@synnaxlabs/pluto 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Animated-DPIV1IH6.js → Animated-BpuQZROI.js} +3 -3
- package/dist/{Animated-DjcnDVGC.cjs → Animated-DqAjXT8r.cjs} +1 -1
- package/dist/{Keyboard-BLHHROrq.js → Keyboard-BTyEk3pg.js} +3 -3
- package/dist/{Keyboard-CJLEUbYu.cjs → Keyboard-GDYsV4-x.cjs} +1 -1
- package/dist/{LinePlot-C9MVJErC.js → LinePlot-CQAK-dkX.js} +4110 -3906
- package/dist/LinePlot-DnLLplw_.cjs +66 -0
- package/dist/{Link-BsqVxj6V.js → Link-BrhOiMiE.js} +2 -2
- package/dist/Link-CpMcH9c1.cjs +1 -0
- package/dist/List-BS57aL1n.js +22 -0
- package/dist/List-Dux7qweq.cjs +1 -0
- package/dist/{Pack-mkZBsSIU.js → Pack-CCCsIeot.js} +6 -6
- package/dist/{Pack-CBNcamuh.cjs → Pack-_i2cfPYc.cjs} +1 -1
- package/dist/{Toggle-W4K3cLf7.js → Toggle-CpLFBHo7.js} +17239 -17153
- package/dist/Toggle-DlNzb7nt.cjs +143 -0
- package/dist/{Video-C2EYBKLN.js → Video-Bi9kFIHV.js} +2 -2
- package/dist/{Video-Kb-c-N69.cjs → Video-THwAEuOy.cjs} +1 -1
- package/dist/{aggregator-BZJAV5yZ.js → aggregator-CoD5WrqU.js} +5151 -5636
- package/dist/aggregator-D47lwtdn.cjs +51 -0
- package/dist/align.cjs +1 -1
- package/dist/align.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/color.cjs +1 -1
- package/dist/color.js +1 -1
- package/dist/css-CC1MhhH7.cjs +1 -0
- package/dist/css-Ce6IGevn.js +1042 -0
- package/dist/css.cjs +1 -1
- package/dist/css.js +2 -2
- package/dist/dropdown.cjs +1 -1
- package/dist/dropdown.js +1 -1
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +9 -9
- package/dist/{external-DjjMU4Z6.cjs → external-B7RXnD0a.cjs} +1 -1
- package/dist/external-B815mDB0.cjs +1 -0
- package/dist/external-BxBMVx6g.js +97 -0
- package/dist/{external-CduvGaPN.js → external-C6v1z0ty.js} +37 -51
- package/dist/{external-XoJlPNFB.js → external-C8CIAjMj.js} +2 -2
- package/dist/external-CLwP0eXe.cjs +1 -0
- package/dist/{external-mlV4Onnq.cjs → external-CMk1k986.cjs} +1 -1
- package/dist/external-CUJXIrxM.cjs +1 -0
- package/dist/{external-0w2SHXg_.js → external-CXrgzQf5.js} +2 -2
- package/dist/external-Cv5GChi6.js +344 -0
- package/dist/{external-BKWizK6o.cjs → external-DMYExlt2.cjs} +1 -1
- package/dist/{external-WGyRiKbb.js → external-DQ4EhNBA.js} +32 -32
- package/dist/external-DRvtVPhp.cjs +1 -0
- package/dist/external-DShO9063.js +74 -0
- package/dist/external-DU5Xqqld.cjs +1 -0
- package/dist/external-D_WKlwCh.js +231 -0
- package/dist/{external-DlCoToEB.cjs → external-DjSiwSCE.cjs} +1 -1
- package/dist/external-Dm3eiIEN.cjs +1 -0
- package/dist/external-Do75w1Zt.cjs +1 -0
- package/dist/{external-DsNtnR-y.cjs → external-DqnUE4mV.cjs} +1 -1
- package/dist/external-DyTzmzSc.js +93 -0
- package/dist/{external-BB2SaR1o.js → external-NHkWeW29.js} +1 -1
- package/dist/external-NeMo53nv.js +271 -0
- package/dist/{external-TNsi3_BK.js → external-e0OPlFyY.js} +26 -26
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +4937 -4262
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/{jsx-runtime-DqxPLdyS.js → jsx-runtime-B6kdoens.js} +225 -214
- package/dist/jsx-runtime-Cek9Ww4S.cjs +30 -0
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/src/accordion/Accordion.d.ts +2 -2
- package/dist/src/aether/aether/aether.d.ts +5 -5
- package/dist/src/aether/main.d.ts +4 -4
- package/dist/src/aether/main.d.ts.map +1 -1
- package/dist/src/aether/test/test.d.ts +1 -1
- package/dist/src/aether/test/test.d.ts.map +1 -1
- package/dist/src/alamos/Provider.d.ts +3 -3
- package/dist/src/alamos/aether/alamos.d.ts +2 -2
- package/dist/src/alamos/aether/alamos.d.ts.map +1 -1
- package/dist/src/align/Center.d.ts +1 -1
- package/dist/src/align/Center.d.ts.map +1 -1
- package/dist/src/align/Pack.d.ts +1 -1
- package/dist/src/align/Pack.d.ts.map +1 -1
- package/dist/src/align/Space.d.ts +3 -3
- package/dist/src/align/Space.d.ts.map +1 -1
- package/dist/src/button/Button.d.ts +15 -11
- package/dist/src/button/Button.d.ts.map +1 -1
- package/dist/src/button/Icon.d.ts +2 -2
- package/dist/src/button/Link.d.ts +3 -3
- package/dist/src/button/Link.d.ts.map +1 -1
- package/dist/src/button/Toggle.d.ts +8 -8
- package/dist/src/button/color.d.ts +2 -2
- package/dist/src/button/color.d.ts.map +1 -1
- package/dist/src/channel/AliasProvider.d.ts +2 -2
- package/dist/src/channel/AliasProvider.d.ts.map +1 -1
- package/dist/src/channel/LinePlot.d.ts +11 -8
- package/dist/src/channel/LinePlot.d.ts.map +1 -1
- package/dist/src/channel/Select.d.ts +2 -2
- package/dist/src/color/Picker/Picker.d.ts +2 -2
- package/dist/src/color/Swatch/Swatch.d.ts +4 -4
- package/dist/src/color/core/color.d.ts +7 -0
- package/dist/src/color/core/color.d.ts.map +1 -1
- package/dist/src/css/color.d.ts.map +1 -1
- package/dist/src/css/css.d.ts +4 -4
- package/dist/src/css/css.d.ts.map +1 -1
- package/dist/src/css/vars.d.ts.map +1 -1
- package/dist/src/dialog/index.d.ts +2 -0
- package/dist/src/dialog/index.d.ts.map +1 -0
- package/dist/src/dialog/use.d.ts +28 -0
- package/dist/src/dialog/use.d.ts.map +1 -0
- package/dist/src/divider/Divider.d.ts +2 -2
- package/dist/src/divider/Divider.d.ts.map +1 -1
- package/dist/src/dropdown/Dropdown.d.ts +8 -30
- package/dist/src/dropdown/Dropdown.d.ts.map +1 -1
- package/dist/src/form/Field.d.ts +35 -0
- package/dist/src/form/Field.d.ts.map +1 -0
- package/dist/src/form/Form.d.ts +19 -49
- package/dist/src/form/Form.d.ts.map +1 -1
- package/dist/src/form/external.d.ts +1 -0
- package/dist/src/form/external.d.ts.map +1 -1
- package/dist/src/generic/Generic.d.ts +1 -1
- package/dist/src/generic/Generic.d.ts.map +1 -1
- package/dist/src/hardware/device/Select.d.ts +2 -2
- package/dist/src/haul/Haul.d.ts +84 -3
- package/dist/src/haul/Haul.d.ts.map +1 -1
- package/dist/src/header/Actions.d.ts +1 -1
- package/dist/src/header/ButtonTitle.d.ts +1 -1
- package/dist/src/header/Header.d.ts +2 -2
- package/dist/src/header/Title.d.ts +1 -1
- package/dist/src/hooks/effect.d.ts.map +1 -1
- package/dist/src/hooks/ref.d.ts +3 -3
- package/dist/src/hooks/ref.d.ts.map +1 -1
- package/dist/src/hooks/useCursorDrag/types.d.ts +1 -1
- package/dist/src/hooks/useCursorDrag/useCursorDrag.d.ts +2 -2
- package/dist/src/hooks/useDebouncedCallback.d.ts.map +1 -1
- package/dist/src/hooks/useFilter.d.ts +1 -1
- package/dist/src/hooks/useFilter.d.ts.map +1 -1
- package/dist/src/hooks/useRequiredContext.d.ts.map +1 -1
- package/dist/src/hooks/useResize.d.ts +1 -1
- package/dist/src/hooks/useResize.d.ts.map +1 -1
- package/dist/src/hooks/useTransforms.d.ts.map +1 -1
- package/dist/src/hooks/useUniqueKey.d.ts.map +1 -1
- package/dist/src/icon/Icon.d.ts +14 -0
- package/dist/src/icon/Icon.d.ts.map +1 -0
- package/dist/src/icon/index.d.ts +2 -0
- package/dist/src/icon/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/input/Date.d.ts +1 -1
- package/dist/src/input/Date.d.ts.map +1 -1
- package/dist/src/input/DateTime.d.ts +1 -1
- package/dist/src/input/DragButton.d.ts +3 -3
- package/dist/src/input/HelpText.d.ts +2 -2
- package/dist/src/input/Item.d.ts +2 -2
- package/dist/src/input/Numeric.d.ts +3 -3
- package/dist/src/input/Numeric.d.ts.map +1 -1
- package/dist/src/input/Switch.d.ts.map +1 -1
- package/dist/src/input/Text.d.ts +2 -0
- package/dist/src/input/Text.d.ts.map +1 -1
- package/dist/src/input/TextArea.d.ts +1 -1
- package/dist/src/input/Time.d.ts +2 -2
- package/dist/src/input/Time.d.ts.map +1 -1
- package/dist/src/input/types.d.ts +2 -2
- package/dist/src/list/Column.d.ts +7 -6
- package/dist/src/list/Column.d.ts.map +1 -1
- package/dist/src/list/Core.d.ts +4 -4
- package/dist/src/list/Core.d.ts.map +1 -1
- package/dist/src/list/Data.d.ts +5 -3
- package/dist/src/list/Data.d.ts.map +1 -1
- package/dist/src/list/Filter.d.ts +4 -4
- package/dist/src/list/Filter.d.ts.map +1 -1
- package/dist/src/list/Hover.d.ts +1 -1
- package/dist/src/list/Hover.d.ts.map +1 -1
- package/dist/src/list/Item.d.ts +3 -3
- package/dist/src/list/Item.d.ts.map +1 -1
- package/dist/src/list/List.d.ts +1 -1
- package/dist/src/list/List.d.ts.map +1 -1
- package/dist/src/list/Search.d.ts +3 -3
- package/dist/src/list/Search.d.ts.map +1 -1
- package/dist/src/list/Selector.d.ts +3 -9
- package/dist/src/list/Selector.d.ts.map +1 -1
- package/dist/src/list/types.d.ts.map +1 -1
- package/dist/src/list/useSelect.d.ts +6 -2
- package/dist/src/list/useSelect.d.ts.map +1 -1
- package/dist/src/memo/useMemoCompare.d.ts +1 -1
- package/dist/src/memo/useMemoCompare.d.ts.map +1 -1
- package/dist/src/menu/ContextMenu.d.ts +2 -2
- package/dist/src/menu/Item.d.ts +7 -7
- package/dist/src/menu/Item.d.ts.map +1 -1
- package/dist/src/menu/Menu.d.ts +7 -5
- package/dist/src/menu/Menu.d.ts.map +1 -1
- package/dist/src/mock/MockGLBufferController.d.ts +1 -1
- package/dist/src/modal/Modal.d.ts +8 -0
- package/dist/src/modal/Modal.d.ts.map +1 -0
- package/dist/src/modal/index.d.ts +2 -0
- package/dist/src/modal/index.d.ts.map +1 -0
- package/dist/src/mosaic/Mosaic.d.ts +6 -5
- package/dist/src/mosaic/Mosaic.d.ts.map +1 -1
- package/dist/src/mosaic/tree.d.ts +3 -2
- package/dist/src/mosaic/tree.d.ts.map +1 -1
- package/dist/src/mosaic/types.d.ts +63 -1
- package/dist/src/mosaic/types.d.ts.map +1 -1
- package/dist/src/mosaic/use.d.ts +1 -1
- package/dist/src/nav/Bar.d.ts +2 -2
- package/dist/src/nav/Bar.d.ts.map +1 -1
- package/dist/src/nav/Drawer.d.ts +3 -3
- package/dist/src/note/Note.d.ts +1 -1
- package/dist/src/note/Note.d.ts.map +1 -1
- package/dist/src/observe/index.d.ts +2 -0
- package/dist/src/observe/index.d.ts.map +1 -0
- package/dist/src/observe/use.d.ts +19 -0
- package/dist/src/observe/use.d.ts.map +1 -0
- package/dist/src/os/Controls/Controls.d.ts +2 -2
- package/dist/src/os/Controls/Mac.d.ts +1 -1
- package/dist/src/os/Controls/Windows.d.ts +2 -2
- package/dist/src/os/Controls/Windows.d.ts.map +1 -1
- package/dist/src/os/Controls/types.d.ts +1 -1
- package/dist/src/os/use.d.ts.map +1 -1
- package/dist/src/pluto/Pluto.d.ts +8 -8
- package/dist/src/portal/Portal.d.ts +0 -1
- package/dist/src/portal/Portal.d.ts.map +1 -1
- package/dist/src/ranger/SelectLabel.d.ts +2 -2
- package/dist/src/ranger/TimeRangeChip.d.ts +4 -3
- package/dist/src/ranger/TimeRangeChip.d.ts.map +1 -1
- package/dist/src/resize/Core.d.ts +1 -1
- package/dist/src/resize/Multiple.d.ts +2 -2
- package/dist/src/resize/Single.d.ts +2 -2
- package/dist/src/select/Button.d.ts +8 -8
- package/dist/src/select/Button.d.ts.map +1 -1
- package/dist/src/select/ClearButton.d.ts +1 -1
- package/dist/src/select/ClearButton.d.ts.map +1 -1
- package/dist/src/select/DataType.d.ts +1 -1
- package/dist/src/select/DataType.d.ts.map +1 -1
- package/dist/src/select/Direction.d.ts +2 -2
- package/dist/src/select/List.d.ts +6 -5
- package/dist/src/select/List.d.ts.map +1 -1
- package/dist/src/select/Multiple.d.ts +10 -9
- package/dist/src/select/Multiple.d.ts.map +1 -1
- package/dist/src/select/Select.spec.d.ts.map +1 -1
- package/dist/src/select/Single.d.ts +9 -7
- package/dist/src/select/Single.d.ts.map +1 -1
- package/dist/src/state/state.d.ts +2 -1
- package/dist/src/state/state.d.ts.map +1 -1
- package/dist/src/status/Aggregator.d.ts +4 -4
- package/dist/src/status/Circle.d.ts +2 -2
- package/dist/src/status/Notification.d.ts +4 -4
- package/dist/src/status/Notification.d.ts.map +1 -1
- package/dist/src/status/Text.d.ts +2 -2
- package/dist/src/status/Text.d.ts.map +1 -1
- package/dist/src/status/aether/aggregator.d.ts +3 -3
- package/dist/src/status/aether/aggregator.d.ts.map +1 -1
- package/dist/src/status/aether/types.d.ts +1 -1
- package/dist/src/steps/Steps.d.ts +2 -2
- package/dist/src/synnax/Provider.d.ts +2 -2
- package/dist/src/synnax/Provider.d.ts.map +1 -1
- package/dist/src/synnax/aether/provider.d.ts +14 -14
- package/dist/src/synnax/aether/provider.d.ts.map +1 -1
- package/dist/src/tabs/Selector.d.ts +6 -12
- package/dist/src/tabs/Selector.d.ts.map +1 -1
- package/dist/src/tabs/Tabs.d.ts +8 -13
- package/dist/src/tabs/Tabs.d.ts.map +1 -1
- package/dist/src/tabs/external.d.ts +1 -0
- package/dist/src/tabs/external.d.ts.map +1 -1
- package/dist/src/tabs/types.d.ts +54 -0
- package/dist/src/tabs/types.d.ts.map +1 -0
- package/dist/src/tag/Tag.d.ts +3 -3
- package/dist/src/telem/Provider.d.ts +1 -1
- package/dist/src/telem/aether/context.d.ts +4 -4
- package/dist/src/telem/aether/context.d.ts.map +1 -1
- package/dist/src/telem/aether/factory.d.ts +1 -1
- package/dist/src/telem/aether/factory.d.ts.map +1 -1
- package/dist/src/telem/aether/noop.d.ts +1 -1
- package/dist/src/telem/aether/pipeline.d.ts +3 -3
- package/dist/src/telem/aether/pipeline.d.ts.map +1 -1
- package/dist/src/telem/aether/provider.d.ts +6 -6
- package/dist/src/telem/aether/remote.d.ts +3 -3
- package/dist/src/telem/aether/remote.d.ts.map +1 -1
- package/dist/src/telem/aether/static.d.ts +3 -3
- package/dist/src/telem/aether/telem.d.ts +3 -3
- package/dist/src/telem/aether/transformers.d.ts +3 -3
- package/dist/src/telem/aether/transformers.d.ts.map +1 -1
- package/dist/src/telem/client/cache/cache.d.ts +3 -3
- package/dist/src/telem/client/cache/static.d.ts +1 -1
- package/dist/src/telem/client/cache/unary.d.ts +3 -3
- package/dist/src/telem/client/client.d.ts +4 -5
- package/dist/src/telem/client/client.d.ts.map +1 -1
- package/dist/src/telem/client/reader.d.ts +4 -4
- package/dist/src/telem/client/streamer.d.ts +4 -4
- package/dist/src/telem/client/types.d.ts +1 -1
- package/dist/src/telem/control/Chip.d.ts +3 -3
- package/dist/src/telem/control/Chip.d.ts.map +1 -1
- package/dist/src/telem/control/Controller.d.ts +4 -4
- package/dist/src/telem/control/Indicator.d.ts +3 -3
- package/dist/src/telem/control/Legend.d.ts +1 -1
- package/dist/src/telem/control/Legend.d.ts.map +1 -1
- package/dist/src/telem/control/StateProvider.d.ts +3 -3
- package/dist/src/telem/control/aether/chip.d.ts +3 -3
- package/dist/src/telem/control/aether/controller.d.ts +8 -8
- package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
- package/dist/src/telem/control/aether/indicator.d.ts +3 -3
- package/dist/src/telem/control/aether/legend.d.ts +3 -3
- package/dist/src/telem/control/aether/state.d.ts +5 -5
- package/dist/src/telem/test/mock.d.ts +2 -2
- package/dist/src/testutil/dom.d.ts.map +1 -1
- package/dist/src/text/DateTime.d.ts +5 -5
- package/dist/src/text/DateTime.d.ts.map +1 -1
- package/dist/src/text/Editable.d.ts +8 -7
- package/dist/src/text/Editable.d.ts.map +1 -1
- package/dist/src/text/Keyboard.d.ts +3 -3
- package/dist/src/text/Keyboard.d.ts.map +1 -1
- package/dist/src/text/Link.d.ts +3 -3
- package/dist/src/text/Link.d.ts.map +1 -1
- package/dist/src/text/SelectLevel.d.ts +2 -2
- package/dist/src/text/Text.d.ts +4 -4
- package/dist/src/text/Text.d.ts.map +1 -1
- package/dist/src/text/WithIcon.d.ts +5 -5
- package/dist/src/text/WithIcon.d.ts.map +1 -1
- package/dist/src/text/core/types.d.ts +1 -1
- package/dist/src/text/dimensions.d.ts.map +1 -1
- package/dist/src/theming/Provider.d.ts +4 -4
- package/dist/src/theming/Provider.d.ts.map +1 -1
- package/dist/src/theming/aether/provider.d.ts +2 -2
- package/dist/src/theming/aether/provider.d.ts.map +1 -1
- package/dist/src/theming/core/fontString.d.ts +2 -2
- package/dist/src/theming/core/fontString.d.ts.map +1 -1
- package/dist/src/theming/core/theme.d.ts +1 -1
- package/dist/src/theming/css.d.ts.map +1 -1
- package/dist/src/theming/font.d.ts.map +1 -1
- package/dist/src/tooltip/Config.d.ts +1 -1
- package/dist/src/tooltip/Dialog.d.ts +2 -2
- package/dist/src/tooltip/Dialog.d.ts.map +1 -1
- package/dist/src/tooltip/wrap.d.ts +1 -1
- package/dist/src/tooltip/wrap.d.ts.map +1 -1
- package/dist/src/tree/Tree.d.ts +16 -11
- package/dist/src/tree/Tree.d.ts.map +1 -1
- package/dist/src/tree/core.d.ts +2 -1
- package/dist/src/tree/core.d.ts.map +1 -1
- package/dist/src/triggers/Provider.d.ts +2 -2
- package/dist/src/triggers/Status.d.ts +1 -1
- package/dist/src/triggers/Text.d.ts +4 -4
- package/dist/src/triggers/Text.d.ts.map +1 -1
- package/dist/src/triggers/hooks.d.ts +4 -4
- package/dist/src/triggers/hooks.d.ts.map +1 -1
- package/dist/src/triggers/triggers.d.ts +3 -2
- package/dist/src/triggers/triggers.d.ts.map +1 -1
- package/dist/src/triggers/useDrag.d.ts +2 -2
- package/dist/src/util/children.d.ts +2 -2
- package/dist/src/util/children.d.ts.map +1 -1
- package/dist/src/util/component.d.ts +1 -1
- package/dist/src/util/component.d.ts.map +1 -1
- package/dist/src/util/renderProp.d.ts +1 -1
- package/dist/src/util/renderProp.d.ts.map +1 -1
- package/dist/src/util/rootElement.d.ts +2 -0
- package/dist/src/util/rootElement.d.ts.map +1 -0
- package/dist/src/util/zod.d.ts.map +1 -1
- package/dist/src/viewport/Mask.d.ts.map +1 -1
- package/dist/src/viewport/SelectMode.d.ts +2 -2
- package/dist/src/viewport/use.d.ts +4 -2
- package/dist/src/viewport/use.d.ts.map +1 -1
- package/dist/src/vis/axis/axis.d.ts +3 -3
- package/dist/src/vis/axis/canvas.d.ts +2 -2
- package/dist/src/vis/axis/ticks.d.ts +1 -1
- package/dist/src/vis/button/aether/button.d.ts +2 -2
- package/dist/src/vis/button/use.d.ts +1 -1
- package/dist/src/vis/canvas/Canvas.d.ts +2 -2
- package/dist/src/vis/canvas/Canvas.d.ts.map +1 -1
- package/dist/src/vis/canvas/aether/canvas.d.ts +25 -25
- package/dist/src/vis/diagram/Diagram.d.ts +6 -6
- package/dist/src/vis/diagram/Diagram.d.ts.map +1 -1
- package/dist/src/vis/diagram/aether/Diagram.d.ts +41 -41
- package/dist/src/vis/diagram/aether/Diagram.d.ts.map +1 -1
- package/dist/src/vis/diagram/aether/types.d.ts +331 -0
- package/dist/src/vis/diagram/aether/types.d.ts.map +1 -0
- package/dist/src/vis/diagram/align.d.ts +1 -1
- package/dist/src/vis/diagram/align.d.ts.map +1 -1
- package/dist/src/vis/diagram/edge/Edge.d.ts +4 -4
- package/dist/src/vis/diagram/edge/Edge.d.ts.map +1 -1
- package/dist/src/vis/diagram/edge/connector/connector.d.ts +12 -4
- package/dist/src/vis/diagram/edge/connector/connector.d.ts.map +1 -1
- package/dist/src/vis/diagram/external.d.ts +1 -1
- package/dist/src/vis/diagram/external.d.ts.map +1 -1
- package/dist/src/vis/diagram/util.d.ts +1 -1
- package/dist/src/vis/diagram/util.d.ts.map +1 -1
- package/dist/src/vis/draw2d/index.d.ts +4 -4
- package/dist/src/vis/eraser/aether/eraser.d.ts +26 -26
- package/dist/src/vis/eraser/use.d.ts +2 -2
- package/dist/src/vis/legend/Container.d.ts +101 -7
- package/dist/src/vis/legend/Container.d.ts.map +1 -1
- package/dist/src/vis/legend/Simple.d.ts +2 -2
- package/dist/src/vis/line/Line.d.ts +2 -2
- package/dist/src/vis/line/Line.d.ts.map +1 -1
- package/dist/src/vis/line/aether/line.d.ts +10 -9
- package/dist/src/vis/line/aether/line.d.ts.map +1 -1
- package/dist/src/vis/lineplot/Axis.d.ts +5 -5
- package/dist/src/vis/lineplot/Axis.d.ts.map +1 -1
- package/dist/src/vis/lineplot/Legend.d.ts +2 -2
- package/dist/src/vis/lineplot/Line.d.ts +1 -1
- package/dist/src/vis/lineplot/Line.d.ts.map +1 -1
- package/dist/src/vis/lineplot/LinePlot.d.ts +7 -7
- package/dist/src/vis/lineplot/LinePlot.d.ts.map +1 -1
- package/dist/src/vis/lineplot/Title.d.ts +2 -2
- package/dist/src/vis/lineplot/Title.d.ts.map +1 -1
- package/dist/src/vis/lineplot/Viewport.d.ts +1 -1
- package/dist/src/vis/lineplot/aether/LinePlot.d.ts +57 -57
- package/dist/src/vis/lineplot/aether/LinePlot.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/XAxis.d.ts +4 -3
- package/dist/src/vis/lineplot/aether/XAxis.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/YAxis.d.ts +5 -4
- package/dist/src/vis/lineplot/aether/YAxis.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/axis.d.ts +6 -6
- package/dist/src/vis/lineplot/aether/axis.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/grid.d.ts +1 -1
- package/dist/src/vis/lineplot/aether/grid.d.ts.map +1 -1
- package/dist/src/vis/lineplot/range/Annotation.d.ts +2 -2
- package/dist/src/vis/lineplot/range/Annotation.d.ts.map +1 -1
- package/dist/src/vis/lineplot/range/Provider.d.ts +2 -2
- package/dist/src/vis/lineplot/range/Provider.d.ts.map +1 -1
- package/dist/src/vis/lineplot/range/aether/annotation.d.ts +4 -4
- package/dist/src/vis/lineplot/range/aether/provider.d.ts +19 -19
- package/dist/src/vis/lineplot/tooltip/Tooltip.d.ts +2 -2
- package/dist/src/vis/lineplot/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts +6 -6
- package/dist/src/vis/measure/Measure.d.ts +1 -2
- package/dist/src/vis/measure/Measure.d.ts.map +1 -1
- package/dist/src/vis/measure/aether/measure.d.ts +7 -7
- package/dist/src/vis/render/GLProgram.d.ts +2 -2
- package/dist/src/vis/render/clear/program.d.ts +1 -1
- package/dist/src/vis/render/context.d.ts +4 -7
- package/dist/src/vis/render/context.d.ts.map +1 -1
- package/dist/src/vis/render/eraser.d.ts +3 -3
- package/dist/src/vis/render/performance.d.ts +11 -0
- package/dist/src/vis/render/performance.d.ts.map +1 -0
- package/dist/src/vis/render/util.d.ts.map +1 -1
- package/dist/src/vis/rule/Rule.d.ts +2 -2
- package/dist/src/vis/rule/Rule.d.ts.map +1 -1
- package/dist/src/vis/rule/aether/aether.d.ts +5 -5
- package/dist/src/vis/schematic/Forms.d.ts +1 -0
- package/dist/src/vis/schematic/Forms.d.ts.map +1 -1
- package/dist/src/vis/schematic/Labeled.d.ts +2 -2
- package/dist/src/vis/schematic/Labeled.d.ts.map +1 -1
- package/dist/src/vis/schematic/SelectOrientation.d.ts +3 -3
- package/dist/src/vis/schematic/Symbols.d.ts +113 -19
- package/dist/src/vis/schematic/Symbols.d.ts.map +1 -1
- package/dist/src/vis/schematic/primitives/Primitives.d.ts +27 -3
- package/dist/src/vis/schematic/primitives/Primitives.d.ts.map +1 -1
- package/dist/src/vis/schematic/registry.d.ts +5 -6
- package/dist/src/vis/schematic/registry.d.ts.map +1 -1
- package/dist/src/vis/toggle/aether/toggle.d.ts +5 -5
- package/dist/src/vis/toggle/use.d.ts +1 -1
- package/dist/src/vis/value/aether/value.d.ts +43 -43
- package/dist/src/vis/value/use.d.ts +12 -12
- package/dist/src/worker/Context.d.ts +1 -1
- package/dist/src/worker/Context.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -2
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -2
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +1 -1
- package/dist/{units-BsHX82D_.cjs → units-CoE6Mywf.cjs} +1 -1
- package/dist/{units-DechjShe.js → units-DlP7zkaE.js} +1 -1
- package/dist/video.cjs +1 -1
- package/dist/video.js +1 -1
- package/package.json +23 -24
- package/dist/LinePlot-DkAUE5Nq.cjs +0 -68
- package/dist/Link-C3NUk5cp.cjs +0 -1
- package/dist/List-BbB1S5Vo.cjs +0 -1
- package/dist/List-DPugi06W.js +0 -22
- package/dist/Toggle-BBGPiXIA.cjs +0 -188
- package/dist/aggregator-DueF6Q-Z.cjs +0 -45
- package/dist/css-DZx3bWkH.cjs +0 -1
- package/dist/css-TXuXKs3A.js +0 -1364
- package/dist/external-B-CtJFCn.js +0 -96
- package/dist/external-B39SmpRo.js +0 -201
- package/dist/external-BbnWD0Pc.js +0 -66
- package/dist/external-BphNoXuB.js +0 -92
- package/dist/external-CsPOXIEm.cjs +0 -1
- package/dist/external-CyiLaYmg.js +0 -322
- package/dist/external-CztU6wom.cjs +0 -1
- package/dist/external-D1NnASGa.cjs +0 -1
- package/dist/external-DrS33VU5.cjs +0 -1
- package/dist/external-WzX6JA2j.cjs +0 -1
- package/dist/external-fg-pJfZR.js +0 -260
- package/dist/external-vZfda3xX.cjs +0 -1
- package/dist/external-vgqH7hLg.cjs +0 -1
- package/dist/jsx-runtime-fmb_vB8K.cjs +0 -25
- package/dist/src/util/case.d.ts +0 -2
- package/dist/src/util/case.d.ts.map +0 -1
- package/dist/src/vis/diagram/types.d.ts +0 -73
- package/dist/src/vis/diagram/types.d.ts.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";var kl=Object.defineProperty;var xl=(t,e,r)=>e in t?kl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var P=(t,e,r)=>(xl(t,typeof e!="symbol"?e+"":e,r),r);const a=require("zod"),O=require("./css-DZx3bWkH.cjs"),$a=require("react");var Cl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Rl(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return t[n]}})}),r}const ar=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var $l=Object.defineProperty,Ml=(t,e,r)=>e in t?$l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,un=(t,e,r)=>(Ml(t,typeof e!="symbol"?e+"":e,r),r);let Dl=class{constructor(){un(this,"contentType","application/json"),un(this,"decoder"),un(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e)).buffer}decode(e,r){return this.decodeString(this.decoder.decode(e),r)}decodeString(e,r){const n=O.Te(JSON.parse(e));return r!=null?r.parse(n):n}encodeString(e){return JSON.stringify(O.ke(e),(r,n)=>ArrayBuffer.isView(n)?Array.from(n):ar(n)&&"encode_value"in n?typeof n.value=="bigint"?n.value.toString():n.value:typeof n=="bigint"?n.toString():n)}static registerCustomType(){}};new Dl;const Ma=t=>t!=null&&typeof t=="object"&&"toString"in t,Pl=t=>{if(Ma(t))return(t==null?void 0:t.toString().length)===0;switch(typeof t){case"string":return t.length===0;case"number":return t===0;case"bigint":return t===0n;case"boolean":return!t;case"undefined":return!0;case"object":return t===null}},Mr=(t,e=!1)=>{const r=Ma(t)?"stringer":typeof t;let n;switch(r){case"string":n=(s,i)=>s.localeCompare(i);break;case"stringer":n=(s,i)=>s.toString().localeCompare(i.toString());break;case"number":n=(s,i)=>Number(s)-Number(i);break;case"bigint":n=(s,i)=>BigInt(s)-BigInt(i)>0n?1:-1;break;case"boolean":n=(s,i)=>Number(s)-Number(i);break;default:return console.warn("sortFunc: unknown type"),()=>-1}return e?Da(n):n},Ul=(t,e,r)=>{const n=Mr(e[t],r);return(s,i)=>n(s[t],i[t])},Bl=(t,e)=>t.length!==e.length?t.length-e.length:t.every((r,n)=>r===e[n])?0:-1,Ll=(t,e)=>{if(t.length!==e.length)return t.length-e.length;if(t.length===0)return 0;const r=Mr(t[0]),n=[...t].sort(r),s=[...e].sort(r);return n.every((i,o)=>i===s[o])?0:-1},_l=(t,e)=>t===e?0:t==="first"&&e==="last"?1:-1,Da=t=>(e,r)=>t(r,e),ql=t=>t<0,Zl=t=>t>0,Yl=t=>t>=0,Fl=Object.freeze(Object.defineProperty({__proto__:null,EQUAL:0,GREATER_THAN:1,LESS_THAN:-1,isGreaterThan:Zl,isGreaterThanEqual:Yl,isLessThan:ql,newF:Mr,newFieldF:Ul,order:_l,primitiveArrays:Bl,reverseF:Da,unorderedPrimitiveArrays:Ll},Symbol.toStringTag,{value:"Module"})),Vl=(t,e)=>{let r=null;return e===0?t:(...n)=>{r!==null&&(clearTimeout(r),r=null),r=setTimeout(()=>t(...n),e)}},Wl=(t,e)=>{let r=null;return e===0?t:(...n)=>{r===null&&(r=setTimeout(()=>{t(...n),r=null},e))}},Pa=(t,e)=>{const r=t.split(".");return r.map((n,s)=>{const i=e(n,s,r);return i==null?null:typeof i=="string"?i:i.join(".")}).filter(n=>n!=null).join(".")},ls=(t,e,r=!1,{getter:n=(s,i)=>s[i]}={})=>{const s=e.split(".");if(s.length===1&&s[0]==="")return t;let i=t;for(const o of s){const l=n(i,o);if(l==null){if(r)return null;throw new Error(`Path ${e} does not exist. ${o} is null`)}i=l}return i},Kl=(t,e,r)=>{const n=e.split(".");let s=t;for(let i=0;i<n.length-1;i++){const o=n[i];if(s[o]==null)throw new Error(`Path ${e} does not exist`);s=s[o]}s[n[n.length-1]]=r},Gl=(t,e)=>{const r=t.split(".");return e<0?r[r.length+e]:r[e]},Jl=t=>t.join("."),Hl=(t,e)=>{try{return ls(t,e),!0}catch{return!1}},Xl=(t,e)=>{if(e.length===0)return!0;const r=t.split("."),n=e.split(".");if(n.length>r.length)return!1;for(let s=0;s<n.length;s++){const i=r[s],o=n[s];if(o!=="*"&&i!==o)return!1}return!0},Ql=t=>JSON.parse(JSON.stringify(t)),eu=(t,...e)=>(e.forEach(r=>{let n=t;const s=r.split(".");s.forEach((i,o)=>{o===s.length-1?delete n[i]:n=n[i]})}),t),tu=(t,e,r="")=>{const n={},s=(i,o,l)=>{if(typeof i!=typeof o||i===null||o===null){n[l]=[i,o];return}if(typeof i=="object"&&typeof o=="object")if(Array.isArray(i)&&Array.isArray(o)){if(i.length!==o.length){n[l]=[i,o];return}for(let c=0;c<i.length;c++)s(i[c],o[c],`${l}[${c}]`)}else new Set([...Object.keys(i),...Object.keys(o)]).forEach(c=>{s(i[c],o[c],l!==""?`${l}.${c}`:c)});else i!==o&&(n[l]=[i,o])};return s(t,e,r),n},Dn=(t,e)=>{const r=Array.isArray(t),n=Array.isArray(e);if(r!==n)return!1;if(r&&n){const o=t,l=e;if(o.length!==l.length)return!1;for(let c=0;c<o.length;c++)if(!Dn(o[c],l[c]))return!1;return!0}if(t==null||e==null||typeof t!="object"||typeof e!="object")return t===e;if("equals"in t)return t.equals(e);const s=Object.keys(t),i=Object.keys(e);if(s.length!==i.length)return!1;for(const o of s){const l=t[o],c=e[o];if(typeof l=="object"&&typeof c=="object"){if(!Dn(l,c))return!1}else if(l!==c)return!1}return!0},Ua=(t,e)=>{if(typeof t!="object"||t==null)return t===e;const r=Object.keys(t),n=Object.keys(e);if(n.length>r.length)return!1;for(const s of n){const i=t[s],o=e[s];if(typeof i=="object"&&typeof o=="object"){if(!Ua(i,o))return!1}else if(i!==o)return!1}return!0},Pn=(t,...e)=>{if(e.length===0)return t;const r=e.shift();if(ar(t)&&ar(r))for(const n in r)try{ar(r[n])?(n in t||Object.assign(t,{[n]:{}}),Pn(t[n],r[n])):Object.assign(t,{[n]:r[n]})}catch(s){throw s instanceof TypeError?new TypeError(`.${n}: ${s.message}`):s}return Pn(t,...e)},ru=(t,e,r)=>{const n=(s,i,o)=>{for(const l in i){const c=i[l];if(o!=null&&o.shape[l]){const f=o.shape[l].safeParse(c);f.success&&(s[l]=f.data)}else typeof c=="object"&&!Array.isArray(c)&&c!==null&&o&&o.shape&&o.shape[l]&&(s[l]||(s[l]={}),n(s[l],c,o.shape[l]))}return s};return n({...t},e,r)},Ba=Object.freeze(Object.defineProperty({__proto__:null,copy:Ql,deleteD:eu,difference:tu,element:Gl,equal:Dn,get:ls,has:Hl,join:Jl,override:Pn,overrideValidItems:ru,partialEqual:Ua,pathsMatch:Xl,set:Kl,transformPath:Pa},Symbol.toStringTag,{value:"Module"}));a.z.record(a.z.union([a.z.number(),a.z.string(),a.z.symbol()]),a.z.unknown());const La=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",nu=La(),_a=["MacOS","Windows","Linux","Docker"],su=a.z.enum(_a);let cn;const au=()=>{if(typeof window>"u")return;const t=window.navigator.userAgent.toLowerCase();if(t.includes("mac"))return"MacOS";if(t.includes("win"))return"Windows";if(t.includes("linux"))return"Linux"},iu=(t={})=>{const{force:e,default:r}=t;return e??cn??(cn=au(),cn??r)},qa=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:_a,RUNTIME:nu,detect:La,getOS:iu,osZ:su},Symbol.toStringTag,{value:"Module"}));var ou=Object.defineProperty,lu=(t,e,r)=>e in t?ou(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g=(t,e,r)=>(lu(t,typeof e!="symbol"?e+"":e,r),r);let uu="_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",cu=(t=21)=>{let e="",r=t;for(;r--;)e+=uu[Math.random()*64|0];return e};const Za=(t,e)=>{const r=new Y(e);if(![K.DAY,K.HOUR,K.MINUTE,K.SECOND,K.MILLISECOND,K.MICROSECOND,K.NANOSECOND].some(s=>s.equals(r)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=t.valueOf()%r.valueOf();return t instanceof Y?new Y(n):new K(n)},U=class T{constructor(e,r="UTC"){if(g(this,"value"),g(this,"encodeValue",!0),e==null)this.value=T.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*T.MILLISECOND.valueOf();else if(typeof e=="string")this.value=T.parseDateTimeString(e,r).valueOf();else if(Array.isArray(e))this.value=T.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),r==="local"&&(n=T.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=T.MAX:e=T.MIN)),this.value=BigInt(e.valueOf())+n}}static parseDate([e=1970,r=1,n=1]){const s=new Date(e,r-1,n,0,0,0,0);return new T(BigInt(s.getTime())*T.MILLISECOND.valueOf()).truncate(T.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[n,s,i]=e.split(":");let o="00",l="00";i!=null&&([o,l]=i.split("."));let c=T.hours(parseInt(n??"00",10)).add(T.minutes(parseInt(s??"00",10))).add(T.seconds(parseInt(o??"00",10))).add(T.milliseconds(parseInt(l??"00",10)));return r==="local"&&(c=c.add(T.utcOffset)),c.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return T.parseTimeString(e,r);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new T(BigInt(n.getTime())*T.MILLISECOND.valueOf(),r).valueOf()}fString(e="ISO",r="UTC"){switch(e){case"ISODate":return this.toISOString(r).slice(0,10);case"ISOTime":return this.toISOString(r).slice(11,23);case"time":return this.timeString(!1,r);case"preciseTime":return this.timeString(!0,r);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,r)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,r)}`;default:return this.toISOString(r)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(T.utcOffset).date().toISOString()}timeString(e=!1,r="UTC"){const n=this.toISOString(r);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),r=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${r} ${n}`}static get utcOffset(){return new K(BigInt(new Date().getTimezoneOffset())*T.MINUTE.valueOf())}static since(e){return new T().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new T(e).valueOf()}span(e){return this.range(e).span}range(e){return new jt(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new T(e).valueOf()}afterEq(e){return this.valueOf()>=new T(e).valueOf()}before(e){return this.valueOf()<new T(e).valueOf()}beforeEq(e){return this.valueOf()<=new T(e).valueOf()}add(e){return new T(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new T(this.valueOf()-BigInt(e.valueOf()))}milliseconds(){return Number(this.valueOf())/Number(T.MILLISECOND.valueOf())}toString(){return this.date().toISOString()}remainder(e){return Za(this,e)}get isToday(){return this.truncate(K.DAY).equals(T.now().truncate(K.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new T(new Date)}static max(...e){let r=T.MIN;for(const n of e){const s=new T(n);s.after(r)&&(r=s)}return r}static min(...e){let r=T.MAX;for(const n of e){const s=new T(n);s.before(r)&&(r=s)}return r}static nanoseconds(e){return new T(e)}static microseconds(e){return T.nanoseconds(e*1e3)}static milliseconds(e){return T.microseconds(e*1e3)}static seconds(e){return T.milliseconds(e*1e3)}static minutes(e){return T.seconds(e*60)}static hours(e){return T.minutes(e*60)}static days(e){return T.hours(e*24)}};g(U,"NANOSECOND",U.nanoseconds(1)),g(U,"MICROSECOND",U.microseconds(1)),g(U,"MILLISECOND",U.milliseconds(1)),g(U,"SECOND",U.seconds(1)),g(U,"MINUTE",U.minutes(1)),g(U,"HOUR",U.hours(1)),g(U,"DAY",U.days(1)),g(U,"MAX",new U((1n<<63n)-1n)),g(U,"MIN",new U(0)),g(U,"ZERO",new U(0)),g(U,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(t=>new U(t.value)),a.z.string().transform(t=>new U(BigInt(t))),a.z.instanceof(Number).transform(t=>new U(t)),a.z.number().transform(t=>new U(t)),a.z.instanceof(U)]));let Y=U;const B=class C{constructor(e){g(this,"value"),g(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new C(e).valueOf()}greaterThan(e){return this.valueOf()>new C(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new C(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new C(e).valueOf()}remainder(e){return Za(this,e)}truncate(e){return new C(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(C.DAY),r=this.truncate(C.HOUR),n=this.truncate(C.MINUTE),s=this.truncate(C.SECOND),i=this.truncate(C.MILLISECOND),o=this.truncate(C.MICROSECOND),l=this.truncate(C.NANOSECOND),c=e,f=r.sub(e),w=n.sub(r),h=s.sub(n),D=i.sub(s),F=o.sub(i),se=l.sub(o);let $="";return c.isZero||($+=`${c.days}d `),f.isZero||($+=`${f.hours}h `),w.isZero||($+=`${w.minutes}m `),h.isZero||($+=`${h.seconds}s `),D.isZero||($+=`${D.milliseconds}ms `),F.isZero||($+=`${F.microseconds}µs `),se.isZero||($+=`${se.nanoseconds}ns`),$.trim()}get days(){return Number(this.valueOf())/Number(C.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(C.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(C.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(C.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(C.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(C.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new C(e).valueOf()}add(e){return new C(this.valueOf()+new C(e).valueOf())}sub(e){return new C(this.valueOf()-new C(e).valueOf())}static nanoseconds(e=1){return new C(e)}static microseconds(e=1){return C.nanoseconds(e*1e3)}static milliseconds(e=1){return C.microseconds(e*1e3)}static seconds(e=1){return C.milliseconds(e*1e3)}static minutes(e){return C.seconds(e.valueOf()*60)}static hours(e){return C.minutes(e*60)}static days(e){return C.hours(e*24)}};g(B,"NANOSECOND",B.nanoseconds(1)),g(B,"MICROSECOND",B.microseconds(1)),g(B,"MILLISECOND",B.milliseconds(1)),g(B,"SECOND",B.seconds(1)),g(B,"MINUTE",B.minutes(1)),g(B,"HOUR",B.hours(1)),g(B,"DAY",B.days(1)),g(B,"MAX",new B((1n<<63n)-1n)),g(B,"MIN",new B(0)),g(B,"ZERO",new B(0)),g(B,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(t=>new B(t.value)),a.z.string().transform(t=>new B(BigInt(t))),a.z.instanceof(Number).transform(t=>new B(t)),a.z.number().transform(t=>new B(t)),a.z.instanceof(B)]));let K=B;const vt=class ir extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new ir(e).valueOf()}get period(){return K.seconds(1/this.valueOf())}sampleCount(e){return new K(e).seconds*this.valueOf()}byteCount(e,r){return this.sampleCount(e)*new le(r).valueOf()}span(e){return K.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/r.valueOf())}static hz(e){return new ir(e)}static khz(e){return ir.hz(e*1e3)}};g(vt,"z",a.z.union([a.z.number().transform(t=>new vt(t)),a.z.instanceof(Number).transform(t=>new vt(t)),a.z.instanceof(vt)]));let hu=vt;const Q=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Dr(e*this.valueOf())}};g(Q,"UNKNOWN",new Q(0)),g(Q,"BIT128",new Q(16)),g(Q,"BIT64",new Q(8)),g(Q,"BIT32",new Q(4)),g(Q,"BIT16",new Q(2)),g(Q,"BIT8",new Q(1)),g(Q,"z",a.z.union([a.z.number().transform(t=>new Q(t)),a.z.instanceof(Number).transform(t=>new Q(t)),a.z.instanceof(Q)]));let le=Q;const Te=class or{constructor(e,r){g(this,"start"),g(this,"end"),typeof e=="object"&&"start"in e?(this.start=new Y(e.start),this.end=new Y(e.end)):(this.start=new Y(e),this.end=new Y(r))}get span(){return new K(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 or(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,r=K.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const s=Y.max(n.start,e.start),i=Y.min(n.end,e.end);return i.before(s)?!1:new K(i.sub(s)).greaterThanOrEqual(r)}roughlyEquals(e,r){let n=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return n<0&&(n=-n),s<0&&(s=-s),n<=r.valueOf()&&s<=r.valueOf()}contains(e){return e instanceof or?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new or(this.start,this.end);return e.start.after(this.start)&&(r.start=e.start),e.start.after(this.end)&&(r.end=e.start),e.end.before(this.end)&&(r.end=e.end),e.end.before(this.start)&&(r.start=e.end),r}};g(Te,"MAX",new Te(Y.MIN,Y.MAX)),g(Te,"MIN",new Te(Y.MAX,Y.MIN)),g(Te,"ZERO",new Te(Y.ZERO,Y.ZERO)),g(Te,"z",a.z.union([a.z.object({start:Y.z,end:Y.z}).transform(t=>new Te(t.start,t.end)),a.z.instanceof(Te)]));let jt=Te;const d=class ze extends String{constructor(e){if(e instanceof ze||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const r=ze.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(r!=null){super(r.valueOf());return}}throw super(ze.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=ze.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}toString(){return this.valueOf()}get isVariable(){return this.equals(ze.JSON)||this.equals(ze.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(ze.UUID)}get isInteger(){return this.toString().startsWith("int")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=ze.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}canSafelyCastTo(e){return this.equals(e)?!0:this.isVariable&&!e.isVariable||!this.isVariable&&e.isVariable?!1:this.isFloat&&e.isInteger||this.isInteger&&e.isFloat?this.density.valueOf()<e.density.valueOf():this.isFloat&&e.isFloat||this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf():!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return ze.BIG_INT_TYPES.some(e=>e.equals(this))}};g(d,"UNKNOWN",new d("unknown")),g(d,"FLOAT64",new d("float64")),g(d,"FLOAT32",new d("float32")),g(d,"INT64",new d("int64")),g(d,"INT32",new d("int32")),g(d,"INT16",new d("int16")),g(d,"INT8",new d("int8")),g(d,"UINT64",new d("uint64")),g(d,"UINT32",new d("uint32")),g(d,"UINT16",new d("uint16")),g(d,"UINT8",new d("uint8")),g(d,"BOOLEAN",d.UINT8),g(d,"TIMESTAMP",new d("timestamp")),g(d,"UUID",new d("uuid")),g(d,"STRING",new d("string")),g(d,"JSON",new d("json")),g(d,"ARRAY_CONSTRUCTORS",new Map([[d.UINT8.toString(),Uint8Array],[d.UINT16.toString(),Uint16Array],[d.UINT32.toString(),Uint32Array],[d.UINT64.toString(),BigUint64Array],[d.FLOAT32.toString(),Float32Array],[d.FLOAT64.toString(),Float64Array],[d.INT8.toString(),Int8Array],[d.INT16.toString(),Int16Array],[d.INT32.toString(),Int32Array],[d.INT64.toString(),BigInt64Array],[d.TIMESTAMP.toString(),BigInt64Array],[d.STRING.toString(),Uint8Array],[d.JSON.toString(),Uint8Array],[d.UUID.toString(),Uint8Array]])),g(d,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,d.UINT8],[Uint16Array.name,d.UINT16],[Uint32Array.name,d.UINT32],[BigUint64Array.name,d.UINT64],[Float32Array.name,d.FLOAT32],[Float64Array.name,d.FLOAT64],[Int8Array.name,d.INT8],[Int16Array.name,d.INT16],[Int32Array.name,d.INT32],[BigInt64Array.name,d.INT64]])),g(d,"DENSITIES",new Map([[d.UINT8.toString(),le.BIT8],[d.UINT16.toString(),le.BIT16],[d.UINT32.toString(),le.BIT32],[d.UINT64.toString(),le.BIT64],[d.FLOAT32.toString(),le.BIT32],[d.FLOAT64.toString(),le.BIT64],[d.INT8.toString(),le.BIT8],[d.INT16.toString(),le.BIT16],[d.INT32.toString(),le.BIT32],[d.INT64.toString(),le.BIT64],[d.TIMESTAMP.toString(),le.BIT64],[d.STRING.toString(),le.UNKNOWN],[d.JSON.toString(),le.UNKNOWN],[d.UUID.toString(),le.BIT128]])),g(d,"ALL",[d.UNKNOWN,d.FLOAT64,d.FLOAT32,d.INT64,d.INT32,d.INT16,d.INT8,d.UINT64,d.UINT32,d.UINT16,d.UINT8,d.TIMESTAMP,d.UUID,d.STRING,d.JSON]),g(d,"BIG_INT_TYPES",[d.INT64,d.UINT64,d.TIMESTAMP]),g(d,"z",a.z.union([a.z.string().transform(t=>new d(t)),a.z.instanceof(d)]));let M=d;const ae=class G extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return G.bytes(this.valueOf()+e.valueOf())}sub(e){return G.bytes(this.valueOf()-e.valueOf())}truncate(e){return new G(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return G.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/G.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/G.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/G.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/G.TERABYTE.valueOf()}toString(){const e=this.truncate(G.TERABYTE),r=this.truncate(G.GIGABYTE),n=this.truncate(G.MEGABYTE),s=this.truncate(G.KILOBYTE),i=this.truncate(G.BYTE),o=e,l=r.sub(e),c=n.sub(r),f=s.sub(n),w=i.sub(s);let h="";return o.isZero||(h+=`${o.terabytes}TB `),l.isZero||(h+=`${l.gigabytes}GB `),c.isZero||(h+=`${c.megabytes}MB `),f.isZero||(h+=`${f.kilobytes}KB `),(!w.isZero||h==="")&&(h+=`${w.valueOf()}B`),h.trim()}static bytes(e=1){return new G(e)}static kilobytes(e=1){return G.bytes(e.valueOf()*1e3)}static megabytes(e=1){return G.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return G.megabytes(e.valueOf()*1e3)}static terabytes(e){return G.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};g(ae,"BYTE",new ae(1)),g(ae,"KILOBYTE",ae.kilobytes(1)),g(ae,"MEGABYTE",ae.megabytes(1)),g(ae,"GIGABYTE",ae.gigabytes(1)),g(ae,"TERABYTE",ae.terabytes(1)),g(ae,"ZERO",new ae(0)),g(ae,"z",a.z.union([a.z.number().transform(t=>new ae(t)),a.z.instanceof(ae)]));let Dr=ae;const fu=a.z.union([a.z.instanceof(Uint8Array),a.z.instanceof(Uint16Array),a.z.instanceof(Uint32Array),a.z.instanceof(BigUint64Array),a.z.instanceof(Float32Array),a.z.instanceof(Float64Array),a.z.instanceof(Int8Array),a.z.instanceof(Int16Array),a.z.instanceof(Int32Array),a.z.instanceof(BigInt64Array)]),Ya=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof Y||t instanceof K||t instanceof Date},du=(t,e,r,n=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(n):!t.usesBigInt&&e.usesBigInt?BigInt(r)-BigInt(n):bt(r,-n),yu=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof Fa?!0:Ya(t),Qe=-1;let Fa=class qe{constructor(e){g(this,"key",""),g(this,"isSynnaxSeries",!0),g(this,"dataType"),g(this,"sampleOffset"),g(this,"gl"),g(this,"_data"),g(this,"_timeRange"),g(this,"alignment",0n),g(this,"_cachedMin"),g(this,"_cachedMax"),g(this,"writePos",Qe),g(this,"_refCount",0),g(this,"_cachedLength"),yu(e)&&(e={data:e});const{dataType:r,timeRange:n,sampleOffset:s=0,glBufferUsage:i="static",alignment:o=0n,key:l=cu()}=e,{data:c}=e;if(c instanceof qe||typeof c=="object"&&"isSynnaxSeries"in c&&c.isSynnaxSeries===!0){const h=c;this.key=h.key,this.dataType=h.dataType,this.sampleOffset=h.sampleOffset,this.gl=h.gl,this._data=h._data,this._timeRange=h._timeRange,this.alignment=h.alignment,this._cachedMin=h._cachedMin,this._cachedMax=h._cachedMax,this.writePos=h.writePos,this._refCount=h._refCount,this._cachedLength=h._cachedLength;return}const f=Ya(c),w=Array.isArray(c);if(r!=null)this.dataType=new M(r);else{if(c instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(w||f){let h=c;if(!f){if(c.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");h=c[0]}if(typeof h=="string")this.dataType=M.STRING;else if(typeof h=="number")this.dataType=M.FLOAT64;else if(typeof h=="bigint")this.dataType=M.INT64;else if(typeof h=="boolean")this.dataType=M.BOOLEAN;else if(h instanceof Y||h instanceof Date||h instanceof Y)this.dataType=M.TIMESTAMP;else if(typeof h=="object")this.dataType=M.JSON;else throw new Error(`cannot infer data type of ${typeof h} when constructing a Series from a JS array`)}else this.dataType=new M(c)}if(!w&&!f)this._data=c;else{let h=f?[c]:c;const D=h[0];(D instanceof Y||D instanceof Date||D instanceof K)&&(h=h.map(F=>new Y(F).valueOf())),this.dataType.equals(M.STRING)?(this._cachedLength=h.length,this._data=new TextEncoder().encode(h.join(`
|
|
2
|
-
`)+`
|
|
3
|
-
`)):this.dataType.equals(M.JSON)?(this._cachedLength=h.length,this._data=new TextEncoder().encode(h.map(F=>JSON.stringify(F)).join(`
|
|
4
|
-
`)+`
|
|
5
|
-
`)):this._data=new this.dataType.Array(h).buffer}this.key=l,this.alignment=o,this.sampleOffset=s??0,this._timeRange=n,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:e,dataType:r,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new M(r).Array(e),i=new qe({data:s.buffer,dataType:r,...n});return i.writePos=0,i}static generateTimestamps(e,r,n){const s=n.spanRange(r.span(e)),i=new BigInt64Array(e);for(let o=0;o<e;o++)i[o]=BigInt(n.add(r.span(o)).valueOf());return new qe({data:i,dataType:M.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(e,r){const n=new TextEncoder().encode(e.join(`
|
|
6
|
-
`)+`
|
|
7
|
-
`);return new qe({data:n,dataType:M.STRING,timeRange:r})}static fromJSON(e,r){const n=new TextEncoder().encode(e.map(s=>JSON.stringify(s)).join(`
|
|
8
|
-
`)+`
|
|
9
|
-
`);return new qe({data:n,dataType:M.JSON,timeRange:r})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}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(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");if(this.writePos===Qe)return 0;const r=this.capacity-this.writePos,n=r<e.length?e.slice(0,r):e;return this.underlyingData.set(n.data,this.writePos),this.maybeRecomputeMinMax(n),this._cachedLength=void 0,this.writePos+=n.length,n.length}get buffer(){return this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===Qe?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.equals(M.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(M.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=M.UUID.density.valueOf(),r=Array(this.length);for(let n=0;n<this.length;n++){const s=this.buffer.slice(n*e,(n+1)*e),i=Array.from(new Uint8Array(s),o=>o.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");r[n]=i}return r}parseJSON(e){if(!this.dataType.equals(M.JSON))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
|
|
11
|
-
`).slice(0,-1).map(r=>e.parse(O.Te(JSON.parse(r))))}get timeRange(){if(this._timeRange==null)throw new Error("time range not set on series");return this._timeRange}get byteCapacity(){return new Dr(this.buffer.byteLength)}get capacity(){return this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Qe?this.byteCapacity:this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===Qe?this.data.length:this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;return this.data.forEach(r=>{r===10&&e++}),this._cachedLength=e,e}convert(e,r=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let s=0;s<this.length;s++)n[s]=du(this.dataType,e,this.data[s],r);return new qe({data:n.buffer,dataType:e,timeRange:this._timeRange,sampleOffset:r,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(M.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMax=e.reduce((r,n)=>r>n?r:n)}else{const e=this.data;this._cachedMax=e.reduce((r,n)=>r>n?r:n)}return this._cachedMax}get max(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this._cachedMax==null&&(this._cachedMax=this.calcRawMax()),bt(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(M.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMin=e.reduce((r,n)=>r<n?r:n)}else{const e=this.data;this._cachedMin=e.reduce((r,n)=>r<n?r:n)}return this._cachedMin}get min(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this._cachedMin==null&&(this._cachedMin=this.calcRawMin()),bt(this._cachedMin,this.sampleOffset))}get bounds(){return O.i(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._cachedMin!=null){const r=e._cachedMin??e.calcRawMin();r<this._cachedMin&&(this._cachedMin=r)}if(this._cachedMax!=null){const r=e._cachedMax??e.calcRawMax();r>this._cachedMax&&(this._cachedMax=r)}}enrich(){this.max,this.min}get range(){return bt(this.max,-this.min)}at(e,r){if(this.dataType.isVariable)return this.atVariable(e,r??!1);e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(r===!0)throw new Error(`[series] - no value at index ${e}`);return}return bt(n,this.sampleOffset)}atVariable(e,r){e<0&&(e=this.length+e);let n=0,s=0;for(let o=0;o<this.data.length;o++)if(this.data[o]===10){if(e===0){s=o;break}n=o+1,e--}if(s===0&&(s=this.data.length),n>=s||e>0){if(r)throw new Error(`[series] - no value at index ${e}`);return}const i=this.data.slice(n,s);return this.dataType.equals(M.STRING)?new TextDecoder().decode(i):O.Te(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let r=0,n=this.length-1;const s=Mr(e);for(;r<=n;){const i=Math.floor((r+n)/2),o=s(this.at(i,!0),e);if(o===0)return i;o<0?r=i+1:n=i-1}return r}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(M.FLOAT32))throw new Error("Only FLOAT32 arrays can be used in WebGL");const{buffer:r,bufferUsage:n,prevBuffer:s}=this.gl;if(r==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Qe){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(s).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,o.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=Qe}as(e){if(e==="string"){if(!this.dataType.equals(M.STRING))throw new Error(`cannot convert series of type ${this.dataType.toString()} to string`);return this}if(e==="number"){if(!this.dataType.isNumeric)throw new Error(`cannot convert series of type ${this.dataType.toString()} to number`);return this}if(e==="bigint"){if(!this.dataType.equals(M.INT64))throw new Error(`cannot convert series of type ${this.dataType.toString()} to bigint`);return this}throw new Error(`cannot convert series to ${e}`)}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:this.alignmentBounds,timeRange:(e=this._timeRange)==null?void 0:e.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 O.i(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.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 e=new pu(this);return this.dataType.equals(M.JSON)?new gu(e):e}return new mu(this)}slice(e,r){if(e<=0&&(r==null||r>=this.length))return this;const n=this.data.slice(e,r);return new qe({data:n,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}reAlign(e){return new qe({data:this.buffer,dataType:this.dataType,timeRange:jt.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}},pu=class{constructor(e){if(g(this,"series"),g(this,"index"),g(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,r=this.series.data;for(;this.index<r.length&&r[this.index]!==10;)this.index++;const n=this.index;return e===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,n))})}[Symbol.iterator](){return this}};var Va;let gu=class{constructor(e){g(this,"wrapped"),g(this,Va,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:O.Te(JSON.parse(e.value))}}[Symbol.iterator](){return this}};Va=Symbol.toStringTag;var Wa;let mu=class{constructor(e){g(this,"series"),g(this,"index"),g(this,Wa,"SeriesIterator"),this.series=e,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}};Wa=Symbol.toStringTag;const bt=(t,e)=>typeof t=="bigint"&&typeof e=="bigint"||typeof t=="number"&&typeof e=="number"?t+e:e===0?t:t===0?e:Number(t)+Number(e);let wu=class{constructor(e){if(g(this,"series"),e.length!==0){const r=e[0].dataType;for(let n=1;n<e.length;n++)if(!e[n].dataType.equals(r))throw new Error("[multi-series] - series must have the same data type")}this.series=e}as(e){if(!new M(e).equals(this.dataType))throw new Error(`cannot convert series of type ${this.dataType.toString()} to ${e.toString()}`);return this}get dataType(){return this.series.length===0?M.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?jt.ZERO:new jt(this.series[0].timeRange.start,this.series[this.series.length-1].timeRange.end)}push(e){this.series.push(e)}get length(){return this.series.reduce((e,r)=>e+r.length,0)}at(e,r=!1){e<0&&(e=this.length+e);for(const n of this.series){if(e<n.length)return n.at(e,r);e-=n.length}if(r)throw new Error(`[series] - no value at index ${e}`)}get byteLength(){return new Dr(this.series.reduce((e,r)=>e+r.byteLength.valueOf(),0))}get data(){const e=new this.dataType.Array(this.length);let r=0;for(const n of this.series)e.set(n.data,r),r+=n.length;return new this.dataType.Array(e)}[Symbol.iterator](){return this.series.length===0?{next(){return{done:!0,value:void 0}}}:new vu(this.series)}};var Ka;let vu=class{constructor(e){g(this,"series"),g(this,"seriesIndex"),g(this,"internal"),g(this,Ka,"MultiSeriesIterator"),this.series=e,this.seriesIndex=0,this.internal=e[0][Symbol.iterator]()}next(){const e=this.internal.next();return e.done===!1?e: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}};Ka=Symbol.toStringTag;const bu=t=>Array.isArray(t)?t:[t],Ou=t=>Array.isArray(t)?t:t===null?[]:[t],Tu=t=>[...new Set(t)];var zu=Object.defineProperty,Su=(t,e,r)=>e in t?zu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ot=(t,e,r)=>(Su(t,typeof e!="symbol"?e+"":e,r),r);const Au=(...t)=>t.map(Ga).join(""),Ga=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),Nu=t=>t.endsWith("/")?t.slice(0,-1):t,sa=class Un{constructor({host:e,port:r,protocol:n="",pathPrefix:s=""}){Ot(this,"protocol"),Ot(this,"host"),Ot(this,"port"),Ot(this,"path"),this.protocol=n,this.host=e,this.port=r,this.path=Ga(s)}replace(e){return new Un({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Un({...this,pathPrefix:Au(this.path,e)})}toString(){return Nu(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};Ot(sa,"UNKNOWN",new sa({host:"unknown",port:0}));var Iu=Object.defineProperty,Eu=(t,e,r)=>e in t?Iu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e,r)=>(Eu(t,typeof e!="symbol"?e+"":e,r),r);let ku=class{constructor(e){Er(this,"sender"),Er(this,"handlers"),this.sender=e,this.handlers=new Map}handle({data:e}){var r;const n=(r=this.handlers.get(e.type))==null?void 0:r.handler;n==null?console.warn(`No handler for ${e.type}`):n(e.payload)}route(e){const r=xu(e,this.sender),n=new Cu(r);return this.handlers.set(e,n),n}};const xu=(t,e)=>(r,n)=>e({type:t,payload:r},n);let Cu=class{constructor(e){Er(this,"_send"),Er(this,"handler"),this._send=e,this.handler=null}send(e,r=[]){this._send(e,r)}handle(e){this.handler=e}};var ju=Object.defineProperty,Ru=(t,e,r)=>e in t?ju(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hn=(t,e,r)=>(Ru(t,typeof e!="symbol"?e+"":e,r),r);const tt=class extends Number{};hn(tt,"Absolute",255),hn(tt,"Default",1),hn(tt,"z",a.z.union([a.z.instanceof(tt),a.z.number().int().min(0).max(255).transform(t=>new tt(t)),a.z.instanceof(Number).transform(t=>new tt(t))]));let Ja=tt;const Ha=a.z.object({name:a.z.string(),key:a.z.string()}),$u=t=>a.z.object({subject:Ha,resource:t,authority:Ja.z}),Mu=(...t)=>e=>e.filter(r=>{let n=!1;return r.to!=null&&(n=t.includes(r.to.resource)),r.from!=null&&!n&&(n=t.includes(r.from.resource)),n}),Du=Object.freeze(Object.defineProperty({__proto__:null,Authority:Ja,filterTransfersByChannelKey:Mu,stateZ:$u,subjectZ:Ha},Symbol.toStringTag,{value:"Module"})),Pu=t=>t?-1:1,Uu=a.z.string().regex(/^\d+\.\d+\.\d+$/);a.z.object({version:Uu});const Bu=t=>{if(t===void 0||typeof t=="string"||typeof t=="number")return t;if(t.toString===void 0)throw new Error("invalid renderer");return t.toString()},Lu=t=>Array.isArray(t)?[...t]:typeof t=="object"&&t!==null?{...t}:t,us=t=>typeof t=="function",cs=(t,e)=>us(t)?t(e):t,Pr=t=>Xa(t)?t():t,Xa=t=>typeof t=="function",Qa=({initial:t,value:e,onChange:r})=>{const[n,s]=$a.useState(Pr(e??t));return e!=null&&r!=null?[e,r]:[n,s]},ei=({initial:t,value:e,onChange:r})=>{const[n,s]=$a.useState(Pr(e??t));return e!=null&&r!=null?[e,r]:[n,s]},_u=Object.freeze(Object.defineProperty({__proto__:null,executeInitialSetter:Pr,executeSetter:cs,isInitialSetter:Xa,isSetter:us,usePassthrough:Qa,usePurePassthrough:ei},Symbol.toStringTag,{value:"Module"})),ti=["h1","h2","h3","h4","h5","p","small"],qu=a.z.enum(ti),Ge=a.z.object({size:a.z.number(),weight:a.z.union([a.z.number(),a.z.string()]),lineHeight:a.z.number(),textTransform:a.z.string().optional()}),ri={small:"small",medium:"p",large:"h5",huge:"h2"},Zu={h1:"huge",h2:"huge",h3:"huge",h4:"large",h5:"small",p:"medium",small:"small"};let fn=null;const Yu=()=>(fn==null&&(fn=document.createElement("canvas")),fn),Fu=(t,e,r)=>{if(qa.RUNTIME==="node")return{width:0,height:0};r==null&&(r=Yu().getContext("2d")),r.font=e;const n=r.measureText(t);return{width:Math.trunc(Math.abs(n.actualBoundingBoxLeft)+Math.abs(n.actualBoundingBoxRight)),height:Math.trunc(Math.abs(n.actualBoundingBoxAscent)+Math.abs(n.actualBoundingBoxDescent))}},Vu=a.z.object({l0:O.Color.z,l1:O.Color.z,l2:O.Color.z,l3:O.Color.z,l4:O.Color.z,l5:O.Color.z,l6:O.Color.z,l7:O.Color.z,l8:O.Color.z,l9:O.Color.z,l10:O.Color.z}),me=(t,e)=>[t[0],t[1],e,t[3]],Wu=a.z.object({m2:O.Color.z,m1:O.Color.z,z:O.Color.z,p1:O.Color.z,p2:O.Color.z}),Jt=Wu.or(O.Color.z.transform(t=>{const e=t.hsla;return{m2:new O.Color(O.fromHSLA(me(e,40))),m1:new O.Color(O.fromHSLA(me(e,45))),z:t,p1:new O.Color(O.fromHSLA(me(e,55))),p2:new O.Color(O.fromHSLA(me(e,65)))}})),ni=a.z.object({name:a.z.string(),key:a.z.string(),colors:a.z.object({border:O.Color.z,primary:Jt,gray:Vu,error:Jt,secondary:Jt,warning:Jt,visualization:a.z.object({palettes:a.z.record(a.z.array(O.Color.z))}).optional().default({palettes:{}}),white:O.Color.z,black:O.Color.z,text:O.Color.z,textInverted:O.Color.z,textOnPrimary:O.Color.z.optional().default(O.ZERO),logo:a.z.string()}),sizes:a.z.object({base:a.z.number(),border:a.z.object({radius:a.z.number(),width:a.z.number()}),schematic:a.z.object({elementStrokeWidth:a.z.number()})}),typography:a.z.object({family:a.z.string(),h1:Ge,h2:Ge,h3:Ge,h4:Ge,h5:Ge,p:Ge,small:Ge})}).transform(t=>((t.colors.textOnPrimary==null||t.colors.textOnPrimary.isZero)&&(t.colors.textOnPrimary=t.colors.primary.z.pickByContrast(t.colors.text,t.colors.textInverted)),t)),Ku="'Inter Variable', sans-serif",Gu=6,pt=[357,91,55,1],gt=[42,100,50,1],Ju=["#FCFCFC","#F9F9F9","#F4F4F4","#ededed","#d9d9d9","#ADADAD","#878787","#616161","#404040","#1C1C1C","#050505"],Ht=Object.fromEntries(Ju.map((t,e)=>[`l${e}`,t])),Bn={key:"synnaxBase",name:"Synnax Base",colors:{primary:{m2:"#041B3D",m1:"#164FA0",z:"#3774D0",p1:"#5E94EE",p2:"#8AB8FF"},secondary:{m2:"#2D8F4E",m1:"#38B261",z:"#50C878",p1:"#73D393",p2:"#96DEAE"},gray:Ht,border:Ht.l3,error:{m2:O.fromHSLA(me(pt,30)),m1:O.fromHSLA(me(pt,40)),z:O.fromHSLA(pt),p1:O.fromHSLA(me(pt,60)),p2:O.fromHSLA(me(pt,70))},warning:{m2:O.fromHSLA(me(gt,30)),m1:O.fromHSLA(me(gt,40)),z:O.fromHSLA(gt),p1:O.fromHSLA(me(gt,60)),p2:O.fromHSLA(me(gt,70))},visualization:{palettes:{default:["#DC136C","#20A4F3","#7AC74F","#FFC43D","#FE5F55","#8075FF","#D90429","#f7aef8","#f18f01","#791e94","#279af1","#d9fff5","#ff6b6b","#52ffb8"]}},logo:"url(#synnax-linear-gradient)",white:"#FFFFFF",black:"#000000",text:Ht.l9,textInverted:Ht.l0},sizes:{base:Gu,border:{radius:2,width:1},schematic:{elementStrokeWidth:2}},typography:{family:Ku,h1:{size:7,weight:"500",lineHeight:7*1.5},h2:{size:4.5,weight:"medium",lineHeight:4.5*1.5},h3:{size:3.5,weight:"medium",lineHeight:3.5*1.5},h4:{size:2.5,weight:"medium",lineHeight:2.5*1.5},h5:{size:2.333333,weight:450,lineHeight:2.333333*1.5},p:{size:2.1666666666,weight:"regular",lineHeight:2*1.5},small:{size:1.916666,weight:"regular",lineHeight:1.9166666*1.5}}},si=Object.freeze({...Bn,key:"synnaxLight",name:"Synnax Light"}),Hu=["#020202","#080808","#141414","#1a1a1a","#242424","#515151","#7f7f7f","#9D9D9D","#BFBFBF","#EDEDED","#FDFDFD"],Xt=Object.fromEntries(Hu.map((t,e)=>[`l${e}`,t])),ai=Object.freeze({...Bn,key:"synnaxDark",name:"Synnax Dark",colors:{...Bn.colors,gray:Xt,logo:"var(--pluto-text-color)",border:Xt.l3,text:Xt.l9,textInverted:Xt.l0}}),Xu={synnaxDark:ai,synnaxLight:si},Qu=["small","medium","large","huge"],ec=a.z.enum(Qu),tc=t=>ec.safeParse(t).success,rc=(t,e,r)=>{const{typography:n,sizes:{base:s}}=t,i=n[tc(e)?ri[e]:e].size,o=s*i,[l,c]=n.family.split(", ");return r!=null?` ${r} ${o}px ${l}, ${c}`:` ${o}px ${n.family}`};var nc=Object.defineProperty,sc=(t,e,r)=>e in t?nc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,u=(t,e,r)=>(sc(t,typeof e!="symbol"?e+"":e,r),r),ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},A={},Ur={};Object.defineProperty(Ur,"__esModule",{value:!0});function ac(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"$"+n}).toLowerCase().replace(/(\$)(\w)/g,function(e,r,n){return n.toUpperCase()}):""}Ur.default=ac;var Br={};Object.defineProperty(Br,"__esModule",{value:!0});function ic(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"_").toLowerCase():""}Br.default=ic;var Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});function oc(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"$").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"$"+n}).toLowerCase().replace(/(\$)(\w?)/g,function(e,r,n){return n.toUpperCase()}):""}Lr.default=oc;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});function lc(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,".").toLowerCase():""}hs.default=lc;var fs={};Object.defineProperty(fs,"__esModule",{value:!0});function uc(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"/").toLowerCase():""}fs.default=uc;var ds={};Object.defineProperty(ds,"__esModule",{value:!0});function cc(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase():""}ds.default=cc;var ys={};Object.defineProperty(ys,"__esModule",{value:!0});function hc(t){if(t===void 0&&(t=""),!t)return"";var e=String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(r,n,s){return n+"_"+s.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}ys.default=hc;var ps={};Object.defineProperty(ps,"__esModule",{value:!0});function fc(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase().replace(/( ?)(\w+)( ?)/g,function(e,r,n,s){return r+n.charAt(0).toUpperCase()+n.slice(1)+s}):""}ps.default=fc;var _r={};Object.defineProperty(_r,"__esModule",{value:!0});function dc(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"-").toLowerCase():""}_r.default=dc;var gs={},at={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.belongToTypes=t.isValidObject=t.isArrayObject=t.validateOptions=t.DefaultOption=void 0,t.DefaultOption={recursive:!1,recursiveInArray:!1,keepTypesOnRecursion:[]},t.validateOptions=function(e){return e===void 0&&(e=t.DefaultOption),e.recursive==null?e=t.DefaultOption:e.recursiveInArray==null&&(e.recursiveInArray=!1),e},t.isArrayObject=function(e){return e!=null&&Array.isArray(e)},t.isValidObject=function(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)},t.belongToTypes=function(e,r){return(r||[]).some(function(n){return e instanceof n})}})(at);var yc=ve&&ve.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(gs,"__esModule",{value:!0});var xe=at;function lr(t,e){if(e===void 0&&(e=xe.DefaultOption),!xe.isValidObject(t))return null;e=xe.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=n.toLowerCase();e.recursive&&(xe.isValidObject(s)?xe.belongToTypes(s,e.keepTypesOnRecursion)||(s=lr(s,e)):e.recursiveInArray&&xe.isArrayObject(s)&&(s=yc(s).map(function(o){var l=o;if(xe.isValidObject(o))xe.belongToTypes(l,e.keepTypesOnRecursion)||(l=lr(o,e));else if(xe.isArrayObject(o)){var c=lr({key:o},e);l=c.key}return l}))),r[i]=s}),r}gs.default=lr;var ms={},pc=ve&&ve.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(ms,"__esModule",{value:!0});var Ce=at;function ur(t,e){if(e===void 0&&(e=Ce.DefaultOption),!Ce.isValidObject(t))return null;e=Ce.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=n.toUpperCase();e.recursive&&(Ce.isValidObject(s)?Ce.belongToTypes(s,e.keepTypesOnRecursion)||(s=ur(s,e)):e.recursiveInArray&&Ce.isArrayObject(s)&&(s=pc(s).map(function(o){var l=o;if(Ce.isValidObject(o))Ce.belongToTypes(l,e.keepTypesOnRecursion)||(l=ur(o,e));else if(Ce.isArrayObject(o)){var c=ur({key:o},e);l=c.key}return l}))),r[i]=s}),r}ms.default=ur;var ws={},gc=ve&&ve.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(ws,"__esModule",{value:!0});var je=at,mc=Ur;function cr(t,e){if(e===void 0&&(e=je.DefaultOption),!je.isValidObject(t))return null;e=je.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=mc.default(n);e.recursive&&(je.isValidObject(s)?je.belongToTypes(s,e.keepTypesOnRecursion)||(s=cr(s,e)):e.recursiveInArray&&je.isArrayObject(s)&&(s=gc(s).map(function(o){var l=o;if(je.isValidObject(o))je.belongToTypes(l,e.keepTypesOnRecursion)||(l=cr(o,e));else if(je.isArrayObject(o)){var c=cr({key:o},e);l=c.key}return l}))),r[i]=s}),r}ws.default=cr;var vs={},wc=ve&&ve.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(vs,"__esModule",{value:!0});var Re=at,vc=Br;function hr(t,e){if(e===void 0&&(e=Re.DefaultOption),!Re.isValidObject(t))return null;e=Re.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=vc.default(n);e.recursive&&(Re.isValidObject(s)?Re.belongToTypes(s,e.keepTypesOnRecursion)||(s=hr(s,e)):e.recursiveInArray&&Re.isArrayObject(s)&&(s=wc(s).map(function(o){var l=o;if(Re.isValidObject(o))Re.belongToTypes(l,e.keepTypesOnRecursion)||(l=hr(o,e));else if(Re.isArrayObject(o)){var c=hr({key:o},e);l=c.key}return l}))),r[i]=s}),r}vs.default=hr;var bs={},bc=ve&&ve.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(bs,"__esModule",{value:!0});var $e=at,Oc=Lr;function fr(t,e){if(e===void 0&&(e=$e.DefaultOption),!$e.isValidObject(t))return null;e=$e.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=Oc.default(n);e.recursive&&($e.isValidObject(s)?$e.belongToTypes(s,e.keepTypesOnRecursion)||(s=fr(s,e)):e.recursiveInArray&&$e.isArrayObject(s)&&(s=bc(s).map(function(o){var l=o;if($e.isValidObject(o))$e.belongToTypes(l,e.keepTypesOnRecursion)||(l=fr(o,e));else if($e.isArrayObject(o)){var c=fr({key:o},e);l=c.key}return l}))),r[i]=s}),r}bs.default=fr;var Os={},Tc=ve&&ve.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(Os,"__esModule",{value:!0});var Me=at,zc=_r;function dr(t,e){if(e===void 0&&(e=Me.DefaultOption),!Me.isValidObject(t))return null;e=Me.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=zc.default(n);e.recursive&&(Me.isValidObject(s)?Me.belongToTypes(s,e.keepTypesOnRecursion)||(s=dr(s,e)):e.recursiveInArray&&Me.isArrayObject(s)&&(s=Tc(s).map(function(o){var l=o;if(Me.isValidObject(o))Me.belongToTypes(l,e.keepTypesOnRecursion)||(l=dr(o,e));else if(Me.isArrayObject(o)){var c=dr({key:o},e);l=c.key}return l}))),r[i]=s}),r}Os.default=dr;Object.defineProperty(A,"__esModule",{value:!0});A.kebabKeys=A.pascalKeys=A.snakeKeys=A.camelKeys=A.upperKeys=A.lowerKeys=A.toLowerCase=A.toUpperCase=A.toKebabCase=A.toHeaderCase=A.toSentenceCase=A.toTextCase=A.toPathCase=A.toDotCase=A.toPascalCase=A.toSnakeCase=A.toCamelCase=void 0;var ii=Ur;A.toCamelCase=ii.default;var oi=Br;A.toSnakeCase=oi.default;var li=Lr;A.toPascalCase=li.default;var ui=hs;A.toDotCase=ui.default;var ci=fs;A.toPathCase=ci.default;var hi=ds;A.toTextCase=hi.default;var fi=ys;A.toSentenceCase=fi.default;var di=ps;A.toHeaderCase=di.default;var yi=_r;A.toKebabCase=yi.default;var pi=gs;A.lowerKeys=pi.default;var gi=ms;A.upperKeys=gi.default;var mi=ws;A.camelKeys=mi.default;var wi=vs;A.snakeKeys=wi.default;var vi=bs;A.pascalKeys=vi.default;var bi=Os;A.kebabKeys=bi.default;var Oi=function(t){return String(t||"").toLowerCase()};A.toLowerCase=Oi;var Ti=function(t){return String(t||"").toUpperCase()};A.toUpperCase=Ti;var Sc={toCamelCase:ii.default,toSnakeCase:oi.default,toPascalCase:li.default,toDotCase:ui.default,toPathCase:ci.default,toTextCase:hi.default,toSentenceCase:fi.default,toHeaderCase:di.default,toKebabCase:yi.default,toUpperCase:Ti,toLowerCase:Oi,lowerKeys:pi.default,upperKeys:gi.default,camelKeys:mi.default,snakeKeys:wi.default,pascalKeys:vi.default,kebabKeys:bi.default};A.default=Sc;var zi=A;const Si={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},Ac=t=>zi.snakeKeys(t,Si),kr=t=>zi.camelKeys(t,Si),Nc=t=>t!=null&&typeof t=="object"&&"toString"in t,Ic=(t,e=!1)=>{const r=Nc(t)?"stringer":typeof t;let n;switch(r){case"string":n=(s,i)=>s.localeCompare(i);break;case"stringer":n=(s,i)=>s.toString().localeCompare(i.toString());break;case"number":n=(s,i)=>Number(s)-Number(i);break;case"bigint":n=(s,i)=>BigInt(s)-BigInt(i)>0n?1:-1;break;case"boolean":n=(s,i)=>Number(s)-Number(i);break;default:return console.warn("sortFunc: unknown type"),()=>-1}return e?Ec(n):n},Ec=t=>(e,r)=>t(r,e),qr=a.z.tuple([a.z.number(),a.z.number()]);a.z.tuple([a.z.bigint(),a.z.bigint()]);const Ai=a.z.object({width:a.z.number(),height:a.z.number()}),kc=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),xc=["width","height"];a.z.enum(xc);const Cc=["start","center","end"],jc=["signedWidth","signedHeight"];a.z.enum(jc);const xr=a.z.object({x:a.z.number(),y:a.z.number()}),Rc=a.z.object({clientX:a.z.number(),clientY:a.z.number()}),$c=["x","y"],Ni=a.z.enum($c),Ii=["top","right","bottom","left"];a.z.enum(Ii);const Mc=["left","right"],Ei=a.z.enum(Mc),Dc=["top","bottom"],ki=a.z.enum(Dc),xi=["center"],aa=a.z.enum(xi),Pc=[...Ii,...xi],Ci=a.z.enum(Pc);a.z.enum(Cc);const Uc=["first","last"];a.z.enum(Uc);const Bc=a.z.object({lower:a.z.number(),upper:a.z.number()}),Lc=a.z.object({lower:a.z.bigint(),upper:a.z.bigint()});a.z.union([Bc,qr]);a.z.union([Lc,qr]);a.z.union([Ni,Ci]);a.z.union([Ni,Ci,a.z.instanceof(String)]);const xt=(t,e)=>{const r={};if(typeof t=="number"||typeof t=="bigint")e!=null?(r.lower=t,r.upper=e):(r.lower=typeof t=="bigint"?0n:0,r.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[r.lower,r.upper]=t}else return ia(t);return ia(r)},ia=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t;a.z.object({x:Ei.or(aa),y:ki.or(aa)});const _c=a.z.object({x:Ei,y:ki}),qc=Object.freeze({x:"left",y:"top"}),Zc=(t,e)=>t.x===e.x&&t.y===e.y,oa=a.z.union([a.z.number(),xr,qr,Ai,kc,Rc]),Yc=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},la=Object.freeze({x:0,y:0}),Qt=a.z.union([a.z.number(),a.z.string()]);a.z.object({top:Qt,left:Qt,width:Qt,height:Qt});a.z.object({left:a.z.number(),top:a.z.number(),right:a.z.number(),bottom:a.z.number()});a.z.object({one:xr,two:xr,root:_c});const Ts=(t,e,r=0,n=0,s)=>{const i={one:{...la},two:{...la},root:s??qc};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:t,y:e},i.two={x:i.one.x+r,y:i.one.y+n},i}return"one"in t&&"two"in t&&"root"in t?{...t,root:s??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(i.one={x:t.left,y:t.top},i.two={x:t.right,y:t.bottom},i):(i.one=t,e==null?i.two={x:i.one.x+r,y:i.one.y+n}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+r}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},dn=t=>{const e=Ts(t);return{lower:e.one.x,upper:e.two.x}},yn=t=>{const e=Ts(t);return{lower:e.one.y,upper:e.two.y}},Fc=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,Vc=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()});a.z.union([Ai,Vc,xr,qr]);var Wc=Object.defineProperty,Kc=(t,e,r)=>e in t?Wc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fe=(t,e,r)=>(Kc(t,typeof e!="symbol"?e+"":e,r),r);const Gc=(t,e,r)=>(e!=null&&(t=Math.max(t,e)),r!=null&&(t=Math.min(t,r)),t);a.z.object({offset:oa,scale:oa});const Jc=t=>(e,r,n,s)=>r==="dimension"?[e,n]:[e,s?n-t:n+t],Hc=t=>(e,r,n,s)=>[e,s?n/t:n*t],Xc=t=>(e,r,n)=>{if(e===null)return[t,n];const{lower:s,upper:i}=e,{lower:o,upper:l}=t,c=i-s,f=l-o;if(r==="dimension")return[t,n*(f/c)];const w=(n-s)*(f/c)+o;return[t,w]},Qc=t=>(e,r,n)=>[t,n],eh=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:n,upper:s}=t;return[t,s-(r-n)]},th=t=>(e,r,n)=>{const{lower:s,upper:i}=t;return n=Gc(n,s,i),[e,n]},Ln=class Tt{constructor(){Fe(this,"ops",[]),Fe(this,"currBounds",null),Fe(this,"currType",null),Fe(this,"reversed",!1),this.ops=[]}static translate(e){return new Tt().translate(e)}static magnify(e){return new Tt().magnify(e)}static scale(e,r){return new Tt().scale(e,r)}translate(e){const r=this.new(),n=Jc(e);return n.type="translate",r.ops.push(n),r}magnify(e){const r=this.new(),n=Hc(e);return n.type="magnify",r.ops.push(n),r}scale(e,r){const n=xt(e,r),s=this.new(),i=Xc(n);return i.type="scale",s.ops.push(i),s}clamp(e,r){const n=xt(e,r),s=this.new(),i=th(n);return i.type="clamp",s.ops.push(i),s}reBound(e,r){const n=xt(e,r),s=this.new(),i=Qc(n);return i.type="re-bound",s.ops.push(i),s}invert(){const e=eh();e.type="invert";const r=this.new();return r.ops.push(e),r}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new Tt;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([n,s],i)=>i(n,e,s,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||r.some(([o,l])=>s>=o&&s<=l))return;const i=e.ops.findIndex((o,l)=>o.type==="scale"&&l>s);i!==-1&&r.push([s,i])}),r.forEach(([n,s])=>{const i=e.ops.slice(n,s);i.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...i)}),e.reversed=!e.reversed,e}};Fe(Ln,"IDENTITY",new Ln);let ua=Ln;const ca=class Ze{constructor(e=new ua,r=new ua,n=null){Fe(this,"x"),Fe(this,"y"),Fe(this,"currRoot"),this.x=e,this.y=r,this.currRoot=n}static translate(e,r){return new Ze().translate(e,r)}static translateX(e){return new Ze().translateX(e)}static translateY(e){return new Ze().translateY(e)}static clamp(e){return new Ze().clamp(e)}static magnify(e){return new Ze().magnify(e)}static scale(e){return new Ze().scale(e)}static reBound(e){return new Ze().reBound(e)}translate(e,r){const n=Yc(e,r),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}translateX(e){const r=this.copy();return r.x=this.x.translate(e),r}translateY(e){const r=this.copy();return r.y=this.y.translate(e),r}magnify(e){const r=this.copy();return r.x=this.x.magnify(e.x),r.y=this.y.magnify(e.y),r}scale(e){const r=this.copy();if(Fc(e)){const n=this.currRoot;return r.currRoot=e.root,n!=null&&!Zc(n,e.root)&&(n.x!==e.root.x&&(r.x=r.x.invert()),n.y!==e.root.y&&(r.y=r.y.invert())),r.x=r.x.scale(dn(e)),r.y=r.y.scale(yn(e)),r}return r.x=r.x.scale(e.width),r.y=r.y.scale(e.height),r}reBound(e){const r=this.copy();return r.x=this.x.reBound(dn(e)),r.y=this.y.reBound(yn(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(dn(e)),r.y=this.y.clamp(yn(e)),r}copy(){const e=new Ze;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}box(e){return Ts(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};Fe(ca,"IDENTITY",new ca);var rh=Object.defineProperty,nh=(t,e,r)=>e in t?rh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m=(t,e,r)=>(nh(t,typeof e!="symbol"?e+"":e,r),r);let sh="_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",ah=(t=21)=>{let e="",r=t;for(;r--;)e+=sh[Math.random()*64|0];return e};const ji=(t,e)=>{const r=new E(e);if(![k.DAY,k.HOUR,k.MINUTE,k.SECOND,k.MILLISECOND,k.MICROSECOND,k.NANOSECOND].some(s=>s.equals(r)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=t.valueOf()%r.valueOf();return t instanceof E?new E(n):new k(n)},L=class z{constructor(e,r="UTC"){if(m(this,"value"),m(this,"encodeValue",!0),e==null)this.value=z.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*z.MILLISECOND.valueOf();else if(typeof e=="string")this.value=z.parseDateTimeString(e,r).valueOf();else if(Array.isArray(e))this.value=z.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),r==="local"&&(n=z.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=z.MAX:e=z.MIN)),this.value=BigInt(e.valueOf())+n}}static parseDate([e=1970,r=1,n=1]){const s=new Date(e,r-1,n,0,0,0,0);return new z(BigInt(s.getTime())*z.MILLISECOND.valueOf()).truncate(z.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[n,s,i]=e.split(":");let o="00",l="00";i!=null&&([o,l]=i.split("."));let c=z.hours(parseInt(n??"00",10)).add(z.minutes(parseInt(s??"00",10))).add(z.seconds(parseInt(o??"00",10))).add(z.milliseconds(parseInt(l??"00",10)));return r==="local"&&(c=c.add(z.utcOffset)),c.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return z.parseTimeString(e,r);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new z(BigInt(n.getTime())*z.MILLISECOND.valueOf(),r).valueOf()}fString(e="ISO",r="UTC"){switch(e){case"ISODate":return this.toISOString(r).slice(0,10);case"ISOTime":return this.toISOString(r).slice(11,23);case"time":return this.timeString(!1,r);case"preciseTime":return this.timeString(!0,r);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,r)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,r)}`;default:return this.toISOString(r)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(z.utcOffset).date().toISOString()}timeString(e=!1,r="UTC"){const n=this.toISOString(r);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),r=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${r} ${n}`}static get utcOffset(){return new k(BigInt(new Date().getTimezoneOffset())*z.MINUTE.valueOf())}static since(e){return new z().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new z(e).valueOf()}span(e){return this.range(e).span}range(e){return new ce(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new z(e).valueOf()}afterEq(e){return this.valueOf()>=new z(e).valueOf()}before(e){return this.valueOf()<new z(e).valueOf()}beforeEq(e){return this.valueOf()<=new z(e).valueOf()}add(e){return new z(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new z(this.valueOf()-BigInt(e.valueOf()))}milliseconds(){return Number(this.valueOf())/Number(z.MILLISECOND.valueOf())}toString(){return this.date().toISOString()}remainder(e){return ji(this,e)}get isToday(){return this.truncate(k.DAY).equals(z.now().truncate(k.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new z(new Date)}static max(...e){let r=z.MIN;for(const n of e){const s=new z(n);s.after(r)&&(r=s)}return r}static min(...e){let r=z.MAX;for(const n of e){const s=new z(n);s.before(r)&&(r=s)}return r}static nanoseconds(e){return new z(e)}static microseconds(e){return z.nanoseconds(e*1e3)}static milliseconds(e){return z.microseconds(e*1e3)}static seconds(e){return z.milliseconds(e*1e3)}static minutes(e){return z.seconds(e*60)}static hours(e){return z.minutes(e*60)}static days(e){return z.hours(e*24)}};m(L,"NANOSECOND",L.nanoseconds(1)),m(L,"MICROSECOND",L.microseconds(1)),m(L,"MILLISECOND",L.milliseconds(1)),m(L,"SECOND",L.seconds(1)),m(L,"MINUTE",L.minutes(1)),m(L,"HOUR",L.hours(1)),m(L,"DAY",L.days(1)),m(L,"MAX",new L((1n<<63n)-1n)),m(L,"MIN",new L(0)),m(L,"ZERO",new L(0)),m(L,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(t=>new L(t.value)),a.z.string().transform(t=>new L(BigInt(t))),a.z.instanceof(Number).transform(t=>new L(t)),a.z.number().transform(t=>new L(t)),a.z.instanceof(L)]));let E=L;const _=class j{constructor(e){m(this,"value"),m(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new j(e).valueOf()}greaterThan(e){return this.valueOf()>new j(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new j(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new j(e).valueOf()}remainder(e){return ji(this,e)}truncate(e){return new j(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(j.DAY),r=this.truncate(j.HOUR),n=this.truncate(j.MINUTE),s=this.truncate(j.SECOND),i=this.truncate(j.MILLISECOND),o=this.truncate(j.MICROSECOND),l=this.truncate(j.NANOSECOND),c=e,f=r.sub(e),w=n.sub(r),h=s.sub(n),D=i.sub(s),F=o.sub(i),se=l.sub(o);let $="";return c.isZero||($+=`${c.days}d `),f.isZero||($+=`${f.hours}h `),w.isZero||($+=`${w.minutes}m `),h.isZero||($+=`${h.seconds}s `),D.isZero||($+=`${D.milliseconds}ms `),F.isZero||($+=`${F.microseconds}µs `),se.isZero||($+=`${se.nanoseconds}ns`),$.trim()}get days(){return Number(this.valueOf())/Number(j.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(j.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(j.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(j.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(j.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(j.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new j(e).valueOf()}add(e){return new j(this.valueOf()+new j(e).valueOf())}sub(e){return new j(this.valueOf()-new j(e).valueOf())}static nanoseconds(e=1){return new j(e)}static microseconds(e=1){return j.nanoseconds(e*1e3)}static milliseconds(e=1){return j.microseconds(e*1e3)}static seconds(e=1){return j.milliseconds(e*1e3)}static minutes(e){return j.seconds(e.valueOf()*60)}static hours(e){return j.minutes(e*60)}static days(e){return j.hours(e*24)}};m(_,"NANOSECOND",_.nanoseconds(1)),m(_,"MICROSECOND",_.microseconds(1)),m(_,"MILLISECOND",_.milliseconds(1)),m(_,"SECOND",_.seconds(1)),m(_,"MINUTE",_.minutes(1)),m(_,"HOUR",_.hours(1)),m(_,"DAY",_.days(1)),m(_,"MAX",new _((1n<<63n)-1n)),m(_,"MIN",new _(0)),m(_,"ZERO",new _(0)),m(_,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(t=>new _(t.value)),a.z.string().transform(t=>new _(BigInt(t))),a.z.instanceof(Number).transform(t=>new _(t)),a.z.number().transform(t=>new _(t)),a.z.instanceof(_)]));let k=_;const zt=class yr extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new yr(e).valueOf()}get period(){return k.seconds(1/this.valueOf())}sampleCount(e){return new k(e).seconds*this.valueOf()}byteCount(e,r){return this.sampleCount(e)*new fe(r).valueOf()}span(e){return k.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/r.valueOf())}static hz(e){return new yr(e)}static khz(e){return yr.hz(e*1e3)}};m(zt,"z",a.z.union([a.z.number().transform(t=>new zt(t)),a.z.instanceof(Number).transform(t=>new zt(t)),a.z.instanceof(zt)]));let zs=zt;const ee=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Rt(e*this.valueOf())}};m(ee,"UNKNOWN",new ee(0)),m(ee,"BIT128",new ee(16)),m(ee,"BIT64",new ee(8)),m(ee,"BIT32",new ee(4)),m(ee,"BIT16",new ee(2)),m(ee,"BIT8",new ee(1)),m(ee,"z",a.z.union([a.z.number().transform(t=>new ee(t)),a.z.instanceof(Number).transform(t=>new ee(t)),a.z.instanceof(ee)]));let fe=ee;const Se=class pr{constructor(e,r){m(this,"start"),m(this,"end"),typeof e=="object"&&"start"in e?(this.start=new E(e.start),this.end=new E(e.end)):(this.start=new E(e),this.end=new E(r))}get span(){return new k(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 pr(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,r=k.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const s=E.max(n.start,e.start),i=E.min(n.end,e.end);return i.before(s)?!1:new k(i.sub(s)).greaterThanOrEqual(r)}roughlyEquals(e,r){let n=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return n<0&&(n=-n),s<0&&(s=-s),n<=r.valueOf()&&s<=r.valueOf()}contains(e){return e instanceof pr?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new pr(this.start,this.end);return e.start.after(this.start)&&(r.start=e.start),e.start.after(this.end)&&(r.end=e.start),e.end.before(this.end)&&(r.end=e.end),e.end.before(this.start)&&(r.start=e.end),r}};m(Se,"MAX",new Se(E.MIN,E.MAX)),m(Se,"MIN",new Se(E.MAX,E.MIN)),m(Se,"ZERO",new Se(E.ZERO,E.ZERO)),m(Se,"z",a.z.union([a.z.object({start:E.z,end:E.z}).transform(t=>new Se(t.start,t.end)),a.z.instanceof(Se)]));let ce=Se;const y=class Ae extends String{constructor(e){if(e instanceof Ae||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const r=Ae.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(r!=null){super(r.valueOf());return}}throw super(Ae.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=Ae.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}toString(){return this.valueOf()}get isVariable(){return this.equals(Ae.JSON)||this.equals(Ae.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(Ae.UUID)}get isInteger(){return this.toString().startsWith("int")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=Ae.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}canSafelyCastTo(e){return this.equals(e)?!0:this.isVariable&&!e.isVariable||!this.isVariable&&e.isVariable?!1:this.isFloat&&e.isInteger||this.isInteger&&e.isFloat?this.density.valueOf()<e.density.valueOf():this.isFloat&&e.isFloat||this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf():!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return Ae.BIG_INT_TYPES.some(e=>e.equals(this))}};m(y,"UNKNOWN",new y("unknown")),m(y,"FLOAT64",new y("float64")),m(y,"FLOAT32",new y("float32")),m(y,"INT64",new y("int64")),m(y,"INT32",new y("int32")),m(y,"INT16",new y("int16")),m(y,"INT8",new y("int8")),m(y,"UINT64",new y("uint64")),m(y,"UINT32",new y("uint32")),m(y,"UINT16",new y("uint16")),m(y,"UINT8",new y("uint8")),m(y,"BOOLEAN",y.UINT8),m(y,"TIMESTAMP",new y("timestamp")),m(y,"UUID",new y("uuid")),m(y,"STRING",new y("string")),m(y,"JSON",new y("json")),m(y,"ARRAY_CONSTRUCTORS",new Map([[y.UINT8.toString(),Uint8Array],[y.UINT16.toString(),Uint16Array],[y.UINT32.toString(),Uint32Array],[y.UINT64.toString(),BigUint64Array],[y.FLOAT32.toString(),Float32Array],[y.FLOAT64.toString(),Float64Array],[y.INT8.toString(),Int8Array],[y.INT16.toString(),Int16Array],[y.INT32.toString(),Int32Array],[y.INT64.toString(),BigInt64Array],[y.TIMESTAMP.toString(),BigInt64Array],[y.STRING.toString(),Uint8Array],[y.JSON.toString(),Uint8Array],[y.UUID.toString(),Uint8Array]])),m(y,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,y.UINT8],[Uint16Array.name,y.UINT16],[Uint32Array.name,y.UINT32],[BigUint64Array.name,y.UINT64],[Float32Array.name,y.FLOAT32],[Float64Array.name,y.FLOAT64],[Int8Array.name,y.INT8],[Int16Array.name,y.INT16],[Int32Array.name,y.INT32],[BigInt64Array.name,y.INT64]])),m(y,"DENSITIES",new Map([[y.UINT8.toString(),fe.BIT8],[y.UINT16.toString(),fe.BIT16],[y.UINT32.toString(),fe.BIT32],[y.UINT64.toString(),fe.BIT64],[y.FLOAT32.toString(),fe.BIT32],[y.FLOAT64.toString(),fe.BIT64],[y.INT8.toString(),fe.BIT8],[y.INT16.toString(),fe.BIT16],[y.INT32.toString(),fe.BIT32],[y.INT64.toString(),fe.BIT64],[y.TIMESTAMP.toString(),fe.BIT64],[y.STRING.toString(),fe.UNKNOWN],[y.JSON.toString(),fe.UNKNOWN],[y.UUID.toString(),fe.BIT128]])),m(y,"ALL",[y.UNKNOWN,y.FLOAT64,y.FLOAT32,y.INT64,y.INT32,y.INT16,y.INT8,y.UINT64,y.UINT32,y.UINT16,y.UINT8,y.TIMESTAMP,y.UUID,y.STRING,y.JSON]),m(y,"BIG_INT_TYPES",[y.INT64,y.UINT64,y.TIMESTAMP]),m(y,"z",a.z.union([a.z.string().transform(t=>new y(t)),a.z.instanceof(y)]));let x=y;const ie=class J extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return J.bytes(this.valueOf()+e.valueOf())}sub(e){return J.bytes(this.valueOf()-e.valueOf())}truncate(e){return new J(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return J.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/J.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/J.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/J.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/J.TERABYTE.valueOf()}toString(){const e=this.truncate(J.TERABYTE),r=this.truncate(J.GIGABYTE),n=this.truncate(J.MEGABYTE),s=this.truncate(J.KILOBYTE),i=this.truncate(J.BYTE),o=e,l=r.sub(e),c=n.sub(r),f=s.sub(n),w=i.sub(s);let h="";return o.isZero||(h+=`${o.terabytes}TB `),l.isZero||(h+=`${l.gigabytes}GB `),c.isZero||(h+=`${c.megabytes}MB `),f.isZero||(h+=`${f.kilobytes}KB `),(!w.isZero||h==="")&&(h+=`${w.valueOf()}B`),h.trim()}static bytes(e=1){return new J(e)}static kilobytes(e=1){return J.bytes(e.valueOf()*1e3)}static megabytes(e=1){return J.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return J.megabytes(e.valueOf()*1e3)}static terabytes(e){return J.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};m(ie,"BYTE",new ie(1)),m(ie,"KILOBYTE",ie.kilobytes(1)),m(ie,"MEGABYTE",ie.megabytes(1)),m(ie,"GIGABYTE",ie.gigabytes(1)),m(ie,"TERABYTE",ie.terabytes(1)),m(ie,"ZERO",new ie(0)),m(ie,"z",a.z.union([a.z.number().transform(t=>new ie(t)),a.z.instanceof(ie)]));let Rt=ie;a.z.union([a.z.instanceof(Uint8Array),a.z.instanceof(Uint16Array),a.z.instanceof(Uint32Array),a.z.instanceof(BigUint64Array),a.z.instanceof(Float32Array),a.z.instanceof(Float64Array),a.z.instanceof(Int8Array),a.z.instanceof(Int16Array),a.z.instanceof(Int32Array),a.z.instanceof(BigInt64Array)]);const Ri=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof E||t instanceof k||t instanceof Date},ih=(t,e,r,n=0)=>t.usesBigInt&&!e.usesBigInt?Number(r)-Number(n):!t.usesBigInt&&e.usesBigInt?BigInt(r)-BigInt(n):St(r,-n),oh=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof ue?!0:Ri(t),et=-1;class ue{constructor(e){m(this,"key",""),m(this,"isSynnaxSeries",!0),m(this,"dataType"),m(this,"sampleOffset"),m(this,"gl"),m(this,"_data"),m(this,"_timeRange"),m(this,"alignment",0n),m(this,"_cachedMin"),m(this,"_cachedMax"),m(this,"writePos",et),m(this,"_refCount",0),m(this,"_cachedLength"),oh(e)&&(e={data:e});const{dataType:r,timeRange:n,sampleOffset:s=0,glBufferUsage:i="static",alignment:o=0n,key:l=ah()}=e,{data:c}=e;if(c instanceof ue||typeof c=="object"&&"isSynnaxSeries"in c&&c.isSynnaxSeries===!0){const h=c;this.key=h.key,this.dataType=h.dataType,this.sampleOffset=h.sampleOffset,this.gl=h.gl,this._data=h._data,this._timeRange=h._timeRange,this.alignment=h.alignment,this._cachedMin=h._cachedMin,this._cachedMax=h._cachedMax,this.writePos=h.writePos,this._refCount=h._refCount,this._cachedLength=h._cachedLength;return}const f=Ri(c),w=Array.isArray(c);if(r!=null)this.dataType=new x(r);else{if(c instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(w||f){let h=c;if(!f){if(c.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");h=c[0]}if(typeof h=="string")this.dataType=x.STRING;else if(typeof h=="number")this.dataType=x.FLOAT64;else if(typeof h=="bigint")this.dataType=x.INT64;else if(typeof h=="boolean")this.dataType=x.BOOLEAN;else if(h instanceof E||h instanceof Date||h instanceof E)this.dataType=x.TIMESTAMP;else if(typeof h=="object")this.dataType=x.JSON;else throw new Error(`cannot infer data type of ${typeof h} when constructing a Series from a JS array`)}else this.dataType=new x(c)}if(!w&&!f)this._data=c;else{let h=f?[c]:c;const D=h[0];(D instanceof E||D instanceof Date||D instanceof k)&&(h=h.map(F=>new E(F).valueOf())),this.dataType.equals(x.STRING)?(this._cachedLength=h.length,this._data=new TextEncoder().encode(h.join(`
|
|
12
|
-
`)+`
|
|
13
|
-
`)):this.dataType.equals(x.JSON)?(this._cachedLength=h.length,this._data=new TextEncoder().encode(h.map(F=>JSON.stringify(F)).join(`
|
|
14
|
-
`)+`
|
|
15
|
-
`)):this._data=new this.dataType.Array(h).buffer}this.key=l,this.alignment=o,this.sampleOffset=s??0,this._timeRange=n,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:e,dataType:r,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new x(r).Array(e),i=new ue({data:s.buffer,dataType:r,...n});return i.writePos=0,i}static generateTimestamps(e,r,n){const s=n.spanRange(r.span(e)),i=new BigInt64Array(e);for(let o=0;o<e;o++)i[o]=BigInt(n.add(r.span(o)).valueOf());return new ue({data:i,dataType:x.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(e,r){const n=new TextEncoder().encode(e.join(`
|
|
16
|
-
`)+`
|
|
17
|
-
`);return new ue({data:n,dataType:x.STRING,timeRange:r})}static fromJSON(e,r){const n=new TextEncoder().encode(e.map(s=>JSON.stringify(s)).join(`
|
|
18
|
-
`)+`
|
|
19
|
-
`);return new ue({data:n,dataType:x.JSON,timeRange:r})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}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(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");if(this.writePos===et)return 0;const r=this.capacity-this.writePos,n=r<e.length?e.slice(0,r):e;return this.underlyingData.set(n.data,this.writePos),this.maybeRecomputeMinMax(n),this._cachedLength=void 0,this.writePos+=n.length,n.length}get buffer(){return this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===et?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.equals(x.STRING))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
|
|
20
|
-
`).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(x.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=x.UUID.density.valueOf(),r=Array(this.length);for(let n=0;n<this.length;n++){const s=this.buffer.slice(n*e,(n+1)*e),i=Array.from(new Uint8Array(s),o=>o.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");r[n]=i}return r}parseJSON(e){if(!this.dataType.equals(x.JSON))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
|
|
21
|
-
`).slice(0,-1).map(r=>e.parse(kr(JSON.parse(r))))}get timeRange(){if(this._timeRange==null)throw new Error("time range not set on series");return this._timeRange}get byteCapacity(){return new Rt(this.buffer.byteLength)}get capacity(){return this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===et?this.byteCapacity:this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===et?this.data.length:this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;return this.data.forEach(r=>{r===10&&e++}),this._cachedLength=e,e}convert(e,r=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let s=0;s<this.length;s++)n[s]=ih(this.dataType,e,this.data[s],r);return new ue({data:n.buffer,dataType:e,timeRange:this._timeRange,sampleOffset:r,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(x.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMax=e.reduce((r,n)=>r>n?r:n)}else{const e=this.data;this._cachedMax=e.reduce((r,n)=>r>n?r:n)}return this._cachedMax}get max(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this._cachedMax==null&&(this._cachedMax=this.calcRawMax()),St(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(x.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMin=e.reduce((r,n)=>r<n?r:n)}else{const e=this.data;this._cachedMin=e.reduce((r,n)=>r<n?r:n)}return this._cachedMin}get min(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this._cachedMin==null&&(this._cachedMin=this.calcRawMin()),St(this._cachedMin,this.sampleOffset))}get bounds(){return xt(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._cachedMin!=null){const r=e._cachedMin??e.calcRawMin();r<this._cachedMin&&(this._cachedMin=r)}if(this._cachedMax!=null){const r=e._cachedMax??e.calcRawMax();r>this._cachedMax&&(this._cachedMax=r)}}enrich(){this.max,this.min}get range(){return St(this.max,-this.min)}at(e,r){if(this.dataType.isVariable)return this.atVariable(e,r??!1);e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(r===!0)throw new Error(`[series] - no value at index ${e}`);return}return St(n,this.sampleOffset)}atVariable(e,r){e<0&&(e=this.length+e);let n=0,s=0;for(let o=0;o<this.data.length;o++)if(this.data[o]===10){if(e===0){s=o;break}n=o+1,e--}if(s===0&&(s=this.data.length),n>=s||e>0){if(r)throw new Error(`[series] - no value at index ${e}`);return}const i=this.data.slice(n,s);return this.dataType.equals(x.STRING)?new TextDecoder().decode(i):kr(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let r=0,n=this.length-1;const s=Ic(e);for(;r<=n;){const i=Math.floor((r+n)/2),o=s(this.at(i,!0),e);if(o===0)return i;o<0?r=i+1:n=i-1}return r}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(x.FLOAT32))throw new Error("Only FLOAT32 arrays can be used in WebGL");const{buffer:r,bufferUsage:n,prevBuffer:s}=this.gl;if(r==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==et){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(s).valueOf(),o=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,o.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=et}as(e){if(e==="string"){if(!this.dataType.equals(x.STRING))throw new Error(`cannot convert series of type ${this.dataType.toString()} to string`);return this}if(e==="number"){if(!this.dataType.isNumeric)throw new Error(`cannot convert series of type ${this.dataType.toString()} to number`);return this}if(e==="bigint"){if(!this.dataType.equals(x.INT64))throw new Error(`cannot convert series of type ${this.dataType.toString()} to bigint`);return this}throw new Error(`cannot convert series to ${e}`)}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:this.alignmentBounds,timeRange:(e=this._timeRange)==null?void 0:e.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 xt(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.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 e=new lh(this);return this.dataType.equals(x.JSON)?new uh(e):e}return new ch(this)}slice(e,r){if(e<=0&&(r==null||r>=this.length))return this;const n=this.data.slice(e,r);return new ue({data:n,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}reAlign(e){return new ue({data:this.buffer,dataType:this.dataType,timeRange:ce.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}}class lh{constructor(e){if(m(this,"series"),m(this,"index"),m(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,r=this.series.data;for(;this.index<r.length&&r[this.index]!==10;)this.index++;const n=this.index;return e===n?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,n))})}[Symbol.iterator](){return this}}var $i;let uh=class{constructor(t){m(this,"wrapped"),m(this,$i,"JSONSeriesIterator"),this.wrapped=t}next(){const t=this.wrapped.next();return t.done===!0?{done:!0,value:void 0}:{done:!1,value:kr(JSON.parse(t.value))}}[Symbol.iterator](){return this}};$i=Symbol.toStringTag;var Mi;let ch=class{constructor(t){m(this,"series"),m(this,"index"),m(this,Mi,"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}};Mi=Symbol.toStringTag;const St=(t,e)=>typeof t=="bigint"&&typeof e=="bigint"||typeof t=="number"&&typeof e=="number"?t+e:e===0?t:t===0?e:Number(t)+Number(e);let hh=class{constructor(t){if(m(this,"series"),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 x(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?x.UNKNOWN:this.series[0].dataType}get timeRange(){return this.series.length===0?ce.ZERO:new ce(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 Rt(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 fh(this.series)}};var Di;let fh=class{constructor(t){m(this,"series"),m(this,"seriesIndex"),m(this,"internal"),m(this,Di,"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}};Di=Symbol.toStringTag;const I=t=>Array.isArray(t)?t:[t],Xe=a.z.number(),Yt=a.z.object({name:a.z.string(),key:a.z.number(),rate:zs.z,dataType:x.z,leaseholder:a.z.number(),index:a.z.number(),isIndex:a.z.boolean(),internal:a.z.boolean(),alias:a.z.string().optional()}),Pi=Yt.extend({key:a.z.number().optional(),leaseholder:a.z.number().optional(),index:a.z.number().optional(),rate:zs.z.optional().default(0),isIndex:a.z.boolean().optional(),internal:a.z.boolean().optional().default(!1),virtual:a.z.boolean().optional().default(!1)}),dh=(t,e)=>{let r=null;return e===0?t:(...n)=>{r!==null&&(clearTimeout(r),r=null),r=setTimeout(()=>t(...n),e)}},yh=new Error("request for lock canceled");var ph=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(w){try{f(n.next(w))}catch(h){o(h)}}function c(w){try{f(n.throw(w))}catch(h){o(h)}}function f(w){w.done?i(w.value):s(w.value).then(l,c)}f((n=n.apply(t,e||[])).next())})};class gh{constructor(e,r=yh){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,s)=>{const i={resolve:n,reject:s,weight:e,priority:r},o=Ui(this._queue,l=>r<=l.priority);o===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(o+1,0,i)})}runExclusive(e){return ph(this,arguments,void 0,function*(r,n=1,s=0){const[i,o]=yield this.acquire(n,s);try{return yield r(i)}finally{o()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),mh(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let r=this._value;r>0;r--){const n=this._weightedWaiters[r-1];if(!n)continue;const s=n.findIndex(i=>i.priority<=e);(s===-1?n:n.splice(0,s)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function mh(t,e){const r=Ui(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function Ui(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var wh=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(w){try{f(n.next(w))}catch(h){o(h)}}function c(w){try{f(n.throw(w))}catch(h){o(h)}}function f(w){w.done?i(w.value):s(w.value).then(l,c)}f((n=n.apply(t,e||[])).next())})};class vh{constructor(e){this._semaphore=new gh(1,e)}acquire(){return wh(this,arguments,void 0,function*(e=0){const[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}var bh=Object.defineProperty,Oh=(t,e,r)=>e in t?bh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V=(t,e,r)=>(Oh(t,typeof e!="symbol"?e+"":e,r),r),be=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},N={},Zr={};Object.defineProperty(Zr,"__esModule",{value:!0});function Th(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"$"+n}).toLowerCase().replace(/(\$)(\w)/g,function(e,r,n){return n.toUpperCase()}):""}Zr.default=Th;var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});function zh(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"_").toLowerCase():""}Yr.default=zh;var Fr={};Object.defineProperty(Fr,"__esModule",{value:!0});function Sh(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"$").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"$"+n}).toLowerCase().replace(/(\$)(\w?)/g,function(e,r,n){return n.toUpperCase()}):""}Fr.default=Sh;var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});function Ah(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,".").toLowerCase():""}Ss.default=Ah;var As={};Object.defineProperty(As,"__esModule",{value:!0});function Nh(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"/").toLowerCase():""}As.default=Nh;var Ns={};Object.defineProperty(Ns,"__esModule",{value:!0});function Ih(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase():""}Ns.default=Ih;var Is={};Object.defineProperty(Is,"__esModule",{value:!0});function Eh(t){if(t===void 0&&(t=""),!t)return"";var e=String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(r,n,s){return n+"_"+s.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}Is.default=Eh;var Es={};Object.defineProperty(Es,"__esModule",{value:!0});function kh(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase().replace(/( ?)(\w+)( ?)/g,function(e,r,n,s){return r+n.charAt(0).toUpperCase()+n.slice(1)+s}):""}Es.default=kh;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});function xh(t){return t===void 0&&(t=""),t?String(t).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,r,n){return r+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"-").toLowerCase():""}Vr.default=xh;var ks={},it={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.belongToTypes=t.isValidObject=t.isArrayObject=t.validateOptions=t.DefaultOption=void 0,t.DefaultOption={recursive:!1,recursiveInArray:!1,keepTypesOnRecursion:[]},t.validateOptions=function(e){return e===void 0&&(e=t.DefaultOption),e.recursive==null?e=t.DefaultOption:e.recursiveInArray==null&&(e.recursiveInArray=!1),e},t.isArrayObject=function(e){return e!=null&&Array.isArray(e)},t.isValidObject=function(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)},t.belongToTypes=function(e,r){return(r||[]).some(function(n){return e instanceof n})}})(it);var Ch=be&&be.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(ks,"__esModule",{value:!0});var De=it;function gr(t,e){if(e===void 0&&(e=De.DefaultOption),!De.isValidObject(t))return null;e=De.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=n.toLowerCase();e.recursive&&(De.isValidObject(s)?De.belongToTypes(s,e.keepTypesOnRecursion)||(s=gr(s,e)):e.recursiveInArray&&De.isArrayObject(s)&&(s=Ch(s).map(function(o){var l=o;if(De.isValidObject(o))De.belongToTypes(l,e.keepTypesOnRecursion)||(l=gr(o,e));else if(De.isArrayObject(o)){var c=gr({key:o},e);l=c.key}return l}))),r[i]=s}),r}ks.default=gr;var xs={},jh=be&&be.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(xs,"__esModule",{value:!0});var Pe=it;function mr(t,e){if(e===void 0&&(e=Pe.DefaultOption),!Pe.isValidObject(t))return null;e=Pe.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=n.toUpperCase();e.recursive&&(Pe.isValidObject(s)?Pe.belongToTypes(s,e.keepTypesOnRecursion)||(s=mr(s,e)):e.recursiveInArray&&Pe.isArrayObject(s)&&(s=jh(s).map(function(o){var l=o;if(Pe.isValidObject(o))Pe.belongToTypes(l,e.keepTypesOnRecursion)||(l=mr(o,e));else if(Pe.isArrayObject(o)){var c=mr({key:o},e);l=c.key}return l}))),r[i]=s}),r}xs.default=mr;var Cs={},Rh=be&&be.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(Cs,"__esModule",{value:!0});var Ue=it,$h=Zr;function wr(t,e){if(e===void 0&&(e=Ue.DefaultOption),!Ue.isValidObject(t))return null;e=Ue.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=$h.default(n);e.recursive&&(Ue.isValidObject(s)?Ue.belongToTypes(s,e.keepTypesOnRecursion)||(s=wr(s,e)):e.recursiveInArray&&Ue.isArrayObject(s)&&(s=Rh(s).map(function(o){var l=o;if(Ue.isValidObject(o))Ue.belongToTypes(l,e.keepTypesOnRecursion)||(l=wr(o,e));else if(Ue.isArrayObject(o)){var c=wr({key:o},e);l=c.key}return l}))),r[i]=s}),r}Cs.default=wr;var js={},Mh=be&&be.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(js,"__esModule",{value:!0});var Be=it,Dh=Yr;function vr(t,e){if(e===void 0&&(e=Be.DefaultOption),!Be.isValidObject(t))return null;e=Be.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=Dh.default(n);e.recursive&&(Be.isValidObject(s)?Be.belongToTypes(s,e.keepTypesOnRecursion)||(s=vr(s,e)):e.recursiveInArray&&Be.isArrayObject(s)&&(s=Mh(s).map(function(o){var l=o;if(Be.isValidObject(o))Be.belongToTypes(l,e.keepTypesOnRecursion)||(l=vr(o,e));else if(Be.isArrayObject(o)){var c=vr({key:o},e);l=c.key}return l}))),r[i]=s}),r}js.default=vr;var Rs={},Ph=be&&be.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty(Rs,"__esModule",{value:!0});var Le=it,Uh=Fr;function br(t,e){if(e===void 0&&(e=Le.DefaultOption),!Le.isValidObject(t))return null;e=Le.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=Uh.default(n);e.recursive&&(Le.isValidObject(s)?Le.belongToTypes(s,e.keepTypesOnRecursion)||(s=br(s,e)):e.recursiveInArray&&Le.isArrayObject(s)&&(s=Ph(s).map(function(o){var l=o;if(Le.isValidObject(o))Le.belongToTypes(l,e.keepTypesOnRecursion)||(l=br(o,e));else if(Le.isArrayObject(o)){var c=br({key:o},e);l=c.key}return l}))),r[i]=s}),r}Rs.default=br;var $s={},Bh=be&&be.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,l=i.length;o<l;o++,s++)n[s]=i[o];return n};Object.defineProperty($s,"__esModule",{value:!0});var _e=it,Lh=Vr;function Or(t,e){if(e===void 0&&(e=_e.DefaultOption),!_e.isValidObject(t))return null;e=_e.validateOptions(e);var r={};return Object.keys(t).forEach(function(n){var s=t[n],i=Lh.default(n);e.recursive&&(_e.isValidObject(s)?_e.belongToTypes(s,e.keepTypesOnRecursion)||(s=Or(s,e)):e.recursiveInArray&&_e.isArrayObject(s)&&(s=Bh(s).map(function(o){var l=o;if(_e.isValidObject(o))_e.belongToTypes(l,e.keepTypesOnRecursion)||(l=Or(o,e));else if(_e.isArrayObject(o)){var c=Or({key:o},e);l=c.key}return l}))),r[i]=s}),r}$s.default=Or;Object.defineProperty(N,"__esModule",{value:!0});N.kebabKeys=N.pascalKeys=N.snakeKeys=N.camelKeys=N.upperKeys=N.lowerKeys=N.toLowerCase=N.toUpperCase=N.toKebabCase=N.toHeaderCase=N.toSentenceCase=N.toTextCase=N.toPathCase=N.toDotCase=N.toPascalCase=N.toSnakeCase=N.toCamelCase=void 0;var Bi=Zr;N.toCamelCase=Bi.default;var Li=Yr;N.toSnakeCase=Li.default;var _i=Fr;N.toPascalCase=_i.default;var qi=Ss;N.toDotCase=qi.default;var Zi=As;N.toPathCase=Zi.default;var Yi=Ns;N.toTextCase=Yi.default;var Fi=Is;N.toSentenceCase=Fi.default;var Vi=Es;N.toHeaderCase=Vi.default;var Wi=Vr;N.toKebabCase=Wi.default;var Ki=ks;N.lowerKeys=Ki.default;var Gi=xs;N.upperKeys=Gi.default;var Ji=Cs;N.camelKeys=Ji.default;var Hi=js;N.snakeKeys=Hi.default;var Xi=Rs;N.pascalKeys=Xi.default;var Qi=$s;N.kebabKeys=Qi.default;var eo=function(t){return String(t||"").toLowerCase()};N.toLowerCase=eo;var to=function(t){return String(t||"").toUpperCase()};N.toUpperCase=to;var _h={toCamelCase:Bi.default,toSnakeCase:Li.default,toPascalCase:_i.default,toDotCase:qi.default,toPathCase:Zi.default,toTextCase:Yi.default,toSentenceCase:Fi.default,toHeaderCase:Vi.default,toKebabCase:Wi.default,toUpperCase:to,toLowerCase:eo,lowerKeys:Ki.default,upperKeys:Gi.default,camelKeys:Ji.default,snakeKeys:Hi.default,pascalKeys:Xi.default,kebabKeys:Qi.default};N.default=_h;var ro=N;const no={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},qh=t=>ro.snakeKeys(t,no),Zh=t=>ro.camelKeys(t,no),Yh=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var Fh=Object.defineProperty,Vh=(t,e,r)=>e in t?Fh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pn=(t,e,r)=>(Vh(t,typeof e!="symbol"?e+"":e,r),r);let Wh=class{constructor(){pn(this,"contentType","application/json"),pn(this,"decoder"),pn(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(t){return this.encoder.encode(this.encodeString(t)).buffer}decode(t,e){return this.decodeString(this.decoder.decode(t),e)}decodeString(t,e){const r=Zh(JSON.parse(t));return e!=null?e.parse(r):r}encodeString(t){return JSON.stringify(qh(t),(e,r)=>ArrayBuffer.isView(r)?Array.from(r):Yh(r)&&"encode_value"in r?typeof r.value=="bigint"?r.value.toString():r.value:typeof r=="bigint"?r.toString():r)}static registerCustomType(){}};new Wh;const Wr=a.z.tuple([a.z.number(),a.z.number()]);a.z.tuple([a.z.bigint(),a.z.bigint()]);const so=a.z.object({width:a.z.number(),height:a.z.number()}),Kh=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()}),Gh=["width","height"];a.z.enum(Gh);const Jh=["start","center","end"],Hh=["signedWidth","signedHeight"];a.z.enum(Hh);const Cr=a.z.object({x:a.z.number(),y:a.z.number()}),Xh=a.z.object({clientX:a.z.number(),clientY:a.z.number()}),Qh=["x","y"],ao=a.z.enum(Qh),io=["top","right","bottom","left"];a.z.enum(io);const ef=["left","right"],oo=a.z.enum(ef),tf=["top","bottom"],lo=a.z.enum(tf),uo=["center"],ha=a.z.enum(uo),rf=[...io,...uo],co=a.z.enum(rf);a.z.enum(Jh);const nf=["first","last"];a.z.enum(nf);const sf=a.z.object({lower:a.z.number(),upper:a.z.number()}),af=a.z.object({lower:a.z.bigint(),upper:a.z.bigint()});a.z.union([sf,Wr]);a.z.union([af,Wr]);a.z.union([ao,co]);a.z.union([ao,co,a.z.instanceof(String)]);const gn=(t,e)=>{const r={};if(typeof t=="number"||typeof t=="bigint")e!=null?(r.lower=t,r.upper=e):(r.lower=typeof t=="bigint"?0n:0,r.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[r.lower,r.upper]=t}else return fa(t);return fa(r)},fa=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t;a.z.object({x:oo.or(ha),y:lo.or(ha)});const of=a.z.object({x:oo,y:lo}),lf=Object.freeze({x:"left",y:"top"}),uf=(t,e)=>t.x===e.x&&t.y===e.y,da=a.z.union([a.z.number(),Cr,Wr,so,Kh,Xh]),cf=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},ya=Object.freeze({x:0,y:0}),er=a.z.union([a.z.number(),a.z.string()]);a.z.object({top:er,left:er,width:er,height:er});a.z.object({left:a.z.number(),top:a.z.number(),right:a.z.number(),bottom:a.z.number()});a.z.object({one:Cr,two:Cr,root:of});const Ms=(t,e,r=0,n=0,s)=>{const i={one:{...ya},two:{...ya},root:s??lf};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:t,y:e},i.two={x:i.one.x+r,y:i.one.y+n},i}return"one"in t&&"two"in t&&"root"in t?{...t,root:s??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(i.one={x:t.left,y:t.top},i.two={x:t.right,y:t.bottom},i):(i.one=t,e==null?i.two={x:i.one.x+r,y:i.one.y+n}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+r}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},mn=t=>{const e=Ms(t);return{lower:e.one.x,upper:e.two.x}},wn=t=>{const e=Ms(t);return{lower:e.one.y,upper:e.two.y}},hf=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t;var ff=Object.defineProperty,df=(t,e,r)=>e in t?ff(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ve=(t,e,r)=>(df(t,typeof e!="symbol"?e+"":e,r),r);const yf=(t,e,r)=>(e!=null&&(t=Math.max(t,e)),r!=null&&(t=Math.min(t,r)),t);a.z.object({offset:da,scale:da});const pf=t=>(e,r,n,s)=>r==="dimension"?[e,n]:[e,s?n-t:n+t],gf=t=>(e,r,n,s)=>[e,s?n/t:n*t],mf=t=>(e,r,n)=>{if(e===null)return[t,n];const{lower:s,upper:i}=e,{lower:o,upper:l}=t,c=i-s,f=l-o;if(r==="dimension")return[t,n*(f/c)];const w=(n-s)*(f/c)+o;return[t,w]},wf=t=>(e,r,n)=>[t,n],vf=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:n,upper:s}=t;return[t,s-(r-n)]},bf=t=>(e,r,n)=>{const{lower:s,upper:i}=t;return n=yf(n,s,i),[e,n]},_n=class At{constructor(){Ve(this,"ops",[]),Ve(this,"currBounds",null),Ve(this,"currType",null),Ve(this,"reversed",!1),this.ops=[]}static translate(e){return new At().translate(e)}static magnify(e){return new At().magnify(e)}static scale(e,r){return new At().scale(e,r)}translate(e){const r=this.new(),n=pf(e);return n.type="translate",r.ops.push(n),r}magnify(e){const r=this.new(),n=gf(e);return n.type="magnify",r.ops.push(n),r}scale(e,r){const n=gn(e,r),s=this.new(),i=mf(n);return i.type="scale",s.ops.push(i),s}clamp(e,r){const n=gn(e,r),s=this.new(),i=bf(n);return i.type="clamp",s.ops.push(i),s}reBound(e,r){const n=gn(e,r),s=this.new(),i=wf(n);return i.type="re-bound",s.ops.push(i),s}invert(){const e=vf();e.type="invert";const r=this.new();return r.ops.push(e),r}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new At;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([n,s],i)=>i(n,e,s,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||r.some(([o,l])=>s>=o&&s<=l))return;const i=e.ops.findIndex((o,l)=>o.type==="scale"&&l>s);i!==-1&&r.push([s,i])}),r.forEach(([n,s])=>{const i=e.ops.slice(n,s);i.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...i)}),e.reversed=!e.reversed,e}};Ve(_n,"IDENTITY",new _n);let pa=_n;const ga=class Ye{constructor(e=new pa,r=new pa,n=null){Ve(this,"x"),Ve(this,"y"),Ve(this,"currRoot"),this.x=e,this.y=r,this.currRoot=n}static translate(e,r){return new Ye().translate(e,r)}static translateX(e){return new Ye().translateX(e)}static translateY(e){return new Ye().translateY(e)}static clamp(e){return new Ye().clamp(e)}static magnify(e){return new Ye().magnify(e)}static scale(e){return new Ye().scale(e)}static reBound(e){return new Ye().reBound(e)}translate(e,r){const n=cf(e,r),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}translateX(e){const r=this.copy();return r.x=this.x.translate(e),r}translateY(e){const r=this.copy();return r.y=this.y.translate(e),r}magnify(e){const r=this.copy();return r.x=this.x.magnify(e.x),r.y=this.y.magnify(e.y),r}scale(e){const r=this.copy();if(hf(e)){const n=this.currRoot;return r.currRoot=e.root,n!=null&&!uf(n,e.root)&&(n.x!==e.root.x&&(r.x=r.x.invert()),n.y!==e.root.y&&(r.y=r.y.invert())),r.x=r.x.scale(mn(e)),r.y=r.y.scale(wn(e)),r}return r.x=r.x.scale(e.width),r.y=r.y.scale(e.height),r}reBound(e){const r=this.copy();return r.x=this.x.reBound(mn(e)),r.y=this.y.reBound(wn(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(mn(e)),r.y=this.y.clamp(wn(e)),r}copy(){const e=new Ye;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}box(e){return Ms(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};Ve(ga,"IDENTITY",new ga);a.z.record(a.z.union([a.z.number(),a.z.string(),a.z.symbol()]),a.z.unknown());const ho=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Of=ho(),fo=["MacOS","Windows","Linux","Docker"],Tf=a.z.enum(fo);let vn;const zf=()=>{if(typeof window>"u")return;const t=window.navigator.userAgent.toLowerCase();if(t.includes("mac"))return"MacOS";if(t.includes("win"))return"Windows";if(t.includes("linux"))return"Linux"},Sf=(t={})=>{const{force:e,default:r}=t;return e??vn??(vn=zf(),vn??r)},yo=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:fo,RUNTIME:Of,detect:ho,getOS:Sf,osZ:Tf},Symbol.toStringTag,{value:"Module"})),Af=a.z.object({signedWidth:a.z.number(),signedHeight:a.z.number()});a.z.union([so,Af,Cr,Wr]);var Nf=Object.defineProperty,If=(t,e,r)=>e in t?Nf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v=(t,e,r)=>(If(t,typeof e!="symbol"?e+"":e,r),r);const po=(t,e)=>{const r=new re(e);if(![ne.DAY,ne.HOUR,ne.MINUTE,ne.SECOND,ne.MILLISECOND,ne.MICROSECOND,ne.NANOSECOND].some(s=>s.equals(r)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=t.valueOf()%r.valueOf();return t instanceof re?new re(n):new ne(n)},q=class S{constructor(e,r="UTC"){if(v(this,"value"),v(this,"encodeValue",!0),e==null)this.value=S.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*S.MILLISECOND.valueOf();else if(typeof e=="string")this.value=S.parseDateTimeString(e,r).valueOf();else if(Array.isArray(e))this.value=S.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),r==="local"&&(n=S.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=S.MAX:e=S.MIN)),this.value=BigInt(e.valueOf())+n}}static parseDate([e=1970,r=1,n=1]){const s=new Date(e,r-1,n,0,0,0,0);return new S(BigInt(s.getTime())*S.MILLISECOND.valueOf()).truncate(S.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(e,r="UTC"){const[n,s,i]=e.split(":");let o="00",l="00";i!=null&&([o,l]=i.split("."));let c=S.hours(parseInt(n??"00",10)).add(S.minutes(parseInt(s??"00",10))).add(S.seconds(parseInt(o??"00",10))).add(S.milliseconds(parseInt(l??"00",10)));return r==="local"&&(c=c.add(S.utcOffset)),c.valueOf()}static parseDateTimeString(e,r="UTC"){if(!e.includes("/")&&!e.includes("-"))return S.parseTimeString(e,r);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new S(BigInt(n.getTime())*S.MILLISECOND.valueOf(),r).valueOf()}fString(e="ISO",r="UTC"){switch(e){case"ISODate":return this.toISOString(r).slice(0,10);case"ISOTime":return this.toISOString(r).slice(11,23);case"time":return this.timeString(!1,r);case"preciseTime":return this.timeString(!0,r);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,r)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,r)}`;default:return this.toISOString(r)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(S.utcOffset).date().toISOString()}timeString(e=!1,r="UTC"){const n=this.toISOString(r);return e?n.slice(11,23):n.slice(11,19)}dateString(){const e=this.date(),r=e.toLocaleString("default",{month:"short"}),n=e.toLocaleString("default",{day:"numeric"});return`${r} ${n}`}static get utcOffset(){return new ne(BigInt(new Date().getTimezoneOffset())*S.MINUTE.valueOf())}static since(e){return new S().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new S(e).valueOf()}span(e){return this.range(e).span}range(e){return new Ef(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new S(e).valueOf()}afterEq(e){return this.valueOf()>=new S(e).valueOf()}before(e){return this.valueOf()<new S(e).valueOf()}beforeEq(e){return this.valueOf()<=new S(e).valueOf()}add(e){return new S(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new S(this.valueOf()-BigInt(e.valueOf()))}milliseconds(){return Number(this.valueOf())/Number(S.MILLISECOND.valueOf())}toString(){return this.date().toISOString()}remainder(e){return po(this,e)}get isToday(){return this.truncate(ne.DAY).equals(S.now().truncate(ne.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new S(new Date)}static max(...e){let r=S.MIN;for(const n of e){const s=new S(n);s.after(r)&&(r=s)}return r}static min(...e){let r=S.MAX;for(const n of e){const s=new S(n);s.before(r)&&(r=s)}return r}static nanoseconds(e){return new S(e)}static microseconds(e){return S.nanoseconds(e*1e3)}static milliseconds(e){return S.microseconds(e*1e3)}static seconds(e){return S.milliseconds(e*1e3)}static minutes(e){return S.seconds(e*60)}static hours(e){return S.minutes(e*60)}static days(e){return S.hours(e*24)}};v(q,"NANOSECOND",q.nanoseconds(1)),v(q,"MICROSECOND",q.microseconds(1)),v(q,"MILLISECOND",q.milliseconds(1)),v(q,"SECOND",q.seconds(1)),v(q,"MINUTE",q.minutes(1)),v(q,"HOUR",q.hours(1)),v(q,"DAY",q.days(1)),v(q,"MAX",new q((1n<<63n)-1n)),v(q,"MIN",new q(0)),v(q,"ZERO",new q(0)),v(q,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(t=>new q(t.value)),a.z.string().transform(t=>new q(BigInt(t))),a.z.instanceof(Number).transform(t=>new q(t)),a.z.number().transform(t=>new q(t)),a.z.instanceof(q)]));let re=q;const Z=class R{constructor(e){v(this,"value"),v(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new R(e).valueOf()}greaterThan(e){return this.valueOf()>new R(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new R(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new R(e).valueOf()}remainder(e){return po(this,e)}truncate(e){return new R(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(R.DAY),r=this.truncate(R.HOUR),n=this.truncate(R.MINUTE),s=this.truncate(R.SECOND),i=this.truncate(R.MILLISECOND),o=this.truncate(R.MICROSECOND),l=this.truncate(R.NANOSECOND),c=e,f=r.sub(e),w=n.sub(r),h=s.sub(n),D=i.sub(s),F=o.sub(i),se=l.sub(o);let $="";return c.isZero||($+=`${c.days}d `),f.isZero||($+=`${f.hours}h `),w.isZero||($+=`${w.minutes}m `),h.isZero||($+=`${h.seconds}s `),D.isZero||($+=`${D.milliseconds}ms `),F.isZero||($+=`${F.microseconds}µs `),se.isZero||($+=`${se.nanoseconds}ns`),$.trim()}get days(){return Number(this.valueOf())/Number(R.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(R.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(R.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(R.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(R.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(R.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new R(e).valueOf()}add(e){return new R(this.valueOf()+new R(e).valueOf())}sub(e){return new R(this.valueOf()-new R(e).valueOf())}static nanoseconds(e=1){return new R(e)}static microseconds(e=1){return R.nanoseconds(e*1e3)}static milliseconds(e=1){return R.microseconds(e*1e3)}static seconds(e=1){return R.milliseconds(e*1e3)}static minutes(e){return R.seconds(e.valueOf()*60)}static hours(e){return R.minutes(e*60)}static days(e){return R.hours(e*24)}};v(Z,"NANOSECOND",Z.nanoseconds(1)),v(Z,"MICROSECOND",Z.microseconds(1)),v(Z,"MILLISECOND",Z.milliseconds(1)),v(Z,"SECOND",Z.seconds(1)),v(Z,"MINUTE",Z.minutes(1)),v(Z,"HOUR",Z.hours(1)),v(Z,"DAY",Z.days(1)),v(Z,"MAX",new Z((1n<<63n)-1n)),v(Z,"MIN",new Z(0)),v(Z,"ZERO",new Z(0)),v(Z,"z",a.z.union([a.z.object({value:a.z.bigint()}).transform(t=>new Z(t.value)),a.z.string().transform(t=>new Z(BigInt(t))),a.z.instanceof(Number).transform(t=>new Z(t)),a.z.number().transform(t=>new Z(t)),a.z.instanceof(Z)]));let ne=Z;const tr=class Tr extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Tr(e).valueOf()}get period(){return ne.seconds(1/this.valueOf())}sampleCount(e){return new ne(e).seconds*this.valueOf()}byteCount(e,r){return this.sampleCount(e)*new de(r).valueOf()}span(e){return ne.seconds(e/this.valueOf())}byteSpan(e,r){return this.span(e.valueOf()/r.valueOf())}static hz(e){return new Tr(e)}static khz(e){return Tr.hz(e*1e3)}};v(tr,"z",a.z.union([a.z.number().transform(t=>new tr(t)),a.z.instanceof(Number).transform(t=>new tr(t)),a.z.instanceof(tr)]));const te=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new kf(e*this.valueOf())}};v(te,"UNKNOWN",new te(0)),v(te,"BIT128",new te(16)),v(te,"BIT64",new te(8)),v(te,"BIT32",new te(4)),v(te,"BIT16",new te(2)),v(te,"BIT8",new te(1)),v(te,"z",a.z.union([a.z.number().transform(t=>new te(t)),a.z.instanceof(Number).transform(t=>new te(t)),a.z.instanceof(te)]));let de=te;const Ne=class zr{constructor(e,r){v(this,"start"),v(this,"end"),typeof e=="object"&&"start"in e?(this.start=new re(e.start),this.end=new re(e.end)):(this.start=new re(e),this.end=new re(r))}get span(){return new ne(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 zr(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,r=ne.ZERO){e=e.makeValid();const n=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(n.start)||n.end.equals(e.start))return!1;const s=re.max(n.start,e.start),i=re.min(n.end,e.end);return i.before(s)?!1:new ne(i.sub(s)).greaterThanOrEqual(r)}roughlyEquals(e,r){let n=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return n<0&&(n=-n),s<0&&(s=-s),n<=r.valueOf()&&s<=r.valueOf()}contains(e){return e instanceof zr?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const r=new zr(this.start,this.end);return e.start.after(this.start)&&(r.start=e.start),e.start.after(this.end)&&(r.end=e.start),e.end.before(this.end)&&(r.end=e.end),e.end.before(this.start)&&(r.start=e.end),r}};v(Ne,"MAX",new Ne(re.MIN,re.MAX)),v(Ne,"MIN",new Ne(re.MAX,re.MIN)),v(Ne,"ZERO",new Ne(re.ZERO,re.ZERO)),v(Ne,"z",a.z.union([a.z.object({start:re.z,end:re.z}).transform(t=>new Ne(t.start,t.end)),a.z.instanceof(Ne)]));let Ef=Ne;const p=class Ie extends String{constructor(e){if(e instanceof Ie||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const r=Ie.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(r!=null){super(r.valueOf());return}}throw super(Ie.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=Ie.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}toString(){return this.valueOf()}get isVariable(){return this.equals(Ie.JSON)||this.equals(Ie.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(Ie.UUID)}get isInteger(){return this.toString().startsWith("int")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=Ie.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}canSafelyCastTo(e){return this.equals(e)?!0:this.isVariable&&!e.isVariable||!this.isVariable&&e.isVariable?!1:this.isFloat&&e.isInteger||this.isInteger&&e.isFloat?this.density.valueOf()<e.density.valueOf():this.isFloat&&e.isFloat||this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf():!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return Ie.BIG_INT_TYPES.some(e=>e.equals(this))}};v(p,"UNKNOWN",new p("unknown")),v(p,"FLOAT64",new p("float64")),v(p,"FLOAT32",new p("float32")),v(p,"INT64",new p("int64")),v(p,"INT32",new p("int32")),v(p,"INT16",new p("int16")),v(p,"INT8",new p("int8")),v(p,"UINT64",new p("uint64")),v(p,"UINT32",new p("uint32")),v(p,"UINT16",new p("uint16")),v(p,"UINT8",new p("uint8")),v(p,"BOOLEAN",p.UINT8),v(p,"TIMESTAMP",new p("timestamp")),v(p,"UUID",new p("uuid")),v(p,"STRING",new p("string")),v(p,"JSON",new p("json")),v(p,"ARRAY_CONSTRUCTORS",new Map([[p.UINT8.toString(),Uint8Array],[p.UINT16.toString(),Uint16Array],[p.UINT32.toString(),Uint32Array],[p.UINT64.toString(),BigUint64Array],[p.FLOAT32.toString(),Float32Array],[p.FLOAT64.toString(),Float64Array],[p.INT8.toString(),Int8Array],[p.INT16.toString(),Int16Array],[p.INT32.toString(),Int32Array],[p.INT64.toString(),BigInt64Array],[p.TIMESTAMP.toString(),BigInt64Array],[p.STRING.toString(),Uint8Array],[p.JSON.toString(),Uint8Array],[p.UUID.toString(),Uint8Array]])),v(p,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,p.UINT8],[Uint16Array.name,p.UINT16],[Uint32Array.name,p.UINT32],[BigUint64Array.name,p.UINT64],[Float32Array.name,p.FLOAT32],[Float64Array.name,p.FLOAT64],[Int8Array.name,p.INT8],[Int16Array.name,p.INT16],[Int32Array.name,p.INT32],[BigInt64Array.name,p.INT64]])),v(p,"DENSITIES",new Map([[p.UINT8.toString(),de.BIT8],[p.UINT16.toString(),de.BIT16],[p.UINT32.toString(),de.BIT32],[p.UINT64.toString(),de.BIT64],[p.FLOAT32.toString(),de.BIT32],[p.FLOAT64.toString(),de.BIT64],[p.INT8.toString(),de.BIT8],[p.INT16.toString(),de.BIT16],[p.INT32.toString(),de.BIT32],[p.INT64.toString(),de.BIT64],[p.TIMESTAMP.toString(),de.BIT64],[p.STRING.toString(),de.UNKNOWN],[p.JSON.toString(),de.UNKNOWN],[p.UUID.toString(),de.BIT128]])),v(p,"ALL",[p.UNKNOWN,p.FLOAT64,p.FLOAT32,p.INT64,p.INT32,p.INT16,p.INT8,p.UINT64,p.UINT32,p.UINT16,p.UINT8,p.TIMESTAMP,p.UUID,p.STRING,p.JSON]),v(p,"BIG_INT_TYPES",[p.INT64,p.UINT64,p.TIMESTAMP]),v(p,"z",a.z.union([a.z.string().transform(t=>new p(t)),a.z.instanceof(p)]));const oe=class H extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return H.bytes(this.valueOf()+e.valueOf())}sub(e){return H.bytes(this.valueOf()-e.valueOf())}truncate(e){return new H(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return H.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/H.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/H.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/H.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/H.TERABYTE.valueOf()}toString(){const e=this.truncate(H.TERABYTE),r=this.truncate(H.GIGABYTE),n=this.truncate(H.MEGABYTE),s=this.truncate(H.KILOBYTE),i=this.truncate(H.BYTE),o=e,l=r.sub(e),c=n.sub(r),f=s.sub(n),w=i.sub(s);let h="";return o.isZero||(h+=`${o.terabytes}TB `),l.isZero||(h+=`${l.gigabytes}GB `),c.isZero||(h+=`${c.megabytes}MB `),f.isZero||(h+=`${f.kilobytes}KB `),(!w.isZero||h==="")&&(h+=`${w.valueOf()}B`),h.trim()}static bytes(e=1){return new H(e)}static kilobytes(e=1){return H.bytes(e.valueOf()*1e3)}static megabytes(e=1){return H.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return H.megabytes(e.valueOf()*1e3)}static terabytes(e){return H.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};v(oe,"BYTE",new oe(1)),v(oe,"KILOBYTE",oe.kilobytes(1)),v(oe,"MEGABYTE",oe.megabytes(1)),v(oe,"GIGABYTE",oe.gigabytes(1)),v(oe,"TERABYTE",oe.terabytes(1)),v(oe,"ZERO",new oe(0)),v(oe,"z",a.z.union([a.z.number().transform(t=>new oe(t)),a.z.instanceof(oe)]));let kf=oe;a.z.union([a.z.instanceof(Uint8Array),a.z.instanceof(Uint16Array),a.z.instanceof(Uint32Array),a.z.instanceof(BigUint64Array),a.z.instanceof(Float32Array),a.z.instanceof(Float64Array),a.z.instanceof(Int8Array),a.z.instanceof(Int16Array),a.z.instanceof(Int32Array),a.z.instanceof(BigInt64Array)]);var xf=Object.defineProperty,Cf=(t,e,r)=>e in t?xf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nt=(t,e,r)=>(Cf(t,typeof e!="symbol"?e+"":e,r),r);const jf=(...t)=>t.map(go).join(""),go=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),Rf=t=>t.endsWith("/")?t.slice(0,-1):t,$f=(t,e="")=>t===null?"":"?"+Object.entries(t).filter(([,r])=>r==null?!1:Array.isArray(r)?r.length>0:!0).map(([r,n])=>`${e}${r}=${n}`).join("&"),qn=class Zn{constructor({host:e,port:r,protocol:n="",pathPrefix:s=""}){Nt(this,"protocol"),Nt(this,"host"),Nt(this,"port"),Nt(this,"path"),this.protocol=n,this.host=e,this.port=r,this.path=go(s)}replace(e){return new Zn({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Zn({...this,pathPrefix:jf(this.path,e)})}toString(){return Rf(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};Nt(qn,"UNKNOWN",new qn({host:"unknown",port:0}));let Mf=qn;var Df=Object.defineProperty,Pf=(t,e,r)=>e in t?Df(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bn=(t,e,r)=>(Pf(t,typeof e!="symbol"?e+"":e,r),r);const ut=class extends Number{};bn(ut,"Absolute",255),bn(ut,"Default",1),bn(ut,"z",a.z.union([a.z.instanceof(ut),a.z.number().int().min(0).max(255).transform(t=>new ut(t)),a.z.instanceof(Number).transform(t=>new ut(t))]));a.z.object({name:a.z.string(),key:a.z.string()});const Uf=a.z.string().regex(/^\d+\.\d+\.\d+$/);a.z.object({version:Uf});class Kr extends Error{constructor(e,r){super(e),V(this,"discriminator","FreighterError"),V(this,"type"),this.type=r}}const Bf=t=>{if(t==null||typeof t!="object")return!1;const e=t;if(e.discriminator!=="FreighterError")return!1;if(!("type"in e))throw new Error(`Freighter error is missing its type property: ${JSON.stringify(e)}`);return!0},Yn="unknown",ma="nil",Gr="freighter",Ft=a.z.object({type:a.z.string(),data:a.z.string()});class Lf{constructor(){V(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:ma,data:""};if(Bf(e))for(const r of this.providers){const n=r.encode(e);if(n!=null)return n}return{type:Yn,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===ma)return null;if(e.type===Yn)return new wa(e.data);for(const r of this.providers){const n=r.decode(e);if(n!=null)return n}return new wa(e.data)}}const mo=new Lf,wo=({encode:t,decode:e})=>mo.register({encode:t,decode:e}),Ds=t=>mo.decode(t);class wa extends Kr{constructor(e){super(e,Yn)}}const Jr="freighter.";let We=class extends Kr{constructor(){super("EOF",Gr)}};V(We,"TYPE",Jr+"eof");let st=class extends Kr{constructor(){super("StreamClosed",Gr)}};V(st,"TYPE",Jr+"stream_closed");class Je extends Kr{constructor(e={}){const{message:r="Unreachable",url:n=Mf.UNKNOWN}=e;super(r,Gr),V(this,"url"),this.url=n}}V(Je,"TYPE",Jr+"unreachable");const _f=t=>{if(t.type!==Gr)return null;if(t instanceof We)return{type:We.TYPE,data:"EOF"};if(t instanceof st)return{type:st.TYPE,data:"StreamClosed"};if(t instanceof Je)return{type:Je.TYPE,data:"Unreachable"};throw new Error(`Unknown error type: ${t.type}: ${t.message}`)},qf=t=>{if(!t.type.startsWith(Jr))return null;switch(t.type){case We.TYPE:return new We;case st.TYPE:return new st;case Je.TYPE:return new Je;default:throw new Error(`Unknown error type: ${t.data}`)}};wo({encode:_f,decode:qf});class vo{constructor(){V(this,"middleware",[])}use(...e){this.middleware.push(...e)}async executeMiddleware(e,r){let n=0;const s=async i=>{if(n===this.middleware.length)return await r(i);const o=this.middleware[n];return n++,await o(i,s)};return await s(e)}}const bo="Content-Type",va=t=>{if(yo.RUNTIME!=="node")return fetch;const e=require("node-fetch");if(t==="http")return e;const r=require("https"),n=new r.Agent({rejectUnauthorized:!1});return async(s,i)=>await e(s,{...i,agent:n})};class Zf extends vo{constructor(e,r,n=!1){return super(),V(this,"endpoint"),V(this,"encoder"),V(this,"fetch"),this.endpoint=e.replace({protocol:n?"https":"http"}),this.encoder=r,this.fetch=va(this.endpoint.protocol),new Proxy(this,{get:(s,i,o)=>i==="endpoint"?this.endpoint:Reflect.get(s,i,o)})}get headers(){return{[bo]:this.encoder.contentType}}async send(e,r,n,s){r=n==null?void 0:n.parse(r);let i=null;const o=this.endpoint.child(e),l={};l.method="POST",l.body=this.encoder.encode(r??{});const[,c]=await this.executeMiddleware({target:o.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async f=>{const w={...f,params:{}};l.headers={...this.headers,...f.params};let h;try{h=await va(f.protocol)(f.target,l)}catch(F){let se=F;return se.message==="Load failed"&&(se=new Je({url:o})),[w,se]}const D=await h.arrayBuffer();if(h!=null&&h.ok)return s!=null&&(i=this.encoder.decode(D,s)),[w,null];try{if(h.status!==400)return[w,new Error(h.statusText)];const F=this.encoder.decode(D,Ft),se=Ds(F);return[w,se]}catch(F){return[w,new Error(`[freighter] - failed to decode error: ${h.statusText}: ${F.message}`)]}});return[i,c]}}const b=async(t,e,r,n,s)=>{const[i,o]=await t.send(e,r,n,s);if(o!=null)throw o;return i},Yf=()=>yo.RUNTIME!=="node"?t=>new WebSocket(t):t=>new(require("ws")).WebSocket(t,{rejectUnauthorized:!1}),Ff=a.z.object({type:a.z.union([a.z.literal("data"),a.z.literal("close")]),payload:a.z.unknown().optional(),error:a.z.optional(Ft)});class Vf{constructor(e,r,n,s){V(this,"encoder"),V(this,"reqSchema"),V(this,"resSchema"),V(this,"ws"),V(this,"serverClosed"),V(this,"sendClosed"),V(this,"receiveDataQueue",[]),V(this,"receiveCallbacksQueue",[]),this.encoder=r,this.reqSchema=n,this.resSchema=s,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}send(e){if(this.serverClosed!=null)return new We;if(this.sendClosed)throw new st;return this.ws.send(this.encoder.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");return this.serverClosed=Ds(e.error),[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.encoder.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){return this.receiveDataQueue.shift()??await new Promise((e,r)=>this.receiveCallbacksQueue.push({resolve:e,reject:r}))}addMessage(e){const r=this.receiveCallbacksQueue.shift();r!=null?r.resolve(e):this.receiveDataQueue.push(e)}listenForMessages(){this.ws.onmessage=e=>this.addMessage(this.encoder.decode(e.data,Ff)),this.ws.onclose=e=>this.addMessage({type:"close",error:{type:Hf(e)?We.TYPE:st.TYPE,data:""}})}}const Wf="freighterctx",Kf=1e3,Gf=1001,Jf=[Kf,Gf],Hf=t=>Jf.includes(t.code),Oo=class To extends vo{constructor(e,r,n=!1){super(),V(this,"baseUrl"),V(this,"encoder"),this.baseUrl=e.replace({protocol:n?"wss":"ws"}),this.encoder=r}async stream(e,r,n){const s=Yf();let i;const[,o]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async l=>{const c=s(this.buildURL(e,l)),f={...l,params:{}};c.binaryType=To.MESSAGE_TYPE;const w=await this.wrapSocket(c,r,n);return w instanceof Error?[f,w]:(i=w,[f,null])});if(o!=null)throw o;return i}buildURL(e,r){const n=$f({[bo]:this.encoder.contentType,...r.params},Wf);return this.baseUrl.child(e).toString()+n}async wrapSocket(e,r,n){return await new Promise(s=>{e.onopen=()=>{s(new Vf(e,this.encoder,r,n))},e.onerror=i=>{const o=i;s(new Error(o.message))}})}};V(Oo,"MESSAGE_TYPE","arraybuffer");let Xf=Oo;const ot="sy.";let W=class extends Error{};u(W,"TYPE",ot+"validation");class Fn extends W{constructor(e,r){super(e+": "+r),u(this,"field"),u(this,"message"),this.field=e,this.message=r}}u(Fn,"TYPE",W.TYPE+".field");class $t extends Error{}u($t,"TYPE",ot+"auth");class jr extends $t{}u(jr,"TYPE",$t.TYPE+".invalid-token");class pe extends Error{constructor(e){super(`
|
|
22
|
-
Unexpected error encountered:
|
|
23
|
-
|
|
24
|
-
${e}
|
|
25
|
-
|
|
26
|
-
Please report this to the Synnax team.
|
|
27
|
-
`)}}u(pe,"TYPE",ot+"unexpected");let ge=class extends Error{};u(ge,"TYPE",ot+"query");class Mt extends ge{}u(Mt,"TYPE",ge.TYPE+".not_found");class Dt extends ge{}u(Dt,"TYPE",ge.TYPE+".multiple_results");class Vn extends Error{constructor(e,r){super(e),u(this,"path"),this.path=r}}u(Vn,"TYPE",ot+"route");class Pt extends Error{}u(Pt,"TYPE",ot+"control");class Wn extends Pt{}u(Wn,"TYPE",Pt.TYPE+".unauthorized");const Qf=t=>{if(!t.type.startsWith(ot))return null;if(t.type.startsWith(W.TYPE)){if(t.type===Fn.TYPE){const e=t.data.split(": ");return e.length<2?new W(t.data):new Fn(e[0],e[1])}return new W(t.data)}return t.type.startsWith($t.TYPE)?t.type.startsWith(jr.TYPE)?new jr(t.data):new $t(t.data):t.type.startsWith(pe.TYPE)?new pe(t.data):t.type.startsWith(ge.TYPE)?t.type.startsWith(Mt.TYPE)?new Mt(t.data):t.type.startsWith(Dt.TYPE)?new Dt(t.data):new ge(t.data):t.type.startsWith(Pt.TYPE)?t.type.startsWith(Wn.TYPE)?new Wn(t.data):new Pt(t.data):t.type.startsWith(Vn.TYPE)?new Vn(t.data,t.data):new pe(t.data)},ed=()=>{throw new Error("Not implemented")};wo({encode:ed,decode:Qf});const td=async(t,e)=>{const[r,n]=await e(t);return n==null?[r,n]:n instanceof Je?[r,new Je({message:`Cannot reach cluster at ${n.url.host}:${n.url.port}`,url:n.url})]:[r,n]},zo=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var rd=Object.defineProperty,nd=(t,e,r)=>e in t?rd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,On=(t,e,r)=>(nd(t,typeof e!="symbol"?e+"":e,r),r);let So=class{constructor(){On(this,"contentType","application/json"),On(this,"decoder"),On(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(t){return this.encoder.encode(this.encodeString(t)).buffer}decode(t,e){return this.decodeString(this.decoder.decode(t),e)}decodeString(t,e){const r=kr(JSON.parse(t));return e!=null?e.parse(r):r}encodeString(t){return JSON.stringify(Ac(t),(e,r)=>ArrayBuffer.isView(r)?Array.from(r):zo(r)&&"encode_value"in r?typeof r.value=="bigint"?r.value.toString():r.value:typeof r=="bigint"?r.toString():r)}static registerCustomType(){}};const Ao=new So,sd=[Ao],ft=Object.freeze(Object.defineProperty({__proto__:null,ENCODERS:sd,JSONEncoderDecoder:So,JSON_ECD:Ao},Symbol.toStringTag,{value:"Module"}));var ad=Object.defineProperty,id=(t,e,r)=>e in t?ad(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kn=(t,e,r)=>(id(t,typeof e!="symbol"?e+"":e,r),r);class od{constructor(e,r){Kn(this,"handlers"),Kn(this,"transform"),this.transform=e,this.handlers=r??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let r=e;if(this.transform!=null){const[n,s]=this.transform(e);if(!s)return;r=n}this.handlers.forEach((n,s)=>s(r))}}let ld=class{constructor(t){Kn(this,"handlers"),this.handlers=t??new Map}onChange(t){return this.handlers.set(t,null),()=>this.handlers.delete(t)}notify(t){this.handlers.forEach((e,r)=>r(t))}};const Gn=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:ld,Observer:od},Symbol.toStringTag,{value:"Module"})),Ps=a.z.record(a.z.union([a.z.number(),a.z.string(),a.z.symbol()]),a.z.unknown()),ud=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";ud();const cd=["MacOS","Windows","Linux","Docker"];a.z.enum(cd);const ba=t=>[...new Set(t)];var hd=Object.defineProperty,fd=(t,e,r)=>e in t?hd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,It=(t,e,r)=>(fd(t,typeof e!="symbol"?e+"":e,r),r);const dd=(...t)=>t.map(No).join(""),No=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),yd=t=>t.endsWith("/")?t.slice(0,-1):t,Jn=class Hn{constructor({host:e,port:r,protocol:n="",pathPrefix:s=""}){It(this,"protocol"),It(this,"host"),It(this,"port"),It(this,"path"),this.protocol=n,this.host=e,this.port=r,this.path=No(s)}replace(e){return new Hn({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Hn({...this,pathPrefix:dd(this.path,e)})}toString(){return yd(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};It(Jn,"UNKNOWN",new Jn({host:"unknown",port:0}));let pd=Jn;var gd=Object.defineProperty,md=(t,e,r)=>e in t?gd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tn=(t,e,r)=>(md(t,typeof e!="symbol"?e+"":e,r),r);const rt=class extends Number{};Tn(rt,"Absolute",255),Tn(rt,"Default",1),Tn(rt,"z",a.z.union([a.z.instanceof(rt),a.z.number().int().min(0).max(255).transform(t=>new rt(t)),a.z.instanceof(Number).transform(t=>new rt(t))]));let Io=rt;const Eo=a.z.object({name:a.z.string(),key:a.z.string()}),wd=t=>a.z.object({subject:Eo,resource:t,authority:Io.z}),vd=(...t)=>e=>e.filter(r=>{let n=!1;return r.to!=null&&(n=t.includes(r.to.resource)),r.from!=null&&!n&&(n=t.includes(r.from.resource)),n}),ht=Object.freeze(Object.defineProperty({__proto__:null,Authority:Io,filterTransfersByChannelKey:vd,stateZ:wd,subjectZ:Eo},Symbol.toStringTag,{value:"Module"})),bd=a.z.string().regex(/^\d+\.\d+\.\d+$/);a.z.object({version:bd});const Hr=(t,e,{convertNumericStrings:r=!0}={})=>{const n=!Array.isArray(t);let s=I(t);const i=s[0],o=typeof i;let l;return o==="string"&&r&&!isNaN(parseInt(i))&&"number"in e?(l=e.number,s=s.map(c=>parseInt(c))):l=e[o],{single:n,variant:l,normalized:s,actual:t}},Xr=(t,e,r,n)=>{if(n){if(r.length===0)throw new Mt(`${t} not found matching ${JSON.stringify(e)}`);if(r.length>1)throw new Dt(`Expected one ${t} matching ${JSON.stringify(e)}, but found ${r.length}`)}},dt=t=>a.z.union([a.z.null().transform(()=>[]),t.array()]),Od=a.z.object({leaseholder:a.z.number().optional(),keys:a.z.number().array().optional(),names:a.z.string().array().optional(),search:a.z.string().optional(),rangeKey:a.z.string().optional(),limit:a.z.number().optional(),offset:a.z.number().optional(),dataTypes:x.z.array().optional(),notDataTypes:x.z.array().optional(),virtual:a.z.boolean().optional(),isIndex:a.z.boolean().optional(),internal:a.z.boolean().optional()}),Td=a.z.object({channels:dt(Yt)}),He=t=>Hr(t,{number:"keys",string:"names"}),ko=class xo{constructor(e){u(this,"client"),this.client=e}async search(e,r){return await this.execute({search:e,...r})}async retrieve(e,r){const n=He(e),{variant:s}=n;let{normalized:i}=n;return s==="keys"&&i.indexOf(0)!==-1&&(i=i.filter(o=>o!==0)),i.length===0?[]:await this.execute({[s]:i,...r})}async page(e,r,n){return await this.execute({offset:e,limit:r,...n})}async execute(e){const[r,n]=await this.client.send(xo.ENDPOINT,e,Od,Td);if(n!=null)throw n;return r.channels}};u(ko,"ENDPOINT","/channel/retrieve");let Us=ko;class Bs{constructor(e){u(this,"cache"),u(this,"namesToKeys"),u(this,"wrapped"),this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async search(e,r){return await this.wrapped.search(e,r)}async page(e,r,n){return await this.wrapped.page(e,r,n)}async retrieve(e,r){const{normalized:n}=Hr(e,{string:"names",number:"keys"}),s=[],i=[];if(n.forEach(l=>{const c=this.getFromCache(l);c!=null?s.push(c):i.push(l)}),i.length===0)return s;const o=await this.wrapped.retrieve(i,r);return this.updateCache(o),s.concat(o)}updateCache(e){e.forEach(r=>{this.cache.set(r.key,r),this.namesToKeys.set(r.name,r.key)})}getFromCache(e){const r=typeof e=="number"?e:this.namesToKeys.get(e);if(r!=null)return this.cache.get(r)}}class Co{constructor(e,r){u(this,"mu",new vh),u(this,"requests",new Map),u(this,"wrapped"),u(this,"debouncedRun"),this.wrapped=e,this.debouncedRun=dh(()=>{this.run()},r)}async search(e,r){return await this.wrapped.search(e,r)}async page(e,r,n){return await this.wrapped.page(e,r,n)}async retrieve(e){const{normalized:r,variant:n}=He(e);return n==="names"?await this.wrapped.retrieve(r):await new Promise((s,i)=>{this.mu.runExclusive(()=>{this.requests.set(r,{resolve:s,reject:i}),this.debouncedRun()})})}async run(){await this.mu.runExclusive(async()=>{const e=new Set;this.requests.forEach((r,n)=>n.forEach(s=>e.add(s)));try{const r=await this.wrapped.retrieve(Array.from(e));this.requests.forEach((n,s)=>n.resolve(r.filter(i=>s.includes(i.key))))}catch(r){this.requests.forEach(n=>n.reject(r))}finally{this.requests.clear()}})}}const jo=async(t,e)=>{const{normalized:r}=He(e),n=await t.retrieve(r),s=[];if(r.forEach(i=>{n.find(o=>o.name===i||o.key===i)==null&&s.push(i)}),s.length>0)throw new ge(`Could not find channels: ${JSON.stringify(s)}`);return n};class Ro{constructor({dataType:e,rate:r,name:n,leaseholder:s=0,key:i=0,isIndex:o=!1,index:l=0,internal:c=!1,frameClient:f,alias:w}){u(this,"_frameClient"),u(this,"key"),u(this,"name"),u(this,"rate"),u(this,"dataType"),u(this,"leaseholder"),u(this,"index"),u(this,"isIndex"),u(this,"internal"),u(this,"alias"),this.key=i,this.name=n,this.rate=new zs(r??0),this.dataType=new x(e),this.leaseholder=s,this.index=l,this.isIndex=o,this.internal=c,this.alias=w,this._frameClient=f??null}get framer(){if(this._frameClient==null)throw new W("cannot read from a channel that has not been created");return this._frameClient}get payload(){return Yt.parse({key:this.key,name:this.name,rate:this.rate.valueOf(),dataType:this.dataType.valueOf(),leaseholder:this.leaseholder,index:this.index,isIndex:this.isIndex,internal:this.internal})}async read(e){return await this.framer.read(e,this.key)}async write(e,r){return await this.framer.write(e,this.key,r)}}let $o=class{constructor(t,e,r,n){u(this,"type","channel"),u(this,"frameClient"),u(this,"client"),u(this,"retriever"),u(this,"writer"),this.frameClient=t,this.retriever=e,this.client=r,this.writer=n}async create(t,e={}){const{retrieveIfNameExists:r=!1}=e,n=!Array.isArray(t);let s=I(t),i=[];if(r){const o=await this.retriever.retrieve(s.map(c=>c.name)),l=new Set(o.map(c=>c.name));s=s.filter(c=>!l.has(c.name)),i=this.sugar(o)}return i=i.concat(this.sugar(await this.writer.create(s))),n?i[0]:i}async retrieve(t,e){const r=!Array.isArray(t),n=this.sugar(await this.retriever.retrieve(t,e));return Xr("channel",t,n,r),r?n[0]:n}async search(t,e){return this.sugar(await this.retriever.search(t,e))}async delete(t){const{normalized:e,variant:r}=He(t);return r==="keys"?await this.writer.delete({keys:e}):await this.writer.delete({names:e})}async rename(t,e){return await this.writer.rename(I(t),I(e))}newSearcherWithOptions(t){return{type:this.type,search:async e=>await this.search(e,t),retrieve:async e=>await this.retrieve(e,t),page:async(e,r)=>await this.page(e,r,t)}}async page(t,e,r){return this.sugar(await this.retriever.page(t,e,r))}createDebouncedBatchRetriever(t=10){return new Bs(new Co(new Us(this.client),t))}sugar(t){const{frameClient:e}=this;return t.map(r=>new Ro({...r,frameClient:e}))}};const zd=a.z.object({channels:Pi.array()}),Sd=a.z.object({channels:Yt.array()}),Ad=a.z.object({keys:Xe.array().optional(),names:a.z.string().array().optional()}),Nd=a.z.object({}),Id=a.z.object({keys:Xe.array(),names:a.z.string().array()}),Ed=a.z.object({}),kd="/channel/create",xd="/channel/delete",Cd="/channel/rename";let Mo=class{constructor(t){u(this,"client"),this.client=t}async create(t){return(await b(this.client,kd,{channels:t},zd,Sd)).channels}async delete(t){await b(this.client,xd,t,Ad,Nd)}async rename(t,e){await b(this.client,Cd,{keys:t,names:e},Id,Ed)}};const jd=Object.freeze(Object.defineProperty({__proto__:null,CacheRetriever:Bs,Channel:Ro,Client:$o,ClusterRetriever:Us,DebouncedBatchRetriever:Co,Writer:Mo,analyzeChannelParams:He,keyZ:Xe,newPayload:Pi,payload:Yt,retrieveRequired:jo},Symbol.toStringTag,{value:"Module"})),Rd=a.z.object({key:a.z.string(),username:a.z.string()}),$d=a.z.object({username:a.z.string(),password:a.z.string()}),Md=a.z.object({token:a.z.string(),user:Rd}),Oa="/auth/login",Dd=3;let Pd=class{constructor(t,e){u(this,"token"),u(this,"client"),u(this,"credentials"),u(this,"authenticating"),u(this,"authenticated"),u(this,"user"),u(this,"retryCount"),this.client=t,this.authenticated=!1,this.credentials=e,this.retryCount=0}middleware(){const t=async(e,r)=>{if(!this.authenticated&&!e.target.endsWith(Oa)){this.authenticating==null&&(this.authenticating=new Promise((o,l)=>{this.client.send(Oa,this.credentials,$d,Md).then(([c,f])=>{if(f!=null)return o(f);this.token=c==null?void 0:c.token,this.user=c==null?void 0:c.user,this.authenticated=!0,o(null)}).catch(l)}));const i=await this.authenticating;if(i!=null)return[e,i]}e.params.Authorization=`Bearer ${this.token}`;const[n,s]=await r(e);return s instanceof jr&&this.retryCount<Dd?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,t(e,r)):(this.retryCount=0,[n,s])};return t}};const Ud=["disconnected","connecting","connected","failed"],Bd=a.z.enum(Ud),Ld=a.z.object({status:Bd,error:a.z.instanceof(Error).optional(),message:a.z.string().optional(),clusterKey:a.z.string()}),_d=a.z.object({clusterKey:a.z.string()}),Do={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected"},Sr=class Po{constructor(e,r=k.seconds(30),n){u(this,"_state"),u(this,"pollFrequency",k.seconds(30)),u(this,"client"),u(this,"name"),u(this,"interval"),u(this,"onChangeHandlers",[]),this._state={...Do},this.client=e,this.pollFrequency=r,this.name=n,this.check(),this.startChecking()}stopChecking(){this.interval!=null&&clearInterval(this.interval)}async check(){var e;const r=this._state.status;try{const[n,s]=await this.client.send(Po.ENDPOINT,{},a.z.object({}),_d);if(s!=null)throw s;this._state.status="connected",this._state.message=`Connected to ${this.name??"cluster"}`,this._state.clusterKey=n.clusterKey}catch(n){this._state.status="failed",this._state.error=n,this._state.message=(e=this.state.error)==null?void 0:e.message}return this.onChangeHandlers.length>0&&r!==this._state.status&&this.onChangeHandlers.forEach(n=>n(this.state)),this.state}get state(){return{...this._state}}onChange(e){this.onChangeHandlers.push(e)}startChecking(){this.interval=setInterval(()=>{this.check()},this.pollFrequency.milliseconds)}};u(Sr,"ENDPOINT","/connectivity/check"),u(Sr,"DEFAULT",Do),u(Sr,"connectionStateZ",Ld);let Uo=Sr;const Ta=t=>{const e=I(t);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},za=(t,e)=>{const r=I(t);if(r.length===e.length)return;const n=Ta(t);throw Ta===null?new W("[Frame] - channel keys or names must be provided when constructing a frame."):new W(`[Frame] - ${n}s and arrays must be the same length.
|
|
28
|
-
Got ${r.length} ${n}s and ${e.length} arrays.`)};let we=class ct{constructor(e=[],r=[]){if(u(this,"columns",[]),u(this,"series",[]),e instanceof ct){this.columns=e.columns,this.series=e.series;return}if(e instanceof Map){e.forEach((n,s)=>this.push(s,...I(n)));return}if(typeof e=="object"&&!Array.isArray(e)){if("keys"in e&&"series"in e){const n=e,s=n.series.map(i=>Lo(i));za(n.keys,s),n.keys.forEach((i,o)=>this.push(i,s[o]))}else Object.entries(e).forEach(([n,s])=>{const i=parseInt(n);if(isNaN(i))this.push(n,...I(s));else return this.push(i,...I(s))});return}if(Array.isArray(e)||["string","number"].includes(typeof e)){const n=I(r),s=I(e);za(s,n),n.forEach((i,o)=>this.push(s[o],i));return}throw new W(`[Frame] - invalid frame construction parameters. data parameter ust be a frame
|
|
29
|
-
payload, a list of lazy arrays, a lazy array, a map, or a record keyed by channel
|
|
30
|
-
name. keys parameter must be a set of channel keys or channel names.`)}get colType(){return this.columns.length===0?null:typeof this.columns[0]=="string"?"name":"key"}get keys(){if(this.colType==="name")throw new pe("colType is not key");return this.columns??[]}get uniqueKeys(){return ba(this.keys)}get names(){if(this.colType==="key")throw new pe("colType is not name");return this.columns??[]}get uniqueNames(){return ba(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>_o(e)),keys:this.keys}}get isVertical(){return this.uniqueColumns.length===this.columns.length}get isHorizontal(){return this.uniqueColumns.length===1}get isSquare(){return this.isHorizontal&&this.isVertical}get isWeaklyAligned(){if(this.columns.length<=1)return!0;const e=this.timeRanges;return e.every(r=>r.equals(e[0]))}timeRange(e){if(e==null){if(this.columns.length===0)return ce.ZERO;const n=E.min(...this.series.map(i=>i.timeRange.start)),s=E.max(...this.series.map(i=>i.timeRange.end));return new ce(n,s)}const r=this.get(e);return r==null?ce.ZERO:r.timeRange}latest(){return this.at(-1)}get timeRanges(){return this.uniqueColumns.map(e=>this.timeRange(e))}get(e){return Array.isArray(e)?this.filter(r=>e.includes(r)):new hh(this.series.filter((r,n)=>this.columns[n]===e))}push(e,...r){if(e instanceof ct){if(this.colType!==null&&e.colType!==this.colType)throw new W("keyVariant must match");this.series.push(...e.series),this.columns.push(...e.columns)}else{if(this.series.push(...r),typeof e=="string"&&this.colType==="key")throw new W("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new W("keyVariant must match");this.columns.push(...Array.from({length:r.length},()=>e))}}concat(e){return new ct([...this.columns,...e.columns],[...this.series,...e.series])}has(e){return typeof e=="string"&&this.colType==="key"||typeof e=="number"&&this.colType==="name"?!1:this.columns.includes(e)}map(e){const r=new ct;return this.forEach((n,s,i)=>r.push(...e(n,s,i))),r}forEach(e){this.columns.forEach((r,n)=>{const s=this.series[n];e(r,s,n)})}at(e,r=!1){const n={};return this.uniqueColumns.forEach(s=>{n[s]=this.get(s).at(e,r)}),n}filter(e){const r=new ct;return this.columns.forEach((n,s)=>{const i=this.series[s];e(n,i,s)&&r.push(n,i)}),r}get byteLength(){return new Rt(this.series.reduce((e,r)=>e.add(r.byteLength),Rt.ZERO))}get length(){return this.series.reduce((e,r)=>e+r.length,0)}};const Bo=a.z.object({timeRange:ce.z.optional(),alignment:a.z.bigint().or(a.z.string().transform(t=>BigInt(t))).optional(),dataType:x.z,data:a.z.string().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer)}),Qr=a.z.object({keys:a.z.union([a.z.null().transform(()=>[]),a.z.number().array().optional().default([])]),series:a.z.union([a.z.null().transform(()=>[]),Bo.array().optional().default([])])}),Lo=t=>{const{dataType:e,data:r,timeRange:n,alignment:s}=t;return new ue({data:r,dataType:e,timeRange:n,glBufferUsage:"static",alignment:s})},_o=t=>({timeRange:t._timeRange,dataType:t.dataType,data:new Uint8Array(t.data.buffer),alignment:t.alignment});class en{constructor(e){u(this,"adapter"),u(this,"retriever"),u(this,"keys"),this.retriever=e,this.adapter=null,this.keys=[]}static async open(e,r){const n=new en(e);return await n.update(r),n}async update(e){const{variant:r,normalized:n}=He(e);if(r==="keys"){this.adapter=null,this.keys=n;return}const s=await this.retriever.retrieve(n),i=new Map;this.adapter=i,n.forEach(o=>{const l=s.find(c=>c.name===o);if(l==null)throw new Error(`Channel ${o} not found`);i.set(l.key,l.name)}),this.keys=Array.from(this.adapter.keys())}adapt(e){if(this.adapter==null)return e;const r=this.adapter;return e.map((n,s)=>{if(typeof n=="number"){const i=r.get(n);if(i==null)throw new Error(`Channel ${n} not found`);return[i,s]}return[n,s]})}}class Ls{constructor(e){u(this,"adapter"),u(this,"retriever"),u(this,"keys"),this.retriever=e,this.adapter=null,this.keys=[]}static async open(e,r){const n=new Ls(e);return await n.update(r),n}async update(e){const r=await jo(this.retriever,e);this.adapter=new Map(r.map(n=>[n.name,n.key])),this.keys=r.map(n=>n.key)}async fetchChannel(e){const r=await this.retriever.retrieve(e);if(r.length===0)throw new Error(`Channel ${e} not found`);return r[0]}async adapt(e,r){if(typeof e=="string"||typeof e=="number"){if(r==null)throw new W(`
|
|
31
|
-
Received a single channel name or key but no series.
|
|
32
|
-
`);if(Array.isArray(r)){if(r.some(c=>c instanceof ue||Array.isArray(c)))throw new W(`
|
|
33
|
-
Received a single channel name or key but multiple series.
|
|
34
|
-
`);r=r}const o=await this.fetchChannel(e),l=new ue({data:r,dataType:o.dataType});return new we(o.key,l)}if(Array.isArray(e)){if(r==null)throw new W(`
|
|
35
|
-
Received an array of channel names or keys but no series.
|
|
36
|
-
`);if(!Array.isArray(r))throw new W(`
|
|
37
|
-
Received an array of channel names or keys but no array of series.
|
|
38
|
-
`);const o=[],l=[];for(let c=0;c<e.length;c++){const f=await this.fetchChannel(e[c]);if(c>=r.length)throw new W(`
|
|
39
|
-
Received an array of channel names or keys but not enough series.
|
|
40
|
-
`);const w=new ue({data:r[c],dataType:f.dataType});o.push(f.key),l.push(w)}return new we(o,l)}if(e instanceof we||e instanceof Map){const o=new we(e);if(this.adapter==null)return o;let l=[];return l=o.columns.map(c=>{var f;const w=typeof c=="string"?(f=this.adapter)==null?void 0:f.get(c):c;if(w==null)throw new W(`
|
|
41
|
-
Channel ${c} was not provided in the list of channels when opening the writer
|
|
42
|
-
`);return w}),new we(l,o.series)}const n=[],s=[],i=Object.entries(e);for(let o=0;o<i.length;o++){const[l,c]=i[o],f=await this.fetchChannel(l),w=new ue({data:c,dataType:f.dataType});n.push(f.key),s.push(w)}return new we(n,s)}}class _s{constructor(e,r){u(this,"name"),u(this,"stream"),this.stream=r,this.name=e}async receive(){const[e,r]=await this.stream.receive();if(r!=null)throw r;return e}received(){return this.stream.received()}async closeAndAck(){for(this.stream.closeSend();;){const[e,r]=await this.stream.receive();if(e!=null&&console.warn(`${this.name} received unexpected response on closure.
|
|
43
|
-
Please report this error to the Synnax team. ${JSON.stringify(e)}`),r!=null){if(r instanceof We)return;throw r}}}closeSend(){this.stream.closeSend()}send(e){const r=this.stream.send(e);if(r!=null)throw r}}const Xn=new k(-1);var qs=(t=>(t[t.Open=0]="Open",t[t.Next=1]="Next",t[t.Prev=2]="Prev",t[t.SeekFirst=3]="SeekFirst",t[t.SeekLast=4]="SeekLast",t[t.SeekLE=5]="SeekLE",t[t.SeekGE=6]="SeekGE",t[t.Valid=7]="Valid",t[t.Error=8]="Error",t))(qs||{}),qo=(t=>(t[t.None=0]="None",t[t.Ack=1]="Ack",t[t.Data=2]="Data",t))(qo||{});const qd=a.z.object({command:a.z.nativeEnum(qs),span:k.z.optional(),bounds:ce.z.optional(),stamp:E.z.optional(),keys:a.z.number().array().optional()}),Zd=a.z.object({variant:a.z.nativeEnum(qo),ack:a.z.boolean(),command:a.z.nativeEnum(qs),error:Ft.optional().nullable(),frame:Qr.optional()}),Zo=class Qn{constructor(e,r){u(this,"stream"),u(this,"adapter"),u(this,"value"),this.stream=new _s("Iterator",e),this.value=new we,this.adapter=r}static async _open(e,r,n,s){const i=await en.open(n,r),o=await s.stream(Qn.ENDPOINT,qd,Zd),l=new Qn(o,i);return await l.execute({command:0,keys:i.keys,bounds:new ce(e)}),l}async next(e=Xn){return await this.execute({command:1,span:new k(e)})}async prev(e=Xn){return await this.execute({command:2,span:new k(e)})}async seekFirst(){return await this.execute({command:3})}async seekLast(){return await this.execute({command:4})}async seekLE(e){return await this.execute({command:5,stamp:new E(e)})}async seekGE(e){return await this.execute({command:6,stamp:new E(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new Yd(this)}async execute(e){for(this.stream.send(e),this.value=new we;;){const r=await this.stream.receive();if(r.variant===1)return r.ack;this.value.push(this.adapter.adapt(new we(r.frame)))}}};u(Zo,"ENDPOINT","/frame/iterate");let Yo=Zo;class Yd{constructor(e){u(this,"iter"),u(this,"open",!1),this.iter=e}async next(){try{let e=!0;return this.open||(await this.iter.seekFirst()||(e=!1),this.open=!0),await this.iter.next()||(e=!1),e||await this.iter.close(),{done:!e,value:this.iter.value}}catch(e){throw await this.iter.close(),e}}}const Fd=a.z.object({start:E.z.optional(),keys:a.z.number().array()}),Vd=a.z.object({frame:Qr,error:Ft.optional().nullable()}),Wd="/frame/stream";class tn{constructor(e,r){u(this,"stream"),u(this,"adapter"),this.stream=new _s("Streamer",e),this.adapter=r}get keys(){return this.adapter.keys}static async _open(e,r,{channels:n,from:s}){const i=await en.open(e,n),o=await r.stream(Wd,Fd,Vd),l=new tn(o,i);return o.send({start:new E(s),keys:i.keys}),l}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(e instanceof We)return{done:!0,value:void 0};throw e}}async read(){return this.adapter.adapt(new we((await this.stream.receive()).frame))}async update(e){await this.adapter.update(e),this.stream.send({keys:this.adapter.keys})}close(){this.stream.closeSend()}[Symbol.asyncIterator](){return this}}class rn extends Gn.Observer{constructor(e,r){super(r),u(this,"streamer"),u(this,"closePromise"),this.streamer=e,this.closePromise=this.stream()}async close(){this.streamer.close(),await this.closePromise}async stream(){for await(const e of this.streamer)this.notify(e)}}var Zs=(t=>(t[t.Open=0]="Open",t[t.Write=1]="Write",t[t.Commit=2]="Commit",t[t.Error=3]="Error",t[t.SetAuthority=4]="SetAuthority",t))(Zs||{}),Ut=(t=>(t[t.PersistStream=1]="PersistStream",t[t.PersistOnly=2]="PersistOnly",t[t.StreamOnly=3]="StreamOnly",t))(Ut||{});const Kd=new k(-1),Gd=a.z.object({start:E.z.optional(),controlSubject:ht.subjectZ.optional(),keys:a.z.number().array().optional(),authorities:ht.Authority.z.array().optional(),mode:a.z.nativeEnum(Ut).optional(),errOnUnauthorized:a.z.boolean().optional(),enableAutoCommit:a.z.boolean().optional(),autoIndexPersistInterval:k.z.optional()}),Jd=a.z.object({command:a.z.nativeEnum(Zs),config:Gd.optional(),frame:Qr.optional()}),Hd=a.z.object({ack:a.z.boolean(),command:a.z.nativeEnum(Zs),error:Ft.optional().nullable()});var mt;let Fo=(mt=class{constructor(t,e){u(this,"stream"),u(this,"adapter"),this.stream=new _s("Writer",t),this.adapter=e}static async _open(t,e,{channels:r,start:n=E.now(),authorities:s=ht.Authority.Absolute,controlSubject:i,mode:o=1,errOnUnauthorized:l=!1,enableAutoCommit:c=!1,autoIndexPersistInterval:f=k.SECOND}){const w=await Ls.open(t,r),h=await e.stream(mt.ENDPOINT,Jd,Hd),D=new mt(h,w);return await D.execute({command:0,config:{start:new E(n),keys:w.keys,controlSubject:i,authorities:I(s),mode:o,errOnUnauthorized:l,enableAutoCommit:c,autoIndexPersistInterval:f}}),D}async write(t,e){const r=await this.adapter.adapt(t,e);return this.stream.send({command:1,frame:r.toPayload()}),!0}async setAuthority(t){return(await this.execute({command:4,config:{keys:Object.keys(t).map(e=>Number(e)),authorities:Object.values(t)}})).ack}async commit(){return this.errorAccumulated?!1:(await this.execute({command:2})).ack}async error(){this.stream.send({command:3});const t=await this.execute({command:3});return t.error!=null?Ds(t.error):null}async close(){await this.stream.closeAndAck()}async execute(t){for(this.stream.send(t);;){const e=await this.stream.receive();if(e.command===t.command)return e;console.warn("writer received unexpected response",e)}}get errorAccumulated(){return this.stream.received()}},u(mt,"ENDPOINT","/frame/write"),mt);const Xd=a.z.object({keys:Xe.array().optional(),names:a.z.string().array().optional(),bounds:ce.z}),Qd=a.z.object({}),ey="/frame/delete";class ty{constructor(e){u(this,"client"),this.client=e}async delete(e){await b(this.client,ey,e,Xd,Qd)}}let Vo=class{constructor(t,e,r){u(this,"streamClient"),u(this,"retriever"),u(this,"deleter"),this.streamClient=t,this.retriever=r,this.deleter=new ty(e)}async openIterator(t,e){return await Yo._open(t,e,this.retriever,this.streamClient)}async openWriter(t){return(Array.isArray(t)||typeof t!="object")&&(t={channels:t}),await Fo._open(this.retriever,this.streamClient,t)}async openStreamer(t){return(Array.isArray(t)||typeof t!="object")&&(t={channels:t}),await tn._open(this.retriever,this.streamClient,t)}async write(t,e,r){if(r==null){const s=e,i=await this.openWriter({start:t,channels:Object.keys(s),mode:Ut.PersistOnly});try{await i.write(s),await i.commit()}finally{await i.close()}return}const n=await this.openWriter({start:t,channels:e,mode:Ut.PersistOnly,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:k.MAX});try{await n.write(e,r)}finally{await n.close()}}async read(t,e){const{single:r}=He(e),n=await this.readFrame(t,e);return r?n.get(e):n}async readFrame(t,e){const r=await this.openIterator(t,e),n=new we;try{for await(const s of r)n.push(s)}finally{await r.close()}return n}async delete(t,e){const{normalized:r,variant:n}=He(t);return n==="keys"?await this.deleter.delete({keys:r,bounds:e}):await this.deleter.delete({names:r,bounds:e})}};const ry=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:Kd,AUTO_SPAN:Xn,Client:Vo,Frame:we,Iterator:Yo,ObservableStreamer:rn,Streamer:tn,Writer:Fo,WriterMode:Ut,frameZ:Qr,series:Bo,seriesFromPayload:Lo,seriesToPayload:_o},Symbol.toStringTag,{value:"Module"})),ny=ht.Authority,sy=ht.stateZ(a.z.number()),ay=t=>{var e,r;return t.to==null?`${(e=t.from)==null?void 0:e.resource} - ${(r=t.from)==null?void 0:r.subject.name} -> released`:t.from==null?`${t.to.resource} - released -> ${t.to.subject.name} (${t.to.authority.toString()})`:`${t.to.resource} - ${t.from.subject.name} -> ${t.to.subject.name} (${t.to.authority.toString()})`};class Wo extends rn{constructor(e){super(e,r=>{const n=this.ecd.decode(r.series[0].buffer);return this.merge(n),[n.transfers,!0]}),u(this,"states"),u(this,"ecd"),this.states=new Map,this.ecd=new ft.JSONEncoderDecoder}subjects(){const e=new Map;return this.states.forEach(r=>e.set(r.subject.key,r.subject)),Array.from(e.values())}merge(e){e.transfers.forEach(r=>{r.from==null&&r.to==null&&console.warn("Invalid transfer: ",r),r.to==null?this.states.delete(r.from.resource):this.states.set(r.to.resource,r.to)})}}const iy="sy_node_1_control";let Ko=class{constructor(t){u(this,"framer"),this.framer=t}async openStateTracker(){const t=await this.framer.openStreamer(iy);return new Wo(t)}};const oy=Object.freeze(Object.defineProperty({__proto__:null,Authority:ny,Client:Ko,StateTracker:Wo,stateZ:sy,transferString:ay},Symbol.toStringTag,{value:"Module"}));let ly=class{constructor(t,e,r){u(this,"tasks"),u(this,"racks"),u(this,"devices"),this.tasks=t,this.racks=e,this.devices=r}};const Vt=a.z.number(),Ys=a.z.object({key:Vt,name:a.z.string()}),uy=Ys.partial({key:!0}),zn="/hardware/rack/retrieve",cy="/hardware/rack/create",hy="/hardware/rack/delete",Sn=a.z.object({keys:Vt.array().optional(),names:a.z.string().array().optional(),search:a.z.string().optional(),offset:a.z.number().optional(),limit:a.z.number().optional()}),An=a.z.object({racks:dt(Ys)}),fy=a.z.object({racks:uy.array()}),dy=a.z.object({racks:Ys.array()}),yy=a.z.object({keys:Vt.array()}),py=a.z.object({});let gy=class{constructor(t,e,r){u(this,"type","rack"),u(this,"client"),u(this,"frameClient"),u(this,"tasks"),this.client=t,this.frameClient=e,this.tasks=r}async delete(t){await b(this.client,hy,{keys:I(t)},yy,py)}async create(t){const e=!Array.isArray(t),r=await b(this.client,cy,{racks:I(t)},fy,dy),n=this.sugar(r.racks);return e?n[0]:n}async search(t){const e=await b(this.client,zn,{search:t},Sn,An);return this.sugar(e.racks)}async page(t,e){const r=await b(this.client,zn,{offset:t,limit:e},Sn,An);return this.sugar(r.racks)}async retrieve(t){const{variant:e,normalized:r,single:n}=Hr(t,{string:"names",number:"keys"}),s=await b(this.client,zn,{[e]:r},Sn,An),i=this.sugar(s.racks);return Xr("Rack",t,i,n),n?i[0]:i}sugar(t){return t.map(({key:e,name:r})=>new my(e,r,this.tasks))}};class my{constructor(e,r,n){u(this,"key"),u(this,"name"),u(this,"tasks"),this.key=e,this.name=r,this.tasks=n}async listTasks(){return await this.tasks.retrieve(this.key)}async retrieveTaskByName(e){return await this.tasks.retrieveByName(e,this.key)}async createTask(e){return e.key=((BigInt(this.key)<<32n)+(BigInt(e.key??0)&0xffffffffn)).toString(),await this.tasks.create(e)}async deleteTask(e){await this.tasks.delete([e])}}const nn=async(t,e,r,n)=>{const s=await t.openStreamer([e,r]),i=o=>{const l=[];return r!=null&&l.push(...o.get(r).series.flatMap(c=>n("delete",c))),e!=null&&l.push(...o.get(e).series.flatMap(c=>n("set",c))),[l,l.length>0]};return new rn(s,i)},wy="sy_device_set",vy="sy_device_delete",Nn="/hardware/device/retrieve",by="/hardware/device/create",Oy="/hardware/device/delete",Fs=a.z.string(),sn=a.z.object({key:Fs,rack:Vt,name:a.z.string(),make:a.z.string(),model:a.z.string(),location:a.z.string(),configured:a.z.boolean().optional(),properties:a.z.record(a.z.unknown()).or(a.z.string().transform(t=>t===""?{}:ft.JSON_ECD.decodeString(t)))}),Ty=sn.extend({properties:a.z.unknown().transform(t=>ft.JSON_ECD.encodeString(t))}),zy=a.z.object({devices:Ty.array()}),Sy=a.z.object({devices:sn.array()}),Ay=a.z.object({keys:Fs.array()}),Ny=a.z.object({}),In=a.z.object({search:a.z.string().optional(),limit:a.z.number().optional(),offset:a.z.number().optional(),keys:Fs.array().optional(),names:a.z.string().array().optional(),makes:a.z.string().array().optional()}),En=a.z.object({devices:dt(sn)});let Iy=class{constructor(t,e){u(this,"type","device"),u(this,"client"),u(this,"frameClient"),this.client=t,this.frameClient=e}async retrieve(t,e){const r=!Array.isArray(t),n=await b(this.client,Nn,{keys:I(t),...e},In,En);return Xr("Device",t,n.devices,r),r?n.devices[0]:n.devices}async search(t,e){return(await b(this.client,Nn,{search:t,...e},In,En)).devices}async page(t,e,r){return(await b(this.client,Nn,{offset:t,limit:e,...r},In,En)).devices}async create(t){const e=!Array.isArray(t),r=await b(this.client,by,{devices:I(t)},zy,Sy);return e?r.devices[0]:r.devices}async delete(t){await b(this.client,Oy,{keys:I(t)},Ay,Ny)}async openDeviceTracker(){return await nn(this.frameClient,wy,vy,Ey)}newSearcherWithOptions(t){return{type:this.type,search:async e=>await this.search(e,t),retrieve:async e=>await this.retrieve(e,t),page:async(e,r)=>await this.page(e,r,t)}}};const Ey=(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):e.parseJSON(sn).map(r=>({variant:t,key:r.key,value:r}));if(process.env.NODE_ENV!=="production"){if(typeof navigator<"u"&&navigator.product==="ReactNative"&&!self.crypto)throw new Error("React Native does not have a built-in secure random generator. If you don’t need unpredictable IDs, you can use `nanoid/non-secure`. For secure IDs, import `react-native-get-random-values` before Nano ID.");if(typeof self<"u"&&self.msCrypto&&!self.crypto)throw new Error("Add self.crypto = self.msCrypto before Nano ID to fix IE 11 support");if(typeof self>"u"||!self.crypto)throw new Error("Your browser does not have secure random generator. If you don’t need unpredictable IDs, you can use nanoid/non-secure.")}let ky=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;){let n=r[t]&63;n<36?e+=n.toString(36):n<62?e+=(n-26).toString(36).toUpperCase():n<63?e+="_":e+="-"}return e};const kn="sy_task_state",Sa="sy_task_cmd",Wt=a.z.union([a.z.string(),a.z.bigint().transform(t=>t.toString()),a.z.number().transform(t=>t.toString())]),es=a.z.object({task:Wt,variant:a.z.string(),key:a.z.string().optional(),details:a.z.record(a.z.unknown()).or(a.z.string().transform(t=>t===""?{}:JSON.parse(t))).or(a.z.array(a.z.unknown())).or(a.z.null())}),Vs=a.z.object({key:Wt,name:a.z.string(),type:a.z.string(),config:a.z.record(a.z.unknown()).or(a.z.string().transform(t=>t===""?{}:ft.JSON_ECD.decodeString(t))),state:es.optional().nullable()}),xy=Vs.omit({key:!0}).extend({key:Wt.transform(t=>t.toString()).optional(),config:a.z.unknown().transform(t=>ft.JSON_ECD.encodeString(t))});a.z.object({task:Wt,type:a.z.string(),key:a.z.string(),args:a.z.record(a.z.unknown()).or(a.z.string().transform(t=>t===""?{}:JSON.parse(t)))});class Cy{constructor(e,r,n,s,i,o){u(this,"key"),u(this,"name"),u(this,"type"),u(this,"config"),u(this,"state"),u(this,"frameClient"),this.key=e,this.name=r,this.type=n,this.config=s,o!==null&&(this.state=o),this.frameClient=i}get payload(){return{key:this.key,name:this.name,type:this.type,config:this.config,state:this.state}}async executeCommand(e,r){const n=await this.frameClient.openWriter(Sa),s=ky();return await n.write(Sa,[{task:this.key,type:e,key:s,args:r}]),await n.close(),s}async executeCommandSync(e,r,n){const s=await this.frameClient.openStreamer(kn),i=await this.executeCommand(e,r);let o;const l=new Promise(c=>setTimeout(()=>c(!1),new k(n).milliseconds));for(;;){const c=await Promise.any([s.read(),l]);if(c===!1)throw new Error("Command timed out");const f=es.safeParse(c.at(-1).sy_task_state);if(f.success){if(o=f.data,o.key===i)break}else console.error(f.error)}return s.close(),o}async openStateObserver(){return new rn(await this.frameClient.openStreamer(kn),e=>{const r=e.get(kn);if(r.length===0)return[null,!1];const n=es.safeParse(r.at(-1));if(!n.success)return[null,!1];const s=n.data;return s.task!==this.key?[null,!1]:[s,!0]})}}const jy=a.z.object({rack:Vt.optional(),keys:a.z.string().array().optional(),names:a.z.string().array().optional(),offset:a.z.number().optional(),limit:a.z.number().optional(),includeState:a.z.boolean().optional()}),Ry=a.z.object({tasks:dt(Vs)}),$y="/hardware/task/retrieve",My="/hardware/task/create",Dy="/hardware/task/delete",Py=a.z.object({tasks:xy.array()}),Uy=a.z.object({tasks:Vs.array()}),By=a.z.object({keys:Wt.array()}),Ly=a.z.object({});let _y=class{constructor(t,e){u(this,"type","task"),u(this,"client"),u(this,"frameClient"),this.client=t,this.frameClient=e}async create(t){const e=!Array.isArray(t),r=await b(this.client,My,{tasks:I(t)},Py,Uy),n=this.sugar(r.tasks);return e?n[0]:n}async delete(t){await b(this.client,Dy,{keys:I(t)},By,Ly)}async search(t){return await this.execRetrieve({keys:[t]})}async page(t,e){return this.execRetrieve({offset:t,limit:e})}async retrieve(t,e){const{single:r,normalized:n,variant:s}=Hr(t,{number:"rack",string:"keys"},{convertNumericStrings:!1}),i={...e};s==="rack"?i.rack=t:i.keys=n;const o=await this.execRetrieve(i),l=this.sugar(o);return r&&s!=="rack"?l[0]:l}async retrieveByName(t,e){const r=await this.execRetrieve({names:[t],rack:e});return Xr("Task",t,r,!0),this.sugar(r)[0]}async execRetrieve(t){return(await b(this.client,$y,t,jy,Ry)).tasks}sugar(t){return t.map(({key:e,name:r,type:n,config:s,state:i})=>new Cy(e,r,n,s,this.frameClient,i))}};class qy{constructor(e,r){u(this,"key"),u(this,"name"),this.key=r,this.name=e}get ontologyID(){return new Oe({type:"group",key:this.key})}}const Zy=a.z.string().uuid(),Yy=a.z.object({key:Zy,name:a.z.string()}),Go=a.z.union([a.z.literal("label"),a.z.literal("builtin"),a.z.literal("cluster"),a.z.literal("channel"),a.z.literal("node"),a.z.literal("group"),a.z.literal("range"),a.z.literal("range-alias"),a.z.literal("user"),a.z.literal("workspace"),a.z.literal("schematic"),a.z.literal("lineplot"),a.z.literal("rack"),a.z.literal("device"),a.z.literal("task")]),ke=a.z.object({type:Go,key:a.z.string()}),Fy=a.z.string().transform(t=>{const[e,r]=t.split(":");return{type:e,key:r}}),Vy=a.z.union([Fy,ke]),Ar=class Jo{constructor(e){if(u(this,"type"),u(this,"key"),e instanceof Jo)this.type=e.type,this.key=e.key;else if(typeof e=="string"){const[r,n]=e.split(":");this.type=r,this.key=n}else this.type=e.type,this.key=e.key}toString(){return`${this.type}:${this.key}`}get payload(){return{type:this.type,key:this.key}}};u(Ar,"z",a.z.union([Vy,a.z.instanceof(Ar)]).transform(t=>new Ar(t)));let Oe=Ar;new Oe({type:"builtin",key:"root"});const Wy=a.z.object({type:a.z.number()}),Ky=a.z.object({type:Go,fields:a.z.record(Wy)}),Gy=a.z.object({id:Oe.z,name:a.z.string(),schema:Ky.optional().nullable(),data:a.z.record(a.z.unknown()).optional().nullable()}).transform(t=>({key:t.id.toString(),...t}));a.z.object({from:Oe.z,type:a.z.string(),to:Oe.z});const Aa=t=>{const[e,r,n]=t.split("->");return{from:new Oe(e),type:r,to:new Oe(n)}},Jy=a.z.object({group:Yy}),Hy=a.z.object({parent:ke,key:a.z.string().uuid().optional(),name:a.z.string()}),Xy=a.z.object({key:a.z.string(),name:a.z.string()}),Qy=a.z.object({keys:a.z.array(a.z.string())});var Ke;let ep=(Ke=class{constructor(t){u(this,"client"),this.client=t}async create(t,e,r){const[n,s]=await this.client.send(Ke.ENDPOINT,{parent:t,name:e,key:r},Hy,Jy);if(s!=null)throw s;return n.group}async rename(t,e){const r={key:t,name:e},[,n]=await this.client.send(Ke.ENDPOINT_RENAME,r,Xy,a.z.object({}));if(n!=null)throw n}async delete(t){const e={keys:t},[,r]=await this.client.send(Ke.ENDPOINT_DELETE,e,Qy,a.z.object({}));if(r!=null)throw r}},u(Ke,"ENDPOINT","/ontology/create-group"),u(Ke,"ENDPOINT_RENAME","/ontology/rename-group"),u(Ke,"ENDPOINT_DELETE","/ontology/delete-group"),Ke),tp=class{constructor(t){u(this,"creator"),this.creator=new ep(t)}async create(t,e,r){return this.sugar(await this.creator.create(t,e,r))}async rename(t,e){return await this.creator.rename(t,e)}async delete(...t){return await this.creator.delete(t)}sugar(t){return new qy(t.name,t.key)}};const xn={ADD_CHILDREN:"/ontology/add-children",REMOVE_CHILDREN:"/ontology/remove-children",MOVE_CHILDREN:"/ontology/move-children"},Na=a.z.object({id:ke,children:ke.array()}),rp=a.z.object({from:ke,to:ke,children:ke.array()});let np=class{constructor(t){u(this,"client"),this.client=t}async addChildren(t,...e){await b(this.client,xn.ADD_CHILDREN,{id:t,children:e},Na,a.z.object({}))}async removeChildren(t,...e){await b(this.client,xn.REMOVE_CHILDREN,{id:t,children:e},Na,a.z.object({}))}async moveChildren(t,e,...r){const n={from:t,to:e,children:r};await b(this.client,xn.MOVE_CHILDREN,n,rp,a.z.object({}))}};const sp="/ontology/retrieve",ap=a.z.object({ids:ke.array().optional(),children:a.z.boolean().optional(),parents:a.z.boolean().optional(),includeSchema:a.z.boolean().optional(),excludeFieldData:a.z.boolean().optional(),term:a.z.string().optional(),limit:a.z.number().optional(),offset:a.z.number().optional()}),ip=a.z.object({resources:Gy.array()}),Cn=t=>I(t).map(e=>new Oe(e).payload);let op=class{constructor(t,e){u(this,"type","ontology"),u(this,"groups"),u(this,"client"),u(this,"writer"),u(this,"framer"),this.client=t,this.writer=new np(t),this.groups=new tp(t),this.framer=e}async search(t,e){return await this.execRetrieve({term:t,...e})}async retrieve(t,e){const r=await this.execRetrieve({ids:Cn(t),...e});if(Array.isArray(t))return r;if(r.length===0)throw new ge(`No resource found with ID ${t.toString()}`);return r[0]}async page(t,e,r){return await this.execRetrieve({offset:t,limit:e,...r})}async retrieveChildren(t,e){return await this.execRetrieve({ids:Cn(t),children:!0,...e})}async retrieveParents(t,e){return await this.execRetrieve({ids:Cn(t),parents:!0,...e})}async addChildren(t,...e){return await this.writer.addChildren(t,...e)}async removeChildren(t,...e){return await this.writer.removeChildren(t,...e)}async moveChildren(t,e,...r){return await this.writer.moveChildren(t,e,...r)}async openChangeTracker(){return await Ws.open(this.framer,this)}newSearcherWithOptions(t){return{type:this.type,search:e=>this.search(e,t),retrieve:e=>this.retrieve(e,t),page:(e,r)=>this.page(e,r,t)}}async execRetrieve(t){const{resources:e}=await b(this.client,sp,t,ap,ip);return e}};const Ia="sy_ontology_resource_set",Ea="sy_ontology_resource_delete",ka="sy_ontology_relationship_set",xa="sy_ontology_relationship_delete";class Ws{constructor(e,r){u(this,"resourceObs"),u(this,"relationshipObs"),u(this,"relationships"),u(this,"resources"),u(this,"streamer"),u(this,"client"),u(this,"closePromise"),this.relationshipObs=new Gn.Observer,this.relationships=this.relationshipObs,this.resourceObs=new Gn.Observer,this.resources=this.resourceObs,this.client=r,this.streamer=e,this.closePromise=this.start()}async close(){this.streamer.close(),await this.closePromise}async start(){for await(const e of this.streamer)await this.update(e)}async update(e){const r=await this.parseResourceSets(e),n=this.parseResourceDeletes(e);r.concat(n).length>0&&this.resourceObs.notify(r.concat(n));const s=this.parseRelationshipSets(e),i=this.parseRelationshipDeletes(e);s.concat(i).length>0&&this.relationshipObs.notify(s.concat(i))}parseRelationshipSets(e){const r=e.get(ka);return r.length===0?[]:Array.from(r.as("string")).map(n=>({variant:"set",key:Aa(n),value:void 0}))}parseRelationshipDeletes(e){const r=e.get(xa);return r.length===0?[]:Array.from(r.as("string")).map(n=>({variant:"delete",key:Aa(n)}))}async parseResourceSets(e){const r=e.get(Ia);if(r.length===0)return[];const n=Array.from(r.as("string")).map(s=>new Oe(s));try{return(await this.client.retrieve(n)).map(s=>({variant:"set",key:s.id,value:s}))}catch(s){if(s instanceof ge)return[];throw s}}parseResourceDeletes(e){const r=e.get(Ea);return r.length===0?[]:Array.from(r.as("string")).map(n=>({variant:"delete",key:new Oe(n)}))}static async open(e,r){const n=await e.openStreamer([Ia,Ea,ka,xa]);return new Ws(n,r)}}const Kt=a.z.string().uuid(),an=a.z.object({key:Kt,name:a.z.string().min(1),color:a.z.string()}),lp=a.z.object({keys:Kt.array().optional(),for:ke.optional(),search:a.z.string().optional(),offset:a.z.number().optional(),limit:a.z.number().optional()}),up=a.z.object({labels:an.array().optional().default([])});var rr;let cp=(rr=class{constructor(t){u(this,"client"),this.client=t}async retrieve(t){const e=I(t);return await this.execute({keys:e})}async retrieveFor(t){return await this.execute({for:t})}async search(t){return await this.execute({search:t})}async page(t,e){return await this.execute({offset:t,limit:e})}async execute(t){const[e,r]=await this.client.send(rr.ENDPOINT,t,lp,up);if(r!=null)throw r;return e.labels}},u(rr,"ENDPOINT","/label/retrieve"),rr);const hp=an.extend({key:Kt.optional()}),fp=a.z.object({labels:hp.array()}),dp=a.z.object({labels:an.array()}),yp=a.z.object({keys:Kt.array()}),Ho=a.z.object({id:ke,labels:Kt.array()}),pp=Ho,jn=a.z.object({}),gp="/label/create",mp="/label/delete",wp="/label/set",vp="/label/remove";let bp=class{constructor(t){u(this,"client"),this.client=t}async create(t){return(await b(this.client,gp,{labels:I(t)},fp,dp)).labels}async delete(t){await b(this.client,mp,{keys:I(t)},yp,jn)}async set(t,e){await b(this.client,wp,{id:t,labels:e},Ho,jn)}async remove(t,e){await b(this.client,vp,{id:t,labels:e},pp,jn)}};const Op="sy_label_set",Tp="sy_label_delete";let zp=class{constructor(t,e){u(this,"type","label"),u(this,"retriever"),u(this,"writer"),u(this,"frameClient"),this.writer=new bp(t),this.retriever=new cp(t),this.frameClient=e}async search(t){return await this.retriever.search(t)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async retrieveFor(t){return await this.retriever.retrieveFor(t)}async label(t,e){await this.writer.set(t,e)}async removeLabels(t,e){await this.writer.remove(t,e)}async page(t,e){return await this.retriever.page(t,e)}async create(t){const e=Array.isArray(t),r=await this.writer.create(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}async openChangeTracker(){return await nn(this.frameClient,Op,Tp,Sp)}};const Sp=(t,e)=>t==="delete"?e.toUUIDs().map(r=>({variant:t,key:r})):e.parseJSON(an).map(r=>({variant:t,key:r.key,value:r})),he=a.z.string().uuid(),yt=a.z.object({key:he,name:a.z.string().min(1),timeRange:ce.z,color:a.z.string().optional()}),Xo=yt.extend({key:a.z.string().uuid().optional()}),Qo=t=>{const e=I(t);if(e.length===0)throw new Error("Range params must not be empty");const r=he.safeParse(e[0]).success;return{single:!Array.isArray(t),variant:r?"keys":"names",normalized:e,actual:t}},Ap=a.z.object({}),Np=a.z.object({range:yt}),Ip=a.z.object({range:he}),Ep=a.z.object({range:he}),kp=a.z.object({}),xp="/range/set-active",Cp="/range/retrieve-active",jp="/range/clear-active";class Rp{constructor(e){u(this,"client"),this.client=e}async setActive(e){await b(this.client,xp,{range:e},Ip,Ap)}async retrieveActive(){const[e,r]=await this.client.send(Cp,{},a.z.object({}),Np);if(r instanceof ge)return null;if(r!=null)throw r;return e.range}async clearActive(e){await b(this.client,jp,{range:e},Ep,kp)}}const $p="sy_range_alias_set",Mp="sy_range_alias_delete",Dp=a.z.object({range:he,aliases:a.z.string().array()}),Pp=a.z.object({aliases:a.z.record(a.z.string(),Xe)}),Up=a.z.object({range:he,aliases:a.z.record(Xe.or(a.z.string()),a.z.string())}),Bp=a.z.unknown(),Lp=a.z.object({range:he,channels:Xe.array()}),_p=a.z.unknown(),qp=a.z.object({range:he}),Zp=a.z.object({aliases:a.z.record(a.z.string(),a.z.string())}),Et=class kt{constructor(e,r,n){u(this,"frameClient"),u(this,"cache",new Map),u(this,"client"),u(this,"rangeKey"),this.rangeKey=e,this.cache=new Map,this.client=n,this.frameClient=r}async resolve(e){const r=[],n=typeof e=="string",s={};if(n){const o=this.cache.get(e);if(o!=null)return o;r.push(e)}else e.forEach(o=>{const l=this.cache.get(o);l!=null?s[o]=l:r.push(o)});if(r.length===0)return s;const i=await b(this.client,kt.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:r},Dp,Pp);return Object.entries(i.aliases).forEach(([o,l])=>this.cache.set(o,l)),n?i.aliases[r[0]]:{...s,...i.aliases}}async set(e){await b(this.client,kt.SET_ENDPOINT,{range:this.rangeKey,aliases:e},Up,Bp)}async list(){return(await b(this.client,kt.LIST_ENDPOINT,{range:this.rangeKey},qp,Zp)).aliases}async delete(e){await b(this.client,kt.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},Lp,_p)}async openChangeTracker(){return await nn(this.frameClient,$p,Mp,Wp(this.rangeKey))}};u(Et,"SET_ENDPOINT","/range/alias/set"),u(Et,"RESOLVE_ENDPOINT","/range/alias/resolve"),u(Et,"LIST_ENDPOINT","/range/alias/list"),u(Et,"DELETE_ENDPOINT","/range/alias/delete");let Yp=Et;const Fp=a.z.object({range:he,channel:Xe,alias:a.z.string()}),Vp="---",Wp=t=>(e,r)=>e==="delete"?r.toStrings().filter(n=>n.split(Vp)[0]===t).map(n=>({variant:e,key:n,value:void 0})):r.parseJSON(Fp).map(n=>({variant:e,key:n.alias,value:n})),Kp=a.z.object({range:he,keys:a.z.string().array()}),Gp=a.z.object({pairs:a.z.record(a.z.string(),a.z.string())}),Jp=a.z.object({range:he,pairs:a.z.record(a.z.string(),a.z.string())}),Hp=a.z.object({range:he,keys:a.z.string().array()}),Nr=class Ir{constructor(e,r){u(this,"rangeKey"),u(this,"client"),this.rangeKey=e,this.client=r}async get(e){const[r,n]=await this.client.send(Ir.GET_ENDPOINT,{range:this.rangeKey,keys:I(e)},Kp,Gp);if(n!=null)throw n;return Array.isArray(e)?r.pairs:r.pairs[e]}async list(){return this.get([])}async set(e,r=""){await b(this.client,Ir.SET_ENDPOINT,{range:this.rangeKey,pairs:zo(e)?e:{[e]:r}},Jp,a.z.unknown())}async delete(e){await b(this.client,Ir.DELETE_ENDPOINT,{range:this.rangeKey,keys:I(e)},Hp,a.z.unknown())}};u(Nr,"GET_ENDPOINT","/range/kv/get"),u(Nr,"SET_ENDPOINT","/range/kv/set"),u(Nr,"DELETE_ENDPOINT","/range/kv/delete");let Xp=Nr;const Rn=t=>new Oe({type:"range",key:t});class el{constructor(e,r=ce.ZERO,n,s,i,o,l,c,f){u(this,"key"),u(this,"name"),u(this,"kv"),u(this,"timeRange"),u(this,"color"),u(this,"channels"),u(this,"aliaser"),u(this,"frameClient"),u(this,"labelClient"),this.key=n,this.name=e,this.timeRange=r,this.frameClient=i,this.color=s,this.kv=o,this.aliaser=l,this.channels=c,this.labelClient=f}async setAlias(e,r){const n=await this.channels.retrieve(e);if(n.length===0)throw new ge(`Channel ${e} does not exist`);await this.aliaser.set({[n[0].key]:r})}async deleteAlias(...e){await this.aliaser.delete(e)}async listAliases(){return await this.aliaser.list()}async openAliasTracker(){return await this.aliaser.openChangeTracker()}async read(e){return await this.frameClient.read(this.timeRange,e)}async labels(){return await this.labelClient.retrieveFor(Rn(this.key))}async addLabel(...e){await this.labelClient.label(Rn(this.key),e)}async removeLabel(...e){await this.labelClient.removeLabels(Rn(this.key),e)}}const Qp=a.z.object({keys:he.array().optional(),names:a.z.array(a.z.string()).optional(),term:a.z.string().optional(),overlapsWith:ce.z.optional()}),eg="/range/retrieve",tg=a.z.object({ranges:dt(yt)});let tl=class{constructor(t,e,r,n,s){u(this,"type","range"),u(this,"frameClient"),u(this,"writer"),u(this,"unaryClient"),u(this,"channels"),u(this,"active"),u(this,"labelClient"),this.frameClient=t,this.writer=e,this.unaryClient=r,this.channels=n,this.active=new Rp(r),this.labelClient=s}async create(t){const e=!Array.isArray(t),r=this.sugar(await this.writer.create(I(t)));return e?r[0]:r}async rename(t,e){await this.writer.rename(t,e)}async delete(t){await this.writer.delete(I(t))}async search(t){return this.sugar(await this.execRetrieve({term:t}))}async page(){return[]}async retrieve(t){if(typeof t=="object"&&"start"in t)return await this.execRetrieve({overlapsWith:new ce(t)});const{single:e,actual:r,variant:n,normalized:s}=Qo(t),i=await this.execRetrieve({[n]:s});if(!e)return i;if(i.length===0)throw new Mt(`range matching ${r} not found`);if(i.length>1)throw new Dt(`multiple ranges matching ${r} found`);return i[0]}async execRetrieve(t){const{ranges:e}=await b(this.unaryClient,eg,t,Qp,tg);return this.sugar(e)}async setActive(t){await this.active.setActive(t)}async retrieveActive(){const t=await this.active.retrieveActive();return t==null?null:this.sugar([t])[0]}async clearActive(t){await this.active.clearActive(t)}sugar(t){return t.map(e=>new el(e.name,e.timeRange,e.key,e.color,this.frameClient,new Xp(e.key,this.unaryClient),new Yp(e.key,this.frameClient,this.unaryClient),this.channels,this.labelClient))}async openTracker(){return await nn(this.frameClient,"sy_range_set","sy_range_delete",(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):this.sugar(e.parseJSON(yt)).map(r=>({variant:t,key:r.key,value:r})))}};const rg=a.z.object({ranges:yt.array()}),ng=a.z.object({ranges:Xo.array()}),sg=a.z.object({keys:he.array()}),ag=a.z.object({}),ig=a.z.object({key:he,name:a.z.string()}),og=a.z.object({}),lg="/range/create",ug="/range/delete",cg="/range/rename";let rl=class{constructor(t){u(this,"client"),this.client=t}async rename(t,e){await b(this.client,cg,{key:t,name:e},ig,og)}async create(t){return(await b(this.client,lg,{ranges:t},ng,rg)).ranges}async delete(t){await b(this.client,ug,{keys:t},sg,ag)}};const hg=Object.freeze(Object.defineProperty({__proto__:null,Client:tl,Range:el,Writer:rl,analyzeParams:Qo,keyZ:he,newPayloadZ:Xo,payloadZ:yt},Symbol.toStringTag,{value:"Module"})),fg="/api/v1/";class dg{constructor(e,r=!1){u(this,"url"),u(this,"unary"),u(this,"stream"),u(this,"secure"),this.secure=r,this.url=e.child(fg);const n=new ft.JSONEncoderDecoder;this.unary=new Zf(this.url,n,this.secure),this.stream=new Xf(this.url,n,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const Ks=a.z.string().uuid(),Gs=a.z.object({key:a.z.string(),name:a.z.string(),data:Ps.or(a.z.string().transform(t=>JSON.parse(t)))}),yg=a.z.object({keys:a.z.string().array()}),pg=a.z.object({linePlots:Gs.array()});let gg=class{constructor(t){u(this,"ENDPOINT","/workspace/lineplot/retrieve"),u(this,"client"),this.client=t}async retrieve(t){const e=I(t);return(await b(this.client,this.ENDPOINT,{keys:e},yg,pg)).linePlots}};const lt=a.z.string().uuid(),nl=t=>JSON.parse(t),sl=a.z.object({name:a.z.string(),key:lt,layout:Ps.or(a.z.string().transform(t=>nl(t)))}),al=sl.omit({layout:!0}).extend({layout:a.z.string().transform(t=>nl(t))}),mg=Gs.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),wg=a.z.object({workspace:lt,linePlots:mg.array()}),vg=a.z.object({linePlots:Gs.array()}),bg=a.z.object({keys:Ks.array()}),Og=a.z.object({}),Tg=a.z.object({key:Ks,name:a.z.string()}),zg=a.z.object({}),Sg=a.z.object({key:Ks,data:a.z.string()}),Ag=a.z.object({}),Ng="/workspace/lineplot/create",Ig="/workspace/lineplot/delete",Eg="/workspace/lineplot/rename",kg="/workspace/lineplot/set-data";let xg=class{constructor(t){u(this,"client"),this.client=t}async create(t,e){const r={...e,data:JSON.stringify(e.data)};return(await b(this.client,Ng,{workspace:t,linePlots:[r]},wg,vg)).linePlots[0]}async delete(t){const e=I(t);await b(this.client,Ig,{keys:e},bg,Og)}async rename(t,e){await b(this.client,Eg,{key:t,name:e},Tg,zg)}async setData(t,e){await b(this.client,kg,{key:t,data:JSON.stringify(e)},Sg,Ag)}},Cg=class{constructor(t){u(this,"writer"),u(this,"retriever"),this.writer=new xg(t),this.retriever=new gg(t)}async create(t,e){return await this.writer.create(t,e)}async rename(t,e){await this.writer.rename(t,e)}async setData(t,e){await this.writer.setData(t,e)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}};const jg=a.z.object({keys:lt.array().optional(),search:a.z.string().optional(),author:a.z.string().uuid().optional(),offset:a.z.number().optional(),limit:a.z.number().optional()}),Rg=a.z.object({workspaces:dt(al)});var nr;let $g=(nr=class{constructor(t){u(this,"client"),this.client=t}async retrieve(t){const e=I(t);return await this.execute({keys:e})}async retrieveByAuthor(t){return await this.execute({author:t})}async search(t){return await this.execute({search:t})}async page(t,e){return await this.execute({offset:t,limit:e})}async execute(t){return(await b(this.client,nr.ENDPOINT,t,jg,Rg)).workspaces}},u(nr,"ENDPOINT","/workspace/retrieve"),nr);const on=a.z.string().uuid(),Mg=a.z.object({key:a.z.string(),name:a.z.string(),data:Ps.or(a.z.string().transform(t=>JSON.parse(t))),snapshot:a.z.boolean()}),Js=a.z.object({key:a.z.string(),name:a.z.string(),snapshot:a.z.boolean(),data:a.z.string().transform(t=>JSON.parse(t))}),Dg=a.z.object({keys:a.z.string().array()}),Pg=a.z.object({schematics:Js.array()});class Ug{constructor(e){u(this,"ENDPOINT","/workspace/schematic/retrieve"),u(this,"client"),this.client=e}async retrieve(e){return(await b(this.client,this.ENDPOINT,{keys:I(e)},Dg,Pg)).schematics}}const Bg=Mg.partial({key:!0,snapshot:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),Lg=a.z.object({workspace:lt,schematics:Bg.array()}),_g=a.z.object({schematics:Js.array()}),qg=a.z.object({keys:on.array()}),Zg=a.z.object({}),Yg=a.z.object({key:on,name:a.z.string()}),Ca=a.z.object({}),Fg=a.z.object({key:on,data:a.z.string()});a.z.object({});const Vg=a.z.object({key:on,name:a.z.string(),snapshot:a.z.boolean()}),Wg=a.z.object({schematic:Js}),Kg="/workspace/schematic/create",Gg="/workspace/schematic/delete",Jg="/workspace/schematic/rename",Hg="/workspace/schematic/set-data",Xg="/workspace/schematic/copy";let Qg=class{constructor(t){u(this,"client"),this.client=t}async create(t,e){const r={...e,data:JSON.stringify(e.data)};return(await b(this.client,Kg,{workspace:t,schematics:[r]},Lg,_g)).schematics[0]}async copy(t,e,r){return(await b(this.client,Xg,{key:t,name:e,snapshot:r},Vg,Wg)).schematic}async delete(t){const e=I(t);await b(this.client,Gg,{keys:e},qg,Zg)}async rename(t,e){await b(this.client,Jg,{key:t,name:e},Yg,Ca)}async setData(t,e){await b(this.client,Hg,{key:t,data:JSON.stringify(e)},Fg,Ca)}},em=class{constructor(t){u(this,"writer"),u(this,"retriever"),this.writer=new Qg(t),this.retriever=new Ug(t)}async create(t,e){return await this.writer.create(t,e)}async rename(t,e){await this.writer.rename(t,e)}async setData(t,e){await this.writer.setData(t,e)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}async copy(t,e,r){return await this.writer.copy(t,e,r)}};const tm=sl.partial({key:!0}).transform(t=>({...t,layout:JSON.stringify(t.layout)})),rm=a.z.object({workspaces:tm.array()}),nm=a.z.object({workspaces:al.array()}),sm=a.z.object({keys:lt.array()}),am=a.z.object({}),im=a.z.object({key:lt,name:a.z.string()}),om=a.z.object({}),lm=a.z.object({key:lt,layout:a.z.string()}),um=a.z.object({}),cm="/workspace/create",hm="/workspace/delete",fm="/workspace/rename",dm="/workspace/set-layout";class ym{constructor(e){u(this,"client"),this.client=e}async create(e){return(await b(this.client,cm,{workspaces:I(e)},rm,nm)).workspaces}async delete(e){await b(this.client,hm,{keys:I(e)},sm,am)}async rename(e,r){await b(this.client,fm,{key:e,name:r},im,om)}async setLayout(e,r){await b(this.client,dm,{key:e,layout:JSON.stringify(r)},lm,um)}}class pm{constructor(e){u(this,"type","workspace"),u(this,"schematic"),u(this,"linePlot"),u(this,"retriever"),u(this,"writer"),this.schematic=new em(e),this.linePlot=new Cg(e),this.retriever=new $g(e),this.writer=new ym(e)}async search(e){return await this.retriever.search(e)}async retrieveByAuthor(e){return await this.retriever.retrieveByAuthor(e)}async retrieve(e){const r=Array.isArray(e),n=await this.retriever.retrieve(e);return r?n:n[0]}async page(e,r){return await this.retriever.page(e,r)}async create(e){const r=Array.isArray(e),n=await this.writer.create(e);return r?n:n[0]}async rename(e,r){await this.writer.rename(e,r)}async setLayout(e,r){await this.writer.setLayout(e,r)}async delete(...e){await this.writer.delete(e)}}const il=a.z.object({host:a.z.string({required_error:"Host is required"}).min(1,"Host is required"),port:a.z.number({required_error:"Port is required"}).or(a.z.string({required_error:"Port is required"})),username:a.z.string().optional(),password:a.z.string().optional(),connectivityPollFrequency:k.z.default(k.seconds(30)),secure:a.z.boolean().optional().default(!1),name:a.z.string().optional()});class ol extends Vo{constructor(e){const r=il.parse(e),{host:n,port:s,username:i,password:o,connectivityPollFrequency:l,secure:c}=r,f=new dg(new pd({host:n,port:Number(s)}),c);f.use(td);let w;if(i!=null&&o!=null){const El=new Pd(f.unary,{username:i,password:o});f.use(El.middleware())}const h=new Bs(new Us(f.unary)),D=new Mo(f.unary);super(f.stream,f.unary,h),u(this,"createdAt"),u(this,"props"),u(this,"ranges"),u(this,"channels"),u(this,"auth"),u(this,"connectivity"),u(this,"ontology"),u(this,"workspaces"),u(this,"labels"),u(this,"hardware"),u(this,"control"),u(this,"transport"),this.createdAt=E.now(),this.props=r,this.auth=w,this.transport=f,this.channels=new $o(this,h,f.unary,D),this.connectivity=new Uo(f.unary,l,r.name),this.control=new Ko(this),this.ontology=new op(f.unary,this);const F=new rl(this.transport.unary);this.labels=new zp(this.transport.unary,this),this.ranges=new tl(this,F,this.transport.unary,h,this.labels),this.workspaces=new pm(this.transport.unary);const se=new Iy(this.transport.unary,this),$=new _y(this.transport.unary,this),Il=new gy(this.transport.unary,this,$);this.hardware=new ly($,Il,se)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}u(ol,"connectivity",Uo);const gm=ht.Authority;let mm="_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",wm=(t,e)=>()=>{let r="",n=e;for(;n--;)r+=t[Math.random()*t.length|0];return r},vm=(t=21)=>{let e="",r=t;for(;r--;)e+=mm[Math.random()*64|0];return e};const ts=(t,e,r="")=>{try{return t.parse(e)}catch(n){if(n instanceof a.z.ZodError){const s=n.errors.map(i=>i.path.length===0?i.message:`${i.path.join(".")}: ${i.message}`);throw new Error(`${r} - ${s.join(`
|
|
44
|
-
`)}`)}else throw n}};var bm=Object.defineProperty,Om=(t,e,r)=>e in t?bm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X=(t,e,r)=>(Om(t,typeof e!="symbol"?e+"":e,r),r);const rs=class ll{constructor(e,r,n="",s=!1){X(this,"_noop",!1),X(this,"key"),X(this,"path"),X(this,"serviceName"),this.key=e,this.path=r,this.serviceName=n,this._noop=s}child(e){return new ll(e,this.extendPath(e),this.serviceName,this.noop)}extendPath(e){return`${this.path}.${e}`}get noop(){return this._noop}};X(rs,"NOOP",new rs("","",""));let Hs=rs;const ns=["debug","info","warn","error"],Tm=t=>{const e=ns.indexOf(t);return({level:r})=>ns.indexOf(r)>=e},zm=t=>{const{include:e,exclude:r}=t;return({path:n})=>!(e!=null&&!e.some(s=>n.startsWith(s))||r!=null&&r.some(s=>n.startsWith(s)))},ss=class ul{constructor(e={}){X(this,"meta",Hs.NOOP),X(this,"filters");const{filters:r=[]}=e;this.filters=r}filter(e){return!this.meta.noop&&this.filters.every(r=>r({key:this.meta.key,path:this.meta.path,level:e}))}child(e){const r=new ul({filters:this.filters});return r.meta=e,r}debug(e,r,n=!1){!this.filter("debug")&&!n||(r==null?console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e):console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e,sr(r)))}info(e,r,n=!1){!this.filter("info")&&!n||(r==null?console.log("%cINFO","color: #005eff;",this.meta.path,e):console.log("%cINFO","color: #005eff;",this.meta.path,e,sr(r)))}warn(e,r,n=!1){!this.filter("warn")&&!n||(r==null?console.warn("WARN",this.meta.path,e):console.warn("WARN",this.meta.path,e,sr(r)))}error(e,r,n=!1){!this.filter("error")&&!n||(r==null?console.error("ERROR",this.meta.path,e):console.error("ERROR",this.meta.path,e,sr(r)))}};X(ss,"NOOP",new ss);let cl=ss;const sr=t=>typeof t=="function"?t():t;var Sm=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},nt="1.8.0",ja=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Am(t){var e=new Set([t]),r=new Set,n=t.match(ja);if(!n)return function(){return!1};var s={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(s.prerelease!=null)return function(l){return l===t};function i(l){return r.add(l),!1}function o(l){return e.add(l),!0}return function(l){if(e.has(l))return!0;if(r.has(l))return!1;var c=l.match(ja);if(!c)return i(l);var f={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return f.prerelease!=null||s.major!==f.major?i(l):s.major===0?s.minor===f.minor&&s.patch<=f.patch?o(l):i(l):s.minor<=f.minor?o(l):i(l)}}var Nm=Am(nt),Im=nt.split(".")[0],Bt=Symbol.for("opentelemetry.js.api."+Im),Lt=Sm;function Xs(t,e,r,n){var s;n===void 0&&(n=!1);var i=Lt[Bt]=(s=Lt[Bt])!==null&&s!==void 0?s:{version:nt};if(!n&&i[t]){var o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(o.stack||o.message),!1}if(i.version!==nt){var o=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+t+" does not match previously registered API v"+nt);return r.error(o.stack||o.message),!1}return i[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+nt+"."),!0}function _t(t){var e,r,n=(e=Lt[Bt])===null||e===void 0?void 0:e.version;if(!(!n||!Nm(n)))return(r=Lt[Bt])===null||r===void 0?void 0:r[t]}function Qs(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+nt+".");var r=Lt[Bt];r&&delete r[t]}var Em=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i},km=function(t,e,r){if(arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},xm=function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return wt("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return wt("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return wt("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return wt("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return wt("verbose",this._namespace,e)},t}();function wt(t,e,r){var n=_t("diag");if(n)return r.unshift(e),n[t].apply(n,km([],Em(r),!1))}var ye;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(ye||(ye={}));function Cm(t,e){t<ye.NONE?t=ye.NONE:t>ye.ALL&&(t=ye.ALL),e=e||{};function r(n,s){var i=e[n];return typeof i=="function"&&t>=s?i.bind(e):function(){}}return{error:r("error",ye.ERROR),warn:r("warn",ye.WARN),info:r("info",ye.INFO),debug:r("debug",ye.DEBUG),verbose:r("verbose",ye.VERBOSE)}}var jm=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i},Rm=function(t,e,r){if(arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},$m="diag",qt=function(){function t(){function e(s){return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var l=_t("diag");if(l)return l[s].apply(l,Rm([],jm(i),!1))}}var r=this,n=function(s,i){var o,l,c;if(i===void 0&&(i={logLevel:ye.INFO}),s===r){var f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((o=f.stack)!==null&&o!==void 0?o:f.message),!1}typeof i=="number"&&(i={logLevel:i});var w=_t("diag"),h=Cm((l=i.logLevel)!==null&&l!==void 0?l:ye.INFO,s);if(w&&!i.suppressOverrideMessage){var D=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";w.warn("Current logger will be overwritten from "+D),h.warn("Current logger will overwrite one already registered from "+D)}return Xs("diag",h,r,!0)};r.setLogger=n,r.disable=function(){Qs($m,r)},r.createComponentLogger=function(s){return new xm(s)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}(),Mm=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i},Dm=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Pm=function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var r=this._entries.get(e);if(r)return Object.assign({},r)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var r=Mm(e,2),n=r[0],s=r[1];return[n,s]})},t.prototype.setEntry=function(e,r){var n=new t(this._entries);return n._entries.set(e,r),n},t.prototype.removeEntry=function(e){var r=new t(this._entries);return r._entries.delete(e),r},t.prototype.removeEntries=function(){for(var e,r,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var i=new t(this._entries);try{for(var o=Dm(n),l=o.next();!l.done;l=o.next()){var c=l.value;i._entries.delete(c)}}catch(f){e={error:f}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t}();qt.instance();function Um(t){return t===void 0&&(t={}),new Pm(new Map(Object.entries(t)))}function Bm(t){return Symbol.for(t)}var Lm=function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,s){var i=new t(r._currentContext);return i._currentContext.set(n,s),i},r.deleteValue=function(n){var s=new t(r._currentContext);return s._currentContext.delete(n),s}}return t}(),_m=new Lm,qm={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},Zm={set:function(t,e,r){t!=null&&(t[e]=r)}},Ym=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i},Fm=function(t,e,r){if(arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},Vm=function(){function t(){}return t.prototype.active=function(){return _m},t.prototype.with=function(e,r,n){for(var s=[],i=3;i<arguments.length;i++)s[i-3]=arguments[i];return r.call.apply(r,Fm([n],Ym(s),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),Wm=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i},Km=function(t,e,r){if(arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},$n="context",Gm=new Vm,hl=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return Xs($n,e,qt.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var s,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return(s=this._getContextManager()).with.apply(s,Km([e,r,n],Wm(i),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return _t($n)||Gm},t.prototype.disable=function(){this._getContextManager().disable(),Qs($n,qt.instance())},t}(),as;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(as||(as={}));var Jm=hl.getInstance(),Hm=function(){function t(){}return t.prototype.inject=function(e,r){},t.prototype.extract=function(e,r){return e},t.prototype.fields=function(){return[]},t}(),ea=Bm("OpenTelemetry Baggage Key");function fl(t){return t.getValue(ea)||void 0}function Xm(){return fl(hl.getInstance().active())}function Qm(t,e){return t.setValue(ea,e)}function ew(t){return t.deleteValue(ea)}var Mn="propagation",tw=new Hm,rw=function(){function t(){this.createBaggage=Um,this.getBaggage=fl,this.getActiveBaggage=Xm,this.setBaggage=Qm,this.deleteBaggage=ew}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return Xs(Mn,e,qt.instance())},t.prototype.inject=function(e,r,n){return n===void 0&&(n=Zm),this._getGlobalPropagator().inject(e,r,n)},t.prototype.extract=function(e,r,n){return n===void 0&&(n=qm),this._getGlobalPropagator().extract(e,r,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){Qs(Mn,qt.instance())},t.prototype._getGlobalPropagator=function(){return _t(Mn)||tw},t}(),nw=rw.getInstance();const Ra=["bench","debug","prod"],sw=t=>e=>Ra.indexOf(e)>=Ra.indexOf(t),is=class dl{constructor(e,r=sw("debug")){X(this,"meta",Hs.NOOP),X(this,"tracer"),X(this,"filter"),this.tracer=e,this.filter=r}child(e){const r=new dl(this.tracer,this.filter);return r.meta=e,r}debug(e,r){return this.trace(e,"debug",r)}bench(e,r){return this.trace(e,"bench",r)}prod(e,r){return this.trace(e,"prod",r)}trace(e,r,n){return this.meta.noop||!this.filter(r)?n(new gl(e)):this.tracer.startActiveSpan(e,s=>{const i=new pl(e,s),o=n(i);return s.end(),o})}propagate(e){if(this.meta.noop)return;const r=Jm.active();nw.inject(r,e,{set:(n,s,i)=>{n[s]=i}})}};X(is,"NOOP",new is);let yl=is;class pl{constructor(e,r){X(this,"key"),X(this,"otel"),this.key=e,this.otel=r}set(e,r){this.otel.setAttribute(e,r)}recordError(e){e!=null&&(this.otel.recordException(e),this.otel.setStatus({code:as.ERROR}))}}class gl{constructor(e){X(this,"key"),this.key=e}set(){}recordError(e){}}const os=class ml{constructor({key:e="",serviceName:r="",logger:n=cl.NOOP,tracer:s=yl.NOOP,noop:i=!1,__meta:o}){X(this,"meta"),X(this,"T"),X(this,"L"),this.meta=o??new Hs(e,e,r,i),this.T=s.child(this.meta),this.L=n.child(this.meta)}child(e){const r=this.meta.child(e);return new ml({__meta:r,tracer:this.T,logger:this.L})}};X(os,"NOOP",new os({noop:!0}));let ta=os;const aw=ta.NOOP,wl=Object.freeze(Object.defineProperty({__proto__:null,Instrumentation:ta,LOG_LEVELS:ns,Logger:cl,NOOP:aw,NoopSpan:gl,Tracer:yl,_Span:pl,logLevelKeyFiler:zm,logThresholdFilter:Tm},Symbol.toStringTag,{value:"Module"})),iw=new Error("request for lock canceled");var ow=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(w){try{f(n.next(w))}catch(h){o(h)}}function c(w){try{f(n.throw(w))}catch(h){o(h)}}function f(w){w.done?i(w.value):s(w.value).then(l,c)}f((n=n.apply(t,e||[])).next())})};class lw{constructor(e,r=iw){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,s)=>{const i={resolve:n,reject:s,weight:e,priority:r},o=vl(this._queue,l=>r<=l.priority);o===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(o+1,0,i)})}runExclusive(e){return ow(this,arguments,void 0,function*(r,n=1,s=0){const[i,o]=yield this.acquire(n,s);try{return yield r(i)}finally{o()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),uw(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let r=this._value;r>0;r--){const n=this._weightedWaiters[r-1];if(!n)continue;const s=n.findIndex(i=>i.priority<=e);(s===-1?n:n.splice(0,s)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function uw(t,e){const r=vl(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function vl(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var cw=function(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(w){try{f(n.next(w))}catch(h){o(h)}}function c(w){try{f(n.throw(w))}catch(h){o(h)}}function f(w){w.done?i(w.value):s(w.value).then(l,c)}f((n=n.apply(t,e||[])).next())})};class bl{constructor(e){this._semaphore=new lw(1,e)}acquire(){return cw(this,arguments,void 0,function*(e=0){const[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class ln{constructor(e,r,n=new Map){P(this,"providers");P(this,"registry");P(this,"sender");P(this,"changedKeys");this.providers=n,this.registry=r,this.changedKeys=[],this.sender=e}propagateState(e,r,n=[]){this.sender.send({key:e,state:r},n)}copyAndMerge(e){const r=new ln(this.sender,this.registry,new Map);return e==null||e.providers.forEach((n,s)=>r.providers.set(s,n)),this.providers.forEach((n,s)=>r.providers.set(s,n)),r.changedKeys=[],r}get changed(){return this.changedKeys.length>0}set(e,r,n=!0){this.providers.set(e,r),n&&this.changedKeys.push(e)}setIfNotHas(e,r){this.providers.has(e)||this.set(e,r)}async create(e){const r=this.registry[e.type];if(r==null)throw new Error(`[AetherRoot.create] - could not find component ${e.type}`);const n=new r(e);return await n.internalUpdate(e),n}getOptional(e){return this.providers.get(e)??null}has(e){return this.providers.has(e)}get(e){const r=this.getOptional(e);if(r==null)throw new Error(`[AetherRoot.get] - could not find provider ${e}`);return r}}class ra{constructor(e){P(this,"type");P(this,"key");P(this,"_ctx");P(this,"_internalState");P(this,"_state");P(this,"_prevState");P(this,"_deleted",!1);P(this,"instrumentation");P(this,"schema");this.type=e.type,this.key=e.path[0],this._ctx=e.ctx,this._internalState={},this.instrumentation=e.instrumentation.child(`${this.type}(${this.key})`)}get _schema(){if(this.schema==null)throw new W(`[AetherLeaf] - expected subclass to define component schema, but none was found.
|
|
45
|
-
Make sure to defne a property 'schema' on the class.`);return this.schema}setState(e){const r=cs(e,this._state);this._prevState={...this._state},this._state=ts(this._schema,r,`${this.type}:${this.key}`),this.ctx.propagateState(this.key,r)}get ctx(){if(this._ctx==null)throw new pe("context not defined");return this._ctx}get state(){if(this._state==null)throw new pe("state not defined");return this._state}get internal(){return this._internalState}get prevState(){return this._prevState}get deleted(){return this._deleted}async internalUpdate({variant:e,path:r,ctx:n,state:s}){if(!this.deleted){if(this._ctx=n,e==="state"){this.validatePath(r);const i=ts(this._schema,s,`${this.type}:${this.key}`);this._state!=null?this.instrumentation.L.debug("updating state",()=>({diff:Ba.difference(this.state,i)})):this.instrumentation.L.debug("setting initial state",{state:s}),this._prevState=this._state??i,this._state=i}else this.instrumentation.L.debug("updating context");await this.afterUpdate()}}async internalDelete(e){this.validatePath(e),this._deleted=!0,await this.afterDelete()}beforeUpdate(){}async afterUpdate(){}async afterDelete(){}validatePath(e){if(e.length===0)throw new pe(`[Leaf.setState] - ${this.type}:${this.key} received an empty path`);const r=e[e.length-1];if(e.length>1)throw new pe(`[Leaf.setState] - ${this.type}:${this.key} received a subPath ${e.join(".")} but is a leaf`);if(r!==this.key)throw new pe(`[Leaf.setState] - ${this.type}:${this.key} received a key ${r} but expected ${this.key}`)}}class Gt extends ra{constructor(r){super(r);P(this,"_children");this._children=new Map}get children(){return Array.from(this._children.values())}async internalUpdate(r){const{variant:n,path:s}=r;if(n==="context")return this._ctx=r.ctx.copyAndMerge(this._ctx),await this.updateContext({...r,ctx:this.ctx});const[i,o]=this.getRequiredKey(s),l={...r,ctx:this.ctx};return o.length===0?await this.updateThis(i,l):await this.updateChild(o,l)}async updateContext(r){await super.internalUpdate(r);for(const n of this.children)await n.internalUpdate({...r,ctx:this.ctx,variant:"context"})}async updateChild(r,n){const s=r[0],i=this.getChild(s);if(i!=null)return await i.internalUpdate({...n,path:r});if(r.length>1)throw new Error(`[Composite.setState] - ${this.type}:${this.key} could not find child with key ${s} while updating `);this._children.set(s,await n.ctx.create({...n,path:r}))}async updateThis(r,n){const s=n.ctx.copyAndMerge(this._ctx);if(r!==this.key)throw new pe(`[Composite.update] - ${this.type}:${this.key} received a key ${r} but expected ${this.key}`);if(await super.internalUpdate({...n,ctx:s}),!!s.changed){this.instrumentation.L.debug("context changed",{changedKeys:s.changedKeys});for(const i of this.children)await i.internalUpdate({...n,ctx:this.ctx,variant:"context"})}}async internalDelete(r){const[n,s]=this.getRequiredKey(r);if(s.length===0){if(n!==this.key)throw new Error(`[Composite.delete] - ${this.type}:${this.key} received a key ${n} but expected ${this.key}`);const o=this.children;this._children=new Map;for(const l of o)await l.internalDelete([l.key]);await super.internalDelete([this.key])}const i=this.getChild(s[0]);i!=null&&(s.length>1?await i.internalDelete(s):(this._children.delete(i.key),await i.internalDelete(s)))}getRequiredKey(r,n){const[s,...i]=r;if(s==null)throw new Error(`Composite ${this.type}:${this.key} received an empty path`+(n!=null?` for ${n}`:""));return[s,i]}getChild(r){return this._children.get(r)??null}childrenOfType(...r){return this.children.filter(n=>r.includes(n.type))}}const hw=a.z.object({}),Ee=class Ee extends Gt{constructor({worker:r,registry:n,instrumentation:s=wl.Instrumentation.NOOP}){const o={ctx:new ln(r,n,new Map),...Ee.ZERO_UPDATE,instrumentation:s};super(o);P(this,"wrap");P(this,"schema",Ee.schema);P(this,"mu",new bl);this.mu.runExclusive(async()=>await this.internalUpdate(o)),this.wrap=r,this.wrap.handle(l=>{this.mu.runExclusive(async()=>await this.handle(l))})}async handle(r){if(r.variant==="delete")await this.internalDelete(r.path);else{const n={...r,variant:"state",ctx:this.ctx,instrumentation:this.instrumentation};await this.internalUpdate(n)}}};P(Ee,"TYPE","root"),P(Ee,"KEY","root"),P(Ee,"ZERO_UPDATE",{path:[Ee.KEY],type:Ee.TYPE,variant:"state",state:{}}),P(Ee,"schema",hw);let Rr=Ee;const Ol=t=>new Rr(t),fw=Object.freeze(Object.defineProperty({__proto__:null,Composite:Gt,Context:ln,Leaf:ra,Root:Rr,render:Ol},Symbol.toStringTag,{value:"Module"})),Tl="pluto-theming-context",dw=a.z.object({theme:ni}),Ct=class Ct extends Gt{constructor(){super(...arguments);P(this,"schema",Ct.z)}async afterUpdate(){this.ctx.set(Tl,this.state.theme)}};P(Ct,"TYPE","theming.Provider"),P(Ct,"z",dw);let Zt=Ct;const yw=t=>t.get(Tl),pw={[Zt.TYPE]:Zt},zl=["success","error","warning","info","loading","disabled","secondary"],Sl=a.z.enum(zl),Al=a.z.object({key:a.z.string(),variant:Sl,message:a.z.string(),description:a.z.string().optional(),time:Y.z,data:a.z.record(a.z.unknown()).optional()}),Nl=a.z.object({statuses:Al.array()}),na="status.aggregator";class $r extends Gt{constructor(){super(...arguments);P(this,"schema",Nl)}async afterUpdate(){this.ctx.set(na,this)}add(r){const n=Y.now();this.setState(s=>({...s,statuses:[...s.statuses,{time:n,key:n.toString(),...r}]}))}}P($r,"TYPE","status.Aggregator");const gw=t=>{const e=t.get(na);return e.add.bind(e)},mw=t=>{const e=t.getOptional(na);return e!=null?e.add.bind(e):()=>{}},ww={[$r.TYPE]:$r};exports.A=bu;exports.A$1=k;exports.A$2=Pl;exports.Aggregator=$r;exports.B=ta;exports.C=Dr;exports.ComponentSizeLevels=ri;exports.Composite=Gt;exports.D=Lu;exports.Dd=oy;exports.G=ue;exports.H=ce;exports.I=le;exports.LEVELS=ti;exports.Leaf=ra;exports.LevelComponentSizes=Zu;exports.Mutex=bl;exports.N=Fa;exports.Provider=Zt;exports.Qd=hg;exports.R=Du;exports.REGISTRY=pw;exports.REGISTRY$1=ww;exports.S=Fl;exports.S$1=E;exports.SYNNAX_DARK=ai;exports.SYNNAX_LIGHT=si;exports.SYNNAX_THEMES=Xu;exports.U=jt;exports.VARIANTS=zl;exports.Z=Bu;exports._=Ba;exports._$1=W;exports.a=ls;exports.aether=fw;exports.aggregatorStateZ=Nl;exports.commonjsGlobal=Cl;exports.customAlphabet=wm;exports.dd=il;exports.dimensions=Fu;exports.executeInitialSetter=Pr;exports.executeSetter=cs;exports.fontString=rc;exports.ft=fu;exports.g=M;exports.g$1=wl;exports.getAugmentedNamespace=Rl;exports.getDefaultExportFromCjs=jl;exports.i=Pa;exports.isSetter=us;exports.iy=gm;exports.jd=ry;exports.kd=jd;exports.l=ku;exports.levelZ=qu;exports.lt=wu;exports.m=Y;exports.n=Tu;exports.nanoid=vm;exports.o=Ou;exports.o$1=Vl;exports.prettyParse=ts;exports.q=hu;exports.r=Wl;exports.re=ge;exports.render=Ol;exports.specZ=Ge;exports.specZ$1=Al;exports.state=_u;exports.themeZ=ni;exports.use=yw;exports.useAggregate=gw;exports.useOptionalAggregate=mw;exports.usePassthrough=Qa;exports.usePurePassthrough=ei;exports.variantZ=Sl;exports.w=K;exports.w$1=qa;exports.yd=ol;exports.z=Pu;exports.ze=pe;
|