You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
148 KiB
1 lines
148 KiB
{"version":3,"file":"index.cjs.js","sources":["../src/utils/isCheckBoxInput.ts","../src/utils/isDateObject.ts","../src/utils/isNullOrUndefined.ts","../src/utils/isObject.ts","../src/logic/getEventValue.ts","../src/logic/isNameInFieldArray.ts","../src/logic/getNodeParentName.ts","../src/utils/compact.ts","../src/utils/isUndefined.ts","../src/utils/get.ts","../src/constants.ts","../src/useFormContext.tsx","../src/logic/getProxyFormState.ts","../src/utils/isEmptyObject.ts","../src/logic/shouldRenderFormState.ts","../src/utils/convertToArrayPayload.ts","../src/logic/shouldSubscribeByName.ts","../src/useSubscribe.ts","../src/useFormState.ts","../src/utils/isString.ts","../src/logic/generateWatchOutput.ts","../src/utils/isFunction.ts","../src/utils/objectHasFunction.ts","../src/useWatch.ts","../src/useController.ts","../src/logic/appendErrors.ts","../src/utils/isKey.ts","../src/utils/stringToPath.ts","../src/utils/set.ts","../src/logic/focusFieldBy.ts","../src/logic/generateId.ts","../src/logic/getFocusFieldName.ts","../src/logic/isWatched.ts","../src/utils/append.ts","../src/utils/isWeb.ts","../src/utils/cloneObject.ts","../src/utils/fillEmptyArray.ts","../src/utils/insert.ts","../src/utils/move.ts","../src/utils/prepend.ts","../src/utils/remove.ts","../src/utils/swap.ts","../src/utils/unset.ts","../src/utils/update.ts","../src/utils/createSubject.ts","../src/utils/isPrimitive.ts","../src/utils/deepEqual.ts","../src/utils/getValidationModes.ts","../src/utils/isBoolean.ts","../src/utils/isFileInput.ts","../src/utils/isHTMLElement.ts","../src/utils/isMultipleSelect.ts","../src/utils/isRadioInput.ts","../src/utils/live.ts","../src/logic/getDirtyFields.ts","../src/logic/getCheckboxValue.ts","../src/logic/getFieldValueAs.ts","../src/logic/getRadioValue.ts","../src/logic/getFieldValue.ts","../src/logic/getResolverOptions.ts","../src/utils/isRegex.ts","../src/logic/getRuleValue.ts","../src/logic/schemaErrorLookup.ts","../src/logic/skipValidation.ts","../src/utils/isMessage.ts","../src/logic/getValidateError.ts","../src/logic/getValueAndMessage.ts","../src/logic/validateField.ts","../src/logic/createFormControl.ts","../src/logic/hasValidation.ts","../src/utils/isRadioOrCheckbox.ts","../src/logic/unsetEmptyArray.ts","../src/controller.tsx","../src/useFieldArray.ts","../src/useForm.ts"],"sourcesContent":["import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLInputElement =>\n element.type === 'checkbox';\n","export default (value: unknown): value is Date => value instanceof Date;\n","export default (value: unknown): value is null | undefined => value == null;\n","import isDateObject from './isDateObject';\nimport isNullOrUndefined from './isNullOrUndefined';\n\nexport const isObjectType = (value: unknown) => typeof value === 'object';\n\nexport default <T extends object>(value: unknown): value is T =>\n !isNullOrUndefined(value) &&\n !Array.isArray(value) &&\n isObjectType(value) &&\n !isDateObject(value);\n","import isCheckBoxInput from '../utils/isCheckBoxInput';\nimport isObject from '../utils/isObject';\n\ntype Event = { target: any };\n\nexport default (event: unknown) =>\n isObject(event) && (event as Event).target\n ? isCheckBoxInput((event as Event).target)\n ? (event as Event).target.checked\n : (event as Event).target.value\n : event;\n","import { InternalFieldName } from '../types';\n\nimport getNodeParentName from './getNodeParentName';\n\nexport default (names: Set<InternalFieldName>, name: InternalFieldName) =>\n names.has(getNodeParentName(name));\n","export default (name: string) =>\n name.substring(0, name.search(/\\.\\d+(\\.|$)/)) || name;\n","export default <TValue>(value: TValue[]) =>\n Array.isArray(value) ? value.filter(Boolean) : [];\n","export default (val: unknown): val is undefined => val === undefined;\n","import compact from './compact';\nimport isNullOrUndefined from './isNullOrUndefined';\nimport isObject from './isObject';\nimport isUndefined from './isUndefined';\n\nexport default <T>(obj: T, path: string, defaultValue?: unknown): any => {\n if (!path || !isObject(obj)) {\n return defaultValue;\n }\n\n const result = compact(path.split(/[,[\\].]+?/)).reduce(\n (result, key) =>\n isNullOrUndefined(result) ? result : result[key as keyof {}],\n obj,\n );\n\n return isUndefined(result) || result === obj\n ? isUndefined(obj[path as keyof T])\n ? defaultValue\n : obj[path as keyof T]\n : result;\n};\n","import { ValidationMode } from './types';\n\nexport const EVENTS = {\n BLUR: 'blur',\n FOCUS_OUT: 'focusout',\n CHANGE: 'change',\n};\n\nexport const VALIDATION_MODE: ValidationMode = {\n onBlur: 'onBlur',\n onChange: 'onChange',\n onSubmit: 'onSubmit',\n onTouched: 'onTouched',\n all: 'all',\n};\n\nexport const INPUT_VALIDATION_RULES = {\n max: 'max',\n min: 'min',\n maxLength: 'maxLength',\n minLength: 'minLength',\n pattern: 'pattern',\n required: 'required',\n validate: 'validate',\n};\n","import React from 'react';\n\nimport { FieldValues, FormProviderProps, UseFormReturn } from './types';\n\nconst HookFormContext = React.createContext<UseFormReturn | null>(null);\n\n/**\n * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)\n *\n * @returns return all useForm methods\n *\n * @example\n * ```tsx\n * function App() {\n * const methods = useForm();\n * const onSubmit = data => console.log(data);\n *\n * return (\n * <FormProvider {...methods} >\n * <form onSubmit={methods.handleSubmit(onSubmit)}>\n * <NestedInput />\n * <input type=\"submit\" />\n * </form>\n * </FormProvider>\n * );\n * }\n *\n * function NestedInput() {\n * const { register } = useFormContext(); // retrieve all hook methods\n * return <input {...register(\"test\")} />;\n * }\n * ```\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues,\n>(): UseFormReturn<TFieldValues> =>\n React.useContext(HookFormContext) as unknown as UseFormReturn<TFieldValues>;\n\n/**\n * A provider component that propagates the `useForm` methods to all children components via [React Context](https://reactjs.org/docs/context.html) API. To be used with {@link useFormContext}.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)\n *\n * @param props - all useFrom methods\n *\n * @example\n * ```tsx\n * function App() {\n * const methods = useForm();\n * const onSubmit = data => console.log(data);\n *\n * return (\n * <FormProvider {...methods} >\n * <form onSubmit={methods.handleSubmit(onSubmit)}>\n * <NestedInput />\n * <input type=\"submit\" />\n * </form>\n * </FormProvider>\n * );\n * }\n *\n * function NestedInput() {\n * const { register } = useFormContext(); // retrieve all hook methods\n * return <input {...register(\"test\")} />;\n * }\n * ```\n */\nexport const FormProvider = <TFieldValues extends FieldValues, TContext = any>(\n props: FormProviderProps<TFieldValues, TContext>,\n) => {\n const { children, ...data } = props;\n return (\n <HookFormContext.Provider value={data as unknown as UseFormReturn}>\n {children}\n </HookFormContext.Provider>\n );\n};\n","import { VALIDATION_MODE } from '../constants';\nimport { FieldValues, FormState, ReadFormState } from '../types';\n\nexport default <TFieldValues extends FieldValues>(\n formState: FormState<TFieldValues>,\n _proxyFormState: ReadFormState,\n localProxyFormState?: ReadFormState,\n isRoot = true,\n) => {\n const result = {} as typeof formState;\n\n for (const key in formState) {\n Object.defineProperty(result, key, {\n get: () => {\n const _key = key as keyof FormState<TFieldValues> & keyof ReadFormState;\n\n if (_proxyFormState[_key] !== VALIDATION_MODE.all) {\n _proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;\n }\n\n localProxyFormState && (localProxyFormState[_key] = true);\n return formState[_key];\n },\n });\n }\n\n return result;\n};\n","import { EmptyObject } from '../types';\n\nimport isObject from './isObject';\n\nexport default (value: unknown): value is EmptyObject =>\n isObject(value) && !Object.keys(value).length;\n","import { VALIDATION_MODE } from '../constants';\nimport { ReadFormState } from '../types';\nimport isEmptyObject from '../utils/isEmptyObject';\n\nexport default <T extends Record<string, any>, K extends ReadFormState>(\n formStateData: T,\n _proxyFormState: K,\n isRoot?: boolean,\n) => {\n const { name, ...formState } = formStateData;\n\n return (\n isEmptyObject(formState) ||\n Object.keys(formState).length >= Object.keys(_proxyFormState).length ||\n Object.keys(formState).find(\n (key) =>\n _proxyFormState[key as keyof ReadFormState] ===\n (!isRoot || VALIDATION_MODE.all),\n )\n );\n};\n","export default <T>(value: T) => (Array.isArray(value) ? value : [value]);\n","import convertToArrayPayload from '../utils/convertToArrayPayload';\n\nexport default <T extends string | string[] | undefined>(\n name?: T,\n signalName?: string,\n exact?: boolean,\n) =>\n exact && signalName\n ? name === signalName\n : !name ||\n !signalName ||\n name === signalName ||\n convertToArrayPayload(name).some(\n (currentName) =>\n currentName &&\n (currentName.startsWith(signalName) ||\n signalName.startsWith(currentName)),\n );\n","import React from 'react';\n\nimport { Subject, Subscription } from './utils/createSubject';\n\ntype Props<T> = {\n disabled?: boolean;\n subject: Subject<T>;\n callback: (value: T) => void;\n};\n\nexport function useSubscribe<T>(props: Props<T>) {\n const _props = React.useRef(props);\n _props.current = props;\n\n React.useEffect(() => {\n const tearDown = (subscription: Subscription | false) => {\n if (subscription) {\n subscription.unsubscribe();\n }\n };\n\n const subscription =\n !props.disabled &&\n _props.current.subject.subscribe({\n next: _props.current.callback,\n });\n\n return () => tearDown(subscription);\n }, [props.disabled]);\n}\n","import React from 'react';\n\nimport getProxyFormState from './logic/getProxyFormState';\nimport shouldRenderFormState from './logic/shouldRenderFormState';\nimport shouldSubscribeByName from './logic/shouldSubscribeByName';\nimport {\n FieldValues,\n InternalFieldName,\n UseFormStateProps,\n UseFormStateReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)\n *\n * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}\n *\n * @example\n * ```tsx\n * function App() {\n * const { register, handleSubmit, control } = useForm({\n * defaultValues: {\n * firstName: \"firstName\"\n * }});\n * const { dirtyFields } = useFormState({\n * control\n * });\n * const onSubmit = (data) => console.log(data);\n *\n * return (\n * <form onSubmit={handleSubmit(onSubmit)}>\n * <input {...register(\"firstName\")} placeholder=\"First Name\" />\n * {dirtyFields.firstName && <p>Field is dirty.</p>}\n * <input type=\"submit\" />\n * </form>\n * );\n * }\n * ```\n */\nfunction useFormState<TFieldValues extends FieldValues = FieldValues>(\n props?: UseFormStateProps<TFieldValues>,\n): UseFormStateReturn<TFieldValues> {\n const methods = useFormContext<TFieldValues>();\n const { control = methods.control, disabled, name, exact } = props || {};\n const [formState, updateFormState] = React.useState(control._formState);\n const _localProxyFormState = React.useRef({\n isDirty: false,\n dirtyFields: false,\n touchedFields: false,\n isValidating: false,\n isValid: false,\n errors: false,\n });\n const _name = React.useRef(name);\n const _mounted = React.useRef(true);\n\n _name.current = name;\n\n const callback = React.useCallback(\n (value: { name?: InternalFieldName }) =>\n _mounted.current &&\n shouldSubscribeByName(\n _name.current as InternalFieldName,\n value.name,\n exact,\n ) &&\n shouldRenderFormState(value, _localProxyFormState.current) &&\n updateFormState({\n ...control._formState,\n ...value,\n }),\n [control, exact],\n );\n\n useSubscribe({\n disabled,\n callback,\n subject: control._subjects.state,\n });\n\n React.useEffect(() => {\n _mounted.current = true;\n return () => {\n _mounted.current = false;\n };\n }, []);\n\n return getProxyFormState(\n formState,\n control._proxyFormState,\n _localProxyFormState.current,\n false,\n );\n}\n\nexport { useFormState };\n","export default (value: unknown): value is string => typeof value === 'string';\n","import { FieldValues, InternalFieldName, Names } from '../types';\nimport get from '../utils/get';\nimport isString from '../utils/isString';\n\nexport default (\n names: string | string[] | undefined,\n _names: Names,\n formValues?: FieldValues,\n isGlobal?: boolean,\n) => {\n const isArray = Array.isArray(names);\n if (isString(names)) {\n isGlobal && _names.watch.add(names as InternalFieldName);\n return get(formValues, names as InternalFieldName);\n }\n\n if (isArray) {\n return names.map(\n (fieldName) => (\n isGlobal && _names.watch.add(fieldName as InternalFieldName),\n get(formValues, fieldName as InternalFieldName)\n ),\n );\n }\n\n isGlobal && (_names.watchAll = true);\n return formValues;\n};\n","export default (value: unknown): value is Function =>\n typeof value === 'function';\n","import isFunction from './isFunction';\n\nexport default <T>(data: T): boolean => {\n for (const key in data) {\n if (isFunction(data[key])) {\n return true;\n }\n }\n return false;\n};\n","import React from 'react';\n\nimport generateWatchOutput from './logic/generateWatchOutput';\nimport shouldSubscribeByName from './logic/shouldSubscribeByName';\nimport isObject from './utils/isObject';\nimport isUndefined from './utils/isUndefined';\nimport objectHasFunction from './utils/objectHasFunction';\nimport {\n Control,\n DeepPartialSkipArrayKey,\n FieldPath,\n FieldPathValue,\n FieldPathValues,\n FieldValues,\n InternalFieldName,\n UnpackNestedValue,\n UseWatchProps,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * Subscribe to the entire form values change and re-render at the hook level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @param props - defaultValue, disable subscription and match exact name.\n *\n * @example\n * ```tsx\n * const { watch } = useForm();\n * const values = useWatch({\n * control,\n * defaultValue: {\n * name: \"data\"\n * },\n * exact: false,\n * })\n * ```\n */\nexport function useWatch<\n TFieldValues extends FieldValues = FieldValues,\n>(props: {\n defaultValue?: DeepPartialSkipArrayKey<TFieldValues>;\n control?: Control<TFieldValues>;\n disabled?: boolean;\n exact?: boolean;\n}): DeepPartialSkipArrayKey<TFieldValues>;\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @param props - defaultValue, disable subscription and match exact name.\n *\n * @example\n * ```tsx\n * const { watch } = useForm();\n * const values = useWatch({\n * control,\n * name: \"fieldA\",\n * defaultValue: \"default value\",\n * exact: false,\n * })\n * ```\n */\nexport function useWatch<\n TFieldValues extends FieldValues = FieldValues,\n TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(props: {\n name: TFieldName;\n defaultValue?: FieldPathValue<TFieldValues, TFieldName>;\n control?: Control<TFieldValues>;\n disabled?: boolean;\n exact?: boolean;\n}): FieldPathValue<TFieldValues, TFieldName>;\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @param props - defaultValue, disable subscription and match exact name.\n *\n * @example\n * ```tsx\n * const { watch } = useForm();\n * const values = useWatch({\n * control,\n * name: [\"fieldA\", \"fieldB\"],\n * defaultValue: {\n * fieldA: \"data\",\n * fieldB: \"data\"\n * },\n * exact: false,\n * })\n * ```\n */\nexport function useWatch<\n TFieldValues extends FieldValues = FieldValues,\n TFieldNames extends readonly FieldPath<TFieldValues>[] = readonly FieldPath<TFieldValues>[],\n>(props: {\n name: readonly [...TFieldNames];\n defaultValue?: UnpackNestedValue<DeepPartialSkipArrayKey<TFieldValues>>;\n control?: Control<TFieldValues>;\n disabled?: boolean;\n exact?: boolean;\n}): FieldPathValues<TFieldValues, TFieldNames>;\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @example\n * ```tsx\n * // can skip passing down the control into useWatch if the form is wrapped with the FormProvider\n * const values = useWatch()\n * ```\n */\nexport function useWatch<\n TFieldValues extends FieldValues = FieldValues,\n TFieldNames extends FieldPath<TFieldValues>[] = FieldPath<TFieldValues>[],\n>(): FieldPathValues<TFieldValues, TFieldNames>;\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/api/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @example\n * ```tsx\n * const { watch } = useForm();\n * const values = useWatch({\n * name: \"fieldName\"\n * control,\n * })\n * ```\n */\nexport function useWatch<TFieldValues extends FieldValues>(\n props?: UseWatchProps<TFieldValues>,\n) {\n const methods = useFormContext();\n const {\n control = methods.control,\n name,\n defaultValue,\n disabled,\n exact,\n } = props || {};\n const _name = React.useRef(name);\n\n _name.current = name;\n\n const callback = React.useCallback(\n (formState: { name?: InternalFieldName; values?: FieldValues }) => {\n if (\n shouldSubscribeByName(\n _name.current as InternalFieldName,\n formState.name,\n exact,\n )\n ) {\n const fieldValues = generateWatchOutput(\n _name.current as InternalFieldName | InternalFieldName[],\n control._names,\n formState.values || control._formValues,\n );\n\n updateValue(\n isUndefined(_name.current) ||\n (isObject(fieldValues) && !objectHasFunction(fieldValues))\n ? { ...fieldValues }\n : Array.isArray(fieldValues)\n ? [...fieldValues]\n : isUndefined(fieldValues)\n ? defaultValue\n : fieldValues,\n );\n }\n },\n [control, exact, defaultValue],\n );\n\n useSubscribe({\n disabled,\n subject: control._subjects.watch,\n callback,\n });\n\n const [value, updateValue] = React.useState<unknown>(\n isUndefined(defaultValue)\n ? control._getWatch(name as InternalFieldName)\n : defaultValue,\n );\n\n React.useEffect(() => {\n control._removeUnmounted();\n });\n\n return value;\n}\n","import React from 'react';\n\nimport getEventValue from './logic/getEventValue';\nimport isNameInFieldArray from './logic/isNameInFieldArray';\nimport get from './utils/get';\nimport { EVENTS } from './constants';\nimport {\n ControllerFieldState,\n Field,\n FieldPath,\n FieldPathValue,\n FieldValues,\n InternalFieldName,\n UseControllerProps,\n UseControllerReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useFormState } from './useFormState';\nimport { useWatch } from './useWatch';\n\n/**\n * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)\n *\n * @param props - the path name to the form field value, and validation rules.\n *\n * @returns field properties, field and form state. {@link UseControllerReturn}\n *\n * @example\n * ```tsx\n * function Input(props) {\n * const { field, fieldState, formState } = useController(props);\n * return (\n * <div>\n * <input {...field} placeholder={props.name} />\n * <p>{fieldState.isTouched && \"Touched\"}</p>\n * <p>{formState.isSubmitted ? \"submitted\" : \"\"}</p>\n * </div>\n * );\n * }\n * ```\n */\nexport function useController<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(\n props: UseControllerProps<TFieldValues, TName>,\n): UseControllerReturn<TFieldValues, TName> {\n const methods = useFormContext<TFieldValues>();\n const { name, control = methods.control, shouldUnregister } = props;\n const isArrayField = isNameInFieldArray(control._names.array, name);\n const value = useWatch({\n control,\n name,\n defaultValue: get(\n control._formValues,\n name,\n get(control._defaultValues, name, props.defaultValue),\n ),\n exact: true,\n }) as FieldPathValue<TFieldValues, TName>;\n const formState = useFormState({\n control,\n name,\n });\n\n const _registerProps = React.useRef(\n control.register(name, {\n ...props.rules,\n value,\n }),\n );\n\n React.useEffect(() => {\n const updateMounted = (name: InternalFieldName, value: boolean) => {\n const field: Field = get(control._fields, name);\n\n if (field) {\n field._f.mount = value;\n }\n };\n\n updateMounted(name, true);\n\n return () => {\n const _shouldUnregisterField =\n control._options.shouldUnregister || shouldUnregister;\n\n (\n isArrayField\n ? _shouldUnregisterField && !control._stateFlags.action\n : _shouldUnregisterField\n )\n ? control.unregister(name)\n : updateMounted(name, false);\n };\n }, [name, control, isArrayField, shouldUnregister]);\n\n return {\n field: {\n name,\n value,\n onChange: React.useCallback(\n (event) => {\n _registerProps.current.onChange({\n target: {\n value: getEventValue(event),\n name: name as InternalFieldName,\n },\n type: EVENTS.CHANGE,\n });\n },\n [name],\n ),\n onBlur: React.useCallback(() => {\n _registerProps.current.onBlur({\n target: {\n value: get(control._formValues, name),\n name: name as InternalFieldName,\n },\n type: EVENTS.BLUR,\n });\n }, [name, control]),\n ref: React.useCallback(\n (elm) => {\n const field = get(control._fields, name);\n\n if (elm && field && elm.focus) {\n field._f.ref = {\n focus: () => elm.focus(),\n select: () => elm.select(),\n setCustomValidity: (message: string) =>\n elm.setCustomValidity(message),\n reportValidity: () => elm.reportValidity(),\n };\n }\n },\n [name, control._fields],\n ),\n },\n formState,\n fieldState: Object.defineProperties(\n {},\n {\n invalid: {\n get: () => !!get(formState.errors, name),\n },\n isDirty: {\n get: () => !!get(formState.dirtyFields, name),\n },\n isTouched: {\n get: () => !!get(formState.touchedFields, name),\n },\n error: {\n get: () => get(formState.errors, name),\n },\n },\n ) as ControllerFieldState,\n };\n}\n","import {\n InternalFieldErrors,\n InternalFieldName,\n ValidateResult,\n} from '../types';\n\nexport default (\n name: InternalFieldName,\n validateAllFieldCriteria: boolean,\n errors: InternalFieldErrors,\n type: string,\n message: ValidateResult,\n) =>\n validateAllFieldCriteria\n ? {\n ...errors[name],\n types: {\n ...(errors[name] && errors[name]!.types ? errors[name]!.types : {}),\n [type]: message || true,\n },\n }\n : {};\n","export default (value: string) => /^\\w*$/.test(value);\n","import compact from './compact';\n\nexport default (input: string): string[] =>\n compact(input.replace(/[\"|']|\\]/g, '').split(/\\.|\\[/));\n","import { FieldValues } from '../types';\n\nimport isKey from './isKey';\nimport isObject from './isObject';\nimport stringToPath from './stringToPath';\n\nexport default function set(\n object: FieldValues,\n path: string,\n value?: unknown,\n) {\n let index = -1;\n const tempPath = isKey(path) ? [path] : stringToPath(path);\n const length = tempPath.length;\n const lastIndex = length - 1;\n\n while (++index < length) {\n const key = tempPath[index];\n let newValue = value;\n\n if (index !== lastIndex) {\n const objValue = object[key];\n newValue =\n isObject(objValue) || Array.isArray(objValue)\n ? objValue\n : !isNaN(+tempPath[index + 1])\n ? []\n : {};\n }\n object[key] = newValue;\n object = object[key];\n }\n return object;\n}\n","import { FieldRefs, InternalFieldName } from '../types';\nimport { get } from '../utils';\nimport isObject from '../utils/isObject';\nimport isUndefined from '../utils/isUndefined';\n\nconst focusFieldBy = (\n fields: FieldRefs,\n callback: (name: string) => boolean,\n fieldsNames?: Set<InternalFieldName> | InternalFieldName[],\n) => {\n for (const key of fieldsNames || Object.keys(fields)) {\n const field = get(fields, key);\n\n if (field) {\n const { _f, ...currentField } = field;\n\n if (_f && callback(_f.name)) {\n if (_f.ref.focus && isUndefined(_f.ref.focus())) {\n break;\n } else if (_f.refs) {\n _f.refs[0].focus();\n break;\n }\n } else if (isObject(currentField)) {\n focusFieldBy(currentField, callback);\n }\n }\n }\n};\n\nexport default focusFieldBy;\n","export default () => {\n const d =\n typeof performance === 'undefined' ? Date.now() : performance.now() * 1000;\n\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16 + d) % 16 | 0;\n\n return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);\n });\n};\n","import { FieldArrayMethodProps, InternalFieldName } from '../types';\nimport isUndefined from '../utils/isUndefined';\n\nexport default (\n name: InternalFieldName,\n index: number,\n options: FieldArrayMethodProps = {},\n): string =>\n options.shouldFocus || isUndefined(options.shouldFocus)\n ? options.focusName ||\n `${name}.${isUndefined(options.focusIndex) ? index : options.focusIndex}.`\n : '';\n","import { InternalFieldName, Names } from '../types';\n\nexport default (\n name: InternalFieldName,\n _names: Names,\n isBlurEvent?: boolean,\n) =>\n !isBlurEvent &&\n (_names.watchAll ||\n _names.watch.has(name) ||\n [..._names.watch].some(\n (watchName) =>\n name.startsWith(watchName) &&\n /^\\.\\w+/.test(name.slice(watchName.length)),\n ));\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function append<T>(data: T[], value: T | T[]): T[] {\n return [...data, ...convertToArrayPayload(value)];\n}\n","export default typeof window !== 'undefined' &&\n typeof window.HTMLElement !== 'undefined' &&\n typeof document !== 'undefined';\n","import isFunction from './isFunction';\nimport isObject from './isObject';\nimport isWeb from './isWeb';\n\nexport default function cloneObject<T>(data: T): T {\n let copy: any;\n const isArray = Array.isArray(data);\n\n if (data instanceof Date) {\n copy = new Date(data);\n } else if (data instanceof Set) {\n copy = new Set(data);\n } else if (\n !(isWeb && (data instanceof Blob || data instanceof FileList)) &&\n (isArray || isObject(data))\n ) {\n copy = isArray ? [] : {};\n for (const key in data) {\n if (isFunction(data[key])) {\n copy = data;\n break;\n }\n copy[key] = cloneObject(data[key]);\n }\n } else {\n return data;\n }\n\n return copy;\n}\n","export default <T>(value: T | T[]): undefined[] | undefined =>\n Array.isArray(value) ? value.map(() => undefined) : undefined;\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function insert<T>(data: T[], index: number): (T | undefined)[];\nexport default function insert<T>(\n data: T[],\n index: number,\n value: T | T[],\n): T[];\nexport default function insert<T>(\n data: T[],\n index: number,\n value?: T | T[],\n): (T | undefined)[] {\n return [\n ...data.slice(0, index),\n ...convertToArrayPayload(value),\n ...data.slice(index),\n ];\n}\n","import isUndefined from './isUndefined';\n\nexport default <T>(\n data: (T | undefined)[],\n from: number,\n to: number,\n): (T | undefined)[] => {\n if (!Array.isArray(data)) {\n return [];\n }\n\n if (isUndefined(data[to])) {\n data[to] = undefined;\n }\n data.splice(to, 0, data.splice(from, 1)[0]);\n\n return data;\n};\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function prepend<T>(data: T[], value: T | T[]): T[] {\n return [...convertToArrayPayload(value), ...convertToArrayPayload(data)];\n}\n","import compact from './compact';\nimport convertToArrayPayload from './convertToArrayPayload';\nimport isUndefined from './isUndefined';\n\nfunction removeAtIndexes<T>(data: T[], indexes: number[]): T[] {\n let i = 0;\n const temp = [...data];\n\n for (const index of indexes) {\n temp.splice(index - i, 1);\n i++;\n }\n\n return compact(temp).length ? temp : [];\n}\n\nexport default <T>(data: T[], index?: number | number[]): T[] =>\n isUndefined(index)\n ? []\n : removeAtIndexes(\n data,\n (convertToArrayPayload(index) as number[]).sort((a, b) => a - b),\n );\n","export default <T>(data: T[], indexA: number, indexB: number): void => {\n data[indexA] = [data[indexB], (data[indexB] = data[indexA])][0];\n};\n","import isEmptyObject from './isEmptyObject';\nimport isKey from './isKey';\nimport isObject from './isObject';\nimport isUndefined from './isUndefined';\nimport stringToPath from './stringToPath';\n\nfunction baseGet(object: any, updatePath: (string | number)[]) {\n const length = updatePath.slice(0, -1).length;\n let index = 0;\n\n while (index < length) {\n object = isUndefined(object) ? index++ : object[updatePath[index++]];\n }\n\n return object;\n}\n\nexport default function unset(object: any, path: string) {\n const updatePath = isKey(path) ? [path] : stringToPath(path);\n const childObject =\n updatePath.length == 1 ? object : baseGet(object, updatePath);\n const key = updatePath[updatePath.length - 1];\n let previousObjRef;\n\n if (childObject) {\n delete childObject[key];\n }\n\n for (let k = 0; k < updatePath.slice(0, -1).length; k++) {\n let index = -1;\n let objectRef;\n const currentPaths = updatePath.slice(0, -(k + 1));\n const currentPathsLength = currentPaths.length - 1;\n\n if (k > 0) {\n previousObjRef = object;\n }\n\n while (++index < currentPaths.length) {\n const item = currentPaths[index];\n objectRef = objectRef ? objectRef[item] : object[item];\n\n if (\n currentPathsLength === index &&\n ((isObject(objectRef) && isEmptyObject(objectRef)) ||\n (Array.isArray(objectRef) &&\n !objectRef.filter((data) => !isUndefined(data)).length))\n ) {\n previousObjRef ? delete previousObjRef[item] : delete object[item];\n }\n\n previousObjRef = objectRef;\n }\n }\n\n return object;\n}\n","export default <T>(fieldValues: T[], index: number, value: T) => {\n fieldValues[index] = value;\n return fieldValues;\n};\n","import { Noop } from '../types';\n\nexport type Observer<T> = {\n next: (value: T) => void;\n};\n\nexport type Subscription = {\n unsubscribe: Noop;\n};\n\nexport type Subject<T> = {\n readonly observers: Observer<T>[];\n subscribe: (value: Observer<T>) => Subscription;\n unsubscribe: Noop;\n} & Observer<T>;\n\nexport default function createSubject<T>(): Subject<T> {\n let _observers: Observer<T>[] = [];\n\n const next = (value: T) => {\n for (const observer of _observers) {\n observer.next(value);\n }\n };\n\n const subscribe = (observer: Observer<T>): Subscription => {\n _observers.push(observer);\n return {\n unsubscribe: () => {\n _observers = _observers.filter((o) => o !== observer);\n },\n };\n };\n\n const unsubscribe = () => {\n _observers = [];\n };\n\n return {\n get observers() {\n return _observers;\n },\n next,\n subscribe,\n unsubscribe,\n };\n}\n","import { Primitive } from '../types';\n\nimport isNullOrUndefined from './isNullOrUndefined';\nimport { isObjectType } from './isObject';\n\nexport default (value: unknown): value is Primitive =>\n isNullOrUndefined(value) || !isObjectType(value);\n","import isObject from '../utils/isObject';\n\nimport isDateObject from './isDateObject';\nimport isPrimitive from './isPrimitive';\n\nexport default function deepEqual(object1: any, object2: any) {\n if (isPrimitive(object1) || isPrimitive(object2)) {\n return object1 === object2;\n }\n\n if (isDateObject(object1) && isDateObject(object2)) {\n return object1.getTime() === object2.getTime();\n }\n\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n for (const key of keys1) {\n const val1 = object1[key];\n\n if (!keys2.includes(key)) {\n return false;\n }\n\n if (key !== 'ref') {\n const val2 = object2[key];\n\n if (\n (isDateObject(val1) && isDateObject(val2)) ||\n (isObject(val1) && isObject(val2)) ||\n (Array.isArray(val1) && Array.isArray(val2))\n ? !deepEqual(val1, val2)\n : val1 !== val2\n ) {\n return false;\n }\n }\n }\n\n return true;\n}\n","import { VALIDATION_MODE } from '../constants';\nimport { Mode } from '../types';\n\nexport default (\n mode?: Mode,\n): {\n isOnSubmit: boolean;\n isOnBlur: boolean;\n isOnChange: boolean;\n isOnAll: boolean;\n isOnTouch: boolean;\n} => ({\n isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,\n isOnBlur: mode === VALIDATION_MODE.onBlur,\n isOnChange: mode === VALIDATION_MODE.onChange,\n isOnAll: mode === VALIDATION_MODE.all,\n isOnTouch: mode === VALIDATION_MODE.onTouched,\n});\n","export default (value: unknown): value is boolean => typeof value === 'boolean';\n","import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLInputElement =>\n element.type === 'file';\n","export default (value: unknown): value is HTMLElement => {\n const owner = value ? ((value as HTMLElement).ownerDocument as Document) : 0;\n const ElementClass =\n owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement;\n return value instanceof ElementClass;\n};\n","import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLSelectElement =>\n element.type === `select-multiple`;\n","import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLInputElement =>\n element.type === 'radio';\n","import { Ref } from '../types';\n\nimport isHTMLElement from './isHTMLElement';\n\nexport default (ref: Ref) => isHTMLElement(ref) && ref.isConnected;\n","import deepEqual from '../utils/deepEqual';\nimport isNullOrUndefined from '../utils/isNullOrUndefined';\nimport isObject from '../utils/isObject';\nimport isPrimitive from '../utils/isPrimitive';\nimport isUndefined from '../utils/isUndefined';\nimport objectHasFunction from '../utils/objectHasFunction';\n\nfunction markFieldsDirty<U>(data: U, fields: Record<string, any> = {}) {\n const isParentNodeArray = Array.isArray(data);\n\n if (isObject(data) || isParentNodeArray) {\n for (const key in data) {\n if (\n Array.isArray(data[key]) ||\n (isObject(data[key]) && !objectHasFunction(data[key]))\n ) {\n fields[key] = Array.isArray(data[key]) ? [] : {};\n markFieldsDirty(data[key], fields[key]);\n } else if (!isNullOrUndefined(data[key])) {\n fields[key] = true;\n }\n }\n }\n\n return fields;\n}\n\nfunction getDirtyFieldsFromDefaultValues<T>(\n data: T,\n formValues: T,\n dirtyFieldsFromValues: any,\n) {\n const isParentNodeArray = Array.isArray(data);\n\n if (isObject(data) || isParentNodeArray) {\n for (const key in data) {\n if (\n Array.isArray(data[key]) ||\n (isObject(data[key]) && !objectHasFunction(data[key]))\n ) {\n if (\n isUndefined(formValues) ||\n isPrimitive(dirtyFieldsFromValues[key])\n ) {\n dirtyFieldsFromValues[key] = Array.isArray(data[key])\n ? markFieldsDirty(data[key], [])\n : { ...markFieldsDirty(data[key]) };\n } else {\n getDirtyFieldsFromDefaultValues(\n data[key],\n isNullOrUndefined(formValues) ? {} : formValues[key],\n dirtyFieldsFromValues[key],\n );\n }\n } else {\n dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);\n }\n }\n }\n\n return dirtyFieldsFromValues;\n}\n\nexport default <T>(defaultValues: T, formValues: T) =>\n getDirtyFieldsFromDefaultValues(\n defaultValues,\n formValues,\n markFieldsDirty(formValues),\n );\n","import isUndefined from '../utils/isUndefined';\n\ntype CheckboxFieldResult = {\n isValid: boolean;\n value: string | string[] | boolean | undefined;\n};\n\nconst defaultResult: CheckboxFieldResult = {\n value: false,\n isValid: false,\n};\n\nconst validResult = { value: true, isValid: true };\n\nexport default (options?: HTMLInputElement[]): CheckboxFieldResult => {\n if (Array.isArray(options)) {\n if (options.length > 1) {\n const values = options\n .filter((option) => option && option.checked && !option.disabled)\n .map((option) => option.value);\n return { value: values, isValid: !!values.length };\n }\n\n return options[0].checked && !options[0].disabled\n ? // @ts-expect-error expected to work in the browser\n options[0].attributes && !isUndefined(options[0].attributes.value)\n ? isUndefined(options[0].value) || options[0].value === ''\n ? validResult\n : { value: options[0].value, isValid: true }\n : validResult\n : defaultResult;\n }\n\n return defaultResult;\n};\n","import { Field, NativeFieldValue } from '../types';\nimport isNullOrUndefined from '../utils/isNullOrUndefined';\nimport isString from '../utils/isString';\nimport isUndefined from '../utils/isUndefined';\n\nexport default <T extends NativeFieldValue>(\n value: T,\n { valueAsNumber, valueAsDate, setValueAs }: Field['_f'],\n) =>\n isUndefined(value)\n ? value\n : valueAsNumber\n ? value === '' || isNullOrUndefined(value)\n ? NaN\n : +value\n : valueAsDate && isString(value)\n ? new Date(value)\n : setValueAs\n ? setValueAs(value)\n : value;\n","type RadioFieldResult = {\n isValid: boolean;\n value: number | string | null;\n};\n\nconst defaultReturn: RadioFieldResult = {\n isValid: false,\n value: null,\n};\n\nexport default (options?: HTMLInputElement[]): RadioFieldResult =>\n Array.isArray(options)\n ? options.reduce(\n (previous, option): RadioFieldResult =>\n option && option.checked && !option.disabled\n ? {\n isValid: true,\n value: option.value,\n }\n : previous,\n defaultReturn,\n )\n : defaultReturn;\n","import { Field } from '../types';\nimport isCheckBox from '../utils/isCheckBoxInput';\nimport isFileInput from '../utils/isFileInput';\nimport isMultipleSelect from '../utils/isMultipleSelect';\nimport isRadioInput from '../utils/isRadioInput';\nimport isUndefined from '../utils/isUndefined';\n\nimport getCheckboxValue from './getCheckboxValue';\nimport getFieldValueAs from './getFieldValueAs';\nimport getRadioValue from './getRadioValue';\n\nexport default function getFieldValue(_f: Field['_f']) {\n const ref = _f.ref;\n\n if (_f.refs ? _f.refs.every((ref) => ref.disabled) : ref.disabled) {\n return;\n }\n\n if (isFileInput(ref)) {\n return ref.files;\n }\n\n if (isRadioInput(ref)) {\n return getRadioValue(_f.refs).value;\n }\n\n if (isMultipleSelect(ref)) {\n return [...ref.selectedOptions].map(({ value }) => value);\n }\n\n if (isCheckBox(ref)) {\n return getCheckboxValue(_f.refs).value;\n }\n\n return getFieldValueAs(isUndefined(ref.value) ? _f.ref.value : ref.value, _f);\n}\n","import {\n CriteriaMode,\n Field,\n FieldName,\n FieldRefs,\n FieldValues,\n InternalFieldName,\n} from '../types';\nimport { get } from '../utils';\nimport set from '../utils/set';\n\nexport default <TFieldValues extends FieldValues>(\n fieldsNames: Set<InternalFieldName> | InternalFieldName[],\n _fields: FieldRefs,\n criteriaMode?: CriteriaMode,\n shouldUseNativeValidation?: boolean | undefined,\n) => {\n const fields: Record<InternalFieldName, Field['_f']> = {};\n\n for (const name of fieldsNames) {\n const field: Field = get(_fields, name);\n\n field && set(fields, name, field._f);\n }\n\n return {\n criteriaMode,\n names: [...fieldsNames] as FieldName<TFieldValues>[],\n fields,\n shouldUseNativeValidation,\n };\n};\n","export default (value: unknown): value is RegExp => value instanceof RegExp;\n","import {\n ValidationRule,\n ValidationValue,\n ValidationValueMessage,\n} from '../types';\nimport isObject from '../utils/isObject';\nimport isRegex from '../utils/isRegex';\nimport isUndefined from '../utils/isUndefined';\n\nexport default <T extends ValidationValue>(\n rule?: ValidationRule<T> | ValidationValueMessage<T>,\n) =>\n isUndefined(rule)\n ? undefined\n : isRegex(rule)\n ? rule.source\n : isObject(rule)\n ? isRegex(rule.value)\n ? rule.value.source\n : rule.value\n : rule;\n","import { FieldError, FieldErrors, FieldValues } from '../types';\nimport get from '../utils/get';\nimport isKey from '../utils/isKey';\n\nexport default function schemaErrorLookup<T extends FieldValues = FieldValues>(\n errors: FieldErrors<T>,\n _fields: FieldValues,\n name: string,\n): {\n error?: FieldError;\n name: string;\n} {\n const error = get(errors, name);\n\n if (error || isKey(name)) {\n return {\n error,\n name,\n };\n }\n\n const names = name.split('.');\n\n while (names.length) {\n const fieldName = names.join('.');\n const field = get(_fields, fieldName);\n const foundError = get(errors, fieldName);\n\n if (field && !Array.isArray(field) && name !== fieldName) {\n return { name };\n }\n\n if (foundError && foundError.type) {\n return {\n name: fieldName,\n error: foundError,\n };\n }\n\n names.pop();\n }\n\n return {\n name,\n };\n}\n","export default (\n isBlurEvent: boolean,\n isTouched: boolean,\n isSubmitted: boolean,\n reValidateMode: {\n isOnBlur: boolean;\n isOnChange: boolean;\n },\n mode: Partial<{\n isOnSubmit: boolean;\n isOnBlur: boolean;\n isOnChange: boolean;\n isOnTouch: boolean;\n isOnAll: boolean;\n }>,\n) => {\n if (mode.isOnAll) {\n return false;\n } else if (!isSubmitted && mode.isOnTouch) {\n return !(isTouched || isBlurEvent);\n } else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) {\n return !isBlurEvent;\n } else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) {\n return isBlurEvent;\n }\n return true;\n};\n","import React from 'react';\n\nimport { Message } from '../types';\nimport isString from '../utils/isString';\n\nexport default (value: unknown): value is Message =>\n isString(value) || React.isValidElement(value as JSX.Element);\n","import { FieldError, Ref, ValidateResult } from '../types';\nimport isBoolean from '../utils/isBoolean';\nimport isMessage from '../utils/isMessage';\n\nexport default function getValidateError(\n result: ValidateResult,\n ref: Ref,\n type = 'validate',\n): FieldError | void {\n if (\n isMessage(result) ||\n (Array.isArray(result) && result.every(isMessage)) ||\n (isBoolean(result) && !result)\n ) {\n return {\n type,\n message: isMessage(result) ? result : '',\n ref,\n };\n }\n}\n","import { ValidationRule } from '../types';\nimport isObject from '../utils/isObject';\nimport isRegex from '../utils/isRegex';\n\nexport default (validationData?: ValidationRule) =>\n isObject(validationData) && !isRegex(validationData)\n ? validationData\n : {\n value: validationData,\n message: '',\n };\n","import { INPUT_VALIDATION_RULES } from '../constants';\nimport {\n Field,\n FieldError,\n InternalFieldErrors,\n Message,\n NativeFieldValue,\n} from '../types';\nimport isBoolean from '../utils/isBoolean';\nimport isCheckBoxInput from '../utils/isCheckBoxInput';\nimport isEmptyObject from '../utils/isEmptyObject';\nimport isFileInput from '../utils/isFileInput';\nimport isFunction from '../utils/isFunction';\nimport isMessage from '../utils/isMessage';\nimport isNullOrUndefined from '../utils/isNullOrUndefined';\nimport isObject from '../utils/isObject';\nimport isRadioInput from '../utils/isRadioInput';\nimport isRegex from '../utils/isRegex';\nimport isString from '../utils/isString';\n\nimport appendErrors from './appendErrors';\nimport getCheckboxValue from './getCheckboxValue';\nimport getRadioValue from './getRadioValue';\nimport getValidateError from './getValidateError';\nimport getValueAndMessage from './getValueAndMessage';\n\nexport default async <T extends NativeFieldValue>(\n field: Field,\n inputValue: T,\n validateAllFieldCriteria: boolean,\n shouldUseNativeValidation?: boolean,\n): Promise<InternalFieldErrors> => {\n const {\n ref,\n refs,\n required,\n maxLength,\n minLength,\n min,\n max,\n pattern,\n validate,\n name,\n valueAsNumber,\n mount,\n disabled,\n } = field._f;\n if (!mount || disabled) {\n return {};\n }\n const inputRef: HTMLInputElement = refs ? refs[0] : (ref as HTMLInputElement);\n const setCustomValidity = (message?: string | boolean) => {\n if (shouldUseNativeValidation && inputRef.reportValidity) {\n inputRef.setCustomValidity(isBoolean(message) ? '' : message || ' ');\n inputRef.reportValidity();\n }\n };\n const error: InternalFieldErrors = {};\n const isRadio = isRadioInput(ref);\n const isCheckBox = isCheckBoxInput(ref);\n const isRadioOrCheckbox = isRadio || isCheckBox;\n const isEmpty =\n ((valueAsNumber || isFileInput(ref)) && !ref.value) ||\n inputValue === '' ||\n (Array.isArray(inputValue) && !inputValue.length);\n const appendErrorsCurry = appendErrors.bind(\n null,\n name,\n validateAllFieldCriteria,\n error,\n );\n const getMinMaxMessage = (\n exceedMax: boolean,\n maxLengthMessage: Message,\n minLengthMessage: Message,\n maxType = INPUT_VALIDATION_RULES.maxLength,\n minType = INPUT_VALIDATION_RULES.minLength,\n ) => {\n const message = exceedMax ? maxLengthMessage : minLengthMessage;\n error[name] = {\n type: exceedMax ? maxType : minType,\n message,\n ref,\n ...appendErrorsCurry(exceedMax ? maxType : minType, message),\n };\n };\n\n if (\n required &&\n ((!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue))) ||\n (isBoolean(inputValue) && !inputValue) ||\n (isCheckBox && !getCheckboxValue(refs).isValid) ||\n (isRadio && !getRadioValue(refs).isValid))\n ) {\n const { value, message } = isMessage(required)\n ? { value: !!required, message: required }\n : getValueAndMessage(required);\n\n if (value) {\n error[name] = {\n type: INPUT_VALIDATION_RULES.required,\n message,\n ref: inputRef,\n ...appendErrorsCurry(INPUT_VALIDATION_RULES.required, message),\n };\n if (!validateAllFieldCriteria) {\n setCustomValidity(message);\n return error;\n }\n }\n }\n\n if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {\n let exceedMax;\n let exceedMin;\n const maxOutput = getValueAndMessage(max);\n const minOutput = getValueAndMessage(min);\n\n if (!isNullOrUndefined(inputValue) && !isNaN(inputValue as number)) {\n const valueNumber =\n (ref as HTMLInputElement).valueAsNumber || +inputValue;\n if (!isNullOrUndefined(maxOutput.value)) {\n exceedMax = valueNumber > maxOutput.value;\n }\n if (!isNullOrUndefined(minOutput.value)) {\n exceedMin = valueNumber < minOutput.value;\n }\n } else {\n const valueDate =\n (ref as HTMLInputElement).valueAsDate || new Date(inputValue as string);\n if (isString(maxOutput.value)) {\n exceedMax = valueDate > new Date(maxOutput.value);\n }\n if (isString(minOutput.value)) {\n exceedMin = valueDate < new Date(minOutput.value);\n }\n }\n\n if (exceedMax || exceedMin) {\n getMinMaxMessage(\n !!exceedMax,\n maxOutput.message,\n minOutput.message,\n INPUT_VALIDATION_RULES.max,\n INPUT_VALIDATION_RULES.min,\n );\n if (!validateAllFieldCriteria) {\n setCustomValidity(error[name]!.message);\n return error;\n }\n }\n }\n\n if ((maxLength || minLength) && !isEmpty && isString(inputValue)) {\n const maxLengthOutput = getValueAndMessage(maxLength);\n const minLengthOutput = getValueAndMessage(minLength);\n const exceedMax =\n !isNullOrUndefined(maxLengthOutput.value) &&\n inputValue.length > maxLengthOutput.value;\n const exceedMin =\n !isNullOrUndefined(minLengthOutput.value) &&\n inputValue.length < minLengthOutput.value;\n\n if (exceedMax || exceedMin) {\n getMinMaxMessage(\n exceedMax,\n maxLengthOutput.message,\n minLengthOutput.message,\n );\n if (!validateAllFieldCriteria) {\n setCustomValidity(error[name]!.message);\n return error;\n }\n }\n }\n\n if (pattern && !isEmpty && isString(inputValue)) {\n const { value: patternValue, message } = getValueAndMessage(pattern);\n\n if (isRegex(patternValue) && !inputValue.match(patternValue)) {\n error[name] = {\n type: INPUT_VALIDATION_RULES.pattern,\n message,\n ref,\n ...appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message),\n };\n if (!validateAllFieldCriteria) {\n setCustomValidity(message);\n return error;\n }\n }\n }\n\n if (validate) {\n if (isFunction(validate)) {\n const result = await validate(inputValue);\n const validateError = getValidateError(result, inputRef);\n\n if (validateError) {\n error[name] = {\n ...validateError,\n ...appendErrorsCurry(\n INPUT_VALIDATION_RULES.validate,\n validateError.message,\n ),\n };\n if (!validateAllFieldCriteria) {\n setCustomValidity(validateError.message);\n return error;\n }\n }\n } else if (isObject(validate)) {\n let validationResult = {} as FieldError;\n\n for (const key in validate) {\n if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {\n break;\n }\n\n const validateError = getValidateError(\n await validate[key](inputValue),\n inputRef,\n key,\n );\n\n if (validateError) {\n validationResult = {\n ...validateError,\n ...appendErrorsCurry(key, validateError.message),\n };\n\n setCustomValidity(validateError.message);\n\n if (validateAllFieldCriteria) {\n error[name] = validationResult;\n }\n }\n }\n\n if (!isEmptyObject(validationResult)) {\n error[name] = {\n ref: inputRef,\n ...validationResult,\n };\n if (!validateAllFieldCriteria) {\n return error;\n }\n }\n }\n }\n\n setCustomValidity(true);\n return error;\n};\n","import { EVENTS, VALIDATION_MODE } from '../constants';\nimport {\n BatchFieldArrayUpdate,\n ChangeHandler,\n DeepPartial,\n DelayCallback,\n EventType,\n Field,\n FieldError,\n FieldErrors,\n FieldNamesMarkedBoolean,\n FieldPath,\n FieldRefs,\n FieldValues,\n FormState,\n GetIsDirty,\n InternalFieldName,\n Names,\n Path,\n Ref,\n ResolverResult,\n SetFieldValue,\n SetValueConfig,\n Subjects,\n UseFormClearErrors,\n UseFormGetFieldState,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormProps,\n UseFormRegister,\n UseFormReset,\n UseFormResetField,\n UseFormReturn,\n UseFormSetError,\n UseFormSetFocus,\n UseFormSetValue,\n UseFormTrigger,\n UseFormUnregister,\n UseFormWatch,\n WatchInternal,\n WatchObserver,\n} from '../types';\nimport cloneObject from '../utils/cloneObject';\nimport compact from '../utils/compact';\nimport convertToArrayPayload from '../utils/convertToArrayPayload';\nimport createSubject from '../utils/createSubject';\nimport deepEqual from '../utils/deepEqual';\nimport get from '../utils/get';\nimport getValidationModes from '../utils/getValidationModes';\nimport isBoolean from '../utils/isBoolean';\nimport isCheckBoxInput from '../utils/isCheckBoxInput';\nimport isDateObject from '../utils/isDateObject';\nimport isEmptyObject from '../utils/isEmptyObject';\nimport isFileInput from '../utils/isFileInput';\nimport isFunction from '../utils/isFunction';\nimport isHTMLElement from '../utils/isHTMLElement';\nimport isMultipleSelect from '../utils/isMultipleSelect';\nimport isNullOrUndefined from '../utils/isNullOrUndefined';\nimport isPrimitive from '../utils/isPrimitive';\nimport isRadioOrCheckbox from '../utils/isRadioOrCheckbox';\nimport isString from '../utils/isString';\nimport isUndefined from '../utils/isUndefined';\nimport isWeb from '../utils/isWeb';\nimport live from '../utils/live';\nimport set from '../utils/set';\nimport unset from '../utils/unset';\n\nimport focusFieldBy from './focusFieldBy';\nimport generateWatchOutput from './generateWatchOutput';\nimport getDirtyFields from './getDirtyFields';\nimport getEventValue from './getEventValue';\nimport getFieldValue from './getFieldValue';\nimport getFieldValueAs from './getFieldValueAs';\nimport getResolverOptions from './getResolverOptions';\nimport getRuleValue from './getRuleValue';\nimport hasValidation from './hasValidation';\nimport isNameInFieldArray from './isNameInFieldArray';\nimport isWatched from './isWatched';\nimport schemaErrorLookup from './schemaErrorLookup';\nimport skipValidation from './skipValidation';\nimport unsetEmptyArray from './unsetEmptyArray';\nimport validateField from './validateField';\n\nconst defaultOptions = {\n mode: VALIDATION_MODE.onSubmit,\n reValidateMode: VALIDATION_MODE.onChange,\n shouldFocusError: true,\n} as const;\n\nexport function createFormControl<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n>(\n props: UseFormProps<TFieldValues, TContext> = {},\n): Omit<UseFormReturn<TFieldValues, TContext>, 'formState'> {\n let _options = {\n ...defaultOptions,\n ...props,\n };\n let _formState: FormState<TFieldValues> = {\n isDirty: false,\n isValidating: false,\n dirtyFields: {} as FieldNamesMarkedBoolean<TFieldValues>,\n isSubmitted: false,\n submitCount: 0,\n touchedFields: {} as FieldNamesMarkedBoolean<TFieldValues>,\n isSubmitting: false,\n isSubmitSuccessful: false,\n isValid: false,\n errors: {} as FieldErrors<TFieldValues>,\n };\n let _fields = {};\n let _defaultValues = cloneObject(_options.defaultValues) || {};\n let _formValues = _options.shouldUnregister\n ? {}\n : cloneObject(_defaultValues);\n let _stateFlags = {\n action: false,\n mount: false,\n watch: false,\n };\n let _names: Names = {\n mount: new Set(),\n unMount: new Set(),\n array: new Set(),\n watch: new Set(),\n } as Names;\n let delayErrorCallback: DelayCallback | null;\n let timer = 0;\n let validateFields: Record<InternalFieldName, number> = {};\n const _proxyFormState = {\n isDirty: false,\n dirtyFields: false,\n touchedFields: false,\n isValidating: false,\n isValid: false,\n errors: false,\n };\n const _subjects: Subjects<TFieldValues> = {\n watch: createSubject(),\n array: createSubject(),\n state: createSubject(),\n };\n\n const validationModeBeforeSubmit = getValidationModes(_options.mode);\n const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);\n const shouldDisplayAllAssociatedErrors =\n _options.criteriaMode === VALIDATION_MODE.all;\n\n const debounce =\n <T extends Function>(callback: T) =>\n (wait: number) => {\n clearTimeout(timer);\n timer = window.setTimeout(callback, wait);\n };\n\n const _updateValid = async (shouldSkipRender?: boolean) => {\n let isValid = false;\n\n if (_proxyFormState.isValid) {\n isValid = _options.resolver\n ? isEmptyObject((await _executeSchema()).errors)\n : await executeBuildInValidation(_fields, true);\n\n if (!shouldSkipRender && isValid !== _formState.isValid) {\n _formState.isValid = isValid;\n _subjects.state.next({\n isValid,\n });\n }\n }\n\n return isValid;\n };\n\n const _updateFieldArray: BatchFieldArrayUpdate = (\n name,\n values = [],\n method,\n args,\n shouldSetValues = true,\n shouldUpdateFieldsAndState = true,\n ) => {\n if (args && method) {\n _stateFlags.action = true;\n if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {\n const fieldValues = method(get(_fields, name), args.argA, args.argB);\n shouldSetValues && set(_fields, name, fieldValues);\n }\n\n if (\n _proxyFormState.errors &&\n shouldUpdateFieldsAndState &&\n Array.isArray(get(_formState.errors, name))\n ) {\n const errors = method(\n get(_formState.errors, name),\n args.argA,\n args.argB,\n );\n shouldSetValues && set(_formState.errors, name, errors);\n unsetEmptyArray(_formState.errors, name);\n }\n\n if (\n _proxyFormState.touchedFields &&\n shouldUpdateFieldsAndState &&\n Array.isArray(get(_formState.touchedFields, name))\n ) {\n const touchedFields = method(\n get(_formState.touchedFields, name),\n args.argA,\n args.argB,\n );\n shouldSetValues && set(_formState.touchedFields, name, touchedFields);\n }\n\n if (_proxyFormState.dirtyFields) {\n _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\n }\n\n _subjects.state.next({\n isDirty: _getDirty(name, values),\n dirtyFields: _formState.dirtyFields,\n errors: _formState.errors,\n isValid: _formState.isValid,\n });\n } else {\n set(_formValues, name, values);\n }\n };\n\n const updateErrors = (name: InternalFieldName, error: FieldError) => {\n set(_formState.errors, name, error);\n _subjects.state.next({\n errors: _formState.errors,\n });\n };\n\n const updateValidAndValue = (\n name: InternalFieldName,\n shouldSkipSetValueAs: boolean,\n value?: unknown,\n ref?: Ref,\n ) => {\n const field: Field = get(_fields, name);\n\n if (field) {\n const defaultValue = get(\n _formValues,\n name,\n isUndefined(value) ? get(_defaultValues, name) : value,\n );\n\n isUndefined(defaultValue) ||\n (ref && (ref as HTMLInputElement).defaultChecked) ||\n shouldSkipSetValueAs\n ? set(\n _formValues,\n name,\n shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f),\n )\n : setFieldValue(name, defaultValue);\n\n _stateFlags.mount && _updateValid();\n }\n };\n\n const updateTouchAndDirty = (\n name: InternalFieldName,\n fieldValue: unknown,\n isBlurEvent?: boolean,\n shouldDirty?: boolean,\n shouldRender?: boolean,\n ): Partial<\n Pick<FormState<TFieldValues>, 'dirtyFields' | 'isDirty' | 'touchedFields'>\n > => {\n let isFieldDirty = false;\n const output: Partial<FormState<TFieldValues>> & { name: string } = {\n name,\n };\n const isPreviousFieldTouched = get(_formState.touchedFields, name);\n\n if (_proxyFormState.isDirty) {\n const isPreviousFormDirty = _formState.isDirty;\n\n _formState.isDirty = output.isDirty = _getDirty();\n isFieldDirty = isPreviousFormDirty !== output.isDirty;\n }\n\n if (_proxyFormState.dirtyFields && (!isBlurEvent || shouldDirty)) {\n const isPreviousFieldDirty = get(_formState.dirtyFields, name);\n const isCurrentFieldPristine = deepEqual(\n get(_defaultValues, name),\n fieldValue,\n );\n\n isCurrentFieldPristine\n ? unset(_formState.dirtyFields, name)\n : set(_formState.dirtyFields as TFieldValues, name, true);\n output.dirtyFields = _formState.dirtyFields;\n isFieldDirty =\n isFieldDirty ||\n isPreviousFieldDirty !== get(_formState.dirtyFields, name);\n }\n\n if (isBlurEvent && !isPreviousFieldTouched) {\n set(_formState.touchedFields as TFieldValues, name, isBlurEvent);\n output.touchedFields = _formState.touchedFields;\n isFieldDirty =\n isFieldDirty ||\n (_proxyFormState.touchedFields &&\n isPreviousFieldTouched !== isBlurEvent);\n }\n\n isFieldDirty && shouldRender && _subjects.state.next(output);\n\n return isFieldDirty ? output : {};\n };\n\n const shouldRenderByError = async (\n name: InternalFieldName,\n isValid: boolean,\n error?: FieldError,\n fieldState?: {\n dirty?: FieldNamesMarkedBoolean<TFieldValues>;\n isDirty?: boolean;\n touched?: FieldNamesMarkedBoolean<TFieldValues>;\n },\n ): Promise<void> => {\n const previousFieldError = get(_formState.errors, name);\n const shouldUpdateValid =\n _proxyFormState.isValid && _formState.isValid !== isValid;\n\n if (props.delayError && error) {\n delayErrorCallback = debounce(() => updateErrors(name, error));\n delayErrorCallback(props.delayError);\n } else {\n clearTimeout(timer);\n delayErrorCallback = null;\n error\n ? set(_formState.errors, name, error)\n : unset(_formState.errors, name);\n }\n\n if (\n (error ? !deepEqual(previousFieldError, error) : previousFieldError) ||\n !isEmptyObject(fieldState) ||\n shouldUpdateValid\n ) {\n const updatedFormState = {\n ...fieldState,\n ...(shouldUpdateValid ? { isValid } : {}),\n errors: _formState.errors,\n name,\n };\n\n _formState = {\n ..._formState,\n ...updatedFormState,\n };\n\n _subjects.state.next(updatedFormState);\n }\n\n validateFields[name]--;\n\n if (\n _proxyFormState.isValidating &&\n !Object.values(validateFields).some((v) => v)\n ) {\n _subjects.state.next({\n isValidating: false,\n });\n validateFields = {};\n }\n };\n\n const _executeSchema = async (name?: InternalFieldName[]) =>\n _options.resolver\n ? await _options.resolver(\n { ..._formValues } as TFieldValues,\n _options.context,\n getResolverOptions(\n name || _names.mount,\n _fields,\n _options.criteriaMode,\n _options.shouldUseNativeValidation,\n ),\n )\n : ({} as ResolverResult<TFieldValues>);\n\n const executeSchemaAndUpdateState = async (names?: InternalFieldName[]) => {\n const { errors } = await _executeSchema();\n\n if (names) {\n for (const name of names) {\n const error = get(errors, name);\n error\n ? set(_formState.errors, name, error)\n : unset(_formState.errors, name);\n }\n } else {\n _formState.errors = errors as FieldErrors<TFieldValues>;\n }\n\n return errors;\n };\n\n const executeBuildInValidation = async (\n fields: FieldRefs,\n shouldOnlyCheckValid?: boolean,\n context = {\n valid: true,\n },\n ) => {\n for (const name in fields) {\n const field = fields[name];\n\n if (field) {\n const { _f: fieldReference, ...fieldValue } = field;\n\n if (fieldReference) {\n const fieldError = await validateField(\n field,\n get(_formValues, fieldReference.name),\n shouldDisplayAllAssociatedErrors,\n _options.shouldUseNativeValidation,\n );\n\n if (fieldError[fieldReference.name]) {\n context.valid = false;\n\n if (shouldOnlyCheckValid) {\n break;\n }\n }\n\n if (!shouldOnlyCheckValid) {\n fieldError[fieldReference.name]\n ? set(\n _formState.errors,\n fieldReference.name,\n fieldError[fieldReference.name],\n )\n : unset(_formState.errors, fieldReference.name);\n }\n }\n\n fieldValue &&\n (await executeBuildInValidation(\n fieldValue,\n shouldOnlyCheckValid,\n context,\n ));\n }\n }\n\n return context.valid;\n };\n\n const _removeUnmounted = () => {\n for (const name of _names.unMount) {\n const field: Field = get(_fields, name);\n\n field &&\n (field._f.refs\n ? field._f.refs.every((ref) => !live(ref))\n : !live(field._f.ref)) &&\n unregister(name as FieldPath<TFieldValues>);\n }\n\n _names.unMount = new Set();\n };\n\n const _getDirty: GetIsDirty = (name, data) => (\n name && data && set(_formValues, name, data),\n !deepEqual(getValues(), _defaultValues)\n );\n\n const _getWatch: WatchInternal<TFieldValues> = (\n names,\n defaultValue,\n isGlobal,\n ) => {\n const fieldValues = {\n ...(_stateFlags.mount\n ? _formValues\n : isUndefined(defaultValue)\n ? _defaultValues\n : isString(names)\n ? { [names]: defaultValue }\n : defaultValue),\n };\n\n return generateWatchOutput(names, _names, fieldValues, isGlobal);\n };\n\n const _getFieldArray = <TFieldArrayValues>(\n name: InternalFieldName,\n ): Partial<TFieldArrayValues>[] =>\n compact(\n get(\n _stateFlags.mount ? _formValues : _defaultValues,\n name,\n props.shouldUnregister ? get(_defaultValues, name, []) : [],\n ),\n );\n\n const setFieldValue = (\n name: InternalFieldName,\n value: SetFieldValue<TFieldValues>,\n options: SetValueConfig = {},\n ) => {\n const field: Field = get(_fields, name);\n let fieldValue: unknown = value;\n\n if (field) {\n const fieldReference = field._f;\n\n if (fieldReference) {\n !fieldReference.disabled &&\n set(_formValues, name, getFieldValueAs(value, fieldReference));\n\n fieldValue =\n isWeb && isHTMLElement(fieldReference.ref) && isNullOrUndefined(value)\n ? ''\n : value;\n\n if (isMultipleSelect(fieldReference.ref)) {\n [...fieldReference.ref.options].forEach(\n (selectRef) =>\n (selectRef.selected = (\n fieldValue as InternalFieldName[]\n ).includes(selectRef.value)),\n );\n } else if (fieldReference.refs) {\n if (isCheckBoxInput(fieldReference.ref)) {\n fieldReference.refs.length > 1\n ? fieldReference.refs.forEach(\n (checkboxRef) =>\n !checkboxRef.disabled &&\n (checkboxRef.checked = Array.isArray(fieldValue)\n ? !!(fieldValue as []).find(\n (data: string) => data === checkboxRef.value,\n )\n : fieldValue === checkboxRef.value),\n )\n : fieldReference.refs[0] &&\n (fieldReference.refs[0].checked = !!fieldValue);\n } else {\n fieldReference.refs.forEach(\n (radioRef: HTMLInputElement) =>\n (radioRef.checked = radioRef.value === fieldValue),\n );\n }\n } else if (isFileInput(fieldReference.ref)) {\n fieldReference.ref.value = '';\n } else {\n fieldReference.ref.value = fieldValue;\n\n if (!fieldReference.ref.type) {\n _subjects.watch.next({\n name,\n });\n }\n }\n }\n }\n\n (options.shouldDirty || options.shouldTouch) &&\n updateTouchAndDirty(\n name,\n fieldValue,\n options.shouldTouch,\n options.shouldDirty,\n true,\n );\n\n options.shouldValidate && trigger(name as Path<TFieldValues>);\n };\n\n const setValues = <\n T extends InternalFieldName,\n K extends SetFieldValue<TFieldValues>,\n U extends SetValueConfig,\n >(\n name: T,\n value: K,\n options: U,\n ) => {\n for (const fieldKey in value) {\n const fieldValue = value[fieldKey];\n const fieldName = `${name}.${fieldKey}` as Path<TFieldValues>;\n const field = get(_fields, fieldName);\n\n (_names.array.has(name) ||\n !isPrimitive(fieldValue) ||\n (field && !field._f)) &&\n !isDateObject(fieldValue)\n ? setValues(fieldName, fieldValue, options)\n : setFieldValue(fieldName, fieldValue, options);\n }\n };\n\n const setValue: UseFormSetValue<TFieldValues> = (\n name,\n value,\n options = {},\n ) => {\n const field = get(_fields, name);\n const isFieldArray = _names.array.has(name);\n const cloneValue = cloneObject(value);\n\n set(_formValues, name, cloneValue);\n\n if (isFieldArray) {\n _subjects.array.next({\n name,\n values: _formValues,\n });\n\n if (\n (_proxyFormState.isDirty || _proxyFormState.dirtyFields) &&\n options.shouldDirty\n ) {\n _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\n\n _subjects.state.next({\n name,\n dirtyFields: _formState.dirtyFields,\n isDirty: _getDirty(name, cloneValue),\n });\n }\n } else {\n field && !field._f && !isNullOrUndefined(cloneValue)\n ? setValues(name, cloneValue, options)\n : setFieldValue(name, cloneValue, options);\n }\n\n isWatched(name, _names) && _subjects.state.next({});\n _subjects.watch.next({\n name,\n });\n };\n\n const onChange: ChangeHandler = async (event) => {\n const target = event.target;\n let name = target.name;\n const field: Field = get(_fields, name);\n\n if (field) {\n let error;\n let isValid;\n const fieldValue = target.type\n ? getFieldValue(field._f)\n : getEventValue(event);\n const isBlurEvent =\n event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;\n const shouldSkipValidation =\n (!hasValidation(field._f) &&\n !_options.resolver &&\n !get(_formState.errors, name) &&\n !field._f.deps) ||\n skipValidation(\n isBlurEvent,\n get(_formState.touchedFields, name),\n _formState.isSubmitted,\n validationModeAfterSubmit,\n validationModeBeforeSubmit,\n );\n const watched = isWatched(name, _names, isBlurEvent);\n\n set(_formValues, name, fieldValue);\n\n if (isBlurEvent) {\n field._f.onBlur && field._f.onBlur(event);\n delayErrorCallback && delayErrorCallback(0);\n } else if (field._f.onChange) {\n field._f.onChange(event);\n }\n\n const fieldState = updateTouchAndDirty(\n name,\n fieldValue,\n isBlurEvent,\n false,\n );\n\n const shouldRender = !isEmptyObject(fieldState) || watched;\n\n !isBlurEvent &&\n _subjects.watch.next({\n name,\n type: event.type,\n });\n\n if (shouldSkipValidation) {\n return (\n shouldRender &&\n _subjects.state.next({ name, ...(watched ? {} : fieldState) })\n );\n }\n\n !isBlurEvent && watched && _subjects.state.next({});\n\n validateFields[name] = validateFields[name] ? +1 : 1;\n\n _subjects.state.next({\n isValidating: true,\n });\n\n if (_options.resolver) {\n const { errors } = await _executeSchema([name]);\n const previousErrorLookupResult = schemaErrorLookup(\n _formState.errors,\n _fields,\n name,\n );\n const errorLookupResult = schemaErrorLookup(\n errors,\n _fields,\n previousErrorLookupResult.name || name,\n );\n\n error = errorLookupResult.error;\n name = errorLookupResult.name;\n\n isValid = isEmptyObject(errors);\n } else {\n error = (\n await validateField(\n field,\n get(_formValues, name),\n shouldDisplayAllAssociatedErrors,\n _options.shouldUseNativeValidation,\n )\n )[name];\n\n isValid = await _updateValid(true);\n }\n\n field._f.deps &&\n trigger(\n field._f.deps as FieldPath<TFieldValues> | FieldPath<TFieldValues>[],\n );\n\n shouldRenderByError(name, isValid, error, fieldState);\n }\n };\n\n const trigger: UseFormTrigger<TFieldValues> = async (name, options = {}) => {\n let isValid;\n let validationResult;\n const fieldNames = convertToArrayPayload(name) as InternalFieldName[];\n\n _subjects.state.next({\n isValidating: true,\n });\n\n if (_options.resolver) {\n const errors = await executeSchemaAndUpdateState(\n isUndefined(name) ? name : fieldNames,\n );\n\n isValid = isEmptyObject(errors);\n validationResult = name\n ? !fieldNames.some((name) => get(errors, name))\n : isValid;\n } else if (name) {\n validationResult = (\n await Promise.all(\n fieldNames.map(async (fieldName) => {\n const field = get(_fields, fieldName);\n return await executeBuildInValidation(\n field && field._f ? { [fieldName]: field } : field,\n );\n }),\n )\n ).every(Boolean);\n !(!validationResult && !_formState.isValid) && _updateValid();\n } else {\n validationResult = isValid = await executeBuildInValidation(_fields);\n }\n\n _subjects.state.next({\n ...(!isString(name) ||\n (_proxyFormState.isValid && isValid !== _formState.isValid)\n ? {}\n : { name }),\n ...(_options.resolver ? { isValid } : {}),\n errors: _formState.errors,\n isValidating: false,\n });\n\n options.shouldFocus &&\n !validationResult &&\n focusFieldBy(\n _fields,\n (key) => get(_formState.errors, key),\n name ? fieldNames : _names.mount,\n );\n\n return validationResult;\n };\n\n const getValues: UseFormGetValues<TFieldValues> = (\n fieldNames?:\n | FieldPath<TFieldValues>\n | ReadonlyArray<FieldPath<TFieldValues>>,\n ) => {\n const values = {\n ..._defaultValues,\n ...(_stateFlags.mount ? _formValues : {}),\n };\n\n return isUndefined(fieldNames)\n ? values\n : isString(fieldNames)\n ? get(values, fieldNames as InternalFieldName)\n : fieldNames.map((name) => get(values, name as InternalFieldName));\n };\n\n const getFieldState: UseFormGetFieldState<TFieldValues> = (\n name,\n formState,\n ) => ({\n invalid: !!get((formState || _formState).errors, name),\n isDirty: !!get((formState || _formState).dirtyFields, name),\n isTouched: !!get((formState || _formState).touchedFields, name),\n error: get((formState || _formState).errors, name),\n });\n\n const clearErrors: UseFormClearErrors<TFieldValues> = (name) => {\n name\n ? convertToArrayPayload(name).forEach((inputName) =>\n unset(_formState.errors, inputName),\n )\n : (_formState.errors = {} as FieldErrors<TFieldValues>);\n\n _subjects.state.next({\n errors: _formState.errors,\n });\n };\n\n const setError: UseFormSetError<TFieldValues> = (name, error, options) => {\n const ref = ((get(_fields, name, { _f: {} }) as Field)._f || {}).ref;\n\n set(_formState.errors, name, {\n ...error,\n ref,\n });\n\n _subjects.state.next({\n name,\n errors: _formState.errors,\n isValid: false,\n });\n\n options && options.shouldFocus && ref && ref.focus && ref.focus();\n };\n\n const watch: UseFormWatch<TFieldValues> = (\n name?:\n | FieldPath<TFieldValues>\n | ReadonlyArray<FieldPath<TFieldValues>>\n | WatchObserver<TFieldValues>,\n defaultValue?: unknown,\n ) =>\n isFunction(name)\n ? _subjects.watch.subscribe({\n next: (info) =>\n name(\n _getWatch(undefined, defaultValue as DeepPartial<TFieldValues>),\n info as {\n name?: FieldPath<TFieldValues>;\n type?: EventType;\n value?: unknown;\n },\n ),\n })\n : _getWatch(\n name as InternalFieldName | InternalFieldName[],\n defaultValue as DeepPartial<TFieldValues>,\n true,\n );\n\n const unregister: UseFormUnregister<TFieldValues> = (name, options = {}) => {\n for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {\n _names.mount.delete(fieldName);\n _names.array.delete(fieldName);\n\n if (get(_fields, fieldName)) {\n if (!options.keepValue) {\n unset(_fields, fieldName);\n unset(_formValues, fieldName);\n }\n\n !options.keepError && unset(_formState.errors, fieldName);\n !options.keepDirty && unset(_formState.dirtyFields, fieldName);\n !options.keepTouched && unset(_formState.touchedFields, fieldName);\n !_options.shouldUnregister &&\n !options.keepDefaultValue &&\n unset(_defaultValues, fieldName);\n }\n }\n\n _subjects.watch.next({});\n\n _subjects.state.next({\n ..._formState,\n ...(!options.keepDirty ? {} : { isDirty: _getDirty() }),\n });\n\n !options.keepIsValid && _updateValid();\n };\n\n const register: UseFormRegister<TFieldValues> = (name, options = {}) => {\n let field = get(_fields, name);\n const disabledIsDefined = isBoolean(options.disabled);\n\n set(_fields, name, {\n _f: {\n ...(field && field._f ? field._f : { ref: { name } }),\n name,\n mount: true,\n ...options,\n },\n });\n _names.mount.add(name);\n\n field\n ? disabledIsDefined &&\n set(\n _formValues,\n name,\n options.disabled\n ? undefined\n : get(_formValues, name, getFieldValue(field._f)),\n )\n : updateValidAndValue(name, true, options.value);\n\n return {\n ...(disabledIsDefined ? { disabled: options.disabled } : {}),\n ...(_options.shouldUseNativeValidation\n ? {\n required: !!options.required,\n min: getRuleValue(options.min),\n max: getRuleValue(options.max),\n minLength: getRuleValue<number>(options.minLength) as number,\n maxLength: getRuleValue(options.maxLength) as number,\n pattern: getRuleValue(options.pattern) as string,\n }\n : {}),\n name,\n onChange,\n onBlur: onChange,\n ref: (ref: HTMLInputElement | null): void => {\n if (ref) {\n register(name, options);\n field = get(_fields, name);\n\n const fieldRef = isUndefined(ref.value)\n ? ref.querySelectorAll\n ? (ref.querySelectorAll('input,select,textarea')[0] as Ref) || ref\n : ref\n : ref;\n const radioOrCheckbox = isRadioOrCheckbox(fieldRef);\n const refs = field._f.refs || [];\n\n if (\n radioOrCheckbox\n ? refs.find((option: Ref) => option === fieldRef)\n : fieldRef === field._f.ref\n ) {\n return;\n }\n\n set(_fields, name, {\n _f: {\n ...field._f,\n ...(radioOrCheckbox\n ? {\n refs: [\n ...refs.filter(live),\n fieldRef,\n ...(!!Array.isArray(get(_defaultValues, name))\n ? [{}]\n : []),\n ],\n ref: { type: fieldRef.type, name },\n }\n : { ref: fieldRef }),\n },\n });\n\n updateValidAndValue(name, false, undefined, fieldRef);\n } else {\n field = get(_fields, name, {});\n\n if (field._f) {\n field._f.mount = false;\n }\n\n (_options.shouldUnregister || options.shouldUnregister) &&\n !(isNameInFieldArray(_names.array, name) && _stateFlags.action) &&\n _names.unMount.add(name);\n }\n },\n };\n };\n\n const handleSubmit: UseFormHandleSubmit<TFieldValues> =\n (onValid, onInvalid) => async (e) => {\n if (e) {\n e.preventDefault && e.preventDefault();\n e.persist && e.persist();\n }\n let hasNoPromiseError = true;\n let fieldValues: any = cloneObject(_formValues);\n\n _subjects.state.next({\n isSubmitting: true,\n });\n\n try {\n if (_options.resolver) {\n const { errors, values } = await _executeSchema();\n _formState.errors = errors as FieldErrors<TFieldValues>;\n fieldValues = values;\n } else {\n await executeBuildInValidation(_fields);\n }\n\n if (isEmptyObject(_formState.errors)) {\n _subjects.state.next({\n errors: {} as FieldErrors<TFieldValues>,\n isSubmitting: true,\n });\n await onValid(fieldValues, e);\n } else {\n if (onInvalid) {\n await onInvalid({ ..._formState.errors }, e);\n }\n\n _options.shouldFocusError &&\n focusFieldBy(\n _fields,\n (key) => get(_formState.errors, key),\n _names.mount,\n );\n }\n } catch (err) {\n hasNoPromiseError = false;\n throw err;\n } finally {\n _formState.isSubmitted = true;\n _subjects.state.next({\n isSubmitted: true,\n isSubmitting: false,\n isSubmitSuccessful:\n isEmptyObject(_formState.errors) && hasNoPromiseError,\n submitCount: _formState.submitCount + 1,\n errors: _formState.errors,\n });\n }\n };\n\n const resetField: UseFormResetField<TFieldValues> = (name, options = {}) => {\n if (get(_fields, name)) {\n if (isUndefined(options.defaultValue)) {\n setValue(name, get(_defaultValues, name));\n } else {\n setValue(name, options.defaultValue);\n set(_defaultValues, name, options.defaultValue);\n }\n\n if (!options.keepTouched) {\n unset(_formState.touchedFields, name);\n }\n\n if (!options.keepDirty) {\n unset(_formState.dirtyFields, name);\n _formState.isDirty = options.defaultValue\n ? _getDirty(name, get(_defaultValues, name))\n : _getDirty();\n }\n\n if (!options.keepError) {\n unset(_formState.errors, name);\n _proxyFormState.isValid && _updateValid();\n }\n\n _subjects.state.next({ ..._formState });\n }\n };\n\n const reset: UseFormReset<TFieldValues> = (\n formValues,\n keepStateOptions = {},\n ) => {\n const updatedValues = formValues || _defaultValues;\n const cloneUpdatedValues = cloneObject(updatedValues);\n const values =\n formValues && !isEmptyObject(formValues)\n ? cloneUpdatedValues\n : _defaultValues;\n\n if (!keepStateOptions.keepDefaultValues) {\n _defaultValues = updatedValues;\n }\n\n if (!keepStateOptions.keepValues) {\n if (keepStateOptions.keepDirtyValues) {\n for (const fieldName of _names.mount) {\n get(_formState.dirtyFields, fieldName)\n ? set(values, fieldName, get(_formValues, fieldName))\n : setValue(\n fieldName as FieldPath<TFieldValues>,\n get(values, fieldName),\n );\n }\n } else {\n if (isWeb && isUndefined(formValues)) {\n for (const name of _names.mount) {\n const field = get(_fields, name);\n if (field && field._f) {\n const fieldReference = Array.isArray(field._f.refs)\n ? field._f.refs[0]\n : field._f.ref;\n\n try {\n isHTMLElement(fieldReference) &&\n fieldReference.closest('form')!.reset();\n break;\n } catch {}\n }\n }\n }\n\n _fields = {};\n }\n\n _formValues = props.shouldUnregister\n ? keepStateOptions.keepDefaultValues\n ? cloneObject(_defaultValues)\n : {}\n : cloneUpdatedValues;\n\n _subjects.array.next({\n values,\n });\n\n _subjects.watch.next({\n values,\n });\n }\n\n _names = {\n mount: new Set(),\n unMount: new Set(),\n array: new Set(),\n watch: new Set(),\n watchAll: false,\n focus: '',\n };\n\n _stateFlags.mount =\n !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;\n\n _stateFlags.watch = !!props.shouldUnregister;\n\n _subjects.state.next({\n submitCount: keepStateOptions.keepSubmitCount\n ? _formState.submitCount\n : 0,\n isDirty:\n keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues\n ? _formState.isDirty\n : !!(\n keepStateOptions.keepDefaultValues &&\n !deepEqual(formValues, _defaultValues)\n ),\n isSubmitted: keepStateOptions.keepIsSubmitted\n ? _formState.isSubmitted\n : false,\n dirtyFields:\n keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues\n ? _formState.dirtyFields\n : keepStateOptions.keepDefaultValues && formValues\n ? getDirtyFields(_defaultValues, formValues)\n : {},\n touchedFields: keepStateOptions.keepTouched\n ? _formState.touchedFields\n : ({} as FieldNamesMarkedBoolean<TFieldValues>),\n errors: keepStateOptions.keepErrors\n ? _formState.errors\n : ({} as FieldErrors<TFieldValues>),\n isSubmitting: false,\n isSubmitSuccessful: false,\n });\n };\n\n const setFocus: UseFormSetFocus<TFieldValues> = (name, options = {}) => {\n const field = get(_fields, name)._f;\n const fieldRef = field.refs ? field.refs[0] : field.ref;\n fieldRef.focus();\n options.shouldSelect && fieldRef.select();\n };\n\n return {\n control: {\n register,\n unregister,\n getFieldState,\n _executeSchema,\n _getWatch,\n _getDirty,\n _updateValid,\n _removeUnmounted,\n _updateFieldArray,\n _getFieldArray,\n _subjects,\n _proxyFormState,\n get _fields() {\n return _fields;\n },\n get _formValues() {\n return _formValues;\n },\n get _stateFlags() {\n return _stateFlags;\n },\n set _stateFlags(value) {\n _stateFlags = value;\n },\n get _defaultValues() {\n return _defaultValues;\n },\n get _names() {\n return _names;\n },\n set _names(value) {\n _names = value;\n },\n get _formState() {\n return _formState;\n },\n set _formState(value) {\n _formState = value;\n },\n get _options() {\n return _options;\n },\n set _options(value) {\n _options = {\n ..._options,\n ...value,\n };\n },\n },\n trigger,\n register,\n handleSubmit,\n watch,\n setValue,\n getValues,\n reset,\n resetField,\n clearErrors,\n unregister,\n setError,\n setFocus,\n getFieldState,\n };\n}\n","import { Field } from '../types';\n\nexport default (options: Field['_f']) =>\n options.mount &&\n (options.required ||\n options.min ||\n options.max ||\n options.maxLength ||\n options.minLength ||\n options.pattern ||\n options.validate);\n","import { FieldElement } from '../types';\n\nimport isCheckBoxInput from './isCheckBoxInput';\nimport isRadioInput from './isRadioInput';\n\nexport default (ref: FieldElement): ref is HTMLInputElement =>\n isRadioInput(ref) || isCheckBoxInput(ref);\n","import compact from '../utils/compact';\nimport get from '../utils/get';\nimport unset from '../utils/unset';\n\nexport default <T>(ref: T, name: string) =>\n !compact(get(ref, name)).length && unset(ref, name);\n","import { ControllerProps, FieldPath, FieldValues } from './types';\nimport { useController } from './useController';\n\n/**\n * Component based on `useController` hook to work with controlled component.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/usecontroller/controller) • [Demo](https://codesandbox.io/s/react-hook-form-v6-controller-ts-jwyzw) • [Video](https://www.youtube.com/watch?v=N2UNk_UCVyA)\n *\n * @param props - the path name to the form field value, and validation rules.\n *\n * @returns provide field handler functions, field and form state.\n *\n * @example\n * ```tsx\n * function App() {\n * const { control } = useForm<FormValues>({\n * defaultValues: {\n * test: \"\"\n * }\n * });\n *\n * return (\n * <form>\n * <Controller\n * control={control}\n * name=\"test\"\n * render={({ field: { onChange, onBlur, value, ref }, formState, fieldState }) => (\n * <>\n * <input\n * onChange={onChange} // send value to hook form\n * onBlur={onBlur} // notify when input is touched\n * value={value} // return updated value\n * ref={ref} // set ref for focus management\n * />\n * <p>{formState.isSubmitted ? \"submitted\" : \"\"}</p>\n * <p>{fieldState.isTouched ? \"touched\" : \"\"}</p>\n * </>\n * )}\n * />\n * </form>\n * );\n * }\n * ```\n */\nconst Controller = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(\n props: ControllerProps<TFieldValues, TName>,\n) => props.render(useController<TFieldValues, TName>(props));\n\nexport { Controller };\n","import React from 'react';\n\nimport focusFieldBy from './logic/focusFieldBy';\nimport generateId from './logic/generateId';\nimport getFocusFieldName from './logic/getFocusFieldName';\nimport isWatched from './logic/isWatched';\nimport appendAt from './utils/append';\nimport cloneObject from './utils/cloneObject';\nimport convertToArrayPayload from './utils/convertToArrayPayload';\nimport fillEmptyArray from './utils/fillEmptyArray';\nimport get from './utils/get';\nimport insertAt from './utils/insert';\nimport moveArrayAt from './utils/move';\nimport prependAt from './utils/prepend';\nimport removeArrayAt from './utils/remove';\nimport set from './utils/set';\nimport swapArrayAt from './utils/swap';\nimport unset from './utils/unset';\nimport updateAt from './utils/update';\nimport {\n FieldArray,\n FieldArrayMethodProps,\n FieldArrayPath,\n FieldArrayWithId,\n FieldErrors,\n FieldPath,\n FieldValues,\n InternalFieldName,\n UseFieldArrayProps,\n UseFieldArrayReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * A custom hook that exposes convenient methods to perform operations with a list of dynamic inputs that need to be appended, updated, removed etc.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/usefieldarray) • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn)\n *\n * @param props - useFieldArray props\n *\n * @returns methods - functions to manipulate with the Field Arrays (dynamic inputs) {@link UseFieldArrayReturn}\n *\n * @example\n * ```tsx\n * function App() {\n * const { register, control, handleSubmit, reset, trigger, setError } = useForm({\n * defaultValues: {\n * test: []\n * }\n * });\n * const { fields, append } = useFieldArray({\n * control,\n * name: \"test\"\n * });\n *\n * return (\n * <form onSubmit={handleSubmit(data => console.log(data))}>\n * {fields.map((item, index) => (\n * <input key={item.id} {...register(`test.${index}.firstName`)} />\n * ))}\n * <button type=\"button\" onClick={() => append({ firstName: \"bill\" })}>\n * append\n * </button>\n * <input type=\"submit\" />\n * </form>\n * );\n * }\n * ```\n */\nexport function useFieldArray<\n TFieldValues extends FieldValues = FieldValues,\n TFieldArrayName extends FieldArrayPath<TFieldValues> = FieldArrayPath<TFieldValues>,\n TKeyName extends string = 'id',\n>(\n props: UseFieldArrayProps<TFieldValues, TFieldArrayName, TKeyName>,\n): UseFieldArrayReturn<TFieldValues, TFieldArrayName, TKeyName> {\n const methods = useFormContext();\n const {\n control = methods.control,\n name,\n keyName = 'id' as TKeyName,\n shouldUnregister,\n } = props;\n const [fields, setFields] = React.useState<\n Partial<FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>>[]\n >(control._getFieldArray(name));\n const ids = React.useRef<string[]>(\n control._getFieldArray(name).map(generateId),\n );\n const _fieldIds = React.useRef(fields);\n const _name = React.useRef(name);\n const _actioned = React.useRef(false);\n\n _name.current = name;\n _fieldIds.current = fields;\n control._names.array.add(name);\n\n const callback = React.useCallback(\n ({\n values,\n name: fieldArrayName,\n }: {\n values?: FieldValues;\n name?: InternalFieldName;\n }) => {\n if (fieldArrayName === _name.current || !fieldArrayName) {\n const fieldValues = get(values, _name.current, []);\n setFields(fieldValues);\n ids.current = fieldValues.map(generateId);\n }\n },\n [],\n );\n\n useSubscribe({\n callback,\n subject: control._subjects.array,\n });\n\n const updateValues = React.useCallback(\n <\n T extends Partial<\n FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>\n >[],\n >(\n updatedFieldArrayValues: T,\n ) => {\n _actioned.current = true;\n control._updateFieldArray(name, updatedFieldArrayValues);\n },\n [control, name],\n );\n\n const append = (\n value:\n | Partial<FieldArray<TFieldValues, TFieldArrayName>>\n | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],\n options?: FieldArrayMethodProps,\n ) => {\n const appendValue = convertToArrayPayload(cloneObject(value));\n const updatedFieldArrayValues = appendAt(\n control._getFieldArray(name),\n appendValue,\n );\n control._names.focus = getFocusFieldName(\n name,\n updatedFieldArrayValues.length - 1,\n options,\n );\n ids.current = appendAt(ids.current, appendValue.map(generateId));\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._updateFieldArray(name, updatedFieldArrayValues, appendAt, {\n argA: fillEmptyArray(value),\n });\n };\n\n const prepend = (\n value:\n | Partial<FieldArray<TFieldValues, TFieldArrayName>>\n | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],\n options?: FieldArrayMethodProps,\n ) => {\n const prependValue = convertToArrayPayload(cloneObject(value));\n const updatedFieldArrayValues = prependAt(\n control._getFieldArray(name),\n prependValue,\n );\n control._names.focus = getFocusFieldName(name, 0, options);\n ids.current = prependAt(ids.current, prependValue.map(generateId));\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._updateFieldArray(name, updatedFieldArrayValues, prependAt, {\n argA: fillEmptyArray(value),\n });\n };\n\n const remove = (index?: number | number[]) => {\n const updatedFieldArrayValues: Partial<\n FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>\n >[] = removeArrayAt(control._getFieldArray(name), index);\n ids.current = removeArrayAt(ids.current, index);\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._updateFieldArray(name, updatedFieldArrayValues, removeArrayAt, {\n argA: index,\n });\n };\n\n const insert = (\n index: number,\n value:\n | Partial<FieldArray<TFieldValues, TFieldArrayName>>\n | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],\n options?: FieldArrayMethodProps,\n ) => {\n const insertValue = convertToArrayPayload(cloneObject(value));\n const updatedFieldArrayValues = insertAt(\n control._getFieldArray(name),\n index,\n insertValue,\n );\n control._names.focus = getFocusFieldName(name, index, options);\n ids.current = insertAt(ids.current, index, insertValue.map(generateId));\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._updateFieldArray(name, updatedFieldArrayValues, insertAt, {\n argA: index,\n argB: fillEmptyArray(value),\n });\n };\n\n const swap = (indexA: number, indexB: number) => {\n const updatedFieldArrayValues = control._getFieldArray(name);\n swapArrayAt(updatedFieldArrayValues, indexA, indexB);\n swapArrayAt(ids.current, indexA, indexB);\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._updateFieldArray(\n name,\n updatedFieldArrayValues,\n swapArrayAt,\n {\n argA: indexA,\n argB: indexB,\n },\n false,\n );\n };\n\n const move = (from: number, to: number) => {\n const updatedFieldArrayValues = control._getFieldArray(name);\n moveArrayAt(updatedFieldArrayValues, from, to);\n moveArrayAt(ids.current, from, to);\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._updateFieldArray(\n name,\n updatedFieldArrayValues,\n moveArrayAt,\n {\n argA: from,\n argB: to,\n },\n false,\n );\n };\n\n const update = (\n index: number,\n value: FieldArray<TFieldValues, TFieldArrayName>,\n ) => {\n const updateValue = cloneObject(value);\n const updatedFieldArrayValues = updateAt(\n control._getFieldArray<\n FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>\n >(name),\n index,\n updateValue as FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>,\n );\n ids.current = [...updatedFieldArrayValues].map((item, i) =>\n !item || i === index ? generateId() : ids.current[i],\n );\n updateValues(updatedFieldArrayValues);\n setFields([...updatedFieldArrayValues]);\n control._updateFieldArray(\n name,\n updatedFieldArrayValues,\n updateAt,\n {\n argA: index,\n argB: updateValue,\n },\n true,\n false,\n );\n };\n\n const replace = (\n value:\n | Partial<FieldArray<TFieldValues, TFieldArrayName>>\n | Partial<FieldArray<TFieldValues, TFieldArrayName>>[],\n ) => {\n const updatedFieldArrayValues = convertToArrayPayload(cloneObject(value));\n ids.current = updatedFieldArrayValues.map(generateId);\n updateValues([...updatedFieldArrayValues]);\n setFields([...updatedFieldArrayValues]);\n control._updateFieldArray(\n name,\n [...updatedFieldArrayValues],\n <T>(data: T): T => data,\n {},\n true,\n false,\n );\n };\n\n React.useEffect(() => {\n control._stateFlags.action = false;\n\n isWatched(name, control._names) && control._subjects.state.next({});\n\n if (_actioned.current) {\n control._executeSchema([name]).then((result) => {\n const error = get(result.errors, name);\n const existingError = get(control._formState.errors, name);\n\n if (\n existingError ? !error && existingError.type : error && error.type\n ) {\n error\n ? set(control._formState.errors, name, error)\n : unset(control._formState.errors, name);\n control._subjects.state.next({\n errors: control._formState.errors as FieldErrors<TFieldValues>,\n });\n }\n });\n }\n\n control._subjects.watch.next({\n name,\n values: control._formValues,\n });\n\n control._names.focus &&\n focusFieldBy(control._fields, (key: string) =>\n key.startsWith(control._names.focus),\n );\n\n control._names.focus = '';\n\n control._proxyFormState.isValid && control._updateValid();\n }, [fields, name, control]);\n\n React.useEffect(() => {\n !get(control._formValues, name) && control._updateFieldArray(name);\n\n return () => {\n (control._options.shouldUnregister || shouldUnregister) &&\n control.unregister(name as FieldPath<TFieldValues>);\n };\n }, [name, control, keyName, shouldUnregister]);\n\n return {\n swap: React.useCallback(swap, [updateValues, name, control]),\n move: React.useCallback(move, [updateValues, name, control]),\n prepend: React.useCallback(prepend, [updateValues, name, control]),\n append: React.useCallback(append, [updateValues, name, control]),\n remove: React.useCallback(remove, [updateValues, name, control]),\n insert: React.useCallback(insert, [updateValues, name, control]),\n update: React.useCallback(update, [updateValues, name, control]),\n replace: React.useCallback(replace, [updateValues, name, control]),\n fields: React.useMemo(\n () =>\n fields.map((field, index) => ({\n ...field,\n [keyName]: ids.current[index] || generateId(),\n })) as FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>[],\n [fields, keyName],\n ),\n };\n}\n","import React from 'react';\n\nimport { createFormControl } from './logic/createFormControl';\nimport getProxyFormState from './logic/getProxyFormState';\nimport shouldRenderFormState from './logic/shouldRenderFormState';\nimport {\n FieldErrors,\n FieldNamesMarkedBoolean,\n FieldValues,\n FormState,\n UseFormProps,\n UseFormReturn,\n} from './types';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * Custom hook to mange the entire form.\n *\n * @remarks\n * [API](https://react-hook-form.com/api/useform) • [Demo](https://codesandbox.io/s/react-hook-form-get-started-ts-5ksmm) • [Video](https://www.youtube.com/watch?v=RkXv4AXXC_4)\n *\n * @param props - form configuration and validation parameters.\n *\n * @returns methods - individual functions to manage the form state. {@link UseFormReturn}\n *\n * @example\n * ```tsx\n * function App() {\n * const { register, handleSubmit, watch, formState: { errors } } = useForm();\n * const onSubmit = data => console.log(data);\n *\n * console.log(watch(\"example\"));\n *\n * return (\n * <form onSubmit={handleSubmit(onSubmit)}>\n * <input defaultValue=\"test\" {...register(\"example\")} />\n * <input {...register(\"exampleRequired\", { required: true })} />\n * {errors.exampleRequired && <span>This field is required</span>}\n * <input type=\"submit\" />\n * </form>\n * );\n * }\n * ```\n */\nexport function useForm<\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: UseFormProps<TFieldValues, TContext> = {},\n): UseFormReturn<TFieldValues, TContext> {\n const _formControl = React.useRef<\n UseFormReturn<TFieldValues, TContext> | undefined\n >();\n const [formState, updateFormState] = React.useState<FormState<TFieldValues>>({\n isDirty: false,\n isValidating: false,\n dirtyFields: {} as FieldNamesMarkedBoolean<TFieldValues>,\n isSubmitted: false,\n submitCount: 0,\n touchedFields: {} as FieldNamesMarkedBoolean<TFieldValues>,\n isSubmitting: false,\n isSubmitSuccessful: false,\n isValid: false,\n errors: {} as FieldErrors<TFieldValues>,\n });\n\n if (_formControl.current) {\n _formControl.current.control._options = props;\n } else {\n _formControl.current = {\n ...createFormControl(props),\n formState,\n };\n }\n\n const control = _formControl.current.control;\n\n const callback = React.useCallback(\n (value: FieldValues) => {\n if (shouldRenderFormState(value, control._proxyFormState, true)) {\n control._formState = {\n ...control._formState,\n ...value,\n };\n\n updateFormState({ ...control._formState });\n }\n },\n [control],\n );\n\n useSubscribe({\n subject: control._subjects.state,\n callback,\n });\n\n React.useEffect(() => {\n if (!control._stateFlags.mount) {\n control._proxyFormState.isValid && control._updateValid();\n control._stateFlags.mount = true;\n }\n if (control._stateFlags.watch) {\n control._stateFlags.watch = false;\n control._subjects.state.next({});\n }\n control._removeUnmounted();\n });\n\n _formControl.current.formState = getProxyFormState(\n formState,\n control._proxyFormState,\n );\n\n return _formControl.current;\n}\n"],"names":["isCheckBoxInput","element","type","isDateObject","value","Date","isNullOrUndefined","isObjectType","isObject","Array","isArray","getEventValue","event","target","checked","isNameInFieldArray","names","name","has","substring","search","getNodeParentName","compact","filter","Boolean","isUndefined","val","undefined","get","obj","path","defaultValue","result","split","reduce","key","EVENTS","VALIDATION_MODE","INPUT_VALIDATION_RULES","HookFormContext","React","createContext","useFormContext","useContext","getProxyFormState","formState","_proxyFormState","localProxyFormState","isRoot","Object","defineProperty","_key","isEmptyObject","keys","length","shouldRenderFormState","formStateData","find","convertToArrayPayload","shouldSubscribeByName","signalName","exact","some","currentName","startsWith","useSubscribe","props","_props","useRef","current","useEffect","subscription","disabled","subject","subscribe","next","callback","unsubscribe","tearDown","useFormState","methods","control","updateFormState","useState","_formState","_localProxyFormState","isDirty","dirtyFields","touchedFields","isValidating","isValid","errors","_name","_mounted","useCallback","_subjects","state","isString","generateWatchOutput","_names","formValues","isGlobal","watch","add","map","fieldName","watchAll","isFunction","objectHasFunction","data","useWatch","fieldValues","values","_formValues","updateValue","_getWatch","_removeUnmounted","useController","shouldUnregister","isArrayField","array","_defaultValues","_registerProps","register","rules","updateMounted","field","_fields","_f","mount","_shouldUnregisterField","_options","_stateFlags","action","unregister","onChange","onBlur","ref","elm","focus","select","setCustomValidity","message","reportValidity","fieldState","defineProperties","invalid","isTouched","error","appendErrors","validateAllFieldCriteria","types","[object Object]","isKey","test","stringToPath","input","replace","set","object","index","tempPath","lastIndex","newValue","objValue","isNaN","focusFieldBy","fields","fieldsNames","currentField","refs","generateId","d","performance","now","c","r","Math","random","toString","getFocusFieldName","options","shouldFocus","focusName","focusIndex","isWatched","isBlurEvent","watchName","slice","append","isWeb","window","HTMLElement","document","cloneObject","copy","Set","Blob","FileList","fillEmptyArray","insert","moveArrayAt","from","to","splice","prepend","removeArrayAt","indexes","i","temp","removeAtIndexes","sort","a","b","swapArrayAt","indexA","indexB","unset","updatePath","childObject","baseGet","previousObjRef","k","objectRef","currentPaths","currentPathsLength","item","updateAt","createSubject","_observers","observers","observer","push","o","isPrimitive","deepEqual","object1","object2","getTime","keys1","keys2","val1","includes","val2","getValidationModes","mode","isOnSubmit","isOnBlur","isOnChange","isOnAll","isOnTouch","isBoolean","isFileInput","isHTMLElement","owner","ownerDocument","defaultView","isMultipleSelect","isRadioInput","live","isConnected","markFieldsDirty","isParentNodeArray","getDirtyFields","defaultValues","getDirtyFieldsFromDefaultValues","dirtyFieldsFromValues","defaultResult","validResult","getCheckboxValue","option","attributes","getFieldValueAs","valueAsNumber","valueAsDate","setValueAs","NaN","defaultReturn","getRadioValue","previous","getFieldValue","every","files","selectedOptions","isCheckBox","isRegex","RegExp","getRuleValue","rule","source","schemaErrorLookup","join","foundError","pop","isMessage","isValidElement","getValidateError","getValueAndMessage","validationData","validateField","async","inputValue","shouldUseNativeValidation","required","maxLength","minLength","min","max","pattern","validate","inputRef","isRadio","isRadioOrCheckbox","isEmpty","appendErrorsCurry","bind","getMinMaxMessage","exceedMax","maxLengthMessage","minLengthMessage","maxType","minType","exceedMin","maxOutput","minOutput","valueDate","valueNumber","maxLengthOutput","minLengthOutput","patternValue","match","validateError","validationResult","defaultOptions","reValidateMode","shouldFocusError","createFormControl","delayErrorCallback","isSubmitted","submitCount","isSubmitting","isSubmitSuccessful","unMount","timer","validateFields","validationModeBeforeSubmit","validationModeAfterSubmit","shouldDisplayAllAssociatedErrors","criteriaMode","_updateValid","shouldSkipRender","resolver","_executeSchema","executeBuildInValidation","updateValidAndValue","shouldSkipSetValueAs","defaultChecked","setFieldValue","updateTouchAndDirty","fieldValue","shouldDirty","shouldRender","isFieldDirty","output","isPreviousFieldTouched","isPreviousFormDirty","_getDirty","isPreviousFieldDirty","shouldRenderByError","previousFieldError","shouldUpdateValid","delayError","updateErrors","wait","clearTimeout","setTimeout","updatedFormState","v","context","getResolverOptions","shouldOnlyCheckValid","valid","fieldReference","fieldError","getValues","forEach","selectRef","selected","checkboxRef","radioRef","shouldTouch","shouldValidate","trigger","setValues","fieldKey","setValue","isFieldArray","cloneValue","shouldSkipValidation","deps","skipValidation","watched","previousErrorLookupResult","errorLookupResult","fieldNames","executeSchemaAndUpdateState","Promise","all","getFieldState","delete","keepValue","keepError","keepDirty","keepTouched","keepDefaultValue","keepIsValid","disabledIsDefined","fieldRef","querySelectorAll","radioOrCheckbox","_updateFieldArray","method","args","shouldSetValues","shouldUpdateFieldsAndState","argA","argB","unsetEmptyArray","_getFieldArray","handleSubmit","onValid","onInvalid","e","preventDefault","persist","hasNoPromiseError","err","info","reset","keepStateOptions","updatedValues","cloneUpdatedValues","keepDefaultValues","keepValues","keepDirtyValues","closest","_a","keepSubmitCount","keepIsSubmitted","keepErrors","resetField","clearErrors","inputName","setError","setFocus","shouldSelect","render","children","createElement","Provider","keyName","setFields","ids","_fieldIds","_actioned","fieldArrayName","updateValues","updatedFieldArrayValues","then","existingError","swap","move","prependValue","prependAt","appendValue","appendAt","remove","insertValue","insertAt","update","useMemo","_formControl"],"mappings":"sKAEAA,EAAgBC,GACG,aAAjBA,EAAQC,KCHVC,EAAgBC,GAAkCA,aAAiBC,KCAnEC,EAAgBF,GAAuD,MAATA,ECGvD,MAAMG,EAAgBH,GAAoC,iBAAVA,EAEvD,IAAAI,EAAkCJ,IAC/BE,EAAkBF,KAClBK,MAAMC,QAAQN,IACfG,EAAaH,KACZD,EAAaC,GCJDO,EAACC,GACdJ,EAASI,IAAWA,EAAgBC,OAChCb,EAAiBY,EAAgBC,QAC9BD,EAAgBC,OAAOC,QACvBF,EAAgBC,OAAOT,MAC1BQ,ECNNG,EAAe,CAACC,EAA+BC,IAC7CD,EAAME,ICLO,CAACD,GACdA,EAAKE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