@synnaxlabs/x 0.48.0 → 0.49.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 (243) hide show
  1. package/.turbo/turbo-build.log +6 -104
  2. package/dist/src/deep/join.d.ts.map +1 -0
  3. package/dist/src/deep/path.d.ts +1 -1
  4. package/dist/src/deep/path.d.ts.map +1 -1
  5. package/dist/src/destructor/destructor.d.ts +7 -0
  6. package/dist/src/destructor/destructor.d.ts.map +1 -0
  7. package/dist/src/destructor/index.d.ts +2 -0
  8. package/dist/src/destructor/index.d.ts.map +1 -0
  9. package/dist/src/index.d.ts +5 -10
  10. package/dist/src/index.d.ts.map +1 -1
  11. package/dist/src/math/constants.d.ts +1 -0
  12. package/dist/src/math/constants.d.ts.map +1 -1
  13. package/dist/src/migrate/migrate.d.ts +3 -3
  14. package/dist/src/migrate/migrate.d.ts.map +1 -1
  15. package/dist/src/narrow/index.d.ts +2 -0
  16. package/dist/src/narrow/index.d.ts.map +1 -0
  17. package/dist/src/narrow/narrow.d.ts +4 -0
  18. package/dist/src/narrow/narrow.d.ts.map +1 -0
  19. package/dist/src/narrow/narrow.spec.d.ts +2 -0
  20. package/dist/src/narrow/narrow.spec.d.ts.map +1 -0
  21. package/dist/src/numeric/numeric.d.ts +0 -1
  22. package/dist/src/numeric/numeric.d.ts.map +1 -1
  23. package/dist/src/observe/observe.d.ts +4 -4
  24. package/dist/src/observe/observe.d.ts.map +1 -1
  25. package/dist/src/optional/index.d.ts +2 -0
  26. package/dist/src/optional/index.d.ts.map +1 -0
  27. package/dist/src/optional/optional.d.ts.map +1 -0
  28. package/dist/src/scheduler/index.d.ts +2 -0
  29. package/dist/src/scheduler/index.d.ts.map +1 -0
  30. package/dist/src/{flush.d.ts → scheduler/scheduler.d.ts} +1 -1
  31. package/dist/src/scheduler/scheduler.d.ts.map +1 -0
  32. package/dist/src/scheduler/scheduler.spec.d.ts +2 -0
  33. package/dist/src/scheduler/scheduler.spec.d.ts.map +1 -0
  34. package/dist/src/shallow/copy.d.ts +2 -0
  35. package/dist/src/shallow/copy.d.ts.map +1 -0
  36. package/dist/src/shallow/copy.spec.d.ts +2 -0
  37. package/dist/src/shallow/copy.spec.d.ts.map +1 -0
  38. package/dist/src/shallow/index.d.ts +2 -0
  39. package/dist/src/shallow/index.d.ts.map +1 -0
  40. package/dist/src/spatial/base.d.ts +5 -38
  41. package/dist/src/spatial/base.d.ts.map +1 -1
  42. package/dist/src/spatial/direction/direction.d.ts +2 -1
  43. package/dist/src/spatial/direction/direction.d.ts.map +1 -1
  44. package/dist/src/spatial/external.d.ts +2 -1
  45. package/dist/src/spatial/external.d.ts.map +1 -1
  46. package/dist/src/spatial/location/location.d.ts +2 -2
  47. package/dist/src/spatial/location/location.d.ts.map +1 -1
  48. package/dist/src/spatial/sticky/index.d.ts +2 -0
  49. package/dist/src/spatial/sticky/index.d.ts.map +1 -0
  50. package/dist/src/spatial/sticky/sticky.d.ts +74 -0
  51. package/dist/src/spatial/sticky/sticky.d.ts.map +1 -0
  52. package/dist/src/spatial/sticky/sticky.spec.d.ts +2 -0
  53. package/dist/src/spatial/sticky/sticky.spec.d.ts.map +1 -0
  54. package/dist/src/spatial/xy/xy.d.ts +10 -2
  55. package/dist/src/spatial/xy/xy.d.ts.map +1 -1
  56. package/dist/src/status/status.d.ts +2 -2
  57. package/dist/src/status/status.d.ts.map +1 -1
  58. package/dist/src/telem/series.d.ts +4 -4
  59. package/dist/src/telem/series.d.ts.map +1 -1
  60. package/dist/src/telem/telem.d.ts +0 -1
  61. package/dist/src/telem/telem.d.ts.map +1 -1
  62. package/dist/src/types/index.d.ts +2 -0
  63. package/dist/src/types/index.d.ts.map +1 -0
  64. package/dist/src/zod/external.d.ts +1 -0
  65. package/dist/src/zod/external.d.ts.map +1 -1
  66. package/dist/src/zod/schemas.d.ts +3 -0
  67. package/dist/src/zod/schemas.d.ts.map +1 -0
  68. package/dist/src/zod/schemas.spec.d.ts +2 -0
  69. package/dist/src/zod/schemas.spec.d.ts.map +1 -0
  70. package/dist/x.cjs +12 -0
  71. package/dist/x.js +5521 -0
  72. package/package.json +6 -144
  73. package/src/binary/codec.ts +2 -2
  74. package/src/deep/merge.ts +3 -3
  75. package/src/deep/path.ts +1 -1
  76. package/src/{destructor.ts → destructor/destructor.ts} +1 -1
  77. package/src/{invert.ts → destructor/index.ts} +1 -1
  78. package/src/index.ts +5 -10
  79. package/src/math/constants.ts +1 -0
  80. package/src/migrate/migrate.ts +5 -3
  81. package/src/{mock → narrow}/index.ts +1 -1
  82. package/src/narrow/narrow.spec.ts +70 -0
  83. package/src/{identity.ts → narrow/narrow.ts} +6 -0
  84. package/src/numeric/numeric.ts +0 -5
  85. package/src/observe/observe.ts +4 -4
  86. package/src/{replace.ts → optional/index.ts} +1 -1
  87. package/src/scheduler/index.ts +10 -0
  88. package/src/scheduler/scheduler.spec.ts +82 -0
  89. package/src/shallow/copy.spec.ts +141 -0
  90. package/src/{shallowCopy.ts → shallow/copy.ts} +1 -1
  91. package/src/shallow/index.ts +10 -0
  92. package/src/spatial/base.ts +6 -15
  93. package/src/spatial/direction/direction.ts +2 -0
  94. package/src/spatial/external.ts +2 -1
  95. package/src/spatial/location/location.spec.ts +16 -0
  96. package/src/spatial/location/location.ts +7 -7
  97. package/src/spatial/sticky/index.ts +10 -0
  98. package/src/spatial/sticky/sticky.spec.ts +584 -0
  99. package/src/spatial/sticky/sticky.ts +98 -0
  100. package/src/spatial/xy/xy.spec.ts +55 -0
  101. package/src/spatial/xy/xy.ts +27 -2
  102. package/src/status/status.ts +5 -5
  103. package/src/telem/series.ts +5 -6
  104. package/src/telem/telem.spec.ts +0 -28
  105. package/src/telem/telem.ts +1 -9
  106. package/src/{clamp → types}/index.ts +1 -1
  107. package/src/zod/external.ts +1 -0
  108. package/src/zod/schemas.spec.ts +51 -0
  109. package/src/zod/schemas.ts +14 -0
  110. package/tsconfig.tsbuildinfo +1 -1
  111. package/vite.config.ts +1 -36
  112. package/dist/array.cjs +0 -1
  113. package/dist/array.js +0 -4
  114. package/dist/base-DRybODwJ.js +0 -42
  115. package/dist/base-KIBsp6TI.cjs +0 -1
  116. package/dist/binary.cjs +0 -1
  117. package/dist/binary.js +0 -4
  118. package/dist/bounds-4BWKPqaP.js +0 -183
  119. package/dist/bounds-C2TKFgVk.cjs +0 -1
  120. package/dist/bounds.cjs +0 -1
  121. package/dist/bounds.js +0 -4
  122. package/dist/box-BXWXSkKu.js +0 -203
  123. package/dist/box-rH3ggwXk.cjs +0 -1
  124. package/dist/box.cjs +0 -1
  125. package/dist/box.js +0 -4
  126. package/dist/caseconv.cjs +0 -1
  127. package/dist/caseconv.js +0 -4
  128. package/dist/change-C-YELKx6.cjs +0 -1
  129. package/dist/change-DLl6DccR.js +0 -12
  130. package/dist/change.cjs +0 -1
  131. package/dist/change.js +0 -4
  132. package/dist/compare-Bnx9CdjS.js +0 -119
  133. package/dist/compare-GPoFaKRW.cjs +0 -1
  134. package/dist/compare.cjs +0 -1
  135. package/dist/compare.js +0 -36
  136. package/dist/debounce.cjs +0 -1
  137. package/dist/debounce.js +0 -17
  138. package/dist/deep.cjs +0 -1
  139. package/dist/deep.js +0 -247
  140. package/dist/destructor.cjs +0 -1
  141. package/dist/destructor.js +0 -1
  142. package/dist/dimensions-Cg5Owbwn.cjs +0 -1
  143. package/dist/dimensions-DC0uLPwn.js +0 -43
  144. package/dist/dimensions.cjs +0 -1
  145. package/dist/dimensions.js +0 -4
  146. package/dist/direction-C_b4tfRN.js +0 -19
  147. package/dist/direction-DqQB9M37.cjs +0 -1
  148. package/dist/direction.cjs +0 -1
  149. package/dist/direction.js +0 -4
  150. package/dist/external-2YWy569j.js +0 -23
  151. package/dist/external-B6edOwoQ.cjs +0 -1
  152. package/dist/external-B80i4ymZ.js +0 -29
  153. package/dist/external-B9AAGv50.cjs +0 -1
  154. package/dist/external-BYuXBYJh.js +0 -40
  155. package/dist/external-BxmTQZ6m.cjs +0 -1
  156. package/dist/external-DLiGrXn7.cjs +0 -1
  157. package/dist/external-Du5qzfYv.js +0 -35
  158. package/dist/get-CtJEJIC_.js +0 -82
  159. package/dist/get-D2VRwUw4.cjs +0 -1
  160. package/dist/identity.cjs +0 -1
  161. package/dist/identity.js +0 -4
  162. package/dist/index-Bfvg0v-N.cjs +0 -3
  163. package/dist/index-Bv029kh3.js +0 -19
  164. package/dist/index-CqisIWWC.cjs +0 -1
  165. package/dist/index-CyNZHQFw.cjs +0 -1
  166. package/dist/index-qmkoZBNO.js +0 -57
  167. package/dist/index-yz34Wc2p.js +0 -92
  168. package/dist/index.cjs +0 -5
  169. package/dist/index.js +0 -1004
  170. package/dist/kv.cjs +0 -1
  171. package/dist/kv.js +0 -4
  172. package/dist/link.cjs +0 -1
  173. package/dist/link.js +0 -10
  174. package/dist/location-0qDBiCqP.cjs +0 -1
  175. package/dist/location-BIzpxczO.js +0 -95
  176. package/dist/location.cjs +0 -1
  177. package/dist/location.js +0 -4
  178. package/dist/observe.cjs +0 -1
  179. package/dist/observe.js +0 -48
  180. package/dist/record-BwjIgrpU.cjs +0 -1
  181. package/dist/record-tSFQKmdG.js +0 -19
  182. package/dist/record.cjs +0 -1
  183. package/dist/record.js +0 -4
  184. package/dist/runtime.cjs +0 -1
  185. package/dist/runtime.js +0 -4
  186. package/dist/scale-BXy1w8R_.cjs +0 -1
  187. package/dist/scale-DJCMZbfU.js +0 -228
  188. package/dist/scale.cjs +0 -1
  189. package/dist/scale.js +0 -4
  190. package/dist/series-B7l2au4y.cjs +0 -6
  191. package/dist/series-TpAaBlEg.js +0 -2837
  192. package/dist/spatial-DnsaOypA.js +0 -11
  193. package/dist/spatial-DrxzaD5U.cjs +0 -1
  194. package/dist/spatial.cjs +0 -1
  195. package/dist/spatial.js +0 -18
  196. package/dist/src/clamp/index.d.ts +0 -2
  197. package/dist/src/clamp/index.d.ts.map +0 -1
  198. package/dist/src/destructor.d.ts +0 -7
  199. package/dist/src/destructor.d.ts.map +0 -1
  200. package/dist/src/flush.d.ts.map +0 -1
  201. package/dist/src/identity.d.ts +0 -3
  202. package/dist/src/identity.d.ts.map +0 -1
  203. package/dist/src/invert.d.ts +0 -2
  204. package/dist/src/invert.d.ts.map +0 -1
  205. package/dist/src/join.d.ts.map +0 -1
  206. package/dist/src/mock/index.d.ts +0 -2
  207. package/dist/src/mock/index.d.ts.map +0 -1
  208. package/dist/src/optional.d.ts.map +0 -1
  209. package/dist/src/renderable.d.ts +0 -5
  210. package/dist/src/renderable.d.ts.map +0 -1
  211. package/dist/src/replace.d.ts +0 -2
  212. package/dist/src/replace.d.ts.map +0 -1
  213. package/dist/src/shallowCopy.d.ts +0 -2
  214. package/dist/src/shallowCopy.d.ts.map +0 -1
  215. package/dist/src/telem/generate.d.ts +0 -3
  216. package/dist/src/telem/generate.d.ts.map +0 -1
  217. package/dist/src/transform.d.ts +0 -6
  218. package/dist/src/transform.d.ts.map +0 -1
  219. package/dist/src/undefined.d.ts +0 -2
  220. package/dist/src/undefined.d.ts.map +0 -1
  221. package/dist/telem.cjs +0 -1
  222. package/dist/telem.js +0 -18
  223. package/dist/unique.cjs +0 -1
  224. package/dist/unique.js +0 -4
  225. package/dist/url.cjs +0 -1
  226. package/dist/url.js +0 -51
  227. package/dist/worker.cjs +0 -1
  228. package/dist/worker.js +0 -43
  229. package/dist/xy-C-MUIjVs.cjs +0 -1
  230. package/dist/xy-DnrCAZaw.js +0 -154
  231. package/dist/xy.cjs +0 -1
  232. package/dist/xy.js +0 -4
  233. package/dist/zod.cjs +0 -1
  234. package/dist/zod.js +0 -4
  235. package/src/renderable.ts +0 -20
  236. package/src/telem/generate.ts +0 -17
  237. package/src/transform.ts +0 -17
  238. package/src/undefined.ts +0 -14
  239. /package/dist/src/{join.d.ts → deep/join.d.ts} +0 -0
  240. /package/dist/src/{optional.d.ts → optional/optional.d.ts} +0 -0
  241. /package/src/{join.ts → deep/join.ts} +0 -0
  242. /package/src/{optional.ts → optional/optional.ts} +0 -0
  243. /package/src/{flush.ts → scheduler/scheduler.ts} +0 -0
