@synnaxlabs/x 0.38.1 → 0.40.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.
Files changed (171) hide show
  1. package/.turbo/turbo-build.log +40 -40
  2. package/dist/{base-B48bPNx5.cjs → base-BAM2mqCy.cjs} +1 -1
  3. package/dist/{base-DnZzEvvz.js → base-DFq0vvGn.js} +7 -7
  4. package/dist/{bounds-8aFLdbEj.cjs → bounds-Dwq6ZFHm.cjs} +1 -1
  5. package/dist/{bounds-BtccGJW0.js → bounds-azUOoVVR.js} +1 -1
  6. package/dist/bounds.cjs +1 -1
  7. package/dist/bounds.js +1 -1
  8. package/dist/box-Bzya27QS.cjs +1 -0
  9. package/dist/box-DrsrRNSe.js +201 -0
  10. package/dist/box.cjs +1 -1
  11. package/dist/box.js +1 -1
  12. package/dist/deep.cjs +1 -1
  13. package/dist/deep.js +77 -74
  14. package/dist/{dimensions-D-1PnJVI.js → dimensions-CRgergMS.js} +1 -1
  15. package/dist/{dimensions-zMcb9pMk.cjs → dimensions-PWy5QZoM.cjs} +1 -1
  16. package/dist/dimensions.cjs +1 -1
  17. package/dist/dimensions.js +1 -1
  18. package/dist/{direction-CScbfCdT.js → direction-BL0PhD1k.js} +1 -1
  19. package/dist/{direction-D7qoo_GJ.cjs → direction-C-b6XTeU.cjs} +1 -1
  20. package/dist/direction.cjs +1 -1
  21. package/dist/direction.js +1 -1
  22. package/dist/{external-CtAt3tnU.js → external-BPgtxa8d.js} +8 -8
  23. package/dist/external-C8TFju8Q.js +29 -0
  24. package/dist/external-CvWr1nhS.cjs +1 -0
  25. package/dist/external-uXk0Avrg.cjs +1 -0
  26. package/dist/index.cjs +4 -2
  27. package/dist/index.js +237 -197
  28. package/dist/{location-BIet4Mig.cjs → location-BgpQ3rN2.cjs} +1 -1
  29. package/dist/{location-BVkZhfQG.js → location-BuYbIFHD.js} +5 -5
  30. package/dist/location.cjs +1 -1
  31. package/dist/location.js +1 -1
  32. package/dist/position-DTrNGtrm.cjs +1 -0
  33. package/dist/position-DemzGvAY.js +85 -0
  34. package/dist/position.cjs +1 -1
  35. package/dist/position.js +1 -1
  36. package/dist/runtime.cjs +1 -1
  37. package/dist/runtime.js +1 -1
  38. package/dist/{scale-D_UMXSZN.js → scale-C0EllH-1.js} +4 -4
  39. package/dist/{scale-Bzjm1mhv.cjs → scale-DpJM6__6.cjs} +1 -1
  40. package/dist/scale.cjs +1 -1
  41. package/dist/scale.js +1 -1
  42. package/dist/series-BgoCtU71.cjs +11 -0
  43. package/dist/{series-Cwc_z2OS.js → series-CXnO-P0V.js} +335 -333
  44. package/dist/{spatial-DozyssiN.js → spatial-BSWPzMkK.js} +1 -1
  45. package/dist/{spatial-BOhaO8xN.cjs → spatial-DGpZ2sO3.cjs} +1 -1
  46. package/dist/spatial.cjs +1 -1
  47. package/dist/spatial.js +9 -9
  48. package/dist/src/breaker/breaker.d.ts.map +1 -1
  49. package/dist/src/caseconv/caseconv.d.ts.map +1 -1
  50. package/dist/src/change/change.d.ts.map +1 -1
  51. package/dist/src/clamp/clamp.d.ts.map +1 -1
  52. package/dist/src/compare/compare.d.ts.map +1 -1
  53. package/dist/src/control/control.d.ts +4 -2
  54. package/dist/src/control/control.d.ts.map +1 -1
  55. package/dist/src/debounce/debounce.d.ts.map +1 -1
  56. package/dist/src/deep/copy.d.ts.map +1 -1
  57. package/dist/src/deep/delete.d.ts +1 -1
  58. package/dist/src/deep/delete.d.ts.map +1 -1
  59. package/dist/src/deep/difference.d.ts.map +1 -1
  60. package/dist/src/deep/equal.d.ts.map +1 -1
  61. package/dist/src/deep/merge.d.ts.map +1 -1
  62. package/dist/src/deep/path.d.ts.map +1 -1
  63. package/dist/src/id/id.d.ts +6 -1
  64. package/dist/src/id/id.d.ts.map +1 -1
  65. package/dist/src/id/id.spec.d.ts +2 -0
  66. package/dist/src/id/id.spec.d.ts.map +1 -0
  67. package/dist/src/identity.d.ts.map +1 -1
  68. package/dist/src/index.d.ts +2 -1
  69. package/dist/src/index.d.ts.map +1 -1
  70. package/dist/src/invert.d.ts.map +1 -1
  71. package/dist/src/jsonrpc/index.d.ts +2 -0
  72. package/dist/src/jsonrpc/index.d.ts.map +1 -0
  73. package/dist/src/jsonrpc/jsonrpc.d.ts +36 -0
  74. package/dist/src/jsonrpc/jsonrpc.d.ts.map +1 -0
  75. package/dist/src/jsonrpc/jsonrpc.spec.d.ts +2 -0
  76. package/dist/src/jsonrpc/jsonrpc.spec.d.ts.map +1 -0
  77. package/dist/src/link/link.d.ts.map +1 -1
  78. package/dist/src/math/math.d.ts.map +1 -1
  79. package/dist/src/migrate/migrate.d.ts.map +1 -1
  80. package/dist/src/primitive.d.ts.map +1 -1
  81. package/dist/src/record.d.ts.map +1 -1
  82. package/dist/src/renderable.d.ts.map +1 -1
  83. package/dist/src/shallowCopy.d.ts.map +1 -1
  84. package/dist/src/sleep/sleep.d.ts.map +1 -1
  85. package/dist/src/spatial/base.d.ts +1 -1
  86. package/dist/src/spatial/base.d.ts.map +1 -1
  87. package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
  88. package/dist/src/spatial/box/box.d.ts.map +1 -1
  89. package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -1
  90. package/dist/src/spatial/direction/direction.d.ts +1 -1
  91. package/dist/src/spatial/direction/direction.d.ts.map +1 -1
  92. package/dist/src/spatial/location/location.d.ts.map +1 -1
  93. package/dist/src/spatial/position/position.d.ts.map +1 -1
  94. package/dist/src/spatial/xy/xy.d.ts.map +1 -1
  95. package/dist/src/strings/strings.d.ts +6 -6
  96. package/dist/src/strings/strings.d.ts.map +1 -1
  97. package/dist/src/telem/generate.d.ts.map +1 -1
  98. package/dist/src/telem/series.d.ts +7 -8
  99. package/dist/src/telem/series.d.ts.map +1 -1
  100. package/dist/src/telem/telem.d.ts +1 -0
  101. package/dist/src/telem/telem.d.ts.map +1 -1
  102. package/dist/src/testutil/testutil.d.ts.map +1 -1
  103. package/dist/src/toArray.d.ts.map +1 -1
  104. package/dist/src/unique/unique.d.ts +2 -2
  105. package/dist/src/unique/unique.d.ts.map +1 -1
  106. package/dist/src/url/url.d.ts.map +1 -1
  107. package/dist/src/zod/external.d.ts +3 -0
  108. package/dist/src/zod/external.d.ts.map +1 -0
  109. package/dist/src/zod/index.d.ts +2 -0
  110. package/dist/src/zod/index.d.ts.map +1 -0
  111. package/dist/src/zod/integer.d.ts +10 -0
  112. package/dist/src/zod/integer.d.ts.map +1 -0
  113. package/dist/src/zod/integer.spec.d.ts +2 -0
  114. package/dist/src/zod/integer.spec.d.ts.map +1 -0
  115. package/dist/src/{zodutil/zodutil.d.ts → zod/util.d.ts} +1 -2
  116. package/dist/src/zod/util.d.ts.map +1 -0
  117. package/dist/src/zod/util.spec.d.ts +2 -0
  118. package/dist/src/zod/util.spec.d.ts.map +1 -0
  119. package/dist/telem.cjs +1 -1
  120. package/dist/telem.js +1 -1
  121. package/dist/url.cjs +1 -1
  122. package/dist/url.js +5 -5
  123. package/dist/{xy-DxjPL2DZ.js → xy-DHBO1dG_.js} +4 -4
  124. package/dist/{xy-Budz-qz-.cjs → xy-DyQSETQZ.cjs} +1 -1
  125. package/dist/xy.cjs +1 -1
  126. package/dist/xy.js +1 -1
  127. package/dist/zod.cjs +1 -0
  128. package/dist/zod.js +4 -0
  129. package/package.json +12 -10
  130. package/src/binary/rpc.txt +39 -0
  131. package/src/control/control.ts +10 -2
  132. package/src/deep/merge.spec.ts +27 -1
  133. package/src/deep/merge.ts +9 -3
  134. package/src/id/id.spec.ts +40 -0
  135. package/src/id/id.ts +9 -2
  136. package/src/index.ts +2 -1
  137. package/src/{zodutil → jsonrpc}/index.ts +1 -1
  138. package/src/jsonrpc/jsonrpc.spec.ts +125 -0
  139. package/src/jsonrpc/jsonrpc.ts +92 -0
  140. package/src/spatial/base.ts +1 -1
  141. package/src/spatial/bounds/bounds.spec.ts +1 -1
  142. package/src/strings/strings.spec.ts +14 -14
  143. package/src/strings/strings.ts +19 -17
  144. package/src/telem/generate.ts +1 -1
  145. package/src/telem/series.spec.ts +45 -3
  146. package/src/telem/series.ts +15 -16
  147. package/src/telem/telem.ts +8 -1
  148. package/src/unique/unique.ts +2 -2
  149. package/src/zod/external.ts +11 -0
  150. package/src/zod/index.ts +10 -0
  151. package/src/zod/integer.spec.ts +148 -0
  152. package/src/zod/integer.ts +38 -0
  153. package/src/{zodutil/zodutil.spec.ts → zod/util.spec.ts} +8 -8
  154. package/src/{zodutil/zodutil.ts → zod/util.ts} +1 -3
  155. package/tsconfig.tsbuildinfo +1 -1
  156. package/vite.config.ts +1 -1
  157. package/dist/box-DPJAbf32.js +0 -201
  158. package/dist/box-Daep7oxr.cjs +0 -1
  159. package/dist/external-DSKjMZ7J.cjs +0 -1
  160. package/dist/position-96CBRKEd.cjs +0 -1
  161. package/dist/position-uVDP52PM.js +0 -85
  162. package/dist/series-DuOxifEy.cjs +0 -11
  163. package/dist/src/zodutil/index.d.ts +0 -2
  164. package/dist/src/zodutil/index.d.ts.map +0 -1
  165. package/dist/src/zodutil/zodutil.d.ts.map +0 -1
  166. package/dist/src/zodutil/zodutil.spec.d.ts +0 -2
  167. package/dist/src/zodutil/zodutil.spec.d.ts.map +0 -1
  168. package/dist/zodutil-BfrF8jE3.js +0 -23
  169. package/dist/zodutil-DFJyyQd2.cjs +0 -1
  170. package/dist/zodutil.cjs +0 -1
  171. package/dist/zodutil.js +0 -4
