@overdoser/react-toolkit 0.20.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +41 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.scss.js +19 -35
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.scss.js +24 -46
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +93 -96
  9. package/components/Alert/Alert.module.scss.js +17 -32
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.scss.js +22 -42
  12. package/components/Badge/Badge.js +15 -37
  13. package/components/Badge/Badge.module.scss.js +16 -30
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.scss.js +24 -46
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.scss.js +34 -59
  21. package/components/Chart/AreaChart.d.ts +1 -1
  22. package/components/Chart/AreaChart.js +248 -249
  23. package/components/Chart/Axis.d.ts +2 -2
  24. package/components/Chart/Axis.js +34 -43
  25. package/components/Chart/BarChart.d.ts +1 -1
  26. package/components/Chart/BarChart.js +307 -348
  27. package/components/Chart/Chart.module.scss.js +31 -60
  28. package/components/Chart/ChartContainer.js +33 -41
  29. package/components/Chart/ChartLegend.d.ts +1 -1
  30. package/components/Chart/ChartLegend.js +31 -30
  31. package/components/Chart/ChartTooltip.d.ts +1 -1
  32. package/components/Chart/ChartTooltip.js +45 -40
  33. package/components/Chart/LineChart.d.ts +1 -1
  34. package/components/Chart/LineChart.js +220 -232
  35. package/components/Chart/PieChart.d.ts +1 -1
  36. package/components/Chart/PieChart.js +224 -240
  37. package/components/Chart/RadarChart.d.ts +1 -1
  38. package/components/Chart/RadarChart.js +166 -215
  39. package/components/Chart/Sparkline.js +73 -68
  40. package/components/Chart/TradingChart.d.ts +1 -1
  41. package/components/Chart/TradingChart.js +804 -701
  42. package/components/Chart/scales.js +28 -35
  43. package/components/Chart/trading/indicators.js +61 -62
  44. package/components/Chart/trading/period.js +46 -68
  45. package/components/Chart/useChartDimensions.js +30 -22
  46. package/components/Chip/Chip.js +98 -141
  47. package/components/Chip/Chip.module.scss.js +31 -58
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.scss.js +16 -30
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.scss.js +9 -16
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.scss.js +65 -118
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.scss.js +28 -52
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +13 -11
  67. package/components/Dropdown/dropdownContext.js +4 -5
  68. package/components/Dropdown/useContextMenu.js +27 -17
  69. package/components/Dropzone/Dropzone.js +99 -105
  70. package/components/Dropzone/Dropzone.module.scss.js +11 -20
  71. package/components/EmptyState/EmptyState.js +57 -54
  72. package/components/EmptyState/EmptyState.module.scss.js +13 -24
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +31 -34
  75. package/components/Form/Form.module.scss.js +15 -28
  76. package/components/Form/FormField.d.ts +1 -1
  77. package/components/Form/FormField.js +71 -75
  78. package/components/Form/FormRow.d.ts +1 -1
  79. package/components/Form/FormRow.js +11 -8
  80. package/components/Form/formFieldDefaults.js +4 -5
  81. package/components/ImageViewer/ImageViewer.js +312 -201
  82. package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +24 -21
  85. package/components/Kbd/Kbd.module.scss.js +9 -16
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.scss.js +9 -15
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.scss.js +11 -20
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.scss.js +39 -69
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.scss.js +17 -32
  96. package/components/PageHeader/PageHeader.js +79 -73
  97. package/components/PageHeader/PageHeader.module.scss.js +22 -42
  98. package/components/Pagination/Pagination.js +62 -83
  99. package/components/Pagination/Pagination.module.scss.js +12 -22
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.scss.js +11 -20
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +56 -89
  105. package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
  108. package/components/SegmentedControl/SegmentedControl.js +93 -129
  109. package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.scss.js +14 -24
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.scss.js +11 -19
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.scss.js +30 -56
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.scss.js +13 -24
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.scss.js +41 -71
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.scss.js +17 -31
  122. package/components/Table/Table.d.ts +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.scss.js +41 -80
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.scss.js +27 -52
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.scss.js +28 -54
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
  134. package/components/Timeline/Timeline.module.scss.js +75 -140
  135. package/components/Timeline/TimelineShared.d.ts +7 -7
  136. package/components/Timeline/TimelineShared.js +288 -279
  137. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  138. package/components/Timeline/TraceEventDetails.js +244 -177
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.scss.js +97 -188
  141. package/components/Timeline/historyLayout.js +336 -263
  142. package/components/Timeline/timelineCore.js +208 -183
  143. package/components/Timeline/traceEvent.js +59 -61
  144. package/components/Timeline/traceLayout.js +101 -90
  145. package/components/Timeline/useTimeline.js +76 -79
  146. package/components/Timer/Timer.js +190 -156
  147. package/components/Timer/Timer.module.scss.js +28 -54
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.scss.js +36 -61
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +36 -58
  153. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.scss.js +16 -29
  157. package/components/Typography/Typography.js +10 -35
  158. package/components/Typography/Typography.module.scss.js +29 -52
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
  163. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  164. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  165. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
  168. package/components/inputs/DatePicker/dateUtils.js +32 -41
  169. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  170. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
  171. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  172. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  173. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  174. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  175. package/components/inputs/Input/Input.js +98 -109
  176. package/components/inputs/Input/Input.module.scss.js +14 -26
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.scss.js +8 -14
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
  183. package/components/inputs/Select/Select.d.ts +55 -3
  184. package/components/inputs/Select/Select.js +696 -682
  185. package/components/inputs/Select/Select.module.scss.js +49 -72
  186. package/components/inputs/Slider/Slider.js +97 -128
  187. package/components/inputs/Slider/Slider.module.scss.js +8 -14
  188. package/components/inputs/Switch/Switch.js +11 -8
  189. package/components/inputs/Textarea/Textarea.js +42 -58
  190. package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
  191. package/hooks/useClickOutside.js +17 -14
  192. package/hooks/useDebouncedValue.js +13 -14
  193. package/hooks/useElementSize.js +27 -22
  194. package/hooks/useEscapeLayer.js +28 -29
  195. package/hooks/useFocusTrap.js +27 -38
  196. package/hooks/useKeyboard.js +76 -64
  197. package/hooks/useMediaQuery.js +10 -15
  198. package/hooks/useNow.js +28 -33
  199. package/hooks/usePersistedState.js +98 -94
  200. package/hooks/usePortalPosition.d.ts +2 -1
  201. package/hooks/usePortalPosition.js +28 -19
  202. package/hooks/useResizable.js +106 -104
  203. package/hooks/useTheme.js +28 -23
  204. package/index.css +2 -1
  205. package/index.js +96 -214
  206. package/index.layered.css +2 -3
  207. package/llms.txt +28 -4
  208. package/manifest.json +41 -4
  209. package/package.json +1 -1
  210. package/utils/formatBytes.js +29 -13
  211. package/utils/themeScript.js +6 -8
  212. package/utils/timeAgo.js +59 -32
