@synnaxlabs/pluto 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Animated-C_WGrQwR.cjs → Animated-BGm8tACN.cjs} +1 -1
- package/dist/{Animated-NyYe8Svx.js → Animated-Cg0ftviS.js} +2 -2
- package/dist/{Item-CcXMlZIY.js → Item-B8JWj3fN.js} +5 -5
- package/dist/{Item-DGKnKb6c.cjs → Item-C89uBEra.cjs} +1 -1
- package/dist/{Keyboard-87LPq07J.cjs → Keyboard-B1757gtH.cjs} +1 -1
- package/dist/{Keyboard-i5fqTDMP.js → Keyboard-BAU1UuVp.js} +2 -2
- package/dist/{LinePlot-CCzgiKg5.js → LinePlot-CgkhTRJT.js} +3531 -3360
- package/dist/LinePlot-oIHuM9Jz.cjs +66 -0
- package/dist/Link-BGZki0c9.cjs +1 -0
- package/dist/Link-Du1lxpym.js +14 -0
- package/dist/{List-BjRQA8wb.js → List-KmtaD0qw.js} +2 -2
- package/dist/{List-B3WCj8GQ.cjs → List-e1hOSGSX.cjs} +1 -1
- package/dist/{Pack-BrxYNh7B.js → Pack-CxtceW7N.js} +1 -1
- package/dist/{Pack-C_SrDA3a.cjs → Pack-uflj5a28.cjs} +1 -1
- package/dist/{Text-MNWCdS6X.js → Text-D1VocrR6.js} +5 -5
- package/dist/{Text-XcCNQVZj.cjs → Text-DWBEhfiF.cjs} +1 -1
- package/dist/{Toggle-C1k6Tnpo.js → Toggle-B96EPQ2x.js} +14463 -14342
- package/dist/Toggle-C5E2dVg4.cjs +143 -0
- package/dist/{Video-DR3tjTFZ.cjs → Video-DKosAU7v.cjs} +1 -1
- package/dist/{Video-DdIv_1Yq.js → Video-o34bcpwh.js} +1 -1
- package/dist/{aggregator-f5OfPmNc.js → aggregator-B36SA-20.js} +5061 -4512
- package/dist/aggregator-CU9VgdUJ.cjs +67 -0
- package/dist/align.cjs +1 -1
- package/dist/align.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/color.cjs +1 -1
- package/dist/color.js +1 -1
- package/dist/css-4MXuPP5v.cjs +1 -0
- package/dist/css-C8qHWSpT.js +1085 -0
- package/dist/css.cjs +1 -1
- package/dist/css.js +2 -2
- package/dist/dropdown.cjs +1 -1
- package/dist/dropdown.js +1 -1
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +53 -51
- package/dist/{external-DLa89w3J.cjs → external-BHkFTefx.cjs} +1 -1
- package/dist/{external-CSyZPKK4.cjs → external-BRdQZoOL.cjs} +1 -1
- package/dist/external-BSHY-kgQ.cjs +1 -0
- package/dist/{external-CIvyZ-Hc.js → external-BSqwgq7l.js} +2 -2
- package/dist/external-BdZ8kC55.cjs +1 -0
- package/dist/{external-CDGv7k3p.js → external-BpIfVU6K.js} +12 -12
- package/dist/{external-DAQPXD3z.cjs → external-C-PNFpoV.cjs} +1 -1
- package/dist/{external-DmJZ_zIB.js → external-C2PoeTKJ.js} +2 -2
- package/dist/{external-Cl_evqYY.cjs → external-CPTY4-IY.cjs} +1 -1
- package/dist/{external-n_t7VfzS.js → external-Cc1Bqjmm.js} +1 -1
- package/dist/{external-FeE2ijEU.js → external-Ckdd7teZ.js} +14 -14
- package/dist/{external-BryXmBqR.js → external-CvTy-Tj3.js} +4 -4
- package/dist/external-CxatFj2t.js +1191 -0
- package/dist/{external-DfIxCAg2.js → external-CzrKYxlg.js} +2 -2
- package/dist/{external-DE4i3A2z.cjs → external-DDwIRENP.cjs} +1 -1
- package/dist/{external-BI9DOL9G.js → external-DWm3_4ZA.js} +28 -28
- package/dist/{external-CNrnZ1L5.js → external-DZhjjzue.js} +73 -73
- package/dist/{external-CmbBTupJ.js → external-Dk66psus.js} +20 -20
- package/dist/{external-i13duWIn.cjs → external-GtPAaR7c.cjs} +1 -1
- package/dist/external-Icf6LMl2.cjs +1 -0
- package/dist/{external-C2Ri5xWS.cjs → external-LyF1vgNR.cjs} +1 -1
- package/dist/{external-BUjAebk2.cjs → external-T318T5Xe.cjs} +1 -1
- package/dist/{external-CbjdO9a0.js → external-uvD747pL.js} +31 -31
- package/dist/{external-DjE3je-g.cjs → external-w5-jxIYn.cjs} +1 -1
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2261 -2166
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/src/aether/main.d.ts +1 -0
- package/dist/src/aether/main.d.ts.map +1 -1
- package/dist/src/button/Button.d.ts +8 -2
- package/dist/src/button/Button.d.ts.map +1 -1
- package/dist/src/button/Link.d.ts +2 -1
- package/dist/src/button/Link.d.ts.map +1 -1
- package/dist/src/button/Toggle.d.ts +1 -1
- package/dist/src/dropdown/Dropdown.d.ts.map +1 -1
- package/dist/src/form/Form.d.ts +2 -2
- package/dist/src/form/Form.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/input/Numeric.d.ts.map +1 -1
- package/dist/src/input/types.d.ts +1 -1
- package/dist/src/input/types.d.ts.map +1 -1
- package/dist/src/memo/proxyMemo.d.ts +1 -1
- package/dist/src/memo/proxyMemo.d.ts.map +1 -1
- package/dist/src/modal/Modal.d.ts.map +1 -1
- package/dist/src/override/factory.d.ts +3 -0
- package/dist/src/override/factory.d.ts.map +1 -0
- package/dist/src/override/index.d.ts +2 -0
- package/dist/src/override/index.d.ts.map +1 -0
- package/dist/src/pluto/aether/pluto.d.ts.map +1 -1
- package/dist/src/select/Button.d.ts +1 -1
- package/dist/src/select/Button.d.ts.map +1 -1
- package/dist/src/select/Multiple.d.ts.map +1 -1
- package/dist/src/select/Single.d.ts.map +1 -1
- package/dist/src/status/Aggregator.d.ts +2 -6
- package/dist/src/status/Aggregator.d.ts.map +1 -1
- package/dist/src/status/Circle.d.ts.map +1 -1
- package/dist/src/status/aether/aggregator.d.ts.map +1 -1
- package/dist/src/status/aether/types.d.ts.map +1 -1
- package/dist/src/tabs/Tabs.d.ts +8 -8
- package/dist/src/tabs/Tabs.d.ts.map +1 -1
- package/dist/src/telem/aether/convertSeries.d.ts +2 -2
- package/dist/src/telem/aether/convertSeries.d.ts.map +1 -1
- package/dist/src/telem/aether/noop.d.ts +2 -1
- package/dist/src/telem/aether/noop.d.ts.map +1 -1
- package/dist/src/telem/aether/remote.d.ts.map +1 -1
- package/dist/src/telem/aether/static.d.ts +2 -2
- package/dist/src/telem/client/cache/cache.d.ts +1 -1
- package/dist/src/telem/client/cache/cache.d.ts.map +1 -1
- package/dist/src/telem/client/cache/dynamic.d.ts +3 -3
- package/dist/src/telem/client/cache/dynamic.d.ts.map +1 -1
- package/dist/src/telem/client/cache/static.d.ts +1 -1
- package/dist/src/telem/client/cache/static.d.ts.map +1 -1
- package/dist/src/telem/control/aether/chip.d.ts.map +1 -1
- package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
- package/dist/src/theming/Provider.d.ts.map +1 -1
- package/dist/src/theming/aether/provider.d.ts +5846 -3
- package/dist/src/theming/aether/provider.d.ts.map +1 -1
- package/dist/src/theming/core/fontString.d.ts +1 -1
- package/dist/src/theming/core/fontString.d.ts.map +1 -1
- package/dist/src/theming/core/theme.d.ts +9 -0
- package/dist/src/theming/core/theme.d.ts.map +1 -1
- package/dist/src/theming/css.d.ts.map +1 -1
- package/dist/src/triggers/hooks.d.ts +2 -1
- package/dist/src/triggers/hooks.d.ts.map +1 -1
- package/dist/src/vis/canvas/aether/canvas.d.ts.map +1 -1
- package/dist/src/vis/diagram/aether/Diagram.d.ts +0 -1
- package/dist/src/vis/diagram/aether/Diagram.d.ts.map +1 -1
- package/dist/src/vis/draw2d/index.d.ts +2 -1
- package/dist/src/vis/draw2d/index.d.ts.map +1 -1
- package/dist/src/vis/eraser/aether/eraser.d.ts.map +1 -1
- package/dist/src/vis/line/aether/line.d.ts +3 -1
- package/dist/src/vis/line/aether/line.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/LinePlot.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/axis.d.ts.map +1 -1
- package/dist/src/vis/lineplot/range/aether/annotation.d.ts.map +1 -1
- package/dist/src/vis/log/Log.d.ts +12 -0
- package/dist/src/vis/log/Log.d.ts.map +1 -0
- package/dist/src/vis/log/aether/Log.d.ts +556 -0
- package/dist/src/vis/log/aether/Log.d.ts.map +1 -0
- package/dist/src/vis/log/aether/index.d.ts +2 -0
- package/dist/src/vis/log/aether/index.d.ts.map +1 -0
- package/dist/src/vis/log/index.d.ts +2 -0
- package/dist/src/vis/log/index.d.ts.map +1 -0
- package/dist/src/vis/render/context.d.ts +3 -1
- package/dist/src/vis/render/context.d.ts.map +1 -1
- package/dist/src/vis/schematic/Forms.d.ts.map +1 -1
- package/dist/src/vis/schematic/primitives/Primitives.d.ts +2 -2
- package/dist/src/vis/schematic/primitives/Primitives.d.ts.map +1 -1
- package/dist/src/vis/schematic/registry.d.ts.map +1 -1
- package/dist/src/vis/value/aether/value.d.ts +1 -0
- package/dist/src/vis/value/aether/value.d.ts.map +1 -1
- package/dist/src/vis/value/use.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -2
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -2
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +1 -1
- package/dist/{units-CnA_yWxx.js → units-CmWU_YzJ.js} +1 -1
- package/dist/{units-CMXTKjnN.cjs → units-DbfWaeE2.cjs} +1 -1
- package/dist/video.cjs +1 -1
- package/dist/video.js +1 -1
- package/package.json +20 -22
- package/dist/LinePlot-BcVyfdeK.cjs +0 -66
- package/dist/Link-B83uKMKM.cjs +0 -1
- package/dist/Link-DlC5z0Wm.js +0 -10
- package/dist/Toggle-CIXrEiVA.cjs +0 -143
- package/dist/aggregator-q0CY7-QS.cjs +0 -67
- package/dist/css-B8RwzK24.js +0 -1042
- package/dist/css-LxkguM_s.cjs +0 -1
- package/dist/external-CDChKvhl.cjs +0 -1
- package/dist/external-CN-OhewX.cjs +0 -1
- package/dist/external-cIvhYaqB.cjs +0 -1
- package/dist/external-kSaQF2Vi.js +0 -1169
|
@@ -0,0 +1,1085 @@
|
|
|
1
|
+
var yt = Object.defineProperty;
|
|
2
|
+
var ft = (t, e, r) => e in t ? yt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var z = (t, e, r) => ft(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { z as i } from "zod";
|
|
5
|
+
const J = i.tuple([i.number(), i.number()]);
|
|
6
|
+
i.tuple([i.bigint(), i.bigint()]);
|
|
7
|
+
const xe = i.object({ width: i.number(), height: i.number() }), dt = i.object({
|
|
8
|
+
signedWidth: i.number(),
|
|
9
|
+
signedHeight: i.number()
|
|
10
|
+
}), gt = ["width", "height"];
|
|
11
|
+
i.enum(gt);
|
|
12
|
+
const bt = ["start", "center", "end"], xt = ["signedWidth", "signedHeight"];
|
|
13
|
+
i.enum(xt);
|
|
14
|
+
const _ = i.object({ x: i.number(), y: i.number() }), _e = i.object({ clientX: i.number(), clientY: i.number() }), me = ["x", "y"], we = i.enum(me), Le = ["top", "right", "bottom", "left"], mt = i.enum(Le), K = ["left", "right"], $e = i.enum(K), Q = ["top", "bottom"], ve = i.enum(Q), Oe = ["center"], Ae = i.enum(Oe), wt = [...Le, ...Oe], Me = i.enum(wt);
|
|
15
|
+
i.enum(bt);
|
|
16
|
+
const $t = ["first", "last"];
|
|
17
|
+
i.enum($t);
|
|
18
|
+
const Pe = i.object({ lower: i.number(), upper: i.number() }), vt = i.object({ lower: i.bigint(), upper: i.bigint() });
|
|
19
|
+
i.union([Pe, J]);
|
|
20
|
+
i.union([vt, J]);
|
|
21
|
+
const Ot = i.union([we, Me]), Mt = i.union([we, Me, i.instanceof(String)]), j = (t) => typeof t == "bigint" || t instanceof BigInt, R = (t, e) => j(t) ? t.valueOf() - BigInt(e.valueOf().valueOf()) : t.valueOf() - Number(e.valueOf()), He = (t, e) => j(t) ? t.valueOf() + BigInt(e.valueOf().valueOf()) : t + Number(e.valueOf()), jt = (t, e, r = 1e-4) => Math.abs(t - e) < r, ie = (t, e) => j(t) ? t === BigInt(e.valueOf().valueOf()) : t === Number(e.valueOf()), Tt = (t) => {
|
|
22
|
+
const e = Math.pow(10, Math.floor(Math.log10(t)));
|
|
23
|
+
return Math.round(t / e) * e;
|
|
24
|
+
}, Ze = (t, e) => j(t) ? t.valueOf() < BigInt(e.valueOf()) ? t : BigInt(e.valueOf()) : t.valueOf() < Number(e.valueOf()) ? t : Number(e.valueOf()), It = (t, e) => j(t) ? t.valueOf() > BigInt(e.valueOf()) ? t : BigInt(e.valueOf()) : t.valueOf() > Number(e.valueOf()) ? t : Number(e.valueOf()), We = (t) => j(t) || t instanceof BigInt ? t.valueOf() < 0n ? -t : t : t.valueOf() < 0 ? -t : t, St = (t, e) => j(t) ? t.valueOf() * BigInt(e.valueOf()) : t.valueOf() * Number(e.valueOf()), Et = (t, e) => j(t) ? t.valueOf() / BigInt(e.valueOf()) : t.valueOf() / Number(e.valueOf()), Cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
25
|
+
__proto__: null,
|
|
26
|
+
abs: We,
|
|
27
|
+
add: He,
|
|
28
|
+
closeTo: jt,
|
|
29
|
+
div: Et,
|
|
30
|
+
equal: ie,
|
|
31
|
+
max: It,
|
|
32
|
+
min: Ze,
|
|
33
|
+
mult: St,
|
|
34
|
+
roundToNearestMagnitude: Tt,
|
|
35
|
+
sub: R
|
|
36
|
+
}, Symbol.toStringTag, { value: "Module" })), p = (t, e) => {
|
|
37
|
+
const r = {};
|
|
38
|
+
if (typeof t == "number" || typeof t == "bigint")
|
|
39
|
+
e != null ? (r.lower = t, r.upper = e) : (r.lower = typeof t == "bigint" ? 0n : 0, r.upper = t);
|
|
40
|
+
else if (Array.isArray(t)) {
|
|
41
|
+
if (t.length !== 2) throw new Error("bounds: expected array of length 2");
|
|
42
|
+
[r.lower, r.upper] = t;
|
|
43
|
+
} else return ue(t);
|
|
44
|
+
return ue(r);
|
|
45
|
+
}, Bt = Object.freeze({ lower: 0, upper: 0 }), Nt = Object.freeze({ lower: -1 / 0, upper: 1 / 0 }), zt = Object.freeze({ lower: 0, upper: 1 }), At = Object.freeze({ lower: -1, upper: 1 }), Ct = (t, e) => {
|
|
46
|
+
if (t == null && e == null) return !0;
|
|
47
|
+
if (t == null || e == null) return !1;
|
|
48
|
+
const r = p(t), n = p(e);
|
|
49
|
+
return (r == null ? void 0 : r.lower) === (n == null ? void 0 : n.lower) && (r == null ? void 0 : r.upper) === (n == null ? void 0 : n.upper);
|
|
50
|
+
}, ue = (t) => t.lower > t.upper ? { lower: t.upper, upper: t.lower } : t, Rt = (t, e) => {
|
|
51
|
+
const r = p(t);
|
|
52
|
+
return e < r.lower ? r.lower : e >= r.upper ? r.upper - (typeof r.upper == "number" ? 1 : 1n) : e;
|
|
53
|
+
}, I = (t, e) => {
|
|
54
|
+
const r = p(t);
|
|
55
|
+
if (typeof e == "number" || typeof e == "bigint")
|
|
56
|
+
return e >= r.lower && e < r.upper;
|
|
57
|
+
const n = p(e);
|
|
58
|
+
return n.lower >= r.lower && n.upper <= r.upper;
|
|
59
|
+
}, _t = (t, e) => {
|
|
60
|
+
const r = p(t), n = p(e);
|
|
61
|
+
return r.lower === n.lower ? !0 : n.upper === r.lower || n.lower === r.upper ? !1 : I(r, n.upper) || I(r, n.lower) || I(n, r.upper) || I(n, r.lower);
|
|
62
|
+
}, ee = (t) => {
|
|
63
|
+
const e = p(t);
|
|
64
|
+
return e.upper - e.lower;
|
|
65
|
+
}, Lt = (t) => {
|
|
66
|
+
const e = p(t);
|
|
67
|
+
return typeof e.lower == "bigint" ? e.lower === 0n && e.upper === 0n : e.lower === 0 && e.upper === 0;
|
|
68
|
+
}, Pt = (t) => {
|
|
69
|
+
const e = ee(t);
|
|
70
|
+
return typeof e == "number" ? e === 0 : e === 0n;
|
|
71
|
+
}, Ht = (t) => {
|
|
72
|
+
const e = p(t);
|
|
73
|
+
return typeof e.lower == "bigint" ? !0 : Number.isFinite(e.lower) && Number.isFinite(e.upper);
|
|
74
|
+
}, Zt = (t) => ({
|
|
75
|
+
lower: Math.min(...t.map((e) => p(e).lower)),
|
|
76
|
+
upper: Math.max(...t.map((e) => p(e).upper))
|
|
77
|
+
}), Wt = (t) => ({
|
|
78
|
+
lower: Math.max(...t.map((e) => p(e).lower)),
|
|
79
|
+
upper: Math.min(...t.map((e) => p(e).upper))
|
|
80
|
+
}), Yt = (t) => {
|
|
81
|
+
const e = p(t), r = typeof e.lower == "bigint";
|
|
82
|
+
return Array.from({ length: Number(ee(t)) }, (n, o) => r ? e.lower + BigInt(o) : e.lower + o);
|
|
83
|
+
}, ae = (t, e) => {
|
|
84
|
+
const r = t.map((s) => p(s)), n = r.findIndex((s) => I(s, e) || e < s.lower);
|
|
85
|
+
if (n === -1) return { index: t.length, position: 0 };
|
|
86
|
+
const o = r[n];
|
|
87
|
+
return I(o, e) ? { index: n, position: Number(e - o.lower) } : { index: n, position: 0 };
|
|
88
|
+
}, oe = {
|
|
89
|
+
removeBefore: 0,
|
|
90
|
+
removeAfter: 0,
|
|
91
|
+
insertInto: 0,
|
|
92
|
+
deleteInBetween: 0
|
|
93
|
+
}, Ft = (t, e) => {
|
|
94
|
+
const r = t.map((c) => p(c)), n = p(e);
|
|
95
|
+
if (r.length === 0) return oe;
|
|
96
|
+
const o = ae(r, n.lower), s = ae(r, n.upper);
|
|
97
|
+
if (o.index === t.length) return { ...oe, insertInto: t.length };
|
|
98
|
+
if (s.index === 0) return { ...oe, removeAfter: s.position };
|
|
99
|
+
if (o.index === s.index)
|
|
100
|
+
return o.position !== 0 && s.position !== 0 ? null : {
|
|
101
|
+
removeAfter: s.position,
|
|
102
|
+
removeBefore: o.position,
|
|
103
|
+
insertInto: o.index,
|
|
104
|
+
deleteInBetween: 0
|
|
105
|
+
};
|
|
106
|
+
let u = s.index - o.index, a = o.index, l = R(Number(ee(r[o.index])), o.position);
|
|
107
|
+
return o.position !== 0 ? (u -= 1, a += 1) : l = 0, {
|
|
108
|
+
removeBefore: l,
|
|
109
|
+
removeAfter: s.position,
|
|
110
|
+
insertInto: a,
|
|
111
|
+
deleteInBetween: u
|
|
112
|
+
};
|
|
113
|
+
}, kt = (t, e, r) => {
|
|
114
|
+
const n = t.map((a) => p(a)), o = r > 0 ? 1 : r < 0 ? -1 : 0;
|
|
115
|
+
if (o === 0) return e;
|
|
116
|
+
let s = r, u = e;
|
|
117
|
+
for (; ie(s, 0) === !1; ) {
|
|
118
|
+
const a = n.findIndex((l) => o > 0 ? u >= l.lower && u < l.upper : u > l.lower && u <= l.upper);
|
|
119
|
+
if (a !== -1) {
|
|
120
|
+
const l = n[a];
|
|
121
|
+
let c;
|
|
122
|
+
if (o > 0 ? c = R(l.upper, u) : c = R(u, l.lower), c > 0) {
|
|
123
|
+
const f = Ze(We(s), c);
|
|
124
|
+
if (u = He(
|
|
125
|
+
u,
|
|
126
|
+
o > 0 ? f : -f
|
|
127
|
+
), s = R(s, o > 0 ? f : -f), ie(s, 0)) return u;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (o > 0) {
|
|
132
|
+
const l = n.filter((c) => c.lower > u);
|
|
133
|
+
if (l.length > 0) u = l[0].lower;
|
|
134
|
+
else return u;
|
|
135
|
+
} else {
|
|
136
|
+
const l = n.filter((c) => c.upper < u);
|
|
137
|
+
if (l.length > 0)
|
|
138
|
+
u = l[l.length - 1].upper;
|
|
139
|
+
else return u;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return u;
|
|
143
|
+
}, Xt = (t, e, r) => {
|
|
144
|
+
const n = t.map((u) => p(u));
|
|
145
|
+
if (e === r) return typeof e == "bigint" ? 0n : 0;
|
|
146
|
+
const o = e < r ? p([e, r]) : p([r, e]);
|
|
147
|
+
let s = typeof e == "bigint" ? 0n : 0;
|
|
148
|
+
for (const u of n) {
|
|
149
|
+
const a = u.lower > o.lower ? u.lower : o.lower, l = u.upper < o.upper ? u.upper : o.upper;
|
|
150
|
+
if (a < l) {
|
|
151
|
+
const c = l - a;
|
|
152
|
+
s = s + c;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return s;
|
|
156
|
+
}, Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
157
|
+
__proto__: null,
|
|
158
|
+
CLIP: At,
|
|
159
|
+
DECIMAL: zt,
|
|
160
|
+
INFINITE: Nt,
|
|
161
|
+
ZERO: Bt,
|
|
162
|
+
bounds: Pe,
|
|
163
|
+
buildInsertionPlan: Ft,
|
|
164
|
+
clamp: Rt,
|
|
165
|
+
construct: p,
|
|
166
|
+
contains: I,
|
|
167
|
+
distance: Xt,
|
|
168
|
+
equals: Ct,
|
|
169
|
+
findInsertPosition: ae,
|
|
170
|
+
isFinite: Ht,
|
|
171
|
+
isZero: Lt,
|
|
172
|
+
linspace: Yt,
|
|
173
|
+
makeValid: ue,
|
|
174
|
+
max: Zt,
|
|
175
|
+
min: Wt,
|
|
176
|
+
overlapsWith: _t,
|
|
177
|
+
span: ee,
|
|
178
|
+
spanIsZero: Pt,
|
|
179
|
+
traverse: kt
|
|
180
|
+
}, Symbol.toStringTag, { value: "Module" })), Ye = Ot, T = (t) => me.includes(t) ? t : Q.includes(t) ? "y" : "x", Dt = (t) => T(t) === "x" ? "y" : "x", Vt = (t) => T(t) === "x" ? "width" : "height", qt = (t) => T(t) === "x" ? "left" : "top", Ut = (t) => Ye.safeParse(t).success, Gt = (t) => T(t) === "x" ? "signedWidth" : "signedHeight", Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
181
|
+
__proto__: null,
|
|
182
|
+
construct: T,
|
|
183
|
+
crude: Ye,
|
|
184
|
+
dimension: Vt,
|
|
185
|
+
direction: we,
|
|
186
|
+
isDirection: Ut,
|
|
187
|
+
location: qt,
|
|
188
|
+
signedDimension: Gt,
|
|
189
|
+
swap: Dt
|
|
190
|
+
}, Symbol.toStringTag, { value: "Module" })), Kt = (t) => {
|
|
191
|
+
const e = t.replace(/_[a-z]/g, (r) => r[1].toUpperCase());
|
|
192
|
+
return e.length > 1 && e[0] === e[0].toUpperCase() && e[1] === e[1].toUpperCase() || e.length === 0 ? e : e[0].toLowerCase() + e.slice(1);
|
|
193
|
+
}, Fe = (t) => {
|
|
194
|
+
const e = (r, n = q) => {
|
|
195
|
+
if (typeof r == "string") return t(r);
|
|
196
|
+
if (Array.isArray(r)) return r.map((u) => e(u, n));
|
|
197
|
+
if (!k(r)) return r;
|
|
198
|
+
n = Xe(n);
|
|
199
|
+
const o = {}, s = r;
|
|
200
|
+
return Object.keys(s).forEach((u) => {
|
|
201
|
+
let a = s[u];
|
|
202
|
+
const l = t(u);
|
|
203
|
+
n.recursive && (k(a) ? ce(a, n.keepTypesOnRecursion) || (a = e(a, n)) : n.recursiveInArray && le(a) && (a = [...a].map((c) => {
|
|
204
|
+
let f = c;
|
|
205
|
+
return k(c) ? ce(f, n.keepTypesOnRecursion) || (f = e(c, n)) : le(c) && (f = e({ key: c }, n).key), f;
|
|
206
|
+
}))), o[l] = a;
|
|
207
|
+
}), o;
|
|
208
|
+
};
|
|
209
|
+
return e;
|
|
210
|
+
}, Qt = Fe(Kt), er = (t) => t.replace(/([a-z0-9])([A-Z])/g, (e, r, n) => `${r}_${n.toLowerCase()}`), tr = Fe(er), ke = (t) => t.length === 0 ? t : t[0].toUpperCase() + t.slice(1), q = {
|
|
211
|
+
recursive: !0,
|
|
212
|
+
recursiveInArray: !0,
|
|
213
|
+
keepTypesOnRecursion: [Number, String, Uint8Array]
|
|
214
|
+
}, Xe = (t = q) => (t.recursive == null ? t = q : t.recursiveInArray == null && (t.recursiveInArray = !1), t), le = (t) => t != null && Array.isArray(t), k = (t) => t != null && typeof t == "object" && !Array.isArray(t), ce = (t, e) => (e || []).some((r) => t instanceof r), _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
215
|
+
__proto__: null,
|
|
216
|
+
belongToTypes: ce,
|
|
217
|
+
camelToSnake: tr,
|
|
218
|
+
capitalize: ke,
|
|
219
|
+
defaultOptions: q,
|
|
220
|
+
isArrayObject: le,
|
|
221
|
+
isValidObject: k,
|
|
222
|
+
snakeToCamel: Qt,
|
|
223
|
+
validateOptions: Xe
|
|
224
|
+
}, Symbol.toStringTag, { value: "Module" })), rr = $e, nr = ve, or = {
|
|
225
|
+
top: "bottom",
|
|
226
|
+
right: "left",
|
|
227
|
+
bottom: "top",
|
|
228
|
+
left: "right",
|
|
229
|
+
center: "center"
|
|
230
|
+
}, sr = {
|
|
231
|
+
top: "left",
|
|
232
|
+
right: "top",
|
|
233
|
+
bottom: "right",
|
|
234
|
+
left: "bottom",
|
|
235
|
+
center: "center"
|
|
236
|
+
}, ir = Mt, v = (t) => t instanceof String ? t : me.includes(t) ? t === "x" ? "left" : "top" : t, ur = (t) => or[v(t)], ar = (t) => sr[v(t)], L = (t) => {
|
|
237
|
+
const e = v(t);
|
|
238
|
+
return e === "top" || e === "bottom" ? "y" : "x";
|
|
239
|
+
}, lr = i.object({
|
|
240
|
+
x: $e.or(Ae),
|
|
241
|
+
y: ve.or(Ae)
|
|
242
|
+
}), De = i.object({ x: $e, y: ve }), P = Object.freeze({ x: "left", y: "top" }), je = Object.freeze({ x: "right", y: "top" }), te = Object.freeze({ x: "left", y: "bottom" }), Te = Object.freeze({ x: "right", y: "bottom" }), Ie = Object.freeze({ x: "center", y: "center" }), Ve = Object.freeze({ x: "center", y: "top" }), qe = Object.freeze({ x: "center", y: "bottom" }), Ue = Object.freeze({ x: "right", y: "center" }), Ge = Object.freeze({ x: "left", y: "center" }), cr = Object.freeze([
|
|
243
|
+
Ge,
|
|
244
|
+
Ue,
|
|
245
|
+
Ve,
|
|
246
|
+
qe,
|
|
247
|
+
P,
|
|
248
|
+
je,
|
|
249
|
+
te,
|
|
250
|
+
Te,
|
|
251
|
+
Ie
|
|
252
|
+
]), Se = (t, e) => t.x === e.x && t.y === e.y, pr = (t, e) => {
|
|
253
|
+
if (typeof e == "object") {
|
|
254
|
+
let r = !0;
|
|
255
|
+
return "x" in e && (t.x === e.x || (r = !1)), "y" in e && (t.y === e.y || (r = !1)), r;
|
|
256
|
+
}
|
|
257
|
+
return t.x === e || t.y === e;
|
|
258
|
+
}, Je = (t) => [t.x, t.y], X = (t) => L(v(t)) === "x", hr = (t) => L(v(t)) === "y", yr = (t) => `${t.x}${ke(t.y)}`, fr = (t, e) => {
|
|
259
|
+
let r, n;
|
|
260
|
+
if (typeof t == "object" && "x" in t ? (r = t.x, n = t.y) : (r = v(t), n = v(e ?? t)), L(r) === L(n) && r !== "center" && n !== "center")
|
|
261
|
+
throw new Error(
|
|
262
|
+
`[XYLocation] - encountered two locations with the same direction: ${r.toString()} - ${n.toString()}`
|
|
263
|
+
);
|
|
264
|
+
const o = { ...Ie };
|
|
265
|
+
return r === "center" ? X(n) ? [o.x, o.y] = [n, r] : [o.x, o.y] = [r, n] : n === "center" ? X(r) ? [o.x, o.y] = [r, n] : [o.x, o.y] = [n, r] : X(r) ? [o.x, o.y] = [r, n] : [o.x, o.y] = [n, r], o;
|
|
266
|
+
}, Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
267
|
+
__proto__: null,
|
|
268
|
+
BOTTOM_CENTER: qe,
|
|
269
|
+
BOTTOM_LEFT: te,
|
|
270
|
+
BOTTOM_RIGHT: Te,
|
|
271
|
+
CENTER: Ie,
|
|
272
|
+
CENTER_LOCATIONS: Oe,
|
|
273
|
+
LEFT_CENTER: Ge,
|
|
274
|
+
RIGHT_CENTER: Ue,
|
|
275
|
+
TOP_CENTER: Ve,
|
|
276
|
+
TOP_LEFT: P,
|
|
277
|
+
TOP_RIGHT: je,
|
|
278
|
+
XY_LOCATIONS: cr,
|
|
279
|
+
X_LOCATIONS: K,
|
|
280
|
+
Y_LOCATIONS: Q,
|
|
281
|
+
construct: v,
|
|
282
|
+
constructXY: fr,
|
|
283
|
+
corner: De,
|
|
284
|
+
crude: ir,
|
|
285
|
+
direction: L,
|
|
286
|
+
isX: X,
|
|
287
|
+
isY: hr,
|
|
288
|
+
location: Me,
|
|
289
|
+
outer: mt,
|
|
290
|
+
rotate90: ar,
|
|
291
|
+
swap: ur,
|
|
292
|
+
x: rr,
|
|
293
|
+
xy: lr,
|
|
294
|
+
xyCouple: Je,
|
|
295
|
+
xyEquals: Se,
|
|
296
|
+
xyMatches: pr,
|
|
297
|
+
xyToString: yr,
|
|
298
|
+
y: nr
|
|
299
|
+
}, Symbol.toStringTag, { value: "Module" })), pe = i.union([
|
|
300
|
+
i.number(),
|
|
301
|
+
_,
|
|
302
|
+
J,
|
|
303
|
+
xe,
|
|
304
|
+
dt,
|
|
305
|
+
_e
|
|
306
|
+
]), y = (t, e) => {
|
|
307
|
+
if (typeof t == "string") {
|
|
308
|
+
if (e === void 0) throw new Error("The y coordinate must be given.");
|
|
309
|
+
return t === "x" ? { x: e, y: 0 } : { x: 0, y: e };
|
|
310
|
+
}
|
|
311
|
+
return typeof t == "number" ? { x: t, y: e ?? t } : Array.isArray(t) ? { x: t[0], y: t[1] } : "signedWidth" in t ? { x: t.signedWidth, y: t.signedHeight } : "clientX" in t ? { x: t.clientX, y: t.clientY } : "width" in t ? { x: t.width, y: t.height } : { x: t.x, y: t.y };
|
|
312
|
+
}, m = Object.freeze({ x: 0, y: 0 }), Qe = Object.freeze({ x: 1, y: 1 }), dr = Object.freeze({ x: 1 / 0, y: 1 / 0 }), gr = Object.freeze({ x: NaN, y: NaN }), U = (t, e, r = 0) => {
|
|
313
|
+
const n = y(t), o = y(e);
|
|
314
|
+
return r === 0 ? n.x === o.x && n.y === o.y : Math.abs(n.x - o.x) <= r && Math.abs(n.y - o.y) <= r;
|
|
315
|
+
}, br = (t) => U(t, m), xr = (t, e, r) => {
|
|
316
|
+
const n = y(t), o = y(e, r);
|
|
317
|
+
return { x: n.x * o.x, y: n.y * o.y };
|
|
318
|
+
}, et = (t, e) => {
|
|
319
|
+
const r = y(t);
|
|
320
|
+
return { x: r.x + e, y: r.y };
|
|
321
|
+
}, tt = (t, e) => {
|
|
322
|
+
const r = y(t);
|
|
323
|
+
return { x: r.x, y: r.y + e };
|
|
324
|
+
}, G = (t, e, r, ...n) => typeof e == "string" && typeof r == "number" ? e === "x" ? et(t, r) : tt(t, r) : [t, e, r ?? m, ...n].reduce((o, s) => {
|
|
325
|
+
const u = y(s);
|
|
326
|
+
return { x: o.x + u.x, y: o.y + u.y };
|
|
327
|
+
}, m), mr = (t, e, r) => {
|
|
328
|
+
const n = y(t);
|
|
329
|
+
return e === "x" ? { x: r, y: n.y } : { x: n.x, y: r };
|
|
330
|
+
}, wr = (t, e) => {
|
|
331
|
+
const r = y(t), n = y(e);
|
|
332
|
+
return Math.sqrt((r.x - n.x) ** 2 + (r.y - n.y) ** 2);
|
|
333
|
+
}, $r = (t, e) => {
|
|
334
|
+
const r = y(t), n = y(e);
|
|
335
|
+
return { x: n.x - r.x, y: n.y - r.y };
|
|
336
|
+
}, vr = (t) => {
|
|
337
|
+
const e = y(t);
|
|
338
|
+
return Number.isNaN(e.x) || Number.isNaN(e.y);
|
|
339
|
+
}, Or = (t) => {
|
|
340
|
+
const e = y(t);
|
|
341
|
+
return Number.isFinite(e.x) && Number.isFinite(e.y);
|
|
342
|
+
}, Mr = (t) => {
|
|
343
|
+
const e = y(t);
|
|
344
|
+
return [e.x, e.y];
|
|
345
|
+
}, jr = (t) => {
|
|
346
|
+
const e = y(t);
|
|
347
|
+
return { left: e.x, top: e.y };
|
|
348
|
+
}, he = (t, e = 0) => {
|
|
349
|
+
const r = y(t);
|
|
350
|
+
return { x: Number(r.x.toFixed(e)), y: Number(r.y.toFixed(e)) };
|
|
351
|
+
}, Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
352
|
+
__proto__: null,
|
|
353
|
+
INFINITY: dr,
|
|
354
|
+
NAN: gr,
|
|
355
|
+
ONE: Qe,
|
|
356
|
+
ZERO: m,
|
|
357
|
+
clientXY: _e,
|
|
358
|
+
construct: y,
|
|
359
|
+
couple: Mr,
|
|
360
|
+
crudeZ: pe,
|
|
361
|
+
css: jr,
|
|
362
|
+
distance: wr,
|
|
363
|
+
equals: U,
|
|
364
|
+
isFinite: Or,
|
|
365
|
+
isNan: vr,
|
|
366
|
+
isZero: br,
|
|
367
|
+
scale: xr,
|
|
368
|
+
set: mr,
|
|
369
|
+
translate: G,
|
|
370
|
+
translateX: et,
|
|
371
|
+
translateY: tt,
|
|
372
|
+
translation: $r,
|
|
373
|
+
truncate: he,
|
|
374
|
+
xy: _
|
|
375
|
+
}, Symbol.toStringTag, { value: "Module" })), Z = i.union([i.number(), i.string()]), Tr = i.object({
|
|
376
|
+
top: Z,
|
|
377
|
+
left: Z,
|
|
378
|
+
width: Z,
|
|
379
|
+
height: Z
|
|
380
|
+
}), Ir = i.object({
|
|
381
|
+
left: i.number(),
|
|
382
|
+
top: i.number(),
|
|
383
|
+
right: i.number(),
|
|
384
|
+
bottom: i.number()
|
|
385
|
+
}), Sr = i.object({
|
|
386
|
+
one: _,
|
|
387
|
+
two: _,
|
|
388
|
+
root: De
|
|
389
|
+
}), rt = { one: m, two: m, root: P }, Er = { one: m, two: Qe, root: te }, nt = (t, e) => ({
|
|
390
|
+
one: t.one,
|
|
391
|
+
two: t.two,
|
|
392
|
+
root: e ?? t.root
|
|
393
|
+
}), h = (t, e, r = 0, n = 0, o) => {
|
|
394
|
+
const s = {
|
|
395
|
+
one: { ...m },
|
|
396
|
+
two: { ...m },
|
|
397
|
+
root: o ?? P
|
|
398
|
+
};
|
|
399
|
+
if (typeof t == "number") {
|
|
400
|
+
if (typeof e != "number")
|
|
401
|
+
throw new Error("Box constructor called with invalid arguments");
|
|
402
|
+
return s.one = { x: t, y: e }, s.two = { x: s.one.x + r, y: s.one.y + n }, s;
|
|
403
|
+
}
|
|
404
|
+
return "one" in t && "two" in t && "root" in t ? { ...t, root: o ?? t.root } : ("getBoundingClientRect" in t && (t = t.getBoundingClientRect()), "left" in t ? (s.one = { x: t.left, y: t.top }, s.two = { x: t.right, y: t.bottom }, s) : (s.one = t, e == null ? s.two = { x: s.one.x + r, y: s.one.y + n } : typeof e == "number" ? s.two = { x: s.one.x + e, y: s.one.y + r } : "width" in e ? s.two = {
|
|
405
|
+
x: s.one.x + e.width,
|
|
406
|
+
y: s.one.y + e.height
|
|
407
|
+
} : "signedWidth" in e ? s.two = {
|
|
408
|
+
x: s.one.x + e.signedWidth,
|
|
409
|
+
y: s.one.y + e.signedHeight
|
|
410
|
+
} : s.two = e, s));
|
|
411
|
+
}, Br = (t, e, r) => {
|
|
412
|
+
const n = h(t);
|
|
413
|
+
if (typeof e == "string") {
|
|
414
|
+
if (r == null) throw new Error("Invalid arguments for resize");
|
|
415
|
+
const o = T(e);
|
|
416
|
+
return h(
|
|
417
|
+
n.one,
|
|
418
|
+
void 0,
|
|
419
|
+
o === "x" ? r : O(n),
|
|
420
|
+
o === "y" ? r : M(n),
|
|
421
|
+
n.root
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
return h(n.one, e, void 0, void 0, n.root);
|
|
425
|
+
}, Nr = (t, e, r = !0) => {
|
|
426
|
+
const n = h(t);
|
|
427
|
+
let o = (s, u) => s < u;
|
|
428
|
+
return r && (o = (s, u) => s <= u), "one" in e ? o(w(n), w(e)) && o(S(e), S(n)) && o($(n), $(e)) && o(E(e), E(n)) : o(w(n), e.x) && o(e.x, S(n)) && o($(n), e.y) && o(e.y, E(n));
|
|
429
|
+
}, zr = (t, e) => U(t.one, e.one) && U(t.two, e.two) && Se(t.root, e.root), ot = (t) => ({
|
|
430
|
+
width: O(t),
|
|
431
|
+
height: M(t)
|
|
432
|
+
}), Ar = (t) => ({
|
|
433
|
+
signedWidth: re(t),
|
|
434
|
+
signedHeight: ne(t)
|
|
435
|
+
}), Cr = (t) => ({
|
|
436
|
+
top: $(t),
|
|
437
|
+
left: w(t),
|
|
438
|
+
width: O(t),
|
|
439
|
+
height: M(t)
|
|
440
|
+
}), Ee = (t, e, r = !1) => {
|
|
441
|
+
const n = T(e) === "y" ? ne(t) : re(t);
|
|
442
|
+
return r ? n : Math.abs(n);
|
|
443
|
+
}, H = (t, e) => {
|
|
444
|
+
const r = h(t);
|
|
445
|
+
return {
|
|
446
|
+
x: e.x === "center" ? ye(r).x : B(r, e.x),
|
|
447
|
+
y: e.y === "center" ? ye(r).y : B(r, e.y)
|
|
448
|
+
};
|
|
449
|
+
}, B = (t, e) => {
|
|
450
|
+
const r = h(t), n = Je(r.root).includes(e) ? Math.min : Math.max;
|
|
451
|
+
return K.includes(e) ? n(r.one.x, r.two.x) : n(r.one.y, r.two.y);
|
|
452
|
+
}, Rr = (t) => t.one.x === t.two.x && t.one.y === t.two.y, O = (t) => Ee(t, "x"), M = (t) => Ee(t, "y"), re = (t) => {
|
|
453
|
+
const e = h(t);
|
|
454
|
+
return e.two.x - e.one.x;
|
|
455
|
+
}, ne = (t) => {
|
|
456
|
+
const e = h(t);
|
|
457
|
+
return e.two.y - e.one.y;
|
|
458
|
+
}, st = (t) => H(t, P), _r = (t) => H(t, je), Lr = (t) => H(t, te), Pr = (t) => H(t, Te), S = (t) => B(t, "right"), E = (t) => B(t, "bottom"), w = (t) => B(t, "left"), $ = (t) => B(t, "top"), ye = (t) => G(st(t), {
|
|
459
|
+
x: re(t) / 2,
|
|
460
|
+
y: ne(t) / 2
|
|
461
|
+
}), Be = (t) => {
|
|
462
|
+
const e = h(t);
|
|
463
|
+
return e.root.x === "left" ? w(e) : S(e);
|
|
464
|
+
}, Ne = (t) => {
|
|
465
|
+
const e = h(t);
|
|
466
|
+
return e.root.y === "top" ? $(e) : E(e);
|
|
467
|
+
}, Hr = (t) => ({ x: Be(t), y: Ne(t) }), D = (t) => {
|
|
468
|
+
const e = h(t);
|
|
469
|
+
return { lower: e.one.x, upper: e.two.x };
|
|
470
|
+
}, V = (t) => {
|
|
471
|
+
const e = h(t);
|
|
472
|
+
return { lower: e.one.y, upper: e.two.y };
|
|
473
|
+
}, Zr = (t, e) => nt(t, e), Wr = (t, e) => {
|
|
474
|
+
const r = h(t), n = K.includes(e) ? "x" : Q.includes(e) ? "y" : null;
|
|
475
|
+
if (n === null) throw new Error(`Invalid location: ${Ke}`);
|
|
476
|
+
const o = e === "top" || e === "left" ? Math.min : Math.max, s = { ...r.one }, u = { ...r.two };
|
|
477
|
+
return s[n] = o(r.one[n], r.two[n]), u[n] = o(r.one[n], r.two[n]), [s, u];
|
|
478
|
+
}, Yr = (t, e) => {
|
|
479
|
+
const r = h(t), n = h(e), o = Be(n) + (O(n) - O(r)) / 2, s = Ne(n) + (M(n) - M(r)) / 2;
|
|
480
|
+
return h({ x: o, y: s }, ot(r));
|
|
481
|
+
}, it = (t) => typeof t != "object" || t == null ? !1 : "one" in t && "two" in t && "root" in t, Fr = (t) => O(t) / M(t), kr = (t, e, r) => {
|
|
482
|
+
if (typeof e == "string") {
|
|
483
|
+
if (r == null) throw new Error("Undefined amount passed into box.translate");
|
|
484
|
+
const o = T(e);
|
|
485
|
+
e = y(o, r);
|
|
486
|
+
}
|
|
487
|
+
const n = h(t);
|
|
488
|
+
return h(
|
|
489
|
+
G(n.one, e),
|
|
490
|
+
G(n.two, e),
|
|
491
|
+
void 0,
|
|
492
|
+
void 0,
|
|
493
|
+
n.root
|
|
494
|
+
);
|
|
495
|
+
}, Xr = (t, e) => {
|
|
496
|
+
const r = Math.max(w(t), w(e)), n = Math.max($(t), $(e)), o = Math.min(S(t), S(e)), s = Math.min(E(t), E(e));
|
|
497
|
+
return r > o || n > s ? rt : h({ x: r, y: n }, { x: o, y: s }, void 0, void 0, t.root);
|
|
498
|
+
}, Dr = (t) => O(t) * M(t), Vr = (t, e) => {
|
|
499
|
+
const r = h(t);
|
|
500
|
+
return h(
|
|
501
|
+
he(r.one, e),
|
|
502
|
+
he(r.two, e),
|
|
503
|
+
void 0,
|
|
504
|
+
void 0,
|
|
505
|
+
r.root
|
|
506
|
+
);
|
|
507
|
+
}, qr = (t, e, r, n, o, s) => {
|
|
508
|
+
const u = { x: t, y: e }, a = { x: t + r, y: e + n };
|
|
509
|
+
return o.x !== s.x && (o.x === "center" ? (u.x -= r / 2, a.x -= r / 2) : (u.x -= r, a.x -= r)), o.y !== s.y && (o.y === "center" ? (u.y -= n / 2, a.y -= n / 2) : (u.y -= n, a.y -= n)), h(u, a, void 0, void 0, s);
|
|
510
|
+
}, Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
511
|
+
__proto__: null,
|
|
512
|
+
DECIMAL: Er,
|
|
513
|
+
ZERO: rt,
|
|
514
|
+
area: Dr,
|
|
515
|
+
areaIsZero: Rr,
|
|
516
|
+
aspect: Fr,
|
|
517
|
+
bottom: E,
|
|
518
|
+
bottomLeft: Lr,
|
|
519
|
+
bottomRight: Pr,
|
|
520
|
+
box: Sr,
|
|
521
|
+
center: ye,
|
|
522
|
+
construct: h,
|
|
523
|
+
constructWithAlternateRoot: qr,
|
|
524
|
+
contains: Nr,
|
|
525
|
+
copy: nt,
|
|
526
|
+
css: Cr,
|
|
527
|
+
cssBox: Tr,
|
|
528
|
+
dim: Ee,
|
|
529
|
+
dims: ot,
|
|
530
|
+
domRect: Ir,
|
|
531
|
+
edgePoints: Wr,
|
|
532
|
+
equals: zr,
|
|
533
|
+
height: M,
|
|
534
|
+
intersection: Xr,
|
|
535
|
+
isBox: it,
|
|
536
|
+
left: w,
|
|
537
|
+
loc: B,
|
|
538
|
+
positionInCenter: Yr,
|
|
539
|
+
reRoot: Zr,
|
|
540
|
+
resize: Br,
|
|
541
|
+
right: S,
|
|
542
|
+
root: Hr,
|
|
543
|
+
signedDims: Ar,
|
|
544
|
+
signedHeight: ne,
|
|
545
|
+
signedWidth: re,
|
|
546
|
+
top: $,
|
|
547
|
+
topLeft: st,
|
|
548
|
+
topRight: _r,
|
|
549
|
+
translate: kr,
|
|
550
|
+
truncate: Vr,
|
|
551
|
+
width: O,
|
|
552
|
+
x: Be,
|
|
553
|
+
xBounds: D,
|
|
554
|
+
xyLoc: H,
|
|
555
|
+
y: Ne,
|
|
556
|
+
yBounds: V
|
|
557
|
+
}, Symbol.toStringTag, { value: "Module" })), ut = i.object({ signedWidth: i.number(), signedHeight: i.number() }), Ur = i.union([xe, ut, _, J]), Gr = { width: 0, height: 0 }, Jr = { width: 1, height: 1 }, d = (t, e) => typeof t == "number" ? { width: t, height: e ?? t } : Array.isArray(t) ? { width: t[0], height: t[1] } : "x" in t ? { width: t.x, height: t.y } : "signedWidth" in t ? { width: t.signedWidth, height: t.signedHeight } : { ...t }, Kr = (t, e) => {
|
|
558
|
+
if (e == null) return !1;
|
|
559
|
+
const r = d(t), n = d(e);
|
|
560
|
+
return r.width === n.width && r.height === n.height;
|
|
561
|
+
}, Qr = (t) => {
|
|
562
|
+
const e = d(t);
|
|
563
|
+
return { width: e.height, height: e.width };
|
|
564
|
+
}, en = (t) => {
|
|
565
|
+
const e = d(t);
|
|
566
|
+
return `0 0 ${e.width} ${e.height}`;
|
|
567
|
+
}, tn = (t) => {
|
|
568
|
+
const e = d(t);
|
|
569
|
+
return [e.width, e.height];
|
|
570
|
+
}, rn = (t) => ({
|
|
571
|
+
width: Math.max(...t.map((e) => d(e).width)),
|
|
572
|
+
height: Math.max(...t.map((e) => d(e).height))
|
|
573
|
+
}), nn = (t) => ({
|
|
574
|
+
width: Math.min(...t.map((e) => d(e).width)),
|
|
575
|
+
height: Math.min(...t.map((e) => d(e).height))
|
|
576
|
+
}), on = (t, e) => {
|
|
577
|
+
const r = d(t);
|
|
578
|
+
return { width: r.width * e, height: r.height * e };
|
|
579
|
+
}, Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
580
|
+
__proto__: null,
|
|
581
|
+
DECIMAL: Jr,
|
|
582
|
+
ZERO: Gr,
|
|
583
|
+
construct: d,
|
|
584
|
+
couple: tn,
|
|
585
|
+
crude: Ur,
|
|
586
|
+
dimensions: xe,
|
|
587
|
+
equals: Kr,
|
|
588
|
+
max: rn,
|
|
589
|
+
min: nn,
|
|
590
|
+
scale: on,
|
|
591
|
+
signed: ut,
|
|
592
|
+
svgViewBox: en,
|
|
593
|
+
swap: Qr
|
|
594
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
595
|
+
var sn = Object.defineProperty, un = (t, e, r) => e in t ? sn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, x = (t, e, r) => un(t, typeof e != "symbol" ? e + "" : e, r);
|
|
596
|
+
const an = (t, e, r) => e !== void 0 && t < e ? e : r !== void 0 && t > r ? r : t, ln = i.object({ offset: pe, scale: pe }), cn = (t) => (e, r, n, o) => r === "dimension" ? [e, n] : [
|
|
597
|
+
e,
|
|
598
|
+
o ? n - t : n + t
|
|
599
|
+
], pn = (t) => (e, r, n, o) => [
|
|
600
|
+
e,
|
|
601
|
+
o ? n / t : n * t
|
|
602
|
+
], hn = (t) => (e, r, n) => {
|
|
603
|
+
if (e === null) return [t, n];
|
|
604
|
+
const { lower: o, upper: s } = e, { lower: u, upper: a } = t, l = s - o, c = a - u;
|
|
605
|
+
if (r === "dimension") return [t, n * (c / l)];
|
|
606
|
+
const f = (n - o) * (c / l) + u;
|
|
607
|
+
return [t, f];
|
|
608
|
+
}, yn = (t) => (e, r, n) => [t, n], fn = () => (t, e, r) => {
|
|
609
|
+
if (t === null) throw new Error("cannot invert without bounds");
|
|
610
|
+
if (e === "dimension") return [t, r];
|
|
611
|
+
const { lower: n, upper: o } = t;
|
|
612
|
+
return [t, o - (r - n)];
|
|
613
|
+
}, dn = (t) => (e, r, n) => {
|
|
614
|
+
const { lower: o, upper: s } = t;
|
|
615
|
+
return n = an(n, o, s), [e, n];
|
|
616
|
+
}, fe = class C {
|
|
617
|
+
constructor() {
|
|
618
|
+
x(this, "ops", []), x(this, "currBounds", null), x(this, "currType", null), x(this, "reversed", !1), this.ops = [];
|
|
619
|
+
}
|
|
620
|
+
static translate(e) {
|
|
621
|
+
return new C().translate(e);
|
|
622
|
+
}
|
|
623
|
+
static magnify(e) {
|
|
624
|
+
return new C().magnify(e);
|
|
625
|
+
}
|
|
626
|
+
static scale(e, r) {
|
|
627
|
+
return new C().scale(e, r);
|
|
628
|
+
}
|
|
629
|
+
translate(e) {
|
|
630
|
+
const r = this.new(), n = cn(e);
|
|
631
|
+
return n.type = "translate", r.ops.push(n), r;
|
|
632
|
+
}
|
|
633
|
+
magnify(e) {
|
|
634
|
+
const r = this.new(), n = pn(e);
|
|
635
|
+
return n.type = "magnify", r.ops.push(n), r;
|
|
636
|
+
}
|
|
637
|
+
scale(e, r) {
|
|
638
|
+
const n = p(e, r), o = this.new(), s = hn(n);
|
|
639
|
+
return s.type = "scale", o.ops.push(s), o;
|
|
640
|
+
}
|
|
641
|
+
clamp(e, r) {
|
|
642
|
+
const n = p(e, r), o = this.new(), s = dn(n);
|
|
643
|
+
return s.type = "clamp", o.ops.push(s), o;
|
|
644
|
+
}
|
|
645
|
+
reBound(e, r) {
|
|
646
|
+
const n = p(e, r), o = this.new(), s = yn(n);
|
|
647
|
+
return s.type = "re-bound", o.ops.push(s), o;
|
|
648
|
+
}
|
|
649
|
+
invert() {
|
|
650
|
+
const e = fn();
|
|
651
|
+
e.type = "invert";
|
|
652
|
+
const r = this.new();
|
|
653
|
+
return r.ops.push(e), r;
|
|
654
|
+
}
|
|
655
|
+
pos(e) {
|
|
656
|
+
return this.exec("position", e);
|
|
657
|
+
}
|
|
658
|
+
dim(e) {
|
|
659
|
+
return this.exec("dimension", e);
|
|
660
|
+
}
|
|
661
|
+
new() {
|
|
662
|
+
const e = new C();
|
|
663
|
+
return e.ops = this.ops.slice(), e.reversed = this.reversed, e;
|
|
664
|
+
}
|
|
665
|
+
exec(e, r) {
|
|
666
|
+
return this.currBounds = null, this.ops.reduce(
|
|
667
|
+
([n, o], s) => s(n, e, o, this.reversed),
|
|
668
|
+
[null, r]
|
|
669
|
+
)[1];
|
|
670
|
+
}
|
|
671
|
+
reverse() {
|
|
672
|
+
const e = this.new();
|
|
673
|
+
e.ops.reverse();
|
|
674
|
+
const r = [];
|
|
675
|
+
return e.ops.forEach((n, o) => {
|
|
676
|
+
if (n.type === "scale" || r.some(([u, a]) => o >= u && o <= a))
|
|
677
|
+
return;
|
|
678
|
+
const s = e.ops.findIndex((u, a) => u.type === "scale" && a > o);
|
|
679
|
+
s !== -1 && r.push([o, s]);
|
|
680
|
+
}), r.forEach(([n, o]) => {
|
|
681
|
+
const s = e.ops.slice(n, o);
|
|
682
|
+
s.unshift(e.ops[o]), e.ops.splice(n, o - n + 1, ...s);
|
|
683
|
+
}), e.reversed = !e.reversed, e;
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
x(fe, "IDENTITY", new fe());
|
|
687
|
+
let de = fe;
|
|
688
|
+
const gn = (t) => ({
|
|
689
|
+
scale: {
|
|
690
|
+
x: t.x.dim(1),
|
|
691
|
+
y: t.y.dim(1)
|
|
692
|
+
},
|
|
693
|
+
offset: {
|
|
694
|
+
x: t.x.pos(0),
|
|
695
|
+
y: t.y.pos(0)
|
|
696
|
+
}
|
|
697
|
+
}), ge = class b {
|
|
698
|
+
constructor(e = new de(), r = new de(), n = null) {
|
|
699
|
+
x(this, "x"), x(this, "y"), x(this, "currRoot"), this.x = e, this.y = r, this.currRoot = n;
|
|
700
|
+
}
|
|
701
|
+
static translate(e, r) {
|
|
702
|
+
return new b().translate(e, r);
|
|
703
|
+
}
|
|
704
|
+
static translateX(e) {
|
|
705
|
+
return new b().translateX(e);
|
|
706
|
+
}
|
|
707
|
+
static translateY(e) {
|
|
708
|
+
return new b().translateY(e);
|
|
709
|
+
}
|
|
710
|
+
static clamp(e) {
|
|
711
|
+
return new b().clamp(e);
|
|
712
|
+
}
|
|
713
|
+
static magnify(e) {
|
|
714
|
+
return new b().magnify(e);
|
|
715
|
+
}
|
|
716
|
+
static scale(e) {
|
|
717
|
+
return new b().scale(e);
|
|
718
|
+
}
|
|
719
|
+
static reBound(e) {
|
|
720
|
+
return new b().reBound(e);
|
|
721
|
+
}
|
|
722
|
+
translate(e, r) {
|
|
723
|
+
const n = y(e, r), o = this.copy();
|
|
724
|
+
return o.x = this.x.translate(n.x), o.y = this.y.translate(n.y), o;
|
|
725
|
+
}
|
|
726
|
+
translateX(e) {
|
|
727
|
+
const r = this.copy();
|
|
728
|
+
return r.x = this.x.translate(e), r;
|
|
729
|
+
}
|
|
730
|
+
translateY(e) {
|
|
731
|
+
const r = this.copy();
|
|
732
|
+
return r.y = this.y.translate(e), r;
|
|
733
|
+
}
|
|
734
|
+
magnify(e) {
|
|
735
|
+
const r = this.copy();
|
|
736
|
+
return r.x = this.x.magnify(e.x), r.y = this.y.magnify(e.y), r;
|
|
737
|
+
}
|
|
738
|
+
scale(e) {
|
|
739
|
+
const r = this.copy();
|
|
740
|
+
if (it(e)) {
|
|
741
|
+
const n = this.currRoot;
|
|
742
|
+
return r.currRoot = e.root, n != null && !Se(n, e.root) && (n.x !== e.root.x && (r.x = r.x.invert()), n.y !== e.root.y && (r.y = r.y.invert())), r.x = r.x.scale(D(e)), r.y = r.y.scale(V(e)), r;
|
|
743
|
+
}
|
|
744
|
+
return r.x = r.x.scale(e.width), r.y = r.y.scale(e.height), r;
|
|
745
|
+
}
|
|
746
|
+
reBound(e) {
|
|
747
|
+
const r = this.copy();
|
|
748
|
+
return r.x = this.x.reBound(D(e)), r.y = this.y.reBound(V(e)), r;
|
|
749
|
+
}
|
|
750
|
+
clamp(e) {
|
|
751
|
+
const r = this.copy();
|
|
752
|
+
return r.x = this.x.clamp(D(e)), r.y = this.y.clamp(V(e)), r;
|
|
753
|
+
}
|
|
754
|
+
copy() {
|
|
755
|
+
const e = new b();
|
|
756
|
+
return e.currRoot = this.currRoot, e.x = this.x, e.y = this.y, e;
|
|
757
|
+
}
|
|
758
|
+
reverse() {
|
|
759
|
+
const e = this.copy();
|
|
760
|
+
return e.x = this.x.reverse(), e.y = this.y.reverse(), e;
|
|
761
|
+
}
|
|
762
|
+
pos(e) {
|
|
763
|
+
return { x: this.x.pos(e.x), y: this.y.pos(e.y) };
|
|
764
|
+
}
|
|
765
|
+
box(e) {
|
|
766
|
+
return h(
|
|
767
|
+
this.pos(e.one),
|
|
768
|
+
this.pos(e.two),
|
|
769
|
+
0,
|
|
770
|
+
0,
|
|
771
|
+
this.currRoot ?? e.root
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
x(ge, "IDENTITY", new ge());
|
|
776
|
+
let bn = ge;
|
|
777
|
+
const Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
778
|
+
__proto__: null,
|
|
779
|
+
Scale: de,
|
|
780
|
+
XY: bn,
|
|
781
|
+
crudeXYTransform: ln,
|
|
782
|
+
xyScaleToTransform: gn
|
|
783
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
784
|
+
function at(t) {
|
|
785
|
+
var e, r, n = "";
|
|
786
|
+
if (typeof t == "string" || typeof t == "number") n += t;
|
|
787
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
788
|
+
var o = t.length;
|
|
789
|
+
for (e = 0; e < o; e++) t[e] && (r = at(t[e])) && (n && (n += " "), n += r);
|
|
790
|
+
} else for (r in t) t[r] && (n && (n += " "), n += r);
|
|
791
|
+
return n;
|
|
792
|
+
}
|
|
793
|
+
function xn() {
|
|
794
|
+
for (var t, e, r = 0, n = "", o = arguments.length; r < o; r++) (t = arguments[r]) && (e = at(t)) && (n && (n += " "), n += e);
|
|
795
|
+
return n;
|
|
796
|
+
}
|
|
797
|
+
const mn = xn, Ce = "-", Re = "__", W = "--", lt = (t) => {
|
|
798
|
+
const e = (...r) => mn(...r);
|
|
799
|
+
return e.B = (r) => t + Ce + r, e.E = (r) => t + Re + r, e.M = (r) => t + W + r, e.BM = (r, n) => e.B(r) + W + n, e.BE = (r, n) => e.B(r) + Re + n, e.BEM = (r, n, o) => e.BE(r, n) + W + o, e.extend = (r) => lt(e.B(r)), e.var = (r) => W + t + Ce + r, e;
|
|
800
|
+
}, wn = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, be = i.string().regex(wn), A = i.number().min(0).max(255), $n = i.number().min(0).max(1), ze = i.tuple([A, A, A, $n]), ct = i.tuple([A, A, A]), pt = i.object({ rgba255: ze }), vn = (t) => t == null ? void 0 : new N(t).hex, On = (t) => {
|
|
801
|
+
if (t == null) return;
|
|
802
|
+
const e = N.z.safeParse(t);
|
|
803
|
+
if (e.success) return e.data.rgbaCSS;
|
|
804
|
+
if (typeof t == "string") return t;
|
|
805
|
+
throw e.error;
|
|
806
|
+
}, g = class g {
|
|
807
|
+
/**
|
|
808
|
+
* @constructor Creates a new color from the given color value. The color value can be
|
|
809
|
+
* a hex string, an array of RGB or RGBA values, or another color.
|
|
810
|
+
*
|
|
811
|
+
* @param color - The color value to create the color from. If the color value is a
|
|
812
|
+
* string, it must be a valid hex color (with or without the '#') with a hasheless
|
|
813
|
+
* length 6 or 8. If the hex color is 8 characters long, the last twoc haracters are
|
|
814
|
+
* used as the alpha value. If the color value is an array, it must be an array of
|
|
815
|
+
* length 3 or 4, with each value between 0 and 255. If the color value is another
|
|
816
|
+
* color, the color will be copied.
|
|
817
|
+
*
|
|
818
|
+
* @param alpha - An optional alpha value to set. If the color value carries its own
|
|
819
|
+
* alpha value, this value will be ignored. Defaults to 1.
|
|
820
|
+
*/
|
|
821
|
+
constructor(e, r = 1) {
|
|
822
|
+
/**
|
|
823
|
+
* @property the color as an RGBA tuple, with each color value between 0 and 255,
|
|
824
|
+
* and the alpha value between 0 and 1.
|
|
825
|
+
*/
|
|
826
|
+
z(this, "rgba255");
|
|
827
|
+
if (typeof e == "string")
|
|
828
|
+
this.rgba255 = g.fromHex(e, r);
|
|
829
|
+
else if (Array.isArray(e)) {
|
|
830
|
+
if (e.length < 3 || e.length > 4)
|
|
831
|
+
throw new Error(`Invalid color: [${e.join(", ")}]`);
|
|
832
|
+
this.rgba255 = e.length === 3 ? [...e, r ?? 1] : e;
|
|
833
|
+
} else this.rgba255 = e.rgba255;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* @returns true if the given color is semantically equal to this color. Different
|
|
837
|
+
* representations of the same color are considered equal (e.g. hex and rgba).
|
|
838
|
+
*/
|
|
839
|
+
equals(e) {
|
|
840
|
+
if (e == null) return !1;
|
|
841
|
+
const r = new g(e);
|
|
842
|
+
return this.rgba255.every((n, o) => n === r.rgba255[o]);
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* @returns the hex representation of the color. If the color has an opacity of 1,
|
|
846
|
+
* the returned hex will be 6 characters long. Otherwise, it will be 8 characters
|
|
847
|
+
* long.
|
|
848
|
+
*/
|
|
849
|
+
get hex() {
|
|
850
|
+
const [e, r, n, o] = this.rgba255;
|
|
851
|
+
return `#${Y(e)}${Y(r)}${Y(n)}${o === 1 ? "" : Y(o * 255)}`;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* @returns the color as a CSS RGBA string.
|
|
855
|
+
*/
|
|
856
|
+
get rgbaCSS() {
|
|
857
|
+
const [e, r, n, o] = this.rgba255;
|
|
858
|
+
return `rgba(${e}, ${r}, ${n}, ${o})`;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* @returns the color as a CSS RGB string with no alpha value.
|
|
862
|
+
*/
|
|
863
|
+
get rgbCSS() {
|
|
864
|
+
return `rgb(${this.rgbString})`;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* @returns the color as an RGB string, with each color value between 0 and 255.
|
|
868
|
+
* @example "255, 255, 255"
|
|
869
|
+
*/
|
|
870
|
+
get rgbString() {
|
|
871
|
+
const [e, r, n] = this.rgba255;
|
|
872
|
+
return `${e}, ${r}, ${n}`;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* @returns the color as an RGBA tuple, with each color value between 0 and 1,
|
|
876
|
+
* and the alpha value between 0 and 1.
|
|
877
|
+
*/
|
|
878
|
+
get rgba1() {
|
|
879
|
+
return [...this.rgb1, this.rgba255[3]];
|
|
880
|
+
}
|
|
881
|
+
get rgb1() {
|
|
882
|
+
return [this.rgba255[0] / 255, this.rgba255[1] / 255, this.rgba255[2] / 255];
|
|
883
|
+
}
|
|
884
|
+
/** @returns the red value of the color, between 0 and 255. */
|
|
885
|
+
get r() {
|
|
886
|
+
return this.rgba255[0];
|
|
887
|
+
}
|
|
888
|
+
/** @returns the green value of the color, between 0 and 255. */
|
|
889
|
+
get g() {
|
|
890
|
+
return this.rgba255[1];
|
|
891
|
+
}
|
|
892
|
+
/** @returns the blue value of the color, between 0 and 255. */
|
|
893
|
+
get b() {
|
|
894
|
+
return this.rgba255[2];
|
|
895
|
+
}
|
|
896
|
+
/** @returns the alpha value of the color, between 0 and 1. */
|
|
897
|
+
get a() {
|
|
898
|
+
return this.rgba255[3];
|
|
899
|
+
}
|
|
900
|
+
/** @returns true if all RGBA values are 0. */
|
|
901
|
+
get isZero() {
|
|
902
|
+
return this.equals(ht);
|
|
903
|
+
}
|
|
904
|
+
get hsla() {
|
|
905
|
+
return Tn(this.rgba255);
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Creates a new color with the given alpha.
|
|
909
|
+
*
|
|
910
|
+
* @param alpha - The alpha value to set. If the value is greater than 1, it will be
|
|
911
|
+
* divided by 100.
|
|
912
|
+
* @returns A new color with the given alpha.
|
|
913
|
+
*/
|
|
914
|
+
setAlpha(e) {
|
|
915
|
+
const [r, n, o] = this.rgba255;
|
|
916
|
+
if (e > 100)
|
|
917
|
+
throw new Error(`Color opacity must be between 0 and 100, got ${e}`);
|
|
918
|
+
return e > 1 && (e = e / 100), new g([r, n, o, e]);
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* @returns the luminance of the color, between 0 and 1.
|
|
922
|
+
*/
|
|
923
|
+
get luminance() {
|
|
924
|
+
const [e, r, n] = this.rgb1.map((o) => o <= 0.03928 ? o / 12.92 : ((o + 0.055) / 1.055) ** 2.4);
|
|
925
|
+
return Number((0.2126 * e + 0.7152 * r + 0.0722 * n).toFixed(3));
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* @returns the contrast ratio between this color and the given color. The contrast
|
|
929
|
+
* ratio is a number between 1 and 21, where 1 is the lowest contrast and 21 is the
|
|
930
|
+
* highest.
|
|
931
|
+
* @param other
|
|
932
|
+
* @returns
|
|
933
|
+
*/
|
|
934
|
+
contrast(e) {
|
|
935
|
+
const r = new g(e), n = this.luminance, o = r.luminance;
|
|
936
|
+
return (Math.max(n, o) + 0.5) / (Math.min(n, o) + 0.5);
|
|
937
|
+
}
|
|
938
|
+
pickByContrast(...e) {
|
|
939
|
+
if (e.length === 0)
|
|
940
|
+
throw new Error("[Color.pickByContrast] - must provide at least one color");
|
|
941
|
+
const [r] = e.map((n) => new g(n)).sort((n, o) => this.contrast(o) - this.contrast(n));
|
|
942
|
+
return r;
|
|
943
|
+
}
|
|
944
|
+
get isDark() {
|
|
945
|
+
return this.luminance < 0.5;
|
|
946
|
+
}
|
|
947
|
+
get isLight() {
|
|
948
|
+
return !this.isDark;
|
|
949
|
+
}
|
|
950
|
+
static fromHex(e, r = 1) {
|
|
951
|
+
if (!be.safeParse(e).success) throw new Error(`Invalid hex color: ${e}`);
|
|
952
|
+
return e = Mn(e), [
|
|
953
|
+
F(e, 0),
|
|
954
|
+
F(e, 2),
|
|
955
|
+
F(e, 4),
|
|
956
|
+
e.length === 8 ? F(e, 6) / 255 : r
|
|
957
|
+
];
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
z(g, "z", i.union([be, ze, ct, i.instanceof(g), pt]).transform((e) => new g(e)));
|
|
961
|
+
let N = g;
|
|
962
|
+
const ht = new N([0, 0, 0, 0]), Y = (t) => Math.floor(t).toString(16).padStart(2, "0"), F = (t, e) => parseInt(t.slice(e, e + 2), 16), Mn = (t) => t.startsWith("#") ? t.slice(1) : t, jn = (t) => {
|
|
963
|
+
let [e, r, n] = t;
|
|
964
|
+
const o = t[3];
|
|
965
|
+
e /= 360, r /= 100, n /= 100;
|
|
966
|
+
let s, u, a;
|
|
967
|
+
if (r === 0)
|
|
968
|
+
s = u = a = n;
|
|
969
|
+
else {
|
|
970
|
+
const l = n < 0.5 ? n * (1 + r) : n + r - n * r, c = 2 * n - l;
|
|
971
|
+
s = se(c, l, e + 1 / 3), u = se(c, l, e), a = se(c, l, e - 1 / 3);
|
|
972
|
+
}
|
|
973
|
+
return [Math.round(s * 255), Math.round(u * 255), Math.round(a * 255), o];
|
|
974
|
+
}, se = (t, e, r) => (r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * 6 * r : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t), Tn = (t) => {
|
|
975
|
+
let [e, r, n] = t;
|
|
976
|
+
const o = t[3];
|
|
977
|
+
e /= 255, r /= 255, n /= 255, e /= 255, r /= 255, n /= 255;
|
|
978
|
+
const s = Math.max(e, r, n), u = Math.min(e, r, n);
|
|
979
|
+
let a, l, c = (s + u) / 2;
|
|
980
|
+
if (s === u)
|
|
981
|
+
a = l = 0;
|
|
982
|
+
else {
|
|
983
|
+
const f = s - u;
|
|
984
|
+
l = c > 0.5 ? f / (2 - s - u) : f / (s + u), s === e ? a = (r - n) / f + (r < n ? 6 : 0) : s === r ? a = (n - e) / f + 2 : a = (e - r) / f + 4, a /= 6;
|
|
985
|
+
}
|
|
986
|
+
return a *= 360, l *= 100, c *= 100, [Math.round(a), Math.round(l), Math.round(c), o];
|
|
987
|
+
}, In = i.union([
|
|
988
|
+
be,
|
|
989
|
+
ze,
|
|
990
|
+
i.instanceof(N),
|
|
991
|
+
i.string(),
|
|
992
|
+
ct,
|
|
993
|
+
pt
|
|
994
|
+
]), Wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
995
|
+
__proto__: null,
|
|
996
|
+
Color: N,
|
|
997
|
+
ZERO: ht,
|
|
998
|
+
crudeZ: In,
|
|
999
|
+
cssString: On,
|
|
1000
|
+
fromHSLA: jn,
|
|
1001
|
+
toHex: vn
|
|
1002
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1003
|
+
class Sn {
|
|
1004
|
+
constructor(e = "") {
|
|
1005
|
+
z(this, "rows", []);
|
|
1006
|
+
z(this, "columns", []);
|
|
1007
|
+
z(this, "prefix");
|
|
1008
|
+
this.prefix = e;
|
|
1009
|
+
}
|
|
1010
|
+
row(e, r, n) {
|
|
1011
|
+
const { prefix: o } = this;
|
|
1012
|
+
return this.rows.push({ startLabel: o + e, endLabel: o + r, size: n }), this;
|
|
1013
|
+
}
|
|
1014
|
+
col(e, r, n) {
|
|
1015
|
+
const { prefix: o } = this;
|
|
1016
|
+
return this.columns.push({ startLabel: o + e, endLabel: o + r, size: n }), this;
|
|
1017
|
+
}
|
|
1018
|
+
build() {
|
|
1019
|
+
return {
|
|
1020
|
+
display: "grid",
|
|
1021
|
+
gridTemplateRows: this.rows.map((e, r) => {
|
|
1022
|
+
let n = r === 0 ? "[" : "";
|
|
1023
|
+
return n += `${e.startLabel}] ${e.size}${typeof e.size == "number" ? "px" : ""} [${e.endLabel}`, n += r === this.rows.length - 1 ? "]" : "", n;
|
|
1024
|
+
}).join(" "),
|
|
1025
|
+
gridTemplateColumns: this.columns.map((e, r) => {
|
|
1026
|
+
let n = r === 0 ? "[" : "";
|
|
1027
|
+
return n += `${e.startLabel}] ${e.size}${typeof e.size == "number" ? "px" : ""} [${e.endLabel}`, n += r === this.columns.length - 1 ? "]" : "", n;
|
|
1028
|
+
}).join(" ")
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
const En = (t, e) => Object.entries(e).forEach(
|
|
1033
|
+
([r, n]) => n != null && t.style.setProperty(r, `${n}`)
|
|
1034
|
+
), Bn = (t, e) => Array.from(t.style).forEach((r) => {
|
|
1035
|
+
r.startsWith(e) && t.style.removeProperty(r);
|
|
1036
|
+
}), Nn = (t) => {
|
|
1037
|
+
const e = lt(t);
|
|
1038
|
+
return e.visible = (r) => e.M(r ? "visible" : "hidden"), e.expanded = (r) => e.M(r ? "expanded" : "collapsed"), e.loc = (r) => e.M(Ke.construct(r)), e.disabled = (r) => r === !0 && e.M("disabled"), e.align = (r) => e.M(r), e.dir = (r) => r != null && e.M(Jt.construct(r)), e.size = (r) => typeof r == "string" && e.M(r), e.sharp = (r) => r !== !1 && e.M("sharp"), e.rounded = (r) => r !== !1 && e.M("rounded"), e.bordered = (r) => typeof r == "boolean" ? r && e.M("bordered") : r != null ? e.M("bordered-" + r) : e.M("bordered"), e.selected = (r) => r && e.M("selected"), e.altColor = (r) => r && e.M("alt-color"), e.editable = (r) => r && e.M("editable"), e.noSelect = e.M("no-select"), e.noWrap = (r) => r && e.M("no-wrap"), e.applyVars = En, e.removeVars = Bn, e.newGridBuilder = (r) => new Sn(r), e.dropRegion = (r) => r && e.B("haul-drop-region"), e.px = (r) => `${r}px`, e.inheritDims = (r = !0) => r && e.M("inherit-dims"), e.shade = (r) => e.M(`shade-${r}`), e.shadeVar = (r) => `var(--${t}-gray-l${r})`, e.levelSizeVar = (r) => `var(--${t}-${r}-size)`, e;
|
|
1039
|
+
}, Yn = Nn("pluto");
|
|
1040
|
+
export {
|
|
1041
|
+
Se as $,
|
|
1042
|
+
M as A,
|
|
1043
|
+
pr as B,
|
|
1044
|
+
Yn as C,
|
|
1045
|
+
O as D,
|
|
1046
|
+
Pn as E,
|
|
1047
|
+
Dr as F,
|
|
1048
|
+
Rn as G,
|
|
1049
|
+
Xr as H,
|
|
1050
|
+
ur as I,
|
|
1051
|
+
Ke as J,
|
|
1052
|
+
cr as K,
|
|
1053
|
+
St as M,
|
|
1054
|
+
Rt as T,
|
|
1055
|
+
Xt as U,
|
|
1056
|
+
Cn as W,
|
|
1057
|
+
ht as Z,
|
|
1058
|
+
_n as _,
|
|
1059
|
+
N as a,
|
|
1060
|
+
In as b,
|
|
1061
|
+
On as c,
|
|
1062
|
+
Wn as d,
|
|
1063
|
+
I as e,
|
|
1064
|
+
jn as f,
|
|
1065
|
+
Jt as g,
|
|
1066
|
+
kt as h,
|
|
1067
|
+
p as i,
|
|
1068
|
+
an as j,
|
|
1069
|
+
Qt as k,
|
|
1070
|
+
xn as l,
|
|
1071
|
+
Zn as m,
|
|
1072
|
+
lt as n,
|
|
1073
|
+
Hn as o,
|
|
1074
|
+
lr as p,
|
|
1075
|
+
Ln as q,
|
|
1076
|
+
Me as r,
|
|
1077
|
+
T as s,
|
|
1078
|
+
vn as t,
|
|
1079
|
+
h as u,
|
|
1080
|
+
tr as v,
|
|
1081
|
+
H as w,
|
|
1082
|
+
qr as x,
|
|
1083
|
+
Ie as y,
|
|
1084
|
+
P as z
|
|
1085
|
+
};
|