@synnaxlabs/x 0.16.1 → 0.23.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 (511) hide show
  1. package/.turbo/turbo-build.log +99 -7
  2. package/.vscode/settings.json +5 -1
  3. package/dist/base-Cz4DfmJf.js +37 -0
  4. package/dist/base-D3FrPu8C.cjs +1 -0
  5. package/dist/binary.cjs +1 -0
  6. package/dist/binary.js +37 -0
  7. package/dist/bounds-1ouRnRJS.cjs +1 -0
  8. package/dist/bounds-BYz3mV9U.js +129 -0
  9. package/dist/bounds.cjs +1 -0
  10. package/dist/bounds.js +4 -0
  11. package/dist/box-CHDDKvN3.cjs +1 -0
  12. package/dist/box-Q7p9JFnX.js +204 -0
  13. package/dist/box.cjs +1 -0
  14. package/dist/box.js +4 -0
  15. package/dist/caseconv.cjs +1 -0
  16. package/dist/caseconv.js +4 -0
  17. package/dist/change-C-YELKx6.cjs +1 -0
  18. package/dist/change-DLl6DccR.js +12 -0
  19. package/dist/change.cjs +1 -0
  20. package/dist/change.js +4 -0
  21. package/dist/compare.cjs +1 -0
  22. package/dist/compare.js +4 -0
  23. package/dist/debounce.cjs +1 -0
  24. package/dist/debounce.js +17 -0
  25. package/dist/deep.cjs +1 -0
  26. package/dist/deep.js +119 -0
  27. package/dist/destructor.cjs +1 -0
  28. package/dist/destructor.js +1 -0
  29. package/dist/dimensions-9gLSFjFx.js +44 -0
  30. package/dist/dimensions-Fe8DhhXU.cjs +1 -0
  31. package/dist/dimensions.cjs +1 -0
  32. package/dist/dimensions.js +4 -0
  33. package/dist/direction-dXjlmg4_.cjs +1 -0
  34. package/dist/direction-wsPTe9a1.js +15 -0
  35. package/dist/direction.cjs +1 -0
  36. package/dist/direction.js +4 -0
  37. package/dist/external-B-DoBvh7.cjs +1 -0
  38. package/dist/external-DI9122wF.js +27 -0
  39. package/dist/identity.cjs +1 -0
  40. package/dist/identity.js +4 -0
  41. package/dist/index-Bcm6lEr8.js +73 -0
  42. package/dist/index-CnZb0cyW.cjs +1 -0
  43. package/dist/index-POWYBOZm.js +356 -0
  44. package/dist/index-xjptNL6Z.cjs +1 -0
  45. package/dist/index.cjs +1 -0
  46. package/dist/index.js +136 -0
  47. package/dist/kv.cjs +1 -0
  48. package/dist/kv.js +6 -0
  49. package/dist/location-C4YaXxjI.js +94 -0
  50. package/dist/location-CZOgJmu5.cjs +1 -0
  51. package/dist/location.cjs +1 -0
  52. package/dist/location.js +4 -0
  53. package/dist/observe.cjs +1 -0
  54. package/dist/observe.js +43 -0
  55. package/dist/path-BfHj5x9k.js +62 -0
  56. package/dist/path-By98WcWm.cjs +1 -0
  57. package/dist/position-BjhXUSEO.cjs +1 -0
  58. package/dist/position-PSYLZzqw.js +87 -0
  59. package/dist/position.cjs +1 -0
  60. package/dist/position.js +4 -0
  61. package/dist/record.cjs +1 -0
  62. package/dist/record.js +9 -0
  63. package/dist/runtime.cjs +1 -0
  64. package/dist/runtime.js +4 -0
  65. package/dist/scale-DCbi48di.js +205 -0
  66. package/dist/scale-DUBO0Q4s.cjs +1 -0
  67. package/dist/scale.cjs +1 -0
  68. package/dist/scale.js +4 -0
  69. package/dist/search.cjs +1 -0
  70. package/dist/search.js +15 -0
  71. package/dist/series-CSutMOtt.cjs +11 -0
  72. package/dist/series-DCv8f29w.js +1629 -0
  73. package/dist/spatial-6OGCmDve.js +11 -0
  74. package/dist/spatial-R5OeJgR6.cjs +1 -0
  75. package/dist/spatial.cjs +1 -0
  76. package/dist/spatial.js +20 -0
  77. package/dist/{binary → src/binary}/encoder.d.ts +7 -2
  78. package/dist/src/binary/encoder.d.ts.map +1 -0
  79. package/dist/src/binary/encoder.spec.d.ts.map +1 -0
  80. package/dist/src/binary/index.d.ts.map +1 -0
  81. package/dist/src/caseconv/caseconv.d.ts +4 -0
  82. package/dist/src/caseconv/caseconv.d.ts.map +1 -0
  83. package/dist/src/caseconv/index.d.ts +2 -0
  84. package/dist/src/caseconv/index.d.ts.map +1 -0
  85. package/dist/{change → src/change}/change.d.ts +10 -9
  86. package/dist/src/change/change.d.ts.map +1 -0
  87. package/dist/src/change/index.d.ts.map +1 -0
  88. package/dist/src/clamp/clamp.d.ts.map +1 -0
  89. package/dist/src/clamp/index.d.ts +2 -0
  90. package/dist/src/clamp/index.d.ts.map +1 -0
  91. package/dist/{compare → src/compare}/compare.d.ts +5 -4
  92. package/dist/src/compare/compare.d.ts.map +1 -0
  93. package/dist/src/compare/index.d.ts.map +1 -0
  94. package/dist/src/control/control.d.ts +107 -0
  95. package/dist/src/control/control.d.ts.map +1 -0
  96. package/dist/src/control/index.d.ts +2 -0
  97. package/dist/src/control/index.d.ts.map +1 -0
  98. package/dist/src/debounce/debounce.d.ts.map +1 -0
  99. package/dist/src/debounce/debounce.spec.d.ts +2 -0
  100. package/dist/src/debounce/debounce.spec.d.ts.map +1 -0
  101. package/dist/src/debounce/index.d.ts +2 -0
  102. package/dist/src/debounce/index.d.ts.map +1 -0
  103. package/dist/src/deep/copy.d.ts.map +1 -0
  104. package/dist/{deep → src/deep}/delete.d.ts +2 -1
  105. package/dist/src/deep/delete.d.ts.map +1 -0
  106. package/dist/{deep → src/deep}/delete.spec.d.ts.map +1 -1
  107. package/dist/src/deep/difference.d.ts.map +1 -0
  108. package/dist/src/deep/difference.spec.d.ts.map +1 -0
  109. package/dist/src/deep/equal.d.ts.map +1 -0
  110. package/dist/{deep → src/deep}/equal.spec.d.ts.map +1 -1
  111. package/dist/{deep → src/deep}/external.d.ts +3 -4
  112. package/dist/src/deep/external.d.ts.map +1 -0
  113. package/dist/src/deep/index.d.ts.map +1 -0
  114. package/dist/src/deep/merge.d.ts +12 -0
  115. package/dist/src/deep/merge.d.ts.map +1 -0
  116. package/dist/{deep → src/deep}/merge.spec.d.ts.map +1 -1
  117. package/dist/src/deep/partial.d.ts.map +1 -0
  118. package/dist/src/deep/path.d.ts +45 -0
  119. package/dist/src/deep/path.d.ts.map +1 -0
  120. package/dist/{deep → src/deep}/path.spec.d.ts.map +1 -1
  121. package/dist/src/destructor.d.ts.map +1 -0
  122. package/dist/{identity.d.ts → src/identity.d.ts} +2 -1
  123. package/dist/src/identity.d.ts.map +1 -0
  124. package/dist/{index.d.ts → src/index.d.ts} +22 -20
  125. package/dist/src/index.d.ts.map +1 -0
  126. package/dist/src/invert.d.ts.map +1 -0
  127. package/dist/src/join.d.ts.map +1 -0
  128. package/dist/src/kv/index.d.ts.map +1 -0
  129. package/dist/src/kv/types.d.ts.map +1 -0
  130. package/dist/src/math/index.d.ts +2 -0
  131. package/dist/src/math/index.d.ts.map +1 -0
  132. package/dist/src/math/math.d.ts +11 -0
  133. package/dist/src/math/math.d.ts.map +1 -0
  134. package/dist/src/migrate/index.d.ts.map +1 -0
  135. package/dist/{migrate → src/migrate}/migrate.d.ts +2 -1
  136. package/dist/src/migrate/migrate.d.ts.map +1 -0
  137. package/dist/src/migrate/migrate.spec.d.ts.map +1 -0
  138. package/dist/{mock → src/mock}/MockGLBufferController.d.ts +2 -1
  139. package/dist/src/mock/MockGLBufferController.d.ts.map +1 -0
  140. package/dist/src/mock/index.d.ts.map +1 -0
  141. package/dist/src/observe/index.d.ts.map +1 -0
  142. package/dist/src/observe/observe.d.ts +24 -0
  143. package/dist/src/observe/observe.d.ts.map +1 -0
  144. package/dist/src/observe/obsever.spec.d.ts +2 -0
  145. package/dist/src/observe/obsever.spec.d.ts.map +1 -0
  146. package/dist/src/optional.d.ts.map +1 -0
  147. package/dist/{primitive.d.ts → src/primitive.d.ts} +2 -1
  148. package/dist/src/primitive.d.ts.map +1 -0
  149. package/dist/{record.d.ts → src/record.d.ts} +7 -8
  150. package/dist/src/record.d.ts.map +1 -0
  151. package/dist/{renderable.d.ts → src/renderable.d.ts} +2 -1
  152. package/dist/src/renderable.d.ts.map +1 -0
  153. package/dist/src/runtime/detect.d.ts.map +1 -0
  154. package/dist/src/runtime/external.d.ts.map +1 -0
  155. package/dist/src/runtime/index.d.ts.map +1 -0
  156. package/dist/src/runtime/os.d.ts +20 -0
  157. package/dist/src/runtime/os.d.ts.map +1 -0
  158. package/dist/{search.d.ts → src/search.d.ts} +5 -2
  159. package/dist/src/search.d.ts.map +1 -0
  160. package/dist/src/shallowCopy.d.ts +2 -0
  161. package/dist/src/shallowCopy.d.ts.map +1 -0
  162. package/dist/{spatial → src/spatial}/base.d.ts +30 -5
  163. package/dist/src/spatial/base.d.ts.map +1 -0
  164. package/dist/src/spatial/bounds/bounds.d.ts +148 -0
  165. package/dist/src/spatial/bounds/bounds.d.ts.map +1 -0
  166. package/dist/src/spatial/bounds/bounds.spec.d.ts.map +1 -0
  167. package/dist/src/spatial/bounds/index.d.ts.map +1 -0
  168. package/dist/{spatial → src/spatial}/box/box.d.ts +69 -22
  169. package/dist/src/spatial/box/box.d.ts.map +1 -0
  170. package/dist/src/spatial/box/box.spec.d.ts.map +1 -0
  171. package/dist/src/spatial/box/index.d.ts.map +1 -0
  172. package/dist/{spatial → src/spatial}/dimensions/dimensions.d.ts +4 -3
  173. package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -0
  174. package/dist/src/spatial/dimensions/dimensions.spec.d.ts.map +1 -0
  175. package/dist/src/spatial/dimensions/index.d.ts.map +1 -0
  176. package/dist/{spatial → src/spatial}/direction/direction.d.ts +3 -2
  177. package/dist/src/spatial/direction/direction.d.ts.map +1 -0
  178. package/dist/src/spatial/direction/direction.spec.d.ts.map +1 -0
  179. package/dist/src/spatial/direction/index.d.ts.map +1 -0
  180. package/dist/{spatial → src/spatial}/external.d.ts +2 -2
  181. package/dist/src/spatial/external.d.ts.map +1 -0
  182. package/dist/src/spatial/index.d.ts.map +1 -0
  183. package/dist/src/spatial/location/index.d.ts.map +1 -0
  184. package/dist/{spatial → src/spatial}/location/location.d.ts +4 -3
  185. package/dist/src/spatial/location/location.d.ts.map +1 -0
  186. package/dist/src/spatial/location/location.spec.d.ts.map +1 -0
  187. package/dist/src/spatial/position/index.d.ts.map +1 -0
  188. package/dist/{spatial → src/spatial}/position/position.d.ts +4 -4
  189. package/dist/src/spatial/position/position.d.ts.map +1 -0
  190. package/dist/src/spatial/position/position.spec.d.ts.map +1 -0
  191. package/dist/src/spatial/scale/index.d.ts.map +1 -0
  192. package/dist/{spatial → src/spatial}/scale/scale.d.ts +15 -62
  193. package/dist/src/spatial/scale/scale.d.ts.map +1 -0
  194. package/dist/src/spatial/scale/scale.spec.d.ts.map +1 -0
  195. package/dist/src/spatial/spatial.d.ts +2 -0
  196. package/dist/src/spatial/spatial.d.ts.map +1 -0
  197. package/dist/src/spatial/xy/index.d.ts.map +1 -0
  198. package/dist/{spatial → src/spatial}/xy/xy.d.ts +15 -24
  199. package/dist/src/spatial/xy/xy.d.ts.map +1 -0
  200. package/dist/{spatial → src/spatial}/xy/xy.spec.d.ts.map +1 -1
  201. package/dist/src/telem/generate.d.ts +4 -0
  202. package/dist/src/telem/generate.d.ts.map +1 -0
  203. package/dist/src/telem/gl.d.ts.map +1 -0
  204. package/dist/{telem → src/telem}/index.d.ts +1 -1
  205. package/dist/src/telem/index.d.ts.map +1 -0
  206. package/dist/{telem → src/telem}/series.d.ts +10 -8
  207. package/dist/src/telem/series.d.ts.map +1 -0
  208. package/dist/{telem → src/telem}/series.spec.d.ts.map +1 -1
  209. package/dist/{telem → src/telem}/telem.d.ts +19 -21
  210. package/dist/src/telem/telem.d.ts.map +1 -0
  211. package/dist/{telem → src/telem}/telem.spec.d.ts.map +1 -1
  212. package/dist/src/toArray.d.ts.map +1 -0
  213. package/dist/src/transform.d.ts +6 -0
  214. package/dist/src/transform.d.ts.map +1 -0
  215. package/dist/src/unique.d.ts.map +1 -0
  216. package/dist/src/url/index.d.ts +2 -0
  217. package/dist/src/url/index.d.ts.map +1 -0
  218. package/dist/src/url/url.d.ts.map +1 -0
  219. package/dist/{url → src/url}/url.spec.d.ts.map +1 -1
  220. package/dist/src/worker/index.d.ts +2 -0
  221. package/dist/src/worker/index.d.ts.map +1 -0
  222. package/dist/{worker → src/worker}/worker.d.ts +4 -4
  223. package/dist/src/worker/worker.d.ts.map +1 -0
  224. package/dist/src/worker/worker.spec.d.ts.map +1 -0
  225. package/dist/src/zodutil/index.d.ts +2 -0
  226. package/dist/src/zodutil/index.d.ts.map +1 -0
  227. package/dist/src/zodutil/zodutil.d.ts +6 -0
  228. package/dist/src/zodutil/zodutil.d.ts.map +1 -0
  229. package/dist/src/zodutil/zodutil.spec.d.ts +2 -0
  230. package/dist/src/zodutil/zodutil.spec.d.ts.map +1 -0
  231. package/dist/telem.cjs +1 -0
  232. package/dist/telem.js +17 -0
  233. package/dist/toArray.cjs +1 -0
  234. package/dist/toArray.js +5 -0
  235. package/dist/unique.cjs +1 -0
  236. package/dist/unique.js +4 -0
  237. package/dist/url.cjs +1 -0
  238. package/dist/url.js +54 -0
  239. package/dist/worker.cjs +1 -0
  240. package/dist/worker.js +47 -0
  241. package/dist/xy-B4SvvNaG.cjs +1 -0
  242. package/dist/xy-H8aUVW_X.js +90 -0
  243. package/dist/xy.cjs +1 -0
  244. package/dist/xy.js +4 -0
  245. package/dist/zodutil.cjs +1 -0
  246. package/dist/zodutil.js +22 -0
  247. package/eslint.config.js +12 -0
  248. package/package.json +159 -15
  249. package/src/binary/encoder.spec.ts +31 -6
  250. package/src/binary/encoder.ts +26 -15
  251. package/src/binary/index.ts +1 -1
  252. package/src/{case.ts → caseconv/caseconv.ts} +4 -9
  253. package/src/caseconv/index.ts +10 -0
  254. package/src/change/change.ts +7 -6
  255. package/src/change/index.ts +1 -1
  256. package/src/{clamp.ts → clamp/clamp.ts} +1 -1
  257. package/src/clamp/index.ts +10 -0
  258. package/src/compare/compare.ts +6 -9
  259. package/src/compare/index.ts +1 -1
  260. package/src/control/control.ts +77 -0
  261. package/src/control/index.ts +1 -0
  262. package/src/debounce/debounce.spec.ts +52 -0
  263. package/src/{debounce.ts → debounce/debounce.ts} +4 -4
  264. package/src/debounce/index.ts +10 -0
  265. package/src/deep/copy.ts +2 -3
  266. package/src/deep/delete.spec.ts +2 -2
  267. package/src/deep/delete.ts +3 -2
  268. package/src/deep/difference.spec.ts +28 -27
  269. package/src/deep/difference.ts +13 -11
  270. package/src/deep/equal.spec.ts +4 -4
  271. package/src/deep/equal.ts +5 -5
  272. package/src/deep/external.ts +4 -5
  273. package/src/deep/index.ts +1 -1
  274. package/src/deep/merge.spec.ts +120 -4
  275. package/src/deep/merge.ts +50 -6
  276. package/src/deep/partial.ts +1 -1
  277. package/src/deep/path.spec.ts +90 -39
  278. package/src/deep/path.ts +105 -46
  279. package/src/destructor.ts +2 -2
  280. package/src/identity.ts +1 -1
  281. package/src/index.ts +23 -21
  282. package/src/invert.ts +9 -0
  283. package/src/join.ts +1 -1
  284. package/src/kv/index.ts +1 -1
  285. package/src/kv/types.ts +1 -1
  286. package/src/math/index.ts +10 -0
  287. package/src/math/math.ts +33 -0
  288. package/src/migrate/index.ts +9 -0
  289. package/src/migrate/migrate.spec.ts +12 -2
  290. package/src/migrate/migrate.ts +9 -0
  291. package/src/mock/MockGLBufferController.ts +6 -6
  292. package/src/mock/index.ts +1 -1
  293. package/src/observe/index.ts +1 -1
  294. package/src/observe/observe.ts +37 -6
  295. package/src/observe/obsever.spec.ts +56 -0
  296. package/src/optional.ts +3 -4
  297. package/src/primitive.ts +1 -1
  298. package/src/record.ts +10 -6
  299. package/src/renderable.ts +1 -1
  300. package/src/runtime/detect.ts +3 -3
  301. package/src/runtime/external.ts +1 -1
  302. package/src/runtime/index.ts +1 -1
  303. package/src/runtime/os.ts +17 -5
  304. package/src/search.ts +3 -1
  305. package/src/shallowCopy.ts +5 -6
  306. package/src/spatial/base.ts +13 -5
  307. package/src/spatial/bounds/bounds.spec.ts +259 -180
  308. package/src/spatial/bounds/bounds.ts +200 -85
  309. package/src/spatial/bounds/index.ts +2 -2
  310. package/src/spatial/box/box.spec.ts +163 -2
  311. package/src/spatial/box/box.ts +82 -38
  312. package/src/spatial/box/index.ts +2 -2
  313. package/src/spatial/dimensions/dimensions.spec.ts +1 -1
  314. package/src/spatial/dimensions/dimensions.ts +4 -4
  315. package/src/spatial/dimensions/index.ts +2 -2
  316. package/src/spatial/direction/direction.spec.ts +1 -1
  317. package/src/spatial/direction/direction.ts +5 -5
  318. package/src/spatial/direction/index.ts +2 -2
  319. package/src/spatial/external.ts +3 -3
  320. package/src/spatial/index.ts +1 -1
  321. package/src/spatial/location/index.ts +2 -2
  322. package/src/spatial/location/location.spec.ts +1 -1
  323. package/src/spatial/location/location.ts +21 -21
  324. package/src/spatial/position/index.ts +1 -1
  325. package/src/spatial/position/position.spec.ts +1 -1
  326. package/src/spatial/position/position.ts +3 -20
  327. package/src/spatial/scale/index.ts +2 -2
  328. package/src/spatial/scale/scale.spec.ts +3 -3
  329. package/src/spatial/scale/scale.ts +3 -3
  330. package/src/spatial/spatial.ts +5 -5
  331. package/src/spatial/xy/index.ts +2 -2
  332. package/src/spatial/xy/xy.spec.ts +93 -44
  333. package/src/spatial/xy/xy.ts +17 -25
  334. package/src/telem/generate.ts +1 -1
  335. package/src/telem/gl.ts +1 -1
  336. package/src/telem/index.ts +2 -2
  337. package/src/telem/series.spec.ts +64 -5
  338. package/src/telem/series.ts +47 -35
  339. package/src/telem/telem.spec.ts +105 -2
  340. package/src/telem/telem.ts +63 -23
  341. package/src/toArray.ts +2 -2
  342. package/src/transform.ts +9 -2
  343. package/src/unique.ts +1 -1
  344. package/src/url/index.ts +2 -2
  345. package/src/url/url.spec.ts +2 -2
  346. package/src/url/url.ts +4 -4
  347. package/src/worker/index.ts +10 -0
  348. package/src/worker/worker.spec.ts +2 -2
  349. package/src/worker/worker.ts +13 -13
  350. package/src/zodutil/index.ts +10 -0
  351. package/src/zodutil/zodutil.spec.ts +103 -0
  352. package/src/zodutil/zodutil.ts +45 -0
  353. package/tsconfig.json +1 -0
  354. package/tsconfig.tsbuildinfo +1 -0
  355. package/vite.config.ts +39 -3
  356. package/.eslintrc.cjs +0 -18
  357. package/dist/binary/encoder.d.ts.map +0 -1
  358. package/dist/binary/encoder.spec.d.ts.map +0 -1
  359. package/dist/binary/index.d.ts.map +0 -1
  360. package/dist/case.d.ts +0 -6
  361. package/dist/case.d.ts.map +0 -1
  362. package/dist/change/change.d.ts.map +0 -1
  363. package/dist/change/index.d.ts.map +0 -1
  364. package/dist/clamp.d.ts.map +0 -1
  365. package/dist/compare/compare.d.ts.map +0 -1
  366. package/dist/compare/index.d.ts.map +0 -1
  367. package/dist/debounce.d.ts.map +0 -1
  368. package/dist/deep/copy.d.ts.map +0 -1
  369. package/dist/deep/delete.d.ts.map +0 -1
  370. package/dist/deep/difference.d.ts.map +0 -1
  371. package/dist/deep/difference.spec.d.ts.map +0 -1
  372. package/dist/deep/equal.d.ts.map +0 -1
  373. package/dist/deep/external.d.ts.map +0 -1
  374. package/dist/deep/index.d.ts.map +0 -1
  375. package/dist/deep/memo.d.ts +0 -2
  376. package/dist/deep/memo.d.ts.map +0 -1
  377. package/dist/deep/merge.d.ts +0 -3
  378. package/dist/deep/merge.d.ts.map +0 -1
  379. package/dist/deep/partial.d.ts.map +0 -1
  380. package/dist/deep/path.d.ts +0 -37
  381. package/dist/deep/path.d.ts.map +0 -1
  382. package/dist/destructor.d.ts.map +0 -1
  383. package/dist/identity.d.ts.map +0 -1
  384. package/dist/index.d.ts.map +0 -1
  385. package/dist/invert.d.ts.map +0 -1
  386. package/dist/join.d.ts.map +0 -1
  387. package/dist/kv/index.d.ts.map +0 -1
  388. package/dist/kv/types.d.ts.map +0 -1
  389. package/dist/migrate/index.d.ts.map +0 -1
  390. package/dist/migrate/migrate.d.ts.map +0 -1
  391. package/dist/migrate/migrate.spec.d.ts.map +0 -1
  392. package/dist/mock/MockGLBufferController.d.ts.map +0 -1
  393. package/dist/mock/index.d.ts.map +0 -1
  394. package/dist/observe/index.d.ts.map +0 -1
  395. package/dist/observe/observe.d.ts +0 -12
  396. package/dist/observe/observe.d.ts.map +0 -1
  397. package/dist/optional.d.ts.map +0 -1
  398. package/dist/primitive.d.ts.map +0 -1
  399. package/dist/record.d.ts.map +0 -1
  400. package/dist/renderable.d.ts.map +0 -1
  401. package/dist/runtime/detect.d.ts.map +0 -1
  402. package/dist/runtime/external.d.ts.map +0 -1
  403. package/dist/runtime/index.d.ts.map +0 -1
  404. package/dist/runtime/os.d.ts +0 -10
  405. package/dist/runtime/os.d.ts.map +0 -1
  406. package/dist/search.d.ts.map +0 -1
  407. package/dist/shallowCopy.d.ts +0 -2
  408. package/dist/shallowCopy.d.ts.map +0 -1
  409. package/dist/spatial/base.d.ts.map +0 -1
  410. package/dist/spatial/bounds/bounds.d.ts +0 -71
  411. package/dist/spatial/bounds/bounds.d.ts.map +0 -1
  412. package/dist/spatial/bounds/bounds.spec.d.ts.map +0 -1
  413. package/dist/spatial/bounds/index.d.ts.map +0 -1
  414. package/dist/spatial/box/box.d.ts.map +0 -1
  415. package/dist/spatial/box/box.spec.d.ts.map +0 -1
  416. package/dist/spatial/box/index.d.ts.map +0 -1
  417. package/dist/spatial/dimensions/dimensions.d.ts.map +0 -1
  418. package/dist/spatial/dimensions/dimensions.spec.d.ts.map +0 -1
  419. package/dist/spatial/dimensions/index.d.ts.map +0 -1
  420. package/dist/spatial/direction/direction.d.ts.map +0 -1
  421. package/dist/spatial/direction/direction.spec.d.ts.map +0 -1
  422. package/dist/spatial/direction/index.d.ts.map +0 -1
  423. package/dist/spatial/external.d.ts.map +0 -1
  424. package/dist/spatial/index.d.ts.map +0 -1
  425. package/dist/spatial/location/index.d.ts.map +0 -1
  426. package/dist/spatial/location/location.d.ts.map +0 -1
  427. package/dist/spatial/location/location.spec.d.ts.map +0 -1
  428. package/dist/spatial/position/index.d.ts.map +0 -1
  429. package/dist/spatial/position/position.d.ts.map +0 -1
  430. package/dist/spatial/position/position.spec.d.ts.map +0 -1
  431. package/dist/spatial/scale/index.d.ts.map +0 -1
  432. package/dist/spatial/scale/scale.d.ts.map +0 -1
  433. package/dist/spatial/scale/scale.spec.d.ts.map +0 -1
  434. package/dist/spatial/spatial.d.ts +0 -2
  435. package/dist/spatial/spatial.d.ts.map +0 -1
  436. package/dist/spatial/xy/index.d.ts.map +0 -1
  437. package/dist/spatial/xy/xy.d.ts.map +0 -1
  438. package/dist/telem/generate.d.ts +0 -3
  439. package/dist/telem/generate.d.ts.map +0 -1
  440. package/dist/telem/gl.d.ts.map +0 -1
  441. package/dist/telem/index.d.ts.map +0 -1
  442. package/dist/telem/series.d.ts.map +0 -1
  443. package/dist/telem/telem.d.ts.map +0 -1
  444. package/dist/toArray.d.ts.map +0 -1
  445. package/dist/transform.d.ts +0 -2
  446. package/dist/transform.d.ts.map +0 -1
  447. package/dist/unique.d.ts.map +0 -1
  448. package/dist/url/index.d.ts +0 -2
  449. package/dist/url/index.d.ts.map +0 -1
  450. package/dist/url/url.d.ts.map +0 -1
  451. package/dist/worker/worker.d.ts.map +0 -1
  452. package/dist/worker/worker.spec.d.ts.map +0 -1
  453. package/dist/x.cjs +0 -12
  454. package/dist/x.cjs.map +0 -1
  455. package/dist/x.js +0 -5935
  456. package/dist/x.js.map +0 -1
  457. package/src/deep/memo.ts +0 -24
  458. /package/dist/{binary → src/binary}/encoder.spec.d.ts +0 -0
  459. /package/dist/{binary → src/binary}/index.d.ts +0 -0
  460. /package/dist/{change → src/change}/index.d.ts +0 -0
  461. /package/dist/{clamp.d.ts → src/clamp/clamp.d.ts} +0 -0
  462. /package/dist/{compare → src/compare}/index.d.ts +0 -0
  463. /package/dist/{debounce.d.ts → src/debounce/debounce.d.ts} +0 -0
  464. /package/dist/{deep → src/deep}/copy.d.ts +0 -0
  465. /package/dist/{deep → src/deep}/delete.spec.d.ts +0 -0
  466. /package/dist/{deep → src/deep}/difference.d.ts +0 -0
  467. /package/dist/{deep → src/deep}/difference.spec.d.ts +0 -0
  468. /package/dist/{deep → src/deep}/equal.d.ts +0 -0
  469. /package/dist/{deep → src/deep}/equal.spec.d.ts +0 -0
  470. /package/dist/{deep → src/deep}/index.d.ts +0 -0
  471. /package/dist/{deep → src/deep}/merge.spec.d.ts +0 -0
  472. /package/dist/{deep → src/deep}/partial.d.ts +0 -0
  473. /package/dist/{deep → src/deep}/path.spec.d.ts +0 -0
  474. /package/dist/{destructor.d.ts → src/destructor.d.ts} +0 -0
  475. /package/dist/{invert.d.ts → src/invert.d.ts} +0 -0
  476. /package/dist/{join.d.ts → src/join.d.ts} +0 -0
  477. /package/dist/{kv → src/kv}/index.d.ts +0 -0
  478. /package/dist/{kv → src/kv}/types.d.ts +0 -0
  479. /package/dist/{migrate → src/migrate}/index.d.ts +0 -0
  480. /package/dist/{migrate → src/migrate}/migrate.spec.d.ts +0 -0
  481. /package/dist/{mock → src/mock}/index.d.ts +0 -0
  482. /package/dist/{observe → src/observe}/index.d.ts +0 -0
  483. /package/dist/{optional.d.ts → src/optional.d.ts} +0 -0
  484. /package/dist/{runtime → src/runtime}/detect.d.ts +0 -0
  485. /package/dist/{runtime → src/runtime}/external.d.ts +0 -0
  486. /package/dist/{runtime → src/runtime}/index.d.ts +0 -0
  487. /package/dist/{spatial → src/spatial}/bounds/bounds.spec.d.ts +0 -0
  488. /package/dist/{spatial → src/spatial}/bounds/index.d.ts +0 -0
  489. /package/dist/{spatial → src/spatial}/box/box.spec.d.ts +0 -0
  490. /package/dist/{spatial → src/spatial}/box/index.d.ts +0 -0
  491. /package/dist/{spatial → src/spatial}/dimensions/dimensions.spec.d.ts +0 -0
  492. /package/dist/{spatial → src/spatial}/dimensions/index.d.ts +0 -0
  493. /package/dist/{spatial → src/spatial}/direction/direction.spec.d.ts +0 -0
  494. /package/dist/{spatial → src/spatial}/direction/index.d.ts +0 -0
  495. /package/dist/{spatial → src/spatial}/index.d.ts +0 -0
  496. /package/dist/{spatial → src/spatial}/location/index.d.ts +0 -0
  497. /package/dist/{spatial → src/spatial}/location/location.spec.d.ts +0 -0
  498. /package/dist/{spatial → src/spatial}/position/index.d.ts +0 -0
  499. /package/dist/{spatial → src/spatial}/position/position.spec.d.ts +0 -0
  500. /package/dist/{spatial → src/spatial}/scale/index.d.ts +0 -0
  501. /package/dist/{spatial → src/spatial}/scale/scale.spec.d.ts +0 -0
  502. /package/dist/{spatial → src/spatial}/xy/index.d.ts +0 -0
  503. /package/dist/{spatial → src/spatial}/xy/xy.spec.d.ts +0 -0
  504. /package/dist/{telem → src/telem}/gl.d.ts +0 -0
  505. /package/dist/{telem → src/telem}/series.spec.d.ts +0 -0
  506. /package/dist/{telem → src/telem}/telem.spec.d.ts +0 -0
  507. /package/dist/{toArray.d.ts → src/toArray.d.ts} +0 -0
  508. /package/dist/{unique.d.ts → src/unique.d.ts} +0 -0
  509. /package/dist/{url → src/url}/url.d.ts +0 -0
  510. /package/dist/{url → src/url}/url.spec.d.ts +0 -0
  511. /package/dist/{worker → src/worker}/worker.spec.d.ts +0 -0