package/dist/index.js CHANGED
@@ -1,266 +1,306 @@
1
- var M = Object.defineProperty;
2
- var T = (e, t, r) => t in e ? M(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var p = (e, t, r) => T(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { e as ne } from "./index-C3QzbIwt.js";
5
- import { z as c } from "zod";
6
- import { b as x } from "./series-Cwc_z2OS.js";
7
- import { d as ie, D as ae, M as ce, R as le, S as ue, e as fe, c as me, T as de, a as pe, g as ge, h as be, i as xe, f as he, s as ye, t as Se } from "./series-Cwc_z2OS.js";
8
- import { a as ve } from "./index-DizUWH6z.js";
9
- import { c as je } from "./change-DLl6DccR.js";
10
- import { c as Me, s as Te } from "./scale-D_UMXSZN.js";
11
- import { L as S, G as $, E as k, i as A, a as _, b as O } from "./index-BVC_8Cg9.js";
12
- import { c as Ae, d as _e, p as Oe } from "./index-BVC_8Cg9.js";
13
- import { debounce as ze, throttle as Le } from "./debounce.js";
14
- import { deep as Pe } from "./deep.js";
15
- import { isObject as Ge } from "./identity.js";
16
- import { e as Ze } from "./external-DqPrWKvU.js";
17
- import { link as Ie } from "./link.js";
18
- import { b as qe, f as Be } from "./bounds-BtccGJW0.js";
19
- import { observe as He } from "./observe.js";
20
- import { getEntries as Ue, mapValues as Je, unknownRecordZ as Ke } from "./record.js";
21
- import { e as Ye } from "./external-CtAt3tnU.js";
22
- import { Search as rr } from "./search.js";
23
- import { b as or } from "./box-DPJAbf32.js";
24
- import { d as sr } from "./dimensions-D-1PnJVI.js";
25
- import { d as ar } from "./direction-CScbfCdT.js";
26
- import { l as lr } from "./location-BVkZhfQG.js";
27
- import { p as fr } from "./position-uVDP52PM.js";
28
- import { s as dr } from "./spatial-DozyssiN.js";
29
- import { x as gr } from "./xy-DxjPL2DZ.js";
30
- import { nullToArr as xr, toArray as hr } from "./toArray.js";
31
- import { u as Sr } from "./index-D4NCYiQB.js";
32
- import { URL as vr, buildQueryString as Er } from "./url.js";
33
- import { RoutedWorker as wr, TypedWorker as Mr, createMockWorkers as Tr } from "./worker.js";
34
- import { z as Ar } from "./zodutil-BfrF8jE3.js";
35
- const R = async (e) => await new Promise(
36
- (t) => setTimeout(t, x.fromMilliseconds(e).milliseconds)
37
- ), z = c.object({
38
- interval: x.z.optional(),
39
- maxRetries: c.number().optional(),
40
- scale: c.number().optional()
41
- }), L = (e = {}) => {
42
- const t = e.sleepFn || R, r = e.maxRetries ?? 5, n = e.scale ?? 1;
43
- let s = 0, l = new x(e.interval ?? x.milliseconds(1));
44
- return async () => s >= r ? !1 : (await t(l), l = l.mult(n), s++, !0);
45
- }, Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1
+ var T = Object.defineProperty;
2
+ var j = (e, t, r) => t in e ? T(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var g = (e, t, r) => j(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { J as _ } from "./index-C3QzbIwt.js";
5
+ import { e as le } from "./index-C3QzbIwt.js";
6
+ import { z as l } from "zod";
7
+ import { a as b } from "./series-CXnO-P0V.js";
8
+ import { c as ue, D as me, M as de, R as ge, S as pe, d as he, b as be, T as xe, g as Se, f as ye, h as we, i as ve, e as Me, s as $e, t as Ee } from "./series-CXnO-P0V.js";
9
+ import { a as je } from "./index-DizUWH6z.js";
10
+ import { c as Oe } from "./change-DLl6DccR.js";
11
+ import { c as ke, s as Le } from "./scale-C0EllH-1.js";
12
+ import { i as O, a as A, b as k, L as y, G as w, E as L } from "./index-BVC_8Cg9.js";
13
+ import { c as Re, d as Ce, p as ze } from "./index-BVC_8Cg9.js";
14
+ import { debounce as Ue, throttle as Be } from "./debounce.js";
15
+ import { deep as Ie } from "./deep.js";
16
+ import { isObject as Ze } from "./identity.js";
17
+ import { e as Je } from "./external-DqPrWKvU.js";
18
+ import { link as qe } from "./link.js";
19
+ import { b as He, f as Qe } from "./bounds-azUOoVVR.js";
20
+ import { observe as Xe } from "./observe.js";
21
+ import { getEntries as er, mapValues as rr, unknownRecordZ as tr } from "./record.js";
22
+ import { e as nr } from "./external-BPgtxa8d.js";
23
+ import { Search as ar } from "./search.js";
24
+ import { b as cr } from "./box-DrsrRNSe.js";
25
+ import { d as fr } from "./dimensions-CRgergMS.js";
26
+ import { d as mr } from "./direction-BL0PhD1k.js";
27
+ import { l as gr } from "./location-BuYbIFHD.js";
28
+ import { p as hr } from "./position-DemzGvAY.js";
29
+ import { s as xr } from "./spatial-BSWPzMkK.js";
30
+ import { x as yr } from "./xy-DHBO1dG_.js";
31
+ import { nullToArr as vr, toArray as Mr } from "./toArray.js";
32
+ import { u as Er } from "./index-D4NCYiQB.js";
33
+ import { URL as jr, buildQueryString as _r } from "./url.js";
34
+ import { RoutedWorker as Ar, TypedWorker as kr, createMockWorkers as Lr } from "./worker.js";
35
+ import { e as Rr } from "./external-C8TFju8Q.js";
36
+ const N = async (e) => await new Promise(
37
+ (t) => setTimeout(t, b.fromMilliseconds(e).milliseconds)
38
+ ), R = l.object({
39
+ interval: b.z.optional(),
40
+ maxRetries: l.number().optional(),
41
+ scale: l.number().optional()
42
+ }), C = (e = {}) => {
43
+ const t = e.sleepFn || N, r = e.maxRetries ?? 5, o = e.scale ?? 1;
44
+ let a = 0, i = new b(e.interval ?? b.milliseconds(1));
45
+ return async () => a >= r ? !1 : (await t(i), i = i.mult(o), a++, !0);
46
+ }, X = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
46
47
  __proto__: null,
47
- breakerConfig: z,
48
- create: L
48
+ breakerConfig: R,
49
+ create: C
49
50
  }, Symbol.toStringTag, { value: "Module" })), u = class u extends Number {
50
51
  };
51
- p(u, "Absolute", 255), p(u, "Default", 1), p(u, "z", c.union([
52
- c.instanceof(u),
53
- c.number().int().min(0).max(255).transform((t) => new u(t)),
54
- c.instanceof(Number).transform((t) => new u(t))
52
+ g(u, "ABSOLUTE", 255), g(u, "MINIMUM", 0), g(u, "BOUNDS", {
53
+ lower: u.MINIMUM,
54
+ // upper bound is exclusive, so we add 1
55
+ upper: u.ABSOLUTE + 1
56
+ }), g(u, "z", l.union([
57
+ l.instanceof(u),
58
+ l.number().int().min(0).max(255).transform((t) => new u(t)),
59
+ l.instanceof(Number).transform((t) => new u(t))
55
60
  ]));
56
- let h = u;
57
- const j = c.object({
58
- name: c.string(),
59
- key: c.string()
60
- }), N = (e) => c.object({
61
- subject: j,
61
+ let x = u;
62
+ const $ = l.object({
63
+ name: l.string(),
64
+ key: l.string()
65
+ }), z = (e) => l.object({
66
+ subject: $,
62
67
  resource: e,
63
- authority: h.z
68
+ authority: x.z
64
69
  }), P = (...e) => (t) => t.filter((r) => {
65
- let n = !1;
66
- return r.to != null && (n = e.includes(r.to.resource)), r.from != null && !n && (n = e.includes(r.from.resource)), n;
67
- }), U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
70
+ let o = !1;
71
+ return r.to != null && (o = e.includes(r.to.resource)), r.from != null && !o && (o = e.includes(r.from.resource)), o;
72
+ }), Y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
68
73
  __proto__: null,
69
- Authority: h,
74
+ Authority: x,
70
75
  filterTransfersByChannelKey: P,
71
- stateZ: N,
72
- subjectZ: j
73
- }, Symbol.toStringTag, { value: "Module" })), m = class m extends Error {
76
+ stateZ: z,
77
+ subjectZ: $
78
+ }, Symbol.toStringTag, { value: "Module" })), d = class d extends Error {
74
79
  constructor() {
75
- super(m.MESSAGE);
80
+ super(d.MESSAGE);
76
81
  }
77
82
  /** Returns true if the error or message is a cancellation error" */
78
83
  matches(t) {
79
- return typeof t == "string" ? t.includes(m.MESSAGE) : t instanceof m || t.message.includes(m.MESSAGE);
84
+ return typeof t == "string" ? t.includes(d.MESSAGE) : t instanceof d || t.message.includes(d.MESSAGE);
80
85
  }
81
86
  };
