jv3-login-jwt
Version:
easy login from assign by route by cdnagroup using vuetify
1,707 lines • 114 kB
JavaScript
import { defineComponent as ft, toRef as Te, computed as T, resolveDynamicComponent as Zt, h as it, inject as Vn, toValue as F, unref as w, onMounted as kn, getCurrentInstance as $e, provide as Tn, isRef as at, watch as we, onBeforeUnmount as cr, ref as G, reactive as st, nextTick as me, warn as fr, readonly as hr, watchEffect as vr, onUnmounted as An, shallowRef as mr, withDirectives as jt, openBlock as Ct, createElementBlock as $t, createElementVNode as k, toDisplayString as He, renderSlot as pr, vShow as It, createVNode as Me, withCtx as gr, createCommentVNode as yr, createTextVNode as Xe } from "vue/dist/vue.esm-bundler.js";
import { useAccount as br } from "./jv3-login-jwt.es.js";
function _r() {
return jn().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
function jn() {
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
}
const Or = typeof Proxy == "function", Sr = "devtools-plugin:setup", xr = "plugin:settings:set";
let Re, Dt;
function wr() {
var e;
return Re !== void 0 || (typeof window < "u" && window.performance ? (Re = !0, Dt = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (Re = !0, Dt = globalThis.perf_hooks.performance) : Re = !1), Re;
}
function Er() {
return wr() ? Dt.now() : Date.now();
}
class Fr {
constructor(t, n) {
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
const r = {};
if (t.settings)
for (const s in t.settings) {
const l = t.settings[s];
r[s] = l.defaultValue;
}
const i = `__vue-devtools-plugin-settings__${t.id}`;
let a = Object.assign({}, r);
try {
const s = localStorage.getItem(i), l = JSON.parse(s);
Object.assign(a, l);
} catch {
}
this.fallbacks = {
getSettings() {
return a;
},
setSettings(s) {
try {
localStorage.setItem(i, JSON.stringify(s));
} catch {
}
a = s;
},
now() {
return Er();
}
}, n && n.on(xr, (s, l) => {
s === this.plugin.id && this.fallbacks.setSettings(l);
}), this.proxiedOn = new Proxy({}, {
get: (s, l) => this.target ? this.target.on[l] : (...u) => {
this.onQueue.push({
method: l,
args: u
});
}
}), this.proxiedTarget = new Proxy({}, {
get: (s, l) => this.target ? this.target[l] : l === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(l) ? (...u) => (this.targetQueue.push({
method: l,
args: u,
resolve: () => {
}
}), this.fallbacks[l](...u)) : (...u) => new Promise((c) => {
this.targetQueue.push({
method: l,
args: u,
resolve: c
});
})
});
}
async setRealTarget(t) {
this.target = t;
for (const n of this.onQueue)
this.target.on[n.method](...n.args);
for (const n of this.targetQueue)
n.resolve(await this.target[n.method](...n.args));
}
}
function Vr(e, t) {
const n = e, r = jn(), i = _r(), a = Or && n.enableEarlyProxy;
if (i && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
i.emit(Sr, e, t);
else {
const s = a ? new Fr(n, i) : null;
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
pluginDescriptor: n,
setupFn: t,
proxy: s
}), s && t(s.proxiedTarget);
}
}
/**
* vee-validate v4.13.2
* (c) 2024 Abdelrahman Awad
* @license MIT
*/
function Y(e) {
return typeof e == "function";
}
function Cn(e) {
return e == null;
}
const Ve = (e) => e !== null && !!e && typeof e == "object" && !Array.isArray(e);
function Gt(e) {
return Number(e) >= 0;
}
function kr(e) {
const t = parseFloat(e);
return isNaN(t) ? e : t;
}
function Tr(e) {
return typeof e == "object" && e !== null;
}
function Ar(e) {
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
}
function ln(e) {
if (!Tr(e) || Ar(e) !== "[object Object]")
return !1;
if (Object.getPrototypeOf(e) === null)
return !0;
let t = e;
for (; Object.getPrototypeOf(t) !== null; )
t = Object.getPrototypeOf(t);
return Object.getPrototypeOf(e) === t;
}
function Ye(e, t) {
return Object.keys(t).forEach((n) => {
if (ln(t[n]) && ln(e[n])) {
e[n] || (e[n] = {}), Ye(e[n], t[n]);
return;
}
e[n] = t[n];
}), e;
}
function Ge(e) {
const t = e.split(".");
if (!t.length)
return "";
let n = String(t[0]);
for (let r = 1; r < t.length; r++) {
if (Gt(t[r])) {
n += `[${t[r]}]`;
continue;
}
n += `.${t[r]}`;
}
return n;
}
const jr = {};
function Cr(e) {
return jr[e];
}
function un(e, t, n) {
typeof n.value == "object" && (n.value = A(n.value)), !n.enumerable || n.get || n.set || !n.configurable || !n.writable || t === "__proto__" ? Object.defineProperty(e, t, n) : e[t] = n.value;
}
function A(e) {
if (typeof e != "object") return e;
var t = 0, n, r, i, a = Object.prototype.toString.call(e);
if (a === "[object Object]" ? i = Object.create(e.__proto__ || null) : a === "[object Array]" ? i = Array(e.length) : a === "[object Set]" ? (i = /* @__PURE__ */ new Set(), e.forEach(function(s) {
i.add(A(s));
})) : a === "[object Map]" ? (i = /* @__PURE__ */ new Map(), e.forEach(function(s, l) {
i.set(A(l), A(s));
})) : a === "[object Date]" ? i = /* @__PURE__ */ new Date(+e) : a === "[object RegExp]" ? i = new RegExp(e.source, e.flags) : a === "[object DataView]" ? i = new e.constructor(A(e.buffer)) : a === "[object ArrayBuffer]" ? i = e.slice(0) : a.slice(-6) === "Array]" && (i = new e.constructor(e)), i) {
for (r = Object.getOwnPropertySymbols(e); t < r.length; t++)
un(i, r[t], Object.getOwnPropertyDescriptor(e, r[t]));
for (t = 0, r = Object.getOwnPropertyNames(e); t < r.length; t++)
Object.hasOwnProperty.call(i, n = r[t]) && i[n] === e[n] || un(i, n, Object.getOwnPropertyDescriptor(e, n));
}
return i || e;
}
const ht = Symbol("vee-validate-form"), $r = Symbol("vee-validate-field-instance"), lt = Symbol("Default empty value"), Ir = typeof window < "u";
function Nt(e) {
return Y(e) && !!e.__locatorRef;
}
function pe(e) {
return !!e && Y(e.parse) && e.__type === "VVTypedSchema";
}
function ut(e) {
return !!e && Y(e.validate);
}
function Qe(e) {
return e === "checkbox" || e === "radio";
}
function Dr(e) {
return Ve(e) || Array.isArray(e);
}
function Nr(e) {
return Array.isArray(e) ? e.length === 0 : Ve(e) && Object.keys(e).length === 0;
}
function vt(e) {
return /^\[.+\]$/i.test(e);
}
function Pr(e) {
return $n(e) && e.multiple;
}
function $n(e) {
return e.tagName === "SELECT";
}
function Mr(e, t) {
const n = ![!1, null, void 0, 0].includes(t.multiple) && !Number.isNaN(t.multiple);
return e === "select" && "multiple" in t && n;
}
function Rr(e, t) {
return !Mr(e, t) && t.type !== "file" && !Qe(t.type);
}
function In(e) {
return Ht(e) && e.target && "submit" in e.target;
}
function Ht(e) {
return e ? !!(typeof Event < "u" && Y(Event) && e instanceof Event || e && e.srcElement) : !1;
}
function on(e, t) {
return t in e && e[t] !== lt;
}
function ne(e, t) {
if (e === t)
return !0;
if (e && t && typeof e == "object" && typeof t == "object") {
if (e.constructor !== t.constructor)
return !1;
var n, r, i;
if (Array.isArray(e)) {
if (n = e.length, n != t.length)
return !1;
for (r = n; r-- !== 0; )
if (!ne(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 (!ne(r[1], t.get(r[0])))
return !1;
return !0;
}
if (dn(e) && dn(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, n != t.length)
return !1;
for (r = n; r-- !== 0; )
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();
for (i = Object.keys(e), n = i.length, r = n; r-- !== 0; ) {
var a = i[r];
if (!ne(e[a], t[a]))
return !1;
}
return !0;
}
return e !== e && t !== t;
}
function dn(e) {
return Ir ? e instanceof File : !1;
}
function Wt(e) {
return vt(e) ? e.replace(/\[|\]/gi, "") : e;
}
function ue(e, t, n) {
return e ? vt(t) ? e[Wt(t)] : (t || "").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i, a) => Dr(i) && a in i ? i[a] : n, e) : n;
}
function ge(e, t, n) {
if (vt(t)) {
e[Wt(t)] = n;
return;
}
const r = t.split(/\.|\[(\d+)\]/).filter(Boolean);
let i = e;
for (let a = 0; a < r.length; a++) {
if (a === r.length - 1) {
i[r[a]] = n;
return;
}
(!(r[a] in i) || Cn(i[r[a]])) && (i[r[a]] = Gt(r[a + 1]) ? [] : {}), i = i[r[a]];
}
}
function Vt(e, t) {
if (Array.isArray(e) && Gt(t)) {
e.splice(Number(t), 1);
return;
}
Ve(e) && delete e[t];
}
function cn(e, t) {
if (vt(t)) {
delete e[Wt(t)];
return;
}
const n = t.split(/\.|\[(\d+)\]/).filter(Boolean);
let r = e;
for (let a = 0; a < n.length; a++) {
if (a === n.length - 1) {
Vt(r, n[a]);
break;
}
if (!(n[a] in r) || Cn(r[n[a]]))
break;
r = r[n[a]];
}
const i = n.map((a, s) => ue(e, n.slice(0, s).join(".")));
for (let a = i.length - 1; a >= 0; a--)
if (Nr(i[a])) {
if (a === 0) {
Vt(e, n[0]);
continue;
}
Vt(i[a - 1], n[a - 1]);
}
}
function ae(e) {
return Object.keys(e);
}
function Dn(e, t = void 0) {
const n = $e();
return (n == null ? void 0 : n.provides[e]) || Vn(e, t);
}
function fn(e, t, n) {
if (Array.isArray(e)) {
const r = [...e], i = r.findIndex((a) => ne(a, t));
return i >= 0 ? r.splice(i, 1) : r.push(t), r;
}
return ne(e, t) ? n : t;
}
function Ur(e, t) {
let n, r;
return function(...i) {
const a = this;
return n || (n = !0, setTimeout(() => n = !1, t), r = e.apply(a, i)), r;
};
}
function hn(e, t = 0) {
let n = null, r = [];
return function(...i) {
return n && clearTimeout(n), n = setTimeout(() => {
const a = e(...i);
r.forEach((s) => s(a)), r = [];
}, t), new Promise((a) => r.push(a));
};
}
function Br(e, t) {
return Ve(t) && t.number ? kr(e) : e;
}
function Pt(e, t) {
let n;
return async function(...i) {
const a = e(...i);
n = a;
const s = await a;
return a !== n ? s : (n = void 0, t(s, i));
};
}
function Mt(e) {
return Array.isArray(e) ? e : e ? [e] : [];
}
function et(e, t) {
const n = {};
for (const r in e)
t.includes(r) || (n[r] = e[r]);
return n;
}
function zr(e) {
let t = null, n = [];
return function(...r) {
const i = me(() => {
if (t !== i)
return;
const a = e(...r);
n.forEach((s) => s(a)), n = [], t = null;
});
return t = i, new Promise((a) => n.push(a));
};
}
function Kt(e, t, n) {
return t.slots.default ? typeof e == "string" || !e ? t.slots.default(n()) : {
default: () => {
var r, i;
return (i = (r = t.slots).default) === null || i === void 0 ? void 0 : i.call(r, n());
}
} : t.slots.default;
}
function kt(e) {
if (Nn(e))
return e._value;
}
function Nn(e) {
return "_value" in e;
}
function Lr(e) {
return e.type === "number" || e.type === "range" ? Number.isNaN(e.valueAsNumber) ? e.value : e.valueAsNumber : e.value;
}
function ot(e) {
if (!Ht(e))
return e;
const t = e.target;
if (Qe(t.type) && Nn(t))
return kt(t);
if (t.type === "file" && t.files) {
const n = Array.from(t.files);
return t.multiple ? n : n[0];
}
if (Pr(t))
return Array.from(t.options).filter((n) => n.selected && !n.disabled).map(kt);
if ($n(t)) {
const n = Array.from(t.options).find((r) => r.selected);
return n ? kt(n) : t.value;
}
return Lr(t);
}
function Pn(e) {
const t = {};
return Object.defineProperty(t, "_$$isNormalized", {
value: !0,
writable: !1,
enumerable: !1,
configurable: !1
}), e ? Ve(e) && e._$$isNormalized ? e : Ve(e) ? Object.keys(e).reduce((n, r) => {
const i = qr(e[r]);
return e[r] !== !1 && (n[r] = vn(i)), n;
}, t) : typeof e != "string" ? t : e.split("|").reduce((n, r) => {
const i = Zr(r);
return i.name && (n[i.name] = vn(i.params)), n;
}, t) : t;
}
function qr(e) {
return e === !0 ? [] : Array.isArray(e) || Ve(e) ? e : [e];
}
function vn(e) {
const t = (n) => typeof n == "string" && n[0] === "@" ? Gr(n.slice(1)) : n;
return Array.isArray(e) ? e.map(t) : e instanceof RegExp ? [e] : Object.keys(e).reduce((n, r) => (n[r] = t(e[r]), n), {});
}
const Zr = (e) => {
let t = [];
const n = e.split(":")[0];
return e.includes(":") && (t = e.split(":").slice(1).join(":").split(",")), { name: n, params: t };
};
function Gr(e) {
const t = (n) => ue(n, e) || n[e];
return t.__locatorRef = e, t;
}
function Hr(e) {
return Array.isArray(e) ? e.filter(Nt) : ae(e).filter((t) => Nt(e[t])).map((t) => e[t]);
}
const Wr = {
generateMessage: ({ field: e }) => `${e} is not valid.`,
bails: !0,
validateOnBlur: !0,
validateOnChange: !0,
validateOnInput: !1,
validateOnModelUpdate: !0
};
let Kr = Object.assign({}, Wr);
const Ae = () => Kr;
async function Mn(e, t, n = {}) {
const r = n == null ? void 0 : n.bails, i = {
name: (n == null ? void 0 : n.name) || "{field}",
rules: t,
label: n == null ? void 0 : n.label,
bails: r ?? !0,
formData: (n == null ? void 0 : n.values) || {}
}, a = await Yr(i, e);
return Object.assign(Object.assign({}, a), { valid: !a.errors.length });
}
async function Yr(e, t) {
const n = e.rules;
if (pe(n) || ut(n))
return Jr(t, Object.assign(Object.assign({}, e), { rules: n }));
if (Y(n) || Array.isArray(n)) {
const l = {
field: e.label || e.name,
name: e.name,
label: e.label,
form: e.formData,
value: t
}, u = Array.isArray(n) ? n : [n], c = u.length, v = [];
for (let h = 0; h < c; h++) {
const y = u[h], g = await y(t, l);
if (!(typeof g != "string" && !Array.isArray(g) && g)) {
if (Array.isArray(g))
v.push(...g);
else {
const j = typeof g == "string" ? g : Un(l);
v.push(j);
}
if (e.bails)
return {
errors: v
};
}
}
return {
errors: v
};
}
const r = Object.assign(Object.assign({}, e), { rules: Pn(n) }), i = [], a = Object.keys(r.rules), s = a.length;
for (let l = 0; l < s; l++) {
const u = a[l], c = await Xr(r, t, {
name: u,
params: r.rules[u]
});
if (c.error && (i.push(c.error), e.bails))
return {
errors: i
};
}
return {
errors: i
};
}
function Qr(e) {
return !!e && e.name === "ValidationError";
}
function Rn(e) {
return {
__type: "VVTypedSchema",
async parse(n, r) {
var i;
try {
return {
output: await e.validate(n, { abortEarly: !1, context: (r == null ? void 0 : r.formData) || {} }),
errors: []
};
} catch (a) {
if (!Qr(a))
throw a;
if (!(!((i = a.inner) === null || i === void 0) && i.length) && a.errors.length)
return { errors: [{ path: a.path, errors: a.errors }] };
const s = a.inner.reduce((l, u) => {
const c = u.path || "";
return l[c] || (l[c] = { errors: [], path: c }), l[c].errors.push(...u.errors), l;
}, {});
return { errors: Object.values(s) };
}
}
};
}
async function Jr(e, t) {
const r = await (pe(t.rules) ? t.rules : Rn(t.rules)).parse(e, { formData: t.formData }), i = [];
for (const a of r.errors)
a.errors.length && i.push(...a.errors);
return {
value: r.value,
errors: i
};
}
async function Xr(e, t, n) {
const r = Cr(n.name);
if (!r)
throw new Error(`No such validator '${n.name}' exists.`);
const i = ei(n.params, e.formData), a = {
field: e.label || e.name,
name: e.name,
label: e.label,
value: t,
form: e.formData,
rule: Object.assign(Object.assign({}, n), { params: i })
}, s = await r(t, i, a);
return typeof s == "string" ? {
error: s
} : {
error: s ? void 0 : Un(a)
};
}
function Un(e) {
const t = Ae().generateMessage;
return t ? t(e) : "Field is invalid";
}
function ei(e, t) {
const n = (r) => Nt(r) ? r(t) : r;
return Array.isArray(e) ? e.map(n) : Object.keys(e).reduce((r, i) => (r[i] = n(e[i]), r), {});
}
async function ti(e, t) {
const r = await (pe(e) ? e : Rn(e)).parse(A(t)), i = {}, a = {};
for (const s of r.errors) {
const l = s.errors, u = (s.path || "").replace(/\["(\d+)"\]/g, (c, v) => `[${v}]`);
i[u] = { valid: !l.length, errors: l }, l.length && (a[u] = l[0]);
}
return {
valid: !r.errors.length,
results: i,
errors: a,
values: r.value,
source: "schema"
};
}
async function ni(e, t, n) {
const i = ae(e).map(async (c) => {
var v, h, y;
const g = (v = n == null ? void 0 : n.names) === null || v === void 0 ? void 0 : v[c], E = await Mn(ue(t, c), e[c], {
name: (g == null ? void 0 : g.name) || c,
label: g == null ? void 0 : g.label,
values: t,
bails: (y = (h = n == null ? void 0 : n.bailsMap) === null || h === void 0 ? void 0 : h[c]) !== null && y !== void 0 ? y : !0
});
return Object.assign(Object.assign({}, E), { path: c });
});
let a = !0;
const s = await Promise.all(i), l = {}, u = {};
for (const c of s)
l[c.path] = {
valid: c.valid,
errors: c.errors
}, c.valid || (a = !1, u[c.path] = c.errors[0]);
return {
valid: a,
results: l,
errors: u,
source: "schema"
};
}
let mn = 0;
function ri(e, t) {
const { value: n, initialValue: r, setInitialValue: i } = ii(e, t.modelValue, t.form);
if (!t.form) {
let y = function(g) {
var E;
"value" in g && (n.value = g.value), "errors" in g && c(g.errors), "touched" in g && (h.touched = (E = g.touched) !== null && E !== void 0 ? E : h.touched), "initialValue" in g && i(g.initialValue);
};
const { errors: u, setErrors: c } = li(), v = mn >= Number.MAX_SAFE_INTEGER ? 0 : ++mn, h = si(n, r, u, t.schema);
return {
id: v,
path: e,
value: n,
initialValue: r,
meta: h,
flags: { pendingUnmount: { [v]: !1 }, pendingReset: !1 },
errors: u,
setState: y
};
}
const a = t.form.createPathState(e, {
bails: t.bails,
label: t.label,
type: t.type,
validate: t.validate,
schema: t.schema
}), s = T(() => a.errors);
function l(u) {
var c, v, h;
"value" in u && (n.value = u.value), "errors" in u && ((c = t.form) === null || c === void 0 || c.setFieldError(w(e), u.errors)), "touched" in u && ((v = t.form) === null || v === void 0 || v.setFieldTouched(w(e), (h = u.touched) !== null && h !== void 0 ? h : !1)), "initialValue" in u && i(u.initialValue);
}
return {
id: Array.isArray(a.id) ? a.id[a.id.length - 1] : a.id,
path: e,
value: n,
errors: s,
meta: a,
initialValue: r,
flags: a.__flags,
setState: l
};
}
function ii(e, t, n) {
const r = G(w(t));
function i() {
return n ? ue(n.initialValues.value, w(e), w(r)) : w(r);
}
function a(c) {
if (!n) {
r.value = c;
return;
}
n.setFieldInitialValue(w(e), c, !0);
}
const s = T(i);
if (!n)
return {
value: G(i()),
initialValue: s,
setInitialValue: a
};
const l = ai(t, n, s, e);
return n.stageInitialValue(w(e), l, !0), {
value: T({
get() {
return ue(n.values, w(e));
},
set(c) {
n.setFieldValue(w(e), c, !1);
}
}),
initialValue: s,
setInitialValue: a
};
}
function ai(e, t, n, r) {
return at(e) ? w(e) : e !== void 0 ? e : ue(t.values, w(r), w(n));
}
function si(e, t, n, r) {
const i = T(() => {
var s, l, u;
return (u = (l = (s = F(r)) === null || s === void 0 ? void 0 : s.describe) === null || l === void 0 ? void 0 : l.call(s).required) !== null && u !== void 0 ? u : !1;
}), a = st({
touched: !1,
pending: !1,
valid: !0,
required: i,
validated: !!w(n).length,
initialValue: T(() => w(t)),
dirty: T(() => !ne(w(e), w(t)))
});
return we(n, (s) => {
a.valid = !s.length;
}, {
immediate: !0,
flush: "sync"
}), a;
}
function li() {
const e = G([]);
return {
errors: e,
setErrors: (t) => {
e.value = Mt(t);
}
};
}
function Bn(e) {
process.env.NODE_ENV !== "production" && Vr({
id: "vee-validate-devtools-plugin",
label: "VeeValidate Plugin",
packageName: "vee-validate",
homepage: "https://vee-validate.logaretm.com/v4",
app: e,
logo: "https://vee-validate.logaretm.com/v4/logo.png"
}, di);
}
const We = {}, Ke = {};
let xe;
const Le = Ur(() => {
setTimeout(async () => {
await me(), xe == null || xe.sendInspectorState(Be), xe == null || xe.sendInspectorTree(Be);
}, 100);
}, 100);
function ui(e) {
const t = $e();
if (!xe) {
const n = t == null ? void 0 : t.appContext.app;
if (!n)
return;
Bn(n);
}
We[e.formId] = Object.assign({}, e), We[e.formId]._vm = t, An(() => {
delete We[e.formId], Le();
}), Le();
}
function oi(e) {
const t = $e();
if (!xe) {
const n = t == null ? void 0 : t.appContext.app;
if (!n)
return;
Bn(n);
}
Ke[e.id] = Object.assign({}, e), Ke[e.id]._vm = t, An(() => {
delete Ke[e.id], Le();
}), Le();
}
const Be = "vee-validate-inspector", se = {
error: 12405579,
success: 448379,
unknown: 5522283,
white: 16777215,
black: 0,
blue: 218007,
purple: 12157168,
orange: 16099682,
gray: 12304330
};
let q = null;
function di(e) {
xe = e, e.addInspector({
id: Be,
icon: "rule",
label: "vee-validate",
noSelectionText: "Select a vee-validate node to inspect",
actions: [
{
icon: "done_outline",
tooltip: "Validate selected item",
action: async () => {
if (!q) {
console.error("There is not a valid selected vee-validate node or component");
return;
}
if (q.type === "field") {
await q.field.validate();
return;
}
if (q.type === "form") {
await q.form.validate();
return;
}
q.type === "pathState" && await q.form.validateField(q.state.path);
}
},
{
icon: "delete_sweep",
tooltip: "Clear validation state of the selected item",
action: () => {
if (!q) {
console.error("There is not a valid selected vee-validate node or component");
return;
}
if (q.type === "field") {
q.field.resetField();
return;
}
q.type === "form" && q.form.resetForm(), q.type === "pathState" && q.form.resetField(q.state.path);
}
}
]
}), e.on.getInspectorTree((t) => {
if (t.inspectorId !== Be)
return;
const n = Object.values(We), r = Object.values(Ke);
t.rootNodes = [
...n.map(ci),
...r.map((i) => hi(i))
];
}), e.on.getInspectorState((t, n) => {
if (t.inspectorId !== Be || n.currentTab !== `custom-inspector:${Be}`)
return;
const { form: r, field: i, state: a, type: s } = vi(t.nodeId);
if (r && s === "form") {
t.state = mi(r), q = { type: "form", form: r };
return;
}
if (a && s === "pathState" && r) {
t.state = pn(a), q = { type: "pathState", state: a, form: r };
return;
}
if (i && s === "field") {
t.state = pn({
errors: i.errors.value,
dirty: i.meta.dirty,
valid: i.meta.valid,
touched: i.meta.touched,
value: i.value.value,
initialValue: i.meta.initialValue
}), q = { field: i, type: "field" };
return;
}
q = null;
});
}
function ci(e) {
const { textColor: t, bgColor: n } = Ln(e.meta.value.valid), r = {};
Object.values(e.getAllPathStates()).forEach((s) => {
ge(r, w(s.path), fi(s, e));
});
function i(s, l = []) {
const u = [...l].pop();
return "id" in s ? Object.assign(Object.assign({}, s), { label: u || s.label }) : Ve(s) ? {
id: `${l.join(".")}`,
label: u || "",
children: Object.keys(s).map((c) => i(s[c], [...l, c]))
} : Array.isArray(s) ? {
id: `${l.join(".")}`,
label: `${u}[]`,
children: s.map((c, v) => i(c, [...l, String(v)]))
} : { id: "", label: "", children: [] };
}
const { children: a } = i(r);
return {
id: Yt(e),
label: "Form",
children: a,
tags: [
{
label: "Form",
textColor: t,
backgroundColor: n
},
{
label: `${e.getAllPathStates().length} fields`,
textColor: se.white,
backgroundColor: se.unknown
}
]
};
}
function fi(e, t) {
return {
id: Yt(t, e),
label: w(e.path),
tags: zn(e.multiple, e.fieldsCount, e.type, e.valid, t)
};
}
function hi(e, t) {
return {
id: Yt(t, e),
label: w(e.name),
tags: zn(!1, 1, e.type, e.meta.valid, t)
};
}
function zn(e, t, n, r, i) {
const { textColor: a, bgColor: s } = Ln(r);
return [
e ? void 0 : {
label: "Field",
textColor: a,
backgroundColor: s
},
i ? void 0 : {
label: "Standalone",
textColor: se.black,
backgroundColor: se.gray
},
n === "checkbox" ? {
label: "Checkbox",
textColor: se.white,
backgroundColor: se.blue
} : void 0,
n === "radio" ? {
label: "Radio",
textColor: se.white,
backgroundColor: se.purple
} : void 0,
e ? {
label: "Multiple",
textColor: se.black,
backgroundColor: se.orange
} : void 0
].filter(Boolean);
}
function Yt(e, t) {
const n = t ? "path" in t ? "pathState" : "field" : "form", r = t ? "path" in t ? t == null ? void 0 : t.path : w(t == null ? void 0 : t.name) : "", i = { f: e == null ? void 0 : e.formId, ff: r, type: n };
return btoa(encodeURIComponent(JSON.stringify(i)));
}
function vi(e) {
try {
const t = JSON.parse(decodeURIComponent(atob(e))), n = We[t.f];
if (!n && t.ff) {
const i = Ke[t.ff];
return i ? {
type: t.type,
field: i
} : {};
}
if (!n)
return {};
const r = n.getPathState(t.ff);
return {
type: t.type,
form: n,
state: r
};
} catch {
}
return {};
}
function pn(e) {
return {
"Field state": [
{ key: "errors", value: e.errors },
{
key: "initialValue",
value: e.initialValue
},
{
key: "currentValue",
value: e.value
},
{
key: "touched",
value: e.touched
},
{
key: "dirty",
value: e.dirty
},
{
key: "valid",
value: e.valid
}
]
};
}
function mi(e) {
const { errorBag: t, meta: n, values: r, isSubmitting: i, isValidating: a, submitCount: s } = e;
return {
"Form state": [
{
key: "submitCount",
value: s.value
},
{
key: "isSubmitting",
value: i.value
},
{
key: "isValidating",
value: a.value
},
{
key: "touched",
value: n.value.touched
},
{
key: "dirty",
value: n.value.dirty
},
{
key: "valid",
value: n.value.valid
},
{
key: "initialValues",
value: n.value.initialValues
},
{
key: "currentValues",
value: r
},
{
key: "errors",
value: ae(t.value).reduce((l, u) => {
var c;
const v = (c = t.value[u]) === null || c === void 0 ? void 0 : c[0];
return v && (l[u] = v), l;
}, {})
}
]
};
}
function Ln(e) {
return {
bgColor: e ? se.success : se.error,
textColor: e ? se.black : se.white
};
}
function pi(e, t, n) {
return Qe(n == null ? void 0 : n.type) ? yi(e, t, n) : qn(e, t, n);
}
function qn(e, t, n) {
const { initialValue: r, validateOnMount: i, bails: a, type: s, checkedValue: l, label: u, validateOnValueUpdate: c, uncheckedValue: v, controlled: h, keepValueOnUnmount: y, syncVModel: g, form: E } = gi(n), j = h ? Dn(ht) : void 0, b = E || j, z = T(() => Ge(F(e))), D = T(() => {
if (F(b == null ? void 0 : b.schema))
return;
const x = w(t);
return ut(x) || pe(x) || Y(x) || Array.isArray(x) ? x : Pn(x);
}), oe = !Y(D.value) && pe(F(t)), { id: H, value: B, initialValue: W, meta: U, setState: de, errors: N, flags: C } = ri(z, {
modelValue: r,
form: b,
bails: a,
label: u,
type: s,
validate: D.value ? $ : void 0,
schema: oe ? t : void 0
}), V = T(() => N.value[0]);
g && bi({
value: B,
prop: g,
handleChange: P,
shouldValidate: () => c && !C.pendingReset
});
const Q = (p, x = !1) => {
U.touched = !0, x && K();
};
async function ce(p) {
var x, Z;
if (b != null && b.validateSchema) {
const { results: I } = await b.validateSchema(p);
return (x = I[F(z)]) !== null && x !== void 0 ? x : { valid: !0, errors: [] };
}
return D.value ? Mn(B.value, D.value, {
name: F(z),
label: F(u),
values: (Z = b == null ? void 0 : b.values) !== null && Z !== void 0 ? Z : {},
bails: a
}) : { valid: !0, errors: [] };
}
const K = Pt(async () => (U.pending = !0, U.validated = !0, ce("validated-only")), (p) => (C.pendingUnmount[te.id] || (de({ errors: p.errors }), U.pending = !1, U.valid = p.valid), p)), J = Pt(async () => ce("silent"), (p) => (U.valid = p.valid, p));
function $(p) {
return (p == null ? void 0 : p.mode) === "silent" ? J() : K();
}
function P(p, x = !0) {
const Z = ot(p);
Ne(Z, x);
}
kn(() => {
if (i)
return K();
(!b || !b.validateSchema) && J();
});
function he(p) {
U.touched = p;
}
function Ee(p) {
var x;
const Z = p && "value" in p ? p.value : W.value;
de({
value: A(Z),
initialValue: A(Z),
touched: (x = p == null ? void 0 : p.touched) !== null && x !== void 0 ? x : !1,
errors: (p == null ? void 0 : p.errors) || []
}), U.pending = !1, U.validated = !1, J();
}
const Je = $e();
function Ne(p, x = !0) {
B.value = Je && g ? Br(p, Je.props.modelModifiers) : p, (x ? K : J)();
}
function nn(p) {
de({ errors: Array.isArray(p) ? p : [p] });
}
const qe = T({
get() {
return B.value;
},
set(p) {
Ne(p, c);
}
}), te = {
id: H,
name: z,
label: u,
value: qe,
meta: U,
errors: N,
errorMessage: V,
type: s,
checkedValue: l,
uncheckedValue: v,
bails: a,
keepValueOnUnmount: y,
resetField: Ee,
handleReset: () => Ee(),
validate: $,
handleChange: P,
handleBlur: Q,
setState: de,
setTouched: he,
setErrors: nn,
setValue: Ne
};
if (Tn($r, te), at(t) && typeof w(t) != "function" && we(t, (p, x) => {
ne(p, x) || (U.validated ? K() : J());
}, {
deep: !0
}), process.env.NODE_ENV !== "production" && (te._vm = $e(), we(() => Object.assign(Object.assign({ errors: N.value }, U), { value: B.value }), Le, {
deep: !0
}), b || oi(te)), !b)
return te;
const yt = T(() => {
const p = D.value;
return !p || Y(p) || ut(p) || pe(p) || Array.isArray(p) ? {} : Object.keys(p).reduce((x, Z) => {
const I = Hr(p[Z]).map((_e) => _e.__locatorRef).reduce((_e, ve) => {
const Oe = ue(b.values, ve) || b.values[ve];
return Oe !== void 0 && (_e[ve] = Oe), _e;
}, {});
return Object.assign(x, I), x;
}, {});
});
return we(yt, (p, x) => {
if (!Object.keys(p).length)
return;
!ne(p, x) && (U.validated ? K() : J());
}), cr(() => {
var p;
const x = (p = F(te.keepValueOnUnmount)) !== null && p !== void 0 ? p : F(b.keepValuesOnUnmount), Z = F(z);
if (x || !b || C.pendingUnmount[te.id]) {
b == null || b.removePathState(Z, H);
return;
}
C.pendingUnmount[te.id] = !0;
const I = b.getPathState(Z);
if (Array.isArray(I == null ? void 0 : I.id) && (I != null && I.multiple) ? I != null && I.id.includes(te.id) : (I == null ? void 0 : I.id) === te.id) {
if (I != null && I.multiple && Array.isArray(I.value)) {
const ve = I.value.findIndex((Oe) => ne(Oe, F(te.checkedValue)));
if (ve > -1) {
const Oe = [...I.value];
Oe.splice(ve, 1), b.setFieldValue(Z, Oe);
}
Array.isArray(I.id) && I.id.splice(I.id.indexOf(te.id), 1);
} else
b.unsetPathValue(F(z));
b.removePathState(Z, H);
}
}), te;
}
function gi(e) {
const t = () => ({
initialValue: void 0,
validateOnMount: !1,
bails: !0,
label: void 0,
validateOnValueUpdate: !0,
keepValueOnUnmount: void 0,
syncVModel: !1,
controlled: !0
}), n = !!(e != null && e.syncVModel), r = typeof (e == null ? void 0 : e.syncVModel) == "string" ? e.syncVModel : (e == null ? void 0 : e.modelPropName) || "modelValue", i = n && !("initialValue" in (e || {})) ? Rt($e(), r) : e == null ? void 0 : e.initialValue;
if (!e)
return Object.assign(Object.assign({}, t()), { initialValue: i });
const a = "valueProp" in e ? e.valueProp : e.checkedValue, s = "standalone" in e ? !e.standalone : e.controlled, l = (e == null ? void 0 : e.modelPropName) || (e == null ? void 0 : e.syncVModel) || !1;
return Object.assign(Object.assign(Object.assign({}, t()), e || {}), {
initialValue: i,
controlled: s ?? !0,
checkedValue: a,
syncVModel: l
});
}
function yi(e, t, n) {
const r = n != null && n.standalone ? void 0 : Dn(ht), i = n == null ? void 0 : n.checkedValue, a = n == null ? void 0 : n.uncheckedValue;
function s(l) {
const u = l.handleChange, c = T(() => {
const h = F(l.value), y = F(i);
return Array.isArray(h) ? h.findIndex((g) => ne(g, y)) >= 0 : ne(y, h);
});
function v(h, y = !0) {
var g, E;
if (c.value === ((g = h == null ? void 0 : h.target) === null || g === void 0 ? void 0 : g.checked)) {
y && l.validate();
return;
}
const j = F(e), b = r == null ? void 0 : r.getPathState(j), z = ot(h);
let D = (E = F(i)) !== null && E !== void 0 ? E : z;
r && (b != null && b.multiple) && b.type === "checkbox" ? D = fn(ue(r.values, j) || [], D, void 0) : (n == null ? void 0 : n.type) === "checkbox" && (D = fn(F(l.value), D, F(a))), u(D, y);
}
return Object.assign(Object.assign({}, l), {
checked: c,
checkedValue: i,
uncheckedValue: a,
handleChange: v
});
}
return s(qn(e, t, n));
}
function bi({ prop: e, value: t, handleChange: n, shouldValidate: r }) {
const i = $e();
if (!i || !e) {
process.env.NODE_ENV !== "production" && console.warn("Failed to setup model events because `useField` was not called in setup.");
return;
}
const a = typeof e == "string" ? e : "modelValue", s = `update:${a}`;
a in i.props && (we(t, (l) => {
ne(l, Rt(i, a)) || i.emit(s, l);
}), we(() => Rt(i, a), (l) => {
if (l === lt && t.value === void 0)
return;
const u = l === lt ? void 0 : l;
ne(u, t.value) || n(u, r());
}));
}
function Rt(e, t) {
if (e)
return e.props[t];
}
const _i = /* @__PURE__ */ ft({
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: () => Ae().bails
},
label: {
type: String,
default: void 0
},
uncheckedValue: {
type: null,
default: void 0
},
modelValue: {
type: null,
default: lt
},
modelModifiers: {
type: null,
default: () => ({})
},
"onUpdate:modelValue": {
type: null,
default: void 0
},
standalone: {
type: Boolean,
default: !1
},
keepValue: {
type: Boolean,
default: void 0
}
},
setup(e, t) {
const n = Te(e, "rules"), r = Te(e, "name"), i = Te(e, "label"), a = Te(e, "uncheckedValue"), s = Te(e, "keepValue"), { errors: l, value: u, errorMessage: c, validate: v, handleChange: h, handleBlur: y, setTouched: g, resetField: E, handleReset: j, meta: b, checked: z, setErrors: D, setValue: oe } = pi(r, n, {
validateOnMount: e.validateOnMount,
bails: e.bails,
standalone: e.standalone,
type: t.attrs.type,
initialValue: Si(e, t),
// Only for checkboxes and radio buttons
checkedValue: t.attrs.value,
uncheckedValue: a,
label: i,
validateOnValueUpdate: e.validateOnModelUpdate,
keepValueOnUnmount: s,
syncVModel: !0
}), H = function(C, V = !0) {
h(C, V);
}, B = T(() => {
const { validateOnInput: N, validateOnChange: C, validateOnBlur: V, validateOnModelUpdate: Q } = Oi(e);
function ce(P) {
y(P, V), Y(t.attrs.onBlur) && t.attrs.onBlur(P);
}
function K(P) {
H(P, N), Y(t.attrs.onInput) && t.attrs.onInput(P);
}
function J(P) {
H(P, C), Y(t.attrs.onChange) && t.attrs.onChange(P);
}
const $ = {
name: e.name,
onBlur: ce,
onInput: K,
onChange: J
};
return $["onUpdate:modelValue"] = (P) => H(P, Q), $;
}), W = T(() => {
const N = Object.assign({}, B.value);
Qe(t.attrs.type) && z && (N.checked = z.value);
const C = gn(e, t);
return Rr(C, t.attrs) && (N.value = u.value), N;
}), U = T(() => Object.assign(Object.assign({}, B.value), { modelValue: u.value }));
function de() {
return {
field: W.value,
componentField: U.value,
value: u.value,
meta: b,
errors: l.value,
errorMessage: c.value,
validate: v,
resetField: E,
handleChange: H,
handleInput: (N) => H(N, !1),
handleReset: j,
handleBlur: B.value.onBlur,
setTouched: g,
setErrors: D,
setValue: oe
};
}
return t.expose({
value: u,
meta: b,
errors: l,
errorMessage: c,
setErrors: D,
setTouched: g,
setValue: oe,
reset: E,
validate: v,
handleChange: h
}), () => {
const N = Zt(gn(e, t)), C = Kt(N, t, de);
return N ? it(N, Object.assign(Object.assign({}, t.attrs), W.value), C) : C;
};
}
});
function gn(e, t) {
let n = e.as || "";
return !e.as && !t.slots.default && (n = "input"), n;
}
function Oi(e) {
var t, n, r, i;
const { validateOnInput: a, validateOnChange: s, validateOnBlur: l, validateOnModelUpdate: u } = Ae();
return {
validateOnInput: (t = e.validateOnInput) !== null && t !== void 0 ? t : a,
validateOnChange: (n = e.validateOnChange) !== null && n !== void 0 ? n : s,
validateOnBlur: (r = e.validateOnBlur) !== null && r !== void 0 ? r : l,
validateOnModelUpdate: (i = e.validateOnModelUpdate) !== null && i !== void 0 ? i : u
};
}
function Si(e, t) {
return Qe(t.attrs.type) ? on(e, "modelValue") ? e.modelValue : void 0 : on(e, "modelValue") ? e.modelValue : t.attrs.value;
}
const yn = _i;
let xi = 0;
const tt = ["bails", "fieldsCount", "id", "multiple", "type", "validate"];
function Zn(e) {
const t = (e == null ? void 0 : e.initialValues) || {}, n = Object.assign({}, F(t)), r = w(e == null ? void 0 : e.validationSchema);
return r && pe(r) && Y(r.cast) ? A(r.cast(n) || {}) : A(n);
}
function wi(e) {
var t;
const n = xi++;
let r = 0;
const i = G(!1), a = G(!1), s = G(0), l = [], u = st(Zn(e)), c = G([]), v = G({}), h = G({}), y = zr(() => {
h.value = c.value.reduce((d, o) => (d[Ge(F(o.path))] = o, d), {});
});
function g(d, o) {
const f = $(d);
if (!f) {
typeof d == "string" && (v.value[Ge(d)] = Mt(o));
return;
}
if (typeof d == "string") {
const m = Ge(d);
v.value[m] && delete v.value[m];
}
f.errors = Mt(o), f.valid = !f.errors.length;
}
function E(d) {
ae(d).forEach((o) => {
g(o, d[o]);
});
}
e != null && e.initialErrors && E(e.initialErrors);
const j = T(() => {
const d = c.value.reduce((o, f) => (f.errors.length && (o[f.path] = f.errors), o), {});
return Object.assign(Object.assign({}, v.value), d);
}), b = T(() => ae(j.value).reduce((d, o) => {
const f = j.value[o];
return f != null && f.length && (d[o] = f[0]), d;
}, {})), z = T(() => c.value.reduce((d, o) => (d[o.path] = { name: o.path || "", label: o.label || "" }, d), {})), D = T(() => c.value.reduce((d, o) => {
var f;
return d[o.path] = (f = o.bails) !== null && f !== void 0 ? f : !0, d;
}, {})), oe = Object.assign({}, (e == null ? void 0 : e.initialErrors) || {}), H = (t = e == null ? void 0 : e.keepValuesOnUnmount) !== null && t !== void 0 ? t : !1, { initialValues: B, originalInitialValues: W, setInitialValues: U } = Fi(c, u, e), de = Ei(c, u, W, b), N = T(() => c.value.reduce((d, o) => {
const f = ue(u, o.path);
return ge(d, o.path, f), d;
}, {})), C = e == null ? void 0 : e.validationSchema;
function V(d, o) {
var f, m;
const O = T(() => ue(B.value, F(d))), S = h.value[F(d)], _ = (o == null ? void 0 : o.type) === "checkbox" || (o == null ? void 0 : o.type) === "radio";
if (S && _) {
S.multiple = !0;
const fe = r++;
return Array.isArray(S.id) ? S.id.push(fe) : S.id = [S.id, fe], S.fieldsCount++, S.__flags.pendingUnmount[fe] = !1, S;
}
const R = T(() => ue(u, F(d))), L = F(d), X = he.findIndex((fe) => fe === L);
X !== -1 && he.splice(X, 1);
const M = T(() => {
var fe, Ze, xt, wt;
const Et = F(C);
if (pe(Et))
return (Ze = (fe = Et.describe) === null || fe === void 0 ? void 0 : fe.call(Et, F(d)).required) !== null && Ze !== void 0 ? Ze : !1;
const Ft = F(o == null ? void 0 : o.schema);
return pe(Ft) && (wt = (xt = Ft.describe) === null || xt === void 0 ? void 0 : xt.call(Ft).required) !== null && wt !== void 0 ? wt : !1;
}), ee = r++, re = st({
id: ee,
path: d,
touched: !1,
pending: !1,
valid: !0,
validated: !!(!((f = oe[L]) === null || f === void 0) && f.length),
required: M,
initialValue: O,
errors: mr([]),
bails: (m = o == null ? void 0 : o.bails) !== null && m !== void 0 ? m : !1,
label: o == null ? void 0 : o.label,
type: (o == null ? void 0 : o.type) || "default",
value: R,
multiple: !1,
__flags: {
pendingUnmount: { [ee]: !1 },
pendingReset: !1
},
fieldsCount: 1,
validate: o == null ? void 0 : o.validate,
dirty: T(() => !ne(w(R), w(O)))
});
return c.value.push(re), h.value[L] = re, y(), b.value[L] && !oe[L] && me(() => {
ke(L, { mode: "silent" });
}), at(d) && we(d, (fe) => {
y();
const Ze = A(R.value);
h.value[fe] = re, me(() => {
ge(u, fe, Ze);
});
}), re;
}
const Q = hn(sn, 5), ce = hn(sn, 5), K = Pt(async (d) => await (d === "silent" ? Q() : ce()), (d, [o]) => {
const f = ae(p.errorBag.value), O = [
.../* @__PURE__ */ new Set([...ae(d.results), ...c.value.map((S) => S.path), ...f])
].sort().reduce((S, _) => {
var R;
const L = _, X = $(L) || P(L), M = ((R = d.results[L]) === null || R === void 0 ? void 0 : R.errors) || [], ee = F(X == null ? void 0 : X.path) || L, re = Vi({ errors: M, valid: !M.length }, S.results[ee]);
return S.results[ee] = re, re.valid || (S.errors[ee] = re.errors[0]), X && v.value[ee] && delete v.value[ee], X ? (X.valid = re.valid, o === "silent" || o === "validated-only" && !X.validated || g(X, re.errors), S) : (g(ee, M), S);
}, {
valid: d.valid,
results: {},
errors: {},
source: d.source
});
return d.values && (O.values = d.values, O.source = d.source), ae(O.results).forEach((S) => {
var _;
const R = $(S);
R && o !== "silent" && (o === "validated-only" && !R.validated || g(R, (_ = O.results[S]) === null || _ === void 0 ? void 0 : _.errors));
}), O;
});
function J(d) {
c.value.forEach(d);
}
function $(d) {
const o = typeof d == "string" ? Ge(d) : d;
return typeof o == "string" ? h.value[o] : o;
}
function P(d) {
return c.value.filter((f) => d.startsWith(f.path)).reduce((f, m) => f ? m.path.length > f.path.length ? m : f : m, void 0);
}
let he = [], Ee;
function Je(d) {
return he.push(d), Ee || (Ee = me(() => {
[...he].sort().reverse().forEach((f) => {
cn(u, f);
}), he = [], Ee = null;
})), Ee;
}
function Ne(d) {
return function(f, m) {
return function(S) {
return S instanceof Event && (S.preventDefault(), S.stopPropagation()), J((_) => _.touched = !0), i.value = !0, s.value++, Pe().then((_) => {
const R = A(u);
if (_.valid && typeof f == "function") {
const L = A(N.value);
let X = d ? L : R;
return _.values && (X = _.source === "schema" ? _.values : Object.assign({}, X, _.values)), f(X, {
evt: S,
controlledValues: L,
setErrors: E,
setFieldError: g,
setTouched: bt,
setFieldTouched: ve,
setValues: I,
setFieldValue: x,
resetForm: _t,
resetField: rn
});
}
!_.valid && typeof m == "function" && m({
values: R,
evt: S,
errors: _.errors,
results: _.results
});
}).then((_) => (i.value = !1, _), (_) => {
throw i.value = !1, _;
});
};
};
}
const qe = Ne(!1);
qe.withControlled = Ne(!0);
function te(d, o) {
const f = c.value.findIndex((O) => O.path === d && (Array.isArray(O.id) ? O.id.includes(o) : O.id === o)), m = c.value[f];
if (!(f === -1 || !m)) {
if (me(() => {
ke(d, { mode: "silent", warn: !1 });
}), m.multiple && m.fieldsCount && m.fieldsCount--, Array.isArray(m.id)) {
const O = m.id.indexOf(o);
O >= 0 && m.id.splice(O, 1), delete m.__flags.pendingUnmount[o];
}
(!m.multiple || m.fieldsCount <= 0) && (c.value.splice(f, 1), an(d), y(), delete h.value[d]);
}
}
function yt(d) {
ae(h.value).forEach((o) => {
o.startsWith(d) && delete h.value[o];
}), c.value = c.value.filter((o) => !o.path.startsWith(d)), me(() => {
y();
});
}
const p = {
formId: n,
values: u,
controlledValues: N,
errorBag: j,
errors: b,
schema: C,
submitCount: s,
meta: de,
isSubmitting: i,
isValidating: a,
fieldArrays: l,
keepValuesOnUnmount: H,
validateSchema: w(C) ? K : void 0,
validate: Pe,
setFieldError: g,
validateField: ke,
setFieldValue: x,
setValues: I,
setErrors: E,
setFieldTouched: ve,
setTouched: bt,
resetForm: _t,
resetField: rn,
handleSubmit: qe,
useFieldModel: ur,
defineInputBinds: or,
defineComponentBinds: dr,
defineField: St,
stageInitialValue: sr,
unsetInitialValue: an,
setFieldInitialValue: Ot,
createPathState: V,
getPathState: $,
unsetPathValue: Je,
removePathState: te,
initialValues: B,
getAllPathStates: () => c.value,
destroyPath: yt,
isFieldTouched: Oe,
isFieldDirty: ir,
isFieldValid: ar
};
function x(d, o, f = !0) {
const m = A(o), O = typeof d == "string" ? d : d.path;
$(O) || V(O), ge(u, O, m), f && ke(O);
}
function Z(d, o = !0) {
ae(u).forEach((f) => {
delete u[f];
}), ae(d).forEach((f) => {
x(f, d[f], !1);
}), o && Pe();
}
function I(d, o = !0) {
Ye(u, d), l.forEach((f) => f && f.reset()), o && Pe();
}
function _e(d, o) {
const f = $(F(d)) || V(d);
return T({
get() {
return f.value;
},
set(m) {
var O;
const S = F(d);
x(S, m, (O = F(o)) !== null && O !== void 0 ? O : !1);
}
});
}
function ve(d, o) {
const f = $(d);
f && (f.touched = o);
}
function Oe(d) {
const o = $(d);
return o ? o.touched : c.value.filter((f) => f.path.startsWith(d)).some((f) => f.touched);
}
function ir(d) {
const o = $(d);
return o ? o.dirty : c.value.filter((f) => f.path.startsWith(d)).some((f) => f.dirty);
}
function ar(d) {
const o = $(d);
return o ? o.valid : c.value.filter((f) => f.path.startsWith(d)).every((f) => f.valid);
}
function bt(d) {
if (typeof d == "boolean") {
J((o) => {
o