{"version":3,"file":"vee-validate.esm-nLNofExN.js","sources":["../../node_modules/vee-validate/dist/vee-validate.esm.js"],"sourcesContent":["/**\n * vee-validate v4.12.6\n * (c) 2024 Abdelrahman Awad\n * @license MIT\n */\nimport { getCurrentInstance, inject, warn as warn$1, computed, toValue, ref, watch, nextTick, unref, isRef, reactive, onUnmounted, onMounted, provide, onBeforeUnmount, defineComponent, toRef, resolveDynamicComponent, h, readonly, watchEffect, shallowRef } from 'vue';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n\nfunction isCallable(fn) {\n return typeof fn === 'function';\n}\nfunction isNullOrUndefined(value) {\n return value === null || value === undefined;\n}\nconst isObject = (obj) => obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj);\nfunction isIndex(value) {\n return Number(value) >= 0;\n}\nfunction toNumber(value) {\n const n = parseFloat(value);\n return isNaN(n) ? value : n;\n}\nfunction isObjectLike(value) {\n return typeof value === 'object' && value !== null;\n}\nfunction getTag(value) {\n if (value == null) {\n return value === undefined ? '[object Undefined]' : '[object Null]';\n }\n return Object.prototype.toString.call(value);\n}\n// Reference: https://github.com/lodash/lodash/blob/master/isPlainObject.js\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || getTag(value) !== '[object Object]') {\n return false;\n }\n if (Object.getPrototypeOf(value) === null) {\n return true;\n }\n let proto = value;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(value) === proto;\n}\nfunction merge(target, source) {\n Object.keys(source).forEach(key => {\n if (isPlainObject(source[key]) && isPlainObject(target[key])) {\n if (!target[key]) {\n target[key] = {};\n }\n merge(target[key], source[key]);\n return;\n }\n target[key] = source[key];\n });\n return target;\n}\n/**\n * Constructs a path with dot paths for arrays to use brackets to be compatible with vee-validate path syntax\n */\nfunction normalizeFormPath(path) {\n const pathArr = path.split('.');\n if (!pathArr.length) {\n return '';\n }\n let fullPath = String(pathArr[0]);\n for (let i = 1; i < pathArr.length; i++) {\n if (isIndex(pathArr[i])) {\n fullPath += `[${pathArr[i]}]`;\n continue;\n }\n fullPath += `.${pathArr[i]}`;\n }\n return fullPath;\n}\n\nconst RULES = {};\n/**\n * Adds a custom validator to the list of validation rules.\n */\nfunction defineRule(id, validator) {\n // makes sure new rules are properly formatted.\n guardExtend(id, validator);\n RULES[id] = validator;\n}\n/**\n * Gets an already defined rule\n */\nfunction resolveRule(id) {\n return RULES[id];\n}\n/**\n * Guards from extension violations.\n */\nfunction guardExtend(id, validator) {\n if (isCallable(validator)) {\n return;\n }\n throw new Error(`Extension Error: The validator '${id}' must be a function.`);\n}\n\nfunction set(obj, key, val) {\n\tif (typeof val.value === 'object') val.value = klona(val.value);\n\tif (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {\n\t\tObject.defineProperty(obj, key, val);\n\t} else obj[key] = val.value;\n}\n\nfunction klona(x) {\n\tif (typeof x !== 'object') return x;\n\n\tvar i=0, k, list, tmp, str=Object.prototype.toString.call(x);\n\n\tif (str === '[object Object]') {\n\t\ttmp = Object.create(x.__proto__ || null);\n\t} else if (str === '[object Array]') {\n\t\ttmp = Array(x.length);\n\t} else if (str === '[object Set]') {\n\t\ttmp = new Set;\n\t\tx.forEach(function (val) {\n\t\t\ttmp.add(klona(val));\n\t\t});\n\t} else if (str === '[object Map]') {\n\t\ttmp = new Map;\n\t\tx.forEach(function (val, key) {\n\t\t\ttmp.set(klona(key), klona(val));\n\t\t});\n\t} else if (str === '[object Date]') {\n\t\ttmp = new Date(+x);\n\t} else if (str === '[object RegExp]') {\n\t\ttmp = new RegExp(x.source, x.flags);\n\t} else if (str === '[object DataView]') {\n\t\ttmp = new x.constructor( klona(x.buffer) );\n\t} else if (str === '[object ArrayBuffer]') {\n\t\ttmp = x.slice(0);\n\t} else if (str.slice(-6) === 'Array]') {\n\t\t// ArrayBuffer.isView(x)\n\t\t// ~> `new` bcuz `Buffer.slice` => ref\n\t\ttmp = new x.constructor(x);\n\t}\n\n\tif (tmp) {\n\t\tfor (list=Object.getOwnPropertySymbols(x); i < list.length; i++) {\n\t\t\tset(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));\n\t\t}\n\n\t\tfor (i=0, list=Object.getOwnPropertyNames(x); i < list.length; i++) {\n\t\t\tif (Object.hasOwnProperty.call(tmp, k=list[i]) && tmp[k] === x[k]) continue;\n\t\t\tset(tmp, k, Object.getOwnPropertyDescriptor(x, k));\n\t\t}\n\t}\n\n\treturn tmp || x;\n}\n\nconst FormContextKey = Symbol('vee-validate-form');\nconst FieldContextKey = Symbol('vee-validate-field-instance');\nconst IS_ABSENT = Symbol('Default empty value');\n\nconst isClient = typeof window !== 'undefined';\nfunction isLocator(value) {\n return isCallable(value) && !!value.__locatorRef;\n}\nfunction isTypedSchema(value) {\n return !!value && isCallable(value.parse) && value.__type === 'VVTypedSchema';\n}\nfunction isYupValidator(value) {\n return !!value && isCallable(value.validate);\n}\nfunction hasCheckedAttr(type) {\n return type === 'checkbox' || type === 'radio';\n}\nfunction isContainerValue(value) {\n return isObject(value) || Array.isArray(value);\n}\n/**\n * True if the value is an empty object or array\n */\nfunction isEmptyContainer(value) {\n if (Array.isArray(value)) {\n return value.length === 0;\n }\n return isObject(value) && Object.keys(value).length === 0;\n}\n/**\n * Checks if the path opted out of nested fields using `[fieldName]` syntax\n */\nfunction isNotNestedPath(path) {\n return /^\\[.+\\]$/i.test(path);\n}\n/**\n * Checks if an element is a native HTML5 multi-select input element\n */\nfunction isNativeMultiSelect(el) {\n return isNativeSelect(el) && el.multiple;\n}\n/**\n * Checks if an element is a native HTML5 select input element\n */\nfunction isNativeSelect(el) {\n return el.tagName === 'SELECT';\n}\n/**\n * Checks if a tag name with attrs object will render a native multi-select element\n */\nfunction isNativeMultiSelectNode(tag, attrs) {\n // The falsy value array is the values that Vue won't add the `multiple` prop if it has one of these values\n const hasTruthyBindingValue = ![false, null, undefined, 0].includes(attrs.multiple) && !Number.isNaN(attrs.multiple);\n return tag === 'select' && 'multiple' in attrs && hasTruthyBindingValue;\n}\n/**\n * Checks if a node should have a `:value` binding or not\n *\n * These nodes should not have a value binding\n * For files, because they are not reactive\n * For multi-selects because the value binding will reset the value\n */\nfunction shouldHaveValueBinding(tag, attrs) {\n return !isNativeMultiSelectNode(tag, attrs) && attrs.type !== 'file' && !hasCheckedAttr(attrs.type);\n}\nfunction isFormSubmitEvent(evt) {\n return isEvent(evt) && evt.target && 'submit' in evt.target;\n}\nfunction isEvent(evt) {\n if (!evt) {\n return false;\n }\n if (typeof Event !== 'undefined' && isCallable(Event) && evt instanceof Event) {\n return true;\n }\n // this is for IE and Cypress #3161\n /* istanbul ignore next */\n if (evt && evt.srcElement) {\n return true;\n }\n return false;\n}\nfunction isPropPresent(obj, prop) {\n return prop in obj && obj[prop] !== IS_ABSENT;\n}\n/**\n * Compares if two values are the same borrowed from:\n * https://github.com/epoberezkin/fast-deep-equal\n * We added a case for file matching since `Object.keys` doesn't work with Files.\n * */\nfunction isEqual(a, b) {\n if (a === b)\n return true;\n if (a && b && typeof a === 'object' && typeof b === 'object') {\n if (a.constructor !== b.constructor)\n return false;\n // eslint-disable-next-line no-var\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n // eslint-disable-next-line eqeqeq\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (!isEqual(a[i], b[i]))\n return false;\n return true;\n }\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size)\n return false;\n for (i of a.entries())\n if (!b.has(i[0]))\n return false;\n for (i of a.entries())\n if (!isEqual(i[1], b.get(i[0])))\n return false;\n return true;\n }\n // We added this part for file comparison, arguably a little naive but should work for most cases.\n // #3911\n if (isFile(a) && isFile(b)) {\n if (a.size !== b.size)\n return false;\n if (a.name !== b.name)\n return false;\n if (a.lastModified !== b.lastModified)\n return false;\n if (a.type !== b.type)\n return false;\n return true;\n }\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size)\n return false;\n for (i of a.entries())\n if (!b.has(i[0]))\n return false;\n return true;\n }\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n // eslint-disable-next-line eqeqeq\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i])\n return false;\n return true;\n }\n if (a.constructor === RegExp)\n return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf)\n return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString)\n return a.toString() === b.toString();\n keys = Object.keys(a);\n length = keys.length;\n for (i = length; i-- !== 0;) {\n // eslint-disable-next-line no-var\n var key = keys[i];\n if (!isEqual(a[key], b[key]))\n return false;\n }\n return true;\n }\n // true if both NaN, false otherwise\n // eslint-disable-next-line no-self-compare\n return a !== a && b !== b;\n}\nfunction isFile(a) {\n if (!isClient) {\n return false;\n }\n return a instanceof File;\n}\n\nfunction cleanupNonNestedPath(path) {\n if (isNotNestedPath(path)) {\n return path.replace(/\\[|\\]/gi, '');\n }\n return path;\n}\nfunction getFromPath(object, path, fallback) {\n if (!object) {\n return fallback;\n }\n if (isNotNestedPath(path)) {\n return object[cleanupNonNestedPath(path)];\n }\n const resolvedValue = (path || '')\n .split(/\\.|\\[(\\d+)\\]/)\n .filter(Boolean)\n .reduce((acc, propKey) => {\n if (isContainerValue(acc) && propKey in acc) {\n return acc[propKey];\n }\n return fallback;\n }, object);\n return resolvedValue;\n}\n/**\n * Sets a nested property value in a path, creates the path properties if it doesn't exist\n */\nfunction setInPath(object, path, value) {\n if (isNotNestedPath(path)) {\n object[cleanupNonNestedPath(path)] = value;\n return;\n }\n const keys = path.split(/\\.|\\[(\\d+)\\]/).filter(Boolean);\n let acc = object;\n for (let i = 0; i < keys.length; i++) {\n // Last key, set it\n if (i === keys.length - 1) {\n acc[keys[i]] = value;\n return;\n }\n // Key does not exist, create a container for it\n if (!(keys[i] in acc) || isNullOrUndefined(acc[keys[i]])) {\n // container can be either an object or an array depending on the next key if it exists\n acc[keys[i]] = isIndex(keys[i + 1]) ? [] : {};\n }\n acc = acc[keys[i]];\n }\n}\nfunction unset(object, key) {\n if (Array.isArray(object) && isIndex(key)) {\n object.splice(Number(key), 1);\n return;\n }\n if (isObject(object)) {\n delete object[key];\n }\n}\n/**\n * Removes a nested property from object\n */\nfunction unsetPath(object, path) {\n if (isNotNestedPath(path)) {\n delete object[cleanupNonNestedPath(path)];\n return;\n }\n const keys = path.split(/\\.|\\[(\\d+)\\]/).filter(Boolean);\n let acc = object;\n for (let i = 0; i < keys.length; i++) {\n // Last key, unset it\n if (i === keys.length - 1) {\n unset(acc, keys[i]);\n break;\n }\n // Key does not exist, exit\n if (!(keys[i] in acc) || isNullOrUndefined(acc[keys[i]])) {\n break;\n }\n acc = acc[keys[i]];\n }\n const pathValues = keys.map((_, idx) => {\n return getFromPath(object, keys.slice(0, idx).join('.'));\n });\n for (let i = pathValues.length - 1; i >= 0; i--) {\n if (!isEmptyContainer(pathValues[i])) {\n continue;\n }\n if (i === 0) {\n unset(object, keys[0]);\n continue;\n }\n unset(pathValues[i - 1], keys[i - 1]);\n }\n}\n/**\n * A typed version of Object.keys\n */\nfunction keysOf(record) {\n return Object.keys(record);\n}\n// Uses same component provide as its own injections\n// Due to changes in https://github.com/vuejs/vue-next/pull/2424\nfunction injectWithSelf(symbol, def = undefined) {\n const vm = getCurrentInstance();\n return (vm === null || vm === void 0 ? void 0 : vm.provides[symbol]) || inject(symbol, def);\n}\nfunction warn(message) {\n warn$1(`[vee-validate]: ${message}`);\n}\nfunction resolveNextCheckboxValue(currentValue, checkedValue, uncheckedValue) {\n if (Array.isArray(currentValue)) {\n const newVal = [...currentValue];\n // Use isEqual since checked object values can possibly fail the equality check #3883\n const idx = newVal.findIndex(v => isEqual(v, checkedValue));\n idx >= 0 ? newVal.splice(idx, 1) : newVal.push(checkedValue);\n return newVal;\n }\n return isEqual(currentValue, checkedValue) ? uncheckedValue : checkedValue;\n}\n/**\n * Creates a throttled function that only invokes the provided function (`func`) at most once per within a given number of milliseconds\n * (`limit`)\n */\nfunction throttle(func, limit) {\n let inThrottle;\n let lastResult;\n return function (...args) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const context = this;\n if (!inThrottle) {\n inThrottle = true;\n setTimeout(() => (inThrottle = false), limit);\n lastResult = func.apply(context, args);\n }\n return lastResult;\n };\n}\nfunction debounceAsync(inner, ms = 0) {\n let timer = null;\n let resolves = [];\n return function (...args) {\n // Run the function after a certain amount of time\n if (timer) {\n clearTimeout(timer);\n }\n // @ts-expect-error timer is a number\n timer = setTimeout(() => {\n // Get the result of the inner function, then apply it to the resolve function of\n // each promise that has been created since the last time the inner function was run\n const result = inner(...args);\n resolves.forEach(r => r(result));\n resolves = [];\n }, ms);\n return new Promise(resolve => resolves.push(resolve));\n };\n}\nfunction applyModelModifiers(value, modifiers) {\n if (!isObject(modifiers)) {\n return value;\n }\n if (modifiers.number) {\n return toNumber(value);\n }\n return value;\n}\nfunction withLatest(fn, onDone) {\n let latestRun;\n return async function runLatest(...args) {\n const pending = fn(...args);\n latestRun = pending;\n const result = await pending;\n if (pending !== latestRun) {\n return result;\n }\n latestRun = undefined;\n return onDone(result, args);\n };\n}\nfunction computedDeep({ get, set }) {\n const baseRef = ref(klona(get()));\n watch(get, newValue => {\n if (isEqual(newValue, baseRef.value)) {\n return;\n }\n baseRef.value = klona(newValue);\n }, {\n deep: true,\n });\n watch(baseRef, newValue => {\n if (isEqual(newValue, get())) {\n return;\n }\n set(klona(newValue));\n }, {\n deep: true,\n });\n return baseRef;\n}\nfunction normalizeErrorItem(message) {\n return Array.isArray(message) ? message : message ? [message] : [];\n}\nfunction resolveFieldOrPathState(path) {\n const form = injectWithSelf(FormContextKey);\n const state = path ? computed(() => form === null || form === void 0 ? void 0 : form.getPathState(toValue(path))) : undefined;\n const field = path ? undefined : inject(FieldContextKey);\n if (!field && !(state === null || state === void 0 ? void 0 : state.value)) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`field with name ${toValue(path)} was not found`);\n }\n }\n return state || field;\n}\nfunction omit(obj, keys) {\n const target = {};\n for (const key in obj) {\n if (!keys.includes(key)) {\n target[key] = obj[key];\n }\n }\n return target;\n}\nfunction debounceNextTick(inner) {\n let lastTick = null;\n let resolves = [];\n return function (...args) {\n // Run the function after a certain amount of time\n const thisTick = nextTick(() => {\n if (lastTick !== thisTick) {\n return;\n }\n // Get the result of the inner function, then apply it to the resolve function of\n // each promise that has been created since the last time the inner function was run\n const result = inner(...args);\n resolves.forEach(r => r(result));\n resolves = [];\n lastTick = null;\n });\n lastTick = thisTick;\n return new Promise(resolve => resolves.push(resolve));\n };\n}\n\nfunction normalizeChildren(tag, context, slotProps) {\n if (!context.slots.default) {\n return context.slots.default;\n }\n if (typeof tag === 'string' || !tag) {\n return context.slots.default(slotProps());\n }\n return {\n default: () => { var _a, _b; return (_b = (_a = context.slots).default) === null || _b === void 0 ? void 0 : _b.call(_a, slotProps()); },\n };\n}\n/**\n * Vue adds a `_value` prop at the moment on the input elements to store the REAL value on them, real values are different than the `value` attribute\n * as they do not get casted to strings unlike `el.value` which preserves user-code behavior\n */\nfunction getBoundValue(el) {\n if (hasValueBinding(el)) {\n return el._value;\n }\n return undefined;\n}\n/**\n * Vue adds a `_value` prop at the moment on the input elements to store the REAL value on them, real values are different than the `value` attribute\n * as they do not get casted to strings unlike `el.value` which preserves user-code behavior\n */\nfunction hasValueBinding(el) {\n return '_value' in el;\n}\n\nfunction parseInputValue(el) {\n if (el.type === 'number') {\n return Number.isNaN(el.valueAsNumber) ? el.value : el.valueAsNumber;\n }\n if (el.type === 'range') {\n return Number.isNaN(el.valueAsNumber) ? el.value : el.valueAsNumber;\n }\n return el.value;\n}\nfunction normalizeEventValue(value) {\n if (!isEvent(value)) {\n return value;\n }\n const input = value.target;\n // Vue sets the current bound value on `_value` prop\n // for checkboxes it it should fetch the value binding type as is (boolean instead of string)\n if (hasCheckedAttr(input.type) && hasValueBinding(input)) {\n return getBoundValue(input);\n }\n if (input.type === 'file' && input.files) {\n const files = Array.from(input.files);\n return input.multiple ? files : files[0];\n }\n if (isNativeMultiSelect(input)) {\n return Array.from(input.options)\n .filter(opt => opt.selected && !opt.disabled)\n .map(getBoundValue);\n }\n // makes sure we get the actual `option` bound value\n // #3440\n if (isNativeSelect(input)) {\n const selectedOption = Array.from(input.options).find(opt => opt.selected);\n return selectedOption ? getBoundValue(selectedOption) : input.value;\n }\n return parseInputValue(input);\n}\n\n/**\n * Normalizes the given rules expression.\n */\nfunction normalizeRules(rules) {\n const acc = {};\n Object.defineProperty(acc, '_$$isNormalized', {\n value: true,\n writable: false,\n enumerable: false,\n configurable: false,\n });\n if (!rules) {\n return acc;\n }\n // Object is already normalized, skip.\n if (isObject(rules) && rules._$$isNormalized) {\n return rules;\n }\n if (isObject(rules)) {\n return Object.keys(rules).reduce((prev, curr) => {\n const params = normalizeParams(rules[curr]);\n if (rules[curr] !== false) {\n prev[curr] = buildParams(params);\n }\n return prev;\n }, acc);\n }\n /* istanbul ignore if */\n if (typeof rules !== 'string') {\n return acc;\n }\n return rules.split('|').reduce((prev, rule) => {\n const parsedRule = parseRule(rule);\n if (!parsedRule.name) {\n return prev;\n }\n prev[parsedRule.name] = buildParams(parsedRule.params);\n return prev;\n }, acc);\n}\n/**\n * Normalizes a rule param.\n */\nfunction normalizeParams(params) {\n if (params === true) {\n return [];\n }\n if (Array.isArray(params)) {\n return params;\n }\n if (isObject(params)) {\n return params;\n }\n return [params];\n}\nfunction buildParams(provided) {\n const mapValueToLocator = (value) => {\n // A target param using interpolation\n if (typeof value === 'string' && value[0] === '@') {\n return createLocator(value.slice(1));\n }\n return value;\n };\n if (Array.isArray(provided)) {\n return provided.map(mapValueToLocator);\n }\n // #3073\n if (provided instanceof RegExp) {\n return [provided];\n }\n return Object.keys(provided).reduce((prev, key) => {\n prev[key] = mapValueToLocator(provided[key]);\n return prev;\n }, {});\n}\n/**\n * Parses a rule string expression.\n */\nconst parseRule = (rule) => {\n let params = [];\n const name = rule.split(':')[0];\n if (rule.includes(':')) {\n params = rule.split(':').slice(1).join(':').split(',');\n }\n return { name, params };\n};\nfunction createLocator(value) {\n const locator = (crossTable) => {\n const val = getFromPath(crossTable, value) || crossTable[value];\n return val;\n };\n locator.__locatorRef = value;\n return locator;\n}\nfunction extractLocators(params) {\n if (Array.isArray(params)) {\n return params.filter(isLocator);\n }\n return keysOf(params)\n .filter(key => isLocator(params[key]))\n .map(key => params[key]);\n}\n\nconst DEFAULT_CONFIG = {\n generateMessage: ({ field }) => `${field} is not valid.`,\n bails: true,\n validateOnBlur: true,\n validateOnChange: true,\n validateOnInput: false,\n validateOnModelUpdate: true,\n};\nlet currentConfig = Object.assign({}, DEFAULT_CONFIG);\nconst getConfig = () => currentConfig;\nconst setConfig = (newConf) => {\n currentConfig = Object.assign(Object.assign({}, currentConfig), newConf);\n};\nconst configure = setConfig;\n\n/**\n * Validates a value against the rules.\n */\nasync function validate(value, rules, options = {}) {\n const shouldBail = options === null || options === void 0 ? void 0 : options.bails;\n const field = {\n name: (options === null || options === void 0 ? void 0 : options.name) || '{field}',\n rules,\n label: options === null || options === void 0 ? void 0 : options.label,\n bails: shouldBail !== null && shouldBail !== void 0 ? shouldBail : true,\n formData: (options === null || options === void 0 ? void 0 : options.values) || {},\n };\n const result = await _validate(field, value);\n const errors = result.errors;\n return {\n errors,\n valid: !errors.length,\n };\n}\n/**\n * Starts the validation process.\n */\nasync function _validate(field, value) {\n if (isTypedSchema(field.rules) || isYupValidator(field.rules)) {\n return validateFieldWithTypedSchema(value, field.rules);\n }\n // if a generic function or chain of generic functions\n if (isCallable(field.rules) || Array.isArray(field.rules)) {\n const ctx = {\n field: field.label || field.name,\n name: field.name,\n label: field.label,\n form: field.formData,\n value,\n };\n // Normalize the pipeline\n const pipeline = Array.isArray(field.rules) ? field.rules : [field.rules];\n const length = pipeline.length;\n const errors = [];\n for (let i = 0; i < length; i++) {\n const rule = pipeline[i];\n const result = await rule(value, ctx);\n const isValid = typeof result !== 'string' && !Array.isArray(result) && result;\n if (isValid) {\n continue;\n }\n if (Array.isArray(result)) {\n errors.push(...result);\n }\n else {\n const message = typeof result === 'string' ? result : _generateFieldError(ctx);\n errors.push(message);\n }\n if (field.bails) {\n return {\n errors,\n };\n }\n }\n return {\n errors,\n };\n }\n const normalizedContext = Object.assign(Object.assign({}, field), { rules: normalizeRules(field.rules) });\n const errors = [];\n const rulesKeys = Object.keys(normalizedContext.rules);\n const length = rulesKeys.length;\n for (let i = 0; i < length; i++) {\n const rule = rulesKeys[i];\n const result = await _test(normalizedContext, value, {\n name: rule,\n params: normalizedContext.rules[rule],\n });\n if (result.error) {\n errors.push(result.error);\n if (field.bails) {\n return {\n errors,\n };\n }\n }\n }\n return {\n errors,\n };\n}\nfunction isYupError(err) {\n return !!err && err.name === 'ValidationError';\n}\nfunction yupToTypedSchema(yupSchema) {\n const schema = {\n __type: 'VVTypedSchema',\n async parse(values) {\n var _a;\n try {\n const output = await yupSchema.validate(values, { abortEarly: false });\n return {\n output,\n errors: [],\n };\n }\n catch (err) {\n // Yup errors have a name prop one them.\n // https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string\n if (!isYupError(err)) {\n throw err;\n }\n if (!((_a = err.inner) === null || _a === void 0 ? void 0 : _a.length) && err.errors.length) {\n return { errors: [{ path: err.path, errors: err.errors }] };\n }\n const errors = err.inner.reduce((acc, curr) => {\n const path = curr.path || '';\n if (!acc[path]) {\n acc[path] = { errors: [], path };\n }\n acc[path].errors.push(...curr.errors);\n return acc;\n }, {});\n return { errors: Object.values(errors) };\n }\n },\n };\n return schema;\n}\n/**\n * Handles yup validation\n */\nasync function validateFieldWithTypedSchema(value, schema) {\n const typedSchema = isTypedSchema(schema) ? schema : yupToTypedSchema(schema);\n const result = await typedSchema.parse(value);\n const messages = [];\n for (const error of result.errors) {\n if (error.errors.length) {\n messages.push(...error.errors);\n }\n }\n return {\n errors: messages,\n };\n}\n/**\n * Tests a single input value against a rule.\n */\nasync function _test(field, value, rule) {\n const validator = resolveRule(rule.name);\n if (!validator) {\n throw new Error(`No such validator '${rule.name}' exists.`);\n }\n const params = fillTargetValues(rule.params, field.formData);\n const ctx = {\n field: field.label || field.name,\n name: field.name,\n label: field.label,\n value,\n form: field.formData,\n rule: Object.assign(Object.assign({}, rule), { params }),\n };\n const result = await validator(value, params, ctx);\n if (typeof result === 'string') {\n return {\n error: result,\n };\n }\n return {\n error: result ? undefined : _generateFieldError(ctx),\n };\n}\n/**\n * Generates error messages.\n */\nfunction _generateFieldError(fieldCtx) {\n const message = getConfig().generateMessage;\n if (!message) {\n return 'Field is invalid';\n }\n return message(fieldCtx);\n}\nfunction fillTargetValues(params, crossTable) {\n const normalize = (value) => {\n if (isLocator(value)) {\n return value(crossTable);\n }\n return value;\n };\n if (Array.isArray(params)) {\n return params.map(normalize);\n }\n return Object.keys(params).reduce((acc, param) => {\n acc[param] = normalize(params[param]);\n return acc;\n }, {});\n}\nasync function validateTypedSchema(schema, values) {\n const typedSchema = isTypedSchema(schema) ? schema : yupToTypedSchema(schema);\n const validationResult = await typedSchema.parse(klona(values));\n const results = {};\n const errors = {};\n for (const error of validationResult.errors) {\n const messages = error.errors;\n // Fixes issue with path mapping with Yup 1.0 including quotes around array indices\n const path = (error.path || '').replace(/\\[\"(\\d+)\"\\]/g, (_, m) => {\n return `[${m}]`;\n });\n results[path] = { valid: !messages.length, errors: messages };\n if (messages.length) {\n errors[path] = messages[0];\n }\n }\n return {\n valid: !validationResult.errors.length,\n results,\n errors,\n values: validationResult.value,\n };\n}\nasync function validateObjectSchema(schema, values, opts) {\n const paths = keysOf(schema);\n const validations = paths.map(async (path) => {\n var _a, _b, _c;\n const strings = (_a = opts === null || opts === void 0 ? void 0 : opts.names) === null || _a === void 0 ? void 0 : _a[path];\n const fieldResult = await validate(getFromPath(values, path), schema[path], {\n name: (strings === null || strings === void 0 ? void 0 : strings.name) || path,\n label: strings === null || strings === void 0 ? void 0 : strings.label,\n values: values,\n bails: (_c = (_b = opts === null || opts === void 0 ? void 0 : opts.bailsMap) === null || _b === void 0 ? void 0 : _b[path]) !== null && _c !== void 0 ? _c : true,\n });\n return Object.assign(Object.assign({}, fieldResult), { path });\n });\n let isAllValid = true;\n const validationResults = await Promise.all(validations);\n const results = {};\n const errors = {};\n for (const result of validationResults) {\n results[result.path] = {\n valid: result.valid,\n errors: result.errors,\n };\n if (!result.valid) {\n isAllValid = false;\n errors[result.path] = result.errors[0];\n }\n }\n return {\n valid: isAllValid,\n results,\n errors,\n };\n}\n\nlet ID_COUNTER = 0;\nfunction useFieldState(path, init) {\n const { value, initialValue, setInitialValue } = _useFieldValue(path, init.modelValue, init.form);\n if (!init.form) {\n const { errors, setErrors } = createFieldErrors();\n const id = ID_COUNTER >= Number.MAX_SAFE_INTEGER ? 0 : ++ID_COUNTER;\n const meta = createFieldMeta(value, initialValue, errors, init.schema);\n function setState(state) {\n var _a;\n if ('value' in state) {\n value.value = state.value;\n }\n if ('errors' in state) {\n setErrors(state.errors);\n }\n if ('touched' in state) {\n meta.touched = (_a = state.touched) !== null && _a !== void 0 ? _a : meta.touched;\n }\n if ('initialValue' in state) {\n setInitialValue(state.initialValue);\n }\n }\n return {\n id,\n path,\n value,\n initialValue,\n meta,\n flags: { pendingUnmount: { [id]: false }, pendingReset: false },\n errors,\n setState,\n };\n }\n const state = init.form.createPathState(path, {\n bails: init.bails,\n label: init.label,\n type: init.type,\n validate: init.validate,\n schema: init.schema,\n });\n const errors = computed(() => state.errors);\n function setState(state) {\n var _a, _b, _c;\n if ('value' in state) {\n value.value = state.value;\n }\n if ('errors' in state) {\n (_a = init.form) === null || _a === void 0 ? void 0 : _a.setFieldError(unref(path), state.errors);\n }\n if ('touched' in state) {\n (_b = init.form) === null || _b === void 0 ? void 0 : _b.setFieldTouched(unref(path), (_c = state.touched) !== null && _c !== void 0 ? _c : false);\n }\n if ('initialValue' in state) {\n setInitialValue(state.initialValue);\n }\n }\n return {\n id: Array.isArray(state.id) ? state.id[state.id.length - 1] : state.id,\n path,\n value,\n errors,\n meta: state,\n initialValue,\n flags: state.__flags,\n setState,\n };\n}\n/**\n * Creates the field value and resolves the initial value\n */\nfunction _useFieldValue(path, modelValue, form) {\n const modelRef = ref(unref(modelValue));\n function resolveInitialValue() {\n if (!form) {\n return unref(modelRef);\n }\n return getFromPath(form.initialValues.value, unref(path), unref(modelRef));\n }\n function setInitialValue(value) {\n if (!form) {\n modelRef.value = value;\n return;\n }\n form.setFieldInitialValue(unref(path), value, true);\n }\n const initialValue = computed(resolveInitialValue);\n // if no form is associated, use a regular ref.\n if (!form) {\n const value = ref(resolveInitialValue());\n return {\n value,\n initialValue,\n setInitialValue,\n };\n }\n // to set the initial value, first check if there is a current value, if there is then use it.\n // otherwise use the configured initial value if it exists.\n // prioritize model value over form values\n // #3429\n const currentValue = resolveModelValue(modelValue, form, initialValue, path);\n form.stageInitialValue(unref(path), currentValue, true);\n // otherwise use a computed setter that triggers the `setFieldValue`\n const value = computed({\n get() {\n return getFromPath(form.values, unref(path));\n },\n set(newVal) {\n form.setFieldValue(unref(path), newVal, false);\n },\n });\n return {\n value,\n initialValue,\n setInitialValue,\n };\n}\n/*\n to set the initial value, first check if there is a current value, if there is then use it.\n otherwise use the configured initial value if it exists.\n prioritize model value over form values\n #3429\n*/\nfunction resolveModelValue(modelValue, form, initialValue, path) {\n if (isRef(modelValue)) {\n return unref(modelValue);\n }\n if (modelValue !== undefined) {\n return modelValue;\n }\n return getFromPath(form.values, unref(path), unref(initialValue));\n}\n/**\n * Creates meta flags state and some associated effects with them\n */\nfunction createFieldMeta(currentValue, initialValue, errors, schema) {\n var _a, _b;\n const isRequired = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.describe) === null || _a === void 0 ? void 0 : _a.call(schema).required) !== null && _b !== void 0 ? _b : false;\n const meta = reactive({\n touched: false,\n pending: false,\n valid: true,\n required: isRequired,\n validated: !!unref(errors).length,\n initialValue: computed(() => unref(initialValue)),\n dirty: computed(() => {\n return !isEqual(unref(currentValue), unref(initialValue));\n }),\n });\n watch(errors, value => {\n meta.valid = !value.length;\n }, {\n immediate: true,\n flush: 'sync',\n });\n return meta;\n}\n/**\n * Creates the error message state for the field state\n */\nfunction createFieldErrors() {\n const errors = ref([]);\n return {\n errors,\n setErrors: (messages) => {\n errors.value = normalizeErrorItem(messages);\n },\n };\n}\n\nfunction installDevtoolsPlugin(app) {\n if ((process.env.NODE_ENV !== 'production')) {\n setupDevtoolsPlugin({\n id: 'vee-validate-devtools-plugin',\n label: 'VeeValidate Plugin',\n packageName: 'vee-validate',\n homepage: 'https://vee-validate.logaretm.com/v4',\n app,\n logo: 'https://vee-validate.logaretm.com/v4/logo.png',\n }, setupApiHooks);\n }\n}\nconst DEVTOOLS_FORMS = {};\nconst DEVTOOLS_FIELDS = {};\nlet API;\nconst refreshInspector = throttle(() => {\n setTimeout(async () => {\n await nextTick();\n API === null || API === void 0 ? void 0 : API.sendInspectorState(INSPECTOR_ID);\n API === null || API === void 0 ? void 0 : API.sendInspectorTree(INSPECTOR_ID);\n }, 100);\n}, 100);\nfunction registerFormWithDevTools(form) {\n const vm = getCurrentInstance();\n if (!API) {\n const app = vm === null || vm === void 0 ? void 0 : vm.appContext.app;\n if (!app) {\n return;\n }\n installDevtoolsPlugin(app);\n }\n DEVTOOLS_FORMS[form.formId] = Object.assign({}, form);\n DEVTOOLS_FORMS[form.formId]._vm = vm;\n onUnmounted(() => {\n delete DEVTOOLS_FORMS[form.formId];\n refreshInspector();\n });\n refreshInspector();\n}\nfunction registerSingleFieldWithDevtools(field) {\n const vm = getCurrentInstance();\n if (!API) {\n const app = vm === null || vm === void 0 ? void 0 : vm.appContext.app;\n if (!app) {\n return;\n }\n installDevtoolsPlugin(app);\n }\n DEVTOOLS_FIELDS[field.id] = Object.assign({}, field);\n DEVTOOLS_FIELDS[field.id]._vm = vm;\n onUnmounted(() => {\n delete DEVTOOLS_FIELDS[field.id];\n refreshInspector();\n });\n refreshInspector();\n}\nconst INSPECTOR_ID = 'vee-validate-inspector';\nconst COLORS = {\n error: 0xbd4b4b,\n success: 0x06d77b,\n unknown: 0x54436b,\n white: 0xffffff,\n black: 0x000000,\n blue: 0x035397,\n purple: 0xb980f0,\n orange: 0xf5a962,\n gray: 0xbbbfca,\n};\nlet SELECTED_NODE = null;\nfunction setupApiHooks(api) {\n API = api;\n api.addInspector({\n id: INSPECTOR_ID,\n icon: 'rule',\n label: 'vee-validate',\n noSelectionText: 'Select a vee-validate node to inspect',\n actions: [\n {\n icon: 'done_outline',\n tooltip: 'Validate selected item',\n action: async () => {\n if (!SELECTED_NODE) {\n console.error('There is not a valid selected vee-validate node or component');\n return;\n }\n if (SELECTED_NODE.type === 'field') {\n await SELECTED_NODE.field.validate();\n return;\n }\n if (SELECTED_NODE.type === 'form') {\n await SELECTED_NODE.form.validate();\n return;\n }\n if (SELECTED_NODE.type === 'pathState') {\n await SELECTED_NODE.form.validateField(SELECTED_NODE.state.path);\n }\n },\n },\n {\n icon: 'delete_sweep',\n tooltip: 'Clear validation state of the selected item',\n action: () => {\n if (!SELECTED_NODE) {\n console.error('There is not a valid selected vee-validate node or component');\n return;\n }\n if (SELECTED_NODE.type === 'field') {\n SELECTED_NODE.field.resetField();\n return;\n }\n if (SELECTED_NODE.type === 'form') {\n SELECTED_NODE.form.resetForm();\n }\n if (SELECTED_NODE.type === 'pathState') {\n SELECTED_NODE.form.resetField(SELECTED_NODE.state.path);\n }\n },\n },\n ],\n });\n api.on.getInspectorTree(payload => {\n if (payload.inspectorId !== INSPECTOR_ID) {\n return;\n }\n const forms = Object.values(DEVTOOLS_FORMS);\n const fields = Object.values(DEVTOOLS_FIELDS);\n payload.rootNodes = [\n ...forms.map(mapFormForDevtoolsInspector),\n ...fields.map(field => mapFieldForDevtoolsInspector(field)),\n ];\n });\n api.on.getInspectorState((payload, ctx) => {\n if (payload.inspectorId !== INSPECTOR_ID || ctx.currentTab !== `custom-inspector:${INSPECTOR_ID}`) {\n return;\n }\n const { form, field, state, type } = decodeNodeId(payload.nodeId);\n if (form && type === 'form') {\n payload.state = buildFormState(form);\n SELECTED_NODE = { type: 'form', form };\n return;\n }\n if (state && type === 'pathState' && form) {\n payload.state = buildFieldState(state);\n SELECTED_NODE = { type: 'pathState', state, form };\n return;\n }\n if (field && type === 'field') {\n payload.state = buildFieldState({\n errors: field.errors.value,\n dirty: field.meta.dirty,\n valid: field.meta.valid,\n touched: field.meta.touched,\n value: field.value.value,\n initialValue: field.meta.initialValue,\n });\n SELECTED_NODE = { field, type: 'field' };\n return;\n }\n SELECTED_NODE = null;\n });\n}\nfunction mapFormForDevtoolsInspector(form) {\n const { textColor, bgColor } = getValidityColors(form.meta.value.valid);\n const formTreeNodes = {};\n Object.values(form.getAllPathStates()).forEach(state => {\n setInPath(formTreeNodes, unref(state.path), mapPathForDevtoolsInspector(state, form));\n });\n function buildFormTree(tree, path = []) {\n const key = [...path].pop();\n if ('id' in tree) {\n return Object.assign(Object.assign({}, tree), { label: key || tree.label });\n }\n if (isObject(tree)) {\n return {\n id: `${path.join('.')}`,\n label: key || '',\n children: Object.keys(tree).map(key => buildFormTree(tree[key], [...path, key])),\n };\n }\n if (Array.isArray(tree)) {\n return {\n id: `${path.join('.')}`,\n label: `${key}[]`,\n children: tree.map((c, idx) => buildFormTree(c, [...path, String(idx)])),\n };\n }\n return { id: '', label: '', children: [] };\n }\n const { children } = buildFormTree(formTreeNodes);\n return {\n id: encodeNodeId(form),\n label: 'Form',\n children,\n tags: [\n {\n label: 'Form',\n textColor,\n backgroundColor: bgColor,\n },\n {\n label: `${form.getAllPathStates().length} fields`,\n textColor: COLORS.white,\n backgroundColor: COLORS.unknown,\n },\n ],\n };\n}\nfunction mapPathForDevtoolsInspector(state, form) {\n return {\n id: encodeNodeId(form, state),\n label: unref(state.path),\n tags: getFieldNodeTags(state.multiple, state.fieldsCount, state.type, state.valid, form),\n };\n}\nfunction mapFieldForDevtoolsInspector(field, form) {\n return {\n id: encodeNodeId(form, field),\n label: unref(field.name),\n tags: getFieldNodeTags(false, 1, field.type, field.meta.valid, form),\n };\n}\nfunction getFieldNodeTags(multiple, fieldsCount, type, valid, form) {\n const { textColor, bgColor } = getValidityColors(valid);\n return [\n multiple\n ? undefined\n : {\n label: 'Field',\n textColor,\n backgroundColor: bgColor,\n },\n !form\n ? {\n label: 'Standalone',\n textColor: COLORS.black,\n backgroundColor: COLORS.gray,\n }\n : undefined,\n type === 'checkbox'\n ? {\n label: 'Checkbox',\n textColor: COLORS.white,\n backgroundColor: COLORS.blue,\n }\n : undefined,\n type === 'radio'\n ? {\n label: 'Radio',\n textColor: COLORS.white,\n backgroundColor: COLORS.purple,\n }\n : undefined,\n multiple\n ? {\n label: 'Multiple',\n textColor: COLORS.black,\n backgroundColor: COLORS.orange,\n }\n : undefined,\n ].filter(Boolean);\n}\nfunction encodeNodeId(form, stateOrField) {\n const type = stateOrField ? ('path' in stateOrField ? 'pathState' : 'field') : 'form';\n const fieldPath = stateOrField ? ('path' in stateOrField ? stateOrField === null || stateOrField === void 0 ? void 0 : stateOrField.path : unref(stateOrField === null || stateOrField === void 0 ? void 0 : stateOrField.name)) : '';\n const idObject = { f: form === null || form === void 0 ? void 0 : form.formId, ff: fieldPath, type };\n return btoa(encodeURIComponent(JSON.stringify(idObject)));\n}\nfunction decodeNodeId(nodeId) {\n try {\n const idObject = JSON.parse(decodeURIComponent(atob(nodeId)));\n const form = DEVTOOLS_FORMS[idObject.f];\n if (!form && idObject.ff) {\n const field = DEVTOOLS_FIELDS[idObject.ff];\n if (!field) {\n return {};\n }\n return {\n type: idObject.type,\n field,\n };\n }\n if (!form) {\n return {};\n }\n const state = form.getPathState(idObject.ff);\n return {\n type: idObject.type,\n form,\n state,\n };\n }\n catch (err) {\n // console.error(`Devtools: [vee-validate] Failed to parse node id ${nodeId}`);\n }\n return {};\n}\nfunction buildFieldState(state) {\n return {\n 'Field state': [\n { key: 'errors', value: state.errors },\n {\n key: 'initialValue',\n value: state.initialValue,\n },\n {\n key: 'currentValue',\n value: state.value,\n },\n {\n key: 'touched',\n value: state.touched,\n },\n {\n key: 'dirty',\n value: state.dirty,\n },\n {\n key: 'valid',\n value: state.valid,\n },\n ],\n };\n}\nfunction buildFormState(form) {\n const { errorBag, meta, values, isSubmitting, isValidating, submitCount } = form;\n return {\n 'Form state': [\n {\n key: 'submitCount',\n value: submitCount.value,\n },\n {\n key: 'isSubmitting',\n value: isSubmitting.value,\n },\n {\n key: 'isValidating',\n value: isValidating.value,\n },\n {\n key: 'touched',\n value: meta.value.touched,\n },\n {\n key: 'dirty',\n value: meta.value.dirty,\n },\n {\n key: 'valid',\n value: meta.value.valid,\n },\n {\n key: 'initialValues',\n value: meta.value.initialValues,\n },\n {\n key: 'currentValues',\n value: values,\n },\n {\n key: 'errors',\n value: keysOf(errorBag.value).reduce((acc, key) => {\n var _a;\n const message = (_a = errorBag.value[key]) === null || _a === void 0 ? void 0 : _a[0];\n if (message) {\n acc[key] = message;\n }\n return acc;\n }, {}),\n },\n ],\n };\n}\n/**\n * Resolves the tag color based on the form state\n */\nfunction getValidityColors(valid) {\n return {\n bgColor: valid ? COLORS.success : COLORS.error,\n textColor: valid ? COLORS.black : COLORS.white,\n };\n}\n\n/**\n * Creates a field composite.\n */\nfunction useField(path, rules, opts) {\n if (hasCheckedAttr(opts === null || opts === void 0 ? void 0 : opts.type)) {\n return useFieldWithChecked(path, rules, opts);\n }\n return _useField(path, rules, opts);\n}\nfunction _useField(path, rules, opts) {\n const { initialValue: modelValue, validateOnMount, bails, type, checkedValue, label, validateOnValueUpdate, uncheckedValue, controlled, keepValueOnUnmount, syncVModel, form: controlForm, } = normalizeOptions(opts);\n const injectedForm = controlled ? injectWithSelf(FormContextKey) : undefined;\n const form = controlForm || injectedForm;\n const name = computed(() => normalizeFormPath(toValue(path)));\n const validator = computed(() => {\n const schema = toValue(form === null || form === void 0 ? void 0 : form.schema);\n if (schema) {\n return undefined;\n }\n const rulesValue = unref(rules);\n if (isYupValidator(rulesValue) ||\n isTypedSchema(rulesValue) ||\n isCallable(rulesValue) ||\n Array.isArray(rulesValue)) {\n return rulesValue;\n }\n return normalizeRules(rulesValue);\n });\n const { id, value, initialValue, meta, setState, errors, flags } = useFieldState(name, {\n modelValue,\n form,\n bails,\n label,\n type,\n validate: validator.value ? validate$1 : undefined,\n schema: isTypedSchema(rules) ? rules : undefined,\n });\n const errorMessage = computed(() => errors.value[0]);\n if (syncVModel) {\n useVModel({\n value,\n prop: syncVModel,\n handleChange,\n shouldValidate: () => validateOnValueUpdate && !flags.pendingReset,\n });\n }\n /**\n * Handles common onBlur meta update\n */\n const handleBlur = (evt, shouldValidate = false) => {\n meta.touched = true;\n if (shouldValidate) {\n validateWithStateMutation();\n }\n };\n async function validateCurrentValue(mode) {\n var _a, _b;\n if (form === null || form === void 0 ? void 0 : form.validateSchema) {\n const { results } = await form.validateSchema(mode);\n return (_a = results[toValue(name)]) !== null && _a !== void 0 ? _a : { valid: true, errors: [] };\n }\n if (validator.value) {\n return validate(value.value, validator.value, {\n name: toValue(name),\n label: toValue(label),\n values: (_b = form === null || form === void 0 ? void 0 : form.values) !== null && _b !== void 0 ? _b : {},\n bails,\n });\n }\n return { valid: true, errors: [] };\n }\n const validateWithStateMutation = withLatest(async () => {\n meta.pending = true;\n meta.validated = true;\n return validateCurrentValue('validated-only');\n }, result => {\n if (flags.pendingUnmount[field.id]) {\n return result;\n }\n setState({ errors: result.errors });\n meta.pending = false;\n meta.valid = result.valid;\n return result;\n });\n const validateValidStateOnly = withLatest(async () => {\n return validateCurrentValue('silent');\n }, result => {\n meta.valid = result.valid;\n return result;\n });\n function validate$1(opts) {\n if ((opts === null || opts === void 0 ? void 0 : opts.mode) === 'silent') {\n return validateValidStateOnly();\n }\n return validateWithStateMutation();\n }\n // Common input/change event handler\n function handleChange(e, shouldValidate = true) {\n const newValue = normalizeEventValue(e);\n setValue(newValue, shouldValidate);\n }\n // Runs the initial validation\n onMounted(() => {\n if (validateOnMount) {\n return validateWithStateMutation();\n }\n // validate self initially if no form was handling this\n // forms should have their own initial silent validation run to make things more efficient\n if (!form || !form.validateSchema) {\n validateValidStateOnly();\n }\n });\n function setTouched(isTouched) {\n meta.touched = isTouched;\n }\n function resetField(state) {\n var _a;\n const newValue = state && 'value' in state ? state.value : initialValue.value;\n setState({\n value: klona(newValue),\n initialValue: klona(newValue),\n touched: (_a = state === null || state === void 0 ? void 0 : state.touched) !== null && _a !== void 0 ? _a : false,\n errors: (state === null || state === void 0 ? void 0 : state.errors) || [],\n });\n meta.pending = false;\n meta.validated = false;\n validateValidStateOnly();\n }\n const vm = getCurrentInstance();\n function setValue(newValue, shouldValidate = true) {\n value.value = vm && syncVModel ? applyModelModifiers(newValue, vm.props.modelModifiers) : newValue;\n const validateFn = shouldValidate ? validateWithStateMutation : validateValidStateOnly;\n validateFn();\n }\n function setErrors(errors) {\n setState({ errors: Array.isArray(errors) ? errors : [errors] });\n }\n const valueProxy = computed({\n get() {\n return value.value;\n },\n set(newValue) {\n setValue(newValue, validateOnValueUpdate);\n },\n });\n const field = {\n id,\n name,\n label,\n value: valueProxy,\n meta,\n errors,\n errorMessage,\n type,\n checkedValue,\n uncheckedValue,\n bails,\n keepValueOnUnmount,\n resetField,\n handleReset: () => resetField(),\n validate: validate$1,\n handleChange,\n handleBlur,\n setState,\n setTouched,\n setErrors,\n setValue,\n };\n provide(FieldContextKey, field);\n if (isRef(rules) && typeof unref(rules) !== 'function') {\n watch(rules, (value, oldValue) => {\n if (isEqual(value, oldValue)) {\n return;\n }\n meta.validated ? validateWithStateMutation() : validateValidStateOnly();\n }, {\n deep: true,\n });\n }\n if ((process.env.NODE_ENV !== 'production')) {\n field._vm = getCurrentInstance();\n watch(() => (Object.assign(Object.assign({ errors: errors.value }, meta), { value: value.value })), refreshInspector, {\n deep: true,\n });\n if (!form) {\n registerSingleFieldWithDevtools(field);\n }\n }\n // if no associated form return the field API immediately\n if (!form) {\n return field;\n }\n // associate the field with the given form\n // extract cross-field dependencies in a computed prop\n const dependencies = computed(() => {\n const rulesVal = validator.value;\n // is falsy, a function schema or a yup schema\n if (!rulesVal ||\n isCallable(rulesVal) ||\n isYupValidator(rulesVal) ||\n isTypedSchema(rulesVal) ||\n Array.isArray(rulesVal)) {\n return {};\n }\n return Object.keys(rulesVal).reduce((acc, rule) => {\n const deps = extractLocators(rulesVal[rule])\n .map((dep) => dep.__locatorRef)\n .reduce((depAcc, depName) => {\n const depValue = getFromPath(form.values, depName) || form.values[depName];\n if (depValue !== undefined) {\n depAcc[depName] = depValue;\n }\n return depAcc;\n }, {});\n Object.assign(acc, deps);\n return acc;\n }, {});\n });\n // Adds a watcher that runs the validation whenever field dependencies change\n watch(dependencies, (deps, oldDeps) => {\n // Skip if no dependencies or if the field wasn't manipulated\n if (!Object.keys(deps).length) {\n return;\n }\n const shouldValidate = !isEqual(deps, oldDeps);\n if (shouldValidate) {\n meta.validated ? validateWithStateMutation() : validateValidStateOnly();\n }\n });\n onBeforeUnmount(() => {\n var _a;\n const shouldKeepValue = (_a = toValue(field.keepValueOnUnmount)) !== null && _a !== void 0 ? _a : toValue(form.keepValuesOnUnmount);\n const path = toValue(name);\n if (shouldKeepValue || !form || flags.pendingUnmount[field.id]) {\n form === null || form === void 0 ? void 0 : form.removePathState(path, id);\n return;\n }\n flags.pendingUnmount[field.id] = true;\n const pathState = form.getPathState(path);\n const matchesId = Array.isArray(pathState === null || pathState === void 0 ? void 0 : pathState.id) && (pathState === null || pathState === void 0 ? void 0 : pathState.multiple)\n ? pathState === null || pathState === void 0 ? void 0 : pathState.id.includes(field.id)\n : (pathState === null || pathState === void 0 ? void 0 : pathState.id) === field.id;\n if (!matchesId) {\n return;\n }\n if ((pathState === null || pathState === void 0 ? void 0 : pathState.multiple) && Array.isArray(pathState.value)) {\n const valueIdx = pathState.value.findIndex(i => isEqual(i, toValue(field.checkedValue)));\n if (valueIdx > -1) {\n const newVal = [...pathState.value];\n newVal.splice(valueIdx, 1);\n form.setFieldValue(path, newVal);\n }\n if (Array.isArray(pathState.id)) {\n pathState.id.splice(pathState.id.indexOf(field.id), 1);\n }\n }\n else {\n form.unsetPathValue(toValue(name));\n }\n form.removePathState(path, id);\n });\n return field;\n}\n/**\n * Normalizes partial field options to include the full options\n */\nfunction normalizeOptions(opts) {\n const defaults = () => ({\n initialValue: undefined,\n validateOnMount: false,\n bails: true,\n label: undefined,\n validateOnValueUpdate: true,\n keepValueOnUnmount: undefined,\n syncVModel: false,\n controlled: true,\n });\n const isVModelSynced = !!(opts === null || opts === void 0 ? void 0 : opts.syncVModel);\n const modelPropName = typeof (opts === null || opts === void 0 ? void 0 : opts.syncVModel) === 'string' ? opts.syncVModel : (opts === null || opts === void 0 ? void 0 : opts.modelPropName) || 'modelValue';\n const initialValue = isVModelSynced && !('initialValue' in (opts || {}))\n ? getCurrentModelValue(getCurrentInstance(), modelPropName)\n : opts === null || opts === void 0 ? void 0 : opts.initialValue;\n if (!opts) {\n return Object.assign(Object.assign({}, defaults()), { initialValue });\n }\n // TODO: Deprecate this in next major release\n const checkedValue = 'valueProp' in opts ? opts.valueProp : opts.checkedValue;\n const controlled = 'standalone' in opts ? !opts.standalone : opts.controlled;\n const syncVModel = (opts === null || opts === void 0 ? void 0 : opts.modelPropName) || (opts === null || opts === void 0 ? void 0 : opts.syncVModel) || false;\n return Object.assign(Object.assign(Object.assign({}, defaults()), (opts || {})), { initialValue, controlled: controlled !== null && controlled !== void 0 ? controlled : true, checkedValue,\n syncVModel });\n}\nfunction useFieldWithChecked(name, rules, opts) {\n const form = !(opts === null || opts === void 0 ? void 0 : opts.standalone) ? injectWithSelf(FormContextKey) : undefined;\n const checkedValue = opts === null || opts === void 0 ? void 0 : opts.checkedValue;\n const uncheckedValue = opts === null || opts === void 0 ? void 0 : opts.uncheckedValue;\n function patchCheckedApi(field) {\n const handleChange = field.handleChange;\n const checked = computed(() => {\n const currentValue = toValue(field.value);\n const checkedVal = toValue(checkedValue);\n return Array.isArray(currentValue)\n ? currentValue.findIndex(v => isEqual(v, checkedVal)) >= 0\n : isEqual(checkedVal, currentValue);\n });\n function handleCheckboxChange(e, shouldValidate = true) {\n var _a, _b;\n if (checked.value === ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.checked)) {\n if (shouldValidate) {\n field.validate();\n }\n return;\n }\n const path = toValue(name);\n const pathState = form === null || form === void 0 ? void 0 : form.getPathState(path);\n const value = normalizeEventValue(e);\n let newValue = (_b = toValue(checkedValue)) !== null && _b !== void 0 ? _b : value;\n if (form && (pathState === null || pathState === void 0 ? void 0 : pathState.multiple) && pathState.type === 'checkbox') {\n newValue = resolveNextCheckboxValue(getFromPath(form.values, path) || [], newValue, undefined);\n }\n else if ((opts === null || opts === void 0 ? void 0 : opts.type) === 'checkbox') {\n newValue = resolveNextCheckboxValue(toValue(field.value), newValue, toValue(uncheckedValue));\n }\n handleChange(newValue, shouldValidate);\n }\n return Object.assign(Object.assign({}, field), { checked,\n checkedValue,\n uncheckedValue, handleChange: handleCheckboxChange });\n }\n return patchCheckedApi(_useField(name, rules, opts));\n}\nfunction useVModel({ prop, value, handleChange, shouldValidate }) {\n const vm = getCurrentInstance();\n /* istanbul ignore next */\n if (!vm || !prop) {\n if ((process.env.NODE_ENV !== 'production')) {\n console.warn('Failed to setup model events because `useField` was not called in setup.');\n }\n return;\n }\n const propName = typeof prop === 'string' ? prop : 'modelValue';\n const emitName = `update:${propName}`;\n // Component doesn't have a model prop setup (must be defined on the props)\n if (!(propName in vm.props)) {\n return;\n }\n watch(value, newValue => {\n if (isEqual(newValue, getCurrentModelValue(vm, propName))) {\n return;\n }\n vm.emit(emitName, newValue);\n });\n watch(() => getCurrentModelValue(vm, propName), propValue => {\n if (propValue === IS_ABSENT && value.value === undefined) {\n return;\n }\n const newValue = propValue === IS_ABSENT ? undefined : propValue;\n if (isEqual(newValue, value.value)) {\n return;\n }\n handleChange(newValue, shouldValidate());\n });\n}\nfunction getCurrentModelValue(vm, propName) {\n if (!vm) {\n return undefined;\n }\n return vm.props[propName];\n}\n\nconst FieldImpl = /** #__PURE__ */ defineComponent({\n name: 'Field',\n inheritAttrs: false,\n props: {\n as: {\n type: [String, Object],\n default: undefined,\n },\n name: {\n type: String,\n required: true,\n },\n rules: {\n type: [Object, String, Function],\n default: undefined,\n },\n validateOnMount: {\n type: Boolean,\n default: false,\n },\n validateOnBlur: {\n type: Boolean,\n default: undefined,\n },\n validateOnChange: {\n type: Boolean,\n default: undefined,\n },\n validateOnInput: {\n type: Boolean,\n default: undefined,\n },\n validateOnModelUpdate: {\n type: Boolean,\n default: undefined,\n },\n bails: {\n type: Boolean,\n default: () => getConfig().bails,\n },\n label: {\n type: String,\n default: undefined,\n },\n uncheckedValue: {\n type: null,\n default: undefined,\n },\n modelValue: {\n type: null,\n default: IS_ABSENT,\n },\n modelModifiers: {\n type: null,\n default: () => ({}),\n },\n 'onUpdate:modelValue': {\n type: null,\n default: undefined,\n },\n standalone: {\n type: Boolean,\n default: false,\n },\n keepValue: {\n type: Boolean,\n default: undefined,\n },\n },\n setup(props, ctx) {\n const rules = toRef(props, 'rules');\n const name = toRef(props, 'name');\n const label = toRef(props, 'label');\n const uncheckedValue = toRef(props, 'uncheckedValue');\n const keepValue = toRef(props, 'keepValue');\n const { errors, value, errorMessage, validate: validateField, handleChange, handleBlur, setTouched, resetField, handleReset, meta, checked, setErrors, } = useField(name, rules, {\n validateOnMount: props.validateOnMount,\n bails: props.bails,\n standalone: props.standalone,\n type: ctx.attrs.type,\n initialValue: resolveInitialValue(props, ctx),\n // Only for checkboxes and radio buttons\n checkedValue: ctx.attrs.value,\n uncheckedValue,\n label,\n validateOnValueUpdate: props.validateOnModelUpdate,\n keepValueOnUnmount: keepValue,\n syncVModel: true,\n });\n // If there is a v-model applied on the component we need to emit the `update:modelValue` whenever the value binding changes\n const onChangeHandler = function handleChangeWithModel(e, shouldValidate = true) {\n handleChange(e, shouldValidate);\n };\n const sharedProps = computed(() => {\n const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = resolveValidationTriggers(props);\n function baseOnBlur(e) {\n handleBlur(e, validateOnBlur);\n if (isCallable(ctx.attrs.onBlur)) {\n ctx.attrs.onBlur(e);\n }\n }\n function baseOnInput(e) {\n onChangeHandler(e, validateOnInput);\n if (isCallable(ctx.attrs.onInput)) {\n ctx.attrs.onInput(e);\n }\n }\n function baseOnChange(e) {\n onChangeHandler(e, validateOnChange);\n if (isCallable(ctx.attrs.onChange)) {\n ctx.attrs.onChange(e);\n }\n }\n const attrs = {\n name: props.name,\n onBlur: baseOnBlur,\n onInput: baseOnInput,\n onChange: baseOnChange,\n };\n attrs['onUpdate:modelValue'] = e => onChangeHandler(e, validateOnModelUpdate);\n return attrs;\n });\n const fieldProps = computed(() => {\n const attrs = Object.assign({}, sharedProps.value);\n if (hasCheckedAttr(ctx.attrs.type) && checked) {\n attrs.checked = checked.value;\n }\n const tag = resolveTag(props, ctx);\n if (shouldHaveValueBinding(tag, ctx.attrs)) {\n attrs.value = value.value;\n }\n return attrs;\n });\n const componentProps = computed(() => {\n return Object.assign(Object.assign({}, sharedProps.value), { modelValue: value.value });\n });\n function slotProps() {\n return {\n field: fieldProps.value,\n componentField: componentProps.value,\n value: value.value,\n meta,\n errors: errors.value,\n errorMessage: errorMessage.value,\n validate: validateField,\n resetField,\n handleChange: onChangeHandler,\n handleInput: e => onChangeHandler(e, false),\n handleReset,\n handleBlur: sharedProps.value.onBlur,\n setTouched,\n setErrors,\n };\n }\n ctx.expose({\n value,\n meta,\n errors,\n errorMessage,\n setErrors,\n setTouched,\n reset: resetField,\n validate: validateField,\n handleChange,\n });\n return () => {\n const tag = resolveDynamicComponent(resolveTag(props, ctx));\n const children = normalizeChildren(tag, ctx, slotProps);\n if (tag) {\n return h(tag, Object.assign(Object.assign({}, ctx.attrs), fieldProps.value), children);\n }\n return children;\n };\n },\n});\nfunction resolveTag(props, ctx) {\n let tag = props.as || '';\n if (!props.as && !ctx.slots.default) {\n tag = 'input';\n }\n return tag;\n}\nfunction resolveValidationTriggers(props) {\n var _a, _b, _c, _d;\n const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = getConfig();\n return {\n validateOnInput: (_a = props.validateOnInput) !== null && _a !== void 0 ? _a : validateOnInput,\n validateOnChange: (_b = props.validateOnChange) !== null && _b !== void 0 ? _b : validateOnChange,\n validateOnBlur: (_c = props.validateOnBlur) !== null && _c !== void 0 ? _c : validateOnBlur,\n validateOnModelUpdate: (_d = props.validateOnModelUpdate) !== null && _d !== void 0 ? _d : validateOnModelUpdate,\n };\n}\nfunction resolveInitialValue(props, ctx) {\n // Gets the initial value either from `value` prop/attr or `v-model` binding (modelValue)\n // For checkboxes and radio buttons it will always be the model value not the `value` attribute\n if (!hasCheckedAttr(ctx.attrs.type)) {\n return isPropPresent(props, 'modelValue') ? props.modelValue : ctx.attrs.value;\n }\n return isPropPresent(props, 'modelValue') ? props.modelValue : undefined;\n}\nconst Field = FieldImpl;\n\nlet FORM_COUNTER = 0;\nconst PRIVATE_PATH_STATE_KEYS = ['bails', 'fieldsCount', 'id', 'multiple', 'type', 'validate'];\nfunction resolveInitialValues(opts) {\n const providedValues = Object.assign({}, toValue((opts === null || opts === void 0 ? void 0 : opts.initialValues) || {}));\n const schema = unref(opts === null || opts === void 0 ? void 0 : opts.validationSchema);\n if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {\n return klona(schema.cast(providedValues) || {});\n }\n return klona(providedValues);\n}\nfunction useForm(opts) {\n var _a;\n const formId = FORM_COUNTER++;\n // Prevents fields from double resetting their values, which causes checkboxes to toggle their initial value\n let FIELD_ID_COUNTER = 0;\n // If the form is currently submitting\n const isSubmitting = ref(false);\n // If the form is currently validating\n const isValidating = ref(false);\n // The number of times the user tried to submit the form\n const submitCount = ref(0);\n // field arrays managed by this form\n const fieldArrays = [];\n // a private ref for all form values\n const formValues = reactive(resolveInitialValues(opts));\n const pathStates = ref([]);\n const extraErrorsBag = ref({});\n const pathStateLookup = ref({});\n const rebuildPathLookup = debounceNextTick(() => {\n pathStateLookup.value = pathStates.value.reduce((names, state) => {\n names[normalizeFormPath(toValue(state.path))] = state;\n return names;\n }, {});\n });\n /**\n * Manually sets an error message on a specific field\n */\n function setFieldError(field, message) {\n const state = findPathState(field);\n if (!state) {\n if (typeof field === 'string') {\n extraErrorsBag.value[normalizeFormPath(field)] = normalizeErrorItem(message);\n }\n return;\n }\n // Move the error from the extras path if exists\n if (typeof field === 'string') {\n const normalizedPath = normalizeFormPath(field);\n if (extraErrorsBag.value[normalizedPath]) {\n delete extraErrorsBag.value[normalizedPath];\n }\n }\n state.errors = normalizeErrorItem(message);\n state.valid = !state.errors.length;\n }\n /**\n * Sets errors for the fields specified in the object\n */\n function setErrors(paths) {\n keysOf(paths).forEach(path => {\n setFieldError(path, paths[path]);\n });\n }\n if (opts === null || opts === void 0 ? void 0 : opts.initialErrors) {\n setErrors(opts.initialErrors);\n }\n const errorBag = computed(() => {\n const pathErrors = pathStates.value.reduce((acc, state) => {\n if (state.errors.length) {\n acc[state.path] = state.errors;\n }\n return acc;\n }, {});\n return Object.assign(Object.assign({}, extraErrorsBag.value), pathErrors);\n });\n // Gets the first error of each field\n const errors = computed(() => {\n return keysOf(errorBag.value).reduce((acc, key) => {\n const errors = errorBag.value[key];\n if (errors === null || errors === void 0 ? void 0 : errors.length) {\n acc[key] = errors[0];\n }\n return acc;\n }, {});\n });\n /**\n * Holds a computed reference to all fields names and labels\n */\n const fieldNames = computed(() => {\n return pathStates.value.reduce((names, state) => {\n names[state.path] = { name: state.path || '', label: state.label || '' };\n return names;\n }, {});\n });\n const fieldBailsMap = computed(() => {\n return pathStates.value.reduce((map, state) => {\n var _a;\n map[state.path] = (_a = state.bails) !== null && _a !== void 0 ? _a : true;\n return map;\n }, {});\n });\n // mutable non-reactive reference to initial errors\n // we need this to process initial errors then unset them\n const initialErrors = Object.assign({}, ((opts === null || opts === void 0 ? void 0 : opts.initialErrors) || {}));\n const keepValuesOnUnmount = (_a = opts === null || opts === void 0 ? void 0 : opts.keepValuesOnUnmount) !== null && _a !== void 0 ? _a : false;\n // initial form values\n const { initialValues, originalInitialValues, setInitialValues } = useFormInitialValues(pathStates, formValues, opts);\n // form meta aggregations\n const meta = useFormMeta(pathStates, formValues, originalInitialValues, errors);\n const controlledValues = computed(() => {\n return pathStates.value.reduce((acc, state) => {\n const value = getFromPath(formValues, state.path);\n setInPath(acc, state.path, value);\n return acc;\n }, {});\n });\n const schema = opts === null || opts === void 0 ? void 0 : opts.validationSchema;\n function createPathState(path, config) {\n var _a, _b;\n const initialValue = computed(() => getFromPath(initialValues.value, toValue(path)));\n const pathStateExists = pathStateLookup.value[toValue(path)];\n const isCheckboxOrRadio = (config === null || config === void 0 ? void 0 : config.type) === 'checkbox' || (config === null || config === void 0 ? void 0 : config.type) === 'radio';\n if (pathStateExists && isCheckboxOrRadio) {\n pathStateExists.multiple = true;\n const id = FIELD_ID_COUNTER++;\n if (Array.isArray(pathStateExists.id)) {\n pathStateExists.id.push(id);\n }\n else {\n pathStateExists.id = [pathStateExists.id, id];\n }\n pathStateExists.fieldsCount++;\n pathStateExists.__flags.pendingUnmount[id] = false;\n return pathStateExists;\n }\n const currentValue = computed(() => getFromPath(formValues, toValue(path)));\n const pathValue = toValue(path);\n const unsetBatchIndex = UNSET_BATCH.findIndex(_path => _path === pathValue);\n if (unsetBatchIndex !== -1) {\n UNSET_BATCH.splice(unsetBatchIndex, 1);\n }\n const isRequired = computed(() => {\n var _a, _b, _c, _d, _e, _f;\n if (isTypedSchema(schema)) {\n return (_c = (_b = (_a = schema).describe) === null || _b === void 0 ? void 0 : _b.call(_a, toValue(path)).required) !== null && _c !== void 0 ? _c : false;\n }\n // Path own schema\n if (isTypedSchema(config === null || config === void 0 ? void 0 : config.schema)) {\n return (_f = (_e = (_d = (config === null || config === void 0 ? void 0 : config.schema)).describe) === null || _e === void 0 ? void 0 : _e.call(_d).required) !== null && _f !== void 0 ? _f : false;\n }\n return false;\n });\n const id = FIELD_ID_COUNTER++;\n const state = reactive({\n id,\n path,\n touched: false,\n pending: false,\n valid: true,\n validated: !!((_a = initialErrors[pathValue]) === null || _a === void 0 ? void 0 : _a.length),\n required: isRequired,\n initialValue,\n errors: shallowRef([]),\n bails: (_b = config === null || config === void 0 ? void 0 : config.bails) !== null && _b !== void 0 ? _b : false,\n label: config === null || config === void 0 ? void 0 : config.label,\n type: (config === null || config === void 0 ? void 0 : config.type) || 'default',\n value: currentValue,\n multiple: false,\n __flags: {\n pendingUnmount: { [id]: false },\n pendingReset: false,\n },\n fieldsCount: 1,\n validate: config === null || config === void 0 ? void 0 : config.validate,\n dirty: computed(() => {\n return !isEqual(unref(currentValue), unref(initialValue));\n }),\n });\n pathStates.value.push(state);\n pathStateLookup.value[pathValue] = state;\n rebuildPathLookup();\n if (errors.value[pathValue] && !initialErrors[pathValue]) {\n nextTick(() => {\n validateField(pathValue, { mode: 'silent' });\n });\n }\n // Handles when a path changes\n if (isRef(path)) {\n watch(path, newPath => {\n rebuildPathLookup();\n const nextValue = klona(currentValue.value);\n pathStateLookup.value[newPath] = state;\n nextTick(() => {\n setInPath(formValues, newPath, nextValue);\n });\n });\n }\n return state;\n }\n /**\n * Batches validation runs in 5ms batches\n * Must have two distinct batch queues to make sure they don't override each other settings #3783\n */\n const debouncedSilentValidation = debounceAsync(_validateSchema, 5);\n const debouncedValidation = debounceAsync(_validateSchema, 5);\n const validateSchema = withLatest(async (mode) => {\n return (await (mode === 'silent'\n ? debouncedSilentValidation()\n : debouncedValidation()));\n }, (formResult, [mode]) => {\n // fields by id lookup\n // errors fields names, we need it to also check if custom errors are updated\n const currentErrorsPaths = keysOf(formCtx.errorBag.value);\n // collect all the keys from the schema and all fields\n // this ensures we have a complete key map of all the fields\n const paths = [\n ...new Set([...keysOf(formResult.results), ...pathStates.value.map(p => p.path), ...currentErrorsPaths]),\n ].sort();\n // aggregates the paths into a single result object while applying the results on the fields\n const results = paths.reduce((validation, _path) => {\n var _a;\n const expectedPath = _path;\n const pathState = findPathState(expectedPath) || findHoistedPath(expectedPath);\n const messages = ((_a = formResult.results[expectedPath]) === null || _a === void 0 ? void 0 : _a.errors) || [];\n // This is the real path of the field, because it might've been a hoisted field\n const path = (toValue(pathState === null || pathState === void 0 ? void 0 : pathState.path) || expectedPath);\n // It is possible that multiple paths are collected across loops\n // We want to merge them to avoid overriding any iteration's results\n const fieldResult = mergeValidationResults({ errors: messages, valid: !messages.length }, validation.results[path]);\n validation.results[path] = fieldResult;\n if (!fieldResult.valid) {\n validation.errors[path] = fieldResult.errors[0];\n }\n // clean up extra errors if path state exists\n if (pathState && extraErrorsBag.value[path]) {\n delete extraErrorsBag.value[path];\n }\n // field not rendered\n if (!pathState) {\n setFieldError(path, messages);\n return validation;\n }\n // always update the valid flag regardless of the mode\n pathState.valid = fieldResult.valid;\n if (mode === 'silent') {\n return validation;\n }\n if (mode === 'validated-only' && !pathState.validated) {\n return validation;\n }\n setFieldError(pathState, fieldResult.errors);\n return validation;\n }, { valid: formResult.valid, results: {}, errors: {} });\n if (formResult.values) {\n results.values = formResult.values;\n }\n keysOf(results.results).forEach(path => {\n var _a;\n const pathState = findPathState(path);\n if (!pathState) {\n return;\n }\n if (mode === 'silent') {\n return;\n }\n if (mode === 'validated-only' && !pathState.validated) {\n return;\n }\n setFieldError(pathState, (_a = results.results[path]) === null || _a === void 0 ? void 0 : _a.errors);\n });\n return results;\n });\n function mutateAllPathState(mutation) {\n pathStates.value.forEach(mutation);\n }\n function findPathState(path) {\n const normalizedPath = typeof path === 'string' ? normalizeFormPath(path) : path;\n const pathState = typeof normalizedPath === 'string' ? pathStateLookup.value[normalizedPath] : normalizedPath;\n return pathState;\n }\n function findHoistedPath(path) {\n const candidates = pathStates.value.filter(state => path.startsWith(state.path));\n return candidates.reduce((bestCandidate, candidate) => {\n if (!bestCandidate) {\n return candidate;\n }\n return (candidate.path.length > bestCandidate.path.length ? candidate : bestCandidate);\n }, undefined);\n }\n let UNSET_BATCH = [];\n let PENDING_UNSET;\n function unsetPathValue(path) {\n UNSET_BATCH.push(path);\n if (!PENDING_UNSET) {\n PENDING_UNSET = nextTick(() => {\n const sortedPaths = [...UNSET_BATCH].sort().reverse();\n sortedPaths.forEach(p => {\n unsetPath(formValues, p);\n });\n UNSET_BATCH = [];\n PENDING_UNSET = null;\n });\n }\n return PENDING_UNSET;\n }\n function makeSubmissionFactory(onlyControlled) {\n return function submitHandlerFactory(fn, onValidationError) {\n return function submissionHandler(e) {\n if (e instanceof Event) {\n e.preventDefault();\n e.stopPropagation();\n }\n // Touch all fields\n mutateAllPathState(s => (s.touched = true));\n isSubmitting.value = true;\n submitCount.value++;\n return validate()\n .then(result => {\n const values = klona(formValues);\n if (result.valid && typeof fn === 'function') {\n const controlled = klona(controlledValues.value);\n let submittedValues = (onlyControlled ? controlled : values);\n if (result.values) {\n submittedValues = result.values;\n }\n return fn(submittedValues, {\n evt: e,\n controlledValues: controlled,\n setErrors,\n setFieldError,\n setTouched,\n setFieldTouched,\n setValues,\n setFieldValue,\n resetForm,\n resetField,\n });\n }\n if (!result.valid && typeof onValidationError === 'function') {\n onValidationError({\n values,\n evt: e,\n errors: result.errors,\n results: result.results,\n });\n }\n })\n .then(returnVal => {\n isSubmitting.value = false;\n return returnVal;\n }, err => {\n isSubmitting.value = false;\n // re-throw the err so it doesn't go silent\n throw err;\n });\n };\n };\n }\n const handleSubmitImpl = makeSubmissionFactory(false);\n const handleSubmit = handleSubmitImpl;\n handleSubmit.withControlled = makeSubmissionFactory(true);\n function removePathState(path, id) {\n const idx = pathStates.value.findIndex(s => {\n return s.path === path && (Array.isArray(s.id) ? s.id.includes(id) : s.id === id);\n });\n const pathState = pathStates.value[idx];\n if (idx === -1 || !pathState) {\n return;\n }\n nextTick(() => {\n validateField(path, { mode: 'silent', warn: false });\n });\n if (pathState.multiple && pathState.fieldsCount) {\n pathState.fieldsCount--;\n }\n if (Array.isArray(pathState.id)) {\n const idIndex = pathState.id.indexOf(id);\n if (idIndex >= 0) {\n pathState.id.splice(idIndex, 1);\n }\n delete pathState.__flags.pendingUnmount[id];\n }\n if (!pathState.multiple || pathState.fieldsCount <= 0) {\n pathStates.value.splice(idx, 1);\n unsetInitialValue(path);\n rebuildPathLookup();\n delete pathStateLookup.value[path];\n }\n }\n function destroyPath(path) {\n keysOf(pathStateLookup.value).forEach(key => {\n if (key.startsWith(path)) {\n delete pathStateLookup.value[key];\n }\n });\n pathStates.value = pathStates.value.filter(s => !s.path.startsWith(path));\n nextTick(() => {\n rebuildPathLookup();\n });\n }\n const formCtx = {\n formId,\n values: formValues,\n controlledValues,\n errorBag,\n errors,\n schema,\n submitCount,\n meta,\n isSubmitting,\n isValidating,\n fieldArrays,\n keepValuesOnUnmount,\n validateSchema: unref(schema) ? validateSchema : undefined,\n validate,\n setFieldError,\n validateField,\n setFieldValue,\n setValues,\n setErrors,\n setFieldTouched,\n setTouched,\n resetForm,\n resetField,\n handleSubmit,\n useFieldModel,\n defineInputBinds,\n defineComponentBinds: defineComponentBinds,\n defineField,\n stageInitialValue,\n unsetInitialValue,\n setFieldInitialValue,\n createPathState,\n getPathState: findPathState,\n unsetPathValue,\n removePathState,\n initialValues: initialValues,\n getAllPathStates: () => pathStates.value,\n destroyPath,\n isFieldTouched,\n isFieldDirty,\n isFieldValid,\n };\n /**\n * Sets a single field value\n */\n function setFieldValue(field, value, shouldValidate = true) {\n const clonedValue = klona(value);\n const path = typeof field === 'string' ? field : field.path;\n const pathState = findPathState(path);\n if (!pathState) {\n createPathState(path);\n }\n setInPath(formValues, path, clonedValue);\n if (shouldValidate) {\n validateField(path);\n }\n }\n function forceSetValues(fields, shouldValidate = true) {\n // clean up old values\n keysOf(formValues).forEach(key => {\n delete formValues[key];\n });\n // set up new values\n keysOf(fields).forEach(path => {\n setFieldValue(path, fields[path], false);\n });\n if (shouldValidate) {\n validate();\n }\n }\n /**\n * Sets multiple fields values\n */\n function setValues(fields, shouldValidate = true) {\n merge(formValues, fields);\n // regenerate the arrays when the form values change\n fieldArrays.forEach(f => f && f.reset());\n if (shouldValidate) {\n validate();\n }\n }\n function createModel(path, shouldValidate) {\n const pathState = findPathState(toValue(path)) || createPathState(path);\n return computed({\n get() {\n return pathState.value;\n },\n set(value) {\n var _a;\n const pathValue = toValue(path);\n setFieldValue(pathValue, value, (_a = toValue(shouldValidate)) !== null && _a !== void 0 ? _a : false);\n },\n });\n }\n /**\n * Sets the touched meta state on a field\n */\n function setFieldTouched(field, isTouched) {\n const pathState = findPathState(field);\n if (pathState) {\n pathState.touched = isTouched;\n }\n }\n function isFieldTouched(field) {\n const pathState = findPathState(field);\n if (pathState) {\n return pathState.touched;\n }\n // Find all nested paths and consider their touched state\n return pathStates.value.filter(s => s.path.startsWith(field)).some(s => s.touched);\n }\n function isFieldDirty(field) {\n const pathState = findPathState(field);\n if (pathState) {\n return pathState.dirty;\n }\n return pathStates.value.filter(s => s.path.startsWith(field)).some(s => s.dirty);\n }\n function isFieldValid(field) {\n const pathState = findPathState(field);\n if (pathState) {\n return pathState.valid;\n }\n return pathStates.value.filter(s => s.path.startsWith(field)).every(s => s.valid);\n }\n /**\n * Sets the touched meta state on multiple fields\n */\n function setTouched(fields) {\n if (typeof fields === 'boolean') {\n mutateAllPathState(state => {\n state.touched = fields;\n });\n return;\n }\n keysOf(fields).forEach(field => {\n setFieldTouched(field, !!fields[field]);\n });\n }\n function resetField(field, state) {\n var _a;\n const newValue = state && 'value' in state ? state.value : getFromPath(initialValues.value, field);\n const pathState = findPathState(field);\n if (pathState) {\n pathState.__flags.pendingReset = true;\n }\n setFieldInitialValue(field, klona(newValue), true);\n setFieldValue(field, newValue, false);\n setFieldTouched(field, (_a = state === null || state === void 0 ? void 0 : state.touched) !== null && _a !== void 0 ? _a : false);\n setFieldError(field, (state === null || state === void 0 ? void 0 : state.errors) || []);\n nextTick(() => {\n if (pathState) {\n pathState.__flags.pendingReset = false;\n }\n });\n }\n /**\n * Resets all fields\n */\n function resetForm(resetState, opts) {\n let newValues = klona((resetState === null || resetState === void 0 ? void 0 : resetState.values) ? resetState.values : originalInitialValues.value);\n newValues = (opts === null || opts === void 0 ? void 0 : opts.force) ? newValues : merge(originalInitialValues.value, newValues);\n newValues = isTypedSchema(schema) && isCallable(schema.cast) ? schema.cast(newValues) : newValues;\n setInitialValues(newValues);\n mutateAllPathState(state => {\n var _a;\n state.__flags.pendingReset = true;\n state.validated = false;\n state.touched = ((_a = resetState === null || resetState === void 0 ? void 0 : resetState.touched) === null || _a === void 0 ? void 0 : _a[state.path]) || false;\n setFieldValue(state.path, getFromPath(newValues, state.path), false);\n setFieldError(state.path, undefined);\n });\n (opts === null || opts === void 0 ? void 0 : opts.force) ? forceSetValues(newValues, false) : setValues(newValues, false);\n setErrors((resetState === null || resetState === void 0 ? void 0 : resetState.errors) || {});\n submitCount.value = (resetState === null || resetState === void 0 ? void 0 : resetState.submitCount) || 0;\n nextTick(() => {\n validate({ mode: 'silent' });\n mutateAllPathState(state => {\n state.__flags.pendingReset = false;\n });\n });\n }\n async function validate(opts) {\n const mode = (opts === null || opts === void 0 ? void 0 : opts.mode) || 'force';\n if (mode === 'force') {\n mutateAllPathState(f => (f.validated = true));\n }\n if (formCtx.validateSchema) {\n return formCtx.validateSchema(mode);\n }\n isValidating.value = true;\n // No schema, each field is responsible to validate itself\n const validations = await Promise.all(pathStates.value.map(state => {\n if (!state.validate) {\n return Promise.resolve({\n key: state.path,\n valid: true,\n errors: [],\n });\n }\n return state.validate(opts).then((result) => {\n return {\n key: state.path,\n valid: result.valid,\n errors: result.errors,\n };\n });\n }));\n isValidating.value = false;\n const results = {};\n const errors = {};\n for (const validation of validations) {\n results[validation.key] = {\n valid: validation.valid,\n errors: validation.errors,\n };\n if (validation.errors.length) {\n errors[validation.key] = validation.errors[0];\n }\n }\n return {\n valid: validations.every(r => r.valid),\n results,\n errors,\n };\n }\n async function validateField(path, opts) {\n var _a;\n const state = findPathState(path);\n if (state && (opts === null || opts === void 0 ? void 0 : opts.mode) !== 'silent') {\n state.validated = true;\n }\n if (schema) {\n const { results } = await validateSchema((opts === null || opts === void 0 ? void 0 : opts.mode) || 'validated-only');\n return results[path] || { errors: [], valid: true };\n }\n if (state === null || state === void 0 ? void 0 : state.validate) {\n return state.validate(opts);\n }\n const shouldWarn = !state && ((_a = opts === null || opts === void 0 ? void 0 : opts.warn) !== null && _a !== void 0 ? _a : true);\n if (shouldWarn) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn$1(`field with path ${path} was not found`);\n }\n }\n return Promise.resolve({ errors: [], valid: true });\n }\n function unsetInitialValue(path) {\n unsetPath(initialValues.value, path);\n }\n /**\n * Sneaky function to set initial field values\n */\n function stageInitialValue(path, value, updateOriginal = false) {\n setFieldInitialValue(path, value);\n setInPath(formValues, path, value);\n if (updateOriginal && !(opts === null || opts === void 0 ? void 0 : opts.initialValues)) {\n setInPath(originalInitialValues.value, path, klona(value));\n }\n }\n function setFieldInitialValue(path, value, updateOriginal = false) {\n setInPath(initialValues.value, path, klona(value));\n if (updateOriginal) {\n setInPath(originalInitialValues.value, path, klona(value));\n }\n }\n async function _validateSchema() {\n const schemaValue = unref(schema);\n if (!schemaValue) {\n return { valid: true, results: {}, errors: {} };\n }\n isValidating.value = true;\n const formResult = isYupValidator(schemaValue) || isTypedSchema(schemaValue)\n ? await validateTypedSchema(schemaValue, formValues)\n : await validateObjectSchema(schemaValue, formValues, {\n names: fieldNames.value,\n bailsMap: fieldBailsMap.value,\n });\n isValidating.value = false;\n return formResult;\n }\n const submitForm = handleSubmit((_, { evt }) => {\n if (isFormSubmitEvent(evt)) {\n evt.target.submit();\n }\n });\n // Trigger initial validation\n onMounted(() => {\n if (opts === null || opts === void 0 ? void 0 : opts.initialErrors) {\n setErrors(opts.initialErrors);\n }\n if (opts === null || opts === void 0 ? void 0 : opts.initialTouched) {\n setTouched(opts.initialTouched);\n }\n // if validate on mount was enabled\n if (opts === null || opts === void 0 ? void 0 : opts.validateOnMount) {\n validate();\n return;\n }\n // otherwise run initial silent validation through schema if available\n // the useField should skip their own silent validation if a yup schema is present\n if (formCtx.validateSchema) {\n formCtx.validateSchema('silent');\n }\n });\n if (isRef(schema)) {\n watch(schema, () => {\n var _a;\n (_a = formCtx.validateSchema) === null || _a === void 0 ? void 0 : _a.call(formCtx, 'validated-only');\n });\n }\n // Provide injections\n provide(FormContextKey, formCtx);\n if ((process.env.NODE_ENV !== 'production')) {\n registerFormWithDevTools(formCtx);\n watch(() => (Object.assign(Object.assign({ errors: errorBag.value }, meta.value), { values: formValues, isSubmitting: isSubmitting.value, isValidating: isValidating.value, submitCount: submitCount.value })), refreshInspector, {\n deep: true,\n });\n }\n function defineField(path, config) {\n const label = isCallable(config) ? undefined : config === null || config === void 0 ? void 0 : config.label;\n const pathState = (findPathState(toValue(path)) || createPathState(path, { label }));\n const evalConfig = () => (isCallable(config) ? config(omit(pathState, PRIVATE_PATH_STATE_KEYS)) : config || {});\n function onBlur() {\n var _a;\n pathState.touched = true;\n const validateOnBlur = (_a = evalConfig().validateOnBlur) !== null && _a !== void 0 ? _a : getConfig().validateOnBlur;\n if (validateOnBlur) {\n validateField(pathState.path);\n }\n }\n function onInput() {\n var _a;\n const validateOnInput = (_a = evalConfig().validateOnInput) !== null && _a !== void 0 ? _a : getConfig().validateOnInput;\n if (validateOnInput) {\n nextTick(() => {\n validateField(pathState.path);\n });\n }\n }\n function onChange() {\n var _a;\n const validateOnChange = (_a = evalConfig().validateOnChange) !== null && _a !== void 0 ? _a : getConfig().validateOnChange;\n if (validateOnChange) {\n nextTick(() => {\n validateField(pathState.path);\n });\n }\n }\n const props = computed(() => {\n const base = {\n onChange,\n onInput,\n onBlur,\n };\n if (isCallable(config)) {\n return Object.assign(Object.assign({}, base), (config(omit(pathState, PRIVATE_PATH_STATE_KEYS)).props || {}));\n }\n if (config === null || config === void 0 ? void 0 : config.props) {\n return Object.assign(Object.assign({}, base), config.props(omit(pathState, PRIVATE_PATH_STATE_KEYS)));\n }\n return base;\n });\n const model = createModel(path, () => { var _a, _b, _c; return (_c = (_a = evalConfig().validateOnModelUpdate) !== null && _a !== void 0 ? _a : (_b = getConfig()) === null || _b === void 0 ? void 0 : _b.validateOnModelUpdate) !== null && _c !== void 0 ? _c : true; });\n return [model, props];\n }\n function useFieldModel(pathOrPaths) {\n if (!Array.isArray(pathOrPaths)) {\n return createModel(pathOrPaths);\n }\n return pathOrPaths.map(p => createModel(p, true));\n }\n /**\n * @deprecated use defineField instead\n */\n function defineInputBinds(path, config) {\n const [model, props] = defineField(path, config);\n function onBlur() {\n props.value.onBlur();\n }\n function onInput(e) {\n const value = normalizeEventValue(e);\n setFieldValue(toValue(path), value, false);\n props.value.onInput();\n }\n function onChange(e) {\n const value = normalizeEventValue(e);\n setFieldValue(toValue(path), value, false);\n props.value.onChange();\n }\n return computed(() => {\n return Object.assign(Object.assign({}, props.value), { onBlur,\n onInput,\n onChange, value: model.value });\n });\n }\n /**\n * @deprecated use defineField instead\n */\n function defineComponentBinds(path, config) {\n const [model, props] = defineField(path, config);\n const pathState = findPathState(toValue(path));\n function onUpdateModelValue(value) {\n model.value = value;\n }\n return computed(() => {\n const conf = isCallable(config) ? config(omit(pathState, PRIVATE_PATH_STATE_KEYS)) : config || {};\n return Object.assign({ [conf.model || 'modelValue']: model.value, [`onUpdate:${conf.model || 'modelValue'}`]: onUpdateModelValue }, props.value);\n });\n }\n return Object.assign(Object.assign({}, formCtx), { values: readonly(formValues), handleReset: () => resetForm(), submitForm });\n}\n/**\n * Manages form meta aggregation\n */\nfunction useFormMeta(pathsState, currentValues, initialValues, errors) {\n const MERGE_STRATEGIES = {\n touched: 'some',\n pending: 'some',\n valid: 'every',\n };\n const isDirty = computed(() => {\n return !isEqual(currentValues, unref(initialValues));\n });\n function calculateFlags() {\n const states = pathsState.value;\n return keysOf(MERGE_STRATEGIES).reduce((acc, flag) => {\n const mergeMethod = MERGE_STRATEGIES[flag];\n acc[flag] = states[mergeMethod](s => s[flag]);\n return acc;\n }, {});\n }\n const flags = reactive(calculateFlags());\n watchEffect(() => {\n const value = calculateFlags();\n flags.touched = value.touched;\n flags.valid = value.valid;\n flags.pending = value.pending;\n });\n return computed(() => {\n return Object.assign(Object.assign({ initialValues: unref(initialValues) }, flags), { valid: flags.valid && !keysOf(errors.value).length, dirty: isDirty.value });\n });\n}\n/**\n * Manages the initial values prop\n */\nfunction useFormInitialValues(pathsState, formValues, opts) {\n const values = resolveInitialValues(opts);\n // these are the mutable initial values as the fields are mounted/unmounted\n const initialValues = ref(values);\n // these are the original initial value as provided by the user initially, they don't keep track of conditional fields\n // this is important because some conditional fields will overwrite the initial values for other fields who had the same name\n // like array fields, any push/insert operation will overwrite the initial values because they \"create new fields\"\n // so these are the values that the reset function should use\n // these only change when the user explicitly changes the initial values or when the user resets them with new values.\n const originalInitialValues = ref(klona(values));\n function setInitialValues(values, updateFields = false) {\n initialValues.value = merge(klona(initialValues.value) || {}, klona(values));\n originalInitialValues.value = merge(klona(originalInitialValues.value) || {}, klona(values));\n if (!updateFields) {\n return;\n }\n // update the pristine non-touched fields\n // those are excluded because it's unlikely you want to change the form values using initial values\n // we mostly watch them for API population or newly inserted fields\n // if the user API is taking too much time before user interaction they should consider disabling or hiding their inputs until the values are ready\n pathsState.value.forEach(state => {\n const wasTouched = state.touched;\n if (wasTouched) {\n return;\n }\n const newValue = getFromPath(initialValues.value, state.path);\n setInPath(formValues, state.path, klona(newValue));\n });\n }\n return {\n initialValues,\n originalInitialValues,\n setInitialValues,\n };\n}\nfunction mergeValidationResults(a, b) {\n if (!b) {\n return a;\n }\n return {\n valid: a.valid && b.valid,\n errors: [...a.errors, ...b.errors],\n };\n}\n\nconst FormImpl = /** #__PURE__ */ defineComponent({\n name: 'Form',\n inheritAttrs: false,\n props: {\n as: {\n type: null,\n default: 'form',\n },\n validationSchema: {\n type: Object,\n default: undefined,\n },\n initialValues: {\n type: Object,\n default: undefined,\n },\n initialErrors: {\n type: Object,\n default: undefined,\n },\n initialTouched: {\n type: Object,\n default: undefined,\n },\n validateOnMount: {\n type: Boolean,\n default: false,\n },\n onSubmit: {\n type: Function,\n default: undefined,\n },\n onInvalidSubmit: {\n type: Function,\n default: undefined,\n },\n keepValues: {\n type: Boolean,\n default: false,\n },\n },\n setup(props, ctx) {\n const validationSchema = toRef(props, 'validationSchema');\n const keepValues = toRef(props, 'keepValues');\n const { errors, errorBag, values, meta, isSubmitting, isValidating, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({\n validationSchema: validationSchema.value ? validationSchema : undefined,\n initialValues: props.initialValues,\n initialErrors: props.initialErrors,\n initialTouched: props.initialTouched,\n validateOnMount: props.validateOnMount,\n keepValuesOnUnmount: keepValues,\n });\n const submitForm = handleSubmit((_, { evt }) => {\n if (isFormSubmitEvent(evt)) {\n evt.target.submit();\n }\n }, props.onInvalidSubmit);\n const onSubmit = props.onSubmit ? handleSubmit(props.onSubmit, props.onInvalidSubmit) : submitForm;\n function handleFormReset(e) {\n if (isEvent(e)) {\n // Prevent default form reset behavior\n e.preventDefault();\n }\n handleReset();\n if (typeof ctx.attrs.onReset === 'function') {\n ctx.attrs.onReset();\n }\n }\n function handleScopedSlotSubmit(evt, onSubmit) {\n const onSuccess = typeof evt === 'function' && !onSubmit ? evt : onSubmit;\n return handleSubmit(onSuccess, props.onInvalidSubmit)(evt);\n }\n function getValues() {\n return klona(values);\n }\n function getMeta() {\n return klona(meta.value);\n }\n function getErrors() {\n return klona(errors.value);\n }\n function slotProps() {\n return {\n meta: meta.value,\n errors: errors.value,\n errorBag: errorBag.value,\n values,\n isSubmitting: isSubmitting.value,\n isValidating: isValidating.value,\n submitCount: submitCount.value,\n controlledValues: controlledValues.value,\n validate,\n validateField,\n handleSubmit: handleScopedSlotSubmit,\n handleReset,\n submitForm,\n setErrors,\n setFieldError,\n setFieldValue,\n setValues,\n setFieldTouched,\n setTouched,\n resetForm,\n resetField,\n getValues,\n getMeta,\n getErrors,\n };\n }\n // expose these functions and methods as part of public API\n ctx.expose({\n setFieldError,\n setErrors,\n setFieldValue,\n setValues,\n setFieldTouched,\n setTouched,\n resetForm,\n validate,\n validateField,\n resetField,\n getValues,\n getMeta,\n getErrors,\n values,\n meta,\n errors,\n });\n return function renderForm() {\n // avoid resolving the form component as itself\n const tag = props.as === 'form' ? props.as : !props.as ? null : resolveDynamicComponent(props.as);\n const children = normalizeChildren(tag, ctx, slotProps);\n if (!tag) {\n return children;\n }\n // Attributes to add on a native `form` tag\n const formAttrs = tag === 'form'\n ? {\n // Disables native validation as vee-validate will handle it.\n novalidate: true,\n }\n : {};\n return h(tag, Object.assign(Object.assign(Object.assign({}, formAttrs), ctx.attrs), { onSubmit, onReset: handleFormReset }), children);\n };\n },\n});\nconst Form = FormImpl;\n\nfunction useFieldArray(arrayPath) {\n const form = injectWithSelf(FormContextKey, undefined);\n const fields = ref([]);\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const noOp = () => { };\n const noOpApi = {\n fields,\n remove: noOp,\n push: noOp,\n swap: noOp,\n insert: noOp,\n update: noOp,\n replace: noOp,\n prepend: noOp,\n move: noOp,\n };\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('FieldArray requires being a child of `
` or `useForm` being called before it. Array fields may not work correctly');\n }\n return noOpApi;\n }\n if (!unref(arrayPath)) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('FieldArray requires a field path to be provided, did you forget to pass the `name` prop?');\n }\n return noOpApi;\n }\n const alreadyExists = form.fieldArrays.find(a => unref(a.path) === unref(arrayPath));\n if (alreadyExists) {\n return alreadyExists;\n }\n let entryCounter = 0;\n function getCurrentValues() {\n return getFromPath(form === null || form === void 0 ? void 0 : form.values, toValue(arrayPath), []) || [];\n }\n function initFields() {\n const currentValues = getCurrentValues();\n if (!Array.isArray(currentValues)) {\n return;\n }\n fields.value = currentValues.map((v, idx) => createEntry(v, idx, fields.value));\n updateEntryFlags();\n }\n initFields();\n function updateEntryFlags() {\n const fieldsLength = fields.value.length;\n for (let i = 0; i < fieldsLength; i++) {\n const entry = fields.value[i];\n entry.isFirst = i === 0;\n entry.isLast = i === fieldsLength - 1;\n }\n }\n function createEntry(value, idx, currentFields) {\n // Skips the work by returning the current entry if it already exists\n // This should make the `key` prop stable and doesn't cause more re-renders than needed\n // The value is computed and should update anyways\n if (currentFields && !isNullOrUndefined(idx) && currentFields[idx]) {\n return currentFields[idx];\n }\n const key = entryCounter++;\n const entry = {\n key,\n value: computedDeep({\n get() {\n const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, toValue(arrayPath), []) || [];\n const idx = fields.value.findIndex(e => e.key === key);\n return idx === -1 ? value : currentValues[idx];\n },\n set(value) {\n const idx = fields.value.findIndex(e => e.key === key);\n if (idx === -1) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`Attempting to update a non-existent array item`);\n }\n return;\n }\n update(idx, value);\n },\n }), // will be auto unwrapped\n isFirst: false,\n isLast: false,\n };\n return entry;\n }\n function afterMutation() {\n updateEntryFlags();\n // Should trigger a silent validation since a field may not do that #4096\n form === null || form === void 0 ? void 0 : form.validate({ mode: 'silent' });\n }\n function remove(idx) {\n const pathName = toValue(arrayPath);\n const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);\n if (!pathValue || !Array.isArray(pathValue)) {\n return;\n }\n const newValue = [...pathValue];\n newValue.splice(idx, 1);\n const fieldPath = pathName + `[${idx}]`;\n form.destroyPath(fieldPath);\n form.unsetInitialValue(fieldPath);\n setInPath(form.values, pathName, newValue);\n fields.value.splice(idx, 1);\n afterMutation();\n }\n function push(initialValue) {\n const value = klona(initialValue);\n const pathName = toValue(arrayPath);\n const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);\n const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;\n if (!Array.isArray(normalizedPathValue)) {\n return;\n }\n const newValue = [...normalizedPathValue];\n newValue.push(value);\n form.stageInitialValue(pathName + `[${newValue.length - 1}]`, value);\n setInPath(form.values, pathName, newValue);\n fields.value.push(createEntry(value));\n afterMutation();\n }\n function swap(indexA, indexB) {\n const pathName = toValue(arrayPath);\n const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);\n if (!Array.isArray(pathValue) || !(indexA in pathValue) || !(indexB in pathValue)) {\n return;\n }\n const newValue = [...pathValue];\n const newFields = [...fields.value];\n // the old switcheroo\n const temp = newValue[indexA];\n newValue[indexA] = newValue[indexB];\n newValue[indexB] = temp;\n const tempEntry = newFields[indexA];\n newFields[indexA] = newFields[indexB];\n newFields[indexB] = tempEntry;\n setInPath(form.values, pathName, newValue);\n fields.value = newFields;\n updateEntryFlags();\n }\n function insert(idx, initialValue) {\n const value = klona(initialValue);\n const pathName = toValue(arrayPath);\n const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);\n if (!Array.isArray(pathValue) || pathValue.length < idx) {\n return;\n }\n const newValue = [...pathValue];\n const newFields = [...fields.value];\n newValue.splice(idx, 0, value);\n newFields.splice(idx, 0, createEntry(value));\n setInPath(form.values, pathName, newValue);\n fields.value = newFields;\n afterMutation();\n }\n function replace(arr) {\n const pathName = toValue(arrayPath);\n form.stageInitialValue(pathName, arr);\n setInPath(form.values, pathName, arr);\n initFields();\n afterMutation();\n }\n function update(idx, value) {\n const pathName = toValue(arrayPath);\n const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);\n if (!Array.isArray(pathValue) || pathValue.length - 1 < idx) {\n return;\n }\n setInPath(form.values, `${pathName}[${idx}]`, value);\n form === null || form === void 0 ? void 0 : form.validate({ mode: 'validated-only' });\n }\n function prepend(initialValue) {\n const value = klona(initialValue);\n const pathName = toValue(arrayPath);\n const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);\n const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;\n if (!Array.isArray(normalizedPathValue)) {\n return;\n }\n const newValue = [value, ...normalizedPathValue];\n setInPath(form.values, pathName, newValue);\n form.stageInitialValue(pathName + `[0]`, value);\n fields.value.unshift(createEntry(value));\n afterMutation();\n }\n function move(oldIdx, newIdx) {\n const pathName = toValue(arrayPath);\n const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);\n const newValue = isNullOrUndefined(pathValue) ? [] : [...pathValue];\n if (!Array.isArray(pathValue) || !(oldIdx in pathValue) || !(newIdx in pathValue)) {\n return;\n }\n const newFields = [...fields.value];\n const movedItem = newFields[oldIdx];\n newFields.splice(oldIdx, 1);\n newFields.splice(newIdx, 0, movedItem);\n const movedValue = newValue[oldIdx];\n newValue.splice(oldIdx, 1);\n newValue.splice(newIdx, 0, movedValue);\n setInPath(form.values, pathName, newValue);\n fields.value = newFields;\n afterMutation();\n }\n const fieldArrayCtx = {\n fields,\n remove,\n push,\n swap,\n insert,\n update,\n replace,\n prepend,\n move,\n };\n form.fieldArrays.push(Object.assign({ path: arrayPath, reset: initFields }, fieldArrayCtx));\n onBeforeUnmount(() => {\n const idx = form.fieldArrays.findIndex(i => toValue(i.path) === toValue(arrayPath));\n if (idx >= 0) {\n form.fieldArrays.splice(idx, 1);\n }\n });\n // Makes sure to sync the form values with the array value if they go out of sync\n // #4153\n watch(getCurrentValues, formValues => {\n const fieldsValues = fields.value.map(f => f.value);\n // If form values are not the same as the current values then something overrode them.\n if (!isEqual(formValues, fieldsValues)) {\n initFields();\n }\n });\n return fieldArrayCtx;\n}\n\nconst FieldArrayImpl = /** #__PURE__ */ defineComponent({\n name: 'FieldArray',\n inheritAttrs: false,\n props: {\n name: {\n type: String,\n required: true,\n },\n },\n setup(props, ctx) {\n const { push, remove, swap, insert, replace, update, prepend, move, fields } = useFieldArray(() => props.name);\n function slotProps() {\n return {\n fields: fields.value,\n push,\n remove,\n swap,\n insert,\n update,\n replace,\n prepend,\n move,\n };\n }\n ctx.expose({\n push,\n remove,\n swap,\n insert,\n update,\n replace,\n prepend,\n move,\n });\n return () => {\n const children = normalizeChildren(undefined, ctx, slotProps);\n return children;\n };\n },\n});\nconst FieldArray = FieldArrayImpl;\n\nconst ErrorMessageImpl = /** #__PURE__ */ defineComponent({\n name: 'ErrorMessage',\n props: {\n as: {\n type: String,\n default: undefined,\n },\n name: {\n type: String,\n required: true,\n },\n },\n setup(props, ctx) {\n const form = inject(FormContextKey, undefined);\n const message = computed(() => {\n return form === null || form === void 0 ? void 0 : form.errors.value[props.name];\n });\n function slotProps() {\n return {\n message: message.value,\n };\n }\n return () => {\n // Renders nothing if there are no messages\n if (!message.value) {\n return undefined;\n }\n const tag = (props.as ? resolveDynamicComponent(props.as) : props.as);\n const children = normalizeChildren(tag, ctx, slotProps);\n const attrs = Object.assign({ role: 'alert' }, ctx.attrs);\n // If no tag was specified and there are children\n // render the slot as is without wrapping it\n if (!tag && (Array.isArray(children) || !children) && (children === null || children === void 0 ? void 0 : children.length)) {\n return children;\n }\n // If no children in slot\n // render whatever specified and fallback to a with the message in it's contents\n if ((Array.isArray(children) || !children) && !(children === null || children === void 0 ? void 0 : children.length)) {\n return h(tag || 'span', attrs, message.value);\n }\n return h(tag, attrs, children);\n };\n },\n});\nconst ErrorMessage = ErrorMessageImpl;\n\nfunction useResetForm() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return function resetForm(state) {\n if (!form) {\n return;\n }\n return form.resetForm(state);\n };\n}\n\n/**\n * If a field is dirty or not\n */\nfunction useIsFieldDirty(path) {\n const fieldOrPath = resolveFieldOrPathState(path);\n return computed(() => {\n var _a, _b;\n if (!fieldOrPath) {\n return false;\n }\n return (_b = ('meta' in fieldOrPath ? fieldOrPath.meta.dirty : (_a = fieldOrPath === null || fieldOrPath === void 0 ? void 0 : fieldOrPath.value) === null || _a === void 0 ? void 0 : _a.dirty)) !== null && _b !== void 0 ? _b : false;\n });\n}\n\n/**\n * If a field is touched or not\n */\nfunction useIsFieldTouched(path) {\n const fieldOrPath = resolveFieldOrPathState(path);\n return computed(() => {\n var _a, _b;\n if (!fieldOrPath) {\n return false;\n }\n return (_b = ('meta' in fieldOrPath ? fieldOrPath.meta.touched : (_a = fieldOrPath === null || fieldOrPath === void 0 ? void 0 : fieldOrPath.value) === null || _a === void 0 ? void 0 : _a.touched)) !== null && _b !== void 0 ? _b : false;\n });\n}\n\n/**\n * If a field is validated and is valid\n */\nfunction useIsFieldValid(path) {\n const fieldOrPath = resolveFieldOrPathState(path);\n return computed(() => {\n var _a, _b;\n if (!fieldOrPath) {\n return false;\n }\n return (_b = ('meta' in fieldOrPath ? fieldOrPath.meta.valid : (_a = fieldOrPath === null || fieldOrPath === void 0 ? void 0 : fieldOrPath.value) === null || _a === void 0 ? void 0 : _a.valid)) !== null && _b !== void 0 ? _b : false;\n });\n}\n\n/**\n * If the form is submitting or not\n */\nfunction useIsSubmitting() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return computed(() => {\n var _a;\n return (_a = form === null || form === void 0 ? void 0 : form.isSubmitting.value) !== null && _a !== void 0 ? _a : false;\n });\n}\n\n/**\n * If the form is validating or not\n */\nfunction useIsValidating() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return computed(() => {\n var _a;\n return (_a = form === null || form === void 0 ? void 0 : form.isValidating.value) !== null && _a !== void 0 ? _a : false;\n });\n}\n\n/**\n * Validates a single field\n */\nfunction useValidateField(path) {\n const form = injectWithSelf(FormContextKey);\n const field = path ? undefined : inject(FieldContextKey);\n return function validateField() {\n if (field) {\n return field.validate();\n }\n if (form && path) {\n return form === null || form === void 0 ? void 0 : form.validateField(toValue(path));\n }\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`field with name ${unref(path)} was not found`);\n }\n return Promise.resolve({\n errors: [],\n valid: true,\n });\n };\n}\n\n/**\n * If the form is dirty or not\n */\nfunction useIsFormDirty() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return computed(() => {\n var _a;\n return (_a = form === null || form === void 0 ? void 0 : form.meta.value.dirty) !== null && _a !== void 0 ? _a : false;\n });\n}\n\n/**\n * If the form is touched or not\n */\nfunction useIsFormTouched() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return computed(() => {\n var _a;\n return (_a = form === null || form === void 0 ? void 0 : form.meta.value.touched) !== null && _a !== void 0 ? _a : false;\n });\n}\n\n/**\n * If the form has been validated and is valid\n */\nfunction useIsFormValid() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return computed(() => {\n var _a;\n return (_a = form === null || form === void 0 ? void 0 : form.meta.value.valid) !== null && _a !== void 0 ? _a : false;\n });\n}\n\n/**\n * Validate multiple fields\n */\nfunction useValidateForm() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return function validateField() {\n if (!form) {\n return Promise.resolve({ results: {}, errors: {}, valid: true });\n }\n return form.validate();\n };\n}\n\n/**\n * The number of form's submission count\n */\nfunction useSubmitCount() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return computed(() => {\n var _a;\n return (_a = form === null || form === void 0 ? void 0 : form.submitCount.value) !== null && _a !== void 0 ? _a : 0;\n });\n}\n\n/**\n * Gives access to a field's current value\n */\nfunction useFieldValue(path) {\n const form = injectWithSelf(FormContextKey);\n // We don't want to use self injected context as it doesn't make sense\n const field = path ? undefined : inject(FieldContextKey);\n return computed(() => {\n if (path) {\n return getFromPath(form === null || form === void 0 ? void 0 : form.values, toValue(path));\n }\n return toValue(field === null || field === void 0 ? void 0 : field.value);\n });\n}\n\n/**\n * Gives access to a form's values\n */\nfunction useFormValues() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return computed(() => {\n return (form === null || form === void 0 ? void 0 : form.values) || {};\n });\n}\n\n/**\n * Gives access to all form errors\n */\nfunction useFormErrors() {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n return computed(() => {\n return ((form === null || form === void 0 ? void 0 : form.errors.value) || {});\n });\n}\n\n/**\n * Gives access to a single field error\n */\nfunction useFieldError(path) {\n const form = injectWithSelf(FormContextKey);\n // We don't want to use self injected context as it doesn't make sense\n const field = path ? undefined : inject(FieldContextKey);\n return computed(() => {\n if (path) {\n return form === null || form === void 0 ? void 0 : form.errors.value[toValue(path)];\n }\n return field === null || field === void 0 ? void 0 : field.errorMessage.value;\n });\n}\n\nfunction useSubmitForm(cb) {\n const form = injectWithSelf(FormContextKey);\n if (!form) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('No vee-validate or `useForm` was detected in the component tree');\n }\n }\n const onSubmit = form ? form.handleSubmit(cb) : undefined;\n return function submitForm(e) {\n if (!onSubmit) {\n return;\n }\n return onSubmit(e);\n };\n}\n\n/**\n * Sets a field's error message\n */\nfunction useSetFieldError(path) {\n const form = injectWithSelf(FormContextKey);\n // We don't want to use self injected context as it doesn't make sense\n const field = path ? undefined : inject(FieldContextKey);\n return function setFieldError(message) {\n if (path && form) {\n form.setFieldError(toValue(path), message);\n return;\n }\n if (field) {\n field.setErrors(message || []);\n return;\n }\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`Could not set error message since there is no form context or a field named \"${toValue(path)}\", did you forget to call \"useField\" or \"useForm\"?`);\n }\n };\n}\n\n/**\n * Sets a field's touched meta state\n */\nfunction useSetFieldTouched(path) {\n const form = injectWithSelf(FormContextKey);\n // We don't want to use self injected context as it doesn't make sense\n const field = path ? undefined : inject(FieldContextKey);\n return function setFieldTouched(touched) {\n if (path && form) {\n form.setFieldTouched(toValue(path), touched);\n return;\n }\n if (field) {\n field.setTouched(touched);\n return;\n }\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`Could not set touched state since there is no form context or a field named \"${toValue(path)}\", did you forget to call \"useField\" or \"useForm\"?`);\n }\n };\n}\n\n/**\n * Sets a field's value\n */\nfunction useSetFieldValue(path) {\n const form = injectWithSelf(FormContextKey);\n // We don't want to use self injected context as it doesn't make sense\n const field = path ? undefined : inject(FieldContextKey);\n return function setFieldValue(value, shouldValidate = true) {\n if (path && form) {\n form.setFieldValue(toValue(path), value, shouldValidate);\n return;\n }\n if (field) {\n field.setValue(value, shouldValidate);\n return;\n }\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`Could not set value since there is no form context or a field named \"${toValue(path)}\", did you forget to call \"useField\" or \"useForm\"?`);\n }\n };\n}\n\n/**\n * Sets multiple fields errors\n */\nfunction useSetFormErrors() {\n const form = injectWithSelf(FormContextKey);\n function setFormErrors(fields) {\n if (form) {\n form.setErrors(fields);\n return;\n }\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`Could not set errors because a form was not detected, did you forget to use \"useForm\" in a parent component?`);\n }\n }\n return setFormErrors;\n}\n\n/**\n * Sets multiple fields touched or all fields in the form\n */\nfunction useSetFormTouched() {\n const form = injectWithSelf(FormContextKey);\n function setFormTouched(fields) {\n if (form) {\n form.setTouched(fields);\n return;\n }\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`Could not set touched state because a form was not detected, did you forget to use \"useForm\" in a parent component?`);\n }\n }\n return setFormTouched;\n}\n\n/**\n * Sets multiple fields values\n */\nfunction useSetFormValues() {\n const form = injectWithSelf(FormContextKey);\n function setFormValues(fields, shouldValidate = true) {\n if (form) {\n form.setValues(fields, shouldValidate);\n return;\n }\n if ((process.env.NODE_ENV !== 'production')) {\n warn(`Could not set form values because a form was not detected, did you forget to use \"useForm\" in a parent component?`);\n }\n }\n return setFormValues;\n}\n\nexport { ErrorMessage, Field, FieldArray, FieldContextKey, Form, FormContextKey, IS_ABSENT, cleanupNonNestedPath, configure, defineRule, isNotNestedPath, normalizeRules, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useIsValidating, useResetForm, useSetFieldError, useSetFieldTouched, useSetFieldValue, useSetFormErrors, useSetFormTouched, useSetFormValues, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };\n"],"names":["isCallable","fn","isNullOrUndefined","value","isObject","obj","isIndex","toNumber","isObjectLike","getTag","isPlainObject","proto","merge","target","source","key","normalizeFormPath","path","pathArr","fullPath","i","RULES","resolveRule","id","set","val","klona","x","k","list","tmp","str","FormContextKey","FieldContextKey","IS_ABSENT","isClient","isLocator","isTypedSchema","isYupValidator","hasCheckedAttr","type","isContainerValue","isEmptyContainer","isNotNestedPath","isNativeMultiSelect","el","isNativeSelect","isFormSubmitEvent","evt","isEvent","isEqual","a","b","length","keys","isFile","cleanupNonNestedPath","getFromPath","object","fallback","acc","propKey","setInPath","unset","unsetPath","pathValues","_","idx","keysOf","record","injectWithSelf","symbol","def","vm","getCurrentInstance","inject","resolveNextCheckboxValue","currentValue","checkedValue","uncheckedValue","newVal","v","debounceAsync","inner","ms","timer","resolves","args","result","r","resolve","applyModelModifiers","modifiers","withLatest","onDone","latestRun","pending","normalizeErrorItem","message","omit","debounceNextTick","lastTick","thisTick","nextTick","getBoundValue","hasValueBinding","parseInputValue","normalizeEventValue","input","files","opt","selectedOption","normalizeRules","rules","prev","curr","params","normalizeParams","buildParams","rule","parsedRule","parseRule","provided","mapValueToLocator","createLocator","name","locator","crossTable","extractLocators","DEFAULT_CONFIG","field","currentConfig","getConfig","validate","options","shouldBail","errors","_validate","validateFieldWithTypedSchema","ctx","pipeline","_generateFieldError","normalizedContext","rulesKeys","_test","isYupError","err","yupToTypedSchema","yupSchema","values","_a","schema","messages","error","validator","fillTargetValues","fieldCtx","normalize","param","validateTypedSchema","validationResult","results","m","validateObjectSchema","opts","validations","_b","_c","strings","fieldResult","isAllValid","validationResults","ID_COUNTER","useFieldState","init","initialValue","setInitialValue","_useFieldValue","setState","state","setErrors","meta","createFieldErrors","createFieldMeta","computed","unref","modelValue","form","modelRef","ref","resolveInitialValue","resolveModelValue","isRef","isRequired","reactive","watch","useField","useFieldWithChecked","_useField","validateOnMount","bails","label","validateOnValueUpdate","controlled","keepValueOnUnmount","syncVModel","controlForm","normalizeOptions","injectedForm","toValue","rulesValue","flags","validate$1","errorMessage","useVModel","handleChange","handleBlur","shouldValidate","validateWithStateMutation","validateCurrentValue","mode","validateValidStateOnly","e","newValue","setValue","onMounted","setTouched","isTouched","resetField","valueProxy","provide","oldValue","dependencies","rulesVal","deps","dep","depAcc","depName","depValue","oldDeps","onBeforeUnmount","shouldKeepValue","pathState","valueIdx","defaults","isVModelSynced","modelPropName","getCurrentModelValue","patchCheckedApi","checked","checkedVal","handleCheckboxChange","prop","propName","emitName","propValue","FORM_COUNTER","PRIVATE_PATH_STATE_KEYS","resolveInitialValues","providedValues","useForm","formId","FIELD_ID_COUNTER","isSubmitting","isValidating","submitCount","fieldArrays","formValues","pathStates","extraErrorsBag","pathStateLookup","rebuildPathLookup","names","setFieldError","findPathState","normalizedPath","paths","errorBag","pathErrors","fieldNames","fieldBailsMap","map","initialErrors","keepValuesOnUnmount","initialValues","originalInitialValues","setInitialValues","useFormInitialValues","useFormMeta","controlledValues","createPathState","config","pathStateExists","isCheckboxOrRadio","pathValue","unsetBatchIndex","UNSET_BATCH","_path","_d","_e","_f","shallowRef","validateField","newPath","nextValue","debouncedSilentValidation","_validateSchema","debouncedValidation","validateSchema","formResult","currentErrorsPaths","formCtx","p","validation","expectedPath","findHoistedPath","mergeValidationResults","mutateAllPathState","mutation","bestCandidate","candidate","PENDING_UNSET","unsetPathValue","makeSubmissionFactory","onlyControlled","onValidationError","s","submittedValues","setFieldTouched","setValues","setFieldValue","resetForm","returnVal","handleSubmit","removePathState","idIndex","unsetInitialValue","destroyPath","useFieldModel","defineInputBinds","defineComponentBinds","defineField","stageInitialValue","setFieldInitialValue","isFieldTouched","isFieldDirty","isFieldValid","clonedValue","forceSetValues","fields","f","createModel","resetState","newValues","updateOriginal","schemaValue","submitForm","evalConfig","onBlur","onInput","onChange","props","base","pathOrPaths","model","onUpdateModelValue","conf","readonly","pathsState","currentValues","MERGE_STRATEGIES","isDirty","calculateFlags","states","flag","mergeMethod","watchEffect","updateFields"],"mappings":"2dAAA;AAAA;AAAA;AAAA;AAAA,IAQA,SAASA,EAAWC,EAAI,CACpB,OAAO,OAAOA,GAAO,UACzB,CACA,SAASC,GAAkBC,EAAO,CACvB,OAAAA,GAAU,IACrB,CACA,MAAMC,GAAYC,GAAQA,IAAQ,MAAQ,CAAC,CAACA,GAAO,OAAOA,GAAQ,UAAY,CAAC,MAAM,QAAQA,CAAG,EAChG,SAASC,GAAQH,EAAO,CACb,OAAA,OAAOA,CAAK,GAAK,CAC5B,CACA,SAASI,GAASJ,EAAO,CACf,MAAA,EAAI,WAAWA,CAAK,EACnB,OAAA,MAAM,CAAC,EAAIA,EAAQ,CAC9B,CACA,SAASK,GAAaL,EAAO,CAClB,OAAA,OAAOA,GAAU,UAAYA,IAAU,IAClD,CACA,SAASM,GAAON,EAAO,CACnB,OAAIA,GAAS,KACFA,IAAU,OAAY,qBAAuB,gBAEjD,OAAO,UAAU,SAAS,KAAKA,CAAK,CAC/C,CAEA,SAASO,GAAcP,EAAO,CAC1B,GAAI,CAACK,GAAaL,CAAK,GAAKM,GAAON,CAAK,IAAM,kBACnC,MAAA,GAEX,GAAI,OAAO,eAAeA,CAAK,IAAM,KAC1B,MAAA,GAEX,IAAIQ,EAAQR,EACZ,KAAO,OAAO,eAAeQ,CAAK,IAAM,MAC5BA,EAAA,OAAO,eAAeA,CA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