vee-validate 4.9.2 → 4.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -331,6 +331,7 @@ interface PrivateFormContext<TValues extends GenericObject = GenericObject, TOut
331
331
  errors: ComputedRef<FormErrors<TValues>>;
332
332
  meta: ComputedRef<FormMeta<TValues>>;
333
333
  isSubmitting: Ref<boolean>;
334
+ isValidating: Ref<boolean>;
334
335
  keepValuesOnUnmount: MaybeRef<boolean>;
335
336
  validateSchema?: (mode: SchemaValidationMode) => Promise<FormValidationResult<TValues, TOutput>>;
336
337
  validate(opts?: Partial<ValidationOptions$1>): Promise<FormValidationResult<TValues, TOutput>>;
@@ -849,7 +850,7 @@ declare const Field: {
849
850
  };
850
851
  });
851
852
 
852
- type FormSlotProps = UnwrapRef<Pick<FormContext, 'meta' | 'errors' | 'errorBag' | 'values' | 'isSubmitting' | 'submitCount' | 'validate' | 'validateField' | 'handleReset' | 'setErrors' | 'setFieldError' | 'setFieldValue' | 'setValues' | 'setFieldTouched' | 'setTouched' | 'resetForm' | 'resetField' | 'controlledValues'>> & {
853
+ type FormSlotProps = UnwrapRef<Pick<FormContext, 'meta' | 'errors' | 'errorBag' | 'values' | 'isSubmitting' | 'isValidating' | 'submitCount' | 'validate' | 'validateField' | 'handleReset' | 'setErrors' | 'setFieldError' | 'setFieldValue' | 'setValues' | 'setFieldTouched' | 'setTouched' | 'resetForm' | 'resetField' | 'controlledValues'>> & {
853
854
  handleSubmit: (evt: Event | SubmissionHandler, onSubmit?: SubmissionHandler) => Promise<unknown>;
854
855
  submitForm(evt?: Event): void;
855
856
  getValues<TValues extends GenericObject = GenericObject>(): TValues;
@@ -1365,6 +1366,11 @@ declare function useIsFieldValid(path?: MaybeRef<string>): vue.ComputedRef<boole
1365
1366
  */
1366
1367
  declare function useIsSubmitting(): vue.ComputedRef<boolean>;
1367
1368
 
1369
+ /**
1370
+ * If the form is validating or not
1371
+ */
1372
+ declare function useIsValidating(): vue.ComputedRef<boolean>;
1373
+
1368
1374
  /**
1369
1375
  * Validates a single field
1370
1376
  */
@@ -1421,4 +1427,4 @@ declare const FormContextKey: InjectionKey<PrivateFormContext>;
1421
1427
  declare const FieldContextKey: InjectionKey<PrivateFieldContext<unknown>>;
1422
1428
  declare const IS_ABSENT: any;
1423
1429
 
1424
- export { ComponentBindsConfig, ErrorMessage, Field, FieldArray, FieldArrayContext, FieldContext, FieldContextKey, FieldEntry, FieldMeta, FieldOptions, FieldState, Form, FormActions, FormContext, FormContextKey, FormMeta, FormOptions, FormState, FormValidationResult, GenericValidateFunction, IS_ABSENT, InputBindsConfig, InvalidSubmissionContext, InvalidSubmissionHandler, LazyComponentBindsConfig, LazyInputBindsConfig, Path, PublicPathState as PathState, RawFormSchema, RuleExpression, SubmissionContext, SubmissionHandler, TypedSchema, TypedSchemaError, ValidationOptions$1 as ValidationOptions, ValidationResult, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };
1430
+ export { ComponentBindsConfig, ErrorMessage, Field, FieldArray, FieldArrayContext, FieldContext, FieldContextKey, FieldEntry, FieldMeta, FieldOptions, FieldState, Form, FormActions, FormContext, FormContextKey, FormMeta, FormOptions, FormState, FormValidationResult, GenericValidateFunction, IS_ABSENT, InputBindsConfig, InvalidSubmissionContext, InvalidSubmissionHandler, LazyComponentBindsConfig, LazyInputBindsConfig, Path, PublicPathState as PathState, RawFormSchema, RuleExpression, SubmissionContext, SubmissionHandler, TypedSchema, TypedSchemaError, ValidationOptions$1 as ValidationOptions, ValidationResult, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useIsValidating, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vee-validate v4.9.2
2
+ * vee-validate v4.9.3
3
3
  * (c) 2023 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
@@ -1432,7 +1432,7 @@ function buildFieldState(state) {
1432
1432
  };
1433
1433
  }
1434
1434
  function buildFormState(form) {
1435
- const { errorBag, meta, values, isSubmitting, submitCount } = form;
1435
+ const { errorBag, meta, values, isSubmitting, isValidating, submitCount } = form;
1436
1436
  return {
1437
1437
  'Form state': [
1438
1438
  {
@@ -1443,6 +1443,10 @@ function buildFormState(form) {
1443
1443
  key: 'isSubmitting',
1444
1444
  value: isSubmitting.value,
1445
1445
  },
1446
+ {
1447
+ key: 'isValidating',
1448
+ value: isValidating.value,
1449
+ },
1446
1450
  {
1447
1451
  key: 'touched',
1448
1452
  value: meta.value.touched,
@@ -1576,10 +1580,7 @@ function _useField(path, rules, opts) {
1576
1580
  // Common input/change event handler
1577
1581
  function handleChange(e, shouldValidate = true) {
1578
1582
  const newValue = normalizeEventValue(e);
1579
- setValue(newValue, false);
1580
- if (!validateOnValueUpdate && shouldValidate) {
1581
- validateWithStateMutation();
1582
- }
1583
+ setValue(newValue, shouldValidate);
1583
1584
  }
1584
1585
  // Runs the initial validation
1585
1586
  onMounted(() => {
@@ -1608,12 +1609,13 @@ function _useField(path, rules, opts) {
1608
1609
  meta.validated = false;
1609
1610
  validateValidStateOnly();
1610
1611
  }
1611
- function setValue(newValue, validate = true) {
1612
+ function setValue(newValue, shouldValidate = true) {
1612
1613
  value.value = newValue;
1613
- if (!validate) {
1614
+ if (!shouldValidate) {
1615
+ validateValidStateOnly();
1614
1616
  return;
1615
1617
  }
1616
- const validateFn = validateOnValueUpdate ? validateWithStateMutation : validateValidStateOnly;
1618
+ const validateFn = shouldValidate ? validateWithStateMutation : validateValidStateOnly;
1617
1619
  validateFn();
1618
1620
  }
1619
1621
  function setErrors(errors) {
@@ -1955,15 +1957,6 @@ const FieldImpl = defineComponent({
1955
1957
  handleChange(e, shouldValidate);
1956
1958
  ctx.emit('update:modelValue', value.value);
1957
1959
  };
1958
- const handleInput = (e) => {
1959
- if (!hasCheckedAttr(ctx.attrs.type)) {
1960
- value.value = normalizeEventValue(e);
1961
- }
1962
- };
1963
- const onInputHandler = function handleInputWithModel(e) {
1964
- handleInput(e);
1965
- ctx.emit('update:modelValue', value.value);
1966
- };
1967
1960
  const fieldProps = computed(() => {
1968
1961
  const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = resolveValidationTriggers(props);
1969
1962
  function baseOnBlur(e) {
@@ -2013,7 +2006,7 @@ const FieldImpl = defineComponent({
2013
2006
  validate: validateField,
2014
2007
  resetField,
2015
2008
  handleChange: onChangeHandler,
2016
- handleInput: onInputHandler,
2009
+ handleInput: e => onChangeHandler(e, false),
2017
2010
  handleReset,
2018
2011
  handleBlur,
2019
2012
  setTouched,
@@ -2081,6 +2074,8 @@ function useForm(opts) {
2081
2074
  let FIELD_ID_COUNTER = 0;
2082
2075
  // If the form is currently submitting
2083
2076
  const isSubmitting = ref(false);
2077
+ // If the form is currently validating
2078
+ const isValidating = ref(false);
2084
2079
  // The number of times the user tried to submit the form
2085
2080
  const submitCount = ref(0);
2086
2081
  // field arrays managed by this form
@@ -2241,11 +2236,11 @@ function useForm(opts) {
2241
2236
  // this ensures we have a complete key map of all the fields
2242
2237
  const paths = [
2243
2238
  ...new Set([...keysOf(formResult.results), ...pathStates.value.map(p => p.path), ...currentErrorsPaths]),
2244
- ];
2239
+ ].sort();
2245
2240
  // aggregates the paths into a single result object while applying the results on the fields
2246
2241
  return paths.reduce((validation, _path) => {
2247
2242
  const path = _path;
2248
- const pathState = findPathState(path);
2243
+ const pathState = findPathState(path) || findHoistedPath(path);
2249
2244
  const messages = (formResult.results[path] || { errors: [] }).errors;
2250
2245
  const fieldResult = {
2251
2246
  errors: messages,
@@ -2283,6 +2278,15 @@ function useForm(opts) {
2283
2278
  const pathState = typeof path === 'string' ? pathStates.value.find(state => state.path === path) : path;
2284
2279
  return pathState;
2285
2280
  }
2281
+ function findHoistedPath(path) {
2282
+ const candidates = pathStates.value.filter(state => path.startsWith(state.path));
2283
+ return candidates.reduce((bestCandidate, candidate) => {
2284
+ if (!bestCandidate) {
2285
+ return candidate;
2286
+ }
2287
+ return (candidate.path.length > bestCandidate.path.length ? candidate : bestCandidate);
2288
+ }, undefined);
2289
+ }
2286
2290
  let UNSET_BATCH = [];
2287
2291
  let PENDING_UNSET;
2288
2292
  function unsetPathValue(path) {
@@ -2395,6 +2399,7 @@ function useForm(opts) {
2395
2399
  submitCount,
2396
2400
  meta,
2397
2401
  isSubmitting,
2402
+ isValidating,
2398
2403
  fieldArrays,
2399
2404
  keepValuesOnUnmount,
2400
2405
  validateSchema: unref(schema) ? validateSchema : undefined,
@@ -2517,6 +2522,7 @@ function useForm(opts) {
2517
2522
  if (formCtx.validateSchema) {
2518
2523
  return formCtx.validateSchema(mode);
2519
2524
  }
2525
+ isValidating.value = true;
2520
2526
  // No schema, each field is responsible to validate itself
2521
2527
  const validations = await Promise.all(pathStates.value.map(state => {
2522
2528
  if (!state.validate) {
@@ -2534,6 +2540,7 @@ function useForm(opts) {
2534
2540
  };
2535
2541
  });
2536
2542
  }));
2543
+ isValidating.value = false;
2537
2544
  const results = {};
2538
2545
  const errors = {};
2539
2546
  for (const validation of validations) {
@@ -2589,12 +2596,14 @@ function useForm(opts) {
2589
2596
  if (!schemaValue) {
2590
2597
  return { valid: true, results: {}, errors: {} };
2591
2598
  }
2599
+ isValidating.value = true;
2592
2600
  const formResult = isYupValidator(schemaValue) || isTypedSchema(schemaValue)
2593
2601
  ? await validateTypedSchema(schemaValue, formValues)
2594
2602
  : await validateObjectSchema(schemaValue, formValues, {
2595
2603
  names: fieldNames.value,
2596
2604
  bailsMap: fieldBailsMap.value,
2597
2605
  });
2606
+ isValidating.value = false;
2598
2607
  return formResult;
2599
2608
  }
2600
2609
  const submitForm = handleSubmit((_, { evt }) => {
@@ -2631,7 +2640,7 @@ function useForm(opts) {
2631
2640
  provide(FormContextKey, formCtx);
2632
2641
  if ((process.env.NODE_ENV !== 'production')) {
2633
2642
  registerFormWithDevTools(formCtx);
2634
- watch(() => (Object.assign(Object.assign({ errors: errorBag.value }, meta.value), { values: formValues, isSubmitting: isSubmitting.value, submitCount: submitCount.value })), refreshInspector, {
2643
+ watch(() => (Object.assign(Object.assign({ errors: errorBag.value }, meta.value), { values: formValues, isSubmitting: isSubmitting.value, isValidating: isValidating.value, submitCount: submitCount.value })), refreshInspector, {
2635
2644
  deep: true,
2636
2645
  });
2637
2646
  }
@@ -2843,7 +2852,7 @@ const FormImpl = defineComponent({
2843
2852
  const initialValues = toRef(props, 'initialValues');
2844
2853
  const validationSchema = toRef(props, 'validationSchema');
2845
2854
  const keepValues = toRef(props, 'keepValues');
2846
- const { errors, errorBag, values, meta, isSubmitting, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2855
+ const { errors, errorBag, values, meta, isSubmitting, isValidating, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2847
2856
  validationSchema: validationSchema.value ? validationSchema : undefined,
2848
2857
  initialValues,
2849
2858
  initialErrors: props.initialErrors,
@@ -2887,6 +2896,7 @@ const FormImpl = defineComponent({
2887
2896
  errorBag: errorBag.value,
2888
2897
  values,
2889
2898
  isSubmitting: isSubmitting.value,
2899
+ isValidating: isValidating.value,
2890
2900
  submitCount: submitCount.value,
2891
2901
  controlledValues: controlledValues.value,
2892
2902
  validate,
@@ -3323,6 +3333,20 @@ function useIsSubmitting() {
3323
3333
  });
3324
3334
  }
3325
3335
 
3336
+ /**
3337
+ * If the form is validating or not
3338
+ */
3339
+ function useIsValidating() {
3340
+ const form = injectWithSelf(FormContextKey);
3341
+ if (!form) {
3342
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
3343
+ }
3344
+ return computed(() => {
3345
+ var _a;
3346
+ return (_a = form === null || form === void 0 ? void 0 : form.isValidating.value) !== null && _a !== void 0 ? _a : false;
3347
+ });
3348
+ }
3349
+
3326
3350
  /**
3327
3351
  * Validates a single field
3328
3352
  */
@@ -3486,4 +3510,4 @@ function useSubmitForm(cb) {
3486
3510
  };
3487
3511
  }
3488
3512
 
3489
- export { ErrorMessage, Field, FieldArray, FieldContextKey, Form, FormContextKey, IS_ABSENT, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };
3513
+ export { ErrorMessage, Field, FieldArray, FieldContextKey, Form, FormContextKey, IS_ABSENT, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useIsValidating, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vee-validate v4.9.2
2
+ * vee-validate v4.9.3
3
3
  * (c) 2023 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
@@ -1182,10 +1182,7 @@
1182
1182
  // Common input/change event handler
1183
1183
  function handleChange(e, shouldValidate = true) {
1184
1184
  const newValue = normalizeEventValue(e);
1185
- setValue(newValue, false);
1186
- if (!validateOnValueUpdate && shouldValidate) {
1187
- validateWithStateMutation();
1188
- }
1185
+ setValue(newValue, shouldValidate);
1189
1186
  }
1190
1187
  // Runs the initial validation
1191
1188
  vue.onMounted(() => {
@@ -1214,12 +1211,13 @@
1214
1211
  meta.validated = false;
1215
1212
  validateValidStateOnly();
1216
1213
  }
1217
- function setValue(newValue, validate = true) {
1214
+ function setValue(newValue, shouldValidate = true) {
1218
1215
  value.value = newValue;
1219
- if (!validate) {
1216
+ if (!shouldValidate) {
1217
+ validateValidStateOnly();
1220
1218
  return;
1221
1219
  }
1222
- const validateFn = validateOnValueUpdate ? validateWithStateMutation : validateValidStateOnly;
1220
+ const validateFn = shouldValidate ? validateWithStateMutation : validateValidStateOnly;
1223
1221
  validateFn();
1224
1222
  }
1225
1223
  function setErrors(errors) {
@@ -1539,15 +1537,6 @@
1539
1537
  handleChange(e, shouldValidate);
1540
1538
  ctx.emit('update:modelValue', value.value);
1541
1539
  };
1542
- const handleInput = (e) => {
1543
- if (!hasCheckedAttr(ctx.attrs.type)) {
1544
- value.value = normalizeEventValue(e);
1545
- }
1546
- };
1547
- const onInputHandler = function handleInputWithModel(e) {
1548
- handleInput(e);
1549
- ctx.emit('update:modelValue', value.value);
1550
- };
1551
1540
  const fieldProps = vue.computed(() => {
1552
1541
  const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = resolveValidationTriggers(props);
1553
1542
  function baseOnBlur(e) {
@@ -1597,7 +1586,7 @@
1597
1586
  validate: validateField,
1598
1587
  resetField,
1599
1588
  handleChange: onChangeHandler,
1600
- handleInput: onInputHandler,
1589
+ handleInput: e => onChangeHandler(e, false),
1601
1590
  handleReset,
1602
1591
  handleBlur,
1603
1592
  setTouched,
@@ -1665,6 +1654,8 @@
1665
1654
  let FIELD_ID_COUNTER = 0;
1666
1655
  // If the form is currently submitting
1667
1656
  const isSubmitting = vue.ref(false);
1657
+ // If the form is currently validating
1658
+ const isValidating = vue.ref(false);
1668
1659
  // The number of times the user tried to submit the form
1669
1660
  const submitCount = vue.ref(0);
1670
1661
  // field arrays managed by this form
@@ -1825,11 +1816,11 @@
1825
1816
  // this ensures we have a complete key map of all the fields
1826
1817
  const paths = [
1827
1818
  ...new Set([...keysOf(formResult.results), ...pathStates.value.map(p => p.path), ...currentErrorsPaths]),
1828
- ];
1819
+ ].sort();
1829
1820
  // aggregates the paths into a single result object while applying the results on the fields
1830
1821
  return paths.reduce((validation, _path) => {
1831
1822
  const path = _path;
1832
- const pathState = findPathState(path);
1823
+ const pathState = findPathState(path) || findHoistedPath(path);
1833
1824
  const messages = (formResult.results[path] || { errors: [] }).errors;
1834
1825
  const fieldResult = {
1835
1826
  errors: messages,
@@ -1867,6 +1858,15 @@
1867
1858
  const pathState = typeof path === 'string' ? pathStates.value.find(state => state.path === path) : path;
1868
1859
  return pathState;
1869
1860
  }
1861
+ function findHoistedPath(path) {
1862
+ const candidates = pathStates.value.filter(state => path.startsWith(state.path));
1863
+ return candidates.reduce((bestCandidate, candidate) => {
1864
+ if (!bestCandidate) {
1865
+ return candidate;
1866
+ }
1867
+ return (candidate.path.length > bestCandidate.path.length ? candidate : bestCandidate);
1868
+ }, undefined);
1869
+ }
1870
1870
  let UNSET_BATCH = [];
1871
1871
  let PENDING_UNSET;
1872
1872
  function unsetPathValue(path) {
@@ -1979,6 +1979,7 @@
1979
1979
  submitCount,
1980
1980
  meta,
1981
1981
  isSubmitting,
1982
+ isValidating,
1982
1983
  fieldArrays,
1983
1984
  keepValuesOnUnmount,
1984
1985
  validateSchema: vue.unref(schema) ? validateSchema : undefined,
@@ -2101,6 +2102,7 @@
2101
2102
  if (formCtx.validateSchema) {
2102
2103
  return formCtx.validateSchema(mode);
2103
2104
  }
2105
+ isValidating.value = true;
2104
2106
  // No schema, each field is responsible to validate itself
2105
2107
  const validations = await Promise.all(pathStates.value.map(state => {
2106
2108
  if (!state.validate) {
@@ -2118,6 +2120,7 @@
2118
2120
  };
2119
2121
  });
2120
2122
  }));
2123
+ isValidating.value = false;
2121
2124
  const results = {};
2122
2125
  const errors = {};
2123
2126
  for (const validation of validations) {
@@ -2173,12 +2176,14 @@
2173
2176
  if (!schemaValue) {
2174
2177
  return { valid: true, results: {}, errors: {} };
2175
2178
  }
2179
+ isValidating.value = true;
2176
2180
  const formResult = isYupValidator(schemaValue) || isTypedSchema(schemaValue)
2177
2181
  ? await validateTypedSchema(schemaValue, formValues)
2178
2182
  : await validateObjectSchema(schemaValue, formValues, {
2179
2183
  names: fieldNames.value,
2180
2184
  bailsMap: fieldBailsMap.value,
2181
2185
  });
2186
+ isValidating.value = false;
2182
2187
  return formResult;
2183
2188
  }
2184
2189
  const submitForm = handleSubmit((_, { evt }) => {
@@ -2421,7 +2426,7 @@
2421
2426
  const initialValues = vue.toRef(props, 'initialValues');
2422
2427
  const validationSchema = vue.toRef(props, 'validationSchema');
2423
2428
  const keepValues = vue.toRef(props, 'keepValues');
2424
- const { errors, errorBag, values, meta, isSubmitting, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2429
+ const { errors, errorBag, values, meta, isSubmitting, isValidating, submitCount, controlledValues, validate, validateField, handleReset, resetForm, handleSubmit, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, resetField, } = useForm({
2425
2430
  validationSchema: validationSchema.value ? validationSchema : undefined,
2426
2431
  initialValues,
2427
2432
  initialErrors: props.initialErrors,
@@ -2465,6 +2470,7 @@
2465
2470
  errorBag: errorBag.value,
2466
2471
  values,
2467
2472
  isSubmitting: isSubmitting.value,
2473
+ isValidating: isValidating.value,
2468
2474
  submitCount: submitCount.value,
2469
2475
  controlledValues: controlledValues.value,
2470
2476
  validate,
@@ -2901,6 +2907,20 @@
2901
2907
  });
2902
2908
  }
2903
2909
 
2910
+ /**
2911
+ * If the form is validating or not
2912
+ */
2913
+ function useIsValidating() {
2914
+ const form = injectWithSelf(FormContextKey);
2915
+ if (!form) {
2916
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
2917
+ }
2918
+ return vue.computed(() => {
2919
+ var _a;
2920
+ return (_a = form === null || form === void 0 ? void 0 : form.isValidating.value) !== null && _a !== void 0 ? _a : false;
2921
+ });
2922
+ }
2923
+
2904
2924
  /**
2905
2925
  * Validates a single field
2906
2926
  */
@@ -3087,6 +3107,7 @@
3087
3107
  exports.useIsFormTouched = useIsFormTouched;
3088
3108
  exports.useIsFormValid = useIsFormValid;
3089
3109
  exports.useIsSubmitting = useIsSubmitting;
3110
+ exports.useIsValidating = useIsValidating;
3090
3111
  exports.useResetForm = useResetForm;
3091
3112
  exports.useSubmitCount = useSubmitCount;
3092
3113
  exports.useSubmitForm = useSubmitForm;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * vee-validate v4.9.2
2
+ * vee-validate v4.9.3
3
3
  * (c) 2023 Abdelrahman Awad
4
4
  * @license MIT
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VeeValidate={},e.Vue)}(this,(function(e,t){"use strict";function n(e){return"function"==typeof e}function r(e){return null==e}const a=e=>null!==e&&!!e&&"object"==typeof e&&!Array.isArray(e);function l(e){return Number(e)>=0}function i(e,t){return Object.keys(t).forEach((n=>{if(a(t[n]))return e[n]||(e[n]={}),void i(e[n],t[n]);e[n]=t[n]})),e}const u={};const o=Symbol("vee-validate-form"),s=Symbol("vee-validate-field-instance"),d=Symbol("Default empty value"),c="undefined"!=typeof window;function v(e){return n(e)&&!!e.__locatorRef}function f(e){return!!e&&n(e.parse)&&"VVTypedSchema"===e.__type}function p(e){return!!e&&n(e.validate)}function m(e){return"checkbox"===e||"radio"===e}function h(e){return/^\[.+\]$/i.test(e)}function y(e){return"SELECT"===e.tagName}function g(e,t){return!function(e,t){const n=![!1,null,void 0,0].includes(t.multiple)&&!Number.isNaN(t.multiple);return"select"===e&&"multiple"in t&&n}(e,t)&&"file"!==t.type&&!m(t.type)}function b(e){return O(e)&&e.target&&"submit"in e.target}function O(e){return!!e&&(!!("undefined"!=typeof Event&&n(Event)&&e instanceof Event)||!(!e||!e.srcElement))}function V(e,t){return t in e&&e[t]!==d}function F(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,r,a;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!F(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(r of e.entries())if(!t.has(r[0]))return!1;for(r of e.entries())if(!F(r[1],t.get(r[0])))return!1;return!0}if(A(e)&&A(t))return e.size===t.size&&(e.name===t.name&&(e.lastModified===t.lastModified&&e.type===t.type));if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(r of e.entries())if(!t.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((n=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!=r--;){var l=a[r];if(!F(e[l],t[l]))return!1}return!0}return e!=e&&t!=t}function A(e){return!!c&&e instanceof File}function j(e,t,n){"object"==typeof n.value&&(n.value=w(n.value)),n.enumerable&&!n.get&&!n.set&&n.configurable&&n.writable&&"__proto__"!==t?e[t]=n.value:Object.defineProperty(e,t,n)}function w(e){if("object"!=typeof e)return e;var t,n,r,a=0,l=Object.prototype.toString.call(e);if("[object Object]"===l?r=Object.create(e.__proto__||null):"[object Array]"===l?r=Array(e.length):"[object Set]"===l?(r=new Set,e.forEach((function(e){r.add(w(e))}))):"[object Map]"===l?(r=new Map,e.forEach((function(e,t){r.set(w(t),w(e))}))):"[object Date]"===l?r=new Date(+e):"[object RegExp]"===l?r=new RegExp(e.source,e.flags):"[object DataView]"===l?r=new e.constructor(w(e.buffer)):"[object ArrayBuffer]"===l?r=e.slice(0):"Array]"===l.slice(-6)&&(r=new e.constructor(e)),r){for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)j(r,n[a],Object.getOwnPropertyDescriptor(e,n[a]));for(a=0,n=Object.getOwnPropertyNames(e);a<n.length;a++)Object.hasOwnProperty.call(r,t=n[a])&&r[t]===e[t]||j(r,t,Object.getOwnPropertyDescriptor(e,t))}return r||e}function S(e){return h(e)?e.replace(/\[|\]/gi,""):e}function E(e,t,n){if(!e)return n;if(h(t))return e[S(t)];return(t||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce(((e,t)=>{return(a(r=e)||Array.isArray(r))&&t in e?e[t]:n;var r}),e)}function k(e,t,n){if(h(t))return void(e[S(t)]=n);const a=t.split(/\.|\[(\d+)\]/).filter(Boolean);let i=e;for(let e=0;e<a.length;e++){if(e===a.length-1)return void(i[a[e]]=n);a[e]in i&&!r(i[a[e]])||(i[a[e]]=l(a[e+1])?[]:{}),i=i[a[e]]}}function I(e,t){Array.isArray(e)&&l(t)?e.splice(Number(t),1):a(e)&&delete e[t]}function C(e,t){if(h(t))return void delete e[S(t)];const n=t.split(/\.|\[(\d+)\]/).filter(Boolean);let l=e;for(let e=0;e<n.length;e++){if(e===n.length-1){I(l,n[e]);break}if(!(n[e]in l)||r(l[n[e]]))break;l=l[n[e]]}const i=n.map(((t,r)=>E(e,n.slice(0,r).join("."))));for(let t=i.length-1;t>=0;t--)u=i[t],(Array.isArray(u)?0===u.length:a(u)&&0===Object.keys(u).length)&&(0!==t?I(i[t-1],n[t-1]):I(e,n[0]));var u}function M(e){return Object.keys(e)}function B(e,n=void 0){const r=t.getCurrentInstance();return(null==r?void 0:r.provides[e])||t.inject(e,n)}function _(e){t.warn(`[vee-validate]: ${e}`)}function T(e,t,n){if(Array.isArray(e)){const n=[...e],r=n.findIndex((e=>F(e,t)));return r>=0?n.splice(r,1):n.push(t),n}return F(e,t)?n:t}function U(e,t=0){let n=null,r=[];return function(...a){return n&&window.clearTimeout(n),n=window.setTimeout((()=>{const t=e(...a);r.forEach((e=>e(t))),r=[]}),t),new Promise((e=>r.push(e)))}}function P(e,t){return a(t)&&t.number?function(e){const t=parseFloat(e);return isNaN(t)?e:t}(e):e}function R(e,t){let n;return async function(...r){const a=e(...r);n=a;const l=await a;return a!==n||(n=void 0,t(l,r)),l}}function x({get:e,set:n}){const r=t.ref(w(e()));return t.watch(e,(e=>{F(e,r.value)||(r.value=w(e))}),{deep:!0}),t.watch(r,(t=>{F(t,e())||n(w(t))}),{deep:!0}),r}function N(e){return n(e)?e():t.unref(e)}function $(e){return Array.isArray(e)?e:e?[e]:[]}function D(e){const n=B(o),r=e?t.computed((()=>null==n?void 0:n.getPathState(t.unref(e)))):void 0,a=e?void 0:t.inject(s);return a||(null==r?void 0:r.value)||_(`field with name ${t.unref(e)} was not found`),r||a}function z(e,t){const n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return n}const q=(e,t,n)=>t.slots.default?"string"!=typeof e&&e?{default:()=>{var e,r;return null===(r=(e=t.slots).default)||void 0===r?void 0:r.call(e,n())}}:t.slots.default(n()):t.slots.default;function L(e){if(K(e))return e._value}function K(e){return"_value"in e}function G(e){if(!O(e))return e;const t=e.target;if(m(t.type)&&K(t))return L(t);if("file"===t.type&&t.files){const e=Array.from(t.files);return t.multiple?e:e[0]}if(y(n=t)&&n.multiple)return Array.from(t.options).filter((e=>e.selected&&!e.disabled)).map(L);var n;if(y(t)){const e=Array.from(t.options).find((e=>e.selected));return e?L(e):t.value}return t.value}function W(e){const t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),e?a(e)&&e._$$isNormalized?e:a(e)?Object.keys(e).reduce(((t,n)=>{const r=function(e){if(!0===e)return[];if(Array.isArray(e))return e;if(a(e))return e;return[e]}(e[n]);return!1!==e[n]&&(t[n]=X(r)),t}),t):"string"!=typeof e?t:e.split("|").reduce(((e,t)=>{const n=H(t);return n.name?(e[n.name]=X(n.params),e):e}),t):t}function X(e){const t=e=>"string"==typeof e&&"@"===e[0]?function(e){const t=t=>E(t,e)||t[e];return t.__locatorRef=e,t}(e.slice(1)):e;return Array.isArray(e)?e.map(t):e instanceof RegExp?[e]:Object.keys(e).reduce(((n,r)=>(n[r]=t(e[r]),n)),{})}const H=e=>{let t=[];const n=e.split(":")[0];return e.includes(":")&&(t=e.split(":").slice(1).join(":").split(",")),{name:n,params:t}};let J=Object.assign({},{generateMessage:({field:e})=>`${e} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const Q=()=>J,Y=e=>{J=Object.assign(Object.assign({},J),e)};async function Z(e,t,r={}){const a=null==r?void 0:r.bails,l={name:(null==r?void 0:r.name)||"{field}",rules:t,label:null==r?void 0:r.label,bails:null==a||a,formData:(null==r?void 0:r.values)||{}},i=await async function(e,t){if(f(e.rules)||p(e.rules))return async function(e,t){const n=f(t)?t:ee(t),r=await n.parse(e),a=[];for(const e of r.errors)e.errors.length&&a.push(...e.errors);return{errors:a}}(t,e.rules);if(n(e.rules)||Array.isArray(e.rules)){const n={field:e.label||e.name,name:e.name,label:e.label,form:e.formData,value:t},r=Array.isArray(e.rules)?e.rules:[e.rules],a=r.length,l=[];for(let i=0;i<a;i++){const a=r[i],u=await a(t,n);if("string"!=typeof u&&u)continue;const o="string"==typeof u?u:ne(n);if(l.push(o),e.bails)return{errors:l}}return{errors:l}}const r=Object.assign(Object.assign({},e),{rules:W(e.rules)}),a=[],l=Object.keys(r.rules),i=l.length;for(let n=0;n<i;n++){const i=l[n],u=await te(r,t,{name:i,params:r.rules[i]});if(u.error&&(a.push(u.error),e.bails))return{errors:a}}return{errors:a}}(l,e),u=i.errors;return{errors:u,valid:!u.length}}function ee(e){return{__type:"VVTypedSchema",async parse(t){var n;try{return{output:await e.validate(t,{abortEarly:!1}),errors:[]}}catch(e){if(!function(e){return!!e&&"ValidationError"===e.name}(e))throw e;if(!(null===(n=e.inner)||void 0===n?void 0:n.length)&&e.errors.length)return{errors:[{path:e.path,errors:e.errors}]};const t=e.inner.reduce(((e,t)=>{const n=t.path||"";return e[n]||(e[n]={errors:[],path:n}),e[n].errors.push(...t.errors),e}),{});return{errors:Object.values(t)}}}}}async function te(e,t,n){const r=(a=n.name,u[a]);var a;if(!r)throw new Error(`No such validator '${n.name}' exists.`);const l=function(e,t){const n=e=>v(e)?e(t):e;if(Array.isArray(e))return e.map(n);return Object.keys(e).reduce(((t,r)=>(t[r]=n(e[r]),t)),{})}(n.params,e.formData),i={field:e.label||e.name,name:e.name,label:e.label,value:t,form:e.formData,rule:Object.assign(Object.assign({},n),{params:l})},o=await r(t,l,i);return"string"==typeof o?{error:o}:{error:o?void 0:ne(i)}}function ne(e){const t=Q().generateMessage;return t?t(e):"Field is invalid"}async function re(e,t,n){const r=M(e).map((async r=>{var a,l,i;const u=null===(a=null==n?void 0:n.names)||void 0===a?void 0:a[r],o=await Z(E(t,r),e[r],{name:(null==u?void 0:u.name)||r,label:null==u?void 0:u.label,values:t,bails:null===(i=null===(l=null==n?void 0:n.bailsMap)||void 0===l?void 0:l[r])||void 0===i||i});return Object.assign(Object.assign({},o),{path:r})}));let a=!0;const l=await Promise.all(r),i={},u={};for(const e of l)i[e.path]={valid:e.valid,errors:e.errors},e.valid||(a=!1,u[e.path]=e.errors[0]);return{valid:a,results:i,errors:u}}let ae=0;function le(e,n){const{value:r,initialValue:a,setInitialValue:l}=function(e,n,r){const a=t.ref(t.unref(n));function l(){return r?E(r.initialValues.value,t.unref(e),t.unref(a)):t.unref(a)}function i(n){r?r.stageInitialValue(t.unref(e),n,!0):a.value=n}const u=t.computed(l);if(!r){return{value:t.ref(l()),initialValue:u,setInitialValue:i}}const o=function(e,n,r,a){if(t.isRef(e))return t.unref(e);if(void 0!==e)return e;return E(n.values,t.unref(a),t.unref(r))}(n,r,u,e);r.stageInitialValue(t.unref(e),o,!0);const s=t.computed({get:()=>E(r.values,t.unref(e)),set(n){r.setFieldValue(t.unref(e),n)}});return{value:s,initialValue:u,setInitialValue:i}}(e,n.modelValue,n.form);if(!n.form){const{errors:o,setErrors:s}=function(){const e=t.ref([]);return{errors:e,setErrors:t=>{e.value=$(t)}}}(),d=ae>=Number.MAX_SAFE_INTEGER?0:++ae,c=function(e,n,r){const a=t.reactive({touched:!1,pending:!1,valid:!0,validated:!!t.unref(r).length,initialValue:t.computed((()=>t.unref(n))),dirty:t.computed((()=>!F(t.unref(e),t.unref(n))))});return t.watch(r,(e=>{a.valid=!e.length}),{immediate:!0,flush:"sync"}),a}(r,a,o);function v(e){var t;"value"in e&&(r.value=e.value),"errors"in e&&s(e.errors),"touched"in e&&(c.touched=null!==(t=e.touched)&&void 0!==t?t:c.touched),"initialValue"in e&&l(e.initialValue)}return{id:d,path:e,value:r,initialValue:a,meta:c,flags:{pendingUnmount:{[d]:!1}},errors:o,setState:v}}const i=n.form.createPathState(e,{bails:n.bails,label:n.label,type:n.type,validate:n.validate}),u=t.computed((()=>i.errors));return{id:Array.isArray(i.id)?i.id[i.id.length-1]:i.id,path:e,value:r,errors:u,meta:i,initialValue:a,flags:i.__flags,setState:function(a){var i,u,o;"value"in a&&(r.value=a.value),"errors"in a&&(null===(i=n.form)||void 0===i||i.setFieldError(t.unref(e),a.errors)),"touched"in a&&(null===(u=n.form)||void 0===u||u.setFieldTouched(t.unref(e),null!==(o=a.touched)&&void 0!==o&&o)),"initialValue"in a&&l(a.initialValue)}}}function ie(e,n,r){return m(null==r?void 0:r.type)?function(e,n,r){const a=(null==r?void 0:r.standalone)?void 0:B(o),l=null==r?void 0:r.checkedValue,i=null==r?void 0:r.uncheckedValue;function u(n){const r=n.handleChange,u=t.computed((()=>{const e=t.unref(n.value),r=t.unref(l);return Array.isArray(e)?e.findIndex((e=>F(e,r)))>=0:F(r,e)}));function o(o,s=!0){var d;if(u.value===(null===(d=null==o?void 0:o.target)||void 0===d?void 0:d.checked))return void(s&&n.validate());const c=N(e),v=null==a?void 0:a.getPathState(c),f=G(o);let p;p=a&&(null==v?void 0:v.multiple)&&"checkbox"===v.type?T(E(a.values,c)||[],f,void 0):T(t.unref(n.value),t.unref(l),t.unref(i)),r(p,s)}return Object.assign(Object.assign({},n),{checked:u,checkedValue:l,uncheckedValue:i,handleChange:o})}return u(ue(e,n,r))}(e,n,r):ue(e,n,r)}function ue(e,r,a){const{initialValue:l,validateOnMount:i,bails:u,type:c,checkedValue:m,label:h,validateOnValueUpdate:y,uncheckedValue:g,controlled:b,keepValueOnUnmount:O,modelPropName:V,syncVModel:A,form:j}=function(e){var n;const r=()=>({initialValue:void 0,validateOnMount:!1,bails:!0,label:void 0,validateOnValueUpdate:!0,keepValueOnUnmount:void 0,modelPropName:"modelValue",syncVModel:!0,controlled:!0}),a=null===(n=null==e?void 0:e.syncVModel)||void 0===n||n,l=a&&!("initialValue"in(e||{}))?oe(t.getCurrentInstance(),(null==e?void 0:e.modelPropName)||"modelValue"):null==e?void 0:e.initialValue;if(!e)return Object.assign(Object.assign({},r()),{initialValue:l});const i="valueProp"in e?e.valueProp:e.checkedValue,u="standalone"in e?!e.standalone:e.controlled;return Object.assign(Object.assign(Object.assign({},r()),e||{}),{initialValue:l,controlled:null==u||u,checkedValue:i})}(a),S=b?B(o):void 0,k=j||S,I=function(e){return t.computed((()=>N(e)))}(e),C=t.computed((()=>{if(t.unref(null==k?void 0:k.schema))return;const e=t.unref(r);return p(e)||f(e)||n(e)||Array.isArray(e)?e:W(e)})),{id:_,value:T,initialValue:U,meta:x,setState:$,errors:D,flags:z}=le(I,{modelValue:l,form:k,bails:u,label:h,type:c,validate:C.value?H:void 0}),q=t.computed((()=>D.value[0]));A&&function({prop:e,value:n,handleChange:r}){const a=t.getCurrentInstance();if(!a)return;const l=e||"modelValue",i=`update:${l}`;if(!(l in a.props))return;t.watch(n,(e=>{F(e,oe(a,l))||a.emit(i,e)})),t.watch((()=>oe(a,l)),(e=>{if(e===d&&void 0===n.value)return;const t=e===d?void 0:e;F(t,P(n.value,a.props.modelModifiers))||r(t)}))}({value:T,prop:V,handleChange:J});async function L(e){var n,r;return(null==k?void 0:k.validateSchema)?null!==(n=(await k.validateSchema(e)).results[t.unref(I)])&&void 0!==n?n:{valid:!0,errors:[]}:C.value?Z(T.value,C.value,{name:t.unref(I),label:t.unref(h),values:null!==(r=null==k?void 0:k.values)&&void 0!==r?r:{},bails:u}):{valid:!0,errors:[]}}const K=R((async()=>(x.pending=!0,x.validated=!0,L("validated-only"))),(e=>{if(!z.pendingUnmount[te.id])return $({errors:e.errors}),x.pending=!1,x.valid=e.valid,e})),X=R((async()=>L("silent")),(e=>(x.valid=e.valid,e)));function H(e){return"silent"===(null==e?void 0:e.mode)?X():K()}function J(e,t=!0){Y(G(e),!1),!y&&t&&K()}function Q(e){var t;const n=e&&"value"in e?e.value:U.value;$({value:w(n),initialValue:w(n),touched:null!==(t=null==e?void 0:e.touched)&&void 0!==t&&t,errors:(null==e?void 0:e.errors)||[]}),x.pending=!1,x.validated=!1,X()}function Y(e,t=!0){if(T.value=e,!t)return;(y?K:X)()}t.onMounted((()=>{if(i)return K();k&&k.validateSchema||X()}));const ee=t.computed({get:()=>T.value,set(e){Y(e,y)}}),te={id:_,name:I,label:h,value:ee,meta:x,errors:D,errorMessage:q,type:c,checkedValue:m,uncheckedValue:g,bails:u,keepValueOnUnmount:O,resetField:Q,handleReset:()=>Q(),validate:H,handleChange:J,handleBlur:()=>{x.touched=!0},setState:$,setTouched:function(e){x.touched=e},setErrors:function(e){$({errors:Array.isArray(e)?e:[e]})},setValue:Y};if(t.provide(s,te),t.isRef(r)&&"function"!=typeof t.unref(r)&&t.watch(r,((e,t)=>{F(e,t)||(x.validated?K():X())}),{deep:!0}),!k)return te;const ne=t.computed((()=>{const e=C.value;return!e||n(e)||p(e)||f(e)||Array.isArray(e)?{}:Object.keys(e).reduce(((t,n)=>{const r=(a=e[n],Array.isArray(a)?a.filter(v):M(a).filter((e=>v(a[e]))).map((e=>a[e]))).map((e=>e.__locatorRef)).reduce(((e,t)=>{const n=E(k.values,t)||k.values[t];return void 0!==n&&(e[t]=n),e}),{});var a;return Object.assign(t,r),t}),{})}));return t.watch(ne,((e,t)=>{if(!Object.keys(e).length)return;!F(e,t)&&(x.validated?K():X())})),t.onBeforeUnmount((()=>{var e;const n=null!==(e=t.unref(te.keepValueOnUnmount))&&void 0!==e?e:t.unref(k.keepValuesOnUnmount),r=N(I);if(n||!k||z.pendingUnmount[te.id])return void(null==k||k.removePathState(r,_));z.pendingUnmount[te.id]=!0;const a=k.getPathState(r);if(Array.isArray(null==a?void 0:a.id)&&(null==a?void 0:a.multiple)?null==a?void 0:a.id.includes(te.id):(null==a?void 0:a.id)===te.id){if((null==a?void 0:a.multiple)&&Array.isArray(a.value)){const e=a.value.findIndex((e=>F(e,t.unref(te.checkedValue))));if(e>-1){const t=[...a.value];t.splice(e,1),k.setFieldValue(r,t)}Array.isArray(a.id)&&a.id.splice(a.id.indexOf(te.id),1)}else k.unsetPathValue(N(I));k.removePathState(r,_)}})),te}function oe(e,t){if(e)return e.props[t]}function se(e,t){let n=e.as||"";return e.as||t.slots.default||(n="input"),n}function de(e,t){return m(t.attrs.type)?V(e,"modelValue")?e.modelValue:void 0:V(e,"modelValue")?e.modelValue:t.attrs.value}const ce=t.defineComponent({name:"Field",inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>Q().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:d},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1},keepValue:{type:Boolean,default:void 0}},setup(e,r){const a=t.toRef(e,"rules"),l=t.toRef(e,"name"),i=t.toRef(e,"label"),u=t.toRef(e,"uncheckedValue"),o=t.toRef(e,"keepValue"),{errors:s,value:d,errorMessage:c,validate:v,handleChange:f,handleBlur:p,setTouched:h,resetField:y,handleReset:b,meta:O,checked:V,setErrors:F}=ie(l,a,{validateOnMount:e.validateOnMount,bails:e.bails,standalone:e.standalone,type:r.attrs.type,initialValue:de(e,r),checkedValue:r.attrs.value,uncheckedValue:u,label:i,validateOnValueUpdate:!1,keepValueOnUnmount:o}),A=function(e,t=!0){f(e,t),r.emit("update:modelValue",d.value)},j=function(e){(e=>{m(r.attrs.type)||(d.value=G(e))})(e),r.emit("update:modelValue",d.value)},w=t.computed((()=>{const{validateOnInput:t,validateOnChange:a,validateOnBlur:l,validateOnModelUpdate:i}=function(e){var t,n,r,a;const{validateOnInput:l,validateOnChange:i,validateOnBlur:u,validateOnModelUpdate:o}=Q();return{validateOnInput:null!==(t=e.validateOnInput)&&void 0!==t?t:l,validateOnChange:null!==(n=e.validateOnChange)&&void 0!==n?n:i,validateOnBlur:null!==(r=e.validateOnBlur)&&void 0!==r?r:u,validateOnModelUpdate:null!==(a=e.validateOnModelUpdate)&&void 0!==a?a:o}}(e);const u={name:e.name,onBlur:function(e){p(e),n(r.attrs.onBlur)&&r.attrs.onBlur(e),l&&v()},onInput:function(e){A(e,t),n(r.attrs.onInput)&&r.attrs.onInput(e)},onChange:function(e){A(e,a),n(r.attrs.onChange)&&r.attrs.onChange(e)},"onUpdate:modelValue":e=>A(e,i)};m(r.attrs.type)&&V&&(u.checked=V.value);return g(se(e,r),r.attrs)&&(u.value=d.value),u}));function S(){return{field:w.value,value:d.value,meta:O,errors:s.value,errorMessage:c.value,validate:v,resetField:y,handleChange:A,handleInput:j,handleReset:b,handleBlur:p,setTouched:h,setErrors:F}}return r.expose({setErrors:F,setTouched:h,reset:y,validate:v,handleChange:f}),()=>{const n=t.resolveDynamicComponent(se(e,r)),a=q(n,r,S);return n?t.h(n,Object.assign(Object.assign({},r.attrs),w.value),a):a}}});let ve=0;const fe=["bails","fieldsCount","id","multiple","type","validate"];function pe(e){const r=t.unref(null==e?void 0:e.initialValues)||{},a=t.unref(null==e?void 0:e.validationSchema);return a&&f(a)&&n(a.cast)?w(a.cast(r)||{}):w(r)}function me(e){var r;const a=ve++;let l=0;const u=t.ref(!1),s=t.ref(0),d=[],c=t.reactive(pe(e)),v=t.ref([]),m=t.ref({});function h(e,t){const n=X(e);n?n.errors=$(t):m.value[e]=$(t)}function y(e){M(e).forEach((t=>{h(t,e[t])}))}(null==e?void 0:e.initialErrors)&&y(e.initialErrors);const g=t.computed((()=>{const e=v.value.reduce(((e,t)=>(t.errors.length&&(e[t.path]=t.errors),e)),{});return Object.assign(Object.assign({},m.value),e)})),O=t.computed((()=>M(g.value).reduce(((e,t)=>{const n=g.value[t];return(null==n?void 0:n.length)&&(e[t]=n[0]),e}),{}))),V=t.computed((()=>v.value.reduce(((e,t)=>(e[t.path]={name:t.path||"",label:t.label||""},e)),{}))),A=t.computed((()=>v.value.reduce(((e,t)=>{var n;return e[t.path]=null===(n=t.bails)||void 0===n||n,e}),{}))),j=Object.assign({},(null==e?void 0:e.initialErrors)||{}),S=null!==(r=null==e?void 0:e.keepValuesOnUnmount)&&void 0!==r&&r,{initialValues:I,originalInitialValues:B,setInitialValues:_}=function(e,n,r){const a=pe(r),l=null==r?void 0:r.initialValues,i=t.ref(a),u=t.ref(w(a));function o(t,r=!1){i.value=w(t),u.value=w(t),r&&e.value.forEach((e=>{if(e.touched)return;const t=E(i.value,e.path);k(n,e.path,w(t))}))}t.isRef(l)&&t.watch(l,(e=>{o(e,!0)}),{deep:!0});return{initialValues:i,originalInitialValues:u,setInitialValues:o}}(v,c,e),T=function(e,n,r,a){const l={touched:"some",pending:"some",valid:"every"},i=t.computed((()=>!F(n,t.unref(r))));function u(){const t=e.value;return M(l).reduce(((e,n)=>{const r=l[n];return e[n]=t[r]((e=>e[n])),e}),{})}const o=t.reactive(u());return t.watchEffect((()=>{const e=u();o.touched=e.touched,o.valid=e.valid,o.pending=e.pending})),t.computed((()=>Object.assign(Object.assign({initialValues:t.unref(r)},o),{valid:o.valid&&!M(a.value).length,dirty:i.value})))}(v,c,B,O),P=t.computed((()=>v.value.reduce(((e,t)=>{const n=E(c,t.path);return k(e,t.path,n),e}),{}))),x=null==e?void 0:e.validationSchema;function D(e,n){var r,a;const i=t.computed((()=>E(I.value,N(e)))),u=v.value.find((n=>n.path===t.unref(e)));if(u){"checkbox"!==(null==n?void 0:n.type)&&"radio"!==(null==n?void 0:n.type)||(u.multiple=!0);const e=l++;return Array.isArray(u.id)?u.id.push(e):u.id=[u.id,e],u.fieldsCount++,u.__flags.pendingUnmount[e]=!1,u}const o=t.computed((()=>E(c,N(e)))),s=N(e),d=l++,f=t.reactive({id:d,path:e,touched:!1,pending:!1,valid:!0,validated:!!(null===(r=j[s])||void 0===r?void 0:r.length),initialValue:i,errors:t.shallowRef([]),bails:null!==(a=null==n?void 0:n.bails)&&void 0!==a&&a,label:null==n?void 0:n.label,type:(null==n?void 0:n.type)||"default",value:o,multiple:!1,__flags:{pendingUnmount:{[d]:!1}},fieldsCount:1,validate:null==n?void 0:n.validate,dirty:t.computed((()=>!F(t.unref(o),t.unref(i))))});return v.value.push(f),O.value[s]&&!j[s]&&t.nextTick((()=>{ce(s)})),t.isRef(e)&&t.watch(e,(e=>{const n=w(o.value);t.nextTick((()=>{k(c,e,n)}))})),f}const q=U(ye,5),L=U(ye,5),K=R((async e=>"silent"===await e?q():L()),((e,[t])=>{const n=M(te.errorBag.value);return[...new Set([...M(e.results),...v.value.map((e=>e.path)),...n])].reduce(((n,r)=>{const a=r,l=X(a),i=(e.results[a]||{errors:[]}).errors,u={errors:i,valid:!i.length};return n.results[a]=u,u.valid||(n.errors[a]=u.errors[0]),l&&m.value[a]&&delete m.value[a],l?(l.valid=u.valid,"silent"===t?n:"validated-only"!==t||l.validated?(h(l,u.errors),n):n):(h(a,i),n)}),{valid:e.valid,results:{},errors:{}})}));function W(e){v.value.forEach(e)}function X(e){return"string"==typeof e?v.value.find((t=>t.path===e)):e}let H,J=[];function Y(e){return function(t,n){return function(r){return r instanceof Event&&(r.preventDefault(),r.stopPropagation()),W((e=>e.touched=!0)),u.value=!0,s.value++,de().then((a=>{const l=w(c);if(a.valid&&"function"==typeof t){const n=w(P.value);let i=e?n:l;return a.values&&(i=a.values),t(i,{evt:r,controlledValues:n,setErrors:y,setFieldError:h,setTouched:ue,setFieldTouched:ie,setValues:ae,setFieldValue:ne,resetForm:se,resetField:oe})}a.valid||"function"!=typeof n||n({values:l,evt:r,errors:a.errors,results:a.results})})).then((e=>(u.value=!1,e)),(e=>{throw u.value=!1,e}))}}}const Z=Y(!1);Z.withControlled=Y(!0);const te={formId:a,values:c,controlledValues:P,errorBag:g,errors:O,schema:x,submitCount:s,meta:T,isSubmitting:u,fieldArrays:d,keepValuesOnUnmount:S,validateSchema:t.unref(x)?K:void 0,validate:de,setFieldError:h,validateField:ce,setFieldValue:ne,setValues:ae,setErrors:y,setFieldTouched:ie,setTouched:ue,resetForm:se,resetField:oe,handleSubmit:Z,stageInitialValue:function(t,n,r=!1){he(t,n),k(c,t,n),r&&!(null==e?void 0:e.initialValues)&&k(B.value,t,w(n))},unsetInitialValue:me,setFieldInitialValue:he,useFieldModel:function(e){if(!Array.isArray(e))return le(e);return e.map(le)},createPathState:D,getPathState:X,unsetPathValue:function(e){return J.push(e),H||(H=t.nextTick((()=>{[...J].sort().reverse().forEach((e=>{C(c,e)})),J=[],H=null}))),H},removePathState:function(e,t){const n=v.value.findIndex((t=>t.path===e)),r=v.value[n];if(-1!==n&&r){if(r.multiple&&r.fieldsCount&&r.fieldsCount--,Array.isArray(r.id)){const e=r.id.indexOf(t);e>=0&&r.id.splice(e,1),delete r.__flags.pendingUnmount[t]}(!r.multiple||r.fieldsCount<=0)&&(v.value.splice(n,1),me(e))}},initialValues:I,getAllPathStates:()=>v.value,markForUnmount:function(e){return W((t=>{t.path.startsWith(e)&&M(t.__flags.pendingUnmount).forEach((e=>{t.__flags.pendingUnmount[e]=!0}))}))}};function ne(e,t){const n=w(t),r="string"==typeof e?e:e.path;X(r)||D(r),k(c,r,n)}function ae(e){i(c,e),d.forEach((e=>e&&e.reset()))}function le(e){const n=X(t.unref(e))||D(e);return t.computed({get:()=>n.value,set(r){const a=t.unref(e);ne(a,r),n.validated=!0,n.pending=!0,ce(a).then((()=>{n.pending=!1}))}})}function ie(e,t){const n=X(e);n&&(n.touched=t)}function ue(e){M(e).forEach((t=>{ie(t,!!e[t])}))}function oe(e,t){var n;const r=t&&"value"in t?t.value:E(I.value,e);he(e,w(r)),ne(e,r),ie(e,null!==(n=null==t?void 0:t.touched)&&void 0!==n&&n),h(e,(null==t?void 0:t.errors)||[])}function se(e){const n=(null==e?void 0:e.values)?e.values:B.value;_(n),ae(n),W((t=>{var r;t.validated=!1,t.touched=(null===(r=null==e?void 0:e.touched)||void 0===r?void 0:r[t.path])||!1,ne(t.path,E(n,t.path)),h(t.path,void 0)})),y((null==e?void 0:e.errors)||{}),s.value=(null==e?void 0:e.submitCount)||0,t.nextTick((()=>{de({mode:"silent"})}))}async function de(e){const t=(null==e?void 0:e.mode)||"force";if("force"===t&&W((e=>e.validated=!0)),te.validateSchema)return te.validateSchema(t);const n=await Promise.all(v.value.map((t=>t.validate?t.validate(e).then((e=>({key:t.path,valid:e.valid,errors:e.errors}))):Promise.resolve({key:t.path,valid:!0,errors:[]})))),r={},a={};for(const e of n)r[e.key]={valid:e.valid,errors:e.errors},e.errors.length&&(a[e.key]=e.errors[0]);return{valid:n.every((e=>e.valid)),results:r,errors:a}}async function ce(e){const n=X(e);if(n&&(n.validated=!0),x){const{results:t}=await K("validated-only");return t[e]||{errors:[],valid:!0}}return(null==n?void 0:n.validate)?n.validate():(n||t.warn(`field with path ${e} was not found`),Promise.resolve({errors:[],valid:!0}))}function me(e){C(I.value,e)}function he(e,t){k(I.value,e,w(t))}async function ye(){const e=t.unref(x);if(!e)return{valid:!0,results:{},errors:{}};const n=p(e)||f(e)?await async function(e,t){const n=f(e)?e:ee(e),r=await n.parse(t),a={},l={};for(const e of r.errors){const t=e.errors,n=(e.path||"").replace(/\["(\d+)"\]/g,((e,t)=>`[${t}]`));a[n]={valid:!t.length,errors:t},t.length&&(l[n]=t[0])}return{valid:!r.errors.length,results:a,errors:l,values:r.value}}(e,c):await re(e,c,{names:V.value,bailsMap:A.value});return n}const ge=Z(((e,{evt:t})=>{b(t)&&t.target.submit()}));return t.onMounted((()=>{(null==e?void 0:e.initialErrors)&&y(e.initialErrors),(null==e?void 0:e.initialTouched)&&ue(e.initialTouched),(null==e?void 0:e.validateOnMount)?de():te.validateSchema&&te.validateSchema("silent")})),t.isRef(x)&&t.watch(x,(()=>{var e;null===(e=te.validateSchema)||void 0===e||e.call(te,"validated-only")})),t.provide(o,te),Object.assign(Object.assign({},te),{handleReset:()=>se(),submitForm:ge,defineComponentBinds:function(e,r){const a=X(N(e))||D(e),l=()=>n(r)?r(z(a,fe)):r||{};function i(){var e;a.touched=!0;(null!==(e=l().validateOnBlur)&&void 0!==e?e:Q().validateOnBlur)&&ce(a.path)}function u(e){var t;ne(a.path,e);(null!==(t=l().validateOnModelUpdate)&&void 0!==t?t:Q().validateOnModelUpdate)&&ce(a.path)}return t.computed((()=>{const e={modelValue:a.value,"onUpdate:modelValue":u,onBlur:i};return n(r)?Object.assign(Object.assign({},e),r(a).props||{}):(null==r?void 0:r.mapProps)?Object.assign(Object.assign({},e),r.mapProps(z(a,fe))):e}))},defineInputBinds:function(e,r){const a=X(N(e))||D(e),l=()=>n(r)?r(z(a,fe)):r||{};function i(){var e;a.touched=!0;(null!==(e=l().validateOnBlur)&&void 0!==e?e:Q().validateOnBlur)&&ce(a.path)}function u(e){var t;const n=G(e);ne(a.path,n);(null!==(t=l().validateOnInput)&&void 0!==t?t:Q().validateOnInput)&&ce(a.path)}function o(e){var t;const n=G(e);ne(a.path,n);(null!==(t=l().validateOnChange)&&void 0!==t?t:Q().validateOnChange)&&ce(a.path)}return t.computed((()=>{const e={value:a.value,onChange:o,onInput:u,onBlur:i};return n(r)?Object.assign(Object.assign({},e),r(z(a,fe)).attrs||{}):(null==r?void 0:r.mapAttrs)?Object.assign(Object.assign({},e),r.mapAttrs(z(a,fe))):e}))}})}const he=t.defineComponent({name:"Form",inheritAttrs:!1,props:{as:{type:String,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0},keepValues:{type:Boolean,default:!1}},setup(e,n){const r=t.toRef(e,"initialValues"),a=t.toRef(e,"validationSchema"),l=t.toRef(e,"keepValues"),{errors:i,errorBag:u,values:o,meta:s,isSubmitting:d,submitCount:c,controlledValues:v,validate:f,validateField:p,handleReset:m,resetForm:h,handleSubmit:y,setErrors:g,setFieldError:V,setFieldValue:F,setValues:A,setFieldTouched:j,setTouched:S,resetField:E}=me({validationSchema:a.value?a:void 0,initialValues:r,initialErrors:e.initialErrors,initialTouched:e.initialTouched,validateOnMount:e.validateOnMount,keepValuesOnUnmount:l}),k=y(((e,{evt:t})=>{b(t)&&t.target.submit()}),e.onInvalidSubmit),I=e.onSubmit?y(e.onSubmit,e.onInvalidSubmit):k;function C(e){O(e)&&e.preventDefault(),m(),"function"==typeof n.attrs.onReset&&n.attrs.onReset()}function M(t,n){return y("function"!=typeof t||n?n:t,e.onInvalidSubmit)(t)}function B(){return w(o)}function _(){return w(s.value)}function T(){return w(i.value)}function U(){return{meta:s.value,errors:i.value,errorBag:u.value,values:o,isSubmitting:d.value,submitCount:c.value,controlledValues:v.value,validate:f,validateField:p,handleSubmit:M,handleReset:m,submitForm:k,setErrors:g,setFieldError:V,setFieldValue:F,setValues:A,setFieldTouched:j,setTouched:S,resetForm:h,resetField:E,getValues:B,getMeta:_,getErrors:T}}return n.expose({setFieldError:V,setErrors:g,setFieldValue:F,setValues:A,setFieldTouched:j,setTouched:S,resetForm:h,validate:f,validateField:p,resetField:E,getValues:B,getMeta:_,getErrors:T}),function(){const r="form"===e.as?e.as:t.resolveDynamicComponent(e.as),a=q(r,n,U);if(!e.as)return a;const l="form"===e.as?{novalidate:!0}:{};return t.h(r,Object.assign(Object.assign(Object.assign({},l),n.attrs),{onSubmit:I,onReset:C}),a)}}}),ye=he;function ge(e){const n=B(o,void 0),a=t.ref([]),l=()=>{},i={fields:a,remove:l,push:l,swap:l,insert:l,update:l,replace:l,prepend:l,move:l};if(!n)return _("FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly"),i;if(!t.unref(e))return _("FieldArray requires a field path to be provided, did you forget to pass the `name` prop?"),i;const u=n.fieldArrays.find((n=>t.unref(n.path)===t.unref(e)));if(u)return u;let s=0;function d(){return E(null==n?void 0:n.values,t.unref(e),[])||[]}function c(){const e=d();Array.isArray(e)&&(a.value=e.map(((e,t)=>f(e,t,a.value))),v())}function v(){const e=a.value.length;for(let t=0;t<e;t++){const n=a.value[t];n.isFirst=0===t,n.isLast=t===e-1}}function f(l,i,u){if(u&&!r(i)&&u[i])return u[i];const o=s++,d={key:o,value:x({get(){const r=E(null==n?void 0:n.values,t.unref(e),[])||[],i=a.value.findIndex((e=>e.key===o));return-1===i?l:r[i]},set(e){const t=a.value.findIndex((e=>e.key===o));-1!==t?m(t,e):_("Attempting to update a non-existent array item")}}),isFirst:!1,isLast:!1};return d}function p(){v(),null==n||n.validate({mode:"silent"})}function m(r,a){const l=t.unref(e),i=E(null==n?void 0:n.values,l);!Array.isArray(i)||i.length-1<r||(k(n.values,`${l}[${r}]`,a),null==n||n.validate({mode:"validated-only"}))}c();const h={fields:a,remove:function(r){const l=t.unref(e),i=E(null==n?void 0:n.values,l);if(!i||!Array.isArray(i))return;const u=[...i];u.splice(r,1);const o=l+`[${r}]`;n.markForUnmount(o),n.unsetInitialValue(o),k(n.values,l,u),a.value.splice(r,1),p()},push:function(l){const i=t.unref(e),u=E(null==n?void 0:n.values,i),o=r(u)?[]:u;if(!Array.isArray(o))return;const s=[...o];s.push(l),n.stageInitialValue(i+`[${s.length-1}]`,l),k(n.values,i,s),a.value.push(f(l)),p()},swap:function(r,l){const i=t.unref(e),u=E(null==n?void 0:n.values,i);if(!Array.isArray(u)||!(r in u)||!(l in u))return;const o=[...u],s=[...a.value],d=o[r];o[r]=o[l],o[l]=d;const c=s[r];s[r]=s[l],s[l]=c,k(n.values,i,o),a.value=s,v()},insert:function(r,l){const i=t.unref(e),u=E(null==n?void 0:n.values,i);if(!Array.isArray(u)||u.length<r)return;const o=[...u],s=[...a.value];o.splice(r,0,l),s.splice(r,0,f(l)),k(n.values,i,o),a.value=s,p()},update:m,replace:function(r){const a=t.unref(e);n.stageInitialValue(a,r),k(n.values,a,r),c(),p()},prepend:function(l){const i=t.unref(e),u=E(null==n?void 0:n.values,i),o=r(u)?[]:u;if(!Array.isArray(o))return;const s=[l,...o];n.stageInitialValue(i+`[${s.length-1}]`,l),k(n.values,i,s),a.value.unshift(f(l)),p()},move:function(l,i){const u=t.unref(e),o=E(null==n?void 0:n.values,u),s=r(o)?[]:[...o];if(!Array.isArray(o)||!(l in o)||!(i in o))return;const d=[...a.value],c=d[l];d.splice(l,1),d.splice(i,0,c);const v=s[l];s.splice(l,1),s.splice(i,0,v),k(n.values,u,s),a.value=d,p()}};return n.fieldArrays.push(Object.assign({path:e,reset:c},h)),t.onBeforeUnmount((()=>{const r=n.fieldArrays.findIndex((n=>t.unref(n.path)===t.unref(e)));r>=0&&n.fieldArrays.splice(r,1)})),t.watch(d,(e=>{F(e,a.value.map((e=>e.value)))||c()})),h}const be=t.defineComponent({name:"FieldArray",inheritAttrs:!1,props:{name:{type:String,required:!0}},setup(e,n){const{push:r,remove:a,swap:l,insert:i,replace:u,update:o,prepend:s,move:d,fields:c}=ge(t.toRef(e,"name"));function v(){return{fields:c.value,push:r,remove:a,swap:l,insert:i,update:o,replace:u,prepend:s,move:d}}return n.expose({push:r,remove:a,swap:l,insert:i,update:o,replace:u,prepend:s,move:d}),()=>q(void 0,n,v)}}),Oe=t.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(e,n){const r=t.inject(o,void 0),a=t.computed((()=>null==r?void 0:r.errors.value[e.name]));function l(){return{message:a.value}}return()=>{if(!a.value)return;const r=e.as?t.resolveDynamicComponent(e.as):e.as,i=q(r,n,l),u=Object.assign({role:"alert"},n.attrs);return r||!Array.isArray(i)&&i||!(null==i?void 0:i.length)?!Array.isArray(i)&&i||(null==i?void 0:i.length)?t.h(r,u,i):t.h(r||"span",u,a.value):i}}});e.ErrorMessage=Oe,e.Field=ce,e.FieldArray=be,e.FieldContextKey=s,e.Form=ye,e.FormContextKey=o,e.IS_ABSENT=d,e.configure=Y,e.defineRule=function(e,t){!function(e,t){if(n(t))return;throw new Error(`Extension Error: The validator '${e}' must be a function.`)}(e,t),u[e]=t},e.useField=ie,e.useFieldArray=ge,e.useFieldError=function(e){const n=B(o),r=e?void 0:t.inject(s);return t.computed((()=>e?null==n?void 0:n.errors.value[t.unref(e)]:null==r?void 0:r.errorMessage.value))},e.useFieldValue=function(e){const n=B(o),r=e?void 0:t.inject(s);return t.computed((()=>e?E(null==n?void 0:n.values,t.unref(e)):t.unref(null==r?void 0:r.value)))},e.useForm=me,e.useFormErrors=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>(null==e?void 0:e.errors.value)||{}))},e.useFormValues=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>(null==e?void 0:e.values)||{}))},e.useIsFieldDirty=function(e){const n=D(e);return t.computed((()=>{var e,t;return!!n&&(null!==(t="meta"in n?n.meta.dirty:null===(e=null==n?void 0:n.value)||void 0===e?void 0:e.dirty)&&void 0!==t&&t)}))},e.useIsFieldTouched=function(e){const n=D(e);return t.computed((()=>{var e,t;return!!n&&(null!==(t="meta"in n?n.meta.touched:null===(e=null==n?void 0:n.value)||void 0===e?void 0:e.touched)&&void 0!==t&&t)}))},e.useIsFieldValid=function(e){const n=D(e);return t.computed((()=>{var e,t;return!!n&&(null!==(t="meta"in n?n.meta.valid:null===(e=null==n?void 0:n.value)||void 0===e?void 0:e.valid)&&void 0!==t&&t)}))},e.useIsFormDirty=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.dirty)&&void 0!==t&&t}))},e.useIsFormTouched=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.touched)&&void 0!==t&&t}))},e.useIsFormValid=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.valid)&&void 0!==t&&t}))},e.useIsSubmitting=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.isSubmitting.value)&&void 0!==t&&t}))},e.useResetForm=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),function(t){if(e)return e.resetForm(t)}},e.useSubmitCount=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.submitCount.value)&&void 0!==t?t:0}))},e.useSubmitForm=function(e){const t=B(o);t||_("No vee-validate <Form /> or `useForm` was detected in the component tree");const n=t?t.handleSubmit(e):void 0;return function(e){if(n)return n(e)}},e.useValidateField=function(e){const n=B(o),r=e?void 0:t.inject(s);return function(){return r?r.validate():n&&e?null==n?void 0:n.validateField(t.unref(e)):(_(`field with name ${t.unref(e)} was not found`),Promise.resolve({errors:[],valid:!0}))}},e.useValidateForm=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),function(){return e?e.validate():Promise.resolve({results:{},errors:{},valid:!0})}},e.validate=Z,e.validateObject=re}));
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VeeValidate={},e.Vue)}(this,(function(e,t){"use strict";function n(e){return"function"==typeof e}function r(e){return null==e}const a=e=>null!==e&&!!e&&"object"==typeof e&&!Array.isArray(e);function i(e){return Number(e)>=0}function l(e,t){return Object.keys(t).forEach((n=>{if(a(t[n]))return e[n]||(e[n]={}),void l(e[n],t[n]);e[n]=t[n]})),e}const u={};const o=Symbol("vee-validate-form"),s=Symbol("vee-validate-field-instance"),d=Symbol("Default empty value"),c="undefined"!=typeof window;function v(e){return n(e)&&!!e.__locatorRef}function f(e){return!!e&&n(e.parse)&&"VVTypedSchema"===e.__type}function p(e){return!!e&&n(e.validate)}function m(e){return"checkbox"===e||"radio"===e}function h(e){return/^\[.+\]$/i.test(e)}function y(e){return"SELECT"===e.tagName}function g(e,t){return!function(e,t){const n=![!1,null,void 0,0].includes(t.multiple)&&!Number.isNaN(t.multiple);return"select"===e&&"multiple"in t&&n}(e,t)&&"file"!==t.type&&!m(t.type)}function b(e){return V(e)&&e.target&&"submit"in e.target}function V(e){return!!e&&(!!("undefined"!=typeof Event&&n(Event)&&e instanceof Event)||!(!e||!e.srcElement))}function O(e,t){return t in e&&e[t]!==d}function F(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,r,a;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!F(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(r of e.entries())if(!t.has(r[0]))return!1;for(r of e.entries())if(!F(r[1],t.get(r[0])))return!1;return!0}if(A(e)&&A(t))return e.size===t.size&&(e.name===t.name&&(e.lastModified===t.lastModified&&e.type===t.type));if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(r of e.entries())if(!t.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((n=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!=r--;){var i=a[r];if(!F(e[i],t[i]))return!1}return!0}return e!=e&&t!=t}function A(e){return!!c&&e instanceof File}function j(e,t,n){"object"==typeof n.value&&(n.value=w(n.value)),n.enumerable&&!n.get&&!n.set&&n.configurable&&n.writable&&"__proto__"!==t?e[t]=n.value:Object.defineProperty(e,t,n)}function w(e){if("object"!=typeof e)return e;var t,n,r,a=0,i=Object.prototype.toString.call(e);if("[object Object]"===i?r=Object.create(e.__proto__||null):"[object Array]"===i?r=Array(e.length):"[object Set]"===i?(r=new Set,e.forEach((function(e){r.add(w(e))}))):"[object Map]"===i?(r=new Map,e.forEach((function(e,t){r.set(w(t),w(e))}))):"[object Date]"===i?r=new Date(+e):"[object RegExp]"===i?r=new RegExp(e.source,e.flags):"[object DataView]"===i?r=new e.constructor(w(e.buffer)):"[object ArrayBuffer]"===i?r=e.slice(0):"Array]"===i.slice(-6)&&(r=new e.constructor(e)),r){for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)j(r,n[a],Object.getOwnPropertyDescriptor(e,n[a]));for(a=0,n=Object.getOwnPropertyNames(e);a<n.length;a++)Object.hasOwnProperty.call(r,t=n[a])&&r[t]===e[t]||j(r,t,Object.getOwnPropertyDescriptor(e,t))}return r||e}function S(e){return h(e)?e.replace(/\[|\]/gi,""):e}function E(e,t,n){if(!e)return n;if(h(t))return e[S(t)];return(t||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce(((e,t)=>{return(a(r=e)||Array.isArray(r))&&t in e?e[t]:n;var r}),e)}function k(e,t,n){if(h(t))return void(e[S(t)]=n);const a=t.split(/\.|\[(\d+)\]/).filter(Boolean);let l=e;for(let e=0;e<a.length;e++){if(e===a.length-1)return void(l[a[e]]=n);a[e]in l&&!r(l[a[e]])||(l[a[e]]=i(a[e+1])?[]:{}),l=l[a[e]]}}function I(e,t){Array.isArray(e)&&i(t)?e.splice(Number(t),1):a(e)&&delete e[t]}function C(e,t){if(h(t))return void delete e[S(t)];const n=t.split(/\.|\[(\d+)\]/).filter(Boolean);let i=e;for(let e=0;e<n.length;e++){if(e===n.length-1){I(i,n[e]);break}if(!(n[e]in i)||r(i[n[e]]))break;i=i[n[e]]}const l=n.map(((t,r)=>E(e,n.slice(0,r).join("."))));for(let t=l.length-1;t>=0;t--)u=l[t],(Array.isArray(u)?0===u.length:a(u)&&0===Object.keys(u).length)&&(0!==t?I(l[t-1],n[t-1]):I(e,n[0]));var u}function M(e){return Object.keys(e)}function B(e,n=void 0){const r=t.getCurrentInstance();return(null==r?void 0:r.provides[e])||t.inject(e,n)}function _(e){t.warn(`[vee-validate]: ${e}`)}function T(e,t,n){if(Array.isArray(e)){const n=[...e],r=n.findIndex((e=>F(e,t)));return r>=0?n.splice(r,1):n.push(t),n}return F(e,t)?n:t}function U(e,t=0){let n=null,r=[];return function(...a){return n&&window.clearTimeout(n),n=window.setTimeout((()=>{const t=e(...a);r.forEach((e=>e(t))),r=[]}),t),new Promise((e=>r.push(e)))}}function P(e,t){return a(t)&&t.number?function(e){const t=parseFloat(e);return isNaN(t)?e:t}(e):e}function R(e,t){let n;return async function(...r){const a=e(...r);n=a;const i=await a;return a!==n||(n=void 0,t(i,r)),i}}function x({get:e,set:n}){const r=t.ref(w(e()));return t.watch(e,(e=>{F(e,r.value)||(r.value=w(e))}),{deep:!0}),t.watch(r,(t=>{F(t,e())||n(w(t))}),{deep:!0}),r}function N(e){return n(e)?e():t.unref(e)}function $(e){return Array.isArray(e)?e:e?[e]:[]}function D(e){const n=B(o),r=e?t.computed((()=>null==n?void 0:n.getPathState(t.unref(e)))):void 0,a=e?void 0:t.inject(s);return a||(null==r?void 0:r.value)||_(`field with name ${t.unref(e)} was not found`),r||a}function z(e,t){const n={};for(const r in e)t.includes(r)||(n[r]=e[r]);return n}const q=(e,t,n)=>t.slots.default?"string"!=typeof e&&e?{default:()=>{var e,r;return null===(r=(e=t.slots).default)||void 0===r?void 0:r.call(e,n())}}:t.slots.default(n()):t.slots.default;function L(e){if(K(e))return e._value}function K(e){return"_value"in e}function W(e){if(!V(e))return e;const t=e.target;if(m(t.type)&&K(t))return L(t);if("file"===t.type&&t.files){const e=Array.from(t.files);return t.multiple?e:e[0]}if(y(n=t)&&n.multiple)return Array.from(t.options).filter((e=>e.selected&&!e.disabled)).map(L);var n;if(y(t)){const e=Array.from(t.options).find((e=>e.selected));return e?L(e):t.value}return t.value}function G(e){const t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),e?a(e)&&e._$$isNormalized?e:a(e)?Object.keys(e).reduce(((t,n)=>{const r=function(e){if(!0===e)return[];if(Array.isArray(e))return e;if(a(e))return e;return[e]}(e[n]);return!1!==e[n]&&(t[n]=X(r)),t}),t):"string"!=typeof e?t:e.split("|").reduce(((e,t)=>{const n=H(t);return n.name?(e[n.name]=X(n.params),e):e}),t):t}function X(e){const t=e=>"string"==typeof e&&"@"===e[0]?function(e){const t=t=>E(t,e)||t[e];return t.__locatorRef=e,t}(e.slice(1)):e;return Array.isArray(e)?e.map(t):e instanceof RegExp?[e]:Object.keys(e).reduce(((n,r)=>(n[r]=t(e[r]),n)),{})}const H=e=>{let t=[];const n=e.split(":")[0];return e.includes(":")&&(t=e.split(":").slice(1).join(":").split(",")),{name:n,params:t}};let J=Object.assign({},{generateMessage:({field:e})=>`${e} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const Q=()=>J,Y=e=>{J=Object.assign(Object.assign({},J),e)};async function Z(e,t,r={}){const a=null==r?void 0:r.bails,i={name:(null==r?void 0:r.name)||"{field}",rules:t,label:null==r?void 0:r.label,bails:null==a||a,formData:(null==r?void 0:r.values)||{}},l=await async function(e,t){if(f(e.rules)||p(e.rules))return async function(e,t){const n=f(t)?t:ee(t),r=await n.parse(e),a=[];for(const e of r.errors)e.errors.length&&a.push(...e.errors);return{errors:a}}(t,e.rules);if(n(e.rules)||Array.isArray(e.rules)){const n={field:e.label||e.name,name:e.name,label:e.label,form:e.formData,value:t},r=Array.isArray(e.rules)?e.rules:[e.rules],a=r.length,i=[];for(let l=0;l<a;l++){const a=r[l],u=await a(t,n);if("string"!=typeof u&&u)continue;const o="string"==typeof u?u:ne(n);if(i.push(o),e.bails)return{errors:i}}return{errors:i}}const r=Object.assign(Object.assign({},e),{rules:G(e.rules)}),a=[],i=Object.keys(r.rules),l=i.length;for(let n=0;n<l;n++){const l=i[n],u=await te(r,t,{name:l,params:r.rules[l]});if(u.error&&(a.push(u.error),e.bails))return{errors:a}}return{errors:a}}(i,e),u=l.errors;return{errors:u,valid:!u.length}}function ee(e){return{__type:"VVTypedSchema",async parse(t){var n;try{return{output:await e.validate(t,{abortEarly:!1}),errors:[]}}catch(e){if(!function(e){return!!e&&"ValidationError"===e.name}(e))throw e;if(!(null===(n=e.inner)||void 0===n?void 0:n.length)&&e.errors.length)return{errors:[{path:e.path,errors:e.errors}]};const t=e.inner.reduce(((e,t)=>{const n=t.path||"";return e[n]||(e[n]={errors:[],path:n}),e[n].errors.push(...t.errors),e}),{});return{errors:Object.values(t)}}}}}async function te(e,t,n){const r=(a=n.name,u[a]);var a;if(!r)throw new Error(`No such validator '${n.name}' exists.`);const i=function(e,t){const n=e=>v(e)?e(t):e;if(Array.isArray(e))return e.map(n);return Object.keys(e).reduce(((t,r)=>(t[r]=n(e[r]),t)),{})}(n.params,e.formData),l={field:e.label||e.name,name:e.name,label:e.label,value:t,form:e.formData,rule:Object.assign(Object.assign({},n),{params:i})},o=await r(t,i,l);return"string"==typeof o?{error:o}:{error:o?void 0:ne(l)}}function ne(e){const t=Q().generateMessage;return t?t(e):"Field is invalid"}async function re(e,t,n){const r=M(e).map((async r=>{var a,i,l;const u=null===(a=null==n?void 0:n.names)||void 0===a?void 0:a[r],o=await Z(E(t,r),e[r],{name:(null==u?void 0:u.name)||r,label:null==u?void 0:u.label,values:t,bails:null===(l=null===(i=null==n?void 0:n.bailsMap)||void 0===i?void 0:i[r])||void 0===l||l});return Object.assign(Object.assign({},o),{path:r})}));let a=!0;const i=await Promise.all(r),l={},u={};for(const e of i)l[e.path]={valid:e.valid,errors:e.errors},e.valid||(a=!1,u[e.path]=e.errors[0]);return{valid:a,results:l,errors:u}}let ae=0;function ie(e,n){const{value:r,initialValue:a,setInitialValue:i}=function(e,n,r){const a=t.ref(t.unref(n));function i(){return r?E(r.initialValues.value,t.unref(e),t.unref(a)):t.unref(a)}function l(n){r?r.stageInitialValue(t.unref(e),n,!0):a.value=n}const u=t.computed(i);if(!r){return{value:t.ref(i()),initialValue:u,setInitialValue:l}}const o=function(e,n,r,a){if(t.isRef(e))return t.unref(e);if(void 0!==e)return e;return E(n.values,t.unref(a),t.unref(r))}(n,r,u,e);r.stageInitialValue(t.unref(e),o,!0);const s=t.computed({get:()=>E(r.values,t.unref(e)),set(n){r.setFieldValue(t.unref(e),n)}});return{value:s,initialValue:u,setInitialValue:l}}(e,n.modelValue,n.form);if(!n.form){const{errors:o,setErrors:s}=function(){const e=t.ref([]);return{errors:e,setErrors:t=>{e.value=$(t)}}}(),d=ae>=Number.MAX_SAFE_INTEGER?0:++ae,c=function(e,n,r){const a=t.reactive({touched:!1,pending:!1,valid:!0,validated:!!t.unref(r).length,initialValue:t.computed((()=>t.unref(n))),dirty:t.computed((()=>!F(t.unref(e),t.unref(n))))});return t.watch(r,(e=>{a.valid=!e.length}),{immediate:!0,flush:"sync"}),a}(r,a,o);function v(e){var t;"value"in e&&(r.value=e.value),"errors"in e&&s(e.errors),"touched"in e&&(c.touched=null!==(t=e.touched)&&void 0!==t?t:c.touched),"initialValue"in e&&i(e.initialValue)}return{id:d,path:e,value:r,initialValue:a,meta:c,flags:{pendingUnmount:{[d]:!1}},errors:o,setState:v}}const l=n.form.createPathState(e,{bails:n.bails,label:n.label,type:n.type,validate:n.validate}),u=t.computed((()=>l.errors));return{id:Array.isArray(l.id)?l.id[l.id.length-1]:l.id,path:e,value:r,errors:u,meta:l,initialValue:a,flags:l.__flags,setState:function(a){var l,u,o;"value"in a&&(r.value=a.value),"errors"in a&&(null===(l=n.form)||void 0===l||l.setFieldError(t.unref(e),a.errors)),"touched"in a&&(null===(u=n.form)||void 0===u||u.setFieldTouched(t.unref(e),null!==(o=a.touched)&&void 0!==o&&o)),"initialValue"in a&&i(a.initialValue)}}}function le(e,n,r){return m(null==r?void 0:r.type)?function(e,n,r){const a=(null==r?void 0:r.standalone)?void 0:B(o),i=null==r?void 0:r.checkedValue,l=null==r?void 0:r.uncheckedValue;function u(n){const r=n.handleChange,u=t.computed((()=>{const e=t.unref(n.value),r=t.unref(i);return Array.isArray(e)?e.findIndex((e=>F(e,r)))>=0:F(r,e)}));function o(o,s=!0){var d;if(u.value===(null===(d=null==o?void 0:o.target)||void 0===d?void 0:d.checked))return void(s&&n.validate());const c=N(e),v=null==a?void 0:a.getPathState(c),f=W(o);let p;p=a&&(null==v?void 0:v.multiple)&&"checkbox"===v.type?T(E(a.values,c)||[],f,void 0):T(t.unref(n.value),t.unref(i),t.unref(l)),r(p,s)}return Object.assign(Object.assign({},n),{checked:u,checkedValue:i,uncheckedValue:l,handleChange:o})}return u(ue(e,n,r))}(e,n,r):ue(e,n,r)}function ue(e,r,a){const{initialValue:i,validateOnMount:l,bails:u,type:c,checkedValue:m,label:h,validateOnValueUpdate:y,uncheckedValue:g,controlled:b,keepValueOnUnmount:V,modelPropName:O,syncVModel:A,form:j}=function(e){var n;const r=()=>({initialValue:void 0,validateOnMount:!1,bails:!0,label:void 0,validateOnValueUpdate:!0,keepValueOnUnmount:void 0,modelPropName:"modelValue",syncVModel:!0,controlled:!0}),a=null===(n=null==e?void 0:e.syncVModel)||void 0===n||n,i=a&&!("initialValue"in(e||{}))?oe(t.getCurrentInstance(),(null==e?void 0:e.modelPropName)||"modelValue"):null==e?void 0:e.initialValue;if(!e)return Object.assign(Object.assign({},r()),{initialValue:i});const l="valueProp"in e?e.valueProp:e.checkedValue,u="standalone"in e?!e.standalone:e.controlled;return Object.assign(Object.assign(Object.assign({},r()),e||{}),{initialValue:i,controlled:null==u||u,checkedValue:l})}(a),S=b?B(o):void 0,k=j||S,I=function(e){return t.computed((()=>N(e)))}(e),C=t.computed((()=>{if(t.unref(null==k?void 0:k.schema))return;const e=t.unref(r);return p(e)||f(e)||n(e)||Array.isArray(e)?e:G(e)})),{id:_,value:T,initialValue:U,meta:x,setState:$,errors:D,flags:z}=ie(I,{modelValue:i,form:k,bails:u,label:h,type:c,validate:C.value?H:void 0}),q=t.computed((()=>D.value[0]));A&&function({prop:e,value:n,handleChange:r}){const a=t.getCurrentInstance();if(!a)return;const i=e||"modelValue",l=`update:${i}`;if(!(i in a.props))return;t.watch(n,(e=>{F(e,oe(a,i))||a.emit(l,e)})),t.watch((()=>oe(a,i)),(e=>{if(e===d&&void 0===n.value)return;const t=e===d?void 0:e;F(t,P(n.value,a.props.modelModifiers))||r(t)}))}({value:T,prop:O,handleChange:J});async function L(e){var n,r;return(null==k?void 0:k.validateSchema)?null!==(n=(await k.validateSchema(e)).results[t.unref(I)])&&void 0!==n?n:{valid:!0,errors:[]}:C.value?Z(T.value,C.value,{name:t.unref(I),label:t.unref(h),values:null!==(r=null==k?void 0:k.values)&&void 0!==r?r:{},bails:u}):{valid:!0,errors:[]}}const K=R((async()=>(x.pending=!0,x.validated=!0,L("validated-only"))),(e=>{if(!z.pendingUnmount[te.id])return $({errors:e.errors}),x.pending=!1,x.valid=e.valid,e})),X=R((async()=>L("silent")),(e=>(x.valid=e.valid,e)));function H(e){return"silent"===(null==e?void 0:e.mode)?X():K()}function J(e,t=!0){Y(W(e),t)}function Q(e){var t;const n=e&&"value"in e?e.value:U.value;$({value:w(n),initialValue:w(n),touched:null!==(t=null==e?void 0:e.touched)&&void 0!==t&&t,errors:(null==e?void 0:e.errors)||[]}),x.pending=!1,x.validated=!1,X()}function Y(e,t=!0){if(T.value=e,!t)return void X();(t?K:X)()}t.onMounted((()=>{if(l)return K();k&&k.validateSchema||X()}));const ee=t.computed({get:()=>T.value,set(e){Y(e,y)}}),te={id:_,name:I,label:h,value:ee,meta:x,errors:D,errorMessage:q,type:c,checkedValue:m,uncheckedValue:g,bails:u,keepValueOnUnmount:V,resetField:Q,handleReset:()=>Q(),validate:H,handleChange:J,handleBlur:()=>{x.touched=!0},setState:$,setTouched:function(e){x.touched=e},setErrors:function(e){$({errors:Array.isArray(e)?e:[e]})},setValue:Y};if(t.provide(s,te),t.isRef(r)&&"function"!=typeof t.unref(r)&&t.watch(r,((e,t)=>{F(e,t)||(x.validated?K():X())}),{deep:!0}),!k)return te;const ne=t.computed((()=>{const e=C.value;return!e||n(e)||p(e)||f(e)||Array.isArray(e)?{}:Object.keys(e).reduce(((t,n)=>{const r=(a=e[n],Array.isArray(a)?a.filter(v):M(a).filter((e=>v(a[e]))).map((e=>a[e]))).map((e=>e.__locatorRef)).reduce(((e,t)=>{const n=E(k.values,t)||k.values[t];return void 0!==n&&(e[t]=n),e}),{});var a;return Object.assign(t,r),t}),{})}));return t.watch(ne,((e,t)=>{if(!Object.keys(e).length)return;!F(e,t)&&(x.validated?K():X())})),t.onBeforeUnmount((()=>{var e;const n=null!==(e=t.unref(te.keepValueOnUnmount))&&void 0!==e?e:t.unref(k.keepValuesOnUnmount),r=N(I);if(n||!k||z.pendingUnmount[te.id])return void(null==k||k.removePathState(r,_));z.pendingUnmount[te.id]=!0;const a=k.getPathState(r);if(Array.isArray(null==a?void 0:a.id)&&(null==a?void 0:a.multiple)?null==a?void 0:a.id.includes(te.id):(null==a?void 0:a.id)===te.id){if((null==a?void 0:a.multiple)&&Array.isArray(a.value)){const e=a.value.findIndex((e=>F(e,t.unref(te.checkedValue))));if(e>-1){const t=[...a.value];t.splice(e,1),k.setFieldValue(r,t)}Array.isArray(a.id)&&a.id.splice(a.id.indexOf(te.id),1)}else k.unsetPathValue(N(I));k.removePathState(r,_)}})),te}function oe(e,t){if(e)return e.props[t]}function se(e,t){let n=e.as||"";return e.as||t.slots.default||(n="input"),n}function de(e,t){return m(t.attrs.type)?O(e,"modelValue")?e.modelValue:void 0:O(e,"modelValue")?e.modelValue:t.attrs.value}const ce=t.defineComponent({name:"Field",inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>Q().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:d},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1},keepValue:{type:Boolean,default:void 0}},setup(e,r){const a=t.toRef(e,"rules"),i=t.toRef(e,"name"),l=t.toRef(e,"label"),u=t.toRef(e,"uncheckedValue"),o=t.toRef(e,"keepValue"),{errors:s,value:d,errorMessage:c,validate:v,handleChange:f,handleBlur:p,setTouched:h,resetField:y,handleReset:b,meta:V,checked:O,setErrors:F}=le(i,a,{validateOnMount:e.validateOnMount,bails:e.bails,standalone:e.standalone,type:r.attrs.type,initialValue:de(e,r),checkedValue:r.attrs.value,uncheckedValue:u,label:l,validateOnValueUpdate:!1,keepValueOnUnmount:o}),A=function(e,t=!0){f(e,t),r.emit("update:modelValue",d.value)},j=t.computed((()=>{const{validateOnInput:t,validateOnChange:a,validateOnBlur:i,validateOnModelUpdate:l}=function(e){var t,n,r,a;const{validateOnInput:i,validateOnChange:l,validateOnBlur:u,validateOnModelUpdate:o}=Q();return{validateOnInput:null!==(t=e.validateOnInput)&&void 0!==t?t:i,validateOnChange:null!==(n=e.validateOnChange)&&void 0!==n?n:l,validateOnBlur:null!==(r=e.validateOnBlur)&&void 0!==r?r:u,validateOnModelUpdate:null!==(a=e.validateOnModelUpdate)&&void 0!==a?a:o}}(e);const u={name:e.name,onBlur:function(e){p(e),n(r.attrs.onBlur)&&r.attrs.onBlur(e),i&&v()},onInput:function(e){A(e,t),n(r.attrs.onInput)&&r.attrs.onInput(e)},onChange:function(e){A(e,a),n(r.attrs.onChange)&&r.attrs.onChange(e)},"onUpdate:modelValue":e=>A(e,l)};m(r.attrs.type)&&O&&(u.checked=O.value);return g(se(e,r),r.attrs)&&(u.value=d.value),u}));function w(){return{field:j.value,value:d.value,meta:V,errors:s.value,errorMessage:c.value,validate:v,resetField:y,handleChange:A,handleInput:e=>A(e,!1),handleReset:b,handleBlur:p,setTouched:h,setErrors:F}}return r.expose({setErrors:F,setTouched:h,reset:y,validate:v,handleChange:f}),()=>{const n=t.resolveDynamicComponent(se(e,r)),a=q(n,r,w);return n?t.h(n,Object.assign(Object.assign({},r.attrs),j.value),a):a}}});let ve=0;const fe=["bails","fieldsCount","id","multiple","type","validate"];function pe(e){const r=t.unref(null==e?void 0:e.initialValues)||{},a=t.unref(null==e?void 0:e.validationSchema);return a&&f(a)&&n(a.cast)?w(a.cast(r)||{}):w(r)}function me(e){var r;const a=ve++;let i=0;const u=t.ref(!1),s=t.ref(!1),d=t.ref(0),c=[],v=t.reactive(pe(e)),m=t.ref([]),h=t.ref({});function y(e,t){const n=H(e);n?n.errors=$(t):h.value[e]=$(t)}function g(e){M(e).forEach((t=>{y(t,e[t])}))}(null==e?void 0:e.initialErrors)&&g(e.initialErrors);const V=t.computed((()=>{const e=m.value.reduce(((e,t)=>(t.errors.length&&(e[t.path]=t.errors),e)),{});return Object.assign(Object.assign({},h.value),e)})),O=t.computed((()=>M(V.value).reduce(((e,t)=>{const n=V.value[t];return(null==n?void 0:n.length)&&(e[t]=n[0]),e}),{}))),A=t.computed((()=>m.value.reduce(((e,t)=>(e[t.path]={name:t.path||"",label:t.label||""},e)),{}))),j=t.computed((()=>m.value.reduce(((e,t)=>{var n;return e[t.path]=null===(n=t.bails)||void 0===n||n,e}),{}))),S=Object.assign({},(null==e?void 0:e.initialErrors)||{}),I=null!==(r=null==e?void 0:e.keepValuesOnUnmount)&&void 0!==r&&r,{initialValues:B,originalInitialValues:_,setInitialValues:T}=function(e,n,r){const a=pe(r),i=null==r?void 0:r.initialValues,l=t.ref(a),u=t.ref(w(a));function o(t,r=!1){l.value=w(t),u.value=w(t),r&&e.value.forEach((e=>{if(e.touched)return;const t=E(l.value,e.path);k(n,e.path,w(t))}))}t.isRef(i)&&t.watch(i,(e=>{o(e,!0)}),{deep:!0});return{initialValues:l,originalInitialValues:u,setInitialValues:o}}(m,v,e),P=function(e,n,r,a){const i={touched:"some",pending:"some",valid:"every"},l=t.computed((()=>!F(n,t.unref(r))));function u(){const t=e.value;return M(i).reduce(((e,n)=>{const r=i[n];return e[n]=t[r]((e=>e[n])),e}),{})}const o=t.reactive(u());return t.watchEffect((()=>{const e=u();o.touched=e.touched,o.valid=e.valid,o.pending=e.pending})),t.computed((()=>Object.assign(Object.assign({initialValues:t.unref(r)},o),{valid:o.valid&&!M(a.value).length,dirty:l.value})))}(m,v,_,O),x=t.computed((()=>m.value.reduce(((e,t)=>{const n=E(v,t.path);return k(e,t.path,n),e}),{}))),D=null==e?void 0:e.validationSchema;function q(e,n){var r,a;const l=t.computed((()=>E(B.value,N(e)))),u=m.value.find((n=>n.path===t.unref(e)));if(u){"checkbox"!==(null==n?void 0:n.type)&&"radio"!==(null==n?void 0:n.type)||(u.multiple=!0);const e=i++;return Array.isArray(u.id)?u.id.push(e):u.id=[u.id,e],u.fieldsCount++,u.__flags.pendingUnmount[e]=!1,u}const o=t.computed((()=>E(v,N(e)))),s=N(e),d=i++,c=t.reactive({id:d,path:e,touched:!1,pending:!1,valid:!0,validated:!!(null===(r=S[s])||void 0===r?void 0:r.length),initialValue:l,errors:t.shallowRef([]),bails:null!==(a=null==n?void 0:n.bails)&&void 0!==a&&a,label:null==n?void 0:n.label,type:(null==n?void 0:n.type)||"default",value:o,multiple:!1,__flags:{pendingUnmount:{[d]:!1}},fieldsCount:1,validate:null==n?void 0:n.validate,dirty:t.computed((()=>!F(t.unref(o),t.unref(l))))});return m.value.push(c),O.value[s]&&!S[s]&&t.nextTick((()=>{me(s)})),t.isRef(e)&&t.watch(e,(e=>{const n=w(o.value);t.nextTick((()=>{k(v,e,n)}))})),c}const L=U(ge,5),K=U(ge,5),G=R((async e=>"silent"===await e?L():K()),((e,[t])=>{const n=M(ne.errorBag.value);return[...new Set([...M(e.results),...m.value.map((e=>e.path)),...n])].sort().reduce(((n,r)=>{const a=r,i=H(a)||function(e){const t=m.value.filter((t=>e.startsWith(t.path)));return t.reduce(((e,t)=>e?t.path.length>e.path.length?t:e:t),void 0)}(a),l=(e.results[a]||{errors:[]}).errors,u={errors:l,valid:!l.length};return n.results[a]=u,u.valid||(n.errors[a]=u.errors[0]),i&&h.value[a]&&delete h.value[a],i?(i.valid=u.valid,"silent"===t?n:"validated-only"!==t||i.validated?(y(i,u.errors),n):n):(y(a,l),n)}),{valid:e.valid,results:{},errors:{}})}));function X(e){m.value.forEach(e)}function H(e){return"string"==typeof e?m.value.find((t=>t.path===e)):e}let J,Y=[];function Z(e){return function(t,n){return function(r){return r instanceof Event&&(r.preventDefault(),r.stopPropagation()),X((e=>e.touched=!0)),u.value=!0,d.value++,ce().then((a=>{const i=w(v);if(a.valid&&"function"==typeof t){const n=w(x.value);let l=e?n:i;return a.values&&(l=a.values),t(l,{evt:r,controlledValues:n,setErrors:g,setFieldError:y,setTouched:oe,setFieldTouched:ue,setValues:ie,setFieldValue:ae,resetForm:de,resetField:se})}a.valid||"function"!=typeof n||n({values:i,evt:r,errors:a.errors,results:a.results})})).then((e=>(u.value=!1,e)),(e=>{throw u.value=!1,e}))}}}const te=Z(!1);te.withControlled=Z(!0);const ne={formId:a,values:v,controlledValues:x,errorBag:V,errors:O,schema:D,submitCount:d,meta:P,isSubmitting:u,isValidating:s,fieldArrays:c,keepValuesOnUnmount:I,validateSchema:t.unref(D)?G:void 0,validate:ce,setFieldError:y,validateField:me,setFieldValue:ae,setValues:ie,setErrors:g,setFieldTouched:ue,setTouched:oe,resetForm:de,resetField:se,handleSubmit:te,stageInitialValue:function(t,n,r=!1){ye(t,n),k(v,t,n),r&&!(null==e?void 0:e.initialValues)&&k(_.value,t,w(n))},unsetInitialValue:he,setFieldInitialValue:ye,useFieldModel:function(e){if(!Array.isArray(e))return le(e);return e.map(le)},createPathState:q,getPathState:H,unsetPathValue:function(e){return Y.push(e),J||(J=t.nextTick((()=>{[...Y].sort().reverse().forEach((e=>{C(v,e)})),Y=[],J=null}))),J},removePathState:function(e,t){const n=m.value.findIndex((t=>t.path===e)),r=m.value[n];if(-1!==n&&r){if(r.multiple&&r.fieldsCount&&r.fieldsCount--,Array.isArray(r.id)){const e=r.id.indexOf(t);e>=0&&r.id.splice(e,1),delete r.__flags.pendingUnmount[t]}(!r.multiple||r.fieldsCount<=0)&&(m.value.splice(n,1),he(e))}},initialValues:B,getAllPathStates:()=>m.value,markForUnmount:function(e){return X((t=>{t.path.startsWith(e)&&M(t.__flags.pendingUnmount).forEach((e=>{t.__flags.pendingUnmount[e]=!0}))}))}};function ae(e,t){const n=w(t),r="string"==typeof e?e:e.path;H(r)||q(r),k(v,r,n)}function ie(e){l(v,e),c.forEach((e=>e&&e.reset()))}function le(e){const n=H(t.unref(e))||q(e);return t.computed({get:()=>n.value,set(r){const a=t.unref(e);ae(a,r),n.validated=!0,n.pending=!0,me(a).then((()=>{n.pending=!1}))}})}function ue(e,t){const n=H(e);n&&(n.touched=t)}function oe(e){M(e).forEach((t=>{ue(t,!!e[t])}))}function se(e,t){var n;const r=t&&"value"in t?t.value:E(B.value,e);ye(e,w(r)),ae(e,r),ue(e,null!==(n=null==t?void 0:t.touched)&&void 0!==n&&n),y(e,(null==t?void 0:t.errors)||[])}function de(e){const n=(null==e?void 0:e.values)?e.values:_.value;T(n),ie(n),X((t=>{var r;t.validated=!1,t.touched=(null===(r=null==e?void 0:e.touched)||void 0===r?void 0:r[t.path])||!1,ae(t.path,E(n,t.path)),y(t.path,void 0)})),g((null==e?void 0:e.errors)||{}),d.value=(null==e?void 0:e.submitCount)||0,t.nextTick((()=>{ce({mode:"silent"})}))}async function ce(e){const t=(null==e?void 0:e.mode)||"force";if("force"===t&&X((e=>e.validated=!0)),ne.validateSchema)return ne.validateSchema(t);s.value=!0;const n=await Promise.all(m.value.map((t=>t.validate?t.validate(e).then((e=>({key:t.path,valid:e.valid,errors:e.errors}))):Promise.resolve({key:t.path,valid:!0,errors:[]}))));s.value=!1;const r={},a={};for(const e of n)r[e.key]={valid:e.valid,errors:e.errors},e.errors.length&&(a[e.key]=e.errors[0]);return{valid:n.every((e=>e.valid)),results:r,errors:a}}async function me(e){const n=H(e);if(n&&(n.validated=!0),D){const{results:t}=await G("validated-only");return t[e]||{errors:[],valid:!0}}return(null==n?void 0:n.validate)?n.validate():(n||t.warn(`field with path ${e} was not found`),Promise.resolve({errors:[],valid:!0}))}function he(e){C(B.value,e)}function ye(e,t){k(B.value,e,w(t))}async function ge(){const e=t.unref(D);if(!e)return{valid:!0,results:{},errors:{}};s.value=!0;const n=p(e)||f(e)?await async function(e,t){const n=f(e)?e:ee(e),r=await n.parse(t),a={},i={};for(const e of r.errors){const t=e.errors,n=(e.path||"").replace(/\["(\d+)"\]/g,((e,t)=>`[${t}]`));a[n]={valid:!t.length,errors:t},t.length&&(i[n]=t[0])}return{valid:!r.errors.length,results:a,errors:i,values:r.value}}(e,v):await re(e,v,{names:A.value,bailsMap:j.value});return s.value=!1,n}const be=te(((e,{evt:t})=>{b(t)&&t.target.submit()}));return t.onMounted((()=>{(null==e?void 0:e.initialErrors)&&g(e.initialErrors),(null==e?void 0:e.initialTouched)&&oe(e.initialTouched),(null==e?void 0:e.validateOnMount)?ce():ne.validateSchema&&ne.validateSchema("silent")})),t.isRef(D)&&t.watch(D,(()=>{var e;null===(e=ne.validateSchema)||void 0===e||e.call(ne,"validated-only")})),t.provide(o,ne),Object.assign(Object.assign({},ne),{handleReset:()=>de(),submitForm:be,defineComponentBinds:function(e,r){const a=H(N(e))||q(e),i=()=>n(r)?r(z(a,fe)):r||{};function l(){var e;a.touched=!0;(null!==(e=i().validateOnBlur)&&void 0!==e?e:Q().validateOnBlur)&&me(a.path)}function u(e){var t;ae(a.path,e);(null!==(t=i().validateOnModelUpdate)&&void 0!==t?t:Q().validateOnModelUpdate)&&me(a.path)}return t.computed((()=>{const e={modelValue:a.value,"onUpdate:modelValue":u,onBlur:l};return n(r)?Object.assign(Object.assign({},e),r(a).props||{}):(null==r?void 0:r.mapProps)?Object.assign(Object.assign({},e),r.mapProps(z(a,fe))):e}))},defineInputBinds:function(e,r){const a=H(N(e))||q(e),i=()=>n(r)?r(z(a,fe)):r||{};function l(){var e;a.touched=!0;(null!==(e=i().validateOnBlur)&&void 0!==e?e:Q().validateOnBlur)&&me(a.path)}function u(e){var t;const n=W(e);ae(a.path,n);(null!==(t=i().validateOnInput)&&void 0!==t?t:Q().validateOnInput)&&me(a.path)}function o(e){var t;const n=W(e);ae(a.path,n);(null!==(t=i().validateOnChange)&&void 0!==t?t:Q().validateOnChange)&&me(a.path)}return t.computed((()=>{const e={value:a.value,onChange:o,onInput:u,onBlur:l};return n(r)?Object.assign(Object.assign({},e),r(z(a,fe)).attrs||{}):(null==r?void 0:r.mapAttrs)?Object.assign(Object.assign({},e),r.mapAttrs(z(a,fe))):e}))}})}const he=t.defineComponent({name:"Form",inheritAttrs:!1,props:{as:{type:String,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0},keepValues:{type:Boolean,default:!1}},setup(e,n){const r=t.toRef(e,"initialValues"),a=t.toRef(e,"validationSchema"),i=t.toRef(e,"keepValues"),{errors:l,errorBag:u,values:o,meta:s,isSubmitting:d,isValidating:c,submitCount:v,controlledValues:f,validate:p,validateField:m,handleReset:h,resetForm:y,handleSubmit:g,setErrors:O,setFieldError:F,setFieldValue:A,setValues:j,setFieldTouched:S,setTouched:E,resetField:k}=me({validationSchema:a.value?a:void 0,initialValues:r,initialErrors:e.initialErrors,initialTouched:e.initialTouched,validateOnMount:e.validateOnMount,keepValuesOnUnmount:i}),I=g(((e,{evt:t})=>{b(t)&&t.target.submit()}),e.onInvalidSubmit),C=e.onSubmit?g(e.onSubmit,e.onInvalidSubmit):I;function M(e){V(e)&&e.preventDefault(),h(),"function"==typeof n.attrs.onReset&&n.attrs.onReset()}function B(t,n){return g("function"!=typeof t||n?n:t,e.onInvalidSubmit)(t)}function _(){return w(o)}function T(){return w(s.value)}function U(){return w(l.value)}function P(){return{meta:s.value,errors:l.value,errorBag:u.value,values:o,isSubmitting:d.value,isValidating:c.value,submitCount:v.value,controlledValues:f.value,validate:p,validateField:m,handleSubmit:B,handleReset:h,submitForm:I,setErrors:O,setFieldError:F,setFieldValue:A,setValues:j,setFieldTouched:S,setTouched:E,resetForm:y,resetField:k,getValues:_,getMeta:T,getErrors:U}}return n.expose({setFieldError:F,setErrors:O,setFieldValue:A,setValues:j,setFieldTouched:S,setTouched:E,resetForm:y,validate:p,validateField:m,resetField:k,getValues:_,getMeta:T,getErrors:U}),function(){const r="form"===e.as?e.as:t.resolveDynamicComponent(e.as),a=q(r,n,P);if(!e.as)return a;const i="form"===e.as?{novalidate:!0}:{};return t.h(r,Object.assign(Object.assign(Object.assign({},i),n.attrs),{onSubmit:C,onReset:M}),a)}}}),ye=he;function ge(e){const n=B(o,void 0),a=t.ref([]),i=()=>{},l={fields:a,remove:i,push:i,swap:i,insert:i,update:i,replace:i,prepend:i,move:i};if(!n)return _("FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly"),l;if(!t.unref(e))return _("FieldArray requires a field path to be provided, did you forget to pass the `name` prop?"),l;const u=n.fieldArrays.find((n=>t.unref(n.path)===t.unref(e)));if(u)return u;let s=0;function d(){return E(null==n?void 0:n.values,t.unref(e),[])||[]}function c(){const e=d();Array.isArray(e)&&(a.value=e.map(((e,t)=>f(e,t,a.value))),v())}function v(){const e=a.value.length;for(let t=0;t<e;t++){const n=a.value[t];n.isFirst=0===t,n.isLast=t===e-1}}function f(i,l,u){if(u&&!r(l)&&u[l])return u[l];const o=s++,d={key:o,value:x({get(){const r=E(null==n?void 0:n.values,t.unref(e),[])||[],l=a.value.findIndex((e=>e.key===o));return-1===l?i:r[l]},set(e){const t=a.value.findIndex((e=>e.key===o));-1!==t?m(t,e):_("Attempting to update a non-existent array item")}}),isFirst:!1,isLast:!1};return d}function p(){v(),null==n||n.validate({mode:"silent"})}function m(r,a){const i=t.unref(e),l=E(null==n?void 0:n.values,i);!Array.isArray(l)||l.length-1<r||(k(n.values,`${i}[${r}]`,a),null==n||n.validate({mode:"validated-only"}))}c();const h={fields:a,remove:function(r){const i=t.unref(e),l=E(null==n?void 0:n.values,i);if(!l||!Array.isArray(l))return;const u=[...l];u.splice(r,1);const o=i+`[${r}]`;n.markForUnmount(o),n.unsetInitialValue(o),k(n.values,i,u),a.value.splice(r,1),p()},push:function(i){const l=t.unref(e),u=E(null==n?void 0:n.values,l),o=r(u)?[]:u;if(!Array.isArray(o))return;const s=[...o];s.push(i),n.stageInitialValue(l+`[${s.length-1}]`,i),k(n.values,l,s),a.value.push(f(i)),p()},swap:function(r,i){const l=t.unref(e),u=E(null==n?void 0:n.values,l);if(!Array.isArray(u)||!(r in u)||!(i in u))return;const o=[...u],s=[...a.value],d=o[r];o[r]=o[i],o[i]=d;const c=s[r];s[r]=s[i],s[i]=c,k(n.values,l,o),a.value=s,v()},insert:function(r,i){const l=t.unref(e),u=E(null==n?void 0:n.values,l);if(!Array.isArray(u)||u.length<r)return;const o=[...u],s=[...a.value];o.splice(r,0,i),s.splice(r,0,f(i)),k(n.values,l,o),a.value=s,p()},update:m,replace:function(r){const a=t.unref(e);n.stageInitialValue(a,r),k(n.values,a,r),c(),p()},prepend:function(i){const l=t.unref(e),u=E(null==n?void 0:n.values,l),o=r(u)?[]:u;if(!Array.isArray(o))return;const s=[i,...o];n.stageInitialValue(l+`[${s.length-1}]`,i),k(n.values,l,s),a.value.unshift(f(i)),p()},move:function(i,l){const u=t.unref(e),o=E(null==n?void 0:n.values,u),s=r(o)?[]:[...o];if(!Array.isArray(o)||!(i in o)||!(l in o))return;const d=[...a.value],c=d[i];d.splice(i,1),d.splice(l,0,c);const v=s[i];s.splice(i,1),s.splice(l,0,v),k(n.values,u,s),a.value=d,p()}};return n.fieldArrays.push(Object.assign({path:e,reset:c},h)),t.onBeforeUnmount((()=>{const r=n.fieldArrays.findIndex((n=>t.unref(n.path)===t.unref(e)));r>=0&&n.fieldArrays.splice(r,1)})),t.watch(d,(e=>{F(e,a.value.map((e=>e.value)))||c()})),h}const be=t.defineComponent({name:"FieldArray",inheritAttrs:!1,props:{name:{type:String,required:!0}},setup(e,n){const{push:r,remove:a,swap:i,insert:l,replace:u,update:o,prepend:s,move:d,fields:c}=ge(t.toRef(e,"name"));function v(){return{fields:c.value,push:r,remove:a,swap:i,insert:l,update:o,replace:u,prepend:s,move:d}}return n.expose({push:r,remove:a,swap:i,insert:l,update:o,replace:u,prepend:s,move:d}),()=>q(void 0,n,v)}}),Ve=t.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(e,n){const r=t.inject(o,void 0),a=t.computed((()=>null==r?void 0:r.errors.value[e.name]));function i(){return{message:a.value}}return()=>{if(!a.value)return;const r=e.as?t.resolveDynamicComponent(e.as):e.as,l=q(r,n,i),u=Object.assign({role:"alert"},n.attrs);return r||!Array.isArray(l)&&l||!(null==l?void 0:l.length)?!Array.isArray(l)&&l||(null==l?void 0:l.length)?t.h(r,u,l):t.h(r||"span",u,a.value):l}}});e.ErrorMessage=Ve,e.Field=ce,e.FieldArray=be,e.FieldContextKey=s,e.Form=ye,e.FormContextKey=o,e.IS_ABSENT=d,e.configure=Y,e.defineRule=function(e,t){!function(e,t){if(n(t))return;throw new Error(`Extension Error: The validator '${e}' must be a function.`)}(e,t),u[e]=t},e.useField=le,e.useFieldArray=ge,e.useFieldError=function(e){const n=B(o),r=e?void 0:t.inject(s);return t.computed((()=>e?null==n?void 0:n.errors.value[t.unref(e)]:null==r?void 0:r.errorMessage.value))},e.useFieldValue=function(e){const n=B(o),r=e?void 0:t.inject(s);return t.computed((()=>e?E(null==n?void 0:n.values,t.unref(e)):t.unref(null==r?void 0:r.value)))},e.useForm=me,e.useFormErrors=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>(null==e?void 0:e.errors.value)||{}))},e.useFormValues=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>(null==e?void 0:e.values)||{}))},e.useIsFieldDirty=function(e){const n=D(e);return t.computed((()=>{var e,t;return!!n&&(null!==(t="meta"in n?n.meta.dirty:null===(e=null==n?void 0:n.value)||void 0===e?void 0:e.dirty)&&void 0!==t&&t)}))},e.useIsFieldTouched=function(e){const n=D(e);return t.computed((()=>{var e,t;return!!n&&(null!==(t="meta"in n?n.meta.touched:null===(e=null==n?void 0:n.value)||void 0===e?void 0:e.touched)&&void 0!==t&&t)}))},e.useIsFieldValid=function(e){const n=D(e);return t.computed((()=>{var e,t;return!!n&&(null!==(t="meta"in n?n.meta.valid:null===(e=null==n?void 0:n.value)||void 0===e?void 0:e.valid)&&void 0!==t&&t)}))},e.useIsFormDirty=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.dirty)&&void 0!==t&&t}))},e.useIsFormTouched=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.touched)&&void 0!==t&&t}))},e.useIsFormValid=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.valid)&&void 0!==t&&t}))},e.useIsSubmitting=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.isSubmitting.value)&&void 0!==t&&t}))},e.useIsValidating=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.isValidating.value)&&void 0!==t&&t}))},e.useResetForm=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),function(t){if(e)return e.resetForm(t)}},e.useSubmitCount=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.submitCount.value)&&void 0!==t?t:0}))},e.useSubmitForm=function(e){const t=B(o);t||_("No vee-validate <Form /> or `useForm` was detected in the component tree");const n=t?t.handleSubmit(e):void 0;return function(e){if(n)return n(e)}},e.useValidateField=function(e){const n=B(o),r=e?void 0:t.inject(s);return function(){return r?r.validate():n&&e?null==n?void 0:n.validateField(t.unref(e)):(_(`field with name ${t.unref(e)} was not found`),Promise.resolve({errors:[],valid:!0}))}},e.useValidateForm=function(){const e=B(o);return e||_("No vee-validate <Form /> or `useForm` was detected in the component tree"),function(){return e?e.validate():Promise.resolve({results:{},errors:{},valid:!0})}},e.validate=Z,e.validateObject=re}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vee-validate",
3
- "version": "4.9.2",
3
+ "version": "4.9.3",
4
4
  "description": "Form Validation for Vue.js",
5
5
  "author": "Abdelrahman Awad <logaretm1@gmail.com>",
6
6
  "license": "MIT",