@koide-labs/ui 0.0.0 → 0.0.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/README.md +53 -3
- package/{src/-types.ts → dist/-types.d.ts} +1 -6
- package/dist/-types.js +1 -0
- package/dist/-utils.d.ts +19 -0
- package/dist/-utils.js +33 -0
- package/dist/Button-DrPFFzo7.js +31 -0
- package/dist/CompositeRoot-CVk5a-pR.js +233 -0
- package/dist/DirectionContext-C2o_MF_i.js +9 -0
- package/dist/FieldItemContext-DAvk99to.js +11 -0
- package/dist/FloatingPortal-tWyuKRSN.js +435 -0
- package/dist/FloatingPortalLite-DVyq6YhV.js +28 -0
- package/dist/InternalBackdrop-jYAiOJ8v.js +574 -0
- package/dist/LabelableContext-BMvjVwor.js +169 -0
- package/dist/ToolbarRootContext-CvvL0Tk1.js +9 -0
- package/dist/clamp-D0KDAQIz.js +6 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/accordion/index.d.ts +12 -0
- package/dist/components/accordion/index.js +699 -0
- package/dist/components/alert-dialog/index.d.ts +26 -0
- package/dist/components/alert-dialog/index.js +136 -0
- package/dist/components/anchor/index.d.ts +8 -0
- package/dist/components/anchor/index.js +38 -0
- package/dist/components/avatar/index.d.ts +21 -0
- package/dist/components/avatar/index.js +161 -0
- package/dist/components/badge/index.d.ts +16 -0
- package/dist/components/badge/index.js +40 -0
- package/dist/components/button/index.d.ts +24 -0
- package/dist/components/button/index.js +47 -0
- package/dist/components/checkbox/index.d.ts +9 -0
- package/dist/components/checkbox/index.js +269 -0
- package/dist/components/code/index.d.ts +9 -0
- package/dist/components/code/index.js +10 -0
- package/dist/components/collapse/index.d.ts +11 -0
- package/dist/components/collapse/index.js +41 -0
- package/dist/components/command/index.d.ts +14 -0
- package/dist/components/command/index.js +1695 -0
- package/dist/components/context-menu/index.d.ts +42 -0
- package/dist/components/context-menu/index.js +1444 -0
- package/dist/components/dialog/index.d.ts +48 -0
- package/dist/components/dialog/index.js +138 -0
- package/dist/components/heading/index.d.ts +44 -0
- package/dist/components/heading/index.js +56 -0
- package/dist/components/icon/icon-names.d.ts +1 -0
- package/dist/components/icon/icon-names.js +1 -0
- package/dist/components/icon/index.d.ts +23 -0
- package/dist/components/icon/index.js +43 -0
- package/dist/components/icon-button/index.d.ts +12 -0
- package/dist/components/icon-button/index.js +45 -0
- package/dist/components/inline-code/index.d.ts +6 -0
- package/dist/components/inline-code/index.js +22 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/index.js +119 -0
- package/dist/components/meter/index.d.ts +18 -0
- package/dist/components/meter/index.js +165 -0
- package/dist/components/multiline-input/index.d.ts +6 -0
- package/dist/components/multiline-input/index.js +100 -0
- package/dist/components/number-input/index.d.ts +10 -0
- package/dist/components/number-input/index.js +1169 -0
- package/dist/components/password-input/index.d.ts +2 -0
- package/dist/components/password-input/index.js +29 -0
- package/dist/components/pill/index.d.ts +13 -0
- package/dist/components/pill/index.js +38 -0
- package/dist/components/popover/index.d.ts +21 -0
- package/dist/components/popover/index.js +636 -0
- package/dist/components/preview-card/index.d.ts +17 -0
- package/dist/components/preview-card/index.js +402 -0
- package/dist/components/radio/index.d.ts +13 -0
- package/dist/components/radio/index.js +404 -0
- package/dist/components/search-bar/index.d.ts +12 -0
- package/dist/components/search-bar/index.js +48 -0
- package/dist/components/select/index.d.ts +16 -0
- package/dist/components/select/index.js +1263 -0
- package/dist/components/separator/index.d.ts +7 -0
- package/dist/components/separator/index.js +6 -0
- package/dist/components/slider/index.d.ts +5 -0
- package/dist/components/slider/index.js +902 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +13 -0
- package/dist/components/stacked-avatars/index.d.ts +14 -0
- package/dist/components/stacked-avatars/index.js +92 -0
- package/dist/components/status-banner/index.d.ts +17 -0
- package/dist/components/status-banner/index.js +69 -0
- package/dist/components/surface/index.d.ts +27 -0
- package/dist/components/surface/index.js +41 -0
- package/dist/components/switch/index.d.ts +5 -0
- package/dist/components/switch/index.js +196 -0
- package/dist/components/tabs/index.d.ts +18 -0
- package/dist/components/tabs/index.js +509 -0
- package/dist/components/text/index.d.ts +26 -0
- package/dist/components/text/index.js +51 -0
- package/dist/components/theme-provider/index.d.ts +2 -0
- package/dist/components/theme-provider/index.js +6 -0
- package/dist/components/theme-provider/theme-context.d.ts +9 -0
- package/dist/components/theme-provider/theme-context.js +13 -0
- package/dist/components/theme-provider/theme-provider.d.ts +17 -0
- package/dist/components/theme-provider/theme-provider.js +30 -0
- package/dist/components/timestamp/index.d.ts +23 -0
- package/dist/components/timestamp/index.js +1392 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +7 -0
- package/dist/components/toast/toast.d.ts +2 -0
- package/dist/components/toast/toast.js +878 -0
- package/dist/components/toast/use-toast-manager.d.ts +27 -0
- package/dist/components/toast/use-toast-manager.js +4 -0
- package/dist/components/tooltip/index.d.ts +14 -0
- package/dist/components/tooltip/index.js +712 -0
- package/dist/components/tooltip/tooltip-arrow.d.ts +3 -0
- package/dist/components/tooltip/tooltip-arrow.js +6 -0
- package/dist/components/view/index.d.ts +30 -0
- package/dist/components/view/index.js +84 -0
- package/dist/components/visually-hidden/index.d.ts +1 -0
- package/dist/components/visually-hidden/index.js +4 -0
- package/dist/composite-Bx7Szd_T.js +208 -0
- package/dist/composite-C9L5QmZL.js +66 -0
- package/dist/createBaseUIEventDetails-D8M2Yl-a.js +59 -0
- package/dist/detectBrowser-I-s3yzIE.js +43 -0
- package/dist/dialog.css +1 -0
- package/dist/dialog.module-BeF-6XAo.js +415 -0
- package/dist/element-CZEOj04G.js +80 -0
- package/dist/event-CKoGyQEJ.js +30 -0
- package/dist/floating-ui.utils-C7pRWMZ_.js +128 -0
- package/dist/floating-ui.utils.dom-C7FS5id0.js +135 -0
- package/dist/formatErrorMessage-BqPuTBN-.js +7 -0
- package/dist/formatNumber-1UNwjeqf.js +25 -0
- package/dist/getDisabledMountTransitionStyles-YfHPge6T.js +1510 -0
- package/dist/index-BX1XbbRk.js +1206 -0
- package/dist/index-CeuccO-T.js +109 -0
- package/dist/index-DN9Bn1qm.js +29 -0
- package/dist/index-FMoPxlJ2.js +52 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +108 -0
- package/dist/index10.css +1 -0
- package/dist/index11.css +1 -0
- package/dist/index12.css +1 -0
- package/dist/index13.css +1 -0
- package/dist/index14.css +1 -0
- package/dist/index15.css +1 -0
- package/dist/index16.css +1 -0
- package/dist/index17.css +1 -0
- package/dist/index18.css +1 -0
- package/dist/index19.css +1 -0
- package/dist/index2.css +1 -0
- package/dist/index20.css +1 -0
- package/dist/index21.css +1 -0
- package/dist/index22.css +1 -0
- package/dist/index23.css +1 -0
- package/dist/index24.css +1 -0
- package/dist/index25.css +1 -0
- package/dist/index26.css +1 -0
- package/dist/index27.css +1 -0
- package/dist/index28.css +1 -0
- package/dist/index29.css +1 -0
- package/dist/index3.css +1 -0
- package/dist/index30.css +1 -0
- package/dist/index31.css +1 -0
- package/dist/index32.css +1 -0
- package/dist/index33.css +1 -0
- package/dist/index34.css +1 -0
- package/dist/index35.css +1 -0
- package/dist/index36.css +1 -0
- package/dist/index37.css +1 -0
- package/dist/index4.css +1 -0
- package/dist/index5.css +1 -0
- package/dist/index6.css +1 -0
- package/dist/index7.css +1 -0
- package/dist/index8.css +1 -0
- package/dist/index9.css +1 -0
- package/dist/inertValue-BCYGsdmf.js +7 -0
- package/dist/input.css +1 -0
- package/dist/input.module-DDQY_Ij6.js +7 -0
- package/dist/integrations/react-markdown/index.d.ts +5 -0
- package/dist/integrations/react-markdown/index.js +6895 -0
- package/dist/integrations/remix/index.d.ts +9 -0
- package/{src/integrations/remix.ts → dist/integrations/remix/index.js} +7 -4
- package/dist/integrations/tailwind.css +1 -0
- package/dist/integrations/twemoij/index.d.ts +3 -0
- package/dist/integrations/twemoij/index.js +18 -0
- package/dist/isElementDisabled-Cbd8W9kH.js +6 -0
- package/dist/owner-rKN292Q9.js +6 -0
- package/dist/safePolygon-DWy1dGKJ.js +308 -0
- package/dist/styles/core.css +1 -0
- package/dist/styles/tokens.d.ts +400 -0
- package/{src/styles/tokens.ts → dist/styles/tokens.js} +54 -96
- package/dist/toast.css +1 -0
- package/dist/tooltip-arrow-C1qXdi5T.js +24 -0
- package/dist/tooltip-arrow.css +1 -0
- package/dist/transitions.css +1 -0
- package/dist/transitions.module-CWX8e5cx.js +1343 -0
- package/dist/use-toast-manager-Dq-44AuW.js +37 -0
- package/dist/useAnimationFrame-451ugS_6.js +68 -0
- package/dist/useBaseUiId-B7WyxtIE.js +7 -0
- package/dist/useButton-DfIwsdb8.js +127 -0
- package/dist/useCompositeListItem-OkcAim_1.js +148 -0
- package/dist/useControlled-Du4sJyMj.js +31 -0
- package/dist/useHoverReferenceInteraction-SfOBPoXM.js +264 -0
- package/dist/useId-C5kyn6tA.js +22 -0
- package/dist/useIsoLayoutEffect-CIDbvm3Q.js +6 -0
- package/dist/useLabelableId-Ci_jDvmv.js +29 -0
- package/dist/useOnMount-VRW6CK2u.js +8 -0
- package/dist/useOpenChangeComplete-Dse9kY9E.js +61 -0
- package/dist/usePopupAutoResize-CNR6Ekmx.js +85 -0
- package/dist/useRender-CLx7dR_1.js +7 -0
- package/dist/useRenderElement-DwToLA61.js +244 -0
- package/dist/useRole-oDBdbuwQ.js +77 -0
- package/dist/useStableCallback-CkTrVkNX.js +29 -0
- package/dist/useSyncedFloatingRootContext-Dorsv-jf.js +167 -0
- package/dist/useTimeout-CflX-kz3.js +32 -0
- package/dist/useTransitionStatus-CUfcuGAV.js +42 -0
- package/dist/useTypeahead-D85V2IUx.js +333 -0
- package/dist/useValueAsRef-HURLzret.js +19 -0
- package/dist/useValueChanged-DL757-yD.js +14 -0
- package/dist/valueToPercent-DaP9qN4u.js +6 -0
- package/dist/view.css +1 -0
- package/dist/view.module-DfDLgJE0.js +6 -0
- package/dist/visuallyHidden-CpJ-mhai.js +16 -0
- package/dist/warn-CKtX8MLJ.js +11 -0
- package/package.json +18 -2
- package/.husky/pre-commit +0 -1
- package/.storybook/main.ts +0 -25
- package/.storybook/preview-head.html +0 -6
- package/.storybook/preview.tsx +0 -48
- package/.storybook/vitest.setup.ts +0 -8
- package/eslint.config.mjs +0 -29
- package/lint-staged.config.js +0 -15
- package/pnpm-workspace.yaml +0 -2
- package/postcss.config.mjs +0 -7
- package/prettier.config.mjs +0 -24
- package/scripts/build-icon-types.ts +0 -38
- package/src/-utils.tsx +0 -64
- package/src/components/accordion/accordion.module.css +0 -44
- package/src/components/accordion/accordion.stories.tsx +0 -36
- package/src/components/accordion/index.tsx +0 -67
- package/src/components/alert-dialog/alert-dialog.module.css +0 -5
- package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -53
- package/src/components/alert-dialog/index.tsx +0 -138
- package/src/components/anchor/anchor.module.css +0 -18
- package/src/components/anchor/anchor.stories.tsx +0 -28
- package/src/components/anchor/index.tsx +0 -45
- package/src/components/avatar/avatar.module.css +0 -56
- package/src/components/avatar/avatar.stories.tsx +0 -61
- package/src/components/avatar/index.tsx +0 -82
- package/src/components/badge/badge.module.css +0 -35
- package/src/components/badge/badge.stories.tsx +0 -60
- package/src/components/badge/index.tsx +0 -71
- package/src/components/button/button.module.css +0 -42
- package/src/components/button/button.stories.tsx +0 -108
- package/src/components/button/index.tsx +0 -63
- package/src/components/checkbox/checkbox.module.css +0 -36
- package/src/components/checkbox/checkbox.stories.tsx +0 -21
- package/src/components/checkbox/index.tsx +0 -41
- package/src/components/code/code.module.css +0 -20
- package/src/components/code/code.stories.tsx +0 -42
- package/src/components/code/index.tsx +0 -73
- package/src/components/collapse/collapse.module.css +0 -27
- package/src/components/collapse/collapse.stories.tsx +0 -27
- package/src/components/collapse/index.tsx +0 -59
- package/src/components/command/command.module.css +0 -95
- package/src/components/command/command.stories.tsx +0 -38
- package/src/components/command/index.tsx +0 -108
- package/src/components/context-menu/context-menu.module.css +0 -36
- package/src/components/context-menu/context-menu.stories.tsx +0 -99
- package/src/components/context-menu/index.tsx +0 -242
- package/src/components/dialog/dialog.module.css +0 -71
- package/src/components/dialog/dialog.stories.tsx +0 -29
- package/src/components/dialog/index.tsx +0 -148
- package/src/components/heading/heading.module.css +0 -3
- package/src/components/heading/heading.stories.tsx +0 -52
- package/src/components/heading/index.tsx +0 -112
- package/src/components/icon/icon-names.ts +0 -3189
- package/src/components/icon/icon.module.css +0 -36
- package/src/components/icon/icon.stories.tsx +0 -40
- package/src/components/icon/index.tsx +0 -60
- package/src/components/icon-button/icon-button.module.css +0 -33
- package/src/components/icon-button/icon-button.stories.tsx +0 -59
- package/src/components/icon-button/index.tsx +0 -48
- package/src/components/inline-code/index.tsx +0 -29
- package/src/components/inline-code/inline-code.module.css +0 -13
- package/src/components/inline-code/inline-code.stories.tsx +0 -31
- package/src/components/input/index.tsx +0 -22
- package/src/components/input/input.module.css +0 -23
- package/src/components/input/input.stories.tsx +0 -52
- package/src/components/meter/index.tsx +0 -55
- package/src/components/meter/meter.module.css +0 -23
- package/src/components/meter/meter.stories.tsx +0 -31
- package/src/components/multiline-input/index.tsx +0 -58
- package/src/components/multiline-input/multiline-input.stories.tsx +0 -26
- package/src/components/number-input/index.tsx +0 -74
- package/src/components/number-input/number-input.module.css +0 -41
- package/src/components/number-input/number-input.stories.tsx +0 -24
- package/src/components/password-input/index.tsx +0 -24
- package/src/components/password-input/password-input.module.css +0 -10
- package/src/components/password-input/password-input.stories.tsx +0 -24
- package/src/components/pill/index.tsx +0 -45
- package/src/components/pill/pill.module.css +0 -22
- package/src/components/pill/pill.stories.tsx +0 -83
- package/src/components/popover/index.tsx +0 -94
- package/src/components/popover/popover.module.css +0 -8
- package/src/components/popover/popover.stories.tsx +0 -53
- package/src/components/preview-card/index.tsx +0 -68
- package/src/components/preview-card/preview-card.module.css +0 -5
- package/src/components/preview-card/preview-card.stories.tsx +0 -58
- package/src/components/radio/index.tsx +0 -67
- package/src/components/radio/radio-group.module.css +0 -5
- package/src/components/radio/radio.module.css +0 -36
- package/src/components/radio/radio.stories.tsx +0 -27
- package/src/components/search-bar/index.tsx +0 -60
- package/src/components/search-bar/search-bar.module.css +0 -29
- package/src/components/search-bar/search-bar.stories.tsx +0 -37
- package/src/components/select/index.tsx +0 -132
- package/src/components/select/select.module.css +0 -63
- package/src/components/select/select.stories.tsx +0 -49
- package/src/components/separator/index.tsx +0 -28
- package/src/components/separator/separator.module.css +0 -24
- package/src/components/separator/separator.stories.tsx +0 -40
- package/src/components/slider/index.tsx +0 -28
- package/src/components/slider/slider.module.css +0 -52
- package/src/components/slider/slider.stories.tsx +0 -53
- package/src/components/spinner/index.tsx +0 -14
- package/src/components/spinner/spinner.module.css +0 -13
- package/src/components/spinner/spinner.stories.tsx +0 -17
- package/src/components/stacked-avatars/index.tsx +0 -88
- package/src/components/stacked-avatars/stacked-avatars.module.css +0 -79
- package/src/components/stacked-avatars/stacked-avatars.stories.tsx +0 -48
- package/src/components/status-banner/index.tsx +0 -96
- package/src/components/status-banner/status-banner.module.css +0 -52
- package/src/components/status-banner/status-banner.stories.tsx +0 -44
- package/src/components/surface/index.tsx +0 -83
- package/src/components/surface/surface.module.css +0 -35
- package/src/components/surface/surface.stories.tsx +0 -84
- package/src/components/switch/index.tsx +0 -23
- package/src/components/switch/switch.module.css +0 -45
- package/src/components/switch/switch.stories.tsx +0 -48
- package/src/components/tabs/index.tsx +0 -126
- package/src/components/tabs/tabs.module.css +0 -134
- package/src/components/tabs/tabs.stories.tsx +0 -88
- package/src/components/text/index.tsx +0 -69
- package/src/components/text/text.module.css +0 -76
- package/src/components/text/text.stories.tsx +0 -107
- package/src/components/theme-provider/index.ts +0 -2
- package/src/components/theme-provider/theme-context.tsx +0 -18
- package/src/components/theme-provider/theme-provider.stories.tsx +0 -47
- package/src/components/theme-provider/theme-provider.tsx +0 -77
- package/src/components/timestamp/index.tsx +0 -131
- package/src/components/timestamp/timestamp.module.css +0 -8
- package/src/components/timestamp/timestamp.stories.tsx +0 -37
- package/src/components/toast/index.ts +0 -2
- package/src/components/toast/toast.module.css +0 -163
- package/src/components/toast/toast.stories.tsx +0 -53
- package/src/components/toast/toast.tsx +0 -104
- package/src/components/toast/use-toast-manager.ts +0 -63
- package/src/components/tooltip/index.tsx +0 -61
- package/src/components/tooltip/tooltip-arrow.tsx +0 -17
- package/src/components/tooltip/tooltip.module.css +0 -44
- package/src/components/tooltip/tooltip.stories.tsx +0 -76
- package/src/components/view/index.tsx +0 -137
- package/src/components/view/view.module.css +0 -11
- package/src/components/view/view.stories.tsx +0 -131
- package/src/components/view/view_colorway.module.css +0 -280
- package/src/components/view/view_interactive.module.css +0 -127
- package/src/components/view/view_loading.module.css +0 -58
- package/src/components/visually-hidden/index.ts +0 -1
- package/src/index.ts +0 -49
- package/src/integrations/react-markdown/index.tsx +0 -134
- package/src/integrations/react-markdown/react-markdown.module.css +0 -62
- package/src/integrations/react-markdown/react-markdown.stories.tsx +0 -31
- package/src/integrations/tailwind.css +0 -173
- package/src/integrations/twemoij/index.tsx +0 -13
- package/src/integrations/twemoij/twemoji.module.css +0 -7
- package/src/integrations/twemoij/twemoji.stories.tsx +0 -40
- package/src/stories/components/all-variants.tsx +0 -40
- package/src/stories/data.ts +0 -72
- package/src/stories/utils.ts +0 -20
- package/src/styles/core.css +0 -153
- package/src/styles/themes/dark.css +0 -86
- package/src/styles/themes/light.css +0 -86
- package/src/styles/transitions.module.css +0 -31
- package/stylelint.config.mjs +0 -29
- package/tsconfig.app.json +0 -35
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -103
- package/vitest.shims.d.ts +0 -1
|
@@ -0,0 +1,1343 @@
|
|
|
1
|
+
import * as v from "react";
|
|
2
|
+
import se from "react";
|
|
3
|
+
import { a as z, o as de, n as lt, i as ft, g as dt, h as pe, l as pt } from "./floating-ui.utils.dom-C7FS5id0.js";
|
|
4
|
+
import { u as Ie, T as ht } from "./useTimeout-CflX-kz3.js";
|
|
5
|
+
import { u as L } from "./useStableCallback-CkTrVkNX.js";
|
|
6
|
+
import { u as mt } from "./useId-C5kyn6tA.js";
|
|
7
|
+
import { u as q } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
8
|
+
import { a as Et, i as gt, N as yt } from "./useRenderElement-DwToLA61.js";
|
|
9
|
+
import { jsx as ze } from "react/jsx-runtime";
|
|
10
|
+
import { c as U, e as St, o as vt, a as Me, n as Ot } from "./createBaseUIEventDetails-D8M2Yl-a.js";
|
|
11
|
+
import { c as _t } from "./FloatingPortal-tWyuKRSN.js";
|
|
12
|
+
import { d as Rt, c as bt } from "./event-CKoGyQEJ.js";
|
|
13
|
+
import { e as B, d as De, f as Q, k as Tt, l as k, F as Ct, n as Be, S as Ge } from "./element-CZEOj04G.js";
|
|
14
|
+
import { f as Ue } from "./formatErrorMessage-BqPuTBN-.js";
|
|
15
|
+
import { T as xe } from "./useOpenChangeComplete-Dse9kY9E.js";
|
|
16
|
+
import './transitions.css';function re(n, t, e = !0) {
|
|
17
|
+
return n.filter((o) => o.parentId === t && (!e || o.context?.open)).flatMap((o) => [o, ...re(n, o.id, e)]);
|
|
18
|
+
}
|
|
19
|
+
function Mn(n, t) {
|
|
20
|
+
let e = [], r = n.find((o) => o.id === t)?.parentId;
|
|
21
|
+
for (; r; ) {
|
|
22
|
+
const o = n.find((s) => s.id === r);
|
|
23
|
+
r = o?.parentId, o && (e = e.concat(o));
|
|
24
|
+
}
|
|
25
|
+
return e;
|
|
26
|
+
}
|
|
27
|
+
function $e() {
|
|
28
|
+
const n = /* @__PURE__ */ new Map();
|
|
29
|
+
return {
|
|
30
|
+
emit(t, e) {
|
|
31
|
+
n.get(t)?.forEach((r) => r(e));
|
|
32
|
+
},
|
|
33
|
+
on(t, e) {
|
|
34
|
+
n.has(t) || n.set(t, /* @__PURE__ */ new Set()), n.get(t).add(e);
|
|
35
|
+
},
|
|
36
|
+
off(t, e) {
|
|
37
|
+
n.get(t)?.delete(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
class wt {
|
|
42
|
+
nodesRef = {
|
|
43
|
+
current: []
|
|
44
|
+
};
|
|
45
|
+
events = $e();
|
|
46
|
+
addNode(t) {
|
|
47
|
+
this.nodesRef.current.push(t);
|
|
48
|
+
}
|
|
49
|
+
removeNode(t) {
|
|
50
|
+
const e = this.nodesRef.current.findIndex((r) => r === t);
|
|
51
|
+
e !== -1 && this.nodesRef.current.splice(e, 1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const Se = /* @__PURE__ */ v.createContext(null);
|
|
55
|
+
process.env.NODE_ENV !== "production" && (Se.displayName = "FloatingNodeContext");
|
|
56
|
+
const ve = /* @__PURE__ */ v.createContext(null);
|
|
57
|
+
process.env.NODE_ENV !== "production" && (ve.displayName = "FloatingTreeContext");
|
|
58
|
+
const qe = () => v.useContext(Se)?.id || null, Ye = (n) => {
|
|
59
|
+
const t = v.useContext(ve);
|
|
60
|
+
return n ?? t;
|
|
61
|
+
};
|
|
62
|
+
function Dn(n) {
|
|
63
|
+
const t = mt(), e = Ye(n), r = qe();
|
|
64
|
+
return q(() => {
|
|
65
|
+
if (!t)
|
|
66
|
+
return;
|
|
67
|
+
const o = {
|
|
68
|
+
id: t,
|
|
69
|
+
parentId: r
|
|
70
|
+
};
|
|
71
|
+
return e?.addNode(o), () => {
|
|
72
|
+
e?.removeNode(o);
|
|
73
|
+
};
|
|
74
|
+
}, [e, t, r]), t;
|
|
75
|
+
}
|
|
76
|
+
function xn(n) {
|
|
77
|
+
const {
|
|
78
|
+
children: t,
|
|
79
|
+
id: e
|
|
80
|
+
} = n, r = qe();
|
|
81
|
+
return /* @__PURE__ */ ze(Se.Provider, {
|
|
82
|
+
value: v.useMemo(() => ({
|
|
83
|
+
id: e,
|
|
84
|
+
parentId: r
|
|
85
|
+
}), [e, r]),
|
|
86
|
+
children: t
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function Vn(n) {
|
|
90
|
+
const {
|
|
91
|
+
children: t,
|
|
92
|
+
externalTree: e
|
|
93
|
+
} = n, r = Et(() => e ?? new wt()).current;
|
|
94
|
+
return /* @__PURE__ */ ze(ve.Provider, {
|
|
95
|
+
value: r,
|
|
96
|
+
children: t
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const Lt = {
|
|
100
|
+
intentional: "onClick",
|
|
101
|
+
sloppy: "onPointerDown"
|
|
102
|
+
};
|
|
103
|
+
function It(n) {
|
|
104
|
+
return {
|
|
105
|
+
escapeKey: typeof n == "boolean" ? n : n?.escapeKey ?? !1,
|
|
106
|
+
outsidePress: typeof n == "boolean" ? n : n?.outsidePress ?? !0
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function Nn(n, t = {}) {
|
|
110
|
+
const e = "rootStore" in n ? n.rootStore : n, r = e.useState("open"), o = e.useState("floatingElement"), s = e.useState("referenceElement"), a = e.useState("domReferenceElement"), {
|
|
111
|
+
onOpenChange: u,
|
|
112
|
+
dataRef: h
|
|
113
|
+
} = e.context, {
|
|
114
|
+
enabled: c = !0,
|
|
115
|
+
escapeKey: f = !0,
|
|
116
|
+
outsidePress: m = !0,
|
|
117
|
+
outsidePressEvent: g = "sloppy",
|
|
118
|
+
referencePress: l = !1,
|
|
119
|
+
referencePressEvent: d = "sloppy",
|
|
120
|
+
ancestorScroll: E = !1,
|
|
121
|
+
bubbles: _,
|
|
122
|
+
externalTree: w
|
|
123
|
+
} = t, b = Ye(w), x = L(typeof m == "function" ? m : () => !1), T = typeof m == "function" ? x : m, N = v.useRef(!1), {
|
|
124
|
+
escapeKey: O,
|
|
125
|
+
outsidePress: C
|
|
126
|
+
} = It(_), R = v.useRef(null), A = Ie(), X = Ie(), F = L(() => {
|
|
127
|
+
X.clear(), h.current.insideReactTree = !1;
|
|
128
|
+
}), ie = v.useRef(!1), Re = v.useRef(""), ce = L((i) => {
|
|
129
|
+
Re.current = i.pointerType;
|
|
130
|
+
}), W = L(() => {
|
|
131
|
+
const i = Re.current, y = i === "pen" || !i ? "mouse" : i, p = typeof g == "function" ? g() : g;
|
|
132
|
+
return typeof p == "string" ? p : p[y];
|
|
133
|
+
}), P = L((i) => {
|
|
134
|
+
if (!r || !c || !f || i.key !== "Escape" || ie.current)
|
|
135
|
+
return;
|
|
136
|
+
const y = h.current.floatingContext?.nodeId, p = b ? re(b.nodesRef.current, y) : [];
|
|
137
|
+
if (!O && p.length > 0) {
|
|
138
|
+
let M = !0;
|
|
139
|
+
if (p.forEach((I) => {
|
|
140
|
+
I.context?.open && !I.context.dataRef.current.__escapeKeyBubbles && (M = !1);
|
|
141
|
+
}), !M)
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const V = Rt(i) ? i.nativeEvent : i, S = U(St, V);
|
|
145
|
+
e.setOpen(!1, S), !O && !S.isPropagationAllowed && i.stopPropagation();
|
|
146
|
+
}), Qe = L((i) => {
|
|
147
|
+
const y = W();
|
|
148
|
+
return y === "intentional" && i.type !== "click" || y === "sloppy" && i.type === "click";
|
|
149
|
+
}), j = L(() => {
|
|
150
|
+
h.current.insideReactTree = !0, X.start(0, F);
|
|
151
|
+
}), G = L((i, y = !1) => {
|
|
152
|
+
if (Qe(i)) {
|
|
153
|
+
F();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (h.current.insideReactTree) {
|
|
157
|
+
F();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (W() === "intentional" && y || typeof T == "function" && !T(i))
|
|
161
|
+
return;
|
|
162
|
+
const p = B(i), V = `[${_t("inert")}]`, S = De(e.select("floatingElement")).querySelectorAll(V), M = e.context.triggerElements;
|
|
163
|
+
if (p && (M.hasElement(p) || M.hasMatchingElement((D) => Q(D, p))))
|
|
164
|
+
return;
|
|
165
|
+
let I = z(p) ? p : null;
|
|
166
|
+
for (; I && !de(I); ) {
|
|
167
|
+
const D = lt(I);
|
|
168
|
+
if (de(D) || !z(D))
|
|
169
|
+
break;
|
|
170
|
+
I = D;
|
|
171
|
+
}
|
|
172
|
+
if (S.length && z(p) && !Tt(p) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
173
|
+
!Q(p, e.select("floatingElement")) && // If the target root element contains none of the markers, then the
|
|
174
|
+
// element was injected after the floating element rendered.
|
|
175
|
+
Array.from(S).every((D) => !Q(I, D)))
|
|
176
|
+
return;
|
|
177
|
+
if (ft(p) && !("touches" in i)) {
|
|
178
|
+
const D = de(p), H = dt(p), Le = /auto|scroll/, rt = D || Le.test(H.overflowX), ot = D || Le.test(H.overflowY), st = rt && p.clientWidth > 0 && p.scrollWidth > p.clientWidth, it = ot && p.clientHeight > 0 && p.scrollHeight > p.clientHeight, ct = H.direction === "rtl", ut = it && (ct ? i.offsetX <= p.offsetWidth - p.clientWidth : i.offsetX > p.clientWidth), at = st && i.offsetY > p.clientHeight;
|
|
179
|
+
if (ut || at)
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const Ce = h.current.floatingContext?.nodeId, nt = b && re(b.nodesRef.current, Ce).some((D) => k(i, D.context?.elements.floating));
|
|
183
|
+
if (k(i, e.select("floatingElement")) || k(i, e.select("domReferenceElement")) || nt)
|
|
184
|
+
return;
|
|
185
|
+
const we = b ? re(b.nodesRef.current, Ce) : [];
|
|
186
|
+
if (we.length > 0) {
|
|
187
|
+
let D = !0;
|
|
188
|
+
if (we.forEach((H) => {
|
|
189
|
+
H.context?.open && !H.context.dataRef.current.__outsidePressBubbles && (D = !1);
|
|
190
|
+
}), !D)
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
e.setOpen(!1, U(vt, i)), F();
|
|
194
|
+
}), be = L((i) => {
|
|
195
|
+
W() !== "sloppy" || i.pointerType === "touch" || !e.select("open") || !c || k(i, e.select("floatingElement")) || k(i, e.select("domReferenceElement")) || G(i);
|
|
196
|
+
}), Ze = L((i) => {
|
|
197
|
+
if (W() !== "sloppy" || !e.select("open") || !c || k(i, e.select("floatingElement")) || k(i, e.select("domReferenceElement")))
|
|
198
|
+
return;
|
|
199
|
+
const y = i.touches[0];
|
|
200
|
+
y && (R.current = {
|
|
201
|
+
startTime: Date.now(),
|
|
202
|
+
startX: y.clientX,
|
|
203
|
+
startY: y.clientY,
|
|
204
|
+
dismissOnTouchEnd: !1,
|
|
205
|
+
dismissOnMouseDown: !0
|
|
206
|
+
}, A.start(1e3, () => {
|
|
207
|
+
R.current && (R.current.dismissOnTouchEnd = !1, R.current.dismissOnMouseDown = !1);
|
|
208
|
+
}));
|
|
209
|
+
}), ue = L((i) => {
|
|
210
|
+
const y = B(i);
|
|
211
|
+
function p() {
|
|
212
|
+
Ze(i), y?.removeEventListener(i.type, p);
|
|
213
|
+
}
|
|
214
|
+
y?.addEventListener(i.type, p);
|
|
215
|
+
}), K = L((i) => {
|
|
216
|
+
const y = N.current;
|
|
217
|
+
if (N.current = !1, A.clear(), i.type === "mousedown" && R.current && !R.current.dismissOnMouseDown)
|
|
218
|
+
return;
|
|
219
|
+
const p = B(i);
|
|
220
|
+
function V() {
|
|
221
|
+
i.type === "pointerdown" ? be(i) : G(i, y), p?.removeEventListener(i.type, V);
|
|
222
|
+
}
|
|
223
|
+
p?.addEventListener(i.type, V);
|
|
224
|
+
}), et = L((i) => {
|
|
225
|
+
if (W() !== "sloppy" || !R.current || k(i, e.select("floatingElement")) || k(i, e.select("domReferenceElement")))
|
|
226
|
+
return;
|
|
227
|
+
const y = i.touches[0];
|
|
228
|
+
if (!y)
|
|
229
|
+
return;
|
|
230
|
+
const p = Math.abs(y.clientX - R.current.startX), V = Math.abs(y.clientY - R.current.startY), S = Math.sqrt(p * p + V * V);
|
|
231
|
+
S > 5 && (R.current.dismissOnTouchEnd = !0), S > 10 && (G(i), A.clear(), R.current = null);
|
|
232
|
+
}), ae = L((i) => {
|
|
233
|
+
const y = B(i);
|
|
234
|
+
function p() {
|
|
235
|
+
et(i), y?.removeEventListener(i.type, p);
|
|
236
|
+
}
|
|
237
|
+
y?.addEventListener(i.type, p);
|
|
238
|
+
}), tt = L((i) => {
|
|
239
|
+
W() !== "sloppy" || !R.current || k(i, e.select("floatingElement")) || k(i, e.select("domReferenceElement")) || (R.current.dismissOnTouchEnd && G(i), A.clear(), R.current = null);
|
|
240
|
+
}), le = L((i) => {
|
|
241
|
+
const y = B(i);
|
|
242
|
+
function p() {
|
|
243
|
+
tt(i), y?.removeEventListener(i.type, p);
|
|
244
|
+
}
|
|
245
|
+
y?.addEventListener(i.type, p);
|
|
246
|
+
});
|
|
247
|
+
v.useEffect(() => {
|
|
248
|
+
if (!r || !c)
|
|
249
|
+
return;
|
|
250
|
+
h.current.__escapeKeyBubbles = O, h.current.__outsidePressBubbles = C;
|
|
251
|
+
const i = new ht();
|
|
252
|
+
function y(I) {
|
|
253
|
+
e.setOpen(!1, U(Ot, I));
|
|
254
|
+
}
|
|
255
|
+
function p() {
|
|
256
|
+
i.clear(), ie.current = !0;
|
|
257
|
+
}
|
|
258
|
+
function V() {
|
|
259
|
+
i.start(
|
|
260
|
+
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
261
|
+
// Only apply to WebKit for the test to remain 0ms.
|
|
262
|
+
pt() ? 5 : 0,
|
|
263
|
+
() => {
|
|
264
|
+
ie.current = !1;
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
const S = De(o);
|
|
269
|
+
S.addEventListener("pointerdown", ce, !0), f && (S.addEventListener("keydown", P), S.addEventListener("compositionstart", p), S.addEventListener("compositionend", V)), T && (S.addEventListener("click", K, !0), S.addEventListener("pointerdown", K, !0), S.addEventListener("touchstart", ue, !0), S.addEventListener("touchmove", ae, !0), S.addEventListener("touchend", le, !0), S.addEventListener("mousedown", K, !0));
|
|
270
|
+
let M = [];
|
|
271
|
+
return E && (z(a) && (M = pe(a)), z(o) && (M = M.concat(pe(o))), !z(s) && s && s.contextElement && (M = M.concat(pe(s.contextElement)))), M = M.filter((I) => I !== S.defaultView?.visualViewport), M.forEach((I) => {
|
|
272
|
+
I.addEventListener("scroll", y, {
|
|
273
|
+
passive: !0
|
|
274
|
+
});
|
|
275
|
+
}), () => {
|
|
276
|
+
S.removeEventListener("pointerdown", ce, !0), f && (S.removeEventListener("keydown", P), S.removeEventListener("compositionstart", p), S.removeEventListener("compositionend", V)), T && (S.removeEventListener("click", K, !0), S.removeEventListener("pointerdown", K, !0), S.removeEventListener("touchstart", ue, !0), S.removeEventListener("touchmove", ae, !0), S.removeEventListener("touchend", le, !0), S.removeEventListener("mousedown", K, !0)), M.forEach((I) => {
|
|
277
|
+
I.removeEventListener("scroll", y);
|
|
278
|
+
}), i.clear();
|
|
279
|
+
};
|
|
280
|
+
}, [h, o, s, a, f, T, r, u, E, c, O, C, P, G, K, be, ue, ae, le, ce, e]), v.useEffect(F, [T, F]);
|
|
281
|
+
const fe = v.useMemo(() => ({
|
|
282
|
+
onKeyDown: P,
|
|
283
|
+
...l && {
|
|
284
|
+
[Lt[d]]: (i) => {
|
|
285
|
+
e.setOpen(!1, U(Me, i.nativeEvent));
|
|
286
|
+
},
|
|
287
|
+
...d !== "intentional" && {
|
|
288
|
+
onClick(i) {
|
|
289
|
+
e.setOpen(!1, U(Me, i.nativeEvent));
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}), [P, e, l, d]), J = L((i) => {
|
|
294
|
+
const y = B(i.nativeEvent);
|
|
295
|
+
!Q(e.select("floatingElement"), y) || i.button !== 0 || (N.current = !0);
|
|
296
|
+
}), Te = v.useMemo(() => ({
|
|
297
|
+
onKeyDown: P,
|
|
298
|
+
// `onMouseDown` may be blocked if `event.preventDefault()` is called in
|
|
299
|
+
// `onPointerDown`, such as with <NumberField.ScrubArea>.
|
|
300
|
+
// See https://github.com/mui/base-ui/pull/3379
|
|
301
|
+
onPointerDown: J,
|
|
302
|
+
onMouseDown: J,
|
|
303
|
+
onMouseUp: J,
|
|
304
|
+
onClickCapture: j,
|
|
305
|
+
onMouseDownCapture: j,
|
|
306
|
+
onPointerDownCapture: j,
|
|
307
|
+
onMouseUpCapture: j,
|
|
308
|
+
onTouchEndCapture: j,
|
|
309
|
+
onTouchMoveCapture: j
|
|
310
|
+
}), [P, J, j]);
|
|
311
|
+
return v.useMemo(() => c ? {
|
|
312
|
+
reference: fe,
|
|
313
|
+
floating: Te,
|
|
314
|
+
trigger: fe
|
|
315
|
+
} : {}, [c, fe, Te]);
|
|
316
|
+
}
|
|
317
|
+
var Mt = (n, t, e) => {
|
|
318
|
+
if (t.length === 1 && t[0] === e) {
|
|
319
|
+
let r = !1;
|
|
320
|
+
try {
|
|
321
|
+
const o = {};
|
|
322
|
+
n(o) === o && (r = !0);
|
|
323
|
+
} catch {
|
|
324
|
+
}
|
|
325
|
+
if (r) {
|
|
326
|
+
let o;
|
|
327
|
+
try {
|
|
328
|
+
throw new Error();
|
|
329
|
+
} catch (s) {
|
|
330
|
+
({ stack: o } = s);
|
|
331
|
+
}
|
|
332
|
+
console.warn(
|
|
333
|
+
`The result function returned its own inputs without modification. e.g
|
|
334
|
+
\`createSelector([state => state.todos], todos => todos)\`
|
|
335
|
+
This could lead to inefficient memoization and unnecessary re-renders.
|
|
336
|
+
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,
|
|
337
|
+
{ stack: o }
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}, Dt = (n, t, e) => {
|
|
342
|
+
const { memoize: r, memoizeOptions: o } = t, { inputSelectorResults: s, inputSelectorResultsCopy: a } = n, u = r(() => ({}), ...o);
|
|
343
|
+
if (!(u.apply(null, s) === u.apply(null, a))) {
|
|
344
|
+
let c;
|
|
345
|
+
try {
|
|
346
|
+
throw new Error();
|
|
347
|
+
} catch (f) {
|
|
348
|
+
({ stack: c } = f);
|
|
349
|
+
}
|
|
350
|
+
console.warn(
|
|
351
|
+
`An input selector returned a different result when passed same arguments.
|
|
352
|
+
This means your output selector will likely run more frequently than intended.
|
|
353
|
+
Avoid returning a new reference inside your input selector, e.g.
|
|
354
|
+
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,
|
|
355
|
+
{
|
|
356
|
+
arguments: e,
|
|
357
|
+
firstInputs: s,
|
|
358
|
+
secondInputs: a,
|
|
359
|
+
stack: c
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
}, xt = {
|
|
364
|
+
inputStabilityCheck: "once",
|
|
365
|
+
identityFunctionCheck: "once"
|
|
366
|
+
}, oe = /* @__PURE__ */ Symbol("NOT_FOUND");
|
|
367
|
+
function Vt(n, t = `expected a function, instead received ${typeof n}`) {
|
|
368
|
+
if (typeof n != "function")
|
|
369
|
+
throw new TypeError(t);
|
|
370
|
+
}
|
|
371
|
+
function Nt(n, t = `expected an object, instead received ${typeof n}`) {
|
|
372
|
+
if (typeof n != "object")
|
|
373
|
+
throw new TypeError(t);
|
|
374
|
+
}
|
|
375
|
+
function kt(n, t = "expected all items to be functions, instead received the following types: ") {
|
|
376
|
+
if (!n.every((e) => typeof e == "function")) {
|
|
377
|
+
const e = n.map(
|
|
378
|
+
(r) => typeof r == "function" ? `function ${r.name || "unnamed"}()` : typeof r
|
|
379
|
+
).join(", ");
|
|
380
|
+
throw new TypeError(`${t}[${e}]`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
var Ve = (n) => Array.isArray(n) ? n : [n];
|
|
384
|
+
function At(n) {
|
|
385
|
+
const t = Array.isArray(n[0]) ? n[0] : n;
|
|
386
|
+
return kt(
|
|
387
|
+
t,
|
|
388
|
+
"createSelector expects all input-selectors to be functions, but received the following types: "
|
|
389
|
+
), t;
|
|
390
|
+
}
|
|
391
|
+
function Ne(n, t) {
|
|
392
|
+
const e = [], { length: r } = n;
|
|
393
|
+
for (let o = 0; o < r; o++)
|
|
394
|
+
e.push(n[o].apply(null, t));
|
|
395
|
+
return e;
|
|
396
|
+
}
|
|
397
|
+
var Pt = (n, t) => {
|
|
398
|
+
const { identityFunctionCheck: e, inputStabilityCheck: r } = {
|
|
399
|
+
...xt,
|
|
400
|
+
...t
|
|
401
|
+
};
|
|
402
|
+
return {
|
|
403
|
+
identityFunctionCheck: {
|
|
404
|
+
shouldRun: e === "always" || e === "once" && n,
|
|
405
|
+
run: Mt
|
|
406
|
+
},
|
|
407
|
+
inputStabilityCheck: {
|
|
408
|
+
shouldRun: r === "always" || r === "once" && n,
|
|
409
|
+
run: Dt
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
function jt(n) {
|
|
414
|
+
let t;
|
|
415
|
+
return {
|
|
416
|
+
get(e) {
|
|
417
|
+
return t && n(t.key, e) ? t.value : oe;
|
|
418
|
+
},
|
|
419
|
+
put(e, r) {
|
|
420
|
+
t = { key: e, value: r };
|
|
421
|
+
},
|
|
422
|
+
getEntries() {
|
|
423
|
+
return t ? [t] : [];
|
|
424
|
+
},
|
|
425
|
+
clear() {
|
|
426
|
+
t = void 0;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function Kt(n, t) {
|
|
431
|
+
let e = [];
|
|
432
|
+
function r(u) {
|
|
433
|
+
const h = e.findIndex((c) => t(u, c.key));
|
|
434
|
+
if (h > -1) {
|
|
435
|
+
const c = e[h];
|
|
436
|
+
return h > 0 && (e.splice(h, 1), e.unshift(c)), c.value;
|
|
437
|
+
}
|
|
438
|
+
return oe;
|
|
439
|
+
}
|
|
440
|
+
function o(u, h) {
|
|
441
|
+
r(u) === oe && (e.unshift({ key: u, value: h }), e.length > n && e.pop());
|
|
442
|
+
}
|
|
443
|
+
function s() {
|
|
444
|
+
return e;
|
|
445
|
+
}
|
|
446
|
+
function a() {
|
|
447
|
+
e = [];
|
|
448
|
+
}
|
|
449
|
+
return { get: r, put: o, getEntries: s, clear: a };
|
|
450
|
+
}
|
|
451
|
+
var Ft = (n, t) => n === t;
|
|
452
|
+
function Wt(n) {
|
|
453
|
+
return function(e, r) {
|
|
454
|
+
if (e === null || r === null || e.length !== r.length)
|
|
455
|
+
return !1;
|
|
456
|
+
const { length: o } = e;
|
|
457
|
+
for (let s = 0; s < o; s++)
|
|
458
|
+
if (!n(e[s], r[s]))
|
|
459
|
+
return !1;
|
|
460
|
+
return !0;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
function Ht(n, t) {
|
|
464
|
+
const e = typeof t == "object" ? t : { equalityCheck: t }, {
|
|
465
|
+
equalityCheck: r = Ft,
|
|
466
|
+
maxSize: o = 1,
|
|
467
|
+
resultEqualityCheck: s
|
|
468
|
+
} = e, a = Wt(r);
|
|
469
|
+
let u = 0;
|
|
470
|
+
const h = o <= 1 ? jt(a) : Kt(o, a);
|
|
471
|
+
function c() {
|
|
472
|
+
let f = h.get(arguments);
|
|
473
|
+
if (f === oe) {
|
|
474
|
+
if (f = n.apply(null, arguments), u++, s) {
|
|
475
|
+
const g = h.getEntries().find(
|
|
476
|
+
(l) => s(l.value, f)
|
|
477
|
+
);
|
|
478
|
+
g && (f = g.value, u !== 0 && u--);
|
|
479
|
+
}
|
|
480
|
+
h.put(arguments, f);
|
|
481
|
+
}
|
|
482
|
+
return f;
|
|
483
|
+
}
|
|
484
|
+
return c.clearCache = () => {
|
|
485
|
+
h.clear(), c.resetResultsCount();
|
|
486
|
+
}, c.resultsCount = () => u, c.resetResultsCount = () => {
|
|
487
|
+
u = 0;
|
|
488
|
+
}, c;
|
|
489
|
+
}
|
|
490
|
+
var zt = class {
|
|
491
|
+
constructor(n) {
|
|
492
|
+
this.value = n;
|
|
493
|
+
}
|
|
494
|
+
deref() {
|
|
495
|
+
return this.value;
|
|
496
|
+
}
|
|
497
|
+
}, Bt = typeof WeakRef < "u" ? WeakRef : zt, Gt = 0, ke = 1;
|
|
498
|
+
function Z() {
|
|
499
|
+
return {
|
|
500
|
+
s: Gt,
|
|
501
|
+
v: void 0,
|
|
502
|
+
o: null,
|
|
503
|
+
p: null
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function Xe(n, t = {}) {
|
|
507
|
+
let e = Z();
|
|
508
|
+
const { resultEqualityCheck: r } = t;
|
|
509
|
+
let o, s = 0;
|
|
510
|
+
function a() {
|
|
511
|
+
let u = e;
|
|
512
|
+
const { length: h } = arguments;
|
|
513
|
+
for (let m = 0, g = h; m < g; m++) {
|
|
514
|
+
const l = arguments[m];
|
|
515
|
+
if (typeof l == "function" || typeof l == "object" && l !== null) {
|
|
516
|
+
let d = u.o;
|
|
517
|
+
d === null && (u.o = d = /* @__PURE__ */ new WeakMap());
|
|
518
|
+
const E = d.get(l);
|
|
519
|
+
E === void 0 ? (u = Z(), d.set(l, u)) : u = E;
|
|
520
|
+
} else {
|
|
521
|
+
let d = u.p;
|
|
522
|
+
d === null && (u.p = d = /* @__PURE__ */ new Map());
|
|
523
|
+
const E = d.get(l);
|
|
524
|
+
E === void 0 ? (u = Z(), d.set(l, u)) : u = E;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
const c = u;
|
|
528
|
+
let f;
|
|
529
|
+
if (u.s === ke)
|
|
530
|
+
f = u.v;
|
|
531
|
+
else if (f = n.apply(null, arguments), s++, r) {
|
|
532
|
+
const m = o?.deref?.() ?? o;
|
|
533
|
+
m != null && r(m, f) && (f = m, s !== 0 && s--), o = typeof f == "object" && f !== null || typeof f == "function" ? new Bt(f) : f;
|
|
534
|
+
}
|
|
535
|
+
return c.s = ke, c.v = f, f;
|
|
536
|
+
}
|
|
537
|
+
return a.clearCache = () => {
|
|
538
|
+
e = Z(), a.resetResultsCount();
|
|
539
|
+
}, a.resultsCount = () => s, a.resetResultsCount = () => {
|
|
540
|
+
s = 0;
|
|
541
|
+
}, a;
|
|
542
|
+
}
|
|
543
|
+
function Je(n, ...t) {
|
|
544
|
+
const e = typeof n == "function" ? {
|
|
545
|
+
memoize: n,
|
|
546
|
+
memoizeOptions: t
|
|
547
|
+
} : n, r = (...o) => {
|
|
548
|
+
let s = 0, a = 0, u, h = {}, c = o.pop();
|
|
549
|
+
typeof c == "object" && (h = c, c = o.pop()), Vt(
|
|
550
|
+
c,
|
|
551
|
+
`createSelector expects an output function after the inputs, but received: [${typeof c}]`
|
|
552
|
+
);
|
|
553
|
+
const f = {
|
|
554
|
+
...e,
|
|
555
|
+
...h
|
|
556
|
+
}, {
|
|
557
|
+
memoize: m,
|
|
558
|
+
memoizeOptions: g = [],
|
|
559
|
+
argsMemoize: l = Xe,
|
|
560
|
+
argsMemoizeOptions: d = [],
|
|
561
|
+
devModeChecks: E = {}
|
|
562
|
+
} = f, _ = Ve(g), w = Ve(d), b = At(o), x = m(function() {
|
|
563
|
+
return s++, c.apply(
|
|
564
|
+
null,
|
|
565
|
+
arguments
|
|
566
|
+
);
|
|
567
|
+
}, ..._);
|
|
568
|
+
let T = !0;
|
|
569
|
+
const N = l(function() {
|
|
570
|
+
a++;
|
|
571
|
+
const C = Ne(
|
|
572
|
+
b,
|
|
573
|
+
arguments
|
|
574
|
+
);
|
|
575
|
+
if (u = x.apply(null, C), process.env.NODE_ENV !== "production") {
|
|
576
|
+
const { identityFunctionCheck: R, inputStabilityCheck: A } = Pt(T, E);
|
|
577
|
+
if (R.shouldRun && R.run(
|
|
578
|
+
c,
|
|
579
|
+
C,
|
|
580
|
+
u
|
|
581
|
+
), A.shouldRun) {
|
|
582
|
+
const X = Ne(
|
|
583
|
+
b,
|
|
584
|
+
arguments
|
|
585
|
+
);
|
|
586
|
+
A.run(
|
|
587
|
+
{ inputSelectorResults: C, inputSelectorResultsCopy: X },
|
|
588
|
+
{ memoize: m, memoizeOptions: _ },
|
|
589
|
+
arguments
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
T && (T = !1);
|
|
593
|
+
}
|
|
594
|
+
return u;
|
|
595
|
+
}, ...w);
|
|
596
|
+
return Object.assign(N, {
|
|
597
|
+
resultFunc: c,
|
|
598
|
+
memoizedResultFunc: x,
|
|
599
|
+
dependencies: b,
|
|
600
|
+
dependencyRecomputations: () => a,
|
|
601
|
+
resetDependencyRecomputations: () => {
|
|
602
|
+
a = 0;
|
|
603
|
+
},
|
|
604
|
+
lastResult: () => u,
|
|
605
|
+
recomputations: () => s,
|
|
606
|
+
resetRecomputations: () => {
|
|
607
|
+
s = 0;
|
|
608
|
+
},
|
|
609
|
+
memoize: m,
|
|
610
|
+
argsMemoize: l
|
|
611
|
+
});
|
|
612
|
+
};
|
|
613
|
+
return Object.assign(r, {
|
|
614
|
+
withTypes: () => r
|
|
615
|
+
}), r;
|
|
616
|
+
}
|
|
617
|
+
var Ut = /* @__PURE__ */ Je(Xe), $t = Object.assign(
|
|
618
|
+
(n, t = Ut) => {
|
|
619
|
+
Nt(
|
|
620
|
+
n,
|
|
621
|
+
`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof n}`
|
|
622
|
+
);
|
|
623
|
+
const e = Object.keys(n), r = e.map(
|
|
624
|
+
(s) => n[s]
|
|
625
|
+
);
|
|
626
|
+
return t(
|
|
627
|
+
r,
|
|
628
|
+
(...s) => s.reduce((a, u, h) => (a[e[h]] = u, a), {})
|
|
629
|
+
);
|
|
630
|
+
},
|
|
631
|
+
{ withTypes: () => $t }
|
|
632
|
+
);
|
|
633
|
+
Je({
|
|
634
|
+
memoize: Ht,
|
|
635
|
+
memoizeOptions: {
|
|
636
|
+
maxSize: 1,
|
|
637
|
+
equalityCheck: Object.is
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
const $ = (n, t, e, r, o, s, ...a) => {
|
|
641
|
+
if (a.length > 0)
|
|
642
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Unsupported number of selectors" : Ue(1));
|
|
643
|
+
let u;
|
|
644
|
+
if (n)
|
|
645
|
+
u = n;
|
|
646
|
+
else
|
|
647
|
+
throw new Error("Missing arguments");
|
|
648
|
+
return u;
|
|
649
|
+
};
|
|
650
|
+
var ee = { exports: {} }, he = {};
|
|
651
|
+
var Ae;
|
|
652
|
+
function qt() {
|
|
653
|
+
if (Ae) return he;
|
|
654
|
+
Ae = 1;
|
|
655
|
+
var n = se;
|
|
656
|
+
function t(m, g) {
|
|
657
|
+
return m === g && (m !== 0 || 1 / m === 1 / g) || m !== m && g !== g;
|
|
658
|
+
}
|
|
659
|
+
var e = typeof Object.is == "function" ? Object.is : t, r = n.useState, o = n.useEffect, s = n.useLayoutEffect, a = n.useDebugValue;
|
|
660
|
+
function u(m, g) {
|
|
661
|
+
var l = g(), d = r({ inst: { value: l, getSnapshot: g } }), E = d[0].inst, _ = d[1];
|
|
662
|
+
return s(
|
|
663
|
+
function() {
|
|
664
|
+
E.value = l, E.getSnapshot = g, h(E) && _({ inst: E });
|
|
665
|
+
},
|
|
666
|
+
[m, l, g]
|
|
667
|
+
), o(
|
|
668
|
+
function() {
|
|
669
|
+
return h(E) && _({ inst: E }), m(function() {
|
|
670
|
+
h(E) && _({ inst: E });
|
|
671
|
+
});
|
|
672
|
+
},
|
|
673
|
+
[m]
|
|
674
|
+
), a(l), l;
|
|
675
|
+
}
|
|
676
|
+
function h(m) {
|
|
677
|
+
var g = m.getSnapshot;
|
|
678
|
+
m = m.value;
|
|
679
|
+
try {
|
|
680
|
+
var l = g();
|
|
681
|
+
return !e(m, l);
|
|
682
|
+
} catch {
|
|
683
|
+
return !0;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
function c(m, g) {
|
|
687
|
+
return g();
|
|
688
|
+
}
|
|
689
|
+
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : u;
|
|
690
|
+
return he.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : f, he;
|
|
691
|
+
}
|
|
692
|
+
var me = {};
|
|
693
|
+
var Pe;
|
|
694
|
+
function Yt() {
|
|
695
|
+
return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
696
|
+
function n(l, d) {
|
|
697
|
+
return l === d && (l !== 0 || 1 / l === 1 / d) || l !== l && d !== d;
|
|
698
|
+
}
|
|
699
|
+
function t(l, d) {
|
|
700
|
+
f || o.startTransition === void 0 || (f = !0, console.error(
|
|
701
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
702
|
+
));
|
|
703
|
+
var E = d();
|
|
704
|
+
if (!m) {
|
|
705
|
+
var _ = d();
|
|
706
|
+
s(E, _) || (console.error(
|
|
707
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
708
|
+
), m = !0);
|
|
709
|
+
}
|
|
710
|
+
_ = a({
|
|
711
|
+
inst: { value: E, getSnapshot: d }
|
|
712
|
+
});
|
|
713
|
+
var w = _[0].inst, b = _[1];
|
|
714
|
+
return h(
|
|
715
|
+
function() {
|
|
716
|
+
w.value = E, w.getSnapshot = d, e(w) && b({ inst: w });
|
|
717
|
+
},
|
|
718
|
+
[l, E, d]
|
|
719
|
+
), u(
|
|
720
|
+
function() {
|
|
721
|
+
return e(w) && b({ inst: w }), l(function() {
|
|
722
|
+
e(w) && b({ inst: w });
|
|
723
|
+
});
|
|
724
|
+
},
|
|
725
|
+
[l]
|
|
726
|
+
), c(E), E;
|
|
727
|
+
}
|
|
728
|
+
function e(l) {
|
|
729
|
+
var d = l.getSnapshot;
|
|
730
|
+
l = l.value;
|
|
731
|
+
try {
|
|
732
|
+
var E = d();
|
|
733
|
+
return !s(l, E);
|
|
734
|
+
} catch {
|
|
735
|
+
return !0;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
function r(l, d) {
|
|
739
|
+
return d();
|
|
740
|
+
}
|
|
741
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
742
|
+
var o = se, s = typeof Object.is == "function" ? Object.is : n, a = o.useState, u = o.useEffect, h = o.useLayoutEffect, c = o.useDebugValue, f = !1, m = !1, g = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : t;
|
|
743
|
+
me.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : g, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
744
|
+
})()), me;
|
|
745
|
+
}
|
|
746
|
+
var je;
|
|
747
|
+
function Oe() {
|
|
748
|
+
return je || (je = 1, process.env.NODE_ENV === "production" ? ee.exports = qt() : ee.exports = Yt()), ee.exports;
|
|
749
|
+
}
|
|
750
|
+
var Xt = Oe(), te = { exports: {} }, Ee = {};
|
|
751
|
+
var Ke;
|
|
752
|
+
function Jt() {
|
|
753
|
+
if (Ke) return Ee;
|
|
754
|
+
Ke = 1;
|
|
755
|
+
var n = se, t = Oe();
|
|
756
|
+
function e(c, f) {
|
|
757
|
+
return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
|
|
758
|
+
}
|
|
759
|
+
var r = typeof Object.is == "function" ? Object.is : e, o = t.useSyncExternalStore, s = n.useRef, a = n.useEffect, u = n.useMemo, h = n.useDebugValue;
|
|
760
|
+
return Ee.useSyncExternalStoreWithSelector = function(c, f, m, g, l) {
|
|
761
|
+
var d = s(null);
|
|
762
|
+
if (d.current === null) {
|
|
763
|
+
var E = { hasValue: !1, value: null };
|
|
764
|
+
d.current = E;
|
|
765
|
+
} else E = d.current;
|
|
766
|
+
d = u(
|
|
767
|
+
function() {
|
|
768
|
+
function w(O) {
|
|
769
|
+
if (!b) {
|
|
770
|
+
if (b = !0, x = O, O = g(O), l !== void 0 && E.hasValue) {
|
|
771
|
+
var C = E.value;
|
|
772
|
+
if (l(C, O))
|
|
773
|
+
return T = C;
|
|
774
|
+
}
|
|
775
|
+
return T = O;
|
|
776
|
+
}
|
|
777
|
+
if (C = T, r(x, O)) return C;
|
|
778
|
+
var R = g(O);
|
|
779
|
+
return l !== void 0 && l(C, R) ? (x = O, C) : (x = O, T = R);
|
|
780
|
+
}
|
|
781
|
+
var b = !1, x, T, N = m === void 0 ? null : m;
|
|
782
|
+
return [
|
|
783
|
+
function() {
|
|
784
|
+
return w(f());
|
|
785
|
+
},
|
|
786
|
+
N === null ? void 0 : function() {
|
|
787
|
+
return w(N());
|
|
788
|
+
}
|
|
789
|
+
];
|
|
790
|
+
},
|
|
791
|
+
[f, m, g, l]
|
|
792
|
+
);
|
|
793
|
+
var _ = o(c, d[0], d[1]);
|
|
794
|
+
return a(
|
|
795
|
+
function() {
|
|
796
|
+
E.hasValue = !0, E.value = _;
|
|
797
|
+
},
|
|
798
|
+
[_]
|
|
799
|
+
), h(_), _;
|
|
800
|
+
}, Ee;
|
|
801
|
+
}
|
|
802
|
+
var ge = {};
|
|
803
|
+
var Fe;
|
|
804
|
+
function Qt() {
|
|
805
|
+
return Fe || (Fe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
806
|
+
function n(c, f) {
|
|
807
|
+
return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
|
|
808
|
+
}
|
|
809
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
810
|
+
var t = se, e = Oe(), r = typeof Object.is == "function" ? Object.is : n, o = e.useSyncExternalStore, s = t.useRef, a = t.useEffect, u = t.useMemo, h = t.useDebugValue;
|
|
811
|
+
ge.useSyncExternalStoreWithSelector = function(c, f, m, g, l) {
|
|
812
|
+
var d = s(null);
|
|
813
|
+
if (d.current === null) {
|
|
814
|
+
var E = { hasValue: !1, value: null };
|
|
815
|
+
d.current = E;
|
|
816
|
+
} else E = d.current;
|
|
817
|
+
d = u(
|
|
818
|
+
function() {
|
|
819
|
+
function w(O) {
|
|
820
|
+
if (!b) {
|
|
821
|
+
if (b = !0, x = O, O = g(O), l !== void 0 && E.hasValue) {
|
|
822
|
+
var C = E.value;
|
|
823
|
+
if (l(C, O))
|
|
824
|
+
return T = C;
|
|
825
|
+
}
|
|
826
|
+
return T = O;
|
|
827
|
+
}
|
|
828
|
+
if (C = T, r(x, O))
|
|
829
|
+
return C;
|
|
830
|
+
var R = g(O);
|
|
831
|
+
return l !== void 0 && l(C, R) ? (x = O, C) : (x = O, T = R);
|
|
832
|
+
}
|
|
833
|
+
var b = !1, x, T, N = m === void 0 ? null : m;
|
|
834
|
+
return [
|
|
835
|
+
function() {
|
|
836
|
+
return w(f());
|
|
837
|
+
},
|
|
838
|
+
N === null ? void 0 : function() {
|
|
839
|
+
return w(N());
|
|
840
|
+
}
|
|
841
|
+
];
|
|
842
|
+
},
|
|
843
|
+
[f, m, g, l]
|
|
844
|
+
);
|
|
845
|
+
var _ = o(c, d[0], d[1]);
|
|
846
|
+
return a(
|
|
847
|
+
function() {
|
|
848
|
+
E.hasValue = !0, E.value = _;
|
|
849
|
+
},
|
|
850
|
+
[_]
|
|
851
|
+
), h(_), _;
|
|
852
|
+
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
853
|
+
})()), ge;
|
|
854
|
+
}
|
|
855
|
+
var We;
|
|
856
|
+
function Zt() {
|
|
857
|
+
return We || (We = 1, process.env.NODE_ENV === "production" ? te.exports = Jt() : te.exports = Qt()), te.exports;
|
|
858
|
+
}
|
|
859
|
+
var en = Zt();
|
|
860
|
+
const tn = gt(19), nn = tn ? on : sn;
|
|
861
|
+
function rn(n, t, e, r, o) {
|
|
862
|
+
return nn(n, t, e, r, o);
|
|
863
|
+
}
|
|
864
|
+
function on(n, t, e, r, o) {
|
|
865
|
+
const s = v.useCallback(() => t(n.getSnapshot(), e, r, o), [n, t, e, r, o]);
|
|
866
|
+
return Xt.useSyncExternalStore(n.subscribe, s, s);
|
|
867
|
+
}
|
|
868
|
+
function sn(n, t, e, r, o) {
|
|
869
|
+
return en.useSyncExternalStoreWithSelector(n.subscribe, n.getSnapshot, n.getSnapshot, (s) => t(s, e, r, o));
|
|
870
|
+
}
|
|
871
|
+
class Y {
|
|
872
|
+
/**
|
|
873
|
+
* The current state of the store.
|
|
874
|
+
* This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
|
|
875
|
+
* To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
|
|
876
|
+
* The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
|
|
877
|
+
*
|
|
878
|
+
* Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
|
|
879
|
+
*/
|
|
880
|
+
// Internal state to handle recursive `setState()` calls
|
|
881
|
+
constructor(t) {
|
|
882
|
+
this.state = t, this.listeners = /* @__PURE__ */ new Set(), this.updateTick = 0;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Registers a listener that will be called whenever the store's state changes.
|
|
886
|
+
*
|
|
887
|
+
* @param fn The listener function to be called on state changes.
|
|
888
|
+
* @returns A function to unsubscribe the listener.
|
|
889
|
+
*/
|
|
890
|
+
subscribe = (t) => (this.listeners.add(t), () => {
|
|
891
|
+
this.listeners.delete(t);
|
|
892
|
+
});
|
|
893
|
+
/**
|
|
894
|
+
* Returns the current state of the store.
|
|
895
|
+
*/
|
|
896
|
+
getSnapshot = () => this.state;
|
|
897
|
+
/**
|
|
898
|
+
* Updates the entire store's state and notifies all registered listeners.
|
|
899
|
+
*
|
|
900
|
+
* @param newState The new state to set for the store.
|
|
901
|
+
*/
|
|
902
|
+
setState(t) {
|
|
903
|
+
if (this.state === t)
|
|
904
|
+
return;
|
|
905
|
+
this.state = t, this.updateTick += 1;
|
|
906
|
+
const e = this.updateTick;
|
|
907
|
+
for (const r of this.listeners) {
|
|
908
|
+
if (e !== this.updateTick)
|
|
909
|
+
return;
|
|
910
|
+
r(t);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Merges the provided changes into the current state and notifies listeners if there are changes.
|
|
915
|
+
*
|
|
916
|
+
* @param changes An object containing the changes to apply to the current state.
|
|
917
|
+
*/
|
|
918
|
+
update(t) {
|
|
919
|
+
for (const e in t)
|
|
920
|
+
if (!Object.is(this.state[e], t[e])) {
|
|
921
|
+
Y.prototype.setState.call(this, {
|
|
922
|
+
...this.state,
|
|
923
|
+
...t
|
|
924
|
+
});
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
|
|
930
|
+
*
|
|
931
|
+
* @param key The key in the store's state to update.
|
|
932
|
+
* @param value The new value to set for the specified key.
|
|
933
|
+
*/
|
|
934
|
+
set(t, e) {
|
|
935
|
+
Object.is(this.state[t], e) || Y.prototype.setState.call(this, {
|
|
936
|
+
...this.state,
|
|
937
|
+
[t]: e
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Gives the state a new reference and updates all registered listeners.
|
|
942
|
+
*/
|
|
943
|
+
notifyAll() {
|
|
944
|
+
const t = {
|
|
945
|
+
...this.state
|
|
946
|
+
};
|
|
947
|
+
Y.prototype.setState.call(this, t);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
class cn extends Y {
|
|
951
|
+
/**
|
|
952
|
+
* Creates a new ReactStore instance.
|
|
953
|
+
*
|
|
954
|
+
* @param state Initial state of the store.
|
|
955
|
+
* @param context Non-reactive context values.
|
|
956
|
+
* @param selectors Optional selectors for use with `useState`.
|
|
957
|
+
*/
|
|
958
|
+
constructor(t, e = {}, r) {
|
|
959
|
+
super(t), this.context = e, this.selectors = r;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Non-reactive values such as refs, callbacks, etc.
|
|
963
|
+
*/
|
|
964
|
+
/**
|
|
965
|
+
* Keeps track of which properties are controlled.
|
|
966
|
+
*/
|
|
967
|
+
controlledValues = /* @__PURE__ */ new Map();
|
|
968
|
+
/**
|
|
969
|
+
* Synchronizes a single external value into the store.
|
|
970
|
+
*
|
|
971
|
+
* Note that the while the value in `state` is updated immediately, the value returned
|
|
972
|
+
* by `useState` is updated before the next render (similarly to React's `useState`).
|
|
973
|
+
*/
|
|
974
|
+
useSyncedValue(t, e) {
|
|
975
|
+
v.useDebugValue(t), q(() => {
|
|
976
|
+
this.state[t] !== e && this.set(t, e);
|
|
977
|
+
}, [t, e]);
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Synchronizes a single external value into the store and
|
|
981
|
+
* cleans it up (sets to `undefined`) on unmount.
|
|
982
|
+
*
|
|
983
|
+
* Note that the while the value in `state` is updated immediately, the value returned
|
|
984
|
+
* by `useState` is updated before the next render (similarly to React's `useState`).
|
|
985
|
+
*/
|
|
986
|
+
useSyncedValueWithCleanup(t, e) {
|
|
987
|
+
q(() => (this.state[t] !== e && this.set(t, e), () => {
|
|
988
|
+
this.set(t, void 0);
|
|
989
|
+
}), [t, e]);
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Synchronizes multiple external values into the store.
|
|
993
|
+
*
|
|
994
|
+
* Note that the while the values in `state` are updated immediately, the values returned
|
|
995
|
+
* by `useState` are updated before the next render (similarly to React's `useState`).
|
|
996
|
+
*/
|
|
997
|
+
useSyncedValues(t) {
|
|
998
|
+
if (process.env.NODE_ENV !== "production") {
|
|
999
|
+
v.useDebugValue(t, (s) => Object.keys(s));
|
|
1000
|
+
const r = v.useRef(Object.keys(t)).current, o = Object.keys(t);
|
|
1001
|
+
(r.length !== o.length || r.some((s, a) => s !== o[a])) && console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
|
|
1002
|
+
}
|
|
1003
|
+
const e = Object.values(t);
|
|
1004
|
+
q(() => {
|
|
1005
|
+
this.update(t);
|
|
1006
|
+
}, e);
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key.
|
|
1010
|
+
* - If `controlled` is non-undefined, the key is marked as controlled and the store's
|
|
1011
|
+
* state at `key` is updated to match `controlled`. Local writes to that key are ignored.
|
|
1012
|
+
* - If `controlled` is undefined, the key is marked as uncontrolled. The store's state
|
|
1013
|
+
* is initialized to `defaultValue` on first render and can be updated with local writes.
|
|
1014
|
+
*/
|
|
1015
|
+
useControlledProp(t, e, r) {
|
|
1016
|
+
v.useDebugValue(t);
|
|
1017
|
+
const o = e !== void 0;
|
|
1018
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1019
|
+
const s = this.controlledValues.get(t);
|
|
1020
|
+
s !== void 0 && s !== o && console.error(`A component is changing the ${o ? "" : "un"}controlled state of ${t.toString()} to be ${o ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
|
|
1021
|
+
}
|
|
1022
|
+
this.controlledValues.has(t) || (this.controlledValues.set(t, o), !o && !Object.is(this.state[t], r) && super.setState({
|
|
1023
|
+
...this.state,
|
|
1024
|
+
[t]: r
|
|
1025
|
+
})), q(() => {
|
|
1026
|
+
o && !Object.is(this.state[t], e) && super.setState({
|
|
1027
|
+
...this.state,
|
|
1028
|
+
[t]: e
|
|
1029
|
+
});
|
|
1030
|
+
}, [t, e, r, o]);
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
|
|
1034
|
+
* If the key is controlled (registered via {@link useControlledProp} with a non-undefined value),
|
|
1035
|
+
* the update is ignored and no listeners are notified.
|
|
1036
|
+
*
|
|
1037
|
+
* @param key The state key to update.
|
|
1038
|
+
* @param value The new value to set for the specified key.
|
|
1039
|
+
*/
|
|
1040
|
+
set(t, e) {
|
|
1041
|
+
this.controlledValues.get(t) !== !0 && super.set(t, e);
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Merges the provided changes into the current state and notifies listeners if there are changes.
|
|
1045
|
+
* Controlled keys are filtered out and not updated.
|
|
1046
|
+
*
|
|
1047
|
+
* @param values An object containing the changes to apply to the current state.
|
|
1048
|
+
*/
|
|
1049
|
+
update(t) {
|
|
1050
|
+
const e = {
|
|
1051
|
+
...t
|
|
1052
|
+
};
|
|
1053
|
+
for (const r in e)
|
|
1054
|
+
if (Object.hasOwn(e, r) && this.controlledValues.get(r) === !0) {
|
|
1055
|
+
delete e[r];
|
|
1056
|
+
continue;
|
|
1057
|
+
}
|
|
1058
|
+
super.update(e);
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Updates the entire store's state and notifies all registered listeners.
|
|
1062
|
+
* Controlled keys are left unchanged; only uncontrolled keys from `newState` are applied.
|
|
1063
|
+
*
|
|
1064
|
+
* @param newState The new state to set for the store.
|
|
1065
|
+
*/
|
|
1066
|
+
setState(t) {
|
|
1067
|
+
const e = {
|
|
1068
|
+
...t
|
|
1069
|
+
};
|
|
1070
|
+
for (const r in e)
|
|
1071
|
+
if (Object.hasOwn(e, r) && this.controlledValues.get(r) === !0) {
|
|
1072
|
+
delete e[r];
|
|
1073
|
+
continue;
|
|
1074
|
+
}
|
|
1075
|
+
super.setState({
|
|
1076
|
+
...this.state,
|
|
1077
|
+
...e
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
/** Gets the current value from the store using a selector with the provided key.
|
|
1081
|
+
*
|
|
1082
|
+
* @param key Key of the selector to use.
|
|
1083
|
+
*/
|
|
1084
|
+
select = (t, e, r, o) => {
|
|
1085
|
+
const s = this.selectors[t];
|
|
1086
|
+
return s(this.state, e, r, o);
|
|
1087
|
+
};
|
|
1088
|
+
/**
|
|
1089
|
+
* Returns a value from the store's state using a selector function.
|
|
1090
|
+
* Used to subscribe to specific parts of the state.
|
|
1091
|
+
* This methods causes a rerender whenever the selected state changes.
|
|
1092
|
+
*
|
|
1093
|
+
* @param key Key of the selector to use.
|
|
1094
|
+
*/
|
|
1095
|
+
useState = (t, e, r, o) => {
|
|
1096
|
+
v.useDebugValue(t);
|
|
1097
|
+
const s = this.selectors[t];
|
|
1098
|
+
return rn(this, s, e, r, o);
|
|
1099
|
+
};
|
|
1100
|
+
/**
|
|
1101
|
+
* Wraps a function with `useStableCallback` to ensure it has a stable reference
|
|
1102
|
+
* and assigns it to the context.
|
|
1103
|
+
*
|
|
1104
|
+
* @param key Key of the event callback. Must be a function in the context.
|
|
1105
|
+
* @param fn Function to assign.
|
|
1106
|
+
*/
|
|
1107
|
+
useContextCallback(t, e) {
|
|
1108
|
+
v.useDebugValue(t);
|
|
1109
|
+
const r = L(e ?? yt);
|
|
1110
|
+
this.context[t] = r;
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Returns a stable setter function for a specific key in the store's state.
|
|
1114
|
+
* It's commonly used to pass as a ref callback to React elements.
|
|
1115
|
+
*
|
|
1116
|
+
* @param key Key of the state to set.
|
|
1117
|
+
*/
|
|
1118
|
+
useStateSetter(t) {
|
|
1119
|
+
const e = v.useRef(void 0);
|
|
1120
|
+
return e.current === void 0 && (e.current = (r) => {
|
|
1121
|
+
this.set(t, r);
|
|
1122
|
+
}), e.current;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Observes changes derived from the store's selectors and calls the listener when the selected value changes.
|
|
1126
|
+
*
|
|
1127
|
+
* @param key Key of the selector to observe.
|
|
1128
|
+
* @param listener Listener function called when the selector result changes.
|
|
1129
|
+
*/
|
|
1130
|
+
observe(t, e) {
|
|
1131
|
+
let r;
|
|
1132
|
+
typeof t == "function" ? r = t : r = this.selectors[t];
|
|
1133
|
+
let o = r(this.state);
|
|
1134
|
+
return e(o, o, this), this.subscribe((s) => {
|
|
1135
|
+
const a = r(s);
|
|
1136
|
+
if (!Object.is(o, a)) {
|
|
1137
|
+
const u = o;
|
|
1138
|
+
o = a, e(a, u, this);
|
|
1139
|
+
}
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
const un = {
|
|
1144
|
+
open: $((n) => n.open),
|
|
1145
|
+
domReferenceElement: $((n) => n.domReferenceElement),
|
|
1146
|
+
referenceElement: $((n) => n.positionReference ?? n.referenceElement),
|
|
1147
|
+
floatingElement: $((n) => n.floatingElement),
|
|
1148
|
+
floatingId: $((n) => n.floatingId)
|
|
1149
|
+
};
|
|
1150
|
+
class kn extends cn {
|
|
1151
|
+
constructor(t) {
|
|
1152
|
+
const {
|
|
1153
|
+
nested: e,
|
|
1154
|
+
noEmit: r,
|
|
1155
|
+
onOpenChange: o,
|
|
1156
|
+
triggerElements: s,
|
|
1157
|
+
...a
|
|
1158
|
+
} = t;
|
|
1159
|
+
super({
|
|
1160
|
+
...a,
|
|
1161
|
+
positionReference: a.referenceElement,
|
|
1162
|
+
domReferenceElement: a.referenceElement
|
|
1163
|
+
}, {
|
|
1164
|
+
onOpenChange: o,
|
|
1165
|
+
dataRef: {
|
|
1166
|
+
current: {}
|
|
1167
|
+
},
|
|
1168
|
+
events: $e(),
|
|
1169
|
+
nested: e,
|
|
1170
|
+
noEmit: r,
|
|
1171
|
+
triggerElements: s
|
|
1172
|
+
}, un);
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
|
|
1176
|
+
*
|
|
1177
|
+
* @param newOpen The new open state.
|
|
1178
|
+
* @param eventDetails Details about the event that triggered the open state change.
|
|
1179
|
+
*/
|
|
1180
|
+
setOpen = (t, e) => {
|
|
1181
|
+
if ((!t || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
|
|
1182
|
+
// click events to upgrade a hover-open.
|
|
1183
|
+
bt(e.event)) && (this.context.dataRef.current.openEvent = t ? e.event : void 0), !this.context.noEmit) {
|
|
1184
|
+
const r = {
|
|
1185
|
+
open: t,
|
|
1186
|
+
reason: e.reason,
|
|
1187
|
+
nativeEvent: e.event,
|
|
1188
|
+
nested: this.context.nested,
|
|
1189
|
+
triggerElement: e.trigger
|
|
1190
|
+
};
|
|
1191
|
+
this.context.events.emit("openchange", r);
|
|
1192
|
+
}
|
|
1193
|
+
this.context.onOpenChange?.(t, e);
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
class An {
|
|
1197
|
+
constructor() {
|
|
1198
|
+
this.elements = /* @__PURE__ */ new Set(), this.idMap = /* @__PURE__ */ new Map();
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Adds a trigger element with the given ID.
|
|
1202
|
+
*
|
|
1203
|
+
* Note: The provided element is assumed to not be registered under multiple IDs.
|
|
1204
|
+
*/
|
|
1205
|
+
add(t, e) {
|
|
1206
|
+
const r = this.idMap.get(t);
|
|
1207
|
+
if (r !== e && (r !== void 0 && this.elements.delete(r), this.elements.add(e), this.idMap.set(t, e), process.env.NODE_ENV !== "production" && this.elements.size !== this.idMap.size))
|
|
1208
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap." : Ue(87));
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Removes the trigger element with the given ID.
|
|
1212
|
+
*/
|
|
1213
|
+
delete(t) {
|
|
1214
|
+
const e = this.idMap.get(t);
|
|
1215
|
+
e && (this.elements.delete(e), this.idMap.delete(t));
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Whether the given element is registered as a trigger.
|
|
1219
|
+
*/
|
|
1220
|
+
hasElement(t) {
|
|
1221
|
+
return this.elements.has(t);
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Whether there is a registered trigger element matching the given predicate.
|
|
1225
|
+
*/
|
|
1226
|
+
hasMatchingElement(t) {
|
|
1227
|
+
for (const e of this.elements)
|
|
1228
|
+
if (t(e))
|
|
1229
|
+
return !0;
|
|
1230
|
+
return !1;
|
|
1231
|
+
}
|
|
1232
|
+
getById(t) {
|
|
1233
|
+
return this.idMap.get(t);
|
|
1234
|
+
}
|
|
1235
|
+
entries() {
|
|
1236
|
+
return this.idMap.entries();
|
|
1237
|
+
}
|
|
1238
|
+
get size() {
|
|
1239
|
+
return this.idMap.size;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
function Pn(n = []) {
|
|
1243
|
+
const t = n.map((c) => c?.reference), e = n.map((c) => c?.floating), r = n.map((c) => c?.item), o = n.map((c) => c?.trigger), s = v.useCallback(
|
|
1244
|
+
(c) => ne(c, n, "reference"),
|
|
1245
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1246
|
+
t
|
|
1247
|
+
), a = v.useCallback(
|
|
1248
|
+
(c) => ne(c, n, "floating"),
|
|
1249
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1250
|
+
e
|
|
1251
|
+
), u = v.useCallback(
|
|
1252
|
+
(c) => ne(c, n, "item"),
|
|
1253
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1254
|
+
r
|
|
1255
|
+
), h = v.useCallback(
|
|
1256
|
+
(c) => ne(c, n, "trigger"),
|
|
1257
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1258
|
+
o
|
|
1259
|
+
);
|
|
1260
|
+
return v.useMemo(() => ({
|
|
1261
|
+
getReferenceProps: s,
|
|
1262
|
+
getFloatingProps: a,
|
|
1263
|
+
getItemProps: u,
|
|
1264
|
+
getTriggerProps: h
|
|
1265
|
+
}), [s, a, u, h]);
|
|
1266
|
+
}
|
|
1267
|
+
function ne(n, t, e) {
|
|
1268
|
+
const r = /* @__PURE__ */ new Map(), o = e === "item", s = {};
|
|
1269
|
+
e === "floating" && (s.tabIndex = -1, s[Ct] = "");
|
|
1270
|
+
for (const a in n)
|
|
1271
|
+
o && n && (a === Be || a === Ge) || (s[a] = n[a]);
|
|
1272
|
+
for (let a = 0; a < t.length; a += 1) {
|
|
1273
|
+
let u;
|
|
1274
|
+
const h = t[a]?.[e];
|
|
1275
|
+
typeof h == "function" ? u = n ? h(n) : null : u = h, u && He(s, u, o, r);
|
|
1276
|
+
}
|
|
1277
|
+
return He(s, n, o, r), s;
|
|
1278
|
+
}
|
|
1279
|
+
function He(n, t, e, r) {
|
|
1280
|
+
for (const o in t) {
|
|
1281
|
+
const s = t[o];
|
|
1282
|
+
e && (o === Be || o === Ge) || (o.startsWith("on") ? (r.has(o) || r.set(o, []), typeof s == "function" && (r.get(o)?.push(s), n[o] = (...a) => r.get(o)?.map((u) => u(...a)).find((u) => u !== void 0))) : n[o] = s);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
let _e = (function(n) {
|
|
1286
|
+
return n.open = "data-open", n.closed = "data-closed", n[n.startingStyle = xe.startingStyle] = "startingStyle", n[n.endingStyle = xe.endingStyle] = "endingStyle", n.anchorHidden = "data-anchor-hidden", n;
|
|
1287
|
+
})({}), ye = /* @__PURE__ */ (function(n) {
|
|
1288
|
+
return n.popupOpen = "data-popup-open", n.pressed = "data-pressed", n;
|
|
1289
|
+
})({});
|
|
1290
|
+
const an = {
|
|
1291
|
+
[ye.popupOpen]: ""
|
|
1292
|
+
}, ln = {
|
|
1293
|
+
[ye.popupOpen]: "",
|
|
1294
|
+
[ye.pressed]: ""
|
|
1295
|
+
}, fn = {
|
|
1296
|
+
[_e.open]: ""
|
|
1297
|
+
}, dn = {
|
|
1298
|
+
[_e.closed]: ""
|
|
1299
|
+
}, pn = {
|
|
1300
|
+
[_e.anchorHidden]: ""
|
|
1301
|
+
}, jn = {
|
|
1302
|
+
open(n) {
|
|
1303
|
+
return n ? an : null;
|
|
1304
|
+
}
|
|
1305
|
+
}, Kn = {
|
|
1306
|
+
open(n) {
|
|
1307
|
+
return n ? ln : null;
|
|
1308
|
+
}
|
|
1309
|
+
}, Fn = {
|
|
1310
|
+
open(n) {
|
|
1311
|
+
return n ? fn : dn;
|
|
1312
|
+
},
|
|
1313
|
+
anchorHidden(n) {
|
|
1314
|
+
return n ? pn : null;
|
|
1315
|
+
}
|
|
1316
|
+
}, hn = "_transition_opacity_18csa_1", mn = "_transition_scale_18csa_19", Wn = {
|
|
1317
|
+
transition_opacity: hn,
|
|
1318
|
+
"transition_fade-out": "_transition_fade-out_18csa_11",
|
|
1319
|
+
transition_scale: mn
|
|
1320
|
+
};
|
|
1321
|
+
export {
|
|
1322
|
+
_e as C,
|
|
1323
|
+
kn as F,
|
|
1324
|
+
An as P,
|
|
1325
|
+
cn as R,
|
|
1326
|
+
Y as S,
|
|
1327
|
+
Ye as a,
|
|
1328
|
+
Mn as b,
|
|
1329
|
+
$ as c,
|
|
1330
|
+
Nn as d,
|
|
1331
|
+
Pn as e,
|
|
1332
|
+
jn as f,
|
|
1333
|
+
re as g,
|
|
1334
|
+
Vn as h,
|
|
1335
|
+
Kn as i,
|
|
1336
|
+
Dn as j,
|
|
1337
|
+
xn as k,
|
|
1338
|
+
rn as l,
|
|
1339
|
+
wt as m,
|
|
1340
|
+
Fn as p,
|
|
1341
|
+
Wn as t,
|
|
1342
|
+
qe as u
|
|
1343
|
+
};
|