@@ -1,135 +1,134 @@
1
- import { jsxs as H, jsx as d } from "react/jsx-runtime";
2
- import { useMemo as b, useRef as g, useEffect as w } from "react";
3
- import x from "clsx";
4
- import S from "./DateTimePicker.module.scss.js";
5
- const y = (n) => String(n).padStart(2, "0");
6
- function A(n, r, l) {
7
- const a = /* @__PURE__ */ new Set();
8
- for (let o = 0; o <= n; o += Math.max(1, Math.floor(r))) a.add(o);
9
- return a.add(l), Array.from(a).sort((o, f) => o - f).map((o) => ({ value: o, label: y(o) }));
1
+ import { useEffect as e, useMemo as t, useRef as n } from "react";
2
+ import r from "clsx";
3
+ import i from "./DateTimePicker.module.scss.js";
4
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ // src/components/inputs/DateTimePicker/TimeField.tsx
6
+ var s = (e) => String(e).padStart(2, "0");
7
+ function c(e, t, n) {
8
+ let r = /* @__PURE__ */ new Set();
9
+ for (let n = 0; n <= e; n += Math.max(1, Math.floor(t))) r.add(n);
10
+ return r.add(n), Array.from(r).sort((e, t) => e - t).map((e) => ({
11
+ value: e,
12
+ label: s(e)
13
+ }));
10
14
  }
11
- function v({ label: n, items: r, selected: l, onSelect: a, disabled: o, classes: f }) {
12
- const m = g(null), u = g(!1);
13
- w(() => {
14
- const e = m.current, t = e?.querySelector('[aria-selected="true"]');
15
- e && t && (e.scrollTop = t.offsetTop - e.clientHeight / 2 + t.offsetHeight / 2);
16
- }, []), w(() => {
17
- if (!u.current) return;
18
- u.current = !1;
19
- const e = m.current?.querySelector('[aria-selected="true"]');
20
- e?.focus(), e?.scrollIntoView?.({ block: "nearest" });
21
- }, [l]);
22
- const i = (e) => {
23
- const t = r.findIndex((h) => h.value === l);
24
- let s = t;
25
- switch (e.key) {
26
- case "ArrowDown":
27
- s = (t + 1) % r.length;
28
- break;
29
- case "ArrowUp":
30
- s = (t - 1 + r.length) % r.length;
31
- break;
32
- case "Home":
33
- s = 0;
34
- break;
35
- case "End":
36
- s = r.length - 1;
37
- break;
38
- default:
39
- return;
40
- }
41
- e.preventDefault(), s !== t && (u.current = !0, a(r[s].value));
42
- };
43
- return (
44
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
45
- /* @__PURE__ */ d(
46
- "div",
47
- {
48
- ref: m,
49
- role: "listbox",
50
- "aria-label": n,
51
- className: x(S.column, f?.column),
52
- onKeyDown: i,
53
- children: r.map((e) => {
54
- const t = e.value === l;
55
- return /* @__PURE__ */ d(
56
- "button",
57
- {
58
- type: "button",
59
- role: "option",
60
- "aria-selected": t,
61
- tabIndex: t ? 0 : -1,
62
- disabled: o,
63
- className: x(S.option, t && S.optionSelected, f?.option, t && f?.optionSelected),
64
- onClick: () => a(e.value),
65
- children: e.label
66
- },
67
- e.value
68
- );
69
- })
70
- }
71
- )
72
- );
15
+ function l({ label: t, items: o, selected: s, onSelect: c, disabled: l, classes: u }) {
16
+ let d = n(null), f = n(!1);
17
+ return e(() => {
18
+ let e = d.current, t = e?.querySelector("[aria-selected=\"true\"]");
19
+ e && t && (e.scrollTop = t.offsetTop - e.clientHeight / 2 + t.offsetHeight / 2);
20
+ }, []), e(() => {
21
+ if (!f.current) return;
22
+ f.current = !1;
23
+ let e = d.current?.querySelector("[aria-selected=\"true\"]");
24
+ e?.focus(), e?.scrollIntoView?.({ block: "nearest" });
25
+ }, [s]), /* @__PURE__ */ a("div", {
26
+ ref: d,
27
+ role: "listbox",
28
+ "aria-label": t,
29
+ className: r(i.column, u?.column),
30
+ onKeyDown: (e) => {
31
+ let t = o.findIndex((e) => e.value === s), n = t;
32
+ switch (e.key) {
33
+ case "ArrowDown":
34
+ n = (t + 1) % o.length;
35
+ break;
36
+ case "ArrowUp":
37
+ n = (t - 1 + o.length) % o.length;
38
+ break;
39
+ case "Home":
40
+ n = 0;
41
+ break;
42
+ case "End":
43
+ n = o.length - 1;
44
+ break;
45
+ default: return;
46
+ }
47
+ e.preventDefault(), n !== t && (f.current = !0, c(o[n].value));
48
+ },
49
+ children: o.map((e) => {
50
+ let t = e.value === s;
51
+ return /* @__PURE__ */ a("button", {
52
+ type: "button",
53
+ role: "option",
54
+ "aria-selected": t,
55
+ tabIndex: t ? 0 : -1,
56
+ disabled: l,
57
+ className: r(i.option, t && i.optionSelected, u?.option, t && u?.optionSelected),
58
+ onClick: () => c(e.value),
59
+ children: e.label
60
+ }, e.value);
61
+ })
62
+ });
73
63
  }
74
- function j({
75
- hour: n,
76
- minute: r,
77
- second: l,
78
- onChange: a,
79
- hourCycle: o,
80
- showSeconds: f,
81
- minuteStep: m,
82
- disabled: u,
83
- classes: i
84
- }) {
85
- const e = o === 12, t = n >= 12, s = b(() => e ? Array.from({ length: 12 }, (c, p) => ({ value: p + (t ? 12 : 0), label: y(p === 0 ? 12 : p) })) : Array.from({ length: 24 }, (c, p) => ({ value: p, label: y(p) })), [e, t]), h = b(() => A(59, m, r), [m, r]), M = b(() => A(59, 1, l), [l]), k = b(() => [{ value: 0, label: "AM" }, { value: 1, label: "PM" }], []);
86
- return /* @__PURE__ */ H("div", { className: x(S.time, i?.time), role: "group", "aria-label": "Time", children: [
87
- /* @__PURE__ */ d(
88
- v,
89
- {
90
- label: "Hours",
91
- items: s,
92
- selected: n,
93
- onSelect: (c) => a({ hour: c, minute: r, second: l }),
94
- disabled: u,
95
- classes: i
96
- }
97
- ),
98
- /* @__PURE__ */ d(
99
- v,
100
- {
101
- label: "Minutes",
102
- items: h,
103
- selected: r,
104
- onSelect: (c) => a({ hour: n, minute: c, second: l }),
105
- disabled: u,
106
- classes: i
107
- }
108
- ),
109
- f && /* @__PURE__ */ d(
110
- v,
111
- {
112
- label: "Seconds",
113
- items: M,
114
- selected: l,
115
- onSelect: (c) => a({ hour: n, minute: r, second: c }),
116
- disabled: u,
117
- classes: i
118
- }
119
- ),
120
- e && /* @__PURE__ */ d(
121
- v,
122
- {
123
- label: "AM/PM",
124
- items: k,
125
- selected: t ? 1 : 0,
126
- onSelect: (c) => a({ hour: n % 12 + (c ? 12 : 0), minute: r, second: l }),
127
- disabled: u,
128
- classes: i
129
- }
130
- )
131
- ] });
64
+ function u({ hour: e, minute: n, second: u, onChange: d, hourCycle: f, showSeconds: p, minuteStep: m, disabled: h, classes: g }) {
65
+ let _ = f === 12, v = e >= 12, y = t(() => _ ? Array.from({ length: 12 }, (e, t) => ({
66
+ value: t + (v ? 12 : 0),
67
+ label: s(t === 0 ? 12 : t)
68
+ })) : Array.from({ length: 24 }, (e, t) => ({
69
+ value: t,
70
+ label: s(t)
71
+ })), [_, v]), b = t(() => c(59, m, n), [m, n]), x = t(() => c(59, 1, u), [u]), S = t(() => [{
72
+ value: 0,
73
+ label: "AM"
74
+ }, {
75
+ value: 1,
76
+ label: "PM"
77
+ }], []);
78
+ return /* @__PURE__ */ o("div", {
79
+ className: r(i.time, g?.time),
80
+ role: "group",
81
+ "aria-label": "Time",
82
+ children: [
83
+ /* @__PURE__ */ a(l, {
84
+ label: "Hours",
85
+ items: y,
86
+ selected: e,
87
+ onSelect: (e) => d({
88
+ hour: e,
89
+ minute: n,
90
+ second: u
91
+ }),
92
+ disabled: h,
93
+ classes: g
94
+ }),
95
+ /* @__PURE__ */ a(l, {
96
+ label: "Minutes",
97
+ items: b,
98
+ selected: n,
99
+ onSelect: (t) => d({
100
+ hour: e,
101
+ minute: t,
102
+ second: u
103
+ }),
104
+ disabled: h,
105
+ classes: g
106
+ }),
107
+ p && /* @__PURE__ */ a(l, {
108
+ label: "Seconds",
109
+ items: x,
110
+ selected: u,
111
+ onSelect: (t) => d({
112
+ hour: e,
113
+ minute: n,
114
+ second: t
115
+ }),
116
+ disabled: h,
117
+ classes: g
118
+ }),
119
+ _ && /* @__PURE__ */ a(l, {
120
+ label: "AM/PM",
121
+ items: S,
122
+ selected: +!!v,
123
+ onSelect: (t) => d({
124
+ hour: e % 12 + (t ? 12 : 0),
125
+ minute: n,
126
+ second: u
127
+ }),
128
+ disabled: h,
129
+ classes: g
130
+ })
131
+ ]
132
+ });
132
133
  }
133
- export {
134
- j as TimeField
135
- };
134
+ export { u as TimeField };
@@ -1,102 +1,105 @@
1
- const i = /* @__PURE__ */ new Map();
2
- function c(e) {
3
- let t = i.get(e);
4
- return t || (t = new Intl.DateTimeFormat("en-US", {
5
- timeZone: e,
6
- hourCycle: "h23",
7
- year: "numeric",
8
- month: "numeric",
9
- day: "numeric",
10
- hour: "numeric",
11
- minute: "numeric",
12
- second: "numeric"
13
- }), i.set(e, t)), t;
1
+ // src/components/inputs/DateTimePicker/timeZoneUtils.ts
2
+ var e = /* @__PURE__ */ new Map();
3
+ function t(t) {
4
+ let n = e.get(t);
5
+ return n || (n = new Intl.DateTimeFormat("en-US", {
6
+ timeZone: t,
7
+ hourCycle: "h23",
8
+ year: "numeric",
9
+ month: "numeric",
10
+ day: "numeric",
11
+ hour: "numeric",
12
+ minute: "numeric",
13
+ second: "numeric"
14
+ }), e.set(t, n)), n;
14
15
  }
15
- function h(e) {
16
- try {
17
- return c(e), !0;
18
- } catch {
19
- return !1;
20
- }
16
+ function n(e) {
17
+ try {
18
+ return t(e), !0;
19
+ } catch {
20
+ return !1;
21
+ }
21
22
  }
22
- function y() {
23
- return new Intl.DateTimeFormat().resolvedOptions().timeZone;
23
+ function r() {
24
+ return new Intl.DateTimeFormat().resolvedOptions().timeZone;
24
25
  }
25
- function f(e, t) {
26
- if (!t)
27
- return {
28
- year: e.getFullYear(),
29
- month: e.getMonth(),
30
- day: e.getDate(),
31
- hour: e.getHours(),
32
- minute: e.getMinutes(),
33
- second: e.getSeconds()
34
- };
35
- const n = { year: 0, month: 0, day: 1, hour: 0, minute: 0, second: 0 };
36
- for (const r of c(t).formatToParts(e))
37
- switch (r.type) {
38
- case "year":
39
- n.year = Number(r.value);
40
- break;
41
- case "month":
42
- n.month = Number(r.value) - 1;
43
- break;
44
- case "day":
45
- n.day = Number(r.value);
46
- break;
47
- case "hour":
48
- n.hour = Number(r.value) % 24;
49
- break;
50
- case "minute":
51
- n.minute = Number(r.value);
52
- break;
53
- case "second":
54
- n.second = Number(r.value);
55
- break;
56
- }
57
- return n;
26
+ function i(e, n) {
27
+ if (!n) return {
28
+ year: e.getFullYear(),
29
+ month: e.getMonth(),
30
+ day: e.getDate(),
31
+ hour: e.getHours(),
32
+ minute: e.getMinutes(),
33
+ second: e.getSeconds()
34
+ };
35
+ let r = {
36
+ year: 0,
37
+ month: 0,
38
+ day: 1,
39
+ hour: 0,
40
+ minute: 0,
41
+ second: 0
42
+ };
43
+ for (let i of t(n).formatToParts(e)) switch (i.type) {
44
+ case "year":
45
+ r.year = Number(i.value);
46
+ break;
47
+ case "month":
48
+ r.month = Number(i.value) - 1;
49
+ break;
50
+ case "day":
51
+ r.day = Number(i.value);
52
+ break;
53
+ case "hour":
54
+ r.hour = Number(i.value) % 24;
55
+ break;
56
+ case "minute":
57
+ r.minute = Number(i.value);
58
+ break;
59
+ case "second": r.second = Number(i.value);
60
+ }
61
+ return r;
58
62
  }
59
- function l(e) {
60
- const t = /* @__PURE__ */ new Date(0);
61
- return t.setUTCFullYear(e.year, e.month, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t.getTime();
63
+ function a(e) {
64
+ let t = /* @__PURE__ */ new Date(0);
65
+ return t.setUTCFullYear(e.year, e.month, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t.getTime();
62
66
  }
63
- function s(e, t) {
64
- return l(f(e, t)) - Math.floor(e.getTime() / 1e3) * 1e3;
67
+ function o(e, t) {
68
+ return a(i(e, t)) - Math.floor(e.getTime() / 1e3) * 1e3;
65
69
  }
66
- function d(e, t) {
67
- if (!t) {
68
- const a = new Date(e.year, e.month, e.day, e.hour, e.minute, e.second, 0);
69
- return e.year >= 0 && e.year < 100 && a.setFullYear(e.year), a;
70
- }
71
- const n = l(e), r = 864e5, u = new Set([n - r, n, n + r].map((a) => s(new Date(a), t))), o = [];
72
- for (const a of u) {
73
- const m = n - a;
74
- s(new Date(m), t) === a && o.push(m);
75
- }
76
- return o.length > 0 ? new Date(Math.min(...o)) : new Date(n - s(new Date(n - r), t));
70
+ function s(e, t) {
71
+ if (!t) {
72
+ let t = new Date(e.year, e.month, e.day, e.hour, e.minute, e.second, 0);
73
+ return e.year >= 0 && e.year < 100 && t.setFullYear(e.year), t;
74
+ }
75
+ let n = a(e), r = 864e5, i = new Set([
76
+ n - r,
77
+ n,
78
+ n + r
79
+ ].map((e) => o(new Date(e), t))), s = [];
80
+ for (let e of i) {
81
+ let r = n - e;
82
+ o(new Date(r), t) === e && s.push(r);
83
+ }
84
+ return s.length > 0 ? new Date(Math.min(...s)) : new Date(n - o(/* @__PURE__ */ new Date(n - r), t));
77
85
  }
78
- function D(e) {
79
- const t = new Date(e.year, e.month, e.day);
80
- return e.year >= 0 && e.year < 100 && t.setFullYear(e.year), t;
86
+ function c(e) {
87
+ let t = new Date(e.year, e.month, e.day);
88
+ return e.year >= 0 && e.year < 100 && t.setFullYear(e.year), t;
81
89
  }
82
- function b(e, t, n, r = "short") {
83
- const u = (o) => new Intl.DateTimeFormat(n, { timeZone: t, timeZoneName: o }).formatToParts(e).find((a) => a.type === "timeZoneName")?.value ?? "";
84
- try {
85
- return u(r);
86
- } catch {
87
- return u("short");
88
- }
90
+ function l(e, t, n, r = "short") {
91
+ let i = (r) => new Intl.DateTimeFormat(n, {
92
+ timeZone: t,
93
+ timeZoneName: r
94
+ }).formatToParts(e).find((e) => e.type === "timeZoneName")?.value ?? "";
95
+ try {
96
+ return i(r);
97
+ } catch {
98
+ return i("short");
99
+ }
89
100
  }
90
- function T(e) {
91
- const t = new Intl.DateTimeFormat(e, { hour: "numeric" }).resolvedOptions().hourCycle;
92
- return t === "h11" || t === "h12" ? 12 : 24;
101
+ function u(e) {
102
+ let t = new Intl.DateTimeFormat(e, { hour: "numeric" }).resolvedOptions().hourCycle;
103
+ return t === "h11" || t === "h12" ? 12 : 24;
93
104
  }
94
- export {
95
- d as fromWallClock,
96
- f as getWallClock,
97
- h as isValidTimeZone,
98
- y as localTimeZone,
99
- T as localeHourCycle,
100
- b as timeZoneName,
101
- D as wallClockDay
102
- };
105
+ export { s as fromWallClock, i as getWallClock, n as isValidTimeZone, r as localTimeZone, u as localeHourCycle, l as timeZoneName, c as wallClockDay };