@saas-ui/forms 0.5.0 → 0.6.0-next.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/display-field.tsx","../src/field.tsx","../src/resolvers/yup.ts","../src/layout.tsx","../src/utils.ts","../src/use-array-field.tsx","../src/array-field.tsx","../src/object-field.tsx","../src/fields.tsx","../src/form.tsx","../src/submit-button.tsx","../src/auto-form.tsx","../../../node_modules/@chakra-ui/utils/dist/chakra-ui-utils.esm.js","../../../node_modules/lodash.mergewith/index.js","../../saas-ui-stepper/node_modules/@chakra-ui/utils/dist/chakra-ui-utils.esm.js","../../saas-ui-stepper/dist/index.modern.js","../src/use-step-form.tsx","../src/step-form.tsx","../src/display-if.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useFormContext } from 'react-hook-form'\n\nimport {\n Text,\n FormControl,\n FormControlProps,\n FormLabel,\n} from '@chakra-ui/react'\n\nimport { FieldProps } from './field'\n\nexport interface DisplayFieldProps\n extends FormControlProps,\n Omit<FieldProps, 'type' | 'label'> {}\n\nexport const DisplayField: React.FC<DisplayFieldProps> = ({\n name,\n label,\n placeholder,\n ...props\n}) => {\n return (\n <FormControl {...props}>\n {label ? <FormLabel htmlFor={name}>{label}</FormLabel> : null}\n <Text fontSize=\"md\">\n <FormValue name={name} />\n </Text>\n </FormControl>\n )\n}\n\nexport const FormValue: React.FC<{ name: string }> = ({ name }) => {\n const { getValues } = useFormContext()\n return getValues(name) || null\n}\n","import * as React from 'react'\nimport {\n useFormContext,\n FormState,\n Controller,\n get,\n RegisterOptions,\n FieldValues,\n FieldPath,\n} from 'react-hook-form'\n\nimport {\n forwardRef,\n Box,\n FormControl,\n FormControlProps,\n FormLabel,\n FormHelperText,\n FormErrorMessage,\n Input,\n Textarea,\n Checkbox,\n Switch,\n useMergeRefs,\n} from '@chakra-ui/react'\n\nimport { NumberInput } from '@saas-ui/number-input'\nimport { PasswordInput } from '@saas-ui/password-input'\nimport { RadioInput } from '@saas-ui/radio'\nimport { PinInput } from '@saas-ui/pin-input'\nimport { Select, NativeSelect } from '@saas-ui/select'\n\nexport interface Option {\n value: string\n label?: string\n [key: string]: unknown\n}\n\nexport type FieldRules = Pick<\n RegisterOptions,\n 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'\n>\n\nexport type FieldTypes =\n | 'text'\n | 'number'\n | 'password'\n | 'textarea'\n | 'select'\n | 'native-select'\n | 'checkbox'\n | 'radio'\n | 'switch'\n | 'pin'\n | string\n\nexport interface FieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends Omit<FormControlProps, 'label' | 'type'> {\n /**\n * The field name\n */\n name: TName\n /**\n * The field label\n */\n label?: string\n /**\n * Hide the field label\n */\n hideLabel?: boolean\n /**\n * Field help text\n */\n help?: string\n /**\n * React hook form rules\n */\n rules?: Omit<\n RegisterOptions<TFieldValues, TName>,\n 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'\n >\n /**\n * Options used for selects and radio fields\n */\n options?: Option[]\n /**\n * The field type\n * Build-in types:\n * - text\n * - number\n * - password\n * - textarea\n * - select\n * - native-select\n * - checkbox\n * - radio\n * - switch\n * - pin\n *\n * Will default to a text field if there is no matching type.\n * @default 'text'\n */\n type?: FieldTypes\n /**\n * The input placeholder\n */\n placeholder?: string\n}\n\nconst inputTypes: Record<FieldTypes, any> = {}\n\nconst defaultInputType = 'text'\n\nconst getInput = (type: string) => {\n return inputTypes[type] || inputTypes[defaultInputType]\n}\n\nconst getError = (name: string, formState: FormState<{ [x: string]: any }>) => {\n return get(formState.errors, name)\n}\n\nconst isTouched = (\n name: string,\n formState: FormState<{ [x: string]: any }>\n) => {\n return get(formState.touchedFields, name)\n}\n\nexport const BaseField: React.FC<FieldProps> = (props) => {\n const { name, label, help, variant, hideLabel, children, ...controlProps } =\n props\n\n const { formState } = useFormContext()\n\n const error = getError(name, formState)\n\n return (\n <FormControl variant={variant} {...controlProps} isInvalid={!!error}>\n {label && !hideLabel ? (\n <FormLabel variant={variant}>{label}</FormLabel>\n ) : null}\n <Box>\n {children}\n {help && !error?.message ? (\n <FormHelperText>{help}</FormHelperText>\n ) : null}\n {error?.message && (\n <FormErrorMessage>{error?.message}</FormErrorMessage>\n )}\n </Box>\n </FormControl>\n )\n}\nexport const Field = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FieldProps<TFieldValues> & {\n [key: string]: unknown // Make sure attributes of custom components work. Need to change this to a global typedef at some point.\n },\n ref: React.ForwardedRef<typeof FormControl>\n ) => {\n const { type = defaultInputType } = props\n const InputComponent = getInput(type)\n\n return <InputComponent ref={ref} {...props} />\n }\n) as <TFieldValues extends FieldValues>(\n props: FieldProps<TFieldValues> & {\n [key: string]: unknown\n } & {\n ref?: React.ForwardedRef<typeof FormControl>\n }\n) => React.ReactElement\n\ninterface CreateFieldProps {\n displayName: string\n hideLabel?: boolean\n BaseField: React.FC<any>\n}\n\nconst createField = (\n InputComponent: React.FC<any>,\n { displayName, hideLabel, BaseField }: CreateFieldProps\n) => {\n const Field = forwardRef<FieldProps, typeof FormControl>((props, ref) => {\n const {\n name,\n label,\n help,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n rules,\n variant,\n ...inputProps\n } = props\n\n const inputRules = {\n required: isRequired,\n ...rules,\n }\n\n return (\n <BaseField\n name={name}\n label={label}\n help={help}\n hideLabel={hideLabel}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n variant={variant}\n >\n <InputComponent\n ref={ref}\n name={name}\n label={label}\n rules={inputRules}\n {...inputProps}\n />\n </BaseField>\n )\n })\n Field.displayName = displayName\n\n return Field\n}\n\nexport const withControlledInput = (InputComponent: any) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { control } = useFormContext()\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { ref: _ref, ...field } }) => (\n <InputComponent\n {...field}\n {...inputProps}\n ref={useMergeRefs(ref, _ref)}\n />\n )}\n />\n )\n }\n )\n}\n\nexport const withUncontrolledInput = (InputComponent: any) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { register } = useFormContext()\n\n const { ref: _ref, ...field } = register(name, rules)\n\n return (\n <InputComponent\n {...field}\n {...inputProps}\n ref={useMergeRefs(ref, _ref)}\n />\n )\n }\n )\n}\n\nexport interface RegisterFieldTypeOptions {\n isControlled?: boolean\n hideLabel?: boolean\n BaseField?: React.FC<any>\n}\n\n/**\n * Register a new field type\n * @param type The name for this field in kebab-case, eg `email` or `array-field`\n * @param component The React component\n * @param options\n * @param options.isControlled Set this to true if this is a controlled field.\n * @param options.hideLabel Hide the field label, for example for checkbox or switch field.\n */\nexport const registerFieldType = (\n type: string,\n component: React.FC<any>,\n options?: RegisterFieldTypeOptions\n) => {\n let InputComponent\n if (options?.isControlled) {\n InputComponent = withControlledInput(component)\n } else {\n InputComponent = withUncontrolledInput(component)\n }\n\n const Field = createField(InputComponent, {\n displayName: `${type\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('')}Field`,\n hideLabel: options?.hideLabel,\n BaseField: options?.BaseField || BaseField,\n })\n\n inputTypes[type] = Field\n\n return Field\n}\n\n// @todo Consider not registering all fields by default to lower the package size and computations.\n// Not all types may be required in a project.\nexport const InputField = registerFieldType('text', Input)\nexport const NumberInputField = registerFieldType('number', NumberInput, {\n isControlled: true,\n})\nexport const PasswordInputFIeld = registerFieldType('password', PasswordInput)\nexport const TextareaField = registerFieldType('textarea', Textarea)\nexport const SwitchField = registerFieldType(\n 'switch',\n forwardRef(({ label, ...props }: { label?: string }, ref) => {\n return (\n <Switch ref={ref} {...props}>\n {label}\n </Switch>\n )\n }),\n {\n isControlled: true,\n hideLabel: true,\n }\n)\nexport const SelectField = registerFieldType('select', Select, {\n isControlled: true,\n})\nexport const CheckboxField = registerFieldType(\n 'checkbox',\n forwardRef(({ label, ...props }: { label?: string }, ref) => {\n return (\n <Checkbox ref={ref} {...props}>\n {label}\n </Checkbox>\n )\n }),\n {\n hideLabel: true,\n }\n)\nexport const RadioField = registerFieldType('radio', RadioInput, {\n isControlled: true,\n})\nexport const PinField = registerFieldType('pin', PinInput, {\n isControlled: true,\n})\nexport const NativeSelectField = registerFieldType(\n 'native-select',\n NativeSelect,\n { isControlled: true }\n)\n","import { SchemaOf, AnySchema, reach } from 'yup'\nexport { yupResolver } from '@hookform/resolvers/yup'\n\nimport { FieldProps } from '../field'\n\n// @TODO get proper typings for the schema fields\n\nconst getType = (field: any) => {\n if (field.spec.meta?.type) {\n return field.spec.meta.type\n }\n\n switch (field.type) {\n case 'array':\n return 'array'\n case 'object':\n return 'object'\n case 'number':\n return 'number'\n case 'date':\n return 'date'\n case 'string':\n default:\n return 'text'\n }\n}\n\ntype Options = {\n min?: number\n max?: number\n}\n\nconst getArrayOption = (field: any, name: string) => {\n for (const test of field.tests) {\n if (test.OPTIONS?.params[name]) return test.OPTIONS.params[name]\n }\n}\n\n/**\n * A helper function to render forms automatically based on a Yup schema\n *\n * @param schema The Yup schema\n * @returns {FieldProps[]}\n */\nexport const getFieldsFromSchema = (\n schema: SchemaOf<AnySchema>\n): FieldProps[] => {\n const fields = []\n\n let schemaFields: Record<string, any> = {}\n if (schema.type === 'array') {\n /* @ts-ignore this is actually valid */\n schemaFields = schema.innerType.fields\n } else {\n schemaFields = schema.fields\n }\n\n for (const name in schemaFields) {\n const field = schemaFields[name]\n\n const options: Options = {}\n if (field.type === 'array') {\n options.min = getArrayOption(field, 'min')\n options.max = getArrayOption(field, 'max')\n }\n\n fields.push({\n name,\n label: field.spec.label || name,\n type: getType(field),\n ...options,\n })\n }\n return fields\n}\n\nexport const getNestedSchema = (schema: SchemaOf<AnySchema>, path: string) => {\n return reach(schema, path)\n}\n","import * as React from 'react'\n\nimport { chakra, SimpleGrid, SimpleGridProps, useTheme } from '@chakra-ui/react'\n\nexport type FormLayoutProps = SimpleGridProps\n\ninterface FormLayoutItemProps {\n children: React.ReactNode\n}\n\nconst FormLayoutItem: React.FC<FormLayoutItemProps> = ({ children }) => {\n return <chakra.div>{children}</chakra.div>\n}\n\n/**\n * FormLayout\n *\n * Renders form items in a `SimpleGrid`\n * @see https://chakra-ui.com/docs/layout/simple-grid\n */\nexport const FormLayout = ({ children, ...props }: FormLayoutProps) => {\n const theme = useTheme()\n\n const defaultProps = theme.components?.FormLayout?.defaultProps ?? {\n spacing: 4,\n }\n\n const gridProps = {\n ...defaultProps,\n ...props,\n }\n\n return (\n <SimpleGrid {...gridProps}>\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return <FormLayoutItem>{child}</FormLayoutItem>\n }\n return child\n })}\n </SimpleGrid>\n )\n}\n","import * as React from 'react'\n\nexport const mapNestedFields = (name: string, children: React.ReactNode) => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.props.name) {\n return React.cloneElement(child, {\n ...child.props,\n name: `${name}.${child.props.name}`,\n })\n }\n return child\n })\n}\n","import * as React from 'react'\nimport {\n useFieldArray,\n useFormContext,\n UseFieldArrayReturn,\n} from 'react-hook-form'\n\nimport { createContext } from '@chakra-ui/react-utils'\n\nexport interface UseArrayFieldReturn extends UseFieldArrayReturn {\n /**\n * The array field name\n */\n name: string\n /**\n * The default value for new items\n */\n defaultValue: Record<string, any>\n /**\n * Min amount of items\n */\n min?: number\n /**\n * Max amount of items\n */\n max?: number\n}\n\nexport const [ArrayFieldProvider, useArrayFieldContext] =\n createContext<UseArrayFieldReturn>({\n name: 'ArrayFieldContext',\n })\n\nexport interface UseArrayFieldRowReturn {\n /**\n * Name of the array field including the index, eg 'field.0'\n */\n name: string\n /**\n * The field index\n */\n index: number\n /**\n * Remove this array item\n */\n remove: () => void\n /**\n * True if this is the first item\n */\n isFirst: boolean\n /**\n * True if this is the last item\n */\n isLast: boolean\n}\n\nexport const [ArrayFieldRowProvider, useArrayFieldRowContext] =\n createContext<UseArrayFieldRowReturn>({\n name: 'ArrayFieldRowContext',\n })\n\nexport interface ArrayFieldOptions {\n /**\n * The field name\n */\n name: string\n /**\n * Default value for new values in the array\n */\n defaultValue?: Record<string, any>\n /**\n * Default key name for rows, change this if your data uses 'id'\n * @default \"id\"\n */\n keyName?: string\n min?: number\n max?: number\n}\n\nexport const useArrayField = ({\n name,\n defaultValue = {},\n keyName,\n min,\n max,\n}: ArrayFieldOptions) => {\n const { control } = useFormContext()\n const context = useFieldArray({\n control,\n name,\n keyName,\n })\n\n return {\n ...context,\n name,\n defaultValue,\n min,\n max,\n }\n}\n\nexport interface UseArrayFieldRowProps {\n index: number\n}\n\nexport const useArrayFieldRow = ({ index }: UseArrayFieldRowProps) => {\n const { clearErrors } = useFormContext()\n const { name, remove, fields } = useArrayFieldContext()\n\n React.useEffect(() => {\n // reset errors, to make sure min/max errors reset correctly\n clearErrors(name)\n }, [])\n\n return {\n index,\n isFirst: index === 0,\n isLast: index === fields.length - 1,\n name: `${name}.${index}`,\n remove: React.useCallback(() => {\n clearErrors(name)\n remove(index)\n }, [index]),\n }\n}\n\nexport const useArrayFieldRemoveButton = () => {\n const { isFirst, remove } = useArrayFieldRowContext()\n const { min, fields } = useArrayFieldContext()\n\n const isDisabled = isFirst && !!(min && fields.length <= min)\n\n return {\n onClick: () => remove(),\n isDisabled,\n }\n}\n\nexport const useArrayFieldAddButton = () => {\n const { append, defaultValue, max, fields } = useArrayFieldContext()\n\n const isDisabled = !!(max && fields.length >= max)\n\n return {\n onClick: () =>\n append(defaultValue, {\n shouldFocus: false,\n }),\n isDisabled,\n }\n}\n","import * as React from 'react'\n\nimport { chakra, ResponsiveValue } from '@chakra-ui/system'\n\nimport { AddIcon, MinusIcon } from '@chakra-ui/icons'\nimport { IconButton, ButtonProps } from '@saas-ui/button'\n\nimport { FormLayout } from './layout'\nimport { BaseField, FieldProps } from './field'\n\nimport { mapNestedFields } from './utils'\n\nimport {\n useArrayField,\n useArrayFieldRow,\n useArrayFieldContext,\n ArrayFieldProvider,\n ArrayFieldOptions,\n ArrayFieldRowProvider,\n useArrayFieldRowContext,\n useArrayFieldRemoveButton,\n useArrayFieldAddButton,\n} from './use-array-field'\n\ninterface ArrayField {\n id: string\n [key: string]: unknown\n}\n\ninterface ArrayFieldRowProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n /**\n * The array index\n */\n index: number\n}\n\nexport const ArrayFieldRow: React.FC<ArrayFieldRowProps> = ({\n children,\n columns,\n spacing,\n index,\n}) => {\n return (\n <ArrayFieldRowContainer index={index}>\n <ArrayFieldRowFields columns={columns} spacing={spacing}>\n {children}\n </ArrayFieldRowFields>\n <ArrayFieldRemoveButton />\n </ArrayFieldRowContainer>\n )\n}\n\nexport interface ArrayFieldRowFieldsProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const ArrayFieldRowFields: React.FC<ArrayFieldRowFieldsProps> = ({\n children,\n columns,\n spacing,\n ...layoutProps\n}) => {\n const { name } = useArrayFieldRowContext()\n return (\n <FormLayout\n flex=\"1\"\n columns={columns}\n gridGap={spacing}\n mr=\"2\"\n {...layoutProps}\n >\n {mapNestedFields(name, children)}\n </FormLayout>\n )\n}\n\nexport const ArrayFieldRowContainer: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n}) => {\n const context = useArrayFieldRow({ index })\n\n const styles = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n width: '100%',\n mb: 4,\n }\n\n return (\n <ArrayFieldRowProvider value={context}>\n <chakra.div __css={styles}>{children}</chakra.div>\n </ArrayFieldRowProvider>\n )\n}\n\nexport const ArrayFieldRemoveButton: React.FC<ButtonProps> = (props) => {\n return (\n <IconButton\n icon={<MinusIcon />}\n aria-label=\"Remove row\"\n {...useArrayFieldRemoveButton()}\n {...props}\n />\n )\n}\n\nexport const ArrayFieldAddButton: React.FC<ButtonProps> = (props) => {\n return (\n <IconButton\n icon={<AddIcon />}\n aria-label=\"Add row\"\n float=\"right\"\n {...useArrayFieldAddButton()}\n {...props}\n />\n )\n}\n\nexport interface ArrayFieldProps\n extends ArrayFieldOptions,\n Omit<FieldProps, 'defaultValue'> {}\n\nexport const ArrayField: React.FC<ArrayFieldProps> = (props) => {\n const { children, ...containerProps } = props\n\n return (\n <ArrayFieldContainer {...containerProps}>\n <ArrayFieldRows>\n {(fields: ArrayField[]) => (\n <>\n {fields.map(({ id }, index: number) => (\n <ArrayFieldRow key={id} index={index}>\n {children}\n </ArrayFieldRow>\n ))}\n </>\n )}\n </ArrayFieldRows>\n <ArrayFieldAddButton />\n </ArrayFieldContainer>\n )\n}\n\nexport interface ArrayFieldRowsProps {\n children: (fields: ArrayField[]) => React.ReactElement | null\n}\n\nexport const ArrayFieldRows = ({\n children,\n}: ArrayFieldRowsProps): React.ReactElement | null => {\n const { fields } = useArrayFieldContext()\n return children(fields)\n}\n\nexport const ArrayFieldContainer: React.FC<ArrayFieldProps> = ({\n name,\n defaultValue,\n keyName,\n min,\n max,\n children,\n ...fieldProps\n}) => {\n const context = useArrayField({\n name,\n defaultValue,\n keyName,\n min,\n max,\n })\n\n return (\n <ArrayFieldProvider value={context}>\n <BaseField name={name} {...fieldProps}>\n {children}\n </BaseField>\n </ArrayFieldProvider>\n )\n}\n","import * as React from 'react'\nimport {\n FormControl,\n FormLabel,\n FormLabelProps,\n ResponsiveValue,\n useStyles,\n} from '@chakra-ui/react'\n\nimport { FormLayout } from './layout'\nimport { FieldProps } from './field'\n\nimport { mapNestedFields } from './utils'\n\nexport interface ObjectFieldProps extends FieldProps {\n name: string\n children: React.ReactNode\n columns?: ResponsiveValue<number>\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const FormLegend = (props: FormLabelProps) => {\n const styles = useStyles()\n return <FormLabel as=\"legend\" sx={styles.legend} {...props} />\n}\n\nexport const ObjectField: React.FC<ObjectFieldProps> = (props) => {\n const { name, label, hideLabel, children, columns, spacing, ...fieldProps } =\n props\n\n return (\n <FormControl name={name} as=\"fieldset\" {...fieldProps}>\n <FormLegend display={hideLabel ? 'none' : 'block'}>{label}</FormLegend>\n <FormLayout columns={columns} gridGap={spacing}>\n {mapNestedFields(name, children)}\n </FormLayout>\n </FormControl>\n )\n}\n","import * as React from 'react'\nimport { getFieldsFromSchema, getNestedSchema } from './resolvers/yup'\n\nimport { FormLayout } from './layout'\nimport { Field, FieldProps } from './field'\n\nimport { ArrayField } from './array-field'\nimport { ObjectField } from './object-field'\n\nexport interface FieldsProps {\n schema: any\n}\n\nconst getNestedFields = (schema: any, name: string) => {\n return getFieldsFromSchema(getNestedSchema(schema, name)).map(\n ({ name, type, ...nestedFieldProps }: FieldProps): React.ReactNode => (\n <Field key={name} name={name} type={type} {...nestedFieldProps} />\n )\n )\n}\n\nexport const Fields: React.FC<FieldsProps> = ({ schema, ...props }) => {\n return (\n <FormLayout {...props}>\n {getFieldsFromSchema(schema).map(\n ({\n name,\n type,\n defaultValue,\n ...fieldProps\n }: FieldProps): React.ReactNode => {\n if (type === 'array') {\n return (\n <ArrayField name={name} {...fieldProps}>\n {getNestedFields(schema, name)}\n </ArrayField>\n )\n } else if (type === 'object') {\n return (\n <ObjectField name={name} {...fieldProps}>\n {getNestedFields(schema, name)}\n </ObjectField>\n )\n }\n\n return <Field key={name} name={name} type={type} {...fieldProps} />\n }\n )}\n </FormLayout>\n )\n}\n","import * as React from 'react'\n\nimport { chakra, HTMLChakraProps, forwardRef } from '@chakra-ui/react'\n\nimport {\n useForm,\n FormProvider,\n UseFormProps,\n UseFormReturn,\n FieldValues,\n SubmitHandler,\n SubmitErrorHandler,\n} from 'react-hook-form'\n\nimport { yupResolver } from './resolvers/yup'\n\nexport type { UseFormReturn }\n\ninterface FormOptions<TFieldValues extends FieldValues = FieldValues> {\n /**\n * The form schema, currently supports Yup schema only.\n */\n schema?: any\n /**\n * The submit handler.\n */\n onSubmit: SubmitHandler<TFieldValues>\n /**\n * Triggers when there are validation errors.\n */\n onError?: SubmitErrorHandler<TFieldValues>\n /**\n * Ref on the HTMLFormElement.\n */\n formRef?: React.MutableRefObject<HTMLFormElement>\n}\n\nexport interface FormProps<TFieldValues extends FieldValues = FieldValues>\n extends UseFormProps<TFieldValues>,\n Omit<HTMLChakraProps<'form'>, 'onSubmit' | 'onError'>,\n FormOptions<TFieldValues> {}\n\n/**\n * @todo Figure out how to pass down FieldValues to all Field components,\n * if at all possible.\n */\nexport const Form = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const {\n mode = 'all',\n resolver,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n schema,\n defaultValues,\n onSubmit,\n onError,\n formRef,\n children,\n ...rest\n } = props\n\n const form = {\n mode,\n resolver,\n defaultValues,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n }\n\n // @todo remove yup dependency and just use resolver prop?\n if (schema) {\n form.resolver = yupResolver(schema)\n }\n\n const methods = useForm<TFieldValues>(form)\n const { handleSubmit } = methods\n\n // This exposes the useForm api through the forwareded ref\n React.useImperativeHandle(ref, () => methods, [ref, methods])\n\n return (\n <FormProvider {...methods}>\n <chakra.form\n ref={formRef}\n onSubmit={handleSubmit(onSubmit, onError)}\n {...rest}\n >\n {children}\n </chakra.form>\n </FormProvider>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","import * as React from 'react'\n\nimport { useFormContext } from 'react-hook-form'\n\nimport { Button, ButtonProps } from '@saas-ui/button'\n\nimport { forwardRef } from '@chakra-ui/system'\n\nexport interface SubmitButtonProps extends ButtonProps {\n /**\n * Disable the submit button if the form is untouched.\n *\n * Change the default behavior by updating\n * `SubmitButton.defaultProps.disableIfUntouched`\n */\n disableIfUntouched?: boolean\n /**\n * Disable the submit button if the form is invalid.\n *\n * Change the default behavior by updating\n * `SubmitButton.defaultProps.disableIfInvalid`\n */\n disableIfInvalid?: boolean\n}\n\nexport const SubmitButton = forwardRef<SubmitButtonProps, 'button'>(\n (props, ref) => {\n const { children, disableIfUntouched, disableIfInvalid, ...rest } = props\n const { formState } = useFormContext()\n\n const isDisabled =\n (disableIfUntouched && !formState.isDirty) ||\n (disableIfInvalid && !formState.isValid)\n\n return (\n <Button\n type=\"submit\"\n isLoading={formState.isSubmitting}\n isPrimary\n ref={ref}\n isDisabled={isDisabled}\n {...rest}\n >\n {children}\n </Button>\n )\n }\n)\n\nSubmitButton.defaultProps = {\n label: 'Submit',\n disableIfUntouched: false,\n disableIfInvalid: false,\n}\n","import * as React from 'react'\nimport { FieldValues, UseFormReturn } from 'react-hook-form'\nimport { forwardRef } from '@chakra-ui/react'\n\nimport { Form, FormProps } from './form'\n\nimport { FormLayout } from './layout'\nimport { Fields } from './fields'\nimport { SubmitButton } from './submit-button'\n\ninterface AutoFormOptions {\n schema: any\n submitLabel?: false | string\n}\n\nexport interface AutoFormProps<TFieldValues extends FieldValues>\n extends Omit<FormProps<TFieldValues>, 'schema'>,\n AutoFormOptions {}\n\nexport const AutoForm = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: AutoFormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const { schema, submitLabel = 'Submit', ...rest } = props\n return (\n <Form {...rest} schema={schema} ref={ref}>\n <FormLayout>\n {<Fields schema={schema} />}\n {submitLabel && <SubmitButton label={submitLabel} />}\n </FormLayout>\n </Form>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: AutoFormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","export * from 'css-box-model';\nexport { default as mergeWith } from 'lodash.mergewith';\nimport sync, { cancelSync, getFrameData } from 'framesync';\n\nfunction getFirstItem(array) {\n return array != null && array.length ? array[0] : undefined;\n}\nfunction getLastItem(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\nfunction getPrevItem(index, array, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n var prevIndex = getPrevIndex(index, array.length, loop);\n return array[prevIndex];\n}\nfunction getNextItem(index, array, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n var nextIndex = getNextIndex(index, array.length, 1, loop);\n return array[nextIndex];\n}\nfunction removeIndex(array, index) {\n return array.filter(function (_, idx) {\n return idx !== index;\n });\n}\nfunction addItem(array, item) {\n return [].concat(array, [item]);\n}\nfunction removeItem(array, item) {\n return array.filter(function (eachItem) {\n return eachItem !== item;\n });\n}\n/**\n * Get the next index based on the current index and step.\n *\n * @param currentIndex the current index\n * @param length the total length or count of items\n * @param step the number of steps\n * @param loop whether to circle back once `currentIndex` is at the start/end\n */\n\nfunction getNextIndex(currentIndex, length, step, loop) {\n if (step === void 0) {\n step = 1;\n }\n\n if (loop === void 0) {\n loop = true;\n }\n\n var lastIndex = length - 1;\n\n if (currentIndex === -1) {\n return step > 0 ? 0 : lastIndex;\n }\n\n var nextIndex = currentIndex + step;\n\n if (nextIndex < 0) {\n return loop ? lastIndex : 0;\n }\n\n if (nextIndex >= length) {\n if (loop) return 0;\n return currentIndex > length ? length : currentIndex;\n }\n\n return nextIndex;\n}\n/**\n * Get's the previous index based on the current index.\n * Mostly used for keyboard navigation.\n *\n * @param index - the current index\n * @param count - the length or total count of items in the array\n * @param loop - whether we should circle back to the\n * first/last once `currentIndex` is at the start/end\n */\n\nfunction getPrevIndex(index, count, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n return getNextIndex(index, count, -1, loop);\n}\n/**\n * Converts an array into smaller chunks or groups.\n *\n * @param array the array to chunk into group\n * @param size the length of each chunk\n */\n\nfunction chunk(array, size) {\n return array.reduce(function (rows, currentValue, index) {\n if (index % size === 0) {\n rows.push([currentValue]);\n } else {\n rows[rows.length - 1].push(currentValue);\n }\n\n return rows;\n }, []);\n}\n/**\n * Gets the next item based on a search string\n *\n * @param items array of items\n * @param searchString the search string\n * @param itemToString resolves an item to string\n * @param currentItem the current selected item\n */\n\nfunction getNextItemFromSearch(items, searchString, itemToString, currentItem) {\n if (searchString == null) {\n return currentItem;\n } // If current item doesn't exist, find the item that matches the search string\n\n\n if (!currentItem) {\n var foundItem = items.find(function (item) {\n return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());\n });\n return foundItem;\n } // Filter items for ones that match the search string (case insensitive)\n\n\n var matchingItems = items.filter(function (item) {\n return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());\n }); // If there's a match, let's get the next item to select\n\n if (matchingItems.length > 0) {\n var nextIndex; // If the currentItem is in the available items, we move to the next available option\n\n if (matchingItems.includes(currentItem)) {\n var currentIndex = matchingItems.indexOf(currentItem);\n nextIndex = currentIndex + 1;\n\n if (nextIndex === matchingItems.length) {\n nextIndex = 0;\n }\n\n return matchingItems[nextIndex];\n } // Else, we pick the first item in the available items\n\n\n nextIndex = items.indexOf(matchingItems[0]);\n return items[nextIndex];\n } // a decent fallback to the currentItem\n\n\n return currentItem;\n}\n\n// Number assertions\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isNotNumber(value) {\n return typeof value !== \"number\" || Number.isNaN(value) || !Number.isFinite(value);\n}\nfunction isNumeric(value) {\n return value != null && value - parseFloat(value) + 1 >= 0;\n} // Array assertions\n\nfunction isArray(value) {\n return Array.isArray(value);\n}\nfunction isEmptyArray(value) {\n return isArray(value) && value.length === 0;\n} // Function assertions\n\nfunction isFunction(value) {\n return typeof value === \"function\";\n} // Generic assertions\n\nfunction isDefined(value) {\n return typeof value !== \"undefined\" && value !== undefined;\n}\nfunction isUndefined(value) {\n return typeof value === \"undefined\" || value === undefined;\n} // Object assertions\n\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type === \"object\" || type === \"function\") && !isArray(value);\n}\nfunction isEmptyObject(value) {\n return isObject(value) && Object.keys(value).length === 0;\n}\nfunction isNotEmptyObject(value) {\n return value && !isEmptyObject(value);\n}\nfunction isNull(value) {\n return value == null;\n} // String assertions\n\nfunction isString(value) {\n return Object.prototype.toString.call(value) === \"[object String]\";\n}\nfunction isCssVar(value) {\n return /^var\\(--.+\\)$/.test(value);\n} // Empty assertions\n\nfunction isEmpty(value) {\n if (isArray(value)) return isEmptyArray(value);\n if (isObject(value)) return isEmptyObject(value);\n if (value == null || value === \"\") return true;\n return false;\n}\nvar __DEV__ = process.env.NODE_ENV !== \"production\";\nvar __TEST__ = process.env.NODE_ENV === \"test\";\nfunction isRefObject(val) {\n return \"current\" in val;\n}\nfunction isInputEvent(value) {\n return value && isObject(value) && isObject(value.target);\n}\n\nfunction omit(object, keys) {\n var result = {};\n Object.keys(object).forEach(function (key) {\n if (keys.includes(key)) return;\n result[key] = object[key];\n });\n return result;\n}\nfunction pick(object, keys) {\n var result = {};\n keys.forEach(function (key) {\n if (key in object) {\n result[key] = object[key];\n }\n });\n return result;\n}\nfunction split(object, keys) {\n var picked = {};\n var omitted = {};\n Object.keys(object).forEach(function (key) {\n if (keys.includes(key)) {\n picked[key] = object[key];\n } else {\n omitted[key] = object[key];\n }\n });\n return [picked, omitted];\n}\n/**\n * Get value from a deeply nested object using a string path.\n * Memoizes the value.\n * @param obj - the object\n * @param path - the string path\n * @param def - the fallback value\n */\n\nfunction get(obj, path, fallback, index) {\n var key = typeof path === \"string\" ? path.split(\".\") : [path];\n\n for (index = 0; index < key.length; index += 1) {\n if (!obj) break;\n obj = obj[key[index]];\n }\n\n return obj === undefined ? fallback : obj;\n}\nvar memoize = function memoize(fn) {\n var cache = new WeakMap();\n\n var memoizedFn = function memoizedFn(obj, path, fallback, index) {\n if (typeof obj === \"undefined\") {\n return fn(obj, path, fallback);\n }\n\n if (!cache.has(obj)) {\n cache.set(obj, new Map());\n }\n\n var map = cache.get(obj);\n\n if (map.has(path)) {\n return map.get(path);\n }\n\n var value = fn(obj, path, fallback, index);\n map.set(path, value);\n return value;\n };\n\n return memoizedFn;\n};\nvar memoizedGet = memoize(get);\n/**\n * Get value from deeply nested object, based on path\n * It returns the path value if not found in object\n *\n * @param path - the string path or value\n * @param scale - the string path or value\n */\n\nfunction getWithDefault(path, scale) {\n return memoizedGet(scale, path, path);\n}\n\n/**\n * Returns the items of an object that meet the condition specified in a callback function.\n *\n * @param object the object to loop through\n * @param fn The filter function\n */\nfunction objectFilter(object, fn) {\n var result = {};\n Object.keys(object).forEach(function (key) {\n var value = object[key];\n var shouldPass = fn(value, key, object);\n\n if (shouldPass) {\n result[key] = value;\n }\n });\n return result;\n}\nvar filterUndefined = function filterUndefined(object) {\n return objectFilter(object, function (val) {\n return val !== null && val !== undefined;\n });\n};\nvar objectKeys = function objectKeys(obj) {\n return Object.keys(obj);\n};\n/**\n * Object.entries polyfill for Nodev10 compatibility\n */\n\nvar fromEntries = function fromEntries(entries) {\n return entries.reduce(function (carry, _ref) {\n var key = _ref[0],\n value = _ref[1];\n carry[key] = value;\n return carry;\n }, {});\n};\n/**\n * Get the CSS variable ref stored in the theme\n */\n\nvar getCSSVar = function getCSSVar(theme, scale, value) {\n var _theme$__cssMap$$varR, _theme$__cssMap$;\n\n return (_theme$__cssMap$$varR = (_theme$__cssMap$ = theme.__cssMap[scale + \".\" + value]) == null ? void 0 : _theme$__cssMap$.varRef) != null ? _theme$__cssMap$$varR : value;\n};\n\nfunction analyzeCSSValue(value) {\n var num = parseFloat(value.toString());\n var unit = value.toString().replace(String(num), \"\");\n return {\n unitless: !unit,\n value: num,\n unit: unit\n };\n}\n\nfunction px(value) {\n if (value == null) return value;\n\n var _analyzeCSSValue = analyzeCSSValue(value),\n unitless = _analyzeCSSValue.unitless;\n\n return unitless || isNumber(value) ? value + \"px\" : value;\n}\n\nvar sortByBreakpointValue = function sortByBreakpointValue(a, b) {\n return parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;\n};\n\nvar sortBps = function sortBps(breakpoints) {\n return fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));\n};\n\nfunction normalize(breakpoints) {\n var sorted = sortBps(breakpoints);\n return Object.assign(Object.values(sorted), sorted);\n}\n\nfunction keys(breakpoints) {\n var value = Object.keys(sortBps(breakpoints));\n return new Set(value);\n}\n\nfunction subtract(value) {\n var _px;\n\n if (!value) return value;\n value = (_px = px(value)) != null ? _px : value;\n var factor = value.endsWith(\"px\") ? -1 : // the equivalent of 1px in em using a 16px base\n -0.0635;\n return isNumber(value) ? \"\" + (value + factor) : value.replace(/([0-9]+\\.?[0-9]*)/, function (m) {\n return \"\" + (parseFloat(m) + factor);\n });\n}\n\nfunction queryString(min, max) {\n var query = [];\n if (min) query.push(\"@media screen and (min-width: \" + px(min) + \")\");\n if (query.length > 0 && max) query.push(\"and\");\n if (max) query.push(\"@media screen and (max-width: \" + px(max) + \")\");\n return query.join(\" \");\n}\n\nfunction analyzeBreakpoints(breakpoints) {\n var _breakpoints$base;\n\n if (!breakpoints) return null;\n breakpoints.base = (_breakpoints$base = breakpoints.base) != null ? _breakpoints$base : \"0px\";\n var normalized = normalize(breakpoints);\n var queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(function (_ref, index, entry) {\n var _entry;\n\n var breakpoint = _ref[0],\n minW = _ref[1];\n\n var _ref2 = (_entry = entry[index + 1]) != null ? _entry : [],\n maxW = _ref2[1];\n\n maxW = parseFloat(maxW) > 0 ? subtract(maxW) : undefined;\n return {\n breakpoint: breakpoint,\n minW: minW,\n maxW: maxW,\n maxWQuery: queryString(null, maxW),\n minWQuery: queryString(minW),\n minMaxQuery: queryString(minW, maxW)\n };\n });\n\n var _keys = keys(breakpoints);\n\n var _keysArr = Array.from(_keys.values());\n\n return {\n keys: _keys,\n normalized: normalized,\n isResponsive: function isResponsive(test) {\n var keys = Object.keys(test);\n return keys.length > 0 && keys.every(function (key) {\n return _keys.has(key);\n });\n },\n asObject: sortBps(breakpoints),\n asArray: normalize(breakpoints),\n details: queries,\n media: [null].concat(normalized.map(function (minW) {\n return queryString(minW);\n }).slice(1)),\n toArrayValue: function toArrayValue(test) {\n if (!isObject(test)) {\n throw new Error(\"toArrayValue: value must be an object\");\n }\n\n var result = _keysArr.map(function (bp) {\n var _test$bp;\n\n return (_test$bp = test[bp]) != null ? _test$bp : null;\n });\n\n while (getLastItem(result) === null) {\n result.pop();\n }\n\n return result;\n },\n toObjectValue: function toObjectValue(test) {\n if (!Array.isArray(test)) {\n throw new Error(\"toObjectValue: value must be an array\");\n }\n\n return test.reduce(function (acc, value, index) {\n var key = _keysArr[index];\n if (key != null && value != null) acc[key] = value;\n return acc;\n }, {});\n }\n };\n}\n\nfunction isElement(el) {\n return el != null && typeof el == \"object\" && \"nodeType\" in el && el.nodeType === Node.ELEMENT_NODE;\n}\nfunction isHTMLElement(el) {\n var _el$ownerDocument$def;\n\n if (!isElement(el)) {\n return false;\n }\n\n var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;\n return el instanceof win.HTMLElement;\n}\nfunction getOwnerWindow(node) {\n var _getOwnerDocument$def, _getOwnerDocument;\n\n return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;\n}\nfunction getOwnerDocument(node) {\n var _node$ownerDocument;\n\n return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;\n}\nfunction getEventWindow(event) {\n var _view;\n\n return (_view = event.view) != null ? _view : window;\n}\nfunction canUseDOM() {\n return !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\n}\nvar isBrowser = canUseDOM();\nvar dataAttr = function dataAttr(condition) {\n return condition ? \"\" : undefined;\n};\nvar ariaAttr = function ariaAttr(condition) {\n return condition ? true : undefined;\n};\nvar cx = function cx() {\n for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {\n classNames[_key] = arguments[_key];\n }\n\n return classNames.filter(Boolean).join(\" \");\n};\nfunction getActiveElement(node) {\n var doc = getOwnerDocument(node);\n return doc == null ? void 0 : doc.activeElement;\n}\nfunction contains(parent, child) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\nfunction addDomEvent(target, eventName, handler, options) {\n target.addEventListener(eventName, handler, options);\n return function () {\n target.removeEventListener(eventName, handler, options);\n };\n}\n/**\n * Get the normalized event key across all browsers\n * @param event keyboard event\n */\n\nfunction normalizeEventKey(event) {\n var key = event.key,\n keyCode = event.keyCode;\n var isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf(\"Arrow\") !== 0;\n var eventKey = isArrowKey ? \"Arrow\" + key : key;\n return eventKey;\n}\nfunction getRelatedTarget(event) {\n var _event$target, _event$relatedTarget;\n\n var target = (_event$target = event.target) != null ? _event$target : event.currentTarget;\n var activeElement = getActiveElement(target);\n return (_event$relatedTarget = event.relatedTarget) != null ? _event$relatedTarget : activeElement;\n}\nfunction isRightClick(event) {\n return event.button !== 0;\n}\n\n// Really great work done by Diego Haz on this one\nvar hasDisplayNone = function hasDisplayNone(element) {\n return window.getComputedStyle(element).display === \"none\";\n};\nvar hasTabIndex = function hasTabIndex(element) {\n return element.hasAttribute(\"tabindex\");\n};\nvar hasNegativeTabIndex = function hasNegativeTabIndex(element) {\n return hasTabIndex(element) && element.tabIndex === -1;\n};\nfunction isDisabled(element) {\n return Boolean(element.getAttribute(\"disabled\")) === true || Boolean(element.getAttribute(\"aria-disabled\")) === true;\n}\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName.toLowerCase() === \"input\" && \"select\" in element;\n}\nfunction isActiveElement(element) {\n var doc = isHTMLElement(element) ? getOwnerDocument(element) : document;\n return doc.activeElement === element;\n}\nfunction hasFocusWithin(element) {\n if (!document.activeElement) return false;\n return element.contains(document.activeElement);\n}\nfunction isHidden(element) {\n if (element.parentElement && isHidden(element.parentElement)) return true;\n return element.hidden;\n}\nfunction isContentEditable(element) {\n var value = element.getAttribute(\"contenteditable\");\n return value !== \"false\" && value != null;\n}\nfunction isFocusable(element) {\n if (!isHTMLElement(element) || isHidden(element) || isDisabled(element)) {\n return false;\n }\n\n var localName = element.localName;\n var focusableTags = [\"input\", \"select\", \"textarea\", \"button\"];\n if (focusableTags.indexOf(localName) >= 0) return true;\n var others = {\n a: function a() {\n return element.hasAttribute(\"href\");\n },\n audio: function audio() {\n return element.hasAttribute(\"controls\");\n },\n video: function video() {\n return element.hasAttribute(\"controls\");\n }\n };\n\n if (localName in others) {\n return others[localName]();\n }\n\n if (isContentEditable(element)) return true;\n return hasTabIndex(element);\n}\nfunction isTabbable(element) {\n if (!element) return false;\n return isHTMLElement(element) && isFocusable(element) && !hasNegativeTabIndex(element);\n}\n\nvar focusableElList = [\"input:not([disabled])\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"embed\", \"iframe\", \"object\", \"a[href]\", \"area[href]\", \"button:not([disabled])\", \"[tabindex]\", \"audio[controls]\", \"video[controls]\", \"*[tabindex]:not([aria-disabled])\", \"*[contenteditable]\"];\nvar focusableElSelector = focusableElList.join();\nfunction getAllFocusable(container) {\n var focusableEls = Array.from(container.querySelectorAll(focusableElSelector));\n focusableEls.unshift(container);\n return focusableEls.filter(isFocusable).filter(function (el) {\n return window.getComputedStyle(el).display !== \"none\";\n });\n}\nfunction getFirstFocusable(container) {\n var allFocusable = getAllFocusable(container);\n return allFocusable.length ? allFocusable[0] : null;\n}\nfunction getAllTabbable(container, fallbackToFocusable) {\n var allFocusable = Array.from(container.querySelectorAll(focusableElSelector));\n var allTabbable = allFocusable.filter(isTabbable);\n\n if (isTabbable(container)) {\n allTabbable.unshift(container);\n }\n\n if (!allTabbable.length && fallbackToFocusable) {\n return allFocusable;\n }\n\n return allTabbable;\n}\nfunction getFirstTabbableIn(container, fallbackToFocusable) {\n var _getAllTabbable = getAllTabbable(container, fallbackToFocusable),\n first = _getAllTabbable[0];\n\n return first || null;\n}\nfunction getLastTabbableIn(container, fallbackToFocusable) {\n var allTabbable = getAllTabbable(container, fallbackToFocusable);\n return allTabbable[allTabbable.length - 1] || null;\n}\nfunction getNextTabbable(container, fallbackToFocusable) {\n var allFocusable = getAllFocusable(container);\n var index = allFocusable.indexOf(document.activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\nfunction getPreviousTabbable(container, fallbackToFocusable) {\n var allFocusable = getAllFocusable(container).reverse();\n var index = allFocusable.indexOf(document.activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\nfunction focusNextTabbable(container, fallbackToFocusable) {\n var nextTabbable = getNextTabbable(container, fallbackToFocusable);\n\n if (nextTabbable && isHTMLElement(nextTabbable)) {\n nextTabbable.focus();\n }\n}\nfunction focusPreviousTabbable(container, fallbackToFocusable) {\n var previousTabbable = getPreviousTabbable(container, fallbackToFocusable);\n\n if (previousTabbable && isHTMLElement(previousTabbable)) {\n previousTabbable.focus();\n }\n}\n\nfunction matches(element, selectors) {\n if (\"matches\" in element) return element.matches(selectors);\n if (\"msMatchesSelector\" in element) return element.msMatchesSelector(selectors);\n return element.webkitMatchesSelector(selectors);\n}\n\nfunction closest(element, selectors) {\n if (\"closest\" in element) return element.closest(selectors);\n\n do {\n if (matches(element, selectors)) return element;\n element = element.parentElement || element.parentNode;\n } while (element !== null && element.nodeType === 1);\n\n return null;\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\n/* eslint-disable no-nested-ternary */\nfunction runIfFn(valueOrFn) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return isFunction(valueOrFn) ? valueOrFn.apply(void 0, args) : valueOrFn;\n}\nfunction callAllHandlers() {\n for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n fns[_key2] = arguments[_key2];\n }\n\n return function func(event) {\n fns.some(function (fn) {\n fn == null ? void 0 : fn(event);\n return event == null ? void 0 : event.defaultPrevented;\n });\n };\n}\nfunction callAll() {\n for (var _len3 = arguments.length, fns = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n fns[_key3] = arguments[_key3];\n }\n\n return function mergedFn(arg) {\n fns.forEach(function (fn) {\n fn == null ? void 0 : fn(arg);\n });\n };\n}\nvar compose = function compose(fn1) {\n for (var _len4 = arguments.length, fns = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n fns[_key4 - 1] = arguments[_key4];\n }\n\n return fns.reduce(function (f1, f2) {\n return function () {\n return f1(f2.apply(void 0, arguments));\n };\n }, fn1);\n};\nfunction once(fn) {\n var result;\n return function func() {\n if (fn) {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n\n result = fn.apply(this, args);\n fn = null;\n }\n\n return result;\n };\n}\nvar noop = function noop() {};\nvar warn = once(function (options) {\n return function () {\n var condition = options.condition,\n message = options.message;\n\n if (condition && __DEV__) {\n console.warn(message);\n }\n };\n});\nvar error = once(function (options) {\n return function () {\n var condition = options.condition,\n message = options.message;\n\n if (condition && __DEV__) {\n console.error(message);\n }\n };\n});\nvar pipe = function pipe() {\n for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n fns[_key6] = arguments[_key6];\n }\n\n return function (v) {\n return fns.reduce(function (a, b) {\n return b(a);\n }, v);\n };\n};\n\nvar distance1D = function distance1D(a, b) {\n return Math.abs(a - b);\n};\n\nvar isPoint = function isPoint(point) {\n return \"x\" in point && \"y\" in point;\n};\n\nfunction distance(a, b) {\n if (isNumber(a) && isNumber(b)) {\n return distance1D(a, b);\n }\n\n if (isPoint(a) && isPoint(b)) {\n var xDelta = distance1D(a.x, b.x);\n var yDelta = distance1D(a.y, b.y);\n return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2));\n }\n\n return 0;\n}\n\nfunction focus(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$isActive = _options.isActive,\n isActive = _options$isActive === void 0 ? isActiveElement : _options$isActive,\n nextTick = _options.nextTick,\n _options$preventScrol = _options.preventScroll,\n preventScroll = _options$preventScrol === void 0 ? true : _options$preventScrol,\n _options$selectTextIf = _options.selectTextIfInput,\n selectTextIfInput = _options$selectTextIf === void 0 ? true : _options$selectTextIf;\n if (!element || isActive(element)) return -1;\n\n function triggerFocus() {\n if (!element) {\n warn({\n condition: true,\n message: \"[chakra-ui]: can't call focus() on `null` or `undefined` element\"\n });\n return;\n }\n\n if (supportsPreventScroll()) {\n element.focus({\n preventScroll: preventScroll\n });\n } else {\n element.focus();\n\n if (preventScroll) {\n var scrollableElements = getScrollableElements(element);\n restoreScrollPosition(scrollableElements);\n }\n }\n\n if (isInputElement(element) && selectTextIfInput) {\n element.select();\n }\n }\n\n if (nextTick) {\n return requestAnimationFrame(triggerFocus);\n }\n\n triggerFocus();\n return -1;\n}\nvar supportsPreventScrollCached = null;\n\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n\n try {\n var div = document.createElement(\"div\");\n div.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n\n });\n } catch (e) {// Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element) {\n var _doc$defaultView;\n\n var doc = getOwnerDocument(element);\n var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;\n var parent = element.parentNode;\n var scrollableElements = [];\n var rootScrollingElement = doc.scrollingElement || doc.documentElement;\n\n while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {\n if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof win.HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements) {\n for (var _iterator = _createForOfIteratorHelperLoose(scrollableElements), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n element = _step$value.element,\n scrollTop = _step$value.scrollTop,\n scrollLeft = _step$value.scrollLeft;\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n\nfunction flatten(target, maxDepth) {\n if (maxDepth === void 0) {\n maxDepth = Infinity;\n }\n\n if (!isObject(target) && !Array.isArray(target) || !maxDepth) {\n return target;\n }\n\n return Object.entries(target).reduce(function (result, _ref) {\n var key = _ref[0],\n value = _ref[1];\n\n if (isObject(value) || isArray(value)) {\n Object.entries(flatten(value, maxDepth - 1)).forEach(function (_ref2) {\n var childKey = _ref2[0],\n childValue = _ref2[1];\n // e.g. gray.500\n result[key + \".\" + childKey] = childValue;\n });\n } else {\n // e.g. transparent\n result[key] = value;\n }\n\n return result;\n }, {});\n}\n\n/**\n * Determines whether the children of a disclosure widget\n * should be rendered or not, depending on the lazy behavior.\n *\n * Used in accordion, tabs, popover, menu and other disclosure\n * widgets.\n */\nfunction determineLazyBehavior(options) {\n var hasBeenSelected = options.hasBeenSelected,\n isLazy = options.isLazy,\n isSelected = options.isSelected,\n _options$lazyBehavior = options.lazyBehavior,\n lazyBehavior = _options$lazyBehavior === void 0 ? \"unmount\" : _options$lazyBehavior; // if not lazy, always render the disclosure's content\n\n if (!isLazy) return true; // if the diclosure is selected, render the disclosure's content\n\n if (isSelected) return true; // if the disclosure was selected but not active, keep its content active\n\n if (lazyBehavior === \"keepMounted\" && hasBeenSelected) return true;\n return false;\n}\n\nvar minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;\nvar maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;\n\nfunction toNumber(value) {\n var num = parseFloat(value);\n return isNotNumber(num) ? 0 : num;\n}\n/**\n * Converts a value to a specific precision (or decimal points).\n *\n * Returns a string representing a number in fixed-point notation.\n *\n * @param value the value to convert\n * @param precision the precision or decimal points\n */\n\n\nfunction toPrecision(value, precision) {\n var nextValue = toNumber(value);\n var scaleFactor = Math.pow(10, precision != null ? precision : 10);\n nextValue = Math.round(nextValue * scaleFactor) / scaleFactor;\n return precision ? nextValue.toFixed(precision) : nextValue.toString();\n}\n/**\n * Counts the number of decimal places a number has\n *\n * @param value the decimal value to count\n */\n\nfunction countDecimalPlaces(value) {\n if (!Number.isFinite(value)) return 0;\n var e = 1;\n var p = 0;\n\n while (Math.round(value * e) / e !== value) {\n e *= 10;\n p += 1;\n }\n\n return p;\n}\n/**\n * Convert a value to percentage based on lower and upper bound values\n *\n * @param value the value in number\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction valueToPercent(value, min, max) {\n return (value - min) * 100 / (max - min);\n}\n/**\n * Calculate the value based on percentage, lower and upper bound values\n *\n * @param percent the percent value in decimals (e.g 0.6, 0.3)\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction percentToValue(percent, min, max) {\n return (max - min) * percent + min;\n}\n/**\n * Rounds a specific value to the next or previous step\n *\n * @param value the value to round\n * @param from the number that stepping started from\n * @param step the specified step\n */\n\nfunction roundValueToStep(value, from, step) {\n var nextValue = Math.round((value - from) / step) * step + from;\n var precision = countDecimalPlaces(step);\n return toPrecision(nextValue, precision);\n}\n/**\n * Clamps a value to ensure it stays within the min and max range.\n *\n * @param value the value to clamp\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction clampValue(value, min, max) {\n if (value == null) return value;\n warn({\n condition: max < min,\n message: \"clamp: max cannot be less than min\"\n });\n return Math.min(Math.max(value, min), max);\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\n/**\n * Credit goes to `framer-motion` of this useful utilities.\n * License can be found here: https://github.com/framer/motion\n */\nfunction isMouseEvent(event) {\n var win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.\n\n if (typeof win.PointerEvent !== \"undefined\" && event instanceof win.PointerEvent) {\n return !!(event.pointerType === \"mouse\");\n }\n\n return event instanceof win.MouseEvent;\n}\nfunction isTouchEvent(event) {\n var hasTouches = !!event.touches;\n return hasTouches;\n}\n\n/**\n * Filters out events not attached to the primary pointer (currently left mouse button)\n * @param eventHandler\n */\nfunction filterPrimaryPointer(eventHandler) {\n return function (event) {\n var win = getEventWindow(event);\n var isMouseEvent = event instanceof win.MouseEvent;\n var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;\n\n if (isPrimaryPointer) {\n eventHandler(event);\n }\n };\n}\n\nvar defaultPagePoint = {\n pageX: 0,\n pageY: 0\n};\n\nfunction pointFromTouch(e, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n var primaryTouch = e.touches[0] || e.changedTouches[0];\n var point = primaryTouch || defaultPagePoint;\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"]\n };\n}\n\nfunction pointFromMouse(point, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"]\n };\n}\n\nfunction extractEventInfo(event, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n return {\n point: isTouchEvent(event) ? pointFromTouch(event, pointType) : pointFromMouse(event, pointType)\n };\n}\nfunction getViewportPointFromEvent(event) {\n return extractEventInfo(event, \"client\");\n}\nvar wrapPointerEventHandler = function wrapPointerEventHandler(handler, shouldFilterPrimaryPointer) {\n if (shouldFilterPrimaryPointer === void 0) {\n shouldFilterPrimaryPointer = false;\n }\n\n var listener = function listener(event) {\n return handler(event, extractEventInfo(event));\n };\n\n return shouldFilterPrimaryPointer ? filterPrimaryPointer(listener) : listener;\n}; // We check for event support via functions in case they've been mocked by a testing suite.\n\nvar supportsPointerEvents = function supportsPointerEvents() {\n return isBrowser && window.onpointerdown === null;\n};\n\nvar supportsTouchEvents = function supportsTouchEvents() {\n return isBrowser && window.ontouchstart === null;\n};\n\nvar supportsMouseEvents = function supportsMouseEvents() {\n return isBrowser && window.onmousedown === null;\n};\n\nvar mouseEventNames = {\n pointerdown: \"mousedown\",\n pointermove: \"mousemove\",\n pointerup: \"mouseup\",\n pointercancel: \"mousecancel\",\n pointerover: \"mouseover\",\n pointerout: \"mouseout\",\n pointerenter: \"mouseenter\",\n pointerleave: \"mouseleave\"\n};\nvar touchEventNames = {\n pointerdown: \"touchstart\",\n pointermove: \"touchmove\",\n pointerup: \"touchend\",\n pointercancel: \"touchcancel\"\n};\nfunction getPointerEventName(name) {\n if (supportsPointerEvents()) {\n return name;\n }\n\n if (supportsTouchEvents()) {\n return touchEventNames[name];\n }\n\n if (supportsMouseEvents()) {\n return mouseEventNames[name];\n }\n\n return name;\n}\nfunction addPointerEvent(target, eventName, handler, options) {\n return addDomEvent(target, getPointerEventName(eventName), wrapPointerEventHandler(handler, eventName === \"pointerdown\"), options);\n}\nfunction isMultiTouchEvent(event) {\n return isTouchEvent(event) && event.touches.length > 1;\n}\n\n/**\n * The event information passed to pan event handlers like `onPan`, `onPanStart`.\n *\n * It contains information about the current state of the tap gesture such as its\n * `point`, `delta`, and `offset`\n */\n\n/**\n * @internal\n *\n * A Pan Session is recognized when the pointer is down\n * and moved in the allowed direction.\n */\nvar PanSession = /*#__PURE__*/function () {\n /**\n * We use this to keep track of the `x` and `y` pan session history\n * as the pan event happens. It helps to calculate the `offset` and `delta`\n */\n // The pointer event that started the pan session\n // The current pointer event for the pan session\n // The current pointer event info for the pan session\n\n /**\n * Minimal pan distance required before recognizing the pan.\n * @default \"3px\"\n */\n function PanSession(_event, handlers, threshold) {\n var _this = this;\n\n this.history = [];\n this.startEvent = null;\n this.lastEvent = null;\n this.lastEventInfo = null;\n this.handlers = {};\n this.removeListeners = noop;\n this.threshold = 3;\n this.win = void 0;\n\n this.updatePoint = function () {\n if (!(_this.lastEvent && _this.lastEventInfo)) return;\n var info = getPanInfo(_this.lastEventInfo, _this.history);\n var isPanStarted = _this.startEvent !== null;\n\n var isDistancePastThreshold = distance(info.offset, {\n x: 0,\n y: 0\n }) >= _this.threshold;\n\n if (!isPanStarted && !isDistancePastThreshold) return;\n\n var _getFrameData = getFrameData(),\n timestamp = _getFrameData.timestamp;\n\n _this.history.push(_extends({}, info.point, {\n timestamp: timestamp\n }));\n\n var _this$handlers = _this.handlers,\n onStart = _this$handlers.onStart,\n onMove = _this$handlers.onMove;\n\n if (!isPanStarted) {\n onStart == null ? void 0 : onStart(_this.lastEvent, info);\n _this.startEvent = _this.lastEvent;\n }\n\n onMove == null ? void 0 : onMove(_this.lastEvent, info);\n };\n\n this.onPointerMove = function (event, info) {\n _this.lastEvent = event;\n _this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`\n\n if (isMouseEvent(event) && event.buttons === 0) {\n _this.onPointerUp(event, info);\n\n return;\n } // Throttle mouse move event to once per frame\n\n\n sync.update(_this.updatePoint, true);\n };\n\n this.onPointerUp = function (event, info) {\n // notify pan session ended\n var panInfo = getPanInfo(info, _this.history);\n var _this$handlers2 = _this.handlers,\n onEnd = _this$handlers2.onEnd,\n onSessionEnd = _this$handlers2.onSessionEnd;\n onSessionEnd == null ? void 0 : onSessionEnd(event, panInfo);\n\n _this.end(); // if panning never started, no need to call `onEnd`\n // panning requires a pointermove of at least 3px\n\n\n if (!onEnd || !_this.startEvent) return;\n onEnd == null ? void 0 : onEnd(event, panInfo);\n };\n\n this.win = getEventWindow(_event); // If we have more than one touch, don't start detecting this gesture\n\n if (isMultiTouchEvent(_event)) return;\n this.handlers = handlers;\n\n if (threshold) {\n this.threshold = threshold;\n } // stop default browser behavior\n\n\n _event.stopPropagation();\n\n _event.preventDefault(); // get and save the `pointerdown` event info in history\n // we'll use it to compute the `offset`\n\n\n var _info = extractEventInfo(_event);\n\n var _getFrameData2 = getFrameData(),\n _timestamp = _getFrameData2.timestamp;\n\n this.history = [_extends({}, _info.point, {\n timestamp: _timestamp\n })]; // notify pan session start\n\n var onSessionStart = handlers.onSessionStart;\n onSessionStart == null ? void 0 : onSessionStart(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all\n\n this.removeListeners = pipe(addPointerEvent(this.win, \"pointermove\", this.onPointerMove), addPointerEvent(this.win, \"pointerup\", this.onPointerUp), addPointerEvent(this.win, \"pointercancel\", this.onPointerUp));\n }\n\n var _proto = PanSession.prototype;\n\n _proto.updateHandlers = function updateHandlers(handlers) {\n this.handlers = handlers;\n };\n\n _proto.end = function end() {\n var _this$removeListeners;\n\n (_this$removeListeners = this.removeListeners) == null ? void 0 : _this$removeListeners.call(this);\n cancelSync.update(this.updatePoint);\n };\n\n return PanSession;\n}();\n\nfunction subtractPoint(a, b) {\n return {\n x: a.x - b.x,\n y: a.y - b.y\n };\n}\n\nfunction startPanPoint(history) {\n return history[0];\n}\n\nfunction lastPanPoint(history) {\n return history[history.length - 1];\n}\n\nfunction getPanInfo(info, history) {\n return {\n point: info.point,\n delta: subtractPoint(info.point, lastPanPoint(history)),\n offset: subtractPoint(info.point, startPanPoint(history)),\n velocity: getVelocity(history, 0.1)\n };\n}\n\nfunction lastDevicePoint(history) {\n return history[history.length - 1];\n}\n\nvar toMilliseconds = function toMilliseconds(seconds) {\n return seconds * 1000;\n};\n\nfunction getVelocity(history, timeDelta) {\n if (history.length < 2) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var i = history.length - 1;\n var timestampedPoint = null;\n var lastPoint = lastDevicePoint(history);\n\n while (i >= 0) {\n timestampedPoint = history[i];\n\n if (lastPoint.timestamp - timestampedPoint.timestamp > toMilliseconds(timeDelta)) {\n break;\n }\n\n i--;\n }\n\n if (!timestampedPoint) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;\n\n if (time === 0) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time\n };\n\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0;\n }\n\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0;\n }\n\n return currentVelocity;\n}\n\nvar breakpoints = Object.freeze([\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"]);\nfunction mapResponsive(prop, mapper) {\n if (isArray(prop)) {\n return prop.map(function (item) {\n if (item === null) {\n return null;\n }\n\n return mapper(item);\n });\n }\n\n if (isObject(prop)) {\n return objectKeys(prop).reduce(function (result, key) {\n result[key] = mapper(prop[key]);\n return result;\n }, {});\n }\n\n if (prop != null) {\n return mapper(prop);\n }\n\n return null;\n}\nfunction objectToArrayNotation(obj, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var result = bps.map(function (br) {\n var _obj$br;\n\n return (_obj$br = obj[br]) != null ? _obj$br : null;\n });\n\n while (getLastItem(result) === null) {\n result.pop();\n }\n\n return result;\n}\nfunction arrayToObjectNotation(values, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var result = {};\n values.forEach(function (value, index) {\n var key = bps[index];\n if (value == null) return;\n result[key] = value;\n });\n return result;\n}\nfunction isResponsiveObjectLike(obj, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var keys = Object.keys(obj);\n return keys.length > 0 && keys.every(function (key) {\n return bps.includes(key);\n });\n}\n/**\n * since breakpoints are defined as custom properties on an array, you may\n * `Object.keys(theme.breakpoints)` to retrieve both regular numeric indices\n * and custom breakpoints as string.\n *\n * This function returns true given a custom array property.\n */\n\nvar isCustomBreakpoint = function isCustomBreakpoint(maybeBreakpoint) {\n return Number.isNaN(Number(maybeBreakpoint));\n};\n\nfunction getUserAgentBrowser(navigator) {\n var ua = navigator.userAgent,\n vendor = navigator.vendor;\n var android = /(android)/i.test(ua);\n\n switch (true) {\n case /CriOS/.test(ua):\n return \"Chrome for iOS\";\n\n case /Edg\\//.test(ua):\n return \"Edge\";\n\n case android && /Silk\\//.test(ua):\n return \"Silk\";\n\n case /Chrome/.test(ua) && /Google Inc/.test(vendor):\n return \"Chrome\";\n\n case /Firefox\\/\\d+\\.\\d+$/.test(ua):\n return \"Firefox\";\n\n case android:\n return \"AOSP\";\n\n case /MSIE|Trident/.test(ua):\n return \"IE\";\n\n case /Safari/.test(navigator.userAgent) && /Apple Computer/.test(ua):\n return \"Safari\";\n\n case /AppleWebKit/.test(ua):\n return \"WebKit\";\n\n default:\n return null;\n }\n}\n\nfunction getUserAgentOS(navigator) {\n var ua = navigator.userAgent,\n platform = navigator.platform;\n\n switch (true) {\n case /Android/.test(ua):\n return \"Android\";\n\n case /iPhone|iPad|iPod/.test(platform):\n return \"iOS\";\n\n case /Win/.test(platform):\n return \"Windows\";\n\n case /Mac/.test(platform):\n return \"Mac\";\n\n case /CrOS/.test(ua):\n return \"Chrome OS\";\n\n case /Firefox/.test(ua):\n return \"Firefox OS\";\n\n default:\n return null;\n }\n}\n\nfunction detectDeviceType(navigator) {\n var ua = navigator.userAgent;\n if (/(tablet)|(iPad)|(Nexus 9)/i.test(ua)) return \"tablet\";\n if (/(mobi)/i.test(ua)) return \"phone\";\n return \"desktop\";\n}\nfunction detectOS(os) {\n if (!isBrowser) return false;\n return getUserAgentOS(window.navigator) === os;\n}\nfunction detectBrowser(browser) {\n if (!isBrowser) return false;\n return getUserAgentBrowser(window.navigator) === browser;\n}\nfunction detectTouch() {\n if (!isBrowser) return false;\n return window.ontouchstart === null && window.ontouchmove === null && window.ontouchend === null;\n}\n\nfunction walkObject(target, predicate) {\n function inner(value, path) {\n if (path === void 0) {\n path = [];\n }\n\n if (isArray(value)) {\n return value.map(function (item, index) {\n return inner(item, [].concat(path, [String(index)]));\n });\n }\n\n if (isObject(value)) {\n return fromEntries(Object.entries(value).map(function (_ref) {\n var key = _ref[0],\n child = _ref[1];\n return [key, inner(child, [].concat(path, [key]))];\n }));\n }\n\n return predicate(value, path);\n }\n\n return inner(target);\n}\n\nexport { PanSession, __DEV__, __TEST__, addDomEvent, addItem, addPointerEvent, analyzeBreakpoints, ariaAttr, arrayToObjectNotation, breakpoints, callAll, callAllHandlers, canUseDOM, chunk, clampValue, closest, compose, contains, countDecimalPlaces, cx, dataAttr, detectBrowser, detectDeviceType, detectOS, detectTouch, determineLazyBehavior, distance, error, extractEventInfo, filterUndefined, flatten, focus, focusNextTabbable, focusPreviousTabbable, fromEntries, get, getActiveElement, getAllFocusable, getAllTabbable, getCSSVar, getEventWindow, getFirstFocusable, getFirstItem, getFirstTabbableIn, getLastItem, getLastTabbableIn, getNextIndex, getNextItem, getNextItemFromSearch, getNextTabbable, getOwnerDocument, getOwnerWindow, getPointerEventName, getPrevIndex, getPrevItem, getPreviousTabbable, getRelatedTarget, getViewportPointFromEvent, getWithDefault, hasDisplayNone, hasFocusWithin, hasNegativeTabIndex, hasTabIndex, isActiveElement, isArray, isBrowser, isContentEditable, isCssVar, isCustomBreakpoint, isDefined, isDisabled, isElement, isEmpty, isEmptyArray, isEmptyObject, isFocusable, isFunction, isHTMLElement, isHidden, isInputElement, isInputEvent, isMouseEvent, isMultiTouchEvent, isNotEmptyObject, isNotNumber, isNull, isNumber, isNumeric, isObject, isRefObject, isResponsiveObjectLike, isRightClick, isString, isTabbable, isTouchEvent, isUndefined, mapResponsive, maxSafeInteger, memoize, memoizedGet, minSafeInteger, noop, normalizeEventKey, objectFilter, objectKeys, objectToArrayNotation, omit, once, percentToValue, pick, pipe, px, removeIndex, removeItem, roundValueToStep, runIfFn, split, toPrecision, valueToPercent, walkObject, warn, wrapPointerEventHandler };\n","/**\n * Lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeMax = Math.max,\n nativeNow = Date.now;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\n/**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\nvar mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n baseMerge(object, source, srcIndex, customizer);\n});\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = mergeWith;\n","export * from 'css-box-model';\nexport { default as mergeWith } from 'lodash.mergewith';\nimport sync, { cancelSync, getFrameData } from 'framesync';\n\nfunction getFirstItem(array) {\n return array != null && array.length ? array[0] : undefined;\n}\nfunction getLastItem(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\nfunction getPrevItem(index, array, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n var prevIndex = getPrevIndex(index, array.length, loop);\n return array[prevIndex];\n}\nfunction getNextItem(index, array, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n var nextIndex = getNextIndex(index, array.length, 1, loop);\n return array[nextIndex];\n}\nfunction removeIndex(array, index) {\n return array.filter(function (_, idx) {\n return idx !== index;\n });\n}\nfunction addItem(array, item) {\n return [].concat(array, [item]);\n}\nfunction removeItem(array, item) {\n return array.filter(function (eachItem) {\n return eachItem !== item;\n });\n}\n/**\n * Get the next index based on the current index and step.\n *\n * @param currentIndex the current index\n * @param length the total length or count of items\n * @param step the number of steps\n * @param loop whether to circle back once `currentIndex` is at the start/end\n */\n\nfunction getNextIndex(currentIndex, length, step, loop) {\n if (step === void 0) {\n step = 1;\n }\n\n if (loop === void 0) {\n loop = true;\n }\n\n var lastIndex = length - 1;\n\n if (currentIndex === -1) {\n return step > 0 ? 0 : lastIndex;\n }\n\n var nextIndex = currentIndex + step;\n\n if (nextIndex < 0) {\n return loop ? lastIndex : 0;\n }\n\n if (nextIndex >= length) {\n if (loop) return 0;\n return currentIndex > length ? length : currentIndex;\n }\n\n return nextIndex;\n}\n/**\n * Get's the previous index based on the current index.\n * Mostly used for keyboard navigation.\n *\n * @param index - the current index\n * @param count - the length or total count of items in the array\n * @param loop - whether we should circle back to the\n * first/last once `currentIndex` is at the start/end\n */\n\nfunction getPrevIndex(index, count, loop) {\n if (loop === void 0) {\n loop = true;\n }\n\n return getNextIndex(index, count, -1, loop);\n}\n/**\n * Converts an array into smaller chunks or groups.\n *\n * @param array the array to chunk into group\n * @param size the length of each chunk\n */\n\nfunction chunk(array, size) {\n return array.reduce(function (rows, currentValue, index) {\n if (index % size === 0) {\n rows.push([currentValue]);\n } else {\n rows[rows.length - 1].push(currentValue);\n }\n\n return rows;\n }, []);\n}\n/**\n * Gets the next item based on a search string\n *\n * @param items array of items\n * @param searchString the search string\n * @param itemToString resolves an item to string\n * @param currentItem the current selected item\n */\n\nfunction getNextItemFromSearch(items, searchString, itemToString, currentItem) {\n if (searchString == null) {\n return currentItem;\n } // If current item doesn't exist, find the item that matches the search string\n\n\n if (!currentItem) {\n var foundItem = items.find(function (item) {\n return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());\n });\n return foundItem;\n } // Filter items for ones that match the search string (case insensitive)\n\n\n var matchingItems = items.filter(function (item) {\n return itemToString(item).toLowerCase().startsWith(searchString.toLowerCase());\n }); // If there's a match, let's get the next item to select\n\n if (matchingItems.length > 0) {\n var nextIndex; // If the currentItem is in the available items, we move to the next available option\n\n if (matchingItems.includes(currentItem)) {\n var currentIndex = matchingItems.indexOf(currentItem);\n nextIndex = currentIndex + 1;\n\n if (nextIndex === matchingItems.length) {\n nextIndex = 0;\n }\n\n return matchingItems[nextIndex];\n } // Else, we pick the first item in the available items\n\n\n nextIndex = items.indexOf(matchingItems[0]);\n return items[nextIndex];\n } // a decent fallback to the currentItem\n\n\n return currentItem;\n}\n\n// Number assertions\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isNotNumber(value) {\n return typeof value !== \"number\" || Number.isNaN(value) || !Number.isFinite(value);\n}\nfunction isNumeric(value) {\n return value != null && value - parseFloat(value) + 1 >= 0;\n} // Array assertions\n\nfunction isArray(value) {\n return Array.isArray(value);\n}\nfunction isEmptyArray(value) {\n return isArray(value) && value.length === 0;\n} // Function assertions\n\nfunction isFunction(value) {\n return typeof value === \"function\";\n} // Generic assertions\n\nfunction isDefined(value) {\n return typeof value !== \"undefined\" && value !== undefined;\n}\nfunction isUndefined(value) {\n return typeof value === \"undefined\" || value === undefined;\n} // Object assertions\n\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type === \"object\" || type === \"function\") && !isArray(value);\n}\nfunction isEmptyObject(value) {\n return isObject(value) && Object.keys(value).length === 0;\n}\nfunction isNotEmptyObject(value) {\n return value && !isEmptyObject(value);\n}\nfunction isNull(value) {\n return value == null;\n} // String assertions\n\nfunction isString(value) {\n return Object.prototype.toString.call(value) === \"[object String]\";\n}\nfunction isCssVar(value) {\n return /^var\\(--.+\\)$/.test(value);\n} // Empty assertions\n\nfunction isEmpty(value) {\n if (isArray(value)) return isEmptyArray(value);\n if (isObject(value)) return isEmptyObject(value);\n if (value == null || value === \"\") return true;\n return false;\n}\nvar __DEV__ = process.env.NODE_ENV !== \"production\";\nvar __TEST__ = process.env.NODE_ENV === \"test\";\nfunction isRefObject(val) {\n return \"current\" in val;\n}\nfunction isInputEvent(value) {\n return value && isObject(value) && isObject(value.target);\n}\n\nfunction omit(object, keys) {\n var result = {};\n Object.keys(object).forEach(function (key) {\n if (keys.includes(key)) return;\n result[key] = object[key];\n });\n return result;\n}\nfunction pick(object, keys) {\n var result = {};\n keys.forEach(function (key) {\n if (key in object) {\n result[key] = object[key];\n }\n });\n return result;\n}\nfunction split(object, keys) {\n var picked = {};\n var omitted = {};\n Object.keys(object).forEach(function (key) {\n if (keys.includes(key)) {\n picked[key] = object[key];\n } else {\n omitted[key] = object[key];\n }\n });\n return [picked, omitted];\n}\n/**\n * Get value from a deeply nested object using a string path.\n * Memoizes the value.\n * @param obj - the object\n * @param path - the string path\n * @param def - the fallback value\n */\n\nfunction get(obj, path, fallback, index) {\n var key = typeof path === \"string\" ? path.split(\".\") : [path];\n\n for (index = 0; index < key.length; index += 1) {\n if (!obj) break;\n obj = obj[key[index]];\n }\n\n return obj === undefined ? fallback : obj;\n}\nvar memoize = function memoize(fn) {\n var cache = new WeakMap();\n\n var memoizedFn = function memoizedFn(obj, path, fallback, index) {\n if (typeof obj === \"undefined\") {\n return fn(obj, path, fallback);\n }\n\n if (!cache.has(obj)) {\n cache.set(obj, new Map());\n }\n\n var map = cache.get(obj);\n\n if (map.has(path)) {\n return map.get(path);\n }\n\n var value = fn(obj, path, fallback, index);\n map.set(path, value);\n return value;\n };\n\n return memoizedFn;\n};\nvar memoizedGet = memoize(get);\n/**\n * Get value from deeply nested object, based on path\n * It returns the path value if not found in object\n *\n * @param path - the string path or value\n * @param scale - the string path or value\n */\n\nfunction getWithDefault(path, scale) {\n return memoizedGet(scale, path, path);\n}\n\n/**\n * Returns the items of an object that meet the condition specified in a callback function.\n *\n * @param object the object to loop through\n * @param fn The filter function\n */\nfunction objectFilter(object, fn) {\n var result = {};\n Object.keys(object).forEach(function (key) {\n var value = object[key];\n var shouldPass = fn(value, key, object);\n\n if (shouldPass) {\n result[key] = value;\n }\n });\n return result;\n}\nvar filterUndefined = function filterUndefined(object) {\n return objectFilter(object, function (val) {\n return val !== null && val !== undefined;\n });\n};\nvar objectKeys = function objectKeys(obj) {\n return Object.keys(obj);\n};\n/**\n * Object.entries polyfill for Nodev10 compatibility\n */\n\nvar fromEntries = function fromEntries(entries) {\n return entries.reduce(function (carry, _ref) {\n var key = _ref[0],\n value = _ref[1];\n carry[key] = value;\n return carry;\n }, {});\n};\n/**\n * Get the CSS variable ref stored in the theme\n */\n\nvar getCSSVar = function getCSSVar(theme, scale, value) {\n var _theme$__cssMap$$varR, _theme$__cssMap$;\n\n return (_theme$__cssMap$$varR = (_theme$__cssMap$ = theme.__cssMap[scale + \".\" + value]) == null ? void 0 : _theme$__cssMap$.varRef) != null ? _theme$__cssMap$$varR : value;\n};\n\nfunction analyzeCSSValue(value) {\n var num = parseFloat(value.toString());\n var unit = value.toString().replace(String(num), \"\");\n return {\n unitless: !unit,\n value: num,\n unit: unit\n };\n}\n\nfunction px(value) {\n if (value == null) return value;\n\n var _analyzeCSSValue = analyzeCSSValue(value),\n unitless = _analyzeCSSValue.unitless;\n\n return unitless || isNumber(value) ? value + \"px\" : value;\n}\n\nvar sortByBreakpointValue = function sortByBreakpointValue(a, b) {\n return parseInt(a[1], 10) > parseInt(b[1], 10) ? 1 : -1;\n};\n\nvar sortBps = function sortBps(breakpoints) {\n return fromEntries(Object.entries(breakpoints).sort(sortByBreakpointValue));\n};\n\nfunction normalize(breakpoints) {\n var sorted = sortBps(breakpoints);\n return Object.assign(Object.values(sorted), sorted);\n}\n\nfunction keys(breakpoints) {\n var value = Object.keys(sortBps(breakpoints));\n return new Set(value);\n}\n\nfunction subtract(value) {\n var _px;\n\n if (!value) return value;\n value = (_px = px(value)) != null ? _px : value;\n var factor = value.endsWith(\"px\") ? -1 : // the equivalent of 1px in em using a 16px base\n -0.0635;\n return isNumber(value) ? \"\" + (value + factor) : value.replace(/([0-9]+\\.?[0-9]*)/, function (m) {\n return \"\" + (parseFloat(m) + factor);\n });\n}\n\nfunction queryString(min, max) {\n var query = [\"@media screen\"];\n if (min) query.push(\"and\", \"(min-width: \" + px(min) + \")\");\n if (max) query.push(\"and\", \"(max-width: \" + px(max) + \")\");\n return query.join(\" \");\n}\n\nfunction analyzeBreakpoints(breakpoints) {\n var _breakpoints$base;\n\n if (!breakpoints) return null;\n breakpoints.base = (_breakpoints$base = breakpoints.base) != null ? _breakpoints$base : \"0px\";\n var normalized = normalize(breakpoints);\n var queries = Object.entries(breakpoints).sort(sortByBreakpointValue).map(function (_ref, index, entry) {\n var _entry;\n\n var breakpoint = _ref[0],\n minW = _ref[1];\n\n var _ref2 = (_entry = entry[index + 1]) != null ? _entry : [],\n maxW = _ref2[1];\n\n maxW = parseFloat(maxW) > 0 ? subtract(maxW) : undefined;\n return {\n breakpoint: breakpoint,\n minW: minW,\n maxW: maxW,\n maxWQuery: queryString(null, maxW),\n minWQuery: queryString(minW),\n minMaxQuery: queryString(minW, maxW)\n };\n });\n\n var _keys = keys(breakpoints);\n\n var _keysArr = Array.from(_keys.values());\n\n return {\n keys: _keys,\n normalized: normalized,\n isResponsive: function isResponsive(test) {\n var keys = Object.keys(test);\n return keys.length > 0 && keys.every(function (key) {\n return _keys.has(key);\n });\n },\n asObject: sortBps(breakpoints),\n asArray: normalize(breakpoints),\n details: queries,\n media: [null].concat(normalized.map(function (minW) {\n return queryString(minW);\n }).slice(1)),\n toArrayValue: function toArrayValue(test) {\n if (!isObject(test)) {\n throw new Error(\"toArrayValue: value must be an object\");\n }\n\n var result = _keysArr.map(function (bp) {\n var _test$bp;\n\n return (_test$bp = test[bp]) != null ? _test$bp : null;\n });\n\n while (getLastItem(result) === null) {\n result.pop();\n }\n\n return result;\n },\n toObjectValue: function toObjectValue(test) {\n if (!Array.isArray(test)) {\n throw new Error(\"toObjectValue: value must be an array\");\n }\n\n return test.reduce(function (acc, value, index) {\n var key = _keysArr[index];\n if (key != null && value != null) acc[key] = value;\n return acc;\n }, {});\n }\n };\n}\n\nfunction isElement(el) {\n return el != null && typeof el == \"object\" && \"nodeType\" in el && el.nodeType === Node.ELEMENT_NODE;\n}\nfunction isHTMLElement(el) {\n var _el$ownerDocument$def;\n\n if (!isElement(el)) {\n return false;\n }\n\n var win = (_el$ownerDocument$def = el.ownerDocument.defaultView) != null ? _el$ownerDocument$def : window;\n return el instanceof win.HTMLElement;\n}\nfunction getOwnerWindow(node) {\n var _getOwnerDocument$def, _getOwnerDocument;\n\n return isElement(node) ? (_getOwnerDocument$def = (_getOwnerDocument = getOwnerDocument(node)) == null ? void 0 : _getOwnerDocument.defaultView) != null ? _getOwnerDocument$def : window : window;\n}\nfunction getOwnerDocument(node) {\n var _node$ownerDocument;\n\n return isElement(node) ? (_node$ownerDocument = node.ownerDocument) != null ? _node$ownerDocument : document : document;\n}\nfunction getEventWindow(event) {\n var _view;\n\n return (_view = event.view) != null ? _view : window;\n}\nfunction canUseDOM() {\n return !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\n}\nvar isBrowser = canUseDOM();\nvar dataAttr = function dataAttr(condition) {\n return condition ? \"\" : undefined;\n};\nvar ariaAttr = function ariaAttr(condition) {\n return condition ? true : undefined;\n};\nvar cx = function cx() {\n for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {\n classNames[_key] = arguments[_key];\n }\n\n return classNames.filter(Boolean).join(\" \");\n};\nfunction getActiveElement(node) {\n var doc = getOwnerDocument(node);\n return doc == null ? void 0 : doc.activeElement;\n}\nfunction contains(parent, child) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\nfunction addDomEvent(target, eventName, handler, options) {\n target.addEventListener(eventName, handler, options);\n return function () {\n target.removeEventListener(eventName, handler, options);\n };\n}\n/**\n * Get the normalized event key across all browsers\n * @param event keyboard event\n */\n\nfunction normalizeEventKey(event) {\n var key = event.key,\n keyCode = event.keyCode;\n var isArrowKey = keyCode >= 37 && keyCode <= 40 && key.indexOf(\"Arrow\") !== 0;\n var eventKey = isArrowKey ? \"Arrow\" + key : key;\n return eventKey;\n}\nfunction getRelatedTarget(event) {\n var _event$target, _event$relatedTarget;\n\n var target = (_event$target = event.target) != null ? _event$target : event.currentTarget;\n var activeElement = getActiveElement(target);\n return (_event$relatedTarget = event.relatedTarget) != null ? _event$relatedTarget : activeElement;\n}\nfunction isRightClick(event) {\n return event.button !== 0;\n}\n\n// Really great work done by Diego Haz on this one\nvar hasDisplayNone = function hasDisplayNone(element) {\n return window.getComputedStyle(element).display === \"none\";\n};\nvar hasTabIndex = function hasTabIndex(element) {\n return element.hasAttribute(\"tabindex\");\n};\nvar hasNegativeTabIndex = function hasNegativeTabIndex(element) {\n return hasTabIndex(element) && element.tabIndex === -1;\n};\nfunction isDisabled(element) {\n return Boolean(element.getAttribute(\"disabled\")) === true || Boolean(element.getAttribute(\"aria-disabled\")) === true;\n}\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName.toLowerCase() === \"input\" && \"select\" in element;\n}\nfunction isActiveElement(element) {\n var doc = isHTMLElement(element) ? getOwnerDocument(element) : document;\n return doc.activeElement === element;\n}\nfunction hasFocusWithin(element) {\n if (!document.activeElement) return false;\n return element.contains(document.activeElement);\n}\nfunction isHidden(element) {\n if (element.parentElement && isHidden(element.parentElement)) return true;\n return element.hidden;\n}\nfunction isContentEditable(element) {\n var value = element.getAttribute(\"contenteditable\");\n return value !== \"false\" && value != null;\n}\nfunction isFocusable(element) {\n if (!isHTMLElement(element) || isHidden(element) || isDisabled(element)) {\n return false;\n }\n\n var localName = element.localName;\n var focusableTags = [\"input\", \"select\", \"textarea\", \"button\"];\n if (focusableTags.indexOf(localName) >= 0) return true;\n var others = {\n a: function a() {\n return element.hasAttribute(\"href\");\n },\n audio: function audio() {\n return element.hasAttribute(\"controls\");\n },\n video: function video() {\n return element.hasAttribute(\"controls\");\n }\n };\n\n if (localName in others) {\n return others[localName]();\n }\n\n if (isContentEditable(element)) return true;\n return hasTabIndex(element);\n}\nfunction isTabbable(element) {\n if (!element) return false;\n return isHTMLElement(element) && isFocusable(element) && !hasNegativeTabIndex(element);\n}\n\nvar focusableElList = [\"input:not([disabled])\", \"select:not([disabled])\", \"textarea:not([disabled])\", \"embed\", \"iframe\", \"object\", \"a[href]\", \"area[href]\", \"button:not([disabled])\", \"[tabindex]\", \"audio[controls]\", \"video[controls]\", \"*[tabindex]:not([aria-disabled])\", \"*[contenteditable]\"];\nvar focusableElSelector = focusableElList.join();\nfunction getAllFocusable(container) {\n var focusableEls = Array.from(container.querySelectorAll(focusableElSelector));\n focusableEls.unshift(container);\n return focusableEls.filter(isFocusable).filter(function (el) {\n return window.getComputedStyle(el).display !== \"none\";\n });\n}\nfunction getFirstFocusable(container) {\n var allFocusable = getAllFocusable(container);\n return allFocusable.length ? allFocusable[0] : null;\n}\nfunction getAllTabbable(container, fallbackToFocusable) {\n var allFocusable = Array.from(container.querySelectorAll(focusableElSelector));\n var allTabbable = allFocusable.filter(isTabbable);\n\n if (isTabbable(container)) {\n allTabbable.unshift(container);\n }\n\n if (!allTabbable.length && fallbackToFocusable) {\n return allFocusable;\n }\n\n return allTabbable;\n}\nfunction getFirstTabbableIn(container, fallbackToFocusable) {\n var _getAllTabbable = getAllTabbable(container, fallbackToFocusable),\n first = _getAllTabbable[0];\n\n return first || null;\n}\nfunction getLastTabbableIn(container, fallbackToFocusable) {\n var allTabbable = getAllTabbable(container, fallbackToFocusable);\n return allTabbable[allTabbable.length - 1] || null;\n}\nfunction getNextTabbable(container, fallbackToFocusable) {\n var allFocusable = getAllFocusable(container);\n var index = allFocusable.indexOf(document.activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\nfunction getPreviousTabbable(container, fallbackToFocusable) {\n var allFocusable = getAllFocusable(container).reverse();\n var index = allFocusable.indexOf(document.activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\nfunction focusNextTabbable(container, fallbackToFocusable) {\n var nextTabbable = getNextTabbable(container, fallbackToFocusable);\n\n if (nextTabbable && isHTMLElement(nextTabbable)) {\n nextTabbable.focus();\n }\n}\nfunction focusPreviousTabbable(container, fallbackToFocusable) {\n var previousTabbable = getPreviousTabbable(container, fallbackToFocusable);\n\n if (previousTabbable && isHTMLElement(previousTabbable)) {\n previousTabbable.focus();\n }\n}\n\nfunction matches(element, selectors) {\n if (\"matches\" in element) return element.matches(selectors);\n if (\"msMatchesSelector\" in element) return element.msMatchesSelector(selectors);\n return element.webkitMatchesSelector(selectors);\n}\n\nfunction closest(element, selectors) {\n if (\"closest\" in element) return element.closest(selectors);\n\n do {\n if (matches(element, selectors)) return element;\n element = element.parentElement || element.parentNode;\n } while (element !== null && element.nodeType === 1);\n\n return null;\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\n/* eslint-disable no-nested-ternary */\nfunction runIfFn(valueOrFn) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return isFunction(valueOrFn) ? valueOrFn.apply(void 0, args) : valueOrFn;\n}\nfunction callAllHandlers() {\n for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n fns[_key2] = arguments[_key2];\n }\n\n return function func(event) {\n fns.some(function (fn) {\n fn == null ? void 0 : fn(event);\n return event == null ? void 0 : event.defaultPrevented;\n });\n };\n}\nfunction callAll() {\n for (var _len3 = arguments.length, fns = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n fns[_key3] = arguments[_key3];\n }\n\n return function mergedFn(arg) {\n fns.forEach(function (fn) {\n fn == null ? void 0 : fn(arg);\n });\n };\n}\nvar compose = function compose(fn1) {\n for (var _len4 = arguments.length, fns = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n fns[_key4 - 1] = arguments[_key4];\n }\n\n return fns.reduce(function (f1, f2) {\n return function () {\n return f1(f2.apply(void 0, arguments));\n };\n }, fn1);\n};\nfunction once(fn) {\n var result;\n return function func() {\n if (fn) {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n\n result = fn.apply(this, args);\n fn = null;\n }\n\n return result;\n };\n}\nvar noop = function noop() {};\nvar warn = once(function (options) {\n return function () {\n var condition = options.condition,\n message = options.message;\n\n if (condition && __DEV__) {\n console.warn(message);\n }\n };\n});\nvar error = once(function (options) {\n return function () {\n var condition = options.condition,\n message = options.message;\n\n if (condition && __DEV__) {\n console.error(message);\n }\n };\n});\nvar pipe = function pipe() {\n for (var _len6 = arguments.length, fns = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n fns[_key6] = arguments[_key6];\n }\n\n return function (v) {\n return fns.reduce(function (a, b) {\n return b(a);\n }, v);\n };\n};\n\nvar distance1D = function distance1D(a, b) {\n return Math.abs(a - b);\n};\n\nvar isPoint = function isPoint(point) {\n return \"x\" in point && \"y\" in point;\n};\n\nfunction distance(a, b) {\n if (isNumber(a) && isNumber(b)) {\n return distance1D(a, b);\n }\n\n if (isPoint(a) && isPoint(b)) {\n var xDelta = distance1D(a.x, b.x);\n var yDelta = distance1D(a.y, b.y);\n return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2));\n }\n\n return 0;\n}\n\nfunction focus(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$isActive = _options.isActive,\n isActive = _options$isActive === void 0 ? isActiveElement : _options$isActive,\n nextTick = _options.nextTick,\n _options$preventScrol = _options.preventScroll,\n preventScroll = _options$preventScrol === void 0 ? true : _options$preventScrol,\n _options$selectTextIf = _options.selectTextIfInput,\n selectTextIfInput = _options$selectTextIf === void 0 ? true : _options$selectTextIf;\n if (!element || isActive(element)) return -1;\n\n function triggerFocus() {\n if (!element) {\n warn({\n condition: true,\n message: \"[chakra-ui]: can't call focus() on `null` or `undefined` element\"\n });\n return;\n }\n\n if (supportsPreventScroll()) {\n element.focus({\n preventScroll: preventScroll\n });\n } else {\n element.focus();\n\n if (preventScroll) {\n var scrollableElements = getScrollableElements(element);\n restoreScrollPosition(scrollableElements);\n }\n }\n\n if (isInputElement(element) && selectTextIfInput) {\n element.select();\n }\n }\n\n if (nextTick) {\n return requestAnimationFrame(triggerFocus);\n }\n\n triggerFocus();\n return -1;\n}\nvar supportsPreventScrollCached = null;\n\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n\n try {\n var div = document.createElement(\"div\");\n div.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n\n });\n } catch (e) {// Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element) {\n var _doc$defaultView;\n\n var doc = getOwnerDocument(element);\n var win = (_doc$defaultView = doc.defaultView) != null ? _doc$defaultView : window;\n var parent = element.parentNode;\n var scrollableElements = [];\n var rootScrollingElement = doc.scrollingElement || doc.documentElement;\n\n while (parent instanceof win.HTMLElement && parent !== rootScrollingElement) {\n if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof win.HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements) {\n for (var _iterator = _createForOfIteratorHelperLoose(scrollableElements), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n element = _step$value.element,\n scrollTop = _step$value.scrollTop,\n scrollLeft = _step$value.scrollLeft;\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n\nfunction flatten(target, maxDepth) {\n if (maxDepth === void 0) {\n maxDepth = Infinity;\n }\n\n if (!isObject(target) && !Array.isArray(target) || !maxDepth) {\n return target;\n }\n\n return Object.entries(target).reduce(function (result, _ref) {\n var key = _ref[0],\n value = _ref[1];\n\n if (isObject(value) || isArray(value)) {\n Object.entries(flatten(value, maxDepth - 1)).forEach(function (_ref2) {\n var childKey = _ref2[0],\n childValue = _ref2[1];\n // e.g. gray.500\n result[key + \".\" + childKey] = childValue;\n });\n } else {\n // e.g. transparent\n result[key] = value;\n }\n\n return result;\n }, {});\n}\n\n/**\n * Determines whether the children of a disclosure widget\n * should be rendered or not, depending on the lazy behavior.\n *\n * Used in accordion, tabs, popover, menu and other disclosure\n * widgets.\n */\nfunction determineLazyBehavior(options) {\n var hasBeenSelected = options.hasBeenSelected,\n isLazy = options.isLazy,\n isSelected = options.isSelected,\n _options$lazyBehavior = options.lazyBehavior,\n lazyBehavior = _options$lazyBehavior === void 0 ? \"unmount\" : _options$lazyBehavior; // if not lazy, always render the disclosure's content\n\n if (!isLazy) return true; // if the diclosure is selected, render the disclosure's content\n\n if (isSelected) return true; // if the disclosure was selected but not active, keep its content active\n\n if (lazyBehavior === \"keepMounted\" && hasBeenSelected) return true;\n return false;\n}\n\nvar minSafeInteger = Number.MIN_SAFE_INTEGER || -9007199254740991;\nvar maxSafeInteger = Number.MAX_SAFE_INTEGER || 9007199254740991;\n\nfunction toNumber(value) {\n var num = parseFloat(value);\n return isNotNumber(num) ? 0 : num;\n}\n/**\n * Converts a value to a specific precision (or decimal points).\n *\n * Returns a string representing a number in fixed-point notation.\n *\n * @param value the value to convert\n * @param precision the precision or decimal points\n */\n\n\nfunction toPrecision(value, precision) {\n var nextValue = toNumber(value);\n var scaleFactor = Math.pow(10, precision != null ? precision : 10);\n nextValue = Math.round(nextValue * scaleFactor) / scaleFactor;\n return precision ? nextValue.toFixed(precision) : nextValue.toString();\n}\n/**\n * Counts the number of decimal places a number has\n *\n * @param value the decimal value to count\n */\n\nfunction countDecimalPlaces(value) {\n if (!Number.isFinite(value)) return 0;\n var e = 1;\n var p = 0;\n\n while (Math.round(value * e) / e !== value) {\n e *= 10;\n p += 1;\n }\n\n return p;\n}\n/**\n * Convert a value to percentage based on lower and upper bound values\n *\n * @param value the value in number\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction valueToPercent(value, min, max) {\n return (value - min) * 100 / (max - min);\n}\n/**\n * Calculate the value based on percentage, lower and upper bound values\n *\n * @param percent the percent value in decimals (e.g 0.6, 0.3)\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction percentToValue(percent, min, max) {\n return (max - min) * percent + min;\n}\n/**\n * Rounds a specific value to the next or previous step\n *\n * @param value the value to round\n * @param from the number that stepping started from\n * @param step the specified step\n */\n\nfunction roundValueToStep(value, from, step) {\n var nextValue = Math.round((value - from) / step) * step + from;\n var precision = countDecimalPlaces(step);\n return toPrecision(nextValue, precision);\n}\n/**\n * Clamps a value to ensure it stays within the min and max range.\n *\n * @param value the value to clamp\n * @param min the minimum value\n * @param max the maximum value\n */\n\nfunction clampValue(value, min, max) {\n if (value == null) return value;\n warn({\n condition: max < min,\n message: \"clamp: max cannot be less than min\"\n });\n return Math.min(Math.max(value, min), max);\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\n/**\n * Credit goes to `framer-motion` of this useful utilities.\n * License can be found here: https://github.com/framer/motion\n */\nfunction isMouseEvent(event) {\n var win = getEventWindow(event); // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.\n\n if (typeof win.PointerEvent !== \"undefined\" && event instanceof win.PointerEvent) {\n return !!(event.pointerType === \"mouse\");\n }\n\n return event instanceof win.MouseEvent;\n}\nfunction isTouchEvent(event) {\n var hasTouches = !!event.touches;\n return hasTouches;\n}\n\n/**\n * Filters out events not attached to the primary pointer (currently left mouse button)\n * @param eventHandler\n */\nfunction filterPrimaryPointer(eventHandler) {\n return function (event) {\n var win = getEventWindow(event);\n var isMouseEvent = event instanceof win.MouseEvent;\n var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;\n\n if (isPrimaryPointer) {\n eventHandler(event);\n }\n };\n}\n\nvar defaultPagePoint = {\n pageX: 0,\n pageY: 0\n};\n\nfunction pointFromTouch(e, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n var primaryTouch = e.touches[0] || e.changedTouches[0];\n var point = primaryTouch || defaultPagePoint;\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"]\n };\n}\n\nfunction pointFromMouse(point, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"]\n };\n}\n\nfunction extractEventInfo(event, pointType) {\n if (pointType === void 0) {\n pointType = \"page\";\n }\n\n return {\n point: isTouchEvent(event) ? pointFromTouch(event, pointType) : pointFromMouse(event, pointType)\n };\n}\nfunction getViewportPointFromEvent(event) {\n return extractEventInfo(event, \"client\");\n}\nvar wrapPointerEventHandler = function wrapPointerEventHandler(handler, shouldFilterPrimaryPointer) {\n if (shouldFilterPrimaryPointer === void 0) {\n shouldFilterPrimaryPointer = false;\n }\n\n var listener = function listener(event) {\n return handler(event, extractEventInfo(event));\n };\n\n return shouldFilterPrimaryPointer ? filterPrimaryPointer(listener) : listener;\n}; // We check for event support via functions in case they've been mocked by a testing suite.\n\nvar supportsPointerEvents = function supportsPointerEvents() {\n return isBrowser && window.onpointerdown === null;\n};\n\nvar supportsTouchEvents = function supportsTouchEvents() {\n return isBrowser && window.ontouchstart === null;\n};\n\nvar supportsMouseEvents = function supportsMouseEvents() {\n return isBrowser && window.onmousedown === null;\n};\n\nvar mouseEventNames = {\n pointerdown: \"mousedown\",\n pointermove: \"mousemove\",\n pointerup: \"mouseup\",\n pointercancel: \"mousecancel\",\n pointerover: \"mouseover\",\n pointerout: \"mouseout\",\n pointerenter: \"mouseenter\",\n pointerleave: \"mouseleave\"\n};\nvar touchEventNames = {\n pointerdown: \"touchstart\",\n pointermove: \"touchmove\",\n pointerup: \"touchend\",\n pointercancel: \"touchcancel\"\n};\nfunction getPointerEventName(name) {\n if (supportsPointerEvents()) {\n return name;\n }\n\n if (supportsTouchEvents()) {\n return touchEventNames[name];\n }\n\n if (supportsMouseEvents()) {\n return mouseEventNames[name];\n }\n\n return name;\n}\nfunction addPointerEvent(target, eventName, handler, options) {\n return addDomEvent(target, getPointerEventName(eventName), wrapPointerEventHandler(handler, eventName === \"pointerdown\"), options);\n}\nfunction isMultiTouchEvent(event) {\n return isTouchEvent(event) && event.touches.length > 1;\n}\n\n/**\n * The event information passed to pan event handlers like `onPan`, `onPanStart`.\n *\n * It contains information about the current state of the tap gesture such as its\n * `point`, `delta`, and `offset`\n */\n\n/**\n * @internal\n *\n * A Pan Session is recognized when the pointer is down\n * and moved in the allowed direction.\n */\nvar PanSession = /*#__PURE__*/function () {\n /**\n * We use this to keep track of the `x` and `y` pan session history\n * as the pan event happens. It helps to calculate the `offset` and `delta`\n */\n // The pointer event that started the pan session\n // The current pointer event for the pan session\n // The current pointer event info for the pan session\n\n /**\n * Minimal pan distance required before recognizing the pan.\n * @default \"3px\"\n */\n function PanSession(_event, handlers, threshold) {\n var _this = this;\n\n this.history = [];\n this.startEvent = null;\n this.lastEvent = null;\n this.lastEventInfo = null;\n this.handlers = {};\n this.removeListeners = noop;\n this.threshold = 3;\n this.win = void 0;\n\n this.updatePoint = function () {\n if (!(_this.lastEvent && _this.lastEventInfo)) return;\n var info = getPanInfo(_this.lastEventInfo, _this.history);\n var isPanStarted = _this.startEvent !== null;\n\n var isDistancePastThreshold = distance(info.offset, {\n x: 0,\n y: 0\n }) >= _this.threshold;\n\n if (!isPanStarted && !isDistancePastThreshold) return;\n\n var _getFrameData = getFrameData(),\n timestamp = _getFrameData.timestamp;\n\n _this.history.push(_extends({}, info.point, {\n timestamp: timestamp\n }));\n\n var _this$handlers = _this.handlers,\n onStart = _this$handlers.onStart,\n onMove = _this$handlers.onMove;\n\n if (!isPanStarted) {\n onStart == null ? void 0 : onStart(_this.lastEvent, info);\n _this.startEvent = _this.lastEvent;\n }\n\n onMove == null ? void 0 : onMove(_this.lastEvent, info);\n };\n\n this.onPointerMove = function (event, info) {\n _this.lastEvent = event;\n _this.lastEventInfo = info; // Because Safari doesn't trigger mouseup events when it's above a `<select>`\n\n if (isMouseEvent(event) && event.buttons === 0) {\n _this.onPointerUp(event, info);\n\n return;\n } // Throttle mouse move event to once per frame\n\n\n sync.update(_this.updatePoint, true);\n };\n\n this.onPointerUp = function (event, info) {\n // notify pan session ended\n var panInfo = getPanInfo(info, _this.history);\n var _this$handlers2 = _this.handlers,\n onEnd = _this$handlers2.onEnd,\n onSessionEnd = _this$handlers2.onSessionEnd;\n onSessionEnd == null ? void 0 : onSessionEnd(event, panInfo);\n\n _this.end(); // if panning never started, no need to call `onEnd`\n // panning requires a pointermove of at least 3px\n\n\n if (!onEnd || !_this.startEvent) return;\n onEnd == null ? void 0 : onEnd(event, panInfo);\n };\n\n this.win = getEventWindow(_event); // If we have more than one touch, don't start detecting this gesture\n\n if (isMultiTouchEvent(_event)) return;\n this.handlers = handlers;\n\n if (threshold) {\n this.threshold = threshold;\n } // stop default browser behavior\n\n\n _event.stopPropagation();\n\n _event.preventDefault(); // get and save the `pointerdown` event info in history\n // we'll use it to compute the `offset`\n\n\n var _info = extractEventInfo(_event);\n\n var _getFrameData2 = getFrameData(),\n _timestamp = _getFrameData2.timestamp;\n\n this.history = [_extends({}, _info.point, {\n timestamp: _timestamp\n })]; // notify pan session start\n\n var onSessionStart = handlers.onSessionStart;\n onSessionStart == null ? void 0 : onSessionStart(_event, getPanInfo(_info, this.history)); // attach event listeners and return a single function to remove them all\n\n this.removeListeners = pipe(addPointerEvent(this.win, \"pointermove\", this.onPointerMove), addPointerEvent(this.win, \"pointerup\", this.onPointerUp), addPointerEvent(this.win, \"pointercancel\", this.onPointerUp));\n }\n\n var _proto = PanSession.prototype;\n\n _proto.updateHandlers = function updateHandlers(handlers) {\n this.handlers = handlers;\n };\n\n _proto.end = function end() {\n var _this$removeListeners;\n\n (_this$removeListeners = this.removeListeners) == null ? void 0 : _this$removeListeners.call(this);\n cancelSync.update(this.updatePoint);\n };\n\n return PanSession;\n}();\n\nfunction subtractPoint(a, b) {\n return {\n x: a.x - b.x,\n y: a.y - b.y\n };\n}\n\nfunction startPanPoint(history) {\n return history[0];\n}\n\nfunction lastPanPoint(history) {\n return history[history.length - 1];\n}\n\nfunction getPanInfo(info, history) {\n return {\n point: info.point,\n delta: subtractPoint(info.point, lastPanPoint(history)),\n offset: subtractPoint(info.point, startPanPoint(history)),\n velocity: getVelocity(history, 0.1)\n };\n}\n\nfunction lastDevicePoint(history) {\n return history[history.length - 1];\n}\n\nvar toMilliseconds = function toMilliseconds(seconds) {\n return seconds * 1000;\n};\n\nfunction getVelocity(history, timeDelta) {\n if (history.length < 2) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var i = history.length - 1;\n var timestampedPoint = null;\n var lastPoint = lastDevicePoint(history);\n\n while (i >= 0) {\n timestampedPoint = history[i];\n\n if (lastPoint.timestamp - timestampedPoint.timestamp > toMilliseconds(timeDelta)) {\n break;\n }\n\n i--;\n }\n\n if (!timestampedPoint) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;\n\n if (time === 0) {\n return {\n x: 0,\n y: 0\n };\n }\n\n var currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time\n };\n\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0;\n }\n\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0;\n }\n\n return currentVelocity;\n}\n\nvar breakpoints = Object.freeze([\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"]);\nfunction mapResponsive(prop, mapper) {\n if (isArray(prop)) {\n return prop.map(function (item) {\n if (item === null) {\n return null;\n }\n\n return mapper(item);\n });\n }\n\n if (isObject(prop)) {\n return objectKeys(prop).reduce(function (result, key) {\n result[key] = mapper(prop[key]);\n return result;\n }, {});\n }\n\n if (prop != null) {\n return mapper(prop);\n }\n\n return null;\n}\nfunction objectToArrayNotation(obj, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var result = bps.map(function (br) {\n var _obj$br;\n\n return (_obj$br = obj[br]) != null ? _obj$br : null;\n });\n\n while (getLastItem(result) === null) {\n result.pop();\n }\n\n return result;\n}\nfunction arrayToObjectNotation(values, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var result = {};\n values.forEach(function (value, index) {\n var key = bps[index];\n if (value == null) return;\n result[key] = value;\n });\n return result;\n}\nfunction isResponsiveObjectLike(obj, bps) {\n if (bps === void 0) {\n bps = breakpoints;\n }\n\n var keys = Object.keys(obj);\n return keys.length > 0 && keys.every(function (key) {\n return bps.includes(key);\n });\n}\n/**\n * since breakpoints are defined as custom properties on an array, you may\n * `Object.keys(theme.breakpoints)` to retrieve both regular numeric indices\n * and custom breakpoints as string.\n *\n * This function returns true given a custom array property.\n */\n\nvar isCustomBreakpoint = function isCustomBreakpoint(maybeBreakpoint) {\n return Number.isNaN(Number(maybeBreakpoint));\n};\n\nfunction getUserAgentBrowser(navigator) {\n var ua = navigator.userAgent,\n vendor = navigator.vendor;\n var android = /(android)/i.test(ua);\n\n switch (true) {\n case /CriOS/.test(ua):\n return \"Chrome for iOS\";\n\n case /Edg\\//.test(ua):\n return \"Edge\";\n\n case android && /Silk\\//.test(ua):\n return \"Silk\";\n\n case /Chrome/.test(ua) && /Google Inc/.test(vendor):\n return \"Chrome\";\n\n case /Firefox\\/\\d+\\.\\d+$/.test(ua):\n return \"Firefox\";\n\n case android:\n return \"AOSP\";\n\n case /MSIE|Trident/.test(ua):\n return \"IE\";\n\n case /Safari/.test(navigator.userAgent) && /Apple Computer/.test(ua):\n return \"Safari\";\n\n case /AppleWebKit/.test(ua):\n return \"WebKit\";\n\n default:\n return null;\n }\n}\n\nfunction getUserAgentOS(navigator) {\n var ua = navigator.userAgent,\n platform = navigator.platform;\n\n switch (true) {\n case /Android/.test(ua):\n return \"Android\";\n\n case /iPhone|iPad|iPod/.test(platform):\n return \"iOS\";\n\n case /Win/.test(platform):\n return \"Windows\";\n\n case /Mac/.test(platform):\n return \"Mac\";\n\n case /CrOS/.test(ua):\n return \"Chrome OS\";\n\n case /Firefox/.test(ua):\n return \"Firefox OS\";\n\n default:\n return null;\n }\n}\n\nfunction detectDeviceType(navigator) {\n var ua = navigator.userAgent;\n if (/(tablet)|(iPad)|(Nexus 9)/i.test(ua)) return \"tablet\";\n if (/(mobi)/i.test(ua)) return \"phone\";\n return \"desktop\";\n}\nfunction detectOS(os) {\n if (!isBrowser) return false;\n return getUserAgentOS(window.navigator) === os;\n}\nfunction detectBrowser(browser) {\n if (!isBrowser) return false;\n return getUserAgentBrowser(window.navigator) === browser;\n}\nfunction detectTouch() {\n if (!isBrowser) return false;\n return window.ontouchstart === null && window.ontouchmove === null && window.ontouchend === null;\n}\n\nfunction walkObject(target, predicate) {\n function inner(value, path) {\n if (path === void 0) {\n path = [];\n }\n\n if (isArray(value)) {\n return value.map(function (item, index) {\n return inner(item, [].concat(path, [String(index)]));\n });\n }\n\n if (isObject(value)) {\n return fromEntries(Object.entries(value).map(function (_ref) {\n var key = _ref[0],\n child = _ref[1];\n return [key, inner(child, [].concat(path, [key]))];\n }));\n }\n\n return predicate(value, path);\n }\n\n return inner(target);\n}\n\nexport { PanSession, __DEV__, __TEST__, addDomEvent, addItem, addPointerEvent, analyzeBreakpoints, ariaAttr, arrayToObjectNotation, breakpoints, callAll, callAllHandlers, canUseDOM, chunk, clampValue, closest, compose, contains, countDecimalPlaces, cx, dataAttr, detectBrowser, detectDeviceType, detectOS, detectTouch, determineLazyBehavior, distance, error, extractEventInfo, filterUndefined, flatten, focus, focusNextTabbable, focusPreviousTabbable, fromEntries, get, getActiveElement, getAllFocusable, getAllTabbable, getCSSVar, getEventWindow, getFirstFocusable, getFirstItem, getFirstTabbableIn, getLastItem, getLastTabbableIn, getNextIndex, getNextItem, getNextItemFromSearch, getNextTabbable, getOwnerDocument, getOwnerWindow, getPointerEventName, getPrevIndex, getPrevItem, getPreviousTabbable, getRelatedTarget, getViewportPointFromEvent, getWithDefault, hasDisplayNone, hasFocusWithin, hasNegativeTabIndex, hasTabIndex, isActiveElement, isArray, isBrowser, isContentEditable, isCssVar, isCustomBreakpoint, isDefined, isDisabled, isElement, isEmpty, isEmptyArray, isEmptyObject, isFocusable, isFunction, isHTMLElement, isHidden, isInputElement, isInputEvent, isMouseEvent, isMultiTouchEvent, isNotEmptyObject, isNotNumber, isNull, isNumber, isNumeric, isObject, isRefObject, isResponsiveObjectLike, isRightClick, isString, isTabbable, isTouchEvent, isUndefined, mapResponsive, maxSafeInteger, memoize, memoizedGet, minSafeInteger, noop, normalizeEventKey, objectFilter, objectKeys, objectToArrayNotation, omit, once, percentToValue, pick, pipe, px, removeIndex, removeItem, roundValueToStep, runIfFn, split, toPrecision, valueToPercent, walkObject, warn, wrapPointerEventHandler };\n","import*as e from\"react\";import{forwardRef as t,useMultiStyleConfig as s,omitThemingProps as r,StylesProvider as n,chakra as a,useStyles as i}from\"@chakra-ui/system\";import{Icon as c,CheckIcon as p}from\"@chakra-ui/icons\";import{Collapse as l}from\"@saas-ui/collapse\";import{getChildrenOfType as o,getChildOfType as m}from\"@saas-ui/react-utils\";import{cx as u,__DEV__ as d}from\"@chakra-ui/utils\";import{createContext as f}from\"@chakra-ui/react-utils\";function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},v.apply(this,arguments)}function S(e,t){if(null==e)return{};var s,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(s=a[r])>=0||(n[s]=e[s]);return n}const[_,N]=f({name:\"StepperContext\",errorMessage:\"useStepperContext: `context` is undefined. Seems you forgot to wrap stepper components in `<Stepper />`\"});function h(t){const{step:s}=t,[r,n]=e.useState(-1),a=e.useRef([]),[,i]=e.useState(Date.now()),c=e.useCallback(e=>{const t=[...a.current];-1===t.indexOf(e)&&t.push(e),a.current=t,i(Date.now())},[a,i]),p=e=>{const t=a.current.indexOf(e);-1!==t&&n(t)};return e.useLayoutEffect(()=>{\"string\"==typeof s?p(s):\"number\"==typeof s?n(s):-1===r&&n(0)},[s]),{stepsRef:a,activeStep:a.current[r],activeIndex:r,isFirstStep:0===r,isLastStep:r===a.current.length-1,isCompleted:r>=a.current.length,setIndex:n,setStep:p,nextStep:()=>{n(r+1)},prevStep:()=>{n(r-1)},registerStep:c,unregisterStep:e=>{a.current=a.current.slice(a.current.indexOf(e),1)}}}function x(t){const{name:s,isActive:r,isCompleted:n}=t,{registerStep:a,unregisterStep:i,activeStep:c}=N();return e.useEffect(()=>{if(s)return a(s),()=>{i(s)}},[]),{isActive:s?c===s:r,isCompleted:n}}function y({label:e=\"Back\"}={}){const{isFirstStep:t,prevStep:s}=N();return{isDisabled:t,onClick:s,label:e}}function C({label:e=\"Next\",submitLabel:t=\"Submit\"}={}){const{isLastStep:s,isCompleted:r,nextStep:n}=N();return{isDisabled:r,onClick:n,label:s?t:e}}const E=[\"children\",\"orientation\"],g=[\"children\",\"orientation\",\"stepComponent\"],b=[\"children\",\"isOpen\"],k=[\"icon\",\"isActive\",\"isCompleted\",\"className\"],A=[\"title\",\"icon\",\"isActive\",\"isCompleted\"],O=[\"isActive\"],D=t((t,i)=>{const c=s(\"Stepper\",t),p=r(t),{children:l,orientation:o}=p,m=S(p,E),d=h(t),f=v({display:\"flex\",flexDirection:\"column\"},c.container);/*#__PURE__*/return e.createElement(n,{value:c},/*#__PURE__*/e.createElement(_,{value:d},/*#__PURE__*/e.createElement(a.div,v({ref:i,__css:f},m,{className:u(\"saas-stepper__container\",t.className)}),/*#__PURE__*/e.createElement(I,{orientation:o},l))))});d&&(D.displayName=\"Stepper\");const I=t=>{var s,r;const{children:n,orientation:c,stepComponent:p}=t,l=S(t,g),d=i(),{activeIndex:f}=N(),_=v({display:\"flex\",flexDirection:\"row\",alignItems:\"center\"},d.steps),h=\"vertical\"===c,x=p||L,y=o(n,x),C=y.reduce((t,s,r,n)=>(t.push(/*#__PURE__*/e.createElement(x,v({key:r},s.props,{icon:s.props.icon||r+1,isActive:f===r,isCompleted:s.props.isCompleted||f>r}))),\"vertical\"===c&&t.push(/*#__PURE__*/e.createElement(w,{isOpen:f===r},s.props.children)),r<n.length-1&&t.push(/*#__PURE__*/e.createElement(F,{key:`separator-${r}`,isActive:r<f})),t),[]),E=m(n,T),b=f>=y.length?E:h?null:null==(s=y[f])||null==(r=s.props)?void 0:r.children;/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(a.div,v({__css:_},l,{className:u(\"saas-stepper__steps\",t.className)}),C),b&&/*#__PURE__*/e.createElement(w,null,b))};d&&(I.displayName=\"StepperSteps\");const w=t=>{const{children:s,isOpen:r=!0}=t,n=S(t,b),c=i();/*#__PURE__*/return e.createElement(a.div,v({__css:c.content},n,{className:u(\"saas-stepper__content\",t.className)}),/*#__PURE__*/e.createElement(l,{in:r},s))};d&&(w.displayName=\"StepperContent\");const j=t=>{const{icon:s,isCompleted:r,className:n}=t,l=S(t,k),o=v({display:\"flex\",alignItems:\"center\",justifyContent:\"center\",borderRadius:\"full\",fontSize:\"1em\",me:2},i().icon);let m;return m=r?/*#__PURE__*/e.createElement(c,{as:p}):s,/*#__PURE__*/e.createElement(a.div,v({__css:o},l,{className:u(\"saas-stepper__icon\",n)}),m)};d&&(j.displayName=\"StepperIcon\");const L=t=>{const{title:s,icon:r,isActive:n,isCompleted:c}=t,p=S(t,A),l=x(t),o=v({display:\"flex\",alignItems:\"center\",flexDirection:\"row\"},i().step);/*#__PURE__*/return e.createElement(a.div,v({__css:o,\"data-active\":l.isActive,\"data-completed\":l.isCompleted},p,{className:u(\"saas-stepper__step\",t.className)}),/*#__PURE__*/e.createElement(j,{icon:r,isActive:n,isCompleted:c}),s&&/*#__PURE__*/e.createElement(R,null,s))};d&&(L.displayName=\"StepperStep\");const F=t=>{const{isActive:s}=t,r=S(t,O),n=v({flex:1,borderTopWidth:\"1px\",mx:2},i().separator);/*#__PURE__*/return e.createElement(a.div,v({\"data-active\":s},r,{className:u(\"saas-stepper__separator\",t.className),__css:n}))};d&&(F.displayName=\"StepperSeparator\");const R=t=>{const s=i();/*#__PURE__*/return e.createElement(a.p,v({},t,{__css:s.title,className:u(\"saas-stepper__title\",t.className)}))};d&&(R.displayName=\"StepperStepTitle\");const T=t=>{const s=i();/*#__PURE__*/return e.createElement(a.div,v({__css:s.completed},t,{className:u(\"saas-stepper__completed\",t.className)}))};d&&(T.displayName=\"StepperCompleted\");export{D as Stepper,T as StepperCompleted,w as StepperContent,j as StepperIcon,_ as StepperProvider,F as StepperSeparator,L as StepperStep,R as StepperStepTitle,I as StepperSteps,C as useNext,y as usePrev,x as useStep,h as useStepper,N as useStepperContext};\n//# sourceMappingURL=index.modern.js.map\n","import * as React from 'react'\nimport { FieldValues, SubmitHandler } from 'react-hook-form'\nimport { createContext } from '@chakra-ui/react-utils'\nimport {\n useStepper,\n useStep,\n UseStepperProps,\n UseStepperReturn,\n} from '@saas-ui/stepper'\n\nexport interface StepState {\n name: string\n schema?: any\n isActive?: boolean\n isCompleted?: boolean\n}\n\nexport interface StepFormContext extends UseStepperReturn {\n updateStep(state: StepState): void\n steps: Record<string, StepState>\n}\n\nexport const [StepFormProvider, useStepFormContext] =\n createContext<StepFormContext>({\n name: 'StepFormContext',\n errorMessage:\n 'useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`',\n })\n\nimport { FormProps } from './form'\n\nexport interface UseStepFormProps<\n TFieldValues extends FieldValues = FieldValues\n> extends UseStepperProps,\n FormProps<TFieldValues> {}\n\nexport function useStepForm<TFieldValues extends FieldValues = FieldValues>(\n props: UseStepFormProps<TFieldValues>\n) {\n const stepper = useStepper(props)\n\n const { activeStep, isLastStep, nextStep } = stepper\n\n const [steps, updateSteps] = React.useState({})\n\n const onSubmitStep: SubmitHandler<TFieldValues> = React.useCallback(\n async (data) => {\n if (isLastStep) {\n return props\n .onSubmit?.(data)\n .then(() => {\n const step = steps[activeStep]\n updateStep({\n ...step,\n isCompleted: true,\n })\n })\n .then(nextStep) // Show completed step\n }\n\n nextStep()\n },\n [activeStep, isLastStep]\n )\n\n const getFormProps = React.useCallback(\n (props) => {\n const step = steps[activeStep]\n return {\n onSubmit: onSubmitStep,\n schema: step?.schema,\n }\n },\n [steps, onSubmitStep, activeStep]\n )\n\n const updateStep = React.useCallback(\n (step) => {\n updateSteps((steps) => {\n return {\n ...steps,\n [step.name]: step,\n }\n })\n },\n [steps]\n )\n\n return {\n getFormProps,\n updateStep,\n steps,\n ...stepper,\n }\n}\n\nexport type UseStepFormReturn = ReturnType<typeof useStepForm>\n\nexport interface UseFormStepProps {\n name: string\n schema?: any\n}\n\nexport function useFormStep(props: UseFormStepProps): StepState {\n const { name, schema } = props\n const step = useStep({ name })\n\n const { steps, updateStep } = useStepFormContext()\n\n React.useEffect(() => {\n updateStep({ name, schema })\n }, [name, schema])\n\n return {\n ...step,\n ...(steps[name] || {}),\n }\n}\n","import * as React from 'react'\n\nimport { FieldValues, UseFormReturn } from 'react-hook-form'\n\nimport {\n chakra,\n HTMLChakraProps,\n useMultiStyleConfig,\n StylesProvider,\n} from '@chakra-ui/system'\n\nimport { callAllHandlers, runIfFn, cx, __DEV__ } from '@chakra-ui/utils'\n\nimport {\n StepperProvider,\n StepperSteps,\n StepperStepsProps,\n StepperStep,\n useStepperContext,\n} from '@saas-ui/stepper'\nimport { Button, ButtonProps } from '@saas-ui/button'\n\nimport { Form, FormProps, SubmitButton } from '.'\n\nimport {\n useStepForm,\n useFormStep,\n StepFormProvider,\n UseStepFormProps,\n} from './use-step-form'\n\nexport interface StepFormProps<TFieldValues extends FieldValues = FieldValues>\n extends UseStepFormProps<TFieldValues>,\n FormProps<TFieldValues> {}\n\nexport const StepForm = React.forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: StepFormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const { children, onSubmit, ...rest } = props\n\n const stepper = useStepForm<TFieldValues>(props)\n\n const { getFormProps, ...ctx } = stepper\n\n const context = React.useMemo(() => ctx, [ctx])\n\n return (\n <StepperProvider value={context}>\n <StepFormProvider value={context}>\n <Form ref={ref} {...rest} {...getFormProps(props)}>\n {runIfFn(children, stepper)}\n </Form>\n </StepFormProvider>\n </StepperProvider>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n\nexport interface FormStepOptions {\n /**\n * The step name\n */\n name: string\n /**\n * Schema\n */\n schema?: any\n}\n\nexport const FormStepper: React.FC<StepperStepsProps> = (props) => {\n const styles = useMultiStyleConfig('Stepper', props)\n\n const { children } = props\n\n const elements = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child?.type === FormStep) {\n const { isCompleted } = useFormStep(child.props) // Register this step\n return (\n <StepperStep\n name={child.props.name}\n title={child.props.title}\n isCompleted={isCompleted}\n >\n {child.props.children}\n </StepperStep>\n )\n }\n return child\n })\n\n return (\n <StylesProvider value={styles}>\n <StepperSteps mb=\"4\" {...props}>\n {elements}\n </StepperSteps>\n </StylesProvider>\n )\n}\n\nexport interface FormStepProps\n extends FormStepOptions,\n HTMLChakraProps<'div'> {}\n\nexport const FormStep: React.FC<FormStepProps> = (props) => {\n const { name, schema, children, className, ...rest } = props\n const step = useFormStep({ name, schema })\n\n const { isActive } = step\n\n return isActive ? (\n <chakra.div {...rest} className={cx('saas-form__step', className)}>\n {children}\n </chakra.div>\n ) : null\n}\n\nif (__DEV__) {\n FormStep.displayName = 'FormStep'\n}\n\nexport const PrevButton: React.FC<ButtonProps> = (props) => {\n const { isFirstStep, isCompleted, prevStep } = useStepperContext()\n\n return (\n <Button\n isDisabled={isFirstStep || isCompleted}\n label=\"Back\"\n {...props}\n className={cx('saas-form__prev-button', props.className)}\n onClick={callAllHandlers(props.onClick, prevStep)}\n />\n )\n}\n\nif (__DEV__) {\n PrevButton.displayName = 'PrevButton'\n}\n\nexport interface NextButtonProps extends ButtonProps {\n submitLabel?: string\n}\n\nexport const NextButton: React.FC<NextButtonProps> = (props) => {\n const { label = 'Next', submitLabel = 'Complete', ...rest } = props\n const { isLastStep, isCompleted } = useStepperContext()\n\n return (\n <SubmitButton\n isDisabled={isCompleted}\n label={isLastStep || isCompleted ? submitLabel : label}\n {...rest}\n className={cx('saas-form__next-button', props.className)}\n />\n )\n}\n\nif (__DEV__) {\n NextButton.displayName = 'NextButton'\n}\n","import * as React from 'react'\nimport {\n useFormContext,\n useWatch,\n FieldValues,\n UseFormReturn,\n} from 'react-hook-form'\n\nexport interface DisplayIfProps<TFieldValues> {\n children: React.ReactElement\n name: string\n defaultValue?: unknown\n isDisabled?: boolean\n isExact?: boolean\n condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean\n}\n\nexport const DisplayIf = <TFieldValues extends FieldValues = FieldValues>({\n children,\n name,\n defaultValue,\n isDisabled,\n isExact,\n condition = (value) => !!value,\n}: DisplayIfProps<TFieldValues>) => {\n const value = useWatch({\n name,\n defaultValue,\n disabled: isDisabled,\n exact: isExact,\n })\n const context = useFormContext<TFieldValues>()\n return condition(value, context) ? children : null\n}\n"],"names":["FormValue","name","getValues","useFormContext","inputTypes","BaseField","props","label","help","variant","hideLabel","children","controlProps","error","formState","get","errors","getError","React","FormControl","isInvalid","FormLabel","Box","message","FormHelperText","FormErrorMessage","Field","forwardRef","ref","type","withControlledInput","InputComponent","rules","inputProps","Controller","control","render","field","_ref","useMergeRefs","withUncontrolledInput","register","registerFieldType","component","options","displayName","isDisabled","isReadOnly","isRequired","inputRules","required","createField","isControlled","split","map","part","charAt","toUpperCase","slice","join","InputField","Input","NumberInputField","NumberInput","PasswordInputFIeld","PasswordInput","TextareaField","Textarea","SwitchField","Switch","SelectField","Select","CheckboxField","Checkbox","RadioField","RadioInput","PinField","PinInput","NativeSelectField","NativeSelect","getType","spec","meta","_field$spec$meta","getArrayOption","tests","test","OPTIONS","_test$OPTIONS","params","getFieldsFromSchema","schema","schemaFields","fields","innerType","min","max","push","FormLayoutItem","chakra","div","FormLayout","gridProps","useTheme","components","_theme$components","_theme$components$For2","defaultProps","spacing","SimpleGrid","Children","child","isValidElement","mapNestedFields","cloneElement","createContext","ArrayFieldProvider","useArrayFieldContext","ArrayFieldRowProvider","useArrayFieldRowContext","useArrayField","defaultValue","keyName","useFieldArray","useArrayFieldRow","index","clearErrors","remove","useEffect","isFirst","isLast","length","useCallback","useArrayFieldRemoveButton","onClick","useArrayFieldAddButton","append","shouldFocus","ArrayFieldRow","ArrayFieldRowContainer","ArrayFieldRowFields","columns","ArrayFieldRemoveButton","layoutProps","flex","gridGap","mr","context","value","__css","display","flexDirection","alignItems","width","mb","IconButton","icon","MinusIcon","ArrayFieldAddButton","AddIcon","float","ArrayField","containerProps","ArrayFieldContainer","ArrayFieldRows","key","id","fieldProps","FormLegend","styles","useStyles","as","sx","legend","ObjectField","getNestedFields","path","reach","getNestedSchema","nestedFieldProps","Fields","Form","mode","resolver","reValidateMode","shouldFocusError","shouldUnregister","shouldUseNativeValidation","criteriaMode","delayError","defaultValues","onSubmit","onError","formRef","rest","form","yupResolver","methods","useForm","handleSubmit","useImperativeHandle","FormProvider","SubmitButton","disableIfUntouched","disableIfInvalid","Button","isLoading","isSubmitting","isPrimary","isDirty","isValid","AutoForm","submitLabel","isFunction","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","funcTag","objectTag","reIsHostCtor","reIsUint","typedArrayTags","freeGlobal","global","Object","freeSelf","self","root","Function","freeExports","exports","nodeType","freeModule","module","moduleExports","freeProcess","process","nodeUtil","require","types","binding","e","nodeIsTypedArray","isTypedArray","apply","func","thisArg","args","call","uid","transform","arrayProto","Array","prototype","objectProto","coreJsData","funcToString","toString","hasOwnProperty","maskSrcKey","exec","keys","IE_PROTO","nativeObjectToString","objectCtorString","reIsNative","RegExp","replace","Buffer","undefined","Symbol","Uint8Array","getPrototype","getPrototypeOf","arg","objectCreate","create","propertyIsEnumerable","splice","symToStringTag","toStringTag","defineProperty","getNative","nativeIsBuffer","isBuffer","nativeMax","Math","nativeNow","Date","now","Map","nativeCreate","baseCreate","object","proto","isObject","result","Hash","entries","this","clear","entry","set","ListCache","MapCache","Stack","data","__data__","size","assignMergeValue","eq","baseAssignValue","assignValue","objValue","assocIndexOf","array","configurable","enumerable","writable","baseGetTag","isOwn","tag","unmasked","getRawTag","objectToString","baseIsArguments","isObjectLike","baseMerge","source","srcIndex","customizer","stack","iteratee","keysFunc","iterable","baseFor","srcValue","mergeFunc","safeGet","stacked","typedArray","arrayBuffer","newValue","isCommon","isArr","isArray","isBuff","isTyped","isArrayLike","copyArray","buffer","constructor","byteLength","byteOffset","Ctor","isPlainObject","isArguments","isNew","copyObject","keysIn","toPlainObject","isPrototype","initCloneObject","baseMergeDeep","has","pop","hash","string","getMapData","pairs","LARGE_ARRAY_SIZE","baseSetToString","identity","getValue","isMasked","toSource","baseIsNative","isIndex","setToString","count","lastCalled","stamp","remaining","arguments","shortOut","other","isLength","baseUnary","inherited","isArg","isType","skipIndexes","n","baseTimes","String","arrayLikeKeys","nativeKeysIn","isProto","baseKeysIn","assigner","mergeWith","start","otherArgs","overRest","baseRest","sources","guard","isIterateeCall","__DEV__","env","NODE_ENV","cx","_len","classNames","_key","filter","Boolean","callAllHandlers","_len2","fns","_key2","event","some","fn","defaultPrevented","freeze","errorMessage","StepperProvider","useStepperContext","useStepper","step","useState","activeIndex","setIndex","stepsRef","useRef","onUpdate","registerStep","newSteps","current","indexOf","setStep","i","useLayoutEffect","activeStep","isFirstStep","isLastStep","isCompleted","nextStep","prevStep","unregisterStep","useStep","isActive","StepFormProvider","useStepFormContext","useStepForm","stepper","steps","updateSteps","onSubmitStep","then","updateStep","getFormProps","useFormStep","StepForm","ctx","useMemo","valueOrFn","runIfFn","FormStep","className","PrevButton","NextButton","htmlFor","Text","fontSize","condition","useWatch","disabled","exact","isExact","useMultiStyleConfig","elements","StepperStep","title","StylesProvider","StepperSteps"],"mappings":"2vCAgCaA,EAAwC,gBAAGC,IAAAA,KAEtD,OAAOC,EADeC,mBAAdD,WACSD,IAAS,kPC6EtBG,EAAsC,GAmB/BC,EAAkC,SAACC,GAC9C,IAAQL,EACNK,EADML,KAAMM,EACZD,EADYC,MAAOC,EACnBF,EADmBE,KAAMC,EACzBH,EADyBG,QAASC,EAClCJ,EADkCI,UAAWC,EAC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A,yBkBTA,gBACvBU,IAAAA,aAKAid,UASA,kBATY,SAACxU,WAAYA,MAEXyU,WAAS,CACrB5d,OAPFA,KAQEwH,eAPFA,aAQEqW,WAPFhb,WAQEib,QAPFC,UASgB7d,oBACmBQ,EAAW,2ID2CQ,SAACL,GACvD,IAAMmK,EAASwT,sBAAoB,UAAW3d,GAIxC4d,EAAWhd,EAAM4F,SAASxD,IAFXhD,EAAbK,SAEsC,SAACoG,GAC7C,GAAI7F,EAAM8F,eAAeD,WAAUA,SAAAA,EAAOlF,QAASwb,GAAU,CAC3D,MAAwBN,GAAYhW,EAAMzG,oBAC1C,OACEY,gBAACid,IACCle,KAAM8G,EAAMzG,MAAML,KAClBme,MAAOrX,EAAMzG,MAAM8d,MACnBrC,cALIA,aAOHhV,EAAMzG,MAAMK,UAInB,OAAOoG,iBAGT,OACE7F,gBAACmd,kBAAejV,MAAOqB,gBACrBvJ,gBAACod,MAAa5U,GAAG,KAAQpJ,GACtB4d"}
1
+ {"version":3,"file":"index.js","sources":["../src/display-field.tsx","../src/field.tsx","../src/layout.tsx","../src/utils.ts","../src/use-array-field.tsx","../src/array-field.tsx","../src/object-field.tsx","../src/field-resolver.ts","../src/fields.tsx","../src/form.tsx","../src/submit-button.tsx","../src/auto-form.tsx","../../saas-ui-stepper/dist/index.modern.js","../src/use-step-form.tsx","../src/step-form.tsx","../src/display-if.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useFormContext } from 'react-hook-form'\n\nimport {\n Text,\n FormControl,\n FormControlProps,\n FormLabel,\n} from '@chakra-ui/react'\n\nimport { FieldProps } from './field'\n\nexport interface DisplayFieldProps\n extends FormControlProps,\n Omit<FieldProps, 'type' | 'label'> {}\n\nexport const DisplayField: React.FC<DisplayFieldProps> = ({\n name,\n label,\n placeholder,\n ...props\n}) => {\n return (\n <FormControl {...props}>\n {label ? <FormLabel htmlFor={name}>{label}</FormLabel> : null}\n <Text fontSize=\"md\">\n <FormValue name={name} />\n </Text>\n </FormControl>\n )\n}\n\nexport const FormValue: React.FC<{ name: string }> = ({ name }) => {\n const { getValues } = useFormContext()\n return getValues(name) || null\n}\n","import * as React from 'react'\nimport {\n useFormContext,\n FormState,\n Controller,\n get,\n RegisterOptions,\n FieldValues,\n FieldPath,\n} from 'react-hook-form'\n\nimport {\n forwardRef,\n Box,\n FormControl,\n FormControlProps,\n FormLabel,\n FormHelperText,\n FormErrorMessage,\n Input,\n Textarea,\n Checkbox,\n Switch,\n useMergeRefs,\n} from '@chakra-ui/react'\n\nimport { NumberInput } from '@saas-ui/number-input'\nimport { PasswordInput } from '@saas-ui/password-input'\nimport { RadioInput } from '@saas-ui/radio'\nimport { PinInput } from '@saas-ui/pin-input'\nimport { Select, NativeSelect } from '@saas-ui/select'\nimport { FocusableElement } from '@chakra-ui/utils'\n\nexport interface Option {\n value: string\n label?: string\n [key: string]: unknown\n}\n\nexport type FieldRules = Pick<\n RegisterOptions,\n 'required' | 'min' | 'max' | 'maxLength' | 'minLength' | 'pattern'\n>\n\nexport type FieldTypes =\n | 'text'\n | 'number'\n | 'password'\n | 'textarea'\n | 'select'\n | 'native-select'\n | 'checkbox'\n | 'radio'\n | 'switch'\n | 'pin'\n | string\n\nexport interface FieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> extends Omit<FormControlProps, 'label' | 'type'> {\n /**\n * The field name\n */\n name: TName\n /**\n * The field label\n */\n label?: string\n /**\n * Hide the field label\n */\n hideLabel?: boolean\n /**\n * Field help text\n */\n help?: string\n /**\n * React hook form rules\n */\n rules?: Omit<\n RegisterOptions<TFieldValues, TName>,\n 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'\n >\n /**\n * Options used for selects and radio fields\n */\n options?: Option[]\n /**\n * The field type\n * Build-in types:\n * - text\n * - number\n * - password\n * - textarea\n * - select\n * - native-select\n * - checkbox\n * - radio\n * - switch\n * - pin\n *\n * Will default to a text field if there is no matching type.\n * @default 'text'\n */\n type?: FieldTypes\n /**\n * The input placeholder\n */\n placeholder?: string\n}\n\nconst inputTypes: Record<FieldTypes, any> = {}\n\nconst defaultInputType = 'text'\n\nconst getInput = (type: string) => {\n return inputTypes[type] || inputTypes[defaultInputType]\n}\n\nconst getError = (name: string, formState: FormState<{ [x: string]: any }>) => {\n return get(formState.errors, name)\n}\n\nconst isTouched = (\n name: string,\n formState: FormState<{ [x: string]: any }>\n) => {\n return get(formState.touchedFields, name)\n}\n\nexport const BaseField: React.FC<FieldProps> = (props) => {\n const { name, label, help, variant, hideLabel, children, ...controlProps } =\n props\n\n const { formState } = useFormContext()\n\n const error = getError(name, formState)\n\n return (\n <FormControl variant={variant} {...controlProps} isInvalid={!!error}>\n {label && !hideLabel ? (\n <FormLabel variant={variant}>{label}</FormLabel>\n ) : null}\n <Box>\n {children}\n {help && !error?.message ? (\n <FormHelperText>{help}</FormHelperText>\n ) : null}\n {error?.message && (\n <FormErrorMessage>{error?.message}</FormErrorMessage>\n )}\n </Box>\n </FormControl>\n )\n}\nexport const Field = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FieldProps<TFieldValues> & {\n [key: string]: unknown // Make sure attributes of custom components work. Need to change this to a global typedef at some point.\n },\n ref: React.ForwardedRef<FocusableElement>\n ) => {\n const { type = defaultInputType } = props\n const InputComponent = getInput(type)\n\n return <InputComponent ref={ref} {...props} />\n }\n) as <TFieldValues extends FieldValues>(\n props: FieldProps<TFieldValues> & {\n [key: string]: unknown\n } & {\n ref?: React.ForwardedRef<FocusableElement>\n }\n) => React.ReactElement\n\ninterface CreateFieldProps {\n displayName: string\n hideLabel?: boolean\n BaseField: React.FC<any>\n}\n\nconst createField = (\n InputComponent: React.FC<any>,\n { displayName, hideLabel, BaseField }: CreateFieldProps\n) => {\n const Field = forwardRef<FieldProps, typeof FormControl>((props, ref) => {\n const {\n name,\n label,\n help,\n isDisabled,\n isInvalid,\n isReadOnly,\n isRequired,\n rules,\n variant,\n ...inputProps\n } = props\n\n const inputRules = {\n required: isRequired,\n ...rules,\n }\n\n return (\n <BaseField\n name={name}\n label={label}\n help={help}\n hideLabel={hideLabel}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n variant={variant}\n >\n <InputComponent\n ref={ref}\n name={name}\n label={label}\n rules={inputRules}\n {...inputProps}\n />\n </BaseField>\n )\n })\n Field.displayName = displayName\n\n return Field\n}\n\nexport const withControlledInput = (InputComponent: any) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { control } = useFormContext()\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field: { ref: _ref, ...field } }) => (\n <InputComponent\n {...field}\n {...inputProps}\n ref={useMergeRefs(ref, _ref)}\n />\n )}\n />\n )\n }\n )\n}\n\nexport const withUncontrolledInput = (InputComponent: any) => {\n return forwardRef<FieldProps, typeof InputComponent>(\n ({ name, rules, ...inputProps }, ref) => {\n const { register } = useFormContext()\n\n const { ref: _ref, ...field } = register(name, rules)\n\n return (\n <InputComponent\n {...field}\n {...inputProps}\n ref={useMergeRefs(ref, _ref)}\n />\n )\n }\n )\n}\n\nexport interface RegisterFieldTypeOptions {\n isControlled?: boolean\n hideLabel?: boolean\n BaseField?: React.FC<any>\n}\n\n/**\n * Register a new field type\n * @param type The name for this field in kebab-case, eg `email` or `array-field`\n * @param component The React component\n * @param options\n * @param options.isControlled Set this to true if this is a controlled field.\n * @param options.hideLabel Hide the field label, for example for checkbox or switch field.\n */\nexport const registerFieldType = (\n type: string,\n component: React.FC<any>,\n options?: RegisterFieldTypeOptions\n) => {\n let InputComponent\n if (options?.isControlled) {\n InputComponent = withControlledInput(component)\n } else {\n InputComponent = withUncontrolledInput(component)\n }\n\n const Field = createField(InputComponent, {\n displayName: `${type\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('')}Field`,\n hideLabel: options?.hideLabel,\n BaseField: options?.BaseField || BaseField,\n })\n\n inputTypes[type] = Field\n\n return Field\n}\n\n// @todo Consider not registering all fields by default to lower the package size and computations.\n// Not all types may be required in a project.\nexport const InputField = registerFieldType('text', Input)\nexport const NumberInputField = registerFieldType('number', NumberInput, {\n isControlled: true,\n})\nexport const PasswordInputFIeld = registerFieldType('password', PasswordInput)\nexport const TextareaField = registerFieldType('textarea', Textarea)\nexport const SwitchField = registerFieldType(\n 'switch',\n forwardRef(({ label, ...props }: { label?: string }, ref) => {\n return (\n <Switch ref={ref} {...props}>\n {label}\n </Switch>\n )\n }),\n {\n isControlled: true,\n hideLabel: true,\n }\n)\nexport const SelectField = registerFieldType('select', Select, {\n isControlled: true,\n})\nexport const CheckboxField = registerFieldType(\n 'checkbox',\n forwardRef(({ label, ...props }: { label?: string }, ref) => {\n return (\n <Checkbox ref={ref} {...props}>\n {label}\n </Checkbox>\n )\n }),\n {\n hideLabel: true,\n }\n)\nexport const RadioField = registerFieldType('radio', RadioInput, {\n isControlled: true,\n})\nexport const PinField = registerFieldType('pin', PinInput, {\n isControlled: true,\n})\nexport const NativeSelectField = registerFieldType(\n 'native-select',\n NativeSelect,\n { isControlled: true }\n)\n","import * as React from 'react'\n\nimport { chakra, SimpleGrid, SimpleGridProps, useTheme } from '@chakra-ui/react'\n\nexport type FormLayoutProps = SimpleGridProps\n\ninterface FormLayoutItemProps {\n children: React.ReactNode\n}\n\nconst FormLayoutItem: React.FC<FormLayoutItemProps> = ({ children }) => {\n return <chakra.div>{children}</chakra.div>\n}\n\n/**\n * FormLayout\n *\n * Renders form items in a `SimpleGrid`\n * @see https://chakra-ui.com/docs/layout/simple-grid\n */\nexport const FormLayout = ({ children, ...props }: FormLayoutProps) => {\n const theme = useTheme()\n\n const defaultProps = theme.components?.FormLayout?.defaultProps ?? {\n spacing: 4,\n }\n\n const gridProps = {\n ...defaultProps,\n ...props,\n }\n\n return (\n <SimpleGrid {...gridProps}>\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return <FormLayoutItem>{child}</FormLayoutItem>\n }\n return child\n })}\n </SimpleGrid>\n )\n}\n","import * as React from 'react'\n\nexport const mapNestedFields = (name: string, children: React.ReactNode) => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.props.name) {\n return React.cloneElement(child, {\n ...child.props,\n name: `${name}.${child.props.name}`,\n })\n }\n return child\n })\n}\n","import * as React from 'react'\nimport {\n useFieldArray,\n useFormContext,\n UseFieldArrayReturn,\n} from 'react-hook-form'\n\nimport { createContext } from '@chakra-ui/react-utils'\n\nexport interface UseArrayFieldReturn extends UseFieldArrayReturn {\n /**\n * The array field name\n */\n name: string\n /**\n * The default value for new items\n */\n defaultValue: Record<string, any>\n /**\n * Min amount of items\n */\n min?: number\n /**\n * Max amount of items\n */\n max?: number\n}\n\nexport const [ArrayFieldProvider, useArrayFieldContext] =\n createContext<UseArrayFieldReturn>({\n name: 'ArrayFieldContext',\n })\n\nexport interface UseArrayFieldRowReturn {\n /**\n * Name of the array field including the index, eg 'field.0'\n */\n name: string\n /**\n * The field index\n */\n index: number\n /**\n * Remove this array item\n */\n remove: () => void\n /**\n * True if this is the first item\n */\n isFirst: boolean\n /**\n * True if this is the last item\n */\n isLast: boolean\n}\n\nexport const [ArrayFieldRowProvider, useArrayFieldRowContext] =\n createContext<UseArrayFieldRowReturn>({\n name: 'ArrayFieldRowContext',\n })\n\nexport interface ArrayFieldOptions {\n /**\n * The field name\n */\n name: string\n /**\n * Default value for new values in the array\n */\n defaultValue?: Record<string, any>\n /**\n * Default key name for rows, change this if your data uses a different 'id' field\n * @default \"id\"\n */\n keyName?: string\n min?: number\n max?: number\n}\n\nexport const useArrayField = ({\n name,\n defaultValue = {},\n keyName,\n min,\n max,\n}: ArrayFieldOptions) => {\n const { control } = useFormContext()\n const context = useFieldArray({\n control,\n name,\n keyName,\n })\n\n return {\n ...context,\n name,\n defaultValue,\n min,\n max,\n }\n}\n\nexport interface UseArrayFieldRowProps {\n index: number\n}\n\nexport const useArrayFieldRow = ({ index }: UseArrayFieldRowProps) => {\n const { clearErrors } = useFormContext()\n const { name, remove, fields } = useArrayFieldContext()\n\n React.useEffect(() => {\n // reset errors, to make sure min/max errors reset correctly\n clearErrors(name)\n }, [])\n\n return {\n index,\n isFirst: index === 0,\n isLast: index === fields.length - 1,\n name: `${name}.${index}`,\n remove: React.useCallback(() => {\n clearErrors(name)\n remove(index)\n }, [index]),\n }\n}\n\nexport const useArrayFieldRemoveButton = () => {\n const { isFirst, remove } = useArrayFieldRowContext()\n const { min, fields } = useArrayFieldContext()\n\n const isDisabled = isFirst && !!(min && fields.length <= min)\n\n return {\n onClick: () => remove(),\n isDisabled,\n }\n}\n\nexport const useArrayFieldAddButton = () => {\n const { append, defaultValue, max, fields } = useArrayFieldContext()\n\n const isDisabled = !!(max && fields.length >= max)\n\n return {\n onClick: () =>\n append(defaultValue, {\n shouldFocus: false,\n }),\n isDisabled,\n }\n}\n","import * as React from 'react'\n\nimport { chakra, ResponsiveValue } from '@chakra-ui/system'\n\nimport { AddIcon, MinusIcon } from '@chakra-ui/icons'\nimport { IconButton, ButtonProps } from '@saas-ui/button'\n\nimport { FormLayout } from './layout'\nimport { BaseField, FieldProps } from './field'\n\nimport { mapNestedFields } from './utils'\n\nimport {\n useArrayField,\n useArrayFieldRow,\n useArrayFieldContext,\n ArrayFieldProvider,\n ArrayFieldOptions,\n ArrayFieldRowProvider,\n useArrayFieldRowContext,\n useArrayFieldRemoveButton,\n useArrayFieldAddButton,\n UseArrayFieldReturn,\n} from './use-array-field'\n\ninterface ArrayField {\n id: string\n [key: string]: unknown\n}\n\ninterface ArrayFieldRowProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n /**\n * The array index\n */\n index: number\n}\n\nexport const ArrayFieldRow: React.FC<ArrayFieldRowProps> = ({\n children,\n columns,\n spacing,\n index,\n}) => {\n return (\n <ArrayFieldRowContainer index={index}>\n <ArrayFieldRowFields columns={columns} spacing={spacing}>\n {children}\n </ArrayFieldRowFields>\n <ArrayFieldRemoveButton />\n </ArrayFieldRowContainer>\n )\n}\n\nexport interface ArrayFieldRowFieldsProps {\n /**\n * Amount of field columns\n */\n columns?: ResponsiveValue<number>\n /**\n * Spacing between fields\n */\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const ArrayFieldRowFields: React.FC<ArrayFieldRowFieldsProps> = ({\n children,\n columns,\n spacing,\n ...layoutProps\n}) => {\n const { name } = useArrayFieldRowContext()\n return (\n <FormLayout\n flex=\"1\"\n columns={columns}\n gridGap={spacing}\n mr=\"2\"\n {...layoutProps}\n >\n {mapNestedFields(name, children)}\n </FormLayout>\n )\n}\n\nexport const ArrayFieldRowContainer: React.FC<ArrayFieldRowProps> = ({\n children,\n index,\n}) => {\n const context = useArrayFieldRow({ index })\n\n const styles = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-end',\n width: '100%',\n mb: 4,\n }\n\n return (\n <ArrayFieldRowProvider value={context}>\n <chakra.div __css={styles}>{children}</chakra.div>\n </ArrayFieldRowProvider>\n )\n}\n\nexport const ArrayFieldRemoveButton: React.FC<ButtonProps> = (props) => {\n return (\n <IconButton\n icon={<MinusIcon />}\n aria-label=\"Remove row\"\n {...useArrayFieldRemoveButton()}\n {...props}\n />\n )\n}\n\nexport const ArrayFieldAddButton: React.FC<ButtonProps> = (props) => {\n return (\n <IconButton\n icon={<AddIcon />}\n aria-label=\"Add row\"\n float=\"right\"\n {...useArrayFieldAddButton()}\n {...props}\n />\n )\n}\n\nexport interface ArrayFieldProps\n extends ArrayFieldOptions,\n Omit<FieldProps, 'defaultValue'> {}\n\nexport const ArrayField = React.forwardRef(\n (props: ArrayFieldProps, ref: React.ForwardedRef<UseArrayFieldReturn>) => {\n const { children, ...containerProps } = props\n\n return (\n <ArrayFieldContainer ref={ref} {...containerProps}>\n <ArrayFieldRows>\n {(fields: ArrayField[]) => (\n <>\n {fields.map(({ id }, index: number) => (\n <ArrayFieldRow key={id} index={index}>\n {children}\n </ArrayFieldRow>\n ))}\n </>\n )}\n </ArrayFieldRows>\n <ArrayFieldAddButton />\n </ArrayFieldContainer>\n )\n }\n)\n\nexport interface ArrayFieldRowsProps {\n children: (fields: ArrayField[]) => React.ReactElement | null\n}\n\nexport const ArrayFieldRows = ({\n children,\n}: ArrayFieldRowsProps): React.ReactElement | null => {\n const { fields } = useArrayFieldContext()\n return children(fields)\n}\n\nexport const ArrayFieldContainer = React.forwardRef(\n (\n {\n name,\n defaultValue,\n keyName,\n min,\n max,\n children,\n ...fieldProps\n }: ArrayFieldProps,\n ref: React.ForwardedRef<UseArrayFieldReturn>\n ) => {\n const context = useArrayField({\n name,\n defaultValue,\n keyName,\n min,\n max,\n })\n\n // This exposes the useArrayField api through the forwarded ref\n React.useImperativeHandle(ref, () => context, [ref, context])\n\n return (\n <ArrayFieldProvider value={context}>\n <BaseField name={name} {...fieldProps}>\n {children}\n </BaseField>\n </ArrayFieldProvider>\n )\n }\n)\n","import * as React from 'react'\nimport {\n FormControl,\n FormLabel,\n FormLabelProps,\n ResponsiveValue,\n useStyles,\n} from '@chakra-ui/react'\n\nimport { FormLayout } from './layout'\nimport { FieldProps } from './field'\n\nimport { mapNestedFields } from './utils'\n\nexport interface ObjectFieldProps extends FieldProps {\n name: string\n children: React.ReactNode\n columns?: ResponsiveValue<number>\n spacing?: ResponsiveValue<string | number>\n}\n\nexport const FormLegend = (props: FormLabelProps) => {\n const styles = useStyles()\n return <FormLabel as=\"legend\" sx={styles.legend} {...props} />\n}\n\nexport const ObjectField: React.FC<ObjectFieldProps> = (props) => {\n const { name, label, hideLabel, children, columns, spacing, ...fieldProps } =\n props\n\n return (\n <FormControl name={name} as=\"fieldset\" {...fieldProps}>\n <FormLegend display={hideLabel ? 'none' : 'block'}>{label}</FormLegend>\n <FormLayout columns={columns} gridGap={spacing}>\n {mapNestedFields(name, children)}\n </FormLayout>\n </FormControl>\n )\n}\n","import { FieldProps } from './field'\n\nimport { get } from '@chakra-ui/utils'\n\nexport type FieldResolver = {\n getFields(): FieldProps[]\n getNestedFields(name: string): FieldProps[]\n}\n\n// @todo finalize this\nexport type FormSchema = Record<string, any>\n\nconst mapFields = (schema: FormSchema) =>\n Object.entries(schema).map(([name, field]) => {\n return {\n name,\n ...field,\n }\n })\n\nexport const defaultFieldResolver = (schema: FormSchema): FieldResolver => {\n const getFields = () => {\n return mapFields(schema)\n }\n const getNestedFields = (name: string) => {\n const field = get(schema, name)\n\n if (!field) return []\n\n if (field.items?.type === 'object') {\n return mapFields(field.items.properties)\n } else if (field.type === 'object') {\n return mapFields(field.properties)\n }\n return [field.items]\n }\n\n return { getFields, getNestedFields }\n}\n","import * as React from 'react'\n\nimport { FormLayout } from './layout'\nimport { Field, FieldProps } from './field'\n\nimport { ArrayField } from './array-field'\nimport { ObjectField } from './object-field'\nimport { FieldResolver } from './field-resolver'\nimport { defaultFieldResolver } from './field-resolver'\n\nexport interface FieldsProps {\n schema: any\n fieldResolver?: FieldResolver\n}\n\nconst mapNestedFields = (resolver: FieldResolver, name: string) => {\n return resolver\n .getNestedFields(name)\n ?.map(\n ({ name, type, ...nestedFieldProps }: FieldProps, i): React.ReactNode => (\n <Field key={name || i} name={name} type={type} {...nestedFieldProps} />\n )\n )\n}\n\nexport const Fields: React.FC<FieldsProps> = ({\n schema,\n fieldResolver,\n ...props\n}) => {\n const resolver = React.useMemo(\n () => fieldResolver || defaultFieldResolver(schema),\n [schema, fieldResolver]\n )\n\n return (\n <FormLayout {...props}>\n {resolver\n .getFields()\n .map(\n ({\n name,\n type,\n defaultValue,\n ...fieldProps\n }: FieldProps): React.ReactNode => {\n if (type === 'array') {\n return (\n <ArrayField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ArrayField>\n )\n } else if (type === 'object') {\n return (\n <ObjectField key={name} name={name} {...fieldProps}>\n {mapNestedFields(resolver, name)}\n </ObjectField>\n )\n }\n\n return <Field key={name} name={name} type={type} {...fieldProps} />\n }\n )}\n </FormLayout>\n )\n}\n","import * as React from 'react'\n\nimport { chakra, HTMLChakraProps, forwardRef } from '@chakra-ui/react'\n\nimport {\n useForm,\n FormProvider,\n UseFormProps,\n UseFormReturn,\n FieldValues,\n SubmitHandler,\n SubmitErrorHandler,\n} from 'react-hook-form'\n\nexport type { UseFormReturn, FieldValues, SubmitHandler }\n\ninterface FormOptions<TFieldValues extends FieldValues = FieldValues> {\n /**\n * The form schema, currently supports Yup schema only.\n */\n schema?: any\n /**\n * The submit handler.\n */\n onSubmit: SubmitHandler<TFieldValues>\n /**\n * Triggers when there are validation errors.\n */\n onError?: SubmitErrorHandler<TFieldValues>\n /**\n * Ref on the HTMLFormElement.\n */\n formRef?: React.MutableRefObject<HTMLFormElement>\n}\n\n/**\n * @todo Figure out how to pass down FieldValues to all Field components,\n * if at all possible.\n */\nexport interface FormProps<TFieldValues extends FieldValues = FieldValues>\n extends UseFormProps<TFieldValues>,\n Omit<HTMLChakraProps<'form'>, 'onSubmit' | 'onError'>,\n FormOptions<TFieldValues> {}\n\nexport const Form = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const {\n mode = 'all',\n resolver,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n schema,\n defaultValues,\n onSubmit,\n onError,\n formRef,\n children,\n ...rest\n } = props\n\n const form = {\n mode,\n resolver,\n defaultValues,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n }\n\n const methods = useForm<TFieldValues>(form)\n const { handleSubmit } = methods\n\n // This exposes the useForm api through the forwarded ref\n React.useImperativeHandle(ref, () => methods, [ref, methods])\n\n return (\n <FormProvider {...methods}>\n <chakra.form\n ref={formRef}\n onSubmit={handleSubmit(onSubmit, onError)}\n {...rest}\n >\n {children}\n </chakra.form>\n </FormProvider>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","import * as React from 'react'\n\nimport { useFormContext } from 'react-hook-form'\n\nimport { Button, ButtonProps } from '@saas-ui/button'\n\nimport { forwardRef } from '@chakra-ui/system'\n\nexport interface SubmitButtonProps extends ButtonProps {\n /**\n * Disable the submit button if the form is untouched.\n *\n * Change the default behavior by updating\n * `SubmitButton.defaultProps.disableIfUntouched`\n */\n disableIfUntouched?: boolean\n /**\n * Disable the submit button if the form is invalid.\n *\n * Change the default behavior by updating\n * `SubmitButton.defaultProps.disableIfInvalid`\n */\n disableIfInvalid?: boolean\n}\n\nexport const SubmitButton = forwardRef<SubmitButtonProps, 'button'>(\n (props, ref) => {\n const { children, disableIfUntouched, disableIfInvalid, ...rest } = props\n const { formState } = useFormContext()\n\n const isDisabled =\n (disableIfUntouched && !formState.isDirty) ||\n (disableIfInvalid && !formState.isValid)\n\n return (\n <Button\n type=\"submit\"\n isLoading={formState.isSubmitting}\n isPrimary\n ref={ref}\n isDisabled={isDisabled}\n {...rest}\n >\n {children}\n </Button>\n )\n }\n)\n\nSubmitButton.defaultProps = {\n label: 'Submit',\n disableIfUntouched: false,\n disableIfInvalid: false,\n}\n","import * as React from 'react'\nimport { FieldValues, UseFormReturn } from 'react-hook-form'\nimport { forwardRef } from '@chakra-ui/react'\n\nimport { Form, FormProps } from './form'\nimport { FormLayout } from './layout'\nimport { Fields } from './fields'\nimport { SubmitButton } from './submit-button'\n\ninterface AutoFormOptions {\n submitLabel?: false | string\n schema: any\n fieldResolver?: any\n}\n\nexport interface AutoFormProps<TFieldValues extends FieldValues>\n extends Omit<FormProps<TFieldValues>, 'schema'>,\n AutoFormOptions {}\n\nexport const AutoForm = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: AutoFormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const { schema, submitLabel = 'Submit', fieldResolver, ...rest } = props\n\n return (\n <Form {...rest} ref={ref}>\n <FormLayout>\n {<Fields schema={schema} fieldResolver={fieldResolver} />}\n {submitLabel && <SubmitButton label={submitLabel} />}\n </FormLayout>\n </Form>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: AutoFormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","import*as e from\"react\";import{forwardRef as t,useMultiStyleConfig as s,omitThemingProps as r,StylesProvider as n,chakra as a,useStyles as i}from\"@chakra-ui/system\";import{Icon as c,CheckIcon as p}from\"@chakra-ui/icons\";import{Collapse as l}from\"@saas-ui/collapse\";import{getChildrenOfType as o,getChildOfType as m}from\"@saas-ui/react-utils\";import{cx as u,__DEV__ as d}from\"@chakra-ui/utils\";import{createContext as f}from\"@chakra-ui/react-utils\";function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},v.apply(this,arguments)}function S(e,t){if(null==e)return{};var s,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(s=a[r])>=0||(n[s]=e[s]);return n}const[_,N]=f({name:\"StepperContext\",errorMessage:\"useStepperContext: `context` is undefined. Seems you forgot to wrap stepper components in `<Stepper />`\"});function h(t){const{step:s}=t,[r,n]=e.useState(-1),a=e.useRef([]),[,i]=e.useState(Date.now()),c=e.useCallback(e=>{const t=[...a.current];-1===t.indexOf(e)&&t.push(e),a.current=t,i(Date.now())},[a,i]),p=e=>{const t=a.current.indexOf(e);-1!==t&&n(t)};return e.useLayoutEffect(()=>{\"string\"==typeof s?p(s):\"number\"==typeof s?n(s):-1===r&&n(0)},[s]),{stepsRef:a,activeStep:a.current[r],activeIndex:r,isFirstStep:0===r,isLastStep:r===a.current.length-1,isCompleted:r>=a.current.length,setIndex:n,setStep:p,nextStep:()=>{n(r+1)},prevStep:()=>{n(r-1)},registerStep:c,unregisterStep:e=>{a.current=a.current.slice(a.current.indexOf(e),1)}}}function y(t){const{name:s,isActive:r,isCompleted:n}=t,{registerStep:a,unregisterStep:i,activeStep:c}=N();return e.useEffect(()=>{if(s)return a(s),()=>{i(s)}},[]),{isActive:s?c===s:r,isCompleted:n}}function x({label:e=\"Back\"}={}){const{isFirstStep:t,prevStep:s}=N();return{isDisabled:t,onClick:s,label:e}}function C({label:e=\"Next\",submitLabel:t=\"Submit\"}={}){const{isLastStep:s,isCompleted:r,nextStep:n}=N();return{isDisabled:r,onClick:n,label:s?t:e}}const E=[\"children\",\"orientation\"],g=[\"children\",\"orientation\",\"stepComponent\"],b=[\"children\",\"isOpen\"],k=[\"icon\",\"isActive\",\"isCompleted\",\"className\"],A=[\"title\",\"icon\",\"isActive\",\"isCompleted\"],O=[\"isActive\"],D=t((t,i)=>{const c=s(\"Stepper\",t),p=r(t),{children:l,orientation:o}=p,m=S(p,E),d=h(t),f=v({display:\"flex\",flexDirection:\"column\"},c.container);/*#__PURE__*/return e.createElement(n,{value:c},/*#__PURE__*/e.createElement(_,{value:d},/*#__PURE__*/e.createElement(a.div,v({ref:i,__css:f},m,{className:u(\"saas-stepper__container\",t.className)}),/*#__PURE__*/e.createElement(I,{orientation:o},l))))});d&&(D.displayName=\"Stepper\");const I=t=>{var s,r;const{children:n,orientation:c,stepComponent:p}=t,l=S(t,g),d=i(),{activeIndex:f}=N(),_=v({display:\"flex\",flexDirection:\"row\",alignItems:\"center\"},d.steps),h=\"vertical\"===c,y=p||L,x=o(n,y),C=x.reduce((t,s,r,n)=>(t.push(/*#__PURE__*/e.createElement(y,v({key:r},s.props,{icon:s.props.icon||r+1,isActive:f===r,isCompleted:s.props.isCompleted||f>r}))),\"vertical\"===c&&t.push(/*#__PURE__*/e.createElement(w,{key:`content-${r}`,isOpen:f===r},s.props.children)),r<n.length-1&&t.push(/*#__PURE__*/e.createElement(F,{key:`separator-${r}`,isActive:r<f})),t),[]),E=m(n,T),b=f>=x.length?E:h?null:/*#__PURE__*/e.createElement(w,null,null==(s=x[f])||null==(r=s.props)?void 0:r.children);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(a.div,v({__css:_},l,{className:u(\"saas-stepper__steps\",t.className)}),C),b)};d&&(I.displayName=\"StepperSteps\");const w=t=>{const{children:s,isOpen:r=!0}=t,n=S(t,b),c=i();/*#__PURE__*/return e.createElement(a.div,v({__css:c.content},n,{className:u(\"saas-stepper__content\",t.className)}),/*#__PURE__*/e.createElement(l,{in:r},s))};d&&(w.displayName=\"StepperContent\");const j=t=>{const{icon:s,isCompleted:r,className:n}=t,l=S(t,k),o=v({display:\"flex\",alignItems:\"center\",justifyContent:\"center\",borderRadius:\"full\",fontSize:\"1em\",me:2},i().icon);let m;return m=r?/*#__PURE__*/e.createElement(c,{as:p}):s,/*#__PURE__*/e.createElement(a.div,v({__css:o},l,{className:u(\"saas-stepper__icon\",n)}),m)};d&&(j.displayName=\"StepperIcon\");const L=t=>{const{title:s,icon:r,isActive:n,isCompleted:c}=t,p=S(t,A),l=y(t),o=v({display:\"flex\",alignItems:\"center\",flexDirection:\"row\"},i().step);/*#__PURE__*/return e.createElement(a.div,v({__css:o,\"data-active\":l.isActive,\"data-completed\":l.isCompleted},p,{className:u(\"saas-stepper__step\",t.className)}),/*#__PURE__*/e.createElement(j,{icon:r,isActive:n,isCompleted:c}),s&&/*#__PURE__*/e.createElement(R,null,s))};d&&(L.displayName=\"StepperStep\");const F=t=>{const{isActive:s}=t,r=S(t,O),n=v({flex:1,borderTopWidth:\"1px\",mx:2},i().separator);/*#__PURE__*/return e.createElement(a.div,v({\"data-active\":s},r,{className:u(\"saas-stepper__separator\",t.className),__css:n}))};d&&(F.displayName=\"StepperSeparator\");const R=t=>{const s=i();/*#__PURE__*/return e.createElement(a.p,v({},t,{__css:s.title,className:u(\"saas-stepper__title\",t.className)}))};d&&(R.displayName=\"StepperStepTitle\");const T=t=>{const s=i();/*#__PURE__*/return e.createElement(a.div,v({__css:s.completed},t,{className:u(\"saas-stepper__completed\",t.className)}))};d&&(T.displayName=\"StepperCompleted\");export{D as Stepper,T as StepperCompleted,w as StepperContent,j as StepperIcon,_ as StepperProvider,F as StepperSeparator,L as StepperStep,R as StepperStepTitle,I as StepperSteps,C as useNext,x as usePrev,y as useStep,h as useStepper,N as useStepperContext};\n//# sourceMappingURL=index.modern.js.map\n","import * as React from 'react'\nimport { FieldValues, SubmitHandler } from 'react-hook-form'\nimport { createContext } from '@chakra-ui/react-utils'\nimport {\n useStepper,\n useStep,\n UseStepperProps,\n UseStepperReturn,\n} from '@saas-ui/stepper'\n\nexport interface StepState {\n name: string\n schema?: any\n resolver?: any\n isActive?: boolean\n isCompleted?: boolean\n}\n\nexport interface StepFormContext extends UseStepperReturn {\n updateStep(state: StepState): void\n steps: Record<string, StepState>\n}\n\nexport const [StepFormProvider, useStepFormContext] =\n createContext<StepFormContext>({\n name: 'StepFormContext',\n errorMessage:\n 'useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`',\n })\n\nimport { FormProps } from './form'\n\nexport interface UseStepFormProps<\n TFieldValues extends FieldValues = FieldValues\n> extends UseStepperProps,\n FormProps<TFieldValues> {}\n\nexport function useStepForm<TFieldValues extends FieldValues = FieldValues>(\n props: UseStepFormProps<TFieldValues>\n) {\n const stepper = useStepper(props)\n\n const { activeStep, isLastStep, nextStep } = stepper\n\n const [steps, updateSteps] = React.useState({})\n\n const onSubmitStep: SubmitHandler<TFieldValues> = React.useCallback(\n async (data) => {\n if (isLastStep) {\n return props\n .onSubmit?.(data)\n .then(() => {\n const step = steps[activeStep]\n updateStep({\n ...step,\n isCompleted: true,\n })\n })\n .then(nextStep) // Show completed step\n }\n\n nextStep()\n },\n [activeStep, isLastStep]\n )\n\n const getFormProps = React.useCallback(\n (props) => {\n const step = steps[activeStep]\n return {\n onSubmit: onSubmitStep,\n schema: step?.schema,\n resolver: step?.resolver,\n }\n },\n [steps, onSubmitStep, activeStep]\n )\n\n const updateStep = React.useCallback(\n (step) => {\n updateSteps((steps) => {\n return {\n ...steps,\n [step.name]: step,\n }\n })\n },\n [steps]\n )\n\n return {\n getFormProps,\n updateStep,\n steps,\n ...stepper,\n }\n}\n\nexport type UseStepFormReturn = ReturnType<typeof useStepForm>\n\nexport interface UseFormStepProps {\n name: string\n schema?: any\n resolver?: any\n}\n\nexport function useFormStep(props: UseFormStepProps): StepState {\n const { name, schema, resolver } = props\n const step = useStep({ name })\n\n const { steps, updateStep } = useStepFormContext()\n\n React.useEffect(() => {\n updateStep({ name, schema, resolver })\n }, [name, schema])\n\n return {\n ...step,\n ...(steps[name] || { name, schema }),\n }\n}\n","import * as React from 'react'\n\nimport { FieldValues, UseFormReturn } from 'react-hook-form'\n\nimport {\n chakra,\n HTMLChakraProps,\n useMultiStyleConfig,\n StylesProvider,\n} from '@chakra-ui/system'\n\nimport { callAllHandlers, runIfFn, cx, __DEV__ } from '@chakra-ui/utils'\n\nimport {\n StepperProvider,\n StepperSteps,\n StepperStepsProps,\n StepperStep,\n useStepperContext,\n} from '@saas-ui/stepper'\nimport { Button, ButtonProps } from '@saas-ui/button'\n\nimport { Form, FormProps } from './form'\nimport { SubmitButton } from './submit-button'\n\nimport {\n useStepForm,\n useFormStep,\n StepFormProvider,\n UseStepFormProps,\n} from './use-step-form'\n\nexport interface StepFormProps<TFieldValues extends FieldValues = FieldValues>\n extends UseStepFormProps<TFieldValues>,\n FormProps<TFieldValues> {}\n\nexport const StepForm = React.forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: StepFormProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const { children, onSubmit, ...rest } = props\n\n const stepper = useStepForm<TFieldValues>(props)\n\n const { getFormProps, ...ctx } = stepper\n\n const context = React.useMemo(() => ctx, [ctx])\n\n return (\n <StepperProvider value={context}>\n <StepFormProvider value={context}>\n <Form ref={ref} {...rest} {...getFormProps(props)}>\n {runIfFn(children, stepper)}\n </Form>\n </StepFormProvider>\n </StepperProvider>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n\nexport interface FormStepOptions {\n /**\n * The step name\n */\n name: string\n /**\n * Schema\n */\n schema?: any\n /**\n * Hook Form Resolver\n */\n resolver?: any\n}\n\nexport const FormStepper: React.FC<StepperStepsProps> = (props) => {\n const styles = useMultiStyleConfig('Stepper', props)\n\n const { children } = props\n\n const elements = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child?.type === FormStep) {\n const { isCompleted } = useFormStep(child.props) // Register this step\n return (\n <StepperStep\n name={child.props.name}\n title={child.props.title}\n isCompleted={isCompleted}\n >\n {child.props.children}\n </StepperStep>\n )\n }\n return child\n })\n\n return (\n <StylesProvider value={styles}>\n <StepperSteps mb=\"4\" {...props}>\n {elements}\n </StepperSteps>\n </StylesProvider>\n )\n}\n\nexport interface FormStepProps\n extends FormStepOptions,\n HTMLChakraProps<'div'> {}\n\nexport const FormStep: React.FC<FormStepProps> = (props) => {\n const { name, schema, resolver, children, className, ...rest } = props\n const step = useFormStep({ name, schema, resolver })\n\n const { isActive } = step\n\n return isActive ? (\n <chakra.div {...rest} className={cx('saas-form__step', className)}>\n {children}\n </chakra.div>\n ) : null\n}\n\nif (__DEV__) {\n FormStep.displayName = 'FormStep'\n}\n\nexport const PrevButton: React.FC<ButtonProps> = (props) => {\n const { isFirstStep, isCompleted, prevStep } = useStepperContext()\n\n return (\n <Button\n isDisabled={isFirstStep || isCompleted}\n label=\"Back\"\n {...props}\n className={cx('saas-form__prev-button', props.className)}\n onClick={callAllHandlers(props.onClick, prevStep)}\n />\n )\n}\n\nif (__DEV__) {\n PrevButton.displayName = 'PrevButton'\n}\n\nexport interface NextButtonProps extends ButtonProps {\n submitLabel?: string\n}\n\nexport const NextButton: React.FC<NextButtonProps> = (props) => {\n const { label = 'Next', submitLabel = 'Complete', ...rest } = props\n const { isLastStep, isCompleted } = useStepperContext()\n\n return (\n <SubmitButton\n isDisabled={isCompleted}\n label={isLastStep || isCompleted ? submitLabel : label}\n {...rest}\n className={cx('saas-form__next-button', props.className)}\n />\n )\n}\n\nif (__DEV__) {\n NextButton.displayName = 'NextButton'\n}\n","import * as React from 'react'\nimport {\n useFormContext,\n useWatch,\n FieldValues,\n UseFormReturn,\n} from 'react-hook-form'\n\nexport interface DisplayIfProps<TFieldValues> {\n children: React.ReactElement\n name: string\n defaultValue?: unknown\n isDisabled?: boolean\n isExact?: boolean\n condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean\n}\n\nexport const DisplayIf = <TFieldValues extends FieldValues = FieldValues>({\n children,\n name,\n defaultValue,\n isDisabled,\n isExact,\n condition = (value) => !!value,\n}: DisplayIfProps<TFieldValues>) => {\n const value = useWatch({\n name,\n defaultValue,\n disabled: isDisabled,\n exact: isExact,\n })\n const context = useFormContext<TFieldValues>()\n return condition(value, context) ? children : null\n}\n"],"names":["FormValue","name","getValues","useFormContext","inputTypes","BaseField","props","label","help","variant","hideLabel","children","controlProps","error","formState","get","errors","getError","React","FormControl","isInvalid","FormLabel","Box","message","FormHelperText","FormErrorMessage","Field","forwardRef","ref","type","withControlledInput","InputComponent","rules","inputProps","Controller","control","render","field","_ref","useMergeRefs","withUncontrolledInput","register","registerFieldType","component","options","displayName","isDisabled","isReadOnly","isRequired","inputRules","required","createField","isControlled","split","map","part","charAt","toUpperCase","slice","join","InputField","Input","NumberInputField","NumberInput","PasswordInputFIeld","PasswordInput","TextareaField","Textarea","SwitchField","Switch","SelectField","Select","CheckboxField","Checkbox","RadioField","RadioInput","PinField","PinInput","NativeSelectField","NativeSelect","FormLayoutItem","chakra","div","FormLayout","gridProps","useTheme","components","_theme$components","_theme$components$For2","defaultProps","spacing","SimpleGrid","Children","child","isValidElement","mapNestedFields","cloneElement","createContext","ArrayFieldProvider","useArrayFieldContext","ArrayFieldRowProvider","useArrayFieldRowContext","useArrayField","defaultValue","keyName","min","max","useFieldArray","useArrayFieldRow","index","clearErrors","remove","fields","useEffect","isFirst","isLast","length","useCallback","useArrayFieldRemoveButton","onClick","useArrayFieldAddButton","append","shouldFocus","ArrayFieldRow","ArrayFieldRowContainer","ArrayFieldRowFields","columns","ArrayFieldRemoveButton","layoutProps","flex","gridGap","mr","context","value","__css","display","flexDirection","alignItems","width","mb","IconButton","icon","MinusIcon","ArrayFieldAddButton","AddIcon","float","ArrayField","containerProps","ArrayFieldContainer","ArrayFieldRows","key","id","fieldProps","useImperativeHandle","FormLegend","styles","useStyles","as","sx","legend","ObjectField","mapFields","schema","Object","entries","defaultFieldResolver","getFields","getNestedFields","items","properties","resolver","_resolver$getNestedFi","i","nestedFieldProps","Fields","fieldResolver","useMemo","Form","mode","reValidateMode","shouldFocusError","shouldUnregister","shouldUseNativeValidation","criteriaMode","delayError","defaultValues","onSubmit","onError","formRef","rest","methods","useForm","handleSubmit","FormProvider","form","SubmitButton","disableIfUntouched","disableIfInvalid","Button","isLoading","isSubmitting","isPrimary","isDirty","isValid","AutoForm","submitLabel","errorMessage","StepperProvider","useStepperContext","useStepper","step","useState","activeIndex","setIndex","stepsRef","useRef","onUpdate","Date","now","registerStep","newSteps","current","indexOf","push","setStep","useLayoutEffect","activeStep","isFirstStep","isLastStep","isCompleted","nextStep","prevStep","unregisterStep","useStep","isActive","StepFormProvider","useStepFormContext","useStepForm","stepper","steps","updateSteps","onSubmitStep","data","then","updateStep","getFormProps","useFormStep","StepForm","ctx","runIfFn","FormStep","className","cx","__DEV__","PrevButton","callAllHandlers","NextButton","htmlFor","Text","fontSize","condition","useWatch","disabled","exact","isExact","useMultiStyleConfig","elements","StepperStep","title","StylesProvider","StepperSteps"],"mappings":"ynCAgCaA,EAAwC,gBAAGC,IAAAA,KAEtD,OAAOC,EADeC,mBAAdD,WACSD,IAAS,kPC8EtBG,EAAsC,GAmB/BC,EAAkC,SAACC,GAC9C,IAAQL,EACNK,EADML,KAAMM,EACZD,EADYC,MAAOC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