@leonardaustin/ui 0.1.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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/components/app-shell/AppShell.d.ts +38 -0
- package/dist/components/app-shell/AppShell.d.ts.map +1 -0
- package/dist/components/app-shell/AuthLayout.d.ts +7 -0
- package/dist/components/app-shell/AuthLayout.d.ts.map +1 -0
- package/dist/components/app-shell/BackLink.d.ts +10 -0
- package/dist/components/app-shell/BackLink.d.ts.map +1 -0
- package/dist/components/app-shell/BottomNav.d.ts +10 -0
- package/dist/components/app-shell/BottomNav.d.ts.map +1 -0
- package/dist/components/app-shell/Breadcrumbs.d.ts +9 -0
- package/dist/components/app-shell/Breadcrumbs.d.ts.map +1 -0
- package/dist/components/app-shell/CommandPalette.d.ts +19 -0
- package/dist/components/app-shell/CommandPalette.d.ts.map +1 -0
- package/dist/components/app-shell/MobileDrawer.d.ts +13 -0
- package/dist/components/app-shell/MobileDrawer.d.ts.map +1 -0
- package/dist/components/app-shell/Sidebar.d.ts +20 -0
- package/dist/components/app-shell/Sidebar.d.ts.map +1 -0
- package/dist/components/app-shell/TopBar.d.ts +15 -0
- package/dist/components/app-shell/TopBar.d.ts.map +1 -0
- package/dist/components/app-shell/commandPaletteEvents.d.ts +12 -0
- package/dist/components/app-shell/commandPaletteEvents.d.ts.map +1 -0
- package/dist/components/app-shell/navigation.d.ts +7 -0
- package/dist/components/app-shell/navigation.d.ts.map +1 -0
- package/dist/components/app-shell/types.d.ts +33 -0
- package/dist/components/app-shell/types.d.ts.map +1 -0
- package/dist/components/charts/AreaChart.d.ts +10 -0
- package/dist/components/charts/AreaChart.d.ts.map +1 -0
- package/dist/components/charts/BarChart.d.ts +10 -0
- package/dist/components/charts/BarChart.d.ts.map +1 -0
- package/dist/components/charts/DonutChart.d.ts +12 -0
- package/dist/components/charts/DonutChart.d.ts.map +1 -0
- package/dist/components/charts/RadarChart.d.ts +13 -0
- package/dist/components/charts/RadarChart.d.ts.map +1 -0
- package/dist/components/charts/RadialBarChart.d.ts +13 -0
- package/dist/components/charts/RadialBarChart.d.ts.map +1 -0
- package/dist/components/charts/SparkLine.d.ts +7 -0
- package/dist/components/charts/SparkLine.d.ts.map +1 -0
- package/dist/components/charts/VerticalBarChart.d.ts +11 -0
- package/dist/components/charts/VerticalBarChart.d.ts.map +1 -0
- package/dist/components/tables/ColumnPicker.d.ts +33 -0
- package/dist/components/tables/ColumnPicker.d.ts.map +1 -0
- package/dist/components/tables/Pagination.d.ts +8 -0
- package/dist/components/tables/Pagination.d.ts.map +1 -0
- package/dist/components/tables/ResourceTable.d.ts +56 -0
- package/dist/components/tables/ResourceTable.d.ts.map +1 -0
- package/dist/components/tables/sortRows.d.ts +13 -0
- package/dist/components/tables/sortRows.d.ts.map +1 -0
- package/dist/components/ui/Alert.d.ts +11 -0
- package/dist/components/ui/Alert.d.ts.map +1 -0
- package/dist/components/ui/AuthCard.d.ts +11 -0
- package/dist/components/ui/AuthCard.d.ts.map +1 -0
- package/dist/components/ui/AuthorByline.d.ts +57 -0
- package/dist/components/ui/AuthorByline.d.ts.map +1 -0
- package/dist/components/ui/Avatar.d.ts +8 -0
- package/dist/components/ui/Avatar.d.ts.map +1 -0
- package/dist/components/ui/Badge.d.ts +10 -0
- package/dist/components/ui/Badge.d.ts.map +1 -0
- package/dist/components/ui/Button.d.ts +63 -0
- package/dist/components/ui/Button.d.ts.map +1 -0
- package/dist/components/ui/CalendarGrid.d.ts +23 -0
- package/dist/components/ui/CalendarGrid.d.ts.map +1 -0
- package/dist/components/ui/Card.d.ts +9 -0
- package/dist/components/ui/Card.d.ts.map +1 -0
- package/dist/components/ui/Checkbox.d.ts +10 -0
- package/dist/components/ui/Checkbox.d.ts.map +1 -0
- package/dist/components/ui/Combobox.d.ts +15 -0
- package/dist/components/ui/Combobox.d.ts.map +1 -0
- package/dist/components/ui/DangerZone.d.ts +40 -0
- package/dist/components/ui/DangerZone.d.ts.map +1 -0
- package/dist/components/ui/DatePicker.d.ts +11 -0
- package/dist/components/ui/DatePicker.d.ts.map +1 -0
- package/dist/components/ui/DateRangePicker.d.ts +13 -0
- package/dist/components/ui/DateRangePicker.d.ts.map +1 -0
- package/dist/components/ui/DateTimePicker.d.ts +9 -0
- package/dist/components/ui/DateTimePicker.d.ts.map +1 -0
- package/dist/components/ui/DetailPanel.d.ts +19 -0
- package/dist/components/ui/DetailPanel.d.ts.map +1 -0
- package/dist/components/ui/Dialog.d.ts +28 -0
- package/dist/components/ui/Dialog.d.ts.map +1 -0
- package/dist/components/ui/DialogActions.d.ts +52 -0
- package/dist/components/ui/DialogActions.d.ts.map +1 -0
- package/dist/components/ui/DividerLabel.d.ts +7 -0
- package/dist/components/ui/DividerLabel.d.ts.map +1 -0
- package/dist/components/ui/DropdownMenu.d.ts +27 -0
- package/dist/components/ui/DropdownMenu.d.ts.map +1 -0
- package/dist/components/ui/EmptyState.d.ts +11 -0
- package/dist/components/ui/EmptyState.d.ts.map +1 -0
- package/dist/components/ui/ErrorBoundary.d.ts +16 -0
- package/dist/components/ui/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/ui/FilterButton.d.ts +47 -0
- package/dist/components/ui/FilterButton.d.ts.map +1 -0
- package/dist/components/ui/FilterDropdown.d.ts +50 -0
- package/dist/components/ui/FilterDropdown.d.ts.map +1 -0
- package/dist/components/ui/Kbd.d.ts +7 -0
- package/dist/components/ui/Kbd.d.ts.map +1 -0
- package/dist/components/ui/LoadingSpinner.d.ts +7 -0
- package/dist/components/ui/LoadingSpinner.d.ts.map +1 -0
- package/dist/components/ui/MetadataGrid.d.ts +45 -0
- package/dist/components/ui/MetadataGrid.d.ts.map +1 -0
- package/dist/components/ui/MetricCard.d.ts +12 -0
- package/dist/components/ui/MetricCard.d.ts.map +1 -0
- package/dist/components/ui/OAuthButton.d.ts +8 -0
- package/dist/components/ui/OAuthButton.d.ts.map +1 -0
- package/dist/components/ui/PageHeader.d.ts +44 -0
- package/dist/components/ui/PageHeader.d.ts.map +1 -0
- package/dist/components/ui/PageSection.d.ts +13 -0
- package/dist/components/ui/PageSection.d.ts.map +1 -0
- package/dist/components/ui/PaginationBar.d.ts +58 -0
- package/dist/components/ui/PaginationBar.d.ts.map +1 -0
- package/dist/components/ui/PasswordInput.d.ts +8 -0
- package/dist/components/ui/PasswordInput.d.ts.map +1 -0
- package/dist/components/ui/ProfileHeader.d.ts +54 -0
- package/dist/components/ui/ProfileHeader.d.ts.map +1 -0
- package/dist/components/ui/ProseContent.d.ts +7 -0
- package/dist/components/ui/ProseContent.d.ts.map +1 -0
- package/dist/components/ui/RadioPill.d.ts +14 -0
- package/dist/components/ui/RadioPill.d.ts.map +1 -0
- package/dist/components/ui/SearchInput.d.ts +8 -0
- package/dist/components/ui/SearchInput.d.ts.map +1 -0
- package/dist/components/ui/SectionHeader.d.ts +35 -0
- package/dist/components/ui/SectionHeader.d.ts.map +1 -0
- package/dist/components/ui/Select.d.ts +12 -0
- package/dist/components/ui/Select.d.ts.map +1 -0
- package/dist/components/ui/SelectDropdown.d.ts +16 -0
- package/dist/components/ui/SelectDropdown.d.ts.map +1 -0
- package/dist/components/ui/SettingRow.d.ts +42 -0
- package/dist/components/ui/SettingRow.d.ts.map +1 -0
- package/dist/components/ui/SideSheet.d.ts +14 -0
- package/dist/components/ui/SideSheet.d.ts.map +1 -0
- package/dist/components/ui/Slider.d.ts +14 -0
- package/dist/components/ui/Slider.d.ts.map +1 -0
- package/dist/components/ui/SplitPaneLayout.d.ts +73 -0
- package/dist/components/ui/SplitPaneLayout.d.ts.map +1 -0
- package/dist/components/ui/StatusDot.d.ts +9 -0
- package/dist/components/ui/StatusDot.d.ts.map +1 -0
- package/dist/components/ui/StepProgress.d.ts +11 -0
- package/dist/components/ui/StepProgress.d.ts.map +1 -0
- package/dist/components/ui/Tabs.d.ts +18 -0
- package/dist/components/ui/Tabs.d.ts.map +1 -0
- package/dist/components/ui/TextInput.d.ts +13 -0
- package/dist/components/ui/TextInput.d.ts.map +1 -0
- package/dist/components/ui/Textarea.d.ts +9 -0
- package/dist/components/ui/Textarea.d.ts.map +1 -0
- package/dist/components/ui/ThemePreview.d.ts +14 -0
- package/dist/components/ui/ThemePreview.d.ts.map +1 -0
- package/dist/components/ui/Timeline.d.ts +39 -0
- package/dist/components/ui/Timeline.d.ts.map +1 -0
- package/dist/components/ui/Toast.d.ts +21 -0
- package/dist/components/ui/Toast.d.ts.map +1 -0
- package/dist/components/ui/Toggle.d.ts +9 -0
- package/dist/components/ui/Toggle.d.ts.map +1 -0
- package/dist/components/ui/Toolbar.d.ts +11 -0
- package/dist/components/ui/Toolbar.d.ts.map +1 -0
- package/dist/components/ui/Tooltip.d.ts +10 -0
- package/dist/components/ui/Tooltip.d.ts.map +1 -0
- package/dist/components/ui/UploadDropzone.d.ts +13 -0
- package/dist/components/ui/UploadDropzone.d.ts.map +1 -0
- package/dist/config/theme.d.ts +43 -0
- package/dist/config/theme.d.ts.map +1 -0
- package/dist/hooks/useApplyTheme.d.ts +7 -0
- package/dist/hooks/useApplyTheme.d.ts.map +1 -0
- package/dist/hooks/useDismiss.d.ts +8 -0
- package/dist/hooks/useDismiss.d.ts.map +1 -0
- package/dist/hooks/useDropUp.d.ts +7 -0
- package/dist/hooks/useDropUp.d.ts.map +1 -0
- package/dist/hooks/useFocusTrap.d.ts +7 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/hooks/useSettings.d.ts +8 -0
- package/dist/hooks/useSettings.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +6 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4622 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/formatDate.d.ts +28 -0
- package/dist/lib/formatDate.d.ts.map +1 -0
- package/dist/providers/SettingsContext.d.ts +60 -0
- package/dist/providers/SettingsContext.d.ts.map +1 -0
- package/dist/providers/SettingsProvider.d.ts +7 -0
- package/dist/providers/SettingsProvider.d.ts.map +1 -0
- package/dist/providers/ThemeContext.d.ts +8 -0
- package/dist/providers/ThemeContext.d.ts.map +1 -0
- package/dist/providers/ThemeProvider.d.ts +5 -0
- package/dist/providers/ThemeProvider.d.ts.map +1 -0
- package/dist/styles.css +923 -0
- package/package.json +63 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4622 @@
|
|
|
1
|
+
import { Component as e, Fragment as t, createContext as n, forwardRef as r, useCallback as i, useContext as a, useEffect as o, useId as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
2
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
3
|
+
import { clsx as h } from "clsx";
|
|
4
|
+
import { Accessibility as g, AlertTriangle as _, ArrowDown as v, ArrowLeft as y, ArrowUp as b, BookOpen as x, Calendar as S, Check as C, CheckCircle2 as w, ChevronDown as T, ChevronLeft as E, ChevronRight as D, ChevronsUpDown as O, Columns3 as k, Eye as A, EyeOff as j, Inbox as ee, Info as te, Loader2 as ne, LogOut as re, Menu as ie, Minus as ae, Monitor as oe, Moon as se, Palette as ce, PanelLeft as le, PanelLeftDashed as ue, Search as M, Settings as de, Sun as fe, UploadCloud as pe, X as N, XCircle as me, Zap as he } from "lucide-react";
|
|
5
|
+
import { createPortal as P } from "react-dom";
|
|
6
|
+
//#region src/components/charts/AreaChart.tsx
|
|
7
|
+
var F = {
|
|
8
|
+
top: 16,
|
|
9
|
+
right: 12,
|
|
10
|
+
bottom: 28,
|
|
11
|
+
left: 48
|
|
12
|
+
};
|
|
13
|
+
function ge(e) {
|
|
14
|
+
return e >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : String(e);
|
|
15
|
+
}
|
|
16
|
+
function _e({ data: e, height: t = 240 }) {
|
|
17
|
+
let n = s(), r = u(null), [i, a] = d(null), o = 600 - F.left - F.right, c = t - F.top - F.bottom, l = Math.min(...e.map((e) => e.value)), h = Math.max(...e.map((e) => e.value)), g = h - l || 1;
|
|
18
|
+
function _(t) {
|
|
19
|
+
return F.left + t / Math.max(e.length - 1, 1) * o;
|
|
20
|
+
}
|
|
21
|
+
function v(e) {
|
|
22
|
+
return F.top + c - (e - l) / g * c;
|
|
23
|
+
}
|
|
24
|
+
let y = e.map((e, t) => `${_(t)},${v(e.value)}`).join(" "), b = [
|
|
25
|
+
`${_(0)},${F.top + c}`,
|
|
26
|
+
...e.map((e, t) => `${_(t)},${v(e.value)}`),
|
|
27
|
+
`${_(e.length - 1)},${F.top + c}`
|
|
28
|
+
].join(" "), x = Math.max(1, Math.floor(e.length / 5)), S = e.filter((t, n) => n % x === 0 || n === e.length - 1), C = e.map((e, t) => t).filter((t) => t % x === 0 || t === e.length - 1);
|
|
29
|
+
function w(t) {
|
|
30
|
+
let n = r.current;
|
|
31
|
+
if (!n || e.length === 0) return;
|
|
32
|
+
let i = n.getBoundingClientRect(), s = ((t.clientX - i.left) / i.width * 600 - F.left) / o, c = Math.round(s * (e.length - 1)), l = Math.max(0, Math.min(e.length - 1, c));
|
|
33
|
+
a({
|
|
34
|
+
x: _(l),
|
|
35
|
+
y: v(e[l].value),
|
|
36
|
+
index: l
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function T() {
|
|
40
|
+
a(null);
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ m("svg", {
|
|
43
|
+
ref: r,
|
|
44
|
+
width: "100%",
|
|
45
|
+
viewBox: `0 0 600 ${t}`,
|
|
46
|
+
onMouseMove: w,
|
|
47
|
+
onMouseLeave: T,
|
|
48
|
+
className: "select-none",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ p("defs", { children: /* @__PURE__ */ m("linearGradient", {
|
|
51
|
+
id: n,
|
|
52
|
+
x1: "0",
|
|
53
|
+
y1: "0",
|
|
54
|
+
x2: "0",
|
|
55
|
+
y2: "1",
|
|
56
|
+
children: [/* @__PURE__ */ p("stop", {
|
|
57
|
+
offset: "0%",
|
|
58
|
+
stopColor: "var(--accent)",
|
|
59
|
+
stopOpacity: .3
|
|
60
|
+
}), /* @__PURE__ */ p("stop", {
|
|
61
|
+
offset: "100%",
|
|
62
|
+
stopColor: "var(--accent)",
|
|
63
|
+
stopOpacity: 0
|
|
64
|
+
})]
|
|
65
|
+
}) }),
|
|
66
|
+
/* @__PURE__ */ p("text", {
|
|
67
|
+
x: F.left - 8,
|
|
68
|
+
y: F.top,
|
|
69
|
+
textAnchor: "end",
|
|
70
|
+
dominantBaseline: "central",
|
|
71
|
+
fill: "var(--text-tertiary)",
|
|
72
|
+
fontSize: 10,
|
|
73
|
+
children: ge(h)
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ p("text", {
|
|
76
|
+
x: F.left - 8,
|
|
77
|
+
y: F.top + c,
|
|
78
|
+
textAnchor: "end",
|
|
79
|
+
dominantBaseline: "central",
|
|
80
|
+
fill: "var(--text-tertiary)",
|
|
81
|
+
fontSize: 10,
|
|
82
|
+
children: ge(l)
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ p("line", {
|
|
85
|
+
x1: F.left,
|
|
86
|
+
y1: F.top + c,
|
|
87
|
+
x2: F.left + o,
|
|
88
|
+
y2: F.top + c,
|
|
89
|
+
stroke: "var(--border)",
|
|
90
|
+
strokeWidth: 1
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ p("polygon", {
|
|
93
|
+
points: b,
|
|
94
|
+
fill: `url(#${n})`
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ p("polyline", {
|
|
97
|
+
points: y,
|
|
98
|
+
fill: "none",
|
|
99
|
+
stroke: "var(--accent)",
|
|
100
|
+
strokeWidth: 2,
|
|
101
|
+
strokeLinecap: "round",
|
|
102
|
+
strokeLinejoin: "round"
|
|
103
|
+
}),
|
|
104
|
+
S.map((e, n) => /* @__PURE__ */ p("text", {
|
|
105
|
+
x: _(C[n]),
|
|
106
|
+
y: t - 4,
|
|
107
|
+
textAnchor: "middle",
|
|
108
|
+
fill: "var(--text-tertiary)",
|
|
109
|
+
fontSize: 10,
|
|
110
|
+
children: e.date
|
|
111
|
+
}, e.date)),
|
|
112
|
+
i && /* @__PURE__ */ m(f, { children: [
|
|
113
|
+
/* @__PURE__ */ p("line", {
|
|
114
|
+
x1: i.x,
|
|
115
|
+
y1: F.top,
|
|
116
|
+
x2: i.x,
|
|
117
|
+
y2: F.top + c,
|
|
118
|
+
stroke: "var(--border-strong)",
|
|
119
|
+
strokeWidth: 1,
|
|
120
|
+
strokeDasharray: "3 3"
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ p("circle", {
|
|
123
|
+
cx: i.x,
|
|
124
|
+
cy: i.y,
|
|
125
|
+
r: 4,
|
|
126
|
+
fill: "var(--accent)",
|
|
127
|
+
stroke: "var(--bg-secondary)",
|
|
128
|
+
strokeWidth: 2
|
|
129
|
+
}),
|
|
130
|
+
(() => {
|
|
131
|
+
let t = i.y - 38 >= 0 ? i.y - 38 : i.y + 12, n = Math.max(0, Math.min(510, i.x - 90 / 2)), r = n + 90 / 2;
|
|
132
|
+
return /* @__PURE__ */ m(f, { children: [
|
|
133
|
+
/* @__PURE__ */ p("rect", {
|
|
134
|
+
x: n,
|
|
135
|
+
y: t,
|
|
136
|
+
width: 90,
|
|
137
|
+
height: 28,
|
|
138
|
+
rx: 4,
|
|
139
|
+
fill: "var(--bg-tertiary)",
|
|
140
|
+
stroke: "var(--border)",
|
|
141
|
+
strokeWidth: 1
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ p("text", {
|
|
144
|
+
x: r,
|
|
145
|
+
y: t + 10,
|
|
146
|
+
textAnchor: "middle",
|
|
147
|
+
dominantBaseline: "central",
|
|
148
|
+
fill: "var(--text-secondary)",
|
|
149
|
+
fontSize: 9,
|
|
150
|
+
children: e[i.index].date
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ p("text", {
|
|
153
|
+
x: r,
|
|
154
|
+
y: t + 22,
|
|
155
|
+
textAnchor: "middle",
|
|
156
|
+
dominantBaseline: "central",
|
|
157
|
+
fill: "var(--text-primary)",
|
|
158
|
+
fontSize: 11,
|
|
159
|
+
fontWeight: 600,
|
|
160
|
+
children: e[i.index].value.toLocaleString()
|
|
161
|
+
})
|
|
162
|
+
] });
|
|
163
|
+
})()
|
|
164
|
+
] })
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/components/charts/BarChart.tsx
|
|
170
|
+
var ve = [
|
|
171
|
+
1,
|
|
172
|
+
.85,
|
|
173
|
+
.7,
|
|
174
|
+
.55,
|
|
175
|
+
.45
|
|
176
|
+
];
|
|
177
|
+
function ye({ data: e, height: t }) {
|
|
178
|
+
let [n, r] = d(null), i = Math.max(...e.map((e) => e.value));
|
|
179
|
+
return /* @__PURE__ */ p("svg", {
|
|
180
|
+
width: "100%",
|
|
181
|
+
viewBox: `0 0 600 ${t ?? e.length * 38 - 10}`,
|
|
182
|
+
className: "select-none",
|
|
183
|
+
children: e.map((e, t) => {
|
|
184
|
+
let a = t * 38, o = i > 0 ? e.value / i * 380 : 0, s = n === t;
|
|
185
|
+
return /* @__PURE__ */ m("g", {
|
|
186
|
+
onMouseEnter: () => r(t),
|
|
187
|
+
onMouseLeave: () => r(null),
|
|
188
|
+
className: "cursor-pointer",
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ p("rect", {
|
|
191
|
+
x: 0,
|
|
192
|
+
y: a,
|
|
193
|
+
width: 600,
|
|
194
|
+
height: 28,
|
|
195
|
+
fill: "transparent"
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ p("text", {
|
|
198
|
+
x: 0,
|
|
199
|
+
y: a + 28 / 2,
|
|
200
|
+
dominantBaseline: "central",
|
|
201
|
+
fill: s ? "var(--text-primary)" : "var(--text-secondary)",
|
|
202
|
+
fontSize: 11,
|
|
203
|
+
fontWeight: s ? 600 : 400,
|
|
204
|
+
style: { transition: "all 150ms" },
|
|
205
|
+
children: e.label
|
|
206
|
+
}),
|
|
207
|
+
/* @__PURE__ */ p("rect", {
|
|
208
|
+
x: 160,
|
|
209
|
+
y: a + 3,
|
|
210
|
+
width: 380,
|
|
211
|
+
height: 22,
|
|
212
|
+
fill: "var(--border)",
|
|
213
|
+
rx: 6,
|
|
214
|
+
opacity: .5
|
|
215
|
+
}),
|
|
216
|
+
/* @__PURE__ */ p("rect", {
|
|
217
|
+
x: 160,
|
|
218
|
+
y: a + 3,
|
|
219
|
+
width: o,
|
|
220
|
+
height: 22,
|
|
221
|
+
fill: "var(--accent)",
|
|
222
|
+
rx: 6,
|
|
223
|
+
opacity: s ? 1 : ve[t % ve.length],
|
|
224
|
+
style: { transition: "all 150ms" }
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ p("text", {
|
|
227
|
+
x: 600,
|
|
228
|
+
y: a + 28 / 2,
|
|
229
|
+
dominantBaseline: "central",
|
|
230
|
+
textAnchor: "end",
|
|
231
|
+
fill: "var(--text-primary)",
|
|
232
|
+
fontSize: 11,
|
|
233
|
+
fontWeight: 600,
|
|
234
|
+
children: e.value.toLocaleString()
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
}, e.label);
|
|
238
|
+
})
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/lib/cn.ts
|
|
243
|
+
var be = new Set([
|
|
244
|
+
"block",
|
|
245
|
+
"contents",
|
|
246
|
+
"flex",
|
|
247
|
+
"grid",
|
|
248
|
+
"hidden",
|
|
249
|
+
"inline",
|
|
250
|
+
"inline-block",
|
|
251
|
+
"inline-flex",
|
|
252
|
+
"table"
|
|
253
|
+
]), xe = new Set([
|
|
254
|
+
"text-2xl",
|
|
255
|
+
"text-2xs",
|
|
256
|
+
"text-2xs-f",
|
|
257
|
+
"text-5xl",
|
|
258
|
+
"text-base",
|
|
259
|
+
"text-body",
|
|
260
|
+
"text-lg",
|
|
261
|
+
"text-sm",
|
|
262
|
+
"text-xl",
|
|
263
|
+
"text-xs"
|
|
264
|
+
]), Se = new Set([
|
|
265
|
+
"text-center",
|
|
266
|
+
"text-left",
|
|
267
|
+
"text-right"
|
|
268
|
+
]), Ce = new Set(["lowercase", "uppercase"]), we = new Set([
|
|
269
|
+
"font-bold",
|
|
270
|
+
"font-medium",
|
|
271
|
+
"font-normal",
|
|
272
|
+
"font-semibold"
|
|
273
|
+
]), Te = {
|
|
274
|
+
m: [
|
|
275
|
+
"margin-top",
|
|
276
|
+
"margin-right",
|
|
277
|
+
"margin-bottom",
|
|
278
|
+
"margin-left"
|
|
279
|
+
],
|
|
280
|
+
mx: ["margin-right", "margin-left"],
|
|
281
|
+
my: ["margin-top", "margin-bottom"],
|
|
282
|
+
mt: ["margin-top"],
|
|
283
|
+
mr: ["margin-right"],
|
|
284
|
+
mb: ["margin-bottom"],
|
|
285
|
+
ml: ["margin-left"],
|
|
286
|
+
p: [
|
|
287
|
+
"padding-top",
|
|
288
|
+
"padding-right",
|
|
289
|
+
"padding-bottom",
|
|
290
|
+
"padding-left"
|
|
291
|
+
],
|
|
292
|
+
px: ["padding-right", "padding-left"],
|
|
293
|
+
py: ["padding-top", "padding-bottom"],
|
|
294
|
+
pt: ["padding-top"],
|
|
295
|
+
pr: ["padding-right"],
|
|
296
|
+
pb: ["padding-bottom"],
|
|
297
|
+
pl: ["padding-left"]
|
|
298
|
+
}, Ee = {
|
|
299
|
+
inset: [
|
|
300
|
+
"top",
|
|
301
|
+
"right",
|
|
302
|
+
"bottom",
|
|
303
|
+
"left"
|
|
304
|
+
],
|
|
305
|
+
"inset-x": ["right", "left"],
|
|
306
|
+
"inset-y": ["top", "bottom"],
|
|
307
|
+
top: ["top"],
|
|
308
|
+
right: ["right"],
|
|
309
|
+
bottom: ["bottom"],
|
|
310
|
+
left: ["left"],
|
|
311
|
+
start: ["inset-inline-start"],
|
|
312
|
+
end: ["inset-inline-end"]
|
|
313
|
+
}, De = {
|
|
314
|
+
border: [
|
|
315
|
+
"border-top-width",
|
|
316
|
+
"border-right-width",
|
|
317
|
+
"border-bottom-width",
|
|
318
|
+
"border-left-width"
|
|
319
|
+
],
|
|
320
|
+
"border-x": ["border-right-width", "border-left-width"],
|
|
321
|
+
"border-y": ["border-top-width", "border-bottom-width"],
|
|
322
|
+
"border-t": ["border-top-width"],
|
|
323
|
+
"border-r": ["border-right-width"],
|
|
324
|
+
"border-b": ["border-bottom-width"],
|
|
325
|
+
"border-l": ["border-left-width"]
|
|
326
|
+
}, Oe = {
|
|
327
|
+
border: [
|
|
328
|
+
"border-top-color",
|
|
329
|
+
"border-right-color",
|
|
330
|
+
"border-bottom-color",
|
|
331
|
+
"border-left-color"
|
|
332
|
+
],
|
|
333
|
+
"border-x": ["border-right-color", "border-left-color"],
|
|
334
|
+
"border-y": ["border-top-color", "border-bottom-color"],
|
|
335
|
+
"border-t": ["border-top-color"],
|
|
336
|
+
"border-r": ["border-right-color"],
|
|
337
|
+
"border-b": ["border-bottom-color"],
|
|
338
|
+
"border-l": ["border-left-color"]
|
|
339
|
+
}, ke = new Set([
|
|
340
|
+
"border-dashed",
|
|
341
|
+
"border-dotted",
|
|
342
|
+
"border-double",
|
|
343
|
+
"border-hidden",
|
|
344
|
+
"border-none",
|
|
345
|
+
"border-solid"
|
|
346
|
+
]);
|
|
347
|
+
function I(...e) {
|
|
348
|
+
return Ae(h(e));
|
|
349
|
+
}
|
|
350
|
+
function Ae(e) {
|
|
351
|
+
let t = [], n = /* @__PURE__ */ new Map();
|
|
352
|
+
for (let r of e.split(/\s+/)) {
|
|
353
|
+
if (!r) continue;
|
|
354
|
+
let e = je(r);
|
|
355
|
+
if (e.size === 0) {
|
|
356
|
+
let i = n.get(r);
|
|
357
|
+
i !== void 0 && (t[i] = null), n.set(r, t.length), t.push({
|
|
358
|
+
token: r,
|
|
359
|
+
keys: e
|
|
360
|
+
});
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
for (let n = t.length - 1; n >= 0; n--) {
|
|
364
|
+
let r = t[n];
|
|
365
|
+
r && Be(r.keys, e) && (t[n] = null);
|
|
366
|
+
}
|
|
367
|
+
t.push({
|
|
368
|
+
token: r,
|
|
369
|
+
keys: e
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
return t.filter((e) => !!e).map((e) => e.token).join(" ");
|
|
373
|
+
}
|
|
374
|
+
function je(e) {
|
|
375
|
+
let t = Me(e), n = t.pop() ?? e, r = n.startsWith("!"), i = Ne(r ? n.slice(1) : n), a = `${t.join(":")}|${r ? "!" : ""}`, o = Pe(i);
|
|
376
|
+
return new Set(o.map((e) => `${a}${e}`));
|
|
377
|
+
}
|
|
378
|
+
function Me(e) {
|
|
379
|
+
let t = [], n = 0, r = 0;
|
|
380
|
+
for (let i = 0; i < e.length; i++) {
|
|
381
|
+
let a = e[i];
|
|
382
|
+
a === "[" && n++, a === "]" && (n = Math.max(0, n - 1)), !(a !== ":" || n > 0) && (t.push(e.slice(r, i)), r = i + 1);
|
|
383
|
+
}
|
|
384
|
+
return t.push(e.slice(r)), t;
|
|
385
|
+
}
|
|
386
|
+
function Ne(e) {
|
|
387
|
+
return e.startsWith("-") ? e.slice(1) : e;
|
|
388
|
+
}
|
|
389
|
+
function Pe(e) {
|
|
390
|
+
let t = Fe(e);
|
|
391
|
+
if (t) return [...Te[t]];
|
|
392
|
+
let n = Ie(e);
|
|
393
|
+
if (n) return [...Ee[n]];
|
|
394
|
+
let r = Le(e);
|
|
395
|
+
if (r) return [...De[r]];
|
|
396
|
+
if (be.has(e)) return ["display"];
|
|
397
|
+
if (e === "absolute" || e === "fixed" || e === "relative" || e === "static" || e === "sticky") return ["position"];
|
|
398
|
+
if (e === "visible" || e === "invisible" || e === "collapse") return ["visibility"];
|
|
399
|
+
if (e === "border-collapse") return ["border-collapse"];
|
|
400
|
+
if (ke.has(e)) return ["border-style"];
|
|
401
|
+
let i = Re(e);
|
|
402
|
+
return i ? [...Oe[i]] : e === "rounded" || e.startsWith("rounded-") ? ["border-radius"] : e.startsWith("bg-") ? ["background"] : xe.has(e) ? ["font-size"] : Se.has(e) ? ["text-align"] : Ce.has(e) ? ["text-transform"] : e.startsWith("text-") ? ["color"] : e === "font-mono" ? ["font-family"] : we.has(e) ? ["font-weight"] : e.startsWith("leading-") ? ["line-height"] : e.startsWith("tracking-") ? ["letter-spacing"] : e.startsWith("w-") ? ["width"] : e.startsWith("min-w-") ? ["min-width"] : e.startsWith("max-w-") ? ["max-width"] : e.startsWith("h-") ? ["height"] : e.startsWith("min-h-") ? ["min-height"] : e.startsWith("max-h-") ? ["max-height"] : e.startsWith("translate-x-") ? ["translate-x"] : e.startsWith("translate-y-") ? ["translate-y"] : e.startsWith("scale-") ? ["scale"] : e.startsWith("rotate-") ? ["rotate"] : e === "transform" ? ["transform"] : e.startsWith("grid-cols-") ? ["grid-template-columns"] : e.startsWith("col-span-") ? ["grid-column"] : e.startsWith("columns-") ? ["columns"] : e === "flex-col" || e === "flex-row" ? ["flex-direction"] : e === "flex-wrap" ? ["flex-wrap"] : e.startsWith("flex-") ? ["flex"] : e === "shrink" || e.startsWith("shrink-") ? ["flex-shrink"] : e === "grow" || e.startsWith("grow-") ? ["flex-grow"] : e.startsWith("items-") ? ["align-items"] : e.startsWith("justify-") ? ["justify-content"] : e.startsWith("gap-") ? ["gap"] : e.startsWith("space-y-") ? ["space-y"] : e.startsWith("overflow-y-") ? ["overflow-y"] : e.startsWith("overflow-x-") ? ["overflow-x"] : e.startsWith("overflow-") ? ["overflow-x", "overflow-y"] : e.startsWith("object-") ? ["object-fit"] : e.startsWith("aspect-") ? ["aspect-ratio"] : e.startsWith("cursor-") ? ["cursor"] : e.startsWith("opacity-") ? ["opacity"] : e.startsWith("shadow-") ? ["box-shadow"] : e === "ring" || /^ring-\d/.test(e) ? ["ring-width"] : e.startsWith("ring-offset-bg-") ? ["ring-offset-color"] : e.startsWith("ring-offset-") ? ["ring-offset-width"] : e.startsWith("ring-") ? ["ring-color"] : e.startsWith("outline-offset-") ? ["outline-offset"] : /^outline-\d/.test(e) ? ["outline-width"] : e === "outline" || e === "outline-none" ? ["outline-style"] : e.startsWith("outline-") ? ["outline-color"] : e.startsWith("transition-") || e === "transition" ? ["transition-property"] : e.startsWith("duration-") ? ["transition-duration"] : e.startsWith("ease-") ? ["transition-timing-function"] : e.startsWith("animate-") ? ["animation"] : e.startsWith("z-") ? ["z-index"] : e.startsWith("whitespace-") ? ["white-space"] : e.startsWith("break-inside-") ? ["break-inside"] : e.startsWith("break-") ? ["word-break"] : e.startsWith("line-clamp-") ? ["line-clamp"] : e === "list-inside" || e === "list-outside" ? ["list-style-position"] : e.startsWith("list-") ? ["list-style-type"] : e.startsWith("resize") ? ["resize"] : e.startsWith("select-") ? ["user-select"] : e.startsWith("pointer-events-") ? ["pointer-events"] : e.startsWith("appearance-") ? ["appearance"] : e.startsWith("accent-") ? ["accent-color"] : [];
|
|
403
|
+
}
|
|
404
|
+
function Fe(e) {
|
|
405
|
+
return ze(e, Te);
|
|
406
|
+
}
|
|
407
|
+
function Ie(e) {
|
|
408
|
+
return ze(e, Ee);
|
|
409
|
+
}
|
|
410
|
+
function Le(e) {
|
|
411
|
+
return e === "border" ? "border" : e.match(/^(border(?:-[xytrbl])?)(?=$|-(?:0|2|4|8|\[))/)?.[1];
|
|
412
|
+
}
|
|
413
|
+
function Re(e) {
|
|
414
|
+
let t = e.match(/^(border-[xytrbl])-./);
|
|
415
|
+
return t ? t[1] : e.startsWith("border-") ? "border" : void 0;
|
|
416
|
+
}
|
|
417
|
+
function ze(e, t) {
|
|
418
|
+
return Object.keys(t).sort((e, t) => String(t).length - String(e).length).find((t) => {
|
|
419
|
+
let n = String(t);
|
|
420
|
+
return e === n || e.startsWith(`${n}-`);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
function Be(e, t) {
|
|
424
|
+
for (let n of e) if (!t.has(n)) return !1;
|
|
425
|
+
return !0;
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/components/charts/DonutChart.tsx
|
|
429
|
+
var Ve = {
|
|
430
|
+
"text-blue": "var(--blue)",
|
|
431
|
+
"text-green": "var(--green)",
|
|
432
|
+
"text-purple": "var(--purple)",
|
|
433
|
+
"text-yellow": "var(--yellow)",
|
|
434
|
+
"text-red": "var(--red)"
|
|
435
|
+
};
|
|
436
|
+
function He(e, t) {
|
|
437
|
+
let n = e.reduce((e, t) => e + t.value, 0), r = 0;
|
|
438
|
+
return e.map((e) => {
|
|
439
|
+
let i = n > 0 ? e.value / n * t : 0, a = t - i, o = r / t * 360 - 90, s = o + i / t * 180, c = n > 0 ? e.value / n * 100 : 0;
|
|
440
|
+
return r += i, {
|
|
441
|
+
segment: e,
|
|
442
|
+
segmentLength: i,
|
|
443
|
+
dashOffset: a,
|
|
444
|
+
rotation: o,
|
|
445
|
+
midAngle: s,
|
|
446
|
+
percentage: c
|
|
447
|
+
};
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
function Ue({ segments: e, size: t = 180 }) {
|
|
451
|
+
let [n, r] = d(null), i = e.reduce((e, t) => e + t.value, 0), a = (t - 28) / 2, o = He(e, 2 * Math.PI * a), s = t + 12, c = s / 2;
|
|
452
|
+
return /* @__PURE__ */ m("div", {
|
|
453
|
+
className: "flex flex-col items-center gap-4",
|
|
454
|
+
children: [/* @__PURE__ */ m("div", {
|
|
455
|
+
className: "relative",
|
|
456
|
+
children: [/* @__PURE__ */ m("svg", {
|
|
457
|
+
width: s,
|
|
458
|
+
height: s,
|
|
459
|
+
viewBox: `0 0 ${s} ${s}`,
|
|
460
|
+
className: "select-none",
|
|
461
|
+
onMouseLeave: () => r(null),
|
|
462
|
+
children: [
|
|
463
|
+
o.map((e, t) => /* @__PURE__ */ p("circle", {
|
|
464
|
+
cx: c,
|
|
465
|
+
cy: c,
|
|
466
|
+
r: a,
|
|
467
|
+
fill: "none",
|
|
468
|
+
stroke: "transparent",
|
|
469
|
+
strokeWidth: 48,
|
|
470
|
+
strokeDasharray: `${e.segmentLength} ${e.dashOffset}`,
|
|
471
|
+
strokeLinecap: "butt",
|
|
472
|
+
transform: `rotate(${e.rotation} ${c} ${c})`,
|
|
473
|
+
onMouseEnter: () => r(t),
|
|
474
|
+
className: "cursor-pointer"
|
|
475
|
+
}, `hit-${e.segment.name}`)),
|
|
476
|
+
o.map((e, t) => {
|
|
477
|
+
let r = n === t, i = e.midAngle * Math.PI / 180, o = r ? Math.cos(i) * 6 : 0, s = r ? Math.sin(i) * 6 : 0;
|
|
478
|
+
return /* @__PURE__ */ p("circle", {
|
|
479
|
+
cx: c,
|
|
480
|
+
cy: c,
|
|
481
|
+
r: a,
|
|
482
|
+
fill: "none",
|
|
483
|
+
stroke: Ve[e.segment.color] ?? "var(--accent)",
|
|
484
|
+
strokeWidth: r ? 32 : 28,
|
|
485
|
+
strokeDasharray: `${e.segmentLength} ${e.dashOffset}`,
|
|
486
|
+
strokeLinecap: "butt",
|
|
487
|
+
transform: `translate(${o} ${s}) rotate(${e.rotation} ${c} ${c})`,
|
|
488
|
+
opacity: n !== null && !r ? .5 : 1,
|
|
489
|
+
style: { transition: "all 150ms ease-out" },
|
|
490
|
+
className: "pointer-events-none"
|
|
491
|
+
}, e.segment.name);
|
|
492
|
+
}),
|
|
493
|
+
/* @__PURE__ */ p("text", {
|
|
494
|
+
x: c,
|
|
495
|
+
y: c - 6,
|
|
496
|
+
textAnchor: "middle",
|
|
497
|
+
dominantBaseline: "central",
|
|
498
|
+
fill: "var(--text-primary)",
|
|
499
|
+
fontSize: 18,
|
|
500
|
+
fontWeight: 700,
|
|
501
|
+
className: "pointer-events-none",
|
|
502
|
+
children: n === null ? i.toLocaleString() : o[n].segment.value.toLocaleString()
|
|
503
|
+
}),
|
|
504
|
+
/* @__PURE__ */ p("text", {
|
|
505
|
+
x: c,
|
|
506
|
+
y: c + 12,
|
|
507
|
+
textAnchor: "middle",
|
|
508
|
+
dominantBaseline: "central",
|
|
509
|
+
fill: "var(--text-tertiary)",
|
|
510
|
+
fontSize: 10,
|
|
511
|
+
className: "pointer-events-none",
|
|
512
|
+
children: n === null ? "Total" : o[n].segment.name
|
|
513
|
+
})
|
|
514
|
+
]
|
|
515
|
+
}), n !== null && (() => {
|
|
516
|
+
let e = o[n], t = e.midAngle * Math.PI / 180, r = a + 28 / 2 + 20, i = c + Math.cos(t) * r, s = c + Math.sin(t) * r, l = Ve[e.segment.color] ?? "var(--accent)";
|
|
517
|
+
return /* @__PURE__ */ p("div", {
|
|
518
|
+
className: "bg-bg-tertiary border-border pointer-events-none absolute z-10 rounded-md border px-2.5 py-1.5 shadow-lg",
|
|
519
|
+
style: {
|
|
520
|
+
left: i,
|
|
521
|
+
top: s,
|
|
522
|
+
transform: "translate(-50%, -50%)"
|
|
523
|
+
},
|
|
524
|
+
children: /* @__PURE__ */ m("div", {
|
|
525
|
+
className: "flex items-center gap-2",
|
|
526
|
+
children: [
|
|
527
|
+
/* @__PURE__ */ p("span", {
|
|
528
|
+
className: "h-2 w-2 shrink-0 rounded-full",
|
|
529
|
+
style: { backgroundColor: l }
|
|
530
|
+
}),
|
|
531
|
+
/* @__PURE__ */ p("span", {
|
|
532
|
+
className: "text-text-secondary text-xs whitespace-nowrap",
|
|
533
|
+
children: e.segment.name
|
|
534
|
+
}),
|
|
535
|
+
/* @__PURE__ */ p("span", {
|
|
536
|
+
className: "text-text-primary text-xs font-semibold",
|
|
537
|
+
children: e.segment.value.toLocaleString()
|
|
538
|
+
}),
|
|
539
|
+
/* @__PURE__ */ m("span", {
|
|
540
|
+
className: "text-text-tertiary text-2xs",
|
|
541
|
+
children: [
|
|
542
|
+
"(",
|
|
543
|
+
e.percentage.toFixed(1),
|
|
544
|
+
"%)"
|
|
545
|
+
]
|
|
546
|
+
})
|
|
547
|
+
]
|
|
548
|
+
})
|
|
549
|
+
});
|
|
550
|
+
})()]
|
|
551
|
+
}), /* @__PURE__ */ p("div", {
|
|
552
|
+
className: "relative z-0 flex flex-wrap justify-center gap-x-4 gap-y-1.5",
|
|
553
|
+
children: e.map((e, t) => /* @__PURE__ */ m("button", {
|
|
554
|
+
type: "button",
|
|
555
|
+
onMouseEnter: () => r(t),
|
|
556
|
+
onMouseLeave: () => r(null),
|
|
557
|
+
className: I("flex cursor-pointer items-center gap-1.5 transition-opacity duration-[100ms]", n !== null && n !== t && "opacity-50"),
|
|
558
|
+
children: [
|
|
559
|
+
/* @__PURE__ */ p("span", {
|
|
560
|
+
className: "h-2 w-2 rounded-full",
|
|
561
|
+
style: { backgroundColor: Ve[e.color] ?? "var(--accent)" }
|
|
562
|
+
}),
|
|
563
|
+
/* @__PURE__ */ p("span", {
|
|
564
|
+
className: "text-text-secondary text-xs",
|
|
565
|
+
children: e.name
|
|
566
|
+
}),
|
|
567
|
+
/* @__PURE__ */ p("span", {
|
|
568
|
+
className: "text-text-primary text-xs font-semibold",
|
|
569
|
+
children: e.value.toLocaleString()
|
|
570
|
+
})
|
|
571
|
+
]
|
|
572
|
+
}, e.name))
|
|
573
|
+
})]
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
//#endregion
|
|
577
|
+
//#region src/components/charts/RadarChart.tsx
|
|
578
|
+
var We = 4;
|
|
579
|
+
function Ge({ data: e, maxValue: t, size: n = 240 }) {
|
|
580
|
+
let [r, i] = d(null), a = t ?? Math.max(...e.map((e) => e.value)), o = n / 2, s = (n - 60) / 2, c = 2 * Math.PI / e.length;
|
|
581
|
+
function l(e, t) {
|
|
582
|
+
return [o + t * Math.cos(e - Math.PI / 2), o + t * Math.sin(e - Math.PI / 2)];
|
|
583
|
+
}
|
|
584
|
+
let u = e.map((e, t) => {
|
|
585
|
+
let n = e.value / a * s;
|
|
586
|
+
return l(t * c, n);
|
|
587
|
+
}), f = u.map((e) => `${e[0]},${e[1]}`).join(" ");
|
|
588
|
+
return /* @__PURE__ */ m("div", {
|
|
589
|
+
className: "relative flex flex-col items-center",
|
|
590
|
+
children: [/* @__PURE__ */ m("svg", {
|
|
591
|
+
width: n,
|
|
592
|
+
height: n,
|
|
593
|
+
viewBox: `0 0 ${n} ${n}`,
|
|
594
|
+
className: "select-none",
|
|
595
|
+
children: [
|
|
596
|
+
Array.from({ length: We }, (t, n) => {
|
|
597
|
+
let r = (n + 1) / We * s;
|
|
598
|
+
return /* @__PURE__ */ p("polygon", {
|
|
599
|
+
points: e.map((e, t) => l(t * c, r)).map((e) => `${e[0]},${e[1]}`).join(" "),
|
|
600
|
+
fill: "none",
|
|
601
|
+
stroke: "var(--border)",
|
|
602
|
+
strokeWidth: 1,
|
|
603
|
+
opacity: .5
|
|
604
|
+
}, n);
|
|
605
|
+
}),
|
|
606
|
+
e.map((e, t) => {
|
|
607
|
+
let [n, r] = l(t * c, s);
|
|
608
|
+
return /* @__PURE__ */ p("line", {
|
|
609
|
+
x1: o,
|
|
610
|
+
y1: o,
|
|
611
|
+
x2: n,
|
|
612
|
+
y2: r,
|
|
613
|
+
stroke: "var(--border)",
|
|
614
|
+
strokeWidth: 1,
|
|
615
|
+
opacity: .3
|
|
616
|
+
}, t);
|
|
617
|
+
}),
|
|
618
|
+
/* @__PURE__ */ p("polygon", {
|
|
619
|
+
points: f,
|
|
620
|
+
fill: "var(--accent)",
|
|
621
|
+
fillOpacity: .15,
|
|
622
|
+
stroke: "var(--accent)",
|
|
623
|
+
strokeWidth: 2,
|
|
624
|
+
strokeLinejoin: "round"
|
|
625
|
+
}),
|
|
626
|
+
u.map((e, t) => {
|
|
627
|
+
let n = r === t;
|
|
628
|
+
return /* @__PURE__ */ p("circle", {
|
|
629
|
+
cx: e[0],
|
|
630
|
+
cy: e[1],
|
|
631
|
+
r: n ? 5 : 3,
|
|
632
|
+
fill: "var(--accent)",
|
|
633
|
+
stroke: "var(--bg-secondary)",
|
|
634
|
+
strokeWidth: 2,
|
|
635
|
+
onMouseEnter: () => i(t),
|
|
636
|
+
onMouseLeave: () => i(null),
|
|
637
|
+
className: "cursor-pointer",
|
|
638
|
+
style: { transition: "r 150ms" }
|
|
639
|
+
}, t);
|
|
640
|
+
}),
|
|
641
|
+
e.map((e, t) => {
|
|
642
|
+
let n = s + 18, [a, o] = l(t * c, n);
|
|
643
|
+
return /* @__PURE__ */ m("g", {
|
|
644
|
+
onMouseEnter: () => i(t),
|
|
645
|
+
onMouseLeave: () => i(null),
|
|
646
|
+
className: "cursor-pointer",
|
|
647
|
+
children: [/* @__PURE__ */ p("rect", {
|
|
648
|
+
x: a - 24,
|
|
649
|
+
y: o - 10,
|
|
650
|
+
width: 48,
|
|
651
|
+
height: 20,
|
|
652
|
+
fill: "transparent"
|
|
653
|
+
}), /* @__PURE__ */ p("text", {
|
|
654
|
+
x: a,
|
|
655
|
+
y: o,
|
|
656
|
+
textAnchor: "middle",
|
|
657
|
+
dominantBaseline: "central",
|
|
658
|
+
fill: r === t ? "var(--text-primary)" : "var(--text-tertiary)",
|
|
659
|
+
fontSize: 10,
|
|
660
|
+
fontWeight: r === t ? 600 : 400,
|
|
661
|
+
style: { transition: "all 150ms" },
|
|
662
|
+
children: e.label
|
|
663
|
+
})]
|
|
664
|
+
}, e.label);
|
|
665
|
+
})
|
|
666
|
+
]
|
|
667
|
+
}), r !== null && /* @__PURE__ */ p("div", {
|
|
668
|
+
className: "bg-bg-tertiary border-border pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-md border px-2.5 py-1.5 shadow-lg",
|
|
669
|
+
children: /* @__PURE__ */ m("div", {
|
|
670
|
+
className: "flex items-center gap-2",
|
|
671
|
+
children: [
|
|
672
|
+
/* @__PURE__ */ p("span", { className: "bg-accent h-2 w-2 shrink-0 rounded-full" }),
|
|
673
|
+
/* @__PURE__ */ p("span", {
|
|
674
|
+
className: I("text-text-secondary text-xs whitespace-nowrap"),
|
|
675
|
+
children: e[r].label
|
|
676
|
+
}),
|
|
677
|
+
/* @__PURE__ */ p("span", {
|
|
678
|
+
className: "text-text-primary text-xs font-semibold",
|
|
679
|
+
children: e[r].value
|
|
680
|
+
})
|
|
681
|
+
]
|
|
682
|
+
})
|
|
683
|
+
})]
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/components/charts/RadialBarChart.tsx
|
|
688
|
+
var Ke = {
|
|
689
|
+
"text-blue": "var(--blue)",
|
|
690
|
+
"text-green": "var(--green)",
|
|
691
|
+
"text-purple": "var(--purple)",
|
|
692
|
+
"text-yellow": "var(--yellow)",
|
|
693
|
+
"text-red": "var(--red)",
|
|
694
|
+
"text-accent": "var(--accent)"
|
|
695
|
+
};
|
|
696
|
+
function qe({ segments: e, size: t = 200 }) {
|
|
697
|
+
let [n, r] = d(null), [i, a] = d({
|
|
698
|
+
x: 0,
|
|
699
|
+
y: 0
|
|
700
|
+
}), o = u(null), s = t / 2, c = (t - 40) / 2;
|
|
701
|
+
function l(e) {
|
|
702
|
+
let t = o.current?.getBoundingClientRect();
|
|
703
|
+
t && a({
|
|
704
|
+
x: e.clientX - t.left,
|
|
705
|
+
y: e.clientY - t.top
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
return /* @__PURE__ */ m("div", {
|
|
709
|
+
className: "flex flex-col items-center gap-4",
|
|
710
|
+
children: [/* @__PURE__ */ m("div", {
|
|
711
|
+
className: "relative",
|
|
712
|
+
ref: o,
|
|
713
|
+
onMouseMove: l,
|
|
714
|
+
children: [/* @__PURE__ */ m("svg", {
|
|
715
|
+
width: t,
|
|
716
|
+
height: t,
|
|
717
|
+
viewBox: `0 0 ${t} ${t}`,
|
|
718
|
+
className: "select-none",
|
|
719
|
+
children: [e.map((e, t) => {
|
|
720
|
+
let i = c - t * 20;
|
|
721
|
+
if (i <= 0) return null;
|
|
722
|
+
let a = 2 * Math.PI * i, o = a * Math.min(e.value / e.max, 1), l = a - o, u = Ke[e.color] ?? "var(--accent)", d = n === t;
|
|
723
|
+
return /* @__PURE__ */ m("g", {
|
|
724
|
+
onMouseEnter: () => r(t),
|
|
725
|
+
onMouseLeave: () => r(null),
|
|
726
|
+
className: "cursor-pointer",
|
|
727
|
+
children: [/* @__PURE__ */ p("circle", {
|
|
728
|
+
cx: s,
|
|
729
|
+
cy: s,
|
|
730
|
+
r: i,
|
|
731
|
+
fill: "none",
|
|
732
|
+
stroke: "var(--border)",
|
|
733
|
+
strokeWidth: 14,
|
|
734
|
+
opacity: .3
|
|
735
|
+
}), /* @__PURE__ */ p("circle", {
|
|
736
|
+
cx: s,
|
|
737
|
+
cy: s,
|
|
738
|
+
r: i,
|
|
739
|
+
fill: "none",
|
|
740
|
+
stroke: u,
|
|
741
|
+
strokeWidth: d ? 18 : 14,
|
|
742
|
+
strokeDasharray: `${o} ${l}`,
|
|
743
|
+
strokeLinecap: "round",
|
|
744
|
+
transform: `rotate(-90 ${s} ${s})`,
|
|
745
|
+
opacity: n !== null && !d ? .4 : 1,
|
|
746
|
+
className: "pointer-events-none",
|
|
747
|
+
style: { transition: "all 150ms ease-out" }
|
|
748
|
+
})]
|
|
749
|
+
}, e.label);
|
|
750
|
+
}), (() => {
|
|
751
|
+
let t = e.length - 1, n = c - t * 20 - 14 / 2;
|
|
752
|
+
return /* @__PURE__ */ p("circle", {
|
|
753
|
+
cx: s,
|
|
754
|
+
cy: s,
|
|
755
|
+
r: Math.max(0, n),
|
|
756
|
+
fill: "rgba(0,0,0,0)",
|
|
757
|
+
onMouseEnter: () => r(t),
|
|
758
|
+
onMouseLeave: () => r(null),
|
|
759
|
+
className: "cursor-pointer"
|
|
760
|
+
});
|
|
761
|
+
})()]
|
|
762
|
+
}), n !== null && (() => {
|
|
763
|
+
let t = e[n], r = Math.round(t.value / t.max * 100), a = Ke[t.color] ?? "var(--accent)";
|
|
764
|
+
return /* @__PURE__ */ p("div", {
|
|
765
|
+
className: "bg-bg-tertiary border-border pointer-events-none absolute z-10 rounded-md border px-2.5 py-1.5 shadow-lg",
|
|
766
|
+
style: {
|
|
767
|
+
left: i.x,
|
|
768
|
+
top: i.y,
|
|
769
|
+
transform: "translate(-50%, -120%)"
|
|
770
|
+
},
|
|
771
|
+
children: /* @__PURE__ */ m("div", {
|
|
772
|
+
className: "flex items-center gap-2",
|
|
773
|
+
children: [
|
|
774
|
+
/* @__PURE__ */ p("span", {
|
|
775
|
+
className: "h-2 w-2 shrink-0 rounded-full",
|
|
776
|
+
style: { backgroundColor: a }
|
|
777
|
+
}),
|
|
778
|
+
/* @__PURE__ */ p("span", {
|
|
779
|
+
className: "text-text-secondary text-xs whitespace-nowrap",
|
|
780
|
+
children: t.label
|
|
781
|
+
}),
|
|
782
|
+
/* @__PURE__ */ m("span", {
|
|
783
|
+
className: "text-text-primary text-xs font-semibold",
|
|
784
|
+
children: [r, "%"]
|
|
785
|
+
}),
|
|
786
|
+
/* @__PURE__ */ m("span", {
|
|
787
|
+
className: "text-text-tertiary text-2xs",
|
|
788
|
+
children: [
|
|
789
|
+
"(",
|
|
790
|
+
t.value,
|
|
791
|
+
"/",
|
|
792
|
+
t.max,
|
|
793
|
+
")"
|
|
794
|
+
]
|
|
795
|
+
})
|
|
796
|
+
]
|
|
797
|
+
})
|
|
798
|
+
});
|
|
799
|
+
})()]
|
|
800
|
+
}), /* @__PURE__ */ p("div", {
|
|
801
|
+
className: "flex flex-wrap justify-center gap-x-4 gap-y-1.5",
|
|
802
|
+
children: e.map((e, t) => {
|
|
803
|
+
let i = Math.round(e.value / e.max * 100);
|
|
804
|
+
return /* @__PURE__ */ m("button", {
|
|
805
|
+
type: "button",
|
|
806
|
+
onMouseEnter: () => r(t),
|
|
807
|
+
onMouseLeave: () => r(null),
|
|
808
|
+
className: I("flex cursor-pointer items-center gap-1.5 transition-opacity duration-[100ms]", n !== null && n !== t && "opacity-50"),
|
|
809
|
+
children: [
|
|
810
|
+
/* @__PURE__ */ p("span", {
|
|
811
|
+
className: "h-2 w-2 rounded-full",
|
|
812
|
+
style: { backgroundColor: Ke[e.color] ?? "var(--accent)" }
|
|
813
|
+
}),
|
|
814
|
+
/* @__PURE__ */ p("span", {
|
|
815
|
+
className: "text-text-secondary text-xs",
|
|
816
|
+
children: e.label
|
|
817
|
+
}),
|
|
818
|
+
/* @__PURE__ */ m("span", {
|
|
819
|
+
className: "text-text-primary text-xs font-semibold",
|
|
820
|
+
children: [i, "%"]
|
|
821
|
+
})
|
|
822
|
+
]
|
|
823
|
+
}, e.label);
|
|
824
|
+
})
|
|
825
|
+
})]
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region src/components/charts/SparkLine.tsx
|
|
830
|
+
function Je({ data: e, width: t = 60, height: n = 20, color: r }) {
|
|
831
|
+
if (e.length < 2) return null;
|
|
832
|
+
let i = Math.min(...e), a = Math.max(...e) - i || 1, o = e.map((r, o) => `${o / (e.length - 1) * t},${n - (r - i) / a * (n - 2) - 1}`).join(" ");
|
|
833
|
+
return /* @__PURE__ */ p("svg", {
|
|
834
|
+
width: t,
|
|
835
|
+
height: n,
|
|
836
|
+
viewBox: `0 0 ${t} ${n}`,
|
|
837
|
+
className: "inline-block",
|
|
838
|
+
children: /* @__PURE__ */ p("polyline", {
|
|
839
|
+
points: o,
|
|
840
|
+
fill: "none",
|
|
841
|
+
stroke: r ?? "var(--accent)",
|
|
842
|
+
strokeWidth: 1.5,
|
|
843
|
+
strokeLinecap: "round",
|
|
844
|
+
strokeLinejoin: "round"
|
|
845
|
+
})
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/components/charts/VerticalBarChart.tsx
|
|
850
|
+
var Ye = [
|
|
851
|
+
1,
|
|
852
|
+
.85,
|
|
853
|
+
.7,
|
|
854
|
+
.55,
|
|
855
|
+
.45,
|
|
856
|
+
.35,
|
|
857
|
+
.25
|
|
858
|
+
], L = {
|
|
859
|
+
top: 20,
|
|
860
|
+
right: 8,
|
|
861
|
+
bottom: 24,
|
|
862
|
+
left: 40
|
|
863
|
+
};
|
|
864
|
+
function Xe(e) {
|
|
865
|
+
return e >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : String(e);
|
|
866
|
+
}
|
|
867
|
+
function Ze({ data: e, height: t = 180 }) {
|
|
868
|
+
let [n, r] = d(null), i = 600 - L.left - L.right, a = t - L.top - L.bottom, o = Math.max(...e.map((e) => e.value), 1), s = Math.max(4, (i - 6 * (e.length - 1)) / e.length);
|
|
869
|
+
return /* @__PURE__ */ m("svg", {
|
|
870
|
+
width: "100%",
|
|
871
|
+
viewBox: `0 0 600 ${t}`,
|
|
872
|
+
className: "select-none",
|
|
873
|
+
children: [
|
|
874
|
+
/* @__PURE__ */ p("text", {
|
|
875
|
+
x: L.left - 6,
|
|
876
|
+
y: L.top + 4,
|
|
877
|
+
textAnchor: "end",
|
|
878
|
+
fill: "var(--text-tertiary)",
|
|
879
|
+
fontSize: 10,
|
|
880
|
+
children: Xe(o)
|
|
881
|
+
}),
|
|
882
|
+
/* @__PURE__ */ p("text", {
|
|
883
|
+
x: L.left - 6,
|
|
884
|
+
y: L.top + a,
|
|
885
|
+
textAnchor: "end",
|
|
886
|
+
dominantBaseline: "central",
|
|
887
|
+
fill: "var(--text-tertiary)",
|
|
888
|
+
fontSize: 10,
|
|
889
|
+
children: "0"
|
|
890
|
+
}),
|
|
891
|
+
/* @__PURE__ */ p("line", {
|
|
892
|
+
x1: L.left,
|
|
893
|
+
y1: L.top + a,
|
|
894
|
+
x2: L.left + i,
|
|
895
|
+
y2: L.top + a,
|
|
896
|
+
stroke: "var(--border)",
|
|
897
|
+
strokeWidth: 1
|
|
898
|
+
}),
|
|
899
|
+
/* @__PURE__ */ p("line", {
|
|
900
|
+
x1: L.left,
|
|
901
|
+
y1: L.top + a / 2,
|
|
902
|
+
x2: L.left + i,
|
|
903
|
+
y2: L.top + a / 2,
|
|
904
|
+
stroke: "var(--border)",
|
|
905
|
+
strokeWidth: 1,
|
|
906
|
+
strokeDasharray: "3 3",
|
|
907
|
+
opacity: .5
|
|
908
|
+
}),
|
|
909
|
+
e.map((e, i) => {
|
|
910
|
+
let c = L.left + i * (s + 6), l = e.value / o * a, u = L.top + a - l, d = n === i;
|
|
911
|
+
return /* @__PURE__ */ m("g", {
|
|
912
|
+
onMouseEnter: () => r(i),
|
|
913
|
+
onMouseLeave: () => r(null),
|
|
914
|
+
children: [
|
|
915
|
+
/* @__PURE__ */ p("rect", {
|
|
916
|
+
x: c,
|
|
917
|
+
y: L.top,
|
|
918
|
+
width: s,
|
|
919
|
+
height: a,
|
|
920
|
+
fill: "transparent"
|
|
921
|
+
}),
|
|
922
|
+
/* @__PURE__ */ p("rect", {
|
|
923
|
+
x: c,
|
|
924
|
+
y: u,
|
|
925
|
+
width: s,
|
|
926
|
+
height: l,
|
|
927
|
+
fill: e.color ?? "var(--accent)",
|
|
928
|
+
rx: 6,
|
|
929
|
+
opacity: d ? 1 : Ye[i % Ye.length],
|
|
930
|
+
style: { transition: "all 150ms" }
|
|
931
|
+
}),
|
|
932
|
+
/* @__PURE__ */ p("text", {
|
|
933
|
+
x: c + s / 2,
|
|
934
|
+
y: t - 4,
|
|
935
|
+
textAnchor: "middle",
|
|
936
|
+
fill: "var(--text-tertiary)",
|
|
937
|
+
fontSize: 10,
|
|
938
|
+
children: e.label
|
|
939
|
+
}),
|
|
940
|
+
d && /* @__PURE__ */ p("text", {
|
|
941
|
+
x: c + s / 2,
|
|
942
|
+
y: u - 6,
|
|
943
|
+
textAnchor: "middle",
|
|
944
|
+
fill: "var(--text-primary)",
|
|
945
|
+
fontSize: 10,
|
|
946
|
+
fontWeight: 600,
|
|
947
|
+
children: e.value.toLocaleString()
|
|
948
|
+
})
|
|
949
|
+
]
|
|
950
|
+
}, e.label);
|
|
951
|
+
})
|
|
952
|
+
]
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/components/app-shell/navigation.ts
|
|
957
|
+
function R(e, t) {
|
|
958
|
+
if (!t) return !1;
|
|
959
|
+
if (e.end ?? e.path === "/") return t === e.path;
|
|
960
|
+
let n = e.path.endsWith("/") ? e.path : `${e.path}/`;
|
|
961
|
+
return t === e.path || t.startsWith(n);
|
|
962
|
+
}
|
|
963
|
+
function z(e, t, n, r) {
|
|
964
|
+
let i = e.currentTarget.getAttribute("target");
|
|
965
|
+
e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || i && i !== "_self" || (n && (e.preventDefault(), n(t)), r?.());
|
|
966
|
+
}
|
|
967
|
+
function Qe(e, t) {
|
|
968
|
+
if (t) {
|
|
969
|
+
t(e);
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
typeof window < "u" && window.location.assign(e);
|
|
973
|
+
}
|
|
974
|
+
//#endregion
|
|
975
|
+
//#region src/components/app-shell/BottomNav.tsx
|
|
976
|
+
function $e({ items: e, currentPath: t, onNavigate: n, className: r }) {
|
|
977
|
+
return e.length === 0 ? null : /* @__PURE__ */ p("nav", {
|
|
978
|
+
className: I("bg-bg-secondary border-border font-navigation fixed right-0 bottom-0 left-0 z-30 border-t md:hidden", r),
|
|
979
|
+
style: { height: "var(--bottomnav-height)" },
|
|
980
|
+
children: /* @__PURE__ */ p("ul", {
|
|
981
|
+
className: "flex h-full items-center justify-around",
|
|
982
|
+
children: e.map((e) => {
|
|
983
|
+
let r = R(e, t);
|
|
984
|
+
return /* @__PURE__ */ p("li", { children: /* @__PURE__ */ m("a", {
|
|
985
|
+
href: e.path,
|
|
986
|
+
onClick: (t) => z(t, e.path, n),
|
|
987
|
+
"aria-current": r ? "page" : void 0,
|
|
988
|
+
className: I("font-navigation flex h-full w-14 flex-col items-center justify-center gap-0.5", "cursor-pointer transition-colors duration-[100ms]", r ? "text-accent" : "text-text-tertiary"),
|
|
989
|
+
children: [/* @__PURE__ */ p(e.icon, { className: "h-5 w-5" }), /* @__PURE__ */ p("span", {
|
|
990
|
+
className: "text-2xs",
|
|
991
|
+
children: e.shortLabel ?? e.label
|
|
992
|
+
})]
|
|
993
|
+
}) }, e.path);
|
|
994
|
+
})
|
|
995
|
+
})
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/hooks/useFocusTrap.ts
|
|
1000
|
+
var et = "a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
1001
|
+
function B(e, t) {
|
|
1002
|
+
let n = u(null);
|
|
1003
|
+
o(() => {
|
|
1004
|
+
if (!t || !e.current) return;
|
|
1005
|
+
n.current = document.activeElement;
|
|
1006
|
+
let r = e.current.querySelectorAll(et);
|
|
1007
|
+
r.length > 0 && r[0].focus();
|
|
1008
|
+
let i = (t) => {
|
|
1009
|
+
if (t.key !== "Tab" || !e.current) return;
|
|
1010
|
+
let n = e.current.querySelectorAll(et);
|
|
1011
|
+
if (n.length === 0) return;
|
|
1012
|
+
let r = n[0], i = n[n.length - 1];
|
|
1013
|
+
t.shiftKey ? document.activeElement === r && (t.preventDefault(), i.focus()) : document.activeElement === i && (t.preventDefault(), r.focus());
|
|
1014
|
+
};
|
|
1015
|
+
return document.addEventListener("keydown", i), () => {
|
|
1016
|
+
document.removeEventListener("keydown", i), n.current instanceof HTMLElement && n.current.focus();
|
|
1017
|
+
};
|
|
1018
|
+
}, [t, e]);
|
|
1019
|
+
}
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region src/components/app-shell/commandPaletteEvents.ts
|
|
1022
|
+
var tt = "open-command-palette", nt = {
|
|
1023
|
+
key: "k",
|
|
1024
|
+
label: "⌘K",
|
|
1025
|
+
modifier: "primary"
|
|
1026
|
+
};
|
|
1027
|
+
function rt(e = tt) {
|
|
1028
|
+
typeof document > "u" || document.dispatchEvent(new CustomEvent(e));
|
|
1029
|
+
}
|
|
1030
|
+
function it(e, t) {
|
|
1031
|
+
if (e.key.toLowerCase() !== t.key.toLowerCase()) return !1;
|
|
1032
|
+
let n = t.modifier ?? "primary";
|
|
1033
|
+
return (n === "primary" ? e.metaKey || e.ctrlKey : n === "meta" ? e.metaKey && !e.ctrlKey : n === "ctrl" ? e.ctrlKey && !e.metaKey : !e.metaKey && !e.ctrlKey) && !!e.altKey == !!t.altKey && !!e.shiftKey == !!t.shiftKey;
|
|
1034
|
+
}
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region src/components/app-shell/CommandPalette.tsx
|
|
1037
|
+
function at(e, t) {
|
|
1038
|
+
let n = t.toLowerCase();
|
|
1039
|
+
return [
|
|
1040
|
+
e.label,
|
|
1041
|
+
e.path,
|
|
1042
|
+
...e.keywords ?? []
|
|
1043
|
+
].some((e) => e.toLowerCase().includes(n));
|
|
1044
|
+
}
|
|
1045
|
+
function ot({ items: e, eventName: t = tt, shortcut: n = nt, placeholder: r = "Search pages...", emptyLabel: a = "No results found", onNavigate: c, onSelect: l }) {
|
|
1046
|
+
let [f, h] = d(!1), [g, _] = d(""), [v, y] = d(0), b = u(null), x = u(null), S = s();
|
|
1047
|
+
B(x, f);
|
|
1048
|
+
let C = e.filter((e) => at(e, g)), w = i(() => {
|
|
1049
|
+
h(!0), _(""), y(0), setTimeout(() => b.current?.focus(), 0);
|
|
1050
|
+
}, []);
|
|
1051
|
+
o(() => {
|
|
1052
|
+
let e = (e) => {
|
|
1053
|
+
it(e, n) && (e.preventDefault(), f ? h(!1) : w());
|
|
1054
|
+
}, r = () => {
|
|
1055
|
+
f || w();
|
|
1056
|
+
};
|
|
1057
|
+
return document.addEventListener("keydown", e), document.addEventListener(t, r), () => {
|
|
1058
|
+
document.removeEventListener("keydown", e), document.removeEventListener(t, r);
|
|
1059
|
+
};
|
|
1060
|
+
}, [
|
|
1061
|
+
t,
|
|
1062
|
+
f,
|
|
1063
|
+
w,
|
|
1064
|
+
n
|
|
1065
|
+
]);
|
|
1066
|
+
function T(e) {
|
|
1067
|
+
_(e), y(0);
|
|
1068
|
+
}
|
|
1069
|
+
function E(e) {
|
|
1070
|
+
l?.(e), Qe(e.path, c), h(!1);
|
|
1071
|
+
}
|
|
1072
|
+
function D(e) {
|
|
1073
|
+
e.key === "ArrowDown" ? (e.preventDefault(), y((e) => Math.min(e + 1, C.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), y((e) => Math.max(e - 1, 0))) : e.key === "Enter" && C[v] ? E(C[v]) : e.key === "Escape" && h(!1);
|
|
1074
|
+
}
|
|
1075
|
+
return f ? /* @__PURE__ */ m("div", {
|
|
1076
|
+
className: "fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",
|
|
1077
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1078
|
+
className: "bg-bg-overlay fixed inset-0",
|
|
1079
|
+
onClick: () => h(!1)
|
|
1080
|
+
}), /* @__PURE__ */ m("div", {
|
|
1081
|
+
ref: x,
|
|
1082
|
+
className: "bg-bg-secondary border-border animate-scale-in relative z-50 mx-4 w-full max-w-[520px] overflow-hidden rounded-xl border shadow-lg",
|
|
1083
|
+
onKeyDown: D,
|
|
1084
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1085
|
+
className: "border-border flex items-center gap-3 border-b px-4",
|
|
1086
|
+
children: [
|
|
1087
|
+
/* @__PURE__ */ p(M, { className: "text-text-tertiary h-4 w-4 shrink-0" }),
|
|
1088
|
+
/* @__PURE__ */ p("input", {
|
|
1089
|
+
ref: b,
|
|
1090
|
+
type: "text",
|
|
1091
|
+
role: "combobox",
|
|
1092
|
+
"aria-expanded": C.length > 0,
|
|
1093
|
+
"aria-controls": S,
|
|
1094
|
+
"aria-activedescendant": C[v] ? `${S}-${v}` : void 0,
|
|
1095
|
+
"aria-autocomplete": "list",
|
|
1096
|
+
"aria-label": "Search pages",
|
|
1097
|
+
value: g,
|
|
1098
|
+
onChange: (e) => T(e.target.value),
|
|
1099
|
+
placeholder: r,
|
|
1100
|
+
className: "text-text-primary placeholder:text-text-disabled h-11 flex-1 bg-transparent text-sm focus:outline-none"
|
|
1101
|
+
}),
|
|
1102
|
+
/* @__PURE__ */ p("kbd", {
|
|
1103
|
+
className: "text-2xs bg-bg-tertiary text-text-tertiary border-border hidden items-center rounded border px-1.5 py-0.5 font-mono font-medium sm:inline-flex",
|
|
1104
|
+
children: "Esc"
|
|
1105
|
+
})
|
|
1106
|
+
]
|
|
1107
|
+
}), /* @__PURE__ */ p("ul", {
|
|
1108
|
+
id: S,
|
|
1109
|
+
role: "listbox",
|
|
1110
|
+
"aria-label": "Pages",
|
|
1111
|
+
className: "max-h-[320px] overflow-y-auto px-2 py-2",
|
|
1112
|
+
children: C.length === 0 ? /* @__PURE__ */ p("li", {
|
|
1113
|
+
className: "text-text-tertiary px-3 py-6 text-center text-xs",
|
|
1114
|
+
children: a
|
|
1115
|
+
}) : C.map((e, t) => /* @__PURE__ */ m("li", {
|
|
1116
|
+
id: `${S}-${t}`,
|
|
1117
|
+
role: "option",
|
|
1118
|
+
"aria-selected": t === v,
|
|
1119
|
+
onClick: () => E(e),
|
|
1120
|
+
className: I("flex h-9 w-full cursor-pointer items-center gap-3 rounded-md px-3 text-left", "transition-colors duration-[100ms]", t === v ? "bg-accent-muted text-accent" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
|
|
1121
|
+
children: [/* @__PURE__ */ p("span", {
|
|
1122
|
+
className: "shrink-0 opacity-60",
|
|
1123
|
+
children: /* @__PURE__ */ p(e.icon, { className: "h-4 w-4" })
|
|
1124
|
+
}), /* @__PURE__ */ p("span", {
|
|
1125
|
+
className: "text-xs font-medium",
|
|
1126
|
+
children: e.label
|
|
1127
|
+
})]
|
|
1128
|
+
}, e.path))
|
|
1129
|
+
})]
|
|
1130
|
+
})]
|
|
1131
|
+
}) : null;
|
|
1132
|
+
}
|
|
1133
|
+
//#endregion
|
|
1134
|
+
//#region src/components/app-shell/MobileDrawer.tsx
|
|
1135
|
+
function st({ brand: e }) {
|
|
1136
|
+
let t = e.icon;
|
|
1137
|
+
return e.logo ? /* @__PURE__ */ p(f, { children: e.logo }) : /* @__PURE__ */ m("div", {
|
|
1138
|
+
className: "flex items-center gap-2",
|
|
1139
|
+
children: [t && /* @__PURE__ */ p(t, { className: "text-accent h-4.5 w-4.5" }), /* @__PURE__ */ p("span", {
|
|
1140
|
+
className: "text-text-primary text-sm font-semibold",
|
|
1141
|
+
children: e.name
|
|
1142
|
+
})]
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
function ct({ open: e, onClose: t, items: n, brand: r, currentPath: i, onNavigate: a, className: s }) {
|
|
1146
|
+
let c = u(null);
|
|
1147
|
+
return B(c, e), o(() => {
|
|
1148
|
+
if (!e) return;
|
|
1149
|
+
document.body.style.overflow = "hidden";
|
|
1150
|
+
let n = (e) => {
|
|
1151
|
+
e.key === "Escape" && t();
|
|
1152
|
+
};
|
|
1153
|
+
return document.addEventListener("keydown", n), () => {
|
|
1154
|
+
document.body.style.overflow = "", document.removeEventListener("keydown", n);
|
|
1155
|
+
};
|
|
1156
|
+
}, [e, t]), e ? /* @__PURE__ */ m("div", {
|
|
1157
|
+
className: "fixed inset-0 z-40 md:hidden",
|
|
1158
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1159
|
+
className: "bg-bg-overlay fixed inset-0",
|
|
1160
|
+
onClick: t
|
|
1161
|
+
}), /* @__PURE__ */ m("div", {
|
|
1162
|
+
ref: c,
|
|
1163
|
+
className: I("bg-bg-sidebar border-border animate-slide-in-left fixed inset-y-0 left-0 z-50 flex w-64 flex-col border-r", s),
|
|
1164
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1165
|
+
className: "border-border flex h-11 items-center justify-between border-b px-4",
|
|
1166
|
+
children: [/* @__PURE__ */ p(st, { brand: r }), /* @__PURE__ */ p("button", {
|
|
1167
|
+
onClick: t,
|
|
1168
|
+
className: "text-text-tertiary hover:text-text-primary flex h-7 w-7 cursor-pointer items-center justify-center rounded",
|
|
1169
|
+
"aria-label": "Close menu",
|
|
1170
|
+
children: /* @__PURE__ */ p(N, { className: "h-4 w-4" })
|
|
1171
|
+
})]
|
|
1172
|
+
}), /* @__PURE__ */ p("nav", {
|
|
1173
|
+
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-2",
|
|
1174
|
+
children: /* @__PURE__ */ p("ul", {
|
|
1175
|
+
className: "space-y-0.5",
|
|
1176
|
+
children: n.map((e) => {
|
|
1177
|
+
let n = R(e, i);
|
|
1178
|
+
return /* @__PURE__ */ p("li", { children: /* @__PURE__ */ m("a", {
|
|
1179
|
+
href: e.path,
|
|
1180
|
+
onClick: (n) => z(n, e.path, a, t),
|
|
1181
|
+
"aria-current": n ? "page" : void 0,
|
|
1182
|
+
className: I("flex h-10 items-center gap-3 rounded-md px-3", "cursor-pointer transition-colors duration-[100ms]", n ? "bg-accent-muted text-accent" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
|
|
1183
|
+
children: [/* @__PURE__ */ p(e.icon, { className: "h-4 w-4" }), /* @__PURE__ */ p("span", {
|
|
1184
|
+
className: "text-sm",
|
|
1185
|
+
children: e.label
|
|
1186
|
+
})]
|
|
1187
|
+
}) }, e.path);
|
|
1188
|
+
})
|
|
1189
|
+
})
|
|
1190
|
+
})]
|
|
1191
|
+
})]
|
|
1192
|
+
}) : null;
|
|
1193
|
+
}
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region src/config/theme.ts
|
|
1196
|
+
var lt = [
|
|
1197
|
+
{
|
|
1198
|
+
value: "dark",
|
|
1199
|
+
label: "Dark",
|
|
1200
|
+
icon: se,
|
|
1201
|
+
preview: {
|
|
1202
|
+
bg: "#0d0f12",
|
|
1203
|
+
fg: "#2a2e38"
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
value: "light",
|
|
1208
|
+
label: "Light",
|
|
1209
|
+
icon: fe,
|
|
1210
|
+
preview: {
|
|
1211
|
+
bg: "#f5f5f5",
|
|
1212
|
+
fg: "#d4d4d8"
|
|
1213
|
+
}
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
value: "monokai",
|
|
1217
|
+
label: "Monokai",
|
|
1218
|
+
icon: ce,
|
|
1219
|
+
preview: {
|
|
1220
|
+
bg: "#272822",
|
|
1221
|
+
fg: "#3E3D32"
|
|
1222
|
+
}
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
value: "solarized",
|
|
1226
|
+
label: "Solarized",
|
|
1227
|
+
icon: oe,
|
|
1228
|
+
preview: {
|
|
1229
|
+
bg: "#002B36",
|
|
1230
|
+
fg: "#0A3F4C"
|
|
1231
|
+
}
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
value: "cyberBrutalDark",
|
|
1235
|
+
label: "Cyber Brutal Dark",
|
|
1236
|
+
icon: he,
|
|
1237
|
+
preview: {
|
|
1238
|
+
bg: "#050505",
|
|
1239
|
+
fg: "#18181b"
|
|
1240
|
+
}
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
value: "cyberBrutalLight",
|
|
1244
|
+
label: "Cyber Brutal Light",
|
|
1245
|
+
icon: he,
|
|
1246
|
+
preview: {
|
|
1247
|
+
bg: "#e4e4e7",
|
|
1248
|
+
fg: "#d4d4d8"
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
{
|
|
1252
|
+
value: "hashiTheme",
|
|
1253
|
+
label: "HashiTheme",
|
|
1254
|
+
icon: x,
|
|
1255
|
+
preview: {
|
|
1256
|
+
bg: "#ffffff",
|
|
1257
|
+
fg: "#364153"
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
], ut = new Set([
|
|
1261
|
+
"light",
|
|
1262
|
+
"cyberBrutalLight",
|
|
1263
|
+
"hashiTheme"
|
|
1264
|
+
]);
|
|
1265
|
+
function V(e) {
|
|
1266
|
+
return ut.has(e);
|
|
1267
|
+
}
|
|
1268
|
+
var dt = lt.filter((e) => V(e.value)), ft = lt.filter((e) => !V(e.value)), H = {
|
|
1269
|
+
uiFont: "inter",
|
|
1270
|
+
headingFont: "inter",
|
|
1271
|
+
proseFont: "inter",
|
|
1272
|
+
controlFont: "inter",
|
|
1273
|
+
labelFont: "inter",
|
|
1274
|
+
navigationFont: "inter",
|
|
1275
|
+
dataFont: "inter",
|
|
1276
|
+
codeFont: "jetbrains-mono",
|
|
1277
|
+
fontSize: 15,
|
|
1278
|
+
borderRadius: 6,
|
|
1279
|
+
borderWidth: 1,
|
|
1280
|
+
tracking: .05,
|
|
1281
|
+
lineHeight: 1.45,
|
|
1282
|
+
density: .25
|
|
1283
|
+
}, pt = {
|
|
1284
|
+
uiFont: "jetbrains-mono",
|
|
1285
|
+
headingFont: "jetbrains-mono",
|
|
1286
|
+
proseFont: "jetbrains-mono",
|
|
1287
|
+
controlFont: "jetbrains-mono",
|
|
1288
|
+
labelFont: "jetbrains-mono",
|
|
1289
|
+
navigationFont: "jetbrains-mono",
|
|
1290
|
+
dataFont: "jetbrains-mono",
|
|
1291
|
+
codeFont: "jetbrains-mono",
|
|
1292
|
+
fontSize: 15,
|
|
1293
|
+
borderRadius: 0,
|
|
1294
|
+
borderWidth: 1,
|
|
1295
|
+
tracking: .2,
|
|
1296
|
+
lineHeight: 1.4,
|
|
1297
|
+
density: .22
|
|
1298
|
+
}, U = {
|
|
1299
|
+
dark: H,
|
|
1300
|
+
light: H,
|
|
1301
|
+
monokai: H,
|
|
1302
|
+
solarized: H,
|
|
1303
|
+
cyberBrutalDark: pt,
|
|
1304
|
+
cyberBrutalLight: pt,
|
|
1305
|
+
hashiTheme: {
|
|
1306
|
+
uiFont: "inter",
|
|
1307
|
+
headingFont: "archivo-expanded",
|
|
1308
|
+
proseFont: "pt-serif",
|
|
1309
|
+
controlFont: "inter",
|
|
1310
|
+
labelFont: "inter",
|
|
1311
|
+
navigationFont: "inter",
|
|
1312
|
+
dataFont: "inter",
|
|
1313
|
+
codeFont: "jetbrains-mono",
|
|
1314
|
+
fontSize: 14,
|
|
1315
|
+
borderRadius: 6,
|
|
1316
|
+
borderWidth: 1,
|
|
1317
|
+
tracking: 0,
|
|
1318
|
+
lineHeight: 1.45,
|
|
1319
|
+
density: .25
|
|
1320
|
+
}
|
|
1321
|
+
}, mt = [
|
|
1322
|
+
{
|
|
1323
|
+
value: "archivo-expanded",
|
|
1324
|
+
label: "Archivo Expanded"
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
value: "inter",
|
|
1328
|
+
label: "Inter"
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
value: "jetbrains-mono",
|
|
1332
|
+
label: "JetBrains Mono"
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
value: "pt-serif",
|
|
1336
|
+
label: "PT Serif"
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
value: "system",
|
|
1340
|
+
label: "System"
|
|
1341
|
+
}
|
|
1342
|
+
], ht = [
|
|
1343
|
+
{
|
|
1344
|
+
value: "purple",
|
|
1345
|
+
color: "#7C5CFC"
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
value: "blue",
|
|
1349
|
+
color: "#3B82F6"
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
value: "green",
|
|
1353
|
+
color: "#22C55E"
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
value: "teal",
|
|
1357
|
+
color: "#14B8A6"
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
value: "orange",
|
|
1361
|
+
color: "#F97316"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
value: "red",
|
|
1365
|
+
color: "#EF4444"
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
value: "pink",
|
|
1369
|
+
color: "#EC4899"
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
value: "indigo",
|
|
1373
|
+
color: "#6366F1"
|
|
1374
|
+
}
|
|
1375
|
+
];
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region src/hooks/useDismiss.ts
|
|
1378
|
+
function W(e, t, n, r) {
|
|
1379
|
+
o(() => {
|
|
1380
|
+
if (!e) return;
|
|
1381
|
+
let i = (e) => {
|
|
1382
|
+
let i = e.target;
|
|
1383
|
+
r?.some((e) => e.current?.contains(i)) || n.every((e) => e.current && !e.current.contains(i)) && t();
|
|
1384
|
+
}, a = (e) => {
|
|
1385
|
+
e.key === "Escape" && t();
|
|
1386
|
+
};
|
|
1387
|
+
return document.addEventListener("mousedown", i), document.addEventListener("keydown", a), () => {
|
|
1388
|
+
document.removeEventListener("mousedown", i), document.removeEventListener("keydown", a);
|
|
1389
|
+
};
|
|
1390
|
+
}, [
|
|
1391
|
+
e,
|
|
1392
|
+
t,
|
|
1393
|
+
n,
|
|
1394
|
+
r
|
|
1395
|
+
]);
|
|
1396
|
+
}
|
|
1397
|
+
//#endregion
|
|
1398
|
+
//#region src/providers/SettingsContext.ts
|
|
1399
|
+
var G = n({
|
|
1400
|
+
fontSize: 15,
|
|
1401
|
+
setFontSize: () => {},
|
|
1402
|
+
accentColor: "purple",
|
|
1403
|
+
setAccentColor: () => {},
|
|
1404
|
+
sidebarCollapsed: !1,
|
|
1405
|
+
setSidebarCollapsed: () => {},
|
|
1406
|
+
sidebarWidth: 220,
|
|
1407
|
+
setSidebarWidth: () => {},
|
|
1408
|
+
reducedMotion: !1,
|
|
1409
|
+
setReducedMotion: () => {},
|
|
1410
|
+
colorMode: "dark",
|
|
1411
|
+
setColorMode: () => {},
|
|
1412
|
+
preferredDarkTheme: "dark",
|
|
1413
|
+
setPreferredDarkTheme: () => {},
|
|
1414
|
+
preferredLightTheme: "light",
|
|
1415
|
+
setPreferredLightTheme: () => {},
|
|
1416
|
+
resolvedTheme: "dark",
|
|
1417
|
+
uiFont: "inter",
|
|
1418
|
+
headingFont: "inter",
|
|
1419
|
+
proseFont: "inter",
|
|
1420
|
+
controlFont: "inter",
|
|
1421
|
+
labelFont: "inter",
|
|
1422
|
+
navigationFont: "inter",
|
|
1423
|
+
dataFont: "inter",
|
|
1424
|
+
codeFont: "jetbrains-mono",
|
|
1425
|
+
borderRadius: 6,
|
|
1426
|
+
borderWidth: 1,
|
|
1427
|
+
tracking: .05,
|
|
1428
|
+
lineHeight: 1.45,
|
|
1429
|
+
density: .25,
|
|
1430
|
+
setUiFont: () => {},
|
|
1431
|
+
setHeadingFont: () => {},
|
|
1432
|
+
setProseFont: () => {},
|
|
1433
|
+
setControlFont: () => {},
|
|
1434
|
+
setLabelFont: () => {},
|
|
1435
|
+
setNavigationFont: () => {},
|
|
1436
|
+
setDataFont: () => {},
|
|
1437
|
+
setCodeFont: () => {},
|
|
1438
|
+
setBorderRadius: () => {},
|
|
1439
|
+
setBorderWidth: () => {},
|
|
1440
|
+
setTracking: () => {},
|
|
1441
|
+
setLineHeight: () => {},
|
|
1442
|
+
setDensity: () => {},
|
|
1443
|
+
saveThemeCustomization: () => {},
|
|
1444
|
+
resetThemeCustomization: () => {},
|
|
1445
|
+
hasThemeOverrides: !1,
|
|
1446
|
+
isCustomized: !1
|
|
1447
|
+
});
|
|
1448
|
+
//#endregion
|
|
1449
|
+
//#region src/hooks/useSettings.ts
|
|
1450
|
+
function K() {
|
|
1451
|
+
return a(G);
|
|
1452
|
+
}
|
|
1453
|
+
//#endregion
|
|
1454
|
+
//#region src/components/ui/Avatar.tsx
|
|
1455
|
+
var gt = {
|
|
1456
|
+
xs: "w-5 h-5 text-2xs",
|
|
1457
|
+
sm: "w-7 h-7 text-2xs",
|
|
1458
|
+
md: "w-10 h-10 text-xs",
|
|
1459
|
+
lg: "w-16 h-16 text-lg"
|
|
1460
|
+
};
|
|
1461
|
+
function _t(e) {
|
|
1462
|
+
return e.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
1463
|
+
}
|
|
1464
|
+
function vt(e) {
|
|
1465
|
+
let t = 0;
|
|
1466
|
+
for (let n = 0; n < e.length; n++) t = e.charCodeAt(n) + ((t << 5) - t);
|
|
1467
|
+
return `hsl(${Math.abs(t) % 360}, 50%, 40%)`;
|
|
1468
|
+
}
|
|
1469
|
+
function q({ name: e, src: t, size: n = "md", className: r }) {
|
|
1470
|
+
return /* @__PURE__ */ p("div", {
|
|
1471
|
+
className: I("text-text-on-avatar flex shrink-0 items-center justify-center rounded-full font-semibold", gt[n], r),
|
|
1472
|
+
style: { backgroundColor: t ? void 0 : vt(e) },
|
|
1473
|
+
"aria-label": e,
|
|
1474
|
+
children: t ? /* @__PURE__ */ p("img", {
|
|
1475
|
+
src: t,
|
|
1476
|
+
alt: e,
|
|
1477
|
+
className: "h-full w-full rounded-full object-cover"
|
|
1478
|
+
}) : _t(e)
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
//#endregion
|
|
1482
|
+
//#region src/components/ui/Toast.tsx
|
|
1483
|
+
var yt = n({ toast: () => {} });
|
|
1484
|
+
function bt() {
|
|
1485
|
+
return a(yt);
|
|
1486
|
+
}
|
|
1487
|
+
function xt({ children: e }) {
|
|
1488
|
+
let [t, n] = d([]), r = u(0), a = i((e, t, i = 4e3) => {
|
|
1489
|
+
let a = r.current++;
|
|
1490
|
+
n((n) => [...n, {
|
|
1491
|
+
id: a,
|
|
1492
|
+
type: e,
|
|
1493
|
+
message: t,
|
|
1494
|
+
duration: i
|
|
1495
|
+
}]);
|
|
1496
|
+
}, []), o = i((e) => {
|
|
1497
|
+
n((t) => t.filter((t) => t.id !== e));
|
|
1498
|
+
}, []);
|
|
1499
|
+
return /* @__PURE__ */ m(yt.Provider, {
|
|
1500
|
+
value: { toast: a },
|
|
1501
|
+
children: [e, /* @__PURE__ */ p("div", {
|
|
1502
|
+
className: "pointer-events-none fixed top-3 right-3 z-[100] flex flex-col gap-2",
|
|
1503
|
+
"aria-live": "polite",
|
|
1504
|
+
children: t.map((e) => /* @__PURE__ */ p(Tt, {
|
|
1505
|
+
toast: e,
|
|
1506
|
+
onDismiss: () => o(e.id)
|
|
1507
|
+
}, e.id))
|
|
1508
|
+
})]
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
var St = {
|
|
1512
|
+
success: w,
|
|
1513
|
+
error: me,
|
|
1514
|
+
warning: _,
|
|
1515
|
+
info: te
|
|
1516
|
+
}, Ct = {
|
|
1517
|
+
success: "bg-green",
|
|
1518
|
+
error: "bg-red",
|
|
1519
|
+
warning: "bg-yellow",
|
|
1520
|
+
info: "bg-blue"
|
|
1521
|
+
}, wt = {
|
|
1522
|
+
success: "text-green",
|
|
1523
|
+
error: "text-red",
|
|
1524
|
+
warning: "text-yellow",
|
|
1525
|
+
info: "text-blue"
|
|
1526
|
+
};
|
|
1527
|
+
function Tt({ toast: e, onDismiss: t }) {
|
|
1528
|
+
let [n, r] = d(100), i = St[e.type], a = e.type === "error" || e.type === "warning", s = u(t);
|
|
1529
|
+
return o(() => {
|
|
1530
|
+
s.current = t;
|
|
1531
|
+
}, [t]), o(() => {
|
|
1532
|
+
let t = Date.now(), n = setInterval(() => {
|
|
1533
|
+
let i = Date.now() - t, a = Math.max(0, 100 - i / e.duration * 100);
|
|
1534
|
+
r(a), a <= 0 && (s.current(), clearInterval(n));
|
|
1535
|
+
}, 50);
|
|
1536
|
+
return () => clearInterval(n);
|
|
1537
|
+
}, [e.duration]), /* @__PURE__ */ m("div", {
|
|
1538
|
+
role: a ? "alert" : "status",
|
|
1539
|
+
"aria-live": a ? "assertive" : "polite",
|
|
1540
|
+
className: "bg-bg-secondary border-border animate-slide-down pointer-events-auto relative w-80 overflow-hidden rounded-lg border shadow-lg",
|
|
1541
|
+
children: [
|
|
1542
|
+
/* @__PURE__ */ p("div", { className: I("absolute top-1.5 bottom-1.5 left-0 w-[3px] rounded-md", Ct[e.type]) }),
|
|
1543
|
+
/* @__PURE__ */ m("div", {
|
|
1544
|
+
className: "flex items-center gap-2.5 p-3 pl-3.5",
|
|
1545
|
+
children: [
|
|
1546
|
+
/* @__PURE__ */ p(i, { className: I("h-4 w-4 shrink-0", wt[e.type]) }),
|
|
1547
|
+
/* @__PURE__ */ p("p", {
|
|
1548
|
+
className: "text-text-primary flex-1 text-xs",
|
|
1549
|
+
children: e.message
|
|
1550
|
+
}),
|
|
1551
|
+
/* @__PURE__ */ p("button", {
|
|
1552
|
+
onClick: t,
|
|
1553
|
+
className: "text-text-tertiary hover:text-text-primary flex h-5 w-5 cursor-pointer items-center justify-center rounded",
|
|
1554
|
+
children: /* @__PURE__ */ p(N, { className: "h-3 w-3" })
|
|
1555
|
+
})
|
|
1556
|
+
]
|
|
1557
|
+
}),
|
|
1558
|
+
/* @__PURE__ */ p("div", {
|
|
1559
|
+
className: "bg-bg-tertiary mx-3 mb-1 h-0.5 overflow-hidden rounded-md",
|
|
1560
|
+
children: /* @__PURE__ */ p("div", {
|
|
1561
|
+
className: "bg-border h-full rounded-md transition-all duration-[100ms]",
|
|
1562
|
+
style: { width: `${n}%` }
|
|
1563
|
+
})
|
|
1564
|
+
})
|
|
1565
|
+
]
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
//#endregion
|
|
1569
|
+
//#region src/components/app-shell/Sidebar.tsx
|
|
1570
|
+
var Et = 140, Dt = 400, Ot = 48;
|
|
1571
|
+
function kt({ item: e, collapsed: t, currentPath: n, onNavigate: r }) {
|
|
1572
|
+
let i = R(e, n);
|
|
1573
|
+
return /* @__PURE__ */ m("a", {
|
|
1574
|
+
href: e.path,
|
|
1575
|
+
onClick: (t) => z(t, e.path, r),
|
|
1576
|
+
"aria-current": i ? "page" : void 0,
|
|
1577
|
+
className: I("font-navigation relative flex items-center gap-2 rounded px-2", "cursor-pointer transition-colors duration-[100ms]", t ? "mx-auto w-[2em] justify-center" : "", i ? "bg-accent-muted text-accent" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
|
|
1578
|
+
style: { height: "2em" },
|
|
1579
|
+
title: t ? e.label : void 0,
|
|
1580
|
+
children: [
|
|
1581
|
+
i && /* @__PURE__ */ p("div", {
|
|
1582
|
+
className: "bg-accent absolute left-0 w-0.5 rounded-md",
|
|
1583
|
+
style: {
|
|
1584
|
+
top: "0.3em",
|
|
1585
|
+
bottom: "0.3em"
|
|
1586
|
+
}
|
|
1587
|
+
}),
|
|
1588
|
+
/* @__PURE__ */ p("span", {
|
|
1589
|
+
className: "shrink-0",
|
|
1590
|
+
children: /* @__PURE__ */ p(e.icon, { className: "h-3.5 w-3.5" })
|
|
1591
|
+
}),
|
|
1592
|
+
!t && /* @__PURE__ */ p("span", {
|
|
1593
|
+
className: "truncate text-xs",
|
|
1594
|
+
children: e.label
|
|
1595
|
+
})
|
|
1596
|
+
]
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function At({ brand: e, collapsed: t }) {
|
|
1600
|
+
let n = e.icon, r = e.name.trim().charAt(0).toUpperCase();
|
|
1601
|
+
return e.logo && !t ? /* @__PURE__ */ p("div", {
|
|
1602
|
+
className: "flex min-w-0 items-center gap-2 px-2",
|
|
1603
|
+
children: e.logo
|
|
1604
|
+
}) : /* @__PURE__ */ m("div", {
|
|
1605
|
+
className: I("flex min-w-0 items-center gap-2 px-2", t && "mx-auto justify-center px-0"),
|
|
1606
|
+
children: [n ? /* @__PURE__ */ p(n, { className: "text-accent h-3.5 w-3.5 shrink-0" }) : t && r && /* @__PURE__ */ p("span", {
|
|
1607
|
+
className: "text-accent shrink-0 text-xs font-bold",
|
|
1608
|
+
children: r
|
|
1609
|
+
}), !t && /* @__PURE__ */ p("span", {
|
|
1610
|
+
className: "text-text-primary truncate text-xs font-semibold",
|
|
1611
|
+
children: e.name
|
|
1612
|
+
})]
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
function jt(e) {
|
|
1616
|
+
return e.role ?? e.email;
|
|
1617
|
+
}
|
|
1618
|
+
function Mt({ collapsed: e, accounts: t, initialAccountIndex: n = 0, onAccountChange: r, onSignOut: a, signOutPath: o, signOutLabel: s = "Sign out", onNavigate: c }) {
|
|
1619
|
+
let [l, h] = d(!1), [g, _] = d(() => Math.min(n, Math.max(t.length - 1, 0))), [v, y] = d({
|
|
1620
|
+
bottom: 0,
|
|
1621
|
+
left: 0
|
|
1622
|
+
}), b = u(null), x = u(null);
|
|
1623
|
+
W(l, i(() => h(!1), []), [x], [b]);
|
|
1624
|
+
let S = t[g] ?? t[0], w = !!(a || o);
|
|
1625
|
+
function T() {
|
|
1626
|
+
if (!b.current) return;
|
|
1627
|
+
let e = b.current.getBoundingClientRect();
|
|
1628
|
+
y({
|
|
1629
|
+
bottom: window.innerHeight - e.bottom,
|
|
1630
|
+
left: e.right + 6
|
|
1631
|
+
}), h(!l);
|
|
1632
|
+
}
|
|
1633
|
+
function E(e, t) {
|
|
1634
|
+
_(t), r?.(e, t), h(!1);
|
|
1635
|
+
}
|
|
1636
|
+
function D() {
|
|
1637
|
+
h(!1), a ? a() : o && Qe(o, c);
|
|
1638
|
+
}
|
|
1639
|
+
return S ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
|
|
1640
|
+
ref: b,
|
|
1641
|
+
onClick: T,
|
|
1642
|
+
className: I("font-navigation flex w-full cursor-pointer items-center gap-2 rounded px-2 transition-colors duration-[100ms]", "text-text-secondary hover:text-text-primary hover:bg-bg-hover", e && "justify-center px-0"),
|
|
1643
|
+
style: { height: "2.5em" },
|
|
1644
|
+
title: e ? S.name : void 0,
|
|
1645
|
+
children: [/* @__PURE__ */ p(q, {
|
|
1646
|
+
name: S.name,
|
|
1647
|
+
src: S.avatarSrc,
|
|
1648
|
+
size: "sm"
|
|
1649
|
+
}), !e && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("div", {
|
|
1650
|
+
className: "min-w-0 flex-1 text-left",
|
|
1651
|
+
children: [/* @__PURE__ */ p("p", {
|
|
1652
|
+
className: "text-text-primary truncate text-xs leading-tight font-medium",
|
|
1653
|
+
children: S.name
|
|
1654
|
+
}), jt(S) && /* @__PURE__ */ p("p", {
|
|
1655
|
+
className: "text-2xs text-text-tertiary truncate leading-tight",
|
|
1656
|
+
children: jt(S)
|
|
1657
|
+
})]
|
|
1658
|
+
}), /* @__PURE__ */ p(O, { className: "text-text-tertiary h-3 w-3 shrink-0" })] })]
|
|
1659
|
+
}), l && P(/* @__PURE__ */ m("div", {
|
|
1660
|
+
ref: x,
|
|
1661
|
+
className: "bg-bg-tertiary border-border-strong animate-scale-in fixed z-[100] w-56 rounded-md border py-1 shadow-lg",
|
|
1662
|
+
style: {
|
|
1663
|
+
bottom: v.bottom,
|
|
1664
|
+
left: v.left
|
|
1665
|
+
},
|
|
1666
|
+
children: [
|
|
1667
|
+
/* @__PURE__ */ p("p", {
|
|
1668
|
+
className: "text-2xs-f text-text-tertiary font-label px-3 py-1.5 font-semibold tracking-wider uppercase",
|
|
1669
|
+
children: "Accounts"
|
|
1670
|
+
}),
|
|
1671
|
+
t.map((e, t) => /* @__PURE__ */ m("button", {
|
|
1672
|
+
onClick: () => E(e, t),
|
|
1673
|
+
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-8 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
1674
|
+
children: [
|
|
1675
|
+
/* @__PURE__ */ p(q, {
|
|
1676
|
+
name: e.name,
|
|
1677
|
+
src: e.avatarSrc,
|
|
1678
|
+
size: "sm"
|
|
1679
|
+
}),
|
|
1680
|
+
/* @__PURE__ */ m("div", {
|
|
1681
|
+
className: "min-w-0 flex-1 text-left",
|
|
1682
|
+
children: [/* @__PURE__ */ p("p", {
|
|
1683
|
+
className: "text-text-primary truncate text-xs leading-tight",
|
|
1684
|
+
children: e.name
|
|
1685
|
+
}), e.email && /* @__PURE__ */ p("p", {
|
|
1686
|
+
className: "text-2xs text-text-tertiary truncate leading-tight",
|
|
1687
|
+
children: e.email
|
|
1688
|
+
})]
|
|
1689
|
+
}),
|
|
1690
|
+
t === g && /* @__PURE__ */ p(C, { className: "text-accent h-3.5 w-3.5 shrink-0" })
|
|
1691
|
+
]
|
|
1692
|
+
}, `${e.name}-${e.email ?? t}`)),
|
|
1693
|
+
w && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "border-border my-1 border-t" }), /* @__PURE__ */ m("button", {
|
|
1694
|
+
onClick: D,
|
|
1695
|
+
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
1696
|
+
children: [/* @__PURE__ */ p(re, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ p("span", { children: s })]
|
|
1697
|
+
})] })
|
|
1698
|
+
]
|
|
1699
|
+
}), document.body)] }) : null;
|
|
1700
|
+
}
|
|
1701
|
+
function Nt({ collapsed: e, settingsPath: t, settingsLabel: n = "All Settings", onOpenSettings: r, onNavigate: a }) {
|
|
1702
|
+
let [o, s] = d(!1), [c, l] = d({
|
|
1703
|
+
bottom: 0,
|
|
1704
|
+
left: 0
|
|
1705
|
+
}), h = u(null), _ = u(null), { accentColor: v, setAccentColor: y, reducedMotion: b, setReducedMotion: x, colorMode: S, setColorMode: w } = K(), { toast: T } = bt(), E = !!(t || r);
|
|
1706
|
+
W(o, i(() => s(!1), []), [_], [h]);
|
|
1707
|
+
function D() {
|
|
1708
|
+
if (!h.current) return;
|
|
1709
|
+
let e = h.current.getBoundingClientRect();
|
|
1710
|
+
l({
|
|
1711
|
+
bottom: window.innerHeight - e.bottom,
|
|
1712
|
+
left: e.right + 6
|
|
1713
|
+
}), s(!o);
|
|
1714
|
+
}
|
|
1715
|
+
function O() {
|
|
1716
|
+
s(!1), r ? r() : t && Qe(t, a);
|
|
1717
|
+
}
|
|
1718
|
+
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
|
|
1719
|
+
ref: h,
|
|
1720
|
+
onClick: D,
|
|
1721
|
+
className: I("font-navigation relative flex w-full items-center gap-2 rounded px-2", "cursor-pointer transition-colors duration-[100ms]", e ? "mx-auto w-[2em] justify-center" : "", o ? "bg-accent-muted text-accent" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
|
|
1722
|
+
style: { height: "2em" },
|
|
1723
|
+
title: e ? "Settings" : void 0,
|
|
1724
|
+
children: [/* @__PURE__ */ p(de, { className: "h-3.5 w-3.5 shrink-0" }), !e && /* @__PURE__ */ p("span", {
|
|
1725
|
+
className: "truncate text-xs",
|
|
1726
|
+
children: "Settings"
|
|
1727
|
+
})]
|
|
1728
|
+
}), o && P(/* @__PURE__ */ m("div", {
|
|
1729
|
+
ref: _,
|
|
1730
|
+
className: "bg-bg-tertiary border-border-strong animate-scale-in fixed z-[100] w-64 rounded-md border py-1 shadow-lg",
|
|
1731
|
+
style: {
|
|
1732
|
+
bottom: c.bottom,
|
|
1733
|
+
left: c.left
|
|
1734
|
+
},
|
|
1735
|
+
children: [
|
|
1736
|
+
/* @__PURE__ */ p("p", {
|
|
1737
|
+
className: "text-2xs-f text-text-tertiary font-label px-3 py-1.5 font-semibold tracking-wider uppercase",
|
|
1738
|
+
children: "Mode"
|
|
1739
|
+
}),
|
|
1740
|
+
[
|
|
1741
|
+
{
|
|
1742
|
+
value: "dark",
|
|
1743
|
+
label: "Dark",
|
|
1744
|
+
Icon: se
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
value: "light",
|
|
1748
|
+
label: "Light",
|
|
1749
|
+
Icon: fe
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
value: "system",
|
|
1753
|
+
label: "System",
|
|
1754
|
+
Icon: oe
|
|
1755
|
+
}
|
|
1756
|
+
].map(({ value: e, label: t, Icon: n }) => /* @__PURE__ */ m("button", {
|
|
1757
|
+
onClick: () => w(e),
|
|
1758
|
+
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
1759
|
+
children: [
|
|
1760
|
+
/* @__PURE__ */ p(n, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
1761
|
+
/* @__PURE__ */ p("span", {
|
|
1762
|
+
className: "flex-1 text-left",
|
|
1763
|
+
children: t
|
|
1764
|
+
}),
|
|
1765
|
+
S === e && /* @__PURE__ */ p(C, { className: "text-accent h-3.5 w-3.5 shrink-0" })
|
|
1766
|
+
]
|
|
1767
|
+
}, e)),
|
|
1768
|
+
/* @__PURE__ */ p("div", { className: "border-border my-1 border-t" }),
|
|
1769
|
+
/* @__PURE__ */ p("p", {
|
|
1770
|
+
className: "text-2xs-f text-text-tertiary font-label px-3 py-1.5 font-semibold tracking-wider uppercase",
|
|
1771
|
+
children: "Accent"
|
|
1772
|
+
}),
|
|
1773
|
+
/* @__PURE__ */ p("div", {
|
|
1774
|
+
className: "flex flex-wrap gap-1.5 px-3 pb-2",
|
|
1775
|
+
children: ht.map((e) => /* @__PURE__ */ p("button", {
|
|
1776
|
+
onClick: () => y(e.value),
|
|
1777
|
+
className: I("h-5 w-5 cursor-pointer rounded-full transition-transform duration-[100ms] hover:scale-110", v === e.value && "ring-offset-bg-tertiary scale-110 ring-2 ring-offset-1"),
|
|
1778
|
+
style: {
|
|
1779
|
+
backgroundColor: e.color,
|
|
1780
|
+
...v === e.value ? { "--utility-ring-color": e.color } : {}
|
|
1781
|
+
},
|
|
1782
|
+
title: e.value.charAt(0).toUpperCase() + e.value.slice(1)
|
|
1783
|
+
}, e.value))
|
|
1784
|
+
}),
|
|
1785
|
+
/* @__PURE__ */ p("div", { className: "border-border my-1 border-t" }),
|
|
1786
|
+
/* @__PURE__ */ m("button", {
|
|
1787
|
+
onClick: () => {
|
|
1788
|
+
x(!b), T("info", b ? "Animations enabled" : "Animations disabled");
|
|
1789
|
+
},
|
|
1790
|
+
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
1791
|
+
children: [
|
|
1792
|
+
/* @__PURE__ */ p(g, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
1793
|
+
/* @__PURE__ */ p("span", {
|
|
1794
|
+
className: "flex-1 text-left",
|
|
1795
|
+
children: "Reduced Motion"
|
|
1796
|
+
}),
|
|
1797
|
+
b && /* @__PURE__ */ p(C, { className: "text-accent h-3.5 w-3.5 shrink-0" })
|
|
1798
|
+
]
|
|
1799
|
+
}),
|
|
1800
|
+
E && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "border-border my-1 border-t" }), /* @__PURE__ */ m("button", {
|
|
1801
|
+
onClick: O,
|
|
1802
|
+
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
1803
|
+
children: [/* @__PURE__ */ p(de, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ p("span", {
|
|
1804
|
+
className: "flex-1 text-left",
|
|
1805
|
+
children: n
|
|
1806
|
+
})]
|
|
1807
|
+
})] })
|
|
1808
|
+
]
|
|
1809
|
+
}), document.body)] });
|
|
1810
|
+
}
|
|
1811
|
+
function Pt({ navSections: e, brand: t, accounts: n = [], initialAccountIndex: r, onAccountChange: a, onSignOut: o, signOutPath: s, signOutLabel: c, settingsPath: l, settingsLabel: f, onOpenSettings: h, currentPath: g, onNavigate: _, className: v }) {
|
|
1812
|
+
let { sidebarCollapsed: y, sidebarWidth: b, setSidebarWidth: x } = K(), [S, C] = d(/* @__PURE__ */ new Set()), w = u(null), E = u(!1), D = i((e) => {
|
|
1813
|
+
if (y) return;
|
|
1814
|
+
e.preventDefault(), E.current = !0, document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
1815
|
+
let t = (e) => {
|
|
1816
|
+
if (!E.current || !w.current) return;
|
|
1817
|
+
let t = w.current.getBoundingClientRect(), n = e.clientX - t.left;
|
|
1818
|
+
x(Math.max(Et, Math.min(n, Dt)));
|
|
1819
|
+
}, n = () => {
|
|
1820
|
+
E.current = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
1821
|
+
};
|
|
1822
|
+
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
1823
|
+
}, [y, x]);
|
|
1824
|
+
function O(e) {
|
|
1825
|
+
C((t) => {
|
|
1826
|
+
let n = new Set(t);
|
|
1827
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
return /* @__PURE__ */ m("aside", {
|
|
1831
|
+
ref: w,
|
|
1832
|
+
className: I("bg-bg-secondary relative hidden shrink-0 flex-col border-r md:flex", "transition-[width] duration-[200ms] ease-out", "border-border", v),
|
|
1833
|
+
style: { width: y ? Ot : b },
|
|
1834
|
+
children: [
|
|
1835
|
+
!y && /* @__PURE__ */ p("div", {
|
|
1836
|
+
onMouseDown: D,
|
|
1837
|
+
className: "hover:bg-accent/30 active:bg-accent/50 absolute top-0 right-0 bottom-0 z-10 w-1 cursor-col-resize"
|
|
1838
|
+
}),
|
|
1839
|
+
/* @__PURE__ */ p("div", {
|
|
1840
|
+
className: "border-border flex shrink-0 items-center border-b px-2",
|
|
1841
|
+
style: { height: "var(--topbar-height)" },
|
|
1842
|
+
children: /* @__PURE__ */ p(At, {
|
|
1843
|
+
brand: t,
|
|
1844
|
+
collapsed: y
|
|
1845
|
+
})
|
|
1846
|
+
}),
|
|
1847
|
+
/* @__PURE__ */ p("nav", {
|
|
1848
|
+
className: "flex-1 overflow-y-auto px-2 py-2",
|
|
1849
|
+
children: e.map((e, t) => {
|
|
1850
|
+
let n = S.has(e.title);
|
|
1851
|
+
return /* @__PURE__ */ m("div", {
|
|
1852
|
+
className: "mb-4",
|
|
1853
|
+
children: [y ? t > 0 && /* @__PURE__ */ p("hr", { className: "border-border mx-auto my-1.5 w-4/5" }) : /* @__PURE__ */ m("button", {
|
|
1854
|
+
onClick: () => O(e.title),
|
|
1855
|
+
className: "text-2xs-f text-text-tertiary hover:text-text-secondary font-label flex w-full cursor-pointer items-center justify-between px-2 font-semibold tracking-wider uppercase",
|
|
1856
|
+
style: {
|
|
1857
|
+
paddingTop: "0.35em",
|
|
1858
|
+
paddingBottom: "0.35em"
|
|
1859
|
+
},
|
|
1860
|
+
children: [e.title, /* @__PURE__ */ p(T, { className: I("h-3 w-3 transition-transform", n && "-rotate-90") })]
|
|
1861
|
+
}), (!n || y) && /* @__PURE__ */ p("ul", {
|
|
1862
|
+
className: "flex flex-col gap-1",
|
|
1863
|
+
children: e.items.map((e) => /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p(kt, {
|
|
1864
|
+
item: e,
|
|
1865
|
+
collapsed: y,
|
|
1866
|
+
currentPath: g,
|
|
1867
|
+
onNavigate: _
|
|
1868
|
+
}) }, e.path))
|
|
1869
|
+
})]
|
|
1870
|
+
}, e.title);
|
|
1871
|
+
})
|
|
1872
|
+
}),
|
|
1873
|
+
/* @__PURE__ */ m("div", {
|
|
1874
|
+
className: "shrink-0 px-2 py-1.5",
|
|
1875
|
+
children: [/* @__PURE__ */ p(Nt, {
|
|
1876
|
+
collapsed: y,
|
|
1877
|
+
settingsPath: l,
|
|
1878
|
+
settingsLabel: f,
|
|
1879
|
+
onOpenSettings: h,
|
|
1880
|
+
onNavigate: _
|
|
1881
|
+
}), n.length > 0 && /* @__PURE__ */ p("div", {
|
|
1882
|
+
className: "border-border mt-2 border-t pt-2",
|
|
1883
|
+
children: /* @__PURE__ */ p(Mt, {
|
|
1884
|
+
collapsed: y,
|
|
1885
|
+
accounts: n,
|
|
1886
|
+
initialAccountIndex: r,
|
|
1887
|
+
onAccountChange: a,
|
|
1888
|
+
onSignOut: o,
|
|
1889
|
+
signOutPath: s,
|
|
1890
|
+
signOutLabel: c,
|
|
1891
|
+
onNavigate: _
|
|
1892
|
+
})
|
|
1893
|
+
})]
|
|
1894
|
+
})
|
|
1895
|
+
]
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
//#endregion
|
|
1899
|
+
//#region src/components/app-shell/Breadcrumbs.tsx
|
|
1900
|
+
function Ft(e) {
|
|
1901
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1902
|
+
}
|
|
1903
|
+
function It({ homeLabel: e = "Dashboard", labels: t = {}, parents: n = {}, currentPath: r = "/", onNavigate: i, className: a }) {
|
|
1904
|
+
let o = r.split("?")[0].split("/").filter(Boolean), s = [{
|
|
1905
|
+
label: e,
|
|
1906
|
+
path: "/"
|
|
1907
|
+
}, ...o.map((e, r) => {
|
|
1908
|
+
let i = o[r - 1];
|
|
1909
|
+
return {
|
|
1910
|
+
label: t[e] || n[i] || Ft(e),
|
|
1911
|
+
path: "/" + o.slice(0, r + 1).join("/")
|
|
1912
|
+
};
|
|
1913
|
+
})];
|
|
1914
|
+
return /* @__PURE__ */ p("nav", {
|
|
1915
|
+
"aria-label": "Breadcrumb",
|
|
1916
|
+
className: I("font-navigation flex items-center gap-1 text-xs", a),
|
|
1917
|
+
children: s.map((e, t) => {
|
|
1918
|
+
let n = t === s.length - 1;
|
|
1919
|
+
return /* @__PURE__ */ m("span", {
|
|
1920
|
+
className: "flex items-center gap-1",
|
|
1921
|
+
children: [t > 0 && /* @__PURE__ */ p(D, { className: "text-text-tertiary h-3 w-3" }), n ? /* @__PURE__ */ p("span", {
|
|
1922
|
+
className: "text-text-primary font-medium",
|
|
1923
|
+
children: e.label
|
|
1924
|
+
}) : /* @__PURE__ */ p("a", {
|
|
1925
|
+
href: e.path,
|
|
1926
|
+
onClick: (t) => z(t, e.path, i),
|
|
1927
|
+
className: I("text-text-tertiary hover:text-text-primary cursor-pointer transition-colors duration-[100ms]"),
|
|
1928
|
+
children: e.label
|
|
1929
|
+
})]
|
|
1930
|
+
}, e.path);
|
|
1931
|
+
})
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
//#endregion
|
|
1935
|
+
//#region src/components/app-shell/TopBar.tsx
|
|
1936
|
+
var Lt = [
|
|
1937
|
+
"dark",
|
|
1938
|
+
"light",
|
|
1939
|
+
"system"
|
|
1940
|
+
], Rt = {
|
|
1941
|
+
dark: se,
|
|
1942
|
+
light: fe,
|
|
1943
|
+
system: oe
|
|
1944
|
+
}, zt = {
|
|
1945
|
+
dark: "Dark",
|
|
1946
|
+
light: "Light",
|
|
1947
|
+
system: "System"
|
|
1948
|
+
};
|
|
1949
|
+
function Bt({ onMobileMenuToggle: e, breadcrumbs: t, showCommandTrigger: n = !0, commandTriggerLabel: r = "Search", commandShortcut: i = nt, currentPath: a, onNavigate: o, onCommandTrigger: s }) {
|
|
1950
|
+
let { sidebarCollapsed: c, setSidebarCollapsed: l, colorMode: u, setColorMode: d } = K();
|
|
1951
|
+
function h() {
|
|
1952
|
+
d(Lt[(Lt.indexOf(u) + 1) % Lt.length]);
|
|
1953
|
+
}
|
|
1954
|
+
let g = Rt[u];
|
|
1955
|
+
return /* @__PURE__ */ m("header", {
|
|
1956
|
+
className: "border-border bg-bg-secondary font-navigation flex h-9 shrink-0 items-center justify-between border-b px-3",
|
|
1957
|
+
style: { height: "var(--topbar-height)" },
|
|
1958
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1959
|
+
className: "flex items-center gap-2",
|
|
1960
|
+
children: [
|
|
1961
|
+
/* @__PURE__ */ p("button", {
|
|
1962
|
+
onClick: e,
|
|
1963
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-7 w-7 cursor-pointer items-center justify-center rounded md:hidden",
|
|
1964
|
+
"aria-label": "Toggle menu",
|
|
1965
|
+
children: /* @__PURE__ */ p(ie, { className: "h-4 w-4" })
|
|
1966
|
+
}),
|
|
1967
|
+
/* @__PURE__ */ p("button", {
|
|
1968
|
+
onClick: () => l(!c),
|
|
1969
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover hidden h-7 w-7 cursor-pointer items-center justify-center rounded md:flex",
|
|
1970
|
+
"aria-label": c ? "Expand sidebar" : "Collapse sidebar",
|
|
1971
|
+
children: p(c ? ue : le, { className: "h-4 w-4" })
|
|
1972
|
+
}),
|
|
1973
|
+
t !== !1 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "bg-border hidden h-4 w-px md:block" }), /* @__PURE__ */ p(It, {
|
|
1974
|
+
...t,
|
|
1975
|
+
currentPath: a,
|
|
1976
|
+
onNavigate: o
|
|
1977
|
+
})] })
|
|
1978
|
+
]
|
|
1979
|
+
}), /* @__PURE__ */ m("div", {
|
|
1980
|
+
className: "flex items-center gap-1",
|
|
1981
|
+
children: [n && /* @__PURE__ */ m("button", {
|
|
1982
|
+
onClick: s ?? (() => rt()),
|
|
1983
|
+
className: "text-text-tertiary bg-bg-primary border-border hover:border-border-strong hover:text-text-secondary font-navigation hidden h-6 cursor-pointer items-center gap-2 rounded-md border px-2 transition-colors duration-[100ms] sm:flex",
|
|
1984
|
+
children: [
|
|
1985
|
+
/* @__PURE__ */ p(M, { className: "h-3 w-3" }),
|
|
1986
|
+
/* @__PURE__ */ p("span", {
|
|
1987
|
+
className: "text-2xs",
|
|
1988
|
+
children: r
|
|
1989
|
+
}),
|
|
1990
|
+
/* @__PURE__ */ p("kbd", {
|
|
1991
|
+
className: "text-2xs font-mono opacity-60",
|
|
1992
|
+
children: i.label
|
|
1993
|
+
})
|
|
1994
|
+
]
|
|
1995
|
+
}), /* @__PURE__ */ p("button", {
|
|
1996
|
+
onClick: h,
|
|
1997
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-7 w-7 cursor-pointer items-center justify-center rounded",
|
|
1998
|
+
"aria-label": `Color mode: ${zt[u]}. Click to cycle.`,
|
|
1999
|
+
title: zt[u],
|
|
2000
|
+
children: /* @__PURE__ */ p(g, { className: "h-4 w-4" })
|
|
2001
|
+
})]
|
|
2002
|
+
})]
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
//#endregion
|
|
2006
|
+
//#region src/components/app-shell/AppShell.tsx
|
|
2007
|
+
function Vt({ children: e, navSections: t, brand: n, accounts: r, bottomNavItems: i = [], commandItems: a, breadcrumbs: o, initialAccountIndex: s, onAccountChange: c, onSignOut: u, signOutPath: f, signOutLabel: h, settingsPath: g, settingsLabel: _, onOpenSettings: v, showCommandPalette: y = !0, showCommandTrigger: b = !0, commandTriggerLabel: x, commandShortcut: S, currentPath: C, onNavigate: w, mainClassName: T, className: E }) {
|
|
2008
|
+
let [D, O] = d(!1), k = l(() => t.flatMap((e) => e.items), [t]), A = a ?? k;
|
|
2009
|
+
return /* @__PURE__ */ m("div", {
|
|
2010
|
+
className: I("bg-bg-primary flex h-svh overflow-hidden", E),
|
|
2011
|
+
children: [
|
|
2012
|
+
/* @__PURE__ */ p("a", {
|
|
2013
|
+
href: "#main-content",
|
|
2014
|
+
className: "skip-link",
|
|
2015
|
+
children: "Skip to content"
|
|
2016
|
+
}),
|
|
2017
|
+
/* @__PURE__ */ p(Pt, {
|
|
2018
|
+
navSections: t,
|
|
2019
|
+
brand: n,
|
|
2020
|
+
accounts: r,
|
|
2021
|
+
initialAccountIndex: s,
|
|
2022
|
+
onAccountChange: c,
|
|
2023
|
+
onSignOut: u,
|
|
2024
|
+
signOutPath: f,
|
|
2025
|
+
signOutLabel: h,
|
|
2026
|
+
settingsPath: g,
|
|
2027
|
+
settingsLabel: _,
|
|
2028
|
+
onOpenSettings: v,
|
|
2029
|
+
currentPath: C,
|
|
2030
|
+
onNavigate: w
|
|
2031
|
+
}),
|
|
2032
|
+
/* @__PURE__ */ m("div", {
|
|
2033
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
2034
|
+
children: [/* @__PURE__ */ p(Bt, {
|
|
2035
|
+
onMobileMenuToggle: () => O(!0),
|
|
2036
|
+
breadcrumbs: o,
|
|
2037
|
+
showCommandTrigger: y && b,
|
|
2038
|
+
commandTriggerLabel: x,
|
|
2039
|
+
commandShortcut: S,
|
|
2040
|
+
currentPath: C,
|
|
2041
|
+
onNavigate: w
|
|
2042
|
+
}), /* @__PURE__ */ p("main", {
|
|
2043
|
+
id: "main-content",
|
|
2044
|
+
className: I("flex-1 overflow-y-auto p-4 pb-20 md:p-6 md:pb-6", T),
|
|
2045
|
+
children: e
|
|
2046
|
+
})]
|
|
2047
|
+
}),
|
|
2048
|
+
/* @__PURE__ */ p($e, {
|
|
2049
|
+
items: i,
|
|
2050
|
+
currentPath: C,
|
|
2051
|
+
onNavigate: w
|
|
2052
|
+
}),
|
|
2053
|
+
/* @__PURE__ */ p(ct, {
|
|
2054
|
+
open: D,
|
|
2055
|
+
onClose: () => O(!1),
|
|
2056
|
+
items: k,
|
|
2057
|
+
brand: n,
|
|
2058
|
+
currentPath: C,
|
|
2059
|
+
onNavigate: w
|
|
2060
|
+
}),
|
|
2061
|
+
y && A.length > 0 && /* @__PURE__ */ p(ot, {
|
|
2062
|
+
items: A,
|
|
2063
|
+
shortcut: S,
|
|
2064
|
+
onNavigate: w
|
|
2065
|
+
})
|
|
2066
|
+
]
|
|
2067
|
+
});
|
|
2068
|
+
}
|
|
2069
|
+
//#endregion
|
|
2070
|
+
//#region src/components/app-shell/AuthLayout.tsx
|
|
2071
|
+
function Ht({ children: e, className: t }) {
|
|
2072
|
+
return /* @__PURE__ */ m("div", {
|
|
2073
|
+
className: I("bg-bg-primary relative flex min-h-svh items-center justify-center p-4", t),
|
|
2074
|
+
children: [/* @__PURE__ */ p("div", {
|
|
2075
|
+
className: "pointer-events-none absolute inset-0 opacity-30",
|
|
2076
|
+
style: { background: "radial-gradient(ellipse at 50% 30%, var(--accent-muted) 0%, transparent 60%)" }
|
|
2077
|
+
}), e]
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
//#endregion
|
|
2081
|
+
//#region src/components/app-shell/BackLink.tsx
|
|
2082
|
+
function Ut({ to: e, children: t, onNavigate: n, className: r }) {
|
|
2083
|
+
return /* @__PURE__ */ m("a", {
|
|
2084
|
+
href: e,
|
|
2085
|
+
onClick: (t) => z(t, e, n),
|
|
2086
|
+
className: I("inline-flex items-center gap-1.5", "text-text-tertiary text-xs", "hover:text-text-primary", r),
|
|
2087
|
+
children: [/* @__PURE__ */ p(y, { className: "h-3.5 w-3.5" }), t]
|
|
2088
|
+
});
|
|
2089
|
+
}
|
|
2090
|
+
//#endregion
|
|
2091
|
+
//#region src/components/ui/Checkbox.tsx
|
|
2092
|
+
function Wt({ checked: e, indeterminate: t, onChange: n, label: r, disabled: i, className: a }) {
|
|
2093
|
+
let o = e || t;
|
|
2094
|
+
return /* @__PURE__ */ m("label", {
|
|
2095
|
+
className: I("flex w-fit items-center gap-2.5", i ? "cursor-not-allowed opacity-40" : "cursor-pointer", a),
|
|
2096
|
+
children: [/* @__PURE__ */ p("button", {
|
|
2097
|
+
role: "checkbox",
|
|
2098
|
+
"aria-checked": t ? "mixed" : e,
|
|
2099
|
+
disabled: i,
|
|
2100
|
+
onClick: () => n(!e),
|
|
2101
|
+
className: I("flex h-4 w-4 shrink-0 items-center justify-center rounded border", "transition-colors duration-[100ms]", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2", o ? "bg-accent border-accent" : "bg-bg-secondary border-border", !i && "cursor-pointer"),
|
|
2102
|
+
children: t ? /* @__PURE__ */ p(ae, { className: "text-text-on-accent h-3 w-3" }) : e ? /* @__PURE__ */ p(C, { className: "text-text-on-accent h-3 w-3" }) : null
|
|
2103
|
+
}), r && /* @__PURE__ */ p("span", {
|
|
2104
|
+
className: "text-text-primary text-xs",
|
|
2105
|
+
children: r
|
|
2106
|
+
})]
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
//#endregion
|
|
2110
|
+
//#region src/components/ui/FilterButton.tsx
|
|
2111
|
+
var Gt = r(function({ icon: e, children: t, className: n, ...r }, i) {
|
|
2112
|
+
return /* @__PURE__ */ m("button", {
|
|
2113
|
+
ref: i,
|
|
2114
|
+
className: I("flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2.5", "border-border bg-bg-secondary text-text-secondary border", "hover:bg-bg-hover hover:border-border-strong", "text-xs", "transition-colors duration-[100ms]", n),
|
|
2115
|
+
...r,
|
|
2116
|
+
children: [/* @__PURE__ */ p(e, { className: "h-3.5 w-3.5 shrink-0" }), t && /* @__PURE__ */ p("span", {
|
|
2117
|
+
className: "hidden sm:inline",
|
|
2118
|
+
children: t
|
|
2119
|
+
})]
|
|
2120
|
+
});
|
|
2121
|
+
});
|
|
2122
|
+
//#endregion
|
|
2123
|
+
//#region src/components/tables/ColumnPicker.tsx
|
|
2124
|
+
function Kt({ columns: e, hidden: t, onToggle: n }) {
|
|
2125
|
+
let [r, a] = d(!1), o = u(null);
|
|
2126
|
+
return W(r, i(() => a(!1), []), [o]), /* @__PURE__ */ m("div", {
|
|
2127
|
+
className: "relative",
|
|
2128
|
+
ref: o,
|
|
2129
|
+
children: [/* @__PURE__ */ p(Gt, {
|
|
2130
|
+
icon: k,
|
|
2131
|
+
onClick: () => a(!r),
|
|
2132
|
+
children: "Columns"
|
|
2133
|
+
}), r && /* @__PURE__ */ m("div", {
|
|
2134
|
+
className: "bg-bg-tertiary border-border-strong animate-scale-in absolute top-full right-0 z-[100] mt-1 w-48 rounded-md border py-1 shadow-lg",
|
|
2135
|
+
children: [/* @__PURE__ */ p("p", {
|
|
2136
|
+
className: "text-2xs-f text-text-tertiary px-3 py-1.5 font-semibold tracking-wider uppercase",
|
|
2137
|
+
children: "Toggle columns"
|
|
2138
|
+
}), e.map((e) => /* @__PURE__ */ m("button", {
|
|
2139
|
+
onClick: () => n(e.key),
|
|
2140
|
+
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
2141
|
+
children: [/* @__PURE__ */ p(Wt, {
|
|
2142
|
+
checked: !t.has(e.key),
|
|
2143
|
+
onChange: () => n(e.key)
|
|
2144
|
+
}), /* @__PURE__ */ p("span", { children: e.header })]
|
|
2145
|
+
}, e.key))]
|
|
2146
|
+
})]
|
|
2147
|
+
});
|
|
2148
|
+
}
|
|
2149
|
+
//#endregion
|
|
2150
|
+
//#region src/components/tables/Pagination.tsx
|
|
2151
|
+
function qt({ page: e, totalPages: t, onPageChange: n }) {
|
|
2152
|
+
if (t <= 1) return null;
|
|
2153
|
+
let r = [];
|
|
2154
|
+
for (let n = 1; n <= t; n++) n === 1 || n === t || n >= e - 1 && n <= e + 1 ? r.push(n) : r[r.length - 1] !== "ellipsis" && r.push("ellipsis");
|
|
2155
|
+
return /* @__PURE__ */ m("div", {
|
|
2156
|
+
className: "flex items-center gap-1",
|
|
2157
|
+
children: [
|
|
2158
|
+
/* @__PURE__ */ p("button", {
|
|
2159
|
+
disabled: e === 1,
|
|
2160
|
+
onClick: () => n(e - 1),
|
|
2161
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-7 w-7 cursor-pointer items-center justify-center rounded disabled:cursor-not-allowed disabled:opacity-30",
|
|
2162
|
+
"aria-label": "Previous page",
|
|
2163
|
+
children: /* @__PURE__ */ p(E, { className: "h-3.5 w-3.5" })
|
|
2164
|
+
}),
|
|
2165
|
+
r.map((t, r) => t === "ellipsis" ? /* @__PURE__ */ p("span", {
|
|
2166
|
+
className: "text-text-tertiary flex h-7 w-7 items-center justify-center text-xs",
|
|
2167
|
+
children: "..."
|
|
2168
|
+
}, `e${r}`) : /* @__PURE__ */ p("button", {
|
|
2169
|
+
onClick: () => n(t),
|
|
2170
|
+
className: I("flex h-7 w-7 cursor-pointer items-center justify-center rounded text-xs font-medium", "transition-colors duration-[100ms]", t === e ? "bg-accent text-text-on-accent" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
|
|
2171
|
+
children: t
|
|
2172
|
+
}, t)),
|
|
2173
|
+
/* @__PURE__ */ p("button", {
|
|
2174
|
+
disabled: e === t,
|
|
2175
|
+
onClick: () => n(e + 1),
|
|
2176
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-7 w-7 cursor-pointer items-center justify-center rounded disabled:cursor-not-allowed disabled:opacity-30",
|
|
2177
|
+
"aria-label": "Next page",
|
|
2178
|
+
children: /* @__PURE__ */ p(D, { className: "h-3.5 w-3.5" })
|
|
2179
|
+
})
|
|
2180
|
+
]
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
//#endregion
|
|
2184
|
+
//#region src/components/tables/sortRows.ts
|
|
2185
|
+
function Jt(e, t, n, r) {
|
|
2186
|
+
if (!n) return e;
|
|
2187
|
+
let i = t.find((e) => e.key === n)?.getValue;
|
|
2188
|
+
return i ? [...e].sort((e, t) => {
|
|
2189
|
+
let n = String(i(e)), a = String(i(t)), o = n.localeCompare(a, void 0, { numeric: !0 });
|
|
2190
|
+
return r === "asc" ? o : -o;
|
|
2191
|
+
}) : e;
|
|
2192
|
+
}
|
|
2193
|
+
//#endregion
|
|
2194
|
+
//#region src/components/tables/ResourceTable.tsx
|
|
2195
|
+
function Yt({ data: e, columns: t, getRowId: n, onRowClick: r, emptyMessage: i = "No data", sortKey: a, sortDir: o, onSortChange: s }) {
|
|
2196
|
+
let c = s !== void 0, [u, f] = d(null), [h, g] = d("asc"), _ = c ? a ?? null : u, y = c ? o ?? "asc" : h, x = l(() => c ? e : Jt(e, t, _, y), [
|
|
2197
|
+
c,
|
|
2198
|
+
e,
|
|
2199
|
+
t,
|
|
2200
|
+
_,
|
|
2201
|
+
y
|
|
2202
|
+
]);
|
|
2203
|
+
function S(e) {
|
|
2204
|
+
let t = _ === e && y === "asc" ? "desc" : "asc";
|
|
2205
|
+
if (c) {
|
|
2206
|
+
s(e, t);
|
|
2207
|
+
return;
|
|
2208
|
+
}
|
|
2209
|
+
f(e), g(t);
|
|
2210
|
+
}
|
|
2211
|
+
return /* @__PURE__ */ p("div", {
|
|
2212
|
+
className: "border-border overflow-x-auto rounded-md border",
|
|
2213
|
+
children: /* @__PURE__ */ m("table", {
|
|
2214
|
+
className: "font-data w-full text-xs",
|
|
2215
|
+
children: [/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ p("tr", {
|
|
2216
|
+
className: "border-border bg-bg-secondary border-b",
|
|
2217
|
+
children: t.map((e) => /* @__PURE__ */ p("th", {
|
|
2218
|
+
className: I("text-2xs text-text-tertiary font-label h-7 px-3 text-left font-semibold tracking-wider uppercase", e.sortable && "hover:text-text-secondary cursor-pointer select-none"),
|
|
2219
|
+
style: { width: e.width },
|
|
2220
|
+
onClick: e.sortable ? () => S(e.key) : void 0,
|
|
2221
|
+
children: /* @__PURE__ */ m("span", {
|
|
2222
|
+
className: "inline-flex items-center gap-1",
|
|
2223
|
+
children: [e.header, e.sortable && _ === e.key && p(y === "asc" ? b : v, { className: "h-3 w-3" })]
|
|
2224
|
+
})
|
|
2225
|
+
}, e.key))
|
|
2226
|
+
}) }), /* @__PURE__ */ p("tbody", { children: x.length === 0 ? /* @__PURE__ */ p("tr", { children: /* @__PURE__ */ p("td", {
|
|
2227
|
+
colSpan: t.length,
|
|
2228
|
+
className: "text-text-tertiary h-32 text-center",
|
|
2229
|
+
children: i
|
|
2230
|
+
}) }) : x.map((e) => /* @__PURE__ */ p("tr", {
|
|
2231
|
+
className: I("border-border h-8 border-b last:border-b-0", "hover:bg-bg-hover", r && "cursor-pointer"),
|
|
2232
|
+
onClick: r ? () => r(e) : void 0,
|
|
2233
|
+
children: t.map((t) => /* @__PURE__ */ p("td", {
|
|
2234
|
+
className: I("text-text-primary px-3 whitespace-nowrap", t.cellClassName),
|
|
2235
|
+
onClick: t.interactive && r ? (e) => e.stopPropagation() : void 0,
|
|
2236
|
+
children: t.render(e)
|
|
2237
|
+
}, t.key))
|
|
2238
|
+
}, n(e))) })]
|
|
2239
|
+
})
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
//#endregion
|
|
2243
|
+
//#region src/components/ui/Alert.tsx
|
|
2244
|
+
var Xt = {
|
|
2245
|
+
success: {
|
|
2246
|
+
bg: "bg-green-muted",
|
|
2247
|
+
border: "border-green/30",
|
|
2248
|
+
icon: w,
|
|
2249
|
+
iconColor: "text-green"
|
|
2250
|
+
},
|
|
2251
|
+
warning: {
|
|
2252
|
+
bg: "bg-yellow-muted",
|
|
2253
|
+
border: "border-yellow/30",
|
|
2254
|
+
icon: _,
|
|
2255
|
+
iconColor: "text-yellow"
|
|
2256
|
+
},
|
|
2257
|
+
error: {
|
|
2258
|
+
bg: "bg-red-muted",
|
|
2259
|
+
border: "border-red/30",
|
|
2260
|
+
icon: me,
|
|
2261
|
+
iconColor: "text-red"
|
|
2262
|
+
},
|
|
2263
|
+
info: {
|
|
2264
|
+
bg: "bg-blue-muted",
|
|
2265
|
+
border: "border-blue/30",
|
|
2266
|
+
icon: te,
|
|
2267
|
+
iconColor: "text-blue"
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2270
|
+
function Zt({ type: e, title: t, children: n, dismissible: r, className: i }) {
|
|
2271
|
+
let [a, o] = d(!1);
|
|
2272
|
+
if (a) return null;
|
|
2273
|
+
let s = Xt[e], c = s.icon;
|
|
2274
|
+
return /* @__PURE__ */ m("div", {
|
|
2275
|
+
className: I("flex gap-2.5 rounded-md border p-3", s.bg, s.border, i),
|
|
2276
|
+
children: [
|
|
2277
|
+
/* @__PURE__ */ p(c, { className: I("mt-0.5 h-4 w-4 shrink-0", s.iconColor) }),
|
|
2278
|
+
/* @__PURE__ */ m("div", {
|
|
2279
|
+
className: "min-w-0 flex-1",
|
|
2280
|
+
children: [t && /* @__PURE__ */ p("p", {
|
|
2281
|
+
className: "text-text-primary mb-0.5 text-xs font-semibold",
|
|
2282
|
+
children: t
|
|
2283
|
+
}), /* @__PURE__ */ p("div", {
|
|
2284
|
+
className: "text-text-secondary text-xs",
|
|
2285
|
+
children: n
|
|
2286
|
+
})]
|
|
2287
|
+
}),
|
|
2288
|
+
r && /* @__PURE__ */ p("button", {
|
|
2289
|
+
onClick: () => o(!0),
|
|
2290
|
+
className: "text-text-tertiary hover:text-text-primary flex h-5 w-5 cursor-pointer items-center justify-center rounded",
|
|
2291
|
+
"aria-label": "Dismiss",
|
|
2292
|
+
children: /* @__PURE__ */ p(N, { className: "h-3 w-3" })
|
|
2293
|
+
})
|
|
2294
|
+
]
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
//#endregion
|
|
2298
|
+
//#region src/components/ui/AuthCard.tsx
|
|
2299
|
+
function Qt({ title: e, subtitle: t, icon: n, children: r, footer: i, className: a }) {
|
|
2300
|
+
return /* @__PURE__ */ p("div", {
|
|
2301
|
+
className: I("relative z-10 w-full max-w-sm", a),
|
|
2302
|
+
children: /* @__PURE__ */ m("div", {
|
|
2303
|
+
className: "bg-bg-secondary border-border rounded-lg border p-8 shadow-lg",
|
|
2304
|
+
children: [
|
|
2305
|
+
/* @__PURE__ */ m("div", {
|
|
2306
|
+
className: "mb-6 flex flex-col items-center",
|
|
2307
|
+
children: [
|
|
2308
|
+
n && /* @__PURE__ */ p("div", {
|
|
2309
|
+
className: "bg-accent-muted mb-3 flex h-12 w-12 items-center justify-center rounded-xl",
|
|
2310
|
+
children: /* @__PURE__ */ p(n, { className: "text-accent h-6 w-6" })
|
|
2311
|
+
}),
|
|
2312
|
+
/* @__PURE__ */ p("h1", {
|
|
2313
|
+
className: "text-text-primary text-lg font-semibold",
|
|
2314
|
+
children: e
|
|
2315
|
+
}),
|
|
2316
|
+
t && /* @__PURE__ */ p("p", {
|
|
2317
|
+
className: "text-text-secondary mt-1 text-xs",
|
|
2318
|
+
children: t
|
|
2319
|
+
})
|
|
2320
|
+
]
|
|
2321
|
+
}),
|
|
2322
|
+
r,
|
|
2323
|
+
i && /* @__PURE__ */ p("p", {
|
|
2324
|
+
className: "text-text-secondary mt-6 text-center text-xs",
|
|
2325
|
+
children: i
|
|
2326
|
+
})
|
|
2327
|
+
]
|
|
2328
|
+
})
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
//#endregion
|
|
2332
|
+
//#region src/components/ui/AuthorByline.tsx
|
|
2333
|
+
function $t({ name: e, meta: t, nameAppend: n, size: r = "sm", className: i }) {
|
|
2334
|
+
return /* @__PURE__ */ m("div", {
|
|
2335
|
+
className: I("flex items-center gap-2", i),
|
|
2336
|
+
children: [/* @__PURE__ */ p(q, {
|
|
2337
|
+
name: e,
|
|
2338
|
+
size: "sm"
|
|
2339
|
+
}), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ m("p", {
|
|
2340
|
+
className: I("text-text-primary font-label font-medium", r === "md" ? "text-xs" : "text-2xs"),
|
|
2341
|
+
children: [e, n]
|
|
2342
|
+
}), t && /* @__PURE__ */ p("p", {
|
|
2343
|
+
className: "text-text-tertiary font-label text-2xs",
|
|
2344
|
+
children: t
|
|
2345
|
+
})] })]
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
//#endregion
|
|
2349
|
+
//#region src/components/ui/Badge.tsx
|
|
2350
|
+
var en = {
|
|
2351
|
+
green: "bg-green-muted text-green",
|
|
2352
|
+
yellow: "bg-yellow-muted text-yellow",
|
|
2353
|
+
red: "bg-red-muted text-red",
|
|
2354
|
+
blue: "bg-blue-muted text-blue",
|
|
2355
|
+
purple: "bg-purple-muted text-purple",
|
|
2356
|
+
gray: "bg-bg-hover text-text-secondary"
|
|
2357
|
+
}, tn = {
|
|
2358
|
+
green: "bg-green",
|
|
2359
|
+
yellow: "bg-yellow",
|
|
2360
|
+
red: "bg-red",
|
|
2361
|
+
blue: "bg-blue",
|
|
2362
|
+
purple: "bg-purple",
|
|
2363
|
+
gray: "bg-text-tertiary"
|
|
2364
|
+
};
|
|
2365
|
+
function nn({ color: e = "gray", dot: t, children: n, className: r }) {
|
|
2366
|
+
return /* @__PURE__ */ m("span", {
|
|
2367
|
+
className: I("font-label text-2xs inline-flex items-center gap-1.5 rounded-md px-2 py-0.5 font-medium", en[e], r),
|
|
2368
|
+
children: [t && /* @__PURE__ */ p("span", { className: I("h-1.5 w-1.5 rounded-full", tn[e]) }), n]
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
//#endregion
|
|
2372
|
+
//#region src/components/ui/Button.tsx
|
|
2373
|
+
var rn = {
|
|
2374
|
+
primary: "bg-accent text-text-on-accent hover:bg-accent-hover active:bg-accent-active",
|
|
2375
|
+
secondary: "bg-bg-secondary text-text-primary border border-border hover:bg-bg-hover hover:border-border-strong",
|
|
2376
|
+
danger: "bg-red-muted text-red border border-transparent hover:bg-red/20",
|
|
2377
|
+
ghost: "text-text-secondary hover:text-text-primary hover:bg-bg-hover",
|
|
2378
|
+
icon: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover"
|
|
2379
|
+
}, an = {
|
|
2380
|
+
sm: "h-7 px-2.5 text-xs gap-1.5",
|
|
2381
|
+
md: "h-8 px-3 text-xs gap-2",
|
|
2382
|
+
lg: "h-9 px-4 text-sm gap-2"
|
|
2383
|
+
}, on = {
|
|
2384
|
+
sm: "h-7 w-7",
|
|
2385
|
+
md: "h-8 w-8",
|
|
2386
|
+
lg: "h-9 w-9"
|
|
2387
|
+
}, sn = {
|
|
2388
|
+
sm: "h-3.5 w-3.5",
|
|
2389
|
+
md: "h-3.5 w-3.5",
|
|
2390
|
+
lg: "h-4 w-4"
|
|
2391
|
+
}, cn = {
|
|
2392
|
+
sm: "hidden sm:inline",
|
|
2393
|
+
md: "hidden md:inline",
|
|
2394
|
+
lg: "hidden lg:inline"
|
|
2395
|
+
}, ln = {
|
|
2396
|
+
sm: {
|
|
2397
|
+
sm: "px-1.5 sm:px-2.5",
|
|
2398
|
+
md: "px-2 sm:px-3",
|
|
2399
|
+
lg: "px-2.5 sm:px-4"
|
|
2400
|
+
},
|
|
2401
|
+
md: {
|
|
2402
|
+
sm: "px-1.5 md:px-2.5",
|
|
2403
|
+
md: "px-2 md:px-3",
|
|
2404
|
+
lg: "px-2.5 md:px-4"
|
|
2405
|
+
},
|
|
2406
|
+
lg: {
|
|
2407
|
+
sm: "px-1.5 lg:px-2.5",
|
|
2408
|
+
md: "px-2 lg:px-3",
|
|
2409
|
+
lg: "px-2.5 lg:px-4"
|
|
2410
|
+
}
|
|
2411
|
+
}, J = r(({ variant: e = "secondary", size: t = "md", loading: n, icon: r, hideLabel: i, className: a, children: o, disabled: s, ...c }, l) => {
|
|
2412
|
+
let u = e === "icon", d = i === !0 ? "sm" : i === !1 ? void 0 : i;
|
|
2413
|
+
return /* @__PURE__ */ m("button", {
|
|
2414
|
+
ref: l,
|
|
2415
|
+
disabled: s || n,
|
|
2416
|
+
className: I("inline-flex items-center justify-center rounded-md font-medium", "font-control", "transition-colors duration-[100ms] ease-out", "cursor-pointer", "disabled:cursor-not-allowed disabled:opacity-40", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2", rn[e], u ? on[t] : an[t], d && !u && ln[d]?.[t], a),
|
|
2417
|
+
...c,
|
|
2418
|
+
children: [
|
|
2419
|
+
n && /* @__PURE__ */ p(ne, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
2420
|
+
r && !n && /* @__PURE__ */ p(r, { className: sn[t] }),
|
|
2421
|
+
o && (d ? /* @__PURE__ */ p("span", {
|
|
2422
|
+
className: cn[d],
|
|
2423
|
+
children: o
|
|
2424
|
+
}) : o)
|
|
2425
|
+
]
|
|
2426
|
+
});
|
|
2427
|
+
});
|
|
2428
|
+
J.displayName = "Button";
|
|
2429
|
+
//#endregion
|
|
2430
|
+
//#region src/components/ui/CalendarGrid.tsx
|
|
2431
|
+
var un = [
|
|
2432
|
+
"Mo",
|
|
2433
|
+
"Tu",
|
|
2434
|
+
"We",
|
|
2435
|
+
"Th",
|
|
2436
|
+
"Fr",
|
|
2437
|
+
"Sa",
|
|
2438
|
+
"Su"
|
|
2439
|
+
], dn = [
|
|
2440
|
+
"January",
|
|
2441
|
+
"February",
|
|
2442
|
+
"March",
|
|
2443
|
+
"April",
|
|
2444
|
+
"May",
|
|
2445
|
+
"June",
|
|
2446
|
+
"July",
|
|
2447
|
+
"August",
|
|
2448
|
+
"September",
|
|
2449
|
+
"October",
|
|
2450
|
+
"November",
|
|
2451
|
+
"December"
|
|
2452
|
+
];
|
|
2453
|
+
function Y(e, t) {
|
|
2454
|
+
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
2455
|
+
}
|
|
2456
|
+
function fn(e, t, n) {
|
|
2457
|
+
if (!t || !n) return !1;
|
|
2458
|
+
let r = e.getTime(), i = Math.min(t.getTime(), n.getTime()), a = Math.max(t.getTime(), n.getTime());
|
|
2459
|
+
return r > i && r < a;
|
|
2460
|
+
}
|
|
2461
|
+
function pn(e, t) {
|
|
2462
|
+
return new Date(e, t + 1, 0).getDate();
|
|
2463
|
+
}
|
|
2464
|
+
function mn(e, t) {
|
|
2465
|
+
let n = new Date(e, t, 1).getDay();
|
|
2466
|
+
return n === 0 ? 6 : n - 1;
|
|
2467
|
+
}
|
|
2468
|
+
function X({ year: e, month: t, selected: n, rangeStart: r, rangeEnd: i, hoverDate: a, onSelect: o, onMonthChange: s, onHover: c, minDate: l, maxDate: f }) {
|
|
2469
|
+
let h = pn(e, t), g = mn(e, t), _ = /* @__PURE__ */ new Date(), v = u(null), [y, b] = d(null);
|
|
2470
|
+
function x() {
|
|
2471
|
+
return y !== null && y >= 1 && y <= h ? y : n && n.getFullYear() === e && n.getMonth() === t ? n.getDate() : r && r.getFullYear() === e && r.getMonth() === t ? r.getDate() : _.getFullYear() === e && _.getMonth() === t ? _.getDate() : 1;
|
|
2472
|
+
}
|
|
2473
|
+
let S = x();
|
|
2474
|
+
function C(e, t) {
|
|
2475
|
+
let n = 0;
|
|
2476
|
+
switch (e.key) {
|
|
2477
|
+
case "ArrowRight":
|
|
2478
|
+
n = 1;
|
|
2479
|
+
break;
|
|
2480
|
+
case "ArrowLeft":
|
|
2481
|
+
n = -1;
|
|
2482
|
+
break;
|
|
2483
|
+
case "ArrowDown":
|
|
2484
|
+
n = 7;
|
|
2485
|
+
break;
|
|
2486
|
+
case "ArrowUp":
|
|
2487
|
+
n = -7;
|
|
2488
|
+
break;
|
|
2489
|
+
default: return;
|
|
2490
|
+
}
|
|
2491
|
+
e.preventDefault();
|
|
2492
|
+
let r = t + n;
|
|
2493
|
+
r >= 1 && r <= h && (b(r), (v.current?.querySelector(`[data-day="${r}"]`))?.focus());
|
|
2494
|
+
}
|
|
2495
|
+
function w() {
|
|
2496
|
+
t === 0 ? s(e - 1, 11) : s(e, t - 1);
|
|
2497
|
+
}
|
|
2498
|
+
function T() {
|
|
2499
|
+
t === 11 ? s(e + 1, 0) : s(e, t + 1);
|
|
2500
|
+
}
|
|
2501
|
+
let O = [];
|
|
2502
|
+
for (let e = 0; e < g; e++) O.push(null);
|
|
2503
|
+
for (let e = 1; e <= h; e++) O.push(e);
|
|
2504
|
+
return /* @__PURE__ */ m("div", {
|
|
2505
|
+
className: "w-[252px]",
|
|
2506
|
+
ref: v,
|
|
2507
|
+
children: [/* @__PURE__ */ m("div", {
|
|
2508
|
+
className: "mb-2 flex items-center justify-between",
|
|
2509
|
+
children: [
|
|
2510
|
+
/* @__PURE__ */ p("button", {
|
|
2511
|
+
type: "button",
|
|
2512
|
+
onClick: w,
|
|
2513
|
+
"aria-label": "Previous month",
|
|
2514
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]",
|
|
2515
|
+
children: /* @__PURE__ */ p(E, { className: "h-3.5 w-3.5" })
|
|
2516
|
+
}),
|
|
2517
|
+
/* @__PURE__ */ m("span", {
|
|
2518
|
+
className: "text-text-primary text-xs font-semibold",
|
|
2519
|
+
"aria-live": "polite",
|
|
2520
|
+
children: [
|
|
2521
|
+
dn[t],
|
|
2522
|
+
" ",
|
|
2523
|
+
e
|
|
2524
|
+
]
|
|
2525
|
+
}),
|
|
2526
|
+
/* @__PURE__ */ p("button", {
|
|
2527
|
+
type: "button",
|
|
2528
|
+
onClick: T,
|
|
2529
|
+
"aria-label": "Next month",
|
|
2530
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]",
|
|
2531
|
+
children: /* @__PURE__ */ p(D, { className: "h-3.5 w-3.5" })
|
|
2532
|
+
})
|
|
2533
|
+
]
|
|
2534
|
+
}), /* @__PURE__ */ m("div", {
|
|
2535
|
+
className: "grid grid-cols-7 gap-0",
|
|
2536
|
+
children: [un.map((e) => /* @__PURE__ */ p("div", {
|
|
2537
|
+
className: "text-text-tertiary text-2xs flex h-8 items-center justify-center font-medium",
|
|
2538
|
+
children: e
|
|
2539
|
+
}, e)), O.map((s, u) => {
|
|
2540
|
+
if (s === null) return /* @__PURE__ */ p("div", { className: "h-8" }, `empty-${u}`);
|
|
2541
|
+
let d = new Date(e, t, s), m = Y(d, _), h = n ? Y(d, n) : !1, g = r ? Y(d, r) : !1, v = i ? Y(d, i) : !1, y = fn(d, r ?? null, i ?? a ?? null), b = l && d < l || f && d > f;
|
|
2542
|
+
return /* @__PURE__ */ p("button", {
|
|
2543
|
+
type: "button",
|
|
2544
|
+
"data-day": s,
|
|
2545
|
+
disabled: !!b,
|
|
2546
|
+
tabIndex: s === S ? 0 : -1,
|
|
2547
|
+
"aria-label": `${dn[t]} ${s}, ${e}`,
|
|
2548
|
+
"aria-current": m ? "date" : void 0,
|
|
2549
|
+
onClick: () => o(d),
|
|
2550
|
+
onKeyDown: (e) => C(e, s),
|
|
2551
|
+
onMouseEnter: () => c?.(d),
|
|
2552
|
+
onMouseLeave: () => c?.(null),
|
|
2553
|
+
className: I("flex h-8 w-full cursor-pointer items-center justify-center text-xs transition-colors duration-[100ms]", "rounded-md", b && "cursor-not-allowed opacity-30", !b && !h && !g && !v && !y && "hover:bg-bg-hover text-text-primary", m && !h && !g && !v && "text-accent font-semibold", (h || g || v) && "bg-accent text-text-on-accent font-semibold", y && !h && !g && !v && "bg-accent-muted text-accent"),
|
|
2554
|
+
children: s
|
|
2555
|
+
}, s);
|
|
2556
|
+
})]
|
|
2557
|
+
})]
|
|
2558
|
+
});
|
|
2559
|
+
}
|
|
2560
|
+
//#endregion
|
|
2561
|
+
//#region src/components/ui/Card.tsx
|
|
2562
|
+
function hn({ children: e, className: t, header: n, footer: r }) {
|
|
2563
|
+
return /* @__PURE__ */ m("div", {
|
|
2564
|
+
className: I("bg-bg-secondary border-border overflow-hidden rounded-md border", t),
|
|
2565
|
+
children: [
|
|
2566
|
+
n && /* @__PURE__ */ p("div", {
|
|
2567
|
+
className: "border-border border-b px-3 py-2.5",
|
|
2568
|
+
children: n
|
|
2569
|
+
}),
|
|
2570
|
+
/* @__PURE__ */ p("div", {
|
|
2571
|
+
className: "p-3",
|
|
2572
|
+
children: e
|
|
2573
|
+
}),
|
|
2574
|
+
r && /* @__PURE__ */ p("div", {
|
|
2575
|
+
className: "border-border bg-bg-primary/50 border-t px-3 py-2.5",
|
|
2576
|
+
children: r
|
|
2577
|
+
})
|
|
2578
|
+
]
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
//#endregion
|
|
2582
|
+
//#region src/components/ui/Combobox.tsx
|
|
2583
|
+
function gn({ options: e, value: t, onChange: n, placeholder: r = "Select...", label: a, className: o }) {
|
|
2584
|
+
let [c, l] = d(!1), [f, h] = d(""), [g, _] = d(0), v = u(null), y = u(null), b = s(), x = e.find((e) => e.value === t), S = e.filter((e) => e.label.toLowerCase().includes(f.toLowerCase()));
|
|
2585
|
+
function w(e) {
|
|
2586
|
+
h(e), _(0);
|
|
2587
|
+
}
|
|
2588
|
+
function E(e) {
|
|
2589
|
+
switch (e.key) {
|
|
2590
|
+
case "ArrowDown":
|
|
2591
|
+
e.preventDefault(), _((e) => Math.min(e + 1, S.length - 1));
|
|
2592
|
+
break;
|
|
2593
|
+
case "ArrowUp":
|
|
2594
|
+
e.preventDefault(), _((e) => Math.max(e - 1, 0));
|
|
2595
|
+
break;
|
|
2596
|
+
case "Enter":
|
|
2597
|
+
e.preventDefault(), S[g] && (n(S[g].value), l(!1));
|
|
2598
|
+
break;
|
|
2599
|
+
case "Escape":
|
|
2600
|
+
l(!1);
|
|
2601
|
+
break;
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
W(c, i(() => l(!1), []), [v]);
|
|
2605
|
+
function D() {
|
|
2606
|
+
l(!0), h(""), _(0), setTimeout(() => y.current?.focus(), 0);
|
|
2607
|
+
}
|
|
2608
|
+
return /* @__PURE__ */ m("div", {
|
|
2609
|
+
className: I("flex flex-col gap-1.5", o),
|
|
2610
|
+
ref: v,
|
|
2611
|
+
children: [a && /* @__PURE__ */ p("span", {
|
|
2612
|
+
className: "text-text-secondary font-label text-xs font-medium",
|
|
2613
|
+
children: a
|
|
2614
|
+
}), /* @__PURE__ */ m("div", {
|
|
2615
|
+
className: "relative",
|
|
2616
|
+
role: "combobox",
|
|
2617
|
+
"aria-expanded": c,
|
|
2618
|
+
"aria-haspopup": "listbox",
|
|
2619
|
+
children: [
|
|
2620
|
+
/* @__PURE__ */ p("button", {
|
|
2621
|
+
type: "button",
|
|
2622
|
+
onClick: () => c ? l(!1) : D(),
|
|
2623
|
+
className: I("font-control flex h-7 w-full cursor-pointer items-center rounded-md px-2 pr-7 text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms]", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2"),
|
|
2624
|
+
children: x ? x.label : /* @__PURE__ */ p("span", {
|
|
2625
|
+
className: "text-text-disabled",
|
|
2626
|
+
children: r
|
|
2627
|
+
})
|
|
2628
|
+
}),
|
|
2629
|
+
/* @__PURE__ */ p(T, { className: I("text-text-tertiary pointer-events-none absolute top-1/2 right-2.5 h-3.5 w-3.5 -translate-y-1/2 transition-transform", c && "rotate-180") }),
|
|
2630
|
+
c && /* @__PURE__ */ m("div", {
|
|
2631
|
+
className: "bg-bg-tertiary border-border-strong animate-scale-in absolute top-full right-0 left-0 z-50 mt-1 overflow-hidden rounded-md border shadow-lg",
|
|
2632
|
+
children: [/* @__PURE__ */ p("div", {
|
|
2633
|
+
className: "border-border border-b p-1.5",
|
|
2634
|
+
children: /* @__PURE__ */ m("div", {
|
|
2635
|
+
className: "relative",
|
|
2636
|
+
children: [/* @__PURE__ */ p(M, { className: "text-text-tertiary absolute top-1/2 left-2 h-3 w-3 -translate-y-1/2" }), /* @__PURE__ */ p("input", {
|
|
2637
|
+
ref: y,
|
|
2638
|
+
type: "text",
|
|
2639
|
+
"aria-label": "Search options",
|
|
2640
|
+
"aria-controls": b,
|
|
2641
|
+
"aria-activedescendant": S[g] ? `${b}-${g}` : void 0,
|
|
2642
|
+
"aria-autocomplete": "list",
|
|
2643
|
+
value: f,
|
|
2644
|
+
onChange: (e) => w(e.target.value),
|
|
2645
|
+
onKeyDown: E,
|
|
2646
|
+
placeholder: "Search...",
|
|
2647
|
+
className: "bg-bg-secondary text-text-primary border-border placeholder:text-text-disabled focus:border-accent font-control h-7 w-full rounded border pr-2 pl-7 text-xs focus:outline-none"
|
|
2648
|
+
})]
|
|
2649
|
+
})
|
|
2650
|
+
}), /* @__PURE__ */ p("ul", {
|
|
2651
|
+
id: b,
|
|
2652
|
+
className: "max-h-48 overflow-y-auto py-1",
|
|
2653
|
+
role: "listbox",
|
|
2654
|
+
children: S.length === 0 ? /* @__PURE__ */ p("li", {
|
|
2655
|
+
className: "text-text-tertiary px-3 py-2 text-center text-xs",
|
|
2656
|
+
children: "No results"
|
|
2657
|
+
}) : S.map((e, r) => /* @__PURE__ */ m("li", {
|
|
2658
|
+
id: `${b}-${r}`,
|
|
2659
|
+
role: "option",
|
|
2660
|
+
"aria-selected": e.value === t,
|
|
2661
|
+
onClick: () => {
|
|
2662
|
+
n(e.value), l(!1);
|
|
2663
|
+
},
|
|
2664
|
+
onMouseEnter: () => _(r),
|
|
2665
|
+
className: I("font-control flex h-7 w-full cursor-pointer items-center gap-2 px-3 text-xs", "transition-colors duration-[100ms]", r === g ? "bg-accent-muted text-accent" : e.value === t ? "text-accent" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
|
|
2666
|
+
children: [/* @__PURE__ */ p("span", {
|
|
2667
|
+
className: "flex-1 truncate",
|
|
2668
|
+
children: e.label
|
|
2669
|
+
}), e.value === t && /* @__PURE__ */ p(C, { className: "h-3 w-3 shrink-0" })]
|
|
2670
|
+
}, e.value))
|
|
2671
|
+
})]
|
|
2672
|
+
})
|
|
2673
|
+
]
|
|
2674
|
+
})]
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
//#endregion
|
|
2678
|
+
//#region src/components/ui/DangerZone.tsx
|
|
2679
|
+
function _n({ title: e = "Danger Zone", description: t, children: n, className: r }) {
|
|
2680
|
+
return /* @__PURE__ */ m("div", {
|
|
2681
|
+
className: I("border-border mt-8 border-t pt-6", r),
|
|
2682
|
+
children: [
|
|
2683
|
+
/* @__PURE__ */ p("h3", {
|
|
2684
|
+
className: "text-red mb-2 text-xs font-semibold",
|
|
2685
|
+
children: e
|
|
2686
|
+
}),
|
|
2687
|
+
t && /* @__PURE__ */ p("p", {
|
|
2688
|
+
className: "text-text-secondary mb-3 text-xs",
|
|
2689
|
+
children: t
|
|
2690
|
+
}),
|
|
2691
|
+
n
|
|
2692
|
+
]
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
//#endregion
|
|
2696
|
+
//#region src/hooks/useDropUp.ts
|
|
2697
|
+
function vn(e, t, n) {
|
|
2698
|
+
let [r, i] = d(!1);
|
|
2699
|
+
return c(() => {
|
|
2700
|
+
if (!e || !n.current || !t.current) return;
|
|
2701
|
+
let r = t.current.getBoundingClientRect(), a = n.current.getBoundingClientRect();
|
|
2702
|
+
i(window.innerHeight - r.bottom < a.height + 8);
|
|
2703
|
+
}, [e]), r;
|
|
2704
|
+
}
|
|
2705
|
+
//#endregion
|
|
2706
|
+
//#region src/components/ui/DatePicker.tsx
|
|
2707
|
+
function yn(e) {
|
|
2708
|
+
return `${[
|
|
2709
|
+
"Jan",
|
|
2710
|
+
"Feb",
|
|
2711
|
+
"Mar",
|
|
2712
|
+
"Apr",
|
|
2713
|
+
"May",
|
|
2714
|
+
"Jun",
|
|
2715
|
+
"Jul",
|
|
2716
|
+
"Aug",
|
|
2717
|
+
"Sep",
|
|
2718
|
+
"Oct",
|
|
2719
|
+
"Nov",
|
|
2720
|
+
"Dec"
|
|
2721
|
+
][e.getMonth()]} ${e.getDate()}, ${e.getFullYear()}`;
|
|
2722
|
+
}
|
|
2723
|
+
function bn({ label: e, value: t, onChange: n, placeholder: r = "Select date...", format: a = yn }) {
|
|
2724
|
+
let [o, s] = d(!1), c = u(null), l = u(null), f = vn(o, c, l), h = /* @__PURE__ */ new Date(), [g, _] = d(t?.getFullYear() ?? h.getFullYear()), [v, y] = d(t?.getMonth() ?? h.getMonth());
|
|
2725
|
+
W(o, i(() => s(!1), []), [c]);
|
|
2726
|
+
function b(e) {
|
|
2727
|
+
n(e), s(!1);
|
|
2728
|
+
}
|
|
2729
|
+
function x() {
|
|
2730
|
+
!o && t && (_(t.getFullYear()), y(t.getMonth())), s(!o);
|
|
2731
|
+
}
|
|
2732
|
+
return /* @__PURE__ */ m("div", {
|
|
2733
|
+
className: "flex flex-col gap-1.5",
|
|
2734
|
+
ref: c,
|
|
2735
|
+
children: [e && /* @__PURE__ */ p("span", {
|
|
2736
|
+
className: "text-text-secondary text-xs font-medium",
|
|
2737
|
+
children: e
|
|
2738
|
+
}), /* @__PURE__ */ m("div", {
|
|
2739
|
+
className: "relative",
|
|
2740
|
+
children: [
|
|
2741
|
+
/* @__PURE__ */ p("button", {
|
|
2742
|
+
type: "button",
|
|
2743
|
+
onClick: x,
|
|
2744
|
+
"aria-haspopup": "dialog",
|
|
2745
|
+
"aria-expanded": o,
|
|
2746
|
+
className: I("flex h-7 w-full cursor-pointer items-center rounded-md text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms]", "px-2 pr-7"),
|
|
2747
|
+
children: t ? a(t) : /* @__PURE__ */ p("span", {
|
|
2748
|
+
className: "text-text-disabled",
|
|
2749
|
+
children: r
|
|
2750
|
+
})
|
|
2751
|
+
}),
|
|
2752
|
+
/* @__PURE__ */ p(S, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2 h-3 w-3 -translate-y-1/2" }),
|
|
2753
|
+
o && /* @__PURE__ */ p("div", {
|
|
2754
|
+
ref: l,
|
|
2755
|
+
role: "dialog",
|
|
2756
|
+
"aria-label": "Choose date",
|
|
2757
|
+
className: I("bg-bg-tertiary border-border-strong animate-scale-in absolute left-0 z-[100] rounded-md border p-3 shadow-lg", f ? "bottom-full mb-1" : "top-full mt-1"),
|
|
2758
|
+
children: /* @__PURE__ */ p(X, {
|
|
2759
|
+
year: g,
|
|
2760
|
+
month: v,
|
|
2761
|
+
selected: t,
|
|
2762
|
+
onSelect: b,
|
|
2763
|
+
onMonthChange: (e, t) => {
|
|
2764
|
+
_(e), y(t);
|
|
2765
|
+
}
|
|
2766
|
+
})
|
|
2767
|
+
})
|
|
2768
|
+
]
|
|
2769
|
+
})]
|
|
2770
|
+
});
|
|
2771
|
+
}
|
|
2772
|
+
//#endregion
|
|
2773
|
+
//#region src/components/ui/DateRangePicker.tsx
|
|
2774
|
+
var xn = [
|
|
2775
|
+
"Jan",
|
|
2776
|
+
"Feb",
|
|
2777
|
+
"Mar",
|
|
2778
|
+
"Apr",
|
|
2779
|
+
"May",
|
|
2780
|
+
"Jun",
|
|
2781
|
+
"Jul",
|
|
2782
|
+
"Aug",
|
|
2783
|
+
"Sep",
|
|
2784
|
+
"Oct",
|
|
2785
|
+
"Nov",
|
|
2786
|
+
"Dec"
|
|
2787
|
+
];
|
|
2788
|
+
function Sn(e) {
|
|
2789
|
+
return `${xn[e.getMonth()]} ${e.getDate()}, ${e.getFullYear()}`;
|
|
2790
|
+
}
|
|
2791
|
+
function Cn(e) {
|
|
2792
|
+
return e.start && e.end ? `${Sn(e.start)} – ${Sn(e.end)}` : e.start ? Sn(e.start) : "";
|
|
2793
|
+
}
|
|
2794
|
+
function wn({ label: e, value: t, onChange: n, placeholder: r = "Select date range..." }) {
|
|
2795
|
+
let [a, o] = d(!1), s = u(null), c = u(null), l = vn(a, s, c), f = /* @__PURE__ */ new Date(), [h, g] = d(t.start?.getFullYear() ?? f.getFullYear()), [_, v] = d(t.start?.getMonth() ?? f.getMonth()), [y, b] = d(null), [x, C] = d("start"), [w, T] = d(t.start), [E, D] = d(t.end);
|
|
2796
|
+
W(a, i(() => o(!1), []), [s]);
|
|
2797
|
+
let O = _ === 11 ? h + 1 : h, k = _ === 11 ? 0 : _ + 1;
|
|
2798
|
+
function A() {
|
|
2799
|
+
a || (T(t.start), D(t.end), C((t.start && t.end, "start")), t.start && (g(t.start.getFullYear()), v(t.start.getMonth()))), o(!a);
|
|
2800
|
+
}
|
|
2801
|
+
function j(e) {
|
|
2802
|
+
x === "start" ? (T(e), D(null), C("end")) : (w && e < w ? (D(w), T(e)) : D(e), C("start"), n({
|
|
2803
|
+
start: w && e < w ? e : w,
|
|
2804
|
+
end: w && e < w ? w : e
|
|
2805
|
+
}), o(!1));
|
|
2806
|
+
}
|
|
2807
|
+
function ee() {
|
|
2808
|
+
_ === 0 ? (g(h - 1), v(11)) : v(_ - 1);
|
|
2809
|
+
}
|
|
2810
|
+
function te() {
|
|
2811
|
+
_ === 11 ? (g(h + 1), v(0)) : v(_ + 1);
|
|
2812
|
+
}
|
|
2813
|
+
let ne = t.start || t.end ? Cn(t) : "";
|
|
2814
|
+
return /* @__PURE__ */ m("div", {
|
|
2815
|
+
className: "flex flex-col gap-1.5",
|
|
2816
|
+
ref: s,
|
|
2817
|
+
children: [e && /* @__PURE__ */ p("span", {
|
|
2818
|
+
className: "text-text-secondary text-xs font-medium",
|
|
2819
|
+
children: e
|
|
2820
|
+
}), /* @__PURE__ */ m("div", {
|
|
2821
|
+
className: "relative",
|
|
2822
|
+
children: [
|
|
2823
|
+
/* @__PURE__ */ p("button", {
|
|
2824
|
+
type: "button",
|
|
2825
|
+
onClick: A,
|
|
2826
|
+
"aria-haspopup": "dialog",
|
|
2827
|
+
"aria-expanded": a,
|
|
2828
|
+
className: I("flex h-7 w-full cursor-pointer items-center rounded-md text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms]", "px-2 pr-7"),
|
|
2829
|
+
children: ne || /* @__PURE__ */ p("span", {
|
|
2830
|
+
className: "text-text-disabled",
|
|
2831
|
+
children: r
|
|
2832
|
+
})
|
|
2833
|
+
}),
|
|
2834
|
+
/* @__PURE__ */ p(S, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2 h-3 w-3 -translate-y-1/2" }),
|
|
2835
|
+
a && /* @__PURE__ */ m("div", {
|
|
2836
|
+
ref: c,
|
|
2837
|
+
role: "dialog",
|
|
2838
|
+
"aria-label": "Choose date range",
|
|
2839
|
+
className: I("bg-bg-tertiary border-border-strong animate-scale-in absolute left-0 z-[100] rounded-md border p-3 shadow-lg", l ? "bottom-full mb-1" : "top-full mt-1"),
|
|
2840
|
+
children: [/* @__PURE__ */ m("div", {
|
|
2841
|
+
className: "mb-2 flex items-center justify-between",
|
|
2842
|
+
children: [
|
|
2843
|
+
/* @__PURE__ */ p("button", {
|
|
2844
|
+
type: "button",
|
|
2845
|
+
onClick: ee,
|
|
2846
|
+
"aria-label": "Previous month",
|
|
2847
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]",
|
|
2848
|
+
children: /* @__PURE__ */ p("span", {
|
|
2849
|
+
className: "text-xs",
|
|
2850
|
+
children: "‹"
|
|
2851
|
+
})
|
|
2852
|
+
}),
|
|
2853
|
+
/* @__PURE__ */ p("span", {
|
|
2854
|
+
className: "text-text-tertiary text-2xs",
|
|
2855
|
+
"aria-live": "polite",
|
|
2856
|
+
children: x === "start" ? "Select start date" : "Select end date"
|
|
2857
|
+
}),
|
|
2858
|
+
/* @__PURE__ */ p("button", {
|
|
2859
|
+
type: "button",
|
|
2860
|
+
onClick: te,
|
|
2861
|
+
"aria-label": "Next month",
|
|
2862
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]",
|
|
2863
|
+
children: /* @__PURE__ */ p("span", {
|
|
2864
|
+
className: "text-xs",
|
|
2865
|
+
children: "›"
|
|
2866
|
+
})
|
|
2867
|
+
})
|
|
2868
|
+
]
|
|
2869
|
+
}), /* @__PURE__ */ m("div", {
|
|
2870
|
+
className: "flex gap-4",
|
|
2871
|
+
children: [/* @__PURE__ */ p(X, {
|
|
2872
|
+
year: h,
|
|
2873
|
+
month: _,
|
|
2874
|
+
rangeStart: w,
|
|
2875
|
+
rangeEnd: E,
|
|
2876
|
+
hoverDate: x === "end" ? y : null,
|
|
2877
|
+
onSelect: j,
|
|
2878
|
+
onMonthChange: (e, t) => {
|
|
2879
|
+
g(e), v(t);
|
|
2880
|
+
},
|
|
2881
|
+
onHover: b
|
|
2882
|
+
}), /* @__PURE__ */ p(X, {
|
|
2883
|
+
year: O,
|
|
2884
|
+
month: k,
|
|
2885
|
+
rangeStart: w,
|
|
2886
|
+
rangeEnd: E,
|
|
2887
|
+
hoverDate: x === "end" ? y : null,
|
|
2888
|
+
onSelect: j,
|
|
2889
|
+
onMonthChange: (e, t) => {
|
|
2890
|
+
t === 0 ? (g(e - 1), v(11)) : (g(e), v(t - 1));
|
|
2891
|
+
},
|
|
2892
|
+
onHover: b
|
|
2893
|
+
})]
|
|
2894
|
+
})]
|
|
2895
|
+
})
|
|
2896
|
+
]
|
|
2897
|
+
})]
|
|
2898
|
+
});
|
|
2899
|
+
}
|
|
2900
|
+
//#endregion
|
|
2901
|
+
//#region src/components/ui/DateTimePicker.tsx
|
|
2902
|
+
var Tn = [
|
|
2903
|
+
"Jan",
|
|
2904
|
+
"Feb",
|
|
2905
|
+
"Mar",
|
|
2906
|
+
"Apr",
|
|
2907
|
+
"May",
|
|
2908
|
+
"Jun",
|
|
2909
|
+
"Jul",
|
|
2910
|
+
"Aug",
|
|
2911
|
+
"Sep",
|
|
2912
|
+
"Oct",
|
|
2913
|
+
"Nov",
|
|
2914
|
+
"Dec"
|
|
2915
|
+
];
|
|
2916
|
+
function En(e) {
|
|
2917
|
+
return e === 0 ? {
|
|
2918
|
+
hour12: 12,
|
|
2919
|
+
period: "AM"
|
|
2920
|
+
} : e < 12 ? {
|
|
2921
|
+
hour12: e,
|
|
2922
|
+
period: "AM"
|
|
2923
|
+
} : e === 12 ? {
|
|
2924
|
+
hour12: 12,
|
|
2925
|
+
period: "PM"
|
|
2926
|
+
} : {
|
|
2927
|
+
hour12: e - 12,
|
|
2928
|
+
period: "PM"
|
|
2929
|
+
};
|
|
2930
|
+
}
|
|
2931
|
+
function Dn(e, t) {
|
|
2932
|
+
return t === "AM" ? e === 12 ? 0 : e : e === 12 ? 12 : e + 12;
|
|
2933
|
+
}
|
|
2934
|
+
function On(e) {
|
|
2935
|
+
let t = Tn[e.getMonth()], n = e.getDate(), r = e.getFullYear(), { hour12: i, period: a } = En(e.getHours());
|
|
2936
|
+
return `${t} ${n}, ${r} ${i}:${String(e.getMinutes()).padStart(2, "0")} ${a}`;
|
|
2937
|
+
}
|
|
2938
|
+
function kn(e) {
|
|
2939
|
+
return String(e).padStart(2, "0");
|
|
2940
|
+
}
|
|
2941
|
+
function An({ label: e, value: t, onChange: n, placeholder: r = "Select date & time..." }) {
|
|
2942
|
+
let [a, o] = d(!1), s = u(null), c = u(null), l = vn(a, s, c), f = /* @__PURE__ */ new Date(), h = t ? En(t.getHours()) : {
|
|
2943
|
+
hour12: 12,
|
|
2944
|
+
period: "PM"
|
|
2945
|
+
}, [g, _] = d(t?.getFullYear() ?? f.getFullYear()), [v, y] = d(t?.getMonth() ?? f.getMonth()), [b, x] = d(String(h.hour12)), [C, w] = d(t ? kn(t.getMinutes()) : "00"), [T, E] = d(h.period), [D, O] = d(t);
|
|
2946
|
+
W(a, i(() => o(!1), []), [s]);
|
|
2947
|
+
function k(e) {
|
|
2948
|
+
O(e);
|
|
2949
|
+
}
|
|
2950
|
+
function A(e) {
|
|
2951
|
+
let t = e.replace(/\D/g, "").slice(0, 2);
|
|
2952
|
+
x(t);
|
|
2953
|
+
let n = parseInt(t, 10);
|
|
2954
|
+
!isNaN(n) && n >= 13 && n <= 23 ? (x(String(n - 12)), E("PM")) : n === 0 && (x("12"), E("AM"));
|
|
2955
|
+
}
|
|
2956
|
+
function j() {
|
|
2957
|
+
if (!D) return;
|
|
2958
|
+
let e = Math.max(1, Math.min(12, parseInt(b, 10) || 12)), t = Math.max(0, Math.min(59, parseInt(C, 10) || 0)), r = Dn(e, T);
|
|
2959
|
+
n(new Date(D.getFullYear(), D.getMonth(), D.getDate(), r, t)), o(!1);
|
|
2960
|
+
}
|
|
2961
|
+
function ee() {
|
|
2962
|
+
if (!a && t) {
|
|
2963
|
+
_(t.getFullYear()), y(t.getMonth()), O(t);
|
|
2964
|
+
let e = En(t.getHours());
|
|
2965
|
+
x(String(e.hour12)), E(e.period), w(kn(t.getMinutes()));
|
|
2966
|
+
}
|
|
2967
|
+
o(!a);
|
|
2968
|
+
}
|
|
2969
|
+
return /* @__PURE__ */ m("div", {
|
|
2970
|
+
className: "flex flex-col gap-1.5",
|
|
2971
|
+
ref: s,
|
|
2972
|
+
children: [e && /* @__PURE__ */ p("span", {
|
|
2973
|
+
className: "text-text-secondary text-xs font-medium",
|
|
2974
|
+
children: e
|
|
2975
|
+
}), /* @__PURE__ */ m("div", {
|
|
2976
|
+
className: "relative",
|
|
2977
|
+
children: [
|
|
2978
|
+
/* @__PURE__ */ p("button", {
|
|
2979
|
+
type: "button",
|
|
2980
|
+
onClick: ee,
|
|
2981
|
+
"aria-haspopup": "dialog",
|
|
2982
|
+
"aria-expanded": a,
|
|
2983
|
+
className: I("flex h-7 w-full cursor-pointer items-center rounded-md text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms]", "px-2 pr-7"),
|
|
2984
|
+
children: t ? On(t) : /* @__PURE__ */ p("span", {
|
|
2985
|
+
className: "text-text-disabled",
|
|
2986
|
+
children: r
|
|
2987
|
+
})
|
|
2988
|
+
}),
|
|
2989
|
+
/* @__PURE__ */ p(S, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2 h-3 w-3 -translate-y-1/2" }),
|
|
2990
|
+
a && /* @__PURE__ */ m("div", {
|
|
2991
|
+
ref: c,
|
|
2992
|
+
role: "dialog",
|
|
2993
|
+
"aria-label": "Choose date and time",
|
|
2994
|
+
className: I("bg-bg-tertiary border-border-strong animate-scale-in absolute left-0 z-[100] rounded-md border p-3 shadow-lg", l ? "bottom-full mb-1" : "top-full mt-1"),
|
|
2995
|
+
children: [/* @__PURE__ */ p(X, {
|
|
2996
|
+
year: g,
|
|
2997
|
+
month: v,
|
|
2998
|
+
selected: D,
|
|
2999
|
+
onSelect: k,
|
|
3000
|
+
onMonthChange: (e, t) => {
|
|
3001
|
+
_(e), y(t);
|
|
3002
|
+
}
|
|
3003
|
+
}), /* @__PURE__ */ m("div", {
|
|
3004
|
+
className: "border-border mt-3 flex items-center gap-2 border-t pt-3",
|
|
3005
|
+
children: [
|
|
3006
|
+
/* @__PURE__ */ p("span", {
|
|
3007
|
+
className: "text-text-secondary text-2xs font-medium",
|
|
3008
|
+
children: "Time"
|
|
3009
|
+
}),
|
|
3010
|
+
/* @__PURE__ */ m("div", {
|
|
3011
|
+
className: "flex items-center gap-1",
|
|
3012
|
+
children: [
|
|
3013
|
+
/* @__PURE__ */ p("input", {
|
|
3014
|
+
type: "text",
|
|
3015
|
+
inputMode: "numeric",
|
|
3016
|
+
maxLength: 2,
|
|
3017
|
+
value: b,
|
|
3018
|
+
onChange: (e) => A(e.target.value),
|
|
3019
|
+
"aria-label": "Hour",
|
|
3020
|
+
className: "bg-bg-secondary border-border text-text-primary focus:border-accent h-6 w-8 rounded-md border text-center text-xs focus:outline-none"
|
|
3021
|
+
}),
|
|
3022
|
+
/* @__PURE__ */ p("span", {
|
|
3023
|
+
className: "text-text-tertiary text-xs",
|
|
3024
|
+
children: ":"
|
|
3025
|
+
}),
|
|
3026
|
+
/* @__PURE__ */ p("input", {
|
|
3027
|
+
type: "text",
|
|
3028
|
+
inputMode: "numeric",
|
|
3029
|
+
maxLength: 2,
|
|
3030
|
+
value: C,
|
|
3031
|
+
onChange: (e) => w(e.target.value.replace(/\D/g, "").slice(0, 2)),
|
|
3032
|
+
"aria-label": "Minute",
|
|
3033
|
+
className: "bg-bg-secondary border-border text-text-primary focus:border-accent h-6 w-8 rounded-md border text-center text-xs focus:outline-none"
|
|
3034
|
+
})
|
|
3035
|
+
]
|
|
3036
|
+
}),
|
|
3037
|
+
/* @__PURE__ */ m("div", {
|
|
3038
|
+
className: "border-border inline-flex overflow-hidden rounded-md border",
|
|
3039
|
+
role: "group",
|
|
3040
|
+
"aria-label": "Time period",
|
|
3041
|
+
children: [/* @__PURE__ */ p("button", {
|
|
3042
|
+
type: "button",
|
|
3043
|
+
onClick: () => E("AM"),
|
|
3044
|
+
"aria-pressed": T === "AM",
|
|
3045
|
+
className: I("text-2xs cursor-pointer px-2 py-0.5 font-medium transition-colors duration-[100ms]", T === "AM" ? "bg-accent text-text-on-accent" : "bg-bg-secondary text-text-secondary hover:bg-bg-hover"),
|
|
3046
|
+
children: "AM"
|
|
3047
|
+
}), /* @__PURE__ */ p("button", {
|
|
3048
|
+
type: "button",
|
|
3049
|
+
onClick: () => E("PM"),
|
|
3050
|
+
"aria-pressed": T === "PM",
|
|
3051
|
+
className: I("text-2xs cursor-pointer px-2 py-0.5 font-medium transition-colors duration-[100ms]", T === "PM" ? "bg-accent text-text-on-accent" : "bg-bg-secondary text-text-secondary hover:bg-bg-hover"),
|
|
3052
|
+
children: "PM"
|
|
3053
|
+
})]
|
|
3054
|
+
}),
|
|
3055
|
+
/* @__PURE__ */ p("button", {
|
|
3056
|
+
type: "button",
|
|
3057
|
+
onClick: j,
|
|
3058
|
+
disabled: !D,
|
|
3059
|
+
className: I("ml-auto h-6 rounded-md px-3 text-xs font-medium transition-colors duration-[100ms]", D ? "bg-accent text-text-on-accent hover:bg-accent-hover cursor-pointer" : "bg-bg-hover text-text-disabled cursor-not-allowed"),
|
|
3060
|
+
children: "Apply"
|
|
3061
|
+
})
|
|
3062
|
+
]
|
|
3063
|
+
})]
|
|
3064
|
+
})
|
|
3065
|
+
]
|
|
3066
|
+
})]
|
|
3067
|
+
});
|
|
3068
|
+
}
|
|
3069
|
+
//#endregion
|
|
3070
|
+
//#region src/components/ui/DetailPanel.tsx
|
|
3071
|
+
var jn = 360, Mn = 260, Nn = 700;
|
|
3072
|
+
function Pn({ open: e, onClose: t, title: n, children: r, className: a, resizable: s = !0, defaultWidth: c = jn, minWidth: l = Mn, maxWidth: f = Nn }) {
|
|
3073
|
+
let [h, g] = d(c), _ = u(!1), v = u(0), y = u(0);
|
|
3074
|
+
o(() => {
|
|
3075
|
+
if (!e) return;
|
|
3076
|
+
let n = (e) => {
|
|
3077
|
+
e.key === "Escape" && t();
|
|
3078
|
+
};
|
|
3079
|
+
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
3080
|
+
}, [e, t]);
|
|
3081
|
+
let b = i((e) => {
|
|
3082
|
+
s && (e.preventDefault(), _.current = !0, v.current = e.clientX, y.current = h, e.target.setPointerCapture(e.pointerId));
|
|
3083
|
+
}, [s, h]), x = i((e) => {
|
|
3084
|
+
if (!_.current) return;
|
|
3085
|
+
let t = v.current - e.clientX;
|
|
3086
|
+
g(Math.max(l, Math.min(f, y.current + t)));
|
|
3087
|
+
}, [l, f]), S = i(() => {
|
|
3088
|
+
_.current = !1;
|
|
3089
|
+
}, []);
|
|
3090
|
+
return /* @__PURE__ */ p("div", {
|
|
3091
|
+
className: I("border-border bg-bg-secondary relative shrink-0 overflow-hidden border-l", "transition-[width] duration-[200ms] ease-out", a),
|
|
3092
|
+
style: { width: e ? h : 0 },
|
|
3093
|
+
children: e && /* @__PURE__ */ m("div", {
|
|
3094
|
+
className: "animate-fade-in flex h-full flex-col",
|
|
3095
|
+
style: { width: h },
|
|
3096
|
+
children: [
|
|
3097
|
+
s && /* @__PURE__ */ p("div", {
|
|
3098
|
+
onPointerDown: b,
|
|
3099
|
+
onPointerMove: x,
|
|
3100
|
+
onPointerUp: S,
|
|
3101
|
+
className: "hover:bg-accent/30 active:bg-accent/40 absolute top-0 left-0 z-10 h-full w-1 cursor-col-resize select-none"
|
|
3102
|
+
}),
|
|
3103
|
+
/* @__PURE__ */ m("div", {
|
|
3104
|
+
className: "border-border flex h-10 shrink-0 items-center justify-between border-b px-3",
|
|
3105
|
+
children: [/* @__PURE__ */ p("h3", {
|
|
3106
|
+
className: "text-text-primary truncate text-xs font-semibold",
|
|
3107
|
+
children: n
|
|
3108
|
+
}), /* @__PURE__ */ p("button", {
|
|
3109
|
+
onClick: t,
|
|
3110
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded",
|
|
3111
|
+
"aria-label": "Close panel",
|
|
3112
|
+
children: /* @__PURE__ */ p(N, { className: "h-3.5 w-3.5" })
|
|
3113
|
+
})]
|
|
3114
|
+
}),
|
|
3115
|
+
/* @__PURE__ */ p("div", {
|
|
3116
|
+
className: "flex-1 overflow-y-auto p-3",
|
|
3117
|
+
children: r
|
|
3118
|
+
})
|
|
3119
|
+
]
|
|
3120
|
+
})
|
|
3121
|
+
});
|
|
3122
|
+
}
|
|
3123
|
+
//#endregion
|
|
3124
|
+
//#region src/components/ui/Dialog.tsx
|
|
3125
|
+
function Fn({ open: e, onClose: t, title: n, children: r, footer: i, className: a }) {
|
|
3126
|
+
let c = u(null), l = s();
|
|
3127
|
+
return B(c, e), o(() => {
|
|
3128
|
+
if (!e) return;
|
|
3129
|
+
let n = (e) => {
|
|
3130
|
+
e.key === "Escape" && t();
|
|
3131
|
+
};
|
|
3132
|
+
return document.addEventListener("keydown", n), document.body.style.overflow = "hidden", () => {
|
|
3133
|
+
document.removeEventListener("keydown", n), document.body.style.overflow = "";
|
|
3134
|
+
};
|
|
3135
|
+
}, [e, t]), e ? P(/* @__PURE__ */ m("div", {
|
|
3136
|
+
className: "fixed inset-0 z-50 flex items-start justify-center overflow-y-auto pt-4 md:pt-[5vh]",
|
|
3137
|
+
children: [/* @__PURE__ */ p("div", {
|
|
3138
|
+
className: "bg-bg-overlay fixed inset-0",
|
|
3139
|
+
onClick: t
|
|
3140
|
+
}), /* @__PURE__ */ m("div", {
|
|
3141
|
+
ref: c,
|
|
3142
|
+
className: I("relative z-50 mx-4 mb-8 w-full max-w-[400px] p-6", "bg-bg-secondary border-border rounded-lg border", "animate-scale-in shadow-lg", a),
|
|
3143
|
+
role: "dialog",
|
|
3144
|
+
"aria-modal": "true",
|
|
3145
|
+
"aria-labelledby": n ? l : void 0,
|
|
3146
|
+
"aria-label": n ? void 0 : "Dialog",
|
|
3147
|
+
children: [
|
|
3148
|
+
/* @__PURE__ */ m("div", {
|
|
3149
|
+
className: "mb-4 flex items-center justify-between",
|
|
3150
|
+
children: [n && /* @__PURE__ */ p("h3", {
|
|
3151
|
+
id: l,
|
|
3152
|
+
className: "text-text-primary text-sm font-semibold",
|
|
3153
|
+
children: n
|
|
3154
|
+
}), /* @__PURE__ */ p("button", {
|
|
3155
|
+
onClick: t,
|
|
3156
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover ml-auto flex h-6 w-6 cursor-pointer items-center justify-center rounded transition-colors duration-[100ms]",
|
|
3157
|
+
"aria-label": "Close",
|
|
3158
|
+
children: /* @__PURE__ */ p(N, { className: "h-4 w-4" })
|
|
3159
|
+
})]
|
|
3160
|
+
}),
|
|
3161
|
+
r,
|
|
3162
|
+
i
|
|
3163
|
+
]
|
|
3164
|
+
})]
|
|
3165
|
+
}), document.body) : null;
|
|
3166
|
+
}
|
|
3167
|
+
//#endregion
|
|
3168
|
+
//#region src/components/ui/DialogActions.tsx
|
|
3169
|
+
function In({ onCancel: e, onConfirm: t, cancelLabel: n = "Cancel", confirmLabel: r = "Confirm", confirmVariant: i = "primary", className: a }) {
|
|
3170
|
+
return /* @__PURE__ */ m("div", {
|
|
3171
|
+
className: I("flex justify-end gap-2", a),
|
|
3172
|
+
children: [/* @__PURE__ */ p(J, {
|
|
3173
|
+
variant: "ghost",
|
|
3174
|
+
size: "sm",
|
|
3175
|
+
onClick: e,
|
|
3176
|
+
children: n
|
|
3177
|
+
}), /* @__PURE__ */ p(J, {
|
|
3178
|
+
variant: i,
|
|
3179
|
+
size: "sm",
|
|
3180
|
+
onClick: t,
|
|
3181
|
+
children: r
|
|
3182
|
+
})]
|
|
3183
|
+
});
|
|
3184
|
+
}
|
|
3185
|
+
//#endregion
|
|
3186
|
+
//#region src/components/ui/DividerLabel.tsx
|
|
3187
|
+
function Ln({ children: e, className: t }) {
|
|
3188
|
+
return /* @__PURE__ */ m("div", {
|
|
3189
|
+
className: I("relative my-6", t),
|
|
3190
|
+
children: [/* @__PURE__ */ p("div", {
|
|
3191
|
+
className: "absolute inset-0 flex items-center",
|
|
3192
|
+
children: /* @__PURE__ */ p("div", { className: "border-border w-full border-t" })
|
|
3193
|
+
}), /* @__PURE__ */ p("div", {
|
|
3194
|
+
className: "relative flex justify-center",
|
|
3195
|
+
children: /* @__PURE__ */ p("span", {
|
|
3196
|
+
className: "bg-bg-secondary text-2xs text-text-tertiary px-2 tracking-wider uppercase",
|
|
3197
|
+
children: e
|
|
3198
|
+
})
|
|
3199
|
+
})]
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
//#endregion
|
|
3203
|
+
//#region src/components/ui/DropdownMenu.tsx
|
|
3204
|
+
function Rn({ trigger: e, items: t, align: n = "right" }) {
|
|
3205
|
+
let [r, a] = d(!1), [s, c] = d({
|
|
3206
|
+
top: 0,
|
|
3207
|
+
left: 0,
|
|
3208
|
+
triggerWidth: 0
|
|
3209
|
+
}), [h, g] = d(-1), _ = u(null), v = u(null), y = l(() => t.filter((e) => !e.divider), [t]), b = i(() => {
|
|
3210
|
+
a(!1), g(-1);
|
|
3211
|
+
}, []);
|
|
3212
|
+
W(r, b, [v], [_]), o(() => {
|
|
3213
|
+
if (!r) return;
|
|
3214
|
+
let e = (e) => {
|
|
3215
|
+
e.key === "ArrowDown" ? (e.preventDefault(), g((e) => (e + 1) % y.length)) : e.key === "ArrowUp" ? (e.preventDefault(), g((e) => (e - 1 + y.length) % y.length)) : e.key === "Enter" && h >= 0 && (e.preventDefault(), y[h].onClick(), b());
|
|
3216
|
+
};
|
|
3217
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
3218
|
+
}, [
|
|
3219
|
+
r,
|
|
3220
|
+
h,
|
|
3221
|
+
y,
|
|
3222
|
+
b
|
|
3223
|
+
]), o(() => {
|
|
3224
|
+
!r || h < 0 || !v.current || v.current.querySelectorAll("[role=\"menuitem\"]")[h]?.focus();
|
|
3225
|
+
}, [r, h]);
|
|
3226
|
+
function x() {
|
|
3227
|
+
if (!_.current) return;
|
|
3228
|
+
let e = _.current.getBoundingClientRect();
|
|
3229
|
+
c({
|
|
3230
|
+
top: e.bottom + 4,
|
|
3231
|
+
left: n === "right" ? e.right : e.left,
|
|
3232
|
+
triggerWidth: e.width
|
|
3233
|
+
}), a(!r), g(-1);
|
|
3234
|
+
}
|
|
3235
|
+
let S = -1;
|
|
3236
|
+
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
|
|
3237
|
+
ref: _,
|
|
3238
|
+
onClick: x,
|
|
3239
|
+
children: e
|
|
3240
|
+
}), r && P(/* @__PURE__ */ p("div", {
|
|
3241
|
+
ref: v,
|
|
3242
|
+
role: "menu",
|
|
3243
|
+
className: "bg-bg-tertiary border-border-strong animate-scale-in fixed z-[100] w-max rounded-md border py-1 shadow-lg",
|
|
3244
|
+
style: {
|
|
3245
|
+
top: s.top,
|
|
3246
|
+
minWidth: s.triggerWidth,
|
|
3247
|
+
...n === "right" ? { right: window.innerWidth - s.left } : { left: s.left }
|
|
3248
|
+
},
|
|
3249
|
+
children: t.map((e, t) => {
|
|
3250
|
+
if (e.divider) return /* @__PURE__ */ p("div", {
|
|
3251
|
+
className: "border-border my-1 border-t",
|
|
3252
|
+
role: "separator"
|
|
3253
|
+
}, `divider-${t}`);
|
|
3254
|
+
S++;
|
|
3255
|
+
let n = S;
|
|
3256
|
+
return /* @__PURE__ */ m("button", {
|
|
3257
|
+
role: "menuitem",
|
|
3258
|
+
tabIndex: n === h ? 0 : -1,
|
|
3259
|
+
onClick: () => {
|
|
3260
|
+
e.onClick(), b();
|
|
3261
|
+
},
|
|
3262
|
+
onMouseEnter: () => g(n),
|
|
3263
|
+
className: I("flex h-7 w-full cursor-pointer items-center gap-2 px-4 text-left text-xs", "transition-colors duration-[100ms]", "focus:outline-none", e.danger ? "text-red hover:bg-red-muted focus:bg-red-muted" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover focus:text-text-primary focus:bg-bg-hover"),
|
|
3264
|
+
children: [
|
|
3265
|
+
e.icon && /* @__PURE__ */ p("span", {
|
|
3266
|
+
className: "flex h-3.5 w-3.5 shrink-0 items-center",
|
|
3267
|
+
children: e.icon
|
|
3268
|
+
}),
|
|
3269
|
+
/* @__PURE__ */ p("span", {
|
|
3270
|
+
className: "flex-1",
|
|
3271
|
+
children: e.label
|
|
3272
|
+
}),
|
|
3273
|
+
e.shortcut && /* @__PURE__ */ p("span", {
|
|
3274
|
+
className: "text-2xs text-text-tertiary ml-auto pl-4 font-mono",
|
|
3275
|
+
children: e.shortcut
|
|
3276
|
+
}),
|
|
3277
|
+
e.checked && /* @__PURE__ */ p(C, { className: "text-accent ml-auto h-3.5 w-3.5 shrink-0" })
|
|
3278
|
+
]
|
|
3279
|
+
}, e.label || `item-${t}`);
|
|
3280
|
+
})
|
|
3281
|
+
}), document.body)] });
|
|
3282
|
+
}
|
|
3283
|
+
//#endregion
|
|
3284
|
+
//#region src/components/ui/EmptyState.tsx
|
|
3285
|
+
function zn({ icon: e, title: t, description: n, action: r, className: i }) {
|
|
3286
|
+
return /* @__PURE__ */ m("div", {
|
|
3287
|
+
className: I("flex flex-col items-center justify-center px-4 py-12", i),
|
|
3288
|
+
children: [
|
|
3289
|
+
/* @__PURE__ */ p("div", {
|
|
3290
|
+
className: "bg-bg-tertiary text-text-tertiary mb-3 flex h-10 w-10 items-center justify-center rounded-md",
|
|
3291
|
+
children: e || /* @__PURE__ */ p(ee, { className: "h-5 w-5" })
|
|
3292
|
+
}),
|
|
3293
|
+
/* @__PURE__ */ p("p", {
|
|
3294
|
+
className: "text-text-primary mb-1 text-sm font-medium",
|
|
3295
|
+
children: t
|
|
3296
|
+
}),
|
|
3297
|
+
n && /* @__PURE__ */ p("p", {
|
|
3298
|
+
className: "text-text-secondary max-w-[300px] text-center text-xs",
|
|
3299
|
+
children: n
|
|
3300
|
+
}),
|
|
3301
|
+
r && /* @__PURE__ */ p("div", {
|
|
3302
|
+
className: "mt-4",
|
|
3303
|
+
children: r
|
|
3304
|
+
})
|
|
3305
|
+
]
|
|
3306
|
+
});
|
|
3307
|
+
}
|
|
3308
|
+
//#endregion
|
|
3309
|
+
//#region src/components/ui/ErrorBoundary.tsx
|
|
3310
|
+
var Bn = class extends e {
|
|
3311
|
+
state = {
|
|
3312
|
+
hasError: !1,
|
|
3313
|
+
error: null
|
|
3314
|
+
};
|
|
3315
|
+
static getDerivedStateFromError(e) {
|
|
3316
|
+
return {
|
|
3317
|
+
hasError: !0,
|
|
3318
|
+
error: e
|
|
3319
|
+
};
|
|
3320
|
+
}
|
|
3321
|
+
componentDidCatch(e, t) {
|
|
3322
|
+
console.error("[ErrorBoundary] Uncaught error:", e, t.componentStack);
|
|
3323
|
+
}
|
|
3324
|
+
render() {
|
|
3325
|
+
return this.state.hasError ? /* @__PURE__ */ m("div", {
|
|
3326
|
+
className: "bg-bg-primary flex min-h-svh flex-col items-center justify-center p-8 text-center",
|
|
3327
|
+
children: [
|
|
3328
|
+
/* @__PURE__ */ p("p", {
|
|
3329
|
+
className: "text-text-primary mb-2 text-lg font-semibold",
|
|
3330
|
+
children: "Something went wrong"
|
|
3331
|
+
}),
|
|
3332
|
+
/* @__PURE__ */ p("p", {
|
|
3333
|
+
className: "text-text-secondary mb-6 max-w-md text-xs",
|
|
3334
|
+
children: this.state.error?.message ?? "An unexpected error occurred."
|
|
3335
|
+
}),
|
|
3336
|
+
/* @__PURE__ */ p(J, {
|
|
3337
|
+
variant: "secondary",
|
|
3338
|
+
onClick: () => {
|
|
3339
|
+
this.setState({
|
|
3340
|
+
hasError: !1,
|
|
3341
|
+
error: null
|
|
3342
|
+
}), window.location.href = "/";
|
|
3343
|
+
},
|
|
3344
|
+
children: "Go home"
|
|
3345
|
+
})
|
|
3346
|
+
]
|
|
3347
|
+
}) : this.props.children;
|
|
3348
|
+
}
|
|
3349
|
+
};
|
|
3350
|
+
//#endregion
|
|
3351
|
+
//#region src/components/ui/FilterDropdown.tsx
|
|
3352
|
+
function Vn({ icon: e, children: t, items: n, align: r, className: i }) {
|
|
3353
|
+
return /* @__PURE__ */ p(Rn, {
|
|
3354
|
+
align: r,
|
|
3355
|
+
trigger: /* @__PURE__ */ p(Gt, {
|
|
3356
|
+
icon: e,
|
|
3357
|
+
className: i,
|
|
3358
|
+
children: t
|
|
3359
|
+
}),
|
|
3360
|
+
items: n
|
|
3361
|
+
});
|
|
3362
|
+
}
|
|
3363
|
+
//#endregion
|
|
3364
|
+
//#region src/components/ui/Kbd.tsx
|
|
3365
|
+
function Hn({ children: e, className: t }) {
|
|
3366
|
+
return /* @__PURE__ */ p("kbd", {
|
|
3367
|
+
className: I("text-2xs inline-flex items-center px-1.5 py-0.5 font-mono font-medium", "bg-bg-tertiary text-text-secondary border-border rounded border", t),
|
|
3368
|
+
children: e
|
|
3369
|
+
});
|
|
3370
|
+
}
|
|
3371
|
+
//#endregion
|
|
3372
|
+
//#region src/components/ui/LoadingSpinner.tsx
|
|
3373
|
+
var Un = {
|
|
3374
|
+
sm: "w-4 h-4",
|
|
3375
|
+
md: "w-6 h-6",
|
|
3376
|
+
lg: "w-8 h-8"
|
|
3377
|
+
};
|
|
3378
|
+
function Wn({ className: e, size: t = "md" }) {
|
|
3379
|
+
return /* @__PURE__ */ p("div", {
|
|
3380
|
+
className: I("flex min-h-[200px] items-center justify-center", e),
|
|
3381
|
+
children: /* @__PURE__ */ p(ne, { className: I("text-accent animate-spin", Un[t]) })
|
|
3382
|
+
});
|
|
3383
|
+
}
|
|
3384
|
+
//#endregion
|
|
3385
|
+
//#region src/components/ui/MetadataGrid.tsx
|
|
3386
|
+
function Gn({ items: e, labelWidth: n = "100px", className: r }) {
|
|
3387
|
+
return /* @__PURE__ */ p("div", {
|
|
3388
|
+
className: I("gap-x-3 gap-y-2 text-xs", r),
|
|
3389
|
+
style: {
|
|
3390
|
+
display: "grid",
|
|
3391
|
+
gridTemplateColumns: `${n} 1fr`
|
|
3392
|
+
},
|
|
3393
|
+
children: e.map((e) => /* @__PURE__ */ m(t, { children: [/* @__PURE__ */ p("span", {
|
|
3394
|
+
className: "text-text-tertiary font-label",
|
|
3395
|
+
children: e.label
|
|
3396
|
+
}), typeof e.value == "string" || typeof e.value == "number" ? /* @__PURE__ */ p("span", {
|
|
3397
|
+
className: "text-text-primary font-data",
|
|
3398
|
+
children: e.value
|
|
3399
|
+
}) : /* @__PURE__ */ p("span", { children: e.value })] }, e.label))
|
|
3400
|
+
});
|
|
3401
|
+
}
|
|
3402
|
+
//#endregion
|
|
3403
|
+
//#region src/components/ui/MetricCard.tsx
|
|
3404
|
+
function Kn({ label: e, value: t, sub: n, bar: r, icon: i, iconColor: a, className: o }) {
|
|
3405
|
+
return /* @__PURE__ */ m("div", {
|
|
3406
|
+
className: I("bg-bg-secondary border-border relative overflow-hidden rounded-md border p-3", o),
|
|
3407
|
+
children: [
|
|
3408
|
+
i && /* @__PURE__ */ p(i, { className: I("absolute -right-9 -bottom-9 h-44 w-44 -rotate-45 opacity-[0.06]", a) }),
|
|
3409
|
+
/* @__PURE__ */ p("p", {
|
|
3410
|
+
className: "text-2xs-f text-text-tertiary font-label mb-1 font-medium tracking-wider uppercase",
|
|
3411
|
+
children: e
|
|
3412
|
+
}),
|
|
3413
|
+
/* @__PURE__ */ p("p", {
|
|
3414
|
+
className: "text-text-primary font-data text-xl font-bold tabular-nums",
|
|
3415
|
+
children: t
|
|
3416
|
+
}),
|
|
3417
|
+
n && /* @__PURE__ */ p("p", {
|
|
3418
|
+
className: "text-2xs text-text-tertiary font-label mt-0.5",
|
|
3419
|
+
children: n
|
|
3420
|
+
}),
|
|
3421
|
+
r !== void 0 && /* @__PURE__ */ p("div", {
|
|
3422
|
+
className: "bg-bg-tertiary mt-2 h-[3px] overflow-hidden rounded-md",
|
|
3423
|
+
children: /* @__PURE__ */ p("div", {
|
|
3424
|
+
className: "bg-accent h-full rounded-md transition-all duration-[250ms] ease-out",
|
|
3425
|
+
style: { width: `${Math.min(100, Math.max(0, r))}%` }
|
|
3426
|
+
})
|
|
3427
|
+
})
|
|
3428
|
+
]
|
|
3429
|
+
});
|
|
3430
|
+
}
|
|
3431
|
+
//#endregion
|
|
3432
|
+
//#region src/components/ui/OAuthButton.tsx
|
|
3433
|
+
function qn() {
|
|
3434
|
+
return /* @__PURE__ */ m("svg", {
|
|
3435
|
+
className: "h-3.5 w-3.5",
|
|
3436
|
+
viewBox: "0 0 24 24",
|
|
3437
|
+
"aria-hidden": "true",
|
|
3438
|
+
children: [
|
|
3439
|
+
/* @__PURE__ */ p("path", {
|
|
3440
|
+
fill: "currentColor",
|
|
3441
|
+
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"
|
|
3442
|
+
}),
|
|
3443
|
+
/* @__PURE__ */ p("path", {
|
|
3444
|
+
fill: "currentColor",
|
|
3445
|
+
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
3446
|
+
}),
|
|
3447
|
+
/* @__PURE__ */ p("path", {
|
|
3448
|
+
fill: "currentColor",
|
|
3449
|
+
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
3450
|
+
}),
|
|
3451
|
+
/* @__PURE__ */ p("path", {
|
|
3452
|
+
fill: "currentColor",
|
|
3453
|
+
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
3454
|
+
})
|
|
3455
|
+
]
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
function Jn() {
|
|
3459
|
+
return /* @__PURE__ */ p("svg", {
|
|
3460
|
+
className: "h-3.5 w-3.5",
|
|
3461
|
+
viewBox: "0 0 24 24",
|
|
3462
|
+
fill: "currentColor",
|
|
3463
|
+
"aria-hidden": "true",
|
|
3464
|
+
children: /* @__PURE__ */ p("path", { d: "M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" })
|
|
3465
|
+
});
|
|
3466
|
+
}
|
|
3467
|
+
var Yn = {
|
|
3468
|
+
github: "GitHub",
|
|
3469
|
+
google: "Google"
|
|
3470
|
+
}, Xn = {
|
|
3471
|
+
github: Jn,
|
|
3472
|
+
google: qn
|
|
3473
|
+
};
|
|
3474
|
+
function Zn({ provider: e, children: t, ...n }) {
|
|
3475
|
+
let r = Xn[e];
|
|
3476
|
+
return /* @__PURE__ */ m(J, {
|
|
3477
|
+
variant: "secondary",
|
|
3478
|
+
size: "md",
|
|
3479
|
+
...n,
|
|
3480
|
+
children: [/* @__PURE__ */ p(r, {}), t ?? Yn[e]]
|
|
3481
|
+
});
|
|
3482
|
+
}
|
|
3483
|
+
//#endregion
|
|
3484
|
+
//#region src/components/ui/PageHeader.tsx
|
|
3485
|
+
function Qn({ title: e, subtitle: t, actions: n, className: r }) {
|
|
3486
|
+
return /* @__PURE__ */ m("div", {
|
|
3487
|
+
className: I("flex items-center justify-between", r),
|
|
3488
|
+
children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
|
|
3489
|
+
className: "text-text-primary font-heading text-sm font-semibold",
|
|
3490
|
+
children: e
|
|
3491
|
+
}), t && /* @__PURE__ */ p("p", {
|
|
3492
|
+
className: "text-text-tertiary text-xs",
|
|
3493
|
+
children: t
|
|
3494
|
+
})] }), n && /* @__PURE__ */ p("div", {
|
|
3495
|
+
className: "flex items-center gap-2",
|
|
3496
|
+
children: n
|
|
3497
|
+
})]
|
|
3498
|
+
});
|
|
3499
|
+
}
|
|
3500
|
+
//#endregion
|
|
3501
|
+
//#region src/components/ui/PageSection.tsx
|
|
3502
|
+
function $n({ title: e, description: t, actions: n, children: r, as: i = "h2", className: a, headerClassName: o, contentClassName: s }) {
|
|
3503
|
+
return /* @__PURE__ */ m("section", {
|
|
3504
|
+
className: I("space-y-4", a),
|
|
3505
|
+
children: [(e || t || n) && /* @__PURE__ */ m("div", {
|
|
3506
|
+
className: I("border-border flex items-end justify-between gap-3 border-b pb-2", o),
|
|
3507
|
+
children: [/* @__PURE__ */ m("div", {
|
|
3508
|
+
className: "min-w-0",
|
|
3509
|
+
children: [e && /* @__PURE__ */ p(i, {
|
|
3510
|
+
className: "text-text-primary font-heading text-xs font-semibold",
|
|
3511
|
+
children: e
|
|
3512
|
+
}), t && /* @__PURE__ */ p("p", {
|
|
3513
|
+
className: "text-text-secondary mt-1 text-xs",
|
|
3514
|
+
children: t
|
|
3515
|
+
})]
|
|
3516
|
+
}), n && /* @__PURE__ */ p("div", {
|
|
3517
|
+
className: "flex items-center gap-2",
|
|
3518
|
+
children: n
|
|
3519
|
+
})]
|
|
3520
|
+
}), /* @__PURE__ */ p("div", {
|
|
3521
|
+
className: s,
|
|
3522
|
+
children: r
|
|
3523
|
+
})]
|
|
3524
|
+
});
|
|
3525
|
+
}
|
|
3526
|
+
//#endregion
|
|
3527
|
+
//#region src/components/ui/SelectDropdown.tsx
|
|
3528
|
+
function er({ options: e, value: t, onChange: n, label: r, placeholder: a = "Select...", className: o, size: c = "md" }) {
|
|
3529
|
+
let [l, f] = d(!1), [h, g] = d(-1), _ = u(null), v = u(null), y = vn(l, _, v), b = s(), x = `${b}-listbox`, S = e.find((e) => e.value === t);
|
|
3530
|
+
W(l, i(() => f(!1), []), [_]);
|
|
3531
|
+
function w() {
|
|
3532
|
+
if (!l) {
|
|
3533
|
+
let n = e.findIndex((e) => e.value === t);
|
|
3534
|
+
g(n >= 0 ? n : 0);
|
|
3535
|
+
}
|
|
3536
|
+
f(!l);
|
|
3537
|
+
}
|
|
3538
|
+
function E(r) {
|
|
3539
|
+
if (!l) {
|
|
3540
|
+
if (r.key === "ArrowDown" || r.key === "ArrowUp") {
|
|
3541
|
+
r.preventDefault();
|
|
3542
|
+
let n = e.findIndex((e) => e.value === t);
|
|
3543
|
+
g(n >= 0 ? n : 0), f(!0);
|
|
3544
|
+
}
|
|
3545
|
+
return;
|
|
3546
|
+
}
|
|
3547
|
+
switch (r.key) {
|
|
3548
|
+
case "ArrowDown":
|
|
3549
|
+
r.preventDefault(), g((t) => Math.min(t + 1, e.length - 1));
|
|
3550
|
+
break;
|
|
3551
|
+
case "ArrowUp":
|
|
3552
|
+
r.preventDefault(), g((e) => Math.max(e - 1, 0));
|
|
3553
|
+
break;
|
|
3554
|
+
case "Enter":
|
|
3555
|
+
r.preventDefault(), e[h] && (n(e[h].value), f(!1));
|
|
3556
|
+
break;
|
|
3557
|
+
case "Escape":
|
|
3558
|
+
r.preventDefault(), f(!1);
|
|
3559
|
+
break;
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
return /* @__PURE__ */ m("div", {
|
|
3563
|
+
className: I("flex flex-col gap-1.5", o),
|
|
3564
|
+
ref: _,
|
|
3565
|
+
children: [r && /* @__PURE__ */ p("span", {
|
|
3566
|
+
className: "text-text-secondary font-label text-xs font-medium",
|
|
3567
|
+
children: r
|
|
3568
|
+
}), /* @__PURE__ */ m("div", {
|
|
3569
|
+
className: "relative",
|
|
3570
|
+
children: [
|
|
3571
|
+
/* @__PURE__ */ p("button", {
|
|
3572
|
+
type: "button",
|
|
3573
|
+
onClick: w,
|
|
3574
|
+
onKeyDown: E,
|
|
3575
|
+
"aria-haspopup": "listbox",
|
|
3576
|
+
"aria-expanded": l,
|
|
3577
|
+
"aria-controls": l ? x : void 0,
|
|
3578
|
+
"aria-activedescendant": l && h >= 0 ? `${b}-option-${h}` : void 0,
|
|
3579
|
+
className: I("font-control flex w-full cursor-pointer items-center rounded-md text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms]", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2", c === "sm" ? "h-6 px-2 pr-6" : "h-7 px-2 pr-7"),
|
|
3580
|
+
children: S ? S.label : /* @__PURE__ */ p("span", {
|
|
3581
|
+
className: "text-text-disabled",
|
|
3582
|
+
children: a
|
|
3583
|
+
})
|
|
3584
|
+
}),
|
|
3585
|
+
/* @__PURE__ */ p(T, { className: I("text-text-tertiary pointer-events-none absolute top-1/2 h-3 w-3 -translate-y-1/2 transition-transform", c === "sm" ? "right-1.5" : "right-2", l && "rotate-180") }),
|
|
3586
|
+
l && /* @__PURE__ */ p("div", {
|
|
3587
|
+
ref: v,
|
|
3588
|
+
className: I("bg-bg-tertiary border-border-strong animate-scale-in absolute right-0 left-0 z-[100] overflow-hidden rounded-md border shadow-lg", y ? "bottom-full mb-1" : "top-full mt-1"),
|
|
3589
|
+
children: /* @__PURE__ */ p("ul", {
|
|
3590
|
+
id: x,
|
|
3591
|
+
className: "max-h-48 overflow-y-auto py-1",
|
|
3592
|
+
role: "listbox",
|
|
3593
|
+
children: e.map((e, r) => /* @__PURE__ */ m("li", {
|
|
3594
|
+
id: `${b}-option-${r}`,
|
|
3595
|
+
role: "option",
|
|
3596
|
+
"aria-selected": e.value === t,
|
|
3597
|
+
onClick: () => {
|
|
3598
|
+
n(e.value), f(!1);
|
|
3599
|
+
},
|
|
3600
|
+
onMouseEnter: () => g(r),
|
|
3601
|
+
className: I("font-control flex h-7 w-full cursor-pointer items-center gap-2 px-3 text-xs", "transition-colors duration-[100ms]", r === h ? "bg-accent-muted text-accent" : e.value === t ? "text-accent" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
|
|
3602
|
+
children: [/* @__PURE__ */ p("span", {
|
|
3603
|
+
className: "flex-1 truncate",
|
|
3604
|
+
children: e.label
|
|
3605
|
+
}), e.value === t && /* @__PURE__ */ p(C, { className: "h-3 w-3 shrink-0" })]
|
|
3606
|
+
}, e.value))
|
|
3607
|
+
})
|
|
3608
|
+
})
|
|
3609
|
+
]
|
|
3610
|
+
})]
|
|
3611
|
+
});
|
|
3612
|
+
}
|
|
3613
|
+
//#endregion
|
|
3614
|
+
//#region src/components/ui/PaginationBar.tsx
|
|
3615
|
+
var tr = [
|
|
3616
|
+
{
|
|
3617
|
+
value: "10",
|
|
3618
|
+
label: "10 per page"
|
|
3619
|
+
},
|
|
3620
|
+
{
|
|
3621
|
+
value: "25",
|
|
3622
|
+
label: "25 per page"
|
|
3623
|
+
},
|
|
3624
|
+
{
|
|
3625
|
+
value: "50",
|
|
3626
|
+
label: "50 per page"
|
|
3627
|
+
}
|
|
3628
|
+
];
|
|
3629
|
+
function nr({ page: e, pageSize: t, total: n, pageSizeOptions: r = tr, onPageChange: i, onPageSizeChange: a, className: o }) {
|
|
3630
|
+
let s = Math.ceil(n / t), c = Math.min((e - 1) * t + 1, n), l = Math.min(e * t, n);
|
|
3631
|
+
return /* @__PURE__ */ m("div", {
|
|
3632
|
+
className: I("flex items-center justify-between", o),
|
|
3633
|
+
children: [/* @__PURE__ */ m("div", {
|
|
3634
|
+
className: "flex items-center gap-3",
|
|
3635
|
+
children: [/* @__PURE__ */ p(er, {
|
|
3636
|
+
size: "sm",
|
|
3637
|
+
value: String(t),
|
|
3638
|
+
onChange: (e) => a(Number(e)),
|
|
3639
|
+
options: r,
|
|
3640
|
+
className: "w-28"
|
|
3641
|
+
}), /* @__PURE__ */ m("span", {
|
|
3642
|
+
className: "text-text-tertiary hidden text-xs sm:inline",
|
|
3643
|
+
children: [
|
|
3644
|
+
c,
|
|
3645
|
+
"–",
|
|
3646
|
+
l,
|
|
3647
|
+
" of ",
|
|
3648
|
+
n
|
|
3649
|
+
]
|
|
3650
|
+
})]
|
|
3651
|
+
}), /* @__PURE__ */ p(qt, {
|
|
3652
|
+
page: e,
|
|
3653
|
+
totalPages: s,
|
|
3654
|
+
onPageChange: i
|
|
3655
|
+
})]
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3658
|
+
//#endregion
|
|
3659
|
+
//#region src/components/ui/PasswordInput.tsx
|
|
3660
|
+
var rr = r(({ label: e, error: t, className: n, id: r, ...i }, a) => {
|
|
3661
|
+
let o = r || e?.toLowerCase().replace(/\s+/g, "-"), [s, c] = d(!1);
|
|
3662
|
+
return /* @__PURE__ */ m("div", {
|
|
3663
|
+
className: "flex flex-col gap-1.5",
|
|
3664
|
+
children: [(e || t) && /* @__PURE__ */ m("div", {
|
|
3665
|
+
className: "flex items-center justify-between",
|
|
3666
|
+
children: [e && /* @__PURE__ */ p("label", {
|
|
3667
|
+
htmlFor: o,
|
|
3668
|
+
className: "text-text-secondary text-xs font-medium",
|
|
3669
|
+
children: e
|
|
3670
|
+
}), t && /* @__PURE__ */ p("p", {
|
|
3671
|
+
className: "text-2xs text-red",
|
|
3672
|
+
children: t
|
|
3673
|
+
})]
|
|
3674
|
+
}), /* @__PURE__ */ m("div", {
|
|
3675
|
+
className: "relative",
|
|
3676
|
+
children: [/* @__PURE__ */ p("input", {
|
|
3677
|
+
ref: a,
|
|
3678
|
+
id: o,
|
|
3679
|
+
type: s ? "text" : "password",
|
|
3680
|
+
className: I("bg-bg-secondary text-text-primary h-7 w-full rounded-md border px-2 pr-8 text-xs", "placeholder:text-text-disabled", "transition-colors duration-[100ms]", "focus:border-accent focus:outline-none", t ? "border-red" : "border-border", n),
|
|
3681
|
+
...i
|
|
3682
|
+
}), /* @__PURE__ */ p("button", {
|
|
3683
|
+
type: "button",
|
|
3684
|
+
onClick: () => c(!s),
|
|
3685
|
+
className: "text-text-tertiary hover:text-text-primary absolute top-1/2 right-2.5 -translate-y-1/2 cursor-pointer",
|
|
3686
|
+
"aria-label": s ? "Hide password" : "Show password",
|
|
3687
|
+
children: p(s ? j : A, { className: "h-3.5 w-3.5" })
|
|
3688
|
+
})]
|
|
3689
|
+
})]
|
|
3690
|
+
});
|
|
3691
|
+
});
|
|
3692
|
+
rr.displayName = "PasswordInput";
|
|
3693
|
+
//#endregion
|
|
3694
|
+
//#region src/components/ui/ProfileHeader.tsx
|
|
3695
|
+
function ir({ name: e, subtitle: t, badge: n, meta: r, action: i, className: a }) {
|
|
3696
|
+
return /* @__PURE__ */ m("div", {
|
|
3697
|
+
className: I("flex items-start gap-4", a),
|
|
3698
|
+
children: [
|
|
3699
|
+
/* @__PURE__ */ p(q, {
|
|
3700
|
+
name: e,
|
|
3701
|
+
size: "lg"
|
|
3702
|
+
}),
|
|
3703
|
+
/* @__PURE__ */ m("div", {
|
|
3704
|
+
className: "min-w-0 flex-1",
|
|
3705
|
+
children: [
|
|
3706
|
+
/* @__PURE__ */ m("div", {
|
|
3707
|
+
className: "mb-1 flex items-center gap-2",
|
|
3708
|
+
children: [/* @__PURE__ */ p("h1", {
|
|
3709
|
+
className: "text-text-primary text-base font-semibold",
|
|
3710
|
+
children: e
|
|
3711
|
+
}), n]
|
|
3712
|
+
}),
|
|
3713
|
+
t && /* @__PURE__ */ p("p", {
|
|
3714
|
+
className: "text-text-tertiary text-xs",
|
|
3715
|
+
children: t
|
|
3716
|
+
}),
|
|
3717
|
+
r && r.length > 0 && /* @__PURE__ */ p("div", {
|
|
3718
|
+
className: "mt-2 flex flex-wrap gap-3",
|
|
3719
|
+
children: r.map((e) => {
|
|
3720
|
+
let t = e.icon, n = /* @__PURE__ */ m(f, { children: [
|
|
3721
|
+
/* @__PURE__ */ p(t, { className: "h-3 w-3" }),
|
|
3722
|
+
" ",
|
|
3723
|
+
e.text
|
|
3724
|
+
] });
|
|
3725
|
+
return e.href ? /* @__PURE__ */ p("a", {
|
|
3726
|
+
href: e.href,
|
|
3727
|
+
className: "text-2xs-f text-accent hover:text-accent-hover flex cursor-pointer items-center gap-1",
|
|
3728
|
+
children: n
|
|
3729
|
+
}, e.text) : /* @__PURE__ */ p("span", {
|
|
3730
|
+
className: "text-2xs-f text-text-tertiary flex items-center gap-1",
|
|
3731
|
+
children: n
|
|
3732
|
+
}, e.text);
|
|
3733
|
+
})
|
|
3734
|
+
})
|
|
3735
|
+
]
|
|
3736
|
+
}),
|
|
3737
|
+
i
|
|
3738
|
+
]
|
|
3739
|
+
});
|
|
3740
|
+
}
|
|
3741
|
+
//#endregion
|
|
3742
|
+
//#region src/components/ui/ProseContent.tsx
|
|
3743
|
+
function ar({ children: e, className: t }) {
|
|
3744
|
+
return /* @__PURE__ */ p("div", {
|
|
3745
|
+
className: I("ui-prose", t),
|
|
3746
|
+
children: e
|
|
3747
|
+
});
|
|
3748
|
+
}
|
|
3749
|
+
//#endregion
|
|
3750
|
+
//#region src/components/ui/RadioPill.tsx
|
|
3751
|
+
function or({ options: e, value: t, onChange: n, disabled: r, className: i, "aria-label": a }) {
|
|
3752
|
+
return /* @__PURE__ */ p("div", {
|
|
3753
|
+
role: "radiogroup",
|
|
3754
|
+
"aria-label": a,
|
|
3755
|
+
className: I("border-border inline-flex overflow-hidden rounded-md border", r && "cursor-not-allowed opacity-40", i),
|
|
3756
|
+
children: e.map((e) => /* @__PURE__ */ p("button", {
|
|
3757
|
+
role: "radio",
|
|
3758
|
+
"aria-checked": e.value === t,
|
|
3759
|
+
disabled: r,
|
|
3760
|
+
onClick: () => n(e.value),
|
|
3761
|
+
className: I("font-control px-3 py-1.5 text-xs font-medium transition-colors duration-[100ms]", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-[-2px]", !r && "cursor-pointer", e.value === t ? "bg-accent text-text-on-accent" : "bg-bg-secondary text-text-secondary hover:bg-bg-hover hover:text-text-primary"),
|
|
3762
|
+
children: e.label
|
|
3763
|
+
}, e.value))
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
//#endregion
|
|
3767
|
+
//#region src/components/ui/SearchInput.tsx
|
|
3768
|
+
function sr({ value: e, onChange: t, placeholder: n = "Search...", className: r }) {
|
|
3769
|
+
return /* @__PURE__ */ m("div", {
|
|
3770
|
+
className: I("relative", r),
|
|
3771
|
+
children: [/* @__PURE__ */ p(M, { className: "text-text-tertiary absolute top-1/2 left-2 h-3.5 w-3.5 -translate-y-1/2" }), /* @__PURE__ */ p("input", {
|
|
3772
|
+
type: "search",
|
|
3773
|
+
value: e,
|
|
3774
|
+
onChange: (e) => t(e.target.value),
|
|
3775
|
+
placeholder: n,
|
|
3776
|
+
className: I("bg-bg-secondary text-text-primary h-7 w-full pr-2 pl-7 text-xs", "border-border rounded-md border", "placeholder:text-text-disabled", "transition-colors duration-[100ms]", "focus:border-accent focus:outline-none")
|
|
3777
|
+
})]
|
|
3778
|
+
});
|
|
3779
|
+
}
|
|
3780
|
+
//#endregion
|
|
3781
|
+
//#region src/components/ui/SectionHeader.tsx
|
|
3782
|
+
function cr({ children: e, as: t = "h2", className: n, border: r = !0 }) {
|
|
3783
|
+
return /* @__PURE__ */ p(t, {
|
|
3784
|
+
className: I("text-text-primary font-heading text-xs font-semibold", r && "border-border border-b pb-2", n),
|
|
3785
|
+
children: e
|
|
3786
|
+
});
|
|
3787
|
+
}
|
|
3788
|
+
//#endregion
|
|
3789
|
+
//#region src/components/ui/Select.tsx
|
|
3790
|
+
var lr = r(({ label: e, error: t, options: n, className: r, id: i, ...a }, o) => {
|
|
3791
|
+
let s = i || e?.toLowerCase().replace(/\s+/g, "-");
|
|
3792
|
+
return /* @__PURE__ */ m("div", {
|
|
3793
|
+
className: "flex flex-col gap-1.5",
|
|
3794
|
+
children: [(e || t) && /* @__PURE__ */ m("div", {
|
|
3795
|
+
className: "flex items-center justify-between",
|
|
3796
|
+
children: [e && /* @__PURE__ */ p("label", {
|
|
3797
|
+
htmlFor: s,
|
|
3798
|
+
className: "text-text-secondary font-label text-xs font-medium",
|
|
3799
|
+
children: e
|
|
3800
|
+
}), t && /* @__PURE__ */ p("p", {
|
|
3801
|
+
className: "text-2xs text-red",
|
|
3802
|
+
children: t
|
|
3803
|
+
})]
|
|
3804
|
+
}), /* @__PURE__ */ m("div", {
|
|
3805
|
+
className: "relative",
|
|
3806
|
+
children: [/* @__PURE__ */ p("select", {
|
|
3807
|
+
ref: o,
|
|
3808
|
+
id: s,
|
|
3809
|
+
className: I("bg-bg-secondary text-text-primary font-control h-7 w-full px-2 pr-7 text-xs", "appearance-none rounded-md border", "transition-colors duration-[100ms]", "focus:border-accent focus:outline-none", "disabled:cursor-not-allowed disabled:opacity-40", "cursor-pointer", t ? "border-red" : "border-border", r),
|
|
3810
|
+
...a,
|
|
3811
|
+
children: n.map((e) => /* @__PURE__ */ p("option", {
|
|
3812
|
+
value: e.value,
|
|
3813
|
+
children: e.label
|
|
3814
|
+
}, e.value))
|
|
3815
|
+
}), /* @__PURE__ */ p(T, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2.5 h-3.5 w-3.5 -translate-y-1/2" })]
|
|
3816
|
+
})]
|
|
3817
|
+
});
|
|
3818
|
+
});
|
|
3819
|
+
lr.displayName = "Select";
|
|
3820
|
+
//#endregion
|
|
3821
|
+
//#region src/components/ui/SettingRow.tsx
|
|
3822
|
+
function ur({ label: e, description: t, action: n, className: r }) {
|
|
3823
|
+
return /* @__PURE__ */ m("div", {
|
|
3824
|
+
className: I("border-border flex items-center justify-between border-b py-3", r),
|
|
3825
|
+
children: [/* @__PURE__ */ m("div", {
|
|
3826
|
+
className: "min-w-0 flex-1 pr-4",
|
|
3827
|
+
children: [/* @__PURE__ */ p("p", {
|
|
3828
|
+
className: "text-text-primary font-label text-xs font-medium",
|
|
3829
|
+
children: e
|
|
3830
|
+
}), t && /* @__PURE__ */ p("p", {
|
|
3831
|
+
className: "text-2xs text-text-tertiary font-label mt-0.5",
|
|
3832
|
+
children: t
|
|
3833
|
+
})]
|
|
3834
|
+
}), /* @__PURE__ */ p("div", {
|
|
3835
|
+
className: "shrink-0",
|
|
3836
|
+
children: n
|
|
3837
|
+
})]
|
|
3838
|
+
});
|
|
3839
|
+
}
|
|
3840
|
+
//#endregion
|
|
3841
|
+
//#region src/components/ui/Slider.tsx
|
|
3842
|
+
function dr({ min: e, max: t, step: n = 1, value: r, onChange: i, onCommit: a, label: o, showValue: s, className: c }) {
|
|
3843
|
+
let l = (r - e) / (t - e) * 100;
|
|
3844
|
+
return /* @__PURE__ */ m("div", {
|
|
3845
|
+
className: I("flex flex-col gap-1.5", c),
|
|
3846
|
+
children: [(o || s) && /* @__PURE__ */ m("div", {
|
|
3847
|
+
className: "flex items-center justify-between",
|
|
3848
|
+
children: [o && /* @__PURE__ */ p("span", {
|
|
3849
|
+
className: "text-text-secondary font-label text-xs font-medium",
|
|
3850
|
+
children: o
|
|
3851
|
+
}), s && /* @__PURE__ */ p("span", {
|
|
3852
|
+
className: "text-text-primary font-data text-xs",
|
|
3853
|
+
children: r
|
|
3854
|
+
})]
|
|
3855
|
+
}), /* @__PURE__ */ p("input", {
|
|
3856
|
+
type: "range",
|
|
3857
|
+
min: e,
|
|
3858
|
+
max: t,
|
|
3859
|
+
step: n,
|
|
3860
|
+
value: r,
|
|
3861
|
+
onChange: (e) => i(Number(e.target.value)),
|
|
3862
|
+
onPointerUp: a ? (e) => a(Number(e.target.value)) : void 0,
|
|
3863
|
+
className: "bg-bg-tertiary [&::-webkit-slider-thumb]:bg-accent h-1.5 w-full cursor-pointer appearance-none rounded-md [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:shadow-sm [&::-webkit-slider-thumb]:transition-transform [&::-webkit-slider-thumb]:duration-[100ms] [&::-webkit-slider-thumb]:hover:scale-110",
|
|
3864
|
+
style: { background: `linear-gradient(to right, var(--accent) ${l}%, var(--bg-tertiary) ${l}%)` }
|
|
3865
|
+
})]
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3868
|
+
//#endregion
|
|
3869
|
+
//#region src/components/ui/SideSheet.tsx
|
|
3870
|
+
function fr({ open: e, onClose: t, title: n, children: r, footer: i, side: a = "right", widthClassName: s = "w-[360px]", className: c, contentClassName: l }) {
|
|
3871
|
+
let d = u(null);
|
|
3872
|
+
return B(d, e), o(() => {
|
|
3873
|
+
if (!e) return;
|
|
3874
|
+
let n = (e) => {
|
|
3875
|
+
e.key === "Escape" && t();
|
|
3876
|
+
};
|
|
3877
|
+
return document.addEventListener("keydown", n), document.body.style.overflow = "hidden", () => {
|
|
3878
|
+
document.removeEventListener("keydown", n), document.body.style.overflow = "";
|
|
3879
|
+
};
|
|
3880
|
+
}, [e, t]), e ? P(/* @__PURE__ */ m("div", {
|
|
3881
|
+
className: "fixed inset-0 z-50 flex",
|
|
3882
|
+
children: [
|
|
3883
|
+
a === "right" && /* @__PURE__ */ p("div", {
|
|
3884
|
+
className: "bg-bg-overlay animate-fade-in flex-1",
|
|
3885
|
+
onClick: t
|
|
3886
|
+
}),
|
|
3887
|
+
/* @__PURE__ */ m("div", {
|
|
3888
|
+
ref: d,
|
|
3889
|
+
className: I("bg-bg-secondary border-border flex flex-col shadow-lg", s, a === "right" ? "animate-slide-in-right border-l" : "animate-slide-in-left border-r", c),
|
|
3890
|
+
style: { maxWidth: "calc(100vw - 2rem)" },
|
|
3891
|
+
role: "dialog",
|
|
3892
|
+
"aria-modal": "true",
|
|
3893
|
+
"aria-label": typeof n == "string" ? n : "Panel",
|
|
3894
|
+
children: [
|
|
3895
|
+
/* @__PURE__ */ m("div", {
|
|
3896
|
+
className: "border-border flex h-10 shrink-0 items-center justify-between border-b px-3",
|
|
3897
|
+
children: [n && /* @__PURE__ */ p("h3", {
|
|
3898
|
+
className: "text-text-primary truncate text-xs font-semibold",
|
|
3899
|
+
children: n
|
|
3900
|
+
}), /* @__PURE__ */ p("button", {
|
|
3901
|
+
onClick: t,
|
|
3902
|
+
className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover ml-auto flex h-6 w-6 cursor-pointer items-center justify-center rounded",
|
|
3903
|
+
"aria-label": "Close",
|
|
3904
|
+
children: /* @__PURE__ */ p(N, { className: "h-3.5 w-3.5" })
|
|
3905
|
+
})]
|
|
3906
|
+
}),
|
|
3907
|
+
/* @__PURE__ */ p("div", {
|
|
3908
|
+
className: I("flex-1 overflow-y-auto p-3", l),
|
|
3909
|
+
children: r
|
|
3910
|
+
}),
|
|
3911
|
+
i && /* @__PURE__ */ p("div", {
|
|
3912
|
+
className: "border-border flex gap-2 border-t p-3",
|
|
3913
|
+
children: i
|
|
3914
|
+
})
|
|
3915
|
+
]
|
|
3916
|
+
}),
|
|
3917
|
+
a === "left" && /* @__PURE__ */ p("div", {
|
|
3918
|
+
className: "bg-bg-overlay animate-fade-in flex-1",
|
|
3919
|
+
onClick: t
|
|
3920
|
+
})
|
|
3921
|
+
]
|
|
3922
|
+
}), document.body) : null;
|
|
3923
|
+
}
|
|
3924
|
+
//#endregion
|
|
3925
|
+
//#region src/components/ui/SplitPaneLayout.tsx
|
|
3926
|
+
function pr({ children: e, direction: t = "row", className: n }) {
|
|
3927
|
+
return /* @__PURE__ */ p("div", {
|
|
3928
|
+
className: I("-m-4 md:-m-6", "flex h-[calc(100vh-var(--topbar-height)-var(--bottomnav-height))] gap-0 md:h-[calc(100vh-var(--topbar-height))]", t === "column" && "flex-col", n),
|
|
3929
|
+
children: e
|
|
3930
|
+
});
|
|
3931
|
+
}
|
|
3932
|
+
function mr({ children: e, className: t }) {
|
|
3933
|
+
return /* @__PURE__ */ p("div", {
|
|
3934
|
+
className: I("flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden", t),
|
|
3935
|
+
children: e
|
|
3936
|
+
});
|
|
3937
|
+
}
|
|
3938
|
+
var hr = Object.assign(pr, { Main: mr }), gr = {
|
|
3939
|
+
active: "bg-green",
|
|
3940
|
+
inactive: "bg-text-tertiary",
|
|
3941
|
+
pending: "bg-yellow animate-pulse-subtle",
|
|
3942
|
+
error: "bg-red"
|
|
3943
|
+
}, _r = {
|
|
3944
|
+
active: "text-green",
|
|
3945
|
+
inactive: "text-text-tertiary",
|
|
3946
|
+
pending: "text-yellow",
|
|
3947
|
+
error: "text-red"
|
|
3948
|
+
};
|
|
3949
|
+
function vr({ status: e, label: t, className: n }) {
|
|
3950
|
+
return /* @__PURE__ */ m("span", {
|
|
3951
|
+
className: I("inline-flex items-center gap-1.5", n),
|
|
3952
|
+
children: [/* @__PURE__ */ p("span", { className: I("h-2 w-2 rounded-full", gr[e]) }), t && /* @__PURE__ */ p("span", {
|
|
3953
|
+
className: I("text-xs", _r[e]),
|
|
3954
|
+
children: t
|
|
3955
|
+
})]
|
|
3956
|
+
});
|
|
3957
|
+
}
|
|
3958
|
+
//#endregion
|
|
3959
|
+
//#region src/components/ui/StepProgress.tsx
|
|
3960
|
+
function yr({ steps: e, currentStep: t, className: n }) {
|
|
3961
|
+
return /* @__PURE__ */ p("div", {
|
|
3962
|
+
className: I("flex items-center justify-between", n),
|
|
3963
|
+
children: e.map((n, r) => /* @__PURE__ */ m("div", {
|
|
3964
|
+
className: "flex flex-1 items-center",
|
|
3965
|
+
children: [/* @__PURE__ */ m("div", {
|
|
3966
|
+
className: "flex flex-col items-center",
|
|
3967
|
+
children: [
|
|
3968
|
+
/* @__PURE__ */ p("div", {
|
|
3969
|
+
className: I("flex h-8 w-8 items-center justify-center rounded-full text-xs", r < t && "bg-accent text-text-on-accent", r === t && "border-accent text-accent border-2 font-semibold", r > t && "bg-bg-tertiary border-border text-text-tertiary border"),
|
|
3970
|
+
children: r < t ? /* @__PURE__ */ p(C, { className: "h-4 w-4" }) : r + 1
|
|
3971
|
+
}),
|
|
3972
|
+
/* @__PURE__ */ p("span", {
|
|
3973
|
+
className: I("text-2xs mt-1.5 hidden sm:block", r === t && "text-accent", r < t && "text-text-primary", r > t && "text-text-tertiary"),
|
|
3974
|
+
children: n.label
|
|
3975
|
+
}),
|
|
3976
|
+
n.description && /* @__PURE__ */ p("span", {
|
|
3977
|
+
className: "text-2xs text-text-secondary mt-0.5 hidden sm:block",
|
|
3978
|
+
children: n.description
|
|
3979
|
+
})
|
|
3980
|
+
]
|
|
3981
|
+
}), r < e.length - 1 && /* @__PURE__ */ p("div", { className: I("mx-2 h-0.5 flex-1", r < t ? "bg-accent" : "bg-border") })]
|
|
3982
|
+
}, n.label))
|
|
3983
|
+
});
|
|
3984
|
+
}
|
|
3985
|
+
//#endregion
|
|
3986
|
+
//#region src/components/ui/Tabs.tsx
|
|
3987
|
+
function br({ tabs: e, defaultTab: t, value: n, onChange: r, className: i }) {
|
|
3988
|
+
let [a, o] = d(t || e[0]?.key), c = n ?? a, l = e.find((e) => e.key === c);
|
|
3989
|
+
function f(e) {
|
|
3990
|
+
n === void 0 && o(e), r?.(e);
|
|
3991
|
+
}
|
|
3992
|
+
let h = s(), g = u(null);
|
|
3993
|
+
function _(t) {
|
|
3994
|
+
let n = e.map((e) => e.key), r = n.indexOf(c), i = null;
|
|
3995
|
+
t.key === "ArrowRight" ? (t.preventDefault(), i = (r + 1) % e.length) : t.key === "ArrowLeft" && (t.preventDefault(), i = (r - 1 + e.length) % e.length), i !== null && (f(n[i]), (g.current?.querySelectorAll("[role=\"tab\"]"))?.[i]?.focus());
|
|
3996
|
+
}
|
|
3997
|
+
return /* @__PURE__ */ m("div", {
|
|
3998
|
+
className: i,
|
|
3999
|
+
children: [/* @__PURE__ */ p("div", {
|
|
4000
|
+
className: "border-border flex border-b",
|
|
4001
|
+
role: "tablist",
|
|
4002
|
+
ref: g,
|
|
4003
|
+
children: e.map((e) => /* @__PURE__ */ m("button", {
|
|
4004
|
+
id: `${h}-tab-${e.key}`,
|
|
4005
|
+
role: "tab",
|
|
4006
|
+
tabIndex: e.key === c ? 0 : -1,
|
|
4007
|
+
"aria-selected": e.key === c,
|
|
4008
|
+
"aria-controls": `${h}-panel-${e.key}`,
|
|
4009
|
+
onClick: () => f(e.key),
|
|
4010
|
+
onKeyDown: _,
|
|
4011
|
+
className: I("font-control relative cursor-pointer px-3 py-2 text-xs font-medium transition-colors duration-[100ms]", "hover:text-text-primary", e.key === c ? "text-accent" : "text-text-tertiary"),
|
|
4012
|
+
children: [e.label, e.key === c && /* @__PURE__ */ p("div", { className: "bg-accent absolute right-0 bottom-0 left-0 h-0.5 rounded-md" })]
|
|
4013
|
+
}, e.key))
|
|
4014
|
+
}), /* @__PURE__ */ p("div", {
|
|
4015
|
+
id: `${h}-panel-${c}`,
|
|
4016
|
+
role: "tabpanel",
|
|
4017
|
+
"aria-labelledby": `${h}-tab-${c}`,
|
|
4018
|
+
className: "pt-4",
|
|
4019
|
+
children: l?.content
|
|
4020
|
+
})]
|
|
4021
|
+
});
|
|
4022
|
+
}
|
|
4023
|
+
//#endregion
|
|
4024
|
+
//#region src/components/ui/Textarea.tsx
|
|
4025
|
+
var xr = r(({ label: e, error: t, showCount: n, maxLength: r, value: i, className: a, id: o, ...s }, c) => {
|
|
4026
|
+
let l = o || e?.toLowerCase().replace(/\s+/g, "-"), u = typeof i == "string" ? i.length : 0;
|
|
4027
|
+
return /* @__PURE__ */ m("div", {
|
|
4028
|
+
className: "flex flex-col gap-1.5",
|
|
4029
|
+
children: [
|
|
4030
|
+
e && /* @__PURE__ */ p("label", {
|
|
4031
|
+
htmlFor: l,
|
|
4032
|
+
className: "text-text-secondary font-label text-xs font-medium",
|
|
4033
|
+
children: e
|
|
4034
|
+
}),
|
|
4035
|
+
/* @__PURE__ */ p("textarea", {
|
|
4036
|
+
ref: c,
|
|
4037
|
+
id: l,
|
|
4038
|
+
value: i,
|
|
4039
|
+
maxLength: r,
|
|
4040
|
+
className: I("bg-bg-secondary text-text-primary font-control min-h-[72px] w-full px-2 py-1.5 text-xs", "resize-y rounded-md border", "placeholder:text-text-disabled", "transition-colors duration-[100ms]", "focus:border-accent focus:outline-none", t ? "border-red" : "border-border", a),
|
|
4041
|
+
...s
|
|
4042
|
+
}),
|
|
4043
|
+
/* @__PURE__ */ m("div", {
|
|
4044
|
+
className: "flex justify-between",
|
|
4045
|
+
children: [t && /* @__PURE__ */ p("p", {
|
|
4046
|
+
className: "text-2xs text-red",
|
|
4047
|
+
children: t
|
|
4048
|
+
}), n && r && /* @__PURE__ */ m("p", {
|
|
4049
|
+
className: "text-2xs text-text-tertiary ml-auto",
|
|
4050
|
+
children: [
|
|
4051
|
+
u,
|
|
4052
|
+
"/",
|
|
4053
|
+
r
|
|
4054
|
+
]
|
|
4055
|
+
})]
|
|
4056
|
+
})
|
|
4057
|
+
]
|
|
4058
|
+
});
|
|
4059
|
+
});
|
|
4060
|
+
xr.displayName = "Textarea";
|
|
4061
|
+
//#endregion
|
|
4062
|
+
//#region src/components/ui/TextInput.tsx
|
|
4063
|
+
var Sr = r(({ label: e, error: t, icon: n, className: r, id: i, readOnly: a, ...o }, s) => {
|
|
4064
|
+
let c = i || e?.toLowerCase().replace(/\s+/g, "-");
|
|
4065
|
+
return /* @__PURE__ */ m("div", {
|
|
4066
|
+
className: "flex flex-col gap-1.5",
|
|
4067
|
+
children: [(e || t) && /* @__PURE__ */ m("div", {
|
|
4068
|
+
className: "flex items-center justify-between",
|
|
4069
|
+
children: [e && /* @__PURE__ */ p("label", {
|
|
4070
|
+
htmlFor: c,
|
|
4071
|
+
className: "text-text-secondary font-label text-xs font-medium",
|
|
4072
|
+
children: e
|
|
4073
|
+
}), t && /* @__PURE__ */ p("p", {
|
|
4074
|
+
className: "text-2xs text-red",
|
|
4075
|
+
children: t
|
|
4076
|
+
})]
|
|
4077
|
+
}), /* @__PURE__ */ m("div", {
|
|
4078
|
+
className: "relative",
|
|
4079
|
+
children: [n && /* @__PURE__ */ p("span", {
|
|
4080
|
+
className: "text-text-tertiary absolute top-1/2 left-2.5 -translate-y-1/2",
|
|
4081
|
+
children: n
|
|
4082
|
+
}), /* @__PURE__ */ p("input", {
|
|
4083
|
+
ref: s,
|
|
4084
|
+
id: c,
|
|
4085
|
+
readOnly: a,
|
|
4086
|
+
className: I("bg-bg-secondary text-text-primary font-control h-7 w-full px-2 text-xs", "rounded-md border", "placeholder:text-text-disabled", "transition-colors duration-[100ms]", "focus:border-accent focus:outline-none", "disabled:cursor-not-allowed disabled:opacity-40", a && "bg-bg-primary text-text-secondary focus:border-border cursor-default border-dashed", n && "pl-7", t ? "border-red" : !a && "border-border", a && !t && "border-border", r),
|
|
4087
|
+
...o
|
|
4088
|
+
})]
|
|
4089
|
+
})]
|
|
4090
|
+
});
|
|
4091
|
+
});
|
|
4092
|
+
Sr.displayName = "TextInput";
|
|
4093
|
+
//#endregion
|
|
4094
|
+
//#region src/components/ui/Timeline.tsx
|
|
4095
|
+
function Cr({ items: e, className: t }) {
|
|
4096
|
+
return /* @__PURE__ */ p("div", {
|
|
4097
|
+
className: I("space-y-0", t),
|
|
4098
|
+
children: e.map((t, n) => /* @__PURE__ */ m("div", {
|
|
4099
|
+
className: "flex gap-3",
|
|
4100
|
+
children: [/* @__PURE__ */ m("div", {
|
|
4101
|
+
className: "flex flex-col items-center",
|
|
4102
|
+
children: [/* @__PURE__ */ p("div", { className: I(t.dot, "mt-1.5 h-2 w-2 shrink-0 rounded-full") }), n < e.length - 1 && /* @__PURE__ */ p("div", { className: "bg-border mt-1 w-px flex-1" })]
|
|
4103
|
+
}), /* @__PURE__ */ m("div", {
|
|
4104
|
+
className: I("pb-4", n === e.length - 1 && "pb-0"),
|
|
4105
|
+
children: [/* @__PURE__ */ p("p", {
|
|
4106
|
+
className: "text-text-primary text-xs",
|
|
4107
|
+
children: t.text
|
|
4108
|
+
}), /* @__PURE__ */ p("p", {
|
|
4109
|
+
className: "text-2xs text-text-tertiary mt-0.5",
|
|
4110
|
+
children: t.time
|
|
4111
|
+
})]
|
|
4112
|
+
})]
|
|
4113
|
+
}, t.id))
|
|
4114
|
+
});
|
|
4115
|
+
}
|
|
4116
|
+
//#endregion
|
|
4117
|
+
//#region src/components/ui/Toggle.tsx
|
|
4118
|
+
function wr({ checked: e, onChange: t, disabled: n, label: r, className: i }) {
|
|
4119
|
+
return /* @__PURE__ */ m("label", {
|
|
4120
|
+
className: I("flex w-fit items-center", n ? "cursor-not-allowed opacity-40" : "cursor-pointer", i),
|
|
4121
|
+
style: { gap: 10 },
|
|
4122
|
+
children: [/* @__PURE__ */ p("button", {
|
|
4123
|
+
type: "button",
|
|
4124
|
+
role: "switch",
|
|
4125
|
+
"aria-checked": e,
|
|
4126
|
+
disabled: n,
|
|
4127
|
+
onClick: () => t(!e),
|
|
4128
|
+
className: I("relative shrink-0 rounded-full border transition-colors duration-[100ms]", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2", e ? "bg-accent border-accent" : "bg-bg-tertiary border-border", !n && "cursor-pointer"),
|
|
4129
|
+
style: {
|
|
4130
|
+
width: 36,
|
|
4131
|
+
height: 20
|
|
4132
|
+
},
|
|
4133
|
+
children: /* @__PURE__ */ p("span", {
|
|
4134
|
+
className: "bg-control-knob absolute top-1/2 rounded-full transition-[left] duration-[100ms]",
|
|
4135
|
+
style: {
|
|
4136
|
+
width: 14,
|
|
4137
|
+
height: 14,
|
|
4138
|
+
marginTop: -7,
|
|
4139
|
+
left: e ? 19 : 3,
|
|
4140
|
+
boxShadow: "0 0 1px rgba(0,0,0,0.1), 2px 0 4px rgba(0,0,0,0.35)"
|
|
4141
|
+
}
|
|
4142
|
+
})
|
|
4143
|
+
}), r && /* @__PURE__ */ p("span", {
|
|
4144
|
+
className: "text-text-secondary text-xs",
|
|
4145
|
+
children: r
|
|
4146
|
+
})]
|
|
4147
|
+
});
|
|
4148
|
+
}
|
|
4149
|
+
//#endregion
|
|
4150
|
+
//#region src/components/ui/Tooltip.tsx
|
|
4151
|
+
var Tr = {
|
|
4152
|
+
top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
4153
|
+
bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
|
|
4154
|
+
left: "right-full top-1/2 -translate-y-1/2 mr-2",
|
|
4155
|
+
right: "left-full top-1/2 -translate-y-1/2 ml-2"
|
|
4156
|
+
};
|
|
4157
|
+
function Er({ content: e, placement: t = "top", children: n }) {
|
|
4158
|
+
let [r, i] = d(!1), a = s();
|
|
4159
|
+
return /* @__PURE__ */ m("div", {
|
|
4160
|
+
className: "relative inline-flex",
|
|
4161
|
+
onMouseEnter: () => i(!0),
|
|
4162
|
+
onMouseLeave: () => i(!1),
|
|
4163
|
+
onFocus: () => i(!0),
|
|
4164
|
+
onBlur: () => i(!1),
|
|
4165
|
+
"aria-describedby": r ? a : void 0,
|
|
4166
|
+
children: [n, r && /* @__PURE__ */ p("div", {
|
|
4167
|
+
id: a,
|
|
4168
|
+
className: I("text-2xs absolute z-50 px-2 py-1 font-medium whitespace-nowrap", "bg-bg-tertiary text-text-primary border-border rounded border shadow-md", "animate-fade-in pointer-events-none", Tr[t]),
|
|
4169
|
+
role: "tooltip",
|
|
4170
|
+
children: e
|
|
4171
|
+
})]
|
|
4172
|
+
});
|
|
4173
|
+
}
|
|
4174
|
+
//#endregion
|
|
4175
|
+
//#region src/components/ui/Toolbar.tsx
|
|
4176
|
+
function Dr({ start: e, end: t, children: n, className: r, startClassName: i, endClassName: a }) {
|
|
4177
|
+
return /* @__PURE__ */ m("div", {
|
|
4178
|
+
className: I("flex items-center justify-between gap-3", r),
|
|
4179
|
+
children: [/* @__PURE__ */ p("div", {
|
|
4180
|
+
className: I("flex flex-1 items-center gap-3", i),
|
|
4181
|
+
children: e ?? n
|
|
4182
|
+
}), t && /* @__PURE__ */ p("div", {
|
|
4183
|
+
className: I("flex items-center gap-1.5", a),
|
|
4184
|
+
children: t
|
|
4185
|
+
})]
|
|
4186
|
+
});
|
|
4187
|
+
}
|
|
4188
|
+
//#endregion
|
|
4189
|
+
//#region src/components/ui/ThemePreview.tsx
|
|
4190
|
+
function Or({ label: e, active: t, icon: n, preview: r, onClick: i, className: a }) {
|
|
4191
|
+
return /* @__PURE__ */ m("button", {
|
|
4192
|
+
type: "button",
|
|
4193
|
+
onClick: i,
|
|
4194
|
+
className: I("flex cursor-pointer flex-col items-center gap-2 rounded-md border p-3 transition-colors duration-[100ms]", t ? "border-accent bg-accent-muted" : "border-border bg-bg-secondary hover:bg-bg-hover hover:border-border-strong", a),
|
|
4195
|
+
children: [/* @__PURE__ */ p("div", {
|
|
4196
|
+
className: "border-border-strong/20 flex h-10 w-full items-center justify-center rounded border",
|
|
4197
|
+
style: { backgroundColor: r?.bg },
|
|
4198
|
+
children: /* @__PURE__ */ p("div", {
|
|
4199
|
+
className: "h-1.5 w-8 rounded-md",
|
|
4200
|
+
style: { backgroundColor: r?.fg }
|
|
4201
|
+
})
|
|
4202
|
+
}), /* @__PURE__ */ m("div", {
|
|
4203
|
+
className: "flex items-center gap-1.5",
|
|
4204
|
+
children: [n && /* @__PURE__ */ p(n, { className: "h-3 w-3" }), /* @__PURE__ */ p("span", {
|
|
4205
|
+
className: "text-xs font-medium",
|
|
4206
|
+
children: e
|
|
4207
|
+
})]
|
|
4208
|
+
})]
|
|
4209
|
+
});
|
|
4210
|
+
}
|
|
4211
|
+
//#endregion
|
|
4212
|
+
//#region src/components/ui/UploadDropzone.tsx
|
|
4213
|
+
function kr({ title: e = "Drag and drop files here, or click to browse", description: t, icon: n, accept: r, multiple: i, disabled: a, onChange: o, className: s }) {
|
|
4214
|
+
return /* @__PURE__ */ m("label", {
|
|
4215
|
+
className: I("border-border hover:border-border-strong block rounded-md border-2 border-dashed p-8 text-center transition-colors duration-[100ms]", a ? "cursor-not-allowed opacity-60" : "cursor-pointer hover:bg-bg-hover", s),
|
|
4216
|
+
children: [
|
|
4217
|
+
/* @__PURE__ */ p("input", {
|
|
4218
|
+
type: "file",
|
|
4219
|
+
accept: r,
|
|
4220
|
+
multiple: i,
|
|
4221
|
+
disabled: a,
|
|
4222
|
+
className: "sr-only",
|
|
4223
|
+
onChange: (e) => o?.(e.target.files, e)
|
|
4224
|
+
}),
|
|
4225
|
+
/* @__PURE__ */ p("div", {
|
|
4226
|
+
className: "text-text-tertiary mx-auto mb-3 flex h-9 w-9 items-center justify-center rounded-md bg-bg-tertiary",
|
|
4227
|
+
children: n ?? /* @__PURE__ */ p(pe, { className: "h-4.5 w-4.5" })
|
|
4228
|
+
}),
|
|
4229
|
+
/* @__PURE__ */ p("p", {
|
|
4230
|
+
className: "text-text-secondary mb-1 text-xs",
|
|
4231
|
+
children: e
|
|
4232
|
+
}),
|
|
4233
|
+
t && /* @__PURE__ */ p("p", {
|
|
4234
|
+
className: "text-2xs text-text-tertiary",
|
|
4235
|
+
children: t
|
|
4236
|
+
})
|
|
4237
|
+
]
|
|
4238
|
+
});
|
|
4239
|
+
}
|
|
4240
|
+
//#endregion
|
|
4241
|
+
//#region src/hooks/useApplyTheme.ts
|
|
4242
|
+
function Ar() {
|
|
4243
|
+
let { setPreferredDarkTheme: e, setPreferredLightTheme: t, setColorMode: n } = K();
|
|
4244
|
+
return i((r) => {
|
|
4245
|
+
V(r) ? (t(r), n("light")) : (e(r), n("dark"));
|
|
4246
|
+
}, [
|
|
4247
|
+
e,
|
|
4248
|
+
t,
|
|
4249
|
+
n
|
|
4250
|
+
]);
|
|
4251
|
+
}
|
|
4252
|
+
//#endregion
|
|
4253
|
+
//#region src/providers/ThemeContext.ts
|
|
4254
|
+
var jr = n({ theme: "dark" });
|
|
4255
|
+
//#endregion
|
|
4256
|
+
//#region src/hooks/useTheme.ts
|
|
4257
|
+
function Mr() {
|
|
4258
|
+
return a(jr);
|
|
4259
|
+
}
|
|
4260
|
+
//#endregion
|
|
4261
|
+
//#region src/lib/formatDate.ts
|
|
4262
|
+
var Nr = [
|
|
4263
|
+
"Jan",
|
|
4264
|
+
"Feb",
|
|
4265
|
+
"Mar",
|
|
4266
|
+
"Apr",
|
|
4267
|
+
"May",
|
|
4268
|
+
"Jun",
|
|
4269
|
+
"Jul",
|
|
4270
|
+
"Aug",
|
|
4271
|
+
"Sep",
|
|
4272
|
+
"Oct",
|
|
4273
|
+
"Nov",
|
|
4274
|
+
"Dec"
|
|
4275
|
+
];
|
|
4276
|
+
function Pr(e) {
|
|
4277
|
+
return (/* @__PURE__ */ new Date(e + "T00:00:00")).toLocaleDateString("en-US", {
|
|
4278
|
+
month: "short",
|
|
4279
|
+
day: "numeric",
|
|
4280
|
+
year: "numeric"
|
|
4281
|
+
});
|
|
4282
|
+
}
|
|
4283
|
+
function Fr(e) {
|
|
4284
|
+
return (/* @__PURE__ */ new Date(e + "T00:00:00")).toLocaleDateString("en-US", {
|
|
4285
|
+
month: "long",
|
|
4286
|
+
day: "numeric",
|
|
4287
|
+
year: "numeric"
|
|
4288
|
+
});
|
|
4289
|
+
}
|
|
4290
|
+
function Ir(e, t = /* @__PURE__ */ new Date()) {
|
|
4291
|
+
let n = t.getTime() - e.getTime(), r = Math.floor(n / 1e3);
|
|
4292
|
+
if (r < 60) return "just now";
|
|
4293
|
+
let i = Math.floor(r / 60);
|
|
4294
|
+
if (i < 60) return `${i}m ago`;
|
|
4295
|
+
let a = Math.floor(i / 60);
|
|
4296
|
+
if (a < 24) return `${a}h ago`;
|
|
4297
|
+
if (Math.floor(a / 24) === 1) return "yesterday";
|
|
4298
|
+
let o = `${Nr[e.getMonth()]} ${e.getDate()}`;
|
|
4299
|
+
return e.getFullYear() === t.getFullYear() ? o : `${o}, ${e.getFullYear()}`;
|
|
4300
|
+
}
|
|
4301
|
+
//#endregion
|
|
4302
|
+
//#region src/providers/SettingsProvider.tsx
|
|
4303
|
+
var Z = {
|
|
4304
|
+
"archivo-expanded": "\"Archivo\", \"Arial Black\", \"Avenir Next Condensed\", \"HelveticaNeue-CondensedBold\", system-ui, sans-serif",
|
|
4305
|
+
inter: "\"Inter\", system-ui, -apple-system, BlinkMacSystemFont, sans-serif",
|
|
4306
|
+
"jetbrains-mono": "\"JetBrains Mono\", Menlo, Monaco, Consolas, monospace",
|
|
4307
|
+
"pt-serif": "\"PT Serif\", Georgia, ui-serif, Cambria, \"Times New Roman\", Times, serif",
|
|
4308
|
+
system: "system-ui, -apple-system, BlinkMacSystemFont, sans-serif"
|
|
4309
|
+
}, Lr = {
|
|
4310
|
+
purple: {
|
|
4311
|
+
base: "#7C5CFC",
|
|
4312
|
+
hover: "#6B4AEB",
|
|
4313
|
+
active: "#5A39DA",
|
|
4314
|
+
muted: "rgba(124,92,252,0.15)",
|
|
4315
|
+
subtle: "rgba(124,92,252,0.08)"
|
|
4316
|
+
},
|
|
4317
|
+
blue: {
|
|
4318
|
+
base: "#3B82F6",
|
|
4319
|
+
hover: "#2563EB",
|
|
4320
|
+
active: "#1D4ED8",
|
|
4321
|
+
muted: "rgba(59,130,246,0.15)",
|
|
4322
|
+
subtle: "rgba(59,130,246,0.08)"
|
|
4323
|
+
},
|
|
4324
|
+
green: {
|
|
4325
|
+
base: "#22C55E",
|
|
4326
|
+
hover: "#16A34A",
|
|
4327
|
+
active: "#15803D",
|
|
4328
|
+
muted: "rgba(34,197,94,0.15)",
|
|
4329
|
+
subtle: "rgba(34,197,94,0.08)"
|
|
4330
|
+
},
|
|
4331
|
+
teal: {
|
|
4332
|
+
base: "#14B8A6",
|
|
4333
|
+
hover: "#0D9488",
|
|
4334
|
+
active: "#0F766E",
|
|
4335
|
+
muted: "rgba(20,184,166,0.15)",
|
|
4336
|
+
subtle: "rgba(20,184,166,0.08)"
|
|
4337
|
+
},
|
|
4338
|
+
orange: {
|
|
4339
|
+
base: "#F97316",
|
|
4340
|
+
hover: "#EA580C",
|
|
4341
|
+
active: "#C2410C",
|
|
4342
|
+
muted: "rgba(249,115,22,0.15)",
|
|
4343
|
+
subtle: "rgba(249,115,22,0.08)"
|
|
4344
|
+
},
|
|
4345
|
+
red: {
|
|
4346
|
+
base: "#EF4444",
|
|
4347
|
+
hover: "#DC2626",
|
|
4348
|
+
active: "#B91C1C",
|
|
4349
|
+
muted: "rgba(239,68,68,0.15)",
|
|
4350
|
+
subtle: "rgba(239,68,68,0.08)"
|
|
4351
|
+
},
|
|
4352
|
+
pink: {
|
|
4353
|
+
base: "#EC4899",
|
|
4354
|
+
hover: "#DB2777",
|
|
4355
|
+
active: "#BE185D",
|
|
4356
|
+
muted: "rgba(236,72,153,0.15)",
|
|
4357
|
+
subtle: "rgba(236,72,153,0.08)"
|
|
4358
|
+
},
|
|
4359
|
+
indigo: {
|
|
4360
|
+
base: "#6366F1",
|
|
4361
|
+
hover: "#4F46E5",
|
|
4362
|
+
active: "#4338CA",
|
|
4363
|
+
muted: "rgba(99,102,241,0.15)",
|
|
4364
|
+
subtle: "rgba(99,102,241,0.08)"
|
|
4365
|
+
}
|
|
4366
|
+
}, Rr = "leonardaustin-ui-settings", zr = new Set(Object.keys(Lr)), Br = new Set(Object.keys(U)), Q = new Set(Object.keys(Z)), Vr = new Set([
|
|
4367
|
+
"light",
|
|
4368
|
+
"dark",
|
|
4369
|
+
"system"
|
|
4370
|
+
]);
|
|
4371
|
+
function $(e, t, n, r) {
|
|
4372
|
+
return typeof e != "number" || !isFinite(e) ? r : Math.min(n, Math.max(t, e));
|
|
4373
|
+
}
|
|
4374
|
+
function Hr(e) {
|
|
4375
|
+
let t = {};
|
|
4376
|
+
if (zr.has(e.accentColor) && (t.accentColor = e.accentColor), Vr.has(e.colorMode) && (t.colorMode = e.colorMode), Br.has(e.preferredDarkTheme) && !V(e.preferredDarkTheme) && (t.preferredDarkTheme = e.preferredDarkTheme), Br.has(e.preferredLightTheme) && V(e.preferredLightTheme) && (t.preferredLightTheme = e.preferredLightTheme), typeof e.sidebarCollapsed == "boolean" && (t.sidebarCollapsed = e.sidebarCollapsed), typeof e.reducedMotion == "boolean" && (t.reducedMotion = e.reducedMotion), typeof e.sidebarWidth == "number" && (t.sidebarWidth = $(e.sidebarWidth, 160, 400, 220)), e.themeOverrides && typeof e.themeOverrides == "object") {
|
|
4377
|
+
let n = {};
|
|
4378
|
+
for (let [t, r] of Object.entries(e.themeOverrides)) {
|
|
4379
|
+
if (!Br.has(t) || !r || typeof r != "object") continue;
|
|
4380
|
+
let e = r, i = U[t];
|
|
4381
|
+
n[t] = {
|
|
4382
|
+
uiFont: Q.has(e.uiFont) ? e.uiFont : i.uiFont,
|
|
4383
|
+
headingFont: Q.has(e.headingFont) ? e.headingFont : i.headingFont,
|
|
4384
|
+
proseFont: Q.has(e.proseFont) ? e.proseFont : i.proseFont,
|
|
4385
|
+
controlFont: Q.has(e.controlFont) ? e.controlFont : i.controlFont,
|
|
4386
|
+
labelFont: Q.has(e.labelFont) ? e.labelFont : i.labelFont,
|
|
4387
|
+
navigationFont: Q.has(e.navigationFont) ? e.navigationFont : i.navigationFont,
|
|
4388
|
+
dataFont: Q.has(e.dataFont) ? e.dataFont : i.dataFont,
|
|
4389
|
+
codeFont: Q.has(e.codeFont) ? e.codeFont : i.codeFont,
|
|
4390
|
+
fontSize: $(e.fontSize, 11, 18, i.fontSize),
|
|
4391
|
+
borderRadius: $(e.borderRadius, 0, 16, i.borderRadius),
|
|
4392
|
+
borderWidth: $(e.borderWidth, 1, 3, i.borderWidth),
|
|
4393
|
+
tracking: $(e.tracking, 0, .3, i.tracking),
|
|
4394
|
+
lineHeight: $(e.lineHeight, 1.2, 2, i.lineHeight),
|
|
4395
|
+
density: $(e.density, .18, .32, i.density)
|
|
4396
|
+
};
|
|
4397
|
+
}
|
|
4398
|
+
t.themeOverrides = n;
|
|
4399
|
+
}
|
|
4400
|
+
return t;
|
|
4401
|
+
}
|
|
4402
|
+
var Ur = {
|
|
4403
|
+
accentColor: "purple",
|
|
4404
|
+
sidebarCollapsed: !1,
|
|
4405
|
+
sidebarWidth: 220,
|
|
4406
|
+
reducedMotion: !1,
|
|
4407
|
+
colorMode: "dark",
|
|
4408
|
+
preferredDarkTheme: "dark",
|
|
4409
|
+
preferredLightTheme: "light",
|
|
4410
|
+
themeOverrides: {}
|
|
4411
|
+
};
|
|
4412
|
+
function Wr(e) {
|
|
4413
|
+
if (typeof localStorage > "u") return Ur;
|
|
4414
|
+
try {
|
|
4415
|
+
let t = localStorage.getItem(e);
|
|
4416
|
+
if (t) return {
|
|
4417
|
+
...Ur,
|
|
4418
|
+
...Hr(JSON.parse(t))
|
|
4419
|
+
};
|
|
4420
|
+
} catch (e) {
|
|
4421
|
+
console.warn("[SettingsProvider] Failed to load settings:", e);
|
|
4422
|
+
}
|
|
4423
|
+
return Ur;
|
|
4424
|
+
}
|
|
4425
|
+
function Gr(e, t) {
|
|
4426
|
+
let n = U[e] ?? U.dark;
|
|
4427
|
+
return t[e] ? {
|
|
4428
|
+
...n,
|
|
4429
|
+
...t[e]
|
|
4430
|
+
} : n;
|
|
4431
|
+
}
|
|
4432
|
+
function Kr(e, t) {
|
|
4433
|
+
return e.uiFont === t.uiFont && e.headingFont === t.headingFont && e.proseFont === t.proseFont && e.controlFont === t.controlFont && e.labelFont === t.labelFont && e.navigationFont === t.navigationFont && e.dataFont === t.dataFont && e.codeFont === t.codeFont && e.fontSize === t.fontSize && e.borderRadius === t.borderRadius && e.borderWidth === t.borderWidth && e.tracking === t.tracking && e.lineHeight === t.lineHeight && e.density === t.density;
|
|
4434
|
+
}
|
|
4435
|
+
function qr({ children: e, storageKey: t = Rr }) {
|
|
4436
|
+
let [n, r] = d(() => Wr(t)), [a, s] = d(() => typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
4437
|
+
o(() => {
|
|
4438
|
+
if (typeof window > "u") return;
|
|
4439
|
+
let e = window.matchMedia("(prefers-color-scheme: dark)"), t = (e) => s(e.matches);
|
|
4440
|
+
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
4441
|
+
}, []);
|
|
4442
|
+
let c = l(() => n.colorMode === "light" ? n.preferredLightTheme : n.colorMode === "dark" || a ? n.preferredDarkTheme : n.preferredLightTheme, [
|
|
4443
|
+
n.colorMode,
|
|
4444
|
+
n.preferredDarkTheme,
|
|
4445
|
+
n.preferredLightTheme,
|
|
4446
|
+
a
|
|
4447
|
+
]), [u, f] = d(() => Gr(c, n.themeOverrides));
|
|
4448
|
+
o(() => {
|
|
4449
|
+
f(Gr(c, n.themeOverrides));
|
|
4450
|
+
}, [c]);
|
|
4451
|
+
let m = i((e) => {
|
|
4452
|
+
r((n) => {
|
|
4453
|
+
let r = {
|
|
4454
|
+
...n,
|
|
4455
|
+
...e
|
|
4456
|
+
};
|
|
4457
|
+
try {
|
|
4458
|
+
localStorage.setItem(t, JSON.stringify(r));
|
|
4459
|
+
} catch (e) {
|
|
4460
|
+
console.warn("[SettingsProvider] Failed to persist settings:", e);
|
|
4461
|
+
}
|
|
4462
|
+
return r;
|
|
4463
|
+
});
|
|
4464
|
+
}, [t]);
|
|
4465
|
+
o(() => {
|
|
4466
|
+
let e = document.documentElement, t = Lr[n.accentColor];
|
|
4467
|
+
e.style.setProperty("--accent", t.base), e.style.setProperty("--accent-hover", t.hover), e.style.setProperty("--accent-active", t.active), e.style.setProperty("--accent-muted", t.muted), e.style.setProperty("--accent-subtle", t.subtle);
|
|
4468
|
+
}, [n.accentColor]), o(() => {
|
|
4469
|
+
document.documentElement.classList.toggle("reduced-motion", n.reducedMotion);
|
|
4470
|
+
}, [n.reducedMotion]), o(() => {
|
|
4471
|
+
let e = document.documentElement, t = u.borderRadius;
|
|
4472
|
+
e.style.fontSize = `${u.fontSize / 13 * 100}%`, e.style.setProperty("--font-ui", Z[u.uiFont]), e.style.setProperty("--font-heading", Z[u.headingFont]), e.style.setProperty("--font-prose", Z[u.proseFont]), e.style.setProperty("--font-control", Z[u.controlFont]), e.style.setProperty("--font-label", Z[u.labelFont]), e.style.setProperty("--font-navigation", Z[u.navigationFont]), e.style.setProperty("--font-data", Z[u.dataFont]), e.style.setProperty("--font-code", Z[u.codeFont]), e.style.setProperty("--ui-radius", t === 0 ? "0" : `${Math.round(t * 2 / 3)}px`), e.style.setProperty("--ui-radius-md", t === 0 ? "0" : `${t}px`), e.style.setProperty("--ui-radius-lg", t === 0 ? "0" : `${Math.round(t * 4 / 3)}px`), e.style.setProperty("--ui-radius-xl", t === 0 ? "0" : `${t * 2}px`), e.style.setProperty("--ui-border-width", `${u.borderWidth}px`), e.style.setProperty("--ui-tracking", `${u.tracking}em`), e.style.setProperty("--ui-line-height", String(u.lineHeight)), e.style.setProperty("--ui-density", `${u.density}rem`);
|
|
4473
|
+
}, [u]);
|
|
4474
|
+
let h = l(() => Gr(c, n.themeOverrides), [c, n.themeOverrides]), g = c in n.themeOverrides, _ = !Kr(u, h), v = i(() => {
|
|
4475
|
+
m({ themeOverrides: {
|
|
4476
|
+
...n.themeOverrides,
|
|
4477
|
+
[c]: { ...u }
|
|
4478
|
+
} });
|
|
4479
|
+
}, [
|
|
4480
|
+
m,
|
|
4481
|
+
n.themeOverrides,
|
|
4482
|
+
c,
|
|
4483
|
+
u
|
|
4484
|
+
]), y = i(() => {
|
|
4485
|
+
let e = { ...n.themeOverrides };
|
|
4486
|
+
delete e[c], m({ themeOverrides: e }), f(U[c] ?? U.dark);
|
|
4487
|
+
}, [
|
|
4488
|
+
m,
|
|
4489
|
+
n.themeOverrides,
|
|
4490
|
+
c
|
|
4491
|
+
]), b = l(() => ({
|
|
4492
|
+
fontSize: u.fontSize,
|
|
4493
|
+
setFontSize: (e) => f((t) => ({
|
|
4494
|
+
...t,
|
|
4495
|
+
fontSize: e
|
|
4496
|
+
})),
|
|
4497
|
+
accentColor: n.accentColor,
|
|
4498
|
+
setAccentColor: (e) => m({ accentColor: e }),
|
|
4499
|
+
sidebarCollapsed: n.sidebarCollapsed,
|
|
4500
|
+
setSidebarCollapsed: (e) => m({ sidebarCollapsed: e }),
|
|
4501
|
+
sidebarWidth: n.sidebarWidth,
|
|
4502
|
+
setSidebarWidth: (e) => m({ sidebarWidth: e }),
|
|
4503
|
+
reducedMotion: n.reducedMotion,
|
|
4504
|
+
setReducedMotion: (e) => m({ reducedMotion: e }),
|
|
4505
|
+
colorMode: n.colorMode,
|
|
4506
|
+
setColorMode: (e) => m({ colorMode: e }),
|
|
4507
|
+
preferredDarkTheme: n.preferredDarkTheme,
|
|
4508
|
+
setPreferredDarkTheme: (e) => m({ preferredDarkTheme: e }),
|
|
4509
|
+
preferredLightTheme: n.preferredLightTheme,
|
|
4510
|
+
setPreferredLightTheme: (e) => m({ preferredLightTheme: e }),
|
|
4511
|
+
resolvedTheme: c,
|
|
4512
|
+
uiFont: u.uiFont,
|
|
4513
|
+
headingFont: u.headingFont,
|
|
4514
|
+
proseFont: u.proseFont,
|
|
4515
|
+
controlFont: u.controlFont,
|
|
4516
|
+
labelFont: u.labelFont,
|
|
4517
|
+
navigationFont: u.navigationFont,
|
|
4518
|
+
dataFont: u.dataFont,
|
|
4519
|
+
codeFont: u.codeFont,
|
|
4520
|
+
borderRadius: u.borderRadius,
|
|
4521
|
+
borderWidth: u.borderWidth,
|
|
4522
|
+
tracking: u.tracking,
|
|
4523
|
+
lineHeight: u.lineHeight,
|
|
4524
|
+
density: u.density,
|
|
4525
|
+
setUiFont: (e) => f((t) => ({
|
|
4526
|
+
...t,
|
|
4527
|
+
uiFont: e
|
|
4528
|
+
})),
|
|
4529
|
+
setHeadingFont: (e) => f((t) => ({
|
|
4530
|
+
...t,
|
|
4531
|
+
headingFont: e
|
|
4532
|
+
})),
|
|
4533
|
+
setProseFont: (e) => f((t) => ({
|
|
4534
|
+
...t,
|
|
4535
|
+
proseFont: e
|
|
4536
|
+
})),
|
|
4537
|
+
setControlFont: (e) => f((t) => ({
|
|
4538
|
+
...t,
|
|
4539
|
+
controlFont: e
|
|
4540
|
+
})),
|
|
4541
|
+
setLabelFont: (e) => f((t) => ({
|
|
4542
|
+
...t,
|
|
4543
|
+
labelFont: e
|
|
4544
|
+
})),
|
|
4545
|
+
setNavigationFont: (e) => f((t) => ({
|
|
4546
|
+
...t,
|
|
4547
|
+
navigationFont: e
|
|
4548
|
+
})),
|
|
4549
|
+
setDataFont: (e) => f((t) => ({
|
|
4550
|
+
...t,
|
|
4551
|
+
dataFont: e
|
|
4552
|
+
})),
|
|
4553
|
+
setCodeFont: (e) => f((t) => ({
|
|
4554
|
+
...t,
|
|
4555
|
+
codeFont: e
|
|
4556
|
+
})),
|
|
4557
|
+
setBorderRadius: (e) => f((t) => ({
|
|
4558
|
+
...t,
|
|
4559
|
+
borderRadius: e
|
|
4560
|
+
})),
|
|
4561
|
+
setBorderWidth: (e) => f((t) => ({
|
|
4562
|
+
...t,
|
|
4563
|
+
borderWidth: e
|
|
4564
|
+
})),
|
|
4565
|
+
setTracking: (e) => f((t) => ({
|
|
4566
|
+
...t,
|
|
4567
|
+
tracking: e
|
|
4568
|
+
})),
|
|
4569
|
+
setLineHeight: (e) => f((t) => ({
|
|
4570
|
+
...t,
|
|
4571
|
+
lineHeight: e
|
|
4572
|
+
})),
|
|
4573
|
+
setDensity: (e) => f((t) => ({
|
|
4574
|
+
...t,
|
|
4575
|
+
density: e
|
|
4576
|
+
})),
|
|
4577
|
+
saveThemeCustomization: v,
|
|
4578
|
+
resetThemeCustomization: y,
|
|
4579
|
+
hasThemeOverrides: g,
|
|
4580
|
+
isCustomized: _
|
|
4581
|
+
}), [
|
|
4582
|
+
n,
|
|
4583
|
+
m,
|
|
4584
|
+
u,
|
|
4585
|
+
c,
|
|
4586
|
+
v,
|
|
4587
|
+
y,
|
|
4588
|
+
g,
|
|
4589
|
+
_
|
|
4590
|
+
]);
|
|
4591
|
+
return /* @__PURE__ */ p(G.Provider, {
|
|
4592
|
+
value: b,
|
|
4593
|
+
children: e
|
|
4594
|
+
});
|
|
4595
|
+
}
|
|
4596
|
+
//#endregion
|
|
4597
|
+
//#region src/providers/ThemeProvider.tsx
|
|
4598
|
+
var Jr = {
|
|
4599
|
+
dark: "",
|
|
4600
|
+
light: "theme-light",
|
|
4601
|
+
monokai: "theme-monokai",
|
|
4602
|
+
solarized: "theme-solarized",
|
|
4603
|
+
cyberBrutalDark: "theme-cyber-brutal-dark",
|
|
4604
|
+
cyberBrutalLight: "theme-cyber-brutal-light",
|
|
4605
|
+
hashiTheme: "theme-hashi"
|
|
4606
|
+
};
|
|
4607
|
+
function Yr({ children: e }) {
|
|
4608
|
+
let { resolvedTheme: t } = a(G);
|
|
4609
|
+
return o(() => {
|
|
4610
|
+
let e = document.documentElement;
|
|
4611
|
+
Object.values(Jr).forEach((t) => {
|
|
4612
|
+
t && e.classList.remove(t);
|
|
4613
|
+
});
|
|
4614
|
+
let n = Jr[t];
|
|
4615
|
+
n && e.classList.add(n);
|
|
4616
|
+
}, [t]), /* @__PURE__ */ p(jr.Provider, {
|
|
4617
|
+
value: { theme: t },
|
|
4618
|
+
children: e
|
|
4619
|
+
});
|
|
4620
|
+
}
|
|
4621
|
+
//#endregion
|
|
4622
|
+
export { Zt as Alert, Vt as AppShell, _e as AreaChart, Qt as AuthCard, Ht as AuthLayout, $t as AuthorByline, q as Avatar, Ut as BackLink, nn as Badge, ye as BarChart, $e as BottomNav, It as Breadcrumbs, J as Button, tt as COMMAND_PALETTE_EVENT, X as CalendarGrid, hn as Card, Wt as Checkbox, Kt as ColumnPicker, gn as Combobox, ot as CommandPalette, nt as DEFAULT_COMMAND_PALETTE_SHORTCUT, _n as DangerZone, bn as DatePicker, wn as DateRangePicker, An as DateTimePicker, Pn as DetailPanel, Fn as Dialog, In as DialogActions, Ln as DividerLabel, Ue as DonutChart, Rn as DropdownMenu, zn as EmptyState, Bn as ErrorBoundary, Gt as FilterButton, Vn as FilterDropdown, Hn as Kbd, Wn as LoadingSpinner, Gn as MetadataGrid, Kn as MetricCard, ct as MobileDrawer, Zn as OAuthButton, Qn as PageHeader, $n as PageSection, qt as Pagination, nr as PaginationBar, rr as PasswordInput, ir as ProfileHeader, ar as ProseContent, Ge as RadarChart, qe as RadialBarChart, or as RadioPill, Yt as ResourceTable, sr as SearchInput, cr as SectionHeader, lr as Select, er as SelectDropdown, ur as SettingRow, G as SettingsContext, qr as SettingsProvider, fr as SideSheet, Pt as Sidebar, dr as Slider, Je as SparkLine, hr as SplitPaneLayout, vr as StatusDot, yr as StepProgress, br as Tabs, Sr as TextInput, xr as Textarea, jr as ThemeContext, Or as ThemePreview, Yr as ThemeProvider, Cr as Timeline, xt as ToastProvider, wr as Toggle, Dr as Toolbar, Er as Tooltip, Bt as TopBar, kr as UploadDropzone, Ze as VerticalBarChart, ht as accentItems, I as cn, ft as darkThemes, mt as fontOptions, Fr as formatDateLong, Pr as formatDateShort, Ir as formatRelative, z as handleAppShellNavigate, R as isAppShellPathActive, V as isLightTheme, dt as lightThemes, it as matchesCommandPaletteShortcut, Qe as navigateToPath, rt as openCommandPalette, Jt as sortRows, U as themeDefaults, lt as themeItems, Ar as useApplyTheme, W as useDismiss, B as useFocusTrap, K as useSettings, Mr as useTheme, bt as useToast };
|