{"version":3,"sources":["../../src/utils/isCheckBoxInput.ts","../../src/utils/isDateObject.ts","../../src/utils/isNullOrUndefined.ts","../../src/utils/isObject.ts","../../src/logic/getNodeParentName.ts","../../src/logic/isNameInFieldArray.ts","../../src/utils/compact.ts","../../src/utils/isUndefined.ts","../../src/utils/get.ts","../../src/constants.ts","../../src/utils/omit.ts","../../src/useFormContext.tsx","../../src/logic/getProxyFormState.ts","../../src/utils/isEmptyObject.ts","../../src/logic/shouldRenderFormState.ts","../../src/utils/convertToArrayPayload.ts","../../src/useFormState.ts","../../src/utils/isKey.ts","../../src/utils/stringToPath.ts","../../src/utils/set.ts","../../src/useController.ts","../../src/logic/getControllerValue.ts","../../src/controller.tsx","../../src/logic/appendErrors.ts","../../src/logic/focusFieldBy.ts","../../src/logic/getFocusFieldName.ts","../../src/logic/mapCurrentIds.ts","../../src/logic/generateId.ts","../../src/logic/mapId.ts","../../src/utils/append.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/update.ts","../../src/useFieldArray.ts","../../src/utils/cloneObject.ts","../../src/utils/isPrimitive.ts","../../src/utils/deepEqual.ts","../../src/utils/getValidationModes.ts","../../src/utils/isBoolean.ts","../../src/utils/isFileInput.ts","../../src/utils/isFunction.ts","../../src/utils/isHTMLElement.ts","../../src/utils/isMultipleSelect.ts","../../src/utils/isRadioInput.ts","../../src/utils/isRadioOrCheckbox.ts","../../src/utils/isString.ts","../../src/utils/isWeb.ts","../../src/utils/live.ts","../../src/utils/omitKeys.ts","../../src/utils/Subject.ts","../../src/utils/unset.ts","../../src/logic/getCheckboxValue.ts","../../src/logic/getFieldValueAs.ts","../../src/logic/getRadioValue.ts","../../src/logic/getFieldValue.ts","../../src/logic/getMultipleSelectValue.ts","../../src/logic/getResolverOptions.ts","../../src/logic/hasValidation.ts","../../src/utils/deepMerge.ts","../../src/logic/setFieldArrayDirtyFields.ts","../../src/logic/skipValidation.ts","../../src/logic/unsetEmptyArray.ts","../../src/utils/isMessage.ts","../../src/utils/isRegex.ts","../../src/logic/getValidateError.ts","../../src/logic/getValueAndMessage.ts","../../src/logic/validateField.ts","../../src/logic/createFormControl.ts","../../src/useForm.ts","../../src/useWatch.ts"],"names":["element","type","data","Date","value","isObjectType","isNullOrUndefined","Array","isArray","isDateObject","name","substring","search","names","some","current","getNodeParentName","filter","Boolean","val","undefined","obj","path","defaultValue","isObject","result","compact","split","reduce","key","isUndefined","EVENTS","VALIDATION_MODE","INPUT_VALIDATION_RULES","source","copy","FormContext","displayName","useFormContext","FormProvider","props","Provider","omit","children","formState","_proxyFormState","localProxyFormState","isRoot","createGetter","prop","Object","defineProperty","get","keys","length","formStateData","isEmptyObject","find","useFormState","methods","control","disabled","nameRef","_formState","updateFormState","_localProxyFormState","isDirty","dirtyFields","touchedFields","isValidating","isValid","errors","formStateSubscription","_subjects","state","subscribe","next","convertToArrayPayload","includes","shouldRenderFormState","unsubscribe","getProxyFormState","test","input","replace","set","object","index","tempPath","isKey","stringToPath","lastIndex","newValue","objValue","isNaN","useController","shouldUnregister","_formValues","_defaultValues","setInputStateValue","registerProps","register","rules","updateMounted","field","_fields","_f","mount","controllerSubscription","values","_shouldUnregisterField","_shouldUnregister","isNameInFieldArray","_names","array","_isInAction","unregister","onChange","event","target","isCheckBoxInput","checked","getControllerValue","onBlur","ref","elm","focus","setCustomValidity","message","reportValidity","fieldState","invalid","isTouched","error","Controller","render","validateAllFieldCriteria","types","focusFieldBy","fields","callback","fieldsNames","refs","options","shouldFocus","focusName","focusIndex","_fieldIds","keyName","map","output","d","performance","now","c","r","Math","random","toString","generateId","append","insert","slice","from","to","splice","prepend","indexes","i","temp","removeAtIndexes","sort","a","b","indexA","indexB","fieldValues","useFieldArray","mapIds","_getFieldArrayValue","setFields","add","watchAll","watch","watchField","startsWith","_updateValid","fieldArraySubscription","fieldArrayName","swap","updatedFieldArrayValuesWithKey","mapCurrentIds","swapArrayAt","_updateFieldArray","argA","argB","move","moveArrayAt","prependAt","fillEmptyArray","getFocusFieldName","appendValue","appendAt","remove","removeArrayAt","insertAt","update","updatedFieldArrayValues","updateAt","cloneObject","getTime","deepEqual","object1","object2","isPrimitive","keys1","keys2","val1","val2","mode","isOnSubmit","isOnBlur","isOnChange","isOnAll","isOnTouch","HTMLElement","isRadioInput","window","document","isHTMLElement","contains","Subscription","tearDowns","tearDown","this","push","teardown","Subscriber","observer","subscription","closed","Subject","observers","subscriber","unset","previousObjRef","updatePath","childObject","baseGet","k","objectRef","currentPaths","currentPathsLength","item","isBoolean","defaultResult","validResult","option","attributes","valueAsNumber","valueAsDate","setValueAs","NaN","defaultReturn","previous","getFieldValue","every","isFileInput","files","getRadioValue","isMultipleSelect","selected","isCheckBox","getCheckboxValue","getFieldValueAs","_fieldss","criteriaMode","shouldUseNativeValidation","required","min","max","maxLength","minLength","pattern","validate","deepMerge","targetValue","sourceValue","setDirtyFields","defaultValues","parentNode","parentName","isBlurEvent","isSubmitted","reValidateMode","isString","RegExp","getValidateError","isMessage","validationData","isRegex","inputValue","inputRef","setCustomValidty","isRadio","isRadioOrCheckbox","isEmpty","appendErrorsCurry","appendErrors","bind","getMinMaxMessage","exceedMax","maxLengthMessage","minLengthMessage","maxType","minType","getValueAndMessage","maxOutput","minOutput","valueDate","exceedMin","valueNumber","parseFloat","maxLengthOutput","minLengthOutput","patternValue","match","isFunction","validateError","validationResult","defaultOptions","shouldFocusError","isWindowUndefined","createFormControl","_delayCallback","formOptions","submitCount","isSubmitting","isSubmitSuccessful","_isMounted","_timer","Set","unMount","_validateCount","validationMode","getValidationModes","isValidateAllFieldCriteria","debounce","wait","args","clearTimeout","setTimeout","isFieldWatched","has","updateErrorState","shouldRenderBaseOnError","shouldSkipRender","previousError","shouldUpdateValid","delayError","updatedFormState","setFieldValue","shouldRender","fieldValue","isWeb","forEach","selectRef","checkboxRef","radioRef","getValues","shouldDirty","shouldTouch","updateTouchAndDirtyState","shouldValidate","trigger","isCurrentTouched","isChanged","previousIsDirty","_getIsDirty","isPreviousFieldDirty","isCurrentFieldDirty","isPreviousFieldTouched","executeResolver","resolver","context","getResolverOptions","executeResolverValidation","validateForm","shouldCheckValid","valid","validateField","fieldError","handleChange","inputType","shouldSkipValidation","hasValidation","deps","skipValidation","isWatched","parentNodeName","parentField","parentError","_updateValidAndInputValue","shouldSkipValueAs","defaultChecked","skipRender","setValues","entries","fieldKey","fieldName","_getWatch","fieldNames","isMounted","isGlobal","_updateValues","method","shouldSet","shouldSetFields","omitKeys","unsetEmptyArray","setFieldArrayDirtyFields","omitKey","setValue","isFieldArray","schemaResult","Promise","all","clearErrors","inputName","setError","info","delete","keepValue","keepError","keepDirty","keepTouched","keepDefaultValue","keepIsValid","registerFieldRef","fieldRef","querySelectorAll","isRadioOrCheckboxFunction","handleSubmit","onValid","onInvalid","e","preventDefault","persist","hasNoPromiseError","reset","formValues","keepStateOptions","updatedValues","keepValues","closest","keepDefaultValues","keepSubmitCount","keepIsSubmitted","keepErrors","setFocus","_removeFields","live","_updateProps","useForm","_formControl","useWatch","_name","updateValue","watchSubscription"],"mappings":"0iBAEA,EAAe,SAACA,GAAD,MACI,aAAjBA,EAAQC,MCHV,EAAe,SAACC,GAAD,OAAmBA,aAAgBC,MCAlD,EAAe,SAACC,GAAD,OAAwD,MAATA,GCGjDC,EAAe,SAACD,GAAD,MAAqC,kBAAVA,GAEvD,EAAe,SAAmBA,GAAnB,OACZE,EAAkBF,KAClBG,MAAMC,QAAQJ,IACfC,EAAaD,KACZK,EAAaL,ICThB,EAAe,SAACM,GAAD,OAAkBA,EAAKC,UAAU,EAAGD,EAAKE,OAAO,SAAWF,GCI1E,EAAe,SAACG,EAA+BH,GAAhC,OACb,YAAIG,GAAOC,MAAK,SAACC,GAAD,OAAaC,EAAkBN,KAAUK,MCL3D,EAAe,SAACX,GAAD,OAAkBA,EAAMa,OAAOC,UCA9C,EAAe,SAACC,GAAD,YAA4CC,IAARD,GCKnD,E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,EAIEA,SAEIqZ,EAAQ,SAAaxc,GAC3Bwc,EAAMnc,QAAUL,EAEhB,MAA6B,WAC3BoB,EAAYP,GACRqC,EAAQ8V,UAAUhZ,GAClBa,GAHN,mBAAOnB,EAAP,KAAc+c,EAAd,KA6CA,OAvCA,aAAgB,WACd,IAAMC,EAAoBxZ,EAAQa,UAAU8G,MAAM5G,UAAU,CAC1DC,KAAM,YAAS,IAANlE,EAAM,EAANA,KACP,IACGwc,EAAMnc,UACNL,GACDmE,EAAsBqY,EAAMnc,SAASD,MACnC,SAAC2Y,GAAD,OACE/Y,GACA+Y,IACCA,EAAUhO,WAAW/K,IACpBA,EAAK+K,WAAWgO,OAEtB,CACA,IAAMhY,EAASmC,EAAQ8V,UACrBwD,EAAMnc,QACNQ,GACA,GAEF4b,EACE3b,EAASC,G,iBACAA,GACLlB,MAAMC,QAAQiB,GAAd,YACIA,GACJA,OAQZ,OAFAoC,GAAYuZ,EAAkBpY,cAEvB,kBAAMoY,EAAkBpY,iBAC9B,CAACnB,EAAUD,EAASrC,IAEvB,aAAgB,WACdqC,EAAQgZ,mBAGHxc","file":"static/js/1.90a26ed4.chunk.js","sourcesContent":["import { FieldElement } from '../types';\n\nexport default (element: FieldElement): element is HTMLInputElement =>\n element.type === 'checkbox';\n","export default (data: unknown) => data 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 (value: unknown): value is T =>\n !isNullOrUndefined(value) &&\n !Array.isArray(value) &&\n isObjectType(value) &&\n !isDateObject(value);\n","export default (name: string) => name.substring(0, name.search(/.\\d/)) || name;\n","import { InternalFieldName } from '../types';\n\nimport getNodeParentName from './getNodeParentName';\n\nexport default (names: Set, name: InternalFieldName) =>\n [...names].some((current) => getNodeParentName(name) === current);\n","export default (value: any[]) => 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 (\n obj: T,\n path: string,\n defaultValue?: unknown,\n) => {\n if (isObject(obj) && path) {\n const result = compact(path.split(/[,[\\].]+?/)).reduce(\n (result, key) => (isNullOrUndefined(result) ? result : result[key]),\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\n return undefined;\n};\n","import { ValidationMode } from './types';\n\nexport const EVENTS = {\n BLUR: 'blur',\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","export default >(\n source: T,\n key: Key,\n): Omit => {\n const copy = { ...source };\n delete copy[key];\n\n return copy;\n};\n","import * as React from 'react';\n\nimport omit from './utils/omit';\nimport { FieldValues, FormProviderProps, UseFormReturn } from './types';\n\nconst FormContext = React.createContext(null);\n\nFormContext.displayName = 'RHFContext';\n\nexport const useFormContext = <\n TFieldValues extends FieldValues,\n>(): UseFormReturn =>\n React.useContext(FormContext) as unknown as UseFormReturn;\n\nexport const FormProvider = <\n TFieldValues extends FieldValues,\n TContext extends object = object,\n>(\n props: FormProviderProps,\n) => (\n \n {props.children}\n \n);\n","import { VALIDATION_MODE } from '../constants';\nimport { FormState, FormStateProxy, ReadFormState } from '../types';\n\nexport default (\n formState: FormState,\n _proxyFormState: ReadFormState,\n localProxyFormState?: ReadFormState,\n isRoot = true,\n) => {\n function createGetter(prop: keyof FormStateProxy) {\n return () => {\n if (prop in formState) {\n if (_proxyFormState[prop] !== VALIDATION_MODE.all) {\n _proxyFormState[prop] = !isRoot || VALIDATION_MODE.all;\n }\n localProxyFormState && (localProxyFormState[prop] = true);\n return formState[prop];\n }\n return undefined;\n };\n }\n\n const result = {} as any as typeof formState;\n for (const key in formState) {\n Object.defineProperty(result, key, {\n get: createGetter(key as keyof FormStateProxy),\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';\nimport omit from '../utils/omit';\n\nexport default , K extends ReadFormState>(\n formStateData: T,\n _proxyFormState: K,\n isRoot?: boolean,\n) => {\n const formState = omit(formStateData, 'name');\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 (value: T) =>\n Array.isArray(value) ? value : [value];\n","import * as React from 'react';\n\nimport getProxyFormState from './logic/getProxyFormState';\nimport shouldRenderFormState from './logic/shouldRenderFormState';\nimport convertToArrayPayload from './utils/convertToArrayPayload';\nimport {\n FieldValues,\n InternalFieldName,\n UseFormStateProps,\n UseFormStateReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\n\nfunction useFormState(\n props?: UseFormStateProps,\n): UseFormStateReturn {\n const methods = useFormContext();\n const { control = methods.control, disabled, name } = props || {};\n const nameRef = React.useRef(name as InternalFieldName);\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 nameRef.current = name as InternalFieldName;\n\n React.useEffect(() => {\n const formStateSubscription = control._subjects.state.subscribe({\n next: (formState) =>\n (!nameRef.current ||\n !formState.name ||\n convertToArrayPayload(nameRef.current).includes(formState.name)) &&\n shouldRenderFormState(formState, _localProxyFormState.current) &&\n updateFormState({\n ...control._formState,\n ...formState,\n }),\n });\n\n disabled && formStateSubscription.unsubscribe();\n\n return () => formStateSubscription.unsubscribe();\n }, [disabled, control]);\n\n return getProxyFormState(\n formState,\n control._proxyFormState,\n _localProxyFormState.current,\n false,\n );\n}\n\nexport { useFormState };\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 * as React from 'react';\n\nimport getControllerValue from './logic/getControllerValue';\nimport isNameInFieldArray from './logic/isNameInFieldArray';\nimport get from './utils/get';\nimport { EVENTS } from './constants';\nimport {\n Field,\n FieldPath,\n FieldValues,\n InternalFieldName,\n UseControllerProps,\n UseControllerReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\nimport { useFormState } from './useFormState';\nimport { set } from './utils';\n\nexport function useController<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath = FieldPath,\n>(\n props: UseControllerProps,\n): UseControllerReturn {\n const methods = useFormContext();\n const { name, control = methods.control, shouldUnregister } = props;\n const [value, setInputStateValue] = React.useState(\n get(\n control._formValues,\n name,\n get(control._defaultValues, name, props.defaultValue),\n ),\n );\n set(control._formValues, name, value);\n const formState = useFormState({\n control: control || methods.control,\n name,\n });\n\n const registerProps = control.register(name, {\n ...props.rules,\n value,\n });\n\n const updateMounted = React.useCallback(\n (name: InternalFieldName, value: boolean) => {\n const field: Field = get(control._fields, name);\n\n if (field) {\n field._f.mount = value;\n }\n },\n [control],\n );\n\n React.useEffect(() => {\n const controllerSubscription = control._subjects.control.subscribe({\n next: (data) =>\n (!data.name || name === data.name) &&\n setInputStateValue(get(data.values, name)),\n });\n updateMounted(name, true);\n\n return () => {\n controllerSubscription.unsubscribe();\n const _shouldUnregisterField =\n control._shouldUnregister || shouldUnregister;\n\n if (\n isNameInFieldArray(control._names.array, name)\n ? _shouldUnregisterField && !control._isInAction\n : _shouldUnregisterField\n ) {\n control.unregister(name);\n } else {\n updateMounted(name, false);\n }\n };\n }, [name, control, shouldUnregister, updateMounted]);\n\n return {\n field: {\n onChange: (event: any) => {\n const value = getControllerValue(event);\n setInputStateValue(value);\n\n registerProps.onChange({\n target: {\n value,\n name: name as InternalFieldName,\n },\n type: EVENTS.CHANGE,\n });\n },\n onBlur: () => {\n registerProps.onBlur({\n target: {\n value,\n name: name as InternalFieldName,\n },\n type: EVENTS.BLUR,\n });\n },\n name,\n value,\n ref: (elm) => {\n const field = get(control._fields, name);\n\n if (elm && field && elm.focus) {\n field._f.ref = {\n focus: () => elm.focus(),\n setCustomValidity: (message: string) =>\n elm.setCustomValidity(message),\n reportValidity: () => elm.reportValidity(),\n };\n }\n },\n },\n formState,\n fieldState: {\n invalid: !!get(formState.errors, name),\n isDirty: !!get(formState.dirtyFields, name),\n isTouched: !!get(formState.touchedFields, name),\n error: get(formState.errors, name),\n },\n };\n}\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 { ControllerProps, FieldPath, FieldValues } from './types';\nimport { useController } from './useController';\n\nconst Controller = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath = FieldPath,\n>(\n props: ControllerProps,\n) => props.render(useController(props));\n\nexport { Controller };\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","import { FieldRefs, InternalFieldName } from '../types';\nimport { get } from '../utils';\nimport isObject from '../utils/isObject';\nimport isUndefined from '../utils/isUndefined';\nimport omit from '../utils/omit';\n\nconst focusFieldBy = (\n fields: FieldRefs,\n callback: (name: string) => boolean,\n fieldsNames?: Set | InternalFieldName[],\n) => {\n for (const key of fieldsNames || Object.keys(fields)) {\n const field = get(fields, key);\n\n if (field) {\n const _f = field._f;\n const current = omit(field, '_f');\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(current)) {\n focusFieldBy(current, callback);\n }\n }\n }\n};\n\nexport default focusFieldBy;\n","import { FieldArrayMethodProps, InternalFieldName } from '../types';\n\nexport default (\n name: InternalFieldName,\n index: number,\n options?: FieldArrayMethodProps,\n): string =>\n options && !options.shouldFocus\n ? options.focusName || `${name}.${options.focusIndex}.`\n : `${name}.${index}.`;\n","import * as React from 'react';\n\nimport { FieldValues } from '../types';\n\nexport default (\n values: T[],\n _fieldIds: React.MutableRefObject,\n keyName: string,\n) =>\n values.map((value, index) => {\n const output = _fieldIds.current[index as keyof K];\n\n return {\n ...value,\n ...(output ? { [keyName]: (output as FieldValues)[keyName] } : {}),\n };\n });\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 { FieldArrayPath, FieldArrayWithId, FieldValues } from '../types';\n\nimport generateId from './generateId';\n\nexport default <\n TFieldArrayValues extends FieldValues = FieldValues,\n TFieldName extends FieldArrayPath = FieldArrayPath,\n TKeyName extends string = 'id',\n>(\n values: Partial[] = [],\n keyName: TKeyName,\n): Partial>[] =>\n values.map((value: Partial) => ({\n ...(value[keyName] ? {} : { [keyName]: generateId() }),\n ...value,\n })) as Partial>[];\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function append(data: T[], value: T | T[]): T[] {\n return [...convertToArrayPayload(data), ...convertToArrayPayload(value)];\n}\n","export default (value: T | T[]): undefined[] | undefined =>\n Array.isArray(value) ? value.map(() => undefined) : undefined;\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function insert(data: T[], index: number): (T | undefined)[];\nexport default function insert(\n data: T[],\n index: number,\n value: T | T[],\n): T[];\nexport default function insert(\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 (\n data: (T | undefined)[],\n from: number,\n to: number,\n): (T | undefined)[] => {\n if (Array.isArray(data)) {\n if (isUndefined(data[to])) {\n data[to] = undefined;\n }\n data.splice(to, 0, data.splice(from, 1)[0]);\n return data;\n }\n\n return [];\n};\n","import convertToArrayPayload from './convertToArrayPayload';\n\nexport default function prepend(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(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 (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 (data: T[], indexA: number, indexB: number): void => {\n data[indexA] = [data[indexB], (data[indexB] = data[indexA])][0];\n};\n","export default (fieldValues: T[], index: number, value: any) => {\n fieldValues[index] = value;\n return fieldValues;\n};\n","import * as React from 'react';\n\nimport focusFieldBy from './logic/focusFieldBy';\nimport getFocusFieldName from './logic/getFocusFieldName';\nimport mapCurrentIds from './logic/mapCurrentIds';\nimport mapIds from './logic/mapId';\nimport appendAt from './utils/append';\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 updateAt from './utils/update';\nimport {\n FieldArray,\n FieldArrayMethodProps,\n FieldArrayPath,\n FieldArrayWithId,\n FieldPath,\n FieldValues,\n UseFieldArrayProps,\n UseFieldArrayReturn,\n} from './types';\nimport { useFormContext } from './useFormContext';\n\nexport const useFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n TFieldArrayName extends FieldArrayPath = FieldArrayPath,\n TKeyName extends string = 'id',\n>(\n props: UseFieldArrayProps,\n): UseFieldArrayReturn => {\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>[]\n >(mapIds(control._getFieldArrayValue(name), keyName));\n const _fieldIds = React.useRef(fields);\n\n _fieldIds.current = fields;\n control._names.array.add(name);\n\n const append = (\n value:\n | Partial>\n | Partial>[],\n options?: FieldArrayMethodProps,\n ) => {\n const appendValue = convertToArrayPayload(value);\n const updatedFieldArrayValuesWithKey = appendAt(\n mapCurrentIds(control._getFieldArrayValue(name), _fieldIds, keyName),\n mapIds(convertToArrayPayload(value), keyName),\n );\n setFields(updatedFieldArrayValuesWithKey);\n control._updateFieldArray(\n keyName,\n name,\n appendAt,\n {\n argA: fillEmptyArray(value),\n },\n updatedFieldArrayValuesWithKey,\n );\n\n control._names.focus = getFocusFieldName(\n name,\n updatedFieldArrayValuesWithKey.length - appendValue.length,\n options,\n );\n };\n\n const prepend = (\n value:\n | Partial>\n | Partial>[],\n options?: FieldArrayMethodProps,\n ) => {\n const updatedFieldArrayValuesWithKey = prependAt(\n mapCurrentIds(control._getFieldArrayValue(name), _fieldIds, keyName),\n mapIds(convertToArrayPayload(value), keyName),\n );\n setFields(updatedFieldArrayValuesWithKey);\n control._updateFieldArray(\n keyName,\n name,\n prependAt,\n {\n argA: fillEmptyArray(value),\n },\n updatedFieldArrayValuesWithKey,\n );\n\n control._names.focus = getFocusFieldName(name, 0, options);\n };\n\n const remove = (index?: number | number[]) => {\n const updatedFieldArrayValuesWithKey: Partial<\n FieldArrayWithId\n >[] = removeArrayAt(\n mapCurrentIds(control._getFieldArrayValue(name), _fieldIds, keyName),\n index,\n );\n setFields(updatedFieldArrayValuesWithKey);\n control._updateFieldArray(\n keyName,\n name,\n removeArrayAt,\n {\n argA: index,\n },\n updatedFieldArrayValuesWithKey,\n );\n };\n\n const insert = (\n index: number,\n value:\n | Partial>\n | Partial>[],\n options?: FieldArrayMethodProps,\n ) => {\n const updatedFieldArrayValuesWithKey = insertAt(\n mapCurrentIds(control._getFieldArrayValue(name), _fieldIds, keyName),\n index,\n mapIds(convertToArrayPayload(value), keyName),\n );\n setFields(updatedFieldArrayValuesWithKey);\n control._updateFieldArray(\n keyName,\n name,\n insertAt,\n {\n argA: index,\n argB: fillEmptyArray(value),\n },\n updatedFieldArrayValuesWithKey,\n );\n\n control._names.focus = getFocusFieldName(name, index, options);\n };\n\n const swap = (indexA: number, indexB: number) => {\n const updatedFieldArrayValuesWithKey = mapCurrentIds(\n control._getFieldArrayValue(name),\n _fieldIds,\n keyName,\n );\n swapArrayAt(updatedFieldArrayValuesWithKey, indexA, indexB);\n setFields(updatedFieldArrayValuesWithKey);\n control._updateFieldArray(\n keyName,\n name,\n swapArrayAt,\n {\n argA: indexA,\n argB: indexB,\n },\n updatedFieldArrayValuesWithKey,\n false,\n );\n };\n\n const move = (from: number, to: number) => {\n const updatedFieldArrayValuesWithKey = mapCurrentIds(\n control._getFieldArrayValue(name),\n _fieldIds,\n keyName,\n );\n moveArrayAt(updatedFieldArrayValuesWithKey, from, to);\n setFields(updatedFieldArrayValuesWithKey);\n control._updateFieldArray(\n keyName,\n name,\n moveArrayAt,\n {\n argA: from,\n argB: to,\n },\n updatedFieldArrayValuesWithKey,\n false,\n );\n };\n\n const update = (\n index: number,\n value: Partial>,\n ) => {\n const updatedFieldArrayValuesWithKey = mapCurrentIds(\n control._getFieldArrayValue(name),\n _fieldIds,\n keyName,\n );\n const updatedFieldArrayValues = updateAt(\n updatedFieldArrayValuesWithKey,\n index,\n value,\n );\n _fieldIds.current = mapIds(updatedFieldArrayValues, keyName);\n setFields(_fieldIds.current);\n control._updateFieldArray(\n keyName,\n name,\n updateAt,\n {\n argA: index,\n argB: value,\n },\n updatedFieldArrayValuesWithKey,\n true,\n false,\n );\n };\n\n const replace = (\n value:\n | Partial>\n | Partial>[],\n ) => {\n const values = mapIds(convertToArrayPayload(value), keyName);\n setFields(\n values as Partial<\n FieldArrayWithId\n >[],\n );\n control._updateFieldArray(\n keyName,\n name,\n () => values,\n {},\n values,\n true,\n false,\n );\n };\n\n React.useEffect(() => {\n control._isInAction = false;\n\n if (control._names.watchAll) {\n control._subjects.state.next({});\n } else {\n for (const watchField of control._names.watch) {\n if (name.startsWith(watchField)) {\n control._subjects.state.next({});\n break;\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, keyName]);\n\n React.useEffect(() => {\n const fieldArraySubscription = control._subjects.array.subscribe({\n next({ values, name: fieldArrayName }) {\n if (fieldArrayName === name || !fieldArrayName) {\n setFields(mapIds(get(values, name), keyName));\n }\n },\n });\n\n !get(control._formValues, name) && set(control._formValues, name, []);\n\n return () => {\n fieldArraySubscription.unsubscribe();\n if (control._shouldUnregister || shouldUnregister) {\n control.unregister(name as FieldPath);\n }\n };\n }, [name, control, keyName, shouldUnregister]);\n\n return {\n swap: React.useCallback(swap, [name, control, keyName]),\n move: React.useCallback(move, [name, control, keyName]),\n prepend: React.useCallback(prepend, [name, control, keyName]),\n append: React.useCallback(append, [name, control, keyName]),\n remove: React.useCallback(remove, [name, control, keyName]),\n insert: React.useCallback(insert, [name, control, keyName]),\n update: React.useCallback(update, [name, control, keyName]),\n replace: React.useCallback(replace, [name, control, keyName]),\n fields: fields as FieldArrayWithId<\n TFieldValues,\n TFieldArrayName,\n TKeyName\n >[],\n };\n};\n","import isObject from './isObject';\n\nexport default function cloneObject(data: T): T {\n let copy: any;\n const isArray = Array.isArray(data);\n\n if (data instanceof Date) {\n copy = new Date(data.getTime());\n } else if (isArray || isObject(data)) {\n copy = isArray ? [] : {};\n for (const key in data) {\n copy[key] = cloneObject(data[key]);\n }\n } else {\n return data;\n }\n\n return copy;\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 (\n isPrimitive(object1) ||\n isPrimitive(object2) ||\n isDateObject(object1) ||\n isDateObject(object2)\n ) {\n return object1 === object2;\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 (isObject(val1) || Array.isArray(val1)) &&\n (isObject(val2) || 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 Function =>\n typeof value === 'function';\n","export default (value: any): value is HTMLElement =>\n value instanceof HTMLElement;\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 { 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","export default (value: unknown): value is string => typeof value === 'string';\n","export default typeof window !== 'undefined' &&\n typeof window.HTMLElement !== 'undefined' &&\n typeof document !== 'undefined';\n","import { Ref } from '../types';\n\nimport isHTMLElement from './isHTMLElement';\n\nexport default (ref: Ref) => !isHTMLElement(ref) || !document.contains(ref);\n","import { FieldArrayWithId } from '../types';\n\nimport omit from './omit';\n\nexport default []>(\n fields: T,\n keyName: string,\n) => fields.map((field = {}) => omit(field, keyName));\n","export type Observer = {\n next: (value: T) => void;\n};\n\ntype TearDown = () => void;\n\nexport type SubjectType = {\n next: (value: T) => void;\n subscribe: (value: Observer) => {\n unsubscribe: TearDown;\n };\n};\n\nexport class Subscription {\n private tearDowns: TearDown[] = [];\n\n add(tearDown: TearDown) {\n this.tearDowns.push(tearDown);\n }\n\n unsubscribe() {\n for (const teardown of this.tearDowns) {\n teardown();\n }\n this.tearDowns = [];\n }\n}\n\nclass Subscriber implements Observer {\n closed = false;\n\n constructor(private observer: Observer, subscription: Subscription) {\n subscription.add(() => (this.closed = true));\n }\n\n next(value: T) {\n if (!this.closed) {\n this.observer.next(value);\n }\n }\n}\n\nexport default class Subject {\n observers: Observer[];\n\n constructor() {\n this.observers = [];\n }\n\n next(value: T) {\n for (const observer of this.observers) {\n observer.next(value);\n }\n }\n\n subscribe(observer: Observer) {\n const subscription = new Subscription();\n const subscriber = new Subscriber(observer, subscription);\n this.observers.push(subscriber);\n\n return subscription;\n }\n\n unsubscribe() {\n this.observers = [];\n }\n}\n","import isBoolean from './isBoolean';\nimport 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(\n (data) =>\n (isObject(data) && !isEmptyObject(data)) || isBoolean(data),\n ).length))\n ) {\n previousObjRef ? delete previousObjRef[item] : delete object[item];\n }\n\n previousObjRef = objectRef;\n }\n }\n\n return object;\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 } from '../types';\nimport isUndefined from '../utils/isUndefined';\n\nexport default (\n value: any,\n { valueAsNumber, valueAsDate, setValueAs }: Field['_f'],\n) =>\n isUndefined(value)\n ? value\n : valueAsNumber\n ? value === ''\n ? NaN\n : +value\n : valueAsDate\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 getMultipleSelectValue from './getMultipleSelectValue';\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 getMultipleSelectValue(ref.options);\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","export default (\n options: HTMLOptionElement[] | HTMLOptionsCollection,\n): string[] =>\n [...options]\n .filter(({ selected }): boolean => selected)\n .map(({ value }): string => value);\n","import {\n CriteriaMode,\n Field,\n FieldName,\n FieldRefs,\n InternalFieldName,\n} from '../types';\nimport { get } from '../utils';\nimport set from '../utils/set';\n\nexport default (\n fieldsNames: Set | InternalFieldName[],\n _fieldss: FieldRefs,\n criteriaMode?: CriteriaMode,\n shouldUseNativeValidation?: boolean | undefined,\n) => {\n const fields: Record = {};\n\n for (const name of fieldsNames) {\n const field = get(_fieldss, name) as Field;\n\n field && set(fields, name, field._f);\n }\n\n return {\n criteriaMode,\n names: [...fieldsNames] as FieldName[],\n fields,\n shouldUseNativeValidation,\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 isObject from './isObject';\nimport isPrimitive from './isPrimitive';\n\nexport function deepMerge<\n T extends Record,\n U extends Record,\n>(target: T, source: U): T & U {\n if (isPrimitive(target) || isPrimitive(source)) {\n return source;\n }\n\n for (const key in source) {\n const targetValue = target[key];\n const sourceValue = source[key];\n\n try {\n target[key] =\n (isObject(targetValue) && isObject(sourceValue)) ||\n (Array.isArray(targetValue) && Array.isArray(sourceValue))\n ? deepMerge(targetValue, sourceValue)\n : sourceValue;\n } catch {}\n }\n\n return target;\n}\n","import { get } from '../utils';\nimport deepEqual from '../utils/deepEqual';\nimport { deepMerge } from '../utils/deepMerge';\nimport isNullOrUndefined from '../utils/isNullOrUndefined';\nimport set from '../utils/set';\n\nfunction setDirtyFields<\n T extends Record[],\n U extends Record[],\n K extends Record,\n>(\n values: T,\n defaultValues: U,\n dirtyFields: Record[],\n parentNode?: K,\n parentName?: keyof K,\n) {\n let index = -1;\n\n while (++index < values.length) {\n for (const key in values[index]) {\n if (Array.isArray(values[index][key])) {\n !dirtyFields[index] && (dirtyFields[index] = {});\n dirtyFields[index][key] = [];\n setDirtyFields(\n values[index][key] as T,\n get(defaultValues[index] || {}, key, []),\n dirtyFields[index][key] as [],\n dirtyFields[index],\n key,\n );\n } else {\n !isNullOrUndefined(defaultValues) &&\n deepEqual(get(defaultValues[index] || {}, key), values[index][key])\n ? set(dirtyFields[index] || {}, key)\n : (dirtyFields[index] = {\n ...dirtyFields[index],\n [key]: true,\n });\n }\n }\n\n parentNode &&\n !dirtyFields.length &&\n delete parentNode[parentName as keyof K];\n }\n\n return dirtyFields;\n}\n\nexport default []>(\n values: T,\n defaultValues: U,\n dirtyFields: Record[],\n) =>\n deepMerge(\n setDirtyFields(values, defaultValues, dirtyFields.slice(0, values.length)),\n setDirtyFields(defaultValues, values, dirtyFields.slice(0, values.length)),\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 compact from '../utils/compact';\nimport get from '../utils/get';\nimport unset from '../utils/unset';\n\nexport default (ref: T, name: string) =>\n !compact(get(ref, name, [])).length && unset(ref, name);\n","import * as 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","export default (value: unknown): value is RegExp => value instanceof RegExp;\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 { Field, FieldError, InternalFieldErrors, Message } 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 (\n field: Field,\n inputValue: any,\n validateAllFieldCriteria: boolean,\n shouldUseNativeValidation?: boolean,\n): Promise => {\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 setCustomValidty = (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 setCustomValidty(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 (!isNaN(inputValue)) {\n const valueNumber =\n (ref as HTMLInputElement).valueAsNumber || parseFloat(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);\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 setCustomValidty(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 setCustomValidty(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 setCustomValidty(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 setCustomValidty(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 setCustomValidty(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 setCustomValidty(true);\n return error;\n};\n","import { EVENTS, VALIDATION_MODE } from '../constants';\nimport {\n BatchFieldArrayUpdate,\n ChangeHandler,\n DeepPartial,\n DelayCallback,\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 PathValue,\n Ref,\n RegisterOptions,\n ResolverResult,\n SetFieldValue,\n SetValueConfig,\n Subjects,\n UnpackNestedValue,\n UpdateValues,\n UseFormClearErrors,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormProps,\n UseFormRegister,\n UseFormRegisterReturn,\n UseFormReset,\n UseFormReturn,\n UseFormSetError,\n UseFormSetFocus,\n UseFormSetValue,\n UseFormTrigger,\n UseFormUnregister,\n UseFormWatch,\n WatchInternal,\n WatchObserver,\n} from '../types';\nimport { set } from '../utils';\nimport cloneObject from '../utils/cloneObject';\nimport compact from '../utils/compact';\nimport convertToArrayPayload from '../utils/convertToArrayPayload';\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 isObject from '../utils/isObject';\nimport isPrimitive from '../utils/isPrimitive';\nimport isRadioOrCheckboxFunction from '../utils/isRadioOrCheckbox';\nimport isString from '../utils/isString';\nimport isUndefined from '../utils/isUndefined';\nimport isWeb from '../utils/isWeb';\nimport live from '../utils/live';\nimport omit from '../utils/omit';\nimport omitKey from '../utils/omitKeys';\nimport omitKeys from '../utils/omitKeys';\nimport Subject from '../utils/Subject';\nimport unset from '../utils/unset';\n\nimport focusFieldBy from './focusFieldBy';\nimport getFieldValue from './getFieldValue';\nimport getFieldValueAs from './getFieldValueAs';\nimport getNodeParentName from './getNodeParentName';\nimport getResolverOptions from './getResolverOptions';\nimport hasValidation from './hasValidation';\nimport isNameInFieldArray from './isNameInFieldArray';\nimport setFieldArrayDirtyFields from './setFieldArrayDirtyFields';\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\nconst isWindowUndefined = typeof window === 'undefined';\n\nexport function createFormControl<\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: UseFormProps = {},\n): Omit, 'formState'> {\n let formOptions = {\n ...defaultOptions,\n ...props,\n };\n let _delayCallback: DelayCallback;\n let _formState: FormState = {\n isDirty: false,\n isValidating: false,\n dirtyFields: {} as FieldNamesMarkedBoolean,\n isSubmitted: false,\n submitCount: 0,\n touchedFields: {} as FieldNamesMarkedBoolean,\n isSubmitting: false,\n isSubmitSuccessful: false,\n isValid: false,\n errors: {} as FieldErrors,\n };\n let _fields = {};\n let _formValues = {};\n let _defaultValues = formOptions.defaultValues || {};\n let _isInAction = false;\n let _isMounted = false;\n let _timer = 0;\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 _validateCount: Record = {};\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 = {\n watch: new Subject(),\n control: new Subject(),\n array: new Subject(),\n state: new Subject(),\n };\n\n const validationMode = getValidationModes(formOptions.mode);\n const reValidateMode = getValidationModes(formOptions.reValidateMode);\n const isValidateAllFieldCriteria =\n formOptions.criteriaMode === VALIDATION_MODE.all;\n\n const debounce =\n (callback: T, wait: number) =>\n (...args: any) => {\n clearTimeout(_timer);\n _timer = window.setTimeout(() => callback(...args), wait);\n };\n\n const isFieldWatched = (name: FieldPath) =>\n _names.watchAll ||\n _names.watch.has(name) ||\n _names.watch.has((name.match(/\\w+/) || [])[0]);\n\n const updateErrorState = (name: InternalFieldName, error: FieldError) => {\n set(_formState.errors, name, error);\n\n _subjects.state.next({\n errors: _formState.errors,\n });\n };\n\n const shouldRenderBaseOnError = async (\n shouldSkipRender: boolean,\n name: InternalFieldName,\n isValid: boolean,\n error?: FieldError,\n fieldState?: {\n dirty?: FieldNamesMarkedBoolean;\n isDirty?: boolean;\n touched?: FieldNamesMarkedBoolean;\n },\n ): Promise => {\n const previousError = get(_formState.errors, name);\n const shouldUpdateValid =\n _proxyFormState.isValid && _formState.isValid !== isValid;\n\n if (props.delayError && error) {\n _delayCallback =\n _delayCallback || debounce(updateErrorState, props.delayError);\n\n _delayCallback(name, error);\n } else {\n clearTimeout(_timer);\n error\n ? set(_formState.errors, name, error)\n : unset(_formState.errors, name);\n }\n\n if (\n ((error ? !deepEqual(previousError, error) : previousError) ||\n !isEmptyObject(fieldState) ||\n shouldUpdateValid) &&\n !shouldSkipRender\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 _validateCount[name]--;\n\n if (_proxyFormState.isValidating && !_validateCount[name]) {\n _subjects.state.next({\n isValidating: false,\n });\n _validateCount = {};\n }\n };\n\n const setFieldValue = (\n name: InternalFieldName,\n value: SetFieldValue,\n options: SetValueConfig = {},\n shouldRender?: boolean,\n ) => {\n const field: Field = get(_fields, name);\n\n if (field) {\n const _f = field._f;\n\n if (_f) {\n set(_formValues, name, getFieldValueAs(value, _f));\n\n const fieldValue =\n isWeb && isHTMLElement(_f.ref) && isNullOrUndefined(value)\n ? ''\n : value;\n\n if (isFileInput(_f.ref) && !isString(fieldValue)) {\n _f.ref.files = fieldValue as FileList;\n } else if (isMultipleSelect(_f.ref)) {\n [..._f.ref.options].forEach(\n (selectRef) =>\n (selectRef.selected = (\n fieldValue as InternalFieldName[]\n ).includes(selectRef.value)),\n );\n } else if (_f.refs) {\n if (isCheckBoxInput(_f.ref)) {\n _f.refs.length > 1\n ? _f.refs.forEach(\n (checkboxRef) =>\n (checkboxRef.checked = Array.isArray(fieldValue)\n ? !!(fieldValue as []).find(\n (data: string) => data === checkboxRef.value,\n )\n : fieldValue === checkboxRef.value),\n )\n : (_f.refs[0].checked = !!fieldValue);\n } else {\n _f.refs.forEach(\n (radioRef: HTMLInputElement) =>\n (radioRef.checked = radioRef.value === fieldValue),\n );\n }\n } else {\n _f.ref.value = fieldValue;\n }\n\n if (shouldRender) {\n _subjects.control.next({\n values: getValues(),\n name,\n });\n }\n\n (options.shouldDirty || options.shouldTouch) &&\n updateTouchAndDirtyState(name, fieldValue, options.shouldTouch);\n options.shouldValidate && trigger(name as Path);\n }\n }\n };\n\n const updateTouchAndDirtyState = (\n name: InternalFieldName,\n inputValue: unknown,\n isCurrentTouched?: boolean,\n shouldRender = true,\n ): Partial<\n Pick, 'dirtyFields' | 'isDirty' | 'touchedFields'>\n > => {\n const state: Partial> & { name: string } = {\n name,\n };\n let isChanged = false;\n\n if (_proxyFormState.isDirty) {\n const previousIsDirty = _formState.isDirty;\n _formState.isDirty = _getIsDirty();\n state.isDirty = _formState.isDirty;\n isChanged = previousIsDirty !== state.isDirty;\n }\n\n if (_proxyFormState.dirtyFields && !isCurrentTouched) {\n const isPreviousFieldDirty = get(_formState.dirtyFields, name);\n const isCurrentFieldDirty = !deepEqual(\n get(_defaultValues, name),\n inputValue,\n );\n isCurrentFieldDirty\n ? set(_formState.dirtyFields as TFieldValues, name, true)\n : unset(_formState.dirtyFields, name);\n state.dirtyFields = _formState.dirtyFields;\n isChanged =\n isChanged || isPreviousFieldDirty !== get(_formState.dirtyFields, name);\n }\n\n const isPreviousFieldTouched = get(_formState.touchedFields, name);\n\n if (isCurrentTouched && !isPreviousFieldTouched) {\n set(_formState.touchedFields as TFieldValues, name, isCurrentTouched);\n state.touchedFields = _formState.touchedFields;\n isChanged =\n isChanged ||\n (_proxyFormState.touchedFields &&\n isPreviousFieldTouched !== isCurrentTouched);\n }\n\n isChanged && shouldRender && _subjects.state.next(state);\n\n return isChanged ? state : {};\n };\n\n const executeResolver = async (name?: InternalFieldName[]) => {\n return formOptions.resolver\n ? await formOptions.resolver(\n { ..._formValues } as UnpackNestedValue,\n formOptions.context,\n getResolverOptions(\n name || _names.mount,\n _fields,\n formOptions.criteriaMode,\n formOptions.shouldUseNativeValidation,\n ),\n )\n : ({} as ResolverResult);\n };\n\n const executeResolverValidation = async (names?: InternalFieldName[]) => {\n const { errors } = await executeResolver();\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;\n }\n\n return errors;\n };\n\n const validateForm = async (\n _fields: FieldRefs,\n shouldCheckValid?: 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 = field._f;\n const fieldValue = omit(field, '_f');\n\n if (_f) {\n const fieldError = await validateField(\n field,\n get(_formValues, _f.name),\n isValidateAllFieldCriteria,\n formOptions.shouldUseNativeValidation,\n );\n\n if (fieldError[_f.name]) {\n context.valid = false;\n\n if (shouldCheckValid) {\n break;\n }\n }\n\n if (!shouldCheckValid) {\n fieldError[_f.name]\n ? set(_formState.errors, _f.name, fieldError[_f.name])\n : unset(_formState.errors, _f.name);\n }\n }\n\n fieldValue &&\n (await validateForm(fieldValue, shouldCheckValid, context));\n }\n }\n\n return context.valid;\n };\n\n const handleChange: ChangeHandler = async ({\n type,\n target,\n target: { value, name, type: inputType },\n }) => {\n const field = get(_fields, name) as Field;\n\n if (field) {\n let error;\n let isValid;\n const inputValue = inputType ? getFieldValue(field._f) : value;\n const isBlurEvent = type === EVENTS.BLUR;\n\n const shouldSkipValidation =\n (!hasValidation(field._f) &&\n !formOptions.resolver &&\n !get(_formState.errors, name) &&\n !field._f.deps) ||\n skipValidation(\n isBlurEvent,\n get(_formState.touchedFields, name),\n _formState.isSubmitted,\n reValidateMode,\n validationMode,\n );\n const isWatched = !isBlurEvent && isFieldWatched(name);\n\n set(_formValues, name, inputValue);\n\n const fieldState = updateTouchAndDirtyState(\n name,\n inputValue,\n isBlurEvent,\n false,\n );\n\n const shouldRender = !isEmptyObject(fieldState) || isWatched;\n\n !isBlurEvent &&\n _subjects.watch.next({\n name,\n type,\n });\n\n if (shouldSkipValidation) {\n return (\n shouldRender &&\n _subjects.state.next({ name, ...(isWatched ? {} : fieldState) })\n );\n }\n\n !isBlurEvent && isWatched && _subjects.state.next({});\n\n _validateCount[name] = _validateCount[name] ? +1 : 1;\n\n _proxyFormState.isValidating &&\n _subjects.state.next({\n isValidating: true,\n });\n\n if (formOptions.resolver) {\n const { errors } = await executeResolver([name]);\n error = get(errors, name);\n\n if (isCheckBoxInput(target) && !error) {\n const parentNodeName = getNodeParentName(name);\n const parentField = get(_fields, parentNodeName);\n\n if (\n Array.isArray(parentField) &&\n parentField.every(\n (field: Field) => field._f && isCheckBoxInput(field._f.ref),\n )\n ) {\n const parentError = get(errors, parentNodeName, {});\n parentError.type && (error = parentError);\n name = parentNodeName;\n }\n }\n\n isValid = isEmptyObject(errors);\n } else {\n error = (\n await validateField(\n field,\n get(_formValues, name) as Field,\n isValidateAllFieldCriteria,\n formOptions.shouldUseNativeValidation,\n )\n )[name];\n\n isValid = await _updateValid(true);\n }\n\n if (field._f.deps) {\n trigger(field._f.deps as FieldPath[]);\n }\n\n shouldRenderBaseOnError(false, name, isValid, error, fieldState);\n }\n };\n\n const _updateValidAndInputValue = (\n name: InternalFieldName,\n ref?: Ref,\n shouldSkipValueAs?: boolean,\n ) => {\n const field = get(_fields, name) as Field;\n\n if (field) {\n const fieldValue = get(_formValues, name);\n const defaultValue = isUndefined(fieldValue)\n ? get(_defaultValues, name)\n : fieldValue;\n\n if (\n isUndefined(defaultValue) ||\n (ref && (ref as HTMLInputElement).defaultChecked) ||\n shouldSkipValueAs\n ) {\n set(\n _formValues,\n name,\n shouldSkipValueAs ? defaultValue : getFieldValue(field._f),\n );\n } else {\n setFieldValue(name, defaultValue);\n }\n }\n\n _isMounted && _updateValid();\n };\n\n const _getIsDirty: GetIsDirty = (name, data) => {\n name && data && set(_formValues, name, data);\n\n return !deepEqual({ ...getValues() }, _defaultValues);\n };\n\n const _updateValid = async (skipRender?: boolean) => {\n let isValid = false;\n if (_proxyFormState.isValid) {\n isValid = formOptions.resolver\n ? isEmptyObject((await executeResolver()).errors)\n : await validateForm(_fields, true);\n\n if (!skipRender && isValid !== _formState.isValid) {\n _formState.isValid = isValid;\n _subjects.state.next({\n isValid,\n });\n }\n }\n return isValid;\n };\n\n const setValues = (\n name: FieldPath,\n value: UnpackNestedValue>>,\n options: SetValueConfig,\n ) =>\n Object.entries(value).forEach(([fieldKey, fieldValue]) => {\n const fieldName = `${name}.${fieldKey}` as Path;\n const field = get(_fields, fieldName);\n\n (_names.array.has(name) ||\n !isPrimitive(fieldValue) ||\n (field && !field._f)) &&\n !isDateObject(fieldValue)\n ? setValues(\n fieldName,\n fieldValue as SetFieldValue,\n options,\n )\n : setFieldValue(\n fieldName,\n fieldValue as SetFieldValue,\n options,\n true,\n );\n });\n\n const _getWatch: WatchInternal = (\n fieldNames,\n defaultValue,\n isMounted,\n isGlobal,\n ) => {\n const fieldValues = {\n ...(isMounted || _isMounted\n ? _formValues\n : isUndefined(defaultValue)\n ? _defaultValues\n : isString(fieldNames)\n ? { [fieldNames]: defaultValue }\n : defaultValue),\n };\n\n if (!fieldNames) {\n isGlobal && (_names.watchAll = true);\n return fieldValues;\n }\n\n const result = [];\n\n for (const fieldName of convertToArrayPayload(fieldNames)) {\n isGlobal && _names.watch.add(fieldName as InternalFieldName);\n result.push(get(fieldValues, fieldName as InternalFieldName));\n }\n\n return Array.isArray(fieldNames) ? result : result[0];\n };\n\n const _updateValues: UpdateValues = (\n defaultValues,\n name = '',\n ): void => {\n for (const key in defaultValues) {\n const value = defaultValues[key];\n const fieldName = name + (name ? '.' : '') + key;\n const field = get(_fields, fieldName);\n\n if (!field || !field._f) {\n if (\n (isObject(value) && Object.keys(value).length) ||\n (Array.isArray(value) && value.length)\n ) {\n _updateValues(value, fieldName);\n } else if (!field) {\n set(_formValues, fieldName, value);\n }\n }\n }\n };\n\n const _updateFieldArray: BatchFieldArrayUpdate = (\n keyName,\n name,\n method,\n args,\n updatedFieldArrayValuesWithKey = [],\n shouldSet = true,\n shouldSetFields = true,\n ) => {\n let output;\n const updatedFieldArrayValues = omitKeys(\n updatedFieldArrayValuesWithKey,\n keyName,\n );\n _isInAction = true;\n\n if (shouldSetFields && get(_fields, name)) {\n output = method(get(_fields, name), args.argA, args.argB);\n shouldSet && set(_fields, name, output);\n }\n\n output = method(get(_formValues, name), args.argA, args.argB);\n shouldSet && set(_formValues, name, output);\n\n if (Array.isArray(get(_formState.errors, name))) {\n const output = method(get(_formState.errors, name), args.argA, args.argB);\n shouldSet && set(_formState.errors, name, output);\n unsetEmptyArray(_formState.errors, name);\n }\n\n if (_proxyFormState.touchedFields && get(_formState.touchedFields, name)) {\n const output = method(\n get(_formState.touchedFields, name),\n args.argA,\n args.argB,\n );\n shouldSet && set(_formState.touchedFields as TFieldValues, name, output);\n unsetEmptyArray(_formState.touchedFields, name);\n }\n\n if (_proxyFormState.dirtyFields || _proxyFormState.isDirty) {\n set(\n _formState.dirtyFields as TFieldValues,\n name,\n setFieldArrayDirtyFields(\n omitKey(updatedFieldArrayValues, keyName),\n get(_defaultValues, name, []),\n get(_formState.dirtyFields, name, []),\n ),\n );\n updatedFieldArrayValues &&\n set(\n _formState.dirtyFields as TFieldValues,\n name,\n setFieldArrayDirtyFields(\n omitKey(updatedFieldArrayValues, keyName),\n get(_defaultValues, name, []),\n get(_formState.dirtyFields, name, []),\n ),\n );\n unsetEmptyArray(_formState.dirtyFields, name);\n }\n\n _subjects.state.next({\n isDirty: _getIsDirty(name, omitKey(updatedFieldArrayValues, keyName)),\n dirtyFields: _formState.dirtyFields,\n errors: _formState.errors,\n isValid: _formState.isValid,\n });\n };\n\n const _getFieldArrayValue = (name: InternalFieldName) =>\n get(_isMounted ? _formValues : _defaultValues, name, []);\n\n const setValue: UseFormSetValue = (\n name,\n value,\n options = {},\n ) => {\n const field = get(_fields, name);\n const isFieldArray = _names.array.has(name);\n\n set(_formValues, name, value);\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 set(\n _formState.dirtyFields as TFieldValues,\n name,\n setFieldArrayDirtyFields(\n value,\n get(_defaultValues, name, []),\n get(_formState.dirtyFields, name, []),\n ),\n );\n\n _subjects.state.next({\n name,\n dirtyFields: _formState.dirtyFields,\n isDirty: _getIsDirty(name, value),\n });\n }\n } else {\n field && !field._f && !isNullOrUndefined(value)\n ? setValues(name, value, options)\n : setFieldValue(name, value, options, true);\n }\n\n isFieldWatched(name) && _subjects.state.next({});\n _subjects.watch.next({\n name,\n });\n };\n\n const trigger: UseFormTrigger = async (name, options = {}) => {\n const fieldNames = convertToArrayPayload(name) as InternalFieldName[];\n let isValid;\n\n _subjects.state.next({\n isValidating: true,\n });\n\n if (formOptions.resolver) {\n const schemaResult = await executeResolverValidation(\n isUndefined(name) ? name : fieldNames,\n );\n isValid = name\n ? fieldNames.every((name) => !get(schemaResult, name))\n : isEmptyObject(schemaResult);\n } else {\n if (name) {\n isValid = (\n await Promise.all(\n fieldNames.map(async (fieldName) => {\n const field = get(_fields, fieldName);\n return await validateForm(\n field._f ? { [fieldName]: field } : field,\n );\n }),\n )\n ).every(Boolean);\n\n _updateValid();\n } else {\n isValid = await validateForm(_fields);\n }\n }\n\n _subjects.state.next({\n ...(isString(name) ? { name } : {}),\n errors: _formState.errors,\n isValid,\n isValidating: false,\n });\n\n if (options.shouldFocus && !isValid) {\n focusFieldBy(\n _fields,\n (key) => get(_formState.errors, key),\n name ? fieldNames : _names.mount,\n );\n }\n\n return isValid;\n };\n\n const getValues: UseFormGetValues = (\n fieldNames?:\n | FieldPath\n | ReadonlyArray>,\n ) => {\n const values = {\n ..._defaultValues,\n ..._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 clearErrors: UseFormClearErrors = (name) => {\n name\n ? convertToArrayPayload(name).forEach((inputName) =>\n unset(_formState.errors, inputName),\n )\n : (_formState.errors = {} as FieldErrors);\n\n _subjects.state.next({\n errors: _formState.errors,\n });\n };\n\n const setError: UseFormSetError = (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 = (\n fieldName?:\n | FieldPath\n | ReadonlyArray>\n | WatchObserver,\n defaultValue?: unknown,\n ) =>\n isFunction(fieldName)\n ? _subjects.watch.subscribe({\n next: (info: any) =>\n fieldName(\n _getWatch(\n undefined,\n defaultValue as UnpackNestedValue>,\n ),\n info,\n ),\n })\n : _getWatch(\n fieldName as InternalFieldName | InternalFieldName[],\n defaultValue as UnpackNestedValue>,\n false,\n true,\n );\n\n const unregister: UseFormUnregister = (name, options = {}) => {\n for (const inputName of name ? convertToArrayPayload(name) : _names.mount) {\n _names.mount.delete(inputName);\n _names.array.delete(inputName);\n\n if (get(_fields, inputName)) {\n if (!options.keepValue) {\n unset(_fields, inputName);\n unset(_formValues, inputName);\n }\n\n !options.keepError && unset(_formState.errors, inputName);\n !options.keepDirty && unset(_formState.dirtyFields, inputName);\n !options.keepTouched && unset(_formState.touchedFields, inputName);\n !formOptions.shouldUnregister &&\n !options.keepDefaultValue &&\n unset(_defaultValues, inputName);\n }\n }\n\n _subjects.watch.next({});\n\n _subjects.state.next({\n ..._formState,\n ...(!options.keepDirty ? {} : { isDirty: _getIsDirty() }),\n });\n\n !options.keepIsValid && _updateValid();\n };\n\n const registerFieldRef = (\n name: InternalFieldName,\n fieldRef: HTMLInputElement,\n options?: RegisterOptions,\n ): ((name: InternalFieldName) => void) | void => {\n register(name as FieldPath, options);\n let field: Field = get(_fields, name);\n const ref = isUndefined(fieldRef.value)\n ? fieldRef.querySelectorAll\n ? (fieldRef.querySelectorAll('input,select,textarea')[0] as Ref) ||\n fieldRef\n : fieldRef\n : fieldRef;\n\n const isRadioOrCheckbox = isRadioOrCheckboxFunction(ref);\n\n if (\n ref === field._f.ref ||\n (isRadioOrCheckbox &&\n compact(field._f.refs || []).find((option) => option === ref))\n ) {\n return;\n }\n\n field = {\n _f: isRadioOrCheckbox\n ? {\n ...field._f,\n refs: [\n ...compact(field._f.refs || []).filter(\n (ref) => isHTMLElement(ref) && document.contains(ref),\n ),\n ref,\n ],\n ref: { type: ref.type, name },\n }\n : {\n ...field._f,\n ref,\n },\n };\n\n set(_fields, name, field);\n\n (!options || !options.disabled) && _updateValidAndInputValue(name, ref);\n };\n\n const register: UseFormRegister = (name, options = {}) => {\n const field = get(_fields, name);\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\n if (options.value) {\n set(_formValues, name, options.value);\n }\n\n if (isBoolean(options.disabled) && field) {\n set(\n _formValues,\n name,\n options.disabled\n ? undefined\n : get(_formValues, name, getFieldValue(field._f)),\n );\n }\n\n _names.mount.add(name);\n !field && _updateValidAndInputValue(name, undefined, true);\n\n return isWindowUndefined\n ? ({ name: name as InternalFieldName } as UseFormRegisterReturn)\n : {\n name,\n ...(isUndefined(options.disabled)\n ? {}\n : { disabled: options.disabled }),\n onChange: handleChange,\n onBlur: handleChange,\n ref: (ref: HTMLInputElement | null): void => {\n if (ref) {\n registerFieldRef(name, ref, options);\n } else {\n const field = get(_fields, name, {}) as Field;\n const _shouldUnregister =\n formOptions.shouldUnregister || options.shouldUnregister;\n\n if (field._f) {\n field._f.mount = false;\n }\n\n _shouldUnregister &&\n !(isNameInFieldArray(_names.array, name) && _isInAction) &&\n _names.unMount.add(name);\n }\n },\n };\n };\n\n const handleSubmit: UseFormHandleSubmit =\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 = { ..._formValues };\n\n _subjects.state.next({\n isSubmitting: true,\n });\n\n try {\n if (formOptions.resolver) {\n const { errors, values } = await executeResolver();\n _formState.errors = errors as FieldErrors;\n fieldValues = values;\n } else {\n await validateForm(_fields);\n }\n\n if (\n isEmptyObject(_formState.errors) &&\n Object.keys(_formState.errors).every((name) => get(fieldValues, name))\n ) {\n _subjects.state.next({\n errors: {} as FieldErrors,\n isSubmitting: true,\n });\n await onValid(fieldValues, e);\n } else {\n onInvalid && (await onInvalid(_formState.errors, e));\n formOptions.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 reset: UseFormReset = (\n formValues,\n keepStateOptions = {},\n ) => {\n const updatedValues = formValues || _defaultValues;\n const values = cloneObject(updatedValues);\n\n _formValues = values;\n\n if (isWeb && !keepStateOptions.keepValues) {\n for (const name of _names.mount) {\n const field = get(_fields, name);\n if (field && field._f) {\n const inputRef = Array.isArray(field._f.refs)\n ? field._f.refs[0]\n : field._f.ref;\n\n try {\n isHTMLElement(inputRef) && inputRef.closest('form')!.reset();\n break;\n } catch {}\n }\n }\n }\n\n if (!keepStateOptions.keepDefaultValues) {\n _defaultValues = { ...updatedValues };\n }\n\n if (!keepStateOptions.keepValues) {\n _fields = {};\n\n _subjects.control.next({\n values: keepStateOptions.keepDefaultValues\n ? _defaultValues\n : { ...updatedValues },\n });\n\n _subjects.watch.next({});\n\n _subjects.array.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 _subjects.state.next({\n submitCount: keepStateOptions.keepSubmitCount\n ? _formState.submitCount\n : 0,\n isDirty: keepStateOptions.keepDirty\n ? _formState.isDirty\n : keepStateOptions.keepDefaultValues\n ? deepEqual(formValues, _defaultValues)\n : false,\n isSubmitted: keepStateOptions.keepIsSubmitted\n ? _formState.isSubmitted\n : false,\n dirtyFields: keepStateOptions.keepDirty\n ? _formState.dirtyFields\n : ({} as FieldNamesMarkedBoolean),\n touchedFields: keepStateOptions.keepTouched\n ? _formState.touchedFields\n : ({} as FieldNamesMarkedBoolean),\n errors: keepStateOptions.keepErrors\n ? _formState.errors\n : ({} as FieldErrors),\n isSubmitting: false,\n isSubmitSuccessful: false,\n });\n\n _isMounted = !!keepStateOptions.keepIsValid;\n };\n\n const setFocus: UseFormSetFocus = (name) =>\n get(_fields, name)._f.ref.focus();\n\n const _removeFields = () => {\n for (const name of _names.unMount) {\n const field = get(_fields, name) as Field;\n\n field &&\n (field._f.refs ? field._f.refs.every(live) : live(field._f.ref)) &&\n unregister(name as FieldPath);\n }\n\n _names.unMount = new Set();\n };\n\n return {\n control: {\n register,\n unregister,\n _getWatch,\n _getIsDirty,\n _updateValid,\n _updateValues,\n _removeFields,\n _updateFieldArray,\n _getFieldArrayValue,\n _subjects,\n _shouldUnregister: formOptions.shouldUnregister,\n _proxyFormState,\n get _fields() {\n return _fields;\n },\n set _fields(value) {\n _fields = value;\n },\n get _formValues() {\n return _formValues;\n },\n set _formValues(value) {\n _formValues = value;\n },\n get _isMounted() {\n return _isMounted;\n },\n set _isMounted(value) {\n _isMounted = value;\n },\n get _defaultValues() {\n return _defaultValues;\n },\n set _defaultValues(value) {\n _defaultValues = value;\n },\n get _names() {\n return _names;\n },\n set _names(value) {\n _names = value;\n },\n get _isInAction() {\n return _isInAction;\n },\n set _isInAction(value) {\n _isInAction = value;\n },\n get _formState() {\n return _formState;\n },\n set _formState(value) {\n _formState = value;\n },\n _updateProps: (options) => {\n formOptions = { ...defaultOptions, ...options };\n },\n },\n trigger,\n register,\n handleSubmit,\n watch,\n setValue,\n getValues,\n reset,\n clearErrors,\n unregister,\n setError,\n setFocus,\n };\n}\n","import * as 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';\n\nexport function useForm<\n TFieldValues extends FieldValues = FieldValues,\n TContext extends object = object,\n>(\n props: UseFormProps = {},\n): UseFormReturn {\n const _formControl = React.useRef<\n UseFormReturn | undefined\n >();\n const [formState, updateFormState] = React.useState>({\n isDirty: false,\n isValidating: false,\n dirtyFields: {} as FieldNamesMarkedBoolean,\n isSubmitted: false,\n submitCount: 0,\n touchedFields: {} as FieldNamesMarkedBoolean,\n isSubmitting: false,\n isSubmitSuccessful: false,\n isValid: false,\n errors: {} as FieldErrors,\n });\n\n if (_formControl.current) {\n _formControl.current.control._updateProps(props);\n } else {\n _formControl.current = {\n ...createFormControl(props),\n formState,\n };\n }\n\n const control = _formControl.current.control;\n\n React.useEffect(() => {\n const formStateSubscription = control._subjects.state.subscribe({\n next(formState) {\n if (shouldRenderFormState(formState, control._proxyFormState, true)) {\n control._formState = {\n ...control._formState,\n ...formState,\n };\n\n updateFormState({ ...control._formState });\n }\n },\n });\n\n return () => {\n formStateSubscription.unsubscribe();\n };\n }, [control]);\n\n React.useEffect(() => {\n if (!control._isMounted) {\n control._isMounted = true;\n control._proxyFormState.isValid && control._updateValid();\n !props.shouldUnregister && control._updateValues(control._defaultValues);\n }\n control._removeFields();\n });\n\n _formControl.current.formState = getProxyFormState(\n formState,\n control._proxyFormState,\n );\n\n return _formControl.current;\n}\n","import * as React from 'react';\n\nimport convertToArrayPayload from './utils/convertToArrayPayload';\nimport isObject from './utils/isObject';\nimport isUndefined from './utils/isUndefined';\nimport {\n Control,\n DeepPartial,\n FieldPath,\n FieldPathValue,\n FieldPathValues,\n FieldValues,\n InternalFieldName,\n UnpackNestedValue,\n UseWatchProps,\n} from './types';\nimport { useFormContext } from './useFormContext';\n\nexport function useWatch<\n TFieldValues extends FieldValues = FieldValues,\n>(props: {\n defaultValue?: UnpackNestedValue>;\n control?: Control;\n disabled?: boolean;\n}): UnpackNestedValue>;\nexport function useWatch<\n TFieldValues extends FieldValues = FieldValues,\n TFieldName extends FieldPath = FieldPath,\n>(props: {\n name: TFieldName;\n defaultValue?: FieldPathValue;\n control?: Control;\n disabled?: boolean;\n}): FieldPathValue;\nexport function useWatch<\n TFieldValues extends FieldValues = FieldValues,\n TFieldNames extends FieldPath[] = FieldPath[],\n>(props: {\n name: readonly [...TFieldNames];\n defaultValue?: UnpackNestedValue>;\n control?: Control;\n disabled?: boolean;\n}): FieldPathValues;\nexport function useWatch(props?: UseWatchProps) {\n const methods = useFormContext();\n const {\n control = methods.control,\n name,\n defaultValue,\n disabled,\n } = props || {};\n const _name = React.useRef(name);\n _name.current = name;\n\n const [value, updateValue] = React.useState(\n isUndefined(defaultValue)\n ? control._getWatch(name as InternalFieldName)\n : defaultValue,\n );\n\n React.useEffect(() => {\n const watchSubscription = control._subjects.watch.subscribe({\n next: ({ name }) => {\n if (\n !_name.current ||\n !name ||\n convertToArrayPayload(_name.current).some(\n (fieldName) =>\n name &&\n fieldName &&\n (fieldName.startsWith(name as InternalFieldName) ||\n name.startsWith(fieldName as InternalFieldName)),\n )\n ) {\n const result = control._getWatch(\n _name.current as InternalFieldName,\n defaultValue as UnpackNestedValue>,\n true,\n );\n updateValue(\n isObject(result)\n ? { ...result }\n : Array.isArray(result)\n ? [...result]\n : result,\n );\n }\n },\n });\n\n disabled && watchSubscription.unsubscribe();\n\n return () => watchSubscription.unsubscribe();\n }, [disabled, control, defaultValue]);\n\n React.useEffect(() => {\n control._removeFields();\n });\n\n return value;\n}\n"],"sourceRoot":""}