82
- p(m, "MESSAGE", "canceled");
83
- let v = m;
84
- const C = new v(), J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
87
+ g(d, "MESSAGE", "canceled");
88
+ let v = d;
89
+ const U = new v(), ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
90
+ __proto__: null,
91
+ CANCELED: U
92
+ }, Symbol.toStringTag, { value: "Module" })), re = (e) => e ? -1 : 1, B = (e) => {
93
+ const t = new TextDecoder();
94
+ let r = new Uint8Array(0), o = null;
95
+ return (a) => {
96
+ let i;
97
+ typeof a == "string" ? i = new TextEncoder().encode(a) : a instanceof ArrayBuffer ? i = new Uint8Array(a) : i = a;
98
+ const f = new Uint8Array(r.length + i.length);
99
+ for (f.set(r), f.set(i, r.length), r = f; r.length > 0; ) {
100
+ if (o === null) {
101
+ const s = t.decode(r).match(/^Content-Length: (\d+)\r?\n\r?\n/);
102
+ if (!s) break;
103
+ o = parseInt(s[1]);
104
+ const n = new TextEncoder().encode(s[0]).length;
105
+ r = r.slice(n);
106
+ }
107
+ if (o !== null && r.length >= o) {
108
+ const m = r.slice(0, o);
109
+ r = r.slice(o), o = null;
110
+ const s = t.decode(m), n = _.decodeString(s);
111
+ e(n);
112
+ } else break;
113
+ }
114
+ };
115
+ }, D = (e) => {
116
+ const t = JSON.stringify(e);
117
+ return `Content-Length: ${new TextEncoder().encode(t).length}\r
118
+ \r
119
+ ` + t;
120
+ }, te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
85
121
  __proto__: null,
