@memobit/libs 3.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/Accordion.css +1 -0
- package/dist/components/Accordion/Accordion2.js +79 -0
- package/dist/components/AlertDialog/AlertDialog.css +1 -0
- package/dist/components/AlertDialog/AlertDialog2.js +26 -0
- package/dist/components/AnalogClock/AnalogClock.css +1 -0
- package/dist/components/AnalogClock/AnalogClock2.js +293 -0
- package/dist/components/AngleSlider/AngleSlider.css +1 -0
- package/dist/components/AngleSlider/AngleSlider2.js +135 -0
- package/dist/components/AppHeader/AppHeader.css +1 -0
- package/dist/components/AppHeader/AppHeader2.js +44 -0
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal.css +1 -0
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal2.js +138 -0
- package/dist/components/Auth/Login/Login.css +1 -0
- package/dist/components/Auth/Login/Login2.js +155 -0
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal.css +1 -0
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +327 -0
- package/dist/components/AvatarInitials/AvatarInitials.css +1 -0
- package/dist/components/AvatarInitials/AvatarInitials2.js +73 -0
- package/dist/components/BMI/BMI.css +1 -0
- package/dist/components/BMI/BMI2.js +53 -0
- package/dist/components/BMI/bmiUtils.js +265 -0
- package/dist/components/Badge/Badge.css +1 -0
- package/dist/components/Badge/Badge2.js +30 -0
- package/dist/components/Banner/Banner.css +1 -0
- package/dist/components/Banner/Banner2.js +57 -0
- package/dist/components/Blockquote/Blockquote.css +1 -0
- package/dist/components/Blockquote/Blockquote2.js +55 -0
- package/dist/components/Breadcrumb/Breadcrumb.css +1 -0
- package/dist/components/Breadcrumb/Breadcrumb2.js +36 -0
- package/dist/components/BulkActionBar/BulkActionBar.css +1 -0
- package/dist/components/BulkActionBar/BulkActionBar2.js +39 -0
- package/dist/components/Button/Button.css +1 -0
- package/dist/components/Button/Button2.js +32 -0
- package/dist/components/Calendar/Calendar.css +1 -0
- package/dist/components/Calendar/Calendar2.js +279 -0
- package/dist/components/CalendarHeatmap/CalendarHeatmap.css +1 -0
- package/dist/components/CalendarHeatmap/CalendarHeatmap2.js +91 -0
- package/dist/components/Card/Card.css +1 -0
- package/dist/components/Card/Card2.js +47 -0
- package/dist/components/Checkbox/Checkbox.css +1 -0
- package/dist/components/Checkbox/Checkbox2.js +35 -0
- package/dist/components/Chip/Chip.css +1 -0
- package/dist/components/Chip/Chip2.js +31 -0
- package/dist/components/CollapsibleSection/CollapsibleSection.css +1 -0
- package/dist/components/CollapsibleSection/CollapsibleSection2.js +68 -0
- package/dist/components/ColorPicker/ColorPicker.css +1 -0
- package/dist/components/ColorPicker/ColorPicker2.js +257 -0
- package/dist/components/CommandPalette/CommandPalette.css +1 -0
- package/dist/components/CommandPalette/CommandPalette2.js +97 -0
- package/dist/components/Confetti/Confetti.css +1 -0
- package/dist/components/Confetti/Confetti2.js +175 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.css +1 -0
- package/dist/components/ConfirmDialog/ConfirmDialog2.js +37 -0
- package/dist/components/ConfirmPopover/ConfirmPopover.css +1 -0
- package/dist/components/ConfirmPopover/ConfirmPopover2.js +55 -0
- package/dist/components/ContextMenu/ContextMenu.css +1 -0
- package/dist/components/ContextMenu/ContextMenu2.js +53 -0
- package/dist/components/ContextToast/ContextToast.css +1 -0
- package/dist/components/ContextToast/ContextToast2.js +96 -0
- package/dist/components/ControlPanel/ControlPanel.css +1 -0
- package/dist/components/ControlPanel/ControlPanel.types.js +21 -0
- package/dist/components/ControlPanel/ControlPanel2.js +137 -0
- package/dist/components/ControlPanel/ControlPanelContext.js +31 -0
- package/dist/components/ControlPanel/ControlPanelFilter.js +386 -0
- package/dist/components/ControlPanel/ControlPanelNav.js +74 -0
- package/dist/components/ControlPanel/ControlPanelOptions.js +197 -0
- package/dist/components/CopyButton/CopyButton.css +1 -0
- package/dist/components/CopyButton/CopyButton2.js +48 -0
- package/dist/components/CountryWithFlag/CountryWithFlag.css +1 -0
- package/dist/components/CountryWithFlag/CountryWithFlag2.js +21 -0
- package/dist/components/DataView/DataView.CardView.js +189 -0
- package/dist/components/DataView/DataView.ColumnSelector.js +51 -0
- package/dist/components/DataView/DataView.MiniSort.js +25 -0
- package/dist/components/DataView/DataView.css +1 -0
- package/dist/components/DataView/DataView2.js +433 -0
- package/dist/components/DatePicker/DatePicker.css +1 -0
- package/dist/components/DatePicker/DatePicker2.js +151 -0
- package/dist/components/DateRangePicker/DateRangePicker.css +1 -0
- package/dist/components/DateRangePicker/DateRangePicker2.js +223 -0
- package/dist/components/DayAgenda/DayAgenda.css +1 -0
- package/dist/components/DayAgenda/DayAgenda2.js +120 -0
- package/dist/components/DiffViewer/DiffViewer.css +1 -0
- package/dist/components/DiffViewer/DiffViewer2.js +270 -0
- package/dist/components/Drawer/Drawer.css +1 -0
- package/dist/components/Drawer/Drawer2.js +119 -0
- package/dist/components/Dropdown/Dropdown.css +1 -0
- package/dist/components/Dropdown/Dropdown2.js +413 -0
- package/dist/components/EmojiPicker/EmojiPicker.css +1 -0
- package/dist/components/EmojiPicker/EmojiPicker2.js +789 -0
- package/dist/components/EmojiPicker/emojiKeywords/activities.js +508 -0
- package/dist/components/EmojiPicker/emojiKeywords/animals.js +501 -0
- package/dist/components/EmojiPicker/emojiKeywords/food.js +540 -0
- package/dist/components/EmojiPicker/emojiKeywords/index.js +21 -0
- package/dist/components/EmojiPicker/emojiKeywords/objects.js +652 -0
- package/dist/components/EmojiPicker/emojiKeywords/people.js +488 -0
- package/dist/components/EmojiPicker/emojiKeywords/smileys.js +538 -0
- package/dist/components/EmojiPicker/emojiKeywords/symbols.js +597 -0
- package/dist/components/EmojiPicker/emojiKeywords/travel.js +507 -0
- package/dist/components/EmptyState/EmptyState.css +1 -0
- package/dist/components/EmptyState/EmptyState2.js +47 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.css +1 -0
- package/dist/components/ErrorBoundary/ErrorBoundary2.js +37 -0
- package/dist/components/EventCalendar/EventCalendar.Chip.js +45 -0
- package/dist/components/EventCalendar/EventCalendar.Month.js +118 -0
- package/dist/components/EventCalendar/EventCalendar.Week.js +131 -0
- package/dist/components/EventCalendar/EventCalendar.css +1 -0
- package/dist/components/EventCalendar/EventCalendar.helpers.js +72 -0
- package/dist/components/EventCalendar/EventCalendar2.js +157 -0
- package/dist/components/FileDropzone/FileDropzone.css +1 -0
- package/dist/components/FileDropzone/FileDropzone2.js +71 -0
- package/dist/components/Flag/Flag.css +1 -0
- package/dist/components/Flag/Flag2.js +36 -0
- package/dist/components/FloatButton/FloatButton.css +1 -0
- package/dist/components/FloatButton/FloatButton2.js +68 -0
- package/dist/components/FloatingWindow/FloatingWindow.css +1 -0
- package/dist/components/FloatingWindow/FloatingWindow2.js +203 -0
- package/dist/components/FolderBrowserModal/FolderBrowserModal.css +1 -0
- package/dist/components/FolderBrowserModal/FolderBrowserModal2.js +144 -0
- package/dist/components/Grid/Col.js +17 -0
- package/dist/components/Grid/Grid.css +1 -0
- package/dist/components/Grid/Grid2.js +28 -0
- package/dist/components/Icon/Icon.css +1 -0
- package/dist/components/Icon/Icon2.js +23 -0
- package/dist/components/IconPicker/IconPicker.css +1 -0
- package/dist/components/IconPicker/IconPicker2.js +51 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.css +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll2.js +66 -0
- package/dist/components/InputDate/InputDate.css +1 -0
- package/dist/components/InputDate/InputDate2.js +87 -0
- package/dist/components/InputEmail/InputEmail.css +1 -0
- package/dist/components/InputEmail/InputEmail2.js +73 -0
- package/dist/components/InputFile/InputFile.css +1 -0
- package/dist/components/InputFile/InputFile2.js +41 -0
- package/dist/components/InputMask/InputMask.css +1 -0
- package/dist/components/InputMask/InputMask2.js +163 -0
- package/dist/components/InputNumber/InputNumber.css +1 -0
- package/dist/components/InputNumber/InputNumber2.js +60 -0
- package/dist/components/InputPIN/InputPIN.css +1 -0
- package/dist/components/InputPIN/InputPIN2.js +121 -0
- package/dist/components/InputPassword/InputPassword.css +1 -0
- package/dist/components/InputPassword/InputPassword2.js +47 -0
- package/dist/components/InputPhone/InputPhone.css +1 -0
- package/dist/components/InputPhone/InputPhone2.js +82 -0
- package/dist/components/InputSearch/InputSearch.css +1 -0
- package/dist/components/InputSearch/InputSearch2.js +53 -0
- package/dist/components/InputText/InputText.css +1 -0
- package/dist/components/InputText/InputText2.js +47 -0
- package/dist/components/InputTextarea/InputTextarea.css +1 -0
- package/dist/components/InputTextarea/InputTextarea2.js +46 -0
- package/dist/components/InputTime/InputTime.css +1 -0
- package/dist/components/InputTime/InputTime2.js +85 -0
- package/dist/components/InputUrl/InputUrl.css +1 -0
- package/dist/components/InputUrl/InputUrl2.js +65 -0
- package/dist/components/JourneyWizard/JourneyWizard.css +1 -0
- package/dist/components/JourneyWizard/JourneyWizard2.js +147 -0
- package/dist/components/List/List.css +1 -0
- package/dist/components/List/List2.js +28 -0
- package/dist/components/Loading/Loading.css +1 -0
- package/dist/components/Loading/Loading2.js +11 -0
- package/dist/components/MenuHamburger/MenuHamburger.css +1 -0
- package/dist/components/MenuHamburger/MenuHamburger2.js +65 -0
- package/dist/components/MiniSort/MiniSort.css +1 -0
- package/dist/components/MiniSort/MiniSort2.js +52 -0
- package/dist/components/MiniStatsCard/MiniStatsCard.css +1 -0
- package/dist/components/MiniStatsCard/MiniStatsCard2.js +67 -0
- package/dist/components/Minimap/Minimap.css +1 -0
- package/dist/components/Minimap/Minimap2.js +62 -0
- package/dist/components/Modal/Modal.css +1 -0
- package/dist/components/Modal/Modal2.js +87 -0
- package/dist/components/NavBar/NavBar.css +1 -0
- package/dist/components/NavBar/NavBar2.js +64 -0
- package/dist/components/NotificationPanel/NotificationPanel.css +1 -0
- package/dist/components/NotificationPanel/NotificationPanel2.js +66 -0
- package/dist/components/Pagination/Pagination.css +1 -0
- package/dist/components/Pagination/Pagination2.js +92 -0
- package/dist/components/PieChart/PieChart.css +1 -0
- package/dist/components/PieChart/PieChart2.js +142 -0
- package/dist/components/Popover/Popover.css +1 -0
- package/dist/components/Popover/Popover2.js +109 -0
- package/dist/components/Popover/hooks/Popover.hook.js +33 -0
- package/dist/components/ProgressBar/ProgressBar.css +1 -0
- package/dist/components/ProgressBar/ProgressBar2.js +48 -0
- package/dist/components/ProgressRing/ProgressRing.css +1 -0
- package/dist/components/ProgressRing/ProgressRing2.js +54 -0
- package/dist/components/QuantitySelector/QuantitySelector.css +1 -0
- package/dist/components/QuantitySelector/QuantitySelector2.js +94 -0
- package/dist/components/QuickAdd/QuickAdd.css +1 -0
- package/dist/components/QuickAdd/QuickAdd2.js +56 -0
- package/dist/components/QuickNumberUpdate/QuickNumberUpdate.css +1 -0
- package/dist/components/QuickNumberUpdate/QuickNumberUpdate2.js +52 -0
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate.css +1 -0
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate2.js +67 -0
- package/dist/components/Radio/Radio.css +1 -0
- package/dist/components/Radio/Radio2.js +36 -0
- package/dist/components/RangeSlider/RangeSlider.css +1 -0
- package/dist/components/RangeSlider/RangeSlider2.js +157 -0
- package/dist/components/Rating/Rating.css +1 -0
- package/dist/components/Rating/Rating2.js +148 -0
- package/dist/components/Rating/RatingIcon.js +102 -0
- package/dist/components/RichTextEditor/RichTextEditor.css +1 -0
- package/dist/components/RichTextEditor/RichTextEditor2.js +212 -0
- package/dist/components/RichTextEditor/RteLinkPrompt.js +42 -0
- package/dist/components/RichTextEditor/RteTableToolbar.js +95 -0
- package/dist/components/RichTextEditor/RteToolbar.js +106 -0
- package/dist/components/RichTextEditor/helpers.js +73 -0
- package/dist/components/RichTextEditor/hooks/useEditorHistory.js +39 -0
- package/dist/components/RichTextEditor/hooks/useLinkPrompt.js +61 -0
- package/dist/components/RichTextEditor/hooks/useTableOps.js +134 -0
- package/dist/components/RollingNumber/RollingNumber.css +1 -0
- package/dist/components/RollingNumber/RollingNumber2.js +71 -0
- package/dist/components/ScrollToTop/ScrollToTop.css +1 -0
- package/dist/components/ScrollToTop/ScrollToTop2.js +40 -0
- package/dist/components/Separator/Separator.css +1 -0
- package/dist/components/Separator/Separator2.js +39 -0
- package/dist/components/Sidebar/Sidebar.css +1 -0
- package/dist/components/Sidebar/Sidebar2.js +115 -0
- package/dist/components/Sidebar/SidebarContext.js +31 -0
- package/dist/components/SignalStrength/SignalStrength.css +1 -0
- package/dist/components/SignalStrength/SignalStrength2.js +56 -0
- package/dist/components/Skeleton/Skeleton.css +1 -0
- package/dist/components/Skeleton/Skeleton2.js +50 -0
- package/dist/components/Slider/Slider.css +1 -0
- package/dist/components/Slider/Slider2.js +39 -0
- package/dist/components/SplitPanel/SplitPanel.css +1 -0
- package/dist/components/SplitPanel/SplitPanel2.js +69 -0
- package/dist/components/Splitter/Splitter.css +1 -0
- package/dist/components/Splitter/Splitter2.js +89 -0
- package/dist/components/StackedBar/StackedBar.css +1 -0
- package/dist/components/StackedBar/StackedBar2.js +50 -0
- package/dist/components/Stats/Stats.css +1 -0
- package/dist/components/Stats/Stats2.js +26 -0
- package/dist/components/StickyBar/StickyBar.css +1 -0
- package/dist/components/StickyBar/StickyBar2.js +29 -0
- package/dist/components/SuggestionsList/SuggestionsList.css +1 -0
- package/dist/components/SuggestionsList/SuggestionsList2.js +121 -0
- package/dist/components/ThemeSettings/ThemeContext.js +140 -0
- package/dist/components/ThemeSettings/ThemeContextValue.js +5 -0
- package/dist/components/ThemeSettings/ThemeSettings.css +1 -0
- package/dist/components/ThemeSettings/ThemeSettings2.js +245 -0
- package/dist/components/ThemeSettings/themeConfig.js +7 -0
- package/dist/components/ThemeSettings/useTheme.js +10 -0
- package/dist/components/TimePicker/TimePicker.css +1 -0
- package/dist/components/TimePicker/TimePicker2.js +118 -0
- package/dist/components/TimePicker/TimeSpinner.js +59 -0
- package/dist/components/Timeline/Timeline.css +1 -0
- package/dist/components/Timeline/Timeline2.js +57 -0
- package/dist/components/TimelineMarkers/TimelineMarkers.css +1 -0
- package/dist/components/TimelineMarkers/TimelineMarkers2.js +73 -0
- package/dist/components/TipsOfTheDay/TipsOfTheDay.css +1 -0
- package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +24 -0
- package/dist/components/Toast/Toast.css +1 -0
- package/dist/components/Toast/Toast2.js +39 -0
- package/dist/components/ToggleButtons/ToggleButtons.css +1 -0
- package/dist/components/ToggleButtons/ToggleButtons2.js +47 -0
- package/dist/components/ToggleSwitch/ToggleSwitch.css +1 -0
- package/dist/components/ToggleSwitch/ToggleSwitch2.js +27 -0
- package/dist/components/Toolbar/Toolbar.css +1 -0
- package/dist/components/Toolbar/Toolbar2.js +129 -0
- package/dist/components/Tooltip/Tooltip.css +1 -0
- package/dist/components/Tooltip/Tooltip2.js +93 -0
- package/dist/components/TourHud/TourHud.css +1 -0
- package/dist/components/TourHud/TourHud2.js +70 -0
- package/dist/components/Transition/Transition.css +1 -0
- package/dist/components/Transition/Transition2.js +68 -0
- package/dist/components/Tree/Tree.css +1 -0
- package/dist/components/Tree/Tree2.js +95 -0
- package/dist/components/VirtualList/VirtualList.css +1 -0
- package/dist/components/VirtualList/VirtualList2.js +64 -0
- package/dist/components/WHtR/WHtR.css +1 -0
- package/dist/components/WHtR/WHtR2.js +115 -0
- package/dist/contexts/AuthContext/AuthContext.js +113 -0
- package/dist/helpers/AppPersistenceStorage.js +50 -0
- package/dist/helpers/Datetime.js +114 -0
- package/dist/helpers/Format.js +21 -0
- package/dist/helpers/Highlight.js +36 -0
- package/dist/helpers/HtmlContent.js +118 -0
- package/dist/helpers/LogicalOperators.js +15 -0
- package/dist/helpers/Numbers.js +15 -0
- package/dist/helpers/Pagination.js +7 -0
- package/dist/helpers/Search.js +15 -0
- package/dist/helpers/Strings.js +10 -0
- package/dist/helpers/Urls.js +68 -0
- package/dist/helpers/VersionInfo.js +36 -0
- package/dist/hooks/useAppPersistence.js +51 -0
- package/dist/hooks/useAuth/useAuth.js +10 -0
- package/dist/hooks/useBodyScrollLock.js +31 -0
- package/dist/hooks/useBreakpoint.js +65 -0
- package/dist/hooks/useComponentEffect.js +8 -0
- package/dist/hooks/useSwipe.js +45 -0
- package/dist/index.css +1 -2
- package/dist/index.esm.js +1 -17211
- package/dist/index.js +348 -0
- package/dist/mfa.js +4 -0
- package/dist/node_modules/qrcode.react/lib/esm/index.js +979 -0
- package/dist/validators/Vin.js +69 -0
- package/dist/version.js +8 -0
- package/dist/version.json +4 -4
- package/package.json +8 -7
- package/dist/mfa.esm.js +0 -1293
- package/dist/useAuth-BBqdDG2z.js +0 -467
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import './VirtualList.css';
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { useCallback as F, useEffect as R, useLayoutEffect as S, useRef as V, useState as d } from "react";
|
|
4
|
+
import { Fragment as $, jsx as h, jsxs as j } from "react/jsx-runtime";
|
|
5
|
+
var D = 96, W = 6;
|
|
6
|
+
function G({ items: l, renderItem: _, getKey: b, rowHeight: s, overscan: f = W, maxHeight: w, empty: m, className: H = "", rowClassName: L = "" }) {
|
|
7
|
+
const o = V(null), [N, v] = d(0), [g, M] = d(0), [p, y] = d(() => window.innerHeight), [z, A] = d(D), a = s && s > 0 ? s : z, C = F((t) => {
|
|
8
|
+
v(t.currentTarget.scrollTop);
|
|
9
|
+
}, []);
|
|
10
|
+
R(() => {
|
|
11
|
+
const t = () => y(window.innerHeight);
|
|
12
|
+
return window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
13
|
+
}, []), R(() => {
|
|
14
|
+
const t = o.current;
|
|
15
|
+
if (!t) return;
|
|
16
|
+
const e = new ResizeObserver((r) => {
|
|
17
|
+
const n = r[0]?.contentRect.height ?? 0;
|
|
18
|
+
M((c) => Math.abs(c - n) > 0.5 ? n : c);
|
|
19
|
+
});
|
|
20
|
+
return e.observe(t), M(t.clientHeight), () => e.disconnect();
|
|
21
|
+
}, []), S(() => {
|
|
22
|
+
o.current && (o.current.scrollTop = 0), v(0);
|
|
23
|
+
}, [l]);
|
|
24
|
+
const u = l.length, I = Math.ceil(Math.min(g || p, p) / a), T = Math.max(1, I + f * 2), O = Math.max(0, u - T), i = Math.min(O, Math.max(0, Math.floor(N / a) - f)), x = Math.min(u, i + T), E = Math.max(0, u - x);
|
|
25
|
+
return S(() => {
|
|
26
|
+
if (s) return;
|
|
27
|
+
const t = o.current;
|
|
28
|
+
if (!t) return;
|
|
29
|
+
const e = t.querySelectorAll("[data-virtual-row]"), r = e[0];
|
|
30
|
+
if (!r) return;
|
|
31
|
+
const n = e[1] ? e[1].offsetTop - r.offsetTop : r.offsetHeight;
|
|
32
|
+
n > 0 && A((c) => Math.abs(c - n) > 0.5 ? n : c);
|
|
33
|
+
}, [
|
|
34
|
+
l,
|
|
35
|
+
s,
|
|
36
|
+
g
|
|
37
|
+
]), u === 0 ? m ? /* @__PURE__ */ h($, { children: m }) : null : /* @__PURE__ */ j("div", {
|
|
38
|
+
className: `virtual-list ${H}`.trim(),
|
|
39
|
+
ref: o,
|
|
40
|
+
onScroll: C,
|
|
41
|
+
style: w === void 0 ? void 0 : { maxHeight: w },
|
|
42
|
+
children: [
|
|
43
|
+
i > 0 && /* @__PURE__ */ h("div", {
|
|
44
|
+
className: "virtual-list__spacer",
|
|
45
|
+
style: { height: i * a }
|
|
46
|
+
}),
|
|
47
|
+
l.slice(i, x).map((t, e) => {
|
|
48
|
+
const r = i + e;
|
|
49
|
+
return /* @__PURE__ */ h("div", {
|
|
50
|
+
className: `virtual-list__row ${L}`.trim(),
|
|
51
|
+
"data-virtual-row": "",
|
|
52
|
+
children: _(t, r)
|
|
53
|
+
}, b(t, r));
|
|
54
|
+
}),
|
|
55
|
+
E > 0 && /* @__PURE__ */ h("div", {
|
|
56
|
+
className: "virtual-list__spacer",
|
|
57
|
+
style: { height: E * a }
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
G as VirtualList
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.whtr-container{width:100%;max-width:600px;margin:0 auto}.whtr-indicator-section{height:var(--spacing-40);margin-bottom:var(--spacing-4);position:relative}.whtr-indicator-pointer{z-index:0;flex-direction:column;align-items:center;display:flex;position:absolute;top:0;transform:translate(-50%)}.whtr-indicator-value{background-color:var(--popover-background-color);border:var(--spacing-2) solid #868585;border-radius:var(--radius);padding:var(--spacing-4) var(--spacing-8);font-weight:var(--font-weight-bold);font-size:var(--font-size-sm);margin-bottom:var(--spacing-2);box-shadow:0 var(--spacing-2) var(--spacing-8) #00000026}.whtr-pointer-arrow{border-left:var(--spacing-8) solid transparent;border-right:var(--spacing-8) solid transparent;border-top:var(--spacing-12) solid #868585;width:0;height:0}.whtr-horizontal-bar{width:100%;height:var(--spacing-48);border:var(--spacing-4) solid #333;border-radius:var(--spacing-24);box-shadow:0 var(--spacing-4) var(--spacing-12) #0000001a;display:flex;overflow:hidden}.whtr-bar-segment{justify-content:center;align-items:center;transition:all .3s;display:flex;position:relative}.whtr-bar-segment:first-child{border-top-left-radius:var(--spacing-8);border-bottom-left-radius:var(--spacing-8)}.whtr-bar-segment:last-child{border-top-right-radius:var(--spacing-8);border-bottom-right-radius:var(--spacing-8)}.whtr-range-text{color:var(--body-color-accent);font-weight:var(--font-weight-bold);font-size:var(--font-size-xs);text-shadow:var(--spacing-1) var(--spacing-1) var(--spacing-2) #0000004d}.whtr-labels-row{width:100%;margin-top:var(--spacing-8);display:flex}.whtr-label-segment{justify-content:center;align-items:center;display:flex}.whtr-label-text{font-weight:var(--font-weight-semibold);font-size:var(--font-size-xs);color:var(--body-color);text-align:center;text-transform:uppercase;line-height:1.2}@media (width<=768px){.whtr-horizontal-bar{height:var(--spacing-40)}.whtr-range-text{font-size:var(--font-size-xxs);text-align:center}.whtr-label-text{font-size:var(--font-size-xxs)}.whtr-indicator-value{font-size:var(--font-size-xs);padding:var(--spacing-4) var(--spacing-8)}}.whtr-container--is-simplified .whtr-indicator-section{margin-bottom:var(--spacing-1);height:var(--spacing-12)}.whtr-container--is-simplified .whtr-indicator-section .whtr-indicator-value{display:none}.whtr-container--is-simplified .whtr-horizontal-bar{height:var(--spacing-8);border-width:var(--spacing-1)}.whtr-container--is-simplified .whtr-horizontal-bar .whtr-range-text{display:none}.whtr-container--is-simplified .whtr-labels-row{margin-top:var(--spacing-2)}.whtr-container--is-simplified .whtr-labels-row .whtr-label-segment .whtr-label-text{font-weight:var(--font-weight-normal);text-transform:none}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import './WHtR.css';
|
|
2
|
+
/* empty css */
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
5
|
+
var e = [
|
|
6
|
+
{
|
|
7
|
+
max: 0.4,
|
|
8
|
+
label: "Underweight",
|
|
9
|
+
color: "#00BFFF",
|
|
10
|
+
percentage: 20
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
max: 0.5,
|
|
14
|
+
label: "Healthy",
|
|
15
|
+
color: "#7ED321",
|
|
16
|
+
percentage: 25
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
max: 0.6,
|
|
20
|
+
label: "At risk",
|
|
21
|
+
color: "#FFD700",
|
|
22
|
+
percentage: 25
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
max: 0.7,
|
|
26
|
+
label: "High Risk",
|
|
27
|
+
shortLabel: "Hi. Risk",
|
|
28
|
+
color: "#FF8C00",
|
|
29
|
+
percentage: 15
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
max: 1,
|
|
33
|
+
label: "Very High",
|
|
34
|
+
shortLabel: "Critical",
|
|
35
|
+
color: "#FF4444",
|
|
36
|
+
percentage: 15
|
|
37
|
+
}
|
|
38
|
+
], g = (o) => {
|
|
39
|
+
for (const a of e) if (o <= a.max) return {
|
|
40
|
+
label: a.label,
|
|
41
|
+
color: a.color
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
label: e[e.length - 1].label,
|
|
45
|
+
color: e[e.length - 1].color
|
|
46
|
+
};
|
|
47
|
+
}, p = (o) => {
|
|
48
|
+
const a = [
|
|
49
|
+
0,
|
|
50
|
+
0.4,
|
|
51
|
+
0.5,
|
|
52
|
+
0.6,
|
|
53
|
+
0.7
|
|
54
|
+
];
|
|
55
|
+
let i = 0;
|
|
56
|
+
for (let t = 0; t < e.length; t++) {
|
|
57
|
+
const n = a[t], c = e[t].max;
|
|
58
|
+
if (o <= c) return i + (o - n) / (c - n) * e[t].percentage;
|
|
59
|
+
i += e[t].percentage;
|
|
60
|
+
}
|
|
61
|
+
return 100;
|
|
62
|
+
}, u = ({ belly: o, height: a, isSimplified: i = !1, showLabels: t = !0, showIndicator: n = !0 }) => {
|
|
63
|
+
const c = Math.round(o / a * 100) / 100, d = g(c), m = p(c), b = [
|
|
64
|
+
"<0.4",
|
|
65
|
+
"0.4-0.5",
|
|
66
|
+
"0.5-0.6",
|
|
67
|
+
"0.6-0.7",
|
|
68
|
+
">0.7"
|
|
69
|
+
];
|
|
70
|
+
return /* @__PURE__ */ h("div", {
|
|
71
|
+
className: `whtr-container ${i ? "whtr-container--is-simplified" : ""}`,
|
|
72
|
+
children: [
|
|
73
|
+
n && /* @__PURE__ */ r("div", {
|
|
74
|
+
className: "whtr-indicator-section",
|
|
75
|
+
children: /* @__PURE__ */ h("div", {
|
|
76
|
+
className: "whtr-indicator-pointer",
|
|
77
|
+
style: { left: `${m}%` },
|
|
78
|
+
children: [/* @__PURE__ */ r("div", {
|
|
79
|
+
className: "whtr-indicator-value",
|
|
80
|
+
style: { color: d.color },
|
|
81
|
+
children: c.toFixed(2)
|
|
82
|
+
}), /* @__PURE__ */ r("div", { className: "whtr-pointer-arrow" })]
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ r("div", {
|
|
86
|
+
className: "whtr-horizontal-bar",
|
|
87
|
+
children: e.map((l, s) => /* @__PURE__ */ r("div", {
|
|
88
|
+
className: "whtr-bar-segment",
|
|
89
|
+
style: {
|
|
90
|
+
backgroundColor: l.color,
|
|
91
|
+
width: `${l.percentage}%`
|
|
92
|
+
},
|
|
93
|
+
children: /* @__PURE__ */ r("div", {
|
|
94
|
+
className: "whtr-range-text",
|
|
95
|
+
children: b[s]
|
|
96
|
+
})
|
|
97
|
+
}, s))
|
|
98
|
+
}),
|
|
99
|
+
t && /* @__PURE__ */ r("div", {
|
|
100
|
+
className: "whtr-labels-row",
|
|
101
|
+
children: e.map((l, s) => /* @__PURE__ */ r("div", {
|
|
102
|
+
className: "whtr-label-segment",
|
|
103
|
+
style: { width: `${l.percentage}%` },
|
|
104
|
+
children: /* @__PURE__ */ r("div", {
|
|
105
|
+
className: "whtr-label-text",
|
|
106
|
+
children: i && l.shortLabel || l.label
|
|
107
|
+
})
|
|
108
|
+
}, s))
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
u as WHtR
|
|
115
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createContext as m, useCallback as n, useEffect as w, useState as c } from "react";
|
|
2
|
+
import { jsx as j } from "react/jsx-runtime";
|
|
3
|
+
var A = m(void 0);
|
|
4
|
+
function T({ children: d, config: a }) {
|
|
5
|
+
const [u, i] = c(null), [h, o] = c(!0);
|
|
6
|
+
w(() => {
|
|
7
|
+
(async () => {
|
|
8
|
+
try {
|
|
9
|
+
const t = await fetch(`${a.apiBaseUrl}/auth/verify`, {
|
|
10
|
+
method: "GET",
|
|
11
|
+
credentials: "include",
|
|
12
|
+
headers: { "Content-Type": "application/json" }
|
|
13
|
+
});
|
|
14
|
+
if (t.ok) {
|
|
15
|
+
const e = await t.json();
|
|
16
|
+
i({
|
|
17
|
+
id: e.user.id,
|
|
18
|
+
username: e.user.username,
|
|
19
|
+
createdAt: new Date(e.user.createdAt)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
} catch (t) {
|
|
23
|
+
console.error("Failed to restore auth state:", t);
|
|
24
|
+
} finally {
|
|
25
|
+
o(!1);
|
|
26
|
+
}
|
|
27
|
+
})();
|
|
28
|
+
}, [a.apiBaseUrl]);
|
|
29
|
+
const s = n((r) => {
|
|
30
|
+
r.user && i({
|
|
31
|
+
id: r.user.id,
|
|
32
|
+
username: r.user.username,
|
|
33
|
+
createdAt: new Date(r.user.createdAt)
|
|
34
|
+
});
|
|
35
|
+
}, []), f = n(async (r) => {
|
|
36
|
+
o(!0);
|
|
37
|
+
try {
|
|
38
|
+
const t = await fetch(`${a.apiBaseUrl}/auth/login`, {
|
|
39
|
+
method: "POST",
|
|
40
|
+
credentials: "include",
|
|
41
|
+
headers: { "Content-Type": "application/json" },
|
|
42
|
+
body: JSON.stringify({
|
|
43
|
+
username: r.username,
|
|
44
|
+
password: r.password,
|
|
45
|
+
rememberMe: r.rememberMe
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
if (!t.ok) {
|
|
49
|
+
const l = await t.json();
|
|
50
|
+
throw new Error(l.error || "Login failed");
|
|
51
|
+
}
|
|
52
|
+
const e = await t.json();
|
|
53
|
+
return e.mfaRequired ? {
|
|
54
|
+
mfaRequired: !0,
|
|
55
|
+
method: e.method
|
|
56
|
+
} : (s(e), { mfaRequired: !1 });
|
|
57
|
+
} catch (t) {
|
|
58
|
+
throw console.error("Login failed:", t), t;
|
|
59
|
+
} finally {
|
|
60
|
+
o(!1);
|
|
61
|
+
}
|
|
62
|
+
}, [a.apiBaseUrl, s]), p = n(async (r, t) => {
|
|
63
|
+
o(!0);
|
|
64
|
+
try {
|
|
65
|
+
const e = await fetch(`${a.apiBaseUrl}/auth/verifyMfa`, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
credentials: "include",
|
|
68
|
+
headers: { "Content-Type": "application/json" },
|
|
69
|
+
body: JSON.stringify({
|
|
70
|
+
code: r,
|
|
71
|
+
trustDevice: t
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
if (!e.ok) {
|
|
75
|
+
const l = await e.json();
|
|
76
|
+
throw new Error(l.error || "Verification failed");
|
|
77
|
+
}
|
|
78
|
+
s(await e.json());
|
|
79
|
+
} catch (e) {
|
|
80
|
+
throw console.error("MFA verification failed:", e), e;
|
|
81
|
+
} finally {
|
|
82
|
+
o(!1);
|
|
83
|
+
}
|
|
84
|
+
}, [a.apiBaseUrl, s]), y = n(async () => {
|
|
85
|
+
try {
|
|
86
|
+
await fetch(`${a.apiBaseUrl}/auth/logout`, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
credentials: "include",
|
|
89
|
+
headers: { "Content-Type": "application/json" }
|
|
90
|
+
});
|
|
91
|
+
} catch (r) {
|
|
92
|
+
console.error("Logout error:", r);
|
|
93
|
+
} finally {
|
|
94
|
+
i(null);
|
|
95
|
+
}
|
|
96
|
+
}, [a.apiBaseUrl]);
|
|
97
|
+
return /* @__PURE__ */ j(A.Provider, {
|
|
98
|
+
value: {
|
|
99
|
+
user: u,
|
|
100
|
+
isAuthenticated: !!u,
|
|
101
|
+
isLoading: h,
|
|
102
|
+
config: a,
|
|
103
|
+
login: f,
|
|
104
|
+
verifyMfa: p,
|
|
105
|
+
logout: y
|
|
106
|
+
},
|
|
107
|
+
children: d
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
A as AuthContext,
|
|
112
|
+
T as AuthProvider
|
|
113
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var g = class {
|
|
2
|
+
static getData(e, t) {
|
|
3
|
+
try {
|
|
4
|
+
const a = localStorage.getItem(e);
|
|
5
|
+
if (a) {
|
|
6
|
+
const r = JSON.parse(a), o = { ...t.pages };
|
|
7
|
+
if (r.pages && typeof r.pages == "object") for (const s of Object.keys(r.pages)) {
|
|
8
|
+
const c = t.pages[s], n = r.pages[s];
|
|
9
|
+
c && typeof c == "object" ? o[s] = {
|
|
10
|
+
...c,
|
|
11
|
+
...n
|
|
12
|
+
} : o[s] = n;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
pages: o,
|
|
16
|
+
theme: {
|
|
17
|
+
...t.theme,
|
|
18
|
+
...r.theme
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
} catch (a) {
|
|
23
|
+
console.warn(`Failed to load app persistence data for ${e}:`, a);
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
}
|
|
27
|
+
static saveData(e, t) {
|
|
28
|
+
try {
|
|
29
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
30
|
+
} catch (a) {
|
|
31
|
+
console.warn(`Failed to save app persistence data for ${e}:`, a);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
static load(e, t) {
|
|
35
|
+
return this.getData(e, t);
|
|
36
|
+
}
|
|
37
|
+
static save(e, t) {
|
|
38
|
+
this.saveData(e, t);
|
|
39
|
+
}
|
|
40
|
+
static clearAll(e) {
|
|
41
|
+
try {
|
|
42
|
+
localStorage.removeItem(e);
|
|
43
|
+
} catch (t) {
|
|
44
|
+
console.warn(`Failed to clear app persistence data for ${e}:`, t);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
g as AppPersistenceStorage
|
|
50
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var m = (t) => {
|
|
2
|
+
if (t < 60) return `${t} min`;
|
|
3
|
+
const e = Math.floor(t / 60), r = t % 60;
|
|
4
|
+
return r === 0 ? `${e}h` : `${e}h ${r}min`;
|
|
5
|
+
}, d = (t) => {
|
|
6
|
+
if (t == null || isNaN(t)) return "0:00";
|
|
7
|
+
const e = Math.floor(t), r = Math.floor(e / 3600), a = Math.floor(e % 3600 / 60), n = e % 60, i = a.toString().padStart(2, "0"), g = n.toString().padStart(2, "0");
|
|
8
|
+
return r === 0 ? `${a}:${g}` : `${r}:${i}:${g}`;
|
|
9
|
+
}, M = [
|
|
10
|
+
"Jan",
|
|
11
|
+
"Feb",
|
|
12
|
+
"Mar",
|
|
13
|
+
"Apr",
|
|
14
|
+
"May",
|
|
15
|
+
"Jun",
|
|
16
|
+
"Jul",
|
|
17
|
+
"Aug",
|
|
18
|
+
"Sep",
|
|
19
|
+
"Oct",
|
|
20
|
+
"Nov",
|
|
21
|
+
"Dec"
|
|
22
|
+
], c = (t, e) => {
|
|
23
|
+
const r = t.getFullYear(), a = t.getMonth(), n = String(a + 1).padStart(2, "0"), i = M[a], g = String(t.getDate()).padStart(2, "0"), o = String(t.getHours()).padStart(2, "0"), u = String(t.getMinutes()).padStart(2, "0"), s = String(t.getSeconds()).padStart(2, "0");
|
|
24
|
+
return e.replace("YYYY", String(r)).replace("MMM", i).replace("MM", n).replace("DD", g).replace("HH", o).replace("mm", u).replace("ss", s);
|
|
25
|
+
}, T = (t) => {
|
|
26
|
+
const [e, r, a] = t.split("-").map(Number);
|
|
27
|
+
return new Date(e, r - 1, a).toLocaleDateString("en-US");
|
|
28
|
+
}, p = () => {
|
|
29
|
+
const t = /* @__PURE__ */ new Date();
|
|
30
|
+
return (/* @__PURE__ */ new Date(t.getTime() - t.getTimezoneOffset() * 6e4)).toISOString().slice(0, 10);
|
|
31
|
+
}, l = "DD MMM YYYY", h = "DD MMM YYYY HH:mm", v = (t) => {
|
|
32
|
+
const [e, r, a] = t.split("-").map(Number);
|
|
33
|
+
return c(new Date(e, r - 1, a), l);
|
|
34
|
+
}, y = (t) => {
|
|
35
|
+
const e = new Date(t.replace(" ", "T"));
|
|
36
|
+
return isNaN(e.getTime()) ? t : c(e, h);
|
|
37
|
+
}, w = (t) => {
|
|
38
|
+
const e = Math.floor(t / 365), r = Math.round((t - e * 365) / 30);
|
|
39
|
+
return e > 0 && r > 0 ? `${e}y ${r}m` : e > 0 ? `${e}y` : `${r}m`;
|
|
40
|
+
}, f = (t, e) => t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate(), S = (t, e, r) => {
|
|
41
|
+
const a = t.getTime();
|
|
42
|
+
return a >= e.getTime() && a <= r.getTime();
|
|
43
|
+
}, Y = (t, e) => new Date(t, e + 1, 0).getDate(), $ = (t, e, r = 0) => {
|
|
44
|
+
const a = new Date(t, e, 1), n = new Date(t, e + 1, 0).getDate();
|
|
45
|
+
let i = a.getDay();
|
|
46
|
+
r === 1 && (i = i === 0 ? 6 : i - 1);
|
|
47
|
+
const g = [];
|
|
48
|
+
let o = [];
|
|
49
|
+
const u = new Date(t, e, 0).getDate();
|
|
50
|
+
for (let s = i - 1; s >= 0; s--) o.push(new Date(t, e - 1, u - s));
|
|
51
|
+
for (let s = 1; s <= n; s++)
|
|
52
|
+
o.push(new Date(t, e, s)), o.length === 7 && (g.push(o), o = []);
|
|
53
|
+
if (o.length > 0) {
|
|
54
|
+
const s = 7 - o.length;
|
|
55
|
+
for (let D = 1; D <= s; D++) o.push(new Date(t, e + 1, D));
|
|
56
|
+
g.push(o);
|
|
57
|
+
}
|
|
58
|
+
return g;
|
|
59
|
+
}, N = (t) => f(t, /* @__PURE__ */ new Date()), A = (t) => {
|
|
60
|
+
const e = new Date(t.getFullYear(), t.getMonth(), t.getDate()), r = (e.getDay() + 6) % 7;
|
|
61
|
+
e.setDate(e.getDate() - r + 3);
|
|
62
|
+
const a = new Date(e.getFullYear(), 0, 4), n = (a.getDay() + 6) % 7;
|
|
63
|
+
return a.setDate(a.getDate() - n + 3), 1 + Math.round((e.getTime() - a.getTime()) / 6048e5);
|
|
64
|
+
}, F = (t) => {
|
|
65
|
+
const e = t.getDay();
|
|
66
|
+
return e === 0 || e === 6;
|
|
67
|
+
}, b = (t, e) => {
|
|
68
|
+
const r = new Date(t);
|
|
69
|
+
return r.setDate(r.getDate() + e), r;
|
|
70
|
+
}, I = (t, e) => {
|
|
71
|
+
const r = new Date(t);
|
|
72
|
+
return r.setMonth(r.getMonth() + e), r;
|
|
73
|
+
}, H = (t, e) => {
|
|
74
|
+
const r = new Date(t.getFullYear(), t.getMonth(), t.getDate()), a = new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
75
|
+
return r.getTime() < a.getTime();
|
|
76
|
+
}, O = (t, e) => {
|
|
77
|
+
const r = new Date(t.getFullYear(), t.getMonth(), t.getDate()), a = new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
78
|
+
return r.getTime() > a.getTime();
|
|
79
|
+
}, _ = (t) => {
|
|
80
|
+
if (!t) return null;
|
|
81
|
+
const e = new Date(t);
|
|
82
|
+
if (Number.isNaN(e.getTime())) return null;
|
|
83
|
+
const r = e.getTime() - Date.now(), a = Math.round(r / 6e4);
|
|
84
|
+
if (Math.abs(a) < 1) return "just now";
|
|
85
|
+
if (Math.abs(a) < 60) return `${Math.abs(a)}m ago`;
|
|
86
|
+
const n = Math.round(a / 60);
|
|
87
|
+
if (Math.abs(n) < 24) return `${Math.abs(n)}h ago`;
|
|
88
|
+
const i = Math.round(n / 24);
|
|
89
|
+
return `${Math.abs(i)}d ago`;
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
l as APP_DATE_FORMAT,
|
|
93
|
+
h as APP_DATE_TIME_FORMAT,
|
|
94
|
+
b as addDays,
|
|
95
|
+
I as addMonths,
|
|
96
|
+
v as formatAppDate,
|
|
97
|
+
y as formatAppDateTime,
|
|
98
|
+
c as formatDate,
|
|
99
|
+
T as formatDateLocale,
|
|
100
|
+
m as formatDuration,
|
|
101
|
+
w as formatRelativeDuration,
|
|
102
|
+
_ as formatRelativeTime,
|
|
103
|
+
d as formatSecondsToMediaTime,
|
|
104
|
+
Y as getDaysInMonth,
|
|
105
|
+
A as getIsoWeek,
|
|
106
|
+
$ as getMonthMatrix,
|
|
107
|
+
p as getTodayDateString,
|
|
108
|
+
O as isAfter,
|
|
109
|
+
H as isBefore,
|
|
110
|
+
S as isDateInRange,
|
|
111
|
+
f as isSameDay,
|
|
112
|
+
N as isToday,
|
|
113
|
+
F as isWeekend
|
|
114
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var e = (t) => new Intl.NumberFormat("en-US", {
|
|
2
|
+
style: "currency",
|
|
3
|
+
currency: "USD",
|
|
4
|
+
minimumFractionDigits: 0
|
|
5
|
+
}).format(t), m = (t) => new Intl.NumberFormat("en-US", { minimumFractionDigits: 0 }).format(t), u = (t, i = 2) => {
|
|
6
|
+
if (!Number.isFinite(t) || t <= 0) return "0 B";
|
|
7
|
+
const n = [
|
|
8
|
+
"B",
|
|
9
|
+
"KB",
|
|
10
|
+
"MB",
|
|
11
|
+
"GB",
|
|
12
|
+
"TB",
|
|
13
|
+
"PB"
|
|
14
|
+
], r = Math.min(Math.floor(Math.log(t) / Math.log(1024)), n.length - 1), o = t / 1024 ** r, a = r === 0 ? 0 : i;
|
|
15
|
+
return `${o.toFixed(a)} ${n[r]}`;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
m as formatBigNumber,
|
|
19
|
+
u as formatBytes,
|
|
20
|
+
e as formatMoney
|
|
21
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
var a = /[̀-ͯ]/g, t = (n) => n.normalize("NFD").replace(a, "").toLowerCase(), d = (n) => {
|
|
3
|
+
let h = "";
|
|
4
|
+
const e = [];
|
|
5
|
+
for (let r = 0; r < n.length; r++) {
|
|
6
|
+
const o = t(n[r]);
|
|
7
|
+
for (let i = 0; i < o.length; i++) e.push(r);
|
|
8
|
+
h += o;
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
folded: h,
|
|
12
|
+
mapping: e
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
function v(n, h) {
|
|
16
|
+
if (!h || !n) return n;
|
|
17
|
+
const e = t(h);
|
|
18
|
+
if (!e) return n;
|
|
19
|
+
const { folded: r, mapping: o } = d(n), i = [];
|
|
20
|
+
let p = 0;
|
|
21
|
+
for (; p <= r.length - e.length; ) {
|
|
22
|
+
const l = r.indexOf(e, p);
|
|
23
|
+
if (l === -1) break;
|
|
24
|
+
const c = o[l], f = l + e.length < o.length ? o[l + e.length] : n.length;
|
|
25
|
+
i.push([c, f]), p = l + e.length;
|
|
26
|
+
}
|
|
27
|
+
if (i.length === 0) return n;
|
|
28
|
+
const g = [];
|
|
29
|
+
let s = 0;
|
|
30
|
+
return i.forEach(([l, c], f) => {
|
|
31
|
+
l > s && g.push(n.slice(s, l)), g.push(/* @__PURE__ */ u("mark", { children: n.slice(l, c) }, f)), s = c;
|
|
32
|
+
}), s < n.length && g.push(n.slice(s)), g;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
v as highlightText
|
|
36
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var m = (r) => r ? /<[a-z][\s\S]*>/i.test(r) ? r : r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").split(/\n{2,}/).map((t) => `<p>${t.replace(/\n/g, "<br>")}</p>`).join("") : "", h = (r) => {
|
|
2
|
+
if (!r) return "";
|
|
3
|
+
const t = document.createElement("div");
|
|
4
|
+
return t.innerHTML = r, t.querySelectorAll("br").forEach((n) => n.replaceWith(`
|
|
5
|
+
`)), (t.textContent || "").trim();
|
|
6
|
+
}, p = (r) => {
|
|
7
|
+
if (!r) return [];
|
|
8
|
+
const t = m(r), n = document.createElement("div");
|
|
9
|
+
n.innerHTML = t;
|
|
10
|
+
const l = Array.from(n.querySelectorAll("p, li, h1, h2, h3, h4, h5, h6"));
|
|
11
|
+
if (l.length > 0) {
|
|
12
|
+
const s = l.map((e) => e.innerHTML.trim()).filter((e) => e.length > 0 && h(e).length > 0);
|
|
13
|
+
if (s.length > 0) return s;
|
|
14
|
+
}
|
|
15
|
+
const c = n.innerHTML.trim();
|
|
16
|
+
return c ? [c] : [];
|
|
17
|
+
}, d = (r) => {
|
|
18
|
+
const t = document.createElement("div");
|
|
19
|
+
t.innerHTML = r;
|
|
20
|
+
const n = (l) => {
|
|
21
|
+
if (l.nodeType === Node.TEXT_NODE) return (l.textContent ?? "").replace(/\u00a0/g, " ");
|
|
22
|
+
if (l.nodeType !== Node.ELEMENT_NODE) return "";
|
|
23
|
+
const c = l, s = c.tagName.toLowerCase(), e = Array.from(c.childNodes).map(n).join("");
|
|
24
|
+
switch (s) {
|
|
25
|
+
case "b":
|
|
26
|
+
case "strong":
|
|
27
|
+
return `**${e}**`;
|
|
28
|
+
case "i":
|
|
29
|
+
case "em":
|
|
30
|
+
return `*${e}*`;
|
|
31
|
+
case "u":
|
|
32
|
+
return `<u>${e}</u>`;
|
|
33
|
+
case "h1":
|
|
34
|
+
return `# ${e}
|
|
35
|
+
|
|
36
|
+
`;
|
|
37
|
+
case "h2":
|
|
38
|
+
return `## ${e}
|
|
39
|
+
|
|
40
|
+
`;
|
|
41
|
+
case "h3":
|
|
42
|
+
return `### ${e}
|
|
43
|
+
|
|
44
|
+
`;
|
|
45
|
+
case "h4":
|
|
46
|
+
return `#### ${e}
|
|
47
|
+
|
|
48
|
+
`;
|
|
49
|
+
case "h5":
|
|
50
|
+
return `##### ${e}
|
|
51
|
+
|
|
52
|
+
`;
|
|
53
|
+
case "h6":
|
|
54
|
+
return `###### ${e}
|
|
55
|
+
|
|
56
|
+
`;
|
|
57
|
+
case "p":
|
|
58
|
+
return `${e}
|
|
59
|
+
|
|
60
|
+
`;
|
|
61
|
+
case "br":
|
|
62
|
+
return `
|
|
63
|
+
`;
|
|
64
|
+
case "a":
|
|
65
|
+
return `[${e}](${c.getAttribute("href") ?? ""})`;
|
|
66
|
+
case "ul":
|
|
67
|
+
return Array.from(c.children).map((o) => {
|
|
68
|
+
const a = o.querySelector('input[type="checkbox"]');
|
|
69
|
+
if (a) {
|
|
70
|
+
const i = a.checked, u = (o.textContent ?? "").trim();
|
|
71
|
+
return `- [${i ? "x" : " "}] ${u}`;
|
|
72
|
+
}
|
|
73
|
+
return `- ${n(o)}`;
|
|
74
|
+
}).join(`
|
|
75
|
+
`) + `
|
|
76
|
+
|
|
77
|
+
`;
|
|
78
|
+
case "ol":
|
|
79
|
+
return Array.from(c.children).map((o, a) => `${a + 1}. ${n(o)}`).join(`
|
|
80
|
+
`) + `
|
|
81
|
+
|
|
82
|
+
`;
|
|
83
|
+
case "li":
|
|
84
|
+
return e;
|
|
85
|
+
case "code":
|
|
86
|
+
return `\`${e}\``;
|
|
87
|
+
case "pre":
|
|
88
|
+
return `\`\`\`
|
|
89
|
+
${c.textContent ?? ""}
|
|
90
|
+
\`\`\`
|
|
91
|
+
|
|
92
|
+
`;
|
|
93
|
+
case "table": {
|
|
94
|
+
const o = Array.from(c.querySelectorAll("tr"));
|
|
95
|
+
return o.length ? [
|
|
96
|
+
Array.from(o[0].querySelectorAll("th,td")).map((a) => a.textContent ?? "").join(" | "),
|
|
97
|
+
Array.from(o[0].querySelectorAll("th,td")).map(() => "---").join(" | "),
|
|
98
|
+
...o.slice(1).map((a) => Array.from(a.querySelectorAll("td")).map((i) => i.textContent ?? "").join(" | "))
|
|
99
|
+
].join(`
|
|
100
|
+
`) + `
|
|
101
|
+
|
|
102
|
+
` : "";
|
|
103
|
+
}
|
|
104
|
+
case "div":
|
|
105
|
+
return `${e}
|
|
106
|
+
`;
|
|
107
|
+
default:
|
|
108
|
+
return e;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return Array.from(t.childNodes).map(n).join("").trim();
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
m as ensureHtml,
|
|
115
|
+
d as htmlToMarkdown,
|
|
116
|
+
h as htmlToPlainText,
|
|
117
|
+
p as splitHtmlIntoSteps
|
|
118
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var s = (e, n, t) => {
|
|
2
|
+
if (e.length === 0) return !0;
|
|
3
|
+
const o = n.toLowerCase(), a = e.map((r) => r.toLowerCase());
|
|
4
|
+
switch (t) {
|
|
5
|
+
case "and":
|
|
6
|
+
return a.every((r) => o.includes(r));
|
|
7
|
+
case "or":
|
|
8
|
+
return a.some((r) => o.includes(r));
|
|
9
|
+
default:
|
|
10
|
+
throw new Error(`Invalid operator: ${t}. Use 'and' or 'or'.`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
s as matchStringsByLogicalOperator
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var o = (r) => Number((typeof r == "number" ? r : Number(r)).toFixed(2)), n = (r, e) => (r > e && console.warn(`Could not get percent of value ${r} from a total ${e}. Total must be higher or at least equal to value.`), r === e ? r === 0 ? 0 : 100 : r / (e / 100)), u = (r, e) => {
|
|
2
|
+
const t = r + e;
|
|
3
|
+
return t === 0 ? {
|
|
4
|
+
a: 0,
|
|
5
|
+
b: 0
|
|
6
|
+
} : {
|
|
7
|
+
a: Math.round(r / t * 100 * 10) / 10,
|
|
8
|
+
b: Math.round(e / t * 100 * 10) / 10
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
o as format2Digits,
|
|
13
|
+
n as getPercent,
|
|
14
|
+
u as getPercentsOf2Numbers
|
|
15
|
+
};
|