@synnaxlabs/x 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +33 -33
- package/dist/binary.cjs +1 -1
- package/dist/binary.js +1 -1
- package/dist/{bounds-CCueigU3.js → bounds-CFI9wDXn.js} +7 -7
- package/dist/bounds-DzCDHgdE.cjs +1 -0
- package/dist/bounds.cjs +1 -1
- package/dist/bounds.js +1 -1
- package/dist/{box-hAkmDC3K.js → box-DVCNGsJG.js} +1 -1
- package/dist/{box-CZVdKCOc.cjs → box-Mf8E1Ypp.cjs} +1 -1
- package/dist/box.cjs +1 -1
- package/dist/box.js +1 -1
- package/dist/caseconv.cjs +1 -1
- package/dist/caseconv.js +1 -1
- package/dist/compare.js +1 -1
- package/dist/deep.cjs +1 -1
- package/dist/deep.js +46 -48
- package/dist/{direction-DZbN47uL.cjs → direction-D7qoo_GJ.cjs} +1 -1
- package/dist/direction.cjs +1 -1
- package/dist/external-B3XSLDq5.cjs +1 -0
- package/dist/{external-CO221aaF.js → external-sVtvYJS6.js} +3 -3
- package/dist/{index-zsix_qnl.js → index-BBa2mWG1.js} +1 -1
- package/dist/{index-DQZfhLnw.cjs → index-CYxQwEdX.cjs} +1 -1
- package/dist/{index-B3BUDIdi.js → index-HQonyH7n.js} +1 -2
- package/dist/index-YsO0EMN8.cjs +1 -0
- package/dist/{index-q_1Jz5rY.js → index-eue4dSQX.js} +10 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +21 -21
- package/dist/{location-B5rSnQP3.js → location-CI9x53qR.js} +8 -8
- package/dist/{location-YGxhLPDy.cjs → location-DetomF8Z.cjs} +1 -1
- package/dist/location.cjs +1 -1
- package/dist/location.js +1 -1
- package/dist/path-BBCx3K6k.cjs +1 -0
- package/dist/{path-B-1-i3qC.js → path-CmnoH3RC.js} +26 -26
- package/dist/{position-BZOTg74V.js → position-CFc9RsSn.js} +2 -2
- package/dist/{position-CjNCcq8X.cjs → position-DKhPhvPh.cjs} +1 -1
- package/dist/position.cjs +1 -1
- package/dist/position.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/{scale-BvbW9p2C.cjs → scale-CT61XD_X.cjs} +1 -1
- package/dist/{scale-C7_4I3pa.js → scale-DNQE1LMm.js} +25 -3
- package/dist/scale.cjs +1 -1
- package/dist/scale.js +1 -1
- package/dist/series-DWLXo7J6.cjs +11 -0
- package/dist/{series-CZw97Bq2.js → series-sjWkW8qe.js} +25 -27
- package/dist/spatial.cjs +1 -1
- package/dist/spatial.js +5 -5
- package/dist/src/binary/encoder.d.ts.map +1 -1
- package/dist/src/caseconv/caseconv.d.ts.map +1 -1
- package/dist/src/clamp/clamp.d.ts.map +1 -1
- package/dist/src/compare/compare.d.ts.map +1 -1
- package/dist/src/debounce/debounce.d.ts.map +1 -1
- package/dist/src/deep/difference.d.ts.map +1 -1
- package/dist/src/deep/merge.d.ts.map +1 -1
- package/dist/src/deep/path.d.ts +1 -1
- package/dist/src/deep/path.d.ts.map +1 -1
- package/dist/src/migrate/migrate.d.ts.map +1 -1
- package/dist/src/spatial/bounds/bounds.d.ts +4 -2
- package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
- package/dist/src/spatial/box/box.d.ts.map +1 -1
- package/dist/src/spatial/scale/scale.d.ts +177 -5
- package/dist/src/spatial/scale/scale.d.ts.map +1 -1
- package/dist/src/telem/generate.d.ts.map +1 -1
- package/dist/src/telem/series.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/src/url/url.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +1 -1
- package/dist/url.cjs +1 -1
- package/dist/url.js +1 -1
- package/dist/{zodutil-BWvwKcpb.cjs → zodutil-C6RYzvXd.cjs} +1 -1
- package/dist/{zodutil-qNM8aVYC.js → zodutil-Tmuc4CNq.js} +1 -1
- package/dist/zodutil.cjs +1 -1
- package/dist/zodutil.js +1 -1
- package/package.json +9 -8
- package/src/binary/encoder.ts +1 -2
- package/src/caseconv/caseconv.ts +7 -15
- package/src/clamp/clamp.ts +1 -1
- package/src/compare/compare.ts +1 -3
- package/src/debounce/debounce.ts +1 -2
- package/src/deep/difference.ts +3 -9
- package/src/deep/merge.ts +8 -15
- package/src/deep/path.spec.ts +1 -1
- package/src/deep/path.ts +3 -3
- package/src/math/math.ts +1 -1
- package/src/migrate/migrate.ts +4 -5
- package/src/runtime/os.ts +2 -2
- package/src/spatial/bounds/bounds.spec.ts +1 -1
- package/src/spatial/bounds/bounds.ts +6 -4
- package/src/spatial/box/box.ts +4 -7
- package/src/spatial/direction/direction.ts +1 -1
- package/src/spatial/location/location.ts +5 -5
- package/src/spatial/scale/scale.ts +196 -12
- package/src/telem/generate.ts +1 -3
- package/src/telem/series.ts +44 -53
- package/src/telem/telem.spec.ts +5 -11
- package/src/telem/telem.ts +12 -16
- package/src/url/url.ts +9 -12
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/bounds-Cudf5M4H.cjs +0 -1
- package/dist/external-B-DoBvh7.cjs +0 -1
- package/dist/index-By0n2R_b.cjs +0 -1
- package/dist/path-577Fmn5N.cjs +0 -1
- package/dist/series-BId9slhU.cjs +0 -11
package/dist/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
var j = Object.defineProperty;
|
|
2
2
|
var T = (e, t, r) => t in e ? j(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var p = (e, t, r) => T(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { e as X } from "./index-
|
|
5
|
-
import { a as ee } from "./index-
|
|
4
|
+
import { e as X } from "./index-BBa2mWG1.js";
|
|
5
|
+
import { a as ee } from "./index-eue4dSQX.js";
|
|
6
6
|
import { c as te } from "./change-DLl6DccR.js";
|
|
7
|
-
import { c as ne, s as se } from "./scale-
|
|
8
|
-
import { L as S, G as y, E as w, i as A, a as k, b as O } from "./index-
|
|
9
|
-
import { c as ae, d as ce, p as le } from "./index-
|
|
7
|
+
import { c as ne, s as se } from "./scale-DNQE1LMm.js";
|
|
8
|
+
import { L as S, G as y, E as w, i as A, a as k, b as O } from "./index-HQonyH7n.js";
|
|
9
|
+
import { c as ae, d as ce, p as le } from "./index-HQonyH7n.js";
|
|
10
10
|
import { z as c } from "zod";
|
|
11
11
|
import { debounce as ue, throttle as me } from "./debounce.js";
|
|
12
12
|
import { deep as pe } from "./deep.js";
|
|
13
|
-
import { d as be, D as he, M as xe, R as Se, S as ye, e as
|
|
13
|
+
import { d as be, D as he, M as xe, R as Se, S as ye, e as $e, c as ve, b as Ee, T as Me, a as je, g as Te, h as we, i as Ae, f as ke, t as Oe } from "./series-sjWkW8qe.js";
|
|
14
14
|
import { isObject as _e } from "./identity.js";
|
|
15
15
|
import { t as Ne } from "./types-BpAJW2TM.js";
|
|
16
|
-
import { b as Pe, f as Ge } from "./bounds-
|
|
16
|
+
import { b as Pe, f as Ge } from "./bounds-CFI9wDXn.js";
|
|
17
17
|
import { observe as De } from "./observe.js";
|
|
18
18
|
import { getEntries as Ie, unknownRecordZ as Ve } from "./record.js";
|
|
19
|
-
import { e as qe } from "./external-
|
|
19
|
+
import { e as qe } from "./external-sVtvYJS6.js";
|
|
20
20
|
import { Search as He } from "./search.js";
|
|
21
|
-
import { b as Ue } from "./box-
|
|
21
|
+
import { b as Ue } from "./box-DVCNGsJG.js";
|
|
22
22
|
import { d as Ke } from "./dimensions-D-1PnJVI.js";
|
|
23
23
|
import { d as Xe } from "./direction-CScbfCdT.js";
|
|
24
|
-
import { l as er } from "./location-
|
|
25
|
-
import { p as tr } from "./position-
|
|
24
|
+
import { l as er } from "./location-CI9x53qR.js";
|
|
25
|
+
import { p as tr } from "./position-CFc9RsSn.js";
|
|
26
26
|
import { s as nr } from "./spatial-DozyssiN.js";
|
|
27
27
|
import { x as ir } from "./xy-CrgPnICw.js";
|
|
28
28
|
import { nullToArr as cr, toArray as lr } from "./toArray.js";
|
|
29
29
|
import { unique as ur } from "./unique.js";
|
|
30
30
|
import { URL as dr, buildQueryString as pr } from "./url.js";
|
|
31
31
|
import { RoutedWorker as br, TypedWorker as hr, createMockWorkers as xr } from "./worker.js";
|
|
32
|
-
import { z as yr } from "./zodutil-
|
|
32
|
+
import { z as yr } from "./zodutil-Tmuc4CNq.js";
|
|
33
33
|
const l = class l extends Number {
|
|
34
34
|
};
|
|
35
35
|
p(l, "Absolute", 255), p(l, "Default", 1), p(l, "z", c.union([
|
|
@@ -64,13 +64,13 @@ const E = c.object({
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
p(m, "MESSAGE", "canceled");
|
|
67
|
-
let
|
|
68
|
-
const z = new
|
|
67
|
+
let $ = m;
|
|
68
|
+
const z = new $(), q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
69
69
|
__proto__: null,
|
|
70
70
|
CANCELED: z
|
|
71
|
-
}, Symbol.toStringTag, { value: "Module" })), B = (e) => e ? -1 : 1,
|
|
71
|
+
}, Symbol.toStringTag, { value: "Module" })), B = (e) => e ? -1 : 1, v = c.string().regex(/^\d+\.\d+\.\d+$/), g = (e, t, r = {}) => {
|
|
72
72
|
r.checkMajor ?? (r.checkMajor = !0), r.checkMinor ?? (r.checkMinor = !0), r.checkPatch ?? (r.checkPatch = !0);
|
|
73
|
-
const n =
|
|
73
|
+
const n = v.parse(e), i = v.parse(t), [f, u, d] = n.split(".").map(Number), [s, o, a] = i.split(".").map(Number);
|
|
74
74
|
if (r.checkMajor) {
|
|
75
75
|
if (f < s) return S;
|
|
76
76
|
if (f > s) return y;
|
|
@@ -104,9 +104,9 @@ const z = new v(), q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defi
|
|
|
104
104
|
const f = Object.keys(t).sort(g).pop();
|
|
105
105
|
if (f == null)
|
|
106
106
|
return (o) => {
|
|
107
|
-
if (o.version
|
|
107
|
+
if (o.version ?? (o.version = n), o.version !== i.version)
|
|
108
108
|
return console.log(
|
|
109
|
-
`${e} version ${o.version} is newer than latest version of ${i.version}.
|
|
109
|
+
`${e} version ${o.version} is newer than latest version of ${i.version}.
|
|
110
110
|
Returning default instead.
|
|
111
111
|
`
|
|
112
112
|
), i;
|
|
@@ -153,7 +153,7 @@ const z = new v(), q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defi
|
|
|
153
153
|
migrator: G,
|
|
154
154
|
semVerNewer: M,
|
|
155
155
|
semVerOlder: R,
|
|
156
|
-
semVerZ:
|
|
156
|
+
semVerZ: v,
|
|
157
157
|
versionsEqual: N
|
|
158
158
|
}, Symbol.toStringTag, { value: "Module" })), Q = (e) => {
|
|
159
159
|
if (e === void 0 || typeof e == "string" || typeof e == "number")
|
|
@@ -192,8 +192,8 @@ export {
|
|
|
192
192
|
br as RoutedWorker,
|
|
193
193
|
He as Search,
|
|
194
194
|
ye as Series,
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
$e as Size,
|
|
196
|
+
ve as TimeRange,
|
|
197
197
|
Ee as TimeSpan,
|
|
198
198
|
Me as TimeStamp,
|
|
199
199
|
hr as TypedWorker,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z as O } from "zod";
|
|
2
|
-
import { c as m } from "./index-
|
|
2
|
+
import { c as m } from "./index-eue4dSQX.js";
|
|
3
3
|
import { e as f, f as x, y as a, g, D as C, C as z, X as L, Y as h, l as S, h as d } from "./base-DnZzEvvz.js";
|
|
4
4
|
const N = f, R = a, I = {
|
|
5
5
|
top: "bottom",
|
|
@@ -13,20 +13,20 @@ const N = f, R = a, I = {
|
|
|
13
13
|
bottom: "right",
|
|
14
14
|
left: "bottom",
|
|
15
15
|
center: "center"
|
|
16
|
-
}, Y = g, c = (t) => t instanceof String
|
|
16
|
+
}, Y = g, c = (t) => t instanceof String || !C.includes(t) ? t : t === "x" ? "left" : "top", A = (t) => I[c(t)], P = (t) => X[c(t)], s = (t) => {
|
|
17
17
|
const o = c(t);
|
|
18
18
|
return o === "top" || o === "bottom" ? "y" : "x";
|
|
19
19
|
}, k = O.object({
|
|
20
20
|
x: f.or(x),
|
|
21
21
|
y: a.or(x)
|
|
22
|
-
}), w = O.object({ x: f, y: a }), T = Object.freeze({ x: "left", y: "top" }),
|
|
22
|
+
}), w = O.object({ x: f, y: a }), T = Object.freeze({ x: "left", y: "top" }), b = Object.freeze({ x: "right", y: "top" }), l = Object.freeze({ x: "left", y: "bottom" }), u = Object.freeze({ x: "right", y: "bottom" }), y = Object.freeze({ x: "center", y: "center" }), p = Object.freeze({ x: "center", y: "top" }), _ = Object.freeze({ x: "center", y: "bottom" }), E = Object.freeze({ x: "right", y: "center" }), j = Object.freeze({ x: "left", y: "center" }), M = Object.freeze([
|
|
23
23
|
j,
|
|
24
24
|
E,
|
|
25
25
|
p,
|
|
26
26
|
_,
|
|
27
27
|
T,
|
|
28
|
-
l,
|
|
29
28
|
b,
|
|
29
|
+
l,
|
|
30
30
|
u,
|
|
31
31
|
y
|
|
32
32
|
]), $ = (t, o) => t.x === o.x && t.y === o.y, B = (t, o) => {
|
|
@@ -46,7 +46,7 @@ const N = f, R = a, I = {
|
|
|
46
46
|
}, J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
47
47
|
__proto__: null,
|
|
48
48
|
BOTTOM_CENTER: _,
|
|
49
|
-
BOTTOM_LEFT:
|
|
49
|
+
BOTTOM_LEFT: l,
|
|
50
50
|
BOTTOM_RIGHT: u,
|
|
51
51
|
CENTER: y,
|
|
52
52
|
CENTER_LOCATIONS: z,
|
|
@@ -54,7 +54,7 @@ const N = f, R = a, I = {
|
|
|
54
54
|
RIGHT_CENTER: E,
|
|
55
55
|
TOP_CENTER: p,
|
|
56
56
|
TOP_LEFT: T,
|
|
57
|
-
TOP_RIGHT:
|
|
57
|
+
TOP_RIGHT: b,
|
|
58
58
|
XY_LOCATIONS: M,
|
|
59
59
|
X_LOCATIONS: L,
|
|
60
60
|
Y_LOCATIONS: h,
|
|
@@ -78,7 +78,7 @@ const N = f, R = a, I = {
|
|
|
78
78
|
y: R
|
|
79
79
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
l as B,
|
|
82
82
|
y as C,
|
|
83
83
|
T,
|
|
84
84
|
M as X,
|
|
@@ -86,7 +86,7 @@ export {
|
|
|
86
86
|
$ as b,
|
|
87
87
|
w as c,
|
|
88
88
|
D as d,
|
|
89
|
-
|
|
89
|
+
b as e,
|
|
90
90
|
u as f,
|
|
91
91
|
J as l,
|
|
92
92
|
A as s,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("zod"),I=require("./index-
|
|
1
|
+
"use strict";const u=require("zod"),I=require("./index-YsO0EMN8.cjs"),c=require("./base-B48bPNx5.cjs"),R=c.xLocation,g=c.yLocation,h={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},d={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},m=c.crudeLocation,s=t=>t instanceof String||!c.DIRECTIONS.includes(t)?t:t==="x"?"left":"top",_=t=>h[s(t)],A=t=>d[s(t)],i=t=>{const o=s(t);return o==="top"||o==="bottom"?"y":"x"},E=u.z.object({x:c.xLocation.or(c.centerLocation),y:c.yLocation.or(c.centerLocation)}),l=u.z.object({x:c.xLocation,y:c.yLocation}),O=Object.freeze({x:"left",y:"top"}),f=Object.freeze({x:"right",y:"top"}),x=Object.freeze({x:"left",y:"bottom"}),a=Object.freeze({x:"right",y:"bottom"}),T=Object.freeze({x:"center",y:"center"}),b=Object.freeze({x:"center",y:"top"}),L=Object.freeze({x:"center",y:"bottom"}),p=Object.freeze({x:"right",y:"center"}),C=Object.freeze({x:"left",y:"center"}),N=Object.freeze([C,p,b,L,O,f,x,a,T]),j=(t,o)=>t.x===o.x&&t.y===o.y,S=(t,o)=>{if(typeof o=="object"){let e=!0;return"x"in o&&(t.x===o.x||(e=!1)),"y"in o&&(t.y===o.y||(e=!1)),e}return t.x===o||t.y===o},z=t=>[t.x,t.y],y=t=>i(s(t))==="x",M=t=>i(s(t))==="y",P=t=>`${t.x}${I.capitalize(t.y)}`,X=(t,o)=>{let e,n;if(typeof t=="object"&&"x"in t?(e=t.x,n=t.y):(e=s(t),n=s(o??t)),i(e)===i(n)&&e!=="center"&&n!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${e.toString()} - ${n.toString()}`);const r={...T};return e==="center"?y(n)?[r.x,r.y]=[n,e]:[r.x,r.y]=[e,n]:n==="center"?y(e)?[r.x,r.y]=[e,n]:[r.x,r.y]=[n,e]:y(e)?[r.x,r.y]=[e,n]:[r.x,r.y]=[n,e],r},Y=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:L,BOTTOM_LEFT:x,BOTTOM_RIGHT:a,CENTER:T,CENTER_LOCATIONS:c.CENTER_LOCATIONS,LEFT_CENTER:C,RIGHT_CENTER:p,TOP_CENTER:b,TOP_LEFT:O,TOP_RIGHT:f,XY_LOCATIONS:N,X_LOCATIONS:c.X_LOCATIONS,Y_LOCATIONS:c.Y_LOCATIONS,construct:s,constructXY:X,corner:l,crude:m,direction:i,isX:y,isY:M,location:c.location,outer:c.outerLocation,rotate90:A,swap:_,x:R,xy:E,xyCouple:z,xyEquals:j,xyMatches:S,xyToString:P,y:g},Symbol.toStringTag,{value:"Module"}));exports.BOTTOM_LEFT=x;exports.BOTTOM_RIGHT=a;exports.CENTER=T;exports.TOP_LEFT=O;exports.TOP_RIGHT=f;exports.XY_LOCATIONS=N;exports.corner=l;exports.location=Y;exports.swap=_;exports.xy=E;exports.xyCouple=z;exports.xyEquals=j;exports.xyMatches=S;
|
package/dist/location.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./location-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./location-DetomF8Z.cjs");exports.location=o.location;
|
package/dist/location.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=(l,n,t=".")=>{const e=l.split(t);return e.map((s,o)=>{const i=n(s,o,e);return i==null?null:typeof i=="string"?i:i.join(t)}).filter(s=>s!=null).join(t)},u=(l,n,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:e,getter:r=(i,a)=>i[a]}=t,s=n.split(t.separator);if(s.length===1&&s[0]==="")return l;let o=l;for(const i of s){const a=r(o,i);if(a==null){if(e)return null;throw new Error(`Path ${n} does not exist. ${i} is null`)}o=a}return o},f=(l,n,t)=>{const e=n.split(".");let r=l;for(let s=0;s<e.length-1;s++){const o=e[s];r[o]??(r[o]={}),r=r[o]}r[e[e.length-1]]=t},h=(l,n)=>{const t=n.split(".");let e=l;for(let r=0;r<t.length-1;r++){const s=t[r];if(e[s]==null)return;e=e[s]}if(Array.isArray(e)){const r=parseInt(t[t.length-1]);if(isNaN(r))return;e.splice(r,1);return}delete e[t[t.length-1]]},p=(l,n)=>{const t=l.split(".");return n<0?t[t.length+n]:t[n]},g=(l,n)=>{try{return u(l,n),!0}catch{return!1}},m=(l,n)=>{if(n.length===0)return!0;const t=l.split("."),e=n.split(".");if(e.length>t.length)return!1;for(let r=0;r<e.length;r++){const s=t[r],o=e[r];if(o!=="*"&&s!==o)return!1}return!0};exports.element=p;exports.get=u;exports.has=g;exports.pathsMatch=m;exports.remove=h;exports.set=f;exports.transformPath=c;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
const c = (l, e, t = ".") => {
|
|
2
|
-
const
|
|
3
|
-
return
|
|
4
|
-
const a = e(s, o,
|
|
2
|
+
const n = l.split(t);
|
|
3
|
+
return n.map((s, o) => {
|
|
4
|
+
const a = e(s, o, n);
|
|
5
5
|
return a == null ? null : typeof a == "string" ? a : a.join(t);
|
|
6
6
|
}).filter((s) => s != null).join(t);
|
|
7
7
|
}, u = (l, e, t = { optional: !1, separator: "." }) => {
|
|
8
8
|
t.separator ?? (t.separator = ".");
|
|
9
|
-
const { optional:
|
|
9
|
+
const { optional: n, getter: r = (a, i) => a[i] } = t, s = e.split(t.separator);
|
|
10
10
|
if (s.length === 1 && s[0] === "") return l;
|
|
11
11
|
let o = l;
|
|
12
12
|
for (const a of s) {
|
|
13
|
-
const i =
|
|
13
|
+
const i = r(o, a);
|
|
14
14
|
if (i == null) {
|
|
15
|
-
if (
|
|
15
|
+
if (n) return null;
|
|
16
16
|
throw new Error(`Path ${e} does not exist. ${a} is null`);
|
|
17
17
|
}
|
|
18
18
|
o = i;
|
|
19
19
|
}
|
|
20
20
|
return o;
|
|
21
21
|
}, f = (l, e, t) => {
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
for (let s = 0; s <
|
|
25
|
-
const o =
|
|
26
|
-
|
|
22
|
+
const n = e.split(".");
|
|
23
|
+
let r = l;
|
|
24
|
+
for (let s = 0; s < n.length - 1; s++) {
|
|
25
|
+
const o = n[s];
|
|
26
|
+
r[o] ?? (r[o] = {}), r = r[o];
|
|
27
27
|
}
|
|
28
|
-
n[
|
|
28
|
+
r[n[n.length - 1]] = t;
|
|
29
29
|
}, p = (l, e) => {
|
|
30
30
|
const t = e.split(".");
|
|
31
|
-
let
|
|
32
|
-
for (let
|
|
33
|
-
const s = t[
|
|
34
|
-
if (
|
|
35
|
-
|
|
31
|
+
let n = l;
|
|
32
|
+
for (let r = 0; r < t.length - 1; r++) {
|
|
33
|
+
const s = t[r];
|
|
34
|
+
if (n[s] == null) return;
|
|
35
|
+
n = n[s];
|
|
36
36
|
}
|
|
37
|
-
if (Array.isArray(
|
|
38
|
-
const
|
|
39
|
-
if (isNaN(
|
|
40
|
-
|
|
37
|
+
if (Array.isArray(n)) {
|
|
38
|
+
const r = parseInt(t[t.length - 1]);
|
|
39
|
+
if (isNaN(r)) return;
|
|
40
|
+
n.splice(r, 1);
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
delete
|
|
43
|
+
delete n[t[t.length - 1]];
|
|
44
44
|
}, h = (l, e) => {
|
|
45
45
|
const t = l.split(".");
|
|
46
46
|
return e < 0 ? t[t.length + e] : t[e];
|
|
@@ -52,10 +52,10 @@ const c = (l, e, t = ".") => {
|
|
|
52
52
|
}
|
|
53
53
|
}, m = (l, e) => {
|
|
54
54
|
if (e.length === 0) return !0;
|
|
55
|
-
const t = l.split("."),
|
|
56
|
-
if (
|
|
57
|
-
for (let
|
|
58
|
-
const s = t[
|
|
55
|
+
const t = l.split("."), n = e.split(".");
|
|
56
|
+
if (n.length > t.length) return !1;
|
|
57
|
+
for (let r = 0; r < n.length; r++) {
|
|
58
|
+
const s = t[r], o = n[r];
|
|
59
59
|
if (o !== "*" && s !== o)
|
|
60
60
|
return !1;
|
|
61
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as g, x as v, a as I, h as M, w as N, d as X, i as j } from "./box-
|
|
1
|
+
import { c as g, x as v, a as I, h as M, w as N, d as X, i as j } from "./box-DVCNGsJG.js";
|
|
2
2
|
import { c as w } from "./direction-CScbfCdT.js";
|
|
3
|
-
import { x as B, a as h, b as C, C as O, T as R, s as m, X as S } from "./location-
|
|
3
|
+
import { x as B, a as h, b as C, C as O, T as R, s as m, X as S } from "./location-CI9x53qR.js";
|
|
4
4
|
import { l as Y } from "./base-DnZzEvvz.js";
|
|
5
5
|
const P = (t) => {
|
|
6
6
|
if (t == null) return { x: void 0, y: void 0 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("./box-
|
|
1
|
+
"use strict";const n=require("./box-Mf8E1Ypp.cjs"),T=require("./direction-D7qoo_GJ.cjs"),r=require("./location-DetomF8Z.cjs"),b=require("./base-B48bPNx5.cjs"),P=t=>{if(t==null)return{x:void 0,y:void 0};const s=r.xy.safeParse(t);if(s.success)return s.data;const e=b.location.safeParse(t);return e.success?T.construct(e.data)==="x"?{x:e.data,y:void 0}:{x:void 0,y:e.data}:t},N=({container:t,target:s,dialog:e,initial:u,prefer:a,alignments:l=["start"],disable:f=[]})=>{const i=P(u);let x=r.XY_LOCATIONS;if(a!=null){const o=a.map(c=>P(c));x=x.slice().sort((c,p)=>{const d=o.findIndex(g=>r.xyMatches(c,g)),h=o.findIndex(g=>r.xyMatches(p,g));return d>-1&&h>-1?d-h:d>-1?-1:h>-1?1:0})}const O=x.filter(o=>!r.xyEquals(o,r.CENTER)&&(i.x==null||o.x===i.x)&&(i.y==null||o.y===i.y)&&!f.some(c=>r.xyMatches(o,c))).map(o=>l==null?void 0:l.map(c=>[o,c])).flat(),A=n.construct(t),M=n.construct(s),_=n.construct(e);let E=-1/0;const y={location:r.CENTER,adjustedDialog:_};return O.forEach(([o,c])=>{const[p,d]=v({option:o,alignment:c,container:A,target:M,dialog:_});d>E&&(E=d,y.location=o,y.adjustedDialog=p)}),y},v=({option:t,alignment:s,container:e,target:u,dialog:a})=>{const l=L(t,s),f=n.xyLoc(u,t),i=n.constructWithAlternateRoot(f.x,f.y,n.width(a),n.height(a),l,r.TOP_LEFT),x=n.area(n.intersection(i,e));return[i,x]},I={start:"left",center:"center",end:"right"},j={start:"bottom",center:"center",end:"top"},L=(t,s)=>{const e={x:"center",y:"center"};if(t.y!=="center"){e.y=r.swap(t.y);const u=t.x==="left"?r.swap:a=>a;e.x=u(I[s])}else e.x=r.swap(t.x),e.y=j[s];return e},q=Object.freeze(Object.defineProperty({__proto__:null,dialog:N,getRoot:L,parseLocationOptions:P},Symbol.toStringTag,{value:"Module"}));exports.position=q;
|
package/dist/position.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./position-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./position-DKhPhvPh.cjs");exports.position=o.position;
|
package/dist/position.js
CHANGED
package/dist/runtime.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-B3XSLDq5.cjs");exports.runtime=e.external;
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var g=(n,t,e)=>t in n?v(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var i=(n,t,e)=>g(n,typeof t!="symbol"?t+"":t,e);const R=require("zod"),x=require("./bounds-
|
|
1
|
+
"use strict";var v=Object.defineProperty;var g=(n,t,e)=>t in n?v(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var i=(n,t,e)=>g(n,typeof t!="symbol"?t+"":t,e);const R=require("zod"),x=require("./bounds-DzCDHgdE.cjs"),u=require("./box-Mf8E1Ypp.cjs"),T=require("./location-DetomF8Z.cjs"),h=require("./xy-cP-FXJtR.cjs"),m=(n,t,e)=>t!==void 0&&n<t?t:e!==void 0&&n>e?e:n,q=R.z.object({offset:h.crudeZ,scale:h.crudeZ}),E=n=>(t,e,s,r)=>e==="dimension"?[t,s]:[t,r?s-n:s+n],I=n=>(t,e,s,r)=>[t,r?s/n:s*n],Y=n=>(t,e,s)=>{if(t===null)return[n,s];const{lower:r,upper:o}=t,{lower:p,upper:l}=n,f=o-r,w=l-p;if(e==="dimension")return[n,s*(w/f)];const B=(s-r)*(w/f)+p;return[n,B]},j=n=>(t,e,s)=>[n,s],z=()=>(n,t,e)=>{if(n===null)throw new Error("cannot invert without bounds");if(t==="dimension")return[n,e];const{lower:s,upper:r}=n;return[n,r-(e-s)]},D=n=>(t,e,s)=>{const{lower:r,upper:o}=n;return s=m(s,r,o),[t,s]},a=class a{constructor(){i(this,"ops",[]);i(this,"currBounds",null);i(this,"currType",null);i(this,"reversed",!1);this.ops=[]}static translate(t){return new a().translate(t)}static magnify(t){return new a().magnify(t)}static scale(t,e){return new a().scale(t,e)}translate(t){const e=this.new(),s=E(t);return s.type="translate",e.ops.push(s),e}magnify(t){const e=this.new(),s=I(t);return s.type="magnify",e.ops.push(s),e}scale(t,e){const s=x.construct(t,e),r=this.new(),o=Y(s);return o.type="scale",r.ops.push(o),r}clamp(t,e){const s=x.construct(t,e),r=this.new(),o=D(s);return o.type="clamp",r.ops.push(o),r}reBound(t,e){const s=x.construct(t,e),r=this.new(),o=j(s);return o.type="re-bound",r.ops.push(o),r}invert(){const t=z();t.type="invert";const e=this.new();return e.ops.push(t),e}pos(t){return this.exec("position",t)}dim(t){return this.exec("dimension",t)}new(){const t=new a;return t.ops=this.ops.slice(),t.reversed=this.reversed,t}exec(t,e){return this.currBounds=null,this.ops.reduce(([s,r],o)=>o(s,t,r,this.reversed),[null,e])[1]}reverse(){const t=this.new();t.ops.reverse();const e=[];return t.ops.forEach((s,r)=>{if(s.type==="scale"||e.some(([p,l])=>r>=p&&r<=l))return;const o=t.ops.findIndex((p,l)=>p.type==="scale"&&l>r);o!==-1&&e.push([r,o])}),e.forEach(([s,r])=>{const o=t.ops.slice(s,r);o.unshift(t.ops[r]),t.ops.splice(s,r-s+1,...o)}),t.reversed=!t.reversed,t}};i(a,"IDENTITY",new a);let y=a;const L=n=>({scale:{x:n.x.dim(1),y:n.y.dim(1)},offset:{x:n.x.pos(0),y:n.y.pos(0)}}),c=class c{constructor(t=new y,e=new y,s=null){i(this,"x");i(this,"y");i(this,"currRoot");this.x=t,this.y=e,this.currRoot=s}static translate(t,e){return new c().translate(t,e)}static translateX(t){return new c().translateX(t)}static translateY(t){return new c().translateY(t)}static clamp(t){return new c().clamp(t)}static magnify(t){return new c().magnify(t)}static scale(t){return new c().scale(t)}static reBound(t){return new c().reBound(t)}translate(t,e){const s=h.construct(t,e),r=this.copy();return r.x=this.x.translate(s.x),r.y=this.y.translate(s.y),r}translateX(t){const e=this.copy();return e.x=this.x.translate(t),e}translateY(t){const e=this.copy();return e.y=this.y.translate(t),e}magnify(t){const e=this.copy();return e.x=this.x.magnify(t.x),e.y=this.y.magnify(t.y),e}scale(t){const e=this.copy();if(u.isBox(t)){const s=this.currRoot;return e.currRoot=t.root,s!=null&&!T.xyEquals(s,t.root)&&(s.x!==t.root.x&&(e.x=e.x.invert()),s.y!==t.root.y&&(e.y=e.y.invert())),e.x=e.x.scale(u.xBounds(t)),e.y=e.y.scale(u.yBounds(t)),e}return e.x=e.x.scale(t.width),e.y=e.y.scale(t.height),e}reBound(t){const e=this.copy();return e.x=this.x.reBound(u.xBounds(t)),e.y=this.y.reBound(u.yBounds(t)),e}clamp(t){const e=this.copy();return e.x=this.x.clamp(u.xBounds(t)),e.y=this.y.clamp(u.yBounds(t)),e}copy(){const t=new c;return t.currRoot=this.currRoot,t.x=this.x,t.y=this.y,t}reverse(){const t=this.copy();return t.x=this.x.reverse(),t.y=this.y.reverse(),t}pos(t){return{x:this.x.pos(t.x),y:this.y.pos(t.y)}}box(t){return u.construct(this.pos(t.one),this.pos(t.two),0,0,this.currRoot??t.root)}};i(c,"IDENTITY",new c);let d=c;const M=Object.freeze(Object.defineProperty({__proto__:null,Scale:y,XY:d,crudeXYTransform:q,xyScaleToTransform:L},Symbol.toStringTag,{value:"Module"}));exports.clamp=m;exports.scale=M;
|
|
@@ -2,9 +2,9 @@ var g = Object.defineProperty;
|
|
|
2
2
|
var B = (r, t, e) => t in r ? g(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
3
|
var i = (r, t, e) => B(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { z as R } from "zod";
|
|
5
|
-
import { c as l } from "./bounds-
|
|
6
|
-
import { e as T, f as x, y as h, c as E } from "./box-
|
|
7
|
-
import { b as I } from "./location-
|
|
5
|
+
import { c as l } from "./bounds-CFI9wDXn.js";
|
|
6
|
+
import { e as T, f as x, y as h, c as E } from "./box-DVCNGsJG.js";
|
|
7
|
+
import { b as I } from "./location-CI9x53qR.js";
|
|
8
8
|
import { b as w, c as Y } from "./xy-CrgPnICw.js";
|
|
9
9
|
const j = (r, t, e) => t !== void 0 && r < t ? t : e !== void 0 && r > e ? e : r, z = R.object({ offset: w, scale: w }), D = (r) => (t, e, s, n) => e === "dimension" ? [t, s] : [
|
|
10
10
|
t,
|
|
@@ -34,19 +34,41 @@ const j = (r, t, e) => t !== void 0 && r < t ? t : e !== void 0 && r > e ? e : r
|
|
|
34
34
|
i(this, "reversed", !1);
|
|
35
35
|
this.ops = [];
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* @returns a new scale with a translation as its first operation. Any number provided
|
|
39
|
+
* to the {@link pos} operation on the scale will be translated by the specified value.
|
|
40
|
+
* @param value - The amount to translate by.
|
|
41
|
+
*/
|
|
37
42
|
static translate(t) {
|
|
38
43
|
return new u().translate(t);
|
|
39
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @returns a new scale with a magnification as its first operation. Any number provided
|
|
47
|
+
* to the {@link pos} or {@link dim} operation will be multiplied by the specified value.
|
|
48
|
+
* @param value - The amount to translate by.
|
|
49
|
+
*/
|
|
40
50
|
static magnify(t) {
|
|
41
51
|
return new u().magnify(t);
|
|
42
52
|
}
|
|
43
53
|
static scale(t, e) {
|
|
44
54
|
return new u().scale(t, e);
|
|
45
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* @returns a copy of the scale with a translation as its next operation. Any
|
|
58
|
+
* number provided to the {@link pos} method on the scale will be translated by the
|
|
59
|
+
* specified value.
|
|
60
|
+
* @param value - The amount to translate by.
|
|
61
|
+
*/
|
|
46
62
|
translate(t) {
|
|
47
63
|
const e = this.new(), s = D(t);
|
|
48
64
|
return s.type = "translate", e.ops.push(s), e;
|
|
49
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* @returns a copy of the scale with a translation as its next operation. Any number
|
|
68
|
+
* provided to the {@link pos} or {@link dim} method on the scale will be multiplied
|
|
69
|
+
* by the specified value.
|
|
70
|
+
* @param value - The amount to magnify by.
|
|
71
|
+
*/
|
|
50
72
|
magnify(t) {
|
|
51
73
|
const e = this.new(), s = L(t);
|
|
52
74
|
return s.type = "magnify", e.ops.push(s), e;
|
package/dist/scale.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./scale-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./scale-CT61XD_X.cjs");exports.scale=e.scale;
|
package/dist/scale.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";var _=Object.defineProperty;var tt=(l,t,e)=>t in l?_(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var i=(l,t,e)=>tt(l,typeof t!="symbol"?t+"":t,e);const o=require("zod"),D=require("./index-CYxQwEdX.cjs"),et=require("./index-YsO0EMN8.cjs"),nt=require("./index-h-QAL9T1.cjs"),w=require("./bounds-DzCDHgdE.cjs");require("./box-Mf8E1Ypp.cjs");require("./dimensions-zMcb9pMk.cjs");require("./base-B48bPNx5.cjs");require("./location-DetomF8Z.cjs");require("./scale-CT61XD_X.cjs");require("./xy-cP-FXJtR.cjs");const rt=require("./zodutil-C6RYzvXd.cjs");let it=(l,t=21)=>(e=t)=>{let n="",s=e;for(;s--;)n+=l[Math.random()*l.length|0];return n};const st="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",K=it(st,11),at=Object.freeze(Object.defineProperty({__proto__:null,id:K},Symbol.toStringTag,{value:"Module"})),ut=o.z.enum(["static","dynamic"]),H=(l,t)=>{const e=new m(t);if(![y.DAY,y.HOUR,y.MINUTE,y.SECOND,y.MILLISECOND,y.MICROSECOND,y.NANOSECOND].some(s=>s.equals(e)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=l.valueOf()%e.valueOf();return l instanceof m?new m(n):new y(n)},a=class a{constructor(t,e="UTC"){i(this,"value");i(this,"encodeValue",!0);if(t==null)this.value=a.now().valueOf();else if(t instanceof Date)this.value=BigInt(t.getTime())*a.MILLISECOND.valueOf();else if(typeof t=="string")this.value=a.parseDateTimeString(t,e).valueOf();else if(Array.isArray(t))this.value=a.parseDate(t);else{let n=BigInt(0);t instanceof Number&&(t=t.valueOf()),e==="local"&&(n=a.utcOffset.valueOf()),typeof t=="number"&&(isFinite(t)?t=Math.trunc(t):(isNaN(t)&&(t=0),t===1/0?t=a.MAX:t=a.MIN)),this.value=BigInt(t.valueOf())+n}}static parseDate([t=1970,e=1,n=1]){const s=new Date(t,e-1,n,0,0,0,0);return new a(BigInt(s.getTime())*a.MILLISECOND.valueOf()).truncate(a.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(t,e="UTC"){const[n,s,c]=t.split(":");let f="00",v="00";c!=null&&([f,v]=c.split("."));let O=a.hours(parseInt(n??"00")).add(a.minutes(parseInt(s??"00"))).add(a.seconds(parseInt(f??"00"))).add(a.milliseconds(parseInt(v??"00")));return e==="local"&&(O=O.add(a.utcOffset)),O.valueOf()}static parseDateTimeString(t,e="UTC"){if(!t.includes("/")&&!t.includes("-"))return a.parseTimeString(t,e);const n=new Date(t);return t.includes(":")||n.setUTCHours(0,0,0,0),new a(BigInt(n.getTime())*a.MILLISECOND.valueOf(),e).valueOf()}fString(t="ISO",e="UTC"){switch(t){case"ISODate":return this.toISOString(e).slice(0,10);case"ISOTime":return this.toISOString(e).slice(11,23);case"time":return this.timeString(!1,e);case"preciseTime":return this.timeString(!0,e);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,e)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,e)}`;default:return this.toISOString(e)}}toISOString(t="UTC"){return t==="UTC"?this.date().toISOString():this.sub(a.utcOffset).date().toISOString()}timeString(t=!1,e="UTC"){const n=this.toISOString(e);return t?n.slice(11,23):n.slice(11,19)}dateString(){const t=this.date(),e=t.toLocaleString("default",{month:"short"}),n=t.toLocaleString("default",{day:"numeric"});return`${e} ${n}`}static get utcOffset(){return new y(BigInt(new Date().getTimezoneOffset())*a.MINUTE.valueOf())}static since(t){return new a().span(t)}date(){return new Date(this.milliseconds())}equals(t){return this.valueOf()===new a(t).valueOf()}span(t){return this.range(t).span}range(t){return new M(this,t).makeValid()}spanRange(t){return this.range(this.add(t)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(t){return this.valueOf()>new a(t).valueOf()}afterEq(t){return this.valueOf()>=new a(t).valueOf()}before(t){return this.valueOf()<new a(t).valueOf()}beforeEq(t){return this.valueOf()<=new a(t).valueOf()}add(t){return new a(this.valueOf()+BigInt(t.valueOf()))}sub(t){return new a(this.valueOf()-BigInt(t.valueOf()))}milliseconds(){return Number(this.valueOf())/Number(a.MILLISECOND.valueOf())}toString(){return this.date().toISOString()}remainder(t){return H(this,t)}get isToday(){return this.truncate(y.DAY).equals(a.now().truncate(y.DAY))}truncate(t){return this.sub(this.remainder(t))}static now(){return new a(new Date)}static max(...t){let e=a.MIN;for(const n of t){const s=new a(n);s.after(e)&&(e=s)}return e}static min(...t){let e=a.MAX;for(const n of t){const s=new a(n);s.before(e)&&(e=s)}return e}static nanoseconds(t){return new a(t)}static microseconds(t){return a.nanoseconds(t*1e3)}static milliseconds(t){return a.microseconds(t*1e3)}static seconds(t){return a.milliseconds(t*1e3)}static minutes(t){return a.seconds(t*60)}static hours(t){return a.minutes(t*60)}static days(t){return a.hours(t*24)}};i(a,"NANOSECOND",a.nanoseconds(1)),i(a,"MICROSECOND",a.microseconds(1)),i(a,"MILLISECOND",a.milliseconds(1)),i(a,"SECOND",a.seconds(1)),i(a,"MINUTE",a.minutes(1)),i(a,"HOUR",a.hours(1)),i(a,"DAY",a.days(1)),i(a,"MAX",new a((1n<<63n)-1n)),i(a,"MIN",new a(0)),i(a,"ZERO",new a(0)),i(a,"z",o.z.union([o.z.object({value:o.z.bigint()}).transform(t=>new a(t.value)),o.z.string().transform(t=>new a(BigInt(t))),o.z.instanceof(Number).transform(t=>new a(t)),o.z.number().transform(t=>new a(t)),o.z.instanceof(a)]));let m=a;const u=class u{constructor(t){i(this,"value");i(this,"encodeValue",!0);typeof t=="number"&&(t=Math.trunc(t.valueOf())),this.value=BigInt(t.valueOf())}static fromSeconds(t){return t instanceof u?t:t instanceof L?t.period:t instanceof m?new u(t):["number","bigint"].includes(typeof t)?u.seconds(t):new u(t)}static fromMilliseconds(t){return t instanceof u?t:t instanceof L?t.period:t instanceof m?new u(t):["number","bigint"].includes(typeof t)?u.milliseconds(t):new u(t)}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(t){return this.valueOf()<new u(t).valueOf()}greaterThan(t){return this.valueOf()>new u(t).valueOf()}lessThanOrEqual(t){return this.valueOf()<=new u(t).valueOf()}greaterThanOrEqual(t){return this.valueOf()>=new u(t).valueOf()}remainder(t){return H(this,t)}truncate(t){return new u(BigInt(Math.trunc(Number(this.valueOf()/t.valueOf())))*t.valueOf())}toString(){const t=this.truncate(u.DAY),e=this.truncate(u.HOUR),n=this.truncate(u.MINUTE),s=this.truncate(u.SECOND),c=this.truncate(u.MILLISECOND),f=this.truncate(u.MICROSECOND),v=this.truncate(u.NANOSECOND),O=t,N=e.sub(t),A=n.sub(e),h=s.sub(n),R=c.sub(s),C=f.sub(c),Y=v.sub(f);let B="";return O.isZero||(B+=`${O.days}d `),N.isZero||(B+=`${N.hours}h `),A.isZero||(B+=`${A.minutes}m `),h.isZero||(B+=`${h.seconds}s `),R.isZero||(B+=`${R.milliseconds}ms `),C.isZero||(B+=`${C.microseconds}µs `),Y.isZero||(B+=`${Y.nanoseconds}ns`),B.trim()}get days(){return Number(this.valueOf())/Number(u.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(u.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(u.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(u.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(u.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(u.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(t){return this.valueOf()===new u(t).valueOf()}add(t){return new u(this.valueOf()+new u(t).valueOf())}sub(t){return new u(this.valueOf()-new u(t).valueOf())}static nanoseconds(t=1){return new u(t)}static microseconds(t=1){return u.nanoseconds(w.mult(t,1e3))}static milliseconds(t=1){return u.microseconds(w.mult(t,1e3))}static seconds(t=1){return u.milliseconds(w.mult(t,1e3))}static minutes(t=1){return u.seconds(w.mult(t,60))}static hours(t){return u.minutes(w.mult(t,60))}static days(t){return u.hours(w.mult(t,24))}};i(u,"NANOSECOND",u.nanoseconds(1)),i(u,"MICROSECOND",u.microseconds(1)),i(u,"MILLISECOND",u.milliseconds(1)),i(u,"SECOND",u.seconds(1)),i(u,"MINUTE",u.minutes(1)),i(u,"HOUR",u.hours(1)),i(u,"DAY",u.days(1)),i(u,"MAX",new u((1n<<63n)-1n)),i(u,"MIN",new u(0)),i(u,"ZERO",new u(0)),i(u,"z",o.z.union([o.z.object({value:o.z.bigint()}).transform(t=>new u(t.value)),o.z.string().transform(t=>new u(BigInt(t))),o.z.instanceof(Number).transform(t=>new u(t)),o.z.number().transform(t=>new u(t)),o.z.instanceof(u)]));let y=u;const p=class p extends Number{constructor(t){t instanceof Number?super(t.valueOf()):super(t)}toString(){return`${this.valueOf()} Hz`}equals(t){return this.valueOf()===new p(t).valueOf()}get period(){return y.seconds(1/this.valueOf())}sampleCount(t){return new y(t).seconds*this.valueOf()}byteCount(t,e){return this.sampleCount(t)*new I(e).valueOf()}span(t){return y.seconds(t/this.valueOf())}byteSpan(t,e){return this.span(t.valueOf()/e.valueOf())}static hz(t){return new p(t)}static khz(t){return p.hz(t*1e3)}};i(p,"z",o.z.union([o.z.number().transform(t=>new p(t)),o.z.instanceof(Number).transform(t=>new p(t)),o.z.instanceof(p)]));let L=p;const b=class b extends Number{constructor(t){t instanceof Number?super(t.valueOf()):super(t)}length(t){return t.valueOf()/this.valueOf()}size(t){return new U(t*this.valueOf())}};i(b,"UNKNOWN",new b(0)),i(b,"BIT128",new b(16)),i(b,"BIT64",new b(8)),i(b,"BIT32",new b(4)),i(b,"BIT16",new b(2)),i(b,"BIT8",new b(1)),i(b,"z",o.z.union([o.z.number().transform(t=>new b(t)),o.z.instanceof(Number).transform(t=>new b(t)),o.z.instanceof(b)]));let I=b;const S=class S{constructor(t,e){i(this,"start");i(this,"end");typeof t=="object"&&"start"in t?(this.start=new m(t.start),this.end=new m(t.end)):(this.start=new m(t),this.end=new m(e))}get span(){return new y(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new S(this.end,this.start)}equals(t){return this.start.equals(t.start)&&this.end.equals(t.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(t,e=y.ZERO){t=t.makeValid();const n=this.makeValid();if(this.equals(t))return!0;if(t.end.equals(n.start)||n.end.equals(t.start))return!1;const s=m.max(n.start,t.start),c=m.min(n.end,t.end);return c.before(s)?!1:new y(c.sub(s)).greaterThanOrEqual(e)}roughlyEquals(t,e){let n=this.start.sub(t.start).valueOf(),s=this.end.sub(t.end).valueOf();return n<0&&(n=-n),s<0&&(s=-s),n<=e.valueOf()&&s<=e.valueOf()}contains(t){return t instanceof S?this.contains(t.start)&&this.contains(t.end):this.start.beforeEq(t)&&this.end.after(t)}boundBy(t){const e=new S(this.start,this.end);return t.start.after(this.start)&&(e.start=t.start),t.start.after(this.end)&&(e.end=t.start),t.end.before(this.end)&&(e.end=t.end),t.end.before(this.start)&&(e.start=t.end),e}};i(S,"MAX",new S(m.MIN,m.MAX)),i(S,"MIN",new S(m.MAX,m.MIN)),i(S,"ZERO",new S(m.ZERO,m.ZERO)),i(S,"z",o.z.union([o.z.object({start:m.z,end:m.z}).transform(t=>new S(t.start,t.end)),o.z.instanceof(S)]));let M=S;const r=class r extends String{constructor(t){if(t instanceof r||typeof t=="string"||typeof t.valueOf()=="string"){super(t.valueOf());return}const e=r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);if(e!=null){super(e.valueOf());return}throw super(r.UNKNOWN.valueOf()),new Error(`unable to find data type for ${t.toString()}`)}get Array(){const t=r.ARRAY_CONSTRUCTORS.get(this.toString());if(t==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return t}equals(t){return this.valueOf()===t.valueOf()}matches(...t){return t.some(e=>this.equals(e))}toString(){return this.valueOf()}get isVariable(){return this.equals(r.JSON)||this.equals(r.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(r.UUID)}get isInteger(){return this.toString().startsWith("int")}get isFloat(){return this.toString().startsWith("float")}get density(){const t=r.DENSITIES.get(this.toString());if(t==null)throw new Error(`unable to find density for ${this.valueOf()}`);return t}canSafelyCastTo(t){return this.equals(t)?!0:this.isVariable&&!t.isVariable||!this.isVariable&&t.isVariable?!1:this.isFloat&&t.isInteger||this.isInteger&&t.isFloat?this.density.valueOf()<t.density.valueOf():this.isFloat&&t.isFloat||this.isInteger&&t.isInteger?this.density.valueOf()<=t.density.valueOf():!1}canCastTo(t){return this.isNumeric&&t.isNumeric?!0:this.equals(t)}checkArray(t){return t.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return r.BIG_INT_TYPES.some(t=>t.equals(this))}};i(r,"UNKNOWN",new r("unknown")),i(r,"FLOAT64",new r("float64")),i(r,"FLOAT32",new r("float32")),i(r,"INT64",new r("int64")),i(r,"INT32",new r("int32")),i(r,"INT16",new r("int16")),i(r,"INT8",new r("int8")),i(r,"UINT64",new r("uint64")),i(r,"UINT32",new r("uint32")),i(r,"UINT16",new r("uint16")),i(r,"UINT8",new r("uint8")),i(r,"BOOLEAN",r.UINT8),i(r,"TIMESTAMP",new r("timestamp")),i(r,"UUID",new r("uuid")),i(r,"STRING",new r("string")),i(r,"JSON",new r("json")),i(r,"ARRAY_CONSTRUCTORS",new Map([[r.UINT8.toString(),Uint8Array],[r.UINT16.toString(),Uint16Array],[r.UINT32.toString(),Uint32Array],[r.UINT64.toString(),BigUint64Array],[r.FLOAT32.toString(),Float32Array],[r.FLOAT64.toString(),Float64Array],[r.INT8.toString(),Int8Array],[r.INT16.toString(),Int16Array],[r.INT32.toString(),Int32Array],[r.INT64.toString(),BigInt64Array],[r.TIMESTAMP.toString(),BigInt64Array],[r.STRING.toString(),Uint8Array],[r.JSON.toString(),Uint8Array],[r.UUID.toString(),Uint8Array]])),i(r,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,r.UINT8],[Uint16Array.name,r.UINT16],[Uint32Array.name,r.UINT32],[BigUint64Array.name,r.UINT64],[Float32Array.name,r.FLOAT32],[Float64Array.name,r.FLOAT64],[Int8Array.name,r.INT8],[Int16Array.name,r.INT16],[Int32Array.name,r.INT32],[BigInt64Array.name,r.INT64]])),i(r,"DENSITIES",new Map([[r.UINT8.toString(),I.BIT8],[r.UINT16.toString(),I.BIT16],[r.UINT32.toString(),I.BIT32],[r.UINT64.toString(),I.BIT64],[r.FLOAT32.toString(),I.BIT32],[r.FLOAT64.toString(),I.BIT64],[r.INT8.toString(),I.BIT8],[r.INT16.toString(),I.BIT16],[r.INT32.toString(),I.BIT32],[r.INT64.toString(),I.BIT64],[r.TIMESTAMP.toString(),I.BIT64],[r.STRING.toString(),I.UNKNOWN],[r.JSON.toString(),I.UNKNOWN],[r.UUID.toString(),I.BIT128]])),i(r,"ALL",[r.UNKNOWN,r.FLOAT64,r.FLOAT32,r.INT64,r.INT32,r.INT16,r.INT8,r.UINT64,r.UINT32,r.UINT16,r.UINT8,r.TIMESTAMP,r.UUID,r.STRING,r.JSON]),i(r,"BIG_INT_TYPES",[r.INT64,r.UINT64,r.TIMESTAMP]),i(r,"z",o.z.union([o.z.string().transform(t=>new r(t)),o.z.instanceof(r)]));let g=r;const d=class d extends Number{constructor(t){super(t.valueOf())}largerThan(t){return this.valueOf()>t.valueOf()}smallerThan(t){return this.valueOf()<t.valueOf()}add(t){return d.bytes(this.valueOf()+t.valueOf())}sub(t){return d.bytes(this.valueOf()-t.valueOf())}truncate(t){return new d(Math.trunc(this.valueOf()/t.valueOf())*t.valueOf())}remainder(t){return d.bytes(this.valueOf()%t.valueOf())}get gigabytes(){return this.valueOf()/d.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/d.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/d.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/d.TERABYTE.valueOf()}toString(){const t=this.truncate(d.TERABYTE),e=this.truncate(d.GIGABYTE),n=this.truncate(d.MEGABYTE),s=this.truncate(d.KILOBYTE),c=this.truncate(d.BYTE),f=t,v=e.sub(t),O=n.sub(e),N=s.sub(n),A=c.sub(s);let h="";return f.isZero||(h+=`${f.terabytes}TB `),v.isZero||(h+=`${v.gigabytes}GB `),O.isZero||(h+=`${O.megabytes}MB `),N.isZero||(h+=`${N.kilobytes}KB `),(!A.isZero||h==="")&&(h+=`${A.valueOf()}B`),h.trim()}static bytes(t=1){return new d(t)}static kilobytes(t=1){return d.bytes(t.valueOf()*1e3)}static megabytes(t=1){return d.kilobytes(t.valueOf()*1e3)}static gigabytes(t=1){return d.megabytes(t.valueOf()*1e3)}static terabytes(t){return d.gigabytes(t.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};i(d,"BYTE",new d(1)),i(d,"KILOBYTE",d.kilobytes(1)),i(d,"MEGABYTE",d.megabytes(1)),i(d,"GIGABYTE",d.gigabytes(1)),i(d,"TERABYTE",d.terabytes(1)),i(d,"ZERO",new d(0)),i(d,"z",o.z.union([o.z.number().transform(t=>new d(t)),o.z.instanceof(d)]));let U=d;const ot=o.z.union([o.z.instanceof(Uint8Array),o.z.instanceof(Uint16Array),o.z.instanceof(Uint32Array),o.z.instanceof(BigUint64Array),o.z.instanceof(Float32Array),o.z.instanceof(Float64Array),o.z.instanceof(Int8Array),o.z.instanceof(Int16Array),o.z.instanceof(Int32Array),o.z.instanceof(BigInt64Array)]),F=l=>{const t=typeof l;return t==="string"||t==="number"||t==="boolean"||t==="bigint"||l instanceof m||l instanceof y||l instanceof Date},X=(l,t,e,n=0)=>l.usesBigInt&&!t.usesBigInt?Number(e)-Number(n):!l.usesBigInt&&t.usesBigInt?BigInt(e.valueOf())-BigInt(n.valueOf()):x(e,-n).valueOf(),Q=l=>l==null?!1:Array.isArray(l)||l instanceof ArrayBuffer||ArrayBuffer.isView(l)&&!(l instanceof DataView)||l instanceof z?!0:F(l),E=-1,$={[Symbol.iterator]:()=>$,next:()=>({done:!0,value:void 0})},lt=o.z.string().transform(l=>new Uint8Array(atob(l).split("").map(t=>t.charCodeAt(0))).buffer),ct=o.z.union([o.z.null(),o.z.undefined()]).transform(()=>new Uint8Array().buffer),P=10,T=class T{constructor(t){i(this,"key","");i(this,"isSynnaxSeries",!0);i(this,"dataType");i(this,"sampleOffset");i(this,"gl");i(this,"_data");i(this,"_timeRange");i(this,"alignment",0n);i(this,"_cachedMin");i(this,"_cachedMax");i(this,"writePos",E);i(this,"_refCount",0);i(this,"_cachedLength");i(this,"_cachedIndexes");Q(t)&&(t={data:t});const{dataType:e,timeRange:n,sampleOffset:s=0,glBufferUsage:c="static",alignment:f=0n,key:v=K()}=t,O=t.data??[];if(O instanceof T||typeof O=="object"&&"isSynnaxSeries"in O&&O.isSynnaxSeries===!0){const h=O;this.key=h.key,this.dataType=h.dataType,this.sampleOffset=h.sampleOffset,this.gl=h.gl,this._data=h._data,this._timeRange=h._timeRange,this.alignment=h.alignment,this._cachedMin=h._cachedMin,this._cachedMax=h._cachedMax,this.writePos=h.writePos,this._refCount=h._refCount,this._cachedLength=h._cachedLength;return}const N=F(O),A=Array.isArray(O);if(e!=null)this.dataType=new g(e);else{if(O instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(A||N){let h=O;if(!N){if(O.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");h=O[0]}if(typeof h=="string")this.dataType=g.STRING;else if(typeof h=="number")this.dataType=g.FLOAT64;else if(typeof h=="bigint")this.dataType=g.INT64;else if(typeof h=="boolean")this.dataType=g.BOOLEAN;else if(h instanceof m||h instanceof Date||h instanceof m)this.dataType=g.TIMESTAMP;else if(typeof h=="object")this.dataType=g.JSON;else throw new Error(`cannot infer data type of ${typeof h} when constructing a Series from a JS array`)}else this.dataType=new g(O)}if(!A&&!N)this._data=O;else{let h=N?[O]:O;const R=h[0];(R instanceof m||R instanceof Date||R instanceof y)&&(h=h.map(C=>new m(C).valueOf())),this.dataType.equals(g.STRING)?(this._cachedLength=h.length,this._data=new TextEncoder().encode(`${h.join(`
|
|
2
|
+
`)}
|
|
3
|
+
`)):this.dataType.equals(g.JSON)?(this._cachedLength=h.length,this._data=new TextEncoder().encode(`${h.map(C=>D.JSON_CODEC.encodeString(C)).join(`
|
|
4
|
+
`)}
|
|
5
|
+
`)):this._data=new this.dataType.Array(h).buffer}this.key=v,this.alignment=f,this.sampleOffset=s??0,this._timeRange=n,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:c}}static alloc({capacity:t,dataType:e,...n}){if(t===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new g(e).Array(t),c=new T({data:s.buffer,dataType:e,...n});return c.writePos=0,c}static generateTimestamps(t,e,n){const s=n.spanRange(e.span(t)),c=new BigInt64Array(t);for(let f=0;f<t;f++)c[f]=BigInt(n.add(e.span(f)).valueOf());return new T({data:c,dataType:g.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(t,e){const n=new TextEncoder().encode(`${t.join(`
|
|
6
|
+
`)}
|
|
7
|
+
`);return new T({data:n,dataType:g.STRING,timeRange:e})}static fromJSON(t,e){const n=new TextEncoder().encode(`${t.map(s=>D.JSON_CODEC.encodeString(s)).join(`
|
|
8
|
+
`)}
|
|
9
|
+
`);return new T({data:n,dataType:g.JSON,timeRange:e})}acquire(t){this._refCount++,t!=null&&this.updateGLBuffer(t)}release(){if(this._refCount--,this._refCount===0&&this.gl.control!=null)this.maybeGarbageCollectGLBuffer(this.gl.control);else if(this._refCount<0)throw new Error("cannot release an array with a negative reference count")}write(t){if(!t.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(t):this.writeFixed(t)}writeVariable(t){if(this.writePos===E)return 0;const e=this.byteCapacity.valueOf()-this.writePos,n=t.subBytes(0,e);return this.writeToUnderlyingData(n),this.writePos+=n.byteLength.valueOf(),this._cachedLength!=null&&(this._cachedLength+=n.length,this.calculateCachedLength()),n.length}writeFixed(t){if(this.writePos===E)return 0;const e=this.capacity-this.writePos,n=t.sub(0,e);return this.writeToUnderlyingData(n),this._cachedLength=void 0,this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}writeToUnderlyingData(t){this.underlyingData.set(t.data,this.writePos)}get buffer(){return this._data instanceof ArrayBuffer||this._data instanceof SharedArrayBuffer?this._data:this._data.buffer}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===E?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(g.STRING,g.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
|
|
10
|
+
`).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(g.UUID))throw new Error("cannot convert non-uuid series to uuids");const t=g.UUID.density.valueOf(),e=Array(this.length);for(let n=0;n<this.length;n++){const s=this.underlyingData.slice(n*t,(n+1)*t),c=Array.from(new Uint8Array(s),f=>f.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");e[n]=c}return e}parseJSON(t){if(!this.dataType.equals(g.JSON))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
|
|
11
|
+
`).slice(0,-1).map(e=>t.parse(D.JSON_CODEC.decodeString(e)))}get timeRange(){if(this._timeRange==null)throw new Error("time range not set on series");return this._timeRange}get byteCapacity(){return new U(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===E?this.byteCapacity:this.dataType.isVariable?new U(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===E?this.data.length:this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let t=0;const e=[0];return this.data.forEach((n,s)=>{n===P&&(t++,e.push(s+1))}),this._cachedIndexes=e,this._cachedLength=t,t}convert(t,e=0){if(this.dataType.equals(t))return this;const n=new t.Array(this.length);for(let s=0;s<this.length;s++)n[s]=X(this.dataType,t,this.data[s],e);return new T({data:n.buffer,dataType:t,timeRange:this._timeRange,sampleOffset:e,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(g.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const t=this.data;this._cachedMax=t.reduce((e,n)=>e>n?e:n)}else{const t=this.data;this._cachedMax=t.reduce((e,n)=>e>n?e:n)}return this._cachedMax}get max(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this._cachedMax??(this._cachedMax=this.calcRawMax()),x(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(g.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const t=this.data;this._cachedMin=t.reduce((e,n)=>e<n?e:n)}else{const t=this.data;this._cachedMin=t.reduce((e,n)=>e<n?e:n)}return this._cachedMin}get min(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this._cachedMin??(this._cachedMin=this.calcRawMin()),x(this._cachedMin,this.sampleOffset))}get bounds(){return w.construct(Number(this.min),Number(this.max))}maybeRecomputeMinMax(t){if(this._cachedMin!=null){const e=t._cachedMin??t.calcRawMin();e<this._cachedMin&&(this._cachedMin=e)}if(this._cachedMax!=null){const e=t._cachedMax??t.calcRawMax();e>this._cachedMax&&(this._cachedMax=e)}}enrich(){this.max,this.min}get range(){return x(this.max,-this.min)}atAlignment(t,e){const n=Number(t-this.alignment);if(n<0||n>=this.length){if(e===!0)throw new Error(`[series] - no value at index ${n}`);return}return this.at(n,e)}at(t,e){if(this.dataType.isVariable)return this.atVariable(t,e??!1);t<0&&(t=this.length+t);const n=this.data[t];if(n==null){if(e===!0)throw new Error(`[series] - no value at index ${t}`);return}return x(n,this.sampleOffset)}atVariable(t,e){let n=0,s=0;if(this._cachedIndexes!=null)n=this._cachedIndexes[t],s=this._cachedIndexes[t+1]-1;else{t<0&&(t=this.length+t);for(let f=0;f<this.data.length;f++)if(this.data[f]===P){if(t===0){s=f;break}n=f+1,t--}if(s===0&&(s=this.data.length),n>=s||t>0){if(e)throw new Error(`[series] - no value at index ${t}`);return}}const c=this.data.slice(n,s);return this.dataType.equals(g.STRING)?new TextDecoder().decode(c):et.snakeToCamel(JSON.parse(new TextDecoder().decode(c)))}binarySearch(t){let e=0,n=this.length-1;const s=nt.newF(t);for(;e<=n;){const c=Math.floor((e+n)/2),f=s(this.at(c,!0),t);if(f===0)return c;f<0?e=c+1:n=c-1}return e}updateGLBuffer(t){if(this.gl.control=t,!this.dataType.equals(g.FLOAT32))throw new Error("Only FLOAT32 arrays can be used in WebGL");const{buffer:e,bufferUsage:n,prevBuffer:s}=this.gl;if(e==null&&(this.gl.buffer=t.createBuffer()),this.writePos!==s)if(t.bindBuffer(t.ARRAY_BUFFER,this.gl.buffer),this.writePos!==E){s===0&&t.bufferData(t.ARRAY_BUFFER,this.byteCapacity.valueOf(),t.STATIC_DRAW);const c=this.dataType.density.size(s).valueOf(),f=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);t.bufferSubData(t.ARRAY_BUFFER,c,f.buffer),this.gl.prevBuffer=this.writePos}else t.bufferData(t.ARRAY_BUFFER,this.underlyingData,n==="static"?t.STATIC_DRAW:t.DYNAMIC_DRAW),this.gl.prevBuffer=E}as(t){if(t==="string"){if(!this.dataType.equals(g.STRING))throw new Error(`cannot convert series of type ${this.dataType.toString()} to string`);return this}if(t==="number"){if(!this.dataType.isNumeric)throw new Error(`cannot convert series of type ${this.dataType.toString()} to number`);return this}if(t==="bigint"){if(!this.dataType.equals(g.INT64))throw new Error(`cannot convert series of type ${this.dataType.toString()} to bigint`);return this}throw new Error(`cannot convert series to ${t}`)}get digest(){var t;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:this.alignmentBounds,timeRange:(t=this._timeRange)==null?void 0:t.toString(),length:this.length,capacity:this.capacity}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return w.construct(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(t){this.gl.buffer!=null&&(t.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const t=new ht(this);return this.dataType.equals(g.JSON)?new ft(t):t}return new dt(this)}slice(t,e){return this.sliceSub(!1,t,e)}sub(t,e){return this.sliceSub(!0,t,e)}subIterator(t,e){return new V(this,t,e??this.length)}subAlignmentIterator(t,e){return new V(this,Number(t-this.alignment),Number(e-this.alignment))}subBytes(t,e){if(t>=0&&(e==null||e>=this.byteLength.valueOf()))return this;const n=this.data.subarray(t,e);return new T({data:n,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}sliceSub(t,e,n){if(e<=0&&(n==null||n>=this.length))return this;let s;return t?s=this.data.subarray(e,n):s=this.data.slice(e,n),new T({data:s,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}reAlign(t){return new T({data:this.buffer,dataType:this.dataType,timeRange:M.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:t})}};i(T,"crudeZ",o.z.object({timeRange:M.z.optional(),dataType:g.z,alignment:rt.bigInt.optional(),data:o.z.union([lt,ct,o.z.instanceof(ArrayBuffer)]),glBufferUsage:ut.optional().default("static").optional()})),i(T,"z",T.crudeZ.transform(t=>new T(t)));let z=T;class V{constructor(t,e,n){i(this,"series");i(this,"end");i(this,"index");this.series=t;const s=w.construct(0,t.length);this.end=w.clamp(s,n),this.index=w.clamp(s,e)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}}class ht{constructor(t){i(this,"series");i(this,"index");i(this,"decoder");if(!t.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=t,this.index=0,this.decoder=new TextDecoder}next(){const t=this.index,e=this.series.data;for(;this.index<e.length&&e[this.index]!==P;)this.index++;const n=this.index;return t===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(t,n))})}[Symbol.iterator](){return this}}var Z,k;class ft{constructor(t){i(this,"wrapped");i(this,Z,"JSONSeriesIterator");this.wrapped=t}next(){const t=this.wrapped.next();return t.done===!0?{done:!0,value:void 0}:{done:!1,value:D.JSON_CODEC.decodeString(t.value)}}[(k=Symbol.iterator,Z=Symbol.toStringTag,k)](){return this}}var G,J;class dt{constructor(t){i(this,"series");i(this,"index");i(this,G,"SeriesIterator");this.series=t,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[(J=Symbol.iterator,G=Symbol.toStringTag,J)](){return this}}const x=(l,t)=>typeof l=="bigint"&&typeof t=="bigint"||typeof l=="number"&&typeof t=="number"?l+t:t===0?l:l===0?t:Number(l)+Number(t);class gt{constructor(t){i(this,"series");if(t.length!==0){const e=t[0].dataType;for(let n=1;n<t.length;n++)if(!t[n].dataType.equals(e))throw new Error("[multi-series] - series must have the same data type")}this.series=t}as(t){if(!new g(t).equals(this.dataType))throw new Error(`cannot convert series of type ${this.dataType.toString()} to ${t.toString()}`);return this}get dataType(){return this.series.length===0?g.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?M.ZERO:new M(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}get alignment(){return this.series.length===0?0n:this.series[0].alignment}get alignmentBounds(){return this.series.length===0?w.construct(0n,0n):w.construct(this.series[0].alignmentBounds.lower,this.series[this.series.length-1].alignmentBounds.upper)}push(t){this.series.push(t)}get length(){return this.series.reduce((t,e)=>t+e.length,0)}atAlignment(t,e){if(this.series.length===0){if(e)throw new Error(`[series] - no value at alignment ${t}`);return}for(const n of this.series)if(w.contains(n.alignmentBounds,t))return n.atAlignment(t,e);if(e)throw new Error(`[series] - no value at alignment ${t}`)}at(t,e=!1){t<0&&(t=this.length+t);for(const n of this.series){if(t<n.length)return n.at(t,e);t-=n.length}if(e)throw new Error(`[series] - no value at index ${t}`)}subIterator(t,e){return new q(this,t,e??this.length)}subAlignmentIterator(t,e){if(t>=this.alignmentBounds.upper||e<=this.alignmentBounds.lower)return $;let n=0;for(let c=0;c<this.series.length;c++){const f=this.series[c];if(t<f.alignment)break;if(t>=f.alignmentBounds.upper)n+=f.length;else if(w.contains(f.alignmentBounds,t)){n+=Number(t-f.alignment);break}}let s=0;for(let c=0;c<this.series.length;c++){const f=this.series[c];if(e<f.alignment)break;if(e>=f.alignmentBounds.upper)s+=f.length;else if(w.contains(f.alignmentBounds,e)){s+=Number(e-f.alignment);break}}return new q(this,n,s)}subAlignmentSpanIterator(t,e){if(t>=this.alignmentBounds.upper)return $;let n=0;for(let s=0;s<this.series.length;s++){const c=this.series[s];if(t<c.alignment)break;if(t>=c.alignmentBounds.upper)n+=c.length;else if(w.contains(c.alignmentBounds,t)){n+=Number(t-c.alignment);break}}return new q(this,n,n+e)}get byteLength(){return new U(this.series.reduce((t,e)=>t+e.byteLength.valueOf(),0))}get data(){const t=new this.dataType.Array(this.length);let e=0;for(const n of this.series)t.set(n.data,e),e+=n.length;return new this.dataType.Array(t)}traverseAlignment(t,e){const n=this.series.map(s=>s.alignmentBounds);return w.traverse(n,t,e)}distance(t,e){const n=this.series.map(s=>s.alignmentBounds);return w.distance(n,t,e)}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new mt(this.series)}}var W,j;class mt{constructor(t){i(this,"series");i(this,"seriesIndex");i(this,"internal");i(this,W,"MultiSeriesIterator");this.series=t,this.seriesIndex=0,this.internal=t[0][Symbol.iterator]()}next(){const t=this.internal.next();return t.done===!1?t:this.seriesIndex===this.series.length-1?{done:!0,value:void 0}:(this.internal=this.series[++this.seriesIndex][Symbol.iterator](),this.next())}[(j=Symbol.iterator,W=Symbol.toStringTag,j)](){return this}}class q{constructor(t,e,n){i(this,"series");i(this,"index");i(this,"end");this.series=t,this.end=n,this.index=e}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}}exports.DataType=g;exports.Density=I;exports.MultiSeries=gt;exports.Rate=L;exports.Series=z;exports.Size=U;exports.TimeRange=M;exports.TimeSpan=y;exports.TimeStamp=m;exports.addSamples=x;exports.convertDataType=X;exports.id=at;exports.isCrudeSeries=Q;exports.isTelemValue=F;exports.typedArrayZ=ot;
|
|
@@ -2,17 +2,17 @@ var tt = Object.defineProperty;
|
|
|
2
2
|
var et = (l, t, e) => t in l ? tt(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
|
|
3
3
|
var s = (l, t, e) => et(l, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { z as o } from "zod";
|
|
5
|
-
import { J as $ } from "./index-
|
|
6
|
-
import { s as nt } from "./index-
|
|
7
|
-
import { n as rt } from "./index-
|
|
8
|
-
import { m as R, c as L, a as k, d as D, t as st, e as it } from "./bounds-
|
|
9
|
-
import "./box-
|
|
5
|
+
import { J as $ } from "./index-BBa2mWG1.js";
|
|
6
|
+
import { s as nt } from "./index-eue4dSQX.js";
|
|
7
|
+
import { n as rt } from "./index-HQonyH7n.js";
|
|
8
|
+
import { m as R, c as L, a as k, d as D, t as st, e as it } from "./bounds-CFI9wDXn.js";
|
|
9
|
+
import "./box-DVCNGsJG.js";
|
|
10
10
|
import "./dimensions-D-1PnJVI.js";
|
|
11
11
|
import "./base-DnZzEvvz.js";
|
|
12
|
-
import "./location-
|
|
13
|
-
import "./scale-
|
|
12
|
+
import "./location-CI9x53qR.js";
|
|
13
|
+
import "./scale-DNQE1LMm.js";
|
|
14
14
|
import "./xy-CrgPnICw.js";
|
|
15
|
-
import { b as at } from "./zodutil-
|
|
15
|
+
import { b as at } from "./zodutil-Tmuc4CNq.js";
|
|
16
16
|
let ut = (l, t = 21) => (e = t) => {
|
|
17
17
|
let n = "", i = e;
|
|
18
18
|
for (; i--; )
|
|
@@ -67,7 +67,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X =
|
|
|
67
67
|
const [n, i, c] = t.split(":");
|
|
68
68
|
let h = "00", S = "00";
|
|
69
69
|
c != null && ([h, S] = c.split("."));
|
|
70
|
-
let O = a.hours(parseInt(n ?? "00"
|
|
70
|
+
let O = a.hours(parseInt(n ?? "00")).add(a.minutes(parseInt(i ?? "00"))).add(a.seconds(parseInt(h ?? "00"))).add(a.milliseconds(parseInt(S ?? "00")));
|
|
71
71
|
return e === "local" && (O = O.add(a.utcOffset)), O.valueOf();
|
|
72
72
|
}
|
|
73
73
|
static parseDateTimeString(t, e = "UTC") {
|
|
@@ -763,12 +763,11 @@ const r = class r extends String {
|
|
|
763
763
|
if (t instanceof r || typeof t == "string" || typeof t.valueOf() == "string") {
|
|
764
764
|
super(t.valueOf());
|
|
765
765
|
return;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
766
|
+
}
|
|
767
|
+
const e = r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
|
|
768
|
+
if (e != null) {
|
|
769
|
+
super(e.valueOf());
|
|
770
|
+
return;
|
|
772
771
|
}
|
|
773
772
|
throw super(r.UNKNOWN.valueOf()), new Error(`unable to find data type for ${t.toString()}`);
|
|
774
773
|
}
|
|
@@ -1122,11 +1121,11 @@ const xt = o.union([
|
|
|
1122
1121
|
else {
|
|
1123
1122
|
let f = N ? [O] : O;
|
|
1124
1123
|
const M = f[0];
|
|
1125
|
-
(M instanceof m || M instanceof Date || M instanceof y) && (f = f.map((U) => new m(U).valueOf())), this.dataType.equals(g.STRING) ? (this._cachedLength = f.length, this._data = new TextEncoder().encode(f.join(`
|
|
1126
|
-
`)
|
|
1124
|
+
(M instanceof m || M instanceof Date || M instanceof y) && (f = f.map((U) => new m(U).valueOf())), this.dataType.equals(g.STRING) ? (this._cachedLength = f.length, this._data = new TextEncoder().encode(`${f.join(`
|
|
1125
|
+
`)}
|
|
1127
1126
|
`)) : this.dataType.equals(g.JSON) ? (this._cachedLength = f.length, this._data = new TextEncoder().encode(
|
|
1128
|
-
f.map((U) => $.encodeString(U)).join(`
|
|
1129
|
-
`)
|
|
1127
|
+
`${f.map((U) => $.encodeString(U)).join(`
|
|
1128
|
+
`)}
|
|
1130
1129
|
`
|
|
1131
1130
|
)) : this._data = new this.dataType.Array(f).buffer;
|
|
1132
1131
|
}
|
|
@@ -1157,15 +1156,15 @@ const xt = o.union([
|
|
|
1157
1156
|
return this._refCount;
|
|
1158
1157
|
}
|
|
1159
1158
|
static fromStrings(t, e) {
|
|
1160
|
-
const n = new TextEncoder().encode(t.join(`
|
|
1161
|
-
`)
|
|
1159
|
+
const n = new TextEncoder().encode(`${t.join(`
|
|
1160
|
+
`)}
|
|
1162
1161
|
`);
|
|
1163
1162
|
return new I({ data: n, dataType: g.STRING, timeRange: e });
|
|
1164
1163
|
}
|
|
1165
1164
|
static fromJSON(t, e) {
|
|
1166
1165
|
const n = new TextEncoder().encode(
|
|
1167
|
-
t.map((i) => $.encodeString(i)).join(`
|
|
1168
|
-
`)
|
|
1166
|
+
`${t.map((i) => $.encodeString(i)).join(`
|
|
1167
|
+
`)}
|
|
1169
1168
|
`
|
|
1170
1169
|
);
|
|
1171
1170
|
return new I({ data: n, dataType: g.JSON, timeRange: e });
|
|
@@ -1311,12 +1310,11 @@ const xt = o.union([
|
|
|
1311
1310
|
get max() {
|
|
1312
1311
|
if (this.dataType.isVariable)
|
|
1313
1312
|
throw new Error("cannot calculate maximum on a variable length data type");
|
|
1314
|
-
return this.writePos === 0 ? -1 / 0 : (this._cachedMax
|
|
1313
|
+
return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()), C(this._cachedMax, this.sampleOffset));
|
|
1315
1314
|
}
|
|
1316
1315
|
calcRawMin() {
|
|
1317
1316
|
if (this.length === 0) return 1 / 0;
|
|
1318
|
-
if (this.dataType.equals(g.TIMESTAMP))
|
|
1319
|
-
this._cachedMin = this.data[0];
|
|
1317
|
+
if (this.dataType.equals(g.TIMESTAMP)) this._cachedMin = this.data[0];
|
|
1320
1318
|
else if (this.dataType.usesBigInt) {
|
|
1321
1319
|
const t = this.data;
|
|
1322
1320
|
this._cachedMin = t.reduce((e, n) => e < n ? e : n);
|
|
@@ -1330,7 +1328,7 @@ const xt = o.union([
|
|
|
1330
1328
|
get min() {
|
|
1331
1329
|
if (this.dataType.isVariable)
|
|
1332
1330
|
throw new Error("cannot calculate minimum on a variable length data type");
|
|
1333
|
-
return this.writePos === 0 ? 1 / 0 : (this._cachedMin
|
|
1331
|
+
return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()), C(this._cachedMin, this.sampleOffset));
|
|
1334
1332
|
}
|
|
1335
1333
|
/** @returns the bounds of this array. */
|
|
1336
1334
|
get bounds() {
|