86
- CANCELED: C
87
- }, Symbol.toStringTag, { value: "Module" })), K = (e) => e ? -1 : 1, E = c.string().regex(/^\d+\.\d+\.\d+$/), g = (e, t, r = {}) => {
122
+ encodeMessage: D,
123
+ streamDecodeChunks: B
124
+ }, Symbol.toStringTag, { value: "Module" })), M = l.string().regex(/^\d+\.\d+\.\d+$/), p = (e, t, r = {}) => {
88
125
  r.checkMajor ?? (r.checkMajor = !0), r.checkMinor ?? (r.checkMinor = !0), r.checkPatch ?? (r.checkPatch = !0);
89
- const n = E.parse(e), s = E.parse(t), [l, f, d] = n.split(".").map(Number), [i, o, a] = s.split(".").map(Number);
126
+ const o = M.parse(e), a = M.parse(t), [i, f, m] = o.split(".").map(Number), [s, n, c] = a.split(".").map(Number);
90
127
  if (r.checkMajor) {
91
- if (l < i) return S;
92
- if (l > i) return $;
128
+ if (i < s) return y;
129
+ if (i > s) return w;
93
130
  }
94
131
  if (r.checkMinor) {
95
- if (f < o) return S;
96
- if (f > o) return $;
132
+ if (f < n) return y;
133
+ if (f > n) return w;
97
134
  }
98
135
  if (r.checkPatch) {
99
- if (d < a) return S;
100
- if (d > a) return $;
136
+ if (m < c) return y;
137
+ if (m > c) return w;
101
138
  }
102
- return k;
103
- }, G = (e, t, r = {}) => A(g(e, t, r)), w = (e, t, r = {}) => _(g(e, t, r)), D = (e, t, r = {}) => O(g(e, t, r)), Z = ({
139
+ return L;
140
+ }, I = (e, t, r = {}) => O(p(e, t, r)), E = (e, t, r = {}) => A(p(e, t, r)), G = (e, t, r = {}) => k(p(e, t, r)), Z = ({
104
141
  name: e,
105
142
  migrate: t
106
143
  }) => (r) => {
107
144
  try {
108
- const n = t(r);
109
- return console.log(`${e} migrated: ${r.version} -> ${n.version}`), n;
110
- } catch (n) {
111
- throw console.log(`${e} failed to migrate from ${r.version}`), console.error(n), n;
145
+ const o = t(r);
146
+ return console.log(`${e} migrated: ${r.version} -> ${o.version}`), o;
147
+ } catch (o) {
148
+ throw console.log(`${e} failed to migrate from ${r.version}`), console.error(o), o;
112
149
  }
113
150
  }, V = ({
114
151
  name: e,
115
152
  migrations: t,
116
153
  targetSchema: r,
117
- defaultVersion: n,
118
- def: s
154
+ defaultVersion: o,
155
+ def: a
119
156
  }) => {
120
- const l = Object.keys(t).sort(g).pop();
121
- if (l == null)
122
- return (o) => {
123
- if (o.version ?? (o.version = n), o.version !== s.version)
157
+ const i = Object.keys(t).sort(p).pop();
158
+ if (i == null)
159
+ return (n) => {
160
+ if (n.version ?? (n.version = o), n.version !== a.version)
124
161
  return console.log(
125
- `${e} version ${o.version} is newer than latest version of ${s.version}.
162
+ `${e} version ${n.version} is newer than latest version of ${a.version}.
126
163
  Returning default instead.
127
164
  `
128
- ), s;
165
+ ), a;
129
166
  try {
130
- return r != null ? r.parse(o) : o;
131
- } catch (a) {
132
- return console.log(`${e} failed to parse default. Exiting with default`), console.error(a), s;
167
+ return r != null ? r.parse(n) : n;
168
+ } catch (c) {
169
+ return console.log(`${e} failed to parse default. Exiting with default`), console.error(c), a;
133
170
  }
134
171
  };
135
172
  const f = Object.keys(t).length;
136
- let d = !1;
137
- const i = (o) => {
173
+ let m = !1;
174
+ const s = (n) => {
138
175
  try {
139
- if (f === 0 || w(o.version, l))
140
- return console.log(d ? `${e} ${o.version} now up to date` : `${e} version ${o.version} is up to date with target version ${s.version}`), o;
141
- const a = o.version, b = t[a], y = b(o);
142
- return d = !0, i(y);
143
- } catch (a) {
176
+ if (f === 0 || E(n.version, i))
177
+ return console.log(m ? `${e} ${n.version} now up to date` : `${e} version ${n.version} is up to date with target version ${a.version}`), n;
178
+ const c = n.version, h = t[c], S = h(n);
179
+ return m = !0, s(S);
180
+ } catch (c) {
144
181
  return console.log(
145
- `${e} failed to migrate from ${o.version} to ${l}`
146
- ), console.error(a), s;
182
+ `${e} failed to migrate from ${n.version} to ${i}`
183
+ ), console.error(c), a;
147
184
  }
148
185
  };
149
- return (o) => {
186
+ return (n) => {
150
187
  try {
151
- if (o.version == null)
152
- if (n != null)
188
+ if (n.version == null)
189
+ if (o != null)
153
190
  console.log(
154
- `${e} version is null. Setting version to default of ${n}`
155
- ), o.version = n;
191
+ `${e} version is null. Setting version to default of ${o}`
192
+ ), n.version = o;
156
193
  else
157
194
  return console.log(
158
195
  `${e} version is null and no default version set. Exiting with default`
159
- ), s;
160
- return i(o);
161
- } catch (a) {
162
- return console.log(`${e} failed to parse final result. Exiting with default`), console.error(a), s;
196
+ ), a;
197
+ return s(n);
198
+ } catch (c) {
199
+ return console.log(`${e} failed to parse final result. Exiting with default`), console.error(c), a;
163
200
  }
164
201
  };
165
- }, X = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
202
+ }, oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
166
203
  __proto__: null,
167
- compareSemVer: g,
204
+ compareSemVer: p,
168
205
  createMigration: Z,
169
206
  migrator: V,
170
- semVerNewer: w,
171
- semVerOlder: D,
172
- semVerZ: E,
173
- versionsEqual: G
174
- }, Symbol.toStringTag, { value: "Module" })), Y = (e) => {
207
+ semVerNewer: E,
208
+ semVerOlder: G,
209
+ semVerZ: M,
210
+ versionsEqual: I
211
+ }, Symbol.toStringTag, { value: "Module" })), ne = (e) => {
175
212
  if (e === void 0 || typeof e == "string" || typeof e == "number")
176
213
  return e;
177
214
  if (e.toString === void 0) throw new Error("invalid renderer");
178
215
  return e.toString();
179
- }, ee = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e !== null ? { ...e } : e, I = (e, t = "") => {
216
+ }, se = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e !== null ? { ...e } : e, J = (e, t = "") => {
180
217
  const r = e.length;
181
218
  return r === 0 ? t : r === 1 ? e[0] : r === 2 ? `${e[0]} and ${e[1]}` : `${e.slice(0, -1).join(", ")}, and ${e[r - 1]}`;
182
219
  }, W = (e) => {
183
- const t = e.split(" "), r = /* @__PURE__ */ new Set(), n = t.map((i) => i.charAt(0).toLowerCase()).join("");
184
- r.add(n), r.add(n.replace(/(.)(.)/g, "$1_$2"));
185
- const s = /\d+/g;
186
- e.match(s) && t.forEach((i, o) => {
187
- if (s.test(i)) {
188
- const a = t.map((b, y) => y !== o ? b.charAt(0).toLowerCase() : b).join("");
189
- r.add(a), r.add(a.replace(/(.)(.)/g, "$1_$2"));
220
+ const t = e.split(" "), r = /* @__PURE__ */ new Set(), o = t.map((s) => s.charAt(0).toLowerCase()).join("");
221
+ r.add(o.replace(/-/g, "_")), r.add(o.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_"));
222
+ const a = /\d+/g;
223
+ e.match(a) && t.forEach((s, n) => {
224
+ if (a.test(s)) {
225
+ const c = t.map((h, S) => S !== n ? h.charAt(0).toLowerCase() : h).join("");
226
+ r.add(c.replace(/-/g, "_")), r.add(
227
+ c.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_")
228
+ );
190
229
  }
191
230
  });
192
231
  const f = t.map(
193
- (i) => (i.length > 3 ? i.substring(0, 3) : i).toLowerCase()
232
+ (s) => (s.length > 3 ? s.substring(0, 3) : s).toLowerCase()
194
233
  );
195
- return r.add(f.join("")), r.add(f.join("_")), Array.from(r).filter(
196
- (i) => i.length >= 2 && i.length <= 12
234
+ return r.add(f.join("").replace(/-/g, "_")), r.add(f.join("_").replace(/-/g, "_")), Array.from(r).filter(
235
+ (s) => s.length >= 2 && s.length <= 12 && !/^\d/.test(s)
197
236
  );
198
- }, re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
237
+ }, ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
199
238
  __proto__: null,
200
- generateShortIdentifiers: W,
201
- naturalLanguageJoin: I
239
+ createShortIdentifiers: W,
240
+ naturalLanguageJoin: J
202
241
  }, Symbol.toStringTag, { value: "Module" }));
203
242
  export {
204
- ie as DataType,
205
- ae as Density,
206
- ce as MultiSeries,
207
- le as Rate,
208
- wr as RoutedWorker,
209
- rr as Search,
210
- ue as Series,
211
- fe as Size,
212
- me as TimeRange,
213
- x as TimeSpan,
214
- de as TimeStamp,
215
- Mr as TypedWorker,
216
- vr as URL,
217
- pe as addSamples,
218
- ne as binary,
219
- qe as bounds,
220
- or as box,
221
- Q as breaker,
222
- Er as buildQueryString,
223
- ve as caseconv,
224
- je as change,
225
- Me as clamp,
226
- Ae as compare,
227
- U as control,
228
- ge as convertDataType,
229
- Y as convertRenderV,
230
- Tr as createMockWorkers,
231
- ze as debounce,
232
- Pe as deep,
233
- sr as dimensions,
234
- ar as direction,
235
- J as errors,
236
- Ue as getEntries,
237
- be as id,
238
- K as invert,
239
- xe as isCrudeSeries,
240
- Ge as isObject,
241
- _e as isStringer,
242
- he as isTelemValue,
243
- Ze as kv,
244
- Ie as link,
245
- lr as location,
246
- Je as mapValues,
247
- Be as math,
248
- X as migrate,
249
- xr as nullToArr,
250
- He as observe,
251
- fr as position,
252
- Oe as primitiveIsZero,
253
- Ye as runtime,
254
- Te as scale,
255
- ee as shallowCopy,
256
- ye as sortTimeRange,
257
- dr as spatial,
258
- re as strings,
259
- Le as throttle,
260
- hr as toArray,
261
- Se as typedArrayZ,
262
- Sr as unique,
263
- Ke as unknownRecordZ,
264
- gr as xy,
265
- Ar as zodutil
243
+ ue as DataType,
244
+ me as Density,
245
+ de as MultiSeries,
246
+ ge as Rate,
247
+ Ar as RoutedWorker,
248
+ ar as Search,
249
+ pe as Series,
250
+ he as Size,
251
+ be as TimeRange,
252
+ b as TimeSpan,
253
+ xe as TimeStamp,
254
+ kr as TypedWorker,
255
+ jr as URL,
256
+ Se as addSamples,
257
+ le as binary,
258
+ He as bounds,
259
+ cr as box,
260
+ X as breaker,
261
+ _r as buildQueryString,
262
+ je as caseconv,
263
+ Oe as change,
264
+ ke as clamp,
265
+ Re as compare,
266
+ Y as control,
267
+ ye as convertDataType,
268
+ ne as convertRenderV,
269
+ Lr as createMockWorkers,
270
+ Ue as debounce,
271
+ Ie as deep,
272
+ fr as dimensions,
273
+ mr as direction,
274
+ ee as errors,
275
+ er as getEntries,
276
+ we as id,
277
+ re as invert,
278
+ ve as isCrudeSeries,
279
+ Ze as isObject,
280
+ Ce as isStringer,
281
+ Me as isTelemValue,
282
+ te as jsonRPC,
283
+ Je as kv,
284
+ qe as link,
285
+ gr as location,
286
+ rr as mapValues,
287
+ Qe as math,
288
+ oe as migrate,
289
+ vr as nullToArr,
290
+ Xe as observe,
291
+ hr as position,
292
+ ze as primitiveIsZero,
293
+ nr as runtime,
294
+ Le as scale,
295
+ se as shallowCopy,
296
+ $e as sortTimeRange,
297
+ xr as spatial,
298
+ ae as strings,
299
+ Be as throttle,
300
+ Mr as toArray,
301
+ Ee as typedArrayZ,
302
+ Er as unique,
303
+ tr as unknownRecordZ,
304
+ yr as xy,
305
+ Rr as zod
266
306
  };
@@ -1 +1 @@
1
- "use strict";const u=require("zod"),I=require("./index-Dd8DLyMx.cjs"),o=require("./base-B48bPNx5.cjs"),R=o.xLocation,g=o.yLocation,h=o.centerLocation,d={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},m={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},A=o.crudeLocation,s=t=>t instanceof String||!o.DIRECTIONS.includes(t)?t:t==="x"?"left":"top",_=t=>d[s(t)],M=t=>m[s(t)],i=t=>{const n=s(t);return n==="top"||n==="bottom"?"y":"x"},E=u.z.object({x:o.xLocation.or(o.centerLocation),y:o.yLocation.or(o.centerLocation)}),l=u.z.object({x:o.xLocation,y:o.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,n)=>t.x===n.x&&t.y===n.y,S=(t,n)=>{if(typeof n=="object"){let e=!0;return"x"in n&&(t.x===n.x||(e=!1)),"y"in n&&(t.y===n.y||(e=!1)),e}return t.x===n||t.y===n},z=t=>[t.x,t.y],y=t=>i(s(t))==="x",P=t=>i(s(t))==="y",X=t=>`${t.x}${I.capitalize(t.y)}`,Y=(t,n)=>{let e,c;if(typeof t=="object"&&"x"in t?(e=t.x,c=t.y):(e=s(t),c=s(n??t)),i(e)===i(c)&&e!=="center"&&c!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${e.toString()} - ${c.toString()}`);const r={...T};return e==="center"?y(c)?[r.x,r.y]=[c,e]:[r.x,r.y]=[e,c]:c==="center"?y(e)?[r.x,r.y]=[e,c]:[r.x,r.y]=[c,e]:y(e)?[r.x,r.y]=[e,c]:[r.x,r.y]=[c,e],r},w=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:L,BOTTOM_LEFT:x,BOTTOM_RIGHT:a,CENTER:T,CENTER_LOCATIONS:o.CENTER_LOCATIONS,LEFT_CENTER:C,RIGHT_CENTER:p,TOP_CENTER:b,TOP_LEFT:O,TOP_RIGHT:f,XY_LOCATIONS:N,X_LOCATIONS:o.X_LOCATIONS,Y_LOCATIONS:o.Y_LOCATIONS,center:h,construct:s,constructXY:Y,corner:l,crude:A,direction:i,isX:y,isY:P,location:o.location,outer:o.outerLocation,rotate90:M,swap:_,x:R,xy:E,xyCouple:z,xyEquals:j,xyMatches:S,xyToString:X,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=w;exports.swap=_;exports.xy=E;exports.xyCouple=z;exports.xyEquals=j;exports.xyMatches=S;
1
+ "use strict";const u=require("zod"),I=require("./index-Dd8DLyMx.cjs"),o=require("./base-BAM2mqCy.cjs"),R=o.xLocation,g=o.yLocation,h=o.centerLocation,d={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},m={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},A=o.crudeLocation,s=t=>t instanceof String||!o.DIRECTIONS.includes(t)?t:t==="x"?"left":"top",_=t=>d[s(t)],M=t=>m[s(t)],i=t=>{const n=s(t);return n==="top"||n==="bottom"?"y":"x"},E=u.z.object({x:o.xLocation.or(o.centerLocation),y:o.yLocation.or(o.centerLocation)}),l=u.z.object({x:o.xLocation,y:o.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,n)=>t.x===n.x&&t.y===n.y,S=(t,n)=>{if(typeof n=="object"){let e=!0;return"x"in n&&(t.x===n.x||(e=!1)),"y"in n&&(t.y===n.y||(e=!1)),e}return t.x===n||t.y===n},z=t=>[t.x,t.y],y=t=>i(s(t))==="x",P=t=>i(s(t))==="y",X=t=>`${t.x}${I.capitalize(t.y)}`,Y=(t,n)=>{let e,c;if(typeof t=="object"&&"x"in t?(e=t.x,c=t.y):(e=s(t),c=s(n??t)),i(e)===i(c)&&e!=="center"&&c!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${e.toString()} - ${c.toString()}`);const r={...T};return e==="center"?y(c)?[r.x,r.y]=[c,e]:[r.x,r.y]=[e,c]:c==="center"?y(e)?[r.x,r.y]=[e,c]:[r.x,r.y]=[c,e]:y(e)?[r.x,r.y]=[e,c]:[r.x,r.y]=[c,e],r},w=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:L,BOTTOM_LEFT:x,BOTTOM_RIGHT:a,CENTER:T,CENTER_LOCATIONS:o.CENTER_LOCATIONS,LEFT_CENTER:C,RIGHT_CENTER:p,TOP_CENTER:b,TOP_LEFT:O,TOP_RIGHT:f,XY_LOCATIONS:N,X_LOCATIONS:o.X_LOCATIONS,Y_LOCATIONS:o.Y_LOCATIONS,center:h,construct:s,constructXY:Y,corner:l,crude:A,direction:i,isX:y,isY:P,location:o.location,outer:o.outerLocation,rotate90:M,swap:_,x:R,xy:E,xyCouple:z,xyEquals:j,xyMatches:S,xyToString:X,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=w;exports.swap=_;exports.xy=E;exports.xyCouple=z;exports.xyEquals=j;exports.xyMatches=S;
@@ -1,7 +1,7 @@
1
1
  import { z as O } from "zod";
2
2
  import { c as m } from "./index-DizUWH6z.js";
3
- import { e as a, f, y, g, D as C, C as z, X as L, Y as h, l as S, h as d } from "./base-DnZzEvvz.js";
4
- const N = a, R = y, I = f, X = {
3
+ import { y as a, e as y, f, g, D as C, C as z, X as L, Y as h, l as S, h as d } from "./base-DFq0vvGn.js";
4
+ const N = y, R = a, I = f, X = {
5
5
  top: "bottom",
6
6
  right: "left",
7
7
  bottom: "top",
@@ -17,9 +17,9 @@ const N = a, R = y, I = f, X = {
17
17
  const o = r(t);
18
18
  return o === "top" || o === "bottom" ? "y" : "x";
19
19
  }, w = O.object({
20
- x: a.or(f),
21
- y: y.or(f)
22
- }), M = O.object({ x: a, y }), 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" }), x = 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" }), $ = Object.freeze([
20
+ x: y.or(f),
21
+ y: a.or(f)
22
+ }), M = O.object({ x: y, 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" }), x = 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" }), $ = Object.freeze([
23
23
  j,
24
24
  E,
25
25
  p,
package/dist/location.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./location-BIet4Mig.cjs");exports.location=o.location;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./location-BgpQ3rN2.cjs");exports.location=o.location;
package/dist/location.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l } from "./location-BVkZhfQG.js";
1
+ import { l } from "./location-BuYbIFHD.js";
2
2
  export {
3
3
  l as location
4
4
  };
@@ -0,0 +1 @@
1
+ "use strict";const n=require("./box-Bzya27QS.cjs"),T=require("./direction-C-b6XTeU.cjs"),r=require("./location-BgpQ3rN2.cjs"),b=require("./base-BAM2mqCy.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;