UNPKG

@userfrosting/sprinkle-account

Version:
1,395 lines 77.3 kB
import { ref as F, shallowRef as ge, watch as ne, effectScope as se, computed as c, toValue as A, reactive as Oe, getCurrentInstance as rt, onMounted as Vt, watchEffect as ze, getCurrentScope as ot, onScopeDispose as $t, isRef as We, inject as Mt, triggerRef as Xt, nextTick as Xe, unref as qt, toRef as Q, version as Zt, markRaw as kt } from "vue"; import Kt from "axios"; import { u as er } from "./useAuthStore-DRHqdc4w.js"; import { useCsrf as tr } from "@userfrosting/sprinkle-core/composables"; /** * @regle/core v1.24.3 * (c) 2026 Victor Garcia * @license MIT */ function rr(e) { var t; return ((t = e == null ? void 0 : e.constructor) == null ? void 0 : t.name) == "File"; } function ae(e) { return e && (e instanceof Date || e.constructor.name == "File" || e.constructor.name == "FileList") ? !1 : typeof e == "object" && e !== null && !Array.isArray(e); } function ur(e) { const t = {}; for (const r in e) { if (!Object.prototype.hasOwnProperty.call(e, r)) continue; const n = e[r], a = r.split("."); let l = t; for (let u = 0; u < a.length; u++) { const s = a[u], o = u === a.length - 1, m = s.match(/^\d+$/) ? Number(s) : null; if (m !== null) { if (Array.isArray(l)) if (o) l[m] = n; else { if (typeof l[m] != "object" || l[m] === null) { const y = a[u + 1]; l[m] = y && y.match(/^\d+$/) ? { $each: [], $self: [] } : {}; } l = "$each" in l[m] ? l[m].$each : l[m]; } } else if (o) if (Array.isArray(l[s])) { let y = l[s].slice(); l[s] = {}, l[s].$self = y; } else typeof l[s] == "object" && l[s] !== null && "$each" in l[s] ? l[s].$self = n : l[s] = n; else { const y = a[u + 1]; if (Array.isArray(l[s])) { let R = l[s].slice(); l[s] = { $each: [] }, l[s].$self = R; } (typeof l[s] != "object" || l[s] === null || Array.isArray(l[s]) && !y.match(/^\d+$/)) && (y && y.match(/^\d+$/) ? l[s] = { $each: [], $self: [] } : l[s] = {}), "$each" in l[s] ? l = l[s].$each : l = l[s]; } } } return t; } function lr(e, t) { return Object.prototype.hasOwnProperty.call(e, t); } function be(e, t = !0, r = !0) { return e == null ? !0 : e instanceof Date ? isNaN(e.getTime()) : rr(e) ? e.size <= 0 : Array.isArray(e) ? t ? e.length === 0 : !1 : ae(e) ? e == null ? !0 : r ? Object.keys(e).length === 0 : !1 : !String(e).length; } const nr = Symbol("regle-rule"); function ar(e) { let t = []; return e.global && t.push("g"), e.ignoreCase && t.push("i"), e.multiline && t.push("m"), e.sticky && t.push("y"), e.unicode && t.push("u"), t.join(""); } function X(e, t = 0) { if (t > 20) return e; let r = e, n = {}.toString.call(e).slice(8, -1); if (n == "Set" && (r = new Set([...e].map((a) => X(a, t++)))), n == "Map" && (r = new Map([...e].map((a) => [X(a[0]), X(a[1])]))), n == "Date" && (r = new Date(e.getTime())), n == "RegExp" && (r = RegExp(e.source, ar(e))), n == "Array" || n == "Object") { r = Array.isArray(e) ? [] : {}; for (let a in e) r[a] = X(e[a], t++); } return r; } function Pt(e) { const t = Object.prototype.toString.call(e); return e == null ? /* @__PURE__ */ new Date(NaN) : e instanceof Date || typeof e == "object" && t === "[object Date]" ? new Date(e.getTime()) : typeof e == "number" || t === "[object Number]" ? new Date(e) : typeof e == "string" || t === "[object String]" ? new Date(e) : /* @__PURE__ */ new Date(NaN); } function Nt(e, t, { immediate: r = !1, trackDebounceRef: n } = {}) { let a; const l = (...u) => { n && (n.value = !0); function s() { n && (n.value = !1); } return new Promise((o, m) => { function y(R) { o(R), s(); } if (clearTimeout(a), a = setTimeout(() => { if (s(), a = void 0, !r) try { Promise.resolve(e.apply(this, [...u])).then(y).catch((R) => m(R)).finally(s); } catch (R) { m(R); } }, t), r) { s(); try { Promise.resolve(e.apply(this, [...u])).then(y).catch((R) => m(R)).finally(s); } catch (R) { m(R); } } }); }; return l.cancel = () => { clearTimeout(a), a = void 0, n && (n.value = !1); }, l; } function ft(e, t, r = !1, n = !0) { if (e === t) return !0; if (e && t && typeof e == "object" && typeof t == "object") { if (e.constructor !== t.constructor) return !1; var a, l, u; if (Array.isArray(e) && Array.isArray(t)) { if (a = e.length, a != t.length) return !1; if (n || !n && r) { for (l = a; l-- !== 0; ) if (!ft(e[l], t[l], r, !1)) return !1; } return !0; } if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf(); if (e.toString !== Object.prototype.toString) return e.toString() === t.toString(); if (u = Object.keys(e), a = u.length, a !== Object.keys(t).length) return !1; for (l = a; l-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(t, u[l])) return !1; for (l = a; l-- !== 0; ) { var s = u[l]; if (ae(e) && ae(t) && s && (n || !n && r) && !ft(e[s], t[s], r, !1)) return !1; } return !0; } return e !== e && t !== t; } var st = class extends Error { constructor(e = "Promise was aborted") { super(e), this.name = "AbortError"; } }; function ir(e) { const t = new AbortController(), { signal: r } = t, n = new Promise((l, u) => { function s() { u(new st()); } r.addEventListener("abort", s), e.then((o) => { r.removeEventListener("abort", s), r.aborted ? u(new st()) : l(o); }).catch((o) => { r.removeEventListener("abort", s), r.aborted ? u(new st()) : u(o); }); }); function a(l) { t.abort(l); } return { promise: n, abort: a, signal: r }; } function sr(e, t, r) { if (!We(e)) return r == null || r(), Oe(e); const n = F(!1); return rt() && Vt(async () => { await Xe(), typeof window < "u" && window.requestAnimationFrame(() => { n.value = !0; }); }), Oe(new Proxy({}, { get(a, l, u) { if (r == null || r(), t.value && l !== "$value" && n.value) return Reflect.get(a, l, u); if (e.value !== void 0) return qt(Reflect.get(e.value, l, u)); }, set(a, l, u) { return r == null || r(), We(e.value[l]) && !We(u) ? e.value[l].value = u : e.value[l] = u, !0; }, deleteProperty(a, l) { return r == null || r(), Reflect.deleteProperty(e.value, l); }, has(a, l) { return r == null || r(), e.value === void 0 ? !1 : Reflect.has(e.value, l); }, ownKeys() { return r == null || r(), e.value === void 0 ? [] : Object.keys(e.value); }, getOwnPropertyDescriptor() { return r == null || r(), { enumerable: !0, configurable: !0 }; } })); } const cr = { Async: "__async" }; function Ce(e) { try { return e.map((t) => A(t)); } catch { return []; } } function fr(e) { return e.map((t) => t instanceof Function ? c(t) : We(t) ? t : Q(() => t)); } function vr(e) { const t = e.toString().replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "").match(/^(?:async\s*)?(?:function\b.*?\(|\((.*?)\)|(\w+))\s*=>|\((.*?)\)\s*=>|function.*?\((.*?)\)|\((.*?)\)/); return t ? (t[0] || t[1] || t[2] || t[3] || t[4] || "").split(",").map((r) => r.trim()).filter((r) => r.length > 0).length : 0; } function It(e, ...t) { const { validator: r, type: n, async: a } = e, l = a || n === cr.Async || r.constructor.name === "AsyncFunction"; return kt({ validator(u, ...s) { return e.validator(u, ...Ce(s.length ? s : t)); }, message(u) { var s; return typeof e.message == "function" ? e.message({ ...u, $params: Ce((s = u == null ? void 0 : u.$params) != null && s.length ? u.$params : t) }) : e.message; }, active(u) { var s; return typeof e.active == "function" ? e.active({ ...u, $params: Ce((s = u == null ? void 0 : u.$params) != null && s.length ? u.$params : t) }) : e.active ?? !0; }, tooltip(u) { var s; return typeof e.tooltip == "function" ? e.tooltip({ ...u, $params: Ce((s = u == null ? void 0 : u.$params) != null && s.length ? u.$params : t) }) : e.tooltip ?? []; }, exec(u) { const s = e.validator(u, ...Ce(t)); let o; return s instanceof Promise ? s.then((m) => (o = m, typeof o == "object" && "$valid" in o ? o.$valid : typeof o == "boolean" ? o : !1)) : (o = s, typeof o == "object" && "$valid" in o ? o.$valid : typeof o == "boolean" ? o : !1); }, type: n, _validator: e.validator, _message: e.message, _active: e.active, _tooltip: e.tooltip, _type: e.type, _message_patched: !1, _tooltip_patched: !1, _async: l, _params: fr(t), _brand: nr }); } function qr(e) { if (typeof e.validator == "function") { let t = []; const r = e.async ?? e.validator.constructor.name === "AsyncFunction", n = It({ ...e, async: r }, ...t); if (vr(e.validator) > 1) { const a = function(...l) { return It(e, ...l); }; return a.validator = n.validator, a.message = n.message, a.active = n.active, a.tooltip = n.tooltip, a.type = n.type, a.exec = n.exec, a._validator = n.validator, a._message = n.message, a._active = n.active, a._tooltip = n.tooltip, a._type = e.type, a._message_pacthed = !1, a._tooltip_pacthed = !1, a._async = r, a; } else return n; } throw new Error("[createRule] validator must be a function"); } function dt(e) { return ae(e.value); } function Wt(e, t, r) { const n = se(); let a; return e instanceof Function ? a = n.run(() => e(t, r ?? 0)) : a = e, { scope: n, unwrapped: a }; } const Je = { LessThan: -1, EqualTo: 0, GreaterThan: 1 }; function or(e, t) { const r = String(e).split("."), n = String(t).split("."); for (let a = 0; a < Math.min(r.length, n.length); a++) { const l = Number(r[a]), u = Number(n[a]); if (l > u) return Je.GreaterThan; if (u > l) return Je.LessThan; if (!isNaN(l) && isNaN(u)) return Je.GreaterThan; if (isNaN(l) && !isNaN(u)) return Je.LessThan; } return Je.EqualTo; } const yt = or(Zt, "3.5.0") !== -1; function $r() { return Math.floor(Math.random() * Date.now()).toString(); } function mt() { return typeof window > "u" ? $r() : window.crypto.getRandomValues(new Uint32Array(1))[0].toString(10); } function pt(e) { return ot() ? ($t(e), !0) : !1; } function dr(e) { let t = !1, r; const n = se(!0); return ((...a) => (t || (r = n.run(() => e(...a)), t = !0), r)); } function yr(e, t) { return e.some((r) => t ? r == null ? void 0 : r[t] : !1); } function mr(e, t) { return t ? e.reduce((r, n) => { const a = (n == null ? void 0 : n[t]) || []; return r.concat(a); }, []) : []; } const zt = { INSPECTOR: "regle-inspector" }, pr = Symbol("regle"), br = Symbol("regle-config"), Lt = { REGLE_STATIC: "__regle_static" }; function hr() { const e = F(!1), t = ge(), r = ge(/* @__PURE__ */ new Map()), n = ge(/* @__PURE__ */ new Map()), a = ge(/* @__PURE__ */ new Map()), l = F(0); function u(D) { t.value = D; } function s(D, p) { var w; const N = (p == null ? void 0 : p.filePath) ?? "loose", z = a.value.get(N), P = z ? z + 1 : 1; a.value.set(N, P); const I = `${((w = p == null ? void 0 : p.uid) == null ? void 0 : w.toString()) ?? "regle"}#${++l.value}`, i = `r$ #${(p == null ? void 0 : p.name) ?? P}`; r.value.set(I, { id: I, name: i, r$: D, componentName: p == null ? void 0 : p.componentName, filePath: p == null ? void 0 : p.filePath }); const h = ne(() => D, () => o(), { deep: !0, flush: "post" }); return xe.addWatcher(I, h), window.requestAnimationFrame(() => { o(); }), I; } function o() { t.value && Rr(t.value); } function m(D) { const p = n.value.get(D); p && (p(), n.value.delete(D)), r.value.delete(D), o(); } function y() { return Array.from(r.value.values()); } function R(D) { return r.value.get(D); } function W() { n.value.forEach((D) => D()), n.value.clear(), r.value.clear(), o(); } function g(D, p) { n.value.set(D, p); } return { devtoolsApi: t, register: s, unregister: m, getAll: y, get: R, clear: W, addWatcher: g, setApi: u, notifyDevtools: o, loggedWarning: e }; } const xe = hr(); function gr(e, t) { var s, o; if (typeof window > "u") return () => { }; { const m = typeof globalThis < "u" && ("__vitest_worker__" in globalThis || "__JEST_GLOBAL__" in globalThis || typeof window < "u" && "Cypress" in window || typeof process < "u" && process.env && (process.env.VITEST || process.env.JEST_WORKER_ID || process.env.NODE_ENV === "test" || process.env.PLAYWRIGHT_TEST)); if (m) return () => { }; if (!Mt(pr, void 0) && !xe.loggedWarning.value && xe.devtoolsApi && !m) return xe.loggedWarning.value = !0, console.warn("📏 Regle Devtools are not available. Install Regle plugin in your app to enable them. https://reglejs.dev/introduction/devtools"), () => { }; } const r = rt(), n = ((s = r == null ? void 0 : r.type) == null ? void 0 : s.name) || ((o = r == null ? void 0 : r.type) == null ? void 0 : o.__name); let a; r && r.type && typeof r.type == "object" && "__file" in r.type && (a = r.type.__file); const l = xe.register(e, { name: t == null ? void 0 : t.name, componentName: n, uid: r == null ? void 0 : r.uid, filePath: a }); function u() { xe.unregister(l); } return pt(u), u; } function Ht(e, t) { return !Ge(e.value) && (dt(e) || ae(t.value) && !be(t.value) && !Object.entries(t.value).some(([r, n]) => Qe(n) || typeof n == "function")); } function Or(e, t) { return !!e.value && ae(e.value) && "$each" in e.value || Array.isArray(t.value); } function Ut(e) { return !!e.value && (ae(e.value) || dt(e.value)); } function Qe(e) { return (ae(e) || typeof e == "function") && "_validator" in e; } function tt(e) { return typeof e.value == "function" ? "_validator" in e.value : !0; } function Ge(e) { return ae(e) && lr(e, Lt.REGLE_STATIC) && e[Lt.REGLE_STATIC] === !0; } function Er(e) { return ae(e) && "$fields" in e; } function Ft(e) { return !!e && "$rules" in e; } async function Rr(e) { e.sendInspectorTree(zt.INSPECTOR), e.sendInspectorState(zt.INSPECTOR); } function Sr() { const e = ge(/* @__PURE__ */ new Map()), t = ge(/* @__PURE__ */ new Map()), r = ge(/* @__PURE__ */ new Map()), n = ge(/* @__PURE__ */ new Map()), a = ge(/* @__PURE__ */ new Map()), l = ge(/* @__PURE__ */ new Map()), u = ge(/* @__PURE__ */ new Map()); function s(i) { const h = t.value.get(i); if (h) return h; { const w = F({}); return t.value.set(i, w), w; } } function o(i) { const h = r.value.get(i); if (h) return h; { const w = F([]); return r.value.set(i, w), w; } } function m(i, h) { l.value.set(i, h); } function y(i) { return l.value.get(i); } function R(i, h, w) { u.value.set(`${i}-${h}`, w); } function W(i, h) { return u.value.get(`${i}-${h}`); } function g(i, h) { i && h != null && u.value.delete(`${i}-${h}`); } function D(i, h) { n.value.set(i, h); } function p(i) { return n.value.get(i) ?? !1; } function N(i, h) { e.value.set(i, h); } function z(i, h) { const w = e.value.get(i); if (w) return P(h, w) ? { valid: !0 } : { valid: !1 }; } function P(i, h) { const w = Object.keys(h), J = Object.keys(i); return J.length !== w.length || !J.every((E) => w.includes(E)) ? !1 : J.every((E) => { var j; const v = i[E], f = h[E]; if (!f || !v || typeof v == "function" || typeof f == "function" || typeof v == "number") return !1; if (typeof v == "boolean") return !1; if (typeof v == "string") return !1; if ("_params" in v) if (v._params) { if (Array.isArray(v._params)) return (j = v._params) == null ? void 0 : j.every((Y, Z) => { if (typeof f == "number" || typeof f == "boolean" || typeof f == "string") return !0; { const ee = Ce("_params" in f && Array.isArray(f._params) ? f._params : []), L = Ce(v._params); return (ee == null ? void 0 : ee[Z]) === (L == null ? void 0 : L[Z]); } }); } else return !0; }); } function I(i) { const h = a.value.get(i); if (h) return h; { const w = F(!1), J = F(!0), E = F({}), v = F(!1); return a.value.set(i, { $pending: w, $valid: J, $metadata: E, $validating: v }), { $pending: w, $valid: J, $metadata: E, $validating: v }; } } return ot() && $t(() => { e.value.clear(), t.value.clear(), r.value.clear(), n.value.clear(), a.value.clear(), u.value.clear(); }), { addRuleDeclEntry: N, setDirtyEntry: D, checkRuleDeclEntry: z, getDirtyState: p, trySetRuleStatusRef: I, getFieldsEntry: s, getCollectionsEntry: o, getArrayStatus: W, addArrayStatus: R, deleteArrayStatus: g, arrayStatusStorage: u, addAdditionalRulesEntry: m, getAdditionalRulesEntry: y }; } function xt({ field: e, silent: t = !1 }) { const r = Object.entries(e.$rules ?? {}).map(([l, u]) => { let s = ""; if (t && !u.$valid) s = u.$message; else if (!u.$valid && e.$error && !u.$validating) s = u.$message; else return null; return { $message: s, $property: e.fieldName, $rule: l, $type: u.$type, ...typeof u.$metadata == "object" ? u.$metadata : {} }; }).filter((l) => !!l).reduce((l, u) => (typeof u.$message == "string" ? l.push(u) : l.push(...u.$message.map((s) => ({ ...u, $message: s }))), l), []), n = e.$error && e.$externalErrors && Array.isArray(e.$externalErrors) ? e.$externalErrors.map((l) => ({ $message: l, $property: e.fieldName, $rule: "external", $type: void 0 })) : []; let a = []; return e.$schemaErrors && e.$error && (!Array.isArray(e.$schemaErrors) && "$self" in e.$schemaErrors ? a = e.$schemaErrors.$self ?? [] : a = e.$schemaErrors ?? []), [ ...r, ...n, ...a ]; } function wr({ field: e }) { const t = []; for (const r of Object.values(e.$rules ?? {})) { const n = r.$tooltip; n && (typeof n == "string" ? t.push(n) : t.push(...n)); } return t; } function Bt(e) { return ae(e) && "$each" in e; } function _r(e, t) { var n, a; const { includePath: r = !1 } = t ?? {}; if (Array.isArray(e) && e.every((l) => !ae(l))) return e; if (Bt(e)) { const l = r ? ((n = e.$self) == null ? void 0 : n.map((s) => ({ message: s, path: [] }))) ?? [] : e.$self ?? [], u = ((a = e.$each) == null ? void 0 : a.map((s) => ut(s, r))) ?? []; return l == null ? void 0 : l.concat(u.flat()); } else return Object.entries(e).map(([l, u]) => ut(u, r, [l])).flat(); } function ut(e, t = !1, r) { var a, l; const n = t && !r ? [] : r; if (Array.isArray(e) && e.every((u) => !ae(u))) return t ? e.map((u) => ({ message: u, path: n ?? [] })) : e; if (Bt(e)) { const u = n != null && n.length ? ((a = e.$self) == null ? void 0 : a.map((o) => ({ message: o, path: n ?? [] }))) ?? [] : e.$self ?? [], s = ((l = e.$each) == null ? void 0 : l.map((o, m) => ut(o, t, n == null ? void 0 : n.concat(m)))) ?? []; return u == null ? void 0 : u.concat(s.flat()); } else return Object.entries(e).map(([u, s]) => ut(s, t, n == null ? void 0 : n.concat(u))).flat(); } function jr({ customMessages: e, rule: t, ruleKey: r, state: n, path: a, cachePath: l, storage: u, modifiers: s }) { let o = se(), m = {}, y; const R = c(() => Qe(t.value) && t.value._async), W = F(!1), { $pending: g, $valid: D, $metadata: p, $validating: N } = u.trySetRuleStatusRef(`${l}.${r}`); function z() { o = se(), m = o.run(() => { const v = F(!1), f = F(!1), j = F(!0), Y = F(!1), Z = F(!1), ee = c(() => ({ $value: n.value, $error: f.value, $dirty: v.value, $pending: Y.value, $correct: Z.value, $invalid: j.value, $rule: { $valid: D.value, $invalid: !D.value, $pending: g.value }, $params: Re.value, ...p.value })), L = c(() => { try { return tt(t) ? typeof t.value.active == "function" ? t.value.active(ee.value) : !!t.value.active : !0; } catch (le) { return console.error(`Error in "active" function for "${a}.${r}" rule`, { cause: le }), !0; } }); function ce(le) { var we; try { let de = ""; const pe = e ? (we = e[r]) == null ? void 0 : we[le] : void 0; if (pe && (typeof pe == "function" ? de = pe(ee.value) : de = pe), tt(t)) { const q = `_${le}_patched`; pe && !t.value[q] || (typeof t.value[le] == "function" ? de = t.value[le](ee.value) : de = t.value[le] ?? ""); } return de; } catch (de) { return console.error(`Error in "${le}" function for "${a}.${r}" rule`, { cause: de }), ""; } } const me = c(() => { let le = ce("message"); return be(le) && (le = "This field is not valid"), le; }), Ae = c(() => ce("tooltip")), _e = c(() => tt(t) && t.value.type ? t.value.type : r), Ee = c(() => tt(t) ? t.value.validator : t.value), Re = c(() => typeof t.value == "function" ? [] : Ce(t.value._params ?? [])); return { $active: L, $message: me, $type: _e, $validator: Ee, $params: Re, $path: c(() => `${a}.${r}`), $tooltip: Ae, $fieldCorrect: Z, $fieldError: f, $fieldDirty: v, $fieldPending: Y, $fieldInvalid: j }; }), y = ne(m == null ? void 0 : m.$params, () => { (!s.$silent.value || s.$rewardEarly.value && m.$fieldError.value) && h(); }, { deep: yt ? 1 : !0 }); } z(); function P() { D.value = !0, m.$fieldDirty.value && (g.value = !0); } async function I() { let v = !1; try { const f = m.$validator.value; if (typeof f != "function") return console.error(`${a}: Incorrect rule format, it needs to be either a function or created with "createRule".`), !1; const j = f(n.value, ...m.$params.value); let Y = n.value; P(); let Z; if (j instanceof Promise ? Z = await j : Z = j, n.value !== Y) return !0; if (typeof Z == "boolean") v = Z; else { const { $valid: ee, ...L } = Z; v = ee, p.value = L; } } catch { v = !1; } finally { g.value = !1; } return v; } function i(v, f = !0) { if (Qe(t.value) && t.value._async) return !0; const j = v(n.value, ...m.$params.value); if (j instanceof Promise) return f && console.warn('You used a async validator function on a non-async rule, please use "async await" or the "withAsync" helper'), !0; if (j != null) { if (typeof j == "boolean") return j; { const { $valid: Y, ...Z } = j; return p.value = Z, Y; } } return !0; } async function h() { try { N.value = !0; let v = !1; if (W.value = !0, Qe(t.value) && t.value._async) v = await I(); else { const f = m.$validator.value; v = i(f); } return D.value = v, v; } catch { return !1; } finally { N.value = !1, W.value = !1; } } function w() { try { return N.value = !0, i(m.$validator.value); } catch { return !1; } finally { N.value = !1; } } function J() { D.value = !0, p.value = {}, g.value = !1, N.value = !1, z(); } function E() { y(), o.stop(), o = se(); } return Oe({ ...m, $pending: g, $valid: D, $metadata: p, $haveAsync: R, $maybePending: W, $validating: N, $parse: h, $parseSync: w, $unwatch: E, $watch: z, $reset: J }); } function bt(e) { return { "~standard": { version: 1, vendor: "regle", validate: async (t) => { const { valid: r, data: n, errors: a } = await e(t, !0); return r ? { value: n, issues: [] } : { issues: _r(a, { includePath: !0 }) }; } } }; } function Ze(e) { return e === !0 ? "eager" : e === !1 || e == null ? !1 : e; } function lt(e) { return ae(e) && !Ge(e) ? Object.values(e).some((t) => lt(t)) : Array.isArray(e) ? e.some((t) => lt(t)) : !be(e); } function Dr(e, t, r) { return e === "eager" ? !0 : e === "non-empty" ? lt(r) : e === "lazy-non-empty" ? lt(t) : !1; } function Cr(e, t, r, n = !1) { return e === "eager" ? !0 : e === "non-empty" ? n && !be(r) : e === "lazy-non-empty" ? !be(t) : !1; } const Ar = 200; function nt({ state: e, rulesDef: t, customMessages: r, path: n, cachePath: a, fieldName: l, storage: u, options: s, externalErrors: o, schemaErrors: m, schemaMode: y, onUnwatch: R, $isArray: W, initialState: g, rootInitialState: D, originalState: p, shortcuts: N, overrides: z, onValidate: P }) { let I = se(), i, h = [], w, J, E, v, f = () => { }, j, Y = () => { }; const Z = F(!1), ee = F(u.getAdditionalRulesEntry(a) ?? {}); function L(d) { ee.value = d ?? {}, u.addAdditionalRulesEntry(a, d ?? {}), me(), f(); } function ce(d) { L(d); } function me() { const d = { ...t.value, ...ee.value }, U = []; for (const T in d) { if (T.startsWith("$") || T.startsWith("~")) continue; const oe = d[T]; if (!oe) continue; const C = Q(() => oe); U.push([T, jr({ modifiers: { $silent: i.$silent, $rewardEarly: i.$rewardEarly }, customMessages: r, rule: C, ruleKey: T, state: e, path: n, cachePath: a, storage: u, $debounce: H.value.$debounce })]); } q.value = Object.fromEntries(U), u.addRuleDeclEntry(a, d); } function Ae() { const d = { ...t.value, ...ee.value }, U = u.checkRuleDeclEntry(a, d), T = {}; for (const oe in d) oe.startsWith("$") && (T[oe] = d[oe]); return H.value = T, U; } function _e() { const d = Ae(); we(), me(), i.processShortcuts(), Ee(), Re(), (d == null ? void 0 : d.valid) != null && (i.$dirty.value = u.getDirtyState(a), (i.$dirty.value && !i.$silent.value || i.$rewardEarly.value && i.$error.value) && f()), u.addRuleDeclEntry(a, t.value); } function Ee() { i.$debounce.value > 0 ? f = Nt(pe, i.$debounce.value, { trackDebounceRef: Z }) : f = pe; } function Re() { i.$debounce.value > 0 ? Y = Nt(() => { i.$dirty.value = !0; }, i.$debounce.value) : Y = () => { i.$dirty.value = !0; }; } function le() { if (q.value) for (const d of Object.values(q.value)) d.$unwatch(); J(), v == null || v(), i.$dirty.value && u.setDirtyEntry(a, i.$dirty.value), w == null || w(), I.stop(), I = se(); for (const d of h) d.stop(); h = [], R == null || R(), E == null || E(); } function we() { if (q.value) for (const d of Object.values(q.value)) d.$watch(); i = I.run(() => { const d = F(!1), U = F(!1), T = c(() => d.value), oe = c(() => W || Ge(e.value)), C = c(() => H.value.$debounce != null ? H.value.$debounce : i.$haveAnyAsyncRule.value ? Ar : 0), x = c(() => H.value.$deepCompare != null ? H.value.$deepCompare : !1), G = c(() => H.value.$lazy != null ? H.value.$lazy : A(s.lazy) != null ? A(s.lazy) === !0 : !1), k = c(() => H.value.$immediateDirty != null ? Ze(H.value.$immediateDirty) : A(s.immediateDirty) != null ? Ze(A(s.immediateDirty)) : !1), fe = c(() => H.value.$rewardEarly != null ? !!H.value.$rewardEarly : A(s.rewardEarly) != null ? A(s.rewardEarly) === !0 : !1), je = c(() => H.value.$clearExternalErrorsOnChange != null ? !!H.value.$clearExternalErrorsOnChange : A(s.clearExternalErrorsOnChange) != null ? A(s.clearExternalErrorsOnChange) === !0 : !at.value), $e = c(() => H.value.$clearExternalErrorsOnValidate != null ? !!H.value.$clearExternalErrorsOnValidate : A(s.clearExternalErrorsOnValidate) != null ? A(s.clearExternalErrorsOnValidate) === !0 : !1), at = c(() => fe.value ? !0 : H.value.$silent != null ? H.value.$silent : A(s.silent) != null ? A(s.silent) === !0 : !1), ht = c(() => H.value.$autoDirty != null ? H.value.$autoDirty : A(s.autoDirty) != null ? A(s.autoDirty) === !0 : !0), it = c(() => { if (H.value.$isEdited != null) return H.value.$isEdited; if ((z == null ? void 0 : z.isEdited) != null) return z.isEdited; }), gt = c(() => { for (const B of Object.values(q.value)) if (B.$validating) return !0; return !1; }), Ot = c({ get: () => e.value, set(B) { w(), e.value = B, de(); } }), ke = c(() => Z.value ? Be.value && d.value : Be.value && !Ue.value && d.value), Et = c(() => xt({ field: { $rules: q.value, $error: ke.value, $externalErrors: o == null ? void 0 : o.value, $schemaErrors: m == null ? void 0 : m.value, fieldName: Ke.value } })), Rt = c(() => xt({ field: { $rules: q.value, $error: ke.value, $externalErrors: o == null ? void 0 : o.value, $schemaErrors: m == null ? void 0 : m.value, fieldName: Ke.value }, silent: !0 })), St = c(() => Et.value.map((B) => B.$message)), wt = c(() => Rt.value.map((B) => B.$message)), Fe = F(!1); function _t(B, ve) { return ve instanceof Date && B instanceof Date ? Pt(ve).getTime() !== Pt(B).getTime() : ve == null ? B != null && B !== "" : Array.isArray(B) && Array.isArray(ve) ? !ft(B, ve, H.value.$deepCompare) : ve !== B; } ze(() => { d.value ? it.value ? Fe.value = it.value(e.value, g.value, _t) : Fe.value = _t(e.value, g.value) : Fe.value = !1; }); const jt = c(() => Fe.value), Dt = c(() => wr({ field: { $rules: q.value } })), Ct = c(() => !(Be.value || Ue.value)), Ue = c(() => U.value || !fe.value ? Object.entries(q.value).some(([B, ve]) => ve.$pending) : !1), Be = c(() => { var B, ve; return (B = o == null ? void 0 : o.value) != null && B.length || (ve = m == null ? void 0 : m.value) != null && ve.length ? !0 : et.value ? !1 : Object.values(q.value).some((De) => !De.$valid || De.$maybePending); }), Ke = c(() => l ?? s.id ?? "root"), et = c(() => !y && !Object.keys(q.value).some((B) => !B.startsWith("$"))), At = c(() => { var B, ve; if ((B = o == null ? void 0 : o.value) != null && B.length) return !1; if (et.value) return !1; if (Z.value) return !1; if (d.value && !be(e.value) && !gt.value && !Ue.value) { if (y) return !((ve = m == null ? void 0 : m.value) != null && ve.length); { const De = Object.values(q.value); for (const Ie of De) if (Ie.$active && !Ie.$valid) return !1; return De.some((Ie) => Ie.$active); } } return !1; }), Jt = c(() => Object.values(q.value).some((B) => B.$haveAsync)), Yt = c(() => ({ $debounce: C.value, $lazy: G.value, $rewardEarly: fe.value, $autoDirty: ht.value, $silent: at.value, $clearExternalErrorsOnChange: je.value, $clearExternalErrorsOnValidate: $e.value, $immediateDirty: k.value, $isEdited: it.value, $disabled: A(s.disabled) ?? !1 })); function Qt() { N != null && N.fields && Object.entries(N.fields).forEach(([B, ve]) => { const De = se(); Tt[B] = De.run(() => { const Ie = F(); return ze(() => { Ie.value = ve(Oe({ $dirty: d, $externalErrors: (o == null ? void 0 : o.value) ?? [], $value: e, $silentValue: Ot, $rules: q, $error: ke, $pending: Ue, $invalid: Be, $correct: At, $errors: St, $ready: Ct, $silentErrors: wt, $anyDirty: T, $tooltips: Dt, $name: Ke, $inactive: et, $edited: Fe, $anyEdited: jt })); }), Ie; }), h.push(De); }); } const Tt = {}; return { $error: ke, $pending: Ue, $invalid: Be, $correct: At, $debounce: C, $deepCompare: x, $lazy: G, $immediateDirty: k, $ready: Ct, $issues: Et, $silentIssues: Rt, $errors: St, $silentErrors: wt, $rewardEarly: fe, $autoDirty: ht, $silent: at, $clearExternalErrorsOnChange: je, $clearExternalErrorsOnValidate: $e, $anyDirty: T, $edited: Fe, $anyEdited: jt, $name: Ke, $haveAnyAsyncRule: Jt, $shortcuts: Tt, $validating: gt, $tooltips: Dt, $dirty: d, processShortcuts: Qt, $silentValue: Ot, $inactive: et, $modifiers: Yt, $isArrayOrRegleStatic: oe }; }), de(), J = ne(i.$dirty, (d) => { u.setDirtyEntry(a, d), Object.values(q.value).forEach((U) => { U.$fieldDirty = d; }); }), v = ne([ i.$error, i.$correct, i.$invalid, i.$pending ], () => { Object.values(q.value).forEach((d) => { d.$fieldError = i.$error.value, d.$fieldInvalid = i.$invalid.value, d.$fieldPending = i.$pending.value, d.$fieldCorrect = i.$correct.value; }); }), E = ne(i.$haveAnyAsyncRule, Ee); } function de() { w = ne(e, () => { i.$autoDirty.value && !i.$silent.value && (i.$dirty.value || Y()), t.value instanceof Function && _e(), (!i.$silent.value || i.$rewardEarly.value && i.$error.value) && f(), i.$clearExternalErrorsOnChange.value && K(); }, { deep: i.$isArrayOrRegleStatic.value ? !0 : yt ? 1 : !0 }); } async function pe() { try { const { promise: d } = b(Promise.allSettled(Object.values(q.value).map((U) => U.$parse()))); await d; } catch { } } const q = F({}), H = F({}); _e(); function O() { Cr(i.$immediateDirty.value, g.value, (D == null ? void 0 : D.value) ?? g.value, n === "") && (i.$dirty.value = !0); } function $(d, U) { if (_(), K(), i.$dirty.value = !1, u.setDirtyEntry(a, !1), !U) if (d != null && d.toOriginalState) e.value = X(p), g.value = X(p); else if (d != null && d.toInitialState) e.value = X(g.value); else if (d != null && d.toState) { let T; typeof (d == null ? void 0 : d.toState) == "function" ? T = d == null ? void 0 : d.toState() : T = d == null ? void 0 : d.toState, g.value = X(T), e.value = X(T); } else g.value = ae(e.value) && !Ge(e.value) ? X(e.value) : Array.isArray(e.value) ? [...e.value] : e.value; if (d != null && d.clearExternalErrors && K(), !U && !(d != null && d.keepValidationState)) for (const T of Object.values(q.value)) T.$reset(); if (!i.$lazy.value && !i.$silent.value && !U) for (const T of Object.values(q.value)) T.$parse(); O(); } function _() { "cancel" in f && f.cancel(); } function b(d) { return j && j.abort(), j = ir(d), j; } function M() { _(), j && j.abort(); } function re(d = !0, U = !1) { i.$dirty.value || Y(), U && d ? (!i.$silent.value || i.$rewardEarly.value && i.$error.value) && (_(), f()) : d && (_(), f()); } async function S(d) { return d && (e.value = d), await Xe(), V(); } async function V(d) { try { if (d && (e.value = d), y) return P ? (re(!1), P()) : { valid: !1, data: e.value, errors: i.$errors.value, issues: i.$issues.value }; const U = e.value; if (i.$autoDirty.value && !i.$silent.value && i.$dirty.value && !i.$validating.value && !i.$pending.value && !Z.value && !be(q.value)) return { valid: !i.$invalid.value, data: U, errors: i.$errors.value, issues: i.$issues.value }; if (i.$dirty.value || (i.$dirty.value = !0), be(q.value)) return { valid: !0, data: U, errors: i.$errors.value, issues: i.$issues.value }; M(); const { promise: T } = b(Promise.allSettled(Object.values(q.value).map((C) => C.$parse()))), oe = await T; return await Xe(), { valid: oe.every((C) => C.status === "fulfilled" && C.value === !0), data: U, errors: i.$errors.value, issues: i.$issues.value }; } catch { return { valid: !1, data: e.value, errors: i.$errors.value, issues: i.$issues.value }; } } function ue(d) { try { return d && (e.value = d), i.$dirty.value || (i.$dirty.value = !0), y ? !1 : Object.values(q.value).map((U) => U.$parseSync()).every((U) => !!U); } catch { return !1; } } function ie(d = !0) { return i.$dirty.value ? e.value : d ? { _null: !0 } : null; } function te(d) { o && (o.value = d); } function K() { var d; (d = o == null ? void 0 : o.value) != null && d.length && (o.value = []); } !i.$lazy.value && !i.$dirty.value && !i.$silent.value && pe(), O(); const { $shortcuts: he, $validating: ye, $autoDirty: Se, $rewardEarly: Le, $clearExternalErrorsOnChange: Te, $clearExternalErrorsOnValidate: Ve, $haveAnyAsyncRule: Me, $debounce: qe, $lazy: He, ...Pe } = i, Ne = Oe({ ...Pe, $externalErrors: o, $value: e, $initialValue: g, $originalValue: p, $rules: q, ...he, $path: n, $isDebouncing: Z, $reset: $, $touch: re, $validate: S, $validateSync: ue, $validateWithoutRaceconditions: V, $unwatch: le, $watch: we, $extractDirtyFields: ie, $clearExternalErrors: K, $abort: M, $addRules: L, addRules: ce, $schemaMode: y, "~modifiers": i.$modifiers, $setExternalErrors: te, ...bt(S) }); return Object.defineProperty(Ne, Symbol.for("regle:instance"), { value: !0 }), Ne; } function Gt({ $id: e, path: t, cachePath: r, index: n, options: a, storage: l, stateValue: u, customMessages: s, rules: o, externalErrors: m, schemaErrors: y, initialState: R, originalState: W, shortcuts: g, fieldName: D, schemaMode: p, overrides: N, currentIndexes: z }) { var v, f; const P = ((v = u.value) == null ? void 0 : v.$id) ?? o.$key ?? mt(); let I = `${r}.${String(P)}`; const i = F(n); let h = `${t}.${n}`; typeof u.value == "object" && u.value != null && (u.value.$id || Object.defineProperties(u.value, { $id: { value: P, enumerable: !1, configurable: !1, writable: !1 } })); const w = Q((m == null ? void 0 : m.value) ?? [], n), J = c(() => { var j; return (j = y == null ? void 0 : y.value) == null ? void 0 : j[i.value]; }), E = Ye({ index: n, state: u, rulesDef: Q(() => o), customMessages: s, path: h, cachePath: I, storage: l, options: a, externalErrors: w, schemaErrors: J, initialState: R, originalState: W, shortcuts: g, fieldName: D, schemaMode: p, overrides: N }); return E && (E.$id = ((f = u.value) == null ? void 0 : f.$id) ?? String(P), z == null || z.set(E.$id, i), l.addArrayStatus(e, E.$id, E)), u.value && (!ae(u.value) || Ge(u.value)) && p && (E == null || E.$touch()), E; } function Tr({ state: e, rulesDef: t, customMessages: r, path: n, cachePath: a, storage: l, options: u, externalErrors: s, schemaErrors: o, schemaMode: m, initialState: y, originalState: R, shortcuts: W, fieldName: g, overrides: D }) { let p = se(), N, z = se(), P, I = []; if (!Array.isArray(e.value) && !t.value.$each) return; const i = F(), h = F(e.value), w = F({}); let J, E; const v = F({}), f = l.getCollectionsEntry(n), j = /* @__PURE__ */ new Map(); P = z.run(() => ({ isPrimitiveArray: c(() => { var $; return ($ = e.value) != null && $.length ? Array.isArray(e.value) && e.value.length ? e.value.every((_) => typeof _ != "object") : t.value.$each && !(t.value.$each instanceof Function) ? Object.values(t.value.$each).every((_) => Qe(_) || typeof _ == "function") : !1 : !1; }) })), Y(), ce(); function Y() { var $, _; w.value = Object.fromEntries(Object.entries(t.value).filter(([b]) => b.startsWith("$"))), typeof e.value == "object" && (e.value != null && !(($ = e.value) != null && $.$id) && e.value !== null ? (i.value = mt(), Object.defineProperties(e.value, { $id: { value: i.value, enumerable: !1, configurable: !1, writable: !1 } })) : (_ = e.value) != null && _.$id && (i.value = e.value.$id)), h.value = v.value.$value, Array.isArray(e.value) && (!P.isPrimitiveArray.value || m) ? f.value = e.value.map((b, M) => { const { scope: re, unwrapped: S } = Wt(t.value.$each, Q(() => b), M); re && I.push(re); const V = Q(y.value ?? [], M), ue = Q((s == null ? void 0 : s.value) ?? {}, "$each"), ie = c(() => { var K; return (K = o == null ? void 0 : o.value) == null ? void 0 : K.$each; }), te = Gt({ $id: i.value, path: n, cachePath: a, customMessages: r, rules: S ?? {}, stateValue: Q(() => b), index: M, options: u, storage: l, externalErrors: ue, schemaErrors: ie, initialState: V, originalState: R, shortcuts: W, fieldName: g, schemaMode: m, overrides: D, currentIndexes: j }); return te || null; }).filter((b) => !!b) : (f.value = [], j.clear()), v.value = nt({ state: e, rulesDef: t, customMessages: r, path: n, cachePath: n, storage: l, options: u, externalErrors: Q((s == null ? void 0 : s.value) ?? {}, "$self"), schemaErrors: c(() => { var b; return (b = o == null ? void 0 : o.value) == null ? void 0 : b.$self; }), $isArray: !0, initialState: y, originalState: R, shortcuts: W, fieldName: g, schemaMode: m, overrides: D }); } function Z() { if (Array.isArray(e.value) && (!P.isPrimitiveArray.value || m)) { const $ = X(f.value), _ = /* @__PURE__ */ new Set(); f.value = e.value.map((b, M) => { const re = Q(() => b); if (b.$id && f.value.find((S) => S.$id === b.$id)) { const S = l.getArrayStatus(i.value, b.$id); if (S) { const V = j.get(b.$id); return V && (V.value = M), _.add(b.$id), S.$value = re, S; } return null; } else { const { scope: S, unwrapped: V } = Wt(t.value.$each, re, M); S && I.push(S); const ue = Q((s == null ? void 0 : s.value) ?? {}, "$each"), ie = c(() => { var K; return ((K = o == null ? void 0 : o.value) == null ? void 0 : K.$each) ?? []; }), te = Gt({ $id: i.value, path: n, cachePath: n, customMessages: r, rules: V ?? {}, stateValue: re, index: M, options: u, storage: l, externalErrors: ue, schemaErrors: ie, initialState: Q(y.value ?? [], M), originalState: R, shortcuts: W, fieldName: g, schemaMode: m, overrides: D, currentIndexes: j }); return te ? (te.$id && _.add(te.$id), te) : null; } }).filter((b) => !!b), $.filter((b) => { var M; return !((M = e.value) != null && M.find((re) => b.$id === re.$id)); }).forEach((b, M) => { l.deleteArrayStatus(i.value, M.toString()); }); for (const b of j.keys()) _.has(b) || j.delete(b); } else f.value = [], j.clear(); } function ee() { J = ne(e, () => { E == null || E(), e.value != null && !Object.hasOwn(e.value, "$id") && !i.value ? Y() : Z(), L(); }, { deep: yt ? 1 : !0, flush: "pre" }), L(); } function L() { E = ne(e, () => { N.$autoDirty.value && !N.$silent.value && v.value.$touch(!1, !0); }, { flush: "post" }); } function ce() { ee(), p = se(), N = p.run(() => { const $ = c({ get: () => e.value, set(T) { J == null || J(), E == null || E(), e.value = T, ee(); } }), _ = c(() => v.value.$dirty && (!f.value.length || f.value.every((T) => T.$dirty))), b = c(() => v.value.$anyDirty || f.value.some((T) => T.$anyDirty)), M = c(() => v.value.$invalid || f.value.some((T) => T.$invalid)), re = c(() => (m ? v.value.$correct : be(v.value.$rules) ? !0 : v.value.$correct) && (!f.value.length || f.value.every((T) => T.$correct || T.$anyDirty && !T.$invalid))), S = c(() => v.value.$error || f.value.some((T) => T.$error)), V = c(() => !(M.value || ue.value)), ue = c(() => v.value.$pending || f.value.some((T) => T.$pending)), ie = c(() => !!f.value.length && f.value.every((T) => T.$edited)), te = c(() => v.value.$anyEdited || f.value.some((T) => T.$anyEdited)), K = c(() => ({ $self: v.value.$issues, $each: f.value.map((T) => T.$issues) })), he = c(() => ({ $self: v.value.$errors, $each: f.value.map((T) => T.$errors) })), ye = c(() => ({ $self: v.value.$silentErrors, $each: f.value.map((T) => T.$silentErrors) })), Se = c(() => w.value.$rewardEarly != null ? w.value.$rewardEarly : A(u.rewardEarly) != null ? A(u.rewardEarly) === !0 : !1), Le = c(() => Se.value ? !0 : w.value.$silent != null ? w.value.$silent : A(u.silent) != null ? A(u.silent) === !0 : !1), Te = c(() => w.value.$autoDirty != null ? w.value.$autoDirty : A(u.autoDirty) != null ? A(u.autoDirty) === !0 : !0), Ve = c(() => w.value.$immediateDirty != null ? Ze(w.value.$immediateDirty) : A(u.immediateDirty) != null ? Ze(A(u.immediateDirty)) : !1), Me = c(() => w.value.$clearExternalErrorsOnChange != null ? w.value.$clearExternalErrorsOnChange : A(u.clearExternalErrorsOnChange) != null ? A(u.clearExternalErrorsOnChange) === !0 : !0), qe = c(() => w.value.$clearExternalErrorsOnValidate != null ? w.value.$clearExternalErrorsOnValidate : A(u.clearExternalErrorsOnValidate) != null ? A(u.clearExternalErrorsOnValidate) === !0 : !1), He = c(() => { if (w.value.$isEdited != null) return w.value.$isEdited; if ((D == null ? void 0 : D.isEdited) != null) return D.isEdited; }), Pe = c(() => g ?? u.id ?? "root"), Ne = c(() => ({ $deepCompare: w.value.$deepCompare ?? !1, $debounce: w.value.$debounce ?? 0, $lazy: w.value.$lazy ?? !1, $rewardEarly: Se.value, $autoDirty: Te.value, $silent: Le.value, $clearExternalErrorsOnChange: Me.value, $clearExternalErrorsOnValidate: qe.value, $immediateDirty: Ve.value, $isEdited: He.value, $disabled: A(u.disabled) ?? !1 })); function d() { W != null && W.collections && Object.entries(W == null ? void 0 : W.collections).forEach(([T, oe]) => { const C = se(); U[T] = C.run(() => { const x = F(); return ze(() => { x.value = oe(Oe({ $dirty: _, $error: S, $path: n, $silentValue: $, $pending: ue, $invalid: M, $correct: re, $errors: he, $silentErrors: ye, $initialValue: y, $originalValue: R, $ready: V, $anyDirty: b, $name: Pe, $each: f, $self: v, $value: e, $edited: ie, $anyEdited: te, $issues: K })); }), x; }), I.push(C); }); } const U = {}; return d(), { $dirty: _, $anyDirty: b, $invalid: M, $correct: re, $error: S, $pending: ue, $errors: he, $silentErrors: ye, $ready: V, $name: Pe, $shortcuts: U, $silentValue: $, $edited: ie, $anyEdited: te, $rewardEarly: Se, $silent: Le, $autoDirty: Te, $issues: K, $modifiers: Ne }; }), P.isPrimitiveArray.value && t.value.$each && console.warn(`${n} is a Array of primitives. Tracking can be lost when reassigning the Array. We advise to use an Array of objects instead`); } function me() { J == null || J(), v.value && v.value.$unwatch(), f.value && f.value.forEach(($) => { "$dirty" in $ && $.$unwatch(); }), p.stop(), p = se(), z.stop(), z = se(!0), I.forEach(($) => $.stop()), I = []; } function Ae($ = !0, _ = !1) { v.value.$touch($, _), f.value.forEach((b) => { b.$touch($, _); }); } function _e($, _) { if (me(), !_) if ($ != null && $.toOriginalState) e.value = X(R), y.value = X(R); else if ($ != null && $.toInitialState) e.value = X(y.value); else if ($ != null && $.toState) { let b; typeof ($ == null ? void 0 : $.toState) == "function" ? b = $ == null ? void 0 : $.toState() : b = $ == null ? void 0 : $.toState, y.value = X(b), e.value = X(b); } else y.value = X(e.value); $ != null && $.clearExternalErrors && pe(), $ != null && $.keepValidationState || (v.value.$reset($, _), f.value.for