package/dist/index.js DELETED
@@ -1,1004 +0,0 @@
1
- import { n as je } from "./external-Du5qzfYv.js";
2
- import { e as cn } from "./external-Du5qzfYv.js";
3
- import { J as Ne } from "./index-yz34Wc2p.js";
4
- import { c as un } from "./index-yz34Wc2p.js";
5
- import m, { z as c } from "zod";
6
- import { h as Ie, j as Ee, k as Oe, l as Ae, m as ke, o as Pe, p as Re, q as Ze, r as Ce, s as Le, u as Ue, v as qe, w as ze, x as We, y as De, a as M, T as J, z as Be } from "./series-TpAaBlEg.js";
7
- import { c as dn, D as mn, M as hn, R as pn, S as gn, d as bn, b as _n, g as yn, f as wn, A as Mn, B as vn, i as Sn, e as xn, n as Tn, t as $n, C as jn } from "./series-TpAaBlEg.js";
8
- import { a as In } from "./index-qmkoZBNO.js";
9
- import { c as On } from "./change-DLl6DccR.js";
10
- import { c as kn, s as Pn } from "./scale-DJCMZbfU.js";
11
- import { compare as Zn } from "./compare.js";
12
- import { debounce as Ln, throttle as Un } from "./debounce.js";
13
- import { deep as zn } from "./deep.js";
14
- import { isObject as Dn } from "./identity.js";
15
- import { e as Fn } from "./external-BYuXBYJh.js";
16
- import { link as Hn } from "./link.js";
17
- import { i as Q, j as Fe, a as Ve, k as He, d as Xe, l as Ge, n as Je, o as Qe, p as Ye, m as Ke, r as et, s as tt } from "./bounds-4BWKPqaP.js";
18
- import { b as Gn } from "./bounds-4BWKPqaP.js";
19
- import { a as rt, b as nt, c as st, L as p, G as g, E as Y } from "./compare-Bnx9CdjS.js";
20
- import { p as Qn } from "./compare-Bnx9CdjS.js";
21
- import { observe as Kn } from "./observe.js";
22
- import { r as ts } from "./record-tSFQKmdG.js";
23
- import { e as ns } from "./external-B80i4ymZ.js";
24
- import { b as os } from "./box-BXWXSkKu.js";
25
- import { d as as } from "./dimensions-DC0uLPwn.js";
26
- import { d as ls } from "./direction-C_b4tfRN.js";
27
- import { l as fs } from "./location-BIzpxczO.js";
28
- import { s as ms } from "./spatial-DnsaOypA.js";
29
- import { x as ps } from "./xy-DnrCAZaw.js";
30
- import { a as bs } from "./index-Bv029kh3.js";
31
- import { URL as ys, buildQueryString as ws } from "./url.js";
32
- import { RoutedWorker as vs, TypedWorker as Ss, createMockWorkers as xs } from "./worker.js";
33
- import { e as $s } from "./external-2YWy569j.js";
34
- const L = 2, U = 3, K = 2, ot = (e, t) => {
35
- if (Number.isNaN(e) || !Number.isFinite(e)) return e;
36
- const r = Q(t);
37
- if (r == 0) return e;
38
- let n;
39
- r >= 1e3 ? n = L : r >= 1 ? n = U : n = Math.ceil(-Math.log10(r)) + K;
40
- const s = 10 ** n;
41
- return Math.round(e * s) / s;
42
- }, it = 5, at = 1e-10, ct = (e, t) => {
43
- if (Number.isNaN(e) || !Number.isFinite(e)) return e;
44
- const r = Math.abs(e);
45
- if (r === 0) return 0;
46
- let n = !1, s = 0;
47
- if (t != null) {
48
- s = Q(t);
49
- const i = s / r;
50
- n = s > 0 && i > at;
51
- }
52
- if (n) {
53
- let i;
54
- s >= 1e3 ? i = L : s >= 1 ? i = U : i = Math.ceil(-Math.log10(s)) + K;
55
- const l = 10 ** i;
56
- return Math.round(e * l) / l;
57
- }
58
- if (r >= 1e3) {
59
- const i = 10 ** L;
60
- return Math.round(e * i) / i;
61
- }
62
- if (r >= 1) {
63
- const i = 10 ** U;
64
- return Math.round(e * i) / i;
65
- }
66
- const o = Math.floor(Math.log10(r)), f = 10 ** (it - o - 1);
67
- return Math.round(e * f) / f;
68
- }, Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
69
- __proto__: null,
70
- MAX_INT16: Ie,
71
- MAX_INT32: Ee,
72
- MAX_INT64: Oe,
73
- MAX_INT64_NUMBER: Ae,
74
- MAX_INT8: ke,
75
- MAX_UINT16: Pe,
76
- MAX_UINT32: Re,
77
- MAX_UINT64: Ze,
78
- MAX_UINT64_NUMBER: Ce,
79
- MAX_UINT8: Le,
80
- MIN_INT16: Ue,
81
- MIN_INT32: qe,
82
- MIN_INT64: ze,
83
- MIN_INT64_NUMBER: We,
84
- MIN_INT8: De,
85
- abs: Fe,
86
- add: Ve,
87
- closeTo: He,
88
- div: Xe,
89
- equal: Ge,
90
- isInteger: Je,
91
- max: Qe,
92
- min: Ye,
93
- mult: Ke,
94
- roundBySpan: ot,
95
- roundToNearestMagnitude: et,
96
- smartRound: ct,
97
- sub: tt
98
- }, Symbol.toStringTag, { value: "Module" })), ee = async (e) => await new Promise(
99
- (t) => setTimeout(t, M.fromMilliseconds(e).milliseconds)
100
- ), Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
101
- __proto__: null,
102
- sleep: ee
103
- }, Symbol.toStringTag, { value: "Module" }));
104
- class lt {
105
- config;
106
- retries;
107
- interval;
108
- constructor(t) {
109
- this.config = {
110
- baseInterval: new M(t?.baseInterval ?? M.seconds(1)),
111
- maxRetries: t?.maxRetries ?? 5,
112
- scale: t?.scale ?? 1,
113
- sleepFn: t?.sleepFn ?? ee
114
- }, this.retries = 0, this.interval = new M(this.config.baseInterval);
115
- }
116
- async wait() {
117
- const { maxRetries: t, scale: r, sleepFn: n } = this.config;
118
- return this.retries >= t ? !1 : (await n(this.interval), this.interval = this.interval.mult(r), this.retries++, !0);
119
- }
120
- get retryMessage() {
121
- return `breaker triggered ${this.retries + 1}/${this.config.maxRetries} times, retrying in ${this.interval.toString()}`;
122
- }
123
- reset() {
124
- this.retries = 0, this.interval = this.config.baseInterval;
125
- }
126
- }
127
- const ut = c.object({
128
- baseInterval: M.z.optional(),
129
- maxRetries: c.number().optional(),
130
- scale: c.number().optional()
131
- }), qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
132
- __proto__: null,
133
- Breaker: lt,
134
- breakerConfigZ: ut
135
- }, Symbol.toStringTag, { value: "Module" })), ft = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, k = c.string().regex(ft), y = c.number().min(0).max(255), te = c.number().min(0).max(1), P = c.tuple([y, y, y, te]), dt = c.tuple([y, y, y]), mt = c.object({ rgba255: P }), ht = c.number().min(0).max(360), pt = c.number().min(0).max(100), gt = c.number().min(0).max(100), re = c.tuple([ht, pt, gt, te]), R = c.union([k, dt, P, re, mt]), Z = R.transform((e) => d(e)), bt = (e) => Z.safeParse(e).success, _t = (e) => P.safeParse(e).success, yt = ((e) => {
136
- if (e == null) return;
137
- const t = Z.safeParse(e);
138
- if (t.success) return se(t.data);
139
- if (typeof e == "string") return e;
140
- throw t.error;
141
- }), d = (e, t = 1) => {
142
- if (e = R.parse(e), typeof e == "string") return A(e, t);
143
- if (Array.isArray(e)) {
144
- if (e.length < 3 || e.length > 4)
145
- throw new Error(`Invalid color: [${e.join(", ")}]`);
146
- return e.length === 3 ? [...e, t] : e;
147
- }
148
- return e.rgba255;
149
- }, ne = (e, t) => {
150
- if (e == null || t == null) return e == t;
151
- const r = d(e), n = d(t);
152
- return r.every((s, o) => s === n[o]);
153
- }, wt = ((e) => {
154
- if (e == null) return;
155
- const [t, r, n, s] = d(e);
156
- return `#${E(t)}${E(r)}${E(n)}${s === 1 ? "" : E(s * 255)}`;
157
- }), se = (e) => {
158
- const [t, r, n, s] = d(e);
159
- return `rgba(${t}, ${r}, ${n}, ${s})`;
160
- }, Mt = (e) => `rgb(${oe(e)})`, oe = (e) => {
161
- const [t, r, n] = d(e);
162
- return `${t}, ${r}, ${n}`;
163
- }, vt = (e) => [...B(e), T(e)], B = (e) => [
164
- v(e) / 255,
165
- S(e) / 255,
166
- x(e) / 255
167
- ], v = (e) => d(e)[0], S = (e) => d(e)[1], x = (e) => d(e)[2], T = (e) => d(e)[3], St = (e) => ne(F, e), xt = (e) => kt(d(e)), Tt = (e, t) => {
168
- const [r, n, s] = d(e);
169
- if (t > 100)
170
- throw new Error(`Color opacity must be between 0 and 100, got ${t}`);
171
- return t > 1 && (t /= 100), [r, n, s, t];
172
- }, $ = (e) => {
173
- const [t, r, n] = B(e).map(
174
- (s) => s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4
175
- );
176
- return Number((0.2126 * t + 0.7152 * r + 0.0722 * n).toFixed(3));
177
- }, $t = (e) => {
178
- const [t, r, n] = B(e);
179
- return 1 - (Math.max(t, r, n) - Math.min(t, r, n));
180
- }, q = (e, t) => {
181
- const r = d(e), n = d(t), s = $(r), o = $(n);
182
- return (Math.max(s, o) + 0.5) / (Math.min(s, o) + 0.5);
183
- }, jt = (e, ...t) => {
184
- if (t.length === 0)
185
- throw new Error("[Color.pickByContrast] - must provide at least one color");
186
- const r = d(e), [n] = t.sort((s, o) => q(r, o) - q(r, s));
187
- return d(n);
188
- }, Nt = (e) => $(e) < 0.5, It = (e) => $(e) > 0.5, A = (e, t = 1) => (e = k.parse(e), e = Et(e), [
189
- O(e, 0),
190
- O(e, 2),
191
- O(e, 4),
192
- e.length === 8 ? O(e, 6) / 255 : t
193
- ]), F = [0, 0, 0, 0], E = (e) => Math.floor(e).toString(16).padStart(2, "0"), O = (e, t) => parseInt(e.slice(t, t + 2), 16), Et = (e) => e.startsWith("#") ? e.slice(1) : e, G = {
194
- black: "#000000",
195
- white: "#ffffff",
196
- red: "#ff0000",
197
- green: "#008000",
198
- blue: "#0000ff",
199
- yellow: "#ffff00",
200
- cyan: "#00ffff",
201
- magenta: "#ff00ff",
202
- silver: "#c0c0c0",
203
- gray: "#808080",
204
- grey: "#808080",
205
- maroon: "#800000",
206
- olive: "#808000",
207
- lime: "#00ff00",
208
- aqua: "#00ffff",
209
- teal: "#008080",
210
- navy: "#000080",
211
- fuchsia: "#ff00ff",
212
- purple: "#800080",
213
- orange: "#ffa500",
214
- brown: "#a52a2a",
215
- tan: "#d2b48c",
216
- gold: "#ffd700",
217
- indigo: "#4b0082",
218
- violet: "#ee82ee",
219
- pink: "#ffc0cb",
220
- coral: "#ff7f50",
221
- salmon: "#fa8072",
222
- khaki: "#f0e68c",
223
- crimson: "#dc143c",
224
- transparent: "transparent"
225
- }, Ot = (e) => {
226
- if (!e) return;
227
- const t = e.trim().toLowerCase();
228
- if (!(t === "transparent" || t === "none")) {
229
- if (t.startsWith("#")) {
230
- if (t.length === 4) {
231
- const r = t[1], n = t[2], s = t[3], o = `#${r}${r}${n}${n}${s}${s}`;
232
- if (k.safeParse(o).success) return A(o);
233
- }
234
- return (t.length === 7 || t.length === 9) && k.safeParse(t).success ? A(t) : void 0;
235
- }
236
- if (t.startsWith("rgb")) {
237
- const r = t.match(
238
- /rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/
239
- );
240
- if (r) {
241
- const [, n, s, o, a] = r;
242
- return [parseInt(n), parseInt(s), parseInt(o), a ? parseFloat(a) : 1];
243
- }
244
- }
245
- if (G[t]) return A(G[t]);
246
- }
247
- }, At = (e) => {
248
- e = re.parse(e);
249
- let [t, r, n] = e;
250
- const s = e[3];
251
- t /= 360, r /= 100, n /= 100;
252
- let o, a, f;
253
- if (r === 0)
254
- o = a = f = n;
255
- else {
256
- const i = n < 0.5 ? n * (1 + r) : n + r - n * r, l = 2 * n - i;
257
- o = C(l, i, t + 1 / 3), a = C(l, i, t), f = C(l, i, t - 1 / 3);
258
- }
259
- return [Math.round(o * 255), Math.round(a * 255), Math.round(f * 255), s];
260
- }, C = (e, t, r) => (r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? e + (t - e) * 6 * r : r < 1 / 2 ? t : r < 2 / 3 ? e + (t - e) * (2 / 3 - r) * 6 : e), kt = (e) => {
261
- e = P.parse(e);
262
- let [t, r, n] = e;
263
- const s = e[3];
264
- t /= 255, r /= 255, n /= 255;
265
- const o = Math.max(t, r, n), a = Math.min(t, r, n);
266
- let f, i, l = (o + a) / 2;
267
- if (o === a)
268
- f = i = 0;
269
- else {
270
- const u = o - a;
271
- i = l > 0.5 ? u / (2 - o - a) : u / (o + a), o === t ? f = (r - n) / u + (r < n ? 6 : 0) : o === r ? f = (n - t) / u + 2 : f = (t - r) / u + 4, f /= 6;
272
- }
273
- return f *= 360, i *= 100, l *= 100, [Math.round(f), Math.round(i), Math.round(l), s];
274
- }, Pt = d("#000000"), Rt = d("#ffffff"), ie = c.object({
275
- key: c.string(),
276
- color: R,
277
- position: c.number(),
278
- switched: c.boolean().optional()
279
- }), Zt = c.array(ie), Ct = (e, t) => {
280
- if (e.length === 0) return F;
281
- if (e = e.slice().sort((r, n) => r.position - n.position), t <= e[0].position) return d(e[0].color);
282
- if (t >= e[e.length - 1].position)
283
- return d(e[e.length - 1].color);
284
- for (let r = 0; r < e.length - 1; r++) {
285
- const n = e[r], s = e[r + 1];
286
- if (t < n.position || t > s.position) continue;
287
- if (t === n.position) return d(n.color);
288
- if (t === s.position) return d(s.color);
289
- const o = (t - n.position) / (s.position - n.position), a = d(n.color), f = d(s.color), i = Math.round(
290
- v(a) + o * (v(f) - v(a))
291
- ), l = Math.round(
292
- S(a) + o * (S(f) - S(a))
293
- ), u = Math.round(
294
- x(a) + o * (x(f) - x(a))
295
- ), h = T(a) + o * (T(f) - T(a));
296
- return d([i, l, u, h]);
297
- }
298
- return d(e[e.length - 1].color);
299
- }, Lt = c.object({
300
- key: c.string(),
301
- name: c.string(),
302
- color: Z
303
- }), Ut = c.object({
304
- key: c.string(),
305
- name: c.string(),
306
- swatches: c.array(Lt)
307
- }), zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
308
- __proto__: null,
309
- BLACK: Pt,
310
- WHITE: Rt,
311
- ZERO: F,
312
- aValue: T,
313
- bValue: x,
314
- colorZ: Z,
315
- construct: d,
316
- contrast: q,
317
- crudeZ: R,
318
- cssString: yt,
319
- equals: ne,
320
- fromCSS: Ot,
321
- fromGradient: Ct,
322
- fromHSLA: At,
323
- gValue: S,
324
- gradientZ: Zt,
325
- grayness: $t,
326
- hex: wt,
327
- hsla: xt,
328
- isColor: _t,
329
- isCrude: bt,
330
- isDark: Nt,
331
- isLight: It,
332
- isZero: St,
333
- luminance: $,
334
- paletteZ: Ut,
335
- pickByContrast: jt,
336
- rValue: v,
337
- rgbCSS: Mt,
338
- rgbString: oe,
339
- rgba1: vt,
340
- rgbaCSS: se,
341
- setAlpha: Tt,
342
- stopZ: ie
343
- }, Symbol.toStringTag, { value: "Module" })), ae = c.int().min(0).max(255), ce = 255, le = 0, qt = {
344
- lower: le,
345
- upper: ce + 1
346
- }, ue = c.object({
347
- name: c.string(),
348
- key: c.string()
349
- }), j = (e) => c.object({
350
- subject: ue,
351
- resource: e,
352
- authority: ae
353
- }), zt = (...e) => (t) => t.filter((r) => {
354
- let n = !1;
355
- return r.to != null && (n = e.includes(r.to.resource)), r.from != null && !n && (n = e.includes(r.from.resource)), n;
356
- }), fe = (e) => c.object({
357
- from: j(e),
358
- to: c.null()
359
- }), de = (e) => c.object({
360
- from: c.null(),
361
- to: j(e)
362
- }), Wt = (e) => c.union([
363
- fe(e),
364
- de(e),
365
- c.object({
366
- from: j(e),
367
- to: j(e)
368
- })
369
- ]), Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
370
- __proto__: null,
371
- ABSOLUTE_AUTHORITY: ce,
372
- AUTHORITY_BOUNDS: qt,
373
- ZERO_AUTHORITY: le,
374
- acquireZ: de,
375
- authorityZ: ae,
376
- filterTransfersByChannelKey: zt,
377
- releaseZ: fe,
378
- stateZ: j,
379
- subjectZ: ue,
380
- transferZ: Wt
381
- }, Symbol.toStringTag, { value: "Module" })), Dt = /[",\n]/, Bt = (e) => Dt.test(e) ? `"${e.replace(/"/g, '""')}"` : e, Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
382
- __proto__: null,
383
- maybeEscapeField: Bt
384
- }, Symbol.toStringTag, { value: "Module" })), Ft = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), Vt = (e, t) => {
385
- const r = Symbol.for(e);
386
- if (!Ft(r)) {
387
- const n = t();
388
- Object.defineProperty(globalThis, r, { value: n });
389
- }
390
- return () => globalThis[r];
391
- }, me = "sy_x_error", Ht = (e) => (t) => t != null && typeof t == "object" && "type" in t && typeof t.type == "string" ? t.type.startsWith(e) : t instanceof Error ? t.message.startsWith(e) : typeof t != "string" ? !1 : t.startsWith(e), N = (e) => class w extends Error {
392
- static discriminator = me;
393
- discriminator = w.discriminator;
394
- static TYPE = e;
395
- type = w.TYPE;
396
- static matches = Ht(e);
397
- matches = w.matches;
398
- constructor(r, n) {
399
- super(r, n), this.name = w.TYPE;
400
- }
401
- static sub(r) {
402
- return N(`${e}.${r}`);
403
- }
404
- }, he = (e) => {
405
- if (e == null || typeof e != "object") return !1;
406
- const t = e;
407
- if (t.discriminator !== me) return !1;
408
- if (!("type" in t))
409
- throw new Error(
410
- `X Error is missing its type property: ${JSON.stringify(t)}`
411
- );
412
- return !0;
413
- }, _ = "unknown", z = "nil";
414
- class Xt {
415
- providers = [];
416
- register(t) {
417
- this.providers.push(t);
418
- }
419
- encode(t) {
420
- if (t == null) return { type: z, data: "" };
421
- if (he(t))
422
- for (const r of this.providers) {
423
- const n = r.encode(t);
424
- if (n != null) return n;
425
- }
426
- if (t instanceof Error) return { type: _, data: t.message };
427
- if (typeof t == "string") return { type: _, data: t };
428
- try {
429
- return { type: _, data: JSON.stringify(t) };
430
- } catch {
431
- return { type: _, data: "unable to encode error information" };
432
- }
433
- }
434
- decode(t) {
435
- if (t == null || t.type === z) return null;
436
- if (t.type === _) return new W(t.data);
437
- for (const r of this.providers) {
438
- const n = r.decode(t);
439
- if (n != null) return n;
440
- }
441
- return new W(t.data);
442
- }
443
- }
444
- const V = Vt("synnax-error-registry", () => new Xt()), Gt = ({ encode: e, decode: t }) => V().register({ encode: e, decode: t }), Jt = (e) => V().encode(e), Qt = (e) => e == null ? null : V().decode(e);
445
- class W extends N("unknown") {
446
- }
447
- const Yt = c.object({ type: c.string(), data: c.string() });
448
- class Kt extends N("canceled") {
449
- }
450
- class er extends N("not_implemented") {
451
- }
452
- const Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
453
- __proto__: null,
454
- Canceled: Kt,
455
- NONE: z,
456
- NotImplemented: er,
457
- UNKNOWN: _,
458
- Unknown: W,
459
- createTyped: N,
460
- decode: Qt,
461
- encode: Jt,
462
- isTyped: he,
463
- payloadZ: Yt,
464
- register: Gt
465
- }, Symbol.toStringTag, { value: "Module" })), Fr = () => Promise.resolve(), Vr = () => new Promise((e) => setTimeout(e, 0)), Hr = (e) => e ? -1 : 1, pe = m.object({
466
- jsonrpc: m.literal("2.0"),
467
- method: m.string(),
468
- // params should be z.union([z.record(z.string(), z.json()),
469
- // z.array(z.json())]).optional() but the VSCode JSON RPC implementation uses a looser
470
- // definition of params then in the JSON-RPC spec.
471
- params: m.any().optional(),
472
- id: m.union([m.string(), m.number(), m.null()]).optional()
473
- }), ge = m.object({
474
- jsonrpc: m.literal("2.0"),
475
- id: m.union([m.string(), m.number(), m.null()])
476
- }), tr = ge.extend({
477
- result: m.json()
478
- }), rr = ge.extend({
479
- error: m.object({
480
- code: m.number().int(),
481
- // This should be z.string(), but the VSCode JSON RPC implementation uses a looser
482
- // definition of error than the JSON-RPC spec.
483
- message: m.string().optional(),
484
- data: m.json().optional()
485
- })
486
- }), be = m.union([tr, rr]), _e = m.union([pe, be]), nr = (e) => {
487
- const t = new TextDecoder();
488
- let r = new Uint8Array(0), n = null;
489
- return (s) => {
490
- let o;
491
- typeof s == "string" ? o = new TextEncoder().encode(s) : s instanceof ArrayBuffer ? o = new Uint8Array(s) : o = s;
492
- const a = new Uint8Array(r.length + o.length);
493
- for (a.set(r), a.set(o, r.length), r = a; r.length > 0; ) {
494
- if (n === null) {
495
- const i = t.decode(r).match(/^Content-Length: (\d+)\r?\n\r?\n/);
496
- if (!i) break;
497
- n = parseInt(i[1]);
498
- const l = new TextEncoder().encode(i[0]).length;
499
- r = r.slice(l);
500
- }
501
- if (n !== null && r.length >= n) {
502
- const f = r.slice(0, n);
503
- r = r.slice(n), n = null;
504
- const i = t.decode(f), l = Ne.decodeString(i, _e);
505
- e(l);
506
- } else break;
507
- }
508
- };
509
- }, sr = (e) => {
510
- const t = JSON.stringify(e);
511
- return `Content-Length: ${new TextEncoder().encode(t).length}\r
512
- \r
513
- ` + t;
514
- }, Xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
515
- __proto__: null,
516
- encodeMessage: sr,
517
- messageZ: _e,
518
- requestZ: pe,
519
- responseZ: be,
520
- streamDecodeChunks: nr
521
- }, Symbol.toStringTag, { value: "Module" })), ye = m.uuid(), we = m.object({
522
- key: ye,
523
- name: m.string().min(1),
524
- color: m.string()
525
- }), Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
526
- __proto__: null,
527
- keyZ: ye,
528
- labelZ: we
529
- }, Symbol.toStringTag, { value: "Module" })), or = (e, t, r) => {
530
- const n = e.get(t);
531
- return n === void 0 ? (e.set(t, r), r) : n;
532
- }, Jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
533
- __proto__: null,
534
- getOrSetDefault: or
535
- }, Symbol.toStringTag, { value: "Module" })), D = c.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/), ir = (e, t) => {
536
- const r = e.split("."), n = t.split("."), s = Math.max(r.length, n.length);
537
- for (let o = 0; o < s; o++) {
538
- const a = r[o], f = n[o];
539
- if (a === void 0) return p;
540
- if (f === void 0) return g;
541
- const i = /^\d+$/.test(a), l = /^\d+$/.test(f);
542
- if (i && !l) return p;
543
- if (!i && l) return g;
544
- if (i && l) {
545
- const u = parseInt(a), h = parseInt(f);
546
- if (u < h) return p;
547
- if (u > h) return g;
548
- } else {
549
- if (a < f) return p;
550
- if (a > f) return g;
551
- }
552
- }
553
- return Y;
554
- }, I = ((e, t, r = {}) => {
555
- r.checkMajor ??= !0, r.checkMinor ??= !0, r.checkPatch ??= !0;
556
- const n = D.parse(e), s = D.parse(t), [o, a] = n.split("-"), [f, i] = s.split("-"), [l, u, h] = o.split(".").map(Number), [b, H, X] = f.split(".").map(Number);
557
- if (r.checkMajor) {
558
- if (l < b) return p;
559
- if (l > b) return g;
560
- }
561
- if (r.checkMinor) {
562
- if (u < H) return p;
563
- if (u > H) return g;
564
- }
565
- if (r.checkPatch) {
566
- if (h < X) return p;
567
- if (h > X) return g;
568
- }
569
- return a === void 0 && i === void 0 ? Y : a === void 0 ? g : i === void 0 ? p : ir(a, i);
570
- }), ar = (e, t, r = {}) => rt(I(e, t, r)), Me = (e, t, r = {}) => nt(I(e, t, r)), cr = (e, t, r = {}) => st(I(e, t, r)), lr = ({
571
- name: e,
572
- migrate: t
573
- }) => (r) => {
574
- try {
575
- const n = t(r);
576
- return console.log(`${e} migrated: ${r.version} -> ${n.version}`), n;
577
- } catch (n) {
578
- throw console.log(`${e} failed to migrate from ${r.version}`), console.error(n), n;
579
- }
580
- }, ur = ({
581
- name: e,
582
- migrations: t,
583
- targetSchema: r,
584
- defaultVersion: n,
585
- def: s
586
- }) => {
587
- const o = Object.keys(t).sort(I).pop();
588
- if (o == null)
589
- return (l) => {
590
- if (l.version ??= n, l.version !== s.version)
591
- return console.log(
592
- `${e} version ${l.version} is newer than latest version of ${s.version}.
593
- Returning default instead.
594
- `
595
- ), s;
596
- try {
597
- return r != null ? r.parse(l) : l;
598
- } catch (u) {
599
- return console.log(`${e} failed to parse default. Exiting with default`), console.error(u), s;
600
- }
601
- };
602
- const a = Object.keys(t).length;
603
- let f = !1;
604
- const i = (l) => {
605
- try {
606
- if (a === 0 || Me(l.version, o))
607
- return console.log(f ? `${e} ${l.version} now up to date` : `${e} version ${l.version} is up to date with target version ${s.version}`), l;
608
- const u = l.version, h = t[u], b = h(l);
609
- return f = !0, i(b);
610
- } catch (u) {
611
- return console.log(
612
- `${e} failed to migrate from ${l.version} to ${o}`
613
- ), console.error(u), s;
614
- }
615
- };
616
- return (l) => {
617
- try {
618
- if (l.version == null)
619
- if (n != null)
620
- console.log(
621
- `${e} version is null. Setting version to default of ${n}`
622
- ), l.version = n;
623
- else
624
- return console.log(
625
- `${e} version is null and no default version set. Exiting with default`
626
- ), s;
627
- return i(l);
628
- } catch (u) {
629
- return console.log(`${e} failed to parse final result. Exiting with default`), console.error(u), s;
630
- }
631
- };
632
- }, Qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
633
- __proto__: null,
634
- compareSemVer: I,
635
- createMigration: lr,
636
- migrator: ur,
637
- semVerNewer: Me,
638
- semVerOlder: cr,
639
- semVerZ: D,
640
- versionsEqual: ar
641
- }, Symbol.toStringTag, { value: "Module" })), ve = ["standard", "scientific", "engineering"], fr = c.enum(ve), dr = (e, t, r) => {
642
- if (Number.isNaN(e)) return "NaN";
643
- if (e === 1 / 0) return "∞";
644
- if (e === -1 / 0) return "-∞";
645
- if (r === "standard") return e.toFixed(t);
646
- if (e === 0)
647
- return t === 0 ? "0ᴇ0" : `0.${"0".repeat(t)}ᴇ0`;
648
- let n;
649
- return r === "scientific" ? n = Math.floor(Math.log10(Math.abs(e))) : n = Math.floor(Math.log10(Math.abs(e)) / 3) * 3, `${(e / 10 ** n).toFixed(t)}ᴇ${n}`;
650
- }, Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
651
- __proto__: null,
652
- NOTATIONS: ve,
653
- notationZ: fr,
654
- stringifyNumber: dr
655
- }, Symbol.toStringTag, { value: "Module" })), Kr = (e) => {
656
- if (e === void 0 || typeof e == "string" || typeof e == "number")
657
- return e;
658
- if (e.toString === void 0) throw new Error("invalid renderer");
659
- return e.toString();
660
- }, en = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e !== null ? { ...e } : e, Se = c.enum([
661
- "success",
662
- "info",
663
- "warning",
664
- "error",
665
- "loading",
666
- "disabled"
667
- ]), mr = (e) => c.object({
668
- key: c.string(),
669
- name: c.string().default(""),
670
- variant: Se,
671
- message: c.string(),
672
- description: c.string().optional(),
673
- time: J.z,
674
- labels: je(we).optional(),
675
- details: e ?? c.unknown().optional()
676
- }), hr = c.object({
677
- stack: c.string(),
678
- error: c.instanceof(Error)
679
- }), pr = (e, t) => {
680
- if (!(e instanceof Error)) throw e;
681
- return xe({
682
- variant: "error",
683
- message: t ?? e.message,
684
- description: t != null ? e.message : void 0,
685
- details: { stack: e.stack ?? "", error: e }
686
- });
687
- }, xe = (e) => ({
688
- key: Be(),
689
- time: J.now(),
690
- name: "",
691
- ...e
692
- }), gr = (e, t = []) => {
693
- if (e != null)
694
- return Array.isArray(t) ? t.includes(e) ? e : void 0 : t === e ? e : void 0;
695
- }, br = (e, t = []) => {
696
- if (e != null)
697
- return Array.isArray(t) ? t.includes(e) ? void 0 : e : t === e ? void 0 : e;
698
- }, tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
699
- __proto__: null,
700
- create: xe,
701
- exceptionDetailsSchema: hr,
702
- fromException: pr,
703
- keepVariants: gr,
704
- removeVariants: br,
705
- statusZ: mr,
706
- variantZ: Se
707
- }, Symbol.toStringTag, { value: "Module" })), _r = (e, t) => {
708
- if (!t.has(e)) return e;
709
- let r = e, n = 1, s = e;
710
- for (; t.has(s); ) {
711
- const o = s.match(yr);
712
- o ? (r = s.slice(0, o.index).trim(), n = parseInt(o[1]) + 1) : (r = s, n = 1), s = `${r} (${n})`;
713
- }
714
- return s;
715
- }, yr = /\((\d+)\)$/, wr = (e, t = "") => {
716
- if (typeof e == "string") return e;
717
- const r = e.length;
718
- return r === 0 ? t : r === 1 ? e[0] : r === 2 ? `${e[0]} and ${e[1]}` : `${e.slice(0, -1).join(", ")}, and ${e[r - 1]}`;
719
- }, Mr = (e) => {
720
- const t = e.split(" "), r = /* @__PURE__ */ new Set(), n = t.map((i) => i.charAt(0).toLowerCase()).join("");
721
- r.add(n.replace(/-/g, "_")), r.add(n.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_"));
722
- const s = /\d+/g;
723
- e.match(s) && t.forEach((i, l) => {
724
- if (s.test(i)) {
725
- const u = t.map((h, b) => b !== l ? h.charAt(0).toLowerCase() : h).join("");
726
- r.add(u.replace(/-/g, "_")), r.add(
727
- u.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_")
728
- );
729
- }
730
- });
731
- const a = t.map(
732
- (i) => (i.length > 3 ? i.substring(0, 3) : i).toLowerCase()
733
- );
734
- return r.add(a.join("").replace(/-/g, "_")), r.add(a.join("_").replace(/-/g, "_")), Array.from(r).filter(
735
- (i) => i.length >= 2 && i.length <= 12 && !/^\d/.test(i)
736
- );
737
- }, vr = (e, t) => e.startsWith(t) ? e.slice(t.length) : e, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
738
- __proto__: null,
739
- createShortIdentifiers: Mr,
740
- deduplicateFileName: _r,
741
- naturalLanguageJoin: wr,
742
- trimPrefix: vr
743
- }, Symbol.toStringTag, { value: "Module" })), Sr = new Error("request for lock canceled");
744
- var xr = function(e, t, r, n) {
745
- function s(o) {
746
- return o instanceof r ? o : new r(function(a) {
747
- a(o);
748
- });
749
- }
750
- return new (r || (r = Promise))(function(o, a) {
751
- function f(u) {
752
- try {
753
- l(n.next(u));
754
- } catch (h) {
755
- a(h);
756
- }
757
- }
758
- function i(u) {
759
- try {
760
- l(n.throw(u));
761
- } catch (h) {
762
- a(h);
763
- }
764
- }
765
- function l(u) {
766
- u.done ? o(u.value) : s(u.value).then(f, i);
767
- }
768
- l((n = n.apply(e, t || [])).next());
769
- });
770
- };
771
- class Tr {
772
- constructor(t, r = Sr) {
773
- this._value = t, this._cancelError = r, this._queue = [], this._weightedWaiters = [];
774
- }
775
- acquire(t = 1, r = 0) {
776
- if (t <= 0)
777
- throw new Error(`invalid weight ${t}: must be positive`);
778
- return new Promise((n, s) => {
779
- const o = { resolve: n, reject: s, weight: t, priority: r }, a = Te(this._queue, (f) => r <= f.priority);
780
- a === -1 && t <= this._value ? this._dispatchItem(o) : this._queue.splice(a + 1, 0, o);
781
- });
782
- }
783
- runExclusive(t) {
784
- return xr(this, arguments, void 0, function* (r, n = 1, s = 0) {
785
- const [o, a] = yield this.acquire(n, s);
786
- try {
787
- return yield r(o);
788
- } finally {
789
- a();
790
- }
791
- });
792
- }
793
- waitForUnlock(t = 1, r = 0) {
794
- if (t <= 0)
795
- throw new Error(`invalid weight ${t}: must be positive`);
796
- return this._couldLockImmediately(t, r) ? Promise.resolve() : new Promise((n) => {
797
- this._weightedWaiters[t - 1] || (this._weightedWaiters[t - 1] = []), $r(this._weightedWaiters[t - 1], { resolve: n, priority: r });
798
- });
799
- }
800
- isLocked() {
801
- return this._value <= 0;
802
- }
803
- getValue() {
804
- return this._value;
805
- }
806
- setValue(t) {
807
- this._value = t, this._dispatchQueue();
808
- }
809
- release(t = 1) {
810
- if (t <= 0)
811
- throw new Error(`invalid weight ${t}: must be positive`);
812
- this._value += t, this._dispatchQueue();
813
- }
814
- cancel() {
815
- this._queue.forEach((t) => t.reject(this._cancelError)), this._queue = [];
816
- }
817
- _dispatchQueue() {
818
- for (this._drainUnlockWaiters(); this._queue.length > 0 && this._queue[0].weight <= this._value; )
819
- this._dispatchItem(this._queue.shift()), this._drainUnlockWaiters();
820
- }
821
- _dispatchItem(t) {
822
- const r = this._value;
823
- this._value -= t.weight, t.resolve([r, this._newReleaser(t.weight)]);
824
- }
825
- _newReleaser(t) {
826
- let r = !1;
827
- return () => {
828
- r || (r = !0, this.release(t));
829
- };
830
- }
831
- _drainUnlockWaiters() {
832
- if (this._queue.length === 0)
833
- for (let t = this._value; t > 0; t--) {
834
- const r = this._weightedWaiters[t - 1];
835
- r && (r.forEach((n) => n.resolve()), this._weightedWaiters[t - 1] = []);
836
- }
837
- else {
838
- const t = this._queue[0].priority;
839
- for (let r = this._value; r > 0; r--) {
840
- const n = this._weightedWaiters[r - 1];
841
- if (!n)
842
- continue;
843
- const s = n.findIndex((o) => o.priority <= t);
844
- (s === -1 ? n : n.splice(0, s)).forEach(((o) => o.resolve()));
845
- }
846
- }
847
- }
848
- _couldLockImmediately(t, r) {
849
- return (this._queue.length === 0 || this._queue[0].priority < r) && t <= this._value;
850
- }
851
- }
852
- function $r(e, t) {
853
- const r = Te(e, (n) => t.priority <= n.priority);
854
- e.splice(r + 1, 0, t);
855
- }
856
- function Te(e, t) {
857
- for (let r = e.length - 1; r >= 0; r--)
858
- if (t(e[r]))
859
- return r;
860
- return -1;
861
- }
862
- var jr = function(e, t, r, n) {
863
- function s(o) {
864
- return o instanceof r ? o : new r(function(a) {
865
- a(o);
866
- });
867
- }
868
- return new (r || (r = Promise))(function(o, a) {
869
- function f(u) {
870
- try {
871
- l(n.next(u));
872
- } catch (h) {
873
- a(h);
874
- }
875
- }
876
- function i(u) {
877
- try {
878
- l(n.throw(u));
879
- } catch (h) {
880
- a(h);
881
- }
882
- }
883
- function l(u) {
884
- u.done ? o(u.value) : s(u.value).then(f, i);
885
- }
886
- l((n = n.apply(e, t || [])).next());
887
- });
888
- };
889
- class Nr {
890
- constructor(t) {
891
- this._semaphore = new Tr(1, t);
892
- }
893
- acquire() {
894
- return jr(this, arguments, void 0, function* (t = 0) {
895
- const [, r] = yield this._semaphore.acquire(1, t);
896
- return r;
897
- });
898
- }
899
- runExclusive(t, r = 0) {
900
- return this._semaphore.runExclusive(() => t(), 1, r);
901
- }
902
- isLocked() {
903
- return this._semaphore.isLocked();
904
- }
905
- waitForUnlock(t = 0) {
906
- return this._semaphore.waitForUnlock(1, t);
907
- }
908
- release() {
909
- this._semaphore.isLocked() && this._semaphore.release();
910
- }
911
- cancel() {
912
- return this._semaphore.cancel();
913
- }
914
- }
915
- class $e extends Nr {
916
- constructor(t) {
917
- super(), Object.assign(this, t);
918
- }
919
- }
920
- const Ir = (e) => new $e(e), nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
921
- __proto__: null,
922
- mutex: $e,
923
- newMutex: Ir
924
- }, Symbol.toStringTag, { value: "Module" })), Er = (e) => JSON.stringify(e, (t, r) => typeof r == "bigint" ? r.toString() : r), Or = async (e, t = 200, r = 20) => {
925
- const n = Date.now();
926
- for (; Date.now() - n < t; )
927
- await e(), await new Promise((s) => setTimeout(s, r));
928
- }, sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
929
- __proto__: null,
930
- expectAlways: Or,
931
- toString: Er
932
- }, Symbol.toStringTag, { value: "Module" }));
933
- export {
934
- dn as DataType,
935
- mn as Density,
936
- hn as MultiSeries,
937
- pn as Rate,
938
- vs as RoutedWorker,
939
- gn as Series,
940
- bn as Size,
941
- _n as TimeRange,
942
- M as TimeSpan,
943
- J as TimeStamp,
944
- Ss as TypedWorker,
945
- ys as URL,
946
- yn as addSamples,
947
- cn as array,
948
- un as binary,
949
- Gn as bounds,
950
- os as box,
951
- qr as breaker,
952
- ws as buildQueryString,
953
- In as caseconv,
954
- On as change,
955
- kn as clamp,
956
- zr as color,
957
- Zn as compare,
958
- Wr as control,
959
- wn as convertDataType,
960
- Kr as convertRenderV,
961
- xs as createMockWorkers,
962
- Dr as csv,
963
- Ln as debounce,
964
- zn as deep,
965
- as as dimensions,
966
- ls as direction,
967
- Br as errors,
968
- Fr as flushMicrotasks,
969
- Vr as flushTaskQueue,
970
- Mn as id,
971
- vn as instance,
972
- Hr as invert,
973
- Sn as isCrudeSeries,
974
- Dn as isObject,
975
- xn as isTelemValue,
976
- Xr as jsonRPC,
977
- Fn as kv,
978
- Gr as label,
979
- Hn as link,
980
- fs as location,
981
- Jr as map,
982
- Lr as math,
983
- Qr as migrate,
984
- Yr as notation,
985
- Tn as numericTimeRangeZ,
986
- Kn as observe,
987
- Qn as primitive,
988
- ts as record,
989
- ns as runtime,
990
- Pn as scale,
991
- en as shallowCopy,
992
- Ur as sleep,
993
- ms as spatial,
994
- tn as status,
995
- rn as strings,
996
- nn as sync,
997
- sn as testutil,
998
- Un as throttle,
999
- $n as typedArrayZ,
1000
- bs as unique,
1001
- jn as uuid,
1002
- ps as xy,
1003
- $s as zod
1004
- };