@m4l/components 0.2.1 → 0.2.2
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/@types/export.d.ts +9 -17
- package/assets/Logo.d.ts +1 -2
- package/{commonjs.333e55c7.js → commonjs.565e6834.js} +0 -5
- package/components/AccountPopover/AccountPopover.d.ts +1 -2
- package/components/AccountPopover/{index.e39dc794.js → index.37803642.js} +4 -2
- package/components/AccountPopover/index.d.ts +0 -1
- package/components/AccountPopover/subcomponents/MyAvatar/index.d.ts +1 -2
- package/components/AccountPopover/subcomponents/PopOver/index.d.ts +1 -2
- package/components/AppBar/AppBar.d.ts +1 -26
- package/components/AppBar/classes/index.d.ts +0 -2
- package/components/AppBar/classes/types.d.ts +0 -2
- package/components/AppBar/{index.7b592977.js → index.d17827eb.js} +5 -26
- package/components/AppBar/types.d.ts +0 -14
- package/components/CommonActions/components/ActionCancel/{index.bec75bdf.js → index.6aa59730.js} +2 -2
- package/components/CommonActions/components/ActionCancel/index.d.ts +2 -3
- package/components/CommonActions/components/ActionFormCancel/index.d.ts +1 -2
- package/components/CommonActions/components/ActionFormCancel/{index.9c6a2013.js → index.e6ac3a19.js} +14 -5
- package/components/CommonActions/components/ActionFormIntro/index.d.ts +1 -2
- package/components/CommonActions/components/ActionFormIntro/{index.99f2f1cf.js → index.ebadee33.js} +2 -2
- package/components/CommonActions/components/ActionIntro/{index.e0150cfc.js → index.33acdebb.js} +2 -2
- package/components/CommonActions/components/ActionIntro/index.d.ts +2 -3
- package/components/CommonActions/components/Actions/index.d.ts +1 -2
- package/components/CommonActions/components/Actions/{index.2f6286eb.js → index.f358ae72.js} +1 -1
- package/components/DataGrid/constants.d.ts +2 -0
- package/components/DataGrid/contexts/DataGridContext/index.d.ts +3 -2
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +2 -2
- package/components/DataGrid/contexts/FilterContext/index.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.d.ts +6 -0
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/types.d.ts +2 -0
- package/components/DataGrid/formatters/columnBooleanFormatter/index.d.ts +1 -2
- package/components/DataGrid/formatters/columnConcatenatedValueFormatter/index.d.ts +1 -2
- package/components/DataGrid/formatters/columnDateFormatter/index.d.ts +1 -2
- package/components/DataGrid/formatters/columnNestedValueFormatter/index.d.ts +1 -2
- package/components/DataGrid/formatters/columnPointsFormatter/{index.a19b7b90.js → index.5e645334.js} +1 -1
- package/components/DataGrid/formatters/columnPointsFormatter/index.d.ts +1 -2
- package/components/DataGrid/formatters/columnPriceFormatter/index.d.ts +1 -2
- package/components/DataGrid/formatters/columnUncertaintyFormatter/index.d.ts +1 -2
- package/components/DataGrid/index.d.ts +2 -3
- package/components/DataGrid/{index.d5559a4d.js → index.e93a1a31.js} +49 -20
- package/components/DataGrid/subcomponents/Actions/{index.83e2be51.js → index.bcf7a8d7.js} +15 -35
- package/components/DataGrid/subcomponents/Actions/index.d.ts +1 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/Density/index.d.ts +1 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/index.d.ts +1 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/RowsCount/index.d.ts +1 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/index.d.ts +1 -2
- package/components/DataGrid/subcomponents/Table/index.d.ts +2 -3
- package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.d.ts +13 -14
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/index.d.ts +1 -2
- package/components/DataGrid/types.d.ts +8 -11
- package/components/DraggableWindow/index.d.ts +1 -2
- package/components/DraggableWindow/{index.f9f067bd.js → index.ddc7327b.js} +1 -1
- package/components/DynamicFilter/DynamicFilter.d.ts +1 -2
- package/components/DynamicFilter/classes/index.d.ts +1 -1
- package/components/DynamicFilter/classes/types.d.ts +0 -1
- package/components/DynamicFilter/contexts/DynamicFilterContext/index.d.ts +1 -1
- package/components/DynamicFilter/{index.e275fed2.js → index.6663cc83.js} +14 -18
- package/components/DynamicFilter/subcomponents/ApplyedFilters/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/ApplyedFilters/subcomponents/ApplyedFilter/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/ClearFilters/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/FilterButton/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/InnerForHooks/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/InputFilter/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/PopoverFilter/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/fieldstypes/BooleanFilter/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/fieldstypes/DateTimeFilter/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/fieldstypes/NumberFilter/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/fieldstypes/StringFilter/index.d.ts +1 -2
- package/components/DynamicFilter/subcomponents/fieldstypes/factory.d.ts +1 -2
- package/components/GridLayout/{index.e8c04242.js → index.c26989d8.js} +2 -2
- package/components/GridLayout/subcomponents/{GridItem → Griditem}/index.d.ts +1 -1
- package/components/GridLayout/subcomponents/Griditem/{index.4d38f12e.js → index.da0a3c47.js} +3 -3
- package/components/GridLayout/subcomponents/Responsive/{index.e25df1dc.js → index.2e641db2.js} +1 -1
- package/components/GridLayout/subcomponents/Responsive/index.d.ts +1 -2
- package/components/GridLayout/subcomponents/WidthProvider/index.d.ts +1 -1
- package/components/HelmetPage/index.d.ts +1 -2
- package/components/HelperText/index.d.ts +1 -2
- package/components/Icon/Icon.d.ts +1 -2
- package/components/Icon/index.6db034b5.js +147 -0
- package/components/Icon/types.d.ts +0 -1
- package/components/Image/Image.d.ts +1 -2
- package/components/Image/{index.bb1670e5.js → index.2a2e0b27.js} +4 -46
- package/components/Image/subcomponents/LazyLoadComponent/index.d.ts +1 -2
- package/components/Image/subcomponents/Skeleton/index.d.ts +1 -2
- package/components/Image/types.d.ts +2 -2
- package/components/LanguagePopover/LanguagePopover.d.ts +1 -2
- package/components/LanguagePopover/{index.6ff9df10.js → index.ff7c862e.js} +2 -2
- package/components/LinearProgressIndeterminate/LinearProgressIndeterminate.d.ts +1 -2
- package/components/LinearProgressIndeterminate/{index.a0ad2d9e.js → index.7f4ed9b7.js} +1 -1
- package/components/Loadable/index.d.ts +1 -1
- package/components/LoadingError/LoadingError.d.ts +1 -2
- package/components/LoadingError/{index.33ab5063.js → index.0ac9e74d.js} +3 -3
- package/components/MFLoader/MFLoader.d.ts +1 -2
- package/components/MFLoader/{index.ad3b304a.js → index.cd087354.js} +1 -1
- package/components/MFLoader/subcomponents/ProggessLoadingMF/index.d.ts +1 -2
- package/components/ModalDialog/{index.89e26413.js → index.8c4fde10.js} +4 -4
- package/components/NavLink/NavLink.d.ts +1 -2
- package/components/NoItemSelected/{index.f20bbfb3.js → index.afc12ed9.js} +1 -1
- package/components/NoItemSelected/index.d.ts +1 -2
- package/components/ObjectLogs/components/DetailDialog/index.d.ts +1 -2
- package/components/ObjectLogs/components/DetailFormatter/index.d.ts +1 -2
- package/components/ObjectLogs/{index.ce1b4f13.js → index.cb303905.js} +7 -7
- package/components/ObjectLogs/index.d.ts +1 -2
- package/components/Page/{index.6dd70d4c.js → index.190e2356.js} +1 -1
- package/components/PaperForm/PaperForm.d.ts +1 -2
- package/components/PaperForm/components/Header.d.ts +1 -2
- package/components/PaperForm/{index.725aee55.js → index.7a206d69.js} +1 -1
- package/components/Period/Period.d.ts +1 -2
- package/components/Period/{index.b2c8b4f7.js → index.906f1ce2.js} +2 -2
- package/components/PrintingSystem/{index.89c4d0f9.js → index.bbf52442.js} +43 -15
- package/components/PrintingSystem/subcomponents/BodyNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/BodyNode/{index.d1f4b0f6.js → index.ee81edc5.js} +1 -1
- package/components/PrintingSystem/subcomponents/ChartNode/{index.6744122f.js → index.b56666cf.js} +4 -4
- package/components/PrintingSystem/subcomponents/ChartNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/DividerNode/{index.782756f8.js → index.ca3332b1.js} +1 -1
- package/components/PrintingSystem/subcomponents/DividerNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/FooterNode/{index.9feec47b.js → index.932c3e33.js} +1 -1
- package/components/PrintingSystem/subcomponents/FooterNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/GridNode/{index.8568b2bc.js → index.16748040.js} +4 -4
- package/components/PrintingSystem/subcomponents/GridNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/HeaderNode/{index.07d6e7f0.js → index.0ddbbbad.js} +1 -1
- package/components/PrintingSystem/subcomponents/HeaderNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/ImageNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/PageNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/Pager/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/PaperNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/PaperNode/{index.615ce7d3.js → index.efd9af2f.js} +4 -4
- package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.e239fdf3.js → index.75ed9752.js} +1 -1
- package/components/PrintingSystem/subcomponents/PropertyValueNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/SectionNode/{index.2f445506.js → index.68cac21a.js} +1 -1
- package/components/PrintingSystem/subcomponents/SectionNode/index.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/TextBoxNode/{index.828bc8fe.js → index.91ba514f.js} +3 -3
- package/components/PrintingSystem/subcomponents/TextBoxNode/index.d.ts +1 -2
- package/components/PrintingSystem/types.d.ts +1 -10
- package/components/PrintingSystem/utils/FactoryRender/index.d.ts +1 -2
- package/components/PrintingSystem/utils/PageRender/index.d.ts +1 -2
- package/components/PrintingSystem/utils/getEvalValue/index.d.ts +1 -0
- package/components/PropertyValue/PropertyValue.d.ts +1 -2
- package/components/PropertyValue/classes/index.d.ts +1 -1
- package/components/PropertyValue/classes/types.d.ts +1 -4
- package/components/PropertyValue/index.a36c1223.js +220 -0
- package/components/PropertyValue/skeleton.d.ts +2 -0
- package/components/PropertyValue/types.d.ts +7 -5
- package/components/Resizeable/{index.6478d7d8.js → index.383eb1aa.js} +1 -1
- package/components/ResizeableWindow/index.d.ts +1 -2
- package/components/ScrollBar/{index.010f1b9d.js → index.65bb2930.js} +1 -5
- package/components/ScrollBar/index.d.ts +1 -1
- package/components/SideBar/SideBar.d.ts +1 -2
- package/components/SideBar/classes/index.d.ts +1 -1
- package/components/SideBar/context/sideBarContext/index.d.ts +1 -1
- package/components/SideBar/{index.54b616c6.js → index.7e4a79a6.js} +12 -12
- package/components/SideBar/subcomponents/ContentDesktop/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentDesktop/subcomponents/CollapseButton/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/ArrowIcon/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/subcomponents/NavItemRootContent/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/subcomponents/NavItemSub/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/subcomponents/NavItemSub/subcomponents/NavItemSubContent/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/Skeleton/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentMobile/index.d.ts +1 -2
- package/components/SideBar/subcomponents/ContentMobile/subcomponents/Drawer.d.ts +1 -2
- package/components/SideBar/types.d.ts +3 -3
- package/components/SplitLayout/SplitLayout.d.ts +1 -2
- package/components/SplitLayout/{index.30fd5861.js → index.9ef430f6.js} +1 -1
- package/components/animate/AnimatedScroll/animatedScroll.d.ts +1 -2
- package/components/animate/LoadingScreen/index.d.ts +1 -2
- package/components/animate/MotionContainer/index.d.ts +1 -2
- package/components/animate/MotionLazyContainer/index.d.ts +1 -1
- package/components/animate/PropagateLoader/index.d.ts +1 -2
- package/components/areas/components/AreasAdmin/{index.2b98920f.js → index.74532c2a.js} +12 -12
- package/components/areas/components/AreasAdmin/index.d.ts +1 -2
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/index.d.ts +1 -2
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/subcomponents/ChipActionsMobile/index.d.ts +1 -2
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/index.d.ts +1 -2
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.d.ts +1 -2
- package/components/areas/components/AreasAdmin/subcomponents/PanelWindowPopUp/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/{index.7bc64011.js → index.3cd1a452.js} +15 -15
- package/components/areas/components/AreasViewer/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/InnerForHooks/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/index.d.ts +2 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/index.d.ts +2 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/skeleton.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/MainActions/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/WindowPopUpsList/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/index.d.ts +2 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Toasties/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Toasties/subcomponents/Toasty/index.d.ts +1 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/WindowModal/index.d.ts +2 -2
- package/components/areas/contexts/AreasContext/{index.70716452.js → index.55981647.js} +4 -4
- package/components/areas/contexts/AreasContext/index.d.ts +1 -1
- package/components/areas/contexts/DynamicMFParmsContext/index.d.ts +1 -1
- package/components/areas/contexts/WindowToolsMFContext/index.d.ts +1 -1
- package/components/areas/hooks/useAreas/{index.8426db7f.js → index.5cbbe91c.js} +1 -1
- package/components/formatters/BooleanFormatter/{index.22761b39.js → index.5379222a.js} +2 -2
- package/components/formatters/BooleanFormatter/index.d.ts +1 -2
- package/components/formatters/DateFormatter/index.d.ts +1 -2
- package/components/formatters/FormatterRoot/index.d.ts +1 -2
- package/components/formatters/PointsFormatter/{index.5c94c5e8.js → index.80a4e414.js} +2 -2
- package/components/formatters/PointsFormatter/index.d.ts +2 -3
- package/components/formatters/PriceFormatter/index.d.ts +1 -2
- package/components/formatters/UncertaintyFormatter/index.d.ts +1 -2
- package/components/formatters/{index.5c788afa.js → index.d0a0800d.js} +1 -1
- package/components/hook-form/HelperError/index.66bbcac3.js +30 -0
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.d.ts +1 -2
- package/components/hook-form/RHFAutocomplete/classes/types.d.ts +0 -2
- package/components/hook-form/RHFAutocomplete/{index.f7145ff4.js → index.09ff3d84.js} +35 -26
- package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/index.d.ts +1 -1
- package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/index.d.ts +1 -2
- package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/types.d.ts +2 -1
- package/components/hook-form/RHFAutocomplete/types.d.ts +3 -8
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.d.ts +1 -2
- package/components/hook-form/RHFAutocompleteAsync/{index.11572063.js → index.54b4dca3.js} +1 -1
- package/components/hook-form/RHFCheckbox/RHFCheckbox.d.ts +1 -2
- package/components/hook-form/RHFColorPicker/index.d.ts +1 -8
- package/components/hook-form/RHFColorPicker/types.d.ts +0 -5
- package/components/hook-form/RHFDateTime/RHFDateTime.d.ts +1 -2
- package/components/hook-form/RHFDateTime/{index.30d6deb9.js → index.2b76899e.js} +1 -1
- package/components/hook-form/RHFDateTime/subcomponents/Skeleton/index.d.ts +1 -2
- package/components/hook-form/RHFDateTime/types.d.ts +1 -0
- package/components/hook-form/RHFHelperError/index.d.ts +4 -0
- package/components/hook-form/RHFMultiCheckbox/index.d.ts +1 -2
- package/components/hook-form/RHFPeriod/index.d.ts +1 -2
- package/components/hook-form/RHFPeriod/{index.8fdd9f5d.js → index.d6c8587a.js} +1 -1
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.d.ts +3 -0
- package/components/hook-form/RHFRadioGroup/{index.b3335e13.js → index.7deb4e48.js} +5 -3
- package/components/hook-form/RHFRadioGroup/index.d.ts +2 -0
- package/components/hook-form/RHFRadioGroup/types.d.ts +8 -0
- package/components/hook-form/RHFSelect.d.ts +1 -2
- package/components/hook-form/RHFTextField/{index.2f73c117.js → index.f546c18a.js} +2 -2
- package/components/hook-form/RHFTextField/subcomponents/Skeleton/index.d.ts +1 -2
- package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.d.ts +1 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.d.ts +1 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/index.d.ts +1 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/subcomponents/Skeleton/index.d.ts +1 -2
- package/components/hook-form/RHFUpload/{index.a69afe7e.js → index.a5621247.js} +4 -4
- package/components/hook-form/index.d.ts +2 -2
- package/components/index.d.ts +1 -2
- package/components/maps/GpsTools.34a27c0a.js +2312 -0
- package/components/maps/Map.9fc17398.js +474 -0
- package/components/maps/components/GpsTools/GpsTools.d.ts +1 -0
- package/components/maps/components/GpsTools/classes/index.d.ts +4 -0
- package/components/maps/components/GpsTools/classes/types.d.ts +20 -0
- package/components/maps/components/GpsTools/constants.d.ts +8 -0
- package/components/maps/components/GpsTools/contexts/GpsToolsContext/index.d.ts +19 -0
- package/components/maps/components/GpsTools/contexts/GpsToolsContext/store.d.ts +16 -0
- package/components/maps/components/GpsTools/contexts/GpsToolsContext/types.d.ts +173 -0
- package/components/maps/components/GpsTools/dictionary.d.ts +64 -0
- package/components/maps/components/GpsTools/hooks/useLayers/index.d.ts +1 -0
- package/components/maps/components/GpsTools/hooks/useMapTools/index.d.ts +2 -0
- package/components/maps/components/GpsTools/icons.d.ts +15 -0
- package/components/maps/components/GpsTools/index.d.ts +2 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/index.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/constants.d.ts +7 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/hooks/useCheckedFeatures.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/hooks/useCheckedGeofences.d.ts +4 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/hooks/useColumns.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/hooks/useMaster.d.ts +20 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/model.d.ts +122 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/ColumnSetCheckFormatter/index.d.ts +8 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/ColumnSetCheckFormatter/types.d.ts +5 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/constants.d.ts +20 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/helpers.d.ts +7 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts +11 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useSubmit.d.ts +8 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useSumbitErrorsFocus.d.ts +5 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useValidation.d.ts +22 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/types.d.ts +6 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/validations.d.ts +5 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/types.d.ts +7 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/validations.d.ts +6 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/MyTabs/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/StyleData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/StyleData/subcomponents/FillData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/StyleData/subcomponents/StrokeData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/StyleData/types.d.ts +10 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/types.d.ts +25 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/subcomponents/Filter/index.d.ts +7 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/PolylineWithArrows/index.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/constants.d.ts +30 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/hooks/useMeasure.d.ts +31 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/hooks/useValidation.d.ts +10 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/subcomponents/MeasureData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/subcomponents/MeasureData/types.d.ts +6 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/subcomponents/MeasureData/validations.d.ts +2 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/subcomponents/MyActions/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/types.d.ts +9 -0
- package/components/maps/components/GpsTools/types.d.ts +34 -0
- package/components/maps/components/Map/Map.d.ts +2 -0
- package/components/maps/components/Map/classes/index.d.ts +5 -0
- package/components/maps/components/Map/classes/types.d.ts +19 -0
- package/components/maps/components/Map/constants.d.ts +10 -0
- package/components/maps/components/Map/contexts/MapContext/MapContext.d.ts +19 -0
- package/components/maps/components/Map/contexts/MapContext/helper.d.ts +8 -0
- package/components/maps/components/Map/contexts/MapContext/index.d.ts +2 -0
- package/components/maps/components/Map/contexts/MapContext/store.d.ts +16 -0
- package/components/maps/components/Map/contexts/MapContext/types.d.ts +354 -0
- package/components/maps/components/Map/hooks/useMapStore/index.d.ts +3 -0
- package/components/maps/components/Map/index.d.ts +5 -0
- package/components/maps/components/Map/subcomponents/LayersContainer/index.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/LeafletLayer/index.d.ts +3 -0
- package/components/maps/components/Map/subcomponents/LeafletLayer/types.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/MainTools/index.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/MainTools/types.d.ts +5 -0
- package/components/maps/components/Map/types.d.ts +28 -0
- package/components/maps/index.7057e217.js +1 -0
- package/components/maps/index.d.ts +3 -0
- package/components/maps/leaflet-geoman.d.ts +1633 -0
- package/components/maps/leaflet.d.ts +29 -0
- package/components/modal/ModalDialog/index.d.ts +1 -2
- package/components/modal/WindowBase/index.d.ts +1 -2
- package/components/modal/WindowBase/subcomponents/Header/index.d.ts +1 -2
- package/components/modal/{WindowBase.444849a3.js → WindowBase.38d4b8e7.js} +3 -3
- package/components/modal/WindowConfirm/index.d.ts +1 -2
- package/components/modal/WindowConfirm/subcomponents/MessageIlustration/index.d.ts +1 -2
- package/components/modal/{WindowConfirm.66c99957.js → WindowConfirm.cd776fe5.js} +6 -6
- package/components/mui_extended/Accordion/Accordion.d.ts +1 -2
- package/components/mui_extended/Accordion/{index.c628e883.js → index.5b4b2075.js} +3 -3
- package/components/mui_extended/Avatar/subcomponents/SkeletonAvatar/index.d.ts +1 -2
- package/components/mui_extended/Badge/Badge.d.ts +1 -2
- package/components/mui_extended/BoxIcon/index.d.ts +1 -2
- package/components/mui_extended/Breadcrumbs/components/LinkItem/index.d.ts +1 -2
- package/components/mui_extended/Breadcrumbs/index.d.ts +1 -2
- package/components/mui_extended/Button/Button.d.ts +4 -3
- package/components/mui_extended/Button/classes/types.d.ts +3 -2
- package/components/mui_extended/Button/{index.56e7522c.js → index.fc5132fa.js} +9 -6
- package/components/mui_extended/Button/types.d.ts +3 -3
- package/components/mui_extended/CheckBox/subcomponents/Skeleton/index.d.ts +1 -2
- package/components/mui_extended/CircularProgress/index.d.ts +1 -2
- package/components/mui_extended/IconButton/IconButton.d.ts +1 -2
- package/components/mui_extended/IconButton/classes/index.d.ts +1 -1
- package/components/mui_extended/IconButton/classes/types.d.ts +3 -0
- package/components/mui_extended/IconButton/{index.f42fa68d.js → index.df52ae90.js} +7 -4
- package/components/mui_extended/IconButton/subcomponents/SkeletonIconButton/index.d.ts +1 -2
- package/components/mui_extended/ImageButton/ImageButton.d.ts +1 -2
- package/components/mui_extended/LinearProgress/index.d.ts +1 -2
- package/components/mui_extended/LinkWithRoute/index.d.ts +1 -2
- package/components/mui_extended/LoadingButton/classes/constants.d.ts +1 -1
- package/components/mui_extended/LoadingButton/index.d.ts +1 -2
- package/components/mui_extended/MenuActions/{index.e146c11b.js → index.04d87c36.js} +2 -2
- package/components/mui_extended/MenuActions/index.d.ts +1 -1
- package/components/mui_extended/Pager/{index.9f0a2757.js → index.c6990cd4.js} +1 -1
- package/components/mui_extended/Pager/index.d.ts +1 -2
- package/components/mui_extended/Pager/subcomponents/CustomTablePagination/index.d.ts +1 -2
- package/components/mui_extended/Pager/subcomponents/PagerActions/index.d.ts +1 -2
- package/components/mui_extended/Popover/Popover.d.ts +1 -2
- package/components/mui_extended/Stack/Stack.d.ts +1 -2
- package/components/mui_extended/Tab/{index.7bdd1260.js → index.53203047.js} +27 -5
- package/components/mui_extended/Tab/index.d.ts +1 -2
- package/components/mui_extended/TabContent/TabContent.d.ts +1 -2
- package/components/mui_extended/TabContent/types.d.ts +1 -0
- package/components/mui_extended/TabContext/index.d.ts +5 -0
- package/components/mui_extended/TabContext/types.d.ts +9 -0
- package/components/mui_extended/Tabs/Tabs.d.ts +1 -2
- package/components/mui_extended/ToggleButton/ToggleButton.d.ts +1 -0
- package/components/mui_extended/ToggleButton/index.4b7b7df0.js +22 -0
- package/components/mui_extended/ToggleButton/index.d.ts +2 -0
- package/components/mui_extended/ToggleButton/types.d.ts +4 -0
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.d.ts +13 -0
- package/components/mui_extended/ToggleIconButton/index.d.ts +2 -0
- package/components/mui_extended/ToggleIconButton/index.e430bed4.js +29 -0
- package/components/mui_extended/ToggleIconButton/types.d.ts +5 -0
- package/components/mui_extended/Tooltip/Tooltip.d.ts +1 -2
- package/components/mui_extended/Typography/Typography.d.ts +1 -2
- package/components/mui_extended/Typography/subcomponents/index.d.ts +1 -2
- package/components/mui_extended/index.d.ts +3 -0
- package/contexts/ModalContext/{index.b39d303d.js → index.aa3bd23f.js} +1 -1
- package/contexts/ModalContext/index.d.ts +1 -1
- package/contexts/RHFormContext/{index.1755b324.js → index.7769076a.js} +4 -2
- package/contexts/RHFormContext/index.d.ts +1 -2
- package/contexts/RHFormContext/types.d.ts +1 -0
- package/hocs/withToggle/index.d.ts +11 -0
- package/hocs/withToggle/index.e44eb0da.js +24 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/useFormAddEdit/{index.8dcf7d45.js → index.59c74cbf.js} +15 -7
- package/hooks/useFormAddEdit/index.d.ts +3 -2
- package/hooks/useFormAddEdit/types.d.ts +8 -4
- package/hooks/useFormReadyForUpdate/index.d.ts +6 -0
- package/hooks/useFormReadyForUpdate/index.f60f500e.js +20 -0
- package/hooks/useModal/{index.abdc0962.js → index.b4b84d5d.js} +1 -1
- package/hooks/useTab/index.6ab00d5a.js +12 -0
- package/hooks/useTab/index.d.ts +3 -0
- package/index.js +132 -119
- package/node_modules.f907e6dd.js +4736 -0
- package/package.json +8 -5
- package/{react-data-grid.d46d625e.js → react-data-grid.c5377916.js} +1 -2
- package/{react-draggable.ee21cb7e.js → react-draggable.cdce362f.js} +4 -4
- package/{react-json-view.5636414a.js → react-json-view.57125fcf.js} +1 -1
- package/{react-resizable.ee028152.js → react-resizable.806822ee.js} +5 -5
- package/{react-splitter-layout.c5d98bf7.js → react-splitter-layout.8b1655c8.js} +3 -3
- package/utils/{index.de903261.js → index.b22c4c1a.js} +32 -0
- package/utils/types.d.ts +6 -0
- package/vendor.caaaf054.js +168 -0
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/subcomponents/FormatterColumn/index.d.ts +0 -4
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/subcomponents/FormatterColumn/types.d.ts +0 -3
- package/components/Icon/index.3e559a61.js +0 -248
- package/components/PDFViewer/PDFViewer.d.ts +0 -3
- package/components/PDFViewer/classes/constants.d.ts +0 -1
- package/components/PDFViewer/classes/index.d.ts +0 -7
- package/components/PDFViewer/classes/types.d.ts +0 -7
- package/components/PDFViewer/index.52f45734.js +0 -63
- package/components/PDFViewer/index.d.ts +0 -1
- package/components/PDFViewer/types.d.ts +0 -3
- package/components/PrintingSystem/subcomponents/QRImageNode/index.d.ts +0 -3
- package/components/PrintingSystem/subcomponents/QRImageNode/types.d.ts +0 -3
- package/components/PropertyValue/index.45c0a6bf.js +0 -206
- package/components/ToastContainer/ToastContainer.d.ts +0 -3
- package/components/ToastContainer/classes/constants.d.ts +0 -1
- package/components/ToastContainer/classes/index.d.ts +0 -8
- package/components/ToastContainer/classes/types.d.ts +0 -9
- package/components/ToastContainer/index.d.ts +0 -2
- package/components/ToastContainer/index.ef20959a.js +0 -87
- package/components/ToastContainer/subcomponents/ToastMessage/index.d.ts +0 -3
- package/components/ToastContainer/subcomponents/ToastMessage/types.d.ts +0 -5
- package/components/ToastContainer/types.d.ts +0 -4
- package/components/hook-form/RHFColorPicker/classes/constants.d.ts +0 -1
- package/components/hook-form/RHFColorPicker/classes/index.d.ts +0 -11
- package/components/hook-form/RHFColorPicker/classes/types.d.ts +0 -11
- package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/indext.d.ts +0 -2
- package/components/hook-form/RHFRadioGroup.d.ts +0 -9
- package/node_modules.9cedcf1f.js +0 -6921
- package/vendor.f577fced.js +0 -250
- /package/components/GridLayout/subcomponents/{GridItem → Griditem}/types.d.ts +0 -0
|
@@ -0,0 +1,4736 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import React__default, { useRef, useMemo, useEffect, useState, useCallback, useLayoutEffect, forwardRef, useContext } from "react";
|
|
3
|
+
import { a as getRegisteredStyles, r as registerStyles, b as insertStyles } from "./utils/index.b22c4c1a.js";
|
|
4
|
+
import isUndefined$1$1 from "lodash/isUndefined";
|
|
5
|
+
import isObject$1 from "lodash/isObject";
|
|
6
|
+
import get$1 from "lodash/get";
|
|
7
|
+
function u$1() {
|
|
8
|
+
return (u$1 = Object.assign || function(e) {
|
|
9
|
+
for (var r2 = 1; r2 < arguments.length; r2++) {
|
|
10
|
+
var t2 = arguments[r2];
|
|
11
|
+
for (var n2 in t2)
|
|
12
|
+
Object.prototype.hasOwnProperty.call(t2, n2) && (e[n2] = t2[n2]);
|
|
13
|
+
}
|
|
14
|
+
return e;
|
|
15
|
+
}).apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
function c$1(e, r2) {
|
|
18
|
+
if (null == e)
|
|
19
|
+
return {};
|
|
20
|
+
var t2, n2, o2 = {}, a2 = Object.keys(e);
|
|
21
|
+
for (n2 = 0; n2 < a2.length; n2++)
|
|
22
|
+
r2.indexOf(t2 = a2[n2]) >= 0 || (o2[t2] = e[t2]);
|
|
23
|
+
return o2;
|
|
24
|
+
}
|
|
25
|
+
function i$2(e) {
|
|
26
|
+
var t2 = useRef(e), n2 = useRef(function(e2) {
|
|
27
|
+
t2.current && t2.current(e2);
|
|
28
|
+
});
|
|
29
|
+
return t2.current = e, n2.current;
|
|
30
|
+
}
|
|
31
|
+
var s$2 = function(e, r2, t2) {
|
|
32
|
+
return void 0 === r2 && (r2 = 0), void 0 === t2 && (t2 = 1), e > t2 ? t2 : e < r2 ? r2 : e;
|
|
33
|
+
}, f$1 = function(e) {
|
|
34
|
+
return "touches" in e;
|
|
35
|
+
}, v$1 = function(e) {
|
|
36
|
+
return e && e.ownerDocument.defaultView || self;
|
|
37
|
+
}, d$1 = function(e, r2, t2) {
|
|
38
|
+
var n2 = e.getBoundingClientRect(), o2 = f$1(r2) ? function(e2, r3) {
|
|
39
|
+
for (var t3 = 0; t3 < e2.length; t3++)
|
|
40
|
+
if (e2[t3].identifier === r3)
|
|
41
|
+
return e2[t3];
|
|
42
|
+
return e2[0];
|
|
43
|
+
}(r2.touches, t2) : r2;
|
|
44
|
+
return { left: s$2((o2.pageX - (n2.left + v$1(e).pageXOffset)) / n2.width), top: s$2((o2.pageY - (n2.top + v$1(e).pageYOffset)) / n2.height) };
|
|
45
|
+
}, h$1 = function(e) {
|
|
46
|
+
!f$1(e) && e.preventDefault();
|
|
47
|
+
}, m$1 = React__default.memo(function(o2) {
|
|
48
|
+
var a2 = o2.onMove, l2 = o2.onKey, s2 = c$1(o2, ["onMove", "onKey"]), m2 = useRef(null), g2 = i$2(a2), p2 = i$2(l2), b2 = useRef(null), _2 = useRef(false), x2 = useMemo(function() {
|
|
49
|
+
var e = function(e2) {
|
|
50
|
+
h$1(e2), (f$1(e2) ? e2.touches.length > 0 : e2.buttons > 0) && m2.current ? g2(d$1(m2.current, e2, b2.current)) : t2(false);
|
|
51
|
+
}, r2 = function() {
|
|
52
|
+
return t2(false);
|
|
53
|
+
};
|
|
54
|
+
function t2(t3) {
|
|
55
|
+
var n2 = _2.current, o3 = v$1(m2.current), a3 = t3 ? o3.addEventListener : o3.removeEventListener;
|
|
56
|
+
a3(n2 ? "touchmove" : "mousemove", e), a3(n2 ? "touchend" : "mouseup", r2);
|
|
57
|
+
}
|
|
58
|
+
return [function(e2) {
|
|
59
|
+
var r3 = e2.nativeEvent, n2 = m2.current;
|
|
60
|
+
if (n2 && (h$1(r3), !function(e3, r4) {
|
|
61
|
+
return r4 && !f$1(e3);
|
|
62
|
+
}(r3, _2.current) && n2)) {
|
|
63
|
+
if (f$1(r3)) {
|
|
64
|
+
_2.current = true;
|
|
65
|
+
var o3 = r3.changedTouches || [];
|
|
66
|
+
o3.length && (b2.current = o3[0].identifier);
|
|
67
|
+
}
|
|
68
|
+
n2.focus(), g2(d$1(n2, r3, b2.current)), t2(true);
|
|
69
|
+
}
|
|
70
|
+
}, function(e2) {
|
|
71
|
+
var r3 = e2.which || e2.keyCode;
|
|
72
|
+
r3 < 37 || r3 > 40 || (e2.preventDefault(), p2({ left: 39 === r3 ? 0.05 : 37 === r3 ? -0.05 : 0, top: 40 === r3 ? 0.05 : 38 === r3 ? -0.05 : 0 }));
|
|
73
|
+
}, t2];
|
|
74
|
+
}, [p2, g2]), C2 = x2[0], E2 = x2[1], H2 = x2[2];
|
|
75
|
+
return useEffect(function() {
|
|
76
|
+
return H2;
|
|
77
|
+
}, [H2]), React__default.createElement("div", u$1({}, s2, { onTouchStart: C2, onMouseDown: C2, className: "react-colorful__interactive", ref: m2, onKeyDown: E2, tabIndex: 0, role: "slider" }));
|
|
78
|
+
}), g$1 = function(e) {
|
|
79
|
+
return e.filter(Boolean).join(" ");
|
|
80
|
+
}, p$1 = function(r2) {
|
|
81
|
+
var t2 = r2.color, n2 = r2.left, o2 = r2.top, a2 = void 0 === o2 ? 0.5 : o2, l2 = g$1(["react-colorful__pointer", r2.className]);
|
|
82
|
+
return React__default.createElement("div", { className: l2, style: { top: 100 * a2 + "%", left: 100 * n2 + "%" } }, React__default.createElement("div", { className: "react-colorful__pointer-fill", style: { backgroundColor: t2 } }));
|
|
83
|
+
}, b$1 = function(e, r2, t2) {
|
|
84
|
+
return void 0 === r2 && (r2 = 0), void 0 === t2 && (t2 = Math.pow(10, r2)), Math.round(t2 * e) / t2;
|
|
85
|
+
}, x$1 = function(e) {
|
|
86
|
+
return L$1(C$1(e));
|
|
87
|
+
}, C$1 = function(e) {
|
|
88
|
+
return "#" === e[0] && (e = e.substring(1)), e.length < 6 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: 4 === e.length ? b$1(parseInt(e[3] + e[3], 16) / 255, 2) : 1 } : { r: parseInt(e.substring(0, 2), 16), g: parseInt(e.substring(2, 4), 16), b: parseInt(e.substring(4, 6), 16), a: 8 === e.length ? b$1(parseInt(e.substring(6, 8), 16) / 255, 2) : 1 };
|
|
89
|
+
}, w$1 = function(e) {
|
|
90
|
+
return K(I$1(e));
|
|
91
|
+
}, y$1 = function(e) {
|
|
92
|
+
var r2 = e.s, t2 = e.v, n2 = e.a, o2 = (200 - r2) * t2 / 100;
|
|
93
|
+
return { h: b$1(e.h), s: b$1(o2 > 0 && o2 < 200 ? r2 * t2 / 100 / (o2 <= 100 ? o2 : 200 - o2) * 100 : 0), l: b$1(o2 / 2), a: b$1(n2, 2) };
|
|
94
|
+
}, q$1 = function(e) {
|
|
95
|
+
var r2 = y$1(e);
|
|
96
|
+
return "hsl(" + r2.h + ", " + r2.s + "%, " + r2.l + "%)";
|
|
97
|
+
}, I$1 = function(e) {
|
|
98
|
+
var r2 = e.h, t2 = e.s, n2 = e.v, o2 = e.a;
|
|
99
|
+
r2 = r2 / 360 * 6, t2 /= 100, n2 /= 100;
|
|
100
|
+
var a2 = Math.floor(r2), l2 = n2 * (1 - t2), u2 = n2 * (1 - (r2 - a2) * t2), c2 = n2 * (1 - (1 - r2 + a2) * t2), i = a2 % 6;
|
|
101
|
+
return { r: b$1(255 * [n2, u2, l2, l2, c2, n2][i]), g: b$1(255 * [c2, n2, n2, u2, l2, l2][i]), b: b$1(255 * [l2, l2, c2, n2, n2, u2][i]), a: b$1(o2, 2) };
|
|
102
|
+
}, D$1 = function(e) {
|
|
103
|
+
var r2 = e.toString(16);
|
|
104
|
+
return r2.length < 2 ? "0" + r2 : r2;
|
|
105
|
+
}, K = function(e) {
|
|
106
|
+
var r2 = e.r, t2 = e.g, n2 = e.b, o2 = e.a, a2 = o2 < 1 ? D$1(b$1(255 * o2)) : "";
|
|
107
|
+
return "#" + D$1(r2) + D$1(t2) + D$1(n2) + a2;
|
|
108
|
+
}, L$1 = function(e) {
|
|
109
|
+
var r2 = e.r, t2 = e.g, n2 = e.b, o2 = e.a, a2 = Math.max(r2, t2, n2), l2 = a2 - Math.min(r2, t2, n2), u2 = l2 ? a2 === r2 ? (t2 - n2) / l2 : a2 === t2 ? 2 + (n2 - r2) / l2 : 4 + (r2 - t2) / l2 : 0;
|
|
110
|
+
return { h: b$1(60 * (u2 < 0 ? u2 + 6 : u2)), s: b$1(a2 ? l2 / a2 * 100 : 0), v: b$1(a2 / 255 * 100), a: o2 };
|
|
111
|
+
}, S$1 = React__default.memo(function(r2) {
|
|
112
|
+
var t2 = r2.hue, n2 = r2.onChange, o2 = g$1(["react-colorful__hue", r2.className]);
|
|
113
|
+
return React__default.createElement("div", { className: o2 }, React__default.createElement(m$1, { onMove: function(e) {
|
|
114
|
+
n2({ h: 360 * e.left });
|
|
115
|
+
}, onKey: function(e) {
|
|
116
|
+
n2({ h: s$2(t2 + 360 * e.left, 0, 360) });
|
|
117
|
+
}, "aria-label": "Hue", "aria-valuenow": b$1(t2), "aria-valuemax": "360", "aria-valuemin": "0" }, React__default.createElement(p$1, { className: "react-colorful__hue-pointer", left: t2 / 360, color: q$1({ h: t2, s: 100, v: 100, a: 1 }) })));
|
|
118
|
+
}), T = React__default.memo(function(r2) {
|
|
119
|
+
var t2 = r2.hsva, n2 = r2.onChange, o2 = { backgroundColor: q$1({ h: t2.h, s: 100, v: 100, a: 1 }) };
|
|
120
|
+
return React__default.createElement("div", { className: "react-colorful__saturation", style: o2 }, React__default.createElement(m$1, { onMove: function(e) {
|
|
121
|
+
n2({ s: 100 * e.left, v: 100 - 100 * e.top });
|
|
122
|
+
}, onKey: function(e) {
|
|
123
|
+
n2({ s: s$2(t2.s + 100 * e.left, 0, 100), v: s$2(t2.v - 100 * e.top, 0, 100) });
|
|
124
|
+
}, "aria-label": "Color", "aria-valuetext": "Saturation " + b$1(t2.s) + "%, Brightness " + b$1(t2.v) + "%" }, React__default.createElement(p$1, { className: "react-colorful__saturation-pointer", top: 1 - t2.v / 100, left: t2.s / 100, color: q$1(t2) })));
|
|
125
|
+
}), F = function(e, r2) {
|
|
126
|
+
if (e === r2)
|
|
127
|
+
return true;
|
|
128
|
+
for (var t2 in e)
|
|
129
|
+
if (e[t2] !== r2[t2])
|
|
130
|
+
return false;
|
|
131
|
+
return true;
|
|
132
|
+
}, X$1 = function(e, r2) {
|
|
133
|
+
return e.toLowerCase() === r2.toLowerCase() || F(C$1(e), C$1(r2));
|
|
134
|
+
};
|
|
135
|
+
function Y$1(e, t2, l2) {
|
|
136
|
+
var u2 = i$2(l2), c2 = useState(function() {
|
|
137
|
+
return e.toHsva(t2);
|
|
138
|
+
}), s2 = c2[0], f2 = c2[1], v2 = useRef({ color: t2, hsva: s2 });
|
|
139
|
+
useEffect(function() {
|
|
140
|
+
if (!e.equal(t2, v2.current.color)) {
|
|
141
|
+
var r2 = e.toHsva(t2);
|
|
142
|
+
v2.current = { hsva: r2, color: t2 }, f2(r2);
|
|
143
|
+
}
|
|
144
|
+
}, [t2, e]), useEffect(function() {
|
|
145
|
+
var r2;
|
|
146
|
+
F(s2, v2.current.hsva) || e.equal(r2 = e.fromHsva(s2), v2.current.color) || (v2.current = { hsva: s2, color: r2 }, u2(r2));
|
|
147
|
+
}, [s2, e, u2]);
|
|
148
|
+
var d2 = useCallback(function(e2) {
|
|
149
|
+
f2(function(r2) {
|
|
150
|
+
return Object.assign({}, r2, e2);
|
|
151
|
+
});
|
|
152
|
+
}, []);
|
|
153
|
+
return [s2, d2];
|
|
154
|
+
}
|
|
155
|
+
var V$1 = "undefined" != typeof window ? useLayoutEffect : useEffect, $ = function() {
|
|
156
|
+
return "undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : void 0;
|
|
157
|
+
}, J = /* @__PURE__ */ new Map(), Q$1 = function(e) {
|
|
158
|
+
V$1(function() {
|
|
159
|
+
var r2 = e.current ? e.current.ownerDocument : document;
|
|
160
|
+
if (void 0 !== r2 && !J.has(r2)) {
|
|
161
|
+
var t2 = r2.createElement("style");
|
|
162
|
+
t2.innerHTML = `.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`, J.set(r2, t2);
|
|
163
|
+
var n2 = $();
|
|
164
|
+
n2 && t2.setAttribute("nonce", n2), r2.head.appendChild(t2);
|
|
165
|
+
}
|
|
166
|
+
}, []);
|
|
167
|
+
}, U$1 = function(t2) {
|
|
168
|
+
var n2 = t2.className, o2 = t2.colorModel, a2 = t2.color, l2 = void 0 === a2 ? o2.defaultColor : a2, i = t2.onChange, s2 = c$1(t2, ["className", "colorModel", "color", "onChange"]), f2 = useRef(null);
|
|
169
|
+
Q$1(f2);
|
|
170
|
+
var v2 = Y$1(o2, l2, i), d2 = v2[0], h2 = v2[1], m2 = g$1(["react-colorful", n2]);
|
|
171
|
+
return React__default.createElement("div", u$1({}, s2, { ref: f2, className: m2 }), React__default.createElement(T, { hsva: d2, onChange: h2 }), React__default.createElement(S$1, { hue: d2.h, onChange: h2, className: "react-colorful__last-control" }));
|
|
172
|
+
}, W$1 = { defaultColor: "000", toHsva: x$1, fromHsva: function(e) {
|
|
173
|
+
return w$1({ h: e.h, s: e.s, v: e.v, a: 1 });
|
|
174
|
+
}, equal: X$1 }, Z$1 = function(r2) {
|
|
175
|
+
return React__default.createElement(U$1, u$1({}, r2, { colorModel: W$1 }));
|
|
176
|
+
};
|
|
177
|
+
function n$1(n2) {
|
|
178
|
+
for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e = 1; e < r2; e++)
|
|
179
|
+
t2[e - 1] = arguments[e];
|
|
180
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
181
|
+
var i = Y[n2], o2 = i ? "function" == typeof i ? i.apply(null, t2) : i : "unknown error nr: " + n2;
|
|
182
|
+
throw Error("[Immer] " + o2);
|
|
183
|
+
}
|
|
184
|
+
throw Error("[Immer] minified error nr: " + n2 + (t2.length ? " " + t2.map(function(n3) {
|
|
185
|
+
return "'" + n3 + "'";
|
|
186
|
+
}).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
|
|
187
|
+
}
|
|
188
|
+
function r$1(n2) {
|
|
189
|
+
return !!n2 && !!n2[Q];
|
|
190
|
+
}
|
|
191
|
+
function t$1(n2) {
|
|
192
|
+
var r2;
|
|
193
|
+
return !!n2 && (function(n3) {
|
|
194
|
+
if (!n3 || "object" != typeof n3)
|
|
195
|
+
return false;
|
|
196
|
+
var r3 = Object.getPrototypeOf(n3);
|
|
197
|
+
if (null === r3)
|
|
198
|
+
return true;
|
|
199
|
+
var t2 = Object.hasOwnProperty.call(r3, "constructor") && r3.constructor;
|
|
200
|
+
return t2 === Object || "function" == typeof t2 && Function.toString.call(t2) === Z;
|
|
201
|
+
}(n2) || Array.isArray(n2) || !!n2[L] || !!(null === (r2 = n2.constructor) || void 0 === r2 ? void 0 : r2[L]) || s$1(n2) || v(n2));
|
|
202
|
+
}
|
|
203
|
+
function i$1(n2, r2, t2) {
|
|
204
|
+
void 0 === t2 && (t2 = false), 0 === o$1(n2) ? (t2 ? Object.keys : nn)(n2).forEach(function(e) {
|
|
205
|
+
t2 && "symbol" == typeof e || r2(e, n2[e], n2);
|
|
206
|
+
}) : n2.forEach(function(t3, e) {
|
|
207
|
+
return r2(e, t3, n2);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function o$1(n2) {
|
|
211
|
+
var r2 = n2[Q];
|
|
212
|
+
return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s$1(n2) ? 2 : v(n2) ? 3 : 0;
|
|
213
|
+
}
|
|
214
|
+
function u(n2, r2) {
|
|
215
|
+
return 2 === o$1(n2) ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
|
|
216
|
+
}
|
|
217
|
+
function a$1(n2, r2) {
|
|
218
|
+
return 2 === o$1(n2) ? n2.get(r2) : n2[r2];
|
|
219
|
+
}
|
|
220
|
+
function f(n2, r2, t2) {
|
|
221
|
+
var e = o$1(n2);
|
|
222
|
+
2 === e ? n2.set(r2, t2) : 3 === e ? n2.add(t2) : n2[r2] = t2;
|
|
223
|
+
}
|
|
224
|
+
function c(n2, r2) {
|
|
225
|
+
return n2 === r2 ? 0 !== n2 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
|
|
226
|
+
}
|
|
227
|
+
function s$1(n2) {
|
|
228
|
+
return X && n2 instanceof Map;
|
|
229
|
+
}
|
|
230
|
+
function v(n2) {
|
|
231
|
+
return q && n2 instanceof Set;
|
|
232
|
+
}
|
|
233
|
+
function p(n2) {
|
|
234
|
+
return n2.o || n2.t;
|
|
235
|
+
}
|
|
236
|
+
function l(n2) {
|
|
237
|
+
if (Array.isArray(n2))
|
|
238
|
+
return Array.prototype.slice.call(n2);
|
|
239
|
+
var r2 = rn(n2);
|
|
240
|
+
delete r2[Q];
|
|
241
|
+
for (var t2 = nn(r2), e = 0; e < t2.length; e++) {
|
|
242
|
+
var i = t2[e], o2 = r2[i];
|
|
243
|
+
false === o2.writable && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i] });
|
|
244
|
+
}
|
|
245
|
+
return Object.create(Object.getPrototypeOf(n2), r2);
|
|
246
|
+
}
|
|
247
|
+
function d(n2, e) {
|
|
248
|
+
return void 0 === e && (e = false), y(n2) || r$1(n2) || !t$1(n2) || (o$1(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e && i$1(n2, function(n3, r2) {
|
|
249
|
+
return d(r2, true);
|
|
250
|
+
}, true)), n2;
|
|
251
|
+
}
|
|
252
|
+
function h() {
|
|
253
|
+
n$1(2);
|
|
254
|
+
}
|
|
255
|
+
function y(n2) {
|
|
256
|
+
return null == n2 || "object" != typeof n2 || Object.isFrozen(n2);
|
|
257
|
+
}
|
|
258
|
+
function b(r2) {
|
|
259
|
+
var t2 = tn[r2];
|
|
260
|
+
return t2 || n$1(18, r2), t2;
|
|
261
|
+
}
|
|
262
|
+
function m(n2, r2) {
|
|
263
|
+
tn[n2] || (tn[n2] = r2);
|
|
264
|
+
}
|
|
265
|
+
function _() {
|
|
266
|
+
return "production" === process.env.NODE_ENV || U || n$1(0), U;
|
|
267
|
+
}
|
|
268
|
+
function j(n2, r2) {
|
|
269
|
+
r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
|
|
270
|
+
}
|
|
271
|
+
function g(n2) {
|
|
272
|
+
O(n2), n2.p.forEach(S), n2.p = null;
|
|
273
|
+
}
|
|
274
|
+
function O(n2) {
|
|
275
|
+
n2 === U && (U = n2.l);
|
|
276
|
+
}
|
|
277
|
+
function w(n2) {
|
|
278
|
+
return U = { p: [], l: U, h: n2, m: true, _: 0 };
|
|
279
|
+
}
|
|
280
|
+
function S(n2) {
|
|
281
|
+
var r2 = n2[Q];
|
|
282
|
+
0 === r2.i || 1 === r2.i ? r2.j() : r2.g = true;
|
|
283
|
+
}
|
|
284
|
+
function P(r2, e) {
|
|
285
|
+
e._ = e.p.length;
|
|
286
|
+
var i = e.p[0], o2 = void 0 !== r2 && r2 !== i;
|
|
287
|
+
return e.h.O || b("ES5").S(e, r2, o2), o2 ? (i[Q].P && (g(e), n$1(4)), t$1(r2) && (r2 = M(e, r2), e.l || x(e, r2)), e.u && b("Patches").M(i[Q].t, r2, e.u, e.s)) : r2 = M(e, i, []), g(e), e.u && e.v(e.u, e.s), r2 !== H ? r2 : void 0;
|
|
288
|
+
}
|
|
289
|
+
function M(n2, r2, t2) {
|
|
290
|
+
if (y(r2))
|
|
291
|
+
return r2;
|
|
292
|
+
var e = r2[Q];
|
|
293
|
+
if (!e)
|
|
294
|
+
return i$1(r2, function(i, o3) {
|
|
295
|
+
return A(n2, e, r2, i, o3, t2);
|
|
296
|
+
}, true), r2;
|
|
297
|
+
if (e.A !== n2)
|
|
298
|
+
return r2;
|
|
299
|
+
if (!e.P)
|
|
300
|
+
return x(n2, e.t, true), e.t;
|
|
301
|
+
if (!e.I) {
|
|
302
|
+
e.I = true, e.A._--;
|
|
303
|
+
var o2 = 4 === e.i || 5 === e.i ? e.o = l(e.k) : e.o, u2 = o2, a2 = false;
|
|
304
|
+
3 === e.i && (u2 = new Set(o2), o2.clear(), a2 = true), i$1(u2, function(r3, i) {
|
|
305
|
+
return A(n2, e, o2, r3, i, t2, a2);
|
|
306
|
+
}), x(n2, o2, false), t2 && n2.u && b("Patches").N(e, t2, n2.u, n2.s);
|
|
307
|
+
}
|
|
308
|
+
return e.o;
|
|
309
|
+
}
|
|
310
|
+
function A(e, i, o2, a2, c2, s2, v2) {
|
|
311
|
+
if ("production" !== process.env.NODE_ENV && c2 === o2 && n$1(5), r$1(c2)) {
|
|
312
|
+
var p2 = M(e, c2, s2 && i && 3 !== i.i && !u(i.R, a2) ? s2.concat(a2) : void 0);
|
|
313
|
+
if (f(o2, a2, p2), !r$1(p2))
|
|
314
|
+
return;
|
|
315
|
+
e.m = false;
|
|
316
|
+
} else
|
|
317
|
+
v2 && o2.add(c2);
|
|
318
|
+
if (t$1(c2) && !y(c2)) {
|
|
319
|
+
if (!e.h.D && e._ < 1)
|
|
320
|
+
return;
|
|
321
|
+
M(e, c2), i && i.A.l || x(e, c2);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function x(n2, r2, t2) {
|
|
325
|
+
void 0 === t2 && (t2 = false), !n2.l && n2.h.D && n2.m && d(r2, t2);
|
|
326
|
+
}
|
|
327
|
+
function z(n2, r2) {
|
|
328
|
+
var t2 = n2[Q];
|
|
329
|
+
return (t2 ? p(t2) : n2)[r2];
|
|
330
|
+
}
|
|
331
|
+
function I(n2, r2) {
|
|
332
|
+
if (r2 in n2)
|
|
333
|
+
for (var t2 = Object.getPrototypeOf(n2); t2; ) {
|
|
334
|
+
var e = Object.getOwnPropertyDescriptor(t2, r2);
|
|
335
|
+
if (e)
|
|
336
|
+
return e;
|
|
337
|
+
t2 = Object.getPrototypeOf(t2);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function k(n2) {
|
|
341
|
+
n2.P || (n2.P = true, n2.l && k(n2.l));
|
|
342
|
+
}
|
|
343
|
+
function E(n2) {
|
|
344
|
+
n2.o || (n2.o = l(n2.t));
|
|
345
|
+
}
|
|
346
|
+
function N(n2, r2, t2) {
|
|
347
|
+
var e = s$1(r2) ? b("MapSet").F(r2, t2) : v(r2) ? b("MapSet").T(r2, t2) : n2.O ? function(n3, r3) {
|
|
348
|
+
var t3 = Array.isArray(n3), e2 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _(), P: false, I: false, R: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i = e2, o2 = en;
|
|
349
|
+
t3 && (i = [e2], o2 = on);
|
|
350
|
+
var u2 = Proxy.revocable(i, o2), a2 = u2.revoke, f2 = u2.proxy;
|
|
351
|
+
return e2.k = f2, e2.j = a2, f2;
|
|
352
|
+
}(r2, t2) : b("ES5").J(r2, t2);
|
|
353
|
+
return (t2 ? t2.A : _()).p.push(e), e;
|
|
354
|
+
}
|
|
355
|
+
function R(e) {
|
|
356
|
+
return r$1(e) || n$1(22, e), function n2(r2) {
|
|
357
|
+
if (!t$1(r2))
|
|
358
|
+
return r2;
|
|
359
|
+
var e2, u2 = r2[Q], c2 = o$1(r2);
|
|
360
|
+
if (u2) {
|
|
361
|
+
if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
|
|
362
|
+
return u2.t;
|
|
363
|
+
u2.I = true, e2 = D(r2, c2), u2.I = false;
|
|
364
|
+
} else
|
|
365
|
+
e2 = D(r2, c2);
|
|
366
|
+
return i$1(e2, function(r3, t2) {
|
|
367
|
+
u2 && a$1(u2.t, r3) === t2 || f(e2, r3, n2(t2));
|
|
368
|
+
}), 3 === c2 ? new Set(e2) : e2;
|
|
369
|
+
}(e);
|
|
370
|
+
}
|
|
371
|
+
function D(n2, r2) {
|
|
372
|
+
switch (r2) {
|
|
373
|
+
case 2:
|
|
374
|
+
return new Map(n2);
|
|
375
|
+
case 3:
|
|
376
|
+
return Array.from(n2);
|
|
377
|
+
}
|
|
378
|
+
return l(n2);
|
|
379
|
+
}
|
|
380
|
+
function C() {
|
|
381
|
+
function r2(n2, r3) {
|
|
382
|
+
function t2() {
|
|
383
|
+
this.constructor = n2;
|
|
384
|
+
}
|
|
385
|
+
a2(n2, r3), n2.prototype = (t2.prototype = r3.prototype, new t2());
|
|
386
|
+
}
|
|
387
|
+
function e(n2) {
|
|
388
|
+
n2.o || (n2.R = /* @__PURE__ */ new Map(), n2.o = new Map(n2.t));
|
|
389
|
+
}
|
|
390
|
+
function o2(n2) {
|
|
391
|
+
n2.o || (n2.o = /* @__PURE__ */ new Set(), n2.t.forEach(function(r3) {
|
|
392
|
+
if (t$1(r3)) {
|
|
393
|
+
var e2 = N(n2.A.h, r3, n2);
|
|
394
|
+
n2.p.set(r3, e2), n2.o.add(e2);
|
|
395
|
+
} else
|
|
396
|
+
n2.o.add(r3);
|
|
397
|
+
}));
|
|
398
|
+
}
|
|
399
|
+
function u2(r3) {
|
|
400
|
+
r3.g && n$1(3, JSON.stringify(p(r3)));
|
|
401
|
+
}
|
|
402
|
+
var a2 = function(n2, r3) {
|
|
403
|
+
return (a2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n3, r4) {
|
|
404
|
+
n3.__proto__ = r4;
|
|
405
|
+
} || function(n3, r4) {
|
|
406
|
+
for (var t2 in r4)
|
|
407
|
+
r4.hasOwnProperty(t2) && (n3[t2] = r4[t2]);
|
|
408
|
+
})(n2, r3);
|
|
409
|
+
}, f2 = function() {
|
|
410
|
+
function n2(n3, r3) {
|
|
411
|
+
return this[Q] = { i: 2, l: r3, A: r3 ? r3.A : _(), P: false, I: false, o: void 0, R: void 0, t: n3, k: this, C: false, g: false }, this;
|
|
412
|
+
}
|
|
413
|
+
r2(n2, Map);
|
|
414
|
+
var o3 = n2.prototype;
|
|
415
|
+
return Object.defineProperty(o3, "size", { get: function() {
|
|
416
|
+
return p(this[Q]).size;
|
|
417
|
+
} }), o3.has = function(n3) {
|
|
418
|
+
return p(this[Q]).has(n3);
|
|
419
|
+
}, o3.set = function(n3, r3) {
|
|
420
|
+
var t2 = this[Q];
|
|
421
|
+
return u2(t2), p(t2).has(n3) && p(t2).get(n3) === r3 || (e(t2), k(t2), t2.R.set(n3, true), t2.o.set(n3, r3), t2.R.set(n3, true)), this;
|
|
422
|
+
}, o3.delete = function(n3) {
|
|
423
|
+
if (!this.has(n3))
|
|
424
|
+
return false;
|
|
425
|
+
var r3 = this[Q];
|
|
426
|
+
return u2(r3), e(r3), k(r3), r3.t.has(n3) ? r3.R.set(n3, false) : r3.R.delete(n3), r3.o.delete(n3), true;
|
|
427
|
+
}, o3.clear = function() {
|
|
428
|
+
var n3 = this[Q];
|
|
429
|
+
u2(n3), p(n3).size && (e(n3), k(n3), n3.R = /* @__PURE__ */ new Map(), i$1(n3.t, function(r3) {
|
|
430
|
+
n3.R.set(r3, false);
|
|
431
|
+
}), n3.o.clear());
|
|
432
|
+
}, o3.forEach = function(n3, r3) {
|
|
433
|
+
var t2 = this;
|
|
434
|
+
p(this[Q]).forEach(function(e2, i) {
|
|
435
|
+
n3.call(r3, t2.get(i), i, t2);
|
|
436
|
+
});
|
|
437
|
+
}, o3.get = function(n3) {
|
|
438
|
+
var r3 = this[Q];
|
|
439
|
+
u2(r3);
|
|
440
|
+
var i = p(r3).get(n3);
|
|
441
|
+
if (r3.I || !t$1(i))
|
|
442
|
+
return i;
|
|
443
|
+
if (i !== r3.t.get(n3))
|
|
444
|
+
return i;
|
|
445
|
+
var o4 = N(r3.A.h, i, r3);
|
|
446
|
+
return e(r3), r3.o.set(n3, o4), o4;
|
|
447
|
+
}, o3.keys = function() {
|
|
448
|
+
return p(this[Q]).keys();
|
|
449
|
+
}, o3.values = function() {
|
|
450
|
+
var n3, r3 = this, t2 = this.keys();
|
|
451
|
+
return (n3 = {})[V] = function() {
|
|
452
|
+
return r3.values();
|
|
453
|
+
}, n3.next = function() {
|
|
454
|
+
var n4 = t2.next();
|
|
455
|
+
return n4.done ? n4 : { done: false, value: r3.get(n4.value) };
|
|
456
|
+
}, n3;
|
|
457
|
+
}, o3.entries = function() {
|
|
458
|
+
var n3, r3 = this, t2 = this.keys();
|
|
459
|
+
return (n3 = {})[V] = function() {
|
|
460
|
+
return r3.entries();
|
|
461
|
+
}, n3.next = function() {
|
|
462
|
+
var n4 = t2.next();
|
|
463
|
+
if (n4.done)
|
|
464
|
+
return n4;
|
|
465
|
+
var e2 = r3.get(n4.value);
|
|
466
|
+
return { done: false, value: [n4.value, e2] };
|
|
467
|
+
}, n3;
|
|
468
|
+
}, o3[V] = function() {
|
|
469
|
+
return this.entries();
|
|
470
|
+
}, n2;
|
|
471
|
+
}(), c2 = function() {
|
|
472
|
+
function n2(n3, r3) {
|
|
473
|
+
return this[Q] = { i: 3, l: r3, A: r3 ? r3.A : _(), P: false, I: false, o: void 0, t: n3, k: this, p: /* @__PURE__ */ new Map(), g: false, C: false }, this;
|
|
474
|
+
}
|
|
475
|
+
r2(n2, Set);
|
|
476
|
+
var t2 = n2.prototype;
|
|
477
|
+
return Object.defineProperty(t2, "size", { get: function() {
|
|
478
|
+
return p(this[Q]).size;
|
|
479
|
+
} }), t2.has = function(n3) {
|
|
480
|
+
var r3 = this[Q];
|
|
481
|
+
return u2(r3), r3.o ? !!r3.o.has(n3) || !(!r3.p.has(n3) || !r3.o.has(r3.p.get(n3))) : r3.t.has(n3);
|
|
482
|
+
}, t2.add = function(n3) {
|
|
483
|
+
var r3 = this[Q];
|
|
484
|
+
return u2(r3), this.has(n3) || (o2(r3), k(r3), r3.o.add(n3)), this;
|
|
485
|
+
}, t2.delete = function(n3) {
|
|
486
|
+
if (!this.has(n3))
|
|
487
|
+
return false;
|
|
488
|
+
var r3 = this[Q];
|
|
489
|
+
return u2(r3), o2(r3), k(r3), r3.o.delete(n3) || !!r3.p.has(n3) && r3.o.delete(r3.p.get(n3));
|
|
490
|
+
}, t2.clear = function() {
|
|
491
|
+
var n3 = this[Q];
|
|
492
|
+
u2(n3), p(n3).size && (o2(n3), k(n3), n3.o.clear());
|
|
493
|
+
}, t2.values = function() {
|
|
494
|
+
var n3 = this[Q];
|
|
495
|
+
return u2(n3), o2(n3), n3.o.values();
|
|
496
|
+
}, t2.entries = function() {
|
|
497
|
+
var n3 = this[Q];
|
|
498
|
+
return u2(n3), o2(n3), n3.o.entries();
|
|
499
|
+
}, t2.keys = function() {
|
|
500
|
+
return this.values();
|
|
501
|
+
}, t2[V] = function() {
|
|
502
|
+
return this.values();
|
|
503
|
+
}, t2.forEach = function(n3, r3) {
|
|
504
|
+
for (var t3 = this.values(), e2 = t3.next(); !e2.done; )
|
|
505
|
+
n3.call(r3, e2.value, e2.value, this), e2 = t3.next();
|
|
506
|
+
}, n2;
|
|
507
|
+
}();
|
|
508
|
+
m("MapSet", { F: function(n2, r3) {
|
|
509
|
+
return new f2(n2, r3);
|
|
510
|
+
}, T: function(n2, r3) {
|
|
511
|
+
return new c2(n2, r3);
|
|
512
|
+
} });
|
|
513
|
+
}
|
|
514
|
+
var G, U, W = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x"), X = "undefined" != typeof Map, q = "undefined" != typeof Set, B = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect, H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G), L = W ? Symbol.for("immer-draftable") : "__$immer_draftable", Q = W ? Symbol.for("immer-state") : "__$immer_state", V = "undefined" != typeof Symbol && Symbol.iterator || "@@iterator", Y = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function(n2) {
|
|
515
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + n2;
|
|
516
|
+
}, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function(n2) {
|
|
517
|
+
return "Cannot apply patch, path doesn't resolve: " + n2;
|
|
518
|
+
}, 16: 'Sets cannot have "replace" patches.', 17: function(n2) {
|
|
519
|
+
return "Unsupported patch operation: " + n2;
|
|
520
|
+
}, 18: function(n2) {
|
|
521
|
+
return "The plugin for '" + n2 + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + n2 + "()` when initializing your application.";
|
|
522
|
+
}, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function(n2) {
|
|
523
|
+
return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + n2 + "'";
|
|
524
|
+
}, 22: function(n2) {
|
|
525
|
+
return "'current' expects a draft, got: " + n2;
|
|
526
|
+
}, 23: function(n2) {
|
|
527
|
+
return "'original' expects a draft, got: " + n2;
|
|
528
|
+
}, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" }, Z = "" + Object.prototype.constructor, nn = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function(n2) {
|
|
529
|
+
return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
|
|
530
|
+
} : Object.getOwnPropertyNames, rn = Object.getOwnPropertyDescriptors || function(n2) {
|
|
531
|
+
var r2 = {};
|
|
532
|
+
return nn(n2).forEach(function(t2) {
|
|
533
|
+
r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
|
|
534
|
+
}), r2;
|
|
535
|
+
}, tn = {}, en = { get: function(n2, r2) {
|
|
536
|
+
if (r2 === Q)
|
|
537
|
+
return n2;
|
|
538
|
+
var e = p(n2);
|
|
539
|
+
if (!u(e, r2))
|
|
540
|
+
return function(n3, r3, t2) {
|
|
541
|
+
var e2, i2 = I(r3, t2);
|
|
542
|
+
return i2 ? "value" in i2 ? i2.value : null === (e2 = i2.get) || void 0 === e2 ? void 0 : e2.call(n3.k) : void 0;
|
|
543
|
+
}(n2, e, r2);
|
|
544
|
+
var i = e[r2];
|
|
545
|
+
return n2.I || !t$1(i) ? i : i === z(n2.t, r2) ? (E(n2), n2.o[r2] = N(n2.A.h, i, n2)) : i;
|
|
546
|
+
}, has: function(n2, r2) {
|
|
547
|
+
return r2 in p(n2);
|
|
548
|
+
}, ownKeys: function(n2) {
|
|
549
|
+
return Reflect.ownKeys(p(n2));
|
|
550
|
+
}, set: function(n2, r2, t2) {
|
|
551
|
+
var e = I(p(n2), r2);
|
|
552
|
+
if (null == e ? void 0 : e.set)
|
|
553
|
+
return e.set.call(n2.k, t2), true;
|
|
554
|
+
if (!n2.P) {
|
|
555
|
+
var i = z(p(n2), r2), o2 = null == i ? void 0 : i[Q];
|
|
556
|
+
if (o2 && o2.t === t2)
|
|
557
|
+
return n2.o[r2] = t2, n2.R[r2] = false, true;
|
|
558
|
+
if (c(t2, i) && (void 0 !== t2 || u(n2.t, r2)))
|
|
559
|
+
return true;
|
|
560
|
+
E(n2), k(n2);
|
|
561
|
+
}
|
|
562
|
+
return n2.o[r2] === t2 && (void 0 !== t2 || r2 in n2.o) || Number.isNaN(t2) && Number.isNaN(n2.o[r2]) || (n2.o[r2] = t2, n2.R[r2] = true), true;
|
|
563
|
+
}, deleteProperty: function(n2, r2) {
|
|
564
|
+
return void 0 !== z(n2.t, r2) || r2 in n2.t ? (n2.R[r2] = false, E(n2), k(n2)) : delete n2.R[r2], n2.o && delete n2.o[r2], true;
|
|
565
|
+
}, getOwnPropertyDescriptor: function(n2, r2) {
|
|
566
|
+
var t2 = p(n2), e = Reflect.getOwnPropertyDescriptor(t2, r2);
|
|
567
|
+
return e ? { writable: true, configurable: 1 !== n2.i || "length" !== r2, enumerable: e.enumerable, value: t2[r2] } : e;
|
|
568
|
+
}, defineProperty: function() {
|
|
569
|
+
n$1(11);
|
|
570
|
+
}, getPrototypeOf: function(n2) {
|
|
571
|
+
return Object.getPrototypeOf(n2.t);
|
|
572
|
+
}, setPrototypeOf: function() {
|
|
573
|
+
n$1(12);
|
|
574
|
+
} }, on = {};
|
|
575
|
+
i$1(en, function(n2, r2) {
|
|
576
|
+
on[n2] = function() {
|
|
577
|
+
return arguments[0] = arguments[0][0], r2.apply(this, arguments);
|
|
578
|
+
};
|
|
579
|
+
}), on.deleteProperty = function(r2, t2) {
|
|
580
|
+
return "production" !== process.env.NODE_ENV && isNaN(parseInt(t2)) && n$1(13), on.set.call(this, r2, t2, void 0);
|
|
581
|
+
}, on.set = function(r2, t2, e) {
|
|
582
|
+
return "production" !== process.env.NODE_ENV && "length" !== t2 && isNaN(parseInt(t2)) && n$1(14), en.set.call(this, r2[0], t2, e, r2[0]);
|
|
583
|
+
};
|
|
584
|
+
var un = function() {
|
|
585
|
+
function e(r2) {
|
|
586
|
+
var e2 = this;
|
|
587
|
+
this.O = B, this.D = true, this.produce = function(r3, i2, o2) {
|
|
588
|
+
if ("function" == typeof r3 && "function" != typeof i2) {
|
|
589
|
+
var u2 = i2;
|
|
590
|
+
i2 = r3;
|
|
591
|
+
var a2 = e2;
|
|
592
|
+
return function(n2) {
|
|
593
|
+
var r4 = this;
|
|
594
|
+
void 0 === n2 && (n2 = u2);
|
|
595
|
+
for (var t2 = arguments.length, e3 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
|
|
596
|
+
e3[o3 - 1] = arguments[o3];
|
|
597
|
+
return a2.produce(n2, function(n3) {
|
|
598
|
+
var t3;
|
|
599
|
+
return (t3 = i2).call.apply(t3, [r4, n3].concat(e3));
|
|
600
|
+
});
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
var f2;
|
|
604
|
+
if ("function" != typeof i2 && n$1(6), void 0 !== o2 && "function" != typeof o2 && n$1(7), t$1(r3)) {
|
|
605
|
+
var c2 = w(e2), s2 = N(e2, r3, void 0), v2 = true;
|
|
606
|
+
try {
|
|
607
|
+
f2 = i2(s2), v2 = false;
|
|
608
|
+
} finally {
|
|
609
|
+
v2 ? g(c2) : O(c2);
|
|
610
|
+
}
|
|
611
|
+
return "undefined" != typeof Promise && f2 instanceof Promise ? f2.then(function(n2) {
|
|
612
|
+
return j(c2, o2), P(n2, c2);
|
|
613
|
+
}, function(n2) {
|
|
614
|
+
throw g(c2), n2;
|
|
615
|
+
}) : (j(c2, o2), P(f2, c2));
|
|
616
|
+
}
|
|
617
|
+
if (!r3 || "object" != typeof r3) {
|
|
618
|
+
if (void 0 === (f2 = i2(r3)) && (f2 = r3), f2 === H && (f2 = void 0), e2.D && d(f2, true), o2) {
|
|
619
|
+
var p2 = [], l2 = [];
|
|
620
|
+
b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
|
|
621
|
+
}
|
|
622
|
+
return f2;
|
|
623
|
+
}
|
|
624
|
+
n$1(21, r3);
|
|
625
|
+
}, this.produceWithPatches = function(n2, r3) {
|
|
626
|
+
if ("function" == typeof n2)
|
|
627
|
+
return function(r4) {
|
|
628
|
+
for (var t3 = arguments.length, i3 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
|
|
629
|
+
i3[o3 - 1] = arguments[o3];
|
|
630
|
+
return e2.produceWithPatches(r4, function(r5) {
|
|
631
|
+
return n2.apply(void 0, [r5].concat(i3));
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
var t2, i2, o2 = e2.produce(n2, r3, function(n3, r4) {
|
|
635
|
+
t2 = n3, i2 = r4;
|
|
636
|
+
});
|
|
637
|
+
return "undefined" != typeof Promise && o2 instanceof Promise ? o2.then(function(n3) {
|
|
638
|
+
return [n3, t2, i2];
|
|
639
|
+
}) : [o2, t2, i2];
|
|
640
|
+
}, "boolean" == typeof (null == r2 ? void 0 : r2.useProxies) && this.setUseProxies(r2.useProxies), "boolean" == typeof (null == r2 ? void 0 : r2.autoFreeze) && this.setAutoFreeze(r2.autoFreeze);
|
|
641
|
+
}
|
|
642
|
+
var i = e.prototype;
|
|
643
|
+
return i.createDraft = function(e2) {
|
|
644
|
+
t$1(e2) || n$1(8), r$1(e2) && (e2 = R(e2));
|
|
645
|
+
var i2 = w(this), o2 = N(this, e2, void 0);
|
|
646
|
+
return o2[Q].C = true, O(i2), o2;
|
|
647
|
+
}, i.finishDraft = function(r2, t2) {
|
|
648
|
+
var e2 = r2 && r2[Q];
|
|
649
|
+
"production" !== process.env.NODE_ENV && (e2 && e2.C || n$1(9), e2.I && n$1(10));
|
|
650
|
+
var i2 = e2.A;
|
|
651
|
+
return j(i2, t2), P(void 0, i2);
|
|
652
|
+
}, i.setAutoFreeze = function(n2) {
|
|
653
|
+
this.D = n2;
|
|
654
|
+
}, i.setUseProxies = function(r2) {
|
|
655
|
+
r2 && !B && n$1(20), this.O = r2;
|
|
656
|
+
}, i.applyPatches = function(n2, t2) {
|
|
657
|
+
var e2;
|
|
658
|
+
for (e2 = t2.length - 1; e2 >= 0; e2--) {
|
|
659
|
+
var i2 = t2[e2];
|
|
660
|
+
if (0 === i2.path.length && "replace" === i2.op) {
|
|
661
|
+
n2 = i2.value;
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
e2 > -1 && (t2 = t2.slice(e2 + 1));
|
|
666
|
+
var o2 = b("Patches").$;
|
|
667
|
+
return r$1(n2) ? o2(n2, t2) : this.produce(n2, function(n3) {
|
|
668
|
+
return o2(n3, t2);
|
|
669
|
+
});
|
|
670
|
+
}, e;
|
|
671
|
+
}(), an = new un();
|
|
672
|
+
an.produce;
|
|
673
|
+
an.produceWithPatches.bind(an);
|
|
674
|
+
an.setAutoFreeze.bind(an);
|
|
675
|
+
an.setUseProxies.bind(an);
|
|
676
|
+
an.applyPatches.bind(an);
|
|
677
|
+
an.createDraft.bind(an);
|
|
678
|
+
an.finishDraft.bind(an);
|
|
679
|
+
var t = function() {
|
|
680
|
+
var e = { name: "__LSM__", middleWares: [], persist: "action" }, t2 = {};
|
|
681
|
+
try {
|
|
682
|
+
e.storageType = "undefined" != typeof sessionStorage ? window.sessionStorage : void 0;
|
|
683
|
+
} catch (e2) {
|
|
684
|
+
}
|
|
685
|
+
return { updateStore: function(n2) {
|
|
686
|
+
try {
|
|
687
|
+
t2 = e.storageType && JSON.parse(e.storageType.getItem(e.name) || "") || n2;
|
|
688
|
+
} catch (e2) {
|
|
689
|
+
t2 = n2;
|
|
690
|
+
}
|
|
691
|
+
}, saveStore: function() {
|
|
692
|
+
e.storageType && e.storageType.setItem(e.name, JSON.stringify(t2));
|
|
693
|
+
}, get state() {
|
|
694
|
+
return t2;
|
|
695
|
+
}, set state(e2) {
|
|
696
|
+
t2 = e2;
|
|
697
|
+
}, get options() {
|
|
698
|
+
return e;
|
|
699
|
+
}, set options(t3) {
|
|
700
|
+
e = t3;
|
|
701
|
+
} };
|
|
702
|
+
}(), n = React$1.createContext(void 0), o = function(o2) {
|
|
703
|
+
var r2 = o2.children, s2 = React$1.useState(t.state), a2 = s2[0], i = s2[1];
|
|
704
|
+
return React$1.useEffect(function() {
|
|
705
|
+
"beforeUnload" === t.options.persist && (window.onbeforeunload = function() {
|
|
706
|
+
return t.saveStore();
|
|
707
|
+
}, t.options.storageType && t.options.storageType.removeItem(t.options.name));
|
|
708
|
+
}, []), React$1.createElement(n.Provider, { value: { state: a2, setState: i } }, r2);
|
|
709
|
+
};
|
|
710
|
+
function r() {
|
|
711
|
+
return r = Object.assign || function(e) {
|
|
712
|
+
for (var t2 = 1; t2 < arguments.length; t2++) {
|
|
713
|
+
var n2 = arguments[t2];
|
|
714
|
+
for (var o2 in n2)
|
|
715
|
+
Object.prototype.hasOwnProperty.call(n2, o2) && (e[o2] = n2[o2]);
|
|
716
|
+
}
|
|
717
|
+
return e;
|
|
718
|
+
}, r.apply(this, arguments);
|
|
719
|
+
}
|
|
720
|
+
function s(e, n2) {
|
|
721
|
+
n2 && (t.options = r({}, t.options, n2)), "production" !== process.env.NODE_ENV && "undefined" != typeof window && (window.__LSM_NAME__ = t.options.name, window.__LSM_RESET__ = function() {
|
|
722
|
+
return t.options.storageType && t.options.storageType.removeItem(t.options.name);
|
|
723
|
+
}), t.updateStore(e);
|
|
724
|
+
}
|
|
725
|
+
function a(o2) {
|
|
726
|
+
var r2 = React$1.useContext(n), s2 = r2.state, a2 = r2.setState, i = React$1.useRef(Object.entries(o2 || {}).reduce(function(e, n2) {
|
|
727
|
+
var o3;
|
|
728
|
+
return Object.assign({}, e, ((o3 = {})[n2[0]] = function(e2, n3) {
|
|
729
|
+
return function(o4, r3) {
|
|
730
|
+
"production" !== process.env.NODE_ENV && (window.__LSM_NAME__ = n3.name), t.state = n3(t.state, o4), t.options.middleWares && (t.state = t.options.middleWares.reduce(function(e3, t2) {
|
|
731
|
+
return t2(e3, n3.name, o4) || e3;
|
|
732
|
+
}, t.state)), (!r3 || !r3.skipRender) && e2(t.state), "action" === t.options.persist && t.saveStore();
|
|
733
|
+
};
|
|
734
|
+
}(a2, n2[1]), o3));
|
|
735
|
+
}, {}));
|
|
736
|
+
return { actions: i.current, state: s2, getState: React$1.useCallback(function() {
|
|
737
|
+
return t.state;
|
|
738
|
+
}, []) };
|
|
739
|
+
}
|
|
740
|
+
var getRandomValues;
|
|
741
|
+
var rnds8 = new Uint8Array(16);
|
|
742
|
+
function rng() {
|
|
743
|
+
if (!getRandomValues) {
|
|
744
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== "undefined" && typeof msCrypto.getRandomValues === "function" && msCrypto.getRandomValues.bind(msCrypto);
|
|
745
|
+
if (!getRandomValues) {
|
|
746
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
return getRandomValues(rnds8);
|
|
750
|
+
}
|
|
751
|
+
const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
752
|
+
function validate(uuid) {
|
|
753
|
+
return typeof uuid === "string" && REGEX.test(uuid);
|
|
754
|
+
}
|
|
755
|
+
var byteToHex = [];
|
|
756
|
+
for (var i = 0; i < 256; ++i) {
|
|
757
|
+
byteToHex.push((i + 256).toString(16).substr(1));
|
|
758
|
+
}
|
|
759
|
+
function stringify$1(arr) {
|
|
760
|
+
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
761
|
+
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
762
|
+
if (!validate(uuid)) {
|
|
763
|
+
throw TypeError("Stringified UUID is invalid");
|
|
764
|
+
}
|
|
765
|
+
return uuid;
|
|
766
|
+
}
|
|
767
|
+
function v4(options, buf, offset) {
|
|
768
|
+
options = options || {};
|
|
769
|
+
var rnds = options.random || (options.rng || rng)();
|
|
770
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
771
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
772
|
+
if (buf) {
|
|
773
|
+
offset = offset || 0;
|
|
774
|
+
for (var i = 0; i < 16; ++i) {
|
|
775
|
+
buf[offset + i] = rnds[i];
|
|
776
|
+
}
|
|
777
|
+
return buf;
|
|
778
|
+
}
|
|
779
|
+
return stringify$1(rnds);
|
|
780
|
+
}
|
|
781
|
+
var dist = {};
|
|
782
|
+
Object.defineProperty(dist, "__esModule", { value: true });
|
|
783
|
+
var React = React__default;
|
|
784
|
+
function _interopNamespace(e) {
|
|
785
|
+
if (e && e.__esModule)
|
|
786
|
+
return e;
|
|
787
|
+
var n2 = /* @__PURE__ */ Object.create(null);
|
|
788
|
+
if (e) {
|
|
789
|
+
Object.keys(e).forEach(function(k2) {
|
|
790
|
+
if (k2 !== "default") {
|
|
791
|
+
var d2 = Object.getOwnPropertyDescriptor(e, k2);
|
|
792
|
+
Object.defineProperty(n2, k2, d2.get ? d2 : {
|
|
793
|
+
enumerable: true,
|
|
794
|
+
get: function() {
|
|
795
|
+
return e[k2];
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
n2["default"] = e;
|
|
802
|
+
return Object.freeze(n2);
|
|
803
|
+
}
|
|
804
|
+
var React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
805
|
+
const DEFAULT_DURATION = 0.3;
|
|
806
|
+
const DEFAULT_EASE_TYPE = "linear";
|
|
807
|
+
const DEFAULT_DIRECTION = "normal";
|
|
808
|
+
const DEFAULT_FILLMODE = "none";
|
|
809
|
+
const RUNNING = "running";
|
|
810
|
+
const PAUSED = "paused";
|
|
811
|
+
const ALL = "all";
|
|
812
|
+
var calculateTotalDuration = ({ duration = DEFAULT_DURATION, delay = 0, overlay = 0 }) => duration + delay - overlay || 0;
|
|
813
|
+
var isUndefined$1 = (val) => val === void 0;
|
|
814
|
+
function getSequenceId(sequenceIndex, sequenceId, defaultValue) {
|
|
815
|
+
if (isUndefined$1(sequenceId) && isUndefined$1(sequenceIndex)) {
|
|
816
|
+
return defaultValue || 0;
|
|
817
|
+
}
|
|
818
|
+
if (sequenceIndex && sequenceIndex >= 0) {
|
|
819
|
+
return sequenceIndex;
|
|
820
|
+
}
|
|
821
|
+
if (sequenceId) {
|
|
822
|
+
return sequenceId;
|
|
823
|
+
}
|
|
824
|
+
return 0;
|
|
825
|
+
}
|
|
826
|
+
const AnimateContext = React__namespace.createContext({
|
|
827
|
+
animationStates: {},
|
|
828
|
+
register: () => {
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
function AnimateGroup({ play, sequences = [], children }) {
|
|
832
|
+
const [animationStates, setAnimationStates] = React__namespace.useState({});
|
|
833
|
+
const animationsRef = React__namespace.useRef({});
|
|
834
|
+
const register = React__namespace.useCallback((data) => {
|
|
835
|
+
const { sequenceIndex, sequenceId } = data;
|
|
836
|
+
if (!isUndefined$1(sequenceId) || !isUndefined$1(sequenceIndex)) {
|
|
837
|
+
animationsRef.current[getSequenceId(sequenceIndex, sequenceId)] = data;
|
|
838
|
+
}
|
|
839
|
+
}, []);
|
|
840
|
+
React__namespace.useEffect(() => {
|
|
841
|
+
const sequencesToAnimate = Array.isArray(sequences) && sequences.length ? sequences : Object.values(animationsRef.current);
|
|
842
|
+
const localAnimationState = {};
|
|
843
|
+
(play ? sequencesToAnimate : [...sequencesToAnimate].reverse()).reduce((previous, { sequenceId, sequenceIndex, duration = DEFAULT_DURATION, delay, overlay }, currentIndex) => {
|
|
844
|
+
const id = getSequenceId(sequenceIndex, sequenceId, currentIndex);
|
|
845
|
+
const currentTotalDuration = calculateTotalDuration({
|
|
846
|
+
duration,
|
|
847
|
+
delay,
|
|
848
|
+
overlay
|
|
849
|
+
});
|
|
850
|
+
const totalDuration = currentTotalDuration + previous;
|
|
851
|
+
localAnimationState[id] = {
|
|
852
|
+
play,
|
|
853
|
+
pause: !play,
|
|
854
|
+
delay: (delay || 0) + previous,
|
|
855
|
+
controlled: true
|
|
856
|
+
};
|
|
857
|
+
return totalDuration;
|
|
858
|
+
}, 0);
|
|
859
|
+
setAnimationStates(localAnimationState);
|
|
860
|
+
}, [play]);
|
|
861
|
+
return React__namespace.createElement(AnimateContext.Provider, { value: { animationStates, register } }, children);
|
|
862
|
+
}
|
|
863
|
+
var secToMs = (ms) => (ms || 0) * 1e3;
|
|
864
|
+
function Animate(props) {
|
|
865
|
+
const { play, children, render, start, end, complete = "", onComplete, delay = 0, duration = DEFAULT_DURATION, easeType = DEFAULT_EASE_TYPE, sequenceId, sequenceIndex } = props;
|
|
866
|
+
const onCompleteTimeRef = React__namespace.useRef();
|
|
867
|
+
const [style, setStyle] = React__namespace.useState(start || {});
|
|
868
|
+
const { register, animationStates = {} } = React__namespace.useContext(AnimateContext);
|
|
869
|
+
const id = getSequenceId(sequenceIndex, sequenceId);
|
|
870
|
+
React__namespace.useEffect(() => {
|
|
871
|
+
if (!isUndefined$1(sequenceIndex) && sequenceIndex >= 0 || sequenceId) {
|
|
872
|
+
register(props);
|
|
873
|
+
}
|
|
874
|
+
}, []);
|
|
875
|
+
React__namespace.useEffect(() => {
|
|
876
|
+
const animationState = animationStates[id] || {};
|
|
877
|
+
setStyle({
|
|
878
|
+
...play || animationState.play ? end : start,
|
|
879
|
+
transition: `${ALL} ${duration}s ${easeType} ${animationState.delay || delay}s`
|
|
880
|
+
});
|
|
881
|
+
if (play && (complete || onComplete)) {
|
|
882
|
+
onCompleteTimeRef.current = setTimeout(() => {
|
|
883
|
+
complete && setStyle(complete);
|
|
884
|
+
onComplete && onComplete();
|
|
885
|
+
}, secToMs((animationState.delay || delay) + duration));
|
|
886
|
+
}
|
|
887
|
+
return () => onCompleteTimeRef.current && clearTimeout(onCompleteTimeRef.current);
|
|
888
|
+
}, [
|
|
889
|
+
id,
|
|
890
|
+
animationStates,
|
|
891
|
+
play,
|
|
892
|
+
duration,
|
|
893
|
+
easeType,
|
|
894
|
+
delay,
|
|
895
|
+
onComplete,
|
|
896
|
+
start,
|
|
897
|
+
end,
|
|
898
|
+
complete
|
|
899
|
+
]);
|
|
900
|
+
return render ? render({ style }) : React__namespace.createElement("div", { style }, children);
|
|
901
|
+
}
|
|
902
|
+
var camelCaseToDash = (camelCase) => camelCase ? camelCase.replace(/[A-Z]/g, (c2) => `-${c2.toLowerCase()}`) : "";
|
|
903
|
+
const generateKeyframes = (keyframes) => {
|
|
904
|
+
const animationLength = keyframes.length;
|
|
905
|
+
return keyframes.reduce((previous, keyframe, currentIndex) => {
|
|
906
|
+
const keyframePercentage = parseFloat((100 / (animationLength - 1)).toFixed(2)) * currentIndex;
|
|
907
|
+
if (typeof keyframe === "string") {
|
|
908
|
+
return `${previous} ${keyframePercentage}% {${keyframe}}`;
|
|
909
|
+
}
|
|
910
|
+
const keys = Object.keys(keyframe);
|
|
911
|
+
if (keys.length && isNaN(+keys[0])) {
|
|
912
|
+
const keyframeContent = keys.reduce((acc, key) => `${acc} ${camelCaseToDash(key)}: ${keyframe[key]};`, "");
|
|
913
|
+
return `${previous} ${keyframePercentage}% {${keyframeContent}}`;
|
|
914
|
+
}
|
|
915
|
+
return `${previous} ${keys[0]}% {${keyframe[keys[0]]}}`;
|
|
916
|
+
}, "");
|
|
917
|
+
};
|
|
918
|
+
function createStyle({ keyframes, animationName }) {
|
|
919
|
+
return `@keyframes ${animationName} {${generateKeyframes(keyframes)}}`;
|
|
920
|
+
}
|
|
921
|
+
function createTag({ keyframes, animationName }) {
|
|
922
|
+
var _a, _b, _c, _d;
|
|
923
|
+
let styleTag = document.querySelector("style[data-id=rsi]");
|
|
924
|
+
if (!styleTag) {
|
|
925
|
+
styleTag = document.createElement("style");
|
|
926
|
+
styleTag.setAttribute("data-id", "rsi");
|
|
927
|
+
document.head.appendChild(styleTag);
|
|
928
|
+
}
|
|
929
|
+
const index = (_c = (_b = (_a = styleTag.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
930
|
+
try {
|
|
931
|
+
(_d = styleTag.sheet) === null || _d === void 0 ? void 0 : _d.insertRule(createStyle({
|
|
932
|
+
keyframes,
|
|
933
|
+
animationName
|
|
934
|
+
}), index);
|
|
935
|
+
} catch (e) {
|
|
936
|
+
console.error("react simple animate, error found during insert style ", e);
|
|
937
|
+
}
|
|
938
|
+
return {
|
|
939
|
+
styleTag,
|
|
940
|
+
index
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
var deleteRules = (sheet, deleteName) => {
|
|
944
|
+
if (!sheet) {
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
const index = Object.values(sheet.cssRules).findIndex(({ name }) => name === deleteName);
|
|
948
|
+
if (index >= 0) {
|
|
949
|
+
sheet.deleteRule(index);
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
var createRandomName = () => `RSI-${Math.random().toString(36).substr(2, 9)}`;
|
|
953
|
+
var getPlayState = (pause) => pause ? PAUSED : RUNNING;
|
|
954
|
+
function AnimateKeyframes(props) {
|
|
955
|
+
const { children, play = false, pause = false, render, duration = DEFAULT_DURATION, delay = 0, easeType = DEFAULT_EASE_TYPE, direction = DEFAULT_DIRECTION, fillMode = DEFAULT_FILLMODE, iterationCount = 1, sequenceIndex, keyframes, sequenceId } = props;
|
|
956
|
+
let pauseValue;
|
|
957
|
+
const animationNameRef = React__namespace.useRef({
|
|
958
|
+
forward: "",
|
|
959
|
+
reverse: ""
|
|
960
|
+
});
|
|
961
|
+
const controlled = React__namespace.useRef(false);
|
|
962
|
+
const styleTagRef = React__namespace.useRef({
|
|
963
|
+
forward: null,
|
|
964
|
+
reverse: null
|
|
965
|
+
});
|
|
966
|
+
const id = getSequenceId(sequenceIndex, sequenceId);
|
|
967
|
+
const { register, animationStates = {} } = React__namespace.useContext(AnimateContext);
|
|
968
|
+
const animateState = animationStates[id] || {};
|
|
969
|
+
const [, forceUpdate] = React__namespace.useState(false);
|
|
970
|
+
React__namespace.useEffect(() => {
|
|
971
|
+
const styleTag = styleTagRef.current;
|
|
972
|
+
const animationName = animationNameRef.current;
|
|
973
|
+
animationNameRef.current.forward = createRandomName();
|
|
974
|
+
let result = createTag({
|
|
975
|
+
animationName: animationNameRef.current.forward,
|
|
976
|
+
keyframes
|
|
977
|
+
});
|
|
978
|
+
styleTagRef.current.forward = result.styleTag;
|
|
979
|
+
animationNameRef.current.reverse = createRandomName();
|
|
980
|
+
result = createTag({
|
|
981
|
+
animationName: animationNameRef.current.reverse,
|
|
982
|
+
keyframes: keyframes.reverse()
|
|
983
|
+
});
|
|
984
|
+
styleTagRef.current.reverse = result.styleTag;
|
|
985
|
+
register(props);
|
|
986
|
+
if (play) {
|
|
987
|
+
forceUpdate(true);
|
|
988
|
+
}
|
|
989
|
+
return () => {
|
|
990
|
+
var _a, _b;
|
|
991
|
+
deleteRules((_a = styleTag.forward) === null || _a === void 0 ? void 0 : _a.sheet, animationName.forward);
|
|
992
|
+
deleteRules((_b = styleTag.reverse) === null || _b === void 0 ? void 0 : _b.sheet, animationName.reverse);
|
|
993
|
+
};
|
|
994
|
+
}, []);
|
|
995
|
+
if (animateState.controlled && !controlled.current) {
|
|
996
|
+
pauseValue = animateState.pause;
|
|
997
|
+
if (!animateState.pause) {
|
|
998
|
+
controlled.current = true;
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
pauseValue = pause;
|
|
1002
|
+
}
|
|
1003
|
+
const style = {
|
|
1004
|
+
animation: `${duration}s ${easeType} ${animateState.delay || delay}s ${iterationCount} ${direction} ${fillMode} ${getPlayState(pauseValue)} ${((animateState.controlled ? animateState.play : play) ? animationNameRef.current.forward : animationNameRef.current.reverse) || ""}`
|
|
1005
|
+
};
|
|
1006
|
+
return render ? render({ style }) : React__namespace.createElement("div", { style: style || {} }, children);
|
|
1007
|
+
}
|
|
1008
|
+
function useAnimate(props) {
|
|
1009
|
+
const { start, end, complete, onComplete, delay = 0, duration = DEFAULT_DURATION, easeType = DEFAULT_EASE_TYPE } = props;
|
|
1010
|
+
const transition = React__namespace.useMemo(() => `${ALL} ${duration}s ${easeType} ${delay}s`, [duration, easeType, delay]);
|
|
1011
|
+
const [animate, setAnimate] = React__namespace.useState({
|
|
1012
|
+
isPlaying: false,
|
|
1013
|
+
style: { ...start, transition }
|
|
1014
|
+
});
|
|
1015
|
+
const { isPlaying, style } = animate;
|
|
1016
|
+
const onCompleteTimeRef = React__namespace.useRef();
|
|
1017
|
+
React__namespace.useEffect(() => {
|
|
1018
|
+
if ((onComplete || complete) && isPlaying) {
|
|
1019
|
+
onCompleteTimeRef.current = setTimeout(() => {
|
|
1020
|
+
if (onComplete) {
|
|
1021
|
+
onComplete();
|
|
1022
|
+
}
|
|
1023
|
+
if (complete) {
|
|
1024
|
+
setAnimate((animate2) => ({
|
|
1025
|
+
...animate2,
|
|
1026
|
+
style: complete
|
|
1027
|
+
}));
|
|
1028
|
+
}
|
|
1029
|
+
}, secToMs(delay + duration));
|
|
1030
|
+
}
|
|
1031
|
+
return () => onCompleteTimeRef.current && clearTimeout(onCompleteTimeRef.current);
|
|
1032
|
+
}, [animate, complete, delay, duration, isPlaying, onComplete]);
|
|
1033
|
+
return {
|
|
1034
|
+
isPlaying,
|
|
1035
|
+
style,
|
|
1036
|
+
play: React__namespace.useCallback((isPlaying2) => {
|
|
1037
|
+
setAnimate((animate2) => ({
|
|
1038
|
+
...animate2,
|
|
1039
|
+
style: {
|
|
1040
|
+
...isPlaying2 ? end : start,
|
|
1041
|
+
transition
|
|
1042
|
+
},
|
|
1043
|
+
isPlaying: isPlaying2
|
|
1044
|
+
}));
|
|
1045
|
+
}, [end, start, transition])
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
function useAnimateKeyframes(props) {
|
|
1049
|
+
const { duration = DEFAULT_DURATION, delay = 0, easeType = DEFAULT_EASE_TYPE, direction = DEFAULT_DIRECTION, fillMode = DEFAULT_FILLMODE, iterationCount = 1, keyframes } = props;
|
|
1050
|
+
const animationNameRef = React__namespace.useRef({
|
|
1051
|
+
forward: "",
|
|
1052
|
+
reverse: ""
|
|
1053
|
+
});
|
|
1054
|
+
const styleTagRef = React__namespace.useRef({
|
|
1055
|
+
forward: null,
|
|
1056
|
+
reverse: null
|
|
1057
|
+
});
|
|
1058
|
+
const { register } = React__namespace.useContext(AnimateContext);
|
|
1059
|
+
const [isPlaying, setIsPlaying] = React__namespace.useState(null);
|
|
1060
|
+
const [isPaused, setIsPaused] = React__namespace.useState(false);
|
|
1061
|
+
React__namespace.useEffect(() => {
|
|
1062
|
+
const styleTag = styleTagRef.current;
|
|
1063
|
+
const animationName = animationNameRef.current;
|
|
1064
|
+
animationNameRef.current.forward = createRandomName();
|
|
1065
|
+
let result = createTag({
|
|
1066
|
+
animationName: animationNameRef.current.forward,
|
|
1067
|
+
keyframes
|
|
1068
|
+
});
|
|
1069
|
+
styleTagRef.current.forward = result.styleTag;
|
|
1070
|
+
animationNameRef.current.reverse = createRandomName();
|
|
1071
|
+
result = createTag({
|
|
1072
|
+
animationName: animationNameRef.current.reverse,
|
|
1073
|
+
keyframes: keyframes.reverse()
|
|
1074
|
+
});
|
|
1075
|
+
styleTagRef.current.reverse = result.styleTag;
|
|
1076
|
+
register(props);
|
|
1077
|
+
return () => {
|
|
1078
|
+
var _a, _b;
|
|
1079
|
+
deleteRules((_a = styleTag.forward) === null || _a === void 0 ? void 0 : _a.sheet, animationName.forward);
|
|
1080
|
+
deleteRules((_b = styleTag.reverse) === null || _b === void 0 ? void 0 : _b.sheet, animationName.reverse);
|
|
1081
|
+
};
|
|
1082
|
+
}, []);
|
|
1083
|
+
const style = {
|
|
1084
|
+
animation: `${duration}s ${easeType} ${delay}s ${iterationCount} ${direction} ${fillMode} ${getPlayState(isPaused)} ${isPlaying === null ? "" : isPlaying ? animationNameRef.current.forward : animationNameRef.current.reverse}`
|
|
1085
|
+
};
|
|
1086
|
+
return {
|
|
1087
|
+
style,
|
|
1088
|
+
play: setIsPlaying,
|
|
1089
|
+
pause: setIsPaused,
|
|
1090
|
+
isPlaying: !!isPlaying
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
function createArrayWithNumbers(length2) {
|
|
1094
|
+
return Array.from({ length: length2 }, () => null);
|
|
1095
|
+
}
|
|
1096
|
+
function useAnimateGroup(props) {
|
|
1097
|
+
const { sequences = [] } = props;
|
|
1098
|
+
const defaultArray = createArrayWithNumbers(sequences.length).map((_2, index) => props.sequences[index].start);
|
|
1099
|
+
const [styles, setStyles] = React__namespace.useState(defaultArray);
|
|
1100
|
+
const [isPlaying, setPlaying] = React__namespace.useState(false);
|
|
1101
|
+
const animationNamesRef = React__namespace.useRef([]);
|
|
1102
|
+
const styleTagRef = React__namespace.useRef([]);
|
|
1103
|
+
React__namespace.useEffect(() => {
|
|
1104
|
+
sequences.forEach(({ keyframes }, i) => {
|
|
1105
|
+
if (!Array.isArray(keyframes)) {
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
if (!animationNamesRef.current[i]) {
|
|
1109
|
+
animationNamesRef.current[i] = {};
|
|
1110
|
+
styleTagRef.current[i] = {};
|
|
1111
|
+
}
|
|
1112
|
+
animationNamesRef.current[i].forward = createRandomName();
|
|
1113
|
+
let result = createTag({
|
|
1114
|
+
animationName: animationNamesRef.current[i].forward,
|
|
1115
|
+
keyframes
|
|
1116
|
+
});
|
|
1117
|
+
styleTagRef.current[i].forward = result.styleTag;
|
|
1118
|
+
animationNamesRef.current[i].reverse = createRandomName();
|
|
1119
|
+
result = createTag({
|
|
1120
|
+
animationName: animationNamesRef.current[i].reverse,
|
|
1121
|
+
keyframes: keyframes.reverse()
|
|
1122
|
+
});
|
|
1123
|
+
styleTagRef.current[i].reverse = result.styleTag;
|
|
1124
|
+
});
|
|
1125
|
+
const styleTags = styleTagRef.current;
|
|
1126
|
+
const animationNames = animationNamesRef.current;
|
|
1127
|
+
return () => Object.values(animationNames).forEach(({ forward, reverse }, i) => {
|
|
1128
|
+
var _a, _b;
|
|
1129
|
+
deleteRules((_a = styleTags[i].forward) === null || _a === void 0 ? void 0 : _a.sheet, forward);
|
|
1130
|
+
deleteRules((_b = styleTags[i].reverse) === null || _b === void 0 ? void 0 : _b.sheet, reverse);
|
|
1131
|
+
});
|
|
1132
|
+
}, []);
|
|
1133
|
+
const play = React__namespace.useCallback((isPlay) => {
|
|
1134
|
+
let totalDuration = 0;
|
|
1135
|
+
const animationRefWithOrder = isPlay ? animationNamesRef.current : [...animationNamesRef.current].reverse();
|
|
1136
|
+
const styles2 = (isPlay ? sequences : [...sequences].reverse()).map((current, currentIndex) => {
|
|
1137
|
+
const { duration = DEFAULT_DURATION, delay = 0, overlay, keyframes, iterationCount = 1, easeType = DEFAULT_EASE_TYPE, direction = DEFAULT_DIRECTION, fillMode = DEFAULT_FILLMODE, end = {}, start = {} } = current;
|
|
1138
|
+
const delayDuration = currentIndex === 0 ? delay : totalDuration;
|
|
1139
|
+
const transition = `${ALL} ${duration}s ${easeType} ${delayDuration}s`;
|
|
1140
|
+
totalDuration = calculateTotalDuration({ duration, delay, overlay }) + totalDuration;
|
|
1141
|
+
return keyframes ? {
|
|
1142
|
+
animation: `${duration}s ${easeType} ${delayDuration}s ${iterationCount} ${direction} ${fillMode} ${RUNNING} ${isPlay ? animationRefWithOrder[currentIndex].forward : animationRefWithOrder[currentIndex].reverse}`
|
|
1143
|
+
} : {
|
|
1144
|
+
...isPlay ? end : start,
|
|
1145
|
+
transition
|
|
1146
|
+
};
|
|
1147
|
+
});
|
|
1148
|
+
setStyles(isPlay ? styles2 : [...styles2].reverse());
|
|
1149
|
+
setPlaying(isPlay);
|
|
1150
|
+
}, []);
|
|
1151
|
+
return { styles, play, isPlaying };
|
|
1152
|
+
}
|
|
1153
|
+
var Animate_1 = dist.Animate = Animate;
|
|
1154
|
+
dist.AnimateGroup = AnimateGroup;
|
|
1155
|
+
dist.AnimateKeyframes = AnimateKeyframes;
|
|
1156
|
+
dist.useAnimate = useAnimate;
|
|
1157
|
+
dist.useAnimateGroup = useAnimateGroup;
|
|
1158
|
+
dist.useAnimateKeyframes = useAnimateKeyframes;
|
|
1159
|
+
function _extends() {
|
|
1160
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
1161
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1162
|
+
var source = arguments[i];
|
|
1163
|
+
for (var key in source) {
|
|
1164
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1165
|
+
target[key] = source[key];
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
return target;
|
|
1170
|
+
};
|
|
1171
|
+
return _extends.apply(this, arguments);
|
|
1172
|
+
}
|
|
1173
|
+
function memoize(fn) {
|
|
1174
|
+
var cache = /* @__PURE__ */ Object.create(null);
|
|
1175
|
+
return function(arg) {
|
|
1176
|
+
if (cache[arg] === void 0)
|
|
1177
|
+
cache[arg] = fn(arg);
|
|
1178
|
+
return cache[arg];
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
|
|
1182
|
+
var isPropValid = /* @__PURE__ */ memoize(
|
|
1183
|
+
function(prop) {
|
|
1184
|
+
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
1185
|
+
}
|
|
1186
|
+
);
|
|
1187
|
+
function sheetForTag(tag) {
|
|
1188
|
+
if (tag.sheet) {
|
|
1189
|
+
return tag.sheet;
|
|
1190
|
+
}
|
|
1191
|
+
for (var i = 0; i < document.styleSheets.length; i++) {
|
|
1192
|
+
if (document.styleSheets[i].ownerNode === tag) {
|
|
1193
|
+
return document.styleSheets[i];
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
function createStyleElement(options) {
|
|
1198
|
+
var tag = document.createElement("style");
|
|
1199
|
+
tag.setAttribute("data-emotion", options.key);
|
|
1200
|
+
if (options.nonce !== void 0) {
|
|
1201
|
+
tag.setAttribute("nonce", options.nonce);
|
|
1202
|
+
}
|
|
1203
|
+
tag.appendChild(document.createTextNode(""));
|
|
1204
|
+
tag.setAttribute("data-s", "");
|
|
1205
|
+
return tag;
|
|
1206
|
+
}
|
|
1207
|
+
var StyleSheet = /* @__PURE__ */ function() {
|
|
1208
|
+
function StyleSheet2(options) {
|
|
1209
|
+
var _this = this;
|
|
1210
|
+
this._insertTag = function(tag) {
|
|
1211
|
+
var before;
|
|
1212
|
+
if (_this.tags.length === 0) {
|
|
1213
|
+
if (_this.insertionPoint) {
|
|
1214
|
+
before = _this.insertionPoint.nextSibling;
|
|
1215
|
+
} else if (_this.prepend) {
|
|
1216
|
+
before = _this.container.firstChild;
|
|
1217
|
+
} else {
|
|
1218
|
+
before = _this.before;
|
|
1219
|
+
}
|
|
1220
|
+
} else {
|
|
1221
|
+
before = _this.tags[_this.tags.length - 1].nextSibling;
|
|
1222
|
+
}
|
|
1223
|
+
_this.container.insertBefore(tag, before);
|
|
1224
|
+
_this.tags.push(tag);
|
|
1225
|
+
};
|
|
1226
|
+
this.isSpeedy = options.speedy === void 0 ? process.env.NODE_ENV === "production" : options.speedy;
|
|
1227
|
+
this.tags = [];
|
|
1228
|
+
this.ctr = 0;
|
|
1229
|
+
this.nonce = options.nonce;
|
|
1230
|
+
this.key = options.key;
|
|
1231
|
+
this.container = options.container;
|
|
1232
|
+
this.prepend = options.prepend;
|
|
1233
|
+
this.insertionPoint = options.insertionPoint;
|
|
1234
|
+
this.before = null;
|
|
1235
|
+
}
|
|
1236
|
+
var _proto = StyleSheet2.prototype;
|
|
1237
|
+
_proto.hydrate = function hydrate(nodes) {
|
|
1238
|
+
nodes.forEach(this._insertTag);
|
|
1239
|
+
};
|
|
1240
|
+
_proto.insert = function insert(rule) {
|
|
1241
|
+
if (this.ctr % (this.isSpeedy ? 65e3 : 1) === 0) {
|
|
1242
|
+
this._insertTag(createStyleElement(this));
|
|
1243
|
+
}
|
|
1244
|
+
var tag = this.tags[this.tags.length - 1];
|
|
1245
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1246
|
+
var isImportRule3 = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
|
|
1247
|
+
if (isImportRule3 && this._alreadyInsertedOrderInsensitiveRule) {
|
|
1248
|
+
console.error("You're attempting to insert the following rule:\n" + rule + "\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.");
|
|
1249
|
+
}
|
|
1250
|
+
this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule3;
|
|
1251
|
+
}
|
|
1252
|
+
if (this.isSpeedy) {
|
|
1253
|
+
var sheet = sheetForTag(tag);
|
|
1254
|
+
try {
|
|
1255
|
+
sheet.insertRule(rule, sheet.cssRules.length);
|
|
1256
|
+
} catch (e) {
|
|
1257
|
+
if (process.env.NODE_ENV !== "production" && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) {
|
|
1258
|
+
console.error('There was a problem inserting the following rule: "' + rule + '"', e);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
} else {
|
|
1262
|
+
tag.appendChild(document.createTextNode(rule));
|
|
1263
|
+
}
|
|
1264
|
+
this.ctr++;
|
|
1265
|
+
};
|
|
1266
|
+
_proto.flush = function flush() {
|
|
1267
|
+
this.tags.forEach(function(tag) {
|
|
1268
|
+
return tag.parentNode && tag.parentNode.removeChild(tag);
|
|
1269
|
+
});
|
|
1270
|
+
this.tags = [];
|
|
1271
|
+
this.ctr = 0;
|
|
1272
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1273
|
+
this._alreadyInsertedOrderInsensitiveRule = false;
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
return StyleSheet2;
|
|
1277
|
+
}();
|
|
1278
|
+
var MS = "-ms-";
|
|
1279
|
+
var MOZ = "-moz-";
|
|
1280
|
+
var WEBKIT = "-webkit-";
|
|
1281
|
+
var COMMENT = "comm";
|
|
1282
|
+
var RULESET = "rule";
|
|
1283
|
+
var DECLARATION = "decl";
|
|
1284
|
+
var IMPORT = "@import";
|
|
1285
|
+
var KEYFRAMES = "@keyframes";
|
|
1286
|
+
var LAYER = "@layer";
|
|
1287
|
+
var abs = Math.abs;
|
|
1288
|
+
var from = String.fromCharCode;
|
|
1289
|
+
var assign = Object.assign;
|
|
1290
|
+
function hash(value, length2) {
|
|
1291
|
+
return charat(value, 0) ^ 45 ? (((length2 << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3) : 0;
|
|
1292
|
+
}
|
|
1293
|
+
function trim(value) {
|
|
1294
|
+
return value.trim();
|
|
1295
|
+
}
|
|
1296
|
+
function match(value, pattern) {
|
|
1297
|
+
return (value = pattern.exec(value)) ? value[0] : value;
|
|
1298
|
+
}
|
|
1299
|
+
function replace(value, pattern, replacement) {
|
|
1300
|
+
return value.replace(pattern, replacement);
|
|
1301
|
+
}
|
|
1302
|
+
function indexof(value, search) {
|
|
1303
|
+
return value.indexOf(search);
|
|
1304
|
+
}
|
|
1305
|
+
function charat(value, index) {
|
|
1306
|
+
return value.charCodeAt(index) | 0;
|
|
1307
|
+
}
|
|
1308
|
+
function substr(value, begin, end) {
|
|
1309
|
+
return value.slice(begin, end);
|
|
1310
|
+
}
|
|
1311
|
+
function strlen(value) {
|
|
1312
|
+
return value.length;
|
|
1313
|
+
}
|
|
1314
|
+
function sizeof(value) {
|
|
1315
|
+
return value.length;
|
|
1316
|
+
}
|
|
1317
|
+
function append(value, array) {
|
|
1318
|
+
return array.push(value), value;
|
|
1319
|
+
}
|
|
1320
|
+
function combine(array, callback) {
|
|
1321
|
+
return array.map(callback).join("");
|
|
1322
|
+
}
|
|
1323
|
+
var line = 1;
|
|
1324
|
+
var column = 1;
|
|
1325
|
+
var length = 0;
|
|
1326
|
+
var position = 0;
|
|
1327
|
+
var character = 0;
|
|
1328
|
+
var characters = "";
|
|
1329
|
+
function node(value, root, parent, type, props, children, length2) {
|
|
1330
|
+
return { value, root, parent, type, props, children, line, column, length: length2, return: "" };
|
|
1331
|
+
}
|
|
1332
|
+
function copy(root, props) {
|
|
1333
|
+
return assign(node("", null, null, "", null, null, 0), root, { length: -root.length }, props);
|
|
1334
|
+
}
|
|
1335
|
+
function char() {
|
|
1336
|
+
return character;
|
|
1337
|
+
}
|
|
1338
|
+
function prev() {
|
|
1339
|
+
character = position > 0 ? charat(characters, --position) : 0;
|
|
1340
|
+
if (column--, character === 10)
|
|
1341
|
+
column = 1, line--;
|
|
1342
|
+
return character;
|
|
1343
|
+
}
|
|
1344
|
+
function next() {
|
|
1345
|
+
character = position < length ? charat(characters, position++) : 0;
|
|
1346
|
+
if (column++, character === 10)
|
|
1347
|
+
column = 1, line++;
|
|
1348
|
+
return character;
|
|
1349
|
+
}
|
|
1350
|
+
function peek() {
|
|
1351
|
+
return charat(characters, position);
|
|
1352
|
+
}
|
|
1353
|
+
function caret() {
|
|
1354
|
+
return position;
|
|
1355
|
+
}
|
|
1356
|
+
function slice(begin, end) {
|
|
1357
|
+
return substr(characters, begin, end);
|
|
1358
|
+
}
|
|
1359
|
+
function token(type) {
|
|
1360
|
+
switch (type) {
|
|
1361
|
+
case 0:
|
|
1362
|
+
case 9:
|
|
1363
|
+
case 10:
|
|
1364
|
+
case 13:
|
|
1365
|
+
case 32:
|
|
1366
|
+
return 5;
|
|
1367
|
+
case 33:
|
|
1368
|
+
case 43:
|
|
1369
|
+
case 44:
|
|
1370
|
+
case 47:
|
|
1371
|
+
case 62:
|
|
1372
|
+
case 64:
|
|
1373
|
+
case 126:
|
|
1374
|
+
case 59:
|
|
1375
|
+
case 123:
|
|
1376
|
+
case 125:
|
|
1377
|
+
return 4;
|
|
1378
|
+
case 58:
|
|
1379
|
+
return 3;
|
|
1380
|
+
case 34:
|
|
1381
|
+
case 39:
|
|
1382
|
+
case 40:
|
|
1383
|
+
case 91:
|
|
1384
|
+
return 2;
|
|
1385
|
+
case 41:
|
|
1386
|
+
case 93:
|
|
1387
|
+
return 1;
|
|
1388
|
+
}
|
|
1389
|
+
return 0;
|
|
1390
|
+
}
|
|
1391
|
+
function alloc(value) {
|
|
1392
|
+
return line = column = 1, length = strlen(characters = value), position = 0, [];
|
|
1393
|
+
}
|
|
1394
|
+
function dealloc(value) {
|
|
1395
|
+
return characters = "", value;
|
|
1396
|
+
}
|
|
1397
|
+
function delimit(type) {
|
|
1398
|
+
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
|
|
1399
|
+
}
|
|
1400
|
+
function whitespace(type) {
|
|
1401
|
+
while (character = peek())
|
|
1402
|
+
if (character < 33)
|
|
1403
|
+
next();
|
|
1404
|
+
else
|
|
1405
|
+
break;
|
|
1406
|
+
return token(type) > 2 || token(character) > 3 ? "" : " ";
|
|
1407
|
+
}
|
|
1408
|
+
function escaping(index, count) {
|
|
1409
|
+
while (--count && next())
|
|
1410
|
+
if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
|
|
1411
|
+
break;
|
|
1412
|
+
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
|
|
1413
|
+
}
|
|
1414
|
+
function delimiter(type) {
|
|
1415
|
+
while (next())
|
|
1416
|
+
switch (character) {
|
|
1417
|
+
case type:
|
|
1418
|
+
return position;
|
|
1419
|
+
case 34:
|
|
1420
|
+
case 39:
|
|
1421
|
+
if (type !== 34 && type !== 39)
|
|
1422
|
+
delimiter(character);
|
|
1423
|
+
break;
|
|
1424
|
+
case 40:
|
|
1425
|
+
if (type === 41)
|
|
1426
|
+
delimiter(type);
|
|
1427
|
+
break;
|
|
1428
|
+
case 92:
|
|
1429
|
+
next();
|
|
1430
|
+
break;
|
|
1431
|
+
}
|
|
1432
|
+
return position;
|
|
1433
|
+
}
|
|
1434
|
+
function commenter(type, index) {
|
|
1435
|
+
while (next())
|
|
1436
|
+
if (type + character === 47 + 10)
|
|
1437
|
+
break;
|
|
1438
|
+
else if (type + character === 42 + 42 && peek() === 47)
|
|
1439
|
+
break;
|
|
1440
|
+
return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
|
|
1441
|
+
}
|
|
1442
|
+
function identifier(index) {
|
|
1443
|
+
while (!token(peek()))
|
|
1444
|
+
next();
|
|
1445
|
+
return slice(index, position);
|
|
1446
|
+
}
|
|
1447
|
+
function compile(value) {
|
|
1448
|
+
return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value));
|
|
1449
|
+
}
|
|
1450
|
+
function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
|
1451
|
+
var index = 0;
|
|
1452
|
+
var offset = 0;
|
|
1453
|
+
var length2 = pseudo;
|
|
1454
|
+
var atrule = 0;
|
|
1455
|
+
var property = 0;
|
|
1456
|
+
var previous = 0;
|
|
1457
|
+
var variable = 1;
|
|
1458
|
+
var scanning = 1;
|
|
1459
|
+
var ampersand = 1;
|
|
1460
|
+
var character2 = 0;
|
|
1461
|
+
var type = "";
|
|
1462
|
+
var props = rules;
|
|
1463
|
+
var children = rulesets;
|
|
1464
|
+
var reference = rule;
|
|
1465
|
+
var characters2 = type;
|
|
1466
|
+
while (scanning)
|
|
1467
|
+
switch (previous = character2, character2 = next()) {
|
|
1468
|
+
case 40:
|
|
1469
|
+
if (previous != 108 && charat(characters2, length2 - 1) == 58) {
|
|
1470
|
+
if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f") != -1)
|
|
1471
|
+
ampersand = -1;
|
|
1472
|
+
break;
|
|
1473
|
+
}
|
|
1474
|
+
case 34:
|
|
1475
|
+
case 39:
|
|
1476
|
+
case 91:
|
|
1477
|
+
characters2 += delimit(character2);
|
|
1478
|
+
break;
|
|
1479
|
+
case 9:
|
|
1480
|
+
case 10:
|
|
1481
|
+
case 13:
|
|
1482
|
+
case 32:
|
|
1483
|
+
characters2 += whitespace(previous);
|
|
1484
|
+
break;
|
|
1485
|
+
case 92:
|
|
1486
|
+
characters2 += escaping(caret() - 1, 7);
|
|
1487
|
+
continue;
|
|
1488
|
+
case 47:
|
|
1489
|
+
switch (peek()) {
|
|
1490
|
+
case 42:
|
|
1491
|
+
case 47:
|
|
1492
|
+
append(comment(commenter(next(), caret()), root, parent), declarations);
|
|
1493
|
+
break;
|
|
1494
|
+
default:
|
|
1495
|
+
characters2 += "/";
|
|
1496
|
+
}
|
|
1497
|
+
break;
|
|
1498
|
+
case 123 * variable:
|
|
1499
|
+
points[index++] = strlen(characters2) * ampersand;
|
|
1500
|
+
case 125 * variable:
|
|
1501
|
+
case 59:
|
|
1502
|
+
case 0:
|
|
1503
|
+
switch (character2) {
|
|
1504
|
+
case 0:
|
|
1505
|
+
case 125:
|
|
1506
|
+
scanning = 0;
|
|
1507
|
+
case 59 + offset:
|
|
1508
|
+
if (ampersand == -1)
|
|
1509
|
+
characters2 = replace(characters2, /\f/g, "");
|
|
1510
|
+
if (property > 0 && strlen(characters2) - length2)
|
|
1511
|
+
append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2), declarations);
|
|
1512
|
+
break;
|
|
1513
|
+
case 59:
|
|
1514
|
+
characters2 += ";";
|
|
1515
|
+
default:
|
|
1516
|
+
append(reference = ruleset(characters2, root, parent, index, offset, rules, points, type, props = [], children = [], length2), rulesets);
|
|
1517
|
+
if (character2 === 123)
|
|
1518
|
+
if (offset === 0)
|
|
1519
|
+
parse(characters2, root, reference, reference, props, rulesets, length2, points, children);
|
|
1520
|
+
else
|
|
1521
|
+
switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
|
|
1522
|
+
case 100:
|
|
1523
|
+
case 108:
|
|
1524
|
+
case 109:
|
|
1525
|
+
case 115:
|
|
1526
|
+
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length2), children), rules, children, length2, points, rule ? props : children);
|
|
1527
|
+
break;
|
|
1528
|
+
default:
|
|
1529
|
+
parse(characters2, reference, reference, reference, [""], children, 0, points, children);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
index = offset = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo;
|
|
1533
|
+
break;
|
|
1534
|
+
case 58:
|
|
1535
|
+
length2 = 1 + strlen(characters2), property = previous;
|
|
1536
|
+
default:
|
|
1537
|
+
if (variable < 1) {
|
|
1538
|
+
if (character2 == 123)
|
|
1539
|
+
--variable;
|
|
1540
|
+
else if (character2 == 125 && variable++ == 0 && prev() == 125)
|
|
1541
|
+
continue;
|
|
1542
|
+
}
|
|
1543
|
+
switch (characters2 += from(character2), character2 * variable) {
|
|
1544
|
+
case 38:
|
|
1545
|
+
ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
|
|
1546
|
+
break;
|
|
1547
|
+
case 44:
|
|
1548
|
+
points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
|
|
1549
|
+
break;
|
|
1550
|
+
case 64:
|
|
1551
|
+
if (peek() === 45)
|
|
1552
|
+
characters2 += delimit(next());
|
|
1553
|
+
atrule = peek(), offset = length2 = strlen(type = characters2 += identifier(caret())), character2++;
|
|
1554
|
+
break;
|
|
1555
|
+
case 45:
|
|
1556
|
+
if (previous === 45 && strlen(characters2) == 2)
|
|
1557
|
+
variable = 0;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
return rulesets;
|
|
1561
|
+
}
|
|
1562
|
+
function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length2) {
|
|
1563
|
+
var post = offset - 1;
|
|
1564
|
+
var rule = offset === 0 ? rules : [""];
|
|
1565
|
+
var size = sizeof(rule);
|
|
1566
|
+
for (var i = 0, j2 = 0, k2 = 0; i < index; ++i)
|
|
1567
|
+
for (var x2 = 0, y2 = substr(value, post + 1, post = abs(j2 = points[i])), z2 = value; x2 < size; ++x2)
|
|
1568
|
+
if (z2 = trim(j2 > 0 ? rule[x2] + " " + y2 : replace(y2, /&\f/g, rule[x2])))
|
|
1569
|
+
props[k2++] = z2;
|
|
1570
|
+
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length2);
|
|
1571
|
+
}
|
|
1572
|
+
function comment(value, root, parent) {
|
|
1573
|
+
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
|
|
1574
|
+
}
|
|
1575
|
+
function declaration(value, root, parent, length2) {
|
|
1576
|
+
return node(value, root, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2);
|
|
1577
|
+
}
|
|
1578
|
+
function serialize(children, callback) {
|
|
1579
|
+
var output = "";
|
|
1580
|
+
var length2 = sizeof(children);
|
|
1581
|
+
for (var i = 0; i < length2; i++)
|
|
1582
|
+
output += callback(children[i], i, children, callback) || "";
|
|
1583
|
+
return output;
|
|
1584
|
+
}
|
|
1585
|
+
function stringify(element, index, children, callback) {
|
|
1586
|
+
switch (element.type) {
|
|
1587
|
+
case LAYER:
|
|
1588
|
+
if (element.children.length)
|
|
1589
|
+
break;
|
|
1590
|
+
case IMPORT:
|
|
1591
|
+
case DECLARATION:
|
|
1592
|
+
return element.return = element.return || element.value;
|
|
1593
|
+
case COMMENT:
|
|
1594
|
+
return "";
|
|
1595
|
+
case KEYFRAMES:
|
|
1596
|
+
return element.return = element.value + "{" + serialize(element.children, callback) + "}";
|
|
1597
|
+
case RULESET:
|
|
1598
|
+
element.value = element.props.join(",");
|
|
1599
|
+
}
|
|
1600
|
+
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
|
|
1601
|
+
}
|
|
1602
|
+
function middleware(collection) {
|
|
1603
|
+
var length2 = sizeof(collection);
|
|
1604
|
+
return function(element, index, children, callback) {
|
|
1605
|
+
var output = "";
|
|
1606
|
+
for (var i = 0; i < length2; i++)
|
|
1607
|
+
output += collection[i](element, index, children, callback) || "";
|
|
1608
|
+
return output;
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
function rulesheet(callback) {
|
|
1612
|
+
return function(element) {
|
|
1613
|
+
if (!element.root) {
|
|
1614
|
+
if (element = element.return)
|
|
1615
|
+
callback(element);
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
var identifierWithPointTracking = function identifierWithPointTracking2(begin, points, index) {
|
|
1620
|
+
var previous = 0;
|
|
1621
|
+
var character2 = 0;
|
|
1622
|
+
while (true) {
|
|
1623
|
+
previous = character2;
|
|
1624
|
+
character2 = peek();
|
|
1625
|
+
if (previous === 38 && character2 === 12) {
|
|
1626
|
+
points[index] = 1;
|
|
1627
|
+
}
|
|
1628
|
+
if (token(character2)) {
|
|
1629
|
+
break;
|
|
1630
|
+
}
|
|
1631
|
+
next();
|
|
1632
|
+
}
|
|
1633
|
+
return slice(begin, position);
|
|
1634
|
+
};
|
|
1635
|
+
var toRules = function toRules2(parsed, points) {
|
|
1636
|
+
var index = -1;
|
|
1637
|
+
var character2 = 44;
|
|
1638
|
+
do {
|
|
1639
|
+
switch (token(character2)) {
|
|
1640
|
+
case 0:
|
|
1641
|
+
if (character2 === 38 && peek() === 12) {
|
|
1642
|
+
points[index] = 1;
|
|
1643
|
+
}
|
|
1644
|
+
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
|
1645
|
+
break;
|
|
1646
|
+
case 2:
|
|
1647
|
+
parsed[index] += delimit(character2);
|
|
1648
|
+
break;
|
|
1649
|
+
case 4:
|
|
1650
|
+
if (character2 === 44) {
|
|
1651
|
+
parsed[++index] = peek() === 58 ? "&\f" : "";
|
|
1652
|
+
points[index] = parsed[index].length;
|
|
1653
|
+
break;
|
|
1654
|
+
}
|
|
1655
|
+
default:
|
|
1656
|
+
parsed[index] += from(character2);
|
|
1657
|
+
}
|
|
1658
|
+
} while (character2 = next());
|
|
1659
|
+
return parsed;
|
|
1660
|
+
};
|
|
1661
|
+
var getRules = function getRules2(value, points) {
|
|
1662
|
+
return dealloc(toRules(alloc(value), points));
|
|
1663
|
+
};
|
|
1664
|
+
var fixedElements = /* @__PURE__ */ new WeakMap();
|
|
1665
|
+
var compat = function compat2(element) {
|
|
1666
|
+
if (element.type !== "rule" || !element.parent || element.length < 1) {
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
var value = element.value, parent = element.parent;
|
|
1670
|
+
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
|
1671
|
+
while (parent.type !== "rule") {
|
|
1672
|
+
parent = parent.parent;
|
|
1673
|
+
if (!parent)
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
if (element.props.length === 1 && value.charCodeAt(0) !== 58 && !fixedElements.get(parent)) {
|
|
1677
|
+
return;
|
|
1678
|
+
}
|
|
1679
|
+
if (isImplicitRule) {
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
fixedElements.set(element, true);
|
|
1683
|
+
var points = [];
|
|
1684
|
+
var rules = getRules(value, points);
|
|
1685
|
+
var parentRules = parent.props;
|
|
1686
|
+
for (var i = 0, k2 = 0; i < rules.length; i++) {
|
|
1687
|
+
for (var j2 = 0; j2 < parentRules.length; j2++, k2++) {
|
|
1688
|
+
element.props[k2] = points[i] ? rules[i].replace(/&\f/g, parentRules[j2]) : parentRules[j2] + " " + rules[i];
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
var removeLabel = function removeLabel2(element) {
|
|
1693
|
+
if (element.type === "decl") {
|
|
1694
|
+
var value = element.value;
|
|
1695
|
+
if (value.charCodeAt(0) === 108 && value.charCodeAt(2) === 98) {
|
|
1696
|
+
element["return"] = "";
|
|
1697
|
+
element.value = "";
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
var ignoreFlag = "emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason";
|
|
1702
|
+
var isIgnoringComment = function isIgnoringComment2(element) {
|
|
1703
|
+
return element.type === "comm" && element.children.indexOf(ignoreFlag) > -1;
|
|
1704
|
+
};
|
|
1705
|
+
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm2(cache) {
|
|
1706
|
+
return function(element, index, children) {
|
|
1707
|
+
if (element.type !== "rule" || cache.compat)
|
|
1708
|
+
return;
|
|
1709
|
+
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
|
1710
|
+
if (unsafePseudoClasses) {
|
|
1711
|
+
var isNested = !!element.parent;
|
|
1712
|
+
var commentContainer = isNested ? element.parent.children : children;
|
|
1713
|
+
for (var i = commentContainer.length - 1; i >= 0; i--) {
|
|
1714
|
+
var node2 = commentContainer[i];
|
|
1715
|
+
if (node2.line < element.line) {
|
|
1716
|
+
break;
|
|
1717
|
+
}
|
|
1718
|
+
if (node2.column < element.column) {
|
|
1719
|
+
if (isIgnoringComment(node2)) {
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
break;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
unsafePseudoClasses.forEach(function(unsafePseudoClass) {
|
|
1726
|
+
console.error('The pseudo class "' + unsafePseudoClass + '" is potentially unsafe when doing server-side rendering. Try changing it to "' + unsafePseudoClass.split("-child")[0] + '-of-type".');
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
};
|
|
1731
|
+
var isImportRule = function isImportRule2(element) {
|
|
1732
|
+
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
|
|
1733
|
+
};
|
|
1734
|
+
var isPrependedWithRegularRules = function isPrependedWithRegularRules2(index, children) {
|
|
1735
|
+
for (var i = index - 1; i >= 0; i--) {
|
|
1736
|
+
if (!isImportRule(children[i])) {
|
|
1737
|
+
return true;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
return false;
|
|
1741
|
+
};
|
|
1742
|
+
var nullifyElement = function nullifyElement2(element) {
|
|
1743
|
+
element.type = "";
|
|
1744
|
+
element.value = "";
|
|
1745
|
+
element["return"] = "";
|
|
1746
|
+
element.children = "";
|
|
1747
|
+
element.props = "";
|
|
1748
|
+
};
|
|
1749
|
+
var incorrectImportAlarm = function incorrectImportAlarm2(element, index, children) {
|
|
1750
|
+
if (!isImportRule(element)) {
|
|
1751
|
+
return;
|
|
1752
|
+
}
|
|
1753
|
+
if (element.parent) {
|
|
1754
|
+
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
|
|
1755
|
+
nullifyElement(element);
|
|
1756
|
+
} else if (isPrependedWithRegularRules(index, children)) {
|
|
1757
|
+
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
|
|
1758
|
+
nullifyElement(element);
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
function prefix(value, length2) {
|
|
1762
|
+
switch (hash(value, length2)) {
|
|
1763
|
+
case 5103:
|
|
1764
|
+
return WEBKIT + "print-" + value + value;
|
|
1765
|
+
case 5737:
|
|
1766
|
+
case 4201:
|
|
1767
|
+
case 3177:
|
|
1768
|
+
case 3433:
|
|
1769
|
+
case 1641:
|
|
1770
|
+
case 4457:
|
|
1771
|
+
case 2921:
|
|
1772
|
+
case 5572:
|
|
1773
|
+
case 6356:
|
|
1774
|
+
case 5844:
|
|
1775
|
+
case 3191:
|
|
1776
|
+
case 6645:
|
|
1777
|
+
case 3005:
|
|
1778
|
+
case 6391:
|
|
1779
|
+
case 5879:
|
|
1780
|
+
case 5623:
|
|
1781
|
+
case 6135:
|
|
1782
|
+
case 4599:
|
|
1783
|
+
case 4855:
|
|
1784
|
+
case 4215:
|
|
1785
|
+
case 6389:
|
|
1786
|
+
case 5109:
|
|
1787
|
+
case 5365:
|
|
1788
|
+
case 5621:
|
|
1789
|
+
case 3829:
|
|
1790
|
+
return WEBKIT + value + value;
|
|
1791
|
+
case 5349:
|
|
1792
|
+
case 4246:
|
|
1793
|
+
case 4810:
|
|
1794
|
+
case 6968:
|
|
1795
|
+
case 2756:
|
|
1796
|
+
return WEBKIT + value + MOZ + value + MS + value + value;
|
|
1797
|
+
case 6828:
|
|
1798
|
+
case 4268:
|
|
1799
|
+
return WEBKIT + value + MS + value + value;
|
|
1800
|
+
case 6165:
|
|
1801
|
+
return WEBKIT + value + MS + "flex-" + value + value;
|
|
1802
|
+
case 5187:
|
|
1803
|
+
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
|
|
1804
|
+
case 5443:
|
|
1805
|
+
return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/, "") + value;
|
|
1806
|
+
case 4675:
|
|
1807
|
+
return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/, "") + value;
|
|
1808
|
+
case 5548:
|
|
1809
|
+
return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
|
|
1810
|
+
case 5292:
|
|
1811
|
+
return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
|
|
1812
|
+
case 6060:
|
|
1813
|
+
return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
|
|
1814
|
+
case 4554:
|
|
1815
|
+
return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
|
|
1816
|
+
case 6187:
|
|
1817
|
+
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
|
|
1818
|
+
case 5495:
|
|
1819
|
+
case 3959:
|
|
1820
|
+
return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
|
|
1821
|
+
case 4968:
|
|
1822
|
+
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
|
|
1823
|
+
case 4095:
|
|
1824
|
+
case 3583:
|
|
1825
|
+
case 4068:
|
|
1826
|
+
case 2532:
|
|
1827
|
+
return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
|
|
1828
|
+
case 8116:
|
|
1829
|
+
case 7059:
|
|
1830
|
+
case 5753:
|
|
1831
|
+
case 5535:
|
|
1832
|
+
case 5445:
|
|
1833
|
+
case 5701:
|
|
1834
|
+
case 4933:
|
|
1835
|
+
case 4677:
|
|
1836
|
+
case 5533:
|
|
1837
|
+
case 5789:
|
|
1838
|
+
case 5021:
|
|
1839
|
+
case 4765:
|
|
1840
|
+
if (strlen(value) - 1 - length2 > 6)
|
|
1841
|
+
switch (charat(value, length2 + 1)) {
|
|
1842
|
+
case 109:
|
|
1843
|
+
if (charat(value, length2 + 4) !== 45)
|
|
1844
|
+
break;
|
|
1845
|
+
case 102:
|
|
1846
|
+
return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length2 + 3) == 108 ? "$3" : "$2-$3")) + value;
|
|
1847
|
+
case 115:
|
|
1848
|
+
return ~indexof(value, "stretch") ? prefix(replace(value, "stretch", "fill-available"), length2) + value : value;
|
|
1849
|
+
}
|
|
1850
|
+
break;
|
|
1851
|
+
case 4949:
|
|
1852
|
+
if (charat(value, length2 + 1) !== 115)
|
|
1853
|
+
break;
|
|
1854
|
+
case 6444:
|
|
1855
|
+
switch (charat(value, strlen(value) - 3 - (~indexof(value, "!important") && 10))) {
|
|
1856
|
+
case 107:
|
|
1857
|
+
return replace(value, ":", ":" + WEBKIT) + value;
|
|
1858
|
+
case 101:
|
|
1859
|
+
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
|
|
1860
|
+
}
|
|
1861
|
+
break;
|
|
1862
|
+
case 5936:
|
|
1863
|
+
switch (charat(value, length2 + 11)) {
|
|
1864
|
+
case 114:
|
|
1865
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
|
|
1866
|
+
case 108:
|
|
1867
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
|
|
1868
|
+
case 45:
|
|
1869
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
|
|
1870
|
+
}
|
|
1871
|
+
return WEBKIT + value + MS + value + value;
|
|
1872
|
+
}
|
|
1873
|
+
return value;
|
|
1874
|
+
}
|
|
1875
|
+
var prefixer = function prefixer2(element, index, children, callback) {
|
|
1876
|
+
if (element.length > -1) {
|
|
1877
|
+
if (!element["return"])
|
|
1878
|
+
switch (element.type) {
|
|
1879
|
+
case DECLARATION:
|
|
1880
|
+
element["return"] = prefix(element.value, element.length);
|
|
1881
|
+
break;
|
|
1882
|
+
case KEYFRAMES:
|
|
1883
|
+
return serialize([copy(element, {
|
|
1884
|
+
value: replace(element.value, "@", "@" + WEBKIT)
|
|
1885
|
+
})], callback);
|
|
1886
|
+
case RULESET:
|
|
1887
|
+
if (element.length)
|
|
1888
|
+
return combine(element.props, function(value) {
|
|
1889
|
+
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
|
1890
|
+
case ":read-only":
|
|
1891
|
+
case ":read-write":
|
|
1892
|
+
return serialize([copy(element, {
|
|
1893
|
+
props: [replace(value, /:(read-\w+)/, ":" + MOZ + "$1")]
|
|
1894
|
+
})], callback);
|
|
1895
|
+
case "::placeholder":
|
|
1896
|
+
return serialize([copy(element, {
|
|
1897
|
+
props: [replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")]
|
|
1898
|
+
}), copy(element, {
|
|
1899
|
+
props: [replace(value, /:(plac\w+)/, ":" + MOZ + "$1")]
|
|
1900
|
+
}), copy(element, {
|
|
1901
|
+
props: [replace(value, /:(plac\w+)/, MS + "input-$1")]
|
|
1902
|
+
})], callback);
|
|
1903
|
+
}
|
|
1904
|
+
return "";
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
var defaultStylisPlugins = [prefixer];
|
|
1910
|
+
var createCache = function createCache2(options) {
|
|
1911
|
+
var key = options.key;
|
|
1912
|
+
if (process.env.NODE_ENV !== "production" && !key) {
|
|
1913
|
+
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\nIf multiple caches share the same key they might \"fight\" for each other's style elements.");
|
|
1914
|
+
}
|
|
1915
|
+
if (key === "css") {
|
|
1916
|
+
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])");
|
|
1917
|
+
Array.prototype.forEach.call(ssrStyles, function(node2) {
|
|
1918
|
+
var dataEmotionAttribute = node2.getAttribute("data-emotion");
|
|
1919
|
+
if (dataEmotionAttribute.indexOf(" ") === -1) {
|
|
1920
|
+
return;
|
|
1921
|
+
}
|
|
1922
|
+
document.head.appendChild(node2);
|
|
1923
|
+
node2.setAttribute("data-s", "");
|
|
1924
|
+
});
|
|
1925
|
+
}
|
|
1926
|
+
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
|
1927
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1928
|
+
if (/[^a-z-]/.test(key)) {
|
|
1929
|
+
throw new Error('Emotion key must only contain lower case alphabetical characters and - but "' + key + '" was passed');
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
var inserted = {};
|
|
1933
|
+
var container;
|
|
1934
|
+
var nodesToHydrate = [];
|
|
1935
|
+
{
|
|
1936
|
+
container = options.container || document.head;
|
|
1937
|
+
Array.prototype.forEach.call(
|
|
1938
|
+
document.querySelectorAll('style[data-emotion^="' + key + ' "]'),
|
|
1939
|
+
function(node2) {
|
|
1940
|
+
var attrib = node2.getAttribute("data-emotion").split(" ");
|
|
1941
|
+
for (var i = 1; i < attrib.length; i++) {
|
|
1942
|
+
inserted[attrib[i]] = true;
|
|
1943
|
+
}
|
|
1944
|
+
nodesToHydrate.push(node2);
|
|
1945
|
+
}
|
|
1946
|
+
);
|
|
1947
|
+
}
|
|
1948
|
+
var _insert;
|
|
1949
|
+
var omnipresentPlugins = [compat, removeLabel];
|
|
1950
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1951
|
+
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
|
|
1952
|
+
get compat() {
|
|
1953
|
+
return cache.compat;
|
|
1954
|
+
}
|
|
1955
|
+
}), incorrectImportAlarm);
|
|
1956
|
+
}
|
|
1957
|
+
{
|
|
1958
|
+
var currentSheet;
|
|
1959
|
+
var finalizingPlugins = [stringify, process.env.NODE_ENV !== "production" ? function(element) {
|
|
1960
|
+
if (!element.root) {
|
|
1961
|
+
if (element["return"]) {
|
|
1962
|
+
currentSheet.insert(element["return"]);
|
|
1963
|
+
} else if (element.value && element.type !== COMMENT) {
|
|
1964
|
+
currentSheet.insert(element.value + "{}");
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
} : rulesheet(function(rule) {
|
|
1968
|
+
currentSheet.insert(rule);
|
|
1969
|
+
})];
|
|
1970
|
+
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
|
1971
|
+
var stylis = function stylis2(styles) {
|
|
1972
|
+
return serialize(compile(styles), serializer);
|
|
1973
|
+
};
|
|
1974
|
+
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
|
1975
|
+
currentSheet = sheet;
|
|
1976
|
+
if (process.env.NODE_ENV !== "production" && serialized.map !== void 0) {
|
|
1977
|
+
currentSheet = {
|
|
1978
|
+
insert: function insert2(rule) {
|
|
1979
|
+
sheet.insert(rule + serialized.map);
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
}
|
|
1983
|
+
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
1984
|
+
if (shouldCache) {
|
|
1985
|
+
cache.inserted[serialized.name] = true;
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
var cache = {
|
|
1990
|
+
key,
|
|
1991
|
+
sheet: new StyleSheet({
|
|
1992
|
+
key,
|
|
1993
|
+
container,
|
|
1994
|
+
nonce: options.nonce,
|
|
1995
|
+
speedy: options.speedy,
|
|
1996
|
+
prepend: options.prepend,
|
|
1997
|
+
insertionPoint: options.insertionPoint
|
|
1998
|
+
}),
|
|
1999
|
+
nonce: options.nonce,
|
|
2000
|
+
inserted,
|
|
2001
|
+
registered: {},
|
|
2002
|
+
insert: _insert
|
|
2003
|
+
};
|
|
2004
|
+
cache.sheet.hydrate(nodesToHydrate);
|
|
2005
|
+
return cache;
|
|
2006
|
+
};
|
|
2007
|
+
function murmur2(str) {
|
|
2008
|
+
var h2 = 0;
|
|
2009
|
+
var k2, i = 0, len = str.length;
|
|
2010
|
+
for (; len >= 4; ++i, len -= 4) {
|
|
2011
|
+
k2 = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;
|
|
2012
|
+
k2 = (k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16);
|
|
2013
|
+
k2 ^= k2 >>> 24;
|
|
2014
|
+
h2 = (k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16) ^ (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
|
|
2015
|
+
}
|
|
2016
|
+
switch (len) {
|
|
2017
|
+
case 3:
|
|
2018
|
+
h2 ^= (str.charCodeAt(i + 2) & 255) << 16;
|
|
2019
|
+
case 2:
|
|
2020
|
+
h2 ^= (str.charCodeAt(i + 1) & 255) << 8;
|
|
2021
|
+
case 1:
|
|
2022
|
+
h2 ^= str.charCodeAt(i) & 255;
|
|
2023
|
+
h2 = (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
|
|
2024
|
+
}
|
|
2025
|
+
h2 ^= h2 >>> 13;
|
|
2026
|
+
h2 = (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
|
|
2027
|
+
return ((h2 ^ h2 >>> 15) >>> 0).toString(36);
|
|
2028
|
+
}
|
|
2029
|
+
var unitlessKeys = {
|
|
2030
|
+
animationIterationCount: 1,
|
|
2031
|
+
aspectRatio: 1,
|
|
2032
|
+
borderImageOutset: 1,
|
|
2033
|
+
borderImageSlice: 1,
|
|
2034
|
+
borderImageWidth: 1,
|
|
2035
|
+
boxFlex: 1,
|
|
2036
|
+
boxFlexGroup: 1,
|
|
2037
|
+
boxOrdinalGroup: 1,
|
|
2038
|
+
columnCount: 1,
|
|
2039
|
+
columns: 1,
|
|
2040
|
+
flex: 1,
|
|
2041
|
+
flexGrow: 1,
|
|
2042
|
+
flexPositive: 1,
|
|
2043
|
+
flexShrink: 1,
|
|
2044
|
+
flexNegative: 1,
|
|
2045
|
+
flexOrder: 1,
|
|
2046
|
+
gridRow: 1,
|
|
2047
|
+
gridRowEnd: 1,
|
|
2048
|
+
gridRowSpan: 1,
|
|
2049
|
+
gridRowStart: 1,
|
|
2050
|
+
gridColumn: 1,
|
|
2051
|
+
gridColumnEnd: 1,
|
|
2052
|
+
gridColumnSpan: 1,
|
|
2053
|
+
gridColumnStart: 1,
|
|
2054
|
+
msGridRow: 1,
|
|
2055
|
+
msGridRowSpan: 1,
|
|
2056
|
+
msGridColumn: 1,
|
|
2057
|
+
msGridColumnSpan: 1,
|
|
2058
|
+
fontWeight: 1,
|
|
2059
|
+
lineHeight: 1,
|
|
2060
|
+
opacity: 1,
|
|
2061
|
+
order: 1,
|
|
2062
|
+
orphans: 1,
|
|
2063
|
+
tabSize: 1,
|
|
2064
|
+
widows: 1,
|
|
2065
|
+
zIndex: 1,
|
|
2066
|
+
zoom: 1,
|
|
2067
|
+
WebkitLineClamp: 1,
|
|
2068
|
+
fillOpacity: 1,
|
|
2069
|
+
floodOpacity: 1,
|
|
2070
|
+
stopOpacity: 1,
|
|
2071
|
+
strokeDasharray: 1,
|
|
2072
|
+
strokeDashoffset: 1,
|
|
2073
|
+
strokeMiterlimit: 1,
|
|
2074
|
+
strokeOpacity: 1,
|
|
2075
|
+
strokeWidth: 1
|
|
2076
|
+
};
|
|
2077
|
+
var ILLEGAL_ESCAPE_SEQUENCE_ERROR$1 = `You have illegal escape sequence in your template literal, most likely inside content's property value.
|
|
2078
|
+
Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';".
|
|
2079
|
+
You can read more about this here:
|
|
2080
|
+
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences`;
|
|
2081
|
+
var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
|
|
2082
|
+
var hyphenateRegex = /[A-Z]|^ms/g;
|
|
2083
|
+
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
|
|
2084
|
+
var isCustomProperty = function isCustomProperty2(property) {
|
|
2085
|
+
return property.charCodeAt(1) === 45;
|
|
2086
|
+
};
|
|
2087
|
+
var isProcessableValue = function isProcessableValue2(value) {
|
|
2088
|
+
return value != null && typeof value !== "boolean";
|
|
2089
|
+
};
|
|
2090
|
+
var processStyleName = /* @__PURE__ */ memoize(function(styleName) {
|
|
2091
|
+
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
|
|
2092
|
+
});
|
|
2093
|
+
var processStyleValue = function processStyleValue2(key, value) {
|
|
2094
|
+
switch (key) {
|
|
2095
|
+
case "animation":
|
|
2096
|
+
case "animationName": {
|
|
2097
|
+
if (typeof value === "string") {
|
|
2098
|
+
return value.replace(animationRegex, function(match2, p1, p2) {
|
|
2099
|
+
cursor = {
|
|
2100
|
+
name: p1,
|
|
2101
|
+
styles: p2,
|
|
2102
|
+
next: cursor
|
|
2103
|
+
};
|
|
2104
|
+
return p1;
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === "number" && value !== 0) {
|
|
2110
|
+
return value + "px";
|
|
2111
|
+
}
|
|
2112
|
+
return value;
|
|
2113
|
+
};
|
|
2114
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2115
|
+
var contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
|
|
2116
|
+
var contentValues = ["normal", "none", "initial", "inherit", "unset"];
|
|
2117
|
+
var oldProcessStyleValue = processStyleValue;
|
|
2118
|
+
var msPattern = /^-ms-/;
|
|
2119
|
+
var hyphenPattern = /-(.)/g;
|
|
2120
|
+
var hyphenatedCache = {};
|
|
2121
|
+
processStyleValue = function processStyleValue3(key, value) {
|
|
2122
|
+
if (key === "content") {
|
|
2123
|
+
if (typeof value !== "string" || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
|
|
2124
|
+
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
var processed = oldProcessStyleValue(key, value);
|
|
2128
|
+
if (processed !== "" && !isCustomProperty(key) && key.indexOf("-") !== -1 && hyphenatedCache[key] === void 0) {
|
|
2129
|
+
hyphenatedCache[key] = true;
|
|
2130
|
+
console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, "ms-").replace(hyphenPattern, function(str, _char) {
|
|
2131
|
+
return _char.toUpperCase();
|
|
2132
|
+
}) + "?");
|
|
2133
|
+
}
|
|
2134
|
+
return processed;
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
var noComponentSelectorMessage = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
|
|
2138
|
+
function handleInterpolation(mergedProps, registered, interpolation) {
|
|
2139
|
+
if (interpolation == null) {
|
|
2140
|
+
return "";
|
|
2141
|
+
}
|
|
2142
|
+
if (interpolation.__emotion_styles !== void 0) {
|
|
2143
|
+
if (process.env.NODE_ENV !== "production" && interpolation.toString() === "NO_COMPONENT_SELECTOR") {
|
|
2144
|
+
throw new Error(noComponentSelectorMessage);
|
|
2145
|
+
}
|
|
2146
|
+
return interpolation;
|
|
2147
|
+
}
|
|
2148
|
+
switch (typeof interpolation) {
|
|
2149
|
+
case "boolean": {
|
|
2150
|
+
return "";
|
|
2151
|
+
}
|
|
2152
|
+
case "object": {
|
|
2153
|
+
if (interpolation.anim === 1) {
|
|
2154
|
+
cursor = {
|
|
2155
|
+
name: interpolation.name,
|
|
2156
|
+
styles: interpolation.styles,
|
|
2157
|
+
next: cursor
|
|
2158
|
+
};
|
|
2159
|
+
return interpolation.name;
|
|
2160
|
+
}
|
|
2161
|
+
if (interpolation.styles !== void 0) {
|
|
2162
|
+
var next2 = interpolation.next;
|
|
2163
|
+
if (next2 !== void 0) {
|
|
2164
|
+
while (next2 !== void 0) {
|
|
2165
|
+
cursor = {
|
|
2166
|
+
name: next2.name,
|
|
2167
|
+
styles: next2.styles,
|
|
2168
|
+
next: cursor
|
|
2169
|
+
};
|
|
2170
|
+
next2 = next2.next;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
var styles = interpolation.styles + ";";
|
|
2174
|
+
if (process.env.NODE_ENV !== "production" && interpolation.map !== void 0) {
|
|
2175
|
+
styles += interpolation.map;
|
|
2176
|
+
}
|
|
2177
|
+
return styles;
|
|
2178
|
+
}
|
|
2179
|
+
return createStringFromObject(mergedProps, registered, interpolation);
|
|
2180
|
+
}
|
|
2181
|
+
case "function": {
|
|
2182
|
+
if (mergedProps !== void 0) {
|
|
2183
|
+
var previousCursor = cursor;
|
|
2184
|
+
var result = interpolation(mergedProps);
|
|
2185
|
+
cursor = previousCursor;
|
|
2186
|
+
return handleInterpolation(mergedProps, registered, result);
|
|
2187
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
2188
|
+
console.error("Functions that are interpolated in css calls will be stringified.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`");
|
|
2189
|
+
}
|
|
2190
|
+
break;
|
|
2191
|
+
}
|
|
2192
|
+
case "string":
|
|
2193
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2194
|
+
var matched = [];
|
|
2195
|
+
var replaced = interpolation.replace(animationRegex, function(match2, p1, p2) {
|
|
2196
|
+
var fakeVarName = "animation" + matched.length;
|
|
2197
|
+
matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, "") + "`");
|
|
2198
|
+
return "${" + fakeVarName + "}";
|
|
2199
|
+
});
|
|
2200
|
+
if (matched.length) {
|
|
2201
|
+
console.error("`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\nInstead of doing this:\n\n" + [].concat(matched, ["`" + replaced + "`"]).join("\n") + "\n\nYou should wrap it with `css` like this:\n\n" + ("css`" + replaced + "`"));
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
break;
|
|
2205
|
+
}
|
|
2206
|
+
if (registered == null) {
|
|
2207
|
+
return interpolation;
|
|
2208
|
+
}
|
|
2209
|
+
var cached = registered[interpolation];
|
|
2210
|
+
return cached !== void 0 ? cached : interpolation;
|
|
2211
|
+
}
|
|
2212
|
+
function createStringFromObject(mergedProps, registered, obj) {
|
|
2213
|
+
var string = "";
|
|
2214
|
+
if (Array.isArray(obj)) {
|
|
2215
|
+
for (var i = 0; i < obj.length; i++) {
|
|
2216
|
+
string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
|
|
2217
|
+
}
|
|
2218
|
+
} else {
|
|
2219
|
+
for (var _key in obj) {
|
|
2220
|
+
var value = obj[_key];
|
|
2221
|
+
if (typeof value !== "object") {
|
|
2222
|
+
if (registered != null && registered[value] !== void 0) {
|
|
2223
|
+
string += _key + "{" + registered[value] + "}";
|
|
2224
|
+
} else if (isProcessableValue(value)) {
|
|
2225
|
+
string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
|
|
2226
|
+
}
|
|
2227
|
+
} else {
|
|
2228
|
+
if (_key === "NO_COMPONENT_SELECTOR" && process.env.NODE_ENV !== "production") {
|
|
2229
|
+
throw new Error(noComponentSelectorMessage);
|
|
2230
|
+
}
|
|
2231
|
+
if (Array.isArray(value) && typeof value[0] === "string" && (registered == null || registered[value[0]] === void 0)) {
|
|
2232
|
+
for (var _i = 0; _i < value.length; _i++) {
|
|
2233
|
+
if (isProcessableValue(value[_i])) {
|
|
2234
|
+
string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
} else {
|
|
2238
|
+
var interpolated = handleInterpolation(mergedProps, registered, value);
|
|
2239
|
+
switch (_key) {
|
|
2240
|
+
case "animation":
|
|
2241
|
+
case "animationName": {
|
|
2242
|
+
string += processStyleName(_key) + ":" + interpolated + ";";
|
|
2243
|
+
break;
|
|
2244
|
+
}
|
|
2245
|
+
default: {
|
|
2246
|
+
if (process.env.NODE_ENV !== "production" && _key === "undefined") {
|
|
2247
|
+
console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);
|
|
2248
|
+
}
|
|
2249
|
+
string += _key + "{" + interpolated + "}";
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
return string;
|
|
2257
|
+
}
|
|
2258
|
+
var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
|
|
2259
|
+
var sourceMapPattern;
|
|
2260
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2261
|
+
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
|
|
2262
|
+
}
|
|
2263
|
+
var cursor;
|
|
2264
|
+
var serializeStyles = function serializeStyles2(args, registered, mergedProps) {
|
|
2265
|
+
if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && args[0].styles !== void 0) {
|
|
2266
|
+
return args[0];
|
|
2267
|
+
}
|
|
2268
|
+
var stringMode = true;
|
|
2269
|
+
var styles = "";
|
|
2270
|
+
cursor = void 0;
|
|
2271
|
+
var strings = args[0];
|
|
2272
|
+
if (strings == null || strings.raw === void 0) {
|
|
2273
|
+
stringMode = false;
|
|
2274
|
+
styles += handleInterpolation(mergedProps, registered, strings);
|
|
2275
|
+
} else {
|
|
2276
|
+
if (process.env.NODE_ENV !== "production" && strings[0] === void 0) {
|
|
2277
|
+
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$1);
|
|
2278
|
+
}
|
|
2279
|
+
styles += strings[0];
|
|
2280
|
+
}
|
|
2281
|
+
for (var i = 1; i < args.length; i++) {
|
|
2282
|
+
styles += handleInterpolation(mergedProps, registered, args[i]);
|
|
2283
|
+
if (stringMode) {
|
|
2284
|
+
if (process.env.NODE_ENV !== "production" && strings[i] === void 0) {
|
|
2285
|
+
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$1);
|
|
2286
|
+
}
|
|
2287
|
+
styles += strings[i];
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
var sourceMap;
|
|
2291
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2292
|
+
styles = styles.replace(sourceMapPattern, function(match3) {
|
|
2293
|
+
sourceMap = match3;
|
|
2294
|
+
return "";
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
labelPattern.lastIndex = 0;
|
|
2298
|
+
var identifierName = "";
|
|
2299
|
+
var match2;
|
|
2300
|
+
while ((match2 = labelPattern.exec(styles)) !== null) {
|
|
2301
|
+
identifierName += "-" + match2[1];
|
|
2302
|
+
}
|
|
2303
|
+
var name = murmur2(styles) + identifierName;
|
|
2304
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2305
|
+
return {
|
|
2306
|
+
name,
|
|
2307
|
+
styles,
|
|
2308
|
+
map: sourceMap,
|
|
2309
|
+
next: cursor,
|
|
2310
|
+
toString: function toString() {
|
|
2311
|
+
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
return {
|
|
2316
|
+
name,
|
|
2317
|
+
styles,
|
|
2318
|
+
next: cursor
|
|
2319
|
+
};
|
|
2320
|
+
};
|
|
2321
|
+
var syncFallback = function syncFallback2(create) {
|
|
2322
|
+
return create();
|
|
2323
|
+
};
|
|
2324
|
+
var useInsertionEffect = React$1["useInsertionEffect"] ? React$1["useInsertionEffect"] : false;
|
|
2325
|
+
var useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;
|
|
2326
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
|
2327
|
+
var EmotionCacheContext = /* @__PURE__ */ React$1.createContext(
|
|
2328
|
+
typeof HTMLElement !== "undefined" ? /* @__PURE__ */ createCache({
|
|
2329
|
+
key: "css"
|
|
2330
|
+
}) : null
|
|
2331
|
+
);
|
|
2332
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2333
|
+
EmotionCacheContext.displayName = "EmotionCacheContext";
|
|
2334
|
+
}
|
|
2335
|
+
EmotionCacheContext.Provider;
|
|
2336
|
+
var withEmotionCache = function withEmotionCache2(func) {
|
|
2337
|
+
return /* @__PURE__ */ forwardRef(function(props, ref) {
|
|
2338
|
+
var cache = useContext(EmotionCacheContext);
|
|
2339
|
+
return func(props, cache, ref);
|
|
2340
|
+
});
|
|
2341
|
+
};
|
|
2342
|
+
var ThemeContext = /* @__PURE__ */ React$1.createContext({});
|
|
2343
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2344
|
+
ThemeContext.displayName = "EmotionThemeContext";
|
|
2345
|
+
}
|
|
2346
|
+
var typePropName = "__EMOTION_TYPE_PLEASE_DO_NOT_USE__";
|
|
2347
|
+
var labelPropName = "__EMOTION_LABEL_PLEASE_DO_NOT_USE__";
|
|
2348
|
+
var Insertion$1 = function Insertion(_ref) {
|
|
2349
|
+
var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag;
|
|
2350
|
+
registerStyles(cache, serialized, isStringTag);
|
|
2351
|
+
useInsertionEffectAlwaysWithSyncFallback(function() {
|
|
2352
|
+
return insertStyles(cache, serialized, isStringTag);
|
|
2353
|
+
});
|
|
2354
|
+
return null;
|
|
2355
|
+
};
|
|
2356
|
+
var Emotion = /* @__PURE__ */ withEmotionCache(function(props, cache, ref) {
|
|
2357
|
+
var cssProp = props.css;
|
|
2358
|
+
if (typeof cssProp === "string" && cache.registered[cssProp] !== void 0) {
|
|
2359
|
+
cssProp = cache.registered[cssProp];
|
|
2360
|
+
}
|
|
2361
|
+
var WrappedComponent = props[typePropName];
|
|
2362
|
+
var registeredStyles = [cssProp];
|
|
2363
|
+
var className = "";
|
|
2364
|
+
if (typeof props.className === "string") {
|
|
2365
|
+
className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
|
|
2366
|
+
} else if (props.className != null) {
|
|
2367
|
+
className = props.className + " ";
|
|
2368
|
+
}
|
|
2369
|
+
var serialized = serializeStyles(registeredStyles, void 0, React$1.useContext(ThemeContext));
|
|
2370
|
+
if (process.env.NODE_ENV !== "production" && serialized.name.indexOf("-") === -1) {
|
|
2371
|
+
var labelFromStack = props[labelPropName];
|
|
2372
|
+
if (labelFromStack) {
|
|
2373
|
+
serialized = serializeStyles([serialized, "label:" + labelFromStack + ";"]);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
className += cache.key + "-" + serialized.name;
|
|
2377
|
+
var newProps = {};
|
|
2378
|
+
for (var key in props) {
|
|
2379
|
+
if (hasOwnProperty.call(props, key) && key !== "css" && key !== typePropName && (process.env.NODE_ENV === "production" || key !== labelPropName)) {
|
|
2380
|
+
newProps[key] = props[key];
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
newProps.ref = ref;
|
|
2384
|
+
newProps.className = className;
|
|
2385
|
+
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(Insertion$1, {
|
|
2386
|
+
cache,
|
|
2387
|
+
serialized,
|
|
2388
|
+
isStringTag: typeof WrappedComponent === "string"
|
|
2389
|
+
}), /* @__PURE__ */ React$1.createElement(WrappedComponent, newProps));
|
|
2390
|
+
});
|
|
2391
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2392
|
+
Emotion.displayName = "EmotionCssPropInternal";
|
|
2393
|
+
}
|
|
2394
|
+
var testOmitPropsOnStringTag = isPropValid;
|
|
2395
|
+
var testOmitPropsOnComponent = function testOmitPropsOnComponent2(key) {
|
|
2396
|
+
return key !== "theme";
|
|
2397
|
+
};
|
|
2398
|
+
var getDefaultShouldForwardProp = function getDefaultShouldForwardProp2(tag) {
|
|
2399
|
+
return typeof tag === "string" && tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
|
|
2400
|
+
};
|
|
2401
|
+
var composeShouldForwardProps = function composeShouldForwardProps2(tag, options, isReal) {
|
|
2402
|
+
var shouldForwardProp;
|
|
2403
|
+
if (options) {
|
|
2404
|
+
var optionsShouldForwardProp = options.shouldForwardProp;
|
|
2405
|
+
shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function(propName) {
|
|
2406
|
+
return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
|
|
2407
|
+
} : optionsShouldForwardProp;
|
|
2408
|
+
}
|
|
2409
|
+
if (typeof shouldForwardProp !== "function" && isReal) {
|
|
2410
|
+
shouldForwardProp = tag.__emotion_forwardProp;
|
|
2411
|
+
}
|
|
2412
|
+
return shouldForwardProp;
|
|
2413
|
+
};
|
|
2414
|
+
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = `You have illegal escape sequence in your template literal, most likely inside content's property value.
|
|
2415
|
+
Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';".
|
|
2416
|
+
You can read more about this here:
|
|
2417
|
+
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences`;
|
|
2418
|
+
var Insertion2 = function Insertion3(_ref) {
|
|
2419
|
+
var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag;
|
|
2420
|
+
registerStyles(cache, serialized, isStringTag);
|
|
2421
|
+
useInsertionEffectAlwaysWithSyncFallback(function() {
|
|
2422
|
+
return insertStyles(cache, serialized, isStringTag);
|
|
2423
|
+
});
|
|
2424
|
+
return null;
|
|
2425
|
+
};
|
|
2426
|
+
var createStyled = function createStyled2(tag, options) {
|
|
2427
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2428
|
+
if (tag === void 0) {
|
|
2429
|
+
throw new Error("You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.");
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
var isReal = tag.__emotion_real === tag;
|
|
2433
|
+
var baseTag = isReal && tag.__emotion_base || tag;
|
|
2434
|
+
var identifierName;
|
|
2435
|
+
var targetClassName;
|
|
2436
|
+
if (options !== void 0) {
|
|
2437
|
+
identifierName = options.label;
|
|
2438
|
+
targetClassName = options.target;
|
|
2439
|
+
}
|
|
2440
|
+
var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
|
|
2441
|
+
var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
|
|
2442
|
+
var shouldUseAs = !defaultShouldForwardProp("as");
|
|
2443
|
+
return function() {
|
|
2444
|
+
var args = arguments;
|
|
2445
|
+
var styles = isReal && tag.__emotion_styles !== void 0 ? tag.__emotion_styles.slice(0) : [];
|
|
2446
|
+
if (identifierName !== void 0) {
|
|
2447
|
+
styles.push("label:" + identifierName + ";");
|
|
2448
|
+
}
|
|
2449
|
+
if (args[0] == null || args[0].raw === void 0) {
|
|
2450
|
+
styles.push.apply(styles, args);
|
|
2451
|
+
} else {
|
|
2452
|
+
if (process.env.NODE_ENV !== "production" && args[0][0] === void 0) {
|
|
2453
|
+
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
|
|
2454
|
+
}
|
|
2455
|
+
styles.push(args[0][0]);
|
|
2456
|
+
var len = args.length;
|
|
2457
|
+
var i = 1;
|
|
2458
|
+
for (; i < len; i++) {
|
|
2459
|
+
if (process.env.NODE_ENV !== "production" && args[0][i] === void 0) {
|
|
2460
|
+
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
|
|
2461
|
+
}
|
|
2462
|
+
styles.push(args[i], args[0][i]);
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
var Styled = withEmotionCache(function(props, cache, ref) {
|
|
2466
|
+
var FinalTag = shouldUseAs && props.as || baseTag;
|
|
2467
|
+
var className = "";
|
|
2468
|
+
var classInterpolations = [];
|
|
2469
|
+
var mergedProps = props;
|
|
2470
|
+
if (props.theme == null) {
|
|
2471
|
+
mergedProps = {};
|
|
2472
|
+
for (var key in props) {
|
|
2473
|
+
mergedProps[key] = props[key];
|
|
2474
|
+
}
|
|
2475
|
+
mergedProps.theme = React$1.useContext(ThemeContext);
|
|
2476
|
+
}
|
|
2477
|
+
if (typeof props.className === "string") {
|
|
2478
|
+
className = getRegisteredStyles(cache.registered, classInterpolations, props.className);
|
|
2479
|
+
} else if (props.className != null) {
|
|
2480
|
+
className = props.className + " ";
|
|
2481
|
+
}
|
|
2482
|
+
var serialized = serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
|
|
2483
|
+
className += cache.key + "-" + serialized.name;
|
|
2484
|
+
if (targetClassName !== void 0) {
|
|
2485
|
+
className += " " + targetClassName;
|
|
2486
|
+
}
|
|
2487
|
+
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === void 0 ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
|
|
2488
|
+
var newProps = {};
|
|
2489
|
+
for (var _key in props) {
|
|
2490
|
+
if (shouldUseAs && _key === "as")
|
|
2491
|
+
continue;
|
|
2492
|
+
if (finalShouldForwardProp(_key)) {
|
|
2493
|
+
newProps[_key] = props[_key];
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
newProps.className = className;
|
|
2497
|
+
newProps.ref = ref;
|
|
2498
|
+
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(Insertion2, {
|
|
2499
|
+
cache,
|
|
2500
|
+
serialized,
|
|
2501
|
+
isStringTag: typeof FinalTag === "string"
|
|
2502
|
+
}), /* @__PURE__ */ React$1.createElement(FinalTag, newProps));
|
|
2503
|
+
});
|
|
2504
|
+
Styled.displayName = identifierName !== void 0 ? identifierName : "Styled(" + (typeof baseTag === "string" ? baseTag : baseTag.displayName || baseTag.name || "Component") + ")";
|
|
2505
|
+
Styled.defaultProps = tag.defaultProps;
|
|
2506
|
+
Styled.__emotion_real = Styled;
|
|
2507
|
+
Styled.__emotion_base = baseTag;
|
|
2508
|
+
Styled.__emotion_styles = styles;
|
|
2509
|
+
Styled.__emotion_forwardProp = shouldForwardProp;
|
|
2510
|
+
Object.defineProperty(Styled, "toString", {
|
|
2511
|
+
value: function value() {
|
|
2512
|
+
if (targetClassName === void 0 && process.env.NODE_ENV !== "production") {
|
|
2513
|
+
return "NO_COMPONENT_SELECTOR";
|
|
2514
|
+
}
|
|
2515
|
+
return "." + targetClassName;
|
|
2516
|
+
}
|
|
2517
|
+
});
|
|
2518
|
+
Styled.withComponent = function(nextTag, nextOptions) {
|
|
2519
|
+
return createStyled2(nextTag, _extends({}, options, nextOptions, {
|
|
2520
|
+
shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
|
|
2521
|
+
})).apply(void 0, styles);
|
|
2522
|
+
};
|
|
2523
|
+
return Styled;
|
|
2524
|
+
};
|
|
2525
|
+
};
|
|
2526
|
+
var tags = [
|
|
2527
|
+
"a",
|
|
2528
|
+
"abbr",
|
|
2529
|
+
"address",
|
|
2530
|
+
"area",
|
|
2531
|
+
"article",
|
|
2532
|
+
"aside",
|
|
2533
|
+
"audio",
|
|
2534
|
+
"b",
|
|
2535
|
+
"base",
|
|
2536
|
+
"bdi",
|
|
2537
|
+
"bdo",
|
|
2538
|
+
"big",
|
|
2539
|
+
"blockquote",
|
|
2540
|
+
"body",
|
|
2541
|
+
"br",
|
|
2542
|
+
"button",
|
|
2543
|
+
"canvas",
|
|
2544
|
+
"caption",
|
|
2545
|
+
"cite",
|
|
2546
|
+
"code",
|
|
2547
|
+
"col",
|
|
2548
|
+
"colgroup",
|
|
2549
|
+
"data",
|
|
2550
|
+
"datalist",
|
|
2551
|
+
"dd",
|
|
2552
|
+
"del",
|
|
2553
|
+
"details",
|
|
2554
|
+
"dfn",
|
|
2555
|
+
"dialog",
|
|
2556
|
+
"div",
|
|
2557
|
+
"dl",
|
|
2558
|
+
"dt",
|
|
2559
|
+
"em",
|
|
2560
|
+
"embed",
|
|
2561
|
+
"fieldset",
|
|
2562
|
+
"figcaption",
|
|
2563
|
+
"figure",
|
|
2564
|
+
"footer",
|
|
2565
|
+
"form",
|
|
2566
|
+
"h1",
|
|
2567
|
+
"h2",
|
|
2568
|
+
"h3",
|
|
2569
|
+
"h4",
|
|
2570
|
+
"h5",
|
|
2571
|
+
"h6",
|
|
2572
|
+
"head",
|
|
2573
|
+
"header",
|
|
2574
|
+
"hgroup",
|
|
2575
|
+
"hr",
|
|
2576
|
+
"html",
|
|
2577
|
+
"i",
|
|
2578
|
+
"iframe",
|
|
2579
|
+
"img",
|
|
2580
|
+
"input",
|
|
2581
|
+
"ins",
|
|
2582
|
+
"kbd",
|
|
2583
|
+
"keygen",
|
|
2584
|
+
"label",
|
|
2585
|
+
"legend",
|
|
2586
|
+
"li",
|
|
2587
|
+
"link",
|
|
2588
|
+
"main",
|
|
2589
|
+
"map",
|
|
2590
|
+
"mark",
|
|
2591
|
+
"marquee",
|
|
2592
|
+
"menu",
|
|
2593
|
+
"menuitem",
|
|
2594
|
+
"meta",
|
|
2595
|
+
"meter",
|
|
2596
|
+
"nav",
|
|
2597
|
+
"noscript",
|
|
2598
|
+
"object",
|
|
2599
|
+
"ol",
|
|
2600
|
+
"optgroup",
|
|
2601
|
+
"option",
|
|
2602
|
+
"output",
|
|
2603
|
+
"p",
|
|
2604
|
+
"param",
|
|
2605
|
+
"picture",
|
|
2606
|
+
"pre",
|
|
2607
|
+
"progress",
|
|
2608
|
+
"q",
|
|
2609
|
+
"rp",
|
|
2610
|
+
"rt",
|
|
2611
|
+
"ruby",
|
|
2612
|
+
"s",
|
|
2613
|
+
"samp",
|
|
2614
|
+
"script",
|
|
2615
|
+
"section",
|
|
2616
|
+
"select",
|
|
2617
|
+
"small",
|
|
2618
|
+
"source",
|
|
2619
|
+
"span",
|
|
2620
|
+
"strong",
|
|
2621
|
+
"style",
|
|
2622
|
+
"sub",
|
|
2623
|
+
"summary",
|
|
2624
|
+
"sup",
|
|
2625
|
+
"table",
|
|
2626
|
+
"tbody",
|
|
2627
|
+
"td",
|
|
2628
|
+
"textarea",
|
|
2629
|
+
"tfoot",
|
|
2630
|
+
"th",
|
|
2631
|
+
"thead",
|
|
2632
|
+
"time",
|
|
2633
|
+
"title",
|
|
2634
|
+
"tr",
|
|
2635
|
+
"track",
|
|
2636
|
+
"u",
|
|
2637
|
+
"ul",
|
|
2638
|
+
"var",
|
|
2639
|
+
"video",
|
|
2640
|
+
"wbr",
|
|
2641
|
+
"circle",
|
|
2642
|
+
"clipPath",
|
|
2643
|
+
"defs",
|
|
2644
|
+
"ellipse",
|
|
2645
|
+
"foreignObject",
|
|
2646
|
+
"g",
|
|
2647
|
+
"image",
|
|
2648
|
+
"line",
|
|
2649
|
+
"linearGradient",
|
|
2650
|
+
"mask",
|
|
2651
|
+
"path",
|
|
2652
|
+
"pattern",
|
|
2653
|
+
"polygon",
|
|
2654
|
+
"polyline",
|
|
2655
|
+
"radialGradient",
|
|
2656
|
+
"rect",
|
|
2657
|
+
"stop",
|
|
2658
|
+
"svg",
|
|
2659
|
+
"text",
|
|
2660
|
+
"tspan"
|
|
2661
|
+
];
|
|
2662
|
+
var newStyled = createStyled.bind();
|
|
2663
|
+
tags.forEach(function(tagName) {
|
|
2664
|
+
newStyled[tagName] = newStyled(tagName);
|
|
2665
|
+
});
|
|
2666
|
+
var has = Object.prototype.hasOwnProperty;
|
|
2667
|
+
function find(iter, tar, key) {
|
|
2668
|
+
for (key of iter.keys()) {
|
|
2669
|
+
if (dequal(key, tar))
|
|
2670
|
+
return key;
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
function dequal(foo, bar) {
|
|
2674
|
+
var ctor, len, tmp;
|
|
2675
|
+
if (foo === bar)
|
|
2676
|
+
return true;
|
|
2677
|
+
if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
|
|
2678
|
+
if (ctor === Date)
|
|
2679
|
+
return foo.getTime() === bar.getTime();
|
|
2680
|
+
if (ctor === RegExp)
|
|
2681
|
+
return foo.toString() === bar.toString();
|
|
2682
|
+
if (ctor === Array) {
|
|
2683
|
+
if ((len = foo.length) === bar.length) {
|
|
2684
|
+
while (len-- && dequal(foo[len], bar[len]))
|
|
2685
|
+
;
|
|
2686
|
+
}
|
|
2687
|
+
return len === -1;
|
|
2688
|
+
}
|
|
2689
|
+
if (ctor === Set) {
|
|
2690
|
+
if (foo.size !== bar.size) {
|
|
2691
|
+
return false;
|
|
2692
|
+
}
|
|
2693
|
+
for (len of foo) {
|
|
2694
|
+
tmp = len;
|
|
2695
|
+
if (tmp && typeof tmp === "object") {
|
|
2696
|
+
tmp = find(bar, tmp);
|
|
2697
|
+
if (!tmp)
|
|
2698
|
+
return false;
|
|
2699
|
+
}
|
|
2700
|
+
if (!bar.has(tmp))
|
|
2701
|
+
return false;
|
|
2702
|
+
}
|
|
2703
|
+
return true;
|
|
2704
|
+
}
|
|
2705
|
+
if (ctor === Map) {
|
|
2706
|
+
if (foo.size !== bar.size) {
|
|
2707
|
+
return false;
|
|
2708
|
+
}
|
|
2709
|
+
for (len of foo) {
|
|
2710
|
+
tmp = len[0];
|
|
2711
|
+
if (tmp && typeof tmp === "object") {
|
|
2712
|
+
tmp = find(bar, tmp);
|
|
2713
|
+
if (!tmp)
|
|
2714
|
+
return false;
|
|
2715
|
+
}
|
|
2716
|
+
if (!dequal(len[1], bar.get(tmp))) {
|
|
2717
|
+
return false;
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
return true;
|
|
2721
|
+
}
|
|
2722
|
+
if (ctor === ArrayBuffer) {
|
|
2723
|
+
foo = new Uint8Array(foo);
|
|
2724
|
+
bar = new Uint8Array(bar);
|
|
2725
|
+
} else if (ctor === DataView) {
|
|
2726
|
+
if ((len = foo.byteLength) === bar.byteLength) {
|
|
2727
|
+
while (len-- && foo.getInt8(len) === bar.getInt8(len))
|
|
2728
|
+
;
|
|
2729
|
+
}
|
|
2730
|
+
return len === -1;
|
|
2731
|
+
}
|
|
2732
|
+
if (ArrayBuffer.isView(foo)) {
|
|
2733
|
+
if ((len = foo.byteLength) === bar.byteLength) {
|
|
2734
|
+
while (len-- && foo[len] === bar[len])
|
|
2735
|
+
;
|
|
2736
|
+
}
|
|
2737
|
+
return len === -1;
|
|
2738
|
+
}
|
|
2739
|
+
if (!ctor || typeof foo === "object") {
|
|
2740
|
+
len = 0;
|
|
2741
|
+
for (ctor in foo) {
|
|
2742
|
+
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor))
|
|
2743
|
+
return false;
|
|
2744
|
+
if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor]))
|
|
2745
|
+
return false;
|
|
2746
|
+
}
|
|
2747
|
+
return Object.keys(bar).length === len;
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
return foo !== foo && bar !== bar;
|
|
2751
|
+
}
|
|
2752
|
+
function checkDeps(deps) {
|
|
2753
|
+
if (!deps || !deps.length) {
|
|
2754
|
+
throw new Error("useDeepCompareEffect should not be used with no dependencies. Use React.useEffect instead.");
|
|
2755
|
+
}
|
|
2756
|
+
if (deps.every(isPrimitive$1)) {
|
|
2757
|
+
throw new Error("useDeepCompareEffect should not be used with dependencies that are all primitive values. Use React.useEffect instead.");
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
function isPrimitive$1(val) {
|
|
2761
|
+
return val == null || /^[sbn]/.test(typeof val);
|
|
2762
|
+
}
|
|
2763
|
+
function useDeepCompareMemoize(value) {
|
|
2764
|
+
var ref = React$1.useRef(value);
|
|
2765
|
+
var signalRef = React$1.useRef(0);
|
|
2766
|
+
if (!dequal(value, ref.current)) {
|
|
2767
|
+
ref.current = value;
|
|
2768
|
+
signalRef.current += 1;
|
|
2769
|
+
}
|
|
2770
|
+
return React$1.useMemo(function() {
|
|
2771
|
+
return ref.current;
|
|
2772
|
+
}, [signalRef.current]);
|
|
2773
|
+
}
|
|
2774
|
+
function useDeepCompareEffect(callback, dependencies) {
|
|
2775
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2776
|
+
checkDeps(dependencies);
|
|
2777
|
+
}
|
|
2778
|
+
return React$1.useEffect(callback, useDeepCompareMemoize(dependencies));
|
|
2779
|
+
}
|
|
2780
|
+
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
2781
|
+
var isDateObject = (value) => value instanceof Date;
|
|
2782
|
+
var isNullOrUndefined = (value) => value == null;
|
|
2783
|
+
const isObjectType = (value) => typeof value === "object";
|
|
2784
|
+
var isObject = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
2785
|
+
var getEventValue = (event) => isObject(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
2786
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
2787
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
2788
|
+
var isPlainObject = (tempObject) => {
|
|
2789
|
+
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
2790
|
+
return isObject(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
2791
|
+
};
|
|
2792
|
+
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
2793
|
+
function cloneObject(data) {
|
|
2794
|
+
let copy2;
|
|
2795
|
+
const isArray = Array.isArray(data);
|
|
2796
|
+
if (data instanceof Date) {
|
|
2797
|
+
copy2 = new Date(data);
|
|
2798
|
+
} else if (data instanceof Set) {
|
|
2799
|
+
copy2 = new Set(data);
|
|
2800
|
+
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray || isObject(data))) {
|
|
2801
|
+
copy2 = isArray ? [] : {};
|
|
2802
|
+
if (!Array.isArray(data) && !isPlainObject(data)) {
|
|
2803
|
+
copy2 = data;
|
|
2804
|
+
} else {
|
|
2805
|
+
for (const key in data) {
|
|
2806
|
+
copy2[key] = cloneObject(data[key]);
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
} else {
|
|
2810
|
+
return data;
|
|
2811
|
+
}
|
|
2812
|
+
return copy2;
|
|
2813
|
+
}
|
|
2814
|
+
var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
|
|
2815
|
+
var isUndefined = (val) => val === void 0;
|
|
2816
|
+
var get = (obj, path, defaultValue) => {
|
|
2817
|
+
if (!path || !isObject(obj)) {
|
|
2818
|
+
return defaultValue;
|
|
2819
|
+
}
|
|
2820
|
+
const result = compact(path.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], obj);
|
|
2821
|
+
return isUndefined(result) || result === obj ? isUndefined(obj[path]) ? defaultValue : obj[path] : result;
|
|
2822
|
+
};
|
|
2823
|
+
const EVENTS = {
|
|
2824
|
+
BLUR: "blur",
|
|
2825
|
+
FOCUS_OUT: "focusout",
|
|
2826
|
+
CHANGE: "change"
|
|
2827
|
+
};
|
|
2828
|
+
const VALIDATION_MODE = {
|
|
2829
|
+
onBlur: "onBlur",
|
|
2830
|
+
onChange: "onChange",
|
|
2831
|
+
onSubmit: "onSubmit",
|
|
2832
|
+
onTouched: "onTouched",
|
|
2833
|
+
all: "all"
|
|
2834
|
+
};
|
|
2835
|
+
const INPUT_VALIDATION_RULES = {
|
|
2836
|
+
max: "max",
|
|
2837
|
+
min: "min",
|
|
2838
|
+
maxLength: "maxLength",
|
|
2839
|
+
minLength: "minLength",
|
|
2840
|
+
pattern: "pattern",
|
|
2841
|
+
required: "required",
|
|
2842
|
+
validate: "validate"
|
|
2843
|
+
};
|
|
2844
|
+
const HookFormContext = React__default.createContext(null);
|
|
2845
|
+
const useFormContext = () => React__default.useContext(HookFormContext);
|
|
2846
|
+
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
2847
|
+
const result = {
|
|
2848
|
+
defaultValues: control._defaultValues
|
|
2849
|
+
};
|
|
2850
|
+
for (const key in formState) {
|
|
2851
|
+
Object.defineProperty(result, key, {
|
|
2852
|
+
get: () => {
|
|
2853
|
+
const _key = key;
|
|
2854
|
+
if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
|
|
2855
|
+
control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
|
|
2856
|
+
}
|
|
2857
|
+
localProxyFormState && (localProxyFormState[_key] = true);
|
|
2858
|
+
return formState[_key];
|
|
2859
|
+
}
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
return result;
|
|
2863
|
+
};
|
|
2864
|
+
var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;
|
|
2865
|
+
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
2866
|
+
updateFormState(formStateData);
|
|
2867
|
+
const { name, ...formState } = formStateData;
|
|
2868
|
+
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
2869
|
+
};
|
|
2870
|
+
var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];
|
|
2871
|
+
var shouldSubscribeByName = (name, signalName, exact) => exact && signalName ? name === signalName : !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
2872
|
+
function useSubscribe(props) {
|
|
2873
|
+
const _props = React__default.useRef(props);
|
|
2874
|
+
_props.current = props;
|
|
2875
|
+
React__default.useEffect(() => {
|
|
2876
|
+
const subscription = !props.disabled && _props.current.subject && _props.current.subject.subscribe({
|
|
2877
|
+
next: _props.current.next
|
|
2878
|
+
});
|
|
2879
|
+
return () => {
|
|
2880
|
+
subscription && subscription.unsubscribe();
|
|
2881
|
+
};
|
|
2882
|
+
}, [props.disabled]);
|
|
2883
|
+
}
|
|
2884
|
+
function useFormState(props) {
|
|
2885
|
+
const methods = useFormContext();
|
|
2886
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
2887
|
+
const [formState, updateFormState] = React__default.useState(control._formState);
|
|
2888
|
+
const _mounted = React__default.useRef(true);
|
|
2889
|
+
const _localProxyFormState = React__default.useRef({
|
|
2890
|
+
isDirty: false,
|
|
2891
|
+
isLoading: false,
|
|
2892
|
+
dirtyFields: false,
|
|
2893
|
+
touchedFields: false,
|
|
2894
|
+
isValidating: false,
|
|
2895
|
+
isValid: false,
|
|
2896
|
+
errors: false
|
|
2897
|
+
});
|
|
2898
|
+
const _name = React__default.useRef(name);
|
|
2899
|
+
_name.current = name;
|
|
2900
|
+
useSubscribe({
|
|
2901
|
+
disabled,
|
|
2902
|
+
next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current, control._updateFormState) && updateFormState({
|
|
2903
|
+
...control._formState,
|
|
2904
|
+
...value
|
|
2905
|
+
}),
|
|
2906
|
+
subject: control._subjects.state
|
|
2907
|
+
});
|
|
2908
|
+
React__default.useEffect(() => {
|
|
2909
|
+
_mounted.current = true;
|
|
2910
|
+
const isDirty = control._proxyFormState.isDirty && control._getDirty();
|
|
2911
|
+
if (isDirty !== control._formState.isDirty) {
|
|
2912
|
+
control._subjects.state.next({
|
|
2913
|
+
isDirty
|
|
2914
|
+
});
|
|
2915
|
+
}
|
|
2916
|
+
_localProxyFormState.current.isValid && control._updateValid(true);
|
|
2917
|
+
return () => {
|
|
2918
|
+
_mounted.current = false;
|
|
2919
|
+
};
|
|
2920
|
+
}, [control]);
|
|
2921
|
+
return getProxyFormState(formState, control, _localProxyFormState.current, false);
|
|
2922
|
+
}
|
|
2923
|
+
var isString = (value) => typeof value === "string";
|
|
2924
|
+
var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
|
|
2925
|
+
if (isString(names)) {
|
|
2926
|
+
isGlobal && _names.watch.add(names);
|
|
2927
|
+
return get(formValues, names, defaultValue);
|
|
2928
|
+
}
|
|
2929
|
+
if (Array.isArray(names)) {
|
|
2930
|
+
return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
|
|
2931
|
+
}
|
|
2932
|
+
isGlobal && (_names.watchAll = true);
|
|
2933
|
+
return formValues;
|
|
2934
|
+
};
|
|
2935
|
+
function useWatch(props) {
|
|
2936
|
+
const methods = useFormContext();
|
|
2937
|
+
const { control = methods.control, name, defaultValue, disabled, exact } = props || {};
|
|
2938
|
+
const _name = React__default.useRef(name);
|
|
2939
|
+
_name.current = name;
|
|
2940
|
+
useSubscribe({
|
|
2941
|
+
disabled,
|
|
2942
|
+
subject: control._subjects.values,
|
|
2943
|
+
next: (formState) => {
|
|
2944
|
+
if (shouldSubscribeByName(_name.current, formState.name, exact)) {
|
|
2945
|
+
updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2949
|
+
const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
|
|
2950
|
+
React__default.useEffect(() => control._removeUnmounted());
|
|
2951
|
+
return value;
|
|
2952
|
+
}
|
|
2953
|
+
var isKey = (value) => /^\w*$/.test(value);
|
|
2954
|
+
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
2955
|
+
function set(object, path, value) {
|
|
2956
|
+
let index = -1;
|
|
2957
|
+
const tempPath = isKey(path) ? [path] : stringToPath(path);
|
|
2958
|
+
const length2 = tempPath.length;
|
|
2959
|
+
const lastIndex = length2 - 1;
|
|
2960
|
+
while (++index < length2) {
|
|
2961
|
+
const key = tempPath[index];
|
|
2962
|
+
let newValue = value;
|
|
2963
|
+
if (index !== lastIndex) {
|
|
2964
|
+
const objValue = object[key];
|
|
2965
|
+
newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
|
|
2966
|
+
}
|
|
2967
|
+
object[key] = newValue;
|
|
2968
|
+
object = object[key];
|
|
2969
|
+
}
|
|
2970
|
+
return object;
|
|
2971
|
+
}
|
|
2972
|
+
var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria ? {
|
|
2973
|
+
...errors[name],
|
|
2974
|
+
types: {
|
|
2975
|
+
...errors[name] && errors[name].types ? errors[name].types : {},
|
|
2976
|
+
[type]: message || true
|
|
2977
|
+
}
|
|
2978
|
+
} : {};
|
|
2979
|
+
const focusFieldBy = (fields, callback, fieldsNames) => {
|
|
2980
|
+
for (const key of fieldsNames || Object.keys(fields)) {
|
|
2981
|
+
const field = get(fields, key);
|
|
2982
|
+
if (field) {
|
|
2983
|
+
const { _f, ...currentField } = field;
|
|
2984
|
+
if (_f && callback(_f.name)) {
|
|
2985
|
+
if (_f.ref.focus) {
|
|
2986
|
+
_f.ref.focus();
|
|
2987
|
+
break;
|
|
2988
|
+
} else if (_f.refs && _f.refs[0].focus) {
|
|
2989
|
+
_f.refs[0].focus();
|
|
2990
|
+
break;
|
|
2991
|
+
}
|
|
2992
|
+
} else if (isObject(currentField)) {
|
|
2993
|
+
focusFieldBy(currentField, callback);
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
};
|
|
2998
|
+
var getValidationModes = (mode) => ({
|
|
2999
|
+
isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,
|
|
3000
|
+
isOnBlur: mode === VALIDATION_MODE.onBlur,
|
|
3001
|
+
isOnChange: mode === VALIDATION_MODE.onChange,
|
|
3002
|
+
isOnAll: mode === VALIDATION_MODE.all,
|
|
3003
|
+
isOnTouch: mode === VALIDATION_MODE.onTouched
|
|
3004
|
+
});
|
|
3005
|
+
var isWatched = (name, _names, isBlurEvent) => !isBlurEvent && (_names.watchAll || _names.watch.has(name) || [..._names.watch].some((watchName) => name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length))));
|
|
3006
|
+
var updateFieldArrayRootError = (errors, error, name) => {
|
|
3007
|
+
const fieldArrayErrors = compact(get(errors, name));
|
|
3008
|
+
set(fieldArrayErrors, "root", error[name]);
|
|
3009
|
+
set(errors, name, fieldArrayErrors);
|
|
3010
|
+
return errors;
|
|
3011
|
+
};
|
|
3012
|
+
var isBoolean = (value) => typeof value === "boolean";
|
|
3013
|
+
var isFileInput = (element) => element.type === "file";
|
|
3014
|
+
var isFunction = (value) => typeof value === "function";
|
|
3015
|
+
var isHTMLElement = (value) => {
|
|
3016
|
+
if (!isWeb) {
|
|
3017
|
+
return false;
|
|
3018
|
+
}
|
|
3019
|
+
const owner = value ? value.ownerDocument : 0;
|
|
3020
|
+
return value instanceof (owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
|
|
3021
|
+
};
|
|
3022
|
+
var isMessage = (value) => isString(value);
|
|
3023
|
+
var isRadioInput = (element) => element.type === "radio";
|
|
3024
|
+
var isRegex = (value) => value instanceof RegExp;
|
|
3025
|
+
const defaultResult = {
|
|
3026
|
+
value: false,
|
|
3027
|
+
isValid: false
|
|
3028
|
+
};
|
|
3029
|
+
const validResult = { value: true, isValid: true };
|
|
3030
|
+
var getCheckboxValue = (options) => {
|
|
3031
|
+
if (Array.isArray(options)) {
|
|
3032
|
+
if (options.length > 1) {
|
|
3033
|
+
const values = options.filter((option) => option && option.checked && !option.disabled).map((option) => option.value);
|
|
3034
|
+
return { value: values, isValid: !!values.length };
|
|
3035
|
+
}
|
|
3036
|
+
return options[0].checked && !options[0].disabled ? options[0].attributes && !isUndefined(options[0].attributes.value) ? isUndefined(options[0].value) || options[0].value === "" ? validResult : { value: options[0].value, isValid: true } : validResult : defaultResult;
|
|
3037
|
+
}
|
|
3038
|
+
return defaultResult;
|
|
3039
|
+
};
|
|
3040
|
+
const defaultReturn = {
|
|
3041
|
+
isValid: false,
|
|
3042
|
+
value: null
|
|
3043
|
+
};
|
|
3044
|
+
var getRadioValue = (options) => Array.isArray(options) ? options.reduce((previous, option) => option && option.checked && !option.disabled ? {
|
|
3045
|
+
isValid: true,
|
|
3046
|
+
value: option.value
|
|
3047
|
+
} : previous, defaultReturn) : defaultReturn;
|
|
3048
|
+
function getValidateError(result, ref, type = "validate") {
|
|
3049
|
+
if (isMessage(result) || Array.isArray(result) && result.every(isMessage) || isBoolean(result) && !result) {
|
|
3050
|
+
return {
|
|
3051
|
+
type,
|
|
3052
|
+
message: isMessage(result) ? result : "",
|
|
3053
|
+
ref
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
var getValueAndMessage = (validationData) => isObject(validationData) && !isRegex(validationData) ? validationData : {
|
|
3058
|
+
value: validationData,
|
|
3059
|
+
message: ""
|
|
3060
|
+
};
|
|
3061
|
+
var validateField = async (field, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
3062
|
+
const { ref, refs, required, maxLength, minLength, min, max, pattern, validate: validate2, name, valueAsNumber, mount, disabled } = field._f;
|
|
3063
|
+
const inputValue = get(formValues, name);
|
|
3064
|
+
if (!mount || disabled) {
|
|
3065
|
+
return {};
|
|
3066
|
+
}
|
|
3067
|
+
const inputRef = refs ? refs[0] : ref;
|
|
3068
|
+
const setCustomValidity = (message) => {
|
|
3069
|
+
if (shouldUseNativeValidation && inputRef.reportValidity) {
|
|
3070
|
+
inputRef.setCustomValidity(isBoolean(message) ? "" : message || "");
|
|
3071
|
+
inputRef.reportValidity();
|
|
3072
|
+
}
|
|
3073
|
+
};
|
|
3074
|
+
const error = {};
|
|
3075
|
+
const isRadio = isRadioInput(ref);
|
|
3076
|
+
const isCheckBox = isCheckBoxInput(ref);
|
|
3077
|
+
const isRadioOrCheckbox2 = isRadio || isCheckBox;
|
|
3078
|
+
const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
3079
|
+
const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);
|
|
3080
|
+
const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
|
|
3081
|
+
const message = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
3082
|
+
error[name] = {
|
|
3083
|
+
type: exceedMax ? maxType : minType,
|
|
3084
|
+
message,
|
|
3085
|
+
ref,
|
|
3086
|
+
...appendErrorsCurry(exceedMax ? maxType : minType, message)
|
|
3087
|
+
};
|
|
3088
|
+
};
|
|
3089
|
+
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
3090
|
+
const { value, message } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
|
|
3091
|
+
if (value) {
|
|
3092
|
+
error[name] = {
|
|
3093
|
+
type: INPUT_VALIDATION_RULES.required,
|
|
3094
|
+
message,
|
|
3095
|
+
ref: inputRef,
|
|
3096
|
+
...appendErrorsCurry(INPUT_VALIDATION_RULES.required, message)
|
|
3097
|
+
};
|
|
3098
|
+
if (!validateAllFieldCriteria) {
|
|
3099
|
+
setCustomValidity(message);
|
|
3100
|
+
return error;
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {
|
|
3105
|
+
let exceedMax;
|
|
3106
|
+
let exceedMin;
|
|
3107
|
+
const maxOutput = getValueAndMessage(max);
|
|
3108
|
+
const minOutput = getValueAndMessage(min);
|
|
3109
|
+
if (!isNullOrUndefined(inputValue) && !isNaN(inputValue)) {
|
|
3110
|
+
const valueNumber = ref.valueAsNumber || (inputValue ? +inputValue : inputValue);
|
|
3111
|
+
if (!isNullOrUndefined(maxOutput.value)) {
|
|
3112
|
+
exceedMax = valueNumber > maxOutput.value;
|
|
3113
|
+
}
|
|
3114
|
+
if (!isNullOrUndefined(minOutput.value)) {
|
|
3115
|
+
exceedMin = valueNumber < minOutput.value;
|
|
3116
|
+
}
|
|
3117
|
+
} else {
|
|
3118
|
+
const valueDate = ref.valueAsDate || new Date(inputValue);
|
|
3119
|
+
const convertTimeToDate = (time) => new Date(new Date().toDateString() + " " + time);
|
|
3120
|
+
const isTime = ref.type == "time";
|
|
3121
|
+
const isWeek = ref.type == "week";
|
|
3122
|
+
if (isString(maxOutput.value) && inputValue) {
|
|
3123
|
+
exceedMax = isTime ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value) : isWeek ? inputValue > maxOutput.value : valueDate > new Date(maxOutput.value);
|
|
3124
|
+
}
|
|
3125
|
+
if (isString(minOutput.value) && inputValue) {
|
|
3126
|
+
exceedMin = isTime ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value) : isWeek ? inputValue < minOutput.value : valueDate < new Date(minOutput.value);
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
if (exceedMax || exceedMin) {
|
|
3130
|
+
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
3131
|
+
if (!validateAllFieldCriteria) {
|
|
3132
|
+
setCustomValidity(error[name].message);
|
|
3133
|
+
return error;
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
if ((maxLength || minLength) && !isEmpty && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
|
|
3138
|
+
const maxLengthOutput = getValueAndMessage(maxLength);
|
|
3139
|
+
const minLengthOutput = getValueAndMessage(minLength);
|
|
3140
|
+
const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > maxLengthOutput.value;
|
|
3141
|
+
const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < minLengthOutput.value;
|
|
3142
|
+
if (exceedMax || exceedMin) {
|
|
3143
|
+
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
3144
|
+
if (!validateAllFieldCriteria) {
|
|
3145
|
+
setCustomValidity(error[name].message);
|
|
3146
|
+
return error;
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
if (pattern && !isEmpty && isString(inputValue)) {
|
|
3151
|
+
const { value: patternValue, message } = getValueAndMessage(pattern);
|
|
3152
|
+
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
3153
|
+
error[name] = {
|
|
3154
|
+
type: INPUT_VALIDATION_RULES.pattern,
|
|
3155
|
+
message,
|
|
3156
|
+
ref,
|
|
3157
|
+
...appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message)
|
|
3158
|
+
};
|
|
3159
|
+
if (!validateAllFieldCriteria) {
|
|
3160
|
+
setCustomValidity(message);
|
|
3161
|
+
return error;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
if (validate2) {
|
|
3166
|
+
if (isFunction(validate2)) {
|
|
3167
|
+
const result = await validate2(inputValue, formValues);
|
|
3168
|
+
const validateError = getValidateError(result, inputRef);
|
|
3169
|
+
if (validateError) {
|
|
3170
|
+
error[name] = {
|
|
3171
|
+
...validateError,
|
|
3172
|
+
...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
|
|
3173
|
+
};
|
|
3174
|
+
if (!validateAllFieldCriteria) {
|
|
3175
|
+
setCustomValidity(validateError.message);
|
|
3176
|
+
return error;
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
} else if (isObject(validate2)) {
|
|
3180
|
+
let validationResult = {};
|
|
3181
|
+
for (const key in validate2) {
|
|
3182
|
+
if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
|
|
3183
|
+
break;
|
|
3184
|
+
}
|
|
3185
|
+
const validateError = getValidateError(await validate2[key](inputValue, formValues), inputRef, key);
|
|
3186
|
+
if (validateError) {
|
|
3187
|
+
validationResult = {
|
|
3188
|
+
...validateError,
|
|
3189
|
+
...appendErrorsCurry(key, validateError.message)
|
|
3190
|
+
};
|
|
3191
|
+
setCustomValidity(validateError.message);
|
|
3192
|
+
if (validateAllFieldCriteria) {
|
|
3193
|
+
error[name] = validationResult;
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
if (!isEmptyObject(validationResult)) {
|
|
3198
|
+
error[name] = {
|
|
3199
|
+
ref: inputRef,
|
|
3200
|
+
...validationResult
|
|
3201
|
+
};
|
|
3202
|
+
if (!validateAllFieldCriteria) {
|
|
3203
|
+
return error;
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
setCustomValidity(true);
|
|
3209
|
+
return error;
|
|
3210
|
+
};
|
|
3211
|
+
function baseGet(object, updatePath) {
|
|
3212
|
+
const length2 = updatePath.slice(0, -1).length;
|
|
3213
|
+
let index = 0;
|
|
3214
|
+
while (index < length2) {
|
|
3215
|
+
object = isUndefined(object) ? index++ : object[updatePath[index++]];
|
|
3216
|
+
}
|
|
3217
|
+
return object;
|
|
3218
|
+
}
|
|
3219
|
+
function isEmptyArray(obj) {
|
|
3220
|
+
for (const key in obj) {
|
|
3221
|
+
if (!isUndefined(obj[key])) {
|
|
3222
|
+
return false;
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
return true;
|
|
3226
|
+
}
|
|
3227
|
+
function unset(object, path) {
|
|
3228
|
+
const paths = Array.isArray(path) ? path : isKey(path) ? [path] : stringToPath(path);
|
|
3229
|
+
const childObject = paths.length === 1 ? object : baseGet(object, paths);
|
|
3230
|
+
const index = paths.length - 1;
|
|
3231
|
+
const key = paths[index];
|
|
3232
|
+
if (childObject) {
|
|
3233
|
+
delete childObject[key];
|
|
3234
|
+
}
|
|
3235
|
+
if (index !== 0 && (isObject(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
|
|
3236
|
+
unset(object, paths.slice(0, -1));
|
|
3237
|
+
}
|
|
3238
|
+
return object;
|
|
3239
|
+
}
|
|
3240
|
+
function createSubject() {
|
|
3241
|
+
let _observers = [];
|
|
3242
|
+
const next2 = (value) => {
|
|
3243
|
+
for (const observer of _observers) {
|
|
3244
|
+
observer.next && observer.next(value);
|
|
3245
|
+
}
|
|
3246
|
+
};
|
|
3247
|
+
const subscribe = (observer) => {
|
|
3248
|
+
_observers.push(observer);
|
|
3249
|
+
return {
|
|
3250
|
+
unsubscribe: () => {
|
|
3251
|
+
_observers = _observers.filter((o2) => o2 !== observer);
|
|
3252
|
+
}
|
|
3253
|
+
};
|
|
3254
|
+
};
|
|
3255
|
+
const unsubscribe = () => {
|
|
3256
|
+
_observers = [];
|
|
3257
|
+
};
|
|
3258
|
+
return {
|
|
3259
|
+
get observers() {
|
|
3260
|
+
return _observers;
|
|
3261
|
+
},
|
|
3262
|
+
next: next2,
|
|
3263
|
+
subscribe,
|
|
3264
|
+
unsubscribe
|
|
3265
|
+
};
|
|
3266
|
+
}
|
|
3267
|
+
var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
|
|
3268
|
+
function deepEqual(object1, object2) {
|
|
3269
|
+
if (isPrimitive(object1) || isPrimitive(object2)) {
|
|
3270
|
+
return object1 === object2;
|
|
3271
|
+
}
|
|
3272
|
+
if (isDateObject(object1) && isDateObject(object2)) {
|
|
3273
|
+
return object1.getTime() === object2.getTime();
|
|
3274
|
+
}
|
|
3275
|
+
const keys1 = Object.keys(object1);
|
|
3276
|
+
const keys2 = Object.keys(object2);
|
|
3277
|
+
if (keys1.length !== keys2.length) {
|
|
3278
|
+
return false;
|
|
3279
|
+
}
|
|
3280
|
+
for (const key of keys1) {
|
|
3281
|
+
const val1 = object1[key];
|
|
3282
|
+
if (!keys2.includes(key)) {
|
|
3283
|
+
return false;
|
|
3284
|
+
}
|
|
3285
|
+
if (key !== "ref") {
|
|
3286
|
+
const val2 = object2[key];
|
|
3287
|
+
if (isDateObject(val1) && isDateObject(val2) || isObject(val1) && isObject(val2) || Array.isArray(val1) && Array.isArray(val2) ? !deepEqual(val1, val2) : val1 !== val2) {
|
|
3288
|
+
return false;
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
return true;
|
|
3293
|
+
}
|
|
3294
|
+
var isMultipleSelect = (element) => element.type === `select-multiple`;
|
|
3295
|
+
var isRadioOrCheckbox = (ref) => isRadioInput(ref) || isCheckBoxInput(ref);
|
|
3296
|
+
var live = (ref) => isHTMLElement(ref) && ref.isConnected;
|
|
3297
|
+
var objectHasFunction = (data) => {
|
|
3298
|
+
for (const key in data) {
|
|
3299
|
+
if (isFunction(data[key])) {
|
|
3300
|
+
return true;
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
return false;
|
|
3304
|
+
};
|
|
3305
|
+
function markFieldsDirty(data, fields = {}) {
|
|
3306
|
+
const isParentNodeArray = Array.isArray(data);
|
|
3307
|
+
if (isObject(data) || isParentNodeArray) {
|
|
3308
|
+
for (const key in data) {
|
|
3309
|
+
if (Array.isArray(data[key]) || isObject(data[key]) && !objectHasFunction(data[key])) {
|
|
3310
|
+
fields[key] = Array.isArray(data[key]) ? [] : {};
|
|
3311
|
+
markFieldsDirty(data[key], fields[key]);
|
|
3312
|
+
} else if (!isNullOrUndefined(data[key])) {
|
|
3313
|
+
fields[key] = true;
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
return fields;
|
|
3318
|
+
}
|
|
3319
|
+
function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues) {
|
|
3320
|
+
const isParentNodeArray = Array.isArray(data);
|
|
3321
|
+
if (isObject(data) || isParentNodeArray) {
|
|
3322
|
+
for (const key in data) {
|
|
3323
|
+
if (Array.isArray(data[key]) || isObject(data[key]) && !objectHasFunction(data[key])) {
|
|
3324
|
+
if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) {
|
|
3325
|
+
dirtyFieldsFromValues[key] = Array.isArray(data[key]) ? markFieldsDirty(data[key], []) : { ...markFieldsDirty(data[key]) };
|
|
3326
|
+
} else {
|
|
3327
|
+
getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
|
|
3328
|
+
}
|
|
3329
|
+
} else {
|
|
3330
|
+
dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
return dirtyFieldsFromValues;
|
|
3335
|
+
}
|
|
3336
|
+
var getDirtyFields = (defaultValues, formValues) => getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));
|
|
3337
|
+
var getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => isUndefined(value) ? value : valueAsNumber ? value === "" ? NaN : value ? +value : value : valueAsDate && isString(value) ? new Date(value) : setValueAs ? setValueAs(value) : value;
|
|
3338
|
+
function getFieldValue(_f) {
|
|
3339
|
+
const ref = _f.ref;
|
|
3340
|
+
if (_f.refs ? _f.refs.every((ref2) => ref2.disabled) : ref.disabled) {
|
|
3341
|
+
return;
|
|
3342
|
+
}
|
|
3343
|
+
if (isFileInput(ref)) {
|
|
3344
|
+
return ref.files;
|
|
3345
|
+
}
|
|
3346
|
+
if (isRadioInput(ref)) {
|
|
3347
|
+
return getRadioValue(_f.refs).value;
|
|
3348
|
+
}
|
|
3349
|
+
if (isMultipleSelect(ref)) {
|
|
3350
|
+
return [...ref.selectedOptions].map(({ value }) => value);
|
|
3351
|
+
}
|
|
3352
|
+
if (isCheckBoxInput(ref)) {
|
|
3353
|
+
return getCheckboxValue(_f.refs).value;
|
|
3354
|
+
}
|
|
3355
|
+
return getFieldValueAs(isUndefined(ref.value) ? _f.ref.value : ref.value, _f);
|
|
3356
|
+
}
|
|
3357
|
+
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
3358
|
+
const fields = {};
|
|
3359
|
+
for (const name of fieldsNames) {
|
|
3360
|
+
const field = get(_fields, name);
|
|
3361
|
+
field && set(fields, name, field._f);
|
|
3362
|
+
}
|
|
3363
|
+
return {
|
|
3364
|
+
criteriaMode,
|
|
3365
|
+
names: [...fieldsNames],
|
|
3366
|
+
fields,
|
|
3367
|
+
shouldUseNativeValidation
|
|
3368
|
+
};
|
|
3369
|
+
};
|
|
3370
|
+
var getRuleValue = (rule) => isUndefined(rule) ? rule : isRegex(rule) ? rule.source : isObject(rule) ? isRegex(rule.value) ? rule.value.source : rule.value : rule;
|
|
3371
|
+
var hasValidation = (options) => options.mount && (options.required || options.min || options.max || options.maxLength || options.minLength || options.pattern || options.validate);
|
|
3372
|
+
function schemaErrorLookup(errors, _fields, name) {
|
|
3373
|
+
const error = get(errors, name);
|
|
3374
|
+
if (error || isKey(name)) {
|
|
3375
|
+
return {
|
|
3376
|
+
error,
|
|
3377
|
+
name
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3380
|
+
const names = name.split(".");
|
|
3381
|
+
while (names.length) {
|
|
3382
|
+
const fieldName = names.join(".");
|
|
3383
|
+
const field = get(_fields, fieldName);
|
|
3384
|
+
const foundError = get(errors, fieldName);
|
|
3385
|
+
if (field && !Array.isArray(field) && name !== fieldName) {
|
|
3386
|
+
return { name };
|
|
3387
|
+
}
|
|
3388
|
+
if (foundError && foundError.type) {
|
|
3389
|
+
return {
|
|
3390
|
+
name: fieldName,
|
|
3391
|
+
error: foundError
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3394
|
+
names.pop();
|
|
3395
|
+
}
|
|
3396
|
+
return {
|
|
3397
|
+
name
|
|
3398
|
+
};
|
|
3399
|
+
}
|
|
3400
|
+
var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
|
|
3401
|
+
if (mode.isOnAll) {
|
|
3402
|
+
return false;
|
|
3403
|
+
} else if (!isSubmitted && mode.isOnTouch) {
|
|
3404
|
+
return !(isTouched || isBlurEvent);
|
|
3405
|
+
} else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) {
|
|
3406
|
+
return !isBlurEvent;
|
|
3407
|
+
} else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) {
|
|
3408
|
+
return isBlurEvent;
|
|
3409
|
+
}
|
|
3410
|
+
return true;
|
|
3411
|
+
};
|
|
3412
|
+
var unsetEmptyArray = (ref, name) => !compact(get(ref, name)).length && unset(ref, name);
|
|
3413
|
+
const defaultOptions = {
|
|
3414
|
+
mode: VALIDATION_MODE.onSubmit,
|
|
3415
|
+
reValidateMode: VALIDATION_MODE.onChange,
|
|
3416
|
+
shouldFocusError: true
|
|
3417
|
+
};
|
|
3418
|
+
function createFormControl(props = {}, flushRootRender) {
|
|
3419
|
+
let _options = {
|
|
3420
|
+
...defaultOptions,
|
|
3421
|
+
...props
|
|
3422
|
+
};
|
|
3423
|
+
let _formState = {
|
|
3424
|
+
submitCount: 0,
|
|
3425
|
+
isDirty: false,
|
|
3426
|
+
isLoading: true,
|
|
3427
|
+
isValidating: false,
|
|
3428
|
+
isSubmitted: false,
|
|
3429
|
+
isSubmitting: false,
|
|
3430
|
+
isSubmitSuccessful: false,
|
|
3431
|
+
isValid: false,
|
|
3432
|
+
touchedFields: {},
|
|
3433
|
+
dirtyFields: {},
|
|
3434
|
+
errors: {}
|
|
3435
|
+
};
|
|
3436
|
+
let _fields = {};
|
|
3437
|
+
let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values) ? cloneObject(_options.defaultValues || _options.values) || {} : {};
|
|
3438
|
+
let _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);
|
|
3439
|
+
let _state = {
|
|
3440
|
+
action: false,
|
|
3441
|
+
mount: false,
|
|
3442
|
+
watch: false
|
|
3443
|
+
};
|
|
3444
|
+
let _names = {
|
|
3445
|
+
mount: /* @__PURE__ */ new Set(),
|
|
3446
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
3447
|
+
array: /* @__PURE__ */ new Set(),
|
|
3448
|
+
watch: /* @__PURE__ */ new Set()
|
|
3449
|
+
};
|
|
3450
|
+
let delayErrorCallback;
|
|
3451
|
+
let timer = 0;
|
|
3452
|
+
const _proxyFormState = {
|
|
3453
|
+
isDirty: false,
|
|
3454
|
+
dirtyFields: false,
|
|
3455
|
+
touchedFields: false,
|
|
3456
|
+
isValidating: false,
|
|
3457
|
+
isValid: false,
|
|
3458
|
+
errors: false
|
|
3459
|
+
};
|
|
3460
|
+
const _subjects = {
|
|
3461
|
+
values: createSubject(),
|
|
3462
|
+
array: createSubject(),
|
|
3463
|
+
state: createSubject()
|
|
3464
|
+
};
|
|
3465
|
+
const shouldCaptureDirtyFields = props.resetOptions && props.resetOptions.keepDirtyValues;
|
|
3466
|
+
const validationModeBeforeSubmit = getValidationModes(_options.mode);
|
|
3467
|
+
const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
|
|
3468
|
+
const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
|
|
3469
|
+
const debounce = (callback) => (wait) => {
|
|
3470
|
+
clearTimeout(timer);
|
|
3471
|
+
timer = setTimeout(callback, wait);
|
|
3472
|
+
};
|
|
3473
|
+
const _updateValid = async (shouldUpdateValid) => {
|
|
3474
|
+
if (_proxyFormState.isValid || shouldUpdateValid) {
|
|
3475
|
+
const isValid = _options.resolver ? isEmptyObject((await _executeSchema()).errors) : await executeBuiltInValidation(_fields, true);
|
|
3476
|
+
if (isValid !== _formState.isValid) {
|
|
3477
|
+
_subjects.state.next({
|
|
3478
|
+
isValid
|
|
3479
|
+
});
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
};
|
|
3483
|
+
const _updateIsValidating = (value) => _proxyFormState.isValidating && _subjects.state.next({
|
|
3484
|
+
isValidating: value
|
|
3485
|
+
});
|
|
3486
|
+
const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
3487
|
+
if (args && method) {
|
|
3488
|
+
_state.action = true;
|
|
3489
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {
|
|
3490
|
+
const fieldValues = method(get(_fields, name), args.argA, args.argB);
|
|
3491
|
+
shouldSetValues && set(_fields, name, fieldValues);
|
|
3492
|
+
}
|
|
3493
|
+
if (shouldUpdateFieldsAndState && Array.isArray(get(_formState.errors, name))) {
|
|
3494
|
+
const errors = method(get(_formState.errors, name), args.argA, args.argB);
|
|
3495
|
+
shouldSetValues && set(_formState.errors, name, errors);
|
|
3496
|
+
unsetEmptyArray(_formState.errors, name);
|
|
3497
|
+
}
|
|
3498
|
+
if (_proxyFormState.touchedFields && shouldUpdateFieldsAndState && Array.isArray(get(_formState.touchedFields, name))) {
|
|
3499
|
+
const touchedFields = method(get(_formState.touchedFields, name), args.argA, args.argB);
|
|
3500
|
+
shouldSetValues && set(_formState.touchedFields, name, touchedFields);
|
|
3501
|
+
}
|
|
3502
|
+
if (_proxyFormState.dirtyFields) {
|
|
3503
|
+
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
3504
|
+
}
|
|
3505
|
+
_subjects.state.next({
|
|
3506
|
+
name,
|
|
3507
|
+
isDirty: _getDirty(name, values),
|
|
3508
|
+
dirtyFields: _formState.dirtyFields,
|
|
3509
|
+
errors: _formState.errors,
|
|
3510
|
+
isValid: _formState.isValid
|
|
3511
|
+
});
|
|
3512
|
+
} else {
|
|
3513
|
+
set(_formValues, name, values);
|
|
3514
|
+
}
|
|
3515
|
+
};
|
|
3516
|
+
const updateErrors = (name, error) => {
|
|
3517
|
+
set(_formState.errors, name, error);
|
|
3518
|
+
_subjects.state.next({
|
|
3519
|
+
errors: _formState.errors
|
|
3520
|
+
});
|
|
3521
|
+
};
|
|
3522
|
+
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
3523
|
+
const field = get(_fields, name);
|
|
3524
|
+
if (field) {
|
|
3525
|
+
const defaultValue = get(_formValues, name, isUndefined(value) ? get(_defaultValues, name) : value);
|
|
3526
|
+
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
3527
|
+
_state.mount && _updateValid();
|
|
3528
|
+
}
|
|
3529
|
+
};
|
|
3530
|
+
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
3531
|
+
let shouldUpdateField = false;
|
|
3532
|
+
let isPreviousDirty = false;
|
|
3533
|
+
const output = {
|
|
3534
|
+
name
|
|
3535
|
+
};
|
|
3536
|
+
if (!isBlurEvent || shouldDirty) {
|
|
3537
|
+
if (_proxyFormState.isDirty) {
|
|
3538
|
+
isPreviousDirty = _formState.isDirty;
|
|
3539
|
+
_formState.isDirty = output.isDirty = _getDirty();
|
|
3540
|
+
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
3541
|
+
}
|
|
3542
|
+
const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);
|
|
3543
|
+
isPreviousDirty = get(_formState.dirtyFields, name);
|
|
3544
|
+
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
3545
|
+
output.dirtyFields = _formState.dirtyFields;
|
|
3546
|
+
shouldUpdateField = shouldUpdateField || _proxyFormState.dirtyFields && isPreviousDirty !== !isCurrentFieldPristine;
|
|
3547
|
+
}
|
|
3548
|
+
if (isBlurEvent) {
|
|
3549
|
+
const isPreviousFieldTouched = get(_formState.touchedFields, name);
|
|
3550
|
+
if (!isPreviousFieldTouched) {
|
|
3551
|
+
set(_formState.touchedFields, name, isBlurEvent);
|
|
3552
|
+
output.touchedFields = _formState.touchedFields;
|
|
3553
|
+
shouldUpdateField = shouldUpdateField || _proxyFormState.touchedFields && isPreviousFieldTouched !== isBlurEvent;
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
shouldUpdateField && shouldRender && _subjects.state.next(output);
|
|
3557
|
+
return shouldUpdateField ? output : {};
|
|
3558
|
+
};
|
|
3559
|
+
const shouldRenderByError = (name, isValid, error, fieldState) => {
|
|
3560
|
+
const previousFieldError = get(_formState.errors, name);
|
|
3561
|
+
const shouldUpdateValid = _proxyFormState.isValid && isBoolean(isValid) && _formState.isValid !== isValid;
|
|
3562
|
+
if (props.delayError && error) {
|
|
3563
|
+
delayErrorCallback = debounce(() => updateErrors(name, error));
|
|
3564
|
+
delayErrorCallback(props.delayError);
|
|
3565
|
+
} else {
|
|
3566
|
+
clearTimeout(timer);
|
|
3567
|
+
delayErrorCallback = null;
|
|
3568
|
+
error ? set(_formState.errors, name, error) : unset(_formState.errors, name);
|
|
3569
|
+
}
|
|
3570
|
+
if ((error ? !deepEqual(previousFieldError, error) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
|
|
3571
|
+
const updatedFormState = {
|
|
3572
|
+
...fieldState,
|
|
3573
|
+
...shouldUpdateValid && isBoolean(isValid) ? { isValid } : {},
|
|
3574
|
+
errors: _formState.errors,
|
|
3575
|
+
name
|
|
3576
|
+
};
|
|
3577
|
+
_formState = {
|
|
3578
|
+
..._formState,
|
|
3579
|
+
...updatedFormState
|
|
3580
|
+
};
|
|
3581
|
+
_subjects.state.next(updatedFormState);
|
|
3582
|
+
}
|
|
3583
|
+
_updateIsValidating(false);
|
|
3584
|
+
};
|
|
3585
|
+
const _executeSchema = async (name) => _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
3586
|
+
const executeSchemaAndUpdateState = async (names) => {
|
|
3587
|
+
const { errors } = await _executeSchema();
|
|
3588
|
+
if (names) {
|
|
3589
|
+
for (const name of names) {
|
|
3590
|
+
const error = get(errors, name);
|
|
3591
|
+
error ? set(_formState.errors, name, error) : unset(_formState.errors, name);
|
|
3592
|
+
}
|
|
3593
|
+
} else {
|
|
3594
|
+
_formState.errors = errors;
|
|
3595
|
+
}
|
|
3596
|
+
return errors;
|
|
3597
|
+
};
|
|
3598
|
+
const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
|
|
3599
|
+
valid: true
|
|
3600
|
+
}) => {
|
|
3601
|
+
for (const name in fields) {
|
|
3602
|
+
const field = fields[name];
|
|
3603
|
+
if (field) {
|
|
3604
|
+
const { _f, ...fieldValue } = field;
|
|
3605
|
+
if (_f) {
|
|
3606
|
+
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
3607
|
+
const fieldError = await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation, isFieldArrayRoot);
|
|
3608
|
+
if (fieldError[_f.name]) {
|
|
3609
|
+
context.valid = false;
|
|
3610
|
+
if (shouldOnlyCheckValid) {
|
|
3611
|
+
break;
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
!shouldOnlyCheckValid && (get(fieldError, _f.name) ? isFieldArrayRoot ? updateFieldArrayRootError(_formState.errors, fieldError, _f.name) : set(_formState.errors, _f.name, fieldError[_f.name]) : unset(_formState.errors, _f.name));
|
|
3615
|
+
}
|
|
3616
|
+
fieldValue && await executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context);
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
return context.valid;
|
|
3620
|
+
};
|
|
3621
|
+
const _removeUnmounted = () => {
|
|
3622
|
+
for (const name of _names.unMount) {
|
|
3623
|
+
const field = get(_fields, name);
|
|
3624
|
+
field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(name);
|
|
3625
|
+
}
|
|
3626
|
+
_names.unMount = /* @__PURE__ */ new Set();
|
|
3627
|
+
};
|
|
3628
|
+
const _getDirty = (name, data) => (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
3629
|
+
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
3630
|
+
..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
|
|
3631
|
+
}, isGlobal, defaultValue);
|
|
3632
|
+
const _getFieldArray = (name) => compact(get(_state.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));
|
|
3633
|
+
const setFieldValue = (name, value, options = {}) => {
|
|
3634
|
+
const field = get(_fields, name);
|
|
3635
|
+
let fieldValue = value;
|
|
3636
|
+
if (field) {
|
|
3637
|
+
const fieldReference = field._f;
|
|
3638
|
+
if (fieldReference) {
|
|
3639
|
+
!fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
|
|
3640
|
+
fieldValue = isHTMLElement(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
|
|
3641
|
+
if (isMultipleSelect(fieldReference.ref)) {
|
|
3642
|
+
[...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
|
|
3643
|
+
} else if (fieldReference.refs) {
|
|
3644
|
+
if (isCheckBoxInput(fieldReference.ref)) {
|
|
3645
|
+
fieldReference.refs.length > 1 ? fieldReference.refs.forEach((checkboxRef) => (!checkboxRef.defaultChecked || !checkboxRef.disabled) && (checkboxRef.checked = Array.isArray(fieldValue) ? !!fieldValue.find((data) => data === checkboxRef.value) : fieldValue === checkboxRef.value)) : fieldReference.refs[0] && (fieldReference.refs[0].checked = !!fieldValue);
|
|
3646
|
+
} else {
|
|
3647
|
+
fieldReference.refs.forEach((radioRef) => radioRef.checked = radioRef.value === fieldValue);
|
|
3648
|
+
}
|
|
3649
|
+
} else if (isFileInput(fieldReference.ref)) {
|
|
3650
|
+
fieldReference.ref.value = "";
|
|
3651
|
+
} else {
|
|
3652
|
+
fieldReference.ref.value = fieldValue;
|
|
3653
|
+
if (!fieldReference.ref.type) {
|
|
3654
|
+
_subjects.values.next({
|
|
3655
|
+
name,
|
|
3656
|
+
values: { ..._formValues }
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
(options.shouldDirty || options.shouldTouch) && updateTouchAndDirty(name, fieldValue, options.shouldTouch, options.shouldDirty, true);
|
|
3663
|
+
options.shouldValidate && trigger(name);
|
|
3664
|
+
};
|
|
3665
|
+
const setValues = (name, value, options) => {
|
|
3666
|
+
for (const fieldKey in value) {
|
|
3667
|
+
const fieldValue = value[fieldKey];
|
|
3668
|
+
const fieldName = `${name}.${fieldKey}`;
|
|
3669
|
+
const field = get(_fields, fieldName);
|
|
3670
|
+
(_names.array.has(name) || !isPrimitive(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options) : setFieldValue(fieldName, fieldValue, options);
|
|
3671
|
+
}
|
|
3672
|
+
};
|
|
3673
|
+
const setValue = (name, value, options = {}) => {
|
|
3674
|
+
const field = get(_fields, name);
|
|
3675
|
+
const isFieldArray = _names.array.has(name);
|
|
3676
|
+
const cloneValue = cloneObject(value);
|
|
3677
|
+
set(_formValues, name, cloneValue);
|
|
3678
|
+
if (isFieldArray) {
|
|
3679
|
+
_subjects.array.next({
|
|
3680
|
+
name,
|
|
3681
|
+
values: { ..._formValues }
|
|
3682
|
+
});
|
|
3683
|
+
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {
|
|
3684
|
+
_subjects.state.next({
|
|
3685
|
+
name,
|
|
3686
|
+
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
3687
|
+
isDirty: _getDirty(name, cloneValue)
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
} else {
|
|
3691
|
+
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);
|
|
3692
|
+
}
|
|
3693
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState });
|
|
3694
|
+
_subjects.values.next({
|
|
3695
|
+
name,
|
|
3696
|
+
values: { ..._formValues }
|
|
3697
|
+
});
|
|
3698
|
+
!_state.mount && flushRootRender();
|
|
3699
|
+
};
|
|
3700
|
+
const onChange = async (event) => {
|
|
3701
|
+
const target = event.target;
|
|
3702
|
+
let name = target.name;
|
|
3703
|
+
const field = get(_fields, name);
|
|
3704
|
+
const getCurrentFieldValue = () => target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
3705
|
+
if (field) {
|
|
3706
|
+
let error;
|
|
3707
|
+
let isValid;
|
|
3708
|
+
const fieldValue = getCurrentFieldValue();
|
|
3709
|
+
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
3710
|
+
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
3711
|
+
const watched = isWatched(name, _names, isBlurEvent);
|
|
3712
|
+
set(_formValues, name, fieldValue);
|
|
3713
|
+
if (isBlurEvent) {
|
|
3714
|
+
field._f.onBlur && field._f.onBlur(event);
|
|
3715
|
+
delayErrorCallback && delayErrorCallback(0);
|
|
3716
|
+
} else if (field._f.onChange) {
|
|
3717
|
+
field._f.onChange(event);
|
|
3718
|
+
}
|
|
3719
|
+
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);
|
|
3720
|
+
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
3721
|
+
!isBlurEvent && _subjects.values.next({
|
|
3722
|
+
name,
|
|
3723
|
+
type: event.type,
|
|
3724
|
+
values: { ..._formValues }
|
|
3725
|
+
});
|
|
3726
|
+
if (shouldSkipValidation) {
|
|
3727
|
+
_proxyFormState.isValid && _updateValid();
|
|
3728
|
+
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
3729
|
+
}
|
|
3730
|
+
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
3731
|
+
_updateIsValidating(true);
|
|
3732
|
+
if (_options.resolver) {
|
|
3733
|
+
const { errors } = await _executeSchema([name]);
|
|
3734
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
3735
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
3736
|
+
error = errorLookupResult.error;
|
|
3737
|
+
name = errorLookupResult.name;
|
|
3738
|
+
isValid = isEmptyObject(errors);
|
|
3739
|
+
} else {
|
|
3740
|
+
error = (await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
3741
|
+
if (error) {
|
|
3742
|
+
isValid = false;
|
|
3743
|
+
} else if (_proxyFormState.isValid) {
|
|
3744
|
+
isValid = await executeBuiltInValidation(_fields, true);
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
field._f.deps && trigger(field._f.deps);
|
|
3748
|
+
shouldRenderByError(name, isValid, error, fieldState);
|
|
3749
|
+
}
|
|
3750
|
+
};
|
|
3751
|
+
const trigger = async (name, options = {}) => {
|
|
3752
|
+
let isValid;
|
|
3753
|
+
let validationResult;
|
|
3754
|
+
const fieldNames = convertToArrayPayload(name);
|
|
3755
|
+
_updateIsValidating(true);
|
|
3756
|
+
if (_options.resolver) {
|
|
3757
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
3758
|
+
isValid = isEmptyObject(errors);
|
|
3759
|
+
validationResult = name ? !fieldNames.some((name2) => get(errors, name2)) : isValid;
|
|
3760
|
+
} else if (name) {
|
|
3761
|
+
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
3762
|
+
const field = get(_fields, fieldName);
|
|
3763
|
+
return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
|
|
3764
|
+
}))).every(Boolean);
|
|
3765
|
+
!(!validationResult && !_formState.isValid) && _updateValid();
|
|
3766
|
+
} else {
|
|
3767
|
+
validationResult = isValid = await executeBuiltInValidation(_fields);
|
|
3768
|
+
}
|
|
3769
|
+
_subjects.state.next({
|
|
3770
|
+
...!isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : { name },
|
|
3771
|
+
..._options.resolver || !name ? { isValid } : {},
|
|
3772
|
+
errors: _formState.errors,
|
|
3773
|
+
isValidating: false
|
|
3774
|
+
});
|
|
3775
|
+
options.shouldFocus && !validationResult && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), name ? fieldNames : _names.mount);
|
|
3776
|
+
return validationResult;
|
|
3777
|
+
};
|
|
3778
|
+
const getValues = (fieldNames) => {
|
|
3779
|
+
const values = {
|
|
3780
|
+
..._defaultValues,
|
|
3781
|
+
..._state.mount ? _formValues : {}
|
|
3782
|
+
};
|
|
3783
|
+
return isUndefined(fieldNames) ? values : isString(fieldNames) ? get(values, fieldNames) : fieldNames.map((name) => get(values, name));
|
|
3784
|
+
};
|
|
3785
|
+
const getFieldState = (name, formState) => ({
|
|
3786
|
+
invalid: !!get((formState || _formState).errors, name),
|
|
3787
|
+
isDirty: !!get((formState || _formState).dirtyFields, name),
|
|
3788
|
+
isTouched: !!get((formState || _formState).touchedFields, name),
|
|
3789
|
+
error: get((formState || _formState).errors, name)
|
|
3790
|
+
});
|
|
3791
|
+
const clearErrors = (name) => {
|
|
3792
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
3793
|
+
_subjects.state.next({
|
|
3794
|
+
errors: name ? _formState.errors : {}
|
|
3795
|
+
});
|
|
3796
|
+
};
|
|
3797
|
+
const setError = (name, error, options) => {
|
|
3798
|
+
const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
|
|
3799
|
+
set(_formState.errors, name, {
|
|
3800
|
+
...error,
|
|
3801
|
+
ref
|
|
3802
|
+
});
|
|
3803
|
+
_subjects.state.next({
|
|
3804
|
+
name,
|
|
3805
|
+
errors: _formState.errors,
|
|
3806
|
+
isValid: false
|
|
3807
|
+
});
|
|
3808
|
+
options && options.shouldFocus && ref && ref.focus && ref.focus();
|
|
3809
|
+
};
|
|
3810
|
+
const watch = (name, defaultValue) => isFunction(name) ? _subjects.values.subscribe({
|
|
3811
|
+
next: (payload) => name(_getWatch(void 0, defaultValue), payload)
|
|
3812
|
+
}) : _getWatch(name, defaultValue, true);
|
|
3813
|
+
const unregister = (name, options = {}) => {
|
|
3814
|
+
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
3815
|
+
_names.mount.delete(fieldName);
|
|
3816
|
+
_names.array.delete(fieldName);
|
|
3817
|
+
if (get(_fields, fieldName)) {
|
|
3818
|
+
if (!options.keepValue) {
|
|
3819
|
+
unset(_fields, fieldName);
|
|
3820
|
+
unset(_formValues, fieldName);
|
|
3821
|
+
}
|
|
3822
|
+
!options.keepError && unset(_formState.errors, fieldName);
|
|
3823
|
+
!options.keepDirty && unset(_formState.dirtyFields, fieldName);
|
|
3824
|
+
!options.keepTouched && unset(_formState.touchedFields, fieldName);
|
|
3825
|
+
!_options.shouldUnregister && !options.keepDefaultValue && unset(_defaultValues, fieldName);
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
_subjects.values.next({
|
|
3829
|
+
values: { ..._formValues }
|
|
3830
|
+
});
|
|
3831
|
+
_subjects.state.next({
|
|
3832
|
+
..._formState,
|
|
3833
|
+
...!options.keepDirty ? {} : { isDirty: _getDirty() }
|
|
3834
|
+
});
|
|
3835
|
+
!options.keepIsValid && _updateValid();
|
|
3836
|
+
};
|
|
3837
|
+
const register = (name, options = {}) => {
|
|
3838
|
+
let field = get(_fields, name);
|
|
3839
|
+
const disabledIsDefined = isBoolean(options.disabled);
|
|
3840
|
+
set(_fields, name, {
|
|
3841
|
+
...field || {},
|
|
3842
|
+
_f: {
|
|
3843
|
+
...field && field._f ? field._f : { ref: { name } },
|
|
3844
|
+
name,
|
|
3845
|
+
mount: true,
|
|
3846
|
+
...options
|
|
3847
|
+
}
|
|
3848
|
+
});
|
|
3849
|
+
_names.mount.add(name);
|
|
3850
|
+
field ? disabledIsDefined && set(_formValues, name, options.disabled ? void 0 : get(_formValues, name, getFieldValue(field._f))) : updateValidAndValue(name, true, options.value);
|
|
3851
|
+
return {
|
|
3852
|
+
...disabledIsDefined ? { disabled: options.disabled } : {},
|
|
3853
|
+
..._options.shouldUseNativeValidation ? {
|
|
3854
|
+
required: !!options.required,
|
|
3855
|
+
min: getRuleValue(options.min),
|
|
3856
|
+
max: getRuleValue(options.max),
|
|
3857
|
+
minLength: getRuleValue(options.minLength),
|
|
3858
|
+
maxLength: getRuleValue(options.maxLength),
|
|
3859
|
+
pattern: getRuleValue(options.pattern)
|
|
3860
|
+
} : {},
|
|
3861
|
+
name,
|
|
3862
|
+
onChange,
|
|
3863
|
+
onBlur: onChange,
|
|
3864
|
+
ref: (ref) => {
|
|
3865
|
+
if (ref) {
|
|
3866
|
+
register(name, options);
|
|
3867
|
+
field = get(_fields, name);
|
|
3868
|
+
const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
|
|
3869
|
+
const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
|
|
3870
|
+
const refs = field._f.refs || [];
|
|
3871
|
+
if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
|
|
3872
|
+
return;
|
|
3873
|
+
}
|
|
3874
|
+
set(_fields, name, {
|
|
3875
|
+
_f: {
|
|
3876
|
+
...field._f,
|
|
3877
|
+
...radioOrCheckbox ? {
|
|
3878
|
+
refs: [
|
|
3879
|
+
...refs.filter(live),
|
|
3880
|
+
fieldRef,
|
|
3881
|
+
...Array.isArray(get(_defaultValues, name)) ? [{}] : []
|
|
3882
|
+
],
|
|
3883
|
+
ref: { type: fieldRef.type, name }
|
|
3884
|
+
} : { ref: fieldRef }
|
|
3885
|
+
}
|
|
3886
|
+
});
|
|
3887
|
+
updateValidAndValue(name, false, void 0, fieldRef);
|
|
3888
|
+
} else {
|
|
3889
|
+
field = get(_fields, name, {});
|
|
3890
|
+
if (field._f) {
|
|
3891
|
+
field._f.mount = false;
|
|
3892
|
+
}
|
|
3893
|
+
(_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
};
|
|
3897
|
+
};
|
|
3898
|
+
const _focusError = () => _options.shouldFocusError && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), _names.mount);
|
|
3899
|
+
const handleSubmit = (onValid, onInvalid) => async (e) => {
|
|
3900
|
+
if (e) {
|
|
3901
|
+
e.preventDefault && e.preventDefault();
|
|
3902
|
+
e.persist && e.persist();
|
|
3903
|
+
}
|
|
3904
|
+
let fieldValues = cloneObject(_formValues);
|
|
3905
|
+
_subjects.state.next({
|
|
3906
|
+
isSubmitting: true
|
|
3907
|
+
});
|
|
3908
|
+
if (_options.resolver) {
|
|
3909
|
+
const { errors, values } = await _executeSchema();
|
|
3910
|
+
_formState.errors = errors;
|
|
3911
|
+
fieldValues = values;
|
|
3912
|
+
} else {
|
|
3913
|
+
await executeBuiltInValidation(_fields);
|
|
3914
|
+
}
|
|
3915
|
+
unset(_formState.errors, "root");
|
|
3916
|
+
if (isEmptyObject(_formState.errors)) {
|
|
3917
|
+
_subjects.state.next({
|
|
3918
|
+
errors: {}
|
|
3919
|
+
});
|
|
3920
|
+
await onValid(fieldValues, e);
|
|
3921
|
+
} else {
|
|
3922
|
+
if (onInvalid) {
|
|
3923
|
+
await onInvalid({ ..._formState.errors }, e);
|
|
3924
|
+
}
|
|
3925
|
+
_focusError();
|
|
3926
|
+
setTimeout(_focusError);
|
|
3927
|
+
}
|
|
3928
|
+
_subjects.state.next({
|
|
3929
|
+
isSubmitted: true,
|
|
3930
|
+
isSubmitting: false,
|
|
3931
|
+
isSubmitSuccessful: isEmptyObject(_formState.errors),
|
|
3932
|
+
submitCount: _formState.submitCount + 1,
|
|
3933
|
+
errors: _formState.errors
|
|
3934
|
+
});
|
|
3935
|
+
};
|
|
3936
|
+
const resetField = (name, options = {}) => {
|
|
3937
|
+
if (get(_fields, name)) {
|
|
3938
|
+
if (isUndefined(options.defaultValue)) {
|
|
3939
|
+
setValue(name, get(_defaultValues, name));
|
|
3940
|
+
} else {
|
|
3941
|
+
setValue(name, options.defaultValue);
|
|
3942
|
+
set(_defaultValues, name, options.defaultValue);
|
|
3943
|
+
}
|
|
3944
|
+
if (!options.keepTouched) {
|
|
3945
|
+
unset(_formState.touchedFields, name);
|
|
3946
|
+
}
|
|
3947
|
+
if (!options.keepDirty) {
|
|
3948
|
+
unset(_formState.dirtyFields, name);
|
|
3949
|
+
_formState.isDirty = options.defaultValue ? _getDirty(name, get(_defaultValues, name)) : _getDirty();
|
|
3950
|
+
}
|
|
3951
|
+
if (!options.keepError) {
|
|
3952
|
+
unset(_formState.errors, name);
|
|
3953
|
+
_proxyFormState.isValid && _updateValid();
|
|
3954
|
+
}
|
|
3955
|
+
_subjects.state.next({ ..._formState });
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
const _reset = (formValues, keepStateOptions = {}) => {
|
|
3959
|
+
const updatedValues = formValues || _defaultValues;
|
|
3960
|
+
const cloneUpdatedValues = cloneObject(updatedValues);
|
|
3961
|
+
const values = formValues && !isEmptyObject(formValues) ? cloneUpdatedValues : _defaultValues;
|
|
3962
|
+
if (!keepStateOptions.keepDefaultValues) {
|
|
3963
|
+
_defaultValues = updatedValues;
|
|
3964
|
+
}
|
|
3965
|
+
if (!keepStateOptions.keepValues) {
|
|
3966
|
+
if (keepStateOptions.keepDirtyValues || shouldCaptureDirtyFields) {
|
|
3967
|
+
for (const fieldName of _names.mount) {
|
|
3968
|
+
get(_formState.dirtyFields, fieldName) ? set(values, fieldName, get(_formValues, fieldName)) : setValue(fieldName, get(values, fieldName));
|
|
3969
|
+
}
|
|
3970
|
+
} else {
|
|
3971
|
+
if (isWeb && isUndefined(formValues)) {
|
|
3972
|
+
for (const name of _names.mount) {
|
|
3973
|
+
const field = get(_fields, name);
|
|
3974
|
+
if (field && field._f) {
|
|
3975
|
+
const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
|
|
3976
|
+
if (isHTMLElement(fieldReference)) {
|
|
3977
|
+
const form = fieldReference.closest("form");
|
|
3978
|
+
if (form) {
|
|
3979
|
+
form.reset();
|
|
3980
|
+
break;
|
|
3981
|
+
}
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3986
|
+
_fields = {};
|
|
3987
|
+
}
|
|
3988
|
+
_formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneUpdatedValues;
|
|
3989
|
+
_subjects.array.next({
|
|
3990
|
+
values: { ...values }
|
|
3991
|
+
});
|
|
3992
|
+
_subjects.values.next({
|
|
3993
|
+
values: { ...values }
|
|
3994
|
+
});
|
|
3995
|
+
}
|
|
3996
|
+
_names = {
|
|
3997
|
+
mount: /* @__PURE__ */ new Set(),
|
|
3998
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
3999
|
+
array: /* @__PURE__ */ new Set(),
|
|
4000
|
+
watch: /* @__PURE__ */ new Set(),
|
|
4001
|
+
watchAll: false,
|
|
4002
|
+
focus: ""
|
|
4003
|
+
};
|
|
4004
|
+
!_state.mount && flushRootRender();
|
|
4005
|
+
_state.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;
|
|
4006
|
+
_state.watch = !!props.shouldUnregister;
|
|
4007
|
+
_subjects.state.next({
|
|
4008
|
+
submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0,
|
|
4009
|
+
isDirty: keepStateOptions.keepDirty ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
|
|
4010
|
+
isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false,
|
|
4011
|
+
dirtyFields: keepStateOptions.keepDirtyValues ? _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : {},
|
|
4012
|
+
touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {},
|
|
4013
|
+
errors: keepStateOptions.keepErrors ? _formState.errors : {},
|
|
4014
|
+
isSubmitting: false,
|
|
4015
|
+
isSubmitSuccessful: false
|
|
4016
|
+
});
|
|
4017
|
+
};
|
|
4018
|
+
const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
4019
|
+
const setFocus = (name, options = {}) => {
|
|
4020
|
+
const field = get(_fields, name);
|
|
4021
|
+
const fieldReference = field && field._f;
|
|
4022
|
+
if (fieldReference) {
|
|
4023
|
+
const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
|
|
4024
|
+
if (fieldRef.focus) {
|
|
4025
|
+
fieldRef.focus();
|
|
4026
|
+
options.shouldSelect && fieldRef.select();
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
};
|
|
4030
|
+
const _updateFormState = (updatedFormState) => {
|
|
4031
|
+
_formState = {
|
|
4032
|
+
..._formState,
|
|
4033
|
+
...updatedFormState
|
|
4034
|
+
};
|
|
4035
|
+
};
|
|
4036
|
+
if (isFunction(_options.defaultValues)) {
|
|
4037
|
+
_options.defaultValues().then((values) => {
|
|
4038
|
+
reset(values, _options.resetOptions);
|
|
4039
|
+
_subjects.state.next({
|
|
4040
|
+
isLoading: false
|
|
4041
|
+
});
|
|
4042
|
+
});
|
|
4043
|
+
}
|
|
4044
|
+
return {
|
|
4045
|
+
control: {
|
|
4046
|
+
register,
|
|
4047
|
+
unregister,
|
|
4048
|
+
getFieldState,
|
|
4049
|
+
_executeSchema,
|
|
4050
|
+
_getWatch,
|
|
4051
|
+
_getDirty,
|
|
4052
|
+
_updateValid,
|
|
4053
|
+
_removeUnmounted,
|
|
4054
|
+
_updateFieldArray,
|
|
4055
|
+
_getFieldArray,
|
|
4056
|
+
_reset,
|
|
4057
|
+
_updateFormState,
|
|
4058
|
+
_subjects,
|
|
4059
|
+
_proxyFormState,
|
|
4060
|
+
get _fields() {
|
|
4061
|
+
return _fields;
|
|
4062
|
+
},
|
|
4063
|
+
get _formValues() {
|
|
4064
|
+
return _formValues;
|
|
4065
|
+
},
|
|
4066
|
+
get _state() {
|
|
4067
|
+
return _state;
|
|
4068
|
+
},
|
|
4069
|
+
set _state(value) {
|
|
4070
|
+
_state = value;
|
|
4071
|
+
},
|
|
4072
|
+
get _defaultValues() {
|
|
4073
|
+
return _defaultValues;
|
|
4074
|
+
},
|
|
4075
|
+
get _names() {
|
|
4076
|
+
return _names;
|
|
4077
|
+
},
|
|
4078
|
+
set _names(value) {
|
|
4079
|
+
_names = value;
|
|
4080
|
+
},
|
|
4081
|
+
get _formState() {
|
|
4082
|
+
return _formState;
|
|
4083
|
+
},
|
|
4084
|
+
set _formState(value) {
|
|
4085
|
+
_formState = value;
|
|
4086
|
+
},
|
|
4087
|
+
get _options() {
|
|
4088
|
+
return _options;
|
|
4089
|
+
},
|
|
4090
|
+
set _options(value) {
|
|
4091
|
+
_options = {
|
|
4092
|
+
..._options,
|
|
4093
|
+
...value
|
|
4094
|
+
};
|
|
4095
|
+
}
|
|
4096
|
+
},
|
|
4097
|
+
trigger,
|
|
4098
|
+
register,
|
|
4099
|
+
handleSubmit,
|
|
4100
|
+
watch,
|
|
4101
|
+
setValue,
|
|
4102
|
+
getValues,
|
|
4103
|
+
reset,
|
|
4104
|
+
resetField,
|
|
4105
|
+
clearErrors,
|
|
4106
|
+
unregister,
|
|
4107
|
+
setError,
|
|
4108
|
+
setFocus,
|
|
4109
|
+
getFieldState
|
|
4110
|
+
};
|
|
4111
|
+
}
|
|
4112
|
+
function useForm(props = {}) {
|
|
4113
|
+
const _formControl = React__default.useRef();
|
|
4114
|
+
const [formState, updateFormState] = React__default.useState({
|
|
4115
|
+
isDirty: false,
|
|
4116
|
+
isValidating: false,
|
|
4117
|
+
isLoading: true,
|
|
4118
|
+
isSubmitted: false,
|
|
4119
|
+
isSubmitting: false,
|
|
4120
|
+
isSubmitSuccessful: false,
|
|
4121
|
+
isValid: false,
|
|
4122
|
+
submitCount: 0,
|
|
4123
|
+
dirtyFields: {},
|
|
4124
|
+
touchedFields: {},
|
|
4125
|
+
errors: {},
|
|
4126
|
+
defaultValues: isFunction(props.defaultValues) ? void 0 : props.defaultValues
|
|
4127
|
+
});
|
|
4128
|
+
if (!_formControl.current) {
|
|
4129
|
+
_formControl.current = {
|
|
4130
|
+
...createFormControl(props, () => updateFormState((formState2) => ({ ...formState2 }))),
|
|
4131
|
+
formState
|
|
4132
|
+
};
|
|
4133
|
+
}
|
|
4134
|
+
const control = _formControl.current.control;
|
|
4135
|
+
control._options = props;
|
|
4136
|
+
useSubscribe({
|
|
4137
|
+
subject: control._subjects.state,
|
|
4138
|
+
next: (value) => {
|
|
4139
|
+
if (shouldRenderFormState(value, control._proxyFormState, control._updateFormState, true)) {
|
|
4140
|
+
updateFormState({ ...control._formState });
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
});
|
|
4144
|
+
React__default.useEffect(() => {
|
|
4145
|
+
if (props.values && !deepEqual(props.values, control._defaultValues)) {
|
|
4146
|
+
control._reset(props.values, control._options.resetOptions);
|
|
4147
|
+
}
|
|
4148
|
+
}, [props.values, control]);
|
|
4149
|
+
React__default.useEffect(() => {
|
|
4150
|
+
if (!control._state.mount) {
|
|
4151
|
+
control._updateValid();
|
|
4152
|
+
control._state.mount = true;
|
|
4153
|
+
}
|
|
4154
|
+
if (control._state.watch) {
|
|
4155
|
+
control._state.watch = false;
|
|
4156
|
+
control._subjects.state.next({ ...control._formState });
|
|
4157
|
+
}
|
|
4158
|
+
control._removeUnmounted();
|
|
4159
|
+
});
|
|
4160
|
+
_formControl.current.formState = getProxyFormState(formState, control);
|
|
4161
|
+
return _formControl.current;
|
|
4162
|
+
}
|
|
4163
|
+
var colors = {
|
|
4164
|
+
primary: "#0e101c",
|
|
4165
|
+
secondary: "#bf1650",
|
|
4166
|
+
lightBlue: "#516391",
|
|
4167
|
+
blue: "#1e2a4a",
|
|
4168
|
+
lightPink: "#ec5990",
|
|
4169
|
+
errorPink: "#fbecf2",
|
|
4170
|
+
buttonBlue: "#191d3a",
|
|
4171
|
+
link: "#ff7aa8",
|
|
4172
|
+
green: "#1bda2b"
|
|
4173
|
+
};
|
|
4174
|
+
const paraGraphDefaultStyle = {
|
|
4175
|
+
fontSize: 13,
|
|
4176
|
+
lineHeight: "20px"
|
|
4177
|
+
};
|
|
4178
|
+
const Button = newStyled.button`
|
|
4179
|
+
appearance: none;
|
|
4180
|
+
margin: 0;
|
|
4181
|
+
border: 0;
|
|
4182
|
+
color: white;
|
|
4183
|
+
padding: 5px !important;
|
|
4184
|
+
border-radius: 0 !important;
|
|
4185
|
+
background: ${(props) => props.hideBackground ? `` : `${colors.blue} !important`};
|
|
4186
|
+
transition: 0.2s all;
|
|
4187
|
+
|
|
4188
|
+
&:hover {
|
|
4189
|
+
background: ${colors.lightBlue};
|
|
4190
|
+
}
|
|
4191
|
+
`;
|
|
4192
|
+
Button.defaultProps = { type: "button" };
|
|
4193
|
+
const CircleButton = newStyled(Button)`
|
|
4194
|
+
font-size: 14px;
|
|
4195
|
+
font-weight: bold;
|
|
4196
|
+
margin: 0 4px 0 auto;
|
|
4197
|
+
background: none !important;
|
|
4198
|
+
display: flex;
|
|
4199
|
+
width: 25px;
|
|
4200
|
+
height: 25px;
|
|
4201
|
+
justify-content: center;
|
|
4202
|
+
line-height: 14px !important;
|
|
4203
|
+
border-radius: 50% !important;
|
|
4204
|
+
padding: 0 !important;
|
|
4205
|
+
transition: 0.2s all;
|
|
4206
|
+
|
|
4207
|
+
&:hover {
|
|
4208
|
+
background: ${colors.lightBlue};
|
|
4209
|
+
}
|
|
4210
|
+
|
|
4211
|
+
&:active {
|
|
4212
|
+
background: black;
|
|
4213
|
+
}
|
|
4214
|
+
`;
|
|
4215
|
+
const Input = newStyled.input`
|
|
4216
|
+
&::placeholder {
|
|
4217
|
+
color: #b3b3b3;
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
&:focus::placeholder {
|
|
4221
|
+
color: white;
|
|
4222
|
+
}
|
|
4223
|
+
`;
|
|
4224
|
+
const Table = newStyled.table`
|
|
4225
|
+
transition: 0.3s all;
|
|
4226
|
+
|
|
4227
|
+
&:hover {
|
|
4228
|
+
background: ${colors.primary};
|
|
4229
|
+
}
|
|
4230
|
+
`;
|
|
4231
|
+
const Header = ({ setVisible: setVisible2, control }) => {
|
|
4232
|
+
const { isValid } = useFormState({
|
|
4233
|
+
control
|
|
4234
|
+
});
|
|
4235
|
+
return React$1.createElement(
|
|
4236
|
+
"header",
|
|
4237
|
+
{ style: {
|
|
4238
|
+
display: "flex",
|
|
4239
|
+
alignItems: "center",
|
|
4240
|
+
paddingLeft: 10,
|
|
4241
|
+
backgroundColor: "transparent"
|
|
4242
|
+
} },
|
|
4243
|
+
React$1.createElement(
|
|
4244
|
+
"p",
|
|
4245
|
+
{ style: Object.assign(Object.assign({}, paraGraphDefaultStyle), { margin: 0, padding: 0, fontWeight: 400, fontSize: 12 }) },
|
|
4246
|
+
React$1.createElement("span", { style: {
|
|
4247
|
+
transition: "0.5s all",
|
|
4248
|
+
color: isValid ? colors.green : colors.lightPink
|
|
4249
|
+
} }, "\u25A0"),
|
|
4250
|
+
" ",
|
|
4251
|
+
"React Hook Form"
|
|
4252
|
+
),
|
|
4253
|
+
React$1.createElement(CircleButton, { title: "Close dev panel", onClick: () => setVisible2(false) }, "\u2715")
|
|
4254
|
+
);
|
|
4255
|
+
};
|
|
4256
|
+
const PanelTable = ({ refObject, hasError, isDirty, fieldsValues, isNative, errorMessage, errorType, type, isTouched, name, collapseAll }) => {
|
|
4257
|
+
const [collapse, setCollapse2] = React$1.useState(false);
|
|
4258
|
+
React$1.useEffect(() => {
|
|
4259
|
+
setCollapse2(!collapseAll);
|
|
4260
|
+
}, [collapseAll]);
|
|
4261
|
+
let value = fieldsValues ? get(fieldsValues, name) : "";
|
|
4262
|
+
let isValueWrappedInPre = false;
|
|
4263
|
+
if (!isUndefined$1$1(value)) {
|
|
4264
|
+
if (isObject$1(value)) {
|
|
4265
|
+
try {
|
|
4266
|
+
value = React$1.createElement(
|
|
4267
|
+
"pre",
|
|
4268
|
+
{ style: { margin: 0 } },
|
|
4269
|
+
React$1.createElement("code", { style: { fontSize: 12 } }, JSON.stringify(value, null, 2))
|
|
4270
|
+
);
|
|
4271
|
+
isValueWrappedInPre = true;
|
|
4272
|
+
} catch (_a) {
|
|
4273
|
+
value = React$1.createElement("span", null, "[Nested Object]");
|
|
4274
|
+
}
|
|
4275
|
+
} else if (typeof value !== "string") {
|
|
4276
|
+
value = String(value);
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
return React$1.createElement(
|
|
4280
|
+
Table,
|
|
4281
|
+
{ style: {
|
|
4282
|
+
padding: "5px 8px",
|
|
4283
|
+
width: "100%",
|
|
4284
|
+
transition: ".3s all",
|
|
4285
|
+
borderLeft: `2px solid ${hasError ? colors.secondary : colors.buttonBlue}`,
|
|
4286
|
+
background: "none"
|
|
4287
|
+
} },
|
|
4288
|
+
React$1.createElement(
|
|
4289
|
+
"thead",
|
|
4290
|
+
null,
|
|
4291
|
+
React$1.createElement(
|
|
4292
|
+
"tr",
|
|
4293
|
+
null,
|
|
4294
|
+
React$1.createElement(
|
|
4295
|
+
"td",
|
|
4296
|
+
{ valign: "top", style: { width: 85, lineHeight: "22px" } },
|
|
4297
|
+
React$1.createElement(Button, { onClick: () => setCollapse2(!collapse), title: "Toggle field table", style: {
|
|
4298
|
+
border: `1px solid ${colors.lightBlue}`,
|
|
4299
|
+
borderRadius: 2,
|
|
4300
|
+
padding: "3px 5px",
|
|
4301
|
+
display: "inline-block",
|
|
4302
|
+
fontSize: 9,
|
|
4303
|
+
lineHeight: "13px",
|
|
4304
|
+
width: 20,
|
|
4305
|
+
textAlign: "center",
|
|
4306
|
+
marginRight: 8
|
|
4307
|
+
} }, collapse ? "+" : "-"),
|
|
4308
|
+
React$1.createElement(Button, { onClick: () => {
|
|
4309
|
+
if (refObject.scrollIntoView) {
|
|
4310
|
+
refObject.scrollIntoView({ behavior: "smooth" });
|
|
4311
|
+
}
|
|
4312
|
+
}, title: "Scroll into view", style: Object.assign({ border: `1px solid ${colors.lightBlue}`, borderRadius: 2, padding: "3px 5px", display: "inline-block", fontSize: 9, lineHeight: "13px", textAlign: "center", width: "calc(100% - 30px)" }, isNative ? {} : { cursor: "not-allowed", background: colors.lightBlue }) }, isNative ? "Native" : "Custom")
|
|
4313
|
+
),
|
|
4314
|
+
React$1.createElement(
|
|
4315
|
+
"td",
|
|
4316
|
+
{ style: {
|
|
4317
|
+
display: "block",
|
|
4318
|
+
maxWidth: 140
|
|
4319
|
+
} },
|
|
4320
|
+
React$1.createElement("p", { style: Object.assign(Object.assign({ margin: 0, padding: 0, top: 0, position: "relative", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, paraGraphDefaultStyle), { lineHeight: "24px" }), title: name }, name)
|
|
4321
|
+
)
|
|
4322
|
+
)
|
|
4323
|
+
),
|
|
4324
|
+
!collapse && React$1.createElement(
|
|
4325
|
+
"tbody",
|
|
4326
|
+
null,
|
|
4327
|
+
type && React$1.createElement(
|
|
4328
|
+
"tr",
|
|
4329
|
+
null,
|
|
4330
|
+
React$1.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, paraGraphDefaultStyle) }, "Type:"),
|
|
4331
|
+
React$1.createElement("td", { style: Object.assign({ display: "block", maxWidth: 100 }, paraGraphDefaultStyle) }, type)
|
|
4332
|
+
),
|
|
4333
|
+
errorType && React$1.createElement(
|
|
4334
|
+
"tr",
|
|
4335
|
+
null,
|
|
4336
|
+
React$1.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, paraGraphDefaultStyle) }, "ERROR Type:"),
|
|
4337
|
+
React$1.createElement("td", { style: Object.assign({ display: "block", maxWidth: 100 }, paraGraphDefaultStyle) }, errorType)
|
|
4338
|
+
),
|
|
4339
|
+
errorMessage && React$1.createElement(
|
|
4340
|
+
"tr",
|
|
4341
|
+
null,
|
|
4342
|
+
React$1.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, paraGraphDefaultStyle) }, "MESSAGE:"),
|
|
4343
|
+
React$1.createElement("td", { style: Object.assign({ display: "block", maxWidth: 100 }, paraGraphDefaultStyle) }, typeof errorMessage === "string" ? errorMessage.trim() : JSON.stringify(errorMessage))
|
|
4344
|
+
),
|
|
4345
|
+
!isUndefined$1$1(value) && React$1.createElement(
|
|
4346
|
+
"tr",
|
|
4347
|
+
null,
|
|
4348
|
+
React$1.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, paraGraphDefaultStyle) }, "Value:"),
|
|
4349
|
+
React$1.createElement(
|
|
4350
|
+
"td",
|
|
4351
|
+
{ "data-testid": `${name}-field-value`, style: Object.assign({ display: "block", maxWidth: 100 }, paraGraphDefaultStyle) },
|
|
4352
|
+
!isValueWrappedInPre && React$1.createElement("p", { title: value, style: Object.assign(Object.assign({}, paraGraphDefaultStyle), { margin: 0, padding: 0 }) }, value),
|
|
4353
|
+
isValueWrappedInPre && React$1.createElement("div", { style: Object.assign(Object.assign({}, paraGraphDefaultStyle), { margin: 0, padding: 0 }) }, value)
|
|
4354
|
+
)
|
|
4355
|
+
),
|
|
4356
|
+
React$1.createElement(
|
|
4357
|
+
"tr",
|
|
4358
|
+
null,
|
|
4359
|
+
React$1.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, paraGraphDefaultStyle) }, "Touched:"),
|
|
4360
|
+
React$1.createElement(
|
|
4361
|
+
"td",
|
|
4362
|
+
null,
|
|
4363
|
+
React$1.createElement("code", { style: Object.assign(Object.assign({ color: isTouched ? colors.green : colors.lightPink }, paraGraphDefaultStyle), { fontSize: 12 }) }, isTouched ? "true" : "false")
|
|
4364
|
+
)
|
|
4365
|
+
),
|
|
4366
|
+
React$1.createElement(
|
|
4367
|
+
"tr",
|
|
4368
|
+
null,
|
|
4369
|
+
React$1.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, paraGraphDefaultStyle) }, "Dirty:"),
|
|
4370
|
+
React$1.createElement(
|
|
4371
|
+
"td",
|
|
4372
|
+
null,
|
|
4373
|
+
React$1.createElement("code", { style: Object.assign(Object.assign({ color: isDirty ? colors.green : colors.lightPink }, paraGraphDefaultStyle), { fontSize: 12 }) }, isDirty ? "true" : "false")
|
|
4374
|
+
)
|
|
4375
|
+
)
|
|
4376
|
+
)
|
|
4377
|
+
);
|
|
4378
|
+
};
|
|
4379
|
+
const FormStateTable = ({ formState, showFormState, setShowFormState }) => React$1.createElement(
|
|
4380
|
+
"div",
|
|
4381
|
+
{ style: {
|
|
4382
|
+
alignSelf: "end"
|
|
4383
|
+
} },
|
|
4384
|
+
React$1.createElement(Animate_1, { play: showFormState, start: { opacity: 0 }, end: { opacity: 1 }, render: ({ style }) => React$1.createElement(
|
|
4385
|
+
"table",
|
|
4386
|
+
{ style: Object.assign({ padding: "5px 10px", display: "block", background: "black", borderTop: `1px solid ${colors.lightPink}`, pointerEvents: "none" }, style) },
|
|
4387
|
+
React$1.createElement(
|
|
4388
|
+
"tbody",
|
|
4389
|
+
null,
|
|
4390
|
+
React$1.createElement(
|
|
4391
|
+
"tr",
|
|
4392
|
+
null,
|
|
4393
|
+
React$1.createElement("td", { align: "right", style: Object.assign({ width: 90 }, paraGraphDefaultStyle) }, "Valid:"),
|
|
4394
|
+
React$1.createElement("td", { style: Object.assign({ color: formState.isValid ? colors.green : colors.lightPink }, paraGraphDefaultStyle) }, formState.isValid ? "true" : "false")
|
|
4395
|
+
),
|
|
4396
|
+
React$1.createElement(
|
|
4397
|
+
"tr",
|
|
4398
|
+
null,
|
|
4399
|
+
React$1.createElement("td", { align: "right", style: Object.assign({}, paraGraphDefaultStyle) }, "Dirty:"),
|
|
4400
|
+
React$1.createElement("td", { style: Object.assign({ color: formState.isDirty ? colors.green : colors.lightPink }, paraGraphDefaultStyle) }, formState.isDirty ? "true" : "false")
|
|
4401
|
+
),
|
|
4402
|
+
React$1.createElement(
|
|
4403
|
+
"tr",
|
|
4404
|
+
null,
|
|
4405
|
+
React$1.createElement("td", { align: "right", style: Object.assign({}, paraGraphDefaultStyle) }, "Submitted:"),
|
|
4406
|
+
React$1.createElement("td", { style: Object.assign({ color: formState.isSubmitted ? colors.green : colors.lightPink }, paraGraphDefaultStyle) }, formState.isSubmitted ? "true" : "false")
|
|
4407
|
+
),
|
|
4408
|
+
React$1.createElement(
|
|
4409
|
+
"tr",
|
|
4410
|
+
null,
|
|
4411
|
+
React$1.createElement("td", { align: "right", style: Object.assign({}, paraGraphDefaultStyle) }, "Count:"),
|
|
4412
|
+
React$1.createElement("td", { style: Object.assign({ color: formState.submitCount ? colors.green : colors.lightPink }, paraGraphDefaultStyle) }, formState.submitCount)
|
|
4413
|
+
),
|
|
4414
|
+
React$1.createElement(
|
|
4415
|
+
"tr",
|
|
4416
|
+
null,
|
|
4417
|
+
React$1.createElement("td", { align: "right", style: Object.assign({}, paraGraphDefaultStyle) }, "Submitting:"),
|
|
4418
|
+
React$1.createElement("td", { style: Object.assign({ color: formState.isSubmitting ? colors.green : colors.lightPink }, paraGraphDefaultStyle) }, formState.isSubmitting ? "true" : "false")
|
|
4419
|
+
)
|
|
4420
|
+
)
|
|
4421
|
+
) }),
|
|
4422
|
+
React$1.createElement(
|
|
4423
|
+
Button,
|
|
4424
|
+
{ style: {
|
|
4425
|
+
margin: 0,
|
|
4426
|
+
width: "100%",
|
|
4427
|
+
padding: "8px 10px",
|
|
4428
|
+
textTransform: "none",
|
|
4429
|
+
fontSize: 12,
|
|
4430
|
+
lineHeight: "14px",
|
|
4431
|
+
cursor: "pointer"
|
|
4432
|
+
}, title: "Toggle form state panel", onClick: () => {
|
|
4433
|
+
setShowFormState(!showFormState);
|
|
4434
|
+
} },
|
|
4435
|
+
React$1.createElement("span", { style: {
|
|
4436
|
+
transition: "0.5s all",
|
|
4437
|
+
color: formState.isValid ? colors.green : colors.lightPink
|
|
4438
|
+
} }, "\u25A0"),
|
|
4439
|
+
" ",
|
|
4440
|
+
"Form State: ",
|
|
4441
|
+
showFormState ? "OFF" : "ON"
|
|
4442
|
+
)
|
|
4443
|
+
);
|
|
4444
|
+
function setVisible(state, payload) {
|
|
4445
|
+
return Object.assign(Object.assign({}, state), { visible: payload });
|
|
4446
|
+
}
|
|
4447
|
+
function setCollapse(state, payload) {
|
|
4448
|
+
return Object.assign(Object.assign({}, state), { isCollapse: payload });
|
|
4449
|
+
}
|
|
4450
|
+
let childIndex = 0;
|
|
4451
|
+
function PanelChildren({ fields, searchTerm, touchedFields, errors, dirtyFields, state, fieldsValues }) {
|
|
4452
|
+
return React$1.createElement(React$1.Fragment, null, fields && Object.entries(fields).filter(([name]) => (name && name.toLowerCase && name.toLowerCase().includes(searchTerm) || !name && !searchTerm || searchTerm === "") && name).map(([name, value], index) => {
|
|
4453
|
+
childIndex++;
|
|
4454
|
+
if (!(value === null || value === void 0 ? void 0 : value._f)) {
|
|
4455
|
+
return React$1.createElement(PanelChildren, Object.assign({ key: name + childIndex }, {
|
|
4456
|
+
fields: value,
|
|
4457
|
+
searchTerm,
|
|
4458
|
+
touchedFields,
|
|
4459
|
+
errors,
|
|
4460
|
+
dirtyFields,
|
|
4461
|
+
state,
|
|
4462
|
+
fieldsValues
|
|
4463
|
+
}));
|
|
4464
|
+
} else {
|
|
4465
|
+
const error = get(errors, value._f.name);
|
|
4466
|
+
const errorMessage = get(error, "message", void 0);
|
|
4467
|
+
const errorType = get(error, "type", void 0);
|
|
4468
|
+
const type = get(value, "ref.type", void 0);
|
|
4469
|
+
const isTouched = !!get(touchedFields, value._f.name);
|
|
4470
|
+
const isNative = !!(value && value._f.ref.type);
|
|
4471
|
+
const isDirty = !!get(dirtyFields, value._f.name);
|
|
4472
|
+
const hasError = !!error;
|
|
4473
|
+
const ref = get(value, "_f.ref");
|
|
4474
|
+
return React$1.createElement(
|
|
4475
|
+
"section",
|
|
4476
|
+
{ key: (value === null || value === void 0 ? void 0 : value._f.name) + childIndex, style: {
|
|
4477
|
+
borderBottom: `1px dashed ${colors.secondary}`,
|
|
4478
|
+
margin: 0
|
|
4479
|
+
} },
|
|
4480
|
+
React$1.createElement(PanelTable, { refObject: ref, index, collapseAll: state.isCollapse, name: value === null || value === void 0 ? void 0 : value._f.name, isTouched, type, hasError, isNative, errorMessage, errorType, isDirty, fieldsValues })
|
|
4481
|
+
);
|
|
4482
|
+
}
|
|
4483
|
+
}));
|
|
4484
|
+
}
|
|
4485
|
+
const Panel = ({ control, control: { _fields } }) => {
|
|
4486
|
+
const formState = useFormState({
|
|
4487
|
+
control
|
|
4488
|
+
});
|
|
4489
|
+
const { dirtyFields, touchedFields, errors } = formState;
|
|
4490
|
+
formState.isDirty;
|
|
4491
|
+
const { state, actions } = a({
|
|
4492
|
+
setCollapse
|
|
4493
|
+
});
|
|
4494
|
+
const [, setData] = React$1.useState({});
|
|
4495
|
+
const [showFormState, setShowFormState] = React$1.useState(false);
|
|
4496
|
+
const fieldsValues = useWatch({
|
|
4497
|
+
control
|
|
4498
|
+
});
|
|
4499
|
+
const { register, watch } = useForm();
|
|
4500
|
+
const searchTerm = watch("search", "");
|
|
4501
|
+
useEffect(() => {
|
|
4502
|
+
setData({});
|
|
4503
|
+
}, []);
|
|
4504
|
+
return React$1.createElement(
|
|
4505
|
+
"div",
|
|
4506
|
+
{ style: {
|
|
4507
|
+
display: "grid",
|
|
4508
|
+
gridTemplateRows: "56px auto",
|
|
4509
|
+
height: process.env.NODE_ENV === "test" ? "100vh" : "calc(100vh - 40px)"
|
|
4510
|
+
} },
|
|
4511
|
+
React$1.createElement(
|
|
4512
|
+
"div",
|
|
4513
|
+
{ style: {
|
|
4514
|
+
display: "grid",
|
|
4515
|
+
gridTemplateColumns: `1fr 1fr`,
|
|
4516
|
+
gridTemplateRows: "28px 28px"
|
|
4517
|
+
} },
|
|
4518
|
+
React$1.createElement(Button, { style: {
|
|
4519
|
+
borderRight: `1px solid ${colors.primary}`,
|
|
4520
|
+
textTransform: "none",
|
|
4521
|
+
fontSize: 11,
|
|
4522
|
+
lineHeight: 1
|
|
4523
|
+
}, title: "Update values and state the form", onClick: () => setData({}) }, "\u267A REFRESH"),
|
|
4524
|
+
React$1.createElement(Button, { style: {
|
|
4525
|
+
borderRight: `1px solid ${colors.primary}`,
|
|
4526
|
+
textTransform: "none",
|
|
4527
|
+
fontSize: 11,
|
|
4528
|
+
lineHeight: 1
|
|
4529
|
+
}, title: "Toggle entire fields", onClick: () => {
|
|
4530
|
+
actions.setCollapse(!state.isCollapse);
|
|
4531
|
+
} }, state.isCollapse ? "[-] COLLAPSE" : "[+] EXPAND"),
|
|
4532
|
+
React$1.createElement(Input, Object.assign({ style: {
|
|
4533
|
+
display: "inline-block",
|
|
4534
|
+
borderRadius: 0,
|
|
4535
|
+
width: "100%",
|
|
4536
|
+
margin: 0,
|
|
4537
|
+
padding: "5px 10px",
|
|
4538
|
+
WebkitAppearance: "none",
|
|
4539
|
+
appearance: "none",
|
|
4540
|
+
fontSize: 14,
|
|
4541
|
+
border: 0,
|
|
4542
|
+
color: "white",
|
|
4543
|
+
gridColumnStart: 1,
|
|
4544
|
+
gridColumnEnd: 4,
|
|
4545
|
+
background: "black"
|
|
4546
|
+
} }, register("search"), { placeholder: "Filter name...", type: "search" }))
|
|
4547
|
+
),
|
|
4548
|
+
React$1.createElement(
|
|
4549
|
+
"div",
|
|
4550
|
+
{ style: {
|
|
4551
|
+
overflow: "auto"
|
|
4552
|
+
} },
|
|
4553
|
+
React$1.createElement(PanelChildren, { fields: _fields, searchTerm, errors, touchedFields, dirtyFields, fieldsValues, state })
|
|
4554
|
+
),
|
|
4555
|
+
React$1.createElement(FormStateTable, { formState, showFormState, setShowFormState })
|
|
4556
|
+
);
|
|
4557
|
+
};
|
|
4558
|
+
const Logo = ({ style, actions }) => {
|
|
4559
|
+
return React$1.createElement(
|
|
4560
|
+
"svg",
|
|
4561
|
+
{ fill: "white", viewBox: "0 0 100 100", style: Object.assign({ height: 14, padding: 3, borderRadius: 2, background: colors.lightPink }, style), onClick: () => {
|
|
4562
|
+
actions.setVisible(true);
|
|
4563
|
+
}, "aria-label": "React Hook Form Logo" },
|
|
4564
|
+
React$1.createElement("path", { d: "M73.56,13.32H58.14a8.54,8.54,0,0,0-16.27,0H26.44a11,11,0,0,0-11,11V81.63a11,11,0,0,0,11,11H73.56a11,11,0,0,0,11-11V24.32A11,11,0,0,0,73.56,13.32Zm-30.92,2a1,1,0,0,0,1-.79,6.54,6.54,0,0,1,12.78,0,1,1,0,0,0,1,.79h5.38v6.55a3,3,0,0,1-3,3H40.25a3,3,0,0,1-3-3V15.32ZM82.56,81.63a9,9,0,0,1-9,9H26.44a9,9,0,0,1-9-9V24.32a9,9,0,0,1,9-9h8.81v6.55a5,5,0,0,0,5,5h19.5a5,5,0,0,0,5-5V15.32h8.81a9,9,0,0,1,9,9Z" }),
|
|
4565
|
+
React$1.createElement("path", { style: { transform: "translateX(-25px)" }, d: "M71.6,45.92H54a1,1,0,0,0,0,2H71.6a1,1,0,0,0,0-2Z" }),
|
|
4566
|
+
React$1.createElement("path", { d: "M71.6,45.92H54a1,1,0,0,0,0,2H71.6a1,1,0,0,0,0-2Z" }),
|
|
4567
|
+
React$1.createElement("path", { style: { transform: "translateX(-25px)" }, d: "M71.1,69.49H53.45a1,1,0,1,0,0,2H71.1a1,1,0,0,0,0-2Z" }),
|
|
4568
|
+
React$1.createElement("path", { d: "M71.1,69.49H53.45a1,1,0,1,0,0,2H71.1a1,1,0,0,0,0-2Z" })
|
|
4569
|
+
);
|
|
4570
|
+
};
|
|
4571
|
+
function getPositionByPlacement(placement, defaultX = 0, defaultY = 0) {
|
|
4572
|
+
const [x2, y2] = placement.split("-");
|
|
4573
|
+
return {
|
|
4574
|
+
[x2]: defaultX,
|
|
4575
|
+
[y2]: defaultY
|
|
4576
|
+
};
|
|
4577
|
+
}
|
|
4578
|
+
const DevToolUI = ({ control, placement = "top-right", styles }) => {
|
|
4579
|
+
const { state, actions } = a({
|
|
4580
|
+
setVisible
|
|
4581
|
+
});
|
|
4582
|
+
const position2 = getPositionByPlacement(placement, 0, 0);
|
|
4583
|
+
return React$1.createElement(
|
|
4584
|
+
React$1.Fragment,
|
|
4585
|
+
null,
|
|
4586
|
+
React$1.createElement(
|
|
4587
|
+
Animate_1,
|
|
4588
|
+
{ play: state.visible, duration: 0.2, start: Object.assign(Object.assign({}, position2), { position: "fixed", transform: placement.includes("right") ? "translateX(280px)" : "translateX(-280px)", zIndex: 99999 }), end: Object.assign(Object.assign({}, position2), { position: "fixed", transform: "translateX(0)", zIndex: 99999 }) },
|
|
4589
|
+
React$1.createElement(
|
|
4590
|
+
"div",
|
|
4591
|
+
{ style: Object.assign(Object.assign(Object.assign({}, position2), { position: "fixed", height: "100vh", width: 250, zIndex: 99999, background: colors.buttonBlue, display: "grid", textAlign: "left", color: "white", fontSize: 14, gridTemplateRows: "40px auto", fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif" }), styles === null || styles === void 0 ? void 0 : styles.panel) },
|
|
4592
|
+
React$1.createElement(Header, { setVisible: actions.setVisible, control }),
|
|
4593
|
+
React$1.createElement(Panel, { control })
|
|
4594
|
+
)
|
|
4595
|
+
),
|
|
4596
|
+
!state.visible && React$1.createElement(
|
|
4597
|
+
Button,
|
|
4598
|
+
{ title: "Show dev panel", hideBackground: true, style: Object.assign(Object.assign(Object.assign({ position: "fixed", zIndex: 99999 }, getPositionByPlacement(placement, 3, 3)), { padding: 3, margin: 0, background: "none" }), styles === null || styles === void 0 ? void 0 : styles.button) },
|
|
4599
|
+
React$1.createElement(Logo, { actions })
|
|
4600
|
+
)
|
|
4601
|
+
);
|
|
4602
|
+
};
|
|
4603
|
+
/*! *****************************************************************************
|
|
4604
|
+
Copyright (c) Microsoft Corporation.
|
|
4605
|
+
|
|
4606
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4607
|
+
purpose with or without fee is hereby granted.
|
|
4608
|
+
|
|
4609
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
4610
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
4611
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
4612
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
4613
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
4614
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4615
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
4616
|
+
***************************************************************************** */
|
|
4617
|
+
function __rest(s2, e) {
|
|
4618
|
+
var t2 = {};
|
|
4619
|
+
for (var p2 in s2)
|
|
4620
|
+
if (Object.prototype.hasOwnProperty.call(s2, p2) && e.indexOf(p2) < 0)
|
|
4621
|
+
t2[p2] = s2[p2];
|
|
4622
|
+
if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
|
|
4623
|
+
for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
|
|
4624
|
+
if (e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i]))
|
|
4625
|
+
t2[p2[i]] = s2[p2[i]];
|
|
4626
|
+
}
|
|
4627
|
+
return t2;
|
|
4628
|
+
}
|
|
4629
|
+
function proxyToObject(proxy) {
|
|
4630
|
+
return Reflect.ownKeys(proxy).reduce((prev2, key) => {
|
|
4631
|
+
prev2[key] = proxy[key];
|
|
4632
|
+
return prev2;
|
|
4633
|
+
}, {});
|
|
4634
|
+
}
|
|
4635
|
+
function nestToFlat(flatKeys, obj, defaultValue) {
|
|
4636
|
+
return flatKeys.reduce((prev2, name) => {
|
|
4637
|
+
prev2[name] = get$1(obj, name) || defaultValue;
|
|
4638
|
+
return prev2;
|
|
4639
|
+
}, {});
|
|
4640
|
+
}
|
|
4641
|
+
function useExportControlToExtension({ id, control }) {
|
|
4642
|
+
const nestedFormValues = useWatch({ control });
|
|
4643
|
+
const formState = useFormState({ control });
|
|
4644
|
+
const [isExtensionEnabled, setIsExtensionEnabled] = useState(false);
|
|
4645
|
+
const handleInitMessage = (message) => {
|
|
4646
|
+
if (message.data.source !== "react-hook-form-bridge" || message.data.type !== "INIT") {
|
|
4647
|
+
return;
|
|
4648
|
+
}
|
|
4649
|
+
window.postMessage({
|
|
4650
|
+
source: "react-hook-form-bridge",
|
|
4651
|
+
type: "WELCOME"
|
|
4652
|
+
});
|
|
4653
|
+
setIsExtensionEnabled(true);
|
|
4654
|
+
};
|
|
4655
|
+
useEffect(() => {
|
|
4656
|
+
window.addEventListener("message", handleInitMessage);
|
|
4657
|
+
return () => window.removeEventListener("message", handleInitMessage);
|
|
4658
|
+
}, []);
|
|
4659
|
+
useDeepCompareEffect(() => {
|
|
4660
|
+
if (!isExtensionEnabled) {
|
|
4661
|
+
return;
|
|
4662
|
+
}
|
|
4663
|
+
const _a = proxyToObject(formState), { errors: nestedErrors, dirtyFields: nestedDirtyFields, touchedFields: nestedTouchedFields } = _a, formStatus = __rest(_a, ["errors", "dirtyFields", "touchedFields"]);
|
|
4664
|
+
const flatFieldNames = [...control._names.mount];
|
|
4665
|
+
const formValues = nestToFlat(flatFieldNames, nestedFormValues, "");
|
|
4666
|
+
const dirtyFields = nestToFlat(flatFieldNames, nestedDirtyFields, false);
|
|
4667
|
+
const touchedFields = nestToFlat(flatFieldNames, nestedTouchedFields, false);
|
|
4668
|
+
const flatErrors = nestToFlat(flatFieldNames, nestedErrors);
|
|
4669
|
+
const errors = Object.entries(flatErrors).reduce((prev2, [key, value]) => {
|
|
4670
|
+
prev2[key] = {
|
|
4671
|
+
type: value === null || value === void 0 ? void 0 : value.type,
|
|
4672
|
+
message: value === null || value === void 0 ? void 0 : value.message
|
|
4673
|
+
};
|
|
4674
|
+
return prev2;
|
|
4675
|
+
}, {});
|
|
4676
|
+
const nativeFields = flatFieldNames.reduce((prev2, name) => {
|
|
4677
|
+
var _a2, _b, _c;
|
|
4678
|
+
prev2[name] = !!((_c = (_b = (_a2 = get$1(control._fields, name)) === null || _a2 === void 0 ? void 0 : _a2._f) === null || _b === void 0 ? void 0 : _b.ref) === null || _c === void 0 ? void 0 : _c.type);
|
|
4679
|
+
return prev2;
|
|
4680
|
+
}, {});
|
|
4681
|
+
const updateMessagePayload = {
|
|
4682
|
+
id,
|
|
4683
|
+
data: {
|
|
4684
|
+
formValues,
|
|
4685
|
+
formState: Object.assign({
|
|
4686
|
+
errors,
|
|
4687
|
+
dirtyFields,
|
|
4688
|
+
touchedFields,
|
|
4689
|
+
nativeFields
|
|
4690
|
+
}, formStatus)
|
|
4691
|
+
}
|
|
4692
|
+
};
|
|
4693
|
+
window.postMessage({
|
|
4694
|
+
source: "react-hook-form-bridge",
|
|
4695
|
+
type: "UPDATE",
|
|
4696
|
+
payload: updateMessagePayload
|
|
4697
|
+
});
|
|
4698
|
+
}, [isExtensionEnabled, nestedFormValues, proxyToObject(formState)]);
|
|
4699
|
+
return { isExtensionEnabled };
|
|
4700
|
+
}
|
|
4701
|
+
if (typeof window !== "undefined") {
|
|
4702
|
+
s({
|
|
4703
|
+
visible: false,
|
|
4704
|
+
isCollapse: false,
|
|
4705
|
+
filterName: ""
|
|
4706
|
+
}, {
|
|
4707
|
+
name: "__REACT_HOOK_FORM_DEVTOOLS__",
|
|
4708
|
+
middleWares: [],
|
|
4709
|
+
storageType: window.localStorage
|
|
4710
|
+
});
|
|
4711
|
+
}
|
|
4712
|
+
const DevTool = (props) => {
|
|
4713
|
+
var _a, _b, _c;
|
|
4714
|
+
const methods = useFormContext();
|
|
4715
|
+
const uuid = React$1.useRef("");
|
|
4716
|
+
React$1.useEffect(() => {
|
|
4717
|
+
uuid.current = v4();
|
|
4718
|
+
}, []);
|
|
4719
|
+
const { isExtensionEnabled } = useExportControlToExtension({
|
|
4720
|
+
id: (_a = props === null || props === void 0 ? void 0 : props.id) !== null && _a !== void 0 ? _a : uuid.current,
|
|
4721
|
+
control: (_b = props === null || props === void 0 ? void 0 : props.control) !== null && _b !== void 0 ? _b : methods.control
|
|
4722
|
+
});
|
|
4723
|
+
if (isExtensionEnabled) {
|
|
4724
|
+
return null;
|
|
4725
|
+
}
|
|
4726
|
+
return React$1.createElement(
|
|
4727
|
+
o,
|
|
4728
|
+
null,
|
|
4729
|
+
React$1.createElement(DevToolUI, { control: (_c = props === null || props === void 0 ? void 0 : props.control) !== null && _c !== void 0 ? _c : methods.control, placement: props === null || props === void 0 ? void 0 : props.placement, styles: props === null || props === void 0 ? void 0 : props.styles })
|
|
4730
|
+
);
|
|
4731
|
+
};
|
|
4732
|
+
export {
|
|
4733
|
+
C,
|
|
4734
|
+
DevTool as D,
|
|
4735
|
+
Z$1 as Z
|
|
4736
|
+
};
|