@stokr/components-library 3.0.65 → 3.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -3
- package/dist/_virtual/Collapse.js +4 -0
- package/dist/_virtual/Component.js +4 -0
- package/dist/_virtual/Range.js +4 -0
- package/dist/_virtual/ResizeObserver.es.js +6 -0
- package/dist/_virtual/UnmountClosed.js +4 -0
- package/dist/_virtual/_commonjsHelpers.js +38 -0
- package/dist/_virtual/arrows.js +4 -0
- package/dist/_virtual/attributes-to-props.js +4 -0
- package/dist/_virtual/constants.js +4 -0
- package/dist/_virtual/default-props.js +4 -0
- package/dist/_virtual/defaultRenderElements.js +4 -0
- package/dist/_virtual/dom-to-react.js +4 -0
- package/dist/_virtual/domparser.js +4 -0
- package/dist/_virtual/dots.js +4 -0
- package/dist/_virtual/getInnerHeight.js +4 -0
- package/dist/_virtual/getInnerWidth.js +4 -0
- package/dist/_virtual/getScrollbarWidth.js +4 -0
- package/dist/_virtual/hoist-non-react-statics.cjs.js +2 -0
- package/dist/_virtual/html-to-dom.js +4 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index10.js +5 -0
- package/dist/_virtual/index11.js +7 -0
- package/dist/_virtual/index12.js +7 -0
- package/dist/_virtual/index13.js +7 -0
- package/dist/_virtual/index14.js +4 -0
- package/dist/_virtual/index15.js +7 -0
- package/dist/_virtual/index16.js +7 -0
- package/dist/_virtual/index17.js +7 -0
- package/dist/_virtual/index18.js +4 -0
- package/dist/_virtual/index19.js +4 -0
- package/dist/_virtual/index2.js +7 -0
- package/dist/_virtual/index20.js +4 -0
- package/dist/_virtual/index21.js +4 -0
- package/dist/_virtual/index22.js +4 -0
- package/dist/_virtual/index23.js +4 -0
- package/dist/_virtual/index24.js +4 -0
- package/dist/_virtual/index25.js +4 -0
- package/dist/_virtual/index26.js +4 -0
- package/dist/_virtual/index27.js +4 -0
- package/dist/_virtual/index28.js +4 -0
- package/dist/_virtual/index29.js +4 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/index30.js +4 -0
- package/dist/_virtual/index31.js +4 -0
- package/dist/_virtual/index4.js +5 -0
- package/dist/_virtual/index5.js +5 -0
- package/dist/_virtual/index6.js +5 -0
- package/dist/_virtual/index7.js +7 -0
- package/dist/_virtual/index8.js +4 -0
- package/dist/_virtual/index9.js +5 -0
- package/dist/_virtual/initial-state.js +4 -0
- package/dist/_virtual/inner-slider.js +4 -0
- package/dist/_virtual/innerSliderUtils.js +4 -0
- package/dist/_virtual/isString.js +4 -0
- package/dist/_virtual/node.js +4 -0
- package/dist/_virtual/performance-now.js +4 -0
- package/dist/_virtual/popper.js +6 -0
- package/dist/_virtual/possibleStandardNamesOptimized.js +4 -0
- package/dist/_virtual/react-is.development.js +4 -0
- package/dist/_virtual/react-is.production.min.js +4 -0
- package/dist/_virtual/react-table.development.js +4 -0
- package/dist/_virtual/react-table.production.min.js +4 -0
- package/dist/_virtual/react-tippy.js +5 -0
- package/dist/_virtual/react-tippy2.js +4 -0
- package/dist/_virtual/returnFalse.js +4 -0
- package/dist/_virtual/slider.js +4 -0
- package/dist/_virtual/styles.js +4 -0
- package/dist/_virtual/track.js +4 -0
- package/dist/_virtual/types.js +4 -0
- package/dist/_virtual/utilities.js +4 -0
- package/dist/_virtual/utilities2.js +4 -0
- package/dist/_virtual/utilities3.js +4 -0
- package/dist/_virtual/utils.js +4 -0
- package/dist/analytics/index.js +1 -1
- package/dist/api/fetchData.js +2 -2
- package/dist/components/2FA/Connect2FA.js +1 -1
- package/dist/components/2FA/EnterCode.js +1 -1
- package/dist/components/2FA/Sucess2FA.js +1 -1
- package/dist/components/2FA/login-with-otp-flow.js +47 -12
- package/dist/components/2FA/main-flow.js +29 -5
- package/dist/components/AccountBalance/AccountBalance.js +1 -1
- package/dist/components/AdminDashboard/Table/ReactTable.js +5 -5
- package/dist/components/AdminDashboard/Table/ReactTableWrapper.js +1 -1
- package/dist/components/AdminDashboard/Table/Table.js +1 -1
- package/dist/components/AgreementItem/AgreementItem.js +1 -1
- package/dist/components/BackButton/BackButton.js +1 -1
- package/dist/components/Background/Background.js +1 -1
- package/dist/components/BasicTable/BasicTable.js +1 -1
- package/dist/components/BlogPost/BlogPost.js +1 -1
- package/dist/components/Button/Button.styles.js +1 -1
- package/dist/components/Button/GlareButton.js +2 -2
- package/dist/components/ChartLegend/ChartLegend.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Checklist/ChecklistCard.js +1 -1
- package/dist/components/Chips/Chip.js +1 -1
- package/dist/components/Chips/ChipWrapper.js +1 -1
- package/dist/components/ComponentScroll/ComponentScroll.js +3 -3
- package/dist/components/Country/CountrySelect.js +4 -4
- package/dist/components/CryptoAddress/ComponentWrap.js +1 -1
- package/dist/components/CryptoAddress/CryptoAddress.js +7 -7
- package/dist/components/CryptoAddress/RadioWrap.js +1 -1
- package/dist/components/CryptoAddressDetails/CryptoAddressDetails.js +1 -1
- package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.js +1 -1
- package/dist/components/FAQ/FAQ.js +1 -1
- package/dist/components/FAQ/FAQ.styles.js +2 -2
- package/dist/components/Footer/Footer.js +1 -1
- package/dist/components/Footer/FooterLayout.js +1 -1
- package/dist/components/Footer/FooterMenu.js +3 -3
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.js +5 -5
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/Form.styles.js +1 -1
- package/dist/components/Header/Header.js +3 -3
- package/dist/components/HeroBlock/HeroVideoBlock.js +1 -1
- package/dist/components/IdentityInfo/IdentityInfo.js +1 -1
- package/dist/components/InfoIcon/InfoIcon.js +6 -6
- package/dist/components/Input/DatePickerInput.js +5 -3
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/InputPassword.js +1 -1
- package/dist/components/Input/InputUsername.js +1 -1
- package/dist/components/Input/InputWithButton.js +1 -1
- package/dist/components/Input/MultiSelect.js +4 -3
- package/dist/components/Input/OtpInput.js +2 -2
- package/dist/components/Input/RangeInput.js +4 -4
- package/dist/components/Input/Select.js +5 -4
- package/dist/components/Input/TableFilterDropdown.js +1 -1
- package/dist/components/InvestmentStat/InvestmentStat.js +1 -1
- package/dist/components/LatestUpdate/LatestUpdate.js +1 -1
- package/dist/components/Layout/Layout.js +1 -1
- package/dist/components/LoginModal/LoginModal.js +6 -6
- package/dist/components/MainMenu/DynamicMainMenu.js +3 -3
- package/dist/components/MainMenu/MainMenu.js +6 -6
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/NewVentureModal/NewVentureModal.js +9 -9
- package/dist/components/Modal/PaymentModal.js +2 -2
- package/dist/components/Modal/SuccessModal/SuccessModal.js +3 -3
- package/dist/components/MultiProgressBar/MultiProgressBar.js +1 -1
- package/dist/components/Number/Number.js +1 -1
- package/dist/components/PageTransition/PageTransition.js +1 -1
- package/dist/components/Pagination/Pagination.js +1 -1
- package/dist/components/Pagination/PaginationControls.js +1 -1
- package/dist/components/Payment/PaymentDisplay.js +4 -4
- package/dist/components/Payment/TimerComponent.js +1 -1
- package/dist/components/ProfileBadge/ProfileBadge.js +1 -1
- package/dist/components/ProfileBox/ProfileBox.js +1 -1
- package/dist/components/ProfileStat/ProfileStat.js +1 -1
- package/dist/components/QRCode/QRCode.js +2 -2
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/RefreshButton/RefreshButton.js +1 -1
- package/dist/components/RegisterConfirmModal/RegisterConfirmModal.js +1 -1
- package/dist/components/RegisterModal/RegisterModal.js +8 -8
- package/dist/components/RequestDataBox/RequestDataBox.js +1 -1
- package/dist/components/ResetConfirmModal/ResetConfirmModal.js +1 -1
- package/dist/components/ResetPasswordModal/ResetPasswordModal.js +6 -6
- package/dist/components/SEO/SEO.js +3 -3
- package/dist/components/Slider/Slider.js +4 -4
- package/dist/components/SmartLink/SmartLink.js +1 -1
- package/dist/components/Snackbar/Snackbar.js +1 -1
- package/dist/components/Snackbar/SnackbarProvider.js +1 -1
- package/dist/components/StepController/StepController.js +1 -1
- package/dist/components/StepController/StepControllerContext.js +1 -1
- package/dist/components/StepController/StepControllerProgress.js +1 -1
- package/dist/components/StepsProgress/StepIndicator.js +1 -1
- package/dist/components/StepsProgress/StepsProgress.js +1 -1
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/TabsNav/TabNav.js +1 -1
- package/dist/components/TabsNav/TabsNav.js +1 -1
- package/dist/components/TaxResidenceCard/TaxResidenceCard.js +1 -1
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +2 -2
- package/dist/components/TeamOverview/TeamOverview.js +1 -1
- package/dist/components/TermsModal/TermsModal.js +5 -5
- package/dist/components/Timeline/TimelineStep.js +1 -1
- package/dist/components/ToDoList/ToDoList.js +3 -3
- package/dist/components/ToDoList/ToDoListTask.js +4 -4
- package/dist/components/TransactionDetails/TransactionDetails.js +1 -1
- package/dist/components/TransactionDetails/TransactionDetails.styles.js +2 -2
- package/dist/components/TransactionInfo/TransactionInfo.js +1 -1
- package/dist/components/VerifyEmailModal/VerifyEmailModal.js +5 -5
- package/dist/components/headerHo/HeaderHo.js +3 -1
- package/dist/components/logo/Logo.js +1 -1
- package/dist/components/taxId/register-taxid.js +4 -4
- package/dist/components-library.css +781 -0
- package/dist/context/Auth.js +15 -12
- package/dist/context/AuthContext.js +89 -16
- package/dist/firebase-config.js +4 -2
- package/dist/hooks/useNewVentureForm.js +1 -1
- package/dist/index.js +5 -4
- package/dist/model/axios.js +2 -1
- package/dist/model/axiosPublic.js +2 -1
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +8 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +7 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/createClass.js +15 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/createSuper.js +17 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +8 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/inherits.js +16 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +13 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +24 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +25 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +13 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +10 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +10 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +10 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +10 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +11 -0
- package/dist/node_modules/@date-fns/tz/date/index.js +66 -0
- package/dist/node_modules/@date-fns/tz/date/mini.js +124 -0
- package/dist/node_modules/@date-fns/tz/tzName/index.js +11 -0
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +28 -0
- package/dist/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js +345 -0
- package/dist/node_modules/@emotion/hash/dist/emotion-hash.esm.js +31 -0
- package/dist/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js +10 -0
- package/dist/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js +84 -0
- package/dist/node_modules/@emotion/react/dist/emotion-react.browser.esm.js +50 -0
- package/dist/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js +169 -0
- package/dist/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js +83 -0
- package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +53 -0
- package/dist/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js +9 -0
- package/dist/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js +45 -0
- package/dist/node_modules/@firebase/app/dist/esm/index.esm.js +609 -0
- package/dist/node_modules/@firebase/auth/dist/esm/index-36fcbc82.js +5751 -0
- package/dist/node_modules/@firebase/component/dist/esm/index.esm.js +291 -0
- package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js +106 -0
- package/dist/node_modules/@firebase/util/dist/index.esm.js +828 -0
- package/dist/node_modules/@firebase/util/dist/postinstall.js +4 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +257 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +122 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +34 -0
- package/dist/node_modules/@lottiefiles/dotlottie-react/dist/index.js +53 -0
- package/dist/node_modules/@lottiefiles/dotlottie-web/dist/index.js +1973 -0
- package/dist/node_modules/add-px-to-style/index.js +48 -0
- package/dist/node_modules/axios/index.js +38 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +71 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +219 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +141 -0
- package/dist/node_modules/axios/lib/axios.js +50 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +99 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +20 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +6 -0
- package/dist/node_modules/axios/lib/core/Axios.js +188 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +67 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +231 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +66 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +12 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +52 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +88 -0
- package/dist/node_modules/axios/lib/core/settle.js +18 -0
- package/dist/node_modules/axios/lib/core/transformData.js +17 -0
- package/dist/node_modules/axios/lib/defaults/index.js +116 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +9 -0
- package/dist/node_modules/axios/lib/env/data.js +4 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +34 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +77 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +8 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +32 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +6 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +39 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +49 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +54 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +9 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +7 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +11 -0
- package/dist/node_modules/axios/lib/helpers/null.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +47 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +41 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +46 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +36 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +8 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +35 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +117 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +18 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +80 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +67 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +15 -0
- package/dist/node_modules/axios/lib/platform/index.js +9 -0
- package/dist/node_modules/axios/lib/utils.js +415 -0
- package/dist/node_modules/classnames/index.js +61 -0
- package/dist/node_modules/copy-to-clipboard/index.js +101 -0
- package/dist/node_modules/country-flag-icons/modules/react/3x2/index.js +6570 -0
- package/dist/node_modules/country-flag-icons/react/3x2/index.js +269 -0
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +8 -0
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
- package/dist/node_modules/date-fns/_lib/format/formatters.js +652 -0
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +62 -0
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +58 -0
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +20 -0
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +8 -0
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +23 -0
- package/dist/node_modules/date-fns/addDays.js +12 -0
- package/dist/node_modules/date-fns/addMonths.js +26 -0
- package/dist/node_modules/date-fns/addWeeks.js +7 -0
- package/dist/node_modules/date-fns/addYears.js +7 -0
- package/dist/node_modules/date-fns/constants.js +14 -0
- package/dist/node_modules/date-fns/constructFrom.js +11 -0
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +19 -0
- package/dist/node_modules/date-fns/differenceInCalendarMonths.js +14 -0
- package/dist/node_modules/date-fns/eachMonthOfInterval.js +20 -0
- package/dist/node_modules/date-fns/eachYearOfInterval.js +20 -0
- package/dist/node_modules/date-fns/endOfISOWeek.js +7 -0
- package/dist/node_modules/date-fns/endOfMonth.js +11 -0
- package/dist/node_modules/date-fns/endOfWeek.js +15 -0
- package/dist/node_modules/date-fns/endOfYear.js +11 -0
- package/dist/node_modules/date-fns/format.js +77 -0
- package/dist/node_modules/date-fns/getDayOfYear.js +12 -0
- package/dist/node_modules/date-fns/getDaysInMonth.js +14 -0
- package/dist/node_modules/date-fns/getDefaultOptions.js +7 -0
- package/dist/node_modules/date-fns/getISODay.js +8 -0
- package/dist/node_modules/date-fns/getISOWeek.js +12 -0
- package/dist/node_modules/date-fns/getISOWeekYear.js +25 -0
- package/dist/node_modules/date-fns/getMonth.js +7 -0
- package/dist/node_modules/date-fns/getWeek.js +12 -0
- package/dist/node_modules/date-fns/getWeekYear.js +28 -0
- package/dist/node_modules/date-fns/getYear.js +7 -0
- package/dist/node_modules/date-fns/isAfter.js +7 -0
- package/dist/node_modules/date-fns/isBefore.js +7 -0
- package/dist/node_modules/date-fns/isDate.js +6 -0
- package/dist/node_modules/date-fns/isSameDay.js +13 -0
- package/dist/node_modules/date-fns/isSameMonth.js +12 -0
- package/dist/node_modules/date-fns/isSameYear.js +12 -0
- package/dist/node_modules/date-fns/isValid.js +8 -0
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +10 -0
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +20 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +43 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +16 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +85 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +36 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +12 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +164 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +122 -0
- package/dist/node_modules/date-fns/locale/en-US.js +20 -0
- package/dist/node_modules/date-fns/max.js +16 -0
- package/dist/node_modules/date-fns/min.js +16 -0
- package/dist/node_modules/date-fns/parse/_lib/Parser.js +25 -0
- package/dist/node_modules/date-fns/parse/_lib/Setter.js +44 -0
- package/dist/node_modules/date-fns/parse/_lib/constants.js +50 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +44 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +44 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DateParser.js +64 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +52 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayParser.js +45 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js +44 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/EraParser.js +30 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +20 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +17 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js +32 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js +27 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js +28 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js +34 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js +106 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +43 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +43 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +43 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +39 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +76 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +42 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +67 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js +27 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/MonthParser.js +73 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +71 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/SecondParser.js +27 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +76 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +73 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +71 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +16 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +16 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/YearParser.js +47 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers.js +67 -0
- package/dist/node_modules/date-fns/parse/_lib/utils.js +117 -0
- package/dist/node_modules/date-fns/parse.js +123 -0
- package/dist/node_modules/date-fns/setDay.js +17 -0
- package/dist/node_modules/date-fns/setISODay.js +12 -0
- package/dist/node_modules/date-fns/setISOWeek.js +11 -0
- package/dist/node_modules/date-fns/setMonth.js +17 -0
- package/dist/node_modules/date-fns/setWeek.js +11 -0
- package/dist/node_modules/date-fns/setYear.js +11 -0
- package/dist/node_modules/date-fns/startOfDay.js +9 -0
- package/dist/node_modules/date-fns/startOfISOWeek.js +7 -0
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +13 -0
- package/dist/node_modules/date-fns/startOfMonth.js +10 -0
- package/dist/node_modules/date-fns/startOfWeek.js +15 -0
- package/dist/node_modules/date-fns/startOfWeekYear.js +17 -0
- package/dist/node_modules/date-fns/startOfYear.js +10 -0
- package/dist/node_modules/date-fns/toDate.js +7 -0
- package/dist/node_modules/date-fns/transpose.js +18 -0
- package/dist/node_modules/date-fns-tz/dist/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +8 -0
- package/dist/node_modules/date-fns-tz/dist/esm/_lib/newDateUTC/index.js +9 -0
- package/dist/node_modules/date-fns-tz/dist/esm/_lib/tzIntlTimeZoneName/index.js +29 -0
- package/dist/node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js +89 -0
- package/dist/node_modules/date-fns-tz/dist/esm/_lib/tzPattern/index.js +4 -0
- package/dist/node_modules/date-fns-tz/dist/esm/_lib/tzTokenizeDate/index.js +81 -0
- package/dist/node_modules/date-fns-tz/dist/esm/format/formatters/index.js +125 -0
- package/dist/node_modules/date-fns-tz/dist/esm/format/index.js +24 -0
- package/dist/node_modules/date-fns-tz/dist/esm/formatInTimeZone/index.js +13 -0
- package/dist/node_modules/date-fns-tz/dist/esm/toDate/index.js +305 -0
- package/dist/node_modules/date-fns-tz/dist/esm/toZonedTime/index.js +14 -0
- package/dist/node_modules/deepmerge/dist/es.js +69 -0
- package/dist/node_modules/dom-css/index.js +65 -0
- package/dist/node_modules/domelementtype/lib/index.js +39 -0
- package/dist/node_modules/domhandler/lib/index.js +166 -0
- package/dist/node_modules/domhandler/lib/node.js +438 -0
- package/dist/node_modules/dompurify/dist/purify.es.js +1020 -0
- package/dist/node_modules/firebase/app/dist/esm/index.esm.js +20 -0
- package/dist/node_modules/firebase/auth/dist/esm/index.esm.js +44 -0
- package/dist/node_modules/formik/dist/formik.esm.js +969 -0
- package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +92 -0
- package/dist/node_modules/html-dom-parser/lib/client/constants.js +55 -0
- package/dist/node_modules/html-dom-parser/lib/client/domparser.js +96 -0
- package/dist/node_modules/html-dom-parser/lib/client/html-to-dom.js +31 -0
- package/dist/node_modules/html-dom-parser/lib/client/utilities.js +96 -0
- package/dist/node_modules/html-react-parser/esm/index.js +5 -0
- package/dist/node_modules/html-react-parser/lib/attributes-to-props.js +64 -0
- package/dist/node_modules/html-react-parser/lib/dom-to-react.js +99 -0
- package/dist/node_modules/html-react-parser/lib/index.js +51 -0
- package/dist/node_modules/html-react-parser/lib/utilities.js +79 -0
- package/dist/node_modules/idb/build/index.js +69 -0
- package/dist/node_modules/idb/build/wrap-idb-value.js +148 -0
- package/dist/node_modules/inline-style-parser/cjs/index.js +142 -0
- package/dist/node_modules/js-cookie/dist/js.cookie.js +99 -0
- package/dist/node_modules/json2mq/index.js +55 -0
- package/dist/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/lodash-es/_Hash.js +21 -0
- package/dist/node_modules/lodash-es/_ListCache.js +21 -0
- package/dist/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/lodash-es/_MapCache.js +21 -0
- package/dist/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/lodash-es/_Stack.js +18 -0
- package/dist/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/lodash-es/_arrayEach.js +12 -0
- package/dist/node_modules/lodash-es/_arrayFilter.js +13 -0
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +24 -0
- package/dist/node_modules/lodash-es/_arrayMap.js +10 -0
- package/dist/node_modules/lodash-es/_arrayPush.js +10 -0
- package/dist/node_modules/lodash-es/_assignValue.js +13 -0
- package/dist/node_modules/lodash-es/_assocIndexOf.js +13 -0
- package/dist/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/lodash-es/_baseAssignValue.js +16 -0
- package/dist/node_modules/lodash-es/_baseClone.js +88 -0
- package/dist/node_modules/lodash-es/_baseCreate.js +21 -0
- package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_baseGetTag.js +14 -0
- package/dist/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/lodash-es/_baseIsNative.js +22 -0
- package/dist/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/lodash-es/_baseIsTypedArray.js +14 -0
- package/dist/node_modules/lodash-es/_baseKeys.js +19 -0
- package/dist/node_modules/lodash-es/_baseKeysIn.js +20 -0
- package/dist/node_modules/lodash-es/_baseTimes.js +10 -0
- package/dist/node_modules/lodash-es/_baseToString.js +21 -0
- package/dist/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +9 -0
- package/dist/node_modules/lodash-es/_cloneBuffer.js +16 -0
- package/dist/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/lodash-es/_cloneRegExp.js +9 -0
- package/dist/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/lodash-es/_copyArray.js +11 -0
- package/dist/node_modules/lodash-es/_copyObject.js +23 -0
- package/dist/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/lodash-es/_defineProperty.js +12 -0
- package/dist/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/lodash-es/_getRawTag.js +25 -0
- package/dist/node_modules/lodash-es/_getSymbols.js +17 -0
- package/dist/node_modules/lodash-es/_getSymbolsIn.js +16 -0
- package/dist/node_modules/lodash-es/_getTag.js +34 -0
- package/dist/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/lodash-es/_hashClear.js +8 -0
- package/dist/node_modules/lodash-es/_hashDelete.js +8 -0
- package/dist/node_modules/lodash-es/_hashGet.js +15 -0
- package/dist/node_modules/lodash-es/_hashHas.js +10 -0
- package/dist/node_modules/lodash-es/_hashSet.js +11 -0
- package/dist/node_modules/lodash-es/_initCloneArray.js +13 -0
- package/dist/node_modules/lodash-es/_initCloneByTag.js +43 -0
- package/dist/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/lodash-es/_isIndex.js +10 -0
- package/dist/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/lodash-es/_listCacheClear.js +7 -0
- package/dist/node_modules/lodash-es/_listCacheDelete.js +20 -0
- package/dist/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_listCacheSet.js +14 -0
- package/dist/node_modules/lodash-es/_mapCacheClear.js +14 -0
- package/dist/node_modules/lodash-es/_mapCacheDelete.js +9 -0
- package/dist/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheSet.js +10 -0
- package/dist/node_modules/lodash-es/_memoizeCapped.js +15 -0
- package/dist/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/lodash-es/_nativeKeysIn.js +12 -0
- package/dist/node_modules/lodash-es/_nodeUtil.js +18 -0
- package/dist/node_modules/lodash-es/_objectToString.js +8 -0
- package/dist/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/lodash-es/_root.js +6 -0
- package/dist/node_modules/lodash-es/_stackClear.js +8 -0
- package/dist/node_modules/lodash-es/_stackDelete.js +8 -0
- package/dist/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/lodash-es/_stackSet.js +22 -0
- package/dist/node_modules/lodash-es/_stringToPath.js +16 -0
- package/dist/node_modules/lodash-es/_toKey.js +11 -0
- package/dist/node_modules/lodash-es/_toSource.js +18 -0
- package/dist/node_modules/lodash-es/clone.js +8 -0
- package/dist/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/lodash-es/isArguments.js +13 -0
- package/dist/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/lodash-es/isBuffer.js +11 -0
- package/dist/node_modules/lodash-es/isFunction.js +13 -0
- package/dist/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/lodash-es/isMap.js +8 -0
- package/dist/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/lodash-es/isPlainObject.js +22 -0
- package/dist/node_modules/lodash-es/isSet.js +8 -0
- package/dist/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/lodash-es/isTypedArray.js +8 -0
- package/dist/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/lodash-es/memoize.js +22 -0
- package/dist/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/lodash-es/toPath.js +16 -0
- package/dist/node_modules/lodash-es/toString.js +7 -0
- package/dist/node_modules/lodash.debounce/index.js +137 -0
- package/dist/node_modules/memoize-one/dist/memoize-one.esm.js +52 -0
- package/dist/node_modules/mixpanel-browser/dist/mixpanel.module.js +25533 -0
- package/dist/node_modules/object-assign/index.js +73 -0
- package/dist/node_modules/performance-now/lib/performance-now.js +42 -0
- package/dist/node_modules/popper.js/dist/esm/popper.js +1516 -0
- package/dist/node_modules/prefix-style/index.js +29 -0
- package/dist/node_modules/prop-types/checkPropTypes.js +68 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +58 -0
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +451 -0
- package/dist/node_modules/prop-types/index.js +20 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +12 -0
- package/dist/node_modules/prop-types/lib/has.js +11 -0
- package/dist/node_modules/property-expr/index.js +105 -0
- package/dist/node_modules/qrcode.react/lib/esm/index.js +1099 -0
- package/dist/node_modules/raf/index.js +67 -0
- package/dist/node_modules/react-collapse/lib/Collapse.js +285 -0
- package/dist/node_modules/react-collapse/lib/UnmountClosed.js +278 -0
- package/dist/node_modules/react-collapse/lib/index.js +17 -0
- package/dist/node_modules/react-copy-to-clipboard/lib/Component.js +209 -0
- package/dist/node_modules/react-copy-to-clipboard/lib/index.js +14 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/Scrollbars/defaultRenderElements.js +85 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/Scrollbars/index.js +706 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/Scrollbars/styles.js +67 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/index.js +24 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/utils/getInnerHeight.js +21 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/utils/getInnerWidth.js +21 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/utils/getScrollbarWidth.js +44 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/utils/isString.js +19 -0
- package/dist/node_modules/react-custom-scrollbars-4/lib/utils/returnFalse.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +325 -0
- package/dist/node_modules/react-day-picker/dist/esm/UI.js +59 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +25 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +282 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +18 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +21 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +34 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +11 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +54 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +10 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +10 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +6 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +18 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +40 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +72 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +11 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +17 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +10 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +30 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +12 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +20 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +22 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +16 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +16 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getLabels.js +41 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +17 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +43 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +39 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +20 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +20 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +20 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +23 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +9 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +26 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +10 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +11 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +6 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +6 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +6 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +6 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +6 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +6 -0
- package/dist/node_modules/react-day-picker/dist/esm/locale/en-US.js +62 -0
- package/dist/node_modules/react-day-picker/dist/esm/noonDateLib.js +145 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +42 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +128 -0
- package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +100 -0
- package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +42 -0
- package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +21 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +55 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js +53 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +52 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +17 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +61 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +23 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js +11 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +26 -0
- package/dist/node_modules/react-fast-compare/index.js +63 -0
- package/dist/node_modules/react-helmet/es/Helmet.js +717 -0
- package/dist/node_modules/react-helmet/node_modules/react-fast-compare/index.js +81 -0
- package/dist/node_modules/react-intersection-observer/dist/index.js +178 -0
- package/dist/node_modules/react-is/cjs/react-is.development.js +157 -0
- package/dist/node_modules/react-is/cjs/react-is.production.min.js +98 -0
- package/dist/node_modules/react-is/index.js +17 -0
- package/dist/node_modules/react-otp-input/lib/index.esm.js +168 -0
- package/dist/node_modules/react-portal/es/LegacyPortal.js +91 -0
- package/dist/node_modules/react-portal/es/Portal.js +74 -0
- package/dist/node_modules/react-portal/es/PortalCompat.js +12 -0
- package/dist/node_modules/react-portal/es/utils.js +4 -0
- package/dist/node_modules/react-property/lib/index.js +471 -0
- package/dist/node_modules/react-property/lib/possibleStandardNamesOptimized.js +499 -0
- package/dist/node_modules/react-range/lib/Range.js +592 -0
- package/dist/node_modules/react-range/lib/index.js +39 -0
- package/dist/node_modules/react-range/lib/types.js +19 -0
- package/dist/node_modules/react-range/lib/utils.js +318 -0
- package/dist/node_modules/react-select/creatable/dist/react-select-creatable.esm.js +19 -0
- package/dist/node_modules/react-select/dist/Select-ef7c0426.esm.js +2317 -0
- package/dist/node_modules/react-select/dist/index-641ee5b8.esm.js +1071 -0
- package/dist/node_modules/react-select/dist/react-select.esm.js +20 -0
- package/dist/node_modules/react-select/dist/useCreatable-09aaeb9a.esm.js +75 -0
- package/dist/node_modules/react-select/dist/useStateManager-7e1e8489.esm.js +51 -0
- package/dist/node_modules/react-side-effect/lib/index.js +105 -0
- package/dist/node_modules/react-slick/lib/arrows.js +248 -0
- package/dist/node_modules/react-slick/lib/default-props.js +85 -0
- package/dist/node_modules/react-slick/lib/dots.js +192 -0
- package/dist/node_modules/react-slick/lib/index.js +22 -0
- package/dist/node_modules/react-slick/lib/initial-state.js +48 -0
- package/dist/node_modules/react-slick/lib/inner-slider.js +810 -0
- package/dist/node_modules/react-slick/lib/slider.js +333 -0
- package/dist/node_modules/react-slick/lib/track.js +330 -0
- package/dist/node_modules/react-slick/lib/utils/innerSliderUtils.js +730 -0
- package/dist/node_modules/react-table/dist/react-table.development.js +3684 -0
- package/dist/node_modules/react-table/dist/react-table.production.min.js +1637 -0
- package/dist/node_modules/react-table/index.js +17 -0
- package/dist/node_modules/react-tippy/dist/react-tippy.js +1981 -0
- package/dist/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +495 -0
- package/dist/node_modules/string-convert/camel2hyphen.js +16 -0
- package/dist/node_modules/style-to-js/cjs/index.js +31 -0
- package/dist/node_modules/style-to-js/cjs/utilities.js +42 -0
- package/dist/node_modules/style-to-object/cjs/index.js +38 -0
- package/dist/node_modules/stylis/src/Enum.js +20 -0
- package/dist/node_modules/stylis/src/Middleware.js +22 -0
- package/dist/node_modules/stylis/src/Parser.js +157 -0
- package/dist/node_modules/stylis/src/Serializer.js +29 -0
- package/dist/node_modules/stylis/src/Tokenizer.js +160 -0
- package/dist/node_modules/stylis/src/Utility.js +52 -0
- package/dist/node_modules/tiny-case/index.js +33 -0
- package/dist/node_modules/tiny-warning/dist/tiny-warning.esm.js +16 -0
- package/dist/node_modules/to-camel-case/index.js +18 -0
- package/dist/node_modules/to-no-case/index.js +32 -0
- package/dist/node_modules/to-space-case/index.js +18 -0
- package/dist/node_modules/toggle-selection/index.js +42 -0
- package/dist/node_modules/toposort/index.js +79 -0
- package/dist/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +5 -0
- package/dist/node_modules/yup/index.esm.js +1921 -0
- package/dist/routing/RouterWrapper.js +1 -1
- package/dist/styles/global.js +2 -2
- package/dist/utils/copyToClipboard.js +7 -7
- package/dist/utils/delete-redirect-cookie-and-navigate.js +3 -3
- package/dist/utils/moment.js +2 -3
- package/dist/utils/redirect-url.js +2 -2
- package/dist/utils/set-redirect-cookie.js +2 -2
- package/dist/utils/transition.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1921 @@
|
|
|
1
|
+
import { p as propertyExprExports } from "../../_virtual/index9.js";
|
|
2
|
+
import { t as tinyCaseExports } from "../../_virtual/index10.js";
|
|
3
|
+
import toposort from "../../_virtual/index11.js";
|
|
4
|
+
const toString = Object.prototype.toString;
|
|
5
|
+
const errorToString = Error.prototype.toString;
|
|
6
|
+
const regExpToString = RegExp.prototype.toString;
|
|
7
|
+
const symbolToString = typeof Symbol !== "undefined" ? Symbol.prototype.toString : () => "";
|
|
8
|
+
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
9
|
+
function printNumber(val) {
|
|
10
|
+
if (val != +val) return "NaN";
|
|
11
|
+
const isNegativeZero = val === 0 && 1 / val < 0;
|
|
12
|
+
return isNegativeZero ? "-0" : "" + val;
|
|
13
|
+
}
|
|
14
|
+
function printSimpleValue(val, quoteStrings = false) {
|
|
15
|
+
if (val == null || val === true || val === false) return "" + val;
|
|
16
|
+
const typeOf = typeof val;
|
|
17
|
+
if (typeOf === "number") return printNumber(val);
|
|
18
|
+
if (typeOf === "string") return quoteStrings ? `"${val}"` : val;
|
|
19
|
+
if (typeOf === "function") return "[Function " + (val.name || "anonymous") + "]";
|
|
20
|
+
if (typeOf === "symbol") return symbolToString.call(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
21
|
+
const tag = toString.call(val).slice(8, -1);
|
|
22
|
+
if (tag === "Date") return isNaN(val.getTime()) ? "" + val : val.toISOString(val);
|
|
23
|
+
if (tag === "Error" || val instanceof Error) return "[" + errorToString.call(val) + "]";
|
|
24
|
+
if (tag === "RegExp") return regExpToString.call(val);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function printValue(value, quoteStrings) {
|
|
28
|
+
let result = printSimpleValue(value, quoteStrings);
|
|
29
|
+
if (result !== null) return result;
|
|
30
|
+
return JSON.stringify(value, function(key, value2) {
|
|
31
|
+
let result2 = printSimpleValue(this[key], quoteStrings);
|
|
32
|
+
if (result2 !== null) return result2;
|
|
33
|
+
return value2;
|
|
34
|
+
}, 2);
|
|
35
|
+
}
|
|
36
|
+
function toArray(value) {
|
|
37
|
+
return value == null ? [] : [].concat(value);
|
|
38
|
+
}
|
|
39
|
+
let _Symbol$toStringTag, _Symbol$hasInstance, _Symbol$toStringTag2;
|
|
40
|
+
let strReg = /\$\{\s*(\w+)\s*\}/g;
|
|
41
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
42
|
+
class ValidationErrorNoStack {
|
|
43
|
+
constructor(errorOrErrors, value, field, type) {
|
|
44
|
+
this.name = void 0;
|
|
45
|
+
this.message = void 0;
|
|
46
|
+
this.value = void 0;
|
|
47
|
+
this.path = void 0;
|
|
48
|
+
this.type = void 0;
|
|
49
|
+
this.params = void 0;
|
|
50
|
+
this.errors = void 0;
|
|
51
|
+
this.inner = void 0;
|
|
52
|
+
this[_Symbol$toStringTag] = "Error";
|
|
53
|
+
this.name = "ValidationError";
|
|
54
|
+
this.value = value;
|
|
55
|
+
this.path = field;
|
|
56
|
+
this.type = type;
|
|
57
|
+
this.errors = [];
|
|
58
|
+
this.inner = [];
|
|
59
|
+
toArray(errorOrErrors).forEach((err) => {
|
|
60
|
+
if (ValidationError.isError(err)) {
|
|
61
|
+
this.errors.push(...err.errors);
|
|
62
|
+
const innerErrors = err.inner.length ? err.inner : [err];
|
|
63
|
+
this.inner.push(...innerErrors);
|
|
64
|
+
} else {
|
|
65
|
+
this.errors.push(err);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
_Symbol$hasInstance = Symbol.hasInstance;
|
|
72
|
+
_Symbol$toStringTag2 = Symbol.toStringTag;
|
|
73
|
+
class ValidationError extends Error {
|
|
74
|
+
static formatError(message, params) {
|
|
75
|
+
const path = params.label || params.path || "this";
|
|
76
|
+
params = Object.assign({}, params, {
|
|
77
|
+
path,
|
|
78
|
+
originalPath: params.path
|
|
79
|
+
});
|
|
80
|
+
if (typeof message === "string") return message.replace(strReg, (_, key) => printValue(params[key]));
|
|
81
|
+
if (typeof message === "function") return message(params);
|
|
82
|
+
return message;
|
|
83
|
+
}
|
|
84
|
+
static isError(err) {
|
|
85
|
+
return err && err.name === "ValidationError";
|
|
86
|
+
}
|
|
87
|
+
constructor(errorOrErrors, value, field, type, disableStack) {
|
|
88
|
+
const errorNoStack = new ValidationErrorNoStack(errorOrErrors, value, field, type);
|
|
89
|
+
if (disableStack) {
|
|
90
|
+
return errorNoStack;
|
|
91
|
+
}
|
|
92
|
+
super();
|
|
93
|
+
this.value = void 0;
|
|
94
|
+
this.path = void 0;
|
|
95
|
+
this.type = void 0;
|
|
96
|
+
this.params = void 0;
|
|
97
|
+
this.errors = [];
|
|
98
|
+
this.inner = [];
|
|
99
|
+
this[_Symbol$toStringTag2] = "Error";
|
|
100
|
+
this.name = errorNoStack.name;
|
|
101
|
+
this.message = errorNoStack.message;
|
|
102
|
+
this.type = errorNoStack.type;
|
|
103
|
+
this.value = errorNoStack.value;
|
|
104
|
+
this.path = errorNoStack.path;
|
|
105
|
+
this.errors = errorNoStack.errors;
|
|
106
|
+
this.inner = errorNoStack.inner;
|
|
107
|
+
if (Error.captureStackTrace) {
|
|
108
|
+
Error.captureStackTrace(this, ValidationError);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
static [_Symbol$hasInstance](inst) {
|
|
112
|
+
return ValidationErrorNoStack[Symbol.hasInstance](inst) || super[Symbol.hasInstance](inst);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
let mixed = {
|
|
116
|
+
default: "${path} is invalid",
|
|
117
|
+
required: "${path} is a required field",
|
|
118
|
+
defined: "${path} must be defined",
|
|
119
|
+
notNull: "${path} cannot be null",
|
|
120
|
+
oneOf: "${path} must be one of the following values: ${values}",
|
|
121
|
+
notOneOf: "${path} must not be one of the following values: ${values}",
|
|
122
|
+
notType: ({
|
|
123
|
+
path,
|
|
124
|
+
type,
|
|
125
|
+
value,
|
|
126
|
+
originalValue
|
|
127
|
+
}) => {
|
|
128
|
+
const castMsg = originalValue != null && originalValue !== value ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : ".";
|
|
129
|
+
return type !== "mixed" ? `${path} must be a \`${type}\` type, but the final value was: \`${printValue(value, true)}\`` + castMsg : `${path} must match the configured type. The validated value was: \`${printValue(value, true)}\`` + castMsg;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
let string = {
|
|
133
|
+
length: "${path} must be exactly ${length} characters",
|
|
134
|
+
min: "${path} must be at least ${min} characters",
|
|
135
|
+
max: "${path} must be at most ${max} characters",
|
|
136
|
+
matches: '${path} must match the following: "${regex}"',
|
|
137
|
+
email: "${path} must be a valid email",
|
|
138
|
+
url: "${path} must be a valid URL",
|
|
139
|
+
uuid: "${path} must be a valid UUID",
|
|
140
|
+
datetime: "${path} must be a valid ISO date-time",
|
|
141
|
+
datetime_precision: "${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",
|
|
142
|
+
datetime_offset: '${path} must be a valid ISO date-time with UTC "Z" timezone',
|
|
143
|
+
trim: "${path} must be a trimmed string",
|
|
144
|
+
lowercase: "${path} must be a lowercase string",
|
|
145
|
+
uppercase: "${path} must be a upper case string"
|
|
146
|
+
};
|
|
147
|
+
let number = {
|
|
148
|
+
min: "${path} must be greater than or equal to ${min}",
|
|
149
|
+
max: "${path} must be less than or equal to ${max}",
|
|
150
|
+
lessThan: "${path} must be less than ${less}",
|
|
151
|
+
moreThan: "${path} must be greater than ${more}",
|
|
152
|
+
positive: "${path} must be a positive number",
|
|
153
|
+
negative: "${path} must be a negative number",
|
|
154
|
+
integer: "${path} must be an integer"
|
|
155
|
+
};
|
|
156
|
+
let date = {
|
|
157
|
+
min: "${path} field must be later than ${min}",
|
|
158
|
+
max: "${path} field must be at earlier than ${max}"
|
|
159
|
+
};
|
|
160
|
+
let boolean = {
|
|
161
|
+
isValue: "${path} field must be ${value}"
|
|
162
|
+
};
|
|
163
|
+
let object = {
|
|
164
|
+
noUnknown: "${path} field has unspecified keys: ${unknown}",
|
|
165
|
+
exact: "${path} object contains unknown properties: ${properties}"
|
|
166
|
+
};
|
|
167
|
+
let array = {
|
|
168
|
+
min: "${path} field must have at least ${min} items",
|
|
169
|
+
max: "${path} field must have less than or equal to ${max} items",
|
|
170
|
+
length: "${path} must have ${length} items"
|
|
171
|
+
};
|
|
172
|
+
let tuple = {
|
|
173
|
+
notType: (params) => {
|
|
174
|
+
const {
|
|
175
|
+
path,
|
|
176
|
+
value,
|
|
177
|
+
spec
|
|
178
|
+
} = params;
|
|
179
|
+
const typeLen = spec.types.length;
|
|
180
|
+
if (Array.isArray(value)) {
|
|
181
|
+
if (value.length < typeLen) return `${path} tuple value has too few items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
|
|
182
|
+
if (value.length > typeLen) return `${path} tuple value has too many items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
|
|
183
|
+
}
|
|
184
|
+
return ValidationError.formatError(mixed.notType, params);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
188
|
+
mixed,
|
|
189
|
+
string,
|
|
190
|
+
number,
|
|
191
|
+
date,
|
|
192
|
+
object,
|
|
193
|
+
array,
|
|
194
|
+
boolean,
|
|
195
|
+
tuple
|
|
196
|
+
});
|
|
197
|
+
const isSchema = (obj) => obj && obj.__isYupSchema__;
|
|
198
|
+
class Condition {
|
|
199
|
+
static fromOptions(refs, config) {
|
|
200
|
+
if (!config.then && !config.otherwise) throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
|
|
201
|
+
let {
|
|
202
|
+
is,
|
|
203
|
+
then,
|
|
204
|
+
otherwise
|
|
205
|
+
} = config;
|
|
206
|
+
let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
|
|
207
|
+
return new Condition(refs, (values, schema) => {
|
|
208
|
+
var _branch;
|
|
209
|
+
let branch = check(...values) ? then : otherwise;
|
|
210
|
+
return (_branch = branch == null ? void 0 : branch(schema)) != null ? _branch : schema;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
constructor(refs, builder) {
|
|
214
|
+
this.fn = void 0;
|
|
215
|
+
this.refs = refs;
|
|
216
|
+
this.refs = refs;
|
|
217
|
+
this.fn = builder;
|
|
218
|
+
}
|
|
219
|
+
resolve(base, options) {
|
|
220
|
+
let values = this.refs.map((ref) => (
|
|
221
|
+
// TODO: ? operator here?
|
|
222
|
+
ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context)
|
|
223
|
+
));
|
|
224
|
+
let schema = this.fn(values, base, options);
|
|
225
|
+
if (schema === void 0 || // @ts-ignore this can be base
|
|
226
|
+
schema === base) {
|
|
227
|
+
return base;
|
|
228
|
+
}
|
|
229
|
+
if (!isSchema(schema)) throw new TypeError("conditions must return a schema object");
|
|
230
|
+
return schema.resolve(options);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const prefixes = {
|
|
234
|
+
context: "$",
|
|
235
|
+
value: "."
|
|
236
|
+
};
|
|
237
|
+
class Reference {
|
|
238
|
+
constructor(key, options = {}) {
|
|
239
|
+
this.key = void 0;
|
|
240
|
+
this.isContext = void 0;
|
|
241
|
+
this.isValue = void 0;
|
|
242
|
+
this.isSibling = void 0;
|
|
243
|
+
this.path = void 0;
|
|
244
|
+
this.getter = void 0;
|
|
245
|
+
this.map = void 0;
|
|
246
|
+
if (typeof key !== "string") throw new TypeError("ref must be a string, got: " + key);
|
|
247
|
+
this.key = key.trim();
|
|
248
|
+
if (key === "") throw new TypeError("ref must be a non-empty string");
|
|
249
|
+
this.isContext = this.key[0] === prefixes.context;
|
|
250
|
+
this.isValue = this.key[0] === prefixes.value;
|
|
251
|
+
this.isSibling = !this.isContext && !this.isValue;
|
|
252
|
+
let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : "";
|
|
253
|
+
this.path = this.key.slice(prefix.length);
|
|
254
|
+
this.getter = this.path && propertyExprExports.getter(this.path, true);
|
|
255
|
+
this.map = options.map;
|
|
256
|
+
}
|
|
257
|
+
getValue(value, parent, context) {
|
|
258
|
+
let result = this.isContext ? context : this.isValue ? value : parent;
|
|
259
|
+
if (this.getter) result = this.getter(result || {});
|
|
260
|
+
if (this.map) result = this.map(result);
|
|
261
|
+
return result;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
*
|
|
265
|
+
* @param {*} value
|
|
266
|
+
* @param {Object} options
|
|
267
|
+
* @param {Object=} options.context
|
|
268
|
+
* @param {Object=} options.parent
|
|
269
|
+
*/
|
|
270
|
+
cast(value, options) {
|
|
271
|
+
return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
|
|
272
|
+
}
|
|
273
|
+
resolve() {
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
describe() {
|
|
277
|
+
return {
|
|
278
|
+
type: "ref",
|
|
279
|
+
key: this.key
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
toString() {
|
|
283
|
+
return `Ref(${this.key})`;
|
|
284
|
+
}
|
|
285
|
+
static isRef(value) {
|
|
286
|
+
return value && value.__isYupRef;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
Reference.prototype.__isYupRef = true;
|
|
290
|
+
const isAbsent = (value) => value == null;
|
|
291
|
+
function createValidation(config) {
|
|
292
|
+
function validate({
|
|
293
|
+
value,
|
|
294
|
+
path = "",
|
|
295
|
+
options,
|
|
296
|
+
originalValue,
|
|
297
|
+
schema
|
|
298
|
+
}, panic, next) {
|
|
299
|
+
const {
|
|
300
|
+
name,
|
|
301
|
+
test,
|
|
302
|
+
params,
|
|
303
|
+
message,
|
|
304
|
+
skipAbsent
|
|
305
|
+
} = config;
|
|
306
|
+
let {
|
|
307
|
+
parent,
|
|
308
|
+
context,
|
|
309
|
+
abortEarly = schema.spec.abortEarly,
|
|
310
|
+
disableStackTrace = schema.spec.disableStackTrace
|
|
311
|
+
} = options;
|
|
312
|
+
const resolveOptions = {
|
|
313
|
+
value,
|
|
314
|
+
parent,
|
|
315
|
+
context
|
|
316
|
+
};
|
|
317
|
+
function createError(overrides = {}) {
|
|
318
|
+
const nextParams = resolveParams(Object.assign({
|
|
319
|
+
value,
|
|
320
|
+
originalValue,
|
|
321
|
+
label: schema.spec.label,
|
|
322
|
+
path: overrides.path || path,
|
|
323
|
+
spec: schema.spec,
|
|
324
|
+
disableStackTrace: overrides.disableStackTrace || disableStackTrace
|
|
325
|
+
}, params, overrides.params), resolveOptions);
|
|
326
|
+
const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name, nextParams.disableStackTrace);
|
|
327
|
+
error.params = nextParams;
|
|
328
|
+
return error;
|
|
329
|
+
}
|
|
330
|
+
const invalid = abortEarly ? panic : next;
|
|
331
|
+
let ctx = {
|
|
332
|
+
path,
|
|
333
|
+
parent,
|
|
334
|
+
type: name,
|
|
335
|
+
from: options.from,
|
|
336
|
+
createError,
|
|
337
|
+
resolve(item) {
|
|
338
|
+
return resolveMaybeRef(item, resolveOptions);
|
|
339
|
+
},
|
|
340
|
+
options,
|
|
341
|
+
originalValue,
|
|
342
|
+
schema
|
|
343
|
+
};
|
|
344
|
+
const handleResult = (validOrError) => {
|
|
345
|
+
if (ValidationError.isError(validOrError)) invalid(validOrError);
|
|
346
|
+
else if (!validOrError) invalid(createError());
|
|
347
|
+
else next(null);
|
|
348
|
+
};
|
|
349
|
+
const handleError = (err) => {
|
|
350
|
+
if (ValidationError.isError(err)) invalid(err);
|
|
351
|
+
else panic(err);
|
|
352
|
+
};
|
|
353
|
+
const shouldSkip = skipAbsent && isAbsent(value);
|
|
354
|
+
if (shouldSkip) {
|
|
355
|
+
return handleResult(true);
|
|
356
|
+
}
|
|
357
|
+
let result;
|
|
358
|
+
try {
|
|
359
|
+
var _result;
|
|
360
|
+
result = test.call(ctx, value, ctx);
|
|
361
|
+
if (typeof ((_result = result) == null ? void 0 : _result.then) === "function") {
|
|
362
|
+
if (options.sync) {
|
|
363
|
+
throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
|
|
364
|
+
}
|
|
365
|
+
return Promise.resolve(result).then(handleResult, handleError);
|
|
366
|
+
}
|
|
367
|
+
} catch (err) {
|
|
368
|
+
handleError(err);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
handleResult(result);
|
|
372
|
+
}
|
|
373
|
+
validate.OPTIONS = config;
|
|
374
|
+
return validate;
|
|
375
|
+
}
|
|
376
|
+
function resolveParams(params, options) {
|
|
377
|
+
if (!params) return params;
|
|
378
|
+
for (const key of Object.keys(params)) {
|
|
379
|
+
params[key] = resolveMaybeRef(params[key], options);
|
|
380
|
+
}
|
|
381
|
+
return params;
|
|
382
|
+
}
|
|
383
|
+
function resolveMaybeRef(item, options) {
|
|
384
|
+
return Reference.isRef(item) ? item.getValue(options.value, options.parent, options.context) : item;
|
|
385
|
+
}
|
|
386
|
+
function getIn(schema, path, value, context = value) {
|
|
387
|
+
let parent, lastPart, lastPartDebug;
|
|
388
|
+
if (!path) return {
|
|
389
|
+
parent,
|
|
390
|
+
parentPath: path,
|
|
391
|
+
schema
|
|
392
|
+
};
|
|
393
|
+
propertyExprExports.forEach(path, (_part, isBracket, isArray) => {
|
|
394
|
+
let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
|
|
395
|
+
schema = schema.resolve({
|
|
396
|
+
context,
|
|
397
|
+
parent,
|
|
398
|
+
value
|
|
399
|
+
});
|
|
400
|
+
let isTuple = schema.type === "tuple";
|
|
401
|
+
let idx = isArray ? parseInt(part, 10) : 0;
|
|
402
|
+
if (schema.innerType || isTuple) {
|
|
403
|
+
if (isTuple && !isArray) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${lastPartDebug}" must contain an index to the tuple element, e.g. "${lastPartDebug}[0]"`);
|
|
404
|
+
if (value && idx >= value.length) {
|
|
405
|
+
throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. because there is no value at that index. `);
|
|
406
|
+
}
|
|
407
|
+
parent = value;
|
|
408
|
+
value = value && value[idx];
|
|
409
|
+
schema = isTuple ? schema.spec.types[idx] : schema.innerType;
|
|
410
|
+
}
|
|
411
|
+
if (!isArray) {
|
|
412
|
+
if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema.type}")`);
|
|
413
|
+
parent = value;
|
|
414
|
+
value = value && value[part];
|
|
415
|
+
schema = schema.fields[part];
|
|
416
|
+
}
|
|
417
|
+
lastPart = part;
|
|
418
|
+
lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
|
|
419
|
+
});
|
|
420
|
+
return {
|
|
421
|
+
schema,
|
|
422
|
+
parent,
|
|
423
|
+
parentPath: lastPart
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
class ReferenceSet extends Set {
|
|
427
|
+
describe() {
|
|
428
|
+
const description = [];
|
|
429
|
+
for (const item of this.values()) {
|
|
430
|
+
description.push(Reference.isRef(item) ? item.describe() : item);
|
|
431
|
+
}
|
|
432
|
+
return description;
|
|
433
|
+
}
|
|
434
|
+
resolveAll(resolve) {
|
|
435
|
+
let result = [];
|
|
436
|
+
for (const item of this.values()) {
|
|
437
|
+
result.push(resolve(item));
|
|
438
|
+
}
|
|
439
|
+
return result;
|
|
440
|
+
}
|
|
441
|
+
clone() {
|
|
442
|
+
return new ReferenceSet(this.values());
|
|
443
|
+
}
|
|
444
|
+
merge(newItems, removeItems) {
|
|
445
|
+
const next = this.clone();
|
|
446
|
+
newItems.forEach((value) => next.add(value));
|
|
447
|
+
removeItems.forEach((value) => next.delete(value));
|
|
448
|
+
return next;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function clone(src, seen = /* @__PURE__ */ new Map()) {
|
|
452
|
+
if (isSchema(src) || !src || typeof src !== "object") return src;
|
|
453
|
+
if (seen.has(src)) return seen.get(src);
|
|
454
|
+
let copy;
|
|
455
|
+
if (src instanceof Date) {
|
|
456
|
+
copy = new Date(src.getTime());
|
|
457
|
+
seen.set(src, copy);
|
|
458
|
+
} else if (src instanceof RegExp) {
|
|
459
|
+
copy = new RegExp(src);
|
|
460
|
+
seen.set(src, copy);
|
|
461
|
+
} else if (Array.isArray(src)) {
|
|
462
|
+
copy = new Array(src.length);
|
|
463
|
+
seen.set(src, copy);
|
|
464
|
+
for (let i = 0; i < src.length; i++) copy[i] = clone(src[i], seen);
|
|
465
|
+
} else if (src instanceof Map) {
|
|
466
|
+
copy = /* @__PURE__ */ new Map();
|
|
467
|
+
seen.set(src, copy);
|
|
468
|
+
for (const [k, v] of src.entries()) copy.set(k, clone(v, seen));
|
|
469
|
+
} else if (src instanceof Set) {
|
|
470
|
+
copy = /* @__PURE__ */ new Set();
|
|
471
|
+
seen.set(src, copy);
|
|
472
|
+
for (const v of src) copy.add(clone(v, seen));
|
|
473
|
+
} else if (src instanceof Object) {
|
|
474
|
+
copy = {};
|
|
475
|
+
seen.set(src, copy);
|
|
476
|
+
for (const [k, v] of Object.entries(src)) copy[k] = clone(v, seen);
|
|
477
|
+
} else {
|
|
478
|
+
throw Error(`Unable to clone ${src}`);
|
|
479
|
+
}
|
|
480
|
+
return copy;
|
|
481
|
+
}
|
|
482
|
+
function createStandardPath(path) {
|
|
483
|
+
if (!(path != null && path.length)) {
|
|
484
|
+
return void 0;
|
|
485
|
+
}
|
|
486
|
+
const segments = [];
|
|
487
|
+
let currentSegment = "";
|
|
488
|
+
let inBrackets = false;
|
|
489
|
+
let inQuotes = false;
|
|
490
|
+
for (let i = 0; i < path.length; i++) {
|
|
491
|
+
const char = path[i];
|
|
492
|
+
if (char === "[" && !inQuotes) {
|
|
493
|
+
if (currentSegment) {
|
|
494
|
+
segments.push(...currentSegment.split(".").filter(Boolean));
|
|
495
|
+
currentSegment = "";
|
|
496
|
+
}
|
|
497
|
+
inBrackets = true;
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
if (char === "]" && !inQuotes) {
|
|
501
|
+
if (currentSegment) {
|
|
502
|
+
if (/^\d+$/.test(currentSegment)) {
|
|
503
|
+
segments.push(currentSegment);
|
|
504
|
+
} else {
|
|
505
|
+
segments.push(currentSegment.replace(/^"|"$/g, ""));
|
|
506
|
+
}
|
|
507
|
+
currentSegment = "";
|
|
508
|
+
}
|
|
509
|
+
inBrackets = false;
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
if (char === '"') {
|
|
513
|
+
inQuotes = !inQuotes;
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
if (char === "." && !inBrackets && !inQuotes) {
|
|
517
|
+
if (currentSegment) {
|
|
518
|
+
segments.push(currentSegment);
|
|
519
|
+
currentSegment = "";
|
|
520
|
+
}
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
currentSegment += char;
|
|
524
|
+
}
|
|
525
|
+
if (currentSegment) {
|
|
526
|
+
segments.push(...currentSegment.split(".").filter(Boolean));
|
|
527
|
+
}
|
|
528
|
+
return segments;
|
|
529
|
+
}
|
|
530
|
+
function createStandardIssues(error, parentPath) {
|
|
531
|
+
const path = parentPath ? `${parentPath}.${error.path}` : error.path;
|
|
532
|
+
return error.errors.map((err) => ({
|
|
533
|
+
message: err,
|
|
534
|
+
path: createStandardPath(path)
|
|
535
|
+
}));
|
|
536
|
+
}
|
|
537
|
+
function issuesFromValidationError(error, parentPath) {
|
|
538
|
+
var _error$inner;
|
|
539
|
+
if (!((_error$inner = error.inner) != null && _error$inner.length) && error.errors.length) {
|
|
540
|
+
return createStandardIssues(error, parentPath);
|
|
541
|
+
}
|
|
542
|
+
const path = parentPath ? `${parentPath}.${error.path}` : error.path;
|
|
543
|
+
return error.inner.flatMap((err) => issuesFromValidationError(err, path));
|
|
544
|
+
}
|
|
545
|
+
class Schema {
|
|
546
|
+
constructor(options) {
|
|
547
|
+
this.type = void 0;
|
|
548
|
+
this.deps = [];
|
|
549
|
+
this.tests = void 0;
|
|
550
|
+
this.transforms = void 0;
|
|
551
|
+
this.conditions = [];
|
|
552
|
+
this._mutate = void 0;
|
|
553
|
+
this.internalTests = {};
|
|
554
|
+
this._whitelist = new ReferenceSet();
|
|
555
|
+
this._blacklist = new ReferenceSet();
|
|
556
|
+
this.exclusiveTests = /* @__PURE__ */ Object.create(null);
|
|
557
|
+
this._typeCheck = void 0;
|
|
558
|
+
this.spec = void 0;
|
|
559
|
+
this.tests = [];
|
|
560
|
+
this.transforms = [];
|
|
561
|
+
this.withMutation(() => {
|
|
562
|
+
this.typeError(mixed.notType);
|
|
563
|
+
});
|
|
564
|
+
this.type = options.type;
|
|
565
|
+
this._typeCheck = options.check;
|
|
566
|
+
this.spec = Object.assign({
|
|
567
|
+
strip: false,
|
|
568
|
+
strict: false,
|
|
569
|
+
abortEarly: true,
|
|
570
|
+
recursive: true,
|
|
571
|
+
disableStackTrace: false,
|
|
572
|
+
nullable: false,
|
|
573
|
+
optional: true,
|
|
574
|
+
coerce: true
|
|
575
|
+
}, options == null ? void 0 : options.spec);
|
|
576
|
+
this.withMutation((s) => {
|
|
577
|
+
s.nonNullable();
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
// TODO: remove
|
|
581
|
+
get _type() {
|
|
582
|
+
return this.type;
|
|
583
|
+
}
|
|
584
|
+
clone(spec) {
|
|
585
|
+
if (this._mutate) {
|
|
586
|
+
if (spec) Object.assign(this.spec, spec);
|
|
587
|
+
return this;
|
|
588
|
+
}
|
|
589
|
+
const next = Object.create(Object.getPrototypeOf(this));
|
|
590
|
+
next.type = this.type;
|
|
591
|
+
next._typeCheck = this._typeCheck;
|
|
592
|
+
next._whitelist = this._whitelist.clone();
|
|
593
|
+
next._blacklist = this._blacklist.clone();
|
|
594
|
+
next.internalTests = Object.assign({}, this.internalTests);
|
|
595
|
+
next.exclusiveTests = Object.assign({}, this.exclusiveTests);
|
|
596
|
+
next.deps = [...this.deps];
|
|
597
|
+
next.conditions = [...this.conditions];
|
|
598
|
+
next.tests = [...this.tests];
|
|
599
|
+
next.transforms = [...this.transforms];
|
|
600
|
+
next.spec = clone(Object.assign({}, this.spec, spec));
|
|
601
|
+
return next;
|
|
602
|
+
}
|
|
603
|
+
label(label) {
|
|
604
|
+
let next = this.clone();
|
|
605
|
+
next.spec.label = label;
|
|
606
|
+
return next;
|
|
607
|
+
}
|
|
608
|
+
meta(...args) {
|
|
609
|
+
if (args.length === 0) return this.spec.meta;
|
|
610
|
+
let next = this.clone();
|
|
611
|
+
next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);
|
|
612
|
+
return next;
|
|
613
|
+
}
|
|
614
|
+
withMutation(fn) {
|
|
615
|
+
let before = this._mutate;
|
|
616
|
+
this._mutate = true;
|
|
617
|
+
let result = fn(this);
|
|
618
|
+
this._mutate = before;
|
|
619
|
+
return result;
|
|
620
|
+
}
|
|
621
|
+
concat(schema) {
|
|
622
|
+
if (!schema || schema === this) return this;
|
|
623
|
+
if (schema.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
|
|
624
|
+
let base = this;
|
|
625
|
+
let combined = schema.clone();
|
|
626
|
+
const mergedSpec = Object.assign({}, base.spec, combined.spec);
|
|
627
|
+
combined.spec = mergedSpec;
|
|
628
|
+
combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
|
|
629
|
+
combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);
|
|
630
|
+
combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist);
|
|
631
|
+
combined.tests = base.tests;
|
|
632
|
+
combined.exclusiveTests = base.exclusiveTests;
|
|
633
|
+
combined.withMutation((next) => {
|
|
634
|
+
schema.tests.forEach((fn) => {
|
|
635
|
+
next.test(fn.OPTIONS);
|
|
636
|
+
});
|
|
637
|
+
});
|
|
638
|
+
combined.transforms = [...base.transforms, ...combined.transforms];
|
|
639
|
+
return combined;
|
|
640
|
+
}
|
|
641
|
+
isType(v) {
|
|
642
|
+
if (v == null) {
|
|
643
|
+
if (this.spec.nullable && v === null) return true;
|
|
644
|
+
if (this.spec.optional && v === void 0) return true;
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
647
|
+
return this._typeCheck(v);
|
|
648
|
+
}
|
|
649
|
+
resolve(options) {
|
|
650
|
+
let schema = this;
|
|
651
|
+
if (schema.conditions.length) {
|
|
652
|
+
let conditions = schema.conditions;
|
|
653
|
+
schema = schema.clone();
|
|
654
|
+
schema.conditions = [];
|
|
655
|
+
schema = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema);
|
|
656
|
+
schema = schema.resolve(options);
|
|
657
|
+
}
|
|
658
|
+
return schema;
|
|
659
|
+
}
|
|
660
|
+
resolveOptions(options) {
|
|
661
|
+
var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
|
|
662
|
+
return Object.assign({}, options, {
|
|
663
|
+
from: options.from || [],
|
|
664
|
+
strict: (_options$strict = options.strict) != null ? _options$strict : this.spec.strict,
|
|
665
|
+
abortEarly: (_options$abortEarly = options.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly,
|
|
666
|
+
recursive: (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive,
|
|
667
|
+
disableStackTrace: (_options$disableStack = options.disableStackTrace) != null ? _options$disableStack : this.spec.disableStackTrace
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Run the configured transform pipeline over an input value.
|
|
672
|
+
*/
|
|
673
|
+
cast(value, options = {}) {
|
|
674
|
+
let resolvedSchema = this.resolve(Object.assign({}, options, {
|
|
675
|
+
value
|
|
676
|
+
// parent: options.parent,
|
|
677
|
+
// context: options.context,
|
|
678
|
+
}));
|
|
679
|
+
let allowOptionality = options.assert === "ignore-optionality";
|
|
680
|
+
let result = resolvedSchema._cast(value, options);
|
|
681
|
+
if (options.assert !== false && !resolvedSchema.isType(result)) {
|
|
682
|
+
if (allowOptionality && isAbsent(result)) {
|
|
683
|
+
return result;
|
|
684
|
+
}
|
|
685
|
+
let formattedValue = printValue(value);
|
|
686
|
+
let formattedResult = printValue(result);
|
|
687
|
+
throw new TypeError(`The value of ${options.path || "field"} could not be cast to a value that satisfies the schema type: "${resolvedSchema.type}".
|
|
688
|
+
|
|
689
|
+
attempted value: ${formattedValue}
|
|
690
|
+
` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ""));
|
|
691
|
+
}
|
|
692
|
+
return result;
|
|
693
|
+
}
|
|
694
|
+
_cast(rawValue, options) {
|
|
695
|
+
let value = rawValue === void 0 ? rawValue : this.transforms.reduce((prevValue, fn) => fn.call(this, prevValue, rawValue, this, options), rawValue);
|
|
696
|
+
if (value === void 0) {
|
|
697
|
+
value = this.getDefault(options);
|
|
698
|
+
}
|
|
699
|
+
return value;
|
|
700
|
+
}
|
|
701
|
+
_validate(_value, options = {}, panic, next) {
|
|
702
|
+
let {
|
|
703
|
+
path,
|
|
704
|
+
originalValue = _value,
|
|
705
|
+
strict = this.spec.strict
|
|
706
|
+
} = options;
|
|
707
|
+
let value = _value;
|
|
708
|
+
if (!strict) {
|
|
709
|
+
value = this._cast(value, Object.assign({
|
|
710
|
+
assert: false
|
|
711
|
+
}, options));
|
|
712
|
+
}
|
|
713
|
+
let initialTests = [];
|
|
714
|
+
for (let test of Object.values(this.internalTests)) {
|
|
715
|
+
if (test) initialTests.push(test);
|
|
716
|
+
}
|
|
717
|
+
this.runTests({
|
|
718
|
+
path,
|
|
719
|
+
value,
|
|
720
|
+
originalValue,
|
|
721
|
+
options,
|
|
722
|
+
tests: initialTests
|
|
723
|
+
}, panic, (initialErrors) => {
|
|
724
|
+
if (initialErrors.length) {
|
|
725
|
+
return next(initialErrors, value);
|
|
726
|
+
}
|
|
727
|
+
this.runTests({
|
|
728
|
+
path,
|
|
729
|
+
value,
|
|
730
|
+
originalValue,
|
|
731
|
+
options,
|
|
732
|
+
tests: this.tests
|
|
733
|
+
}, panic, next);
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Executes a set of validations, either schema, produced Tests or a nested
|
|
738
|
+
* schema validate result.
|
|
739
|
+
*/
|
|
740
|
+
runTests(runOptions, panic, next) {
|
|
741
|
+
let fired = false;
|
|
742
|
+
let {
|
|
743
|
+
tests,
|
|
744
|
+
value,
|
|
745
|
+
originalValue,
|
|
746
|
+
path,
|
|
747
|
+
options
|
|
748
|
+
} = runOptions;
|
|
749
|
+
let panicOnce = (arg) => {
|
|
750
|
+
if (fired) return;
|
|
751
|
+
fired = true;
|
|
752
|
+
panic(arg, value);
|
|
753
|
+
};
|
|
754
|
+
let nextOnce = (arg) => {
|
|
755
|
+
if (fired) return;
|
|
756
|
+
fired = true;
|
|
757
|
+
next(arg, value);
|
|
758
|
+
};
|
|
759
|
+
let count = tests.length;
|
|
760
|
+
let nestedErrors = [];
|
|
761
|
+
if (!count) return nextOnce([]);
|
|
762
|
+
let args = {
|
|
763
|
+
value,
|
|
764
|
+
originalValue,
|
|
765
|
+
path,
|
|
766
|
+
options,
|
|
767
|
+
schema: this
|
|
768
|
+
};
|
|
769
|
+
for (let i = 0; i < tests.length; i++) {
|
|
770
|
+
const test = tests[i];
|
|
771
|
+
test(args, panicOnce, function finishTestRun(err) {
|
|
772
|
+
if (err) {
|
|
773
|
+
Array.isArray(err) ? nestedErrors.push(...err) : nestedErrors.push(err);
|
|
774
|
+
}
|
|
775
|
+
if (--count <= 0) {
|
|
776
|
+
nextOnce(nestedErrors);
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
asNestedTest({
|
|
782
|
+
key,
|
|
783
|
+
index,
|
|
784
|
+
parent,
|
|
785
|
+
parentPath,
|
|
786
|
+
originalParent,
|
|
787
|
+
options
|
|
788
|
+
}) {
|
|
789
|
+
const k = key != null ? key : index;
|
|
790
|
+
if (k == null) {
|
|
791
|
+
throw TypeError("Must include `key` or `index` for nested validations");
|
|
792
|
+
}
|
|
793
|
+
const isIndex = typeof k === "number";
|
|
794
|
+
let value = parent[k];
|
|
795
|
+
const testOptions = Object.assign({}, options, {
|
|
796
|
+
// Nested validations fields are always strict:
|
|
797
|
+
// 1. parent isn't strict so the casting will also have cast inner values
|
|
798
|
+
// 2. parent is strict in which case the nested values weren't cast either
|
|
799
|
+
strict: true,
|
|
800
|
+
parent,
|
|
801
|
+
value,
|
|
802
|
+
originalValue: originalParent[k],
|
|
803
|
+
// FIXME: tests depend on `index` being passed around deeply,
|
|
804
|
+
// we should not let the options.key/index bleed through
|
|
805
|
+
key: void 0,
|
|
806
|
+
// index: undefined,
|
|
807
|
+
[isIndex ? "index" : "key"]: k,
|
|
808
|
+
path: isIndex || k.includes(".") ? `${parentPath || ""}[${isIndex ? k : `"${k}"`}]` : (parentPath ? `${parentPath}.` : "") + key
|
|
809
|
+
});
|
|
810
|
+
return (_, panic, next) => this.resolve(testOptions)._validate(value, testOptions, panic, next);
|
|
811
|
+
}
|
|
812
|
+
validate(value, options) {
|
|
813
|
+
var _options$disableStack2;
|
|
814
|
+
let schema = this.resolve(Object.assign({}, options, {
|
|
815
|
+
value
|
|
816
|
+
}));
|
|
817
|
+
let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema.spec.disableStackTrace;
|
|
818
|
+
return new Promise((resolve, reject) => schema._validate(value, options, (error, parsed) => {
|
|
819
|
+
if (ValidationError.isError(error)) error.value = parsed;
|
|
820
|
+
reject(error);
|
|
821
|
+
}, (errors, validated) => {
|
|
822
|
+
if (errors.length) reject(new ValidationError(errors, validated, void 0, void 0, disableStackTrace));
|
|
823
|
+
else resolve(validated);
|
|
824
|
+
}));
|
|
825
|
+
}
|
|
826
|
+
validateSync(value, options) {
|
|
827
|
+
var _options$disableStack3;
|
|
828
|
+
let schema = this.resolve(Object.assign({}, options, {
|
|
829
|
+
value
|
|
830
|
+
}));
|
|
831
|
+
let result;
|
|
832
|
+
let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema.spec.disableStackTrace;
|
|
833
|
+
schema._validate(value, Object.assign({}, options, {
|
|
834
|
+
sync: true
|
|
835
|
+
}), (error, parsed) => {
|
|
836
|
+
if (ValidationError.isError(error)) error.value = parsed;
|
|
837
|
+
throw error;
|
|
838
|
+
}, (errors, validated) => {
|
|
839
|
+
if (errors.length) throw new ValidationError(errors, value, void 0, void 0, disableStackTrace);
|
|
840
|
+
result = validated;
|
|
841
|
+
});
|
|
842
|
+
return result;
|
|
843
|
+
}
|
|
844
|
+
isValid(value, options) {
|
|
845
|
+
return this.validate(value, options).then(() => true, (err) => {
|
|
846
|
+
if (ValidationError.isError(err)) return false;
|
|
847
|
+
throw err;
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
isValidSync(value, options) {
|
|
851
|
+
try {
|
|
852
|
+
this.validateSync(value, options);
|
|
853
|
+
return true;
|
|
854
|
+
} catch (err) {
|
|
855
|
+
if (ValidationError.isError(err)) return false;
|
|
856
|
+
throw err;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
_getDefault(options) {
|
|
860
|
+
let defaultValue = this.spec.default;
|
|
861
|
+
if (defaultValue == null) {
|
|
862
|
+
return defaultValue;
|
|
863
|
+
}
|
|
864
|
+
return typeof defaultValue === "function" ? defaultValue.call(this, options) : clone(defaultValue);
|
|
865
|
+
}
|
|
866
|
+
getDefault(options) {
|
|
867
|
+
let schema = this.resolve(options || {});
|
|
868
|
+
return schema._getDefault(options);
|
|
869
|
+
}
|
|
870
|
+
default(def) {
|
|
871
|
+
if (arguments.length === 0) {
|
|
872
|
+
return this._getDefault();
|
|
873
|
+
}
|
|
874
|
+
let next = this.clone({
|
|
875
|
+
default: def
|
|
876
|
+
});
|
|
877
|
+
return next;
|
|
878
|
+
}
|
|
879
|
+
strict(isStrict = true) {
|
|
880
|
+
return this.clone({
|
|
881
|
+
strict: isStrict
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
nullability(nullable, message) {
|
|
885
|
+
const next = this.clone({
|
|
886
|
+
nullable
|
|
887
|
+
});
|
|
888
|
+
next.internalTests.nullable = createValidation({
|
|
889
|
+
message,
|
|
890
|
+
name: "nullable",
|
|
891
|
+
test(value) {
|
|
892
|
+
return value === null ? this.schema.spec.nullable : true;
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
return next;
|
|
896
|
+
}
|
|
897
|
+
optionality(optional, message) {
|
|
898
|
+
const next = this.clone({
|
|
899
|
+
optional
|
|
900
|
+
});
|
|
901
|
+
next.internalTests.optionality = createValidation({
|
|
902
|
+
message,
|
|
903
|
+
name: "optionality",
|
|
904
|
+
test(value) {
|
|
905
|
+
return value === void 0 ? this.schema.spec.optional : true;
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
return next;
|
|
909
|
+
}
|
|
910
|
+
optional() {
|
|
911
|
+
return this.optionality(true);
|
|
912
|
+
}
|
|
913
|
+
defined(message = mixed.defined) {
|
|
914
|
+
return this.optionality(false, message);
|
|
915
|
+
}
|
|
916
|
+
nullable() {
|
|
917
|
+
return this.nullability(true);
|
|
918
|
+
}
|
|
919
|
+
nonNullable(message = mixed.notNull) {
|
|
920
|
+
return this.nullability(false, message);
|
|
921
|
+
}
|
|
922
|
+
required(message = mixed.required) {
|
|
923
|
+
return this.clone().withMutation((next) => next.nonNullable(message).defined(message));
|
|
924
|
+
}
|
|
925
|
+
notRequired() {
|
|
926
|
+
return this.clone().withMutation((next) => next.nullable().optional());
|
|
927
|
+
}
|
|
928
|
+
transform(fn) {
|
|
929
|
+
let next = this.clone();
|
|
930
|
+
next.transforms.push(fn);
|
|
931
|
+
return next;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Adds a test function to the schema's queue of tests.
|
|
935
|
+
* tests can be exclusive or non-exclusive.
|
|
936
|
+
*
|
|
937
|
+
* - exclusive tests, will replace any existing tests of the same name.
|
|
938
|
+
* - non-exclusive: can be stacked
|
|
939
|
+
*
|
|
940
|
+
* If a non-exclusive test is added to a schema with an exclusive test of the same name
|
|
941
|
+
* the exclusive test is removed and further tests of the same name will be stacked.
|
|
942
|
+
*
|
|
943
|
+
* If an exclusive test is added to a schema with non-exclusive tests of the same name
|
|
944
|
+
* the previous tests are removed and further tests of the same name will replace each other.
|
|
945
|
+
*/
|
|
946
|
+
test(...args) {
|
|
947
|
+
let opts;
|
|
948
|
+
if (args.length === 1) {
|
|
949
|
+
if (typeof args[0] === "function") {
|
|
950
|
+
opts = {
|
|
951
|
+
test: args[0]
|
|
952
|
+
};
|
|
953
|
+
} else {
|
|
954
|
+
opts = args[0];
|
|
955
|
+
}
|
|
956
|
+
} else if (args.length === 2) {
|
|
957
|
+
opts = {
|
|
958
|
+
name: args[0],
|
|
959
|
+
test: args[1]
|
|
960
|
+
};
|
|
961
|
+
} else {
|
|
962
|
+
opts = {
|
|
963
|
+
name: args[0],
|
|
964
|
+
message: args[1],
|
|
965
|
+
test: args[2]
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
if (opts.message === void 0) opts.message = mixed.default;
|
|
969
|
+
if (typeof opts.test !== "function") throw new TypeError("`test` is a required parameters");
|
|
970
|
+
let next = this.clone();
|
|
971
|
+
let validate = createValidation(opts);
|
|
972
|
+
let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
|
|
973
|
+
if (opts.exclusive) {
|
|
974
|
+
if (!opts.name) throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
|
|
975
|
+
}
|
|
976
|
+
if (opts.name) next.exclusiveTests[opts.name] = !!opts.exclusive;
|
|
977
|
+
next.tests = next.tests.filter((fn) => {
|
|
978
|
+
if (fn.OPTIONS.name === opts.name) {
|
|
979
|
+
if (isExclusive) return false;
|
|
980
|
+
if (fn.OPTIONS.test === validate.OPTIONS.test) return false;
|
|
981
|
+
}
|
|
982
|
+
return true;
|
|
983
|
+
});
|
|
984
|
+
next.tests.push(validate);
|
|
985
|
+
return next;
|
|
986
|
+
}
|
|
987
|
+
when(keys, options) {
|
|
988
|
+
if (!Array.isArray(keys) && typeof keys !== "string") {
|
|
989
|
+
options = keys;
|
|
990
|
+
keys = ".";
|
|
991
|
+
}
|
|
992
|
+
let next = this.clone();
|
|
993
|
+
let deps = toArray(keys).map((key) => new Reference(key));
|
|
994
|
+
deps.forEach((dep) => {
|
|
995
|
+
if (dep.isSibling) next.deps.push(dep.key);
|
|
996
|
+
});
|
|
997
|
+
next.conditions.push(typeof options === "function" ? new Condition(deps, options) : Condition.fromOptions(deps, options));
|
|
998
|
+
return next;
|
|
999
|
+
}
|
|
1000
|
+
typeError(message) {
|
|
1001
|
+
let next = this.clone();
|
|
1002
|
+
next.internalTests.typeError = createValidation({
|
|
1003
|
+
message,
|
|
1004
|
+
name: "typeError",
|
|
1005
|
+
skipAbsent: true,
|
|
1006
|
+
test(value) {
|
|
1007
|
+
if (!this.schema._typeCheck(value)) return this.createError({
|
|
1008
|
+
params: {
|
|
1009
|
+
type: this.schema.type
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
return true;
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
return next;
|
|
1016
|
+
}
|
|
1017
|
+
oneOf(enums, message = mixed.oneOf) {
|
|
1018
|
+
let next = this.clone();
|
|
1019
|
+
enums.forEach((val) => {
|
|
1020
|
+
next._whitelist.add(val);
|
|
1021
|
+
next._blacklist.delete(val);
|
|
1022
|
+
});
|
|
1023
|
+
next.internalTests.whiteList = createValidation({
|
|
1024
|
+
message,
|
|
1025
|
+
name: "oneOf",
|
|
1026
|
+
skipAbsent: true,
|
|
1027
|
+
test(value) {
|
|
1028
|
+
let valids = this.schema._whitelist;
|
|
1029
|
+
let resolved = valids.resolveAll(this.resolve);
|
|
1030
|
+
return resolved.includes(value) ? true : this.createError({
|
|
1031
|
+
params: {
|
|
1032
|
+
values: Array.from(valids).join(", "),
|
|
1033
|
+
resolved
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
});
|
|
1038
|
+
return next;
|
|
1039
|
+
}
|
|
1040
|
+
notOneOf(enums, message = mixed.notOneOf) {
|
|
1041
|
+
let next = this.clone();
|
|
1042
|
+
enums.forEach((val) => {
|
|
1043
|
+
next._blacklist.add(val);
|
|
1044
|
+
next._whitelist.delete(val);
|
|
1045
|
+
});
|
|
1046
|
+
next.internalTests.blacklist = createValidation({
|
|
1047
|
+
message,
|
|
1048
|
+
name: "notOneOf",
|
|
1049
|
+
test(value) {
|
|
1050
|
+
let invalids = this.schema._blacklist;
|
|
1051
|
+
let resolved = invalids.resolveAll(this.resolve);
|
|
1052
|
+
if (resolved.includes(value)) return this.createError({
|
|
1053
|
+
params: {
|
|
1054
|
+
values: Array.from(invalids).join(", "),
|
|
1055
|
+
resolved
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
return true;
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
return next;
|
|
1062
|
+
}
|
|
1063
|
+
strip(strip = true) {
|
|
1064
|
+
let next = this.clone();
|
|
1065
|
+
next.spec.strip = strip;
|
|
1066
|
+
return next;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Return a serialized description of the schema including validations, flags, types etc.
|
|
1070
|
+
*
|
|
1071
|
+
* @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).
|
|
1072
|
+
*/
|
|
1073
|
+
describe(options) {
|
|
1074
|
+
const next = (options ? this.resolve(options) : this).clone();
|
|
1075
|
+
const {
|
|
1076
|
+
label,
|
|
1077
|
+
meta,
|
|
1078
|
+
optional,
|
|
1079
|
+
nullable
|
|
1080
|
+
} = next.spec;
|
|
1081
|
+
const description = {
|
|
1082
|
+
meta,
|
|
1083
|
+
label,
|
|
1084
|
+
optional,
|
|
1085
|
+
nullable,
|
|
1086
|
+
default: next.getDefault(options),
|
|
1087
|
+
type: next.type,
|
|
1088
|
+
oneOf: next._whitelist.describe(),
|
|
1089
|
+
notOneOf: next._blacklist.describe(),
|
|
1090
|
+
tests: next.tests.filter((n, idx, list) => list.findIndex((c) => c.OPTIONS.name === n.OPTIONS.name) === idx).map((fn) => {
|
|
1091
|
+
const params = fn.OPTIONS.params && options ? resolveParams(Object.assign({}, fn.OPTIONS.params), options) : fn.OPTIONS.params;
|
|
1092
|
+
return {
|
|
1093
|
+
name: fn.OPTIONS.name,
|
|
1094
|
+
params
|
|
1095
|
+
};
|
|
1096
|
+
})
|
|
1097
|
+
};
|
|
1098
|
+
return description;
|
|
1099
|
+
}
|
|
1100
|
+
get ["~standard"]() {
|
|
1101
|
+
const schema = this;
|
|
1102
|
+
const standard = {
|
|
1103
|
+
version: 1,
|
|
1104
|
+
vendor: "yup",
|
|
1105
|
+
async validate(value) {
|
|
1106
|
+
try {
|
|
1107
|
+
const result = await schema.validate(value, {
|
|
1108
|
+
abortEarly: false
|
|
1109
|
+
});
|
|
1110
|
+
return {
|
|
1111
|
+
value: result
|
|
1112
|
+
};
|
|
1113
|
+
} catch (err) {
|
|
1114
|
+
if (err instanceof ValidationError) {
|
|
1115
|
+
return {
|
|
1116
|
+
issues: issuesFromValidationError(err)
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
throw err;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
return standard;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
Schema.prototype.__isYupSchema__ = true;
|
|
1127
|
+
for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At`] = function(path, value, options = {}) {
|
|
1128
|
+
const {
|
|
1129
|
+
parent,
|
|
1130
|
+
parentPath,
|
|
1131
|
+
schema
|
|
1132
|
+
} = getIn(this, path, value, options.context);
|
|
1133
|
+
return schema[method](parent && parent[parentPath], Object.assign({}, options, {
|
|
1134
|
+
parent,
|
|
1135
|
+
path
|
|
1136
|
+
}));
|
|
1137
|
+
};
|
|
1138
|
+
for (const alias of ["equals", "is"]) Schema.prototype[alias] = Schema.prototype.oneOf;
|
|
1139
|
+
for (const alias of ["not", "nope"]) Schema.prototype[alias] = Schema.prototype.notOneOf;
|
|
1140
|
+
function create$7() {
|
|
1141
|
+
return new BooleanSchema();
|
|
1142
|
+
}
|
|
1143
|
+
class BooleanSchema extends Schema {
|
|
1144
|
+
constructor() {
|
|
1145
|
+
super({
|
|
1146
|
+
type: "boolean",
|
|
1147
|
+
check(v) {
|
|
1148
|
+
if (v instanceof Boolean) v = v.valueOf();
|
|
1149
|
+
return typeof v === "boolean";
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
this.withMutation(() => {
|
|
1153
|
+
this.transform((value, _raw) => {
|
|
1154
|
+
if (this.spec.coerce && !this.isType(value)) {
|
|
1155
|
+
if (/^(true|1)$/i.test(String(value))) return true;
|
|
1156
|
+
if (/^(false|0)$/i.test(String(value))) return false;
|
|
1157
|
+
}
|
|
1158
|
+
return value;
|
|
1159
|
+
});
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
isTrue(message = boolean.isValue) {
|
|
1163
|
+
return this.test({
|
|
1164
|
+
message,
|
|
1165
|
+
name: "is-value",
|
|
1166
|
+
exclusive: true,
|
|
1167
|
+
params: {
|
|
1168
|
+
value: "true"
|
|
1169
|
+
},
|
|
1170
|
+
test(value) {
|
|
1171
|
+
return isAbsent(value) || value === true;
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
isFalse(message = boolean.isValue) {
|
|
1176
|
+
return this.test({
|
|
1177
|
+
message,
|
|
1178
|
+
name: "is-value",
|
|
1179
|
+
exclusive: true,
|
|
1180
|
+
params: {
|
|
1181
|
+
value: "false"
|
|
1182
|
+
},
|
|
1183
|
+
test(value) {
|
|
1184
|
+
return isAbsent(value) || value === false;
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
default(def) {
|
|
1189
|
+
return super.default(def);
|
|
1190
|
+
}
|
|
1191
|
+
defined(msg) {
|
|
1192
|
+
return super.defined(msg);
|
|
1193
|
+
}
|
|
1194
|
+
optional() {
|
|
1195
|
+
return super.optional();
|
|
1196
|
+
}
|
|
1197
|
+
required(msg) {
|
|
1198
|
+
return super.required(msg);
|
|
1199
|
+
}
|
|
1200
|
+
notRequired() {
|
|
1201
|
+
return super.notRequired();
|
|
1202
|
+
}
|
|
1203
|
+
nullable() {
|
|
1204
|
+
return super.nullable();
|
|
1205
|
+
}
|
|
1206
|
+
nonNullable(msg) {
|
|
1207
|
+
return super.nonNullable(msg);
|
|
1208
|
+
}
|
|
1209
|
+
strip(v) {
|
|
1210
|
+
return super.strip(v);
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
create$7.prototype = BooleanSchema.prototype;
|
|
1214
|
+
const isoReg = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
|
|
1215
|
+
function parseIsoDate(date2) {
|
|
1216
|
+
const struct = parseDateStruct(date2);
|
|
1217
|
+
if (!struct) return Date.parse ? Date.parse(date2) : Number.NaN;
|
|
1218
|
+
if (struct.z === void 0 && struct.plusMinus === void 0) {
|
|
1219
|
+
return new Date(struct.year, struct.month, struct.day, struct.hour, struct.minute, struct.second, struct.millisecond).valueOf();
|
|
1220
|
+
}
|
|
1221
|
+
let totalMinutesOffset = 0;
|
|
1222
|
+
if (struct.z !== "Z" && struct.plusMinus !== void 0) {
|
|
1223
|
+
totalMinutesOffset = struct.hourOffset * 60 + struct.minuteOffset;
|
|
1224
|
+
if (struct.plusMinus === "+") totalMinutesOffset = 0 - totalMinutesOffset;
|
|
1225
|
+
}
|
|
1226
|
+
return Date.UTC(struct.year, struct.month, struct.day, struct.hour, struct.minute + totalMinutesOffset, struct.second, struct.millisecond);
|
|
1227
|
+
}
|
|
1228
|
+
function parseDateStruct(date2) {
|
|
1229
|
+
var _regexResult$7$length, _regexResult$;
|
|
1230
|
+
const regexResult = isoReg.exec(date2);
|
|
1231
|
+
if (!regexResult) return null;
|
|
1232
|
+
return {
|
|
1233
|
+
year: toNumber(regexResult[1]),
|
|
1234
|
+
month: toNumber(regexResult[2], 1) - 1,
|
|
1235
|
+
day: toNumber(regexResult[3], 1),
|
|
1236
|
+
hour: toNumber(regexResult[4]),
|
|
1237
|
+
minute: toNumber(regexResult[5]),
|
|
1238
|
+
second: toNumber(regexResult[6]),
|
|
1239
|
+
millisecond: regexResult[7] ? (
|
|
1240
|
+
// allow arbitrary sub-second precision beyond milliseconds
|
|
1241
|
+
toNumber(regexResult[7].substring(0, 3))
|
|
1242
|
+
) : 0,
|
|
1243
|
+
precision: (_regexResult$7$length = (_regexResult$ = regexResult[7]) == null ? void 0 : _regexResult$.length) != null ? _regexResult$7$length : void 0,
|
|
1244
|
+
z: regexResult[8] || void 0,
|
|
1245
|
+
plusMinus: regexResult[9] || void 0,
|
|
1246
|
+
hourOffset: toNumber(regexResult[10]),
|
|
1247
|
+
minuteOffset: toNumber(regexResult[11])
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
function toNumber(str, defaultValue = 0) {
|
|
1251
|
+
return Number(str) || defaultValue;
|
|
1252
|
+
}
|
|
1253
|
+
let rEmail = (
|
|
1254
|
+
// eslint-disable-next-line
|
|
1255
|
+
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
|
|
1256
|
+
);
|
|
1257
|
+
let rUrl = (
|
|
1258
|
+
// eslint-disable-next-line
|
|
1259
|
+
/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
|
|
1260
|
+
);
|
|
1261
|
+
let rUUID = /^(?:[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;
|
|
1262
|
+
let yearMonthDay = "^\\d{4}-\\d{2}-\\d{2}";
|
|
1263
|
+
let hourMinuteSecond = "\\d{2}:\\d{2}:\\d{2}";
|
|
1264
|
+
let zOrOffset = "(([+-]\\d{2}(:?\\d{2})?)|Z)";
|
|
1265
|
+
let rIsoDateTime = new RegExp(`${yearMonthDay}T${hourMinuteSecond}(\\.\\d+)?${zOrOffset}$`);
|
|
1266
|
+
let isTrimmed = (value) => isAbsent(value) || value === value.trim();
|
|
1267
|
+
let objStringTag = {}.toString();
|
|
1268
|
+
function create$6() {
|
|
1269
|
+
return new StringSchema();
|
|
1270
|
+
}
|
|
1271
|
+
class StringSchema extends Schema {
|
|
1272
|
+
constructor() {
|
|
1273
|
+
super({
|
|
1274
|
+
type: "string",
|
|
1275
|
+
check(value) {
|
|
1276
|
+
if (value instanceof String) value = value.valueOf();
|
|
1277
|
+
return typeof value === "string";
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
this.withMutation(() => {
|
|
1281
|
+
this.transform((value, _raw) => {
|
|
1282
|
+
if (!this.spec.coerce || this.isType(value)) return value;
|
|
1283
|
+
if (Array.isArray(value)) return value;
|
|
1284
|
+
const strValue = value != null && value.toString ? value.toString() : value;
|
|
1285
|
+
if (strValue === objStringTag) return value;
|
|
1286
|
+
return strValue;
|
|
1287
|
+
});
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
required(message) {
|
|
1291
|
+
return super.required(message).withMutation((schema) => schema.test({
|
|
1292
|
+
message: message || mixed.required,
|
|
1293
|
+
name: "required",
|
|
1294
|
+
skipAbsent: true,
|
|
1295
|
+
test: (value) => !!value.length
|
|
1296
|
+
}));
|
|
1297
|
+
}
|
|
1298
|
+
notRequired() {
|
|
1299
|
+
return super.notRequired().withMutation((schema) => {
|
|
1300
|
+
schema.tests = schema.tests.filter((t) => t.OPTIONS.name !== "required");
|
|
1301
|
+
return schema;
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
length(length, message = string.length) {
|
|
1305
|
+
return this.test({
|
|
1306
|
+
message,
|
|
1307
|
+
name: "length",
|
|
1308
|
+
exclusive: true,
|
|
1309
|
+
params: {
|
|
1310
|
+
length
|
|
1311
|
+
},
|
|
1312
|
+
skipAbsent: true,
|
|
1313
|
+
test(value) {
|
|
1314
|
+
return value.length === this.resolve(length);
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
min(min, message = string.min) {
|
|
1319
|
+
return this.test({
|
|
1320
|
+
message,
|
|
1321
|
+
name: "min",
|
|
1322
|
+
exclusive: true,
|
|
1323
|
+
params: {
|
|
1324
|
+
min
|
|
1325
|
+
},
|
|
1326
|
+
skipAbsent: true,
|
|
1327
|
+
test(value) {
|
|
1328
|
+
return value.length >= this.resolve(min);
|
|
1329
|
+
}
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
max(max, message = string.max) {
|
|
1333
|
+
return this.test({
|
|
1334
|
+
name: "max",
|
|
1335
|
+
exclusive: true,
|
|
1336
|
+
message,
|
|
1337
|
+
params: {
|
|
1338
|
+
max
|
|
1339
|
+
},
|
|
1340
|
+
skipAbsent: true,
|
|
1341
|
+
test(value) {
|
|
1342
|
+
return value.length <= this.resolve(max);
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
matches(regex, options) {
|
|
1347
|
+
let excludeEmptyString = false;
|
|
1348
|
+
let message;
|
|
1349
|
+
let name;
|
|
1350
|
+
if (options) {
|
|
1351
|
+
if (typeof options === "object") {
|
|
1352
|
+
({
|
|
1353
|
+
excludeEmptyString = false,
|
|
1354
|
+
message,
|
|
1355
|
+
name
|
|
1356
|
+
} = options);
|
|
1357
|
+
} else {
|
|
1358
|
+
message = options;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
return this.test({
|
|
1362
|
+
name: name || "matches",
|
|
1363
|
+
message: message || string.matches,
|
|
1364
|
+
params: {
|
|
1365
|
+
regex
|
|
1366
|
+
},
|
|
1367
|
+
skipAbsent: true,
|
|
1368
|
+
test: (value) => value === "" && excludeEmptyString || value.search(regex) !== -1
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1371
|
+
email(message = string.email) {
|
|
1372
|
+
return this.matches(rEmail, {
|
|
1373
|
+
name: "email",
|
|
1374
|
+
message,
|
|
1375
|
+
excludeEmptyString: true
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
url(message = string.url) {
|
|
1379
|
+
return this.matches(rUrl, {
|
|
1380
|
+
name: "url",
|
|
1381
|
+
message,
|
|
1382
|
+
excludeEmptyString: true
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
uuid(message = string.uuid) {
|
|
1386
|
+
return this.matches(rUUID, {
|
|
1387
|
+
name: "uuid",
|
|
1388
|
+
message,
|
|
1389
|
+
excludeEmptyString: false
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
datetime(options) {
|
|
1393
|
+
let message = "";
|
|
1394
|
+
let allowOffset;
|
|
1395
|
+
let precision;
|
|
1396
|
+
if (options) {
|
|
1397
|
+
if (typeof options === "object") {
|
|
1398
|
+
({
|
|
1399
|
+
message = "",
|
|
1400
|
+
allowOffset = false,
|
|
1401
|
+
precision = void 0
|
|
1402
|
+
} = options);
|
|
1403
|
+
} else {
|
|
1404
|
+
message = options;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
return this.matches(rIsoDateTime, {
|
|
1408
|
+
name: "datetime",
|
|
1409
|
+
message: message || string.datetime,
|
|
1410
|
+
excludeEmptyString: true
|
|
1411
|
+
}).test({
|
|
1412
|
+
name: "datetime_offset",
|
|
1413
|
+
message: message || string.datetime_offset,
|
|
1414
|
+
params: {
|
|
1415
|
+
allowOffset
|
|
1416
|
+
},
|
|
1417
|
+
skipAbsent: true,
|
|
1418
|
+
test: (value) => {
|
|
1419
|
+
if (!value || allowOffset) return true;
|
|
1420
|
+
const struct = parseDateStruct(value);
|
|
1421
|
+
if (!struct) return false;
|
|
1422
|
+
return !!struct.z;
|
|
1423
|
+
}
|
|
1424
|
+
}).test({
|
|
1425
|
+
name: "datetime_precision",
|
|
1426
|
+
message: message || string.datetime_precision,
|
|
1427
|
+
params: {
|
|
1428
|
+
precision
|
|
1429
|
+
},
|
|
1430
|
+
skipAbsent: true,
|
|
1431
|
+
test: (value) => {
|
|
1432
|
+
if (!value || precision == void 0) return true;
|
|
1433
|
+
const struct = parseDateStruct(value);
|
|
1434
|
+
if (!struct) return false;
|
|
1435
|
+
return struct.precision === precision;
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
//-- transforms --
|
|
1440
|
+
ensure() {
|
|
1441
|
+
return this.default("").transform((val) => val === null ? "" : val);
|
|
1442
|
+
}
|
|
1443
|
+
trim(message = string.trim) {
|
|
1444
|
+
return this.transform((val) => val != null ? val.trim() : val).test({
|
|
1445
|
+
message,
|
|
1446
|
+
name: "trim",
|
|
1447
|
+
test: isTrimmed
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
lowercase(message = string.lowercase) {
|
|
1451
|
+
return this.transform((value) => !isAbsent(value) ? value.toLowerCase() : value).test({
|
|
1452
|
+
message,
|
|
1453
|
+
name: "string_case",
|
|
1454
|
+
exclusive: true,
|
|
1455
|
+
skipAbsent: true,
|
|
1456
|
+
test: (value) => isAbsent(value) || value === value.toLowerCase()
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
uppercase(message = string.uppercase) {
|
|
1460
|
+
return this.transform((value) => !isAbsent(value) ? value.toUpperCase() : value).test({
|
|
1461
|
+
message,
|
|
1462
|
+
name: "string_case",
|
|
1463
|
+
exclusive: true,
|
|
1464
|
+
skipAbsent: true,
|
|
1465
|
+
test: (value) => isAbsent(value) || value === value.toUpperCase()
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
create$6.prototype = StringSchema.prototype;
|
|
1470
|
+
let invalidDate = /* @__PURE__ */ new Date("");
|
|
1471
|
+
let isDate = (obj) => Object.prototype.toString.call(obj) === "[object Date]";
|
|
1472
|
+
class DateSchema extends Schema {
|
|
1473
|
+
constructor() {
|
|
1474
|
+
super({
|
|
1475
|
+
type: "date",
|
|
1476
|
+
check(v) {
|
|
1477
|
+
return isDate(v) && !isNaN(v.getTime());
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
this.withMutation(() => {
|
|
1481
|
+
this.transform((value, _raw) => {
|
|
1482
|
+
if (!this.spec.coerce || this.isType(value) || value === null) return value;
|
|
1483
|
+
value = parseIsoDate(value);
|
|
1484
|
+
return !isNaN(value) ? new Date(value) : DateSchema.INVALID_DATE;
|
|
1485
|
+
});
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
prepareParam(ref, name) {
|
|
1489
|
+
let param;
|
|
1490
|
+
if (!Reference.isRef(ref)) {
|
|
1491
|
+
let cast = this.cast(ref);
|
|
1492
|
+
if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
|
|
1493
|
+
param = cast;
|
|
1494
|
+
} else {
|
|
1495
|
+
param = ref;
|
|
1496
|
+
}
|
|
1497
|
+
return param;
|
|
1498
|
+
}
|
|
1499
|
+
min(min, message = date.min) {
|
|
1500
|
+
let limit = this.prepareParam(min, "min");
|
|
1501
|
+
return this.test({
|
|
1502
|
+
message,
|
|
1503
|
+
name: "min",
|
|
1504
|
+
exclusive: true,
|
|
1505
|
+
params: {
|
|
1506
|
+
min
|
|
1507
|
+
},
|
|
1508
|
+
skipAbsent: true,
|
|
1509
|
+
test(value) {
|
|
1510
|
+
return value >= this.resolve(limit);
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
max(max, message = date.max) {
|
|
1515
|
+
let limit = this.prepareParam(max, "max");
|
|
1516
|
+
return this.test({
|
|
1517
|
+
message,
|
|
1518
|
+
name: "max",
|
|
1519
|
+
exclusive: true,
|
|
1520
|
+
params: {
|
|
1521
|
+
max
|
|
1522
|
+
},
|
|
1523
|
+
skipAbsent: true,
|
|
1524
|
+
test(value) {
|
|
1525
|
+
return value <= this.resolve(limit);
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
DateSchema.INVALID_DATE = invalidDate;
|
|
1531
|
+
function sortFields(fields, excludedEdges = []) {
|
|
1532
|
+
let edges = [];
|
|
1533
|
+
let nodes = /* @__PURE__ */ new Set();
|
|
1534
|
+
let excludes = new Set(excludedEdges.map(([a, b]) => `${a}-${b}`));
|
|
1535
|
+
function addNode(depPath, key) {
|
|
1536
|
+
let node = propertyExprExports.split(depPath)[0];
|
|
1537
|
+
nodes.add(node);
|
|
1538
|
+
if (!excludes.has(`${key}-${node}`)) edges.push([key, node]);
|
|
1539
|
+
}
|
|
1540
|
+
for (const key of Object.keys(fields)) {
|
|
1541
|
+
let value = fields[key];
|
|
1542
|
+
nodes.add(key);
|
|
1543
|
+
if (Reference.isRef(value) && value.isSibling) addNode(value.path, key);
|
|
1544
|
+
else if (isSchema(value) && "deps" in value) value.deps.forEach((path) => addNode(path, key));
|
|
1545
|
+
}
|
|
1546
|
+
return toposort.array(Array.from(nodes), edges).reverse();
|
|
1547
|
+
}
|
|
1548
|
+
function findIndex(arr, err) {
|
|
1549
|
+
let idx = Infinity;
|
|
1550
|
+
arr.some((key, ii) => {
|
|
1551
|
+
var _err$path;
|
|
1552
|
+
if ((_err$path = err.path) != null && _err$path.includes(key)) {
|
|
1553
|
+
idx = ii;
|
|
1554
|
+
return true;
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
return idx;
|
|
1558
|
+
}
|
|
1559
|
+
function sortByKeyOrder(keys) {
|
|
1560
|
+
return (a, b) => {
|
|
1561
|
+
return findIndex(keys, a) - findIndex(keys, b);
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
const parseJson = (value, _, schema) => {
|
|
1565
|
+
if (typeof value !== "string") {
|
|
1566
|
+
return value;
|
|
1567
|
+
}
|
|
1568
|
+
let parsed = value;
|
|
1569
|
+
try {
|
|
1570
|
+
parsed = JSON.parse(value);
|
|
1571
|
+
} catch (err) {
|
|
1572
|
+
}
|
|
1573
|
+
return schema.isType(parsed) ? parsed : value;
|
|
1574
|
+
};
|
|
1575
|
+
function deepPartial(schema) {
|
|
1576
|
+
if ("fields" in schema) {
|
|
1577
|
+
const partial = {};
|
|
1578
|
+
for (const [key, fieldSchema] of Object.entries(schema.fields)) {
|
|
1579
|
+
partial[key] = deepPartial(fieldSchema);
|
|
1580
|
+
}
|
|
1581
|
+
return schema.setFields(partial);
|
|
1582
|
+
}
|
|
1583
|
+
if (schema.type === "array") {
|
|
1584
|
+
const nextArray = schema.optional();
|
|
1585
|
+
if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
|
|
1586
|
+
return nextArray;
|
|
1587
|
+
}
|
|
1588
|
+
if (schema.type === "tuple") {
|
|
1589
|
+
return schema.optional().clone({
|
|
1590
|
+
types: schema.spec.types.map(deepPartial)
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
if ("optional" in schema) {
|
|
1594
|
+
return schema.optional();
|
|
1595
|
+
}
|
|
1596
|
+
return schema;
|
|
1597
|
+
}
|
|
1598
|
+
const deepHas = (obj, p) => {
|
|
1599
|
+
const path = [...propertyExprExports.normalizePath(p)];
|
|
1600
|
+
if (path.length === 1) return path[0] in obj;
|
|
1601
|
+
let last = path.pop();
|
|
1602
|
+
let parent = propertyExprExports.getter(propertyExprExports.join(path), true)(obj);
|
|
1603
|
+
return !!(parent && last in parent);
|
|
1604
|
+
};
|
|
1605
|
+
let isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
|
|
1606
|
+
function unknown(ctx, value) {
|
|
1607
|
+
let known = Object.keys(ctx.fields);
|
|
1608
|
+
return Object.keys(value).filter((key) => known.indexOf(key) === -1);
|
|
1609
|
+
}
|
|
1610
|
+
const defaultSort = sortByKeyOrder([]);
|
|
1611
|
+
function create$3(spec) {
|
|
1612
|
+
return new ObjectSchema(spec);
|
|
1613
|
+
}
|
|
1614
|
+
class ObjectSchema extends Schema {
|
|
1615
|
+
constructor(spec) {
|
|
1616
|
+
super({
|
|
1617
|
+
type: "object",
|
|
1618
|
+
check(value) {
|
|
1619
|
+
return isObject(value) || typeof value === "function";
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
this.fields = /* @__PURE__ */ Object.create(null);
|
|
1623
|
+
this._sortErrors = defaultSort;
|
|
1624
|
+
this._nodes = [];
|
|
1625
|
+
this._excludedEdges = [];
|
|
1626
|
+
this.withMutation(() => {
|
|
1627
|
+
if (spec) {
|
|
1628
|
+
this.shape(spec);
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
_cast(_value, options = {}) {
|
|
1633
|
+
var _options$stripUnknown;
|
|
1634
|
+
let value = super._cast(_value, options);
|
|
1635
|
+
if (value === void 0) return this.getDefault(options);
|
|
1636
|
+
if (!this._typeCheck(value)) return value;
|
|
1637
|
+
let fields = this.fields;
|
|
1638
|
+
let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
|
|
1639
|
+
let props = [].concat(this._nodes, Object.keys(value).filter((v) => !this._nodes.includes(v)));
|
|
1640
|
+
let intermediateValue = {};
|
|
1641
|
+
let innerOptions = Object.assign({}, options, {
|
|
1642
|
+
parent: intermediateValue,
|
|
1643
|
+
__validating: options.__validating || false
|
|
1644
|
+
});
|
|
1645
|
+
let isChanged = false;
|
|
1646
|
+
for (const prop of props) {
|
|
1647
|
+
let field = fields[prop];
|
|
1648
|
+
let exists = prop in value;
|
|
1649
|
+
let inputValue = value[prop];
|
|
1650
|
+
if (field) {
|
|
1651
|
+
let fieldValue;
|
|
1652
|
+
innerOptions.path = (options.path ? `${options.path}.` : "") + prop;
|
|
1653
|
+
field = field.resolve({
|
|
1654
|
+
value: inputValue,
|
|
1655
|
+
context: options.context,
|
|
1656
|
+
parent: intermediateValue
|
|
1657
|
+
});
|
|
1658
|
+
let fieldSpec = field instanceof Schema ? field.spec : void 0;
|
|
1659
|
+
let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
|
|
1660
|
+
if (fieldSpec != null && fieldSpec.strip) {
|
|
1661
|
+
isChanged = isChanged || prop in value;
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
fieldValue = !options.__validating || !strict ? field.cast(inputValue, innerOptions) : inputValue;
|
|
1665
|
+
if (fieldValue !== void 0) {
|
|
1666
|
+
intermediateValue[prop] = fieldValue;
|
|
1667
|
+
}
|
|
1668
|
+
} else if (exists && !strip) {
|
|
1669
|
+
intermediateValue[prop] = inputValue;
|
|
1670
|
+
}
|
|
1671
|
+
if (exists !== prop in intermediateValue || intermediateValue[prop] !== inputValue) {
|
|
1672
|
+
isChanged = true;
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
return isChanged ? intermediateValue : value;
|
|
1676
|
+
}
|
|
1677
|
+
_validate(_value, options = {}, panic, next) {
|
|
1678
|
+
let {
|
|
1679
|
+
from = [],
|
|
1680
|
+
originalValue = _value,
|
|
1681
|
+
recursive = this.spec.recursive
|
|
1682
|
+
} = options;
|
|
1683
|
+
options.from = [{
|
|
1684
|
+
schema: this,
|
|
1685
|
+
value: originalValue
|
|
1686
|
+
}, ...from];
|
|
1687
|
+
options.__validating = true;
|
|
1688
|
+
options.originalValue = originalValue;
|
|
1689
|
+
super._validate(_value, options, panic, (objectErrors, value) => {
|
|
1690
|
+
if (!recursive || !isObject(value)) {
|
|
1691
|
+
next(objectErrors, value);
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
originalValue = originalValue || value;
|
|
1695
|
+
let tests = [];
|
|
1696
|
+
for (let key of this._nodes) {
|
|
1697
|
+
let field = this.fields[key];
|
|
1698
|
+
if (!field || Reference.isRef(field)) {
|
|
1699
|
+
continue;
|
|
1700
|
+
}
|
|
1701
|
+
tests.push(field.asNestedTest({
|
|
1702
|
+
options,
|
|
1703
|
+
key,
|
|
1704
|
+
parent: value,
|
|
1705
|
+
parentPath: options.path,
|
|
1706
|
+
originalParent: originalValue
|
|
1707
|
+
}));
|
|
1708
|
+
}
|
|
1709
|
+
this.runTests({
|
|
1710
|
+
tests,
|
|
1711
|
+
value,
|
|
1712
|
+
originalValue,
|
|
1713
|
+
options
|
|
1714
|
+
}, panic, (fieldErrors) => {
|
|
1715
|
+
next(fieldErrors.sort(this._sortErrors).concat(objectErrors), value);
|
|
1716
|
+
});
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
clone(spec) {
|
|
1720
|
+
const next = super.clone(spec);
|
|
1721
|
+
next.fields = Object.assign({}, this.fields);
|
|
1722
|
+
next._nodes = this._nodes;
|
|
1723
|
+
next._excludedEdges = this._excludedEdges;
|
|
1724
|
+
next._sortErrors = this._sortErrors;
|
|
1725
|
+
return next;
|
|
1726
|
+
}
|
|
1727
|
+
concat(schema) {
|
|
1728
|
+
let next = super.concat(schema);
|
|
1729
|
+
let nextFields = next.fields;
|
|
1730
|
+
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
|
|
1731
|
+
const target = nextFields[field];
|
|
1732
|
+
nextFields[field] = target === void 0 ? schemaOrRef : target;
|
|
1733
|
+
}
|
|
1734
|
+
return next.withMutation((s) => (
|
|
1735
|
+
// XXX: excludes here is wrong
|
|
1736
|
+
s.setFields(nextFields, [...this._excludedEdges, ...schema._excludedEdges])
|
|
1737
|
+
));
|
|
1738
|
+
}
|
|
1739
|
+
_getDefault(options) {
|
|
1740
|
+
if ("default" in this.spec) {
|
|
1741
|
+
return super._getDefault(options);
|
|
1742
|
+
}
|
|
1743
|
+
if (!this._nodes.length) {
|
|
1744
|
+
return void 0;
|
|
1745
|
+
}
|
|
1746
|
+
let dft = {};
|
|
1747
|
+
this._nodes.forEach((key) => {
|
|
1748
|
+
var _innerOptions;
|
|
1749
|
+
const field = this.fields[key];
|
|
1750
|
+
let innerOptions = options;
|
|
1751
|
+
if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
|
|
1752
|
+
innerOptions = Object.assign({}, innerOptions, {
|
|
1753
|
+
parent: innerOptions.value,
|
|
1754
|
+
value: innerOptions.value[key]
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
dft[key] = field && "getDefault" in field ? field.getDefault(innerOptions) : void 0;
|
|
1758
|
+
});
|
|
1759
|
+
return dft;
|
|
1760
|
+
}
|
|
1761
|
+
setFields(shape, excludedEdges) {
|
|
1762
|
+
let next = this.clone();
|
|
1763
|
+
next.fields = shape;
|
|
1764
|
+
next._nodes = sortFields(shape, excludedEdges);
|
|
1765
|
+
next._sortErrors = sortByKeyOrder(Object.keys(shape));
|
|
1766
|
+
if (excludedEdges) next._excludedEdges = excludedEdges;
|
|
1767
|
+
return next;
|
|
1768
|
+
}
|
|
1769
|
+
shape(additions, excludes = []) {
|
|
1770
|
+
return this.clone().withMutation((next) => {
|
|
1771
|
+
let edges = next._excludedEdges;
|
|
1772
|
+
if (excludes.length) {
|
|
1773
|
+
if (!Array.isArray(excludes[0])) excludes = [excludes];
|
|
1774
|
+
edges = [...next._excludedEdges, ...excludes];
|
|
1775
|
+
}
|
|
1776
|
+
return next.setFields(Object.assign(next.fields, additions), edges);
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
partial() {
|
|
1780
|
+
const partial = {};
|
|
1781
|
+
for (const [key, schema] of Object.entries(this.fields)) {
|
|
1782
|
+
partial[key] = "optional" in schema && schema.optional instanceof Function ? schema.optional() : schema;
|
|
1783
|
+
}
|
|
1784
|
+
return this.setFields(partial);
|
|
1785
|
+
}
|
|
1786
|
+
deepPartial() {
|
|
1787
|
+
const next = deepPartial(this);
|
|
1788
|
+
return next;
|
|
1789
|
+
}
|
|
1790
|
+
pick(keys) {
|
|
1791
|
+
const picked = {};
|
|
1792
|
+
for (const key of keys) {
|
|
1793
|
+
if (this.fields[key]) picked[key] = this.fields[key];
|
|
1794
|
+
}
|
|
1795
|
+
return this.setFields(picked, this._excludedEdges.filter(([a, b]) => keys.includes(a) && keys.includes(b)));
|
|
1796
|
+
}
|
|
1797
|
+
omit(keys) {
|
|
1798
|
+
const remaining = [];
|
|
1799
|
+
for (const key of Object.keys(this.fields)) {
|
|
1800
|
+
if (keys.includes(key)) continue;
|
|
1801
|
+
remaining.push(key);
|
|
1802
|
+
}
|
|
1803
|
+
return this.pick(remaining);
|
|
1804
|
+
}
|
|
1805
|
+
from(from, to, alias) {
|
|
1806
|
+
let fromGetter = propertyExprExports.getter(from, true);
|
|
1807
|
+
return this.transform((obj) => {
|
|
1808
|
+
if (!obj) return obj;
|
|
1809
|
+
let newObj = obj;
|
|
1810
|
+
if (deepHas(obj, from)) {
|
|
1811
|
+
newObj = Object.assign({}, obj);
|
|
1812
|
+
if (!alias) delete newObj[from];
|
|
1813
|
+
newObj[to] = fromGetter(obj);
|
|
1814
|
+
}
|
|
1815
|
+
return newObj;
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
/** Parse an input JSON string to an object */
|
|
1819
|
+
json() {
|
|
1820
|
+
return this.transform(parseJson);
|
|
1821
|
+
}
|
|
1822
|
+
/**
|
|
1823
|
+
* Similar to `noUnknown` but only validates that an object is the right shape without stripping the unknown keys
|
|
1824
|
+
*/
|
|
1825
|
+
exact(message) {
|
|
1826
|
+
return this.test({
|
|
1827
|
+
name: "exact",
|
|
1828
|
+
exclusive: true,
|
|
1829
|
+
message: message || object.exact,
|
|
1830
|
+
test(value) {
|
|
1831
|
+
if (value == null) return true;
|
|
1832
|
+
const unknownKeys = unknown(this.schema, value);
|
|
1833
|
+
return unknownKeys.length === 0 || this.createError({
|
|
1834
|
+
params: {
|
|
1835
|
+
properties: unknownKeys.join(", ")
|
|
1836
|
+
}
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
stripUnknown() {
|
|
1842
|
+
return this.clone({
|
|
1843
|
+
noUnknown: true
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
noUnknown(noAllow = true, message = object.noUnknown) {
|
|
1847
|
+
if (typeof noAllow !== "boolean") {
|
|
1848
|
+
message = noAllow;
|
|
1849
|
+
noAllow = true;
|
|
1850
|
+
}
|
|
1851
|
+
let next = this.test({
|
|
1852
|
+
name: "noUnknown",
|
|
1853
|
+
exclusive: true,
|
|
1854
|
+
message,
|
|
1855
|
+
test(value) {
|
|
1856
|
+
if (value == null) return true;
|
|
1857
|
+
const unknownKeys = unknown(this.schema, value);
|
|
1858
|
+
return !noAllow || unknownKeys.length === 0 || this.createError({
|
|
1859
|
+
params: {
|
|
1860
|
+
unknown: unknownKeys.join(", ")
|
|
1861
|
+
}
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
next.spec.noUnknown = noAllow;
|
|
1866
|
+
return next;
|
|
1867
|
+
}
|
|
1868
|
+
unknown(allow = true, message = object.noUnknown) {
|
|
1869
|
+
return this.noUnknown(!allow, message);
|
|
1870
|
+
}
|
|
1871
|
+
transformKeys(fn) {
|
|
1872
|
+
return this.transform((obj) => {
|
|
1873
|
+
if (!obj) return obj;
|
|
1874
|
+
const result = {};
|
|
1875
|
+
for (const key of Object.keys(obj)) result[fn(key)] = obj[key];
|
|
1876
|
+
return result;
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
camelCase() {
|
|
1880
|
+
return this.transformKeys(tinyCaseExports.camelCase);
|
|
1881
|
+
}
|
|
1882
|
+
snakeCase() {
|
|
1883
|
+
return this.transformKeys(tinyCaseExports.snakeCase);
|
|
1884
|
+
}
|
|
1885
|
+
constantCase() {
|
|
1886
|
+
return this.transformKeys((key) => tinyCaseExports.snakeCase(key).toUpperCase());
|
|
1887
|
+
}
|
|
1888
|
+
describe(options) {
|
|
1889
|
+
const next = (options ? this.resolve(options) : this).clone();
|
|
1890
|
+
const base = super.describe(options);
|
|
1891
|
+
base.fields = {};
|
|
1892
|
+
for (const [key, value] of Object.entries(next.fields)) {
|
|
1893
|
+
var _innerOptions2;
|
|
1894
|
+
let innerOptions = options;
|
|
1895
|
+
if ((_innerOptions2 = innerOptions) != null && _innerOptions2.value) {
|
|
1896
|
+
innerOptions = Object.assign({}, innerOptions, {
|
|
1897
|
+
parent: innerOptions.value,
|
|
1898
|
+
value: innerOptions.value[key]
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
base.fields[key] = value.describe(innerOptions);
|
|
1902
|
+
}
|
|
1903
|
+
return base;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
create$3.prototype = ObjectSchema.prototype;
|
|
1907
|
+
export {
|
|
1908
|
+
BooleanSchema,
|
|
1909
|
+
DateSchema,
|
|
1910
|
+
ObjectSchema,
|
|
1911
|
+
Schema,
|
|
1912
|
+
StringSchema,
|
|
1913
|
+
ValidationError,
|
|
1914
|
+
create$7 as bool,
|
|
1915
|
+
create$7 as boolean,
|
|
1916
|
+
getIn,
|
|
1917
|
+
isSchema,
|
|
1918
|
+
create$3 as object,
|
|
1919
|
+
printValue,
|
|
1920
|
+
create$6 as string
|
|
1921
|
+
};
|