@synnaxlabs/pluto 0.44.2 → 0.44.5
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-BDoJWl9g.cjs +1 -0
- package/dist/{Animated-D5cL3URg.js → Animated-fI-NFaha.js} +2 -2
- package/dist/{symbols-Lz5vQQDw.js → Editable-C1g_CFYk.js} +7836 -7781
- package/dist/{symbols-B15FeAg9.cjs → Editable-DUtJOqJ5.cjs} +45 -45
- package/dist/LinePlot-6cl8_hmn.cjs +53 -0
- package/dist/{provider-Bp-CLkh2.js → LinePlot-Ck0rhtFk.js} +4563 -4484
- package/dist/{Toggle-Dol9oHzM.js → Toggle-DEJ8Uvun.js} +1 -1
- package/dist/Toggle-DUKDeqpe.cjs +1 -0
- package/dist/{Video-Cm8ZBqid.js → Video-B6tujjr8.js} +1 -1
- package/dist/{Video-BidrtYj_.cjs → Video-BjRd9sFv.cjs} +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-DI0uCCGq.cjs +8 -0
- package/dist/{css-Dl9aM7Jz.js → css-DvIPI3Qm.js} +1407 -1248
- package/dist/css.cjs +1 -1
- package/dist/css.js +2 -2
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/eraser-B03ej59l.cjs +63 -0
- package/dist/{eraser-CZknVTjw.js → eraser-CnRJY__h.js} +6002 -5625
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +66 -63
- package/dist/{external-DOd9BcLC.js → external-B3dPSZUg.js} +7 -8
- package/dist/external-BEd3F7zY.cjs +1 -0
- package/dist/external-BS9S-b49.cjs +1 -0
- package/dist/external-BVDQNHbo.cjs +1 -0
- package/dist/external-BenP6Hcm.cjs +1 -0
- package/dist/external-Blrrgnzw.cjs +1 -0
- package/dist/{external-b2X_jilF.js → external-BzV_PGNe.js} +2 -2
- package/dist/{external-DnnHYQqD.js → external-C2iqWGd2.js} +32 -32
- package/dist/external-CAAPXpVr.cjs +1 -0
- package/dist/{external-BYJw6DJV.js → external-CKhbbig_.js} +25 -25
- package/dist/external-CNF5TNBY.cjs +1 -0
- package/dist/{external-B5RyMtMy.js → external-D16M7vHB.js} +9 -9
- package/dist/{external-pm79tCDD.js → external-D6hAP7eJ.js} +16 -16
- package/dist/external-D98a3YQJ.cjs +1 -0
- package/dist/external-DKh0JhWO.cjs +1 -0
- package/dist/external-DNO3FJLl.cjs +1 -0
- package/dist/{external-BJ91nMtQ.cjs → external-DOEaBrpz.cjs} +2 -2
- package/dist/external-DRuZ24L7.js +78 -0
- package/dist/{external-B_NFroo8.js → external-Daage1AI.js} +4 -4
- package/dist/{external-CU_XHLqP.js → external-Db9iKa8k.js} +3 -3
- package/dist/{external-B8qSW3N8.js → external-Dfr7xymv.js} +3 -3
- package/dist/external-DwRvB5ZT.cjs +1 -0
- package/dist/{external-CJZTgfAH.js → external-GR-20z_c.js} +10 -10
- package/dist/external-I_-aclFy.cjs +1 -0
- package/dist/{external-Ylv9Wts9.js → external-R9a28aP6.js} +55 -56
- package/dist/external-dew29Q0v.js +42 -0
- package/dist/flex.cjs +1 -1
- package/dist/flex.js +1 -1
- package/dist/{fontString-Bm52S4Lo.js → fontString-CW0wLG5g.js} +2 -2
- package/dist/{fontString-BptzSQcY.cjs → fontString-aK--tYMM.cjs} +1 -1
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +10255 -10189
- 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/pluto.css +1 -1
- package/dist/src/channel/AliasInput.d.ts +3 -1
- package/dist/src/channel/AliasInput.d.ts.map +1 -1
- package/dist/src/channel/Select.d.ts.map +1 -1
- package/dist/src/channel/external.d.ts +0 -2
- package/dist/src/channel/external.d.ts.map +1 -1
- package/dist/src/channel/queries.d.ts +84 -6
- package/dist/src/channel/queries.d.ts.map +1 -1
- package/dist/src/dialog/Frame.d.ts.map +1 -1
- package/dist/src/flux/Provider.d.ts +9 -7
- package/dist/src/flux/Provider.d.ts.map +1 -1
- package/dist/src/flux/aether/external.d.ts +4 -3
- package/dist/src/flux/aether/external.d.ts.map +1 -1
- package/dist/src/flux/aether/provider.d.ts +31 -25
- package/dist/src/flux/aether/provider.d.ts.map +1 -1
- package/dist/src/flux/core/client.d.ts +21 -0
- package/dist/src/flux/core/client.d.ts.map +1 -0
- package/dist/src/flux/core/external.d.ts +4 -0
- package/dist/src/flux/core/external.d.ts.map +1 -0
- package/dist/src/flux/core/index.d.ts +2 -0
- package/dist/src/flux/core/index.d.ts.map +1 -0
- package/dist/src/flux/core/params.d.ts.map +1 -0
- package/dist/src/flux/core/store.d.ts +128 -0
- package/dist/src/flux/core/store.d.ts.map +1 -0
- package/dist/src/flux/core/store.spec.d.ts +2 -0
- package/dist/src/flux/core/store.spec.d.ts.map +1 -0
- package/dist/src/flux/core/streamer.d.ts +31 -0
- package/dist/src/flux/core/streamer.d.ts.map +1 -0
- package/dist/src/flux/core/streamer.spec.d.ts.map +1 -0
- package/dist/src/flux/external.d.ts +3 -5
- package/dist/src/flux/external.d.ts.map +1 -1
- package/dist/src/flux/form.d.ts +43 -11
- package/dist/src/flux/form.d.ts.map +1 -1
- package/dist/src/flux/list.d.ts +13 -13
- package/dist/src/flux/list.d.ts.map +1 -1
- package/dist/src/flux/result.d.ts +10 -9
- package/dist/src/flux/result.d.ts.map +1 -1
- package/dist/src/flux/retrieve.d.ts +22 -41
- package/dist/src/flux/retrieve.d.ts.map +1 -1
- package/dist/src/flux/update.d.ts +25 -7
- package/dist/src/flux/update.d.ts.map +1 -1
- package/dist/src/form/Context.d.ts +6 -2
- package/dist/src/form/Context.d.ts.map +1 -1
- package/dist/src/form/state.d.ts +4 -1
- package/dist/src/form/state.d.ts.map +1 -1
- package/dist/src/form/use.d.ts +1 -0
- package/dist/src/form/use.d.ts.map +1 -1
- package/dist/src/hardware/device/queries.d.ts +12 -4
- package/dist/src/hardware/device/queries.d.ts.map +1 -1
- package/dist/src/hardware/rack/external.d.ts +0 -3
- package/dist/src/hardware/rack/external.d.ts.map +1 -1
- package/dist/src/hardware/rack/queries.d.ts +13 -0
- package/dist/src/hardware/rack/queries.d.ts.map +1 -1
- package/dist/src/hardware/task/queries.d.ts +34 -6
- package/dist/src/hardware/task/queries.d.ts.map +1 -1
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/useDestructors.d.ts +7 -0
- package/dist/src/hooks/useDestructors.d.ts.map +1 -0
- package/dist/src/icon/registry.d.ts +1 -0
- package/dist/src/icon/registry.d.ts.map +1 -1
- package/dist/src/label/queries.d.ts +21 -19
- package/dist/src/label/queries.d.ts.map +1 -1
- package/dist/src/menu/ContextMenu.d.ts +1 -0
- package/dist/src/menu/ContextMenu.d.ts.map +1 -1
- package/dist/src/mosaic/Mosaic.d.ts +1 -1
- package/dist/src/mosaic/Mosaic.d.ts.map +1 -1
- package/dist/src/mosaic/tree.d.ts.map +1 -1
- package/dist/src/ontology/queries.d.ts +19 -4
- package/dist/src/ontology/queries.d.ts.map +1 -1
- package/dist/src/pluto/Pluto.d.ts +23 -2
- package/dist/src/pluto/Pluto.d.ts.map +1 -1
- package/dist/src/pluto/aether/pluto.d.ts.map +1 -1
- package/dist/src/ranger/aether/index.d.ts +2 -0
- package/dist/src/ranger/aether/index.d.ts.map +1 -0
- package/dist/src/ranger/aether/queries.d.ts +11 -0
- package/dist/src/ranger/aether/queries.d.ts.map +1 -0
- package/dist/src/ranger/queries.d.ts +31 -25
- package/dist/src/ranger/queries.d.ts.map +1 -1
- package/dist/src/select/Button.d.ts +3 -2
- package/dist/src/select/Button.d.ts.map +1 -1
- package/dist/src/select/use.d.ts +7 -4
- package/dist/src/select/use.d.ts.map +1 -1
- package/dist/src/showcase/TextShowcase.d.ts.map +1 -1
- package/dist/src/state/state.d.ts +1 -1
- package/dist/src/state/state.d.ts.map +1 -1
- package/dist/src/status/Aggregator.d.ts +3 -0
- package/dist/src/status/Aggregator.d.ts.map +1 -1
- package/dist/src/status/Summary.d.ts.map +1 -1
- package/dist/src/status/aether/aggregator.d.ts +2 -12
- package/dist/src/status/aether/aggregator.d.ts.map +1 -1
- package/dist/src/status/aether/errorHandler.d.ts +15 -0
- package/dist/src/status/aether/errorHandler.d.ts.map +1 -0
- package/dist/src/status/aether/errorHandler.spec.d.ts +2 -0
- package/dist/src/status/aether/errorHandler.spec.d.ts.map +1 -0
- package/dist/src/status/aether/external.d.ts +3 -0
- package/dist/src/status/aether/external.d.ts.map +1 -0
- package/dist/src/status/aether/index.d.ts +1 -1
- package/dist/src/status/aether/index.d.ts.map +1 -1
- package/dist/src/synnax/Provider.d.ts.map +1 -1
- package/dist/src/synnax/aether/provider.d.ts +6 -6
- package/dist/src/telem/aether/remote.d.ts +4 -4
- package/dist/src/telem/aether/transformers.d.ts +0 -2
- package/dist/src/telem/aether/transformers.d.ts.map +1 -1
- package/dist/src/telem/aether/transformers.spec.d.ts +2 -0
- package/dist/src/telem/aether/transformers.spec.d.ts.map +1 -0
- package/dist/src/testutil/Synnax.d.ts +6 -1
- package/dist/src/testutil/Synnax.d.ts.map +1 -1
- package/dist/src/text/Editable.d.ts.map +1 -1
- package/dist/src/text/external.d.ts +0 -1
- package/dist/src/text/external.d.ts.map +1 -1
- package/dist/src/triggers/Text.d.ts.map +1 -1
- package/dist/src/triggers/triggers.d.ts +3 -0
- package/dist/src/triggers/triggers.d.ts.map +1 -1
- package/dist/src/viewport/SelectMode.d.ts +10 -2
- package/dist/src/viewport/SelectMode.d.ts.map +1 -1
- package/dist/src/vis/diagram/Diagram.d.ts.map +1 -1
- package/dist/src/vis/legend/Simple.d.ts.map +1 -1
- package/dist/src/vis/line/aether/line.d.ts +0 -1
- package/dist/src/vis/line/aether/line.d.ts.map +1 -1
- package/dist/src/vis/lineplot/Legend.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/XAxis.d.ts +2 -2
- package/dist/src/vis/lineplot/aether/YAxis.d.ts +2 -2
- package/dist/src/vis/lineplot/aether/axis.d.ts +2 -2
- package/dist/src/vis/lineplot/aether/axis.d.ts.map +1 -1
- package/dist/src/vis/lineplot/range/aether/provider.d.ts +6 -18
- package/dist/src/vis/lineplot/range/aether/provider.d.ts.map +1 -1
- package/dist/src/vis/schematic/Forms.d.ts.map +1 -1
- package/dist/src/vis/value/TelemForm.d.ts.map +1 -1
- package/dist/src/workspace/queries.d.ts +8 -0
- package/dist/src/workspace/queries.d.ts.map +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-HcS_zslH.js → units-Dh7MflIZ.js} +3 -3
- package/dist/units-WWUmv-rf.cjs +1 -0
- package/dist/video.cjs +1 -1
- package/dist/video.js +1 -1
- package/package.json +6 -6
- package/dist/Animated-DnsZ5vvU.cjs +0 -1
- package/dist/Menu-C-MABQ1r.js +0 -61
- package/dist/Menu-vR5-lqo4.cjs +0 -1
- package/dist/Toggle-Ckdi4fKV.cjs +0 -1
- package/dist/css-9yccD6t_.cjs +0 -8
- package/dist/eraser-CLWNvWDn.cjs +0 -63
- package/dist/external-BGCkpetp.cjs +0 -1
- package/dist/external-CS6l_QN4.cjs +0 -1
- package/dist/external-CVNscTLA.js +0 -42
- package/dist/external-CY2bvy20.cjs +0 -1
- package/dist/external-CkvXTCCL.cjs +0 -1
- package/dist/external-ClD4VLgc.cjs +0 -1
- package/dist/external-CtooTI5M.cjs +0 -1
- package/dist/external-DFsKdN71.cjs +0 -1
- package/dist/external-DNHOS3w0.cjs +0 -1
- package/dist/external-DPqPAgoV.cjs +0 -1
- package/dist/external-DXY1bIut.cjs +0 -1
- package/dist/external-DZqxSCvz.cjs +0 -1
- package/dist/external-_eEnQPcq.cjs +0 -1
- package/dist/external-xfHaehZH.js +0 -75
- package/dist/provider-DBSsDoFS.cjs +0 -53
- package/dist/src/channel/AliasContext.d.ts +0 -19
- package/dist/src/channel/AliasContext.d.ts.map +0 -1
- package/dist/src/channel/AliasProvider.d.ts +0 -6
- package/dist/src/channel/AliasProvider.d.ts.map +0 -1
- package/dist/src/flux/Context.d.ts +0 -4
- package/dist/src/flux/Context.d.ts.map +0 -1
- package/dist/src/flux/aether/listeners.d.ts +0 -16
- package/dist/src/flux/aether/listeners.d.ts.map +0 -1
- package/dist/src/flux/aether/params.d.ts.map +0 -1
- package/dist/src/flux/aether/streamer.d.ts +0 -22
- package/dist/src/flux/aether/streamer.d.ts.map +0 -1
- package/dist/src/flux/aether/streamer.spec.d.ts.map +0 -1
- package/dist/src/flux/aether/types.d.ts +0 -13
- package/dist/src/flux/aether/types.d.ts.map +0 -1
- package/dist/src/flux/listeners.d.ts +0 -4
- package/dist/src/flux/listeners.d.ts.map +0 -1
- package/dist/src/flux/listeners.spec.d.ts +0 -2
- package/dist/src/flux/listeners.spec.d.ts.map +0 -1
- package/dist/src/flux/useMountListeners.d.ts +0 -7
- package/dist/src/flux/useMountListeners.d.ts.map +0 -1
- package/dist/src/hardware/rack/synchronizers.d.ts +0 -3
- package/dist/src/hardware/rack/synchronizers.d.ts.map +0 -1
- package/dist/src/hardware/rack/use.d.ts +0 -3
- package/dist/src/hardware/rack/use.d.ts.map +0 -1
- package/dist/src/hardware/rack/useStatus.d.ts +0 -3
- package/dist/src/hardware/rack/useStatus.d.ts.map +0 -1
- package/dist/src/text/symbols.d.ts +0 -3
- package/dist/src/text/symbols.d.ts.map +0 -1
- package/dist/units-BGkvnLO-.cjs +0 -1
- /package/dist/src/flux/{aether → core}/params.d.ts +0 -0
- /package/dist/src/flux/{aether → core}/streamer.spec.d.ts +0 -0
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import S, { z as a } from "zod";
|
|
2
|
+
const ln = (t) => {
|
|
3
3
|
const e = t.replace(/_[a-z]/g, (r) => r[1].toUpperCase());
|
|
4
4
|
return e.length > 1 && e[0] === e[0].toUpperCase() && e[1] === e[1].toUpperCase() || e.length === 0 ? e : e[0].toLowerCase() + e.slice(1);
|
|
5
|
-
},
|
|
6
|
-
const e = (r, n =
|
|
5
|
+
}, pt = (t) => {
|
|
6
|
+
const e = (r, n = _e) => {
|
|
7
7
|
if (typeof r == "string") return t(r);
|
|
8
8
|
if (Array.isArray(r)) return r.map((o) => e(o, n));
|
|
9
|
-
if (!
|
|
10
|
-
n =
|
|
9
|
+
if (!He(r)) return r;
|
|
10
|
+
n = fn(n);
|
|
11
11
|
const s = {}, i = r;
|
|
12
12
|
return "toJSON" in i && typeof i.toJSON == "function" ? e(i.toJSON(), n) : (Object.keys(i).forEach((o) => {
|
|
13
13
|
let c = i[o];
|
|
14
|
-
const
|
|
15
|
-
n.recursive && (
|
|
16
|
-
let
|
|
17
|
-
return
|
|
18
|
-
}))), s[
|
|
14
|
+
const h = t(o);
|
|
15
|
+
n.recursive && (He(c) ? zt(c) || (c = e(c, n)) : n.recursiveInArray && kt(c) && (c = [...c].map((l) => {
|
|
16
|
+
let d = l;
|
|
17
|
+
return He(l) ? zt(d) || (d = e(l, n)) : kt(l) && (d = e({ key: l }, n).key), d;
|
|
18
|
+
}))), s[h] = c;
|
|
19
19
|
}), s);
|
|
20
20
|
};
|
|
21
21
|
return e;
|
|
22
|
-
},
|
|
22
|
+
}, mt = pt(ln), cn = (t) => (
|
|
23
23
|
// Don't convert the first character and don't convert a character that is after a
|
|
24
24
|
// non-alphanumeric character
|
|
25
25
|
t.replace(
|
|
26
26
|
/([a-z0-9])([A-Z])/g,
|
|
27
27
|
(e, r, n) => `${r}_${n.toLowerCase()}`
|
|
28
28
|
)
|
|
29
|
-
),
|
|
29
|
+
), Gt = pt(cn), Ht = (t) => t.length === 0 ? t : t[0].toUpperCase() + t.slice(1), hn = [Number, String, Uint8Array], _e = {
|
|
30
30
|
recursive: !0,
|
|
31
31
|
recursiveInArray: !0
|
|
32
|
-
},
|
|
32
|
+
}, fn = (t = _e) => (t.recursive == null ? t = _e : t.recursiveInArray ??= !1, t), kt = (t) => t != null && Array.isArray(t), He = (t) => t != null && typeof t == "object" && !Array.isArray(t), zt = (t) => hn.some((e) => t instanceof e), dn = (t) => t.replace(/\s+/g, "-").replace(
|
|
33
33
|
/([a-z0-9])([A-Z])/g,
|
|
34
34
|
(e, r, n) => `${r}-${n.toLowerCase()}`
|
|
35
|
-
).toLowerCase(),
|
|
35
|
+
).toLowerCase(), gn = pt(dn), wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
36
36
|
__proto__: null,
|
|
37
|
-
camelToSnake:
|
|
38
|
-
capitalize:
|
|
39
|
-
snakeToCamel:
|
|
40
|
-
toKebab:
|
|
37
|
+
camelToSnake: Gt,
|
|
38
|
+
capitalize: Ht,
|
|
39
|
+
snakeToCamel: mt,
|
|
40
|
+
toKebab: gn
|
|
41
41
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
42
|
-
let
|
|
42
|
+
let pn = class {
|
|
43
43
|
contentType = "application/json";
|
|
44
44
|
decoder;
|
|
45
45
|
encoder;
|
|
@@ -53,15 +53,15 @@ let un = class {
|
|
|
53
53
|
return this.decodeString(this.decoder.decode(e), r);
|
|
54
54
|
}
|
|
55
55
|
decodeString(e, r) {
|
|
56
|
-
const n = JSON.parse(e), s =
|
|
56
|
+
const n = JSON.parse(e), s = mt(n);
|
|
57
57
|
return r != null ? r.parse(s) : s;
|
|
58
58
|
}
|
|
59
59
|
encodeString(e) {
|
|
60
|
-
const r =
|
|
60
|
+
const r = Gt(e);
|
|
61
61
|
return JSON.stringify(r, (n, s) => ArrayBuffer.isView(s) ? Array.from(s) : typeof s == "bigint" ? s.toString() : s);
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
const
|
|
64
|
+
const et = new pn(), tt = (t) => [...new Set(t)], mn = (t, e, r = !0) => {
|
|
65
65
|
const n = /* @__PURE__ */ new Map();
|
|
66
66
|
return t.forEach((s) => {
|
|
67
67
|
const i = e(s);
|
|
@@ -71,12 +71,12 @@ const He = new un(), Je = (t) => [...new Set(t)], ln = (t, e, r = !0) => {
|
|
|
71
71
|
}
|
|
72
72
|
n.set(i, s);
|
|
73
73
|
}), Array.from(n.values());
|
|
74
|
-
},
|
|
74
|
+
}, vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
75
75
|
__proto__: null,
|
|
76
|
-
by:
|
|
77
|
-
unique:
|
|
76
|
+
by: mn,
|
|
77
|
+
unique: tt
|
|
78
78
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
79
|
-
let
|
|
79
|
+
let _ = class {
|
|
80
80
|
/** The underlying primitive value */
|
|
81
81
|
value;
|
|
82
82
|
constructor(e) {
|
|
@@ -96,8 +96,8 @@ let J = class {
|
|
|
96
96
|
return this.value.toString();
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
99
|
+
const yt = (t) => t != null && typeof t == "object" && "toString" in t, Jt = (t) => {
|
|
100
|
+
if (yt(t)) return t?.toString().length === 0;
|
|
101
101
|
switch (typeof t) {
|
|
102
102
|
case "string":
|
|
103
103
|
return t.length === 0;
|
|
@@ -114,13 +114,14 @@ const ht = (t) => t != null && typeof t == "object" && "toString" in t, cn = (t)
|
|
|
114
114
|
default:
|
|
115
115
|
return !1;
|
|
116
116
|
}
|
|
117
|
-
},
|
|
117
|
+
}, yn = (t) => !Jt(t), xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
118
118
|
__proto__: null,
|
|
119
|
-
ValueExtension:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
ValueExtension: _,
|
|
120
|
+
isNonZero: yn,
|
|
121
|
+
isStringer: yt,
|
|
122
|
+
isZero: Jt
|
|
123
|
+
}, Symbol.toStringTag, { value: "Module" })), De = (t, e = !1) => {
|
|
124
|
+
const r = yt(t) ? "stringer" : typeof t;
|
|
124
125
|
let n;
|
|
125
126
|
switch (r) {
|
|
126
127
|
case "string":
|
|
@@ -144,69 +145,80 @@ const ht = (t) => t != null && typeof t == "object" && "toString" in t, cn = (t)
|
|
|
144
145
|
default:
|
|
145
146
|
return console.warn(`sortFunc: unknown type ${r}`), () => -1;
|
|
146
147
|
}
|
|
147
|
-
return e ?
|
|
148
|
-
},
|
|
149
|
-
const n =
|
|
148
|
+
return e ? Kt(n) : n;
|
|
149
|
+
}, bn = (t, e, r) => {
|
|
150
|
+
const n = De(e[t], r);
|
|
150
151
|
return (s, i) => n(s[t], i[t]);
|
|
151
|
-
},
|
|
152
|
+
}, wn = (t, e) => t.length !== e.length ? t.length - e.length : t.every((r, n) => r === e[n]) ? 0 : -1, Xt = (t, e) => {
|
|
152
153
|
if (t.length !== e.length) return t.length - e.length;
|
|
153
154
|
if (t.length === 0) return 0;
|
|
154
|
-
const r =
|
|
155
|
+
const r = De(t[0]), n = [...t].sort(r), s = [...e].sort(r);
|
|
155
156
|
return n.every((i, o) => i === s[o]) ? 0 : -1;
|
|
156
|
-
},
|
|
157
|
-
const r =
|
|
158
|
-
return
|
|
159
|
-
},
|
|
157
|
+
}, On = (t, e) => {
|
|
158
|
+
const r = tt(t), n = tt(e);
|
|
159
|
+
return Xt(r, n);
|
|
160
|
+
}, vn = (t, e) => t === e ? 0 : t === "first" && e === "last" ? 1 : -1, Kt = (t) => (e, r) => t(r, e), ne = 0, Ie = -1, Me = 1, Qt = (t) => t < ne, _t = (t) => t > ne, Tn = (t) => t >= ne, er = (t) => t === ne, xn = (t, e) => {
|
|
160
161
|
const r = /([a-zA-Z]+)|(\d+)/g, n = t.replace(/[\s_.-]+/g, "").match(r), s = e.replace(/[\s_.-]+/g, "").match(r);
|
|
161
162
|
if (!n || !s) return 0;
|
|
162
163
|
for (let i = 0; i < Math.min(n.length, s.length); i++) {
|
|
163
164
|
const o = n[i], c = s[i];
|
|
164
165
|
if (isNaN(Number(o)) && isNaN(Number(c))) {
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
166
|
+
const h = o.localeCompare(c);
|
|
167
|
+
if (h !== 0) return h;
|
|
167
168
|
} else if (!isNaN(Number(o)) && !isNaN(Number(c))) {
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
169
|
+
const h = Number(o) - Number(c);
|
|
170
|
+
if (h !== 0) return h;
|
|
170
171
|
} else return isNaN(Number(o)) ? -1 : 1;
|
|
171
172
|
}
|
|
172
173
|
return n.length - s.length;
|
|
173
|
-
},
|
|
174
|
+
}, $o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
174
175
|
__proto__: null,
|
|
175
|
-
EQUAL:
|
|
176
|
-
GREATER_THAN:
|
|
177
|
-
LESS_THAN:
|
|
178
|
-
isEqualTo:
|
|
179
|
-
isGreaterThan:
|
|
180
|
-
isGreaterThanEqual:
|
|
181
|
-
isLessThan:
|
|
182
|
-
newF:
|
|
183
|
-
newFieldF:
|
|
184
|
-
order:
|
|
185
|
-
primitiveArrays:
|
|
186
|
-
reverseF:
|
|
187
|
-
stringsWithNumbers:
|
|
188
|
-
uniqueUnorderedPrimitiveArrays:
|
|
189
|
-
unorderedPrimitiveArrays:
|
|
190
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
176
|
+
EQUAL: ne,
|
|
177
|
+
GREATER_THAN: Me,
|
|
178
|
+
LESS_THAN: Ie,
|
|
179
|
+
isEqualTo: er,
|
|
180
|
+
isGreaterThan: _t,
|
|
181
|
+
isGreaterThanEqual: Tn,
|
|
182
|
+
isLessThan: Qt,
|
|
183
|
+
newF: De,
|
|
184
|
+
newFieldF: bn,
|
|
185
|
+
order: vn,
|
|
186
|
+
primitiveArrays: wn,
|
|
187
|
+
reverseF: Kt,
|
|
188
|
+
stringsWithNumbers: xn,
|
|
189
|
+
uniqueUnorderedPrimitiveArrays: On,
|
|
190
|
+
unorderedPrimitiveArrays: Xt
|
|
191
|
+
}, Symbol.toStringTag, { value: "Module" })), Pe = a.tuple([a.number(), a.number()]);
|
|
191
192
|
a.tuple([a.bigint(), a.bigint()]);
|
|
192
|
-
const
|
|
193
|
+
const bt = a.object({ width: a.number(), height: a.number() }), $n = a.object({
|
|
193
194
|
signedWidth: a.number(),
|
|
194
195
|
signedHeight: a.number()
|
|
195
|
-
}),
|
|
196
|
-
a.enum(
|
|
197
|
-
const
|
|
198
|
-
a.enum(
|
|
199
|
-
const
|
|
200
|
-
a.enum(
|
|
201
|
-
const
|
|
202
|
-
a.enum(
|
|
203
|
-
const
|
|
204
|
-
a.union([
|
|
205
|
-
a.union([
|
|
206
|
-
const
|
|
196
|
+
}), Sn = ["width", "height"];
|
|
197
|
+
a.enum(Sn);
|
|
198
|
+
const Nn = ["start", "center", "end"], In = ["signedWidth", "signedHeight"];
|
|
199
|
+
a.enum(In);
|
|
200
|
+
const ge = a.object({ x: a.number(), y: a.number() }), tr = a.object({ clientX: a.number(), clientY: a.number() }), qe = ["x", "y"], wt = a.enum(qe), rr = ["top", "right", "bottom", "left"], Mn = a.enum(rr), ke = ["left", "right"], Ot = a.enum(ke), ze = ["top", "bottom"], vt = a.enum(ze), Tt = ["center"], rt = a.enum(Tt), En = [...rr, ...Tt], xt = a.enum(En);
|
|
201
|
+
a.enum(Nn);
|
|
202
|
+
const An = ["first", "last"];
|
|
203
|
+
a.enum(An);
|
|
204
|
+
const nr = a.object({ lower: a.number(), upper: a.number() }), Bn = a.object({ lower: a.bigint(), upper: a.bigint() });
|
|
205
|
+
a.union([nr, Pe]);
|
|
206
|
+
a.union([Bn, Pe]);
|
|
207
|
+
const Un = a.enum([...wt.options, ...xt.options]), Cn = a.union([wt, xt, a.instanceof(String)]), se = (t) => (e, r) => {
|
|
208
|
+
if (typeof e == "bigint") {
|
|
209
|
+
if (je(r))
|
|
210
|
+
return t(e, BigInt(r));
|
|
211
|
+
const n = t(Number(e), Number(r));
|
|
212
|
+
return typeof n == "number" ? BigInt(Math.round(n)) : n;
|
|
213
|
+
}
|
|
214
|
+
return t(Number(e), Number(r));
|
|
215
|
+
}, P = se((t, e) => t - e), ie = se((t, e) => t + e), jn = (t, e, r = 1e-4) => Math.abs(t - e) < r, nt = (t, e) => {
|
|
216
|
+
const r = typeof t == "bigint", n = typeof e == "bigint";
|
|
217
|
+
return r && n ? t === e : r && je(e) ? t === BigInt(e) : n && je(t) ? e === BigInt(t) : t === e;
|
|
218
|
+
}, Rn = (t) => {
|
|
207
219
|
const e = 10 ** Math.floor(Math.log10(t));
|
|
208
220
|
return Math.round(t / e) * e;
|
|
209
|
-
},
|
|
221
|
+
}, sr = se((t, e) => t <= e ? t : e), je = (t) => typeof t == "bigint" ? !0 : Number.isInteger(t), Ln = se((t, e) => t >= e ? t : e), ir = (t) => typeof t == "bigint" ? t < 0n ? -t : t : t < 0 ? -t : t, B = se((t, e) => t * e), we = se((t, e) => t / e), y = (t, e, r) => {
|
|
210
222
|
const n = {};
|
|
211
223
|
if (typeof e == "object" && (r = e, e = void 0), r = { makeValid: !0, ...r }, typeof t == "number" || typeof t == "bigint")
|
|
212
224
|
e != null ? (n.lower = t, n.upper = e) : (n.lower = typeof t == "bigint" ? 0n : 0, n.upper = t);
|
|
@@ -215,64 +227,64 @@ const Sn = a.enum([...dt.options, ...mt.options]), Nn = a.union([dt, mt, a.insta
|
|
|
215
227
|
[n.lower, n.upper] = t;
|
|
216
228
|
} else
|
|
217
229
|
n.lower = t.lower, n.upper = t.upper;
|
|
218
|
-
return r?.makeValid ?
|
|
219
|
-
},
|
|
230
|
+
return r?.makeValid ? ar(n) : n;
|
|
231
|
+
}, Dn = Object.freeze({ lower: 0, upper: 0 }), Pn = Object.freeze({ lower: -1 / 0, upper: 1 / 0 }), qn = Object.freeze({ lower: 0, upper: 1 }), kn = Object.freeze({ lower: -1, upper: 1 }), zn = (t, e) => {
|
|
220
232
|
if (t == null && e == null) return !0;
|
|
221
233
|
if (t == null || e == null) return !1;
|
|
222
234
|
const r = y(t), n = y(e);
|
|
223
235
|
return r?.lower === n?.lower && r?.upper === n?.upper;
|
|
224
|
-
},
|
|
236
|
+
}, ar = (t) => t.lower > t.upper ? { lower: t.upper, upper: t.lower } : t, st = (t, e) => {
|
|
225
237
|
const r = y(t);
|
|
226
238
|
return e < r.lower ? r.lower : e >= r.upper ? r.upper - (typeof r.upper == "number" ? 1 : 1n) : e;
|
|
227
|
-
},
|
|
239
|
+
}, U = (t, e) => {
|
|
228
240
|
const r = y(t);
|
|
229
241
|
if (typeof e == "number" || typeof e == "bigint")
|
|
230
242
|
return e >= r.lower && e < r.upper;
|
|
231
243
|
const n = y(e);
|
|
232
244
|
return n.lower >= r.lower && n.upper <= r.upper;
|
|
233
|
-
},
|
|
245
|
+
}, Fn = (t, e) => {
|
|
234
246
|
const r = y(t), n = y(e);
|
|
235
|
-
return r.lower === n.lower ? !0 : n.upper === r.lower || n.lower === r.upper ? !1 :
|
|
236
|
-
},
|
|
247
|
+
return r.lower === n.lower ? !0 : n.upper === r.lower || n.lower === r.upper ? !1 : U(r, n.upper) || U(r, n.lower) || U(n, r.upper) || U(n, r.lower);
|
|
248
|
+
}, Oe = (t) => {
|
|
237
249
|
const e = y(t);
|
|
238
250
|
return e.upper - e.lower;
|
|
239
|
-
},
|
|
251
|
+
}, Zn = (t) => {
|
|
240
252
|
const e = y(t);
|
|
241
253
|
return typeof e.lower == "bigint" ? e.lower === 0n && e.upper === 0n : e.lower === 0 && e.upper === 0;
|
|
242
|
-
},
|
|
243
|
-
const e =
|
|
254
|
+
}, Yn = (t) => {
|
|
255
|
+
const e = Oe(t);
|
|
244
256
|
return typeof e == "number" ? e === 0 : e === 0n;
|
|
245
|
-
},
|
|
257
|
+
}, Wn = (t) => {
|
|
246
258
|
const e = y(t);
|
|
247
259
|
return typeof e.lower == "bigint" ? !0 : Number.isFinite(e.lower) && Number.isFinite(e.upper);
|
|
248
|
-
},
|
|
260
|
+
}, Vn = (t) => {
|
|
249
261
|
const e = y(t);
|
|
250
262
|
return (e.upper + e.lower) / 2;
|
|
251
|
-
},
|
|
263
|
+
}, or = (t) => ({
|
|
252
264
|
lower: Math.min(...t.map((e) => y(e).lower)),
|
|
253
265
|
upper: Math.max(...t.map((e) => y(e).upper))
|
|
254
|
-
}),
|
|
266
|
+
}), Gn = (t) => ({
|
|
255
267
|
lower: Math.max(...t.map((e) => y(e).lower)),
|
|
256
268
|
upper: Math.min(...t.map((e) => y(e).upper))
|
|
257
|
-
}),
|
|
269
|
+
}), Hn = (t) => {
|
|
258
270
|
const e = y(t), r = typeof e.lower == "bigint";
|
|
259
|
-
return Array.from({ length: Number(
|
|
260
|
-
},
|
|
261
|
-
const r = t.map((i) => y(i)), n = r.findIndex((i) =>
|
|
271
|
+
return Array.from({ length: Number(Oe(t)) }, (n, s) => r ? e.lower + BigInt(s) : e.lower + s);
|
|
272
|
+
}, it = (t, e) => {
|
|
273
|
+
const r = t.map((i) => y(i)), n = r.findIndex((i) => U(i, e) || e < i.lower);
|
|
262
274
|
if (n === -1) return { index: t.length, position: 0 };
|
|
263
275
|
const s = r[n];
|
|
264
|
-
return
|
|
265
|
-
},
|
|
276
|
+
return U(s, e) ? { index: n, position: Number(e - s.lower) } : { index: n, position: 0 };
|
|
277
|
+
}, Je = {
|
|
266
278
|
removeBefore: 0,
|
|
267
279
|
removeAfter: 0,
|
|
268
280
|
insertInto: 0,
|
|
269
281
|
deleteInBetween: 0
|
|
270
|
-
},
|
|
271
|
-
const r = t.map((
|
|
272
|
-
if (r.length === 0) return
|
|
273
|
-
const s =
|
|
274
|
-
if (s.index === t.length) return { ...
|
|
275
|
-
if (i.index === 0) return { ...
|
|
282
|
+
}, Jn = (t, e) => {
|
|
283
|
+
const r = t.map((l) => y(l)), n = y(e);
|
|
284
|
+
if (r.length === 0) return Je;
|
|
285
|
+
const s = it(r, n.lower), i = it(r, n.upper);
|
|
286
|
+
if (s.index === t.length) return { ...Je, insertInto: t.length };
|
|
287
|
+
if (i.index === 0) return { ...Je, removeAfter: i.position };
|
|
276
288
|
if (s.index === i.index)
|
|
277
289
|
return s.position !== 0 && i.position !== 0 ? null : {
|
|
278
290
|
removeAfter: i.position,
|
|
@@ -280,314 +292,314 @@ const Sn = a.enum([...dt.options, ...mt.options]), Nn = a.union([dt, mt, a.insta
|
|
|
280
292
|
insertInto: s.index,
|
|
281
293
|
deleteInBetween: 0
|
|
282
294
|
};
|
|
283
|
-
let o = i.index - s.index, c = s.index,
|
|
284
|
-
return s.position !== 0 ? (o -= 1, c += 1) :
|
|
285
|
-
removeBefore:
|
|
295
|
+
let o = i.index - s.index, c = s.index, h = P(Number(Oe(r[s.index])), s.position);
|
|
296
|
+
return s.position !== 0 ? (o -= 1, c += 1) : h = 0, {
|
|
297
|
+
removeBefore: h,
|
|
286
298
|
removeAfter: i.position,
|
|
287
299
|
insertInto: c,
|
|
288
300
|
deleteInBetween: o
|
|
289
301
|
};
|
|
290
|
-
},
|
|
302
|
+
}, ur = (t, e, r) => {
|
|
291
303
|
const n = t.map((c) => y(c)), s = r > 0 ? 1 : r < 0 ? -1 : 0;
|
|
292
304
|
if (s === 0) return e;
|
|
293
305
|
let i = r, o = e;
|
|
294
|
-
for (;
|
|
295
|
-
const c = n.findIndex((
|
|
306
|
+
for (; nt(i, 0) === !1; ) {
|
|
307
|
+
const c = n.findIndex((h) => s > 0 ? o >= h.lower && o < h.upper : o > h.lower && o <= h.upper);
|
|
296
308
|
if (c !== -1) {
|
|
297
|
-
const
|
|
298
|
-
let
|
|
299
|
-
if (s > 0 ?
|
|
300
|
-
const
|
|
301
|
-
if (o =
|
|
309
|
+
const h = n[c];
|
|
310
|
+
let l;
|
|
311
|
+
if (s > 0 ? l = P(h.upper, o) : l = P(o, h.lower), l > 0) {
|
|
312
|
+
const d = sr(ir(i), l);
|
|
313
|
+
if (o = ie(
|
|
302
314
|
o,
|
|
303
|
-
s > 0 ?
|
|
304
|
-
), i =
|
|
315
|
+
s > 0 ? d : -d
|
|
316
|
+
), i = P(i, s > 0 ? d : -d), nt(i, 0)) return o;
|
|
305
317
|
continue;
|
|
306
318
|
}
|
|
307
319
|
}
|
|
308
320
|
if (s > 0) {
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
321
|
+
const h = n.filter((l) => l.lower > o);
|
|
322
|
+
if (h.length > 0) o = h[0].lower;
|
|
311
323
|
else return o;
|
|
312
324
|
} else {
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
315
|
-
o =
|
|
325
|
+
const h = n.filter((l) => l.upper < o);
|
|
326
|
+
if (h.length > 0)
|
|
327
|
+
o = h[h.length - 1].upper;
|
|
316
328
|
else return o;
|
|
317
329
|
}
|
|
318
330
|
}
|
|
319
331
|
return o;
|
|
320
|
-
},
|
|
332
|
+
}, lr = (t, e, r) => {
|
|
321
333
|
const n = t.map((o) => y(o));
|
|
322
334
|
if (e === r) return typeof e == "bigint" ? 0n : 0;
|
|
323
335
|
const s = e < r ? y([e, r]) : y([r, e]);
|
|
324
336
|
let i = typeof e == "bigint" ? 0n : 0;
|
|
325
337
|
for (const o of n) {
|
|
326
|
-
const c = o.lower > s.lower ? o.lower : s.lower,
|
|
327
|
-
if (c <
|
|
328
|
-
const
|
|
329
|
-
i = i +
|
|
338
|
+
const c = o.lower > s.lower ? o.lower : s.lower, h = o.upper < s.upper ? o.upper : s.upper;
|
|
339
|
+
if (c < h) {
|
|
340
|
+
const l = h - c;
|
|
341
|
+
i = i + l;
|
|
330
342
|
}
|
|
331
343
|
}
|
|
332
344
|
return i;
|
|
333
|
-
},
|
|
345
|
+
}, So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
334
346
|
__proto__: null,
|
|
335
|
-
CLIP:
|
|
336
|
-
DECIMAL:
|
|
337
|
-
INFINITE:
|
|
338
|
-
ZERO:
|
|
339
|
-
bounds:
|
|
340
|
-
buildInsertionPlan:
|
|
341
|
-
clamp:
|
|
347
|
+
CLIP: kn,
|
|
348
|
+
DECIMAL: qn,
|
|
349
|
+
INFINITE: Pn,
|
|
350
|
+
ZERO: Dn,
|
|
351
|
+
bounds: nr,
|
|
352
|
+
buildInsertionPlan: Jn,
|
|
353
|
+
clamp: st,
|
|
342
354
|
construct: y,
|
|
343
|
-
contains:
|
|
344
|
-
distance:
|
|
345
|
-
equals:
|
|
346
|
-
findInsertPosition:
|
|
347
|
-
isFinite:
|
|
348
|
-
isZero:
|
|
349
|
-
linspace:
|
|
350
|
-
makeValid:
|
|
351
|
-
max:
|
|
352
|
-
mean:
|
|
353
|
-
min:
|
|
354
|
-
overlapsWith:
|
|
355
|
-
span:
|
|
356
|
-
spanIsZero:
|
|
357
|
-
traverse:
|
|
358
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
355
|
+
contains: U,
|
|
356
|
+
distance: lr,
|
|
357
|
+
equals: zn,
|
|
358
|
+
findInsertPosition: it,
|
|
359
|
+
isFinite: Wn,
|
|
360
|
+
isZero: Zn,
|
|
361
|
+
linspace: Hn,
|
|
362
|
+
makeValid: ar,
|
|
363
|
+
max: or,
|
|
364
|
+
mean: Vn,
|
|
365
|
+
min: Gn,
|
|
366
|
+
overlapsWith: Fn,
|
|
367
|
+
span: Oe,
|
|
368
|
+
spanIsZero: Yn,
|
|
369
|
+
traverse: ur
|
|
370
|
+
}, Symbol.toStringTag, { value: "Module" })), cr = Un, H = (t) => qe.includes(t) ? t : ze.includes(t) ? "y" : "x", Xn = (t) => H(t) === "x" ? "y" : "x", Kn = (t) => H(t) === "x" ? "width" : "height", Qn = (t) => H(t) === "x" ? "left" : "top", _n = (t) => cr.safeParse(t).success, es = (t) => H(t) === "x" ? "signedWidth" : "signedHeight", ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
359
371
|
__proto__: null,
|
|
360
|
-
DIRECTIONS:
|
|
361
|
-
construct:
|
|
362
|
-
crude:
|
|
363
|
-
dimension:
|
|
364
|
-
direction:
|
|
365
|
-
isDirection:
|
|
366
|
-
location:
|
|
367
|
-
signedDimension:
|
|
368
|
-
swap:
|
|
369
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
372
|
+
DIRECTIONS: qe,
|
|
373
|
+
construct: H,
|
|
374
|
+
crude: cr,
|
|
375
|
+
dimension: Kn,
|
|
376
|
+
direction: wt,
|
|
377
|
+
isDirection: _n,
|
|
378
|
+
location: Qn,
|
|
379
|
+
signedDimension: es,
|
|
380
|
+
swap: Xn
|
|
381
|
+
}, Symbol.toStringTag, { value: "Module" })), rs = Ot, ns = vt, ss = rt, is = {
|
|
370
382
|
top: "bottom",
|
|
371
383
|
right: "left",
|
|
372
384
|
bottom: "top",
|
|
373
385
|
left: "right",
|
|
374
386
|
center: "center"
|
|
375
|
-
},
|
|
387
|
+
}, as = {
|
|
376
388
|
top: "left",
|
|
377
389
|
right: "top",
|
|
378
390
|
bottom: "right",
|
|
379
391
|
left: "bottom",
|
|
380
392
|
center: "center"
|
|
381
|
-
},
|
|
382
|
-
const e =
|
|
393
|
+
}, os = Cn, W = (t) => t instanceof String || !qe.includes(t) ? t : t === "x" ? "left" : "top", us = (t) => is[W(t)], ls = (t) => as[W(t)], pe = (t) => {
|
|
394
|
+
const e = W(t);
|
|
383
395
|
return e === "top" || e === "bottom" ? "y" : "x";
|
|
384
|
-
},
|
|
385
|
-
x:
|
|
386
|
-
y:
|
|
387
|
-
}),
|
|
396
|
+
}, cs = a.object({
|
|
397
|
+
x: Ot.or(rt),
|
|
398
|
+
y: vt.or(rt)
|
|
399
|
+
}), hr = a.object({ x: Ot, y: vt }), ve = Object.freeze({ x: "left", y: "top" }), $t = Object.freeze({ x: "right", y: "top" }), Fe = Object.freeze({ x: "left", y: "bottom" }), St = Object.freeze({ x: "right", y: "bottom" }), Nt = Object.freeze({ x: "center", y: "center" }), It = Object.freeze({ x: "center", y: "top" }), Mt = Object.freeze({ x: "center", y: "bottom" }), Et = Object.freeze({ x: "right", y: "center" }), At = Object.freeze({ x: "left", y: "center" }), hs = Object.freeze([
|
|
400
|
+
At,
|
|
401
|
+
Et,
|
|
402
|
+
It,
|
|
403
|
+
Mt,
|
|
404
|
+
ve,
|
|
388
405
|
$t,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
bt,
|
|
394
|
-
Le,
|
|
395
|
-
wt,
|
|
396
|
-
Ot
|
|
397
|
-
]), St = (t, e) => t.x === e.x && t.y === e.y, as = (t, e) => {
|
|
406
|
+
Fe,
|
|
407
|
+
St,
|
|
408
|
+
Nt
|
|
409
|
+
]), Bt = (t, e) => t.x === e.x && t.y === e.y, fs = (t, e) => {
|
|
398
410
|
if (typeof e == "object") {
|
|
399
411
|
let r = !0;
|
|
400
412
|
return "x" in e && (t.x === e.x || (r = !1)), "y" in e && (t.y === e.y || (r = !1)), r;
|
|
401
413
|
}
|
|
402
414
|
return t.x === e || t.y === e;
|
|
403
|
-
},
|
|
415
|
+
}, fr = (t) => [t.x, t.y], Ee = (t) => pe(W(t)) === "x", ds = (t) => pe(W(t)) === "y", gs = (t) => `${t.x}${Ht(t.y)}`, ps = (t, e) => {
|
|
404
416
|
let r, n;
|
|
405
|
-
if (typeof t == "object" && "x" in t ? (r = t.x, n = t.y) : (r =
|
|
417
|
+
if (typeof t == "object" && "x" in t ? (r = t.x, n = t.y) : (r = W(t), n = W(e ?? t)), pe(r) === pe(n) && r !== "center" && n !== "center")
|
|
406
418
|
throw new Error(
|
|
407
419
|
`[XYLocation] - encountered two locations with the same direction: ${r.toString()} - ${n.toString()}`
|
|
408
420
|
);
|
|
409
|
-
const s = { ...
|
|
410
|
-
return r === "center" ?
|
|
411
|
-
},
|
|
421
|
+
const s = { ...Nt };
|
|
422
|
+
return r === "center" ? Ee(n) ? [s.x, s.y] = [n, r] : [s.x, s.y] = [r, n] : n === "center" ? Ee(r) ? [s.x, s.y] = [r, n] : [s.x, s.y] = [n, r] : Ee(r) ? [s.x, s.y] = [r, n] : [s.x, s.y] = [n, r], s;
|
|
423
|
+
}, ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
412
424
|
__proto__: null,
|
|
413
|
-
BOTTOM_CENTER:
|
|
414
|
-
BOTTOM_LEFT:
|
|
415
|
-
BOTTOM_RIGHT:
|
|
416
|
-
CENTER:
|
|
417
|
-
CENTER_LEFT:
|
|
418
|
-
CENTER_LOCATIONS:
|
|
419
|
-
CENTER_RIGHT:
|
|
420
|
-
TOP_CENTER:
|
|
421
|
-
TOP_LEFT:
|
|
422
|
-
TOP_RIGHT:
|
|
423
|
-
XY_LOCATIONS:
|
|
424
|
-
X_LOCATIONS:
|
|
425
|
-
Y_LOCATIONS:
|
|
426
|
-
center:
|
|
427
|
-
construct:
|
|
428
|
-
constructXY:
|
|
429
|
-
corner:
|
|
430
|
-
crude:
|
|
431
|
-
direction:
|
|
432
|
-
isX:
|
|
433
|
-
isY:
|
|
434
|
-
location:
|
|
435
|
-
outer:
|
|
436
|
-
rotate90:
|
|
437
|
-
swap:
|
|
438
|
-
x:
|
|
439
|
-
xy:
|
|
440
|
-
xyCouple:
|
|
441
|
-
xyEquals:
|
|
442
|
-
xyMatches:
|
|
443
|
-
xyToString:
|
|
444
|
-
y:
|
|
445
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
425
|
+
BOTTOM_CENTER: Mt,
|
|
426
|
+
BOTTOM_LEFT: Fe,
|
|
427
|
+
BOTTOM_RIGHT: St,
|
|
428
|
+
CENTER: Nt,
|
|
429
|
+
CENTER_LEFT: At,
|
|
430
|
+
CENTER_LOCATIONS: Tt,
|
|
431
|
+
CENTER_RIGHT: Et,
|
|
432
|
+
TOP_CENTER: It,
|
|
433
|
+
TOP_LEFT: ve,
|
|
434
|
+
TOP_RIGHT: $t,
|
|
435
|
+
XY_LOCATIONS: hs,
|
|
436
|
+
X_LOCATIONS: ke,
|
|
437
|
+
Y_LOCATIONS: ze,
|
|
438
|
+
center: ss,
|
|
439
|
+
construct: W,
|
|
440
|
+
constructXY: ps,
|
|
441
|
+
corner: hr,
|
|
442
|
+
crude: os,
|
|
443
|
+
direction: pe,
|
|
444
|
+
isX: Ee,
|
|
445
|
+
isY: ds,
|
|
446
|
+
location: xt,
|
|
447
|
+
outer: Mn,
|
|
448
|
+
rotate90: ls,
|
|
449
|
+
swap: us,
|
|
450
|
+
x: rs,
|
|
451
|
+
xy: cs,
|
|
452
|
+
xyCouple: fr,
|
|
453
|
+
xyEquals: Bt,
|
|
454
|
+
xyMatches: fs,
|
|
455
|
+
xyToString: gs,
|
|
456
|
+
y: ns
|
|
457
|
+
}, Symbol.toStringTag, { value: "Module" })), at = a.union([
|
|
446
458
|
a.number(),
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
]),
|
|
459
|
+
ge,
|
|
460
|
+
Pe,
|
|
461
|
+
bt,
|
|
462
|
+
$n,
|
|
463
|
+
tr
|
|
464
|
+
]), x = (t, e) => {
|
|
453
465
|
if (typeof t == "string") {
|
|
454
466
|
if (e === void 0) throw new Error("The y coordinate must be given.");
|
|
455
467
|
return t === "x" ? { x: e, y: 0 } : { x: 0, y: e };
|
|
456
468
|
}
|
|
457
469
|
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 };
|
|
458
|
-
},
|
|
459
|
-
const n =
|
|
470
|
+
}, D = Object.freeze({ x: 0, y: 0 }), dr = Object.freeze({ x: 1, y: 1 }), ys = Object.freeze({ x: 1 / 0, y: 1 / 0 }), bs = Object.freeze({ x: NaN, y: NaN }), Re = (t, e, r = 0) => {
|
|
471
|
+
const n = x(t), s = x(e);
|
|
460
472
|
return r === 0 ? n.x === s.x && n.y === s.y : Math.abs(n.x - s.x) <= r && Math.abs(n.y - s.y) <= r;
|
|
461
|
-
},
|
|
462
|
-
const n =
|
|
473
|
+
}, ws = (t) => Re(t, D), Ut = (t, e, r) => {
|
|
474
|
+
const n = x(t), s = x(e, r);
|
|
463
475
|
return { x: n.x * s.x, y: n.y * s.y };
|
|
464
|
-
},
|
|
465
|
-
const r =
|
|
476
|
+
}, gr = (t, e) => {
|
|
477
|
+
const r = x(t);
|
|
466
478
|
return { x: r.x + e, y: r.y };
|
|
467
|
-
},
|
|
468
|
-
const r =
|
|
479
|
+
}, pr = (t, e) => {
|
|
480
|
+
const r = x(t);
|
|
469
481
|
return { x: r.x, y: r.y + e };
|
|
470
|
-
},
|
|
471
|
-
const o =
|
|
482
|
+
}, me = (t, e, r, ...n) => typeof e == "string" && typeof r == "number" ? e === "x" ? gr(t, r) : pr(t, r) : [t, e, r ?? D, ...n].reduce((s, i) => {
|
|
483
|
+
const o = x(i);
|
|
472
484
|
return { x: s.x + o.x, y: s.y + o.y };
|
|
473
|
-
},
|
|
474
|
-
const n =
|
|
485
|
+
}, D), Os = (t, e, r) => {
|
|
486
|
+
const n = x(t);
|
|
475
487
|
return e === "x" ? { x: r, y: n.y } : { x: n.x, y: r };
|
|
476
|
-
},
|
|
477
|
-
const r =
|
|
488
|
+
}, vs = (t, e) => {
|
|
489
|
+
const r = x(t), n = x(e);
|
|
478
490
|
return Math.sqrt((r.x - n.x) ** 2 + (r.y - n.y) ** 2);
|
|
479
|
-
},
|
|
480
|
-
const r =
|
|
491
|
+
}, Ts = (t, e) => {
|
|
492
|
+
const r = x(t), n = x(e);
|
|
481
493
|
return { x: n.x - r.x, y: n.y - r.y };
|
|
482
|
-
},
|
|
483
|
-
const e =
|
|
494
|
+
}, xs = (t) => {
|
|
495
|
+
const e = x(t);
|
|
484
496
|
return Number.isNaN(e.x) || Number.isNaN(e.y);
|
|
485
|
-
},
|
|
486
|
-
const e =
|
|
497
|
+
}, $s = (t) => {
|
|
498
|
+
const e = x(t);
|
|
487
499
|
return Number.isFinite(e.x) && Number.isFinite(e.y);
|
|
488
|
-
},
|
|
489
|
-
const e =
|
|
500
|
+
}, Ss = (t) => {
|
|
501
|
+
const e = x(t);
|
|
490
502
|
return [e.x, e.y];
|
|
491
|
-
},
|
|
492
|
-
const e =
|
|
503
|
+
}, Ns = (t) => {
|
|
504
|
+
const e = x(t);
|
|
493
505
|
return { left: e.x, top: e.y };
|
|
494
|
-
},
|
|
495
|
-
const r =
|
|
506
|
+
}, ot = (t, e = 0) => {
|
|
507
|
+
const r = x(t);
|
|
496
508
|
return { x: Number(r.x.toFixed(e)), y: Number(r.y.toFixed(e)) };
|
|
497
|
-
},
|
|
498
|
-
const r =
|
|
509
|
+
}, oe = (t, e) => {
|
|
510
|
+
const r = x(t), n = x(e);
|
|
499
511
|
return { x: r.x - n.x, y: r.y - n.y };
|
|
500
|
-
},
|
|
501
|
-
const e =
|
|
512
|
+
}, ue = (t) => {
|
|
513
|
+
const e = x(t), r = Math.hypot(e.x, e.y);
|
|
502
514
|
return r === 0 ? { x: 0, y: 0 } : { x: -e.y / r, y: e.x / r };
|
|
503
|
-
},
|
|
504
|
-
const e =
|
|
515
|
+
}, mr = (t) => {
|
|
516
|
+
const e = x(t), r = Math.hypot(e.x, e.y);
|
|
505
517
|
return r === 0 ? { x: 0, y: 0 } : { x: e.x / r, y: e.y / r };
|
|
506
|
-
},
|
|
507
|
-
const e = t.reduce((r, n) =>
|
|
508
|
-
return
|
|
509
|
-
},
|
|
518
|
+
}, yr = (...t) => {
|
|
519
|
+
const e = t.reduce((r, n) => me(r, n), D);
|
|
520
|
+
return Ut(e, 1 / t.length);
|
|
521
|
+
}, Is = (t, e) => {
|
|
510
522
|
const r = [];
|
|
511
523
|
for (let n = 0; n < t.length; n++) {
|
|
512
524
|
const s = t[n];
|
|
513
|
-
let i, o, c,
|
|
525
|
+
let i, o, c, h;
|
|
514
526
|
if (n === 0) {
|
|
515
|
-
const
|
|
516
|
-
o =
|
|
527
|
+
const l = t[n + 1], d = oe(l, s);
|
|
528
|
+
o = ue(d), c = o, h = e;
|
|
517
529
|
} else if (n === t.length - 1) {
|
|
518
|
-
const
|
|
519
|
-
i =
|
|
530
|
+
const l = t[n - 1], d = oe(s, l);
|
|
531
|
+
i = ue(d), c = i, h = e;
|
|
520
532
|
} else {
|
|
521
|
-
const
|
|
522
|
-
i =
|
|
523
|
-
const
|
|
524
|
-
(
|
|
525
|
-
),
|
|
526
|
-
|
|
533
|
+
const l = t[n - 1], d = t[n + 1], m = oe(s, l), p = oe(d, s);
|
|
534
|
+
i = ue(m), o = ue(p);
|
|
535
|
+
const j = Math.acos(
|
|
536
|
+
(m.x * p.x + m.y * p.y) / (Math.hypot(m.x, m.y) * Math.hypot(p.x, p.y))
|
|
537
|
+
), A = Math.sin(j / 2);
|
|
538
|
+
A === 0 ? h = e : h = e / A, c = mr(yr(i, o));
|
|
527
539
|
}
|
|
528
|
-
r.push(
|
|
540
|
+
r.push(Ut(c, h));
|
|
529
541
|
}
|
|
530
542
|
return r;
|
|
531
|
-
},
|
|
532
|
-
const e =
|
|
543
|
+
}, Ms = (t) => {
|
|
544
|
+
const e = x(t);
|
|
533
545
|
return { x: e.y, y: e.x };
|
|
534
|
-
},
|
|
535
|
-
const e =
|
|
546
|
+
}, ut = (t) => {
|
|
547
|
+
const e = x(t);
|
|
536
548
|
return { x: Math.round(e.x), y: Math.round(e.y) };
|
|
537
|
-
},
|
|
549
|
+
}, No = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
538
550
|
__proto__: null,
|
|
539
|
-
INFINITY:
|
|
540
|
-
NAN:
|
|
541
|
-
ONE:
|
|
542
|
-
ZERO:
|
|
543
|
-
average:
|
|
544
|
-
calculateMiters:
|
|
545
|
-
clientXY:
|
|
546
|
-
construct:
|
|
547
|
-
couple:
|
|
548
|
-
crudeZ:
|
|
549
|
-
css:
|
|
550
|
-
distance:
|
|
551
|
-
equals:
|
|
552
|
-
isFinite:
|
|
553
|
-
isNan:
|
|
554
|
-
isZero:
|
|
555
|
-
normal:
|
|
556
|
-
normalize:
|
|
557
|
-
round:
|
|
558
|
-
scale:
|
|
559
|
-
set:
|
|
560
|
-
sub:
|
|
561
|
-
swap:
|
|
562
|
-
translate:
|
|
563
|
-
translateX:
|
|
564
|
-
translateY:
|
|
565
|
-
translation:
|
|
566
|
-
truncate:
|
|
567
|
-
xy:
|
|
568
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
569
|
-
top:
|
|
570
|
-
left:
|
|
571
|
-
width:
|
|
572
|
-
height:
|
|
573
|
-
}),
|
|
551
|
+
INFINITY: ys,
|
|
552
|
+
NAN: bs,
|
|
553
|
+
ONE: dr,
|
|
554
|
+
ZERO: D,
|
|
555
|
+
average: yr,
|
|
556
|
+
calculateMiters: Is,
|
|
557
|
+
clientXY: tr,
|
|
558
|
+
construct: x,
|
|
559
|
+
couple: Ss,
|
|
560
|
+
crudeZ: at,
|
|
561
|
+
css: Ns,
|
|
562
|
+
distance: vs,
|
|
563
|
+
equals: Re,
|
|
564
|
+
isFinite: $s,
|
|
565
|
+
isNan: xs,
|
|
566
|
+
isZero: ws,
|
|
567
|
+
normal: ue,
|
|
568
|
+
normalize: mr,
|
|
569
|
+
round: ut,
|
|
570
|
+
scale: Ut,
|
|
571
|
+
set: Os,
|
|
572
|
+
sub: oe,
|
|
573
|
+
swap: Ms,
|
|
574
|
+
translate: me,
|
|
575
|
+
translateX: gr,
|
|
576
|
+
translateY: pr,
|
|
577
|
+
translation: Ts,
|
|
578
|
+
truncate: ot,
|
|
579
|
+
xy: ge
|
|
580
|
+
}, Symbol.toStringTag, { value: "Module" })), xe = a.union([a.number(), a.string()]), Es = a.object({
|
|
581
|
+
top: xe,
|
|
582
|
+
left: xe,
|
|
583
|
+
width: xe,
|
|
584
|
+
height: xe
|
|
585
|
+
}), As = a.object({
|
|
574
586
|
left: a.number(),
|
|
575
587
|
top: a.number(),
|
|
576
588
|
right: a.number(),
|
|
577
589
|
bottom: a.number()
|
|
578
|
-
}),
|
|
579
|
-
one:
|
|
580
|
-
two:
|
|
581
|
-
root:
|
|
582
|
-
}),
|
|
590
|
+
}), Bs = a.object({
|
|
591
|
+
one: ge,
|
|
592
|
+
two: ge,
|
|
593
|
+
root: hr
|
|
594
|
+
}), br = { one: D, two: D, root: ve }, Us = { one: D, two: dr, root: Fe }, wr = (t, e) => ({
|
|
583
595
|
one: t.one,
|
|
584
596
|
two: t.two,
|
|
585
597
|
root: e ?? t.root
|
|
586
|
-
}),
|
|
598
|
+
}), T = (t, e, r = 0, n = 0, s) => {
|
|
587
599
|
const i = {
|
|
588
|
-
one: { ...
|
|
589
|
-
two: { ...
|
|
590
|
-
root: s ??
|
|
600
|
+
one: { ...D },
|
|
601
|
+
two: { ...D },
|
|
602
|
+
root: s ?? ve
|
|
591
603
|
};
|
|
592
604
|
if (typeof t == "number") {
|
|
593
605
|
if (typeof e != "number")
|
|
@@ -601,219 +613,219 @@ const Sn = a.enum([...dt.options, ...mt.options]), Nn = a.union([dt, mt, a.insta
|
|
|
601
613
|
x: i.one.x + e.signedWidth,
|
|
602
614
|
y: i.one.y + e.signedHeight
|
|
603
615
|
} : i.two = e, i));
|
|
604
|
-
},
|
|
605
|
-
const n =
|
|
616
|
+
}, Cs = (t, e, r) => {
|
|
617
|
+
const n = T(t);
|
|
606
618
|
if (typeof e == "string") {
|
|
607
619
|
if (r == null) throw new Error("Invalid arguments for resize");
|
|
608
|
-
const s =
|
|
609
|
-
return
|
|
620
|
+
const s = H(e);
|
|
621
|
+
return T(
|
|
610
622
|
n.one,
|
|
611
623
|
void 0,
|
|
612
|
-
s === "x" ? r :
|
|
613
|
-
s === "y" ? r :
|
|
624
|
+
s === "x" ? r : V(n),
|
|
625
|
+
s === "y" ? r : G(n),
|
|
614
626
|
n.root
|
|
615
627
|
);
|
|
616
628
|
}
|
|
617
|
-
return
|
|
618
|
-
},
|
|
619
|
-
const n =
|
|
629
|
+
return T(n.one, e, void 0, void 0, n.root);
|
|
630
|
+
}, js = (t, e, r = !0) => {
|
|
631
|
+
const n = T(t);
|
|
620
632
|
let s = (i, o) => i < o;
|
|
621
|
-
return r && (s = (i, o) => i <= o), "one" in e ? s(
|
|
622
|
-
},
|
|
623
|
-
width:
|
|
624
|
-
height:
|
|
625
|
-
}),
|
|
626
|
-
signedWidth:
|
|
627
|
-
signedHeight:
|
|
628
|
-
}),
|
|
629
|
-
top:
|
|
630
|
-
left:
|
|
631
|
-
width:
|
|
632
|
-
height:
|
|
633
|
-
}),
|
|
634
|
-
const n =
|
|
633
|
+
return r && (s = (i, o) => i <= o), "one" in e ? s(Z(n), Z(e)) && s(X(e), X(n)) && s(Y(n), Y(e)) && s(K(e), K(n)) : s(Z(n), e.x) && s(e.x, X(n)) && s(Y(n), e.y) && s(e.y, K(n));
|
|
634
|
+
}, Rs = (t, e) => Re(t.one, e.one) && Re(t.two, e.two) && Bt(t.root, e.root), Or = (t) => ({
|
|
635
|
+
width: V(t),
|
|
636
|
+
height: G(t)
|
|
637
|
+
}), Ls = (t) => ({
|
|
638
|
+
signedWidth: Ze(t),
|
|
639
|
+
signedHeight: Ye(t)
|
|
640
|
+
}), Ds = (t) => ({
|
|
641
|
+
top: Y(t),
|
|
642
|
+
left: Z(t),
|
|
643
|
+
width: V(t),
|
|
644
|
+
height: G(t)
|
|
645
|
+
}), Ct = (t, e, r = !1) => {
|
|
646
|
+
const n = H(e) === "y" ? Ye(t) : Ze(t);
|
|
635
647
|
return r ? n : Math.abs(n);
|
|
636
|
-
},
|
|
637
|
-
const r =
|
|
648
|
+
}, q = (t, e) => {
|
|
649
|
+
const r = T(t);
|
|
638
650
|
return {
|
|
639
|
-
x: e.x === "center" ?
|
|
640
|
-
y: e.y === "center" ?
|
|
651
|
+
x: e.x === "center" ? lt(r).x : Q(r, e.x),
|
|
652
|
+
y: e.y === "center" ? lt(r).y : Q(r, e.y)
|
|
641
653
|
};
|
|
642
|
-
},
|
|
643
|
-
const r =
|
|
644
|
-
return
|
|
645
|
-
},
|
|
646
|
-
const e =
|
|
654
|
+
}, Q = (t, e) => {
|
|
655
|
+
const r = T(t), n = fr(r.root).includes(e) ? Math.min : Math.max;
|
|
656
|
+
return ke.includes(e) ? n(r.one.x, r.two.x) : n(r.one.y, r.two.y);
|
|
657
|
+
}, Ps = (t) => t.one.x === t.two.x && t.one.y === t.two.y, V = (t) => Ct(t, "x"), G = (t) => Ct(t, "y"), Ze = (t) => {
|
|
658
|
+
const e = T(t);
|
|
647
659
|
return e.two.x - e.one.x;
|
|
648
|
-
},
|
|
649
|
-
const e =
|
|
660
|
+
}, Ye = (t) => {
|
|
661
|
+
const e = T(t);
|
|
650
662
|
return e.two.y - e.one.y;
|
|
651
|
-
},
|
|
652
|
-
x:
|
|
653
|
-
y:
|
|
654
|
-
}),
|
|
655
|
-
const e =
|
|
656
|
-
return e.root.x === "left" ?
|
|
657
|
-
},
|
|
658
|
-
const e =
|
|
659
|
-
return e.root.y === "top" ?
|
|
660
|
-
},
|
|
661
|
-
const e =
|
|
663
|
+
}, vr = (t) => q(t, ve), qs = (t) => q(t, It), ks = (t) => q(t, $t), zs = (t) => q(t, Fe), Fs = (t) => q(t, Mt), Zs = (t) => q(t, St), Ys = (t) => q(t, At), Ws = (t) => q(t, Et), X = (t) => Q(t, "right"), K = (t) => Q(t, "bottom"), Z = (t) => Q(t, "left"), Y = (t) => Q(t, "top"), lt = (t) => me(vr(t), {
|
|
664
|
+
x: Ze(t) / 2,
|
|
665
|
+
y: Ye(t) / 2
|
|
666
|
+
}), jt = (t) => {
|
|
667
|
+
const e = T(t);
|
|
668
|
+
return e.root.x === "left" ? Z(e) : X(e);
|
|
669
|
+
}, Rt = (t) => {
|
|
670
|
+
const e = T(t);
|
|
671
|
+
return e.root.y === "top" ? Y(e) : K(e);
|
|
672
|
+
}, Vs = (t) => ({ x: jt(t), y: Rt(t) }), Ae = (t) => {
|
|
673
|
+
const e = T(t);
|
|
662
674
|
return { lower: e.one.x, upper: e.two.x };
|
|
663
|
-
},
|
|
664
|
-
const e =
|
|
675
|
+
}, Be = (t) => {
|
|
676
|
+
const e = T(t);
|
|
665
677
|
return { lower: e.one.y, upper: e.two.y };
|
|
666
|
-
},
|
|
667
|
-
const r =
|
|
678
|
+
}, Gs = (t, e) => wr(t, e), Hs = (t, e) => {
|
|
679
|
+
const r = T(t), n = ke.includes(e) ? "x" : ze.includes(e) ? "y" : null;
|
|
668
680
|
if (n === null) throw new Error(`Invalid location: ${e}`);
|
|
669
681
|
const s = e === "top" || e === "left" ? Math.min : Math.max, i = { ...r.one }, o = { ...r.two };
|
|
670
682
|
return i[n] = s(r.one[n], r.two[n]), o[n] = s(r.one[n], r.two[n]), [i, o];
|
|
671
|
-
},
|
|
672
|
-
const r =
|
|
673
|
-
return
|
|
674
|
-
},
|
|
683
|
+
}, Js = (t, e) => {
|
|
684
|
+
const r = T(t), n = T(e), s = jt(n) + (V(n) - V(r)) / 2, i = Rt(n) + (G(n) - G(r)) / 2;
|
|
685
|
+
return T({ x: s, y: i }, Or(r));
|
|
686
|
+
}, Tr = (t) => typeof t != "object" || t == null ? !1 : "one" in t && "two" in t && "root" in t, Xs = (t) => V(t) / G(t), Ks = (t, e, r) => {
|
|
675
687
|
if (typeof e == "string") {
|
|
676
688
|
if (r == null) throw new Error("Undefined amount passed into box.translate");
|
|
677
|
-
const s =
|
|
678
|
-
e =
|
|
689
|
+
const s = H(e);
|
|
690
|
+
e = x(s, r);
|
|
679
691
|
}
|
|
680
|
-
const n =
|
|
681
|
-
return
|
|
682
|
-
|
|
683
|
-
|
|
692
|
+
const n = T(t);
|
|
693
|
+
return T(
|
|
694
|
+
me(n.one, e),
|
|
695
|
+
me(n.two, e),
|
|
684
696
|
void 0,
|
|
685
697
|
void 0,
|
|
686
698
|
n.root
|
|
687
699
|
);
|
|
688
|
-
},
|
|
689
|
-
const r = Math.max(
|
|
690
|
-
return r > s || n > i ?
|
|
691
|
-
},
|
|
692
|
-
const r =
|
|
693
|
-
return
|
|
694
|
-
|
|
695
|
-
|
|
700
|
+
}, Qs = (t, e) => {
|
|
701
|
+
const r = Math.max(Z(t), Z(e)), n = Math.max(Y(t), Y(e)), s = Math.min(X(t), X(e)), i = Math.min(K(t), K(e));
|
|
702
|
+
return r > s || n > i ? br : T({ x: r, y: n }, { x: s, y: i }, void 0, void 0, t.root);
|
|
703
|
+
}, _s = (t) => V(t) * G(t), ei = (t, e) => {
|
|
704
|
+
const r = T(t);
|
|
705
|
+
return T(
|
|
706
|
+
ot(r.one, e),
|
|
707
|
+
ot(r.two, e),
|
|
696
708
|
void 0,
|
|
697
709
|
void 0,
|
|
698
710
|
r.root
|
|
699
711
|
);
|
|
700
|
-
},
|
|
712
|
+
}, ti = (t, e, r, n, s, i) => {
|
|
701
713
|
const o = { x: t, y: e }, c = { x: t + r, y: e + n };
|
|
702
|
-
return s.x !== i.x && (s.x === "center" ? (o.x -= r / 2, c.x -= r / 2) : (o.x -= r, c.x -= r)), s.y !== i.y && (s.y === "center" ? (o.y -= n / 2, c.y -= n / 2) : (o.y -= n, c.y -= n)),
|
|
703
|
-
},
|
|
704
|
-
const e =
|
|
705
|
-
return
|
|
706
|
-
},
|
|
714
|
+
return s.x !== i.x && (s.x === "center" ? (o.x -= r / 2, c.x -= r / 2) : (o.x -= r, c.x -= r)), s.y !== i.y && (s.y === "center" ? (o.y -= n / 2, c.y -= n / 2) : (o.y -= n, c.y -= n)), T(o, c, void 0, void 0, i);
|
|
715
|
+
}, ri = (t) => {
|
|
716
|
+
const e = T(t);
|
|
717
|
+
return T(ut(e.one), ut(e.two), void 0, void 0, e.root);
|
|
718
|
+
}, Io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
707
719
|
__proto__: null,
|
|
708
|
-
DECIMAL:
|
|
709
|
-
ZERO:
|
|
710
|
-
area:
|
|
711
|
-
areaIsZero:
|
|
712
|
-
aspect:
|
|
713
|
-
bottom:
|
|
714
|
-
bottomCenter:
|
|
715
|
-
bottomLeft:
|
|
716
|
-
bottomRight:
|
|
717
|
-
box:
|
|
718
|
-
center:
|
|
719
|
-
centerLeft:
|
|
720
|
-
centerRight:
|
|
721
|
-
construct:
|
|
722
|
-
constructWithAlternateRoot:
|
|
723
|
-
contains:
|
|
724
|
-
copy:
|
|
725
|
-
css:
|
|
726
|
-
cssBox:
|
|
727
|
-
dim:
|
|
728
|
-
dims:
|
|
729
|
-
domRect:
|
|
730
|
-
edgePoints:
|
|
731
|
-
equals:
|
|
732
|
-
height:
|
|
733
|
-
intersection:
|
|
734
|
-
isBox:
|
|
735
|
-
left:
|
|
736
|
-
loc:
|
|
737
|
-
positionInCenter:
|
|
738
|
-
reRoot:
|
|
739
|
-
resize:
|
|
740
|
-
right:
|
|
741
|
-
root:
|
|
742
|
-
round:
|
|
743
|
-
signedDims:
|
|
744
|
-
signedHeight:
|
|
745
|
-
signedWidth:
|
|
746
|
-
top:
|
|
747
|
-
topCenter:
|
|
748
|
-
topLeft:
|
|
749
|
-
topRight:
|
|
750
|
-
translate:
|
|
751
|
-
truncate:
|
|
752
|
-
width:
|
|
753
|
-
x:
|
|
754
|
-
xBounds:
|
|
755
|
-
xyLoc:
|
|
756
|
-
y:
|
|
757
|
-
yBounds:
|
|
758
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
720
|
+
DECIMAL: Us,
|
|
721
|
+
ZERO: br,
|
|
722
|
+
area: _s,
|
|
723
|
+
areaIsZero: Ps,
|
|
724
|
+
aspect: Xs,
|
|
725
|
+
bottom: K,
|
|
726
|
+
bottomCenter: Fs,
|
|
727
|
+
bottomLeft: zs,
|
|
728
|
+
bottomRight: Zs,
|
|
729
|
+
box: Bs,
|
|
730
|
+
center: lt,
|
|
731
|
+
centerLeft: Ys,
|
|
732
|
+
centerRight: Ws,
|
|
733
|
+
construct: T,
|
|
734
|
+
constructWithAlternateRoot: ti,
|
|
735
|
+
contains: js,
|
|
736
|
+
copy: wr,
|
|
737
|
+
css: Ds,
|
|
738
|
+
cssBox: Es,
|
|
739
|
+
dim: Ct,
|
|
740
|
+
dims: Or,
|
|
741
|
+
domRect: As,
|
|
742
|
+
edgePoints: Hs,
|
|
743
|
+
equals: Rs,
|
|
744
|
+
height: G,
|
|
745
|
+
intersection: Qs,
|
|
746
|
+
isBox: Tr,
|
|
747
|
+
left: Z,
|
|
748
|
+
loc: Q,
|
|
749
|
+
positionInCenter: Js,
|
|
750
|
+
reRoot: Gs,
|
|
751
|
+
resize: Cs,
|
|
752
|
+
right: X,
|
|
753
|
+
root: Vs,
|
|
754
|
+
round: ri,
|
|
755
|
+
signedDims: Ls,
|
|
756
|
+
signedHeight: Ye,
|
|
757
|
+
signedWidth: Ze,
|
|
758
|
+
top: Y,
|
|
759
|
+
topCenter: qs,
|
|
760
|
+
topLeft: vr,
|
|
761
|
+
topRight: ks,
|
|
762
|
+
translate: Ks,
|
|
763
|
+
truncate: ei,
|
|
764
|
+
width: V,
|
|
765
|
+
x: jt,
|
|
766
|
+
xBounds: Ae,
|
|
767
|
+
xyLoc: q,
|
|
768
|
+
y: Rt,
|
|
769
|
+
yBounds: Be
|
|
770
|
+
}, Symbol.toStringTag, { value: "Module" })), xr = a.object({ signedWidth: a.number(), signedHeight: a.number() }), ni = a.union([bt, xr, ge, Pe]), si = { width: 0, height: 0 }, ii = { width: 1, height: 1 }, C = (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 }, ai = (t, e) => {
|
|
759
771
|
if (e == null) return !1;
|
|
760
|
-
const r =
|
|
772
|
+
const r = C(t), n = C(e);
|
|
761
773
|
return r.width === n.width && r.height === n.height;
|
|
762
|
-
},
|
|
763
|
-
const e =
|
|
774
|
+
}, oi = (t) => {
|
|
775
|
+
const e = C(t);
|
|
764
776
|
return { width: e.height, height: e.width };
|
|
765
|
-
},
|
|
766
|
-
const e =
|
|
777
|
+
}, ui = (t) => {
|
|
778
|
+
const e = C(t);
|
|
767
779
|
return `0 0 ${e.width} ${e.height}`;
|
|
768
|
-
},
|
|
769
|
-
const e =
|
|
780
|
+
}, li = (t) => {
|
|
781
|
+
const e = C(t);
|
|
770
782
|
return [e.width, e.height];
|
|
771
|
-
},
|
|
772
|
-
width: Math.max(...t.map((e) =>
|
|
773
|
-
height: Math.max(...t.map((e) =>
|
|
774
|
-
}),
|
|
775
|
-
width: Math.min(...t.map((e) =>
|
|
776
|
-
height: Math.min(...t.map((e) =>
|
|
777
|
-
}),
|
|
778
|
-
const r =
|
|
783
|
+
}, ci = (t) => ({
|
|
784
|
+
width: Math.max(...t.map((e) => C(e).width)),
|
|
785
|
+
height: Math.max(...t.map((e) => C(e).height))
|
|
786
|
+
}), hi = (t) => ({
|
|
787
|
+
width: Math.min(...t.map((e) => C(e).width)),
|
|
788
|
+
height: Math.min(...t.map((e) => C(e).height))
|
|
789
|
+
}), fi = (t, e) => {
|
|
790
|
+
const r = C(t);
|
|
779
791
|
return { width: r.width * e, height: r.height * e };
|
|
780
|
-
},
|
|
792
|
+
}, Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
781
793
|
__proto__: null,
|
|
782
|
-
DECIMAL:
|
|
783
|
-
ZERO:
|
|
784
|
-
construct:
|
|
785
|
-
couple:
|
|
786
|
-
crude:
|
|
787
|
-
dimensions:
|
|
788
|
-
equals:
|
|
789
|
-
max:
|
|
790
|
-
min:
|
|
791
|
-
scale:
|
|
792
|
-
signed:
|
|
793
|
-
svgViewBox:
|
|
794
|
-
swap:
|
|
795
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
794
|
+
DECIMAL: ii,
|
|
795
|
+
ZERO: si,
|
|
796
|
+
construct: C,
|
|
797
|
+
couple: li,
|
|
798
|
+
crude: ni,
|
|
799
|
+
dimensions: bt,
|
|
800
|
+
equals: ai,
|
|
801
|
+
max: ci,
|
|
802
|
+
min: hi,
|
|
803
|
+
scale: fi,
|
|
804
|
+
signed: xr,
|
|
805
|
+
svgViewBox: ui,
|
|
806
|
+
swap: oi
|
|
807
|
+
}, Symbol.toStringTag, { value: "Module" })), di = (t, e, r) => e !== void 0 && t < e ? e : r !== void 0 && t > r ? r : t, gi = a.object({ offset: at, scale: at }), pi = a.object({ offset: a.number(), scale: a.number() }), mi = (t) => (e, r, n, s) => r === "dimension" ? [e, n] : [
|
|
796
808
|
e,
|
|
797
809
|
s ? n - t : n + t
|
|
798
|
-
],
|
|
810
|
+
], yi = (t) => (e, r, n, s) => [
|
|
799
811
|
e,
|
|
800
812
|
s ? n / t : n * t
|
|
801
|
-
],
|
|
813
|
+
], bi = (t) => (e, r, n) => {
|
|
802
814
|
if (e === null) return [t, n];
|
|
803
|
-
const { lower: s, upper: i } = e, { lower: o, upper: c } = t,
|
|
804
|
-
if (r === "dimension") return [t, n * (
|
|
805
|
-
const
|
|
806
|
-
return [t,
|
|
807
|
-
},
|
|
815
|
+
const { lower: s, upper: i } = e, { lower: o, upper: c } = t, h = i - s, l = c - o;
|
|
816
|
+
if (r === "dimension") return [t, n * (l / h)];
|
|
817
|
+
const d = (n - s) * (l / h) + o;
|
|
818
|
+
return [t, d];
|
|
819
|
+
}, wi = (t) => (e, r, n) => [t, n], Oi = () => (t, e, r) => {
|
|
808
820
|
if (t === null) throw new Error("cannot invert without bounds");
|
|
809
821
|
if (e === "dimension") return [t, r];
|
|
810
822
|
const { lower: n, upper: s } = t;
|
|
811
823
|
return [t, s - (r - n)];
|
|
812
|
-
},
|
|
824
|
+
}, vi = (t) => (e, r, n) => {
|
|
813
825
|
const { lower: s, upper: i } = t;
|
|
814
|
-
return n =
|
|
826
|
+
return n = di(n, s, i), [e, n];
|
|
815
827
|
};
|
|
816
|
-
let
|
|
828
|
+
let ct = class te {
|
|
817
829
|
ops = [];
|
|
818
830
|
currBounds = null;
|
|
819
831
|
currType = null;
|
|
@@ -827,7 +839,7 @@ let st = class K {
|
|
|
827
839
|
* @param value - The amount to translate by.
|
|
828
840
|
*/
|
|
829
841
|
static translate(e) {
|
|
830
|
-
return new
|
|
842
|
+
return new te().translate(e);
|
|
831
843
|
}
|
|
832
844
|
/**
|
|
833
845
|
* @returns a new scale with a magnification as its first operation. Any number provided
|
|
@@ -835,10 +847,10 @@ let st = class K {
|
|
|
835
847
|
* @param value - The amount to translate by.
|
|
836
848
|
*/
|
|
837
849
|
static magnify(e) {
|
|
838
|
-
return new
|
|
850
|
+
return new te().magnify(e);
|
|
839
851
|
}
|
|
840
852
|
static scale(e, r) {
|
|
841
|
-
return new
|
|
853
|
+
return new te().scale(e, r);
|
|
842
854
|
}
|
|
843
855
|
/**
|
|
844
856
|
* @returns a copy of the scale with a translation as its next operation. Any
|
|
@@ -847,7 +859,7 @@ let st = class K {
|
|
|
847
859
|
* @param value - The amount to translate by.
|
|
848
860
|
*/
|
|
849
861
|
translate(e) {
|
|
850
|
-
const r = this.new(), n =
|
|
862
|
+
const r = this.new(), n = mi(e);
|
|
851
863
|
return n.type = "translate", r.ops.push(n), r;
|
|
852
864
|
}
|
|
853
865
|
/**
|
|
@@ -857,23 +869,23 @@ let st = class K {
|
|
|
857
869
|
* @param value - The amount to magnify by.
|
|
858
870
|
*/
|
|
859
871
|
magnify(e) {
|
|
860
|
-
const r = this.new(), n =
|
|
872
|
+
const r = this.new(), n = yi(e);
|
|
861
873
|
return n.type = "magnify", r.ops.push(n), r;
|
|
862
874
|
}
|
|
863
875
|
scale(e, r) {
|
|
864
|
-
const n = y(e, r), s = this.new(), i =
|
|
876
|
+
const n = y(e, r), s = this.new(), i = bi(n);
|
|
865
877
|
return i.type = "scale", s.ops.push(i), s;
|
|
866
878
|
}
|
|
867
879
|
clamp(e, r) {
|
|
868
|
-
const n = y(e, r), s = this.new(), i =
|
|
880
|
+
const n = y(e, r), s = this.new(), i = vi(n);
|
|
869
881
|
return i.type = "clamp", s.ops.push(i), s;
|
|
870
882
|
}
|
|
871
883
|
reBound(e, r) {
|
|
872
|
-
const n = y(e, r), s = this.new(), i =
|
|
884
|
+
const n = y(e, r), s = this.new(), i = wi(n);
|
|
873
885
|
return i.type = "re-bound", s.ops.push(i), s;
|
|
874
886
|
}
|
|
875
887
|
invert() {
|
|
876
|
-
const e =
|
|
888
|
+
const e = Oi();
|
|
877
889
|
e.type = "invert";
|
|
878
890
|
const r = this.new();
|
|
879
891
|
return r.ops.push(e), r;
|
|
@@ -885,7 +897,7 @@ let st = class K {
|
|
|
885
897
|
return this.exec("dimension", e);
|
|
886
898
|
}
|
|
887
899
|
new() {
|
|
888
|
-
const e = new
|
|
900
|
+
const e = new te();
|
|
889
901
|
return e.ops = this.ops.slice(), e.reversed = this.reversed, e;
|
|
890
902
|
}
|
|
891
903
|
exec(e, r) {
|
|
@@ -911,37 +923,37 @@ let st = class K {
|
|
|
911
923
|
get transform() {
|
|
912
924
|
return { scale: this.dim(1), offset: this.pos(0) };
|
|
913
925
|
}
|
|
914
|
-
static IDENTITY = new
|
|
915
|
-
},
|
|
926
|
+
static IDENTITY = new te();
|
|
927
|
+
}, Ti = class R {
|
|
916
928
|
x;
|
|
917
929
|
y;
|
|
918
930
|
currRoot;
|
|
919
|
-
constructor(e = new
|
|
931
|
+
constructor(e = new ct(), r = new ct(), n = null) {
|
|
920
932
|
this.x = e, this.y = r, this.currRoot = n;
|
|
921
933
|
}
|
|
922
934
|
static translate(e, r) {
|
|
923
|
-
return new
|
|
935
|
+
return new R().translate(e, r);
|
|
924
936
|
}
|
|
925
937
|
static translateX(e) {
|
|
926
|
-
return new
|
|
938
|
+
return new R().translateX(e);
|
|
927
939
|
}
|
|
928
940
|
static translateY(e) {
|
|
929
|
-
return new
|
|
941
|
+
return new R().translateY(e);
|
|
930
942
|
}
|
|
931
943
|
static clamp(e) {
|
|
932
|
-
return new
|
|
944
|
+
return new R().clamp(e);
|
|
933
945
|
}
|
|
934
946
|
static magnify(e) {
|
|
935
|
-
return new
|
|
947
|
+
return new R().magnify(e);
|
|
936
948
|
}
|
|
937
949
|
static scale(e) {
|
|
938
|
-
return new
|
|
950
|
+
return new R().scale(e);
|
|
939
951
|
}
|
|
940
952
|
static reBound(e) {
|
|
941
|
-
return new
|
|
953
|
+
return new R().reBound(e);
|
|
942
954
|
}
|
|
943
955
|
translate(e, r) {
|
|
944
|
-
const n =
|
|
956
|
+
const n = x(e, r), s = this.copy();
|
|
945
957
|
return s.x = this.x.translate(n.x), s.y = this.y.translate(n.y), s;
|
|
946
958
|
}
|
|
947
959
|
translateX(e) {
|
|
@@ -958,22 +970,22 @@ let st = class K {
|
|
|
958
970
|
}
|
|
959
971
|
scale(e) {
|
|
960
972
|
const r = this.copy();
|
|
961
|
-
if (
|
|
973
|
+
if (Tr(e)) {
|
|
962
974
|
const n = this.currRoot;
|
|
963
|
-
return r.currRoot = e.root, n != null && !
|
|
975
|
+
return r.currRoot = e.root, n != null && !Bt(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(Ae(e)), r.y = r.y.scale(Be(e)), r;
|
|
964
976
|
}
|
|
965
977
|
return r.x = r.x.scale(e.width), r.y = r.y.scale(e.height), r;
|
|
966
978
|
}
|
|
967
979
|
reBound(e) {
|
|
968
980
|
const r = this.copy();
|
|
969
|
-
return r.x = this.x.reBound(
|
|
981
|
+
return r.x = this.x.reBound(Ae(e)), r.y = this.y.reBound(Be(e)), r;
|
|
970
982
|
}
|
|
971
983
|
clamp(e) {
|
|
972
984
|
const r = this.copy();
|
|
973
|
-
return r.x = this.x.clamp(
|
|
985
|
+
return r.x = this.x.clamp(Ae(e)), r.y = this.y.clamp(Be(e)), r;
|
|
974
986
|
}
|
|
975
987
|
copy() {
|
|
976
|
-
const e = new
|
|
988
|
+
const e = new R();
|
|
977
989
|
return e.currRoot = this.currRoot, e.x = this.x, e.y = this.y, e;
|
|
978
990
|
}
|
|
979
991
|
reverse() {
|
|
@@ -987,7 +999,7 @@ let st = class K {
|
|
|
987
999
|
return { x: this.x.dim(e.x), y: this.y.dim(e.y) };
|
|
988
1000
|
}
|
|
989
1001
|
box(e) {
|
|
990
|
-
return
|
|
1002
|
+
return T(
|
|
991
1003
|
this.pos(e.one),
|
|
992
1004
|
this.pos(e.two),
|
|
993
1005
|
0,
|
|
@@ -1001,62 +1013,62 @@ let st = class K {
|
|
|
1001
1013
|
offset: this.pos({ x: 0, y: 0 })
|
|
1002
1014
|
};
|
|
1003
1015
|
}
|
|
1004
|
-
static IDENTITY = new
|
|
1016
|
+
static IDENTITY = new R();
|
|
1005
1017
|
};
|
|
1006
|
-
const
|
|
1018
|
+
const Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1007
1019
|
__proto__: null,
|
|
1008
|
-
Scale:
|
|
1009
|
-
XY:
|
|
1010
|
-
crudeXYTransform:
|
|
1011
|
-
transform:
|
|
1020
|
+
Scale: ct,
|
|
1021
|
+
XY: Ti,
|
|
1022
|
+
crudeXYTransform: gi,
|
|
1023
|
+
transform: pi
|
|
1012
1024
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1013
|
-
let
|
|
1025
|
+
let $r = (t, e = 21) => (r = e) => {
|
|
1014
1026
|
let n = "", s = r | 0;
|
|
1015
1027
|
for (; s--; )
|
|
1016
1028
|
n += t[Math.random() * t.length | 0];
|
|
1017
1029
|
return n;
|
|
1018
1030
|
};
|
|
1019
|
-
const
|
|
1031
|
+
const Sr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", xi = `0123456789${Sr}`, Nr = 11, $i = $r(Sr, 1), Si = $r(xi, Nr - 1), Lt = () => `${$i()}${Si()}`, Ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1020
1032
|
__proto__: null,
|
|
1021
|
-
LENGTH:
|
|
1022
|
-
create:
|
|
1023
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1033
|
+
LENGTH: Nr,
|
|
1034
|
+
create: Lt
|
|
1035
|
+
}, Symbol.toStringTag, { value: "Module" })), Ni = (t, e) => (r) => r instanceof e || typeof r == "object" && r !== null && "discriminator" in r && r.discriminator === t, Ii = a.enum(["static", "dynamic"]), Mi = a.union([
|
|
1024
1036
|
a.tuple([a.int()]),
|
|
1025
1037
|
a.tuple([a.int(), a.int().min(1).max(12)]),
|
|
1026
1038
|
a.tuple([a.int(), a.int().min(1).max(12), a.int().min(1).max(31)])
|
|
1027
|
-
]),
|
|
1039
|
+
]), Ir = (t, e) => {
|
|
1028
1040
|
const r = new b(e);
|
|
1029
1041
|
if (![
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1042
|
+
O.DAY,
|
|
1043
|
+
O.HOUR,
|
|
1044
|
+
O.MINUTE,
|
|
1045
|
+
O.SECOND,
|
|
1046
|
+
O.MILLISECOND,
|
|
1047
|
+
O.MICROSECOND,
|
|
1048
|
+
O.NANOSECOND
|
|
1037
1049
|
].some((s) => s.equals(r)))
|
|
1038
1050
|
throw new Error(
|
|
1039
1051
|
"Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
|
|
1040
1052
|
);
|
|
1041
1053
|
const n = t.valueOf() % r.valueOf();
|
|
1042
|
-
return t instanceof b ? new b(n) : new
|
|
1054
|
+
return t instanceof b ? new b(n) : new O(n);
|
|
1043
1055
|
};
|
|
1044
|
-
let b = class
|
|
1056
|
+
let b = class f extends _ {
|
|
1045
1057
|
constructor(e, r = "UTC") {
|
|
1046
|
-
if (e == null) super(
|
|
1058
|
+
if (e == null) super(f.now().valueOf());
|
|
1047
1059
|
else if (e instanceof Date)
|
|
1048
|
-
super(BigInt(e.getTime()) *
|
|
1060
|
+
super(BigInt(e.getTime()) * f.MILLISECOND.valueOf());
|
|
1049
1061
|
else if (typeof e == "string")
|
|
1050
|
-
super(
|
|
1051
|
-
else if (Array.isArray(e)) super(
|
|
1062
|
+
super(f.parseDateTimeString(e, r).valueOf());
|
|
1063
|
+
else if (Array.isArray(e)) super(f.parseDate(e));
|
|
1052
1064
|
else {
|
|
1053
1065
|
let n = 0n;
|
|
1054
|
-
e instanceof Number && (e = e.valueOf()), r === "local" && (n =
|
|
1066
|
+
e instanceof Number && (e = e.valueOf()), r === "local" && (n = f.utcOffset.valueOf()), typeof e == "number" && (isFinite(e) ? e = Math.trunc(e) : (isNaN(e) && (e = 0), e === 1 / 0 ? e = f.MAX : e = f.MIN)), super(BigInt(e.valueOf()) + n);
|
|
1055
1067
|
}
|
|
1056
1068
|
}
|
|
1057
1069
|
static parseDate([e = 1970, r = 1, n = 1]) {
|
|
1058
1070
|
const s = new Date(e, r - 1, n, 0, 0, 0, 0);
|
|
1059
|
-
return new
|
|
1071
|
+
return new f(BigInt(s.getTime()) * f.MILLISECOND.valueOf()).truncate(f.DAY).valueOf();
|
|
1060
1072
|
}
|
|
1061
1073
|
/**
|
|
1062
1074
|
* @returns the primitive value of the TimeStamp. Overrides standard JS valueOf()
|
|
@@ -1069,15 +1081,15 @@ let b = class d extends J {
|
|
|
1069
1081
|
const [n, s, i] = e.split(":");
|
|
1070
1082
|
let o = "00", c = "00";
|
|
1071
1083
|
i != null && ([o, c] = i.split("."));
|
|
1072
|
-
let
|
|
1073
|
-
return r === "local" && (
|
|
1084
|
+
let h = f.hours(parseInt(n ?? "00")).add(f.minutes(parseInt(s ?? "00"))).add(f.seconds(parseInt(o ?? "00"))).add(f.milliseconds(parseInt(c ?? "00")));
|
|
1085
|
+
return r === "local" && (h = h.add(f.utcOffset)), h.valueOf();
|
|
1074
1086
|
}
|
|
1075
1087
|
static parseDateTimeString(e, r = "UTC") {
|
|
1076
1088
|
if (!e.includes("/") && !e.includes("-"))
|
|
1077
|
-
return
|
|
1089
|
+
return f.parseTimeString(e, r);
|
|
1078
1090
|
const n = new Date(e);
|
|
1079
|
-
return e.includes(":") || n.setUTCHours(0, 0, 0, 0), new
|
|
1080
|
-
BigInt(n.getTime()) *
|
|
1091
|
+
return e.includes(":") || n.setUTCHours(0, 0, 0, 0), new f(
|
|
1092
|
+
BigInt(n.getTime()) * f.MILLISECOND.valueOf(),
|
|
1081
1093
|
r
|
|
1082
1094
|
).valueOf();
|
|
1083
1095
|
}
|
|
@@ -1109,7 +1121,7 @@ let b = class d extends J {
|
|
|
1109
1121
|
}
|
|
1110
1122
|
}
|
|
1111
1123
|
toISOString(e = "UTC") {
|
|
1112
|
-
return e === "UTC" ? this.date().toISOString() : this.sub(
|
|
1124
|
+
return e === "UTC" ? this.date().toISOString() : this.sub(f.utcOffset).date().toISOString();
|
|
1113
1125
|
}
|
|
1114
1126
|
timeString(e = !1, r = "UTC") {
|
|
1115
1127
|
const n = this.toISOString(r);
|
|
@@ -1121,8 +1133,8 @@ let b = class d extends J {
|
|
|
1121
1133
|
}
|
|
1122
1134
|
/** @returns The UTC offset for the time zone of the machine. */
|
|
1123
1135
|
static get utcOffset() {
|
|
1124
|
-
return new
|
|
1125
|
-
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) *
|
|
1136
|
+
return new O(
|
|
1137
|
+
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * f.MINUTE.valueOf()
|
|
1126
1138
|
);
|
|
1127
1139
|
}
|
|
1128
1140
|
/**
|
|
@@ -1131,7 +1143,7 @@ let b = class d extends J {
|
|
|
1131
1143
|
* @param other - The other timestamp.
|
|
1132
1144
|
*/
|
|
1133
1145
|
static since(e) {
|
|
1134
|
-
return new
|
|
1146
|
+
return new f().span(e);
|
|
1135
1147
|
}
|
|
1136
1148
|
/** @returns A JavaScript Date object representing the TimeStamp. */
|
|
1137
1149
|
date() {
|
|
@@ -1144,7 +1156,7 @@ let b = class d extends J {
|
|
|
1144
1156
|
* @returns True if the TimeStamps are equal, false otherwise.
|
|
1145
1157
|
*/
|
|
1146
1158
|
equals(e) {
|
|
1147
|
-
return this.valueOf() === new
|
|
1159
|
+
return this.valueOf() === new f(e).valueOf();
|
|
1148
1160
|
}
|
|
1149
1161
|
/**
|
|
1150
1162
|
* Creates a TimeSpan representing the duration between the two timestamps.
|
|
@@ -1164,7 +1176,7 @@ let b = class d extends J {
|
|
|
1164
1176
|
* valid, regardless of the TimeStamp order.
|
|
1165
1177
|
*/
|
|
1166
1178
|
range(e) {
|
|
1167
|
-
return new
|
|
1179
|
+
return new J(this, e).makeValid();
|
|
1168
1180
|
}
|
|
1169
1181
|
/**
|
|
1170
1182
|
* Creates a TimeRange starting at the TimeStamp and spanning the given
|
|
@@ -1193,7 +1205,7 @@ let b = class d extends J {
|
|
|
1193
1205
|
* otherwise.
|
|
1194
1206
|
*/
|
|
1195
1207
|
after(e) {
|
|
1196
|
-
return this.valueOf() > new
|
|
1208
|
+
return this.valueOf() > new f(e).valueOf();
|
|
1197
1209
|
}
|
|
1198
1210
|
/**
|
|
1199
1211
|
* Checks if the TimeStamp is after or equal to the given TimeStamp.
|
|
@@ -1203,7 +1215,7 @@ let b = class d extends J {
|
|
|
1203
1215
|
* false otherwise.
|
|
1204
1216
|
*/
|
|
1205
1217
|
afterEq(e) {
|
|
1206
|
-
return this.valueOf() >= new
|
|
1218
|
+
return this.valueOf() >= new f(e).valueOf();
|
|
1207
1219
|
}
|
|
1208
1220
|
/**
|
|
1209
1221
|
* Checks if the TimeStamp is before the given TimeStamp.
|
|
@@ -1213,7 +1225,7 @@ let b = class d extends J {
|
|
|
1213
1225
|
* otherwise.
|
|
1214
1226
|
*/
|
|
1215
1227
|
before(e) {
|
|
1216
|
-
return this.valueOf() < new
|
|
1228
|
+
return this.valueOf() < new f(e).valueOf();
|
|
1217
1229
|
}
|
|
1218
1230
|
/**
|
|
1219
1231
|
* Checks if TimeStamp is before or equal to the current timestamp.
|
|
@@ -1223,7 +1235,7 @@ let b = class d extends J {
|
|
|
1223
1235
|
* false otherwise.
|
|
1224
1236
|
*/
|
|
1225
1237
|
beforeEq(e) {
|
|
1226
|
-
return this.valueOf() <= new
|
|
1238
|
+
return this.valueOf() <= new f(e).valueOf();
|
|
1227
1239
|
}
|
|
1228
1240
|
/**
|
|
1229
1241
|
* Adds a TimeSpan to the TimeStamp.
|
|
@@ -1233,7 +1245,7 @@ let b = class d extends J {
|
|
|
1233
1245
|
* TimeSpan.
|
|
1234
1246
|
*/
|
|
1235
1247
|
add(e) {
|
|
1236
|
-
return new
|
|
1248
|
+
return new f(ie(this.valueOf(), new O(e).valueOf()));
|
|
1237
1249
|
}
|
|
1238
1250
|
/**
|
|
1239
1251
|
* Subtracts a TimeSpan from the TimeStamp.
|
|
@@ -1243,43 +1255,43 @@ let b = class d extends J {
|
|
|
1243
1255
|
* TimeSpan.
|
|
1244
1256
|
*/
|
|
1245
1257
|
sub(e) {
|
|
1246
|
-
return new
|
|
1258
|
+
return new f(P(this.valueOf(), new O(e).valueOf()));
|
|
1247
1259
|
}
|
|
1248
1260
|
/**
|
|
1249
1261
|
* @returns the floating point number of hours since the unix epoch to the timestamp
|
|
1250
1262
|
* value.
|
|
1251
1263
|
*/
|
|
1252
1264
|
get hours() {
|
|
1253
|
-
return Number(this.valueOf()) / Number(
|
|
1265
|
+
return Number(this.valueOf()) / Number(O.HOUR.valueOf());
|
|
1254
1266
|
}
|
|
1255
1267
|
/**
|
|
1256
1268
|
* @returns the floating point number of minutes since the unix epoch to the timestamp
|
|
1257
1269
|
* value.
|
|
1258
1270
|
*/
|
|
1259
1271
|
get minutes() {
|
|
1260
|
-
return Number(this.valueOf()) / Number(
|
|
1272
|
+
return Number(this.valueOf()) / Number(O.MINUTE.valueOf());
|
|
1261
1273
|
}
|
|
1262
1274
|
/**
|
|
1263
1275
|
* @returns the floating point number of days since the unix epoch to the timestamp
|
|
1264
1276
|
* value.
|
|
1265
1277
|
*/
|
|
1266
1278
|
get days() {
|
|
1267
|
-
return Number(this.valueOf()) / Number(
|
|
1279
|
+
return Number(this.valueOf()) / Number(O.DAY.valueOf());
|
|
1268
1280
|
}
|
|
1269
1281
|
/**
|
|
1270
1282
|
* @returns the floating point number of seconds since the unix epoch to the timestamp
|
|
1271
1283
|
* value.
|
|
1272
1284
|
*/
|
|
1273
1285
|
get seconds() {
|
|
1274
|
-
return Number(this.valueOf()) / Number(
|
|
1286
|
+
return Number(this.valueOf()) / Number(O.SECOND.valueOf());
|
|
1275
1287
|
}
|
|
1276
1288
|
/** @returns the floating point number of milliseconds since the unix epoch. */
|
|
1277
1289
|
get milliseconds() {
|
|
1278
|
-
return Number(this.valueOf()) / Number(
|
|
1290
|
+
return Number(this.valueOf()) / Number(f.MILLISECOND.valueOf());
|
|
1279
1291
|
}
|
|
1280
1292
|
/** @returns the floating point number of microseconds since the unix epoch. */
|
|
1281
1293
|
get microseconds() {
|
|
1282
|
-
return Number(this.valueOf()) / Number(
|
|
1294
|
+
return Number(this.valueOf()) / Number(f.MICROSECOND.valueOf());
|
|
1283
1295
|
}
|
|
1284
1296
|
/**
|
|
1285
1297
|
* @returns the floating point number of nanoseconds since the unix epoch.
|
|
@@ -1299,7 +1311,7 @@ let b = class d extends J {
|
|
|
1299
1311
|
*/
|
|
1300
1312
|
setYear(e) {
|
|
1301
1313
|
const r = this.date();
|
|
1302
|
-
return r.setUTCFullYear(e), new
|
|
1314
|
+
return r.setUTCFullYear(e), new f(r);
|
|
1303
1315
|
}
|
|
1304
1316
|
/** @returns the integer month that the timestamp corresponds to with its year. */
|
|
1305
1317
|
get month() {
|
|
@@ -1311,7 +1323,7 @@ let b = class d extends J {
|
|
|
1311
1323
|
*/
|
|
1312
1324
|
setMonth(e) {
|
|
1313
1325
|
const r = this.date();
|
|
1314
|
-
return r.setUTCMonth(e), new
|
|
1326
|
+
return r.setUTCMonth(e), new f(r);
|
|
1315
1327
|
}
|
|
1316
1328
|
/** @returns the integer day that the timestamp corresponds to within its month. */
|
|
1317
1329
|
get day() {
|
|
@@ -1323,7 +1335,7 @@ let b = class d extends J {
|
|
|
1323
1335
|
*/
|
|
1324
1336
|
setDay(e) {
|
|
1325
1337
|
const r = this.date();
|
|
1326
|
-
return r.setUTCDate(e), new
|
|
1338
|
+
return r.setUTCDate(e), new f(r);
|
|
1327
1339
|
}
|
|
1328
1340
|
/**
|
|
1329
1341
|
* @returns the integer hour that the timestamp corresponds to within its day.
|
|
@@ -1337,7 +1349,7 @@ let b = class d extends J {
|
|
|
1337
1349
|
*/
|
|
1338
1350
|
setHour(e) {
|
|
1339
1351
|
const r = this.date();
|
|
1340
|
-
return r.setUTCHours(e), new
|
|
1352
|
+
return r.setUTCHours(e), new f(r, "UTC");
|
|
1341
1353
|
}
|
|
1342
1354
|
/** @returns the integer minute that the timestamp corresponds to within its hour. */
|
|
1343
1355
|
get minute() {
|
|
@@ -1349,7 +1361,7 @@ let b = class d extends J {
|
|
|
1349
1361
|
*/
|
|
1350
1362
|
setMinute(e) {
|
|
1351
1363
|
const r = this.date();
|
|
1352
|
-
return r.setUTCMinutes(e), new
|
|
1364
|
+
return r.setUTCMinutes(e), new f(r);
|
|
1353
1365
|
}
|
|
1354
1366
|
/**
|
|
1355
1367
|
* @returns the integer second that the timestamp corresponds to within its
|
|
@@ -1364,7 +1376,7 @@ let b = class d extends J {
|
|
|
1364
1376
|
*/
|
|
1365
1377
|
setSecond(e) {
|
|
1366
1378
|
const r = this.date();
|
|
1367
|
-
return r.setUTCSeconds(e), new
|
|
1379
|
+
return r.setUTCSeconds(e), new f(r);
|
|
1368
1380
|
}
|
|
1369
1381
|
/**
|
|
1370
1382
|
* @reutrns the integer millisecond that the timestamp corresponds to within
|
|
@@ -1379,7 +1391,7 @@ let b = class d extends J {
|
|
|
1379
1391
|
*/
|
|
1380
1392
|
setMillisecond(e) {
|
|
1381
1393
|
const r = this.date();
|
|
1382
|
-
return r.setUTCMilliseconds(e), new
|
|
1394
|
+
return r.setUTCMilliseconds(e), new f(r);
|
|
1383
1395
|
}
|
|
1384
1396
|
/** @returns the time stamp formatted as an ISO string. */
|
|
1385
1397
|
toString() {
|
|
@@ -1397,11 +1409,11 @@ let b = class d extends J {
|
|
|
1397
1409
|
* @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
|
|
1398
1410
|
*/
|
|
1399
1411
|
remainder(e) {
|
|
1400
|
-
return
|
|
1412
|
+
return Ir(this, e);
|
|
1401
1413
|
}
|
|
1402
1414
|
/** @returns true if the day portion TimeStamp is today, false otherwise. */
|
|
1403
1415
|
get isToday() {
|
|
1404
|
-
return this.truncate(
|
|
1416
|
+
return this.truncate(O.DAY).equals(f.now().truncate(O.DAY));
|
|
1405
1417
|
}
|
|
1406
1418
|
/**
|
|
1407
1419
|
* Truncates the TimeStamp to the nearest multiple of the given span.
|
|
@@ -1418,7 +1430,7 @@ let b = class d extends J {
|
|
|
1418
1430
|
* JavaScript can do).
|
|
1419
1431
|
*/
|
|
1420
1432
|
static now() {
|
|
1421
|
-
return new
|
|
1433
|
+
return new f(/* @__PURE__ */ new Date());
|
|
1422
1434
|
}
|
|
1423
1435
|
/**
|
|
1424
1436
|
* Finds the maximum timestamp among the provided timestamps.
|
|
@@ -1427,9 +1439,9 @@ let b = class d extends J {
|
|
|
1427
1439
|
* @returns The maximum (latest) timestamp from the input.
|
|
1428
1440
|
*/
|
|
1429
1441
|
static max(...e) {
|
|
1430
|
-
let r =
|
|
1442
|
+
let r = f.MIN;
|
|
1431
1443
|
for (const n of e) {
|
|
1432
|
-
const s = new
|
|
1444
|
+
const s = new f(n);
|
|
1433
1445
|
s.after(r) && (r = s);
|
|
1434
1446
|
}
|
|
1435
1447
|
return r;
|
|
@@ -1441,9 +1453,9 @@ let b = class d extends J {
|
|
|
1441
1453
|
* @returns The minimum (earliest) timestamp from the input.
|
|
1442
1454
|
*/
|
|
1443
1455
|
static min(...e) {
|
|
1444
|
-
let r =
|
|
1456
|
+
let r = f.MAX;
|
|
1445
1457
|
for (const n of e) {
|
|
1446
|
-
const s = new
|
|
1458
|
+
const s = new f(n);
|
|
1447
1459
|
s.before(r) && (r = s);
|
|
1448
1460
|
}
|
|
1449
1461
|
return r;
|
|
@@ -1455,62 +1467,62 @@ let b = class d extends J {
|
|
|
1455
1467
|
* @returns A TimeStamp representing the given number of nanoseconds.
|
|
1456
1468
|
*/
|
|
1457
1469
|
static nanoseconds(e, r = "UTC") {
|
|
1458
|
-
return new
|
|
1470
|
+
return new f(e, r);
|
|
1459
1471
|
}
|
|
1460
1472
|
/** One nanosecond after the unix epoch */
|
|
1461
|
-
static NANOSECOND =
|
|
1473
|
+
static NANOSECOND = f.nanoseconds(1);
|
|
1462
1474
|
/** @returns a new TimeStamp n microseconds after the unix epoch */
|
|
1463
1475
|
static microseconds(e, r = "UTC") {
|
|
1464
|
-
return
|
|
1476
|
+
return f.nanoseconds(e * 1e3, r);
|
|
1465
1477
|
}
|
|
1466
1478
|
/** One microsecond after the unix epoch */
|
|
1467
|
-
static MICROSECOND =
|
|
1479
|
+
static MICROSECOND = f.microseconds(1);
|
|
1468
1480
|
/** @returns a new TimeStamp n milliseconds after the unix epoch */
|
|
1469
1481
|
static milliseconds(e, r = "UTC") {
|
|
1470
|
-
return
|
|
1482
|
+
return f.microseconds(e * 1e3, r);
|
|
1471
1483
|
}
|
|
1472
1484
|
/** One millisecond after the unix epoch */
|
|
1473
|
-
static MILLISECOND =
|
|
1485
|
+
static MILLISECOND = f.milliseconds(1);
|
|
1474
1486
|
/** @returns a new TimeStamp n seconds after the unix epoch */
|
|
1475
1487
|
static seconds(e, r = "UTC") {
|
|
1476
|
-
return
|
|
1488
|
+
return f.milliseconds(e * 1e3, r);
|
|
1477
1489
|
}
|
|
1478
1490
|
/** One second after the unix epoch */
|
|
1479
|
-
static SECOND =
|
|
1491
|
+
static SECOND = f.seconds(1);
|
|
1480
1492
|
/** @returns a new TimeStamp n minutes after the unix epoch */
|
|
1481
1493
|
static minutes(e, r = "UTC") {
|
|
1482
|
-
return
|
|
1494
|
+
return f.seconds(e * 60, r);
|
|
1483
1495
|
}
|
|
1484
1496
|
/** One minute after the unix epoch */
|
|
1485
|
-
static MINUTE =
|
|
1497
|
+
static MINUTE = f.minutes(1);
|
|
1486
1498
|
/** @returns a new TimeStamp n hours after the unix epoch */
|
|
1487
1499
|
static hours(e, r = "UTC") {
|
|
1488
|
-
return
|
|
1500
|
+
return f.minutes(e * 60, r);
|
|
1489
1501
|
}
|
|
1490
1502
|
/** One hour after the unix epoch */
|
|
1491
|
-
static HOUR =
|
|
1503
|
+
static HOUR = f.hours(1);
|
|
1492
1504
|
/** @returns a new TimeStamp n days after the unix epoch */
|
|
1493
1505
|
static days(e, r = "UTC") {
|
|
1494
|
-
return
|
|
1506
|
+
return f.hours(e * 24, r);
|
|
1495
1507
|
}
|
|
1496
1508
|
/** One day after the unix epoch */
|
|
1497
|
-
static DAY =
|
|
1509
|
+
static DAY = f.days(1);
|
|
1498
1510
|
/** The maximum possible value for a timestamp */
|
|
1499
|
-
static MAX = new
|
|
1511
|
+
static MAX = new f((1n << 63n) - 1n);
|
|
1500
1512
|
/** The minimum possible value for a timestamp */
|
|
1501
|
-
static MIN = new
|
|
1513
|
+
static MIN = new f(0);
|
|
1502
1514
|
/** The unix epoch */
|
|
1503
|
-
static ZERO = new
|
|
1515
|
+
static ZERO = new f(0);
|
|
1504
1516
|
/** A zod schema for validating timestamps */
|
|
1505
1517
|
static z = a.union([
|
|
1506
|
-
a.instanceof(
|
|
1507
|
-
a.object({ value: a.bigint() }).transform((e) => new
|
|
1508
|
-
a.string().transform((e) => new
|
|
1509
|
-
a.number().transform((e) => new
|
|
1510
|
-
a.bigint().transform((e) => new
|
|
1511
|
-
a.date().transform((e) => new
|
|
1512
|
-
a.custom((e) => e instanceof
|
|
1513
|
-
|
|
1518
|
+
a.instanceof(f),
|
|
1519
|
+
a.object({ value: a.bigint() }).transform((e) => new f(e.value)),
|
|
1520
|
+
a.string().transform((e) => new f(BigInt(e))),
|
|
1521
|
+
a.number().transform((e) => new f(e)),
|
|
1522
|
+
a.bigint().transform((e) => new f(e)),
|
|
1523
|
+
a.date().transform((e) => new f(e)),
|
|
1524
|
+
a.custom((e) => e instanceof O).transform((e) => new f(e)),
|
|
1525
|
+
Mi.transform((e) => new f(e))
|
|
1514
1526
|
]);
|
|
1515
1527
|
/**
|
|
1516
1528
|
* Sorts two timestamps.
|
|
@@ -1523,8 +1535,7 @@ let b = class d extends J {
|
|
|
1523
1535
|
static sort(e, r) {
|
|
1524
1536
|
return Number(e.valueOf() - r.valueOf());
|
|
1525
1537
|
}
|
|
1526
|
-
}
|
|
1527
|
-
class h extends J {
|
|
1538
|
+
}, O = class g extends _ {
|
|
1528
1539
|
constructor(e) {
|
|
1529
1540
|
typeof e == "number" && (e = Math.trunc(e.valueOf())), super(BigInt(e.valueOf()));
|
|
1530
1541
|
}
|
|
@@ -1535,7 +1546,7 @@ class h extends J {
|
|
|
1535
1546
|
* @returns A TimeSpan representing the given number of seconds.
|
|
1536
1547
|
*/
|
|
1537
1548
|
static fromSeconds(e) {
|
|
1538
|
-
return e instanceof
|
|
1549
|
+
return e instanceof g ? e : e instanceof E ? e.period : e instanceof b ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.seconds(e) : new g(e);
|
|
1539
1550
|
}
|
|
1540
1551
|
/**
|
|
1541
1552
|
* Creates a TimeSpan representing the given number of milliseconds.
|
|
@@ -1544,7 +1555,7 @@ class h extends J {
|
|
|
1544
1555
|
* @returns A TimeSpan representing the given number of milliseconds.
|
|
1545
1556
|
*/
|
|
1546
1557
|
static fromMilliseconds(e) {
|
|
1547
|
-
return e instanceof
|
|
1558
|
+
return e instanceof g ? e : e instanceof E ? e.period : e instanceof b ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.milliseconds(e) : new g(e);
|
|
1548
1559
|
}
|
|
1549
1560
|
/**
|
|
1550
1561
|
* @returns the primitive value of the TimeSpan. Overrides standard JS valueOf()
|
|
@@ -1560,7 +1571,7 @@ class h extends J {
|
|
|
1560
1571
|
* @returns True if the TimeSpan is less than the other TimeSpan, false otherwise.
|
|
1561
1572
|
*/
|
|
1562
1573
|
lessThan(e) {
|
|
1563
|
-
return this.valueOf() < new
|
|
1574
|
+
return this.valueOf() < new g(e).valueOf();
|
|
1564
1575
|
}
|
|
1565
1576
|
/**
|
|
1566
1577
|
* Checks if the TimeSpan is greater than another TimeSpan.
|
|
@@ -1569,7 +1580,7 @@ class h extends J {
|
|
|
1569
1580
|
* @returns True if the TimeSpan is greater than the other TimeSpan, false otherwise.
|
|
1570
1581
|
*/
|
|
1571
1582
|
greaterThan(e) {
|
|
1572
|
-
return this.valueOf() > new
|
|
1583
|
+
return this.valueOf() > new g(e).valueOf();
|
|
1573
1584
|
}
|
|
1574
1585
|
/**
|
|
1575
1586
|
* Checks if the TimeSpan is less than or equal to another TimeSpan.
|
|
@@ -1578,7 +1589,7 @@ class h extends J {
|
|
|
1578
1589
|
* @returns True if the TimeSpan is less than or equal to the other TimeSpan, false otherwise.
|
|
1579
1590
|
*/
|
|
1580
1591
|
lessThanOrEqual(e) {
|
|
1581
|
-
return this.valueOf() <= new
|
|
1592
|
+
return this.valueOf() <= new g(e).valueOf();
|
|
1582
1593
|
}
|
|
1583
1594
|
/**
|
|
1584
1595
|
* Checks if the TimeSpan is greater than or equal to another TimeSpan.
|
|
@@ -1587,7 +1598,7 @@ class h extends J {
|
|
|
1587
1598
|
* @returns True if the TimeSpan is greater than or equal to the other TimeSpan, false otherwise.
|
|
1588
1599
|
*/
|
|
1589
1600
|
greaterThanOrEqual(e) {
|
|
1590
|
-
return this.valueOf() >= new
|
|
1601
|
+
return this.valueOf() >= new g(e).valueOf();
|
|
1591
1602
|
}
|
|
1592
1603
|
/**
|
|
1593
1604
|
* Calculates the remainder of the TimeSpan when divided by another TimeSpan.
|
|
@@ -1596,7 +1607,7 @@ class h extends J {
|
|
|
1596
1607
|
* @returns A new TimeSpan representing the remainder.
|
|
1597
1608
|
*/
|
|
1598
1609
|
remainder(e) {
|
|
1599
|
-
return
|
|
1610
|
+
return Ir(this, e);
|
|
1600
1611
|
}
|
|
1601
1612
|
/**
|
|
1602
1613
|
* Truncates the TimeSpan to the nearest multiple of the given span.
|
|
@@ -1605,7 +1616,7 @@ class h extends J {
|
|
|
1605
1616
|
* @returns A new TimeSpan that is truncated to the nearest multiple of the given span.
|
|
1606
1617
|
*/
|
|
1607
1618
|
truncate(e) {
|
|
1608
|
-
return new
|
|
1619
|
+
return new g(
|
|
1609
1620
|
BigInt(Math.trunc(Number(this.valueOf() / e.valueOf()))) * e.valueOf()
|
|
1610
1621
|
);
|
|
1611
1622
|
}
|
|
@@ -1615,9 +1626,9 @@ class h extends J {
|
|
|
1615
1626
|
* @returns A string representation of the TimeSpan.
|
|
1616
1627
|
*/
|
|
1617
1628
|
toString() {
|
|
1618
|
-
const e = this.truncate(
|
|
1619
|
-
let
|
|
1620
|
-
return
|
|
1629
|
+
const e = this.truncate(g.DAY), r = this.truncate(g.HOUR), n = this.truncate(g.MINUTE), s = this.truncate(g.SECOND), i = this.truncate(g.MILLISECOND), o = this.truncate(g.MICROSECOND), c = this.truncate(g.NANOSECOND), h = e, l = r.sub(e), d = n.sub(r), m = s.sub(n), p = i.sub(s), j = o.sub(i), A = c.sub(o);
|
|
1630
|
+
let k = "";
|
|
1631
|
+
return h.isZero || (k += `${h.days}d `), l.isZero || (k += `${l.hours}h `), d.isZero || (k += `${d.minutes}m `), m.isZero || (k += `${m.seconds}s `), p.isZero || (k += `${p.milliseconds}ms `), j.isZero || (k += `${j.microseconds}µs `), A.isZero || (k += `${A.nanoseconds}ns`), k.trim();
|
|
1621
1632
|
}
|
|
1622
1633
|
/**
|
|
1623
1634
|
* Multiplies the TimeSpan by a scalar value.
|
|
@@ -1626,31 +1637,40 @@ class h extends J {
|
|
|
1626
1637
|
* @returns A new TimeSpan that is this TimeSpan multiplied by the provided value.
|
|
1627
1638
|
*/
|
|
1628
1639
|
mult(e) {
|
|
1629
|
-
return new
|
|
1640
|
+
return new g(B(this.valueOf(), e));
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Divides the TimeSpan by a scalar value.
|
|
1644
|
+
*
|
|
1645
|
+
* @param value - The scalar value to divide by.
|
|
1646
|
+
* @returns A new TimeSpan that is this TimeSpan divided by the provided value.
|
|
1647
|
+
*/
|
|
1648
|
+
div(e) {
|
|
1649
|
+
return new g(we(this.valueOf(), e));
|
|
1630
1650
|
}
|
|
1631
1651
|
/** @returns the decimal number of days in the TimeSpan. */
|
|
1632
1652
|
get days() {
|
|
1633
|
-
return Number(this.valueOf()) / Number(
|
|
1653
|
+
return Number(this.valueOf()) / Number(g.DAY.valueOf());
|
|
1634
1654
|
}
|
|
1635
1655
|
/** @returns the decimal number of hours in the TimeSpan. */
|
|
1636
1656
|
get hours() {
|
|
1637
|
-
return Number(this.valueOf()) / Number(
|
|
1657
|
+
return Number(this.valueOf()) / Number(g.HOUR.valueOf());
|
|
1638
1658
|
}
|
|
1639
1659
|
/** @returns the decimal number of minutes in the TimeSpan. */
|
|
1640
1660
|
get minutes() {
|
|
1641
|
-
return Number(this.valueOf()) / Number(
|
|
1661
|
+
return Number(this.valueOf()) / Number(g.MINUTE.valueOf());
|
|
1642
1662
|
}
|
|
1643
1663
|
/** @returns The number of seconds in the TimeSpan. */
|
|
1644
1664
|
get seconds() {
|
|
1645
|
-
return Number(this.valueOf()) / Number(
|
|
1665
|
+
return Number(this.valueOf()) / Number(g.SECOND.valueOf());
|
|
1646
1666
|
}
|
|
1647
1667
|
/** @returns The number of milliseconds in the TimeSpan. */
|
|
1648
1668
|
get milliseconds() {
|
|
1649
|
-
return Number(this.valueOf()) / Number(
|
|
1669
|
+
return Number(this.valueOf()) / Number(g.MILLISECOND.valueOf());
|
|
1650
1670
|
}
|
|
1651
1671
|
/** @returns The number of microseconds in the TimeSpan. */
|
|
1652
1672
|
get microseconds() {
|
|
1653
|
-
return Number(this.valueOf()) / Number(
|
|
1673
|
+
return Number(this.valueOf()) / Number(g.MICROSECOND.valueOf());
|
|
1654
1674
|
}
|
|
1655
1675
|
/** @returns The number of nanoseconds in the TimeSpan. */
|
|
1656
1676
|
get nanoseconds() {
|
|
@@ -1670,7 +1690,7 @@ class h extends J {
|
|
|
1670
1690
|
* @returns True if the TimeSpans are equal, false otherwise.
|
|
1671
1691
|
*/
|
|
1672
1692
|
equals(e) {
|
|
1673
|
-
return this.valueOf() === new
|
|
1693
|
+
return this.valueOf() === new g(e).valueOf();
|
|
1674
1694
|
}
|
|
1675
1695
|
/**
|
|
1676
1696
|
* Adds a TimeSpan to the TimeSpan.
|
|
@@ -1678,7 +1698,7 @@ class h extends J {
|
|
|
1678
1698
|
* @returns A new TimeSpan representing the sum of the two TimeSpans.
|
|
1679
1699
|
*/
|
|
1680
1700
|
add(e) {
|
|
1681
|
-
return new
|
|
1701
|
+
return new g(this.valueOf() + new g(e).valueOf());
|
|
1682
1702
|
}
|
|
1683
1703
|
/**
|
|
1684
1704
|
* Creates a TimeSpan representing the duration between the two timestamps.
|
|
@@ -1686,7 +1706,7 @@ class h extends J {
|
|
|
1686
1706
|
* @param other
|
|
1687
1707
|
*/
|
|
1688
1708
|
sub(e) {
|
|
1689
|
-
return new
|
|
1709
|
+
return new g(this.valueOf() - new g(e).valueOf());
|
|
1690
1710
|
}
|
|
1691
1711
|
/**
|
|
1692
1712
|
* Creates a TimeSpan representing the given number of nanoseconds.
|
|
@@ -1695,10 +1715,10 @@ class h extends J {
|
|
|
1695
1715
|
* @returns A TimeSpan representing the given number of nanoseconds.
|
|
1696
1716
|
*/
|
|
1697
1717
|
static nanoseconds(e = 1) {
|
|
1698
|
-
return new
|
|
1718
|
+
return new g(e);
|
|
1699
1719
|
}
|
|
1700
1720
|
/** A nanosecond. */
|
|
1701
|
-
static NANOSECOND =
|
|
1721
|
+
static NANOSECOND = g.nanoseconds(1);
|
|
1702
1722
|
/**
|
|
1703
1723
|
* Creates a TimeSpan representing the given number of microseconds.
|
|
1704
1724
|
*
|
|
@@ -1706,10 +1726,10 @@ class h extends J {
|
|
|
1706
1726
|
* @returns A TimeSpan representing the given number of microseconds.
|
|
1707
1727
|
*/
|
|
1708
1728
|
static microseconds(e = 1) {
|
|
1709
|
-
return
|
|
1729
|
+
return g.nanoseconds(B(e, 1e3));
|
|
1710
1730
|
}
|
|
1711
1731
|
/** A microsecond. */
|
|
1712
|
-
static MICROSECOND =
|
|
1732
|
+
static MICROSECOND = g.microseconds(1);
|
|
1713
1733
|
/**
|
|
1714
1734
|
* Creates a TimeSpan representing the given number of milliseconds.
|
|
1715
1735
|
*
|
|
@@ -1717,10 +1737,10 @@ class h extends J {
|
|
|
1717
1737
|
* @returns A TimeSpan representing the given number of milliseconds.
|
|
1718
1738
|
*/
|
|
1719
1739
|
static milliseconds(e = 1) {
|
|
1720
|
-
return
|
|
1740
|
+
return g.microseconds(B(e, 1e3));
|
|
1721
1741
|
}
|
|
1722
1742
|
/** A millisecond. */
|
|
1723
|
-
static MILLISECOND =
|
|
1743
|
+
static MILLISECOND = g.milliseconds(1);
|
|
1724
1744
|
/**
|
|
1725
1745
|
* Creates a TimeSpan representing the given number of seconds.
|
|
1726
1746
|
*
|
|
@@ -1728,10 +1748,10 @@ class h extends J {
|
|
|
1728
1748
|
* @returns A TimeSpan representing the given number of seconds.
|
|
1729
1749
|
*/
|
|
1730
1750
|
static seconds(e = 1) {
|
|
1731
|
-
return
|
|
1751
|
+
return g.milliseconds(B(e, 1e3));
|
|
1732
1752
|
}
|
|
1733
1753
|
/** A second. */
|
|
1734
|
-
static SECOND =
|
|
1754
|
+
static SECOND = g.seconds(1);
|
|
1735
1755
|
/**
|
|
1736
1756
|
* Creates a TimeSpan representing the given number of minutes.
|
|
1737
1757
|
*
|
|
@@ -1739,10 +1759,10 @@ class h extends J {
|
|
|
1739
1759
|
* @returns A TimeSpan representing the given number of minutes.
|
|
1740
1760
|
*/
|
|
1741
1761
|
static minutes(e = 1) {
|
|
1742
|
-
return
|
|
1762
|
+
return g.seconds(B(e, 60));
|
|
1743
1763
|
}
|
|
1744
1764
|
/** A minute. */
|
|
1745
|
-
static MINUTE =
|
|
1765
|
+
static MINUTE = g.minutes(1);
|
|
1746
1766
|
/**
|
|
1747
1767
|
* Creates a TimeSpan representing the given number of hours.
|
|
1748
1768
|
*
|
|
@@ -1750,10 +1770,10 @@ class h extends J {
|
|
|
1750
1770
|
* @returns A TimeSpan representing the given number of hours.
|
|
1751
1771
|
*/
|
|
1752
1772
|
static hours(e) {
|
|
1753
|
-
return
|
|
1773
|
+
return g.minutes(B(e, 60));
|
|
1754
1774
|
}
|
|
1755
1775
|
/** Represents an hour. */
|
|
1756
|
-
static HOUR =
|
|
1776
|
+
static HOUR = g.hours(1);
|
|
1757
1777
|
/**
|
|
1758
1778
|
* Creates a TimeSpan representing the given number of days.
|
|
1759
1779
|
*
|
|
@@ -1761,25 +1781,28 @@ class h extends J {
|
|
|
1761
1781
|
* @returns A TimeSpan representing the given number of days.
|
|
1762
1782
|
*/
|
|
1763
1783
|
static days(e) {
|
|
1764
|
-
return
|
|
1784
|
+
return g.hours(B(e, 24));
|
|
1765
1785
|
}
|
|
1766
1786
|
/** Represents a day. */
|
|
1767
|
-
static DAY =
|
|
1787
|
+
static DAY = g.days(1);
|
|
1768
1788
|
/** The maximum possible value for a TimeSpan. */
|
|
1769
|
-
static MAX = new
|
|
1789
|
+
static MAX = new g((1n << 63n) - 1n);
|
|
1770
1790
|
/** The minimum possible value for a TimeSpan. */
|
|
1771
|
-
static MIN = new
|
|
1791
|
+
static MIN = new g(0);
|
|
1772
1792
|
/** The zero value for a TimeSpan. */
|
|
1773
|
-
static ZERO = new
|
|
1793
|
+
static ZERO = new g(0);
|
|
1774
1794
|
/** A zod schema for validating and transforming timespans */
|
|
1775
1795
|
static z = a.union([
|
|
1776
|
-
a.object({ value: a.bigint() }).transform((e) => new
|
|
1777
|
-
a.string().transform((e) => new
|
|
1778
|
-
a.number().transform((e) => new
|
|
1779
|
-
a.
|
|
1796
|
+
a.object({ value: a.bigint() }).transform((e) => new g(e.value)),
|
|
1797
|
+
a.string().transform((e) => new g(BigInt(e))),
|
|
1798
|
+
a.number().transform((e) => new g(e)),
|
|
1799
|
+
a.bigint().transform((e) => new g(e)),
|
|
1800
|
+
a.instanceof(g),
|
|
1801
|
+
a.instanceof(b).transform((e) => new g(e)),
|
|
1802
|
+
a.custom((e) => e instanceof E).transform((e) => new g(e))
|
|
1780
1803
|
]);
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1804
|
+
};
|
|
1805
|
+
class E extends _ {
|
|
1783
1806
|
constructor(e) {
|
|
1784
1807
|
super(e.valueOf());
|
|
1785
1808
|
}
|
|
@@ -1789,7 +1812,7 @@ let Lt = class Q extends J {
|
|
|
1789
1812
|
}
|
|
1790
1813
|
/** @returns The number of seconds in the Rate. */
|
|
1791
1814
|
equals(e) {
|
|
1792
|
-
return this.valueOf() === new
|
|
1815
|
+
return this.valueOf() === new E(e).valueOf();
|
|
1793
1816
|
}
|
|
1794
1817
|
/**
|
|
1795
1818
|
* Calculates the period of the Rate as a TimeSpan.
|
|
@@ -1797,7 +1820,7 @@ let Lt = class Q extends J {
|
|
|
1797
1820
|
* @returns A TimeSpan representing the period of the Rate.
|
|
1798
1821
|
*/
|
|
1799
1822
|
get period() {
|
|
1800
|
-
return
|
|
1823
|
+
return O.seconds(1 / this.valueOf());
|
|
1801
1824
|
}
|
|
1802
1825
|
/**
|
|
1803
1826
|
* Calculates the number of samples in the given TimeSpan at this rate.
|
|
@@ -1806,7 +1829,7 @@ let Lt = class Q extends J {
|
|
|
1806
1829
|
* @returns The number of samples in the given TimeSpan at this rate.
|
|
1807
1830
|
*/
|
|
1808
1831
|
sampleCount(e) {
|
|
1809
|
-
return new
|
|
1832
|
+
return new O(e).seconds * this.valueOf();
|
|
1810
1833
|
}
|
|
1811
1834
|
/**
|
|
1812
1835
|
* Calculates the number of bytes in the given TimeSpan at this rate.
|
|
@@ -1816,7 +1839,7 @@ let Lt = class Q extends J {
|
|
|
1816
1839
|
* @returns The number of bytes in the given TimeSpan at this rate.
|
|
1817
1840
|
*/
|
|
1818
1841
|
byteCount(e, r) {
|
|
1819
|
-
return this.sampleCount(e) * new
|
|
1842
|
+
return this.sampleCount(e) * new I(r).valueOf();
|
|
1820
1843
|
}
|
|
1821
1844
|
/**
|
|
1822
1845
|
* Calculates a TimeSpan given the number of samples at this rate.
|
|
@@ -1825,7 +1848,7 @@ let Lt = class Q extends J {
|
|
|
1825
1848
|
* @returns A TimeSpan that corresponds to the given number of samples.
|
|
1826
1849
|
*/
|
|
1827
1850
|
span(e) {
|
|
1828
|
-
return
|
|
1851
|
+
return O.seconds(e / this.valueOf());
|
|
1829
1852
|
}
|
|
1830
1853
|
/**
|
|
1831
1854
|
* Calculates a TimeSpan given the number of bytes at this rate.
|
|
@@ -1837,6 +1860,42 @@ let Lt = class Q extends J {
|
|
|
1837
1860
|
byteSpan(e, r) {
|
|
1838
1861
|
return this.span(e.valueOf() / r.valueOf());
|
|
1839
1862
|
}
|
|
1863
|
+
/**
|
|
1864
|
+
* Adds another Rate to this Rate.
|
|
1865
|
+
*
|
|
1866
|
+
* @param other - The Rate to add.
|
|
1867
|
+
* @returns A new Rate representing the sum of the two rates.
|
|
1868
|
+
*/
|
|
1869
|
+
add(e) {
|
|
1870
|
+
return new E(ie(this.valueOf(), e.valueOf()));
|
|
1871
|
+
}
|
|
1872
|
+
/**
|
|
1873
|
+
* Subtracts another Rate from this Rate.
|
|
1874
|
+
*
|
|
1875
|
+
* @param other - The Rate to subtract.
|
|
1876
|
+
* @returns A new Rate representing the difference of the two rates.
|
|
1877
|
+
*/
|
|
1878
|
+
sub(e) {
|
|
1879
|
+
return new E(P(this.valueOf(), e.valueOf()));
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Multiplies this Rate by a scalar value.
|
|
1883
|
+
*
|
|
1884
|
+
* @param value - The scalar value to multiply by.
|
|
1885
|
+
* @returns A new Rate representing this Rate multiplied by the value.
|
|
1886
|
+
*/
|
|
1887
|
+
mult(e) {
|
|
1888
|
+
return new E(B(this.valueOf(), e));
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* Divides this Rate by a scalar value.
|
|
1892
|
+
*
|
|
1893
|
+
* @param value - The scalar value to divide by.
|
|
1894
|
+
* @returns A new Rate representing this Rate divided by the value.
|
|
1895
|
+
*/
|
|
1896
|
+
div(e) {
|
|
1897
|
+
return new E(we(this.valueOf(), e));
|
|
1898
|
+
}
|
|
1840
1899
|
/**
|
|
1841
1900
|
* Creates a Rate representing the given number of Hz.
|
|
1842
1901
|
*
|
|
@@ -1844,7 +1903,7 @@ let Lt = class Q extends J {
|
|
|
1844
1903
|
* @returns A Rate representing the given number of Hz.
|
|
1845
1904
|
*/
|
|
1846
1905
|
static hz(e) {
|
|
1847
|
-
return new
|
|
1906
|
+
return new E(e);
|
|
1848
1907
|
}
|
|
1849
1908
|
/**
|
|
1850
1909
|
* Creates a Rate representing the given number of kHz.
|
|
@@ -1853,14 +1912,15 @@ let Lt = class Q extends J {
|
|
|
1853
1912
|
* @returns A Rate representing the given number of kHz.
|
|
1854
1913
|
*/
|
|
1855
1914
|
static khz(e) {
|
|
1856
|
-
return
|
|
1915
|
+
return E.hz(e * 1e3);
|
|
1857
1916
|
}
|
|
1858
1917
|
/** A zod schema for validating and transforming rates */
|
|
1859
1918
|
static z = a.union([
|
|
1860
|
-
a.number().transform((e) => new
|
|
1861
|
-
a.instanceof(
|
|
1919
|
+
a.number().transform((e) => new E(e)),
|
|
1920
|
+
a.instanceof(E)
|
|
1862
1921
|
]);
|
|
1863
|
-
}
|
|
1922
|
+
}
|
|
1923
|
+
let I = class M extends _ {
|
|
1864
1924
|
/**
|
|
1865
1925
|
* Creates a Density representing the given number of bytes per value.
|
|
1866
1926
|
*
|
|
@@ -1887,26 +1947,62 @@ let Lt = class Q extends J {
|
|
|
1887
1947
|
* @returns A Size representing the given number of values.
|
|
1888
1948
|
*/
|
|
1889
1949
|
size(e) {
|
|
1890
|
-
return new
|
|
1950
|
+
return new Le(e * this.valueOf());
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Adds another Density to this Density.
|
|
1954
|
+
*
|
|
1955
|
+
* @param other - The Density to add.
|
|
1956
|
+
* @returns A new Density representing the sum of the two densities.
|
|
1957
|
+
*/
|
|
1958
|
+
add(e) {
|
|
1959
|
+
return new M(ie(this.valueOf(), e.valueOf()));
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* Subtracts another Density from this Density.
|
|
1963
|
+
*
|
|
1964
|
+
* @param other - The Density to subtract.
|
|
1965
|
+
* @returns A new Density representing the difference of the two densities.
|
|
1966
|
+
*/
|
|
1967
|
+
sub(e) {
|
|
1968
|
+
return new M(P(this.valueOf(), e.valueOf()));
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Multiplies this Density by a scalar value.
|
|
1972
|
+
*
|
|
1973
|
+
* @param value - The scalar value to multiply by.
|
|
1974
|
+
* @returns A new Density representing this Density multiplied by the value.
|
|
1975
|
+
*/
|
|
1976
|
+
mult(e) {
|
|
1977
|
+
return new M(B(this.valueOf(), e));
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Divides this Density by a scalar value.
|
|
1981
|
+
*
|
|
1982
|
+
* @param value - The scalar value to divide by.
|
|
1983
|
+
* @returns A new Density representing this Density divided by the value.
|
|
1984
|
+
*/
|
|
1985
|
+
div(e) {
|
|
1986
|
+
return new M(we(this.valueOf(), e));
|
|
1891
1987
|
}
|
|
1892
1988
|
/** Unknown/Invalid Density. */
|
|
1893
|
-
static UNKNOWN = new
|
|
1989
|
+
static UNKNOWN = new M(0);
|
|
1894
1990
|
/** 128 bits per value. */
|
|
1895
|
-
static BIT128 = new
|
|
1991
|
+
static BIT128 = new M(16);
|
|
1896
1992
|
/** 64 bits per value. */
|
|
1897
|
-
static BIT64 = new
|
|
1993
|
+
static BIT64 = new M(8);
|
|
1898
1994
|
/** 32 bits per value. */
|
|
1899
|
-
static BIT32 = new
|
|
1995
|
+
static BIT32 = new M(4);
|
|
1900
1996
|
/** 16 bits per value. */
|
|
1901
|
-
static BIT16 = new
|
|
1997
|
+
static BIT16 = new M(2);
|
|
1902
1998
|
/** 8 bits per value. */
|
|
1903
|
-
static BIT8 = new
|
|
1999
|
+
static BIT8 = new M(1);
|
|
1904
2000
|
/** A zod schema for validating and transforming densities */
|
|
1905
2001
|
static z = a.union([
|
|
1906
|
-
a.number().transform((e) => new
|
|
1907
|
-
a.instanceof(
|
|
2002
|
+
a.number().transform((e) => new M(e)),
|
|
2003
|
+
a.instanceof(M)
|
|
1908
2004
|
]);
|
|
1909
|
-
},
|
|
2005
|
+
}, J = class L {
|
|
1910
2006
|
/**
|
|
1911
2007
|
* The starting TimeStamp of the TimeRange.
|
|
1912
2008
|
*
|
|
@@ -1936,7 +2032,7 @@ let Lt = class Q extends J {
|
|
|
1936
2032
|
}
|
|
1937
2033
|
/** @returns The TimeSpan occupied by the TimeRange. */
|
|
1938
2034
|
get span() {
|
|
1939
|
-
return new
|
|
2035
|
+
return new O(this.end.valueOf() - this.start.valueOf());
|
|
1940
2036
|
}
|
|
1941
2037
|
/**
|
|
1942
2038
|
* Checks if the timestamp is valid i.e. the start is before the end.
|
|
@@ -1974,7 +2070,7 @@ let Lt = class Q extends J {
|
|
|
1974
2070
|
* @returns A TimeRange with the start and end swapped.
|
|
1975
2071
|
*/
|
|
1976
2072
|
swap() {
|
|
1977
|
-
return new
|
|
2073
|
+
return new L(this.end, this.start);
|
|
1978
2074
|
}
|
|
1979
2075
|
get numericBounds() {
|
|
1980
2076
|
return {
|
|
@@ -1988,7 +2084,7 @@ let Lt = class Q extends J {
|
|
|
1988
2084
|
* @param other - The TimeRange to compare to.
|
|
1989
2085
|
* @returns True if the TimeRange is equal to the given TimeRange.
|
|
1990
2086
|
*/
|
|
1991
|
-
equals(e, r =
|
|
2087
|
+
equals(e, r = O.ZERO) {
|
|
1992
2088
|
if (r.isZero)
|
|
1993
2089
|
return this.start.equals(e.start) && this.end.equals(e.end);
|
|
1994
2090
|
let n = this.start.sub(e.start).valueOf(), s = this.end.sub(e.end).valueOf();
|
|
@@ -2021,16 +2117,16 @@ let Lt = class Q extends J {
|
|
|
2021
2117
|
* checking for overlap.
|
|
2022
2118
|
* @returns True if the two TimeRanges overlap, false otherwise.
|
|
2023
2119
|
*/
|
|
2024
|
-
overlapsWith(e, r =
|
|
2120
|
+
overlapsWith(e, r = O.ZERO) {
|
|
2025
2121
|
e = e.makeValid();
|
|
2026
2122
|
const n = this.makeValid();
|
|
2027
2123
|
if (this.equals(e)) return !0;
|
|
2028
2124
|
if (e.end.equals(n.start) || n.end.equals(e.start)) return !1;
|
|
2029
2125
|
const s = b.max(n.start, e.start), i = b.min(n.end, e.end);
|
|
2030
|
-
return i.before(s) ? !1 : new
|
|
2126
|
+
return i.before(s) ? !1 : new O(i.sub(s)).greaterThanOrEqual(r);
|
|
2031
2127
|
}
|
|
2032
2128
|
contains(e) {
|
|
2033
|
-
return e instanceof
|
|
2129
|
+
return e instanceof L ? this.contains(e.start) && this.contains(e.end) : this.start.beforeEq(e) && this.end.after(e);
|
|
2034
2130
|
}
|
|
2035
2131
|
/**
|
|
2036
2132
|
* Returns a new TimeRange that is bound by the given TimeRange.
|
|
@@ -2044,25 +2140,25 @@ let Lt = class Q extends J {
|
|
|
2044
2140
|
* console.log(bounded); // TimeRange(1500, 2000)
|
|
2045
2141
|
*/
|
|
2046
2142
|
boundBy(e) {
|
|
2047
|
-
const r = new
|
|
2143
|
+
const r = new L(this.start, this.end);
|
|
2048
2144
|
return e.start.after(this.start) && (r.start = e.start), e.start.after(this.end) && (r.end = e.start), e.end.before(this.end) && (r.end = e.end), e.end.before(this.start) && (r.start = e.end), r;
|
|
2049
2145
|
}
|
|
2050
2146
|
static max(...e) {
|
|
2051
|
-
return new
|
|
2147
|
+
return new L(
|
|
2052
2148
|
b.min(...e.map((r) => r.start)),
|
|
2053
2149
|
b.max(...e.map((r) => r.end))
|
|
2054
2150
|
);
|
|
2055
2151
|
}
|
|
2056
2152
|
/** The maximum possible time range. */
|
|
2057
|
-
static MAX = new
|
|
2153
|
+
static MAX = new L(b.MIN, b.MAX);
|
|
2058
2154
|
/** The minimum possible time range. */
|
|
2059
|
-
static MIN = new
|
|
2155
|
+
static MIN = new L(b.MAX, b.MIN);
|
|
2060
2156
|
/** A time range whose start and end are both zero. */
|
|
2061
|
-
static ZERO = new
|
|
2157
|
+
static ZERO = new L(b.ZERO, b.ZERO);
|
|
2062
2158
|
/** A zod schema for validating and transforming time ranges */
|
|
2063
2159
|
static z = a.union([
|
|
2064
|
-
a.object({ start: b.z, end: b.z }).transform((e) => new
|
|
2065
|
-
a.instanceof(
|
|
2160
|
+
a.object({ start: b.z, end: b.z }).transform((e) => new L(e.start, e.end)),
|
|
2161
|
+
a.instanceof(L)
|
|
2066
2162
|
]);
|
|
2067
2163
|
/**
|
|
2068
2164
|
* Sorts two time ranges. The range with the earlier start time is considered less than
|
|
@@ -2078,7 +2174,7 @@ let Lt = class Q extends J {
|
|
|
2078
2174
|
static sort(e, r) {
|
|
2079
2175
|
return b.sort(e.start, r.start) || b.sort(e.end, r.end);
|
|
2080
2176
|
}
|
|
2081
|
-
},
|
|
2177
|
+
}, $ = class u extends _ {
|
|
2082
2178
|
constructor(e) {
|
|
2083
2179
|
if (e instanceof u || typeof e == "string" || typeof e.valueOf() == "string")
|
|
2084
2180
|
super(e.valueOf());
|
|
@@ -2257,20 +2353,20 @@ let Lt = class Q extends J {
|
|
|
2257
2353
|
[BigInt64Array.name, u.INT64]
|
|
2258
2354
|
]);
|
|
2259
2355
|
static DENSITIES = /* @__PURE__ */ new Map([
|
|
2260
|
-
[u.UINT8.toString(),
|
|
2261
|
-
[u.UINT16.toString(),
|
|
2262
|
-
[u.UINT32.toString(),
|
|
2263
|
-
[u.UINT64.toString(),
|
|
2264
|
-
[u.FLOAT32.toString(),
|
|
2265
|
-
[u.FLOAT64.toString(),
|
|
2266
|
-
[u.INT8.toString(),
|
|
2267
|
-
[u.INT16.toString(),
|
|
2268
|
-
[u.INT32.toString(),
|
|
2269
|
-
[u.INT64.toString(),
|
|
2270
|
-
[u.TIMESTAMP.toString(),
|
|
2271
|
-
[u.STRING.toString(),
|
|
2272
|
-
[u.JSON.toString(),
|
|
2273
|
-
[u.UUID.toString(),
|
|
2356
|
+
[u.UINT8.toString(), I.BIT8],
|
|
2357
|
+
[u.UINT16.toString(), I.BIT16],
|
|
2358
|
+
[u.UINT32.toString(), I.BIT32],
|
|
2359
|
+
[u.UINT64.toString(), I.BIT64],
|
|
2360
|
+
[u.FLOAT32.toString(), I.BIT32],
|
|
2361
|
+
[u.FLOAT64.toString(), I.BIT64],
|
|
2362
|
+
[u.INT8.toString(), I.BIT8],
|
|
2363
|
+
[u.INT16.toString(), I.BIT16],
|
|
2364
|
+
[u.INT32.toString(), I.BIT32],
|
|
2365
|
+
[u.INT64.toString(), I.BIT64],
|
|
2366
|
+
[u.TIMESTAMP.toString(), I.BIT64],
|
|
2367
|
+
[u.STRING.toString(), I.UNKNOWN],
|
|
2368
|
+
[u.JSON.toString(), I.UNKNOWN],
|
|
2369
|
+
[u.UUID.toString(), I.BIT128]
|
|
2274
2370
|
]);
|
|
2275
2371
|
/** All the data types. */
|
|
2276
2372
|
static ALL = [
|
|
@@ -2296,8 +2392,7 @@ let Lt = class Q extends J {
|
|
|
2296
2392
|
a.string().transform((e) => new u(e)),
|
|
2297
2393
|
a.instanceof(u)
|
|
2298
2394
|
]);
|
|
2299
|
-
}
|
|
2300
|
-
class m extends J {
|
|
2395
|
+
}, Le = class w extends _ {
|
|
2301
2396
|
constructor(e) {
|
|
2302
2397
|
super(e.valueOf());
|
|
2303
2398
|
}
|
|
@@ -2311,41 +2406,59 @@ class m extends J {
|
|
|
2311
2406
|
}
|
|
2312
2407
|
/** @returns a new Size representing the sum of the two Sizes. */
|
|
2313
2408
|
add(e) {
|
|
2314
|
-
return
|
|
2409
|
+
return new w(ie(this.valueOf(), e.valueOf()));
|
|
2315
2410
|
}
|
|
2316
2411
|
/** @returns a new Size representing the difference of the two Sizes. */
|
|
2317
2412
|
sub(e) {
|
|
2318
|
-
return
|
|
2413
|
+
return new w(P(this.valueOf(), e.valueOf()));
|
|
2414
|
+
}
|
|
2415
|
+
/**
|
|
2416
|
+
* Multiplies this Size by a scalar value.
|
|
2417
|
+
*
|
|
2418
|
+
* @param value - The scalar value to multiply by.
|
|
2419
|
+
* @returns A new Size representing this Size multiplied by the value.
|
|
2420
|
+
*/
|
|
2421
|
+
mult(e) {
|
|
2422
|
+
return new w(B(this.valueOf(), e));
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* Divides this Size by a scalar value.
|
|
2426
|
+
*
|
|
2427
|
+
* @param value - The scalar value to divide by.
|
|
2428
|
+
* @returns A new Size representing this Size divided by the value.
|
|
2429
|
+
*/
|
|
2430
|
+
div(e) {
|
|
2431
|
+
return new w(we(this.valueOf(), e));
|
|
2319
2432
|
}
|
|
2320
2433
|
/** @returns a new Size representing the truncated value of the Size. */
|
|
2321
2434
|
truncate(e) {
|
|
2322
|
-
return new
|
|
2435
|
+
return new w(Math.trunc(this.valueOf() / e.valueOf()) * e.valueOf());
|
|
2323
2436
|
}
|
|
2324
2437
|
/** @returns a new Size representing the remainder of the Size. */
|
|
2325
2438
|
remainder(e) {
|
|
2326
|
-
return
|
|
2439
|
+
return w.bytes(this.valueOf() % e.valueOf());
|
|
2327
2440
|
}
|
|
2328
2441
|
/** @returns the number of gigabytes in the Size. */
|
|
2329
2442
|
get gigabytes() {
|
|
2330
|
-
return this.valueOf() /
|
|
2443
|
+
return this.valueOf() / w.GIGABYTE.valueOf();
|
|
2331
2444
|
}
|
|
2332
2445
|
/** @returns the number of megabytes in the Size. */
|
|
2333
2446
|
get megabytes() {
|
|
2334
|
-
return this.valueOf() /
|
|
2447
|
+
return this.valueOf() / w.MEGABYTE.valueOf();
|
|
2335
2448
|
}
|
|
2336
2449
|
/** @returns the number of kilobytes in the Size. */
|
|
2337
2450
|
get kilobytes() {
|
|
2338
|
-
return this.valueOf() /
|
|
2451
|
+
return this.valueOf() / w.KILOBYTE.valueOf();
|
|
2339
2452
|
}
|
|
2340
2453
|
/** @returns the number of terabytes in the Size. */
|
|
2341
2454
|
get terabytes() {
|
|
2342
|
-
return this.valueOf() /
|
|
2455
|
+
return this.valueOf() / w.TERABYTE.valueOf();
|
|
2343
2456
|
}
|
|
2344
2457
|
/** @returns a nicely formatted string representation of the Size. */
|
|
2345
2458
|
toString() {
|
|
2346
|
-
const e = this.truncate(
|
|
2347
|
-
let
|
|
2348
|
-
return o.isZero || (
|
|
2459
|
+
const e = this.truncate(w.TERABYTE), r = this.truncate(w.GIGABYTE), n = this.truncate(w.MEGABYTE), s = this.truncate(w.KILOBYTE), i = this.truncate(w.BYTE), o = e, c = r.sub(e), h = n.sub(r), l = s.sub(n), d = i.sub(s);
|
|
2460
|
+
let m = "";
|
|
2461
|
+
return o.isZero || (m += `${o.terabytes}TB `), c.isZero || (m += `${c.gigabytes}GB `), h.isZero || (m += `${h.megabytes}MB `), l.isZero || (m += `${l.kilobytes}KB `), (!d.isZero || m === "") && (m += `${d.valueOf()}B`), m.trim();
|
|
2349
2462
|
}
|
|
2350
2463
|
/**
|
|
2351
2464
|
* Creates a Size from the given number of bytes.
|
|
@@ -2354,10 +2467,10 @@ class m extends J {
|
|
|
2354
2467
|
* @returns A Size representing the given number of bytes.
|
|
2355
2468
|
*/
|
|
2356
2469
|
static bytes(e = 1) {
|
|
2357
|
-
return new
|
|
2470
|
+
return new w(e);
|
|
2358
2471
|
}
|
|
2359
2472
|
/** A single byte */
|
|
2360
|
-
static BYTE = new
|
|
2473
|
+
static BYTE = new w(1);
|
|
2361
2474
|
/**
|
|
2362
2475
|
* Creates a Size from the given number if kilobytes.
|
|
2363
2476
|
*
|
|
@@ -2365,10 +2478,10 @@ class m extends J {
|
|
|
2365
2478
|
* @returns A Size representing the given number of kilobytes.
|
|
2366
2479
|
*/
|
|
2367
2480
|
static kilobytes(e = 1) {
|
|
2368
|
-
return
|
|
2481
|
+
return w.bytes(e.valueOf() * 1e3);
|
|
2369
2482
|
}
|
|
2370
2483
|
/** A kilobyte */
|
|
2371
|
-
static KILOBYTE =
|
|
2484
|
+
static KILOBYTE = w.kilobytes(1);
|
|
2372
2485
|
/**
|
|
2373
2486
|
* Creates a Size from the given number of megabytes.
|
|
2374
2487
|
*
|
|
@@ -2376,10 +2489,10 @@ class m extends J {
|
|
|
2376
2489
|
* @returns A Size representing the given number of megabytes.
|
|
2377
2490
|
*/
|
|
2378
2491
|
static megabytes(e = 1) {
|
|
2379
|
-
return
|
|
2492
|
+
return w.kilobytes(e.valueOf() * 1e3);
|
|
2380
2493
|
}
|
|
2381
2494
|
/** A megabyte */
|
|
2382
|
-
static MEGABYTE =
|
|
2495
|
+
static MEGABYTE = w.megabytes(1);
|
|
2383
2496
|
/**
|
|
2384
2497
|
* Creates a Size from the given number of gigabytes.
|
|
2385
2498
|
*
|
|
@@ -2387,10 +2500,10 @@ class m extends J {
|
|
|
2387
2500
|
* @returns A Size representing the given number of gigabytes.
|
|
2388
2501
|
*/
|
|
2389
2502
|
static gigabytes(e = 1) {
|
|
2390
|
-
return
|
|
2503
|
+
return w.megabytes(e.valueOf() * 1e3);
|
|
2391
2504
|
}
|
|
2392
2505
|
/** A gigabyte */
|
|
2393
|
-
static GIGABYTE =
|
|
2506
|
+
static GIGABYTE = w.gigabytes(1);
|
|
2394
2507
|
/**
|
|
2395
2508
|
* Creates a Size from the given number of terabytes.
|
|
2396
2509
|
*
|
|
@@ -2398,23 +2511,23 @@ class m extends J {
|
|
|
2398
2511
|
* @returns A Size representing the given number of terabytes.
|
|
2399
2512
|
*/
|
|
2400
2513
|
static terabytes(e) {
|
|
2401
|
-
return
|
|
2514
|
+
return w.gigabytes(e.valueOf() * 1e3);
|
|
2402
2515
|
}
|
|
2403
2516
|
/** A terabyte. */
|
|
2404
|
-
static TERABYTE =
|
|
2517
|
+
static TERABYTE = w.terabytes(1);
|
|
2405
2518
|
/** The zero value for Size */
|
|
2406
|
-
static ZERO = new
|
|
2519
|
+
static ZERO = new w(0);
|
|
2407
2520
|
/** A zod schema for a Size. */
|
|
2408
2521
|
static z = a.union([
|
|
2409
|
-
a.number().transform((e) => new
|
|
2410
|
-
a.instanceof(
|
|
2522
|
+
a.number().transform((e) => new w(e)),
|
|
2523
|
+
a.instanceof(w)
|
|
2411
2524
|
]);
|
|
2412
2525
|
/** @returns true if the Size is zero. */
|
|
2413
2526
|
get isZero() {
|
|
2414
2527
|
return this.valueOf() === 0;
|
|
2415
2528
|
}
|
|
2416
|
-
}
|
|
2417
|
-
const
|
|
2529
|
+
};
|
|
2530
|
+
const Bo = a.union([
|
|
2418
2531
|
a.instanceof(Uint8Array),
|
|
2419
2532
|
a.instanceof(Uint16Array),
|
|
2420
2533
|
a.instanceof(Uint32Array),
|
|
@@ -2425,40 +2538,40 @@ const vo = a.union([
|
|
|
2425
2538
|
a.instanceof(Int16Array),
|
|
2426
2539
|
a.instanceof(Int32Array),
|
|
2427
2540
|
a.instanceof(BigInt64Array)
|
|
2428
|
-
]),
|
|
2541
|
+
]), Mr = (t) => {
|
|
2429
2542
|
const e = typeof t;
|
|
2430
|
-
return e === "string" || e === "number" || e === "boolean" || e === "bigint" || t instanceof b || t instanceof
|
|
2431
|
-
},
|
|
2432
|
-
function
|
|
2433
|
-
return typeof t == "string" &&
|
|
2543
|
+
return e === "string" || e === "number" || e === "boolean" || e === "bigint" || t instanceof b || t instanceof O || t instanceof Date;
|
|
2544
|
+
}, Ei = (t, e, r, n = 0) => t.usesBigInt && !e.usesBigInt ? Number(r) - Number(n) : !t.usesBigInt && e.usesBigInt ? BigInt(r.valueOf()) - BigInt(n.valueOf()) : Ue(r, -n), Ue = (t, e) => e == 0 ? t : t == 0 ? e : typeof t == "bigint" && typeof e == "bigint" || typeof t == "number" && typeof e == "number" ? t + e : Number(t) + Number(e), Ai = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
2545
|
+
function Bi(t) {
|
|
2546
|
+
return typeof t == "string" && Ai.test(t);
|
|
2434
2547
|
}
|
|
2435
|
-
const
|
|
2548
|
+
const N = [];
|
|
2436
2549
|
for (let t = 0; t < 256; ++t)
|
|
2437
|
-
|
|
2438
|
-
function
|
|
2439
|
-
return (
|
|
2550
|
+
N.push((t + 256).toString(16).slice(1));
|
|
2551
|
+
function Ui(t, e = 0) {
|
|
2552
|
+
return (N[t[e + 0]] + N[t[e + 1]] + N[t[e + 2]] + N[t[e + 3]] + "-" + N[t[e + 4]] + N[t[e + 5]] + "-" + N[t[e + 6]] + N[t[e + 7]] + "-" + N[t[e + 8]] + N[t[e + 9]] + "-" + N[t[e + 10]] + N[t[e + 11]] + N[t[e + 12]] + N[t[e + 13]] + N[t[e + 14]] + N[t[e + 15]]).toLowerCase();
|
|
2440
2553
|
}
|
|
2441
|
-
function
|
|
2442
|
-
const r =
|
|
2443
|
-
if (!
|
|
2554
|
+
function Ci(t, e = 0) {
|
|
2555
|
+
const r = Ui(t, e);
|
|
2556
|
+
if (!Bi(r))
|
|
2444
2557
|
throw TypeError("Stringified UUID is invalid");
|
|
2445
2558
|
return r;
|
|
2446
2559
|
}
|
|
2447
2560
|
typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
2448
|
-
const
|
|
2449
|
-
[Symbol.iterator]: () =>
|
|
2561
|
+
const Er = (t, e) => Ci(t, e), z = -1, ht = {
|
|
2562
|
+
[Symbol.iterator]: () => ht,
|
|
2450
2563
|
next: () => ({ done: !0, value: void 0 })
|
|
2451
|
-
},
|
|
2564
|
+
}, ji = a.string().transform(
|
|
2452
2565
|
(t) => new Uint8Array(
|
|
2453
2566
|
atob(t).split("").map((e) => e.charCodeAt(0))
|
|
2454
2567
|
).buffer
|
|
2455
|
-
),
|
|
2568
|
+
), Ri = a.union([a.null(), a.undefined()]).transform(() => new Uint8Array().buffer), ft = 10, Ar = (t, e) => {
|
|
2456
2569
|
if (t === "number" && !e.isNumeric)
|
|
2457
2570
|
throw new Error(`cannot convert series of type ${e.toString()} to number`);
|
|
2458
2571
|
if (t === "bigint" && !e.usesBigInt)
|
|
2459
2572
|
throw new Error(`cannot convert series of type ${e.toString()} to bigint`);
|
|
2460
|
-
},
|
|
2461
|
-
let
|
|
2573
|
+
}, Br = "sy_x_telem_series";
|
|
2574
|
+
let Ur = class F {
|
|
2462
2575
|
/**
|
|
2463
2576
|
* A unique identifier for the series. If specified by the user, it is their
|
|
2464
2577
|
* responsibility to ensure that it is unique. If not specified, a new ID will be
|
|
@@ -2469,7 +2582,7 @@ let Sr = class D {
|
|
|
2469
2582
|
* A discriminator used for identifying instances of the series class even
|
|
2470
2583
|
* when bundlers mangle the class name.
|
|
2471
2584
|
*/
|
|
2472
|
-
discriminator =
|
|
2585
|
+
discriminator = Br;
|
|
2473
2586
|
/** The data type of the series. */
|
|
2474
2587
|
dataType;
|
|
2475
2588
|
/**
|
|
@@ -2485,18 +2598,24 @@ let Sr = class D {
|
|
|
2485
2598
|
/** The underlying data. */
|
|
2486
2599
|
_data;
|
|
2487
2600
|
/** The time range occupied by the series' data. */
|
|
2488
|
-
timeRange =
|
|
2601
|
+
timeRange = J.ZERO;
|
|
2489
2602
|
/**
|
|
2490
2603
|
* Alignment defines the location of the series relative to other series in a logical
|
|
2491
2604
|
* group. Useful for defining the position of the series within a channel's data.
|
|
2492
2605
|
*/
|
|
2493
2606
|
alignment = 0n;
|
|
2607
|
+
/**
|
|
2608
|
+
* Alignment multiple defines the number of alignment steps taken per sample. This is
|
|
2609
|
+
* useful for when the samples in a series represent a partial view of the raw data
|
|
2610
|
+
* i.e. decimation or averaging.
|
|
2611
|
+
*/
|
|
2612
|
+
alignmentMultiple = 1n;
|
|
2494
2613
|
/** A cached minimum value. */
|
|
2495
2614
|
cachedMin;
|
|
2496
2615
|
/** A cached maximum value. */
|
|
2497
2616
|
cachedMax;
|
|
2498
2617
|
/** The write position of the buffer. */
|
|
2499
|
-
writePos =
|
|
2618
|
+
writePos = z;
|
|
2500
2619
|
/** Tracks the number of entities currently using this array. */
|
|
2501
2620
|
_refCount = 0;
|
|
2502
2621
|
/** Caches the length of the array for variable length data types. */
|
|
@@ -2508,22 +2627,22 @@ let Sr = class D {
|
|
|
2508
2627
|
* can be constructed into a series.
|
|
2509
2628
|
*/
|
|
2510
2629
|
static crudeZ = a.object({
|
|
2511
|
-
timeRange:
|
|
2512
|
-
dataType:
|
|
2630
|
+
timeRange: J.z.optional(),
|
|
2631
|
+
dataType: $.z,
|
|
2513
2632
|
alignment: a.coerce.bigint().optional(),
|
|
2514
2633
|
data: a.union([
|
|
2515
|
-
|
|
2516
|
-
|
|
2634
|
+
ji,
|
|
2635
|
+
Ri,
|
|
2517
2636
|
a.instanceof(ArrayBuffer),
|
|
2518
2637
|
a.instanceof(Uint8Array)
|
|
2519
2638
|
]),
|
|
2520
|
-
glBufferUsage:
|
|
2639
|
+
glBufferUsage: Ii.optional().default("static").optional()
|
|
2521
2640
|
});
|
|
2522
2641
|
/**
|
|
2523
2642
|
* A zod schema that validates and constructs a series from it's crude
|
|
2524
2643
|
* representation.
|
|
2525
2644
|
*/
|
|
2526
|
-
static z =
|
|
2645
|
+
static z = F.crudeZ.transform((e) => new F(e));
|
|
2527
2646
|
/**
|
|
2528
2647
|
* The Series constructor accepts either a SeriesArgs object or a CrudeSeries value.
|
|
2529
2648
|
*
|
|
@@ -2598,69 +2717,70 @@ let Sr = class D {
|
|
|
2598
2717
|
* @throws Error if data type cannot be inferred from input
|
|
2599
2718
|
*/
|
|
2600
2719
|
constructor(e) {
|
|
2601
|
-
|
|
2720
|
+
Li(e) && (e = { data: e }), e.data ??= [];
|
|
2602
2721
|
const {
|
|
2603
2722
|
dataType: r,
|
|
2604
2723
|
timeRange: n,
|
|
2605
2724
|
sampleOffset: s = 0,
|
|
2606
2725
|
glBufferUsage: i = "static",
|
|
2607
2726
|
alignment: o = 0n,
|
|
2608
|
-
|
|
2727
|
+
alignmentMultiple: c = 1n,
|
|
2728
|
+
key: h = Lt(),
|
|
2609
2729
|
data: l
|
|
2610
2730
|
} = e;
|
|
2611
|
-
if (
|
|
2612
|
-
const
|
|
2613
|
-
this.key =
|
|
2731
|
+
if (Cr(l)) {
|
|
2732
|
+
const p = l;
|
|
2733
|
+
this.key = p.key, this.dataType = p.dataType, this.sampleOffset = p.sampleOffset, this.gl = p.gl, this._data = p._data, this.timeRange = p.timeRange, this.alignment = p.alignment, this.alignmentMultiple = p.alignmentMultiple, this.cachedMin = p.cachedMin, this.cachedMax = p.cachedMax, this.writePos = p.writePos, this._refCount = p._refCount, this.cachedLength = p.cachedLength;
|
|
2614
2734
|
return;
|
|
2615
2735
|
}
|
|
2616
|
-
const
|
|
2617
|
-
if (r != null) this.dataType = new
|
|
2736
|
+
const d = Mr(l), m = Array.isArray(l);
|
|
2737
|
+
if (r != null) this.dataType = new $(r);
|
|
2618
2738
|
else {
|
|
2619
2739
|
if (l instanceof ArrayBuffer)
|
|
2620
2740
|
throw new Error(
|
|
2621
2741
|
"cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
|
|
2622
2742
|
);
|
|
2623
|
-
if (
|
|
2624
|
-
let
|
|
2625
|
-
if (!
|
|
2743
|
+
if (m || d) {
|
|
2744
|
+
let p = l;
|
|
2745
|
+
if (!d) {
|
|
2626
2746
|
if (l.length === 0)
|
|
2627
2747
|
throw new Error(
|
|
2628
2748
|
"cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
|
|
2629
2749
|
);
|
|
2630
|
-
|
|
2750
|
+
p = l[0];
|
|
2631
2751
|
}
|
|
2632
|
-
if (typeof
|
|
2633
|
-
else if (typeof
|
|
2634
|
-
else if (typeof
|
|
2635
|
-
else if (typeof
|
|
2636
|
-
else if (
|
|
2637
|
-
this.dataType =
|
|
2638
|
-
else if (typeof
|
|
2752
|
+
if (typeof p == "string") this.dataType = $.STRING;
|
|
2753
|
+
else if (typeof p == "number") this.dataType = $.FLOAT64;
|
|
2754
|
+
else if (typeof p == "bigint") this.dataType = $.INT64;
|
|
2755
|
+
else if (typeof p == "boolean") this.dataType = $.BOOLEAN;
|
|
2756
|
+
else if (p instanceof b || p instanceof Date || p instanceof b)
|
|
2757
|
+
this.dataType = $.TIMESTAMP;
|
|
2758
|
+
else if (typeof p == "object") this.dataType = $.JSON;
|
|
2639
2759
|
else
|
|
2640
2760
|
throw new Error(
|
|
2641
|
-
`cannot infer data type of ${typeof
|
|
2761
|
+
`cannot infer data type of ${typeof p} when constructing a Series from a JS array`
|
|
2642
2762
|
);
|
|
2643
|
-
} else this.dataType = new
|
|
2763
|
+
} else this.dataType = new $(l);
|
|
2644
2764
|
}
|
|
2645
|
-
if (!
|
|
2646
|
-
else if (
|
|
2765
|
+
if (!m && !d) this._data = l;
|
|
2766
|
+
else if (m && l.length === 0)
|
|
2647
2767
|
this._data = new this.dataType.Array([]).buffer;
|
|
2648
2768
|
else {
|
|
2649
|
-
let
|
|
2650
|
-
const
|
|
2651
|
-
(
|
|
2769
|
+
let p = d ? [l] : l;
|
|
2770
|
+
const j = p[0];
|
|
2771
|
+
(j instanceof b || j instanceof Date || j instanceof O) && (p = p.map((A) => new b(A).valueOf())), this.dataType.equals($.STRING) ? (this.cachedLength = p.length, this._data = new TextEncoder().encode(`${p.join(`
|
|
2652
2772
|
`)}
|
|
2653
|
-
`).buffer) : this.dataType.equals(
|
|
2654
|
-
`${
|
|
2773
|
+
`).buffer) : this.dataType.equals($.JSON) ? (this.cachedLength = p.length, this._data = new TextEncoder().encode(
|
|
2774
|
+
`${p.map((A) => et.encodeString(A)).join(`
|
|
2655
2775
|
`)}
|
|
2656
2776
|
`
|
|
2657
|
-
).buffer) : this.dataType.usesBigInt && typeof
|
|
2658
|
-
|
|
2659
|
-
).buffer : !this.dataType.usesBigInt && typeof
|
|
2660
|
-
|
|
2661
|
-
).buffer : this._data = new this.dataType.Array(
|
|
2777
|
+
).buffer) : this.dataType.usesBigInt && typeof j == "number" ? this._data = new this.dataType.Array(
|
|
2778
|
+
p.map((A) => BigInt(Math.round(A)))
|
|
2779
|
+
).buffer : !this.dataType.usesBigInt && typeof j == "bigint" ? this._data = new this.dataType.Array(
|
|
2780
|
+
p.map(Number)
|
|
2781
|
+
).buffer : this._data = new this.dataType.Array(p).buffer;
|
|
2662
2782
|
}
|
|
2663
|
-
this.key =
|
|
2783
|
+
this.key = h, this.alignment = o, this.alignmentMultiple = c, this.sampleOffset = s ?? 0, this.timeRange = n ?? J.ZERO, this.gl = {
|
|
2664
2784
|
control: null,
|
|
2665
2785
|
buffer: null,
|
|
2666
2786
|
prevBuffer: 0,
|
|
@@ -2677,7 +2797,7 @@ let Sr = class D {
|
|
|
2677
2797
|
static alloc({ capacity: e, dataType: r, ...n }) {
|
|
2678
2798
|
if (e === 0)
|
|
2679
2799
|
throw new Error("[Series] - cannot allocate an array of length 0");
|
|
2680
|
-
const s = new new
|
|
2800
|
+
const s = new new $(r).Array(e), i = new F({ data: s.buffer, dataType: r, ...n });
|
|
2681
2801
|
return i.writePos = 0, i;
|
|
2682
2802
|
}
|
|
2683
2803
|
/**
|
|
@@ -2720,12 +2840,12 @@ let Sr = class D {
|
|
|
2720
2840
|
return this.dataType.isVariable ? this.writeVariable(e) : this.writeFixed(e);
|
|
2721
2841
|
}
|
|
2722
2842
|
writeVariable(e) {
|
|
2723
|
-
if (this.writePos ===
|
|
2843
|
+
if (this.writePos === z) return 0;
|
|
2724
2844
|
const r = this.byteCapacity.valueOf() - this.writePos, n = e.subBytes(0, r);
|
|
2725
2845
|
return this.writeToUnderlyingData(n), this.writePos += n.byteLength.valueOf(), this.cachedLength != null && (this.cachedLength += n.length, this.calculateCachedLength()), n.length;
|
|
2726
2846
|
}
|
|
2727
2847
|
writeFixed(e) {
|
|
2728
|
-
if (this.writePos ===
|
|
2848
|
+
if (this.writePos === z) return 0;
|
|
2729
2849
|
const r = this.capacity - this.writePos, n = e.sub(0, r);
|
|
2730
2850
|
return this.writeToUnderlyingData(n), this.cachedLength = void 0, this.maybeRecomputeMinMax(n), this.writePos += n.length, n.length;
|
|
2731
2851
|
}
|
|
@@ -2748,7 +2868,7 @@ let Sr = class D {
|
|
|
2748
2868
|
* @returns A typed array containing the series data.
|
|
2749
2869
|
*/
|
|
2750
2870
|
get data() {
|
|
2751
|
-
return this.writePos ===
|
|
2871
|
+
return this.writePos === z ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
|
|
2752
2872
|
}
|
|
2753
2873
|
/**
|
|
2754
2874
|
* Returns an array of the values in the series as strings.
|
|
@@ -2767,16 +2887,16 @@ let Sr = class D {
|
|
|
2767
2887
|
* @returns An array of values parsed from the JSON series.
|
|
2768
2888
|
*/
|
|
2769
2889
|
parseJSON(e) {
|
|
2770
|
-
if (!this.dataType.equals(
|
|
2890
|
+
if (!this.dataType.equals($.JSON))
|
|
2771
2891
|
throw new Error("cannot parse non-JSON series as JSON");
|
|
2772
|
-
return this.toStrings().map((r) => e.parse(
|
|
2892
|
+
return this.toStrings().map((r) => e.parse(et.decodeString(r)));
|
|
2773
2893
|
}
|
|
2774
2894
|
/**
|
|
2775
2895
|
* Returns the capacity of the series in bytes.
|
|
2776
2896
|
* @returns The size of the underlying buffer in bytes.
|
|
2777
2897
|
*/
|
|
2778
2898
|
get byteCapacity() {
|
|
2779
|
-
return new
|
|
2899
|
+
return new Le(this.underlyingData.byteLength);
|
|
2780
2900
|
}
|
|
2781
2901
|
/**
|
|
2782
2902
|
* Returns the capacity of the series in samples.
|
|
@@ -2792,7 +2912,7 @@ let Sr = class D {
|
|
|
2792
2912
|
* @returns The size of the data in bytes.
|
|
2793
2913
|
*/
|
|
2794
2914
|
get byteLength() {
|
|
2795
|
-
return this.writePos ===
|
|
2915
|
+
return this.writePos === z ? this.byteCapacity : this.dataType.isVariable ? new Le(this.writePos) : this.dataType.density.size(this.writePos);
|
|
2796
2916
|
}
|
|
2797
2917
|
/**
|
|
2798
2918
|
* Returns the number of samples in this array.
|
|
@@ -2800,7 +2920,7 @@ let Sr = class D {
|
|
|
2800
2920
|
* @returns The number of samples in the series.
|
|
2801
2921
|
*/
|
|
2802
2922
|
get length() {
|
|
2803
|
-
return this.cachedLength != null ? this.cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos ===
|
|
2923
|
+
return this.cachedLength != null ? this.cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === z ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos;
|
|
2804
2924
|
}
|
|
2805
2925
|
calculateCachedLength() {
|
|
2806
2926
|
if (!this.dataType.isVariable)
|
|
@@ -2808,7 +2928,7 @@ let Sr = class D {
|
|
|
2808
2928
|
let e = 0;
|
|
2809
2929
|
const r = [0];
|
|
2810
2930
|
return this.data.forEach((n, s) => {
|
|
2811
|
-
n ===
|
|
2931
|
+
n === ft && (e++, r.push(s + 1));
|
|
2812
2932
|
}), this._cachedIndexes = r, this.cachedLength = e, e;
|
|
2813
2933
|
}
|
|
2814
2934
|
/**
|
|
@@ -2824,8 +2944,8 @@ let Sr = class D {
|
|
|
2824
2944
|
if (this.dataType.equals(e)) return this;
|
|
2825
2945
|
const n = new e.Array(this.length);
|
|
2826
2946
|
for (let s = 0; s < this.length; s++)
|
|
2827
|
-
n[s] =
|
|
2828
|
-
return new
|
|
2947
|
+
n[s] = Ei(this.dataType, e, this.data[s], r);
|
|
2948
|
+
return new F({
|
|
2829
2949
|
data: n.buffer,
|
|
2830
2950
|
dataType: e,
|
|
2831
2951
|
timeRange: this.timeRange,
|
|
@@ -2836,7 +2956,7 @@ let Sr = class D {
|
|
|
2836
2956
|
}
|
|
2837
2957
|
calcRawMax() {
|
|
2838
2958
|
if (this.length === 0) return -1 / 0;
|
|
2839
|
-
if (this.dataType.equals(
|
|
2959
|
+
if (this.dataType.equals($.TIMESTAMP))
|
|
2840
2960
|
this.cachedMax = this.data[this.data.length - 1];
|
|
2841
2961
|
else if (this.dataType.usesBigInt) {
|
|
2842
2962
|
const e = this.data;
|
|
@@ -2854,11 +2974,11 @@ let Sr = class D {
|
|
|
2854
2974
|
calcMax() {
|
|
2855
2975
|
if (this.dataType.isVariable)
|
|
2856
2976
|
throw new Error("cannot calculate maximum on a variable length data type");
|
|
2857
|
-
return this.writePos === 0 ? -1 / 0 : (this.cachedMax ??= this.calcRawMax(),
|
|
2977
|
+
return this.writePos === 0 ? -1 / 0 : (this.cachedMax ??= this.calcRawMax(), Ue(this.cachedMax, this.sampleOffset));
|
|
2858
2978
|
}
|
|
2859
2979
|
calcRawMin() {
|
|
2860
2980
|
if (this.length === 0) return 1 / 0;
|
|
2861
|
-
if (this.dataType.equals(
|
|
2981
|
+
if (this.dataType.equals($.TIMESTAMP)) this.cachedMin = this.data[0];
|
|
2862
2982
|
else if (this.dataType.usesBigInt) {
|
|
2863
2983
|
const e = this.data;
|
|
2864
2984
|
this.cachedMin = e.reduce((r, n) => r < n ? r : n);
|
|
@@ -2875,7 +2995,7 @@ let Sr = class D {
|
|
|
2875
2995
|
calcMin() {
|
|
2876
2996
|
if (this.dataType.isVariable)
|
|
2877
2997
|
throw new Error("cannot calculate minimum on a variable length data type");
|
|
2878
|
-
return this.writePos === 0 ? 1 / 0 : (this.cachedMin ??= this.calcRawMin(),
|
|
2998
|
+
return this.writePos === 0 ? 1 / 0 : (this.cachedMin ??= this.calcRawMin(), Ue(this.cachedMin, this.sampleOffset));
|
|
2879
2999
|
}
|
|
2880
3000
|
/** @returns the bounds of the series. */
|
|
2881
3001
|
get bounds() {
|
|
@@ -2892,7 +3012,7 @@ let Sr = class D {
|
|
|
2892
3012
|
}
|
|
2893
3013
|
}
|
|
2894
3014
|
atAlignment(e, r) {
|
|
2895
|
-
const n = Number(e - this.alignment);
|
|
3015
|
+
const n = Number((e - this.alignment) / this.alignmentMultiple);
|
|
2896
3016
|
if (n < 0 || n >= this.length) {
|
|
2897
3017
|
if (r === !0) throw new Error(`[series] - no value at index ${n}`);
|
|
2898
3018
|
return;
|
|
@@ -2901,18 +3021,18 @@ let Sr = class D {
|
|
|
2901
3021
|
}
|
|
2902
3022
|
at(e, r = !1) {
|
|
2903
3023
|
if (this.dataType.isVariable) return this.atVariable(e, r ?? !1);
|
|
2904
|
-
if (this.dataType.equals(
|
|
3024
|
+
if (this.dataType.equals($.UUID)) return this.atUUID(e, r);
|
|
2905
3025
|
e < 0 && (e = this.length + e);
|
|
2906
3026
|
const n = this.data[e];
|
|
2907
3027
|
if (n == null) {
|
|
2908
3028
|
if (r === !0) throw new Error(`[series] - no value at index ${e}`);
|
|
2909
3029
|
return;
|
|
2910
3030
|
}
|
|
2911
|
-
return
|
|
3031
|
+
return Ue(n, this.sampleOffset);
|
|
2912
3032
|
}
|
|
2913
3033
|
atUUID(e, r) {
|
|
2914
3034
|
e < 0 && (e = this.length + e);
|
|
2915
|
-
const n =
|
|
3035
|
+
const n = Er(
|
|
2916
3036
|
new Uint8Array(this.buffer, e * this.dataType.density.valueOf())
|
|
2917
3037
|
);
|
|
2918
3038
|
if (n == null) {
|
|
@@ -2928,7 +3048,7 @@ let Sr = class D {
|
|
|
2928
3048
|
else {
|
|
2929
3049
|
e < 0 && (e = this.length + e);
|
|
2930
3050
|
for (let o = 0; o < this.data.length; o++)
|
|
2931
|
-
if (this.data[o] ===
|
|
3051
|
+
if (this.data[o] === ft) {
|
|
2932
3052
|
if (e === 0) {
|
|
2933
3053
|
s = o;
|
|
2934
3054
|
break;
|
|
@@ -2941,7 +3061,7 @@ let Sr = class D {
|
|
|
2941
3061
|
}
|
|
2942
3062
|
}
|
|
2943
3063
|
const i = this.data.slice(n, s);
|
|
2944
|
-
return this.dataType.equals(
|
|
3064
|
+
return this.dataType.equals($.STRING) ? new TextDecoder().decode(i) : mt(JSON.parse(new TextDecoder().decode(i)));
|
|
2945
3065
|
}
|
|
2946
3066
|
/**
|
|
2947
3067
|
* @returns the index of the first sample that is greater than or equal to the given value.
|
|
@@ -2950,7 +3070,7 @@ let Sr = class D {
|
|
|
2950
3070
|
*/
|
|
2951
3071
|
binarySearch(e) {
|
|
2952
3072
|
let r = 0, n = this.length - 1;
|
|
2953
|
-
const s =
|
|
3073
|
+
const s = De(e);
|
|
2954
3074
|
for (; r <= n; ) {
|
|
2955
3075
|
const i = Math.floor((r + n) / 2), o = s(this.at(i, !0), e);
|
|
2956
3076
|
if (o === 0) return i;
|
|
@@ -2966,11 +3086,11 @@ let Sr = class D {
|
|
|
2966
3086
|
* be the same buffer previously passed to {@method acquire} or {@method updateGLBuffer}.
|
|
2967
3087
|
*/
|
|
2968
3088
|
updateGLBuffer(e) {
|
|
2969
|
-
if (this.gl.control = e, !this.dataType.equals(
|
|
3089
|
+
if (this.gl.control = e, !this.dataType.equals($.FLOAT32) && !this.dataType.equals($.UINT8))
|
|
2970
3090
|
throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
|
|
2971
3091
|
const { buffer: r, bufferUsage: n, prevBuffer: s } = this.gl;
|
|
2972
3092
|
if (r == null && (this.gl.buffer = e.createBuffer()), this.writePos !== s)
|
|
2973
|
-
if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !==
|
|
3093
|
+
if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== z) {
|
|
2974
3094
|
s === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
|
|
2975
3095
|
const i = this.dataType.density.size(s).valueOf(), o = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
|
|
2976
3096
|
e.bufferSubData(e.ARRAY_BUFFER, i, o.buffer), this.gl.prevBuffer = this.writePos;
|
|
@@ -2979,10 +3099,10 @@ let Sr = class D {
|
|
|
2979
3099
|
e.ARRAY_BUFFER,
|
|
2980
3100
|
this.buffer,
|
|
2981
3101
|
n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW
|
|
2982
|
-
), this.gl.prevBuffer =
|
|
3102
|
+
), this.gl.prevBuffer = z;
|
|
2983
3103
|
}
|
|
2984
3104
|
as(e) {
|
|
2985
|
-
return
|
|
3105
|
+
return Ar(e, this.dataType), this;
|
|
2986
3106
|
}
|
|
2987
3107
|
/** @returns a digest containing information about the series. */
|
|
2988
3108
|
get digest() {
|
|
@@ -2991,8 +3111,8 @@ let Sr = class D {
|
|
|
2991
3111
|
dataType: this.dataType.toString(),
|
|
2992
3112
|
sampleOffset: this.sampleOffset,
|
|
2993
3113
|
alignment: {
|
|
2994
|
-
lower:
|
|
2995
|
-
upper:
|
|
3114
|
+
lower: Zt(this.alignmentBounds.lower),
|
|
3115
|
+
upper: Zt(this.alignmentBounds.upper)
|
|
2996
3116
|
},
|
|
2997
3117
|
timeRange: this.timeRange.toString(),
|
|
2998
3118
|
length: this.length,
|
|
@@ -3009,7 +3129,10 @@ let Sr = class D {
|
|
|
3009
3129
|
* is exclusive.
|
|
3010
3130
|
*/
|
|
3011
3131
|
get alignmentBounds() {
|
|
3012
|
-
return y(
|
|
3132
|
+
return y(
|
|
3133
|
+
this.alignment,
|
|
3134
|
+
this.alignment + BigInt(this.length) * this.alignmentMultiple
|
|
3135
|
+
);
|
|
3013
3136
|
}
|
|
3014
3137
|
maybeGarbageCollectGLBuffer(e) {
|
|
3015
3138
|
this.gl.buffer != null && (e.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
|
|
@@ -3026,10 +3149,10 @@ let Sr = class D {
|
|
|
3026
3149
|
}
|
|
3027
3150
|
[Symbol.iterator]() {
|
|
3028
3151
|
if (this.dataType.isVariable) {
|
|
3029
|
-
const e = new
|
|
3030
|
-
return this.dataType.equals(
|
|
3152
|
+
const e = new Di(this);
|
|
3153
|
+
return this.dataType.equals($.JSON) ? new Pi(e) : e;
|
|
3031
3154
|
}
|
|
3032
|
-
return this.dataType.equals(
|
|
3155
|
+
return this.dataType.equals($.UUID) ? new qi(this) : new ki(this);
|
|
3033
3156
|
}
|
|
3034
3157
|
/**
|
|
3035
3158
|
* Returns a slice of the series from start to end.
|
|
@@ -3056,7 +3179,7 @@ let Sr = class D {
|
|
|
3056
3179
|
* @returns An iterator over the specified range.
|
|
3057
3180
|
*/
|
|
3058
3181
|
subIterator(e, r) {
|
|
3059
|
-
return new
|
|
3182
|
+
return new Ft(this, e, r ?? this.length);
|
|
3060
3183
|
}
|
|
3061
3184
|
/**
|
|
3062
3185
|
* Returns an iterator over a portion of the series based on alignment.
|
|
@@ -3065,16 +3188,17 @@ let Sr = class D {
|
|
|
3065
3188
|
* @returns An iterator over the specified alignment range.
|
|
3066
3189
|
*/
|
|
3067
3190
|
subAlignmentIterator(e, r) {
|
|
3068
|
-
|
|
3069
|
-
this
|
|
3070
|
-
|
|
3071
|
-
Number(r - this.alignment)
|
|
3191
|
+
const n = Math.ceil(
|
|
3192
|
+
Number(e - this.alignment) / Number(this.alignmentMultiple)
|
|
3193
|
+
), s = Math.ceil(
|
|
3194
|
+
Number(r - this.alignment) / Number(this.alignmentMultiple)
|
|
3072
3195
|
);
|
|
3196
|
+
return new Ft(this, n, s);
|
|
3073
3197
|
}
|
|
3074
3198
|
subBytes(e, r) {
|
|
3075
3199
|
if (e >= 0 && (r == null || r >= this.byteLength.valueOf())) return this;
|
|
3076
3200
|
const n = this.data.subarray(e, r);
|
|
3077
|
-
return new
|
|
3201
|
+
return new F({
|
|
3078
3202
|
data: n,
|
|
3079
3203
|
dataType: this.dataType,
|
|
3080
3204
|
timeRange: this.timeRange,
|
|
@@ -3086,7 +3210,7 @@ let Sr = class D {
|
|
|
3086
3210
|
sliceSub(e, r, n) {
|
|
3087
3211
|
if (r <= 0 && (n == null || n >= this.length)) return this;
|
|
3088
3212
|
let s;
|
|
3089
|
-
return e ? s = this.data.subarray(r, n) : s = this.data.slice(r, n), new
|
|
3213
|
+
return e ? s = this.data.subarray(r, n) : s = this.data.slice(r, n), new F({
|
|
3090
3214
|
data: s,
|
|
3091
3215
|
dataType: this.dataType,
|
|
3092
3216
|
timeRange: this.timeRange,
|
|
@@ -3101,10 +3225,10 @@ let Sr = class D {
|
|
|
3101
3225
|
* @returns A new series with the specified alignment.
|
|
3102
3226
|
*/
|
|
3103
3227
|
reAlign(e) {
|
|
3104
|
-
return new
|
|
3228
|
+
return new F({
|
|
3105
3229
|
data: this.buffer,
|
|
3106
3230
|
dataType: this.dataType,
|
|
3107
|
-
timeRange:
|
|
3231
|
+
timeRange: J.ZERO,
|
|
3108
3232
|
sampleOffset: this.sampleOffset,
|
|
3109
3233
|
glBufferUsage: "static",
|
|
3110
3234
|
alignment: e
|
|
@@ -3128,21 +3252,20 @@ let Sr = class D {
|
|
|
3128
3252
|
return e += "])", e;
|
|
3129
3253
|
}
|
|
3130
3254
|
};
|
|
3131
|
-
const
|
|
3132
|
-
let
|
|
3255
|
+
const Li = (t) => t == null ? !1 : Array.isArray(t) || t instanceof ArrayBuffer || ArrayBuffer.isView(t) && !(t instanceof DataView) || t instanceof Ur ? !0 : Mr(t), Cr = Ni(Br, Ur);
|
|
3256
|
+
let Ft = class {
|
|
3133
3257
|
series;
|
|
3134
3258
|
end;
|
|
3135
3259
|
index;
|
|
3136
3260
|
constructor(e, r, n) {
|
|
3137
3261
|
this.series = e;
|
|
3138
|
-
const s = y(0, e.length);
|
|
3139
|
-
this.end =
|
|
3262
|
+
const s = y(0, e.length + 1);
|
|
3263
|
+
this.end = st(s, n), this.index = st(s, r);
|
|
3140
3264
|
}
|
|
3141
3265
|
next() {
|
|
3142
3266
|
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
3143
3267
|
}
|
|
3144
|
-
}
|
|
3145
|
-
class Bi {
|
|
3268
|
+
}, Di = class {
|
|
3146
3269
|
series;
|
|
3147
3270
|
index;
|
|
3148
3271
|
decoder;
|
|
@@ -3155,12 +3278,11 @@ class Bi {
|
|
|
3155
3278
|
}
|
|
3156
3279
|
next() {
|
|
3157
3280
|
const e = this.index, r = this.series.data;
|
|
3158
|
-
for (; this.index < r.length && r[this.index] !==
|
|
3281
|
+
for (; this.index < r.length && r[this.index] !== ft; ) this.index++;
|
|
3159
3282
|
const n = this.index;
|
|
3160
3283
|
return e === n ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(e, n)) });
|
|
3161
3284
|
}
|
|
3162
|
-
}
|
|
3163
|
-
let Ui = class Ir {
|
|
3285
|
+
}, Pi = class jr {
|
|
3164
3286
|
wrapped;
|
|
3165
3287
|
static schema = a.record(a.string(), a.unknown());
|
|
3166
3288
|
constructor(e) {
|
|
@@ -3170,25 +3292,26 @@ let Ui = class Ir {
|
|
|
3170
3292
|
const e = this.wrapped.next();
|
|
3171
3293
|
return e.done === !0 ? { done: !0, value: void 0 } : {
|
|
3172
3294
|
done: !1,
|
|
3173
|
-
value:
|
|
3295
|
+
value: et.decodeString(e.value, jr.schema)
|
|
3174
3296
|
};
|
|
3175
3297
|
}
|
|
3176
|
-
},
|
|
3298
|
+
}, qi = class {
|
|
3177
3299
|
series;
|
|
3178
3300
|
index;
|
|
3179
3301
|
data;
|
|
3180
3302
|
density;
|
|
3181
3303
|
constructor(e) {
|
|
3182
|
-
if (!e.dataType.equals(
|
|
3304
|
+
if (!e.dataType.equals($.UUID))
|
|
3183
3305
|
throw new Error("cannot create a UUID series iterator for a non-UUID series");
|
|
3184
|
-
this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density =
|
|
3306
|
+
this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density = $.UUID.density.valueOf();
|
|
3185
3307
|
}
|
|
3186
3308
|
next() {
|
|
3187
3309
|
if (this.index >= this.series.length) return { done: !0, value: void 0 };
|
|
3188
|
-
const e =
|
|
3310
|
+
const e = Er(this.data, this.index * this.density);
|
|
3189
3311
|
return this.index++, { done: !1, value: e };
|
|
3190
3312
|
}
|
|
3191
|
-
}
|
|
3313
|
+
};
|
|
3314
|
+
class ki {
|
|
3192
3315
|
series;
|
|
3193
3316
|
index;
|
|
3194
3317
|
constructor(e) {
|
|
@@ -3200,7 +3323,8 @@ let Ui = class Ir {
|
|
|
3200
3323
|
value: this.series.at(this.index++, !0)
|
|
3201
3324
|
};
|
|
3202
3325
|
}
|
|
3203
|
-
}
|
|
3326
|
+
}
|
|
3327
|
+
let Ro = class {
|
|
3204
3328
|
/** The array of series in this collection */
|
|
3205
3329
|
series;
|
|
3206
3330
|
/**
|
|
@@ -3253,14 +3377,14 @@ let Ui = class Ir {
|
|
|
3253
3377
|
this.series = e;
|
|
3254
3378
|
}
|
|
3255
3379
|
as(e) {
|
|
3256
|
-
return
|
|
3380
|
+
return Ar(e, this.dataType), this;
|
|
3257
3381
|
}
|
|
3258
3382
|
/**
|
|
3259
3383
|
* Returns the data type of the series in this collection. If the collection is empty,
|
|
3260
3384
|
* returns DataType.UNKNOWN.
|
|
3261
3385
|
*/
|
|
3262
3386
|
get dataType() {
|
|
3263
|
-
return this.series.length === 0 ?
|
|
3387
|
+
return this.series.length === 0 ? $.UNKNOWN : this.series[0].dataType;
|
|
3264
3388
|
}
|
|
3265
3389
|
/**
|
|
3266
3390
|
* Returns the combined time range of all series in the collection. If the collection
|
|
@@ -3268,7 +3392,7 @@ let Ui = class Ir {
|
|
|
3268
3392
|
* series to the end of the last series.
|
|
3269
3393
|
*/
|
|
3270
3394
|
get timeRange() {
|
|
3271
|
-
return this.series.length === 0 ?
|
|
3395
|
+
return this.series.length === 0 ? J.ZERO : new J(
|
|
3272
3396
|
this.series[0].timeRange.start,
|
|
3273
3397
|
this.series[this.series.length - 1].timeRange.end
|
|
3274
3398
|
);
|
|
@@ -3295,7 +3419,7 @@ let Ui = class Ir {
|
|
|
3295
3419
|
const r = () => new Error(
|
|
3296
3420
|
`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`
|
|
3297
3421
|
), n = e.dataType.equals(this.dataType);
|
|
3298
|
-
if (
|
|
3422
|
+
if (Cr(e)) {
|
|
3299
3423
|
if (this.series.length !== 0 && !n) throw r();
|
|
3300
3424
|
this.series.push(e);
|
|
3301
3425
|
} else {
|
|
@@ -3313,7 +3437,7 @@ let Ui = class Ir {
|
|
|
3313
3437
|
}
|
|
3314
3438
|
atAlignment(e, r) {
|
|
3315
3439
|
for (const n of this.series)
|
|
3316
|
-
if (
|
|
3440
|
+
if (U(n.alignmentBounds, e))
|
|
3317
3441
|
return n.atAlignment(e, r);
|
|
3318
3442
|
if (r) throw new Error(`[series] - no value at alignment ${e}`);
|
|
3319
3443
|
}
|
|
@@ -3332,7 +3456,7 @@ let Ui = class Ir {
|
|
|
3332
3456
|
* @returns An iterator over the specified range.
|
|
3333
3457
|
*/
|
|
3334
3458
|
subIterator(e, r) {
|
|
3335
|
-
return new
|
|
3459
|
+
return new Xe(this, e, r ?? this.length);
|
|
3336
3460
|
}
|
|
3337
3461
|
/**
|
|
3338
3462
|
* Returns an iterator over a portion of the multi-series based on alignment.
|
|
@@ -3342,14 +3466,16 @@ let Ui = class Ir {
|
|
|
3342
3466
|
*/
|
|
3343
3467
|
subAlignmentIterator(e, r) {
|
|
3344
3468
|
if (e >= this.alignmentBounds.upper || r <= this.alignmentBounds.lower)
|
|
3345
|
-
return
|
|
3469
|
+
return ht;
|
|
3346
3470
|
let n = 0;
|
|
3347
3471
|
for (let i = 0; i < this.series.length; i++) {
|
|
3348
3472
|
const o = this.series[i];
|
|
3349
3473
|
if (e < o.alignment) break;
|
|
3350
3474
|
if (e >= o.alignmentBounds.upper) n += o.length;
|
|
3351
|
-
else if (
|
|
3352
|
-
n +=
|
|
3475
|
+
else if (U(o.alignmentBounds, e)) {
|
|
3476
|
+
n += Math.ceil(
|
|
3477
|
+
Number(e - o.alignment) / Number(o.alignmentMultiple)
|
|
3478
|
+
);
|
|
3353
3479
|
break;
|
|
3354
3480
|
}
|
|
3355
3481
|
}
|
|
@@ -3358,12 +3484,14 @@ let Ui = class Ir {
|
|
|
3358
3484
|
const o = this.series[i];
|
|
3359
3485
|
if (r < o.alignment) break;
|
|
3360
3486
|
if (r >= o.alignmentBounds.upper) s += o.length;
|
|
3361
|
-
else if (
|
|
3362
|
-
s +=
|
|
3487
|
+
else if (U(o.alignmentBounds, r)) {
|
|
3488
|
+
s += Math.ceil(
|
|
3489
|
+
Number(r - o.alignment) / Number(o.alignmentMultiple)
|
|
3490
|
+
);
|
|
3363
3491
|
break;
|
|
3364
3492
|
}
|
|
3365
3493
|
}
|
|
3366
|
-
return new
|
|
3494
|
+
return new Xe(this, n, s);
|
|
3367
3495
|
}
|
|
3368
3496
|
/**
|
|
3369
3497
|
* Returns an iterator over the specified alignment range and span.
|
|
@@ -3372,19 +3500,19 @@ let Ui = class Ir {
|
|
|
3372
3500
|
* @returns An iterator over the specified range.
|
|
3373
3501
|
*/
|
|
3374
3502
|
subAlignmentSpanIterator(e, r) {
|
|
3375
|
-
if (e >= this.alignmentBounds.upper) return
|
|
3503
|
+
if (e >= this.alignmentBounds.upper) return ht;
|
|
3376
3504
|
r = Math.min(r, Number(this.distance(e, this.alignmentBounds.upper)));
|
|
3377
3505
|
let n = 0;
|
|
3378
3506
|
for (let s = 0; s < this.series.length; s++) {
|
|
3379
3507
|
const i = this.series[s];
|
|
3380
3508
|
if (e < i.alignment) break;
|
|
3381
3509
|
if (e >= i.alignmentBounds.upper) n += i.length;
|
|
3382
|
-
else if (
|
|
3510
|
+
else if (U(i.alignmentBounds, e)) {
|
|
3383
3511
|
n += Number(e - i.alignment);
|
|
3384
3512
|
break;
|
|
3385
3513
|
}
|
|
3386
3514
|
}
|
|
3387
|
-
return new
|
|
3515
|
+
return new Xe(this, n, n + r);
|
|
3388
3516
|
}
|
|
3389
3517
|
/**
|
|
3390
3518
|
* Updates the WebGL buffer for all series in the collection.
|
|
@@ -3397,13 +3525,13 @@ let Ui = class Ir {
|
|
|
3397
3525
|
* Returns the bounds containing the minimum and maximum values across all series.
|
|
3398
3526
|
*/
|
|
3399
3527
|
get bounds() {
|
|
3400
|
-
return
|
|
3528
|
+
return or(this.series.map((e) => e.bounds));
|
|
3401
3529
|
}
|
|
3402
3530
|
/**
|
|
3403
3531
|
* Returns the sum of the byte lengths of all series.
|
|
3404
3532
|
*/
|
|
3405
3533
|
get byteLength() {
|
|
3406
|
-
return new
|
|
3534
|
+
return new Le(this.series.reduce((e, r) => e + r.byteLength.valueOf(), 0));
|
|
3407
3535
|
}
|
|
3408
3536
|
/**
|
|
3409
3537
|
* Returns a combined typed array containing all data from all series.
|
|
@@ -3424,7 +3552,7 @@ let Ui = class Ir {
|
|
|
3424
3552
|
*/
|
|
3425
3553
|
traverseAlignment(e, r) {
|
|
3426
3554
|
const n = this.series.map((s) => s.alignmentBounds);
|
|
3427
|
-
return
|
|
3555
|
+
return ur(n, e, r);
|
|
3428
3556
|
}
|
|
3429
3557
|
/**
|
|
3430
3558
|
* Acquires a reference to the WebGL buffer for all series.
|
|
@@ -3447,7 +3575,7 @@ let Ui = class Ir {
|
|
|
3447
3575
|
*/
|
|
3448
3576
|
distance(e, r) {
|
|
3449
3577
|
const n = this.series.map((s) => s.alignmentBounds);
|
|
3450
|
-
return
|
|
3578
|
+
return lr(n, e, r);
|
|
3451
3579
|
}
|
|
3452
3580
|
/**
|
|
3453
3581
|
* Parses a JSON multi-series into an array of values using the provided zod schema.
|
|
@@ -3457,7 +3585,7 @@ let Ui = class Ir {
|
|
|
3457
3585
|
* @returns An array of values parsed from the JSON series.
|
|
3458
3586
|
*/
|
|
3459
3587
|
parseJSON(e) {
|
|
3460
|
-
if (!this.dataType.equals(
|
|
3588
|
+
if (!this.dataType.equals($.JSON))
|
|
3461
3589
|
throw new Error("cannot parse non-JSON series as JSON");
|
|
3462
3590
|
return this.series.flatMap((r) => r.parseJSON(e));
|
|
3463
3591
|
}
|
|
@@ -3470,7 +3598,7 @@ let Ui = class Ir {
|
|
|
3470
3598
|
next() {
|
|
3471
3599
|
return { done: !0, value: void 0 };
|
|
3472
3600
|
}
|
|
3473
|
-
} : new
|
|
3601
|
+
} : new zi(this.series);
|
|
3474
3602
|
}
|
|
3475
3603
|
/**
|
|
3476
3604
|
* Returns an array of the values in the multi-series as strings.
|
|
@@ -3480,7 +3608,7 @@ let Ui = class Ir {
|
|
|
3480
3608
|
toStrings() {
|
|
3481
3609
|
return this.series.flatMap((e) => e.toStrings());
|
|
3482
3610
|
}
|
|
3483
|
-
},
|
|
3611
|
+
}, zi = class {
|
|
3484
3612
|
series;
|
|
3485
3613
|
seriesIndex;
|
|
3486
3614
|
internal;
|
|
@@ -3494,7 +3622,8 @@ let Ui = class Ir {
|
|
|
3494
3622
|
[Symbol.iterator]() {
|
|
3495
3623
|
return this;
|
|
3496
3624
|
}
|
|
3497
|
-
}
|
|
3625
|
+
};
|
|
3626
|
+
class Xe {
|
|
3498
3627
|
series;
|
|
3499
3628
|
index;
|
|
3500
3629
|
end;
|
|
@@ -3507,47 +3636,47 @@ let Ui = class Ir {
|
|
|
3507
3636
|
[Symbol.iterator]() {
|
|
3508
3637
|
return this;
|
|
3509
3638
|
}
|
|
3510
|
-
}
|
|
3511
|
-
const
|
|
3639
|
+
}
|
|
3640
|
+
const Zt = (t) => {
|
|
3512
3641
|
const e = t >> 32n, r = t & 0xffffffffn;
|
|
3513
3642
|
return { domain: e, sample: r };
|
|
3514
3643
|
};
|
|
3515
3644
|
a.object({ key: a.string(), value: a.string() });
|
|
3516
|
-
const
|
|
3645
|
+
const Fi = a.record(
|
|
3517
3646
|
a.union([a.number(), a.string(), a.symbol()]),
|
|
3518
3647
|
a.unknown()
|
|
3519
|
-
),
|
|
3648
|
+
), Dt = (t) => Object.entries(t), Zi = (t, e) => Object.fromEntries(Dt(t).map(([r, n]) => [r, e(n, r)])), Yi = (t) => Object.fromEntries(Dt(t).filter(([e, r]) => r !== void 0)), Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3520
3649
|
__proto__: null,
|
|
3521
|
-
entries:
|
|
3522
|
-
map:
|
|
3523
|
-
purgeUndefined:
|
|
3524
|
-
unknownZ:
|
|
3525
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3650
|
+
entries: Dt,
|
|
3651
|
+
map: Zi,
|
|
3652
|
+
purgeUndefined: Yi,
|
|
3653
|
+
unknownZ: Fi
|
|
3654
|
+
}, Symbol.toStringTag, { value: "Module" })), Rr = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", Wi = Rr(), Lr = ["macOS", "Windows", "Linux"], Vi = ["macos", "windows", "linux"], Gi = {
|
|
3526
3655
|
macos: "macOS",
|
|
3527
3656
|
windows: "Windows",
|
|
3528
3657
|
linux: "Linux"
|
|
3529
|
-
},
|
|
3530
|
-
a.enum(
|
|
3531
|
-
),
|
|
3658
|
+
}, Hi = a.enum(Lr).or(
|
|
3659
|
+
a.enum(Vi).transform((t) => Gi[t])
|
|
3660
|
+
), Ji = () => {
|
|
3532
3661
|
if (typeof window > "u") return;
|
|
3533
3662
|
const t = window.navigator.userAgent.toLowerCase();
|
|
3534
3663
|
if (t.includes("mac")) return "macOS";
|
|
3535
3664
|
if (t.includes("win")) return "Windows";
|
|
3536
3665
|
if (t.includes("linux")) return "Linux";
|
|
3537
3666
|
};
|
|
3538
|
-
let
|
|
3539
|
-
const
|
|
3667
|
+
let Ke;
|
|
3668
|
+
const Xi = (t = {}) => {
|
|
3540
3669
|
const { force: e, default: r } = t;
|
|
3541
|
-
return e ??
|
|
3542
|
-
},
|
|
3670
|
+
return e ?? Ke ?? (Ke = Ji(), Ke ?? r);
|
|
3671
|
+
}, qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3543
3672
|
__proto__: null,
|
|
3544
|
-
OPERATING_SYSTEMS:
|
|
3545
|
-
RUNTIME:
|
|
3546
|
-
detect:
|
|
3547
|
-
getOS:
|
|
3548
|
-
osZ:
|
|
3549
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3550
|
-
class
|
|
3673
|
+
OPERATING_SYSTEMS: Lr,
|
|
3674
|
+
RUNTIME: Wi,
|
|
3675
|
+
detect: Rr,
|
|
3676
|
+
getOS: Xi,
|
|
3677
|
+
osZ: Hi
|
|
3678
|
+
}, Symbol.toStringTag, { value: "Module" })), Ki = (...t) => t.map(Dr).join(""), Dr = (t) => (t.endsWith("/") || (t += "/"), t.startsWith("/") && (t = t.slice(1)), t), Qi = (t) => t.endsWith("/") ? t.slice(0, -1) : t;
|
|
3679
|
+
class Ce {
|
|
3551
3680
|
protocol;
|
|
3552
3681
|
host;
|
|
3553
3682
|
port;
|
|
@@ -3559,7 +3688,7 @@ class Ee {
|
|
|
3559
3688
|
* @param pathPrefix - A path prefix to use for all requests. Defaults to "".
|
|
3560
3689
|
*/
|
|
3561
3690
|
constructor({ host: e, port: r, protocol: n = "", pathPrefix: s = "" }) {
|
|
3562
|
-
this.protocol = n, this.host = e, this.port = r, this.path =
|
|
3691
|
+
this.protocol = n, this.host = e, this.port = r, this.path = Dr(s);
|
|
3563
3692
|
}
|
|
3564
3693
|
/**
|
|
3565
3694
|
* Replaces creates a new URL with the specified properties replaced.
|
|
@@ -3567,7 +3696,7 @@ class Ee {
|
|
|
3567
3696
|
* @returns a new URL.
|
|
3568
3697
|
*/
|
|
3569
3698
|
replace(e) {
|
|
3570
|
-
return new
|
|
3699
|
+
return new Ce({
|
|
3571
3700
|
host: e.host ?? this.host,
|
|
3572
3701
|
port: e.port ?? this.port,
|
|
3573
3702
|
protocol: e.protocol ?? this.protocol,
|
|
@@ -3580,106 +3709,107 @@ class Ee {
|
|
|
3580
3709
|
* @returns a new URL.
|
|
3581
3710
|
*/
|
|
3582
3711
|
child(e) {
|
|
3583
|
-
return new
|
|
3712
|
+
return new Ce({
|
|
3584
3713
|
...this,
|
|
3585
|
-
pathPrefix:
|
|
3714
|
+
pathPrefix: Ki(this.path, e)
|
|
3586
3715
|
});
|
|
3587
3716
|
}
|
|
3588
3717
|
/** @returns a string representation of the url */
|
|
3589
3718
|
toString() {
|
|
3590
|
-
return
|
|
3719
|
+
return Qi(
|
|
3591
3720
|
`${this.protocol}://${this.host}:${this.port}/${this.path}`
|
|
3592
3721
|
);
|
|
3593
3722
|
}
|
|
3594
|
-
static UNKNOWN = new
|
|
3723
|
+
static UNKNOWN = new Ce({ host: "unknown", port: 0 });
|
|
3595
3724
|
}
|
|
3596
|
-
const
|
|
3725
|
+
const _i = 2, ea = 3, ta = 2, ra = (t, e) => {
|
|
3597
3726
|
if (Number.isNaN(t) || !Number.isFinite(t)) return t;
|
|
3598
|
-
const r =
|
|
3727
|
+
const r = Oe(e);
|
|
3599
3728
|
if (r == 0) return t;
|
|
3600
3729
|
let n;
|
|
3601
|
-
r >= 1e3 ? n =
|
|
3730
|
+
r >= 1e3 ? n = _i : r >= 1 ? n = ea : n = Math.ceil(-Math.log10(r)) + ta;
|
|
3602
3731
|
const s = 10 ** n;
|
|
3603
3732
|
return Math.round(t * s) / s;
|
|
3604
|
-
},
|
|
3733
|
+
}, ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3605
3734
|
__proto__: null,
|
|
3606
|
-
abs:
|
|
3607
|
-
add:
|
|
3608
|
-
closeTo:
|
|
3609
|
-
div:
|
|
3610
|
-
equal:
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3735
|
+
abs: ir,
|
|
3736
|
+
add: ie,
|
|
3737
|
+
closeTo: jn,
|
|
3738
|
+
div: we,
|
|
3739
|
+
equal: nt,
|
|
3740
|
+
isInteger: je,
|
|
3741
|
+
max: Ln,
|
|
3742
|
+
min: sr,
|
|
3743
|
+
mult: B,
|
|
3744
|
+
roundBySpan: ra,
|
|
3745
|
+
roundToNearestMagnitude: Rn,
|
|
3746
|
+
sub: P
|
|
3617
3747
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3618
3748
|
a.object({
|
|
3619
|
-
baseInterval:
|
|
3749
|
+
baseInterval: O.z.optional(),
|
|
3620
3750
|
maxRetries: a.number().optional(),
|
|
3621
3751
|
scale: a.number().optional()
|
|
3622
3752
|
});
|
|
3623
|
-
const
|
|
3753
|
+
const na = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, Pr = a.string().regex(na), re = a.number().min(0).max(255), qr = a.number().min(0).max(1), We = a.tuple([re, re, re, qr]), sa = a.tuple([re, re, re]), ia = a.object({ rgba255: We }), aa = a.number().min(0).max(360), oa = a.number().min(0).max(100), ua = a.number().min(0).max(100), kr = a.tuple([aa, oa, ua, qr]), Ve = a.union([Pr, sa, We, kr, ia]), Ge = Ve.transform((t) => v(t)), la = (t) => Ge.safeParse(t).success, ca = (t) => We.safeParse(t).success, ha = (t) => {
|
|
3624
3754
|
if (t == null) return;
|
|
3625
|
-
const e =
|
|
3626
|
-
if (e.success) return
|
|
3755
|
+
const e = Ge.safeParse(t);
|
|
3756
|
+
if (e.success) return Fr(e.data);
|
|
3627
3757
|
if (typeof t == "string") return t;
|
|
3628
3758
|
throw e.error;
|
|
3629
|
-
},
|
|
3630
|
-
if (t =
|
|
3759
|
+
}, v = (t, e = 1) => {
|
|
3760
|
+
if (t = Ve.parse(t), typeof t == "string") return Ta(t, e);
|
|
3631
3761
|
if (Array.isArray(t)) {
|
|
3632
3762
|
if (t.length < 3 || t.length > 4)
|
|
3633
3763
|
throw new Error(`Invalid color: [${t.join(", ")}]`);
|
|
3634
3764
|
return t.length === 3 ? [...t, e] : t;
|
|
3635
3765
|
}
|
|
3636
3766
|
return t.rgba255;
|
|
3637
|
-
},
|
|
3767
|
+
}, zr = (t, e) => {
|
|
3638
3768
|
if (t == null || e == null) return t == e;
|
|
3639
|
-
const r =
|
|
3769
|
+
const r = v(t), n = v(e);
|
|
3640
3770
|
return r.every((s, i) => s === n[i]);
|
|
3641
|
-
},
|
|
3771
|
+
}, fa = (t) => {
|
|
3642
3772
|
if (t == null) return;
|
|
3643
|
-
const [e, r, n, s] =
|
|
3644
|
-
return `#${
|
|
3645
|
-
},
|
|
3646
|
-
const [e, r, n, s] =
|
|
3773
|
+
const [e, r, n, s] = v(t);
|
|
3774
|
+
return `#${$e(e)}${$e(r)}${$e(n)}${s === 1 ? "" : $e(s * 255)}`;
|
|
3775
|
+
}, Fr = (t) => {
|
|
3776
|
+
const [e, r, n, s] = v(t);
|
|
3647
3777
|
return `rgba(${e}, ${r}, ${n}, ${s})`;
|
|
3648
|
-
},
|
|
3649
|
-
const [e, r, n] =
|
|
3778
|
+
}, da = (t) => `rgb(${Zr(t)})`, Zr = (t) => {
|
|
3779
|
+
const [e, r, n] = v(t);
|
|
3650
3780
|
return `${e}, ${r}, ${n}`;
|
|
3651
|
-
},
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
],
|
|
3656
|
-
const [r, n, s] =
|
|
3781
|
+
}, ga = (t) => [...Pt(t), de(t)], Pt = (t) => [
|
|
3782
|
+
ce(t) / 255,
|
|
3783
|
+
he(t) / 255,
|
|
3784
|
+
fe(t) / 255
|
|
3785
|
+
], ce = (t) => v(t)[0], he = (t) => v(t)[1], fe = (t) => v(t)[2], de = (t) => v(t)[3], pa = (t) => zr(qt, t), ma = (t) => Sa(v(t)), ya = (t, e) => {
|
|
3786
|
+
const [r, n, s] = v(t);
|
|
3657
3787
|
if (e > 100)
|
|
3658
3788
|
throw new Error(`Color opacity must be between 0 and 100, got ${e}`);
|
|
3659
3789
|
return e > 1 && (e /= 100), [r, n, s, e];
|
|
3660
|
-
},
|
|
3661
|
-
const [e, r, n] =
|
|
3790
|
+
}, ye = (t) => {
|
|
3791
|
+
const [e, r, n] = Pt(t).map(
|
|
3662
3792
|
(s) => s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4
|
|
3663
3793
|
);
|
|
3664
3794
|
return Number((0.2126 * e + 0.7152 * r + 0.0722 * n).toFixed(3));
|
|
3665
|
-
},
|
|
3666
|
-
const [e, r, n] =
|
|
3795
|
+
}, ba = (t) => {
|
|
3796
|
+
const [e, r, n] = Pt(t);
|
|
3667
3797
|
return 1 - (Math.max(e, r, n) - Math.min(e, r, n));
|
|
3668
|
-
},
|
|
3669
|
-
const r =
|
|
3798
|
+
}, dt = (t, e) => {
|
|
3799
|
+
const r = v(t), n = v(e), s = ye(r), i = ye(n);
|
|
3670
3800
|
return (Math.max(s, i) + 0.5) / (Math.min(s, i) + 0.5);
|
|
3671
|
-
},
|
|
3801
|
+
}, wa = (t, ...e) => {
|
|
3672
3802
|
if (e.length === 0)
|
|
3673
3803
|
throw new Error("[Color.pickByContrast] - must provide at least one color");
|
|
3674
|
-
const r =
|
|
3675
|
-
return
|
|
3676
|
-
},
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
t.length === 8 ?
|
|
3681
|
-
]),
|
|
3682
|
-
t =
|
|
3804
|
+
const r = v(t), [n] = e.sort((s, i) => dt(r, i) - dt(r, s));
|
|
3805
|
+
return v(n);
|
|
3806
|
+
}, Oa = (t) => ye(t) < 0.5, va = (t) => ye(t) > 0.5, Ta = (t, e = 1) => (t = Pr.parse(t), t = xa(t), [
|
|
3807
|
+
Se(t, 0),
|
|
3808
|
+
Se(t, 2),
|
|
3809
|
+
Se(t, 4),
|
|
3810
|
+
t.length === 8 ? Se(t, 6) / 255 : e
|
|
3811
|
+
]), qt = [0, 0, 0, 0], $e = (t) => Math.floor(t).toString(16).padStart(2, "0"), Se = (t, e) => parseInt(t.slice(e, e + 2), 16), xa = (t) => t.startsWith("#") ? t.slice(1) : t, $a = (t) => {
|
|
3812
|
+
t = kr.parse(t);
|
|
3683
3813
|
let [e, r, n] = t;
|
|
3684
3814
|
const s = t[3];
|
|
3685
3815
|
e /= 360, r /= 100, n /= 100;
|
|
@@ -3687,240 +3817,240 @@ const Ki = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, Br = a.string().regex(Ki), _ = a.nu
|
|
|
3687
3817
|
if (r === 0)
|
|
3688
3818
|
i = o = c = n;
|
|
3689
3819
|
else {
|
|
3690
|
-
const
|
|
3691
|
-
i =
|
|
3820
|
+
const h = n < 0.5 ? n * (1 + r) : n + r - n * r, l = 2 * n - h;
|
|
3821
|
+
i = Qe(l, h, e + 1 / 3), o = Qe(l, h, e), c = Qe(l, h, e - 1 / 3);
|
|
3692
3822
|
}
|
|
3693
3823
|
return [Math.round(i * 255), Math.round(o * 255), Math.round(c * 255), s];
|
|
3694
|
-
},
|
|
3695
|
-
t =
|
|
3824
|
+
}, Qe = (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), Sa = (t) => {
|
|
3825
|
+
t = We.parse(t);
|
|
3696
3826
|
let [e, r, n] = t;
|
|
3697
3827
|
const s = t[3];
|
|
3698
3828
|
e /= 255, r /= 255, n /= 255;
|
|
3699
3829
|
const i = Math.max(e, r, n), o = Math.min(e, r, n);
|
|
3700
|
-
let c,
|
|
3830
|
+
let c, h, l = (i + o) / 2;
|
|
3701
3831
|
if (i === o)
|
|
3702
|
-
c =
|
|
3832
|
+
c = h = 0;
|
|
3703
3833
|
else {
|
|
3704
|
-
const
|
|
3705
|
-
|
|
3834
|
+
const d = i - o;
|
|
3835
|
+
h = l > 0.5 ? d / (2 - i - o) : d / (i + o), i === e ? c = (r - n) / d + (r < n ? 6 : 0) : i === r ? c = (n - e) / d + 2 : c = (e - r) / d + 4, c /= 6;
|
|
3706
3836
|
}
|
|
3707
|
-
return c *= 360,
|
|
3708
|
-
},
|
|
3837
|
+
return c *= 360, h *= 100, l *= 100, [Math.round(c), Math.round(h), Math.round(l), s];
|
|
3838
|
+
}, Na = v("#000000"), Ia = v("#ffffff"), Yr = a.object({
|
|
3709
3839
|
key: a.string(),
|
|
3710
|
-
color:
|
|
3840
|
+
color: Ve,
|
|
3711
3841
|
position: a.number(),
|
|
3712
3842
|
switched: a.boolean().optional()
|
|
3713
|
-
}),
|
|
3714
|
-
if (t.length === 0) return
|
|
3715
|
-
if (t = t.slice().sort((r, n) => r.position - n.position), e <= t[0].position) return
|
|
3843
|
+
}), Ma = a.array(Yr), Ea = (t, e) => {
|
|
3844
|
+
if (t.length === 0) return qt;
|
|
3845
|
+
if (t = t.slice().sort((r, n) => r.position - n.position), e <= t[0].position) return v(t[0].color);
|
|
3716
3846
|
if (e >= t[t.length - 1].position)
|
|
3717
|
-
return
|
|
3847
|
+
return v(t[t.length - 1].color);
|
|
3718
3848
|
for (let r = 0; r < t.length - 1; r++) {
|
|
3719
3849
|
const n = t[r], s = t[r + 1];
|
|
3720
3850
|
if (e < n.position || e > s.position) continue;
|
|
3721
|
-
if (e === n.position) return
|
|
3722
|
-
if (e === s.position) return
|
|
3723
|
-
const i = (e - n.position) / (s.position - n.position), o =
|
|
3724
|
-
|
|
3725
|
-
),
|
|
3726
|
-
|
|
3727
|
-
),
|
|
3728
|
-
|
|
3729
|
-
),
|
|
3730
|
-
return
|
|
3731
|
-
}
|
|
3732
|
-
return
|
|
3733
|
-
},
|
|
3851
|
+
if (e === n.position) return v(n.color);
|
|
3852
|
+
if (e === s.position) return v(s.color);
|
|
3853
|
+
const i = (e - n.position) / (s.position - n.position), o = v(n.color), c = v(s.color), h = Math.round(
|
|
3854
|
+
ce(o) + i * (ce(c) - ce(o))
|
|
3855
|
+
), l = Math.round(
|
|
3856
|
+
he(o) + i * (he(c) - he(o))
|
|
3857
|
+
), d = Math.round(
|
|
3858
|
+
fe(o) + i * (fe(c) - fe(o))
|
|
3859
|
+
), m = de(o) + i * (de(c) - de(o));
|
|
3860
|
+
return v([h, l, d, m]);
|
|
3861
|
+
}
|
|
3862
|
+
return v(t[t.length - 1].color);
|
|
3863
|
+
}, Aa = a.object({
|
|
3734
3864
|
key: a.string(),
|
|
3735
3865
|
name: a.string(),
|
|
3736
|
-
color:
|
|
3737
|
-
}),
|
|
3866
|
+
color: Ge
|
|
3867
|
+
}), Ba = a.object({
|
|
3738
3868
|
key: a.string(),
|
|
3739
3869
|
name: a.string(),
|
|
3740
|
-
swatches: a.array(
|
|
3741
|
-
}),
|
|
3870
|
+
swatches: a.array(Aa)
|
|
3871
|
+
}), Ua = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3742
3872
|
__proto__: null,
|
|
3743
|
-
BLACK:
|
|
3744
|
-
WHITE:
|
|
3745
|
-
ZERO:
|
|
3746
|
-
aValue:
|
|
3747
|
-
bValue:
|
|
3748
|
-
colorZ:
|
|
3749
|
-
construct:
|
|
3750
|
-
contrast:
|
|
3751
|
-
crudeZ:
|
|
3752
|
-
cssString:
|
|
3753
|
-
equals:
|
|
3754
|
-
fromGradient:
|
|
3755
|
-
fromHSLA:
|
|
3756
|
-
gValue:
|
|
3757
|
-
gradientZ:
|
|
3758
|
-
grayness:
|
|
3759
|
-
hex:
|
|
3760
|
-
hsla:
|
|
3761
|
-
isColor:
|
|
3762
|
-
isCrude:
|
|
3763
|
-
isDark:
|
|
3764
|
-
isLight:
|
|
3765
|
-
isZero:
|
|
3766
|
-
luminance:
|
|
3767
|
-
paletteZ:
|
|
3768
|
-
pickByContrast:
|
|
3769
|
-
rValue:
|
|
3770
|
-
rgbCSS:
|
|
3771
|
-
rgbString:
|
|
3772
|
-
rgba1:
|
|
3773
|
-
rgbaCSS:
|
|
3774
|
-
setAlpha:
|
|
3775
|
-
stopZ:
|
|
3776
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3777
|
-
lower:
|
|
3778
|
-
upper:
|
|
3779
|
-
},
|
|
3873
|
+
BLACK: Na,
|
|
3874
|
+
WHITE: Ia,
|
|
3875
|
+
ZERO: qt,
|
|
3876
|
+
aValue: de,
|
|
3877
|
+
bValue: fe,
|
|
3878
|
+
colorZ: Ge,
|
|
3879
|
+
construct: v,
|
|
3880
|
+
contrast: dt,
|
|
3881
|
+
crudeZ: Ve,
|
|
3882
|
+
cssString: ha,
|
|
3883
|
+
equals: zr,
|
|
3884
|
+
fromGradient: Ea,
|
|
3885
|
+
fromHSLA: $a,
|
|
3886
|
+
gValue: he,
|
|
3887
|
+
gradientZ: Ma,
|
|
3888
|
+
grayness: ba,
|
|
3889
|
+
hex: fa,
|
|
3890
|
+
hsla: ma,
|
|
3891
|
+
isColor: ca,
|
|
3892
|
+
isCrude: la,
|
|
3893
|
+
isDark: Oa,
|
|
3894
|
+
isLight: va,
|
|
3895
|
+
isZero: pa,
|
|
3896
|
+
luminance: ye,
|
|
3897
|
+
paletteZ: Ba,
|
|
3898
|
+
pickByContrast: wa,
|
|
3899
|
+
rValue: ce,
|
|
3900
|
+
rgbCSS: da,
|
|
3901
|
+
rgbString: Zr,
|
|
3902
|
+
rgba1: ga,
|
|
3903
|
+
rgbaCSS: Fr,
|
|
3904
|
+
setAlpha: ya,
|
|
3905
|
+
stopZ: Yr
|
|
3906
|
+
}, Symbol.toStringTag, { value: "Module" })), Wr = a.int().min(0).max(255), Vr = 255, Gr = 0, Ca = {
|
|
3907
|
+
lower: Gr,
|
|
3908
|
+
upper: Vr + 1
|
|
3909
|
+
}, Hr = a.object({
|
|
3780
3910
|
name: a.string(),
|
|
3781
3911
|
key: a.string()
|
|
3782
|
-
}),
|
|
3783
|
-
subject:
|
|
3912
|
+
}), be = (t) => a.object({
|
|
3913
|
+
subject: Hr,
|
|
3784
3914
|
resource: t,
|
|
3785
|
-
authority:
|
|
3786
|
-
}),
|
|
3915
|
+
authority: Wr
|
|
3916
|
+
}), ja = (...t) => (e) => e.filter((r) => {
|
|
3787
3917
|
let n = !1;
|
|
3788
3918
|
return r.to != null && (n = t.includes(r.to.resource)), r.from != null && !n && (n = t.includes(r.from.resource)), n;
|
|
3789
|
-
}),
|
|
3790
|
-
from:
|
|
3919
|
+
}), Jr = (t) => a.object({
|
|
3920
|
+
from: be(t),
|
|
3791
3921
|
to: a.null()
|
|
3792
|
-
}),
|
|
3922
|
+
}), Xr = (t) => a.object({
|
|
3793
3923
|
from: a.null(),
|
|
3794
|
-
to:
|
|
3795
|
-
}),
|
|
3796
|
-
|
|
3797
|
-
|
|
3924
|
+
to: be(t)
|
|
3925
|
+
}), Ra = (t) => a.union([
|
|
3926
|
+
Jr(t),
|
|
3927
|
+
Xr(t),
|
|
3798
3928
|
a.object({
|
|
3799
|
-
from:
|
|
3800
|
-
to:
|
|
3929
|
+
from: be(t),
|
|
3930
|
+
to: be(t)
|
|
3801
3931
|
})
|
|
3802
|
-
]),
|
|
3932
|
+
]), zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3803
3933
|
__proto__: null,
|
|
3804
|
-
ABSOLUTE_AUTHORITY:
|
|
3805
|
-
AUTHORITY_BOUNDS:
|
|
3806
|
-
ZERO_AUTHORITY:
|
|
3807
|
-
acquireZ:
|
|
3808
|
-
authorityZ:
|
|
3809
|
-
filterTransfersByChannelKey:
|
|
3810
|
-
releaseZ:
|
|
3811
|
-
stateZ:
|
|
3812
|
-
subjectZ:
|
|
3813
|
-
transferZ:
|
|
3814
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3934
|
+
ABSOLUTE_AUTHORITY: Vr,
|
|
3935
|
+
AUTHORITY_BOUNDS: Ca,
|
|
3936
|
+
ZERO_AUTHORITY: Gr,
|
|
3937
|
+
acquireZ: Xr,
|
|
3938
|
+
authorityZ: Wr,
|
|
3939
|
+
filterTransfersByChannelKey: ja,
|
|
3940
|
+
releaseZ: Jr,
|
|
3941
|
+
stateZ: be,
|
|
3942
|
+
subjectZ: Hr,
|
|
3943
|
+
transferZ: Ra
|
|
3944
|
+
}, Symbol.toStringTag, { value: "Module" })), La = (t) => Object.getOwnPropertySymbols(globalThis).includes(t), Da = (t, e) => {
|
|
3815
3945
|
const r = Symbol.for(t);
|
|
3816
|
-
if (!
|
|
3946
|
+
if (!La(r)) {
|
|
3817
3947
|
const n = e();
|
|
3818
3948
|
Object.defineProperty(globalThis, r, { value: n });
|
|
3819
3949
|
}
|
|
3820
3950
|
return () => globalThis[r];
|
|
3821
|
-
},
|
|
3822
|
-
static discriminator =
|
|
3823
|
-
discriminator =
|
|
3951
|
+
}, Kr = "sy_x_error", Pa = (t) => (e) => e != null && typeof e == "object" && "type" in e && typeof e.type == "string" ? e.type.startsWith(t) : e instanceof Error ? e.message.startsWith(t) : typeof e != "string" ? !1 : e.startsWith(t), Qr = (t) => class le extends Error {
|
|
3952
|
+
static discriminator = Kr;
|
|
3953
|
+
discriminator = le.discriminator;
|
|
3824
3954
|
static TYPE = t;
|
|
3825
|
-
type =
|
|
3826
|
-
static matches =
|
|
3827
|
-
matches =
|
|
3955
|
+
type = le.TYPE;
|
|
3956
|
+
static matches = Pa(t);
|
|
3957
|
+
matches = le.matches;
|
|
3828
3958
|
constructor(r, n) {
|
|
3829
|
-
super(r, n), this.name =
|
|
3959
|
+
super(r, n), this.name = le.TYPE;
|
|
3830
3960
|
}
|
|
3831
3961
|
static sub(r) {
|
|
3832
|
-
return
|
|
3962
|
+
return Qr(`${t}.${r}`);
|
|
3833
3963
|
}
|
|
3834
|
-
},
|
|
3964
|
+
}, qa = (t) => {
|
|
3835
3965
|
if (t == null || typeof t != "object") return !1;
|
|
3836
3966
|
const e = t;
|
|
3837
|
-
if (e.discriminator !==
|
|
3967
|
+
if (e.discriminator !== Kr) return !1;
|
|
3838
3968
|
if (!("type" in e))
|
|
3839
3969
|
throw new Error(
|
|
3840
3970
|
`X Error is missing its type property: ${JSON.stringify(e)}`
|
|
3841
3971
|
);
|
|
3842
3972
|
return !0;
|
|
3843
|
-
},
|
|
3844
|
-
class
|
|
3973
|
+
}, ae = "unknown", Yt = "nil";
|
|
3974
|
+
class ka {
|
|
3845
3975
|
providers = [];
|
|
3846
3976
|
register(e) {
|
|
3847
3977
|
this.providers.push(e);
|
|
3848
3978
|
}
|
|
3849
3979
|
encode(e) {
|
|
3850
|
-
if (e == null) return { type:
|
|
3851
|
-
if (
|
|
3980
|
+
if (e == null) return { type: Yt, data: "" };
|
|
3981
|
+
if (qa(e))
|
|
3852
3982
|
for (const r of this.providers) {
|
|
3853
3983
|
const n = r.encode(e);
|
|
3854
3984
|
if (n != null) return n;
|
|
3855
3985
|
}
|
|
3856
|
-
if (e instanceof Error) return { type:
|
|
3857
|
-
if (typeof e == "string") return { type:
|
|
3986
|
+
if (e instanceof Error) return { type: ae, data: e.message };
|
|
3987
|
+
if (typeof e == "string") return { type: ae, data: e };
|
|
3858
3988
|
try {
|
|
3859
|
-
return { type:
|
|
3989
|
+
return { type: ae, data: JSON.stringify(e) };
|
|
3860
3990
|
} catch {
|
|
3861
|
-
return { type:
|
|
3991
|
+
return { type: ae, data: "unable to encode error information" };
|
|
3862
3992
|
}
|
|
3863
3993
|
}
|
|
3864
3994
|
decode(e) {
|
|
3865
|
-
if (e == null || e.type ===
|
|
3866
|
-
if (e.type ===
|
|
3995
|
+
if (e == null || e.type === Yt) return null;
|
|
3996
|
+
if (e.type === ae) return new Wt(e.data);
|
|
3867
3997
|
for (const r of this.providers) {
|
|
3868
3998
|
const n = r.decode(e);
|
|
3869
3999
|
if (n != null) return n;
|
|
3870
4000
|
}
|
|
3871
|
-
return new
|
|
4001
|
+
return new Wt(e.data);
|
|
3872
4002
|
}
|
|
3873
4003
|
}
|
|
3874
|
-
|
|
3875
|
-
class
|
|
4004
|
+
Da("synnax-error-registry", () => new ka());
|
|
4005
|
+
class Wt extends Qr("unknown") {
|
|
3876
4006
|
}
|
|
3877
4007
|
a.object({ type: a.string(), data: a.string() });
|
|
3878
|
-
const
|
|
3879
|
-
jsonrpc:
|
|
3880
|
-
method:
|
|
4008
|
+
const Fo = () => new Promise((t) => setTimeout(t, 0)), Zo = (t) => t ? -1 : 1, za = S.object({
|
|
4009
|
+
jsonrpc: S.literal("2.0"),
|
|
4010
|
+
method: S.string(),
|
|
3881
4011
|
// params should be z.union([z.record(z.string(), z.json()),
|
|
3882
4012
|
// z.array(z.json())]).optional() but the VSCode JSON RPC implementation uses a looser
|
|
3883
4013
|
// definition of params then in the JSON-RPC spec.
|
|
3884
|
-
params:
|
|
3885
|
-
id:
|
|
3886
|
-
}),
|
|
3887
|
-
jsonrpc:
|
|
3888
|
-
id:
|
|
3889
|
-
}),
|
|
3890
|
-
result:
|
|
3891
|
-
}),
|
|
3892
|
-
error:
|
|
3893
|
-
code:
|
|
4014
|
+
params: S.any().optional(),
|
|
4015
|
+
id: S.union([S.string(), S.number(), S.null()]).optional()
|
|
4016
|
+
}), _r = S.object({
|
|
4017
|
+
jsonrpc: S.literal("2.0"),
|
|
4018
|
+
id: S.union([S.string(), S.number(), S.null()])
|
|
4019
|
+
}), Fa = _r.extend({
|
|
4020
|
+
result: S.json()
|
|
4021
|
+
}), Za = _r.extend({
|
|
4022
|
+
error: S.object({
|
|
4023
|
+
code: S.number().int(),
|
|
3894
4024
|
// This should be z.string(), but the VSCode JSON RPC implementation uses a looser
|
|
3895
4025
|
// definition of error than the JSON-RPC spec.
|
|
3896
|
-
message:
|
|
3897
|
-
data:
|
|
4026
|
+
message: S.string().optional(),
|
|
4027
|
+
data: S.json().optional()
|
|
3898
4028
|
})
|
|
3899
|
-
}),
|
|
3900
|
-
|
|
3901
|
-
const
|
|
4029
|
+
}), Ya = S.union([Fa, Za]);
|
|
4030
|
+
S.union([za, Ya]);
|
|
4031
|
+
const Wa = (t, e, r) => {
|
|
3902
4032
|
const n = t.get(e);
|
|
3903
4033
|
return n === void 0 ? (t.set(e, r), r) : n;
|
|
3904
|
-
},
|
|
4034
|
+
}, Yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3905
4035
|
__proto__: null,
|
|
3906
|
-
getOrSetDefault:
|
|
3907
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4036
|
+
getOrSetDefault: Wa
|
|
4037
|
+
}, Symbol.toStringTag, { value: "Module" })), gt = a.string().regex(/^\d+\.\d+\.\d+$/), Te = (t, e, r = {}) => {
|
|
3908
4038
|
r.checkMajor ??= !0, r.checkMinor ??= !0, r.checkPatch ??= !0;
|
|
3909
|
-
const n =
|
|
4039
|
+
const n = gt.parse(t), s = gt.parse(e), [i, o, c] = n.split(".").map(Number), [h, l, d] = s.split(".").map(Number);
|
|
3910
4040
|
if (r.checkMajor) {
|
|
3911
|
-
if (i <
|
|
3912
|
-
if (i >
|
|
4041
|
+
if (i < h) return Ie;
|
|
4042
|
+
if (i > h) return Me;
|
|
3913
4043
|
}
|
|
3914
4044
|
if (r.checkMinor) {
|
|
3915
|
-
if (o <
|
|
3916
|
-
if (o >
|
|
4045
|
+
if (o < l) return Ie;
|
|
4046
|
+
if (o > l) return Me;
|
|
3917
4047
|
}
|
|
3918
4048
|
if (r.checkPatch) {
|
|
3919
|
-
if (c <
|
|
3920
|
-
if (c >
|
|
4049
|
+
if (c < d) return Ie;
|
|
4050
|
+
if (c > d) return Me;
|
|
3921
4051
|
}
|
|
3922
|
-
return
|
|
3923
|
-
},
|
|
4052
|
+
return ne;
|
|
4053
|
+
}, Va = (t, e, r = {}) => er(Te(t, e, r)), en = (t, e, r = {}) => _t(Te(t, e, r)), Ga = (t, e, r = {}) => Qt(Te(t, e, r)), Ha = ({
|
|
3924
4054
|
name: t,
|
|
3925
4055
|
migrate: e
|
|
3926
4056
|
}) => (r) => {
|
|
@@ -3930,68 +4060,68 @@ const qa = (t, e, r) => {
|
|
|
3930
4060
|
} catch (n) {
|
|
3931
4061
|
throw console.log(`${t} failed to migrate from ${r.version}`), console.error(n), n;
|
|
3932
4062
|
}
|
|
3933
|
-
},
|
|
4063
|
+
}, Ja = ({
|
|
3934
4064
|
name: t,
|
|
3935
4065
|
migrations: e,
|
|
3936
4066
|
targetSchema: r,
|
|
3937
4067
|
defaultVersion: n,
|
|
3938
4068
|
def: s
|
|
3939
4069
|
}) => {
|
|
3940
|
-
const i = Object.keys(e).sort(
|
|
4070
|
+
const i = Object.keys(e).sort(Te).pop();
|
|
3941
4071
|
if (i == null)
|
|
3942
|
-
return (
|
|
3943
|
-
if (
|
|
4072
|
+
return (l) => {
|
|
4073
|
+
if (l.version ??= n, l.version !== s.version)
|
|
3944
4074
|
return console.log(
|
|
3945
|
-
`${t} version ${
|
|
4075
|
+
`${t} version ${l.version} is newer than latest version of ${s.version}.
|
|
3946
4076
|
Returning default instead.
|
|
3947
4077
|
`
|
|
3948
4078
|
), s;
|
|
3949
4079
|
try {
|
|
3950
|
-
return r != null ? r.parse(
|
|
3951
|
-
} catch (
|
|
3952
|
-
return console.log(`${t} failed to parse default. Exiting with default`), console.error(
|
|
4080
|
+
return r != null ? r.parse(l) : l;
|
|
4081
|
+
} catch (d) {
|
|
4082
|
+
return console.log(`${t} failed to parse default. Exiting with default`), console.error(d), s;
|
|
3953
4083
|
}
|
|
3954
4084
|
};
|
|
3955
4085
|
const o = Object.keys(e).length;
|
|
3956
4086
|
let c = !1;
|
|
3957
|
-
const
|
|
4087
|
+
const h = (l) => {
|
|
3958
4088
|
try {
|
|
3959
|
-
if (o === 0 ||
|
|
3960
|
-
return console.log(c ? `${t} ${
|
|
3961
|
-
const
|
|
3962
|
-
return c = !0,
|
|
3963
|
-
} catch (
|
|
4089
|
+
if (o === 0 || en(l.version, i))
|
|
4090
|
+
return console.log(c ? `${t} ${l.version} now up to date` : `${t} version ${l.version} is up to date with target version ${s.version}`), l;
|
|
4091
|
+
const d = l.version, m = e[d], p = m(l);
|
|
4092
|
+
return c = !0, h(p);
|
|
4093
|
+
} catch (d) {
|
|
3964
4094
|
return console.log(
|
|
3965
|
-
`${t} failed to migrate from ${
|
|
3966
|
-
), console.error(
|
|
4095
|
+
`${t} failed to migrate from ${l.version} to ${i}`
|
|
4096
|
+
), console.error(d), s;
|
|
3967
4097
|
}
|
|
3968
4098
|
};
|
|
3969
|
-
return (
|
|
4099
|
+
return (l) => {
|
|
3970
4100
|
try {
|
|
3971
|
-
if (
|
|
4101
|
+
if (l.version == null)
|
|
3972
4102
|
if (n != null)
|
|
3973
4103
|
console.log(
|
|
3974
4104
|
`${t} version is null. Setting version to default of ${n}`
|
|
3975
|
-
),
|
|
4105
|
+
), l.version = n;
|
|
3976
4106
|
else
|
|
3977
4107
|
return console.log(
|
|
3978
4108
|
`${t} version is null and no default version set. Exiting with default`
|
|
3979
4109
|
), s;
|
|
3980
|
-
return l
|
|
3981
|
-
} catch (
|
|
3982
|
-
return console.log(`${t} failed to parse final result. Exiting with default`), console.error(
|
|
4110
|
+
return h(l);
|
|
4111
|
+
} catch (d) {
|
|
4112
|
+
return console.log(`${t} failed to parse final result. Exiting with default`), console.error(d), s;
|
|
3983
4113
|
}
|
|
3984
4114
|
};
|
|
3985
|
-
},
|
|
4115
|
+
}, Wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3986
4116
|
__proto__: null,
|
|
3987
|
-
compareSemVer:
|
|
3988
|
-
createMigration:
|
|
3989
|
-
migrator:
|
|
3990
|
-
semVerNewer:
|
|
3991
|
-
semVerOlder:
|
|
3992
|
-
semVerZ:
|
|
3993
|
-
versionsEqual:
|
|
3994
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4117
|
+
compareSemVer: Te,
|
|
4118
|
+
createMigration: Ha,
|
|
4119
|
+
migrator: Ja,
|
|
4120
|
+
semVerNewer: en,
|
|
4121
|
+
semVerOlder: Ga,
|
|
4122
|
+
semVerZ: gt,
|
|
4123
|
+
versionsEqual: Va
|
|
4124
|
+
}, Symbol.toStringTag, { value: "Module" })), tn = ["standard", "scientific", "engineering"], Xa = a.enum(tn), Ka = (t, e, r) => {
|
|
3995
4125
|
if (Number.isNaN(t)) return "NaN";
|
|
3996
4126
|
if (t === 1 / 0) return "∞";
|
|
3997
4127
|
if (t === -1 / 0) return "-∞";
|
|
@@ -4000,28 +4130,28 @@ const qa = (t, e, r) => {
|
|
|
4000
4130
|
return e === 0 ? "0ᴇ0" : `0.${"0".repeat(e)}ᴇ0`;
|
|
4001
4131
|
let n;
|
|
4002
4132
|
return r === "scientific" ? n = Math.floor(Math.log10(Math.abs(t))) : n = Math.floor(Math.log10(Math.abs(t)) / 3) * 3, `${(t / 10 ** n).toFixed(e)}ᴇ${n}`;
|
|
4003
|
-
},
|
|
4133
|
+
}, Vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4004
4134
|
__proto__: null,
|
|
4005
|
-
NOTATIONS:
|
|
4006
|
-
notationZ:
|
|
4007
|
-
stringifyNumber:
|
|
4008
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4135
|
+
NOTATIONS: tn,
|
|
4136
|
+
notationZ: Xa,
|
|
4137
|
+
stringifyNumber: Ka
|
|
4138
|
+
}, Symbol.toStringTag, { value: "Module" })), Go = (t) => Array.isArray(t) ? [...t] : typeof t == "object" && t !== null ? { ...t } : t, rn = a.enum([
|
|
4009
4139
|
"success",
|
|
4010
4140
|
"info",
|
|
4011
4141
|
"warning",
|
|
4012
4142
|
"error",
|
|
4013
4143
|
"loading",
|
|
4014
4144
|
"disabled"
|
|
4015
|
-
]),
|
|
4145
|
+
]), Qa = (t) => a.object({
|
|
4016
4146
|
key: a.string(),
|
|
4017
|
-
variant:
|
|
4147
|
+
variant: rn,
|
|
4018
4148
|
message: a.string(),
|
|
4019
4149
|
description: a.string().optional(),
|
|
4020
4150
|
time: b.z,
|
|
4021
4151
|
details: t ?? a.unknown().optional()
|
|
4022
|
-
}),
|
|
4152
|
+
}), _a = (t, e) => {
|
|
4023
4153
|
if (!(t instanceof Error)) throw t;
|
|
4024
|
-
return
|
|
4154
|
+
return nn({
|
|
4025
4155
|
variant: "error",
|
|
4026
4156
|
message: e ?? t.message,
|
|
4027
4157
|
description: e != null ? t.message : void 0,
|
|
@@ -4029,58 +4159,86 @@ const qa = (t, e, r) => {
|
|
|
4029
4159
|
stack: t.stack ?? ""
|
|
4030
4160
|
}
|
|
4031
4161
|
});
|
|
4032
|
-
},
|
|
4033
|
-
key:
|
|
4162
|
+
}, nn = (t) => ({
|
|
4163
|
+
key: Lt(),
|
|
4034
4164
|
time: b.now(),
|
|
4035
4165
|
...t
|
|
4036
|
-
}),
|
|
4166
|
+
}), eo = (t, e = []) => Array.isArray(e) ? e.includes(t) ? t : void 0 : e === t ? t : void 0, Ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4167
|
+
__proto__: null,
|
|
4168
|
+
create: nn,
|
|
4169
|
+
filterVariant: eo,
|
|
4170
|
+
fromException: _a,
|
|
4171
|
+
statusZ: Qa,
|
|
4172
|
+
variantZ: rn
|
|
4173
|
+
}, Symbol.toStringTag, { value: "Module" })), to = (t, e = "") => {
|
|
4174
|
+
if (typeof t == "string") return t;
|
|
4175
|
+
const r = t.length;
|
|
4176
|
+
return r === 0 ? e : r === 1 ? t[0] : r === 2 ? `${t[0]} and ${t[1]}` : `${t.slice(0, -1).join(", ")}, and ${t[r - 1]}`;
|
|
4177
|
+
}, ro = (t) => {
|
|
4178
|
+
const e = t.split(" "), r = /* @__PURE__ */ new Set(), n = e.map((o) => o.charAt(0).toLowerCase()).join("");
|
|
4179
|
+
r.add(n.replace(/-/g, "_")), r.add(n.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_"));
|
|
4180
|
+
const s = /\d+/g;
|
|
4181
|
+
t.match(s) && e.forEach((o, c) => {
|
|
4182
|
+
if (s.test(o)) {
|
|
4183
|
+
const h = e.map((l, d) => d !== c ? l.charAt(0).toLowerCase() : l).join("");
|
|
4184
|
+
r.add(h.replace(/-/g, "_")), r.add(
|
|
4185
|
+
h.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_")
|
|
4186
|
+
);
|
|
4187
|
+
}
|
|
4188
|
+
});
|
|
4189
|
+
const i = e.map(
|
|
4190
|
+
(o) => (o.length > 3 ? o.substring(0, 3) : o).toLowerCase()
|
|
4191
|
+
);
|
|
4192
|
+
return r.add(i.join("").replace(/-/g, "_")), r.add(i.join("_").replace(/-/g, "_")), Array.from(r).filter(
|
|
4193
|
+
(o) => o.length >= 2 && o.length <= 12 && !/^\d/.test(o)
|
|
4194
|
+
);
|
|
4195
|
+
}, no = (t, e) => t.startsWith(e) ? t.slice(e.length) : t, Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4037
4196
|
__proto__: null,
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
var Ja = function(t, e, r, n) {
|
|
4197
|
+
createShortIdentifiers: ro,
|
|
4198
|
+
naturalLanguageJoin: to,
|
|
4199
|
+
trimPrefix: no
|
|
4200
|
+
}, Symbol.toStringTag, { value: "Module" })), so = new Error("request for lock canceled");
|
|
4201
|
+
var io = function(t, e, r, n) {
|
|
4044
4202
|
function s(i) {
|
|
4045
4203
|
return i instanceof r ? i : new r(function(o) {
|
|
4046
4204
|
o(i);
|
|
4047
4205
|
});
|
|
4048
4206
|
}
|
|
4049
4207
|
return new (r || (r = Promise))(function(i, o) {
|
|
4050
|
-
function c(
|
|
4208
|
+
function c(d) {
|
|
4051
4209
|
try {
|
|
4052
|
-
|
|
4053
|
-
} catch (
|
|
4054
|
-
o(
|
|
4210
|
+
l(n.next(d));
|
|
4211
|
+
} catch (m) {
|
|
4212
|
+
o(m);
|
|
4055
4213
|
}
|
|
4056
4214
|
}
|
|
4057
|
-
function
|
|
4215
|
+
function h(d) {
|
|
4058
4216
|
try {
|
|
4059
|
-
|
|
4060
|
-
} catch (
|
|
4061
|
-
o(
|
|
4217
|
+
l(n.throw(d));
|
|
4218
|
+
} catch (m) {
|
|
4219
|
+
o(m);
|
|
4062
4220
|
}
|
|
4063
4221
|
}
|
|
4064
|
-
function
|
|
4065
|
-
|
|
4222
|
+
function l(d) {
|
|
4223
|
+
d.done ? i(d.value) : s(d.value).then(c, h);
|
|
4066
4224
|
}
|
|
4067
|
-
|
|
4225
|
+
l((n = n.apply(t, e || [])).next());
|
|
4068
4226
|
});
|
|
4069
4227
|
};
|
|
4070
|
-
class
|
|
4071
|
-
constructor(e, r =
|
|
4228
|
+
class ao {
|
|
4229
|
+
constructor(e, r = so) {
|
|
4072
4230
|
this._value = e, this._cancelError = r, this._queue = [], this._weightedWaiters = [];
|
|
4073
4231
|
}
|
|
4074
4232
|
acquire(e = 1, r = 0) {
|
|
4075
4233
|
if (e <= 0)
|
|
4076
4234
|
throw new Error(`invalid weight ${e}: must be positive`);
|
|
4077
4235
|
return new Promise((n, s) => {
|
|
4078
|
-
const i = { resolve: n, reject: s, weight: e, priority: r }, o =
|
|
4236
|
+
const i = { resolve: n, reject: s, weight: e, priority: r }, o = sn(this._queue, (c) => r <= c.priority);
|
|
4079
4237
|
o === -1 && e <= this._value ? this._dispatchItem(i) : this._queue.splice(o + 1, 0, i);
|
|
4080
4238
|
});
|
|
4081
4239
|
}
|
|
4082
4240
|
runExclusive(e) {
|
|
4083
|
-
return
|
|
4241
|
+
return io(this, arguments, void 0, function* (r, n = 1, s = 0) {
|
|
4084
4242
|
const [i, o] = yield this.acquire(n, s);
|
|
4085
4243
|
try {
|
|
4086
4244
|
return yield r(i);
|
|
@@ -4093,7 +4251,7 @@ class Xa {
|
|
|
4093
4251
|
if (e <= 0)
|
|
4094
4252
|
throw new Error(`invalid weight ${e}: must be positive`);
|
|
4095
4253
|
return this._couldLockImmediately(e, r) ? Promise.resolve() : new Promise((n) => {
|
|
4096
|
-
this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []),
|
|
4254
|
+
this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []), oo(this._weightedWaiters[e - 1], { resolve: n, priority: r });
|
|
4097
4255
|
});
|
|
4098
4256
|
}
|
|
4099
4257
|
isLocked() {
|
|
@@ -4148,49 +4306,49 @@ class Xa {
|
|
|
4148
4306
|
return (this._queue.length === 0 || this._queue[0].priority < r) && e <= this._value;
|
|
4149
4307
|
}
|
|
4150
4308
|
}
|
|
4151
|
-
function
|
|
4152
|
-
const r =
|
|
4309
|
+
function oo(t, e) {
|
|
4310
|
+
const r = sn(t, (n) => e.priority <= n.priority);
|
|
4153
4311
|
t.splice(r + 1, 0, e);
|
|
4154
4312
|
}
|
|
4155
|
-
function
|
|
4313
|
+
function sn(t, e) {
|
|
4156
4314
|
for (let r = t.length - 1; r >= 0; r--)
|
|
4157
4315
|
if (e(t[r]))
|
|
4158
4316
|
return r;
|
|
4159
4317
|
return -1;
|
|
4160
4318
|
}
|
|
4161
|
-
var
|
|
4319
|
+
var uo = function(t, e, r, n) {
|
|
4162
4320
|
function s(i) {
|
|
4163
4321
|
return i instanceof r ? i : new r(function(o) {
|
|
4164
4322
|
o(i);
|
|
4165
4323
|
});
|
|
4166
4324
|
}
|
|
4167
4325
|
return new (r || (r = Promise))(function(i, o) {
|
|
4168
|
-
function c(
|
|
4326
|
+
function c(d) {
|
|
4169
4327
|
try {
|
|
4170
|
-
|
|
4171
|
-
} catch (
|
|
4172
|
-
o(
|
|
4328
|
+
l(n.next(d));
|
|
4329
|
+
} catch (m) {
|
|
4330
|
+
o(m);
|
|
4173
4331
|
}
|
|
4174
4332
|
}
|
|
4175
|
-
function
|
|
4333
|
+
function h(d) {
|
|
4176
4334
|
try {
|
|
4177
|
-
|
|
4178
|
-
} catch (
|
|
4179
|
-
o(
|
|
4335
|
+
l(n.throw(d));
|
|
4336
|
+
} catch (m) {
|
|
4337
|
+
o(m);
|
|
4180
4338
|
}
|
|
4181
4339
|
}
|
|
4182
|
-
function
|
|
4183
|
-
|
|
4340
|
+
function l(d) {
|
|
4341
|
+
d.done ? i(d.value) : s(d.value).then(c, h);
|
|
4184
4342
|
}
|
|
4185
|
-
|
|
4343
|
+
l((n = n.apply(t, e || [])).next());
|
|
4186
4344
|
});
|
|
4187
4345
|
};
|
|
4188
|
-
class
|
|
4346
|
+
class lo {
|
|
4189
4347
|
constructor(e) {
|
|
4190
|
-
this._semaphore = new
|
|
4348
|
+
this._semaphore = new ao(1, e);
|
|
4191
4349
|
}
|
|
4192
4350
|
acquire() {
|
|
4193
|
-
return
|
|
4351
|
+
return uo(this, arguments, void 0, function* (e = 0) {
|
|
4194
4352
|
const [, r] = yield this._semaphore.acquire(1, e);
|
|
4195
4353
|
return r;
|
|
4196
4354
|
});
|
|
@@ -4211,34 +4369,34 @@ class _a {
|
|
|
4211
4369
|
return this._semaphore.cancel();
|
|
4212
4370
|
}
|
|
4213
4371
|
}
|
|
4214
|
-
class
|
|
4372
|
+
class an extends lo {
|
|
4215
4373
|
constructor(e) {
|
|
4216
4374
|
super(), Object.assign(this, e);
|
|
4217
4375
|
}
|
|
4218
4376
|
}
|
|
4219
|
-
const
|
|
4377
|
+
const co = (t) => new an(t), Xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4220
4378
|
__proto__: null,
|
|
4221
|
-
mutex:
|
|
4222
|
-
newMutex:
|
|
4379
|
+
mutex: an,
|
|
4380
|
+
newMutex: co
|
|
4223
4381
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4224
|
-
function
|
|
4382
|
+
function on(t) {
|
|
4225
4383
|
var e, r, n = "";
|
|
4226
4384
|
if (typeof t == "string" || typeof t == "number") n += t;
|
|
4227
4385
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
4228
4386
|
var s = t.length;
|
|
4229
|
-
for (e = 0; e < s; e++) t[e] && (r =
|
|
4387
|
+
for (e = 0; e < s; e++) t[e] && (r = on(t[e])) && (n && (n += " "), n += r);
|
|
4230
4388
|
} else for (r in t) t[r] && (n && (n += " "), n += r);
|
|
4231
4389
|
return n;
|
|
4232
4390
|
}
|
|
4233
|
-
function
|
|
4234
|
-
for (var t, e, r = 0, n = "", s = arguments.length; r < s; r++) (t = arguments[r]) && (e =
|
|
4391
|
+
function ho() {
|
|
4392
|
+
for (var t, e, r = 0, n = "", s = arguments.length; r < s; r++) (t = arguments[r]) && (e = on(t)) && (n && (n += " "), n += e);
|
|
4235
4393
|
return n;
|
|
4236
4394
|
}
|
|
4237
|
-
const
|
|
4238
|
-
const e = (...r) =>
|
|
4239
|
-
return e.B = (...r) => t +
|
|
4395
|
+
const fo = ho, ee = "-", Vt = "__", Ne = "--", un = (t) => {
|
|
4396
|
+
const e = (...r) => fo(...r);
|
|
4397
|
+
return e.B = (...r) => t + ee + r.join(ee), e.E = (r) => t + Vt + r, e.M = (...r) => t + Ne + r.join("-"), e.BM = (r, ...n) => e.B(r) + Ne + n.join("-"), e.BE = (r, ...n) => e.B(r) + Vt + n.join(ee), e.BEM = (r, n, ...s) => e.BE(r, n) + Ne + s.join(ee), e.extend = (r) => un(e.B(r)), e.var = (...r) => Ne + t + ee + r.join(ee), e;
|
|
4240
4398
|
};
|
|
4241
|
-
class
|
|
4399
|
+
class go {
|
|
4242
4400
|
rows = [];
|
|
4243
4401
|
columns = [];
|
|
4244
4402
|
prefix;
|
|
@@ -4267,71 +4425,72 @@ class no {
|
|
|
4267
4425
|
};
|
|
4268
4426
|
}
|
|
4269
4427
|
}
|
|
4270
|
-
const
|
|
4428
|
+
const po = (t, e) => Object.entries(e).forEach(
|
|
4271
4429
|
([r, n]) => n != null && t.style.setProperty(r, `${n}`)
|
|
4272
|
-
),
|
|
4430
|
+
), mo = (t, e) => Array.from(t.style).forEach((r) => {
|
|
4273
4431
|
r.startsWith(e) && t.style.removeProperty(r);
|
|
4274
|
-
}),
|
|
4275
|
-
const e =
|
|
4276
|
-
return e.visible = (r) => e.M(r ? "visible" : "hidden"), e.expanded = (r) => e.M(r ? "expanded" : "collapsed"), e.loc = (r) => e.M("location",
|
|
4432
|
+
}), yo = (t) => {
|
|
4433
|
+
const e = un(t);
|
|
4434
|
+
return e.visible = (r) => e.M(r ? "visible" : "hidden"), e.expanded = (r) => e.M(r ? "expanded" : "collapsed"), e.loc = (r) => e.M("location", ms.construct(r)), e.disabled = (r) => r === !0 && e.M("disabled"), e.align = (r) => e.M(r), e.dir = (r) => r != null && e.M("direction", ts.construct(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.toString()}`) : 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.applyVars = po, e.removeVars = mo, e.newGridBuilder = (r) => new go(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) => r != null && e.M(`shade-${r}`), e.colorVar = (r) => {
|
|
4277
4435
|
if (!(r == null || r === !1))
|
|
4278
|
-
return typeof r == "number" ? `var(--${t}-gray-l${r})` :
|
|
4436
|
+
return typeof r == "number" ? `var(--${t}-gray-l${r})` : Ua.cssString(r);
|
|
4279
4437
|
}, e.levelSizeVar = (r) => `var(--${t}-${r}-size)`, e.level = (r) => e.M(`level-${r}`), e;
|
|
4280
|
-
},
|
|
4438
|
+
}, Ko = yo("pluto");
|
|
4281
4439
|
export {
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4440
|
+
hs as $,
|
|
4441
|
+
Wo as A,
|
|
4442
|
+
Po as B,
|
|
4443
|
+
Ko as C,
|
|
4444
|
+
I as D,
|
|
4445
|
+
cs as E,
|
|
4446
|
+
xt as F,
|
|
4447
|
+
H as G,
|
|
4448
|
+
Io as H,
|
|
4449
|
+
E as I,
|
|
4450
|
+
Bo as J,
|
|
4451
|
+
No as K,
|
|
4452
|
+
fs as L,
|
|
4453
|
+
Bt as M,
|
|
4454
|
+
Nt as N,
|
|
4455
|
+
xo as O,
|
|
4456
|
+
us as P,
|
|
4457
|
+
T as Q,
|
|
4458
|
+
di as R,
|
|
4459
|
+
qo as S,
|
|
4460
|
+
q as T,
|
|
4461
|
+
ti as U,
|
|
4462
|
+
ve as V,
|
|
4463
|
+
Ro as W,
|
|
4464
|
+
G as X,
|
|
4465
|
+
V as Y,
|
|
4466
|
+
_s as Z,
|
|
4467
|
+
Mo as _,
|
|
4468
|
+
vo as a,
|
|
4469
|
+
Qs as a0,
|
|
4470
|
+
Zo as a1,
|
|
4471
|
+
Eo as b,
|
|
4472
|
+
Ua as c,
|
|
4473
|
+
So as d,
|
|
4474
|
+
J as e,
|
|
4475
|
+
$ as f,
|
|
4476
|
+
ts as g,
|
|
4477
|
+
Vo as h,
|
|
4478
|
+
O as i,
|
|
4479
|
+
Le as j,
|
|
4480
|
+
Ao as k,
|
|
4481
|
+
Xo as l,
|
|
4482
|
+
$o as m,
|
|
4483
|
+
un as n,
|
|
4484
|
+
ko as o,
|
|
4485
|
+
ms as p,
|
|
4486
|
+
zo as q,
|
|
4487
|
+
b as r,
|
|
4488
|
+
Jo as s,
|
|
4489
|
+
Fo as t,
|
|
4490
|
+
ho as u,
|
|
4491
|
+
Ur as v,
|
|
4492
|
+
Ho as w,
|
|
4493
|
+
Yo as x,
|
|
4494
|
+
Go as y,
|
|
4495
|
+
wo as z
|
|
4337
4496
|
};
|