@@ -0,0 +1,43 @@
1
+ var h = Object.defineProperty;
2
+ var l = (s, e, r) => e in s ? h(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
3
+ var n = (s, e, r) => (l(s, typeof e != "symbol" ? e + "" : e, r), r);
4
+ class o {
5
+ constructor(e, r) {
6
+ n(this, "handlers");
7
+ n(this, "transform");
8
+ this.transform = e, this.handlers = r ?? /* @__PURE__ */ new Map();
9
+ }
10
+ onChange(e) {
11
+ return this.handlers.set(e, null), () => this.handlers.delete(e);
12
+ }
13
+ notify(e) {
14
+ let r = e;
15
+ if (this.transform != null) {
16
+ const [t, a] = this.transform(e);
17
+ if (!a)
18
+ return;
19
+ r = t;
20
+ }
21
+ this.handlers.forEach((t, a) => a(r));
22
+ }
23
+ }
24
+ class i {
25
+ constructor(e) {
26
+ n(this, "handlers");
27
+ this.handlers = e ?? /* @__PURE__ */ new Map();
28
+ }
29
+ onChange(e) {
30
+ return this.handlers.set(e, null), () => this.handlers.delete(e);
31
+ }
32
+ notify(e) {
33
+ this.handlers.forEach((r, t) => t(e));
34
+ }
35
+ }
36
+ const d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
37
+ __proto__: null,
38
+ BaseObserver: i,
39
+ Observer: o
40
+ }, Symbol.toStringTag, { value: "Module" }));
41
+ export {
42
+ d as observe
43
+ };
@@ -0,0 +1,62 @@
1
+ const i = (n, r) => {
2
+ const s = n.split(".");
3
+ return s.map((t, e) => {
4
+ const l = r(t, e, s);
5
+ return l == null ? null : typeof l == "string" ? l : l.join(".");
6
+ }).filter((t) => t != null).join(".");
7
+ }, a = (n, r, s = !1, { getter: o = (t, e) => t[e] } = {}) => {
8
+ const t = r.split(".");
9
+ if (t.length === 1 && t[0] === "")
10
+ return n;
11
+ let e = n;
12
+ for (const l of t) {
13
+ const u = o(e, l);
14
+ if (u == null) {
15
+ if (s)
16
+ return null;
17
+ throw new Error(`Path ${r} does not exist. ${l} is null`);
18
+ }
19
+ e = u;
20
+ }
21
+ return e;
22
+ }, c = (n, r, s) => {
23
+ const o = r.split(".");
24
+ let t = n;
25
+ for (let e = 0; e < o.length - 1; e++) {
26
+ const l = o[e];
27
+ if (t[l] == null)
28
+ throw new Error(`Path ${r} does not exist`);
29
+ t = t[l];
30
+ }
31
+ t[o[o.length - 1]] = s;
32
+ }, f = (n, r) => {
33
+ const s = n.split(".");
34
+ return r < 0 ? s[s.length + r] : s[r];
35
+ }, p = (n) => n.join("."), h = (n, r) => {
36
+ try {
37
+ return a(n, r), !0;
38
+ } catch {
39
+ return !1;
40
+ }
41
+ }, g = (n, r) => {
42
+ if (r.length === 0)
43
+ return !0;
44
+ const s = n.split("."), o = r.split(".");
45
+ if (o.length > s.length)
46
+ return !1;
47
+ for (let t = 0; t < o.length; t++) {
48
+ const e = s[t], l = o[t];
49
+ if (l !== "*" && e !== l)
50
+ return !1;
51
+ }
52
+ return !0;
53
+ };
54
+ export {
55
+ f as e,
56
+ a as g,
57
+ h,
58
+ p as j,
59
+ g as p,
60
+ c as s,
61
+ i as t
62
+ };
@@ -0,0 +1 @@
1
+ "use strict";const c=(n,r)=>{const e=n.split(".");return e.map((t,s)=>{const l=r(t,s,e);return l==null?null:typeof l=="string"?l:l.join(".")}).filter(t=>t!=null).join(".")},i=(n,r,e=!1,{getter:o=(t,s)=>t[s]}={})=>{const t=r.split(".");if(t.length===1&&t[0]==="")return n;let s=n;for(const l of t){const u=o(s,l);if(u==null){if(e)return null;throw new Error(`Path ${r} does not exist. ${l} is null`)}s=u}return s},a=(n,r,e)=>{const o=r.split(".");let t=n;for(let s=0;s<o.length-1;s++){const l=o[s];if(t[l]==null)throw new Error(`Path ${r} does not exist`);t=t[l]}t[o[o.length-1]]=e},f=(n,r)=>{const e=n.split(".");return r<0?e[e.length+r]:e[r]},h=n=>n.join("."),p=(n,r)=>{try{return i(n,r),!0}catch{return!1}},g=(n,r)=>{if(r.length===0)return!0;const e=n.split("."),o=r.split(".");if(o.length>e.length)return!1;for(let t=0;t<o.length;t++){const s=e[t],l=o[t];if(l!=="*"&&s!==l)return!1}return!0};exports.element=f;exports.get=i;exports.has=p;exports.join=h;exports.pathsMatch=g;exports.set=a;exports.transformPath=c;
@@ -0,0 +1 @@
1
+ "use strict";const n=require("./box-CHDDKvN3.cjs"),T=require("./direction-dXjlmg4_.cjs"),r=require("./location-CZOgJmu5.cjs"),b=require("./base-D3FrPu8C.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;
@@ -0,0 +1,87 @@
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-Q7p9JFnX.js";
2
+ import { c as w } from "./direction-wsPTe9a1.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-C4YaXxjI.js";
4
+ import { l as Y } from "./base-Cz4DfmJf.js";
5
+ const P = (t) => {
6
+ if (t == null)
7
+ return { x: void 0, y: void 0 };
8
+ const s = B.safeParse(t);
9
+ if (s.success)
10
+ return s.data;
11
+ const o = Y.safeParse(t);
12
+ return o.success ? w(o.data) === "x" ? { x: o.data, y: void 0 } : { x: void 0, y: o.data } : t;
13
+ }, D = ({
14
+ container: t,
15
+ target: s,
16
+ dialog: o,
17
+ initial: c,
18
+ prefer: a,
19
+ alignments: d = ["start"],
20
+ disable: f = []
21
+ }) => {
22
+ const n = P(c);
23
+ let u = S;
24
+ if (a != null) {
25
+ const e = a.map((r) => P(r));
26
+ u = u.slice().sort((r, x) => {
27
+ const i = e.findIndex((y) => h(r, y)), p = e.findIndex((y) => h(x, y));
28
+ return i > -1 && p > -1 ? i - p : i > -1 ? -1 : p > -1 ? 1 : 0;
29
+ });
30
+ }
31
+ const T = u.filter(
32
+ (e) => !C(e, O) && (n.x == null || e.x === n.x) && (n.y == null || e.y === n.y) && !f.some((r) => h(e, r))
33
+ ).map((e) => d == null ? void 0 : d.map((r) => [e, r])).flat(), E = g(t), b = g(s), _ = g(o);
34
+ let L = -1 / 0;
35
+ const l = { location: O, adjustedDialog: _ };
36
+ return T.forEach(([e, r]) => {
37
+ const [x, i] = G({
38
+ option: e,
39
+ alignment: r,
40
+ container: E,
41
+ target: b,
42
+ dialog: _
43
+ });
44
+ i > L && (L = i, l.location = e, l.adjustedDialog = x);
45
+ }), l;
46
+ }, G = ({
47
+ option: t,
48
+ alignment: s,
49
+ container: o,
50
+ target: c,
51
+ dialog: a
52
+ }) => {
53
+ const d = A(t, s), f = v(c, t), n = I(
54
+ f.x,
55
+ f.y,
56
+ N(a),
57
+ M(a),
58
+ d,
59
+ R
60
+ ), u = X(j(n, o));
61
+ return [n, u];
62
+ }, $ = {
63
+ start: "left",
64
+ center: "center",
65
+ end: "right"
66
+ }, q = {
67
+ start: "bottom",
68
+ center: "center",
69
+ end: "top"
70
+ }, A = (t, s) => {
71
+ const o = { x: "center", y: "center" };
72
+ if (t.y !== "center") {
73
+ o.y = m(t.y);
74
+ const c = t.x === "left" ? m : (a) => a;
75
+ o.x = c($[s]);
76
+ } else
77
+ o.x = m(t.x), o.y = q[s];
78
+ return o;
79
+ }, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
80
+ __proto__: null,
81
+ dialog: D,
82
+ getRoot: A,
83
+ parseLocationOptions: P
84
+ }, Symbol.toStringTag, { value: "Module" }));
85
+ export {
86
+ H as p
87
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./position-BjhXUSEO.cjs");exports.position=o.position;
@@ -0,0 +1,4 @@
1
+ import { p as i } from "./position-PSYLZzqw.js";
2
+ export {
3
+ i as position
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("zod"),o=n.z.record(n.z.union([n.z.number(),n.z.string(),n.z.symbol()]),n.z.unknown()),t=e=>Object.entries(e);exports.getEntries=t;exports.unknownRecordZ=o;
package/dist/record.js ADDED
@@ -0,0 +1,9 @@
1
+ import { z as n } from "zod";
2
+ const e = n.record(
3
+ n.union([n.number(), n.string(), n.symbol()]),
4
+ n.unknown()
5
+ ), t = (o) => Object.entries(o);
6
+ export {
7
+ t as getEntries,
8
+ e as unknownRecordZ
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-B-DoBvh7.cjs");exports.runtime=e.external;
@@ -0,0 +1,4 @@
1
+ import { e as m } from "./external-DI9122wF.js";
2
+ export {
3
+ m as runtime
4
+ };
@@ -0,0 +1,205 @@
1
+ var B = Object.defineProperty;
2
+ var R = (r, t, e) => t in r ? B(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var i = (r, t, e) => (R(r, typeof t != "symbol" ? t + "" : t, e), e);
4
+ import { z as v } from "zod";
5
+ import { c as y } from "./bounds-BYz3mV9U.js";
6
+ import { e as T, f as x, y as h, c as E } from "./box-Q7p9JFnX.js";
7
+ import { b as I } from "./location-C4YaXxjI.js";
8
+ import { b as w, c as M } from "./xy-H8aUVW_X.js";
9
+ const Y = (r, t, e) => (t != null && (r = Math.max(r, t)), e != null && (r = Math.min(r, e)), r), j = v.object({ offset: w, scale: w }), z = (r) => (t, e, s, n) => e === "dimension" ? [t, s] : [t, n ? s - r : s + r], D = (r) => (t, e, s, n) => [t, n ? s / r : s * r], L = (r) => (t, e, s) => {
10
+ if (t === null)
11
+ return [r, s];
12
+ const { lower: n, upper: o } = t, { lower: u, upper: p } = r, m = o - n, d = p - u;
13
+ if (e === "dimension")
14
+ return [r, s * (d / m)];
15
+ const g = (s - n) * (d / m) + u;
16
+ return [r, g];
17
+ }, N = (r) => (t, e, s) => [r, s], O = () => (r, t, e) => {
18
+ if (r === null)
19
+ throw new Error("cannot invert without bounds");
20
+ if (t === "dimension")
21
+ return [r, e];
22
+ const { lower: s, upper: n } = r;
23
+ return [r, n - (e - s)];
24
+ }, U = (r) => (t, e, s) => {
25
+ const { lower: n, upper: o } = r;
26
+ return s = Y(s, n, o), [t, s];
27
+ }, a = class a {
28
+ constructor() {
29
+ i(this, "ops", []);
30
+ i(this, "currBounds", null);
31
+ i(this, "currType", null);
32
+ i(this, "reversed", !1);
33
+ this.ops = [];
34
+ }
35
+ static translate(t) {
36
+ return new a().translate(t);
37
+ }
38
+ static magnify(t) {
39
+ return new a().magnify(t);
40
+ }
41
+ static scale(t, e) {
42
+ return new a().scale(t, e);
43
+ }
44
+ translate(t) {
45
+ const e = this.new(), s = z(t);
46
+ return s.type = "translate", e.ops.push(s), e;
47
+ }
48
+ magnify(t) {
49
+ const e = this.new(), s = D(t);
50
+ return s.type = "magnify", e.ops.push(s), e;
51
+ }
52
+ scale(t, e) {
53
+ const s = y(t, e), n = this.new(), o = L(s);
54
+ return o.type = "scale", n.ops.push(o), n;
55
+ }
56
+ clamp(t, e) {
57
+ const s = y(t, e), n = this.new(), o = U(s);
58
+ return o.type = "clamp", n.ops.push(o), n;
59
+ }
60
+ reBound(t, e) {
61
+ const s = y(t, e), n = this.new(), o = N(s);
62
+ return o.type = "re-bound", n.ops.push(o), n;
63
+ }
64
+ invert() {
65
+ const t = O();
66
+ t.type = "invert";
67
+ const e = this.new();
68
+ return e.ops.push(t), e;
69
+ }
70
+ pos(t) {
71
+ return this.exec("position", t);
72
+ }
73
+ dim(t) {
74
+ return this.exec("dimension", t);
75
+ }
76
+ new() {
77
+ const t = new a();
78
+ return t.ops = this.ops.slice(), t.reversed = this.reversed, t;
79
+ }
80
+ exec(t, e) {
81
+ return this.currBounds = null, this.ops.reduce(
82
+ ([s, n], o) => o(s, t, n, this.reversed),
83
+ [null, e]
84
+ )[1];
85
+ }
86
+ reverse() {
87
+ const t = this.new();
88
+ t.ops.reverse();
89
+ const e = [];
90
+ return t.ops.forEach((s, n) => {
91
+ if (s.type === "scale" || e.some(([u, p]) => n >= u && n <= p))
92
+ return;
93
+ const o = t.ops.findIndex((u, p) => u.type === "scale" && p > n);
94
+ o !== -1 && e.push([n, o]);
95
+ }), e.forEach(([s, n]) => {
96
+ const o = t.ops.slice(s, n);
97
+ o.unshift(t.ops[n]), t.ops.splice(s, n - s + 1, ...o);
98
+ }), t.reversed = !t.reversed, t;
99
+ }
100
+ };
101
+ i(a, "IDENTITY", new a());
102
+ let l = a;
103
+ const X = (r) => ({
104
+ scale: {
105
+ x: r.x.dim(1),
106
+ y: r.y.dim(1)
107
+ },
108
+ offset: {
109
+ x: r.x.pos(0),
110
+ y: r.y.pos(0)
111
+ }
112
+ }), c = class c {
113
+ constructor(t = new l(), e = new l(), s = null) {
114
+ i(this, "x");
115
+ i(this, "y");
116
+ i(this, "currRoot");
117
+ this.x = t, this.y = e, this.currRoot = s;
118
+ }
119
+ static translate(t, e) {
120
+ return new c().translate(t, e);
121
+ }
122
+ static translateX(t) {
123
+ return new c().translateX(t);
124
+ }
125
+ static translateY(t) {
126
+ return new c().translateY(t);
127
+ }
128
+ static clamp(t) {
129
+ return new c().clamp(t);
130
+ }
131
+ static magnify(t) {
132
+ return new c().magnify(t);
133
+ }
134
+ static scale(t) {
135
+ return new c().scale(t);
136
+ }
137
+ static reBound(t) {
138
+ return new c().reBound(t);
139
+ }
140
+ translate(t, e) {
141
+ const s = M(t, e), n = this.copy();
142
+ return n.x = this.x.translate(s.x), n.y = this.y.translate(s.y), n;
143
+ }
144
+ translateX(t) {
145
+ const e = this.copy();
146
+ return e.x = this.x.translate(t), e;
147
+ }
148
+ translateY(t) {
149
+ const e = this.copy();
150
+ return e.y = this.y.translate(t), e;
151
+ }
152
+ magnify(t) {
153
+ const e = this.copy();
154
+ return e.x = this.x.magnify(t.x), e.y = this.y.magnify(t.y), e;
155
+ }
156
+ scale(t) {
157
+ const e = this.copy();
158
+ if (T(t)) {
159
+ const s = this.currRoot;
160
+ return e.currRoot = t.root, s != null && !I(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(x(t)), e.y = e.y.scale(h(t)), e;
161
+ }
162
+ return e.x = e.x.scale(t.width), e.y = e.y.scale(t.height), e;
163
+ }
164
+ reBound(t) {
165
+ const e = this.copy();
166
+ return e.x = this.x.reBound(x(t)), e.y = this.y.reBound(h(t)), e;
167
+ }
168
+ clamp(t) {
169
+ const e = this.copy();
170
+ return e.x = this.x.clamp(x(t)), e.y = this.y.clamp(h(t)), e;
171
+ }
172
+ copy() {
173
+ const t = new c();
174
+ return t.currRoot = this.currRoot, t.x = this.x, t.y = this.y, t;
175
+ }
176
+ reverse() {
177
+ const t = this.copy();
178
+ return t.x = this.x.reverse(), t.y = this.y.reverse(), t;
179
+ }
180
+ pos(t) {
181
+ return { x: this.x.pos(t.x), y: this.y.pos(t.y) };
182
+ }
183
+ box(t) {
184
+ return E(
185
+ this.pos(t.one),
186
+ this.pos(t.two),
187
+ 0,
188
+ 0,
189
+ this.currRoot ?? t.root
190
+ );
191
+ }
192
+ };
193
+ i(c, "IDENTITY", new c());
194
+ let f = c;
195
+ const k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
196
+ __proto__: null,
197
+ Scale: l,
198
+ XY: f,
199
+ crudeXYTransform: j,
200
+ xyScaleToTransform: X
201
+ }, Symbol.toStringTag, { value: "Module" }));
202
+ export {
203
+ Y as c,
204
+ k as s
205
+ };
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.defineProperty;var R=(n,t,e)=>t in n?g(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var i=(n,t,e)=>(R(n,typeof t!="symbol"?t+"":t,e),e);const v=require("zod"),x=require("./bounds-1ouRnRJS.cjs"),u=require("./box-CHDDKvN3.cjs"),T=require("./location-CZOgJmu5.cjs"),h=require("./xy-B4SvvNaG.cjs"),m=(n,t,e)=>(t!=null&&(n=Math.max(n,t)),e!=null&&(n=Math.min(n,e)),n),q=v.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],M=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]},Y=n=>(t,e,s)=>[n,s],j=()=>(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)]},z=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=M(s);return o.type="scale",r.ops.push(o),r}clamp(t,e){const s=x.construct(t,e),r=this.new(),o=z(s);return o.type="clamp",r.ops.push(o),r}reBound(t,e){const s=x.construct(t,e),r=this.new(),o=Y(s);return o.type="re-bound",r.ops.push(o),r}invert(){const t=j();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 D=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 L=Object.freeze(Object.defineProperty({__proto__:null,Scale:y,XY:d,crudeXYTransform:q,xyScaleToTransform:D},Symbol.toStringTag,{value:"Module"}));exports.clamp=m;exports.scale=L;
package/dist/scale.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./scale-DUBO0Q4s.cjs");exports.scale=e.scale;
package/dist/scale.js ADDED
@@ -0,0 +1,4 @@
1
+ import { s as e } from "./scale-DCbi48di.js";
2
+ export {
3
+ e as scale
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=(l,o,c)=>{let t=0,r=l.length-1;for(;t<=r;){const e=Math.floor((t+r)/2),n=c(l[e],o);if(n===0)return e;n<0?t=e+1:r=e-1}return-1},s={binary:i};exports.Search=s;
package/dist/search.js ADDED
@@ -0,0 +1,15 @@
1
+ const i = (l, r, c) => {
2
+ let e = 0, n = l.length - 1;
3
+ for (; e <= n; ) {
4
+ const t = Math.floor((e + n) / 2), o = c(l[t], r);
5
+ if (o === 0)
6
+ return t;
7
+ o < 0 ? e = t + 1 : n = t - 1;
8
+ }
9
+ return -1;
10
+ }, h = {
11
+ binary: i
12
+ };
13
+ export {
14
+ h as Search
15
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";var Y=Object.defineProperty;var G=(f,t,e)=>t in f?Y(f,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):f[t]=e;var s=(f,t,e)=>(G(f,typeof t!="symbol"?t+"":t,e),e);const L=require("./index-xjptNL6Z.cjs"),V=require("./index-CnZb0cyW.cjs"),z=require("./bounds-1ouRnRJS.cjs");require("./box-CHDDKvN3.cjs");require("./dimensions-Fe8DhhXU.cjs");require("./base-D3FrPu8C.cjs");require("./location-CZOgJmu5.cjs");require("./scale-DUBO0Q4s.cjs");require("./xy-B4SvvNaG.cjs");const c=require("zod");let Z="_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",k=(f=21)=>{let t="",e=f;for(;e--;)t+=Z[Math.random()*64|0];return t};const $=(f,t)=>{const e=new y(t);if(![w.DAY,w.HOUR,w.MINUTE,w.SECOND,w.MILLISECOND,w.MICROSECOND,w.NANOSECOND].some(u=>u.equals(e)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const r=f.valueOf()%e.valueOf();return f instanceof y?new y(r):new w(r)},i=class i{constructor(t,e="UTC"){s(this,"value");s(this,"encodeValue",!0);if(t==null)this.value=i.now().valueOf();else if(t instanceof Date)this.value=BigInt(t.getTime())*i.MILLISECOND.valueOf();else if(typeof t=="string")this.value=i.parseDateTimeString(t,e).valueOf();else if(Array.isArray(t))this.value=i.parseDate(t);else{let r=BigInt(0);t instanceof Number&&(t=t.valueOf()),e==="local"&&(r=i.utcOffset.valueOf()),typeof t=="number"&&(isFinite(t)?t=Math.trunc(t):(isNaN(t)&&(t=0),t===1/0?t=i.MAX:t=i.MIN)),this.value=BigInt(t.valueOf())+r}}static parseDate([t=1970,e=1,r=1]){const u=new Date(t,e-1,r,0,0,0,0);return new i(BigInt(u.getTime())*i.MILLISECOND.valueOf()).truncate(i.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(t,e="UTC"){const[r,u,h]=t.split(":");let g="00",S="00";h!=null&&([g,S]=h.split("."));let O=i.hours(parseInt(r??"00",10)).add(i.minutes(parseInt(u??"00",10))).add(i.seconds(parseInt(g??"00",10))).add(i.milliseconds(parseInt(S??"00",10)));return e==="local"&&(O=O.add(i.utcOffset)),O.valueOf()}static parseDateTimeString(t,e="UTC"){if(!t.includes("/")&&!t.includes("-"))return i.parseTimeString(t,e);const r=new Date(t);return t.includes(":")||r.setUTCHours(0,0,0,0),new i(BigInt(r.getTime())*i.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(i.utcOffset).date().toISOString()}timeString(t=!1,e="UTC"){const r=this.toISOString(e);return t?r.slice(11,23):r.slice(11,19)}dateString(){const t=this.date(),e=t.toLocaleString("default",{month:"short"}),r=t.toLocaleString("default",{day:"numeric"});return`${e} ${r}`}static get utcOffset(){return new w(BigInt(new Date().getTimezoneOffset())*i.MINUTE.valueOf())}static since(t){return new i().span(t)}date(){return new Date(this.milliseconds())}equals(t){return this.valueOf()===new i(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 i(t).valueOf()}afterEq(t){return this.valueOf()>=new i(t).valueOf()}before(t){return this.valueOf()<new i(t).valueOf()}beforeEq(t){return this.valueOf()<=new i(t).valueOf()}add(t){return new i(this.valueOf()+BigInt(t.valueOf()))}sub(t){return new i(this.valueOf()-BigInt(t.valueOf()))}milliseconds(){return Number(this.valueOf())/Number(i.MILLISECOND.valueOf())}toString(){return this.date().toISOString()}remainder(t){return $(this,t)}get isToday(){return this.truncate(w.DAY).equals(i.now().truncate(w.DAY))}truncate(t){return this.sub(this.remainder(t))}static now(){return new i(new Date)}static max(...t){let e=i.MIN;for(const r of t){const u=new i(r);u.after(e)&&(e=u)}return e}static min(...t){let e=i.MAX;for(const r of t){const u=new i(r);u.before(e)&&(e=u)}return e}static nanoseconds(t){return new i(t)}static microseconds(t){return i.nanoseconds(t*1e3)}static milliseconds(t){return i.microseconds(t*1e3)}static seconds(t){return i.milliseconds(t*1e3)}static minutes(t){return i.seconds(t*60)}static hours(t){return i.minutes(t*60)}static days(t){return i.hours(t*24)}};s(i,"NANOSECOND",i.nanoseconds(1)),s(i,"MICROSECOND",i.microseconds(1)),s(i,"MILLISECOND",i.milliseconds(1)),s(i,"SECOND",i.seconds(1)),s(i,"MINUTE",i.minutes(1)),s(i,"HOUR",i.hours(1)),s(i,"DAY",i.days(1)),s(i,"MAX",new i((1n<<63n)-1n)),s(i,"MIN",new i(0)),s(i,"ZERO",new i(0)),s(i,"z",c.z.union([c.z.object({value:c.z.bigint()}).transform(t=>new i(t.value)),c.z.string().transform(t=>new i(BigInt(t))),c.z.instanceof(Number).transform(t=>new i(t)),c.z.number().transform(t=>new i(t)),c.z.instanceof(i)]));let y=i;const a=class a{constructor(t){s(this,"value");s(this,"encodeValue",!0);typeof t=="number"&&(t=Math.trunc(t.valueOf())),this.value=BigInt(t.valueOf())}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(t){return this.valueOf()<new a(t).valueOf()}greaterThan(t){return this.valueOf()>new a(t).valueOf()}lessThanOrEqual(t){return this.valueOf()<=new a(t).valueOf()}greaterThanOrEqual(t){return this.valueOf()>=new a(t).valueOf()}remainder(t){return $(this,t)}truncate(t){return new a(BigInt(Math.trunc(Number(this.valueOf()/t.valueOf())))*t.valueOf())}toString(){const t=this.truncate(a.DAY),e=this.truncate(a.HOUR),r=this.truncate(a.MINUTE),u=this.truncate(a.SECOND),h=this.truncate(a.MILLISECOND),g=this.truncate(a.MICROSECOND),S=this.truncate(a.NANOSECOND),O=t,N=e.sub(t),p=r.sub(e),o=u.sub(r),B=h.sub(u),U=g.sub(h),q=S.sub(g);let A="";return O.isZero||(A+=`${O.days}d `),N.isZero||(A+=`${N.hours}h `),p.isZero||(A+=`${p.minutes}m `),o.isZero||(A+=`${o.seconds}s `),B.isZero||(A+=`${B.milliseconds}ms `),U.isZero||(A+=`${U.microseconds}µs `),q.isZero||(A+=`${q.nanoseconds}ns`),A.trim()}get days(){return Number(this.valueOf())/Number(a.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(a.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(a.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(a.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(a.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(a.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(t){return this.valueOf()===new a(t).valueOf()}add(t){return new a(this.valueOf()+new a(t).valueOf())}sub(t){return new a(this.valueOf()-new a(t).valueOf())}static nanoseconds(t=1){return new a(t)}static microseconds(t=1){return a.nanoseconds(t*1e3)}static milliseconds(t=1){return a.microseconds(t*1e3)}static seconds(t=1){return a.milliseconds(t*1e3)}static minutes(t){return a.seconds(t.valueOf()*60)}static hours(t){return a.minutes(t*60)}static days(t){return a.hours(t*24)}};s(a,"NANOSECOND",a.nanoseconds(1)),s(a,"MICROSECOND",a.microseconds(1)),s(a,"MILLISECOND",a.milliseconds(1)),s(a,"SECOND",a.seconds(1)),s(a,"MINUTE",a.minutes(1)),s(a,"HOUR",a.hours(1)),s(a,"DAY",a.days(1)),s(a,"MAX",new a((1n<<63n)-1n)),s(a,"MIN",new a(0)),s(a,"ZERO",new a(0)),s(a,"z",c.z.union([c.z.object({value:c.z.bigint()}).transform(t=>new a(t.value)),c.z.string().transform(t=>new a(BigInt(t))),c.z.instanceof(Number).transform(t=>new a(t)),c.z.number().transform(t=>new a(t)),c.z.instanceof(a)]));let w=a;const v=class v extends Number{constructor(t){t instanceof Number?super(t.valueOf()):super(t)}toString(){return`${this.valueOf()} Hz`}equals(t){return this.valueOf()===new v(t).valueOf()}get period(){return w.seconds(1/this.valueOf())}sampleCount(t){return new w(t).seconds*this.valueOf()}byteCount(t,e){return this.sampleCount(t)*new I(e).valueOf()}span(t){return w.seconds(t/this.valueOf())}byteSpan(t,e){return this.span(t.valueOf()/e.valueOf())}static hz(t){return new v(t)}static khz(t){return v.hz(t*1e3)}};s(v,"z",c.z.union([c.z.number().transform(t=>new v(t)),c.z.instanceof(Number).transform(t=>new v(t)),c.z.instanceof(v)]));let x=v;const m=class m extends Number{constructor(t){t instanceof Number?super(t.valueOf()):super(t)}length(t){return t.valueOf()/this.valueOf()}size(t){return new C(t*this.valueOf())}};s(m,"UNKNOWN",new m(0)),s(m,"BIT128",new m(16)),s(m,"BIT64",new m(8)),s(m,"BIT32",new m(4)),s(m,"BIT16",new m(2)),s(m,"BIT8",new m(1)),s(m,"z",c.z.union([c.z.number().transform(t=>new m(t)),c.z.instanceof(Number).transform(t=>new m(t)),c.z.instanceof(m)]));let I=m;const T=class T{constructor(t,e){s(this,"start");s(this,"end");typeof t=="object"&&"start"in t?(this.start=new y(t.start),this.end=new y(t.end)):(this.start=new y(t),this.end=new y(e))}get span(){return new w(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}swap(){return new T(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=w.ZERO){t=t.makeValid();const r=this.makeValid();if(this.equals(t))return!0;if(t.end.equals(r.start)||r.end.equals(t.start))return!1;const u=y.max(r.start,t.start),h=y.min(r.end,t.end);return h.before(u)?!1:new w(h.sub(u)).greaterThanOrEqual(e)}roughlyEquals(t,e){let r=this.start.sub(t.start).valueOf(),u=this.end.sub(t.end).valueOf();return r<0&&(r=-r),u<0&&(u=-u),r<=e.valueOf()&&u<=e.valueOf()}contains(t){return t instanceof T?this.contains(t.start)&&this.contains(t.end):this.start.beforeEq(t)&&this.end.after(t)}boundBy(t){const e=new T(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}};s(T,"MAX",new T(y.MIN,y.MAX)),s(T,"MIN",new T(y.MAX,y.MIN)),s(T,"ZERO",new T(y.ZERO,y.ZERO)),s(T,"z",c.z.union([c.z.object({start:y.z,end:y.z}).transform(t=>new T(t.start,t.end)),c.z.instanceof(T)]));let M=T;const n=class n extends String{constructor(t){if(t instanceof n||typeof t=="string"||typeof t.valueOf()=="string"){super(t.valueOf());return}else{const e=n.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);if(e!=null){super(e.valueOf());return}}throw super(n.UNKNOWN.valueOf()),new Error(`unable to find data type for ${t.toString()}`)}get Array(){const t=n.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()}toString(){return this.valueOf()}get isVariable(){return this.equals(n.JSON)||this.equals(n.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(n.UUID)}get isInteger(){return this.toString().startsWith("int")}get isFloat(){return this.toString().startsWith("float")}get density(){const t=n.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 n.BIG_INT_TYPES.some(t=>t.equals(this))}};s(n,"UNKNOWN",new n("unknown")),s(n,"FLOAT64",new n("float64")),s(n,"FLOAT32",new n("float32")),s(n,"INT64",new n("int64")),s(n,"INT32",new n("int32")),s(n,"INT16",new n("int16")),s(n,"INT8",new n("int8")),s(n,"UINT64",new n("uint64")),s(n,"UINT32",new n("uint32")),s(n,"UINT16",new n("uint16")),s(n,"UINT8",new n("uint8")),s(n,"BOOLEAN",n.UINT8),s(n,"TIMESTAMP",new n("timestamp")),s(n,"UUID",new n("uuid")),s(n,"STRING",new n("string")),s(n,"JSON",new n("json")),s(n,"ARRAY_CONSTRUCTORS",new Map([[n.UINT8.toString(),Uint8Array],[n.UINT16.toString(),Uint16Array],[n.UINT32.toString(),Uint32Array],[n.UINT64.toString(),BigUint64Array],[n.FLOAT32.toString(),Float32Array],[n.FLOAT64.toString(),Float64Array],[n.INT8.toString(),Int8Array],[n.INT16.toString(),Int16Array],[n.INT32.toString(),Int32Array],[n.INT64.toString(),BigInt64Array],[n.TIMESTAMP.toString(),BigInt64Array],[n.STRING.toString(),Uint8Array],[n.JSON.toString(),Uint8Array],[n.UUID.toString(),Uint8Array]])),s(n,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,n.UINT8],[Uint16Array.name,n.UINT16],[Uint32Array.name,n.UINT32],[BigUint64Array.name,n.UINT64],[Float32Array.name,n.FLOAT32],[Float64Array.name,n.FLOAT64],[Int8Array.name,n.INT8],[Int16Array.name,n.INT16],[Int32Array.name,n.INT32],[BigInt64Array.name,n.INT64]])),s(n,"DENSITIES",new Map([[n.UINT8.toString(),I.BIT8],[n.UINT16.toString(),I.BIT16],[n.UINT32.toString(),I.BIT32],[n.UINT64.toString(),I.BIT64],[n.FLOAT32.toString(),I.BIT32],[n.FLOAT64.toString(),I.BIT64],[n.INT8.toString(),I.BIT8],[n.INT16.toString(),I.BIT16],[n.INT32.toString(),I.BIT32],[n.INT64.toString(),I.BIT64],[n.TIMESTAMP.toString(),I.BIT64],[n.STRING.toString(),I.UNKNOWN],[n.JSON.toString(),I.UNKNOWN],[n.UUID.toString(),I.BIT128]])),s(n,"ALL",[n.UNKNOWN,n.FLOAT64,n.FLOAT32,n.INT64,n.INT32,n.INT16,n.INT8,n.UINT64,n.UINT32,n.UINT16,n.UINT8,n.TIMESTAMP,n.UUID,n.STRING,n.JSON]),s(n,"BIG_INT_TYPES",[n.INT64,n.UINT64,n.TIMESTAMP]),s(n,"z",c.z.union([c.z.string().transform(t=>new n(t)),c.z.instanceof(n)]));let d=n;const l=class l extends Number{constructor(t){super(t.valueOf())}largerThan(t){return this.valueOf()>t.valueOf()}smallerThan(t){return this.valueOf()<t.valueOf()}add(t){return l.bytes(this.valueOf()+t.valueOf())}sub(t){return l.bytes(this.valueOf()-t.valueOf())}truncate(t){return new l(Math.trunc(this.valueOf()/t.valueOf())*t.valueOf())}remainder(t){return l.bytes(this.valueOf()%t.valueOf())}get gigabytes(){return this.valueOf()/l.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/l.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/l.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/l.TERABYTE.valueOf()}toString(){const t=this.truncate(l.TERABYTE),e=this.truncate(l.GIGABYTE),r=this.truncate(l.MEGABYTE),u=this.truncate(l.KILOBYTE),h=this.truncate(l.BYTE),g=t,S=e.sub(t),O=r.sub(e),N=u.sub(r),p=h.sub(u);let o="";return g.isZero||(o+=`${g.terabytes}TB `),S.isZero||(o+=`${S.gigabytes}GB `),O.isZero||(o+=`${O.megabytes}MB `),N.isZero||(o+=`${N.kilobytes}KB `),(!p.isZero||o==="")&&(o+=`${p.valueOf()}B`),o.trim()}static bytes(t=1){return new l(t)}static kilobytes(t=1){return l.bytes(t.valueOf()*1e3)}static megabytes(t=1){return l.kilobytes(t.valueOf()*1e3)}static gigabytes(t=1){return l.megabytes(t.valueOf()*1e3)}static terabytes(t){return l.gigabytes(t.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};s(l,"BYTE",new l(1)),s(l,"KILOBYTE",l.kilobytes(1)),s(l,"MEGABYTE",l.megabytes(1)),s(l,"GIGABYTE",l.gigabytes(1)),s(l,"TERABYTE",l.terabytes(1)),s(l,"ZERO",new l(0)),s(l,"z",c.z.union([c.z.number().transform(t=>new l(t)),c.z.instanceof(l)]));let C=l;const J=c.z.union([c.z.instanceof(Uint8Array),c.z.instanceof(Uint16Array),c.z.instanceof(Uint32Array),c.z.instanceof(BigUint64Array),c.z.instanceof(Float32Array),c.z.instanceof(Float64Array),c.z.instanceof(Int8Array),c.z.instanceof(Int16Array),c.z.instanceof(Int32Array),c.z.instanceof(BigInt64Array)]),D=f=>{const t=typeof f;return t==="string"||t==="number"||t==="boolean"||t==="bigint"||f instanceof y||f instanceof w||f instanceof Date},F=(f,t,e,r=0)=>f.usesBigInt&&!t.usesBigInt?Number(e)-Number(r):!f.usesBigInt&&t.usesBigInt?BigInt(e)-BigInt(r):R(e,-r),P=f=>f==null?!1:Array.isArray(f)||f instanceof ArrayBuffer||ArrayBuffer.isView(f)&&!(f instanceof DataView)||f instanceof b?!0:D(f),E=-1;class b{constructor(t){s(this,"key","");s(this,"isSynnaxSeries",!0);s(this,"dataType");s(this,"sampleOffset");s(this,"gl");s(this,"_data");s(this,"_timeRange");s(this,"alignment",0n);s(this,"_cachedMin");s(this,"_cachedMax");s(this,"writePos",E);s(this,"_refCount",0);s(this,"_cachedLength");P(t)&&(t={data:t});const{dataType:e,timeRange:r,sampleOffset:u=0,glBufferUsage:h="static",alignment:g=0n,key:S=k()}=t,{data:O}=t;if(O instanceof b||typeof O=="object"&&"isSynnaxSeries"in O&&O.isSynnaxSeries===!0){const o=O;this.key=o.key,this.dataType=o.dataType,this.sampleOffset=o.sampleOffset,this.gl=o.gl,this._data=o._data,this._timeRange=o._timeRange,this.alignment=o.alignment,this._cachedMin=o._cachedMin,this._cachedMax=o._cachedMax,this.writePos=o.writePos,this._refCount=o._refCount,this._cachedLength=o._cachedLength;return}const N=D(O),p=Array.isArray(O);if(e!=null)this.dataType=new d(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(p||N){let o=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.");o=O[0]}if(typeof o=="string")this.dataType=d.STRING;else if(typeof o=="number")this.dataType=d.FLOAT64;else if(typeof o=="bigint")this.dataType=d.INT64;else if(typeof o=="boolean")this.dataType=d.BOOLEAN;else if(o instanceof y||o instanceof Date||o instanceof y)this.dataType=d.TIMESTAMP;else if(typeof o=="object")this.dataType=d.JSON;else throw new Error(`cannot infer data type of ${typeof o} when constructing a Series from a JS array`)}else this.dataType=new d(O)}if(!p&&!N)this._data=O;else{let o=N?[O]:O;const B=o[0];(B instanceof y||B instanceof Date||B instanceof w)&&(o=o.map(U=>new y(U).valueOf())),this.dataType.equals(d.STRING)?(this._cachedLength=o.length,this._data=new TextEncoder().encode(o.join(`
2
+ `)+`
3
+ `)):this.dataType.equals(d.JSON)?(this._cachedLength=o.length,this._data=new TextEncoder().encode(o.map(U=>JSON.stringify(U)).join(`
4
+ `)+`
5
+ `)):this._data=new this.dataType.Array(o).buffer}this.key=S,this.alignment=g,this.sampleOffset=u??0,this._timeRange=r,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:h}}static alloc({capacity:t,dataType:e,...r}){if(t===0)throw new Error("[Series] - cannot allocate an array of length 0");const u=new new d(e).Array(t),h=new b({data:u.buffer,dataType:e,...r});return h.writePos=0,h}static generateTimestamps(t,e,r){const u=r.spanRange(e.span(t)),h=new BigInt64Array(t);for(let g=0;g<t;g++)h[g]=BigInt(r.add(e.span(g)).valueOf());return new b({data:h,dataType:d.TIMESTAMP,timeRange:u})}get refCount(){return this._refCount}static fromStrings(t,e){const r=new TextEncoder().encode(t.join(`
6
+ `)+`
7
+ `);return new b({data:r,dataType:d.STRING,timeRange:e})}static fromJSON(t,e){const r=new TextEncoder().encode(t.map(u=>JSON.stringify(u)).join(`
8
+ `)+`
9
+ `);return new b({data:r,dataType:d.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");if(this.writePos===E)return 0;const e=this.capacity-this.writePos,r=e<t.length?t.slice(0,e):t;return this.underlyingData.set(r.data,this.writePos),this.maybeRecomputeMinMax(r),this._cachedLength=void 0,this.writePos+=r.length,r.length}get buffer(){return this._data}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.equals(d.STRING))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
10
+ `).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(d.UUID))throw new Error("cannot convert non-uuid series to uuids");const t=d.UUID.density.valueOf(),e=Array(this.length);for(let r=0;r<this.length;r++){const u=this.buffer.slice(r*t,(r+1)*t),h=Array.from(new Uint8Array(u),g=>g.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");e[r]=h}return e}parseJSON(t){if(!this.dataType.equals(d.JSON))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
11
+ `).slice(0,-1).map(e=>t.parse(L.toCamel(JSON.parse(e))))}get timeRange(){if(this._timeRange==null)throw new Error("time range not set on series");return this._timeRange}get byteCapacity(){return new C(this.buffer.byteLength)}get capacity(){return this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===E?this.byteCapacity: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;return this.data.forEach(e=>{e===10&&t++}),this._cachedLength=t,t}convert(t,e=0){if(this.dataType.equals(t))return this;const r=new t.Array(this.length);for(let u=0;u<this.length;u++)r[u]=F(this.dataType,t,this.data[u],e);return new b({data:r.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(d.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const t=this.data;this._cachedMax=t.reduce((e,r)=>e>r?e:r)}else{const t=this.data;this._cachedMax=t.reduce((e,r)=>e>r?e:r)}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==null&&(this._cachedMax=this.calcRawMax()),R(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(d.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const t=this.data;this._cachedMin=t.reduce((e,r)=>e<r?e:r)}else{const t=this.data;this._cachedMin=t.reduce((e,r)=>e<r?e:r)}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==null&&(this._cachedMin=this.calcRawMin()),R(this._cachedMin,this.sampleOffset))}get bounds(){return z.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 R(this.max,-this.min)}at(t,e){if(this.dataType.isVariable)return this.atVariable(t,e??!1);t<0&&(t=this.length+t);const r=this.data[t];if(r==null){if(e===!0)throw new Error(`[series] - no value at index ${t}`);return}return R(r,this.sampleOffset)}atVariable(t,e){t<0&&(t=this.length+t);let r=0,u=0;for(let g=0;g<this.data.length;g++)if(this.data[g]===10){if(t===0){u=g;break}r=g+1,t--}if(u===0&&(u=this.data.length),r>=u||t>0){if(e)throw new Error(`[series] - no value at index ${t}`);return}const h=this.data.slice(r,u);return this.dataType.equals(d.STRING)?new TextDecoder().decode(h):L.toCamel(JSON.parse(new TextDecoder().decode(h)))}binarySearch(t){let e=0,r=this.length-1;const u=V.newF(t);for(;e<=r;){const h=Math.floor((e+r)/2),g=u(this.at(h,!0),t);if(g===0)return h;g<0?e=h+1:r=h-1}return e}updateGLBuffer(t){if(this.gl.control=t,!this.dataType.equals(d.FLOAT32))throw new Error("Only FLOAT32 arrays can be used in WebGL");const{buffer:e,bufferUsage:r,prevBuffer:u}=this.gl;if(e==null&&(this.gl.buffer=t.createBuffer()),this.writePos!==u)if(t.bindBuffer(t.ARRAY_BUFFER,this.gl.buffer),this.writePos!==E){u===0&&t.bufferData(t.ARRAY_BUFFER,this.byteCapacity.valueOf(),t.STATIC_DRAW);const h=this.dataType.density.size(u).valueOf(),g=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);t.bufferSubData(t.ARRAY_BUFFER,h,g.buffer),this.gl.prevBuffer=this.writePos}else t.bufferData(t.ARRAY_BUFFER,this.buffer,r==="static"?t.STATIC_DRAW:t.DYNAMIC_DRAW),this.gl.prevBuffer=E}as(t){if(t==="string"){if(!this.dataType.equals(d.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(d.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 z.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 W(this);return this.dataType.equals(d.JSON)?new K(t):t}return new j(this)}slice(t,e){if(t<=0&&(e==null||e>=this.length))return this;const r=this.data.slice(t,e);return new b({data:r,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(t){return new b({data:this.buffer,dataType:this.dataType,timeRange:M.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:t})}}class W{constructor(t){s(this,"series");s(this,"index");s(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]!==10;)this.index++;const r=this.index;return t===r?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(t,r))})}[Symbol.iterator](){return this}}var Q;class K{constructor(t){s(this,"wrapped");s(this,Q,"JSONSeriesIterator");this.wrapped=t}next(){const t=this.wrapped.next();return t.done===!0?{done:!0,value:void 0}:{done:!1,value:L.toCamel(JSON.parse(t.value))}}[Symbol.iterator](){return this}}Q=Symbol.toStringTag;var _;class j{constructor(t){s(this,"series");s(this,"index");s(this,_,"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)}}[Symbol.iterator](){return this}}_=Symbol.toStringTag;const R=(f,t)=>typeof f=="bigint"&&typeof t=="bigint"||typeof f=="number"&&typeof t=="number"?f+t:t===0?f:f===0?t:Number(f)+Number(t);class H{constructor(t){s(this,"series");if(t.length!==0){const e=t[0].dataType;for(let r=1;r<t.length;r++)if(!t[r].dataType.equals(e))throw new Error("[multi-series] - series must have the same data type")}this.series=t}as(t){if(!new d(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?d.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)}push(t){this.series.push(t)}get length(){return this.series.reduce((t,e)=>t+e.length,0)}at(t,e=!1){t<0&&(t=this.length+t);for(const r of this.series){if(t<r.length)return r.at(t,e);t-=r.length}if(e)throw new Error(`[series] - no value at index ${t}`)}get byteLength(){return new C(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 r of this.series)t.set(r.data,e),e+=r.length;return new this.dataType.Array(t)}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new X(this.series)}}var tt;class X{constructor(t){s(this,"series");s(this,"seriesIndex");s(this,"internal");s(this,tt,"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())}[Symbol.iterator](){return this}}tt=Symbol.toStringTag;exports.DataType=d;exports.Density=I;exports.MultiSeries=H;exports.Rate=x;exports.Series=b;exports.Size=C;exports.TimeRange=M;exports.TimeSpan=w;exports.TimeStamp=y;exports.addSamples=R;exports.convertDataType=F;exports.isCrudeSeries=P;exports.isTelemValue=D;exports.typedArrayZ=J;