@soft-stech/bootsman-ui-shadcn 1.1.27 → 1.1.28
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{BuiFormControl.vue_vue_type_script_setup_true_lang-CvXdU-J4.js → BuiFormControl.vue_vue_type_script_setup_true_lang-DBf2R0rh.js} +1 -1
- package/dist/{BuiFormDescription.vue_vue_type_script_setup_true_lang-BBiuEHED.js → BuiFormDescription.vue_vue_type_script_setup_true_lang-DESVSeBk.js} +1 -1
- package/dist/{BuiFormLabel.vue_vue_type_script_setup_true_lang-DuFBMvZs.js → BuiFormLabel.vue_vue_type_script_setup_true_lang-CdTsKLdJ.js} +1 -1
- package/dist/{BuiFormMessage.vue_vue_type_script_setup_true_lang-BYeSyti7.js → BuiFormMessage.vue_vue_type_script_setup_true_lang-BtxFDcdt.js} +1 -1
- package/dist/components/ui/form/BuiFormControl.js +1 -1
- package/dist/components/ui/form/BuiFormDescription.js +1 -1
- package/dist/components/ui/form/BuiFormLabel.js +1 -1
- package/dist/components/ui/form/BuiFormMessage.js +1 -1
- package/dist/components/ui/form/index.js +5 -5
- package/dist/components/ui/form/useFormField.js +1 -1
- package/dist/index.js +5 -5
- package/dist/useFormField-_ngdGlTO.js +2309 -0
- package/package.json +3 -3
- package/dist/useFormField-BwNojvaR.js +0 -2291
@@ -0,0 +1,2309 @@
|
|
1
|
+
import { computed as C, toValue as S, unref as N, onMounted as Rt, getCurrentInstance as Ee, provide as Ut, isRef as qe, watch as de, onBeforeUnmount as Lt, ref as ue, reactive as Ge, nextTick as ve, warn as $t, readonly as dn, watchEffect as cn, inject as ke, onUnmounted as zt, defineComponent as Ye, toRef as _e, resolveDynamicComponent as yt, h as He, shallowRef as fn } from "vue";
|
2
|
+
import { F as vn } from "./BuiFormItem.vue_vue_type_script_setup_true_lang-DQtpoiOP.js";
|
3
|
+
function hn() {
|
4
|
+
return xt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
5
|
+
}
|
6
|
+
function xt() {
|
7
|
+
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
8
|
+
}
|
9
|
+
const mn = typeof Proxy == "function", gn = "devtools-plugin:setup", yn = "plugin:settings:set";
|
10
|
+
let je, ft;
|
11
|
+
function pn() {
|
12
|
+
var e;
|
13
|
+
return je !== void 0 || (typeof window < "u" && window.performance ? (je = !0, ft = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (je = !0, ft = globalThis.perf_hooks.performance) : je = !1), je;
|
14
|
+
}
|
15
|
+
function bn() {
|
16
|
+
return pn() ? ft.now() : Date.now();
|
17
|
+
}
|
18
|
+
class On {
|
19
|
+
constructor(t, n) {
|
20
|
+
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
21
|
+
const r = {};
|
22
|
+
if (t.settings)
|
23
|
+
for (const o in t.settings) {
|
24
|
+
const s = t.settings[o];
|
25
|
+
r[o] = s.defaultValue;
|
26
|
+
}
|
27
|
+
const i = `__vue-devtools-plugin-settings__${t.id}`;
|
28
|
+
let a = Object.assign({}, r);
|
29
|
+
try {
|
30
|
+
const o = localStorage.getItem(i), s = JSON.parse(o);
|
31
|
+
Object.assign(a, s);
|
32
|
+
} catch {
|
33
|
+
}
|
34
|
+
this.fallbacks = {
|
35
|
+
getSettings() {
|
36
|
+
return a;
|
37
|
+
},
|
38
|
+
setSettings(o) {
|
39
|
+
try {
|
40
|
+
localStorage.setItem(i, JSON.stringify(o));
|
41
|
+
} catch {
|
42
|
+
}
|
43
|
+
a = o;
|
44
|
+
},
|
45
|
+
now() {
|
46
|
+
return bn();
|
47
|
+
}
|
48
|
+
}, n && n.on(yn, (o, s) => {
|
49
|
+
o === this.plugin.id && this.fallbacks.setSettings(s);
|
50
|
+
}), this.proxiedOn = new Proxy({}, {
|
51
|
+
get: (o, s) => this.target ? this.target.on[s] : (...d) => {
|
52
|
+
this.onQueue.push({
|
53
|
+
method: s,
|
54
|
+
args: d
|
55
|
+
});
|
56
|
+
}
|
57
|
+
}), this.proxiedTarget = new Proxy({}, {
|
58
|
+
get: (o, s) => this.target ? this.target[s] : s === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(s) ? (...d) => (this.targetQueue.push({
|
59
|
+
method: s,
|
60
|
+
args: d,
|
61
|
+
resolve: () => {
|
62
|
+
}
|
63
|
+
}), this.fallbacks[s](...d)) : (...d) => new Promise((f) => {
|
64
|
+
this.targetQueue.push({
|
65
|
+
method: s,
|
66
|
+
args: d,
|
67
|
+
resolve: f
|
68
|
+
});
|
69
|
+
})
|
70
|
+
});
|
71
|
+
}
|
72
|
+
async setRealTarget(t) {
|
73
|
+
this.target = t;
|
74
|
+
for (const n of this.onQueue)
|
75
|
+
this.target.on[n.method](...n.args);
|
76
|
+
for (const n of this.targetQueue)
|
77
|
+
n.resolve(await this.target[n.method](...n.args));
|
78
|
+
}
|
79
|
+
}
|
80
|
+
function Vn(e, t) {
|
81
|
+
const n = e, r = xt(), i = hn(), a = mn && n.enableEarlyProxy;
|
82
|
+
if (i && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
|
83
|
+
i.emit(gn, e, t);
|
84
|
+
else {
|
85
|
+
const o = a ? new On(n, i) : null;
|
86
|
+
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
87
|
+
pluginDescriptor: n,
|
88
|
+
setupFn: t,
|
89
|
+
proxy: o
|
90
|
+
}), o && t(o.proxiedTarget);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* vee-validate v4.13.1
|
95
|
+
* (c) 2024 Abdelrahman Awad
|
96
|
+
* @license MIT
|
97
|
+
*/
|
98
|
+
function Y(e) {
|
99
|
+
return typeof e == "function";
|
100
|
+
}
|
101
|
+
function we(e) {
|
102
|
+
return e == null;
|
103
|
+
}
|
104
|
+
const Oe = (e) => e !== null && !!e && typeof e == "object" && !Array.isArray(e);
|
105
|
+
function pt(e) {
|
106
|
+
return Number(e) >= 0;
|
107
|
+
}
|
108
|
+
function _n(e) {
|
109
|
+
const t = parseFloat(e);
|
110
|
+
return isNaN(t) ? e : t;
|
111
|
+
}
|
112
|
+
function Sn(e) {
|
113
|
+
return typeof e == "object" && e !== null;
|
114
|
+
}
|
115
|
+
function En(e) {
|
116
|
+
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
|
117
|
+
}
|
118
|
+
function Ft(e) {
|
119
|
+
if (!Sn(e) || En(e) !== "[object Object]")
|
120
|
+
return !1;
|
121
|
+
if (Object.getPrototypeOf(e) === null)
|
122
|
+
return !0;
|
123
|
+
let t = e;
|
124
|
+
for (; Object.getPrototypeOf(t) !== null; )
|
125
|
+
t = Object.getPrototypeOf(t);
|
126
|
+
return Object.getPrototypeOf(e) === t;
|
127
|
+
}
|
128
|
+
function Re(e, t) {
|
129
|
+
return Object.keys(t).forEach((n) => {
|
130
|
+
if (Ft(t[n]) && Ft(e[n])) {
|
131
|
+
e[n] || (e[n] = {}), Re(e[n], t[n]);
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
e[n] = t[n];
|
135
|
+
}), e;
|
136
|
+
}
|
137
|
+
function Me(e) {
|
138
|
+
const t = e.split(".");
|
139
|
+
if (!t.length)
|
140
|
+
return "";
|
141
|
+
let n = String(t[0]);
|
142
|
+
for (let r = 1; r < t.length; r++) {
|
143
|
+
if (pt(t[r])) {
|
144
|
+
n += `[${t[r]}]`;
|
145
|
+
continue;
|
146
|
+
}
|
147
|
+
n += `.${t[r]}`;
|
148
|
+
}
|
149
|
+
return n;
|
150
|
+
}
|
151
|
+
const An = {};
|
152
|
+
function In(e) {
|
153
|
+
return An[e];
|
154
|
+
}
|
155
|
+
function jt(e, t, n) {
|
156
|
+
typeof n.value == "object" && (n.value = k(n.value)), !n.enumerable || n.get || n.set || !n.configurable || !n.writable || t === "__proto__" ? Object.defineProperty(e, t, n) : e[t] = n.value;
|
157
|
+
}
|
158
|
+
function k(e) {
|
159
|
+
if (typeof e != "object")
|
160
|
+
return e;
|
161
|
+
var t = 0, n, r, i, a = Object.prototype.toString.call(e);
|
162
|
+
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(o) {
|
163
|
+
i.add(k(o));
|
164
|
+
})) : a === "[object Map]" ? (i = /* @__PURE__ */ new Map(), e.forEach(function(o, s) {
|
165
|
+
i.set(k(s), k(o));
|
166
|
+
})) : 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(k(e.buffer)) : a === "[object ArrayBuffer]" ? i = e.slice(0) : a.slice(-6) === "Array]" && (i = new e.constructor(e)), i) {
|
167
|
+
for (r = Object.getOwnPropertySymbols(e); t < r.length; t++)
|
168
|
+
jt(i, r[t], Object.getOwnPropertyDescriptor(e, r[t]));
|
169
|
+
for (t = 0, r = Object.getOwnPropertyNames(e); t < r.length; t++)
|
170
|
+
Object.hasOwnProperty.call(i, n = r[t]) && i[n] === e[n] || jt(i, n, Object.getOwnPropertyDescriptor(e, n));
|
171
|
+
}
|
172
|
+
return i || e;
|
173
|
+
}
|
174
|
+
const Ae = Symbol("vee-validate-form"), Xe = Symbol("vee-validate-field-instance"), Ke = Symbol("Default empty value"), Fn = typeof window < "u";
|
175
|
+
function vt(e) {
|
176
|
+
return Y(e) && !!e.__locatorRef;
|
177
|
+
}
|
178
|
+
function he(e) {
|
179
|
+
return !!e && Y(e.parse) && e.__type === "VVTypedSchema";
|
180
|
+
}
|
181
|
+
function Qe(e) {
|
182
|
+
return !!e && Y(e.validate);
|
183
|
+
}
|
184
|
+
function Ue(e) {
|
185
|
+
return e === "checkbox" || e === "radio";
|
186
|
+
}
|
187
|
+
function jn(e) {
|
188
|
+
return Oe(e) || Array.isArray(e);
|
189
|
+
}
|
190
|
+
function wn(e) {
|
191
|
+
return Array.isArray(e) ? e.length === 0 : Oe(e) && Object.keys(e).length === 0;
|
192
|
+
}
|
193
|
+
function Ze(e) {
|
194
|
+
return /^\[.+\]$/i.test(e);
|
195
|
+
}
|
196
|
+
function Cn(e) {
|
197
|
+
return Wt(e) && e.multiple;
|
198
|
+
}
|
199
|
+
function Wt(e) {
|
200
|
+
return e.tagName === "SELECT";
|
201
|
+
}
|
202
|
+
function kn(e, t) {
|
203
|
+
const n = ![!1, null, void 0, 0].includes(t.multiple) && !Number.isNaN(t.multiple);
|
204
|
+
return e === "select" && "multiple" in t && n;
|
205
|
+
}
|
206
|
+
function Nn(e, t) {
|
207
|
+
return !kn(e, t) && t.type !== "file" && !Ue(t.type);
|
208
|
+
}
|
209
|
+
function qt(e) {
|
210
|
+
return bt(e) && e.target && "submit" in e.target;
|
211
|
+
}
|
212
|
+
function bt(e) {
|
213
|
+
return e ? !!(typeof Event < "u" && Y(Event) && e instanceof Event || e && e.srcElement) : !1;
|
214
|
+
}
|
215
|
+
function wt(e, t) {
|
216
|
+
return t in e && e[t] !== Ke;
|
217
|
+
}
|
218
|
+
function Q(e, t) {
|
219
|
+
if (e === t)
|
220
|
+
return !0;
|
221
|
+
if (e && t && typeof e == "object" && typeof t == "object") {
|
222
|
+
if (e.constructor !== t.constructor)
|
223
|
+
return !1;
|
224
|
+
var n, r, i;
|
225
|
+
if (Array.isArray(e)) {
|
226
|
+
if (n = e.length, n != t.length)
|
227
|
+
return !1;
|
228
|
+
for (r = n; r-- !== 0; )
|
229
|
+
if (!Q(e[r], t[r]))
|
230
|
+
return !1;
|
231
|
+
return !0;
|
232
|
+
}
|
233
|
+
if (e instanceof Map && t instanceof Map) {
|
234
|
+
if (e.size !== t.size)
|
235
|
+
return !1;
|
236
|
+
for (r of e.entries())
|
237
|
+
if (!t.has(r[0]))
|
238
|
+
return !1;
|
239
|
+
for (r of e.entries())
|
240
|
+
if (!Q(r[1], t.get(r[0])))
|
241
|
+
return !1;
|
242
|
+
return !0;
|
243
|
+
}
|
244
|
+
if (Ct(e) && Ct(t))
|
245
|
+
return !(e.size !== t.size || e.name !== t.name || e.lastModified !== t.lastModified || e.type !== t.type);
|
246
|
+
if (e instanceof Set && t instanceof Set) {
|
247
|
+
if (e.size !== t.size)
|
248
|
+
return !1;
|
249
|
+
for (r of e.entries())
|
250
|
+
if (!t.has(r[0]))
|
251
|
+
return !1;
|
252
|
+
return !0;
|
253
|
+
}
|
254
|
+
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
|
255
|
+
if (n = e.length, n != t.length)
|
256
|
+
return !1;
|
257
|
+
for (r = n; r-- !== 0; )
|
258
|
+
if (e[r] !== t[r])
|
259
|
+
return !1;
|
260
|
+
return !0;
|
261
|
+
}
|
262
|
+
if (e.constructor === RegExp)
|
263
|
+
return e.source === t.source && e.flags === t.flags;
|
264
|
+
if (e.valueOf !== Object.prototype.valueOf)
|
265
|
+
return e.valueOf() === t.valueOf();
|
266
|
+
if (e.toString !== Object.prototype.toString)
|
267
|
+
return e.toString() === t.toString();
|
268
|
+
for (i = Object.keys(e), n = i.length, r = n; r-- !== 0; ) {
|
269
|
+
var a = i[r];
|
270
|
+
if (!Q(e[a], t[a]))
|
271
|
+
return !1;
|
272
|
+
}
|
273
|
+
return !0;
|
274
|
+
}
|
275
|
+
return e !== e && t !== t;
|
276
|
+
}
|
277
|
+
function Ct(e) {
|
278
|
+
return Fn ? e instanceof File : !1;
|
279
|
+
}
|
280
|
+
function Ot(e) {
|
281
|
+
return Ze(e) ? e.replace(/\[|\]/gi, "") : e;
|
282
|
+
}
|
283
|
+
function $(e, t, n) {
|
284
|
+
return e ? Ze(t) ? e[Ot(t)] : (t || "").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i, a) => jn(i) && a in i ? i[a] : n, e) : n;
|
285
|
+
}
|
286
|
+
function K(e, t, n) {
|
287
|
+
if (Ze(t)) {
|
288
|
+
e[Ot(t)] = n;
|
289
|
+
return;
|
290
|
+
}
|
291
|
+
const r = t.split(/\.|\[(\d+)\]/).filter(Boolean);
|
292
|
+
let i = e;
|
293
|
+
for (let a = 0; a < r.length; a++) {
|
294
|
+
if (a === r.length - 1) {
|
295
|
+
i[r[a]] = n;
|
296
|
+
return;
|
297
|
+
}
|
298
|
+
(!(r[a] in i) || we(i[r[a]])) && (i[r[a]] = pt(r[a + 1]) ? [] : {}), i = i[r[a]];
|
299
|
+
}
|
300
|
+
}
|
301
|
+
function dt(e, t) {
|
302
|
+
if (Array.isArray(e) && pt(t)) {
|
303
|
+
e.splice(Number(t), 1);
|
304
|
+
return;
|
305
|
+
}
|
306
|
+
Oe(e) && delete e[t];
|
307
|
+
}
|
308
|
+
function kt(e, t) {
|
309
|
+
if (Ze(t)) {
|
310
|
+
delete e[Ot(t)];
|
311
|
+
return;
|
312
|
+
}
|
313
|
+
const n = t.split(/\.|\[(\d+)\]/).filter(Boolean);
|
314
|
+
let r = e;
|
315
|
+
for (let a = 0; a < n.length; a++) {
|
316
|
+
if (a === n.length - 1) {
|
317
|
+
dt(r, n[a]);
|
318
|
+
break;
|
319
|
+
}
|
320
|
+
if (!(n[a] in r) || we(r[n[a]]))
|
321
|
+
break;
|
322
|
+
r = r[n[a]];
|
323
|
+
}
|
324
|
+
const i = n.map((a, o) => $(e, n.slice(0, o).join(".")));
|
325
|
+
for (let a = i.length - 1; a >= 0; a--)
|
326
|
+
if (wn(i[a])) {
|
327
|
+
if (a === 0) {
|
328
|
+
dt(e, n[0]);
|
329
|
+
continue;
|
330
|
+
}
|
331
|
+
dt(i[a - 1], n[a - 1]);
|
332
|
+
}
|
333
|
+
}
|
334
|
+
function le(e) {
|
335
|
+
return Object.keys(e);
|
336
|
+
}
|
337
|
+
function Le(e, t = void 0) {
|
338
|
+
const n = Ee();
|
339
|
+
return n?.provides[e] || ke(e, t);
|
340
|
+
}
|
341
|
+
function We(e) {
|
342
|
+
$t(`[vee-validate]: ${e}`);
|
343
|
+
}
|
344
|
+
function Nt(e, t, n) {
|
345
|
+
if (Array.isArray(e)) {
|
346
|
+
const r = [...e], i = r.findIndex((a) => Q(a, t));
|
347
|
+
return i >= 0 ? r.splice(i, 1) : r.push(t), r;
|
348
|
+
}
|
349
|
+
return Q(e, t) ? n : t;
|
350
|
+
}
|
351
|
+
function Tn(e, t) {
|
352
|
+
let n, r;
|
353
|
+
return function(...i) {
|
354
|
+
const a = this;
|
355
|
+
return n || (n = !0, setTimeout(() => n = !1, t), r = e.apply(a, i)), r;
|
356
|
+
};
|
357
|
+
}
|
358
|
+
function Tt(e, t = 0) {
|
359
|
+
let n = null, r = [];
|
360
|
+
return function(...i) {
|
361
|
+
return n && clearTimeout(n), n = setTimeout(() => {
|
362
|
+
const a = e(...i);
|
363
|
+
r.forEach((o) => o(a)), r = [];
|
364
|
+
}, t), new Promise((a) => r.push(a));
|
365
|
+
};
|
366
|
+
}
|
367
|
+
function Pn(e, t) {
|
368
|
+
return Oe(t) && t.number ? _n(e) : e;
|
369
|
+
}
|
370
|
+
function ht(e, t) {
|
371
|
+
let n;
|
372
|
+
return async function(...i) {
|
373
|
+
const a = e(...i);
|
374
|
+
n = a;
|
375
|
+
const o = await a;
|
376
|
+
return a !== n ? o : (n = void 0, t(o, i));
|
377
|
+
};
|
378
|
+
}
|
379
|
+
function Mn({ get: e, set: t }) {
|
380
|
+
const n = ue(k(e()));
|
381
|
+
return de(e, (r) => {
|
382
|
+
Q(r, n.value) || (n.value = k(r));
|
383
|
+
}, {
|
384
|
+
deep: !0
|
385
|
+
}), de(n, (r) => {
|
386
|
+
Q(r, e()) || t(k(r));
|
387
|
+
}, {
|
388
|
+
deep: !0
|
389
|
+
}), n;
|
390
|
+
}
|
391
|
+
function mt(e) {
|
392
|
+
return Array.isArray(e) ? e : e ? [e] : [];
|
393
|
+
}
|
394
|
+
function Vt(e) {
|
395
|
+
const t = Le(Ae), n = e ? C(() => t?.getPathState(S(e))) : void 0, r = e ? void 0 : ke(Xe);
|
396
|
+
return !r && !n?.value && process.env.NODE_ENV !== "production" && We(`field with name ${S(e)} was not found`), n || r;
|
397
|
+
}
|
398
|
+
function ze(e, t) {
|
399
|
+
const n = {};
|
400
|
+
for (const r in e)
|
401
|
+
t.includes(r) || (n[r] = e[r]);
|
402
|
+
return n;
|
403
|
+
}
|
404
|
+
function Bn(e) {
|
405
|
+
let t = null, n = [];
|
406
|
+
return function(...r) {
|
407
|
+
const i = ve(() => {
|
408
|
+
if (t !== i)
|
409
|
+
return;
|
410
|
+
const a = e(...r);
|
411
|
+
n.forEach((o) => o(a)), n = [], t = null;
|
412
|
+
});
|
413
|
+
return t = i, new Promise((a) => n.push(a));
|
414
|
+
};
|
415
|
+
}
|
416
|
+
function et(e, t, n) {
|
417
|
+
return t.slots.default ? typeof e == "string" || !e ? t.slots.default(n()) : {
|
418
|
+
default: () => {
|
419
|
+
var r, i;
|
420
|
+
return (i = (r = t.slots).default) === null || i === void 0 ? void 0 : i.call(r, n());
|
421
|
+
}
|
422
|
+
} : t.slots.default;
|
423
|
+
}
|
424
|
+
function ct(e) {
|
425
|
+
if (Gt(e))
|
426
|
+
return e._value;
|
427
|
+
}
|
428
|
+
function Gt(e) {
|
429
|
+
return "_value" in e;
|
430
|
+
}
|
431
|
+
function Dn(e) {
|
432
|
+
return e.type === "number" || e.type === "range" ? Number.isNaN(e.valueAsNumber) ? e.value : e.valueAsNumber : e.value;
|
433
|
+
}
|
434
|
+
function Je(e) {
|
435
|
+
if (!bt(e))
|
436
|
+
return e;
|
437
|
+
const t = e.target;
|
438
|
+
if (Ue(t.type) && Gt(t))
|
439
|
+
return ct(t);
|
440
|
+
if (t.type === "file" && t.files) {
|
441
|
+
const n = Array.from(t.files);
|
442
|
+
return t.multiple ? n : n[0];
|
443
|
+
}
|
444
|
+
if (Cn(t))
|
445
|
+
return Array.from(t.options).filter((n) => n.selected && !n.disabled).map(ct);
|
446
|
+
if (Wt(t)) {
|
447
|
+
const n = Array.from(t.options).find((r) => r.selected);
|
448
|
+
return n ? ct(n) : t.value;
|
449
|
+
}
|
450
|
+
return Dn(t);
|
451
|
+
}
|
452
|
+
function Ht(e) {
|
453
|
+
const t = {};
|
454
|
+
return Object.defineProperty(t, "_$$isNormalized", {
|
455
|
+
value: !0,
|
456
|
+
writable: !1,
|
457
|
+
enumerable: !1,
|
458
|
+
configurable: !1
|
459
|
+
}), e ? Oe(e) && e._$$isNormalized ? e : Oe(e) ? Object.keys(e).reduce((n, r) => {
|
460
|
+
const i = Rn(e[r]);
|
461
|
+
return e[r] !== !1 && (n[r] = Pt(i)), n;
|
462
|
+
}, t) : typeof e != "string" ? t : e.split("|").reduce((n, r) => {
|
463
|
+
const i = Un(r);
|
464
|
+
return i.name && (n[i.name] = Pt(i.params)), n;
|
465
|
+
}, t) : t;
|
466
|
+
}
|
467
|
+
function Rn(e) {
|
468
|
+
return e === !0 ? [] : Array.isArray(e) || Oe(e) ? e : [e];
|
469
|
+
}
|
470
|
+
function Pt(e) {
|
471
|
+
const t = (n) => typeof n == "string" && n[0] === "@" ? Ln(n.slice(1)) : n;
|
472
|
+
return Array.isArray(e) ? e.map(t) : e instanceof RegExp ? [e] : Object.keys(e).reduce((n, r) => (n[r] = t(e[r]), n), {});
|
473
|
+
}
|
474
|
+
const Un = (e) => {
|
475
|
+
let t = [];
|
476
|
+
const n = e.split(":")[0];
|
477
|
+
return e.includes(":") && (t = e.split(":").slice(1).join(":").split(",")), { name: n, params: t };
|
478
|
+
};
|
479
|
+
function Ln(e) {
|
480
|
+
const t = (n) => $(n, e) || n[e];
|
481
|
+
return t.__locatorRef = e, t;
|
482
|
+
}
|
483
|
+
function $n(e) {
|
484
|
+
return Array.isArray(e) ? e.filter(vt) : le(e).filter((t) => vt(e[t])).map((t) => e[t]);
|
485
|
+
}
|
486
|
+
const zn = {
|
487
|
+
generateMessage: ({ field: e }) => `${e} is not valid.`,
|
488
|
+
bails: !0,
|
489
|
+
validateOnBlur: !0,
|
490
|
+
validateOnChange: !0,
|
491
|
+
validateOnInput: !1,
|
492
|
+
validateOnModelUpdate: !0
|
493
|
+
};
|
494
|
+
let xn = Object.assign({}, zn);
|
495
|
+
const Se = () => xn;
|
496
|
+
async function Kt(e, t, n = {}) {
|
497
|
+
const r = n?.bails, i = {
|
498
|
+
name: n?.name || "{field}",
|
499
|
+
rules: t,
|
500
|
+
label: n?.label,
|
501
|
+
bails: r ?? !0,
|
502
|
+
formData: n?.values || {}
|
503
|
+
}, a = await Wn(i, e);
|
504
|
+
return Object.assign(Object.assign({}, a), { valid: !a.errors.length });
|
505
|
+
}
|
506
|
+
async function Wn(e, t) {
|
507
|
+
const n = e.rules;
|
508
|
+
if (he(n) || Qe(n))
|
509
|
+
return Gn(t, Object.assign(Object.assign({}, e), { rules: n }));
|
510
|
+
if (Y(n) || Array.isArray(n)) {
|
511
|
+
const s = {
|
512
|
+
field: e.label || e.name,
|
513
|
+
name: e.name,
|
514
|
+
label: e.label,
|
515
|
+
form: e.formData,
|
516
|
+
value: t
|
517
|
+
}, d = Array.isArray(n) ? n : [n], f = d.length, b = [];
|
518
|
+
for (let p = 0; p < f; p++) {
|
519
|
+
const T = d[p], O = await T(t, s);
|
520
|
+
if (!(typeof O != "string" && !Array.isArray(O) && O)) {
|
521
|
+
if (Array.isArray(O))
|
522
|
+
b.push(...O);
|
523
|
+
else {
|
524
|
+
const H = typeof O == "string" ? O : Jt(s);
|
525
|
+
b.push(H);
|
526
|
+
}
|
527
|
+
if (e.bails)
|
528
|
+
return {
|
529
|
+
errors: b
|
530
|
+
};
|
531
|
+
}
|
532
|
+
}
|
533
|
+
return {
|
534
|
+
errors: b
|
535
|
+
};
|
536
|
+
}
|
537
|
+
const r = Object.assign(Object.assign({}, e), { rules: Ht(n) }), i = [], a = Object.keys(r.rules), o = a.length;
|
538
|
+
for (let s = 0; s < o; s++) {
|
539
|
+
const d = a[s], f = await Hn(r, t, {
|
540
|
+
name: d,
|
541
|
+
params: r.rules[d]
|
542
|
+
});
|
543
|
+
if (f.error && (i.push(f.error), e.bails))
|
544
|
+
return {
|
545
|
+
errors: i
|
546
|
+
};
|
547
|
+
}
|
548
|
+
return {
|
549
|
+
errors: i
|
550
|
+
};
|
551
|
+
}
|
552
|
+
function qn(e) {
|
553
|
+
return !!e && e.name === "ValidationError";
|
554
|
+
}
|
555
|
+
function Qt(e) {
|
556
|
+
return {
|
557
|
+
__type: "VVTypedSchema",
|
558
|
+
async parse(n, r) {
|
559
|
+
var i;
|
560
|
+
try {
|
561
|
+
return {
|
562
|
+
output: await e.validate(n, { abortEarly: !1, context: r?.formData || {} }),
|
563
|
+
errors: []
|
564
|
+
};
|
565
|
+
} catch (a) {
|
566
|
+
if (!qn(a))
|
567
|
+
throw a;
|
568
|
+
if (!(!((i = a.inner) === null || i === void 0) && i.length) && a.errors.length)
|
569
|
+
return { errors: [{ path: a.path, errors: a.errors }] };
|
570
|
+
const o = a.inner.reduce((s, d) => {
|
571
|
+
const f = d.path || "";
|
572
|
+
return s[f] || (s[f] = { errors: [], path: f }), s[f].errors.push(...d.errors), s;
|
573
|
+
}, {});
|
574
|
+
return { errors: Object.values(o) };
|
575
|
+
}
|
576
|
+
}
|
577
|
+
};
|
578
|
+
}
|
579
|
+
async function Gn(e, t) {
|
580
|
+
const r = await (he(t.rules) ? t.rules : Qt(t.rules)).parse(e, { formData: t.formData }), i = [];
|
581
|
+
for (const a of r.errors)
|
582
|
+
a.errors.length && i.push(...a.errors);
|
583
|
+
return {
|
584
|
+
value: r.value,
|
585
|
+
errors: i
|
586
|
+
};
|
587
|
+
}
|
588
|
+
async function Hn(e, t, n) {
|
589
|
+
const r = In(n.name);
|
590
|
+
if (!r)
|
591
|
+
throw new Error(`No such validator '${n.name}' exists.`);
|
592
|
+
const i = Kn(n.params, e.formData), a = {
|
593
|
+
field: e.label || e.name,
|
594
|
+
name: e.name,
|
595
|
+
label: e.label,
|
596
|
+
value: t,
|
597
|
+
form: e.formData,
|
598
|
+
rule: Object.assign(Object.assign({}, n), { params: i })
|
599
|
+
}, o = await r(t, i, a);
|
600
|
+
return typeof o == "string" ? {
|
601
|
+
error: o
|
602
|
+
} : {
|
603
|
+
error: o ? void 0 : Jt(a)
|
604
|
+
};
|
605
|
+
}
|
606
|
+
function Jt(e) {
|
607
|
+
const t = Se().generateMessage;
|
608
|
+
return t ? t(e) : "Field is invalid";
|
609
|
+
}
|
610
|
+
function Kn(e, t) {
|
611
|
+
const n = (r) => vt(r) ? r(t) : r;
|
612
|
+
return Array.isArray(e) ? e.map(n) : Object.keys(e).reduce((r, i) => (r[i] = n(e[i]), r), {});
|
613
|
+
}
|
614
|
+
async function Qn(e, t) {
|
615
|
+
const r = await (he(e) ? e : Qt(e)).parse(k(t)), i = {}, a = {};
|
616
|
+
for (const o of r.errors) {
|
617
|
+
const s = o.errors, d = (o.path || "").replace(/\["(\d+)"\]/g, (f, b) => `[${b}]`);
|
618
|
+
i[d] = { valid: !s.length, errors: s }, s.length && (a[d] = s[0]);
|
619
|
+
}
|
620
|
+
return {
|
621
|
+
valid: !r.errors.length,
|
622
|
+
results: i,
|
623
|
+
errors: a,
|
624
|
+
values: r.value,
|
625
|
+
source: "schema"
|
626
|
+
};
|
627
|
+
}
|
628
|
+
async function Jn(e, t, n) {
|
629
|
+
const i = le(e).map(async (f) => {
|
630
|
+
var b, p, T;
|
631
|
+
const O = (b = n?.names) === null || b === void 0 ? void 0 : b[f], B = await Kt($(t, f), e[f], {
|
632
|
+
name: O?.name || f,
|
633
|
+
label: O?.label,
|
634
|
+
values: t,
|
635
|
+
bails: (T = (p = n?.bailsMap) === null || p === void 0 ? void 0 : p[f]) !== null && T !== void 0 ? T : !0
|
636
|
+
});
|
637
|
+
return Object.assign(Object.assign({}, B), { path: f });
|
638
|
+
});
|
639
|
+
let a = !0;
|
640
|
+
const o = await Promise.all(i), s = {}, d = {};
|
641
|
+
for (const f of o)
|
642
|
+
s[f.path] = {
|
643
|
+
valid: f.valid,
|
644
|
+
errors: f.errors
|
645
|
+
}, f.valid || (a = !1, d[f.path] = f.errors[0]);
|
646
|
+
return {
|
647
|
+
valid: a,
|
648
|
+
results: s,
|
649
|
+
errors: d,
|
650
|
+
source: "schema"
|
651
|
+
};
|
652
|
+
}
|
653
|
+
let Mt = 0;
|
654
|
+
function Yn(e, t) {
|
655
|
+
const { value: n, initialValue: r, setInitialValue: i } = Xn(e, t.modelValue, t.form);
|
656
|
+
if (!t.form) {
|
657
|
+
let T = function(O) {
|
658
|
+
var B;
|
659
|
+
"value" in O && (n.value = O.value), "errors" in O && f(O.errors), "touched" in O && (p.touched = (B = O.touched) !== null && B !== void 0 ? B : p.touched), "initialValue" in O && i(O.initialValue);
|
660
|
+
};
|
661
|
+
const { errors: d, setErrors: f } = tr(), b = Mt >= Number.MAX_SAFE_INTEGER ? 0 : ++Mt, p = er(n, r, d, t.schema);
|
662
|
+
return {
|
663
|
+
id: b,
|
664
|
+
path: e,
|
665
|
+
value: n,
|
666
|
+
initialValue: r,
|
667
|
+
meta: p,
|
668
|
+
flags: { pendingUnmount: { [b]: !1 }, pendingReset: !1 },
|
669
|
+
errors: d,
|
670
|
+
setState: T
|
671
|
+
};
|
672
|
+
}
|
673
|
+
const a = t.form.createPathState(e, {
|
674
|
+
bails: t.bails,
|
675
|
+
label: t.label,
|
676
|
+
type: t.type,
|
677
|
+
validate: t.validate,
|
678
|
+
schema: t.schema
|
679
|
+
}), o = C(() => a.errors);
|
680
|
+
function s(d) {
|
681
|
+
var f, b, p;
|
682
|
+
"value" in d && (n.value = d.value), "errors" in d && ((f = t.form) === null || f === void 0 || f.setFieldError(N(e), d.errors)), "touched" in d && ((b = t.form) === null || b === void 0 || b.setFieldTouched(N(e), (p = d.touched) !== null && p !== void 0 ? p : !1)), "initialValue" in d && i(d.initialValue);
|
683
|
+
}
|
684
|
+
return {
|
685
|
+
id: Array.isArray(a.id) ? a.id[a.id.length - 1] : a.id,
|
686
|
+
path: e,
|
687
|
+
value: n,
|
688
|
+
errors: o,
|
689
|
+
meta: a,
|
690
|
+
initialValue: r,
|
691
|
+
flags: a.__flags,
|
692
|
+
setState: s
|
693
|
+
};
|
694
|
+
}
|
695
|
+
function Xn(e, t, n) {
|
696
|
+
const r = ue(N(t));
|
697
|
+
function i() {
|
698
|
+
return n ? $(n.initialValues.value, N(e), N(r)) : N(r);
|
699
|
+
}
|
700
|
+
function a(f) {
|
701
|
+
if (!n) {
|
702
|
+
r.value = f;
|
703
|
+
return;
|
704
|
+
}
|
705
|
+
n.setFieldInitialValue(N(e), f, !0);
|
706
|
+
}
|
707
|
+
const o = C(i);
|
708
|
+
if (!n)
|
709
|
+
return {
|
710
|
+
value: ue(i()),
|
711
|
+
initialValue: o,
|
712
|
+
setInitialValue: a
|
713
|
+
};
|
714
|
+
const s = Zn(t, n, o, e);
|
715
|
+
return n.stageInitialValue(N(e), s, !0), {
|
716
|
+
value: C({
|
717
|
+
get() {
|
718
|
+
return $(n.values, N(e));
|
719
|
+
},
|
720
|
+
set(f) {
|
721
|
+
n.setFieldValue(N(e), f, !1);
|
722
|
+
}
|
723
|
+
}),
|
724
|
+
initialValue: o,
|
725
|
+
setInitialValue: a
|
726
|
+
};
|
727
|
+
}
|
728
|
+
function Zn(e, t, n, r) {
|
729
|
+
return qe(e) ? N(e) : e !== void 0 ? e : $(t.values, N(r), N(n));
|
730
|
+
}
|
731
|
+
function er(e, t, n, r) {
|
732
|
+
const i = C(() => {
|
733
|
+
var o, s, d;
|
734
|
+
return (d = (s = (o = S(r)) === null || o === void 0 ? void 0 : o.describe) === null || s === void 0 ? void 0 : s.call(o).required) !== null && d !== void 0 ? d : !1;
|
735
|
+
}), a = Ge({
|
736
|
+
touched: !1,
|
737
|
+
pending: !1,
|
738
|
+
valid: !0,
|
739
|
+
required: i,
|
740
|
+
validated: !!N(n).length,
|
741
|
+
initialValue: C(() => N(t)),
|
742
|
+
dirty: C(() => !Q(N(e), N(t)))
|
743
|
+
});
|
744
|
+
return de(n, (o) => {
|
745
|
+
a.valid = !o.length;
|
746
|
+
}, {
|
747
|
+
immediate: !0,
|
748
|
+
flush: "sync"
|
749
|
+
}), a;
|
750
|
+
}
|
751
|
+
function tr() {
|
752
|
+
const e = ue([]);
|
753
|
+
return {
|
754
|
+
errors: e,
|
755
|
+
setErrors: (t) => {
|
756
|
+
e.value = mt(t);
|
757
|
+
}
|
758
|
+
};
|
759
|
+
}
|
760
|
+
function Yt(e) {
|
761
|
+
process.env.NODE_ENV !== "production" && Vn({
|
762
|
+
id: "vee-validate-devtools-plugin",
|
763
|
+
label: "VeeValidate Plugin",
|
764
|
+
packageName: "vee-validate",
|
765
|
+
homepage: "https://vee-validate.logaretm.com/v4",
|
766
|
+
app: e,
|
767
|
+
logo: "https://vee-validate.logaretm.com/v4/logo.png"
|
768
|
+
}, ir);
|
769
|
+
}
|
770
|
+
const Be = {}, De = {};
|
771
|
+
let pe;
|
772
|
+
const Ne = Tn(() => {
|
773
|
+
setTimeout(async () => {
|
774
|
+
await ve(), pe?.sendInspectorState(Ce), pe?.sendInspectorTree(Ce);
|
775
|
+
}, 100);
|
776
|
+
}, 100);
|
777
|
+
function nr(e) {
|
778
|
+
const t = Ee();
|
779
|
+
if (!pe) {
|
780
|
+
const n = t?.appContext.app;
|
781
|
+
if (!n)
|
782
|
+
return;
|
783
|
+
Yt(n);
|
784
|
+
}
|
785
|
+
Be[e.formId] = Object.assign({}, e), Be[e.formId]._vm = t, zt(() => {
|
786
|
+
delete Be[e.formId], Ne();
|
787
|
+
}), Ne();
|
788
|
+
}
|
789
|
+
function rr(e) {
|
790
|
+
const t = Ee();
|
791
|
+
if (!pe) {
|
792
|
+
const n = t?.appContext.app;
|
793
|
+
if (!n)
|
794
|
+
return;
|
795
|
+
Yt(n);
|
796
|
+
}
|
797
|
+
De[e.id] = Object.assign({}, e), De[e.id]._vm = t, zt(() => {
|
798
|
+
delete De[e.id], Ne();
|
799
|
+
}), Ne();
|
800
|
+
}
|
801
|
+
const Ce = "vee-validate-inspector", ae = {
|
802
|
+
error: 12405579,
|
803
|
+
success: 448379,
|
804
|
+
unknown: 5522283,
|
805
|
+
white: 16777215,
|
806
|
+
black: 0,
|
807
|
+
blue: 218007,
|
808
|
+
purple: 12157168,
|
809
|
+
orange: 16099682,
|
810
|
+
gray: 12304330
|
811
|
+
};
|
812
|
+
let W = null;
|
813
|
+
function ir(e) {
|
814
|
+
pe = e, e.addInspector({
|
815
|
+
id: Ce,
|
816
|
+
icon: "rule",
|
817
|
+
label: "vee-validate",
|
818
|
+
noSelectionText: "Select a vee-validate node to inspect",
|
819
|
+
actions: [
|
820
|
+
{
|
821
|
+
icon: "done_outline",
|
822
|
+
tooltip: "Validate selected item",
|
823
|
+
action: async () => {
|
824
|
+
if (!W) {
|
825
|
+
console.error("There is not a valid selected vee-validate node or component");
|
826
|
+
return;
|
827
|
+
}
|
828
|
+
if (W.type === "field") {
|
829
|
+
await W.field.validate();
|
830
|
+
return;
|
831
|
+
}
|
832
|
+
if (W.type === "form") {
|
833
|
+
await W.form.validate();
|
834
|
+
return;
|
835
|
+
}
|
836
|
+
W.type === "pathState" && await W.form.validateField(W.state.path);
|
837
|
+
}
|
838
|
+
},
|
839
|
+
{
|
840
|
+
icon: "delete_sweep",
|
841
|
+
tooltip: "Clear validation state of the selected item",
|
842
|
+
action: () => {
|
843
|
+
if (!W) {
|
844
|
+
console.error("There is not a valid selected vee-validate node or component");
|
845
|
+
return;
|
846
|
+
}
|
847
|
+
if (W.type === "field") {
|
848
|
+
W.field.resetField();
|
849
|
+
return;
|
850
|
+
}
|
851
|
+
W.type === "form" && W.form.resetForm(), W.type === "pathState" && W.form.resetField(W.state.path);
|
852
|
+
}
|
853
|
+
}
|
854
|
+
]
|
855
|
+
}), e.on.getInspectorTree((t) => {
|
856
|
+
if (t.inspectorId !== Ce)
|
857
|
+
return;
|
858
|
+
const n = Object.values(Be), r = Object.values(De);
|
859
|
+
t.rootNodes = [
|
860
|
+
...n.map(lr),
|
861
|
+
...r.map((i) => ur(i))
|
862
|
+
];
|
863
|
+
}), e.on.getInspectorState((t, n) => {
|
864
|
+
if (t.inspectorId !== Ce || n.currentTab !== `custom-inspector:${Ce}`)
|
865
|
+
return;
|
866
|
+
const { form: r, field: i, state: a, type: o } = or(t.nodeId);
|
867
|
+
if (r && o === "form") {
|
868
|
+
t.state = sr(r), W = { type: "form", form: r };
|
869
|
+
return;
|
870
|
+
}
|
871
|
+
if (a && o === "pathState" && r) {
|
872
|
+
t.state = Bt(a), W = { type: "pathState", state: a, form: r };
|
873
|
+
return;
|
874
|
+
}
|
875
|
+
if (i && o === "field") {
|
876
|
+
t.state = Bt({
|
877
|
+
errors: i.errors.value,
|
878
|
+
dirty: i.meta.dirty,
|
879
|
+
valid: i.meta.valid,
|
880
|
+
touched: i.meta.touched,
|
881
|
+
value: i.value.value,
|
882
|
+
initialValue: i.meta.initialValue
|
883
|
+
}), W = { field: i, type: "field" };
|
884
|
+
return;
|
885
|
+
}
|
886
|
+
W = null;
|
887
|
+
});
|
888
|
+
}
|
889
|
+
function lr(e) {
|
890
|
+
const { textColor: t, bgColor: n } = Zt(e.meta.value.valid), r = {};
|
891
|
+
Object.values(e.getAllPathStates()).forEach((o) => {
|
892
|
+
K(r, N(o.path), ar(o, e));
|
893
|
+
});
|
894
|
+
function i(o, s = []) {
|
895
|
+
const d = [...s].pop();
|
896
|
+
return "id" in o ? Object.assign(Object.assign({}, o), { label: d || o.label }) : Oe(o) ? {
|
897
|
+
id: `${s.join(".")}`,
|
898
|
+
label: d || "",
|
899
|
+
children: Object.keys(o).map((f) => i(o[f], [...s, f]))
|
900
|
+
} : Array.isArray(o) ? {
|
901
|
+
id: `${s.join(".")}`,
|
902
|
+
label: `${d}[]`,
|
903
|
+
children: o.map((f, b) => i(f, [...s, String(b)]))
|
904
|
+
} : { id: "", label: "", children: [] };
|
905
|
+
}
|
906
|
+
const { children: a } = i(r);
|
907
|
+
return {
|
908
|
+
id: _t(e),
|
909
|
+
label: "Form",
|
910
|
+
children: a,
|
911
|
+
tags: [
|
912
|
+
{
|
913
|
+
label: "Form",
|
914
|
+
textColor: t,
|
915
|
+
backgroundColor: n
|
916
|
+
},
|
917
|
+
{
|
918
|
+
label: `${e.getAllPathStates().length} fields`,
|
919
|
+
textColor: ae.white,
|
920
|
+
backgroundColor: ae.unknown
|
921
|
+
}
|
922
|
+
]
|
923
|
+
};
|
924
|
+
}
|
925
|
+
function ar(e, t) {
|
926
|
+
return {
|
927
|
+
id: _t(t, e),
|
928
|
+
label: N(e.path),
|
929
|
+
tags: Xt(e.multiple, e.fieldsCount, e.type, e.valid, t)
|
930
|
+
};
|
931
|
+
}
|
932
|
+
function ur(e, t) {
|
933
|
+
return {
|
934
|
+
id: _t(t, e),
|
935
|
+
label: N(e.name),
|
936
|
+
tags: Xt(!1, 1, e.type, e.meta.valid, t)
|
937
|
+
};
|
938
|
+
}
|
939
|
+
function Xt(e, t, n, r, i) {
|
940
|
+
const { textColor: a, bgColor: o } = Zt(r);
|
941
|
+
return [
|
942
|
+
e ? void 0 : {
|
943
|
+
label: "Field",
|
944
|
+
textColor: a,
|
945
|
+
backgroundColor: o
|
946
|
+
},
|
947
|
+
i ? void 0 : {
|
948
|
+
label: "Standalone",
|
949
|
+
textColor: ae.black,
|
950
|
+
backgroundColor: ae.gray
|
951
|
+
},
|
952
|
+
n === "checkbox" ? {
|
953
|
+
label: "Checkbox",
|
954
|
+
textColor: ae.white,
|
955
|
+
backgroundColor: ae.blue
|
956
|
+
} : void 0,
|
957
|
+
n === "radio" ? {
|
958
|
+
label: "Radio",
|
959
|
+
textColor: ae.white,
|
960
|
+
backgroundColor: ae.purple
|
961
|
+
} : void 0,
|
962
|
+
e ? {
|
963
|
+
label: "Multiple",
|
964
|
+
textColor: ae.black,
|
965
|
+
backgroundColor: ae.orange
|
966
|
+
} : void 0
|
967
|
+
].filter(Boolean);
|
968
|
+
}
|
969
|
+
function _t(e, t) {
|
970
|
+
const n = t ? "path" in t ? "pathState" : "field" : "form", r = t ? "path" in t ? t?.path : N(t?.name) : "", i = { f: e?.formId, ff: r, type: n };
|
971
|
+
return btoa(encodeURIComponent(JSON.stringify(i)));
|
972
|
+
}
|
973
|
+
function or(e) {
|
974
|
+
try {
|
975
|
+
const t = JSON.parse(decodeURIComponent(atob(e))), n = Be[t.f];
|
976
|
+
if (!n && t.ff) {
|
977
|
+
const i = De[t.ff];
|
978
|
+
return i ? {
|
979
|
+
type: t.type,
|
980
|
+
field: i
|
981
|
+
} : {};
|
982
|
+
}
|
983
|
+
if (!n)
|
984
|
+
return {};
|
985
|
+
const r = n.getPathState(t.ff);
|
986
|
+
return {
|
987
|
+
type: t.type,
|
988
|
+
form: n,
|
989
|
+
state: r
|
990
|
+
};
|
991
|
+
} catch {
|
992
|
+
}
|
993
|
+
return {};
|
994
|
+
}
|
995
|
+
function Bt(e) {
|
996
|
+
return {
|
997
|
+
"Field state": [
|
998
|
+
{ key: "errors", value: e.errors },
|
999
|
+
{
|
1000
|
+
key: "initialValue",
|
1001
|
+
value: e.initialValue
|
1002
|
+
},
|
1003
|
+
{
|
1004
|
+
key: "currentValue",
|
1005
|
+
value: e.value
|
1006
|
+
},
|
1007
|
+
{
|
1008
|
+
key: "touched",
|
1009
|
+
value: e.touched
|
1010
|
+
},
|
1011
|
+
{
|
1012
|
+
key: "dirty",
|
1013
|
+
value: e.dirty
|
1014
|
+
},
|
1015
|
+
{
|
1016
|
+
key: "valid",
|
1017
|
+
value: e.valid
|
1018
|
+
}
|
1019
|
+
]
|
1020
|
+
};
|
1021
|
+
}
|
1022
|
+
function sr(e) {
|
1023
|
+
const { errorBag: t, meta: n, values: r, isSubmitting: i, isValidating: a, submitCount: o } = e;
|
1024
|
+
return {
|
1025
|
+
"Form state": [
|
1026
|
+
{
|
1027
|
+
key: "submitCount",
|
1028
|
+
value: o.value
|
1029
|
+
},
|
1030
|
+
{
|
1031
|
+
key: "isSubmitting",
|
1032
|
+
value: i.value
|
1033
|
+
},
|
1034
|
+
{
|
1035
|
+
key: "isValidating",
|
1036
|
+
value: a.value
|
1037
|
+
},
|
1038
|
+
{
|
1039
|
+
key: "touched",
|
1040
|
+
value: n.value.touched
|
1041
|
+
},
|
1042
|
+
{
|
1043
|
+
key: "dirty",
|
1044
|
+
value: n.value.dirty
|
1045
|
+
},
|
1046
|
+
{
|
1047
|
+
key: "valid",
|
1048
|
+
value: n.value.valid
|
1049
|
+
},
|
1050
|
+
{
|
1051
|
+
key: "initialValues",
|
1052
|
+
value: n.value.initialValues
|
1053
|
+
},
|
1054
|
+
{
|
1055
|
+
key: "currentValues",
|
1056
|
+
value: r
|
1057
|
+
},
|
1058
|
+
{
|
1059
|
+
key: "errors",
|
1060
|
+
value: le(t.value).reduce((s, d) => {
|
1061
|
+
var f;
|
1062
|
+
const b = (f = t.value[d]) === null || f === void 0 ? void 0 : f[0];
|
1063
|
+
return b && (s[d] = b), s;
|
1064
|
+
}, {})
|
1065
|
+
}
|
1066
|
+
]
|
1067
|
+
};
|
1068
|
+
}
|
1069
|
+
function Zt(e) {
|
1070
|
+
return {
|
1071
|
+
bgColor: e ? ae.success : ae.error,
|
1072
|
+
textColor: e ? ae.black : ae.white
|
1073
|
+
};
|
1074
|
+
}
|
1075
|
+
function dr(e, t, n) {
|
1076
|
+
return Ue(n?.type) ? fr(e, t, n) : en(e, t, n);
|
1077
|
+
}
|
1078
|
+
function en(e, t, n) {
|
1079
|
+
const { initialValue: r, validateOnMount: i, bails: a, type: o, checkedValue: s, label: d, validateOnValueUpdate: f, uncheckedValue: b, controlled: p, keepValueOnUnmount: T, syncVModel: O, form: B } = cr(n), H = p ? Le(Ae) : void 0, I = B || H, q = C(() => Me(S(e))), z = C(() => {
|
1080
|
+
if (S(I?.schema))
|
1081
|
+
return;
|
1082
|
+
const w = N(t);
|
1083
|
+
return Qe(w) || he(w) || Y(w) || Array.isArray(w) ? w : Ht(w);
|
1084
|
+
}), oe = !Y(z.value) && he(S(t)), { id: J, value: m, initialValue: g, meta: y, setState: F, errors: A, flags: V } = Yn(q, {
|
1085
|
+
modelValue: r,
|
1086
|
+
form: I,
|
1087
|
+
bails: a,
|
1088
|
+
label: d,
|
1089
|
+
type: o,
|
1090
|
+
validate: z.value ? P : void 0,
|
1091
|
+
schema: oe ? t : void 0
|
1092
|
+
}), R = C(() => A.value[0]);
|
1093
|
+
O && vr({
|
1094
|
+
value: m,
|
1095
|
+
prop: O,
|
1096
|
+
handleChange: D,
|
1097
|
+
shouldValidate: () => f && !V.pendingReset
|
1098
|
+
});
|
1099
|
+
const X = (h, w = !1) => {
|
1100
|
+
y.touched = !0, w && re();
|
1101
|
+
};
|
1102
|
+
async function me(h) {
|
1103
|
+
var w, G;
|
1104
|
+
if (I?.validateSchema) {
|
1105
|
+
const { results: M } = await I.validateSchema(h);
|
1106
|
+
return (w = M[S(q)]) !== null && w !== void 0 ? w : { valid: !0, errors: [] };
|
1107
|
+
}
|
1108
|
+
return z.value ? Kt(m.value, z.value, {
|
1109
|
+
name: S(q),
|
1110
|
+
label: S(d),
|
1111
|
+
values: (G = I?.values) !== null && G !== void 0 ? G : {},
|
1112
|
+
bails: a
|
1113
|
+
}) : { valid: !0, errors: [] };
|
1114
|
+
}
|
1115
|
+
const re = ht(async () => (y.pending = !0, y.validated = !0, me("validated-only")), (h) => (V.pendingUnmount[ne.id] || (F({ errors: h.errors }), y.pending = !1, y.valid = h.valid), h)), Z = ht(async () => me("silent"), (h) => (y.valid = h.valid, h));
|
1116
|
+
function P(h) {
|
1117
|
+
return h?.mode === "silent" ? Z() : re();
|
1118
|
+
}
|
1119
|
+
function D(h, w = !0) {
|
1120
|
+
const G = Je(h);
|
1121
|
+
Ie(G, w);
|
1122
|
+
}
|
1123
|
+
Rt(() => {
|
1124
|
+
if (i)
|
1125
|
+
return re();
|
1126
|
+
(!I || !I.validateSchema) && Z();
|
1127
|
+
});
|
1128
|
+
function ce(h) {
|
1129
|
+
y.touched = h;
|
1130
|
+
}
|
1131
|
+
function be(h) {
|
1132
|
+
var w;
|
1133
|
+
const G = h && "value" in h ? h.value : g.value;
|
1134
|
+
F({
|
1135
|
+
value: k(G),
|
1136
|
+
initialValue: k(G),
|
1137
|
+
touched: (w = h?.touched) !== null && w !== void 0 ? w : !1,
|
1138
|
+
errors: h?.errors || []
|
1139
|
+
}), y.pending = !1, y.validated = !1, Z();
|
1140
|
+
}
|
1141
|
+
const $e = Ee();
|
1142
|
+
function Ie(h, w = !0) {
|
1143
|
+
m.value = $e && O ? Pn(h, $e.props.modelModifiers) : h, (w ? re : Z)();
|
1144
|
+
}
|
1145
|
+
function St(h) {
|
1146
|
+
F({ errors: Array.isArray(h) ? h : [h] });
|
1147
|
+
}
|
1148
|
+
const Te = C({
|
1149
|
+
get() {
|
1150
|
+
return m.value;
|
1151
|
+
},
|
1152
|
+
set(h) {
|
1153
|
+
Ie(h, f);
|
1154
|
+
}
|
1155
|
+
}), ne = {
|
1156
|
+
id: J,
|
1157
|
+
name: q,
|
1158
|
+
label: d,
|
1159
|
+
value: Te,
|
1160
|
+
meta: y,
|
1161
|
+
errors: A,
|
1162
|
+
errorMessage: R,
|
1163
|
+
type: o,
|
1164
|
+
checkedValue: s,
|
1165
|
+
uncheckedValue: b,
|
1166
|
+
bails: a,
|
1167
|
+
keepValueOnUnmount: T,
|
1168
|
+
resetField: be,
|
1169
|
+
handleReset: () => be(),
|
1170
|
+
validate: P,
|
1171
|
+
handleChange: D,
|
1172
|
+
handleBlur: X,
|
1173
|
+
setState: F,
|
1174
|
+
setTouched: ce,
|
1175
|
+
setErrors: St,
|
1176
|
+
setValue: Ie
|
1177
|
+
};
|
1178
|
+
if (Ut(Xe, ne), qe(t) && typeof N(t) != "function" && de(t, (h, w) => {
|
1179
|
+
Q(h, w) || (y.validated ? re() : Z());
|
1180
|
+
}, {
|
1181
|
+
deep: !0
|
1182
|
+
}), process.env.NODE_ENV !== "production" && (ne._vm = Ee(), de(() => Object.assign(Object.assign({ errors: A.value }, y), { value: m.value }), Ne, {
|
1183
|
+
deep: !0
|
1184
|
+
}), I || rr(ne)), !I)
|
1185
|
+
return ne;
|
1186
|
+
const tt = C(() => {
|
1187
|
+
const h = z.value;
|
1188
|
+
return !h || Y(h) || Qe(h) || he(h) || Array.isArray(h) ? {} : Object.keys(h).reduce((w, G) => {
|
1189
|
+
const M = $n(h[G]).map((ge) => ge.__locatorRef).reduce((ge, fe) => {
|
1190
|
+
const ye = $(I.values, fe) || I.values[fe];
|
1191
|
+
return ye !== void 0 && (ge[fe] = ye), ge;
|
1192
|
+
}, {});
|
1193
|
+
return Object.assign(w, M), w;
|
1194
|
+
}, {});
|
1195
|
+
});
|
1196
|
+
return de(tt, (h, w) => {
|
1197
|
+
if (!Object.keys(h).length)
|
1198
|
+
return;
|
1199
|
+
!Q(h, w) && (y.validated ? re() : Z());
|
1200
|
+
}), Lt(() => {
|
1201
|
+
var h;
|
1202
|
+
const w = (h = S(ne.keepValueOnUnmount)) !== null && h !== void 0 ? h : S(I.keepValuesOnUnmount), G = S(q);
|
1203
|
+
if (w || !I || V.pendingUnmount[ne.id]) {
|
1204
|
+
I?.removePathState(G, J);
|
1205
|
+
return;
|
1206
|
+
}
|
1207
|
+
V.pendingUnmount[ne.id] = !0;
|
1208
|
+
const M = I.getPathState(G);
|
1209
|
+
if (Array.isArray(M?.id) && M?.multiple ? M?.id.includes(ne.id) : M?.id === ne.id) {
|
1210
|
+
if (M?.multiple && Array.isArray(M.value)) {
|
1211
|
+
const fe = M.value.findIndex((ye) => Q(ye, S(ne.checkedValue)));
|
1212
|
+
if (fe > -1) {
|
1213
|
+
const ye = [...M.value];
|
1214
|
+
ye.splice(fe, 1), I.setFieldValue(G, ye);
|
1215
|
+
}
|
1216
|
+
Array.isArray(M.id) && M.id.splice(M.id.indexOf(ne.id), 1);
|
1217
|
+
} else
|
1218
|
+
I.unsetPathValue(S(q));
|
1219
|
+
I.removePathState(G, J);
|
1220
|
+
}
|
1221
|
+
}), ne;
|
1222
|
+
}
|
1223
|
+
function cr(e) {
|
1224
|
+
const t = () => ({
|
1225
|
+
initialValue: void 0,
|
1226
|
+
validateOnMount: !1,
|
1227
|
+
bails: !0,
|
1228
|
+
label: void 0,
|
1229
|
+
validateOnValueUpdate: !0,
|
1230
|
+
keepValueOnUnmount: void 0,
|
1231
|
+
syncVModel: !1,
|
1232
|
+
controlled: !0
|
1233
|
+
}), n = !!e?.syncVModel, r = typeof e?.syncVModel == "string" ? e.syncVModel : e?.modelPropName || "modelValue", i = n && !("initialValue" in (e || {})) ? gt(Ee(), r) : e?.initialValue;
|
1234
|
+
if (!e)
|
1235
|
+
return Object.assign(Object.assign({}, t()), { initialValue: i });
|
1236
|
+
const a = "valueProp" in e ? e.valueProp : e.checkedValue, o = "standalone" in e ? !e.standalone : e.controlled, s = e?.modelPropName || e?.syncVModel || !1;
|
1237
|
+
return Object.assign(Object.assign(Object.assign({}, t()), e || {}), {
|
1238
|
+
initialValue: i,
|
1239
|
+
controlled: o ?? !0,
|
1240
|
+
checkedValue: a,
|
1241
|
+
syncVModel: s
|
1242
|
+
});
|
1243
|
+
}
|
1244
|
+
function fr(e, t, n) {
|
1245
|
+
const r = n?.standalone ? void 0 : Le(Ae), i = n?.checkedValue, a = n?.uncheckedValue;
|
1246
|
+
function o(s) {
|
1247
|
+
const d = s.handleChange, f = C(() => {
|
1248
|
+
const p = S(s.value), T = S(i);
|
1249
|
+
return Array.isArray(p) ? p.findIndex((O) => Q(O, T)) >= 0 : Q(T, p);
|
1250
|
+
});
|
1251
|
+
function b(p, T = !0) {
|
1252
|
+
var O, B;
|
1253
|
+
if (f.value === ((O = p?.target) === null || O === void 0 ? void 0 : O.checked)) {
|
1254
|
+
T && s.validate();
|
1255
|
+
return;
|
1256
|
+
}
|
1257
|
+
const H = S(e), I = r?.getPathState(H), q = Je(p);
|
1258
|
+
let z = (B = S(i)) !== null && B !== void 0 ? B : q;
|
1259
|
+
r && I?.multiple && I.type === "checkbox" ? z = Nt($(r.values, H) || [], z, void 0) : n?.type === "checkbox" && (z = Nt(S(s.value), z, S(a))), d(z, T);
|
1260
|
+
}
|
1261
|
+
return Object.assign(Object.assign({}, s), {
|
1262
|
+
checked: f,
|
1263
|
+
checkedValue: i,
|
1264
|
+
uncheckedValue: a,
|
1265
|
+
handleChange: b
|
1266
|
+
});
|
1267
|
+
}
|
1268
|
+
return o(en(e, t, n));
|
1269
|
+
}
|
1270
|
+
function vr({ prop: e, value: t, handleChange: n, shouldValidate: r }) {
|
1271
|
+
const i = Ee();
|
1272
|
+
if (!i || !e) {
|
1273
|
+
process.env.NODE_ENV !== "production" && console.warn("Failed to setup model events because `useField` was not called in setup.");
|
1274
|
+
return;
|
1275
|
+
}
|
1276
|
+
const a = typeof e == "string" ? e : "modelValue", o = `update:${a}`;
|
1277
|
+
a in i.props && (de(t, (s) => {
|
1278
|
+
Q(s, gt(i, a)) || i.emit(o, s);
|
1279
|
+
}), de(() => gt(i, a), (s) => {
|
1280
|
+
if (s === Ke && t.value === void 0)
|
1281
|
+
return;
|
1282
|
+
const d = s === Ke ? void 0 : s;
|
1283
|
+
Q(d, t.value) || n(d, r());
|
1284
|
+
}));
|
1285
|
+
}
|
1286
|
+
function gt(e, t) {
|
1287
|
+
if (e)
|
1288
|
+
return e.props[t];
|
1289
|
+
}
|
1290
|
+
const hr = /* @__PURE__ */ Ye({
|
1291
|
+
name: "Field",
|
1292
|
+
inheritAttrs: !1,
|
1293
|
+
props: {
|
1294
|
+
as: {
|
1295
|
+
type: [String, Object],
|
1296
|
+
default: void 0
|
1297
|
+
},
|
1298
|
+
name: {
|
1299
|
+
type: String,
|
1300
|
+
required: !0
|
1301
|
+
},
|
1302
|
+
rules: {
|
1303
|
+
type: [Object, String, Function],
|
1304
|
+
default: void 0
|
1305
|
+
},
|
1306
|
+
validateOnMount: {
|
1307
|
+
type: Boolean,
|
1308
|
+
default: !1
|
1309
|
+
},
|
1310
|
+
validateOnBlur: {
|
1311
|
+
type: Boolean,
|
1312
|
+
default: void 0
|
1313
|
+
},
|
1314
|
+
validateOnChange: {
|
1315
|
+
type: Boolean,
|
1316
|
+
default: void 0
|
1317
|
+
},
|
1318
|
+
validateOnInput: {
|
1319
|
+
type: Boolean,
|
1320
|
+
default: void 0
|
1321
|
+
},
|
1322
|
+
validateOnModelUpdate: {
|
1323
|
+
type: Boolean,
|
1324
|
+
default: void 0
|
1325
|
+
},
|
1326
|
+
bails: {
|
1327
|
+
type: Boolean,
|
1328
|
+
default: () => Se().bails
|
1329
|
+
},
|
1330
|
+
label: {
|
1331
|
+
type: String,
|
1332
|
+
default: void 0
|
1333
|
+
},
|
1334
|
+
uncheckedValue: {
|
1335
|
+
type: null,
|
1336
|
+
default: void 0
|
1337
|
+
},
|
1338
|
+
modelValue: {
|
1339
|
+
type: null,
|
1340
|
+
default: Ke
|
1341
|
+
},
|
1342
|
+
modelModifiers: {
|
1343
|
+
type: null,
|
1344
|
+
default: () => ({})
|
1345
|
+
},
|
1346
|
+
"onUpdate:modelValue": {
|
1347
|
+
type: null,
|
1348
|
+
default: void 0
|
1349
|
+
},
|
1350
|
+
standalone: {
|
1351
|
+
type: Boolean,
|
1352
|
+
default: !1
|
1353
|
+
},
|
1354
|
+
keepValue: {
|
1355
|
+
type: Boolean,
|
1356
|
+
default: void 0
|
1357
|
+
}
|
1358
|
+
},
|
1359
|
+
setup(e, t) {
|
1360
|
+
const n = _e(e, "rules"), r = _e(e, "name"), i = _e(e, "label"), a = _e(e, "uncheckedValue"), o = _e(e, "keepValue"), { errors: s, value: d, errorMessage: f, validate: b, handleChange: p, handleBlur: T, setTouched: O, resetField: B, handleReset: H, meta: I, checked: q, setErrors: z, setValue: oe } = dr(r, n, {
|
1361
|
+
validateOnMount: e.validateOnMount,
|
1362
|
+
bails: e.bails,
|
1363
|
+
standalone: e.standalone,
|
1364
|
+
type: t.attrs.type,
|
1365
|
+
initialValue: gr(e, t),
|
1366
|
+
// Only for checkboxes and radio buttons
|
1367
|
+
checkedValue: t.attrs.value,
|
1368
|
+
uncheckedValue: a,
|
1369
|
+
label: i,
|
1370
|
+
validateOnValueUpdate: e.validateOnModelUpdate,
|
1371
|
+
keepValueOnUnmount: o,
|
1372
|
+
syncVModel: !0
|
1373
|
+
}), J = function(V, R = !0) {
|
1374
|
+
p(V, R);
|
1375
|
+
}, m = C(() => {
|
1376
|
+
const { validateOnInput: A, validateOnChange: V, validateOnBlur: R, validateOnModelUpdate: X } = mr(e);
|
1377
|
+
function me(D) {
|
1378
|
+
T(D, R), Y(t.attrs.onBlur) && t.attrs.onBlur(D);
|
1379
|
+
}
|
1380
|
+
function re(D) {
|
1381
|
+
J(D, A), Y(t.attrs.onInput) && t.attrs.onInput(D);
|
1382
|
+
}
|
1383
|
+
function Z(D) {
|
1384
|
+
J(D, V), Y(t.attrs.onChange) && t.attrs.onChange(D);
|
1385
|
+
}
|
1386
|
+
const P = {
|
1387
|
+
name: e.name,
|
1388
|
+
onBlur: me,
|
1389
|
+
onInput: re,
|
1390
|
+
onChange: Z
|
1391
|
+
};
|
1392
|
+
return P["onUpdate:modelValue"] = (D) => J(D, X), P;
|
1393
|
+
}), g = C(() => {
|
1394
|
+
const A = Object.assign({}, m.value);
|
1395
|
+
Ue(t.attrs.type) && q && (A.checked = q.value);
|
1396
|
+
const V = Dt(e, t);
|
1397
|
+
return Nn(V, t.attrs) && (A.value = d.value), A;
|
1398
|
+
}), y = C(() => Object.assign(Object.assign({}, m.value), { modelValue: d.value }));
|
1399
|
+
function F() {
|
1400
|
+
return {
|
1401
|
+
field: g.value,
|
1402
|
+
componentField: y.value,
|
1403
|
+
value: d.value,
|
1404
|
+
meta: I,
|
1405
|
+
errors: s.value,
|
1406
|
+
errorMessage: f.value,
|
1407
|
+
validate: b,
|
1408
|
+
resetField: B,
|
1409
|
+
handleChange: J,
|
1410
|
+
handleInput: (A) => J(A, !1),
|
1411
|
+
handleReset: H,
|
1412
|
+
handleBlur: m.value.onBlur,
|
1413
|
+
setTouched: O,
|
1414
|
+
setErrors: z,
|
1415
|
+
setValue: oe
|
1416
|
+
};
|
1417
|
+
}
|
1418
|
+
return t.expose({
|
1419
|
+
value: d,
|
1420
|
+
meta: I,
|
1421
|
+
errors: s,
|
1422
|
+
errorMessage: f,
|
1423
|
+
setErrors: z,
|
1424
|
+
setTouched: O,
|
1425
|
+
setValue: oe,
|
1426
|
+
reset: B,
|
1427
|
+
validate: b,
|
1428
|
+
handleChange: p
|
1429
|
+
}), () => {
|
1430
|
+
const A = yt(Dt(e, t)), V = et(A, t, F);
|
1431
|
+
return A ? He(A, Object.assign(Object.assign({}, t.attrs), g.value), V) : V;
|
1432
|
+
};
|
1433
|
+
}
|
1434
|
+
});
|
1435
|
+
function Dt(e, t) {
|
1436
|
+
let n = e.as || "";
|
1437
|
+
return !e.as && !t.slots.default && (n = "input"), n;
|
1438
|
+
}
|
1439
|
+
function mr(e) {
|
1440
|
+
var t, n, r, i;
|
1441
|
+
const { validateOnInput: a, validateOnChange: o, validateOnBlur: s, validateOnModelUpdate: d } = Se();
|
1442
|
+
return {
|
1443
|
+
validateOnInput: (t = e.validateOnInput) !== null && t !== void 0 ? t : a,
|
1444
|
+
validateOnChange: (n = e.validateOnChange) !== null && n !== void 0 ? n : o,
|
1445
|
+
validateOnBlur: (r = e.validateOnBlur) !== null && r !== void 0 ? r : s,
|
1446
|
+
validateOnModelUpdate: (i = e.validateOnModelUpdate) !== null && i !== void 0 ? i : d
|
1447
|
+
};
|
1448
|
+
}
|
1449
|
+
function gr(e, t) {
|
1450
|
+
return Ue(t.attrs.type) ? wt(e, "modelValue") ? e.modelValue : void 0 : wt(e, "modelValue") ? e.modelValue : t.attrs.value;
|
1451
|
+
}
|
1452
|
+
const Nr = hr;
|
1453
|
+
let yr = 0;
|
1454
|
+
const xe = ["bails", "fieldsCount", "id", "multiple", "type", "validate"];
|
1455
|
+
function tn(e) {
|
1456
|
+
const t = e?.initialValues || {}, n = Object.assign({}, S(t)), r = N(e?.validationSchema);
|
1457
|
+
return r && he(r) && Y(r.cast) ? k(r.cast(n) || {}) : k(n);
|
1458
|
+
}
|
1459
|
+
function pr(e) {
|
1460
|
+
var t;
|
1461
|
+
const n = yr++;
|
1462
|
+
let r = 0;
|
1463
|
+
const i = ue(!1), a = ue(!1), o = ue(0), s = [], d = Ge(tn(e)), f = ue([]), b = ue({}), p = ue({}), T = Bn(() => {
|
1464
|
+
p.value = f.value.reduce((u, l) => (u[Me(S(l.path))] = l, u), {});
|
1465
|
+
});
|
1466
|
+
function O(u, l) {
|
1467
|
+
const c = P(u);
|
1468
|
+
if (!c) {
|
1469
|
+
typeof u == "string" && (b.value[Me(u)] = mt(l));
|
1470
|
+
return;
|
1471
|
+
}
|
1472
|
+
if (typeof u == "string") {
|
1473
|
+
const v = Me(u);
|
1474
|
+
b.value[v] && delete b.value[v];
|
1475
|
+
}
|
1476
|
+
c.errors = mt(l), c.valid = !c.errors.length;
|
1477
|
+
}
|
1478
|
+
function B(u) {
|
1479
|
+
le(u).forEach((l) => {
|
1480
|
+
O(l, u[l]);
|
1481
|
+
});
|
1482
|
+
}
|
1483
|
+
e?.initialErrors && B(e.initialErrors);
|
1484
|
+
const H = C(() => {
|
1485
|
+
const u = f.value.reduce((l, c) => (c.errors.length && (l[c.path] = c.errors), l), {});
|
1486
|
+
return Object.assign(Object.assign({}, b.value), u);
|
1487
|
+
}), I = C(() => le(H.value).reduce((u, l) => {
|
1488
|
+
const c = H.value[l];
|
1489
|
+
return c?.length && (u[l] = c[0]), u;
|
1490
|
+
}, {})), q = C(() => f.value.reduce((u, l) => (u[l.path] = { name: l.path || "", label: l.label || "" }, u), {})), z = C(() => f.value.reduce((u, l) => {
|
1491
|
+
var c;
|
1492
|
+
return u[l.path] = (c = l.bails) !== null && c !== void 0 ? c : !0, u;
|
1493
|
+
}, {})), oe = Object.assign({}, e?.initialErrors || {}), J = (t = e?.keepValuesOnUnmount) !== null && t !== void 0 ? t : !1, { initialValues: m, originalInitialValues: g, setInitialValues: y } = Or(f, d, e), F = br(f, d, g, I), A = C(() => f.value.reduce((u, l) => {
|
1494
|
+
const c = $(d, l.path);
|
1495
|
+
return K(u, l.path, c), u;
|
1496
|
+
}, {})), V = e?.validationSchema;
|
1497
|
+
function R(u, l) {
|
1498
|
+
var c, v;
|
1499
|
+
const E = C(() => $(m.value, S(u))), j = p.value[S(u)], _ = l?.type === "checkbox" || l?.type === "radio";
|
1500
|
+
if (j && _) {
|
1501
|
+
j.multiple = !0;
|
1502
|
+
const se = r++;
|
1503
|
+
return Array.isArray(j.id) ? j.id.push(se) : j.id = [j.id, se], j.fieldsCount++, j.__flags.pendingUnmount[se] = !1, j;
|
1504
|
+
}
|
1505
|
+
const L = C(() => $(d, S(u))), x = S(u), ee = ce.findIndex((se) => se === x);
|
1506
|
+
ee !== -1 && ce.splice(ee, 1);
|
1507
|
+
const U = C(() => {
|
1508
|
+
var se, Pe, at, ut;
|
1509
|
+
const ot = S(V);
|
1510
|
+
if (he(ot))
|
1511
|
+
return (Pe = (se = ot.describe) === null || se === void 0 ? void 0 : se.call(ot, S(u)).required) !== null && Pe !== void 0 ? Pe : !1;
|
1512
|
+
const st = S(l?.schema);
|
1513
|
+
return he(st) && (ut = (at = st.describe) === null || at === void 0 ? void 0 : at.call(st).required) !== null && ut !== void 0 ? ut : !1;
|
1514
|
+
}), te = r++, ie = Ge({
|
1515
|
+
id: te,
|
1516
|
+
path: u,
|
1517
|
+
touched: !1,
|
1518
|
+
pending: !1,
|
1519
|
+
valid: !0,
|
1520
|
+
validated: !!(!((c = oe[x]) === null || c === void 0) && c.length),
|
1521
|
+
required: U,
|
1522
|
+
initialValue: E,
|
1523
|
+
errors: fn([]),
|
1524
|
+
bails: (v = l?.bails) !== null && v !== void 0 ? v : !1,
|
1525
|
+
label: l?.label,
|
1526
|
+
type: l?.type || "default",
|
1527
|
+
value: L,
|
1528
|
+
multiple: !1,
|
1529
|
+
__flags: {
|
1530
|
+
pendingUnmount: { [te]: !1 },
|
1531
|
+
pendingReset: !1
|
1532
|
+
},
|
1533
|
+
fieldsCount: 1,
|
1534
|
+
validate: l?.validate,
|
1535
|
+
dirty: C(() => !Q(N(L), N(E)))
|
1536
|
+
});
|
1537
|
+
return f.value.push(ie), p.value[x] = ie, T(), I.value[x] && !oe[x] && ve(() => {
|
1538
|
+
Ve(x, { mode: "silent" });
|
1539
|
+
}), qe(u) && de(u, (se) => {
|
1540
|
+
T();
|
1541
|
+
const Pe = k(L.value);
|
1542
|
+
p.value[se] = ie, ve(() => {
|
1543
|
+
K(d, se, Pe);
|
1544
|
+
});
|
1545
|
+
}), ie;
|
1546
|
+
}
|
1547
|
+
const X = Tt(It, 5), me = Tt(It, 5), re = ht(async (u) => await (u === "silent" ? X() : me()), (u, [l]) => {
|
1548
|
+
const c = le(h.errorBag.value), E = [
|
1549
|
+
.../* @__PURE__ */ new Set([...le(u.results), ...f.value.map((j) => j.path), ...c])
|
1550
|
+
].sort().reduce((j, _) => {
|
1551
|
+
var L;
|
1552
|
+
const x = _, ee = P(x) || D(x), U = ((L = u.results[x]) === null || L === void 0 ? void 0 : L.errors) || [], te = S(ee?.path) || x, ie = Vr({ errors: U, valid: !U.length }, j.results[te]);
|
1553
|
+
return j.results[te] = ie, ie.valid || (j.errors[te] = ie.errors[0]), ee && b.value[te] && delete b.value[te], ee ? (ee.valid = ie.valid, l === "silent" || l === "validated-only" && !ee.validated || O(ee, ie.errors), j) : (O(te, U), j);
|
1554
|
+
}, {
|
1555
|
+
valid: u.valid,
|
1556
|
+
results: {},
|
1557
|
+
errors: {},
|
1558
|
+
source: u.source
|
1559
|
+
});
|
1560
|
+
return u.values && (E.values = u.values, E.source = u.source), le(E.results).forEach((j) => {
|
1561
|
+
var _;
|
1562
|
+
const L = P(j);
|
1563
|
+
L && l !== "silent" && (l === "validated-only" && !L.validated || O(L, (_ = E.results[j]) === null || _ === void 0 ? void 0 : _.errors));
|
1564
|
+
}), E;
|
1565
|
+
});
|
1566
|
+
function Z(u) {
|
1567
|
+
f.value.forEach(u);
|
1568
|
+
}
|
1569
|
+
function P(u) {
|
1570
|
+
const l = typeof u == "string" ? Me(u) : u;
|
1571
|
+
return typeof l == "string" ? p.value[l] : l;
|
1572
|
+
}
|
1573
|
+
function D(u) {
|
1574
|
+
return f.value.filter((c) => u.startsWith(c.path)).reduce((c, v) => c ? v.path.length > c.path.length ? v : c : v, void 0);
|
1575
|
+
}
|
1576
|
+
let ce = [], be;
|
1577
|
+
function $e(u) {
|
1578
|
+
return ce.push(u), be || (be = ve(() => {
|
1579
|
+
[...ce].sort().reverse().forEach((c) => {
|
1580
|
+
kt(d, c);
|
1581
|
+
}), ce = [], be = null;
|
1582
|
+
})), be;
|
1583
|
+
}
|
1584
|
+
function Ie(u) {
|
1585
|
+
return function(c, v) {
|
1586
|
+
return function(j) {
|
1587
|
+
return j instanceof Event && (j.preventDefault(), j.stopPropagation()), Z((_) => _.touched = !0), i.value = !0, o.value++, Fe().then((_) => {
|
1588
|
+
const L = k(d);
|
1589
|
+
if (_.valid && typeof c == "function") {
|
1590
|
+
const x = k(A.value);
|
1591
|
+
let ee = u ? x : L;
|
1592
|
+
return _.values && (ee = _.source === "schema" ? _.values : Object.assign({}, ee, _.values)), c(ee, {
|
1593
|
+
evt: j,
|
1594
|
+
controlledValues: x,
|
1595
|
+
setErrors: B,
|
1596
|
+
setFieldError: O,
|
1597
|
+
setTouched: nt,
|
1598
|
+
setFieldTouched: fe,
|
1599
|
+
setValues: M,
|
1600
|
+
setFieldValue: w,
|
1601
|
+
resetForm: rt,
|
1602
|
+
resetField: Et
|
1603
|
+
});
|
1604
|
+
}
|
1605
|
+
!_.valid && typeof v == "function" && v({
|
1606
|
+
values: L,
|
1607
|
+
evt: j,
|
1608
|
+
errors: _.errors,
|
1609
|
+
results: _.results
|
1610
|
+
});
|
1611
|
+
}).then((_) => (i.value = !1, _), (_) => {
|
1612
|
+
throw i.value = !1, _;
|
1613
|
+
});
|
1614
|
+
};
|
1615
|
+
};
|
1616
|
+
}
|
1617
|
+
const Te = Ie(!1);
|
1618
|
+
Te.withControlled = Ie(!0);
|
1619
|
+
function ne(u, l) {
|
1620
|
+
const c = f.value.findIndex((E) => E.path === u && (Array.isArray(E.id) ? E.id.includes(l) : E.id === l)), v = f.value[c];
|
1621
|
+
if (!(c === -1 || !v)) {
|
1622
|
+
if (ve(() => {
|
1623
|
+
Ve(u, { mode: "silent", warn: !1 });
|
1624
|
+
}), v.multiple && v.fieldsCount && v.fieldsCount--, Array.isArray(v.id)) {
|
1625
|
+
const E = v.id.indexOf(l);
|
1626
|
+
E >= 0 && v.id.splice(E, 1), delete v.__flags.pendingUnmount[l];
|
1627
|
+
}
|
1628
|
+
(!v.multiple || v.fieldsCount <= 0) && (f.value.splice(c, 1), At(u), T(), delete p.value[u]);
|
1629
|
+
}
|
1630
|
+
}
|
1631
|
+
function tt(u) {
|
1632
|
+
le(p.value).forEach((l) => {
|
1633
|
+
l.startsWith(u) && delete p.value[l];
|
1634
|
+
}), f.value = f.value.filter((l) => !l.path.startsWith(u)), ve(() => {
|
1635
|
+
T();
|
1636
|
+
});
|
1637
|
+
}
|
1638
|
+
const h = {
|
1639
|
+
formId: n,
|
1640
|
+
values: d,
|
1641
|
+
controlledValues: A,
|
1642
|
+
errorBag: H,
|
1643
|
+
errors: I,
|
1644
|
+
schema: V,
|
1645
|
+
submitCount: o,
|
1646
|
+
meta: F,
|
1647
|
+
isSubmitting: i,
|
1648
|
+
isValidating: a,
|
1649
|
+
fieldArrays: s,
|
1650
|
+
keepValuesOnUnmount: J,
|
1651
|
+
validateSchema: N(V) ? re : void 0,
|
1652
|
+
validate: Fe,
|
1653
|
+
setFieldError: O,
|
1654
|
+
validateField: Ve,
|
1655
|
+
setFieldValue: w,
|
1656
|
+
setValues: M,
|
1657
|
+
setErrors: B,
|
1658
|
+
setFieldTouched: fe,
|
1659
|
+
setTouched: nt,
|
1660
|
+
resetForm: rt,
|
1661
|
+
resetField: Et,
|
1662
|
+
handleSubmit: Te,
|
1663
|
+
useFieldModel: un,
|
1664
|
+
defineInputBinds: on,
|
1665
|
+
defineComponentBinds: sn,
|
1666
|
+
defineField: lt,
|
1667
|
+
stageInitialValue: ln,
|
1668
|
+
unsetInitialValue: At,
|
1669
|
+
setFieldInitialValue: it,
|
1670
|
+
createPathState: R,
|
1671
|
+
getPathState: P,
|
1672
|
+
unsetPathValue: $e,
|
1673
|
+
removePathState: ne,
|
1674
|
+
initialValues: m,
|
1675
|
+
getAllPathStates: () => f.value,
|
1676
|
+
destroyPath: tt,
|
1677
|
+
isFieldTouched: ye,
|
1678
|
+
isFieldDirty: nn,
|
1679
|
+
isFieldValid: rn
|
1680
|
+
};
|
1681
|
+
function w(u, l, c = !0) {
|
1682
|
+
const v = k(l), E = typeof u == "string" ? u : u.path;
|
1683
|
+
P(E) || R(E), K(d, E, v), c && Ve(E);
|
1684
|
+
}
|
1685
|
+
function G(u, l = !0) {
|
1686
|
+
le(d).forEach((c) => {
|
1687
|
+
delete d[c];
|
1688
|
+
}), le(u).forEach((c) => {
|
1689
|
+
w(c, u[c], !1);
|
1690
|
+
}), l && Fe();
|
1691
|
+
}
|
1692
|
+
function M(u, l = !0) {
|
1693
|
+
Re(d, u), s.forEach((c) => c && c.reset()), l && Fe();
|
1694
|
+
}
|
1695
|
+
function ge(u, l) {
|
1696
|
+
const c = P(S(u)) || R(u);
|
1697
|
+
return C({
|
1698
|
+
get() {
|
1699
|
+
return c.value;
|
1700
|
+
},
|
1701
|
+
set(v) {
|
1702
|
+
var E;
|
1703
|
+
const j = S(u);
|
1704
|
+
w(j, v, (E = S(l)) !== null && E !== void 0 ? E : !1);
|
1705
|
+
}
|
1706
|
+
});
|
1707
|
+
}
|
1708
|
+
function fe(u, l) {
|
1709
|
+
const c = P(u);
|
1710
|
+
c && (c.touched = l);
|
1711
|
+
}
|
1712
|
+
function ye(u) {
|
1713
|
+
const l = P(u);
|
1714
|
+
return l ? l.touched : f.value.filter((c) => c.path.startsWith(u)).some((c) => c.touched);
|
1715
|
+
}
|
1716
|
+
function nn(u) {
|
1717
|
+
const l = P(u);
|
1718
|
+
return l ? l.dirty : f.value.filter((c) => c.path.startsWith(u)).some((c) => c.dirty);
|
1719
|
+
}
|
1720
|
+
function rn(u) {
|
1721
|
+
const l = P(u);
|
1722
|
+
return l ? l.valid : f.value.filter((c) => c.path.startsWith(u)).every((c) => c.valid);
|
1723
|
+
}
|
1724
|
+
function nt(u) {
|
1725
|
+
if (typeof u == "boolean") {
|
1726
|
+
Z((l) => {
|
1727
|
+
l.touched = u;
|
1728
|
+
});
|
1729
|
+
return;
|
1730
|
+
}
|
1731
|
+
le(u).forEach((l) => {
|
1732
|
+
fe(l, !!u[l]);
|
1733
|
+
});
|
1734
|
+
}
|
1735
|
+
function Et(u, l) {
|
1736
|
+
var c;
|
1737
|
+
const v = l && "value" in l ? l.value : $(m.value, u), E = P(u);
|
1738
|
+
E && (E.__flags.pendingReset = !0), it(u, k(v), !0), w(u, v, !1), fe(u, (c = l?.touched) !== null && c !== void 0 ? c : !1), O(u, l?.errors || []), ve(() => {
|
1739
|
+
E && (E.__flags.pendingReset = !1);
|
1740
|
+
});
|
1741
|
+
}
|
1742
|
+
function rt(u, l) {
|
1743
|
+
let c = k(u?.values ? u.values : g.value);
|
1744
|
+
c = l?.force ? c : Re(g.value, c), c = he(V) && Y(V.cast) ? V.cast(c) : c, y(c, { force: l?.force }), Z((v) => {
|
1745
|
+
var E;
|
1746
|
+
v.__flags.pendingReset = !0, v.validated = !1, v.touched = ((E = u?.touched) === null || E === void 0 ? void 0 : E[v.path]) || !1, w(v.path, $(c, v.path), !1), O(v.path, void 0);
|
1747
|
+
}), l?.force ? G(c, !1) : M(c, !1), B(u?.errors || {}), o.value = u?.submitCount || 0, ve(() => {
|
1748
|
+
Fe({ mode: "silent" }), Z((v) => {
|
1749
|
+
v.__flags.pendingReset = !1;
|
1750
|
+
});
|
1751
|
+
});
|
1752
|
+
}
|
1753
|
+
async function Fe(u) {
|
1754
|
+
const l = u?.mode || "force";
|
1755
|
+
if (l === "force" && Z((_) => _.validated = !0), h.validateSchema)
|
1756
|
+
return h.validateSchema(l);
|
1757
|
+
a.value = !0;
|
1758
|
+
const c = await Promise.all(f.value.map((_) => _.validate ? _.validate(u).then((L) => ({
|
1759
|
+
key: _.path,
|
1760
|
+
valid: L.valid,
|
1761
|
+
errors: L.errors,
|
1762
|
+
value: L.value
|
1763
|
+
})) : Promise.resolve({
|
1764
|
+
key: _.path,
|
1765
|
+
valid: !0,
|
1766
|
+
errors: [],
|
1767
|
+
value: void 0
|
1768
|
+
})));
|
1769
|
+
a.value = !1;
|
1770
|
+
const v = {}, E = {}, j = {};
|
1771
|
+
for (const _ of c)
|
1772
|
+
v[_.key] = {
|
1773
|
+
valid: _.valid,
|
1774
|
+
errors: _.errors
|
1775
|
+
}, _.value && K(j, _.key, _.value), _.errors.length && (E[_.key] = _.errors[0]);
|
1776
|
+
return {
|
1777
|
+
valid: c.every((_) => _.valid),
|
1778
|
+
results: v,
|
1779
|
+
errors: E,
|
1780
|
+
values: j,
|
1781
|
+
source: "fields"
|
1782
|
+
};
|
1783
|
+
}
|
1784
|
+
async function Ve(u, l) {
|
1785
|
+
var c;
|
1786
|
+
const v = P(u);
|
1787
|
+
if (v && l?.mode !== "silent" && (v.validated = !0), V) {
|
1788
|
+
const { results: j } = await re(l?.mode || "validated-only");
|
1789
|
+
return j[u] || { errors: [], valid: !0 };
|
1790
|
+
}
|
1791
|
+
return v?.validate ? v.validate(l) : (!v && ((c = l?.warn) !== null && c !== void 0 ? c : !0) && process.env.NODE_ENV !== "production" && $t(`field with path ${u} was not found`), Promise.resolve({ errors: [], valid: !0 }));
|
1792
|
+
}
|
1793
|
+
function At(u) {
|
1794
|
+
kt(m.value, u);
|
1795
|
+
}
|
1796
|
+
function ln(u, l, c = !1) {
|
1797
|
+
it(u, l), K(d, u, l), c && !e?.initialValues && K(g.value, u, k(l));
|
1798
|
+
}
|
1799
|
+
function it(u, l, c = !1) {
|
1800
|
+
K(m.value, u, k(l)), c && K(g.value, u, k(l));
|
1801
|
+
}
|
1802
|
+
async function It() {
|
1803
|
+
const u = N(V);
|
1804
|
+
if (!u)
|
1805
|
+
return { valid: !0, results: {}, errors: {}, source: "none" };
|
1806
|
+
a.value = !0;
|
1807
|
+
const l = Qe(u) || he(u) ? await Qn(u, d) : await Jn(u, d, {
|
1808
|
+
names: q.value,
|
1809
|
+
bailsMap: z.value
|
1810
|
+
});
|
1811
|
+
return a.value = !1, l;
|
1812
|
+
}
|
1813
|
+
const an = Te((u, { evt: l }) => {
|
1814
|
+
qt(l) && l.target.submit();
|
1815
|
+
});
|
1816
|
+
Rt(() => {
|
1817
|
+
if (e?.initialErrors && B(e.initialErrors), e?.initialTouched && nt(e.initialTouched), e?.validateOnMount) {
|
1818
|
+
Fe();
|
1819
|
+
return;
|
1820
|
+
}
|
1821
|
+
h.validateSchema && h.validateSchema("silent");
|
1822
|
+
}), qe(V) && de(V, () => {
|
1823
|
+
var u;
|
1824
|
+
(u = h.validateSchema) === null || u === void 0 || u.call(h, "validated-only");
|
1825
|
+
}), Ut(Ae, h), process.env.NODE_ENV !== "production" && (nr(h), de(() => Object.assign(Object.assign({ errors: H.value }, F.value), { values: d, isSubmitting: i.value, isValidating: a.value, submitCount: o.value }), Ne, {
|
1826
|
+
deep: !0
|
1827
|
+
}));
|
1828
|
+
function lt(u, l) {
|
1829
|
+
const c = Y(l) ? void 0 : l?.label, v = P(S(u)) || R(u, { label: c }), E = () => Y(l) ? l(ze(v, xe)) : l || {};
|
1830
|
+
function j() {
|
1831
|
+
var U;
|
1832
|
+
v.touched = !0, ((U = E().validateOnBlur) !== null && U !== void 0 ? U : Se().validateOnBlur) && Ve(v.path);
|
1833
|
+
}
|
1834
|
+
function _() {
|
1835
|
+
var U;
|
1836
|
+
((U = E().validateOnInput) !== null && U !== void 0 ? U : Se().validateOnInput) && ve(() => {
|
1837
|
+
Ve(v.path);
|
1838
|
+
});
|
1839
|
+
}
|
1840
|
+
function L() {
|
1841
|
+
var U;
|
1842
|
+
((U = E().validateOnChange) !== null && U !== void 0 ? U : Se().validateOnChange) && ve(() => {
|
1843
|
+
Ve(v.path);
|
1844
|
+
});
|
1845
|
+
}
|
1846
|
+
const x = C(() => {
|
1847
|
+
const U = {
|
1848
|
+
onChange: L,
|
1849
|
+
onInput: _,
|
1850
|
+
onBlur: j
|
1851
|
+
};
|
1852
|
+
return Y(l) ? Object.assign(Object.assign({}, U), l(ze(v, xe)).props || {}) : l?.props ? Object.assign(Object.assign({}, U), l.props(ze(v, xe))) : U;
|
1853
|
+
});
|
1854
|
+
return [ge(u, () => {
|
1855
|
+
var U, te, ie;
|
1856
|
+
return (ie = (U = E().validateOnModelUpdate) !== null && U !== void 0 ? U : (te = Se()) === null || te === void 0 ? void 0 : te.validateOnModelUpdate) !== null && ie !== void 0 ? ie : !0;
|
1857
|
+
}), x];
|
1858
|
+
}
|
1859
|
+
function un(u) {
|
1860
|
+
return Array.isArray(u) ? u.map((l) => ge(l, !0)) : ge(u);
|
1861
|
+
}
|
1862
|
+
function on(u, l) {
|
1863
|
+
const [c, v] = lt(u, l);
|
1864
|
+
function E() {
|
1865
|
+
v.value.onBlur();
|
1866
|
+
}
|
1867
|
+
function j(L) {
|
1868
|
+
const x = Je(L);
|
1869
|
+
w(S(u), x, !1), v.value.onInput();
|
1870
|
+
}
|
1871
|
+
function _(L) {
|
1872
|
+
const x = Je(L);
|
1873
|
+
w(S(u), x, !1), v.value.onChange();
|
1874
|
+
}
|
1875
|
+
return C(() => Object.assign(Object.assign({}, v.value), {
|
1876
|
+
onBlur: E,
|
1877
|
+
onInput: j,
|
1878
|
+
onChange: _,
|
1879
|
+
value: c.value
|
1880
|
+
}));
|
1881
|
+
}
|
1882
|
+
function sn(u, l) {
|
1883
|
+
const [c, v] = lt(u, l), E = P(S(u));
|
1884
|
+
function j(_) {
|
1885
|
+
c.value = _;
|
1886
|
+
}
|
1887
|
+
return C(() => {
|
1888
|
+
const _ = Y(l) ? l(ze(E, xe)) : l || {};
|
1889
|
+
return Object.assign({ [_.model || "modelValue"]: c.value, [`onUpdate:${_.model || "modelValue"}`]: j }, v.value);
|
1890
|
+
});
|
1891
|
+
}
|
1892
|
+
return Object.assign(Object.assign({}, h), { values: dn(d), handleReset: () => rt(), submitForm: an });
|
1893
|
+
}
|
1894
|
+
function br(e, t, n, r) {
|
1895
|
+
const i = {
|
1896
|
+
touched: "some",
|
1897
|
+
pending: "some",
|
1898
|
+
valid: "every"
|
1899
|
+
}, a = C(() => !Q(t, N(n)));
|
1900
|
+
function o() {
|
1901
|
+
const d = e.value;
|
1902
|
+
return le(i).reduce((f, b) => {
|
1903
|
+
const p = i[b];
|
1904
|
+
return f[b] = d[p]((T) => T[b]), f;
|
1905
|
+
}, {});
|
1906
|
+
}
|
1907
|
+
const s = Ge(o());
|
1908
|
+
return cn(() => {
|
1909
|
+
const d = o();
|
1910
|
+
s.touched = d.touched, s.valid = d.valid, s.pending = d.pending;
|
1911
|
+
}), C(() => Object.assign(Object.assign({ initialValues: N(n) }, s), { valid: s.valid && !le(r.value).length, dirty: a.value }));
|
1912
|
+
}
|
1913
|
+
function Or(e, t, n) {
|
1914
|
+
const r = tn(n), i = ue(r), a = ue(k(r));
|
1915
|
+
function o(s, d) {
|
1916
|
+
d?.force ? (i.value = k(s), a.value = k(s)) : (i.value = Re(k(i.value) || {}, k(s)), a.value = Re(k(a.value) || {}, k(s))), d?.updateFields && e.value.forEach((f) => {
|
1917
|
+
if (f.touched)
|
1918
|
+
return;
|
1919
|
+
const p = $(i.value, f.path);
|
1920
|
+
K(t, f.path, k(p));
|
1921
|
+
});
|
1922
|
+
}
|
1923
|
+
return {
|
1924
|
+
initialValues: i,
|
1925
|
+
originalInitialValues: a,
|
1926
|
+
setInitialValues: o
|
1927
|
+
};
|
1928
|
+
}
|
1929
|
+
function Vr(e, t) {
|
1930
|
+
return t ? {
|
1931
|
+
valid: e.valid && t.valid,
|
1932
|
+
errors: [...e.errors, ...t.errors]
|
1933
|
+
} : e;
|
1934
|
+
}
|
1935
|
+
const _r = /* @__PURE__ */ Ye({
|
1936
|
+
name: "Form",
|
1937
|
+
inheritAttrs: !1,
|
1938
|
+
props: {
|
1939
|
+
as: {
|
1940
|
+
type: null,
|
1941
|
+
default: "form"
|
1942
|
+
},
|
1943
|
+
validationSchema: {
|
1944
|
+
type: Object,
|
1945
|
+
default: void 0
|
1946
|
+
},
|
1947
|
+
initialValues: {
|
1948
|
+
type: Object,
|
1949
|
+
default: void 0
|
1950
|
+
},
|
1951
|
+
initialErrors: {
|
1952
|
+
type: Object,
|
1953
|
+
default: void 0
|
1954
|
+
},
|
1955
|
+
initialTouched: {
|
1956
|
+
type: Object,
|
1957
|
+
default: void 0
|
1958
|
+
},
|
1959
|
+
validateOnMount: {
|
1960
|
+
type: Boolean,
|
1961
|
+
default: !1
|
1962
|
+
},
|
1963
|
+
onSubmit: {
|
1964
|
+
type: Function,
|
1965
|
+
default: void 0
|
1966
|
+
},
|
1967
|
+
onInvalidSubmit: {
|
1968
|
+
type: Function,
|
1969
|
+
default: void 0
|
1970
|
+
},
|
1971
|
+
keepValues: {
|
1972
|
+
type: Boolean,
|
1973
|
+
default: !1
|
1974
|
+
}
|
1975
|
+
},
|
1976
|
+
setup(e, t) {
|
1977
|
+
const n = _e(e, "validationSchema"), r = _e(e, "keepValues"), { errors: i, errorBag: a, values: o, meta: s, isSubmitting: d, isValidating: f, submitCount: b, controlledValues: p, validate: T, validateField: O, handleReset: B, resetForm: H, handleSubmit: I, setErrors: q, setFieldError: z, setFieldValue: oe, setValues: J, setFieldTouched: m, setTouched: g, resetField: y } = pr({
|
1978
|
+
validationSchema: n.value ? n : void 0,
|
1979
|
+
initialValues: e.initialValues,
|
1980
|
+
initialErrors: e.initialErrors,
|
1981
|
+
initialTouched: e.initialTouched,
|
1982
|
+
validateOnMount: e.validateOnMount,
|
1983
|
+
keepValuesOnUnmount: r
|
1984
|
+
}), F = I((P, { evt: D }) => {
|
1985
|
+
qt(D) && D.target.submit();
|
1986
|
+
}, e.onInvalidSubmit), A = e.onSubmit ? I(e.onSubmit, e.onInvalidSubmit) : F;
|
1987
|
+
function V(P) {
|
1988
|
+
bt(P) && P.preventDefault(), B(), typeof t.attrs.onReset == "function" && t.attrs.onReset();
|
1989
|
+
}
|
1990
|
+
function R(P, D) {
|
1991
|
+
return I(typeof P == "function" && !D ? P : D, e.onInvalidSubmit)(P);
|
1992
|
+
}
|
1993
|
+
function X() {
|
1994
|
+
return k(o);
|
1995
|
+
}
|
1996
|
+
function me() {
|
1997
|
+
return k(s.value);
|
1998
|
+
}
|
1999
|
+
function re() {
|
2000
|
+
return k(i.value);
|
2001
|
+
}
|
2002
|
+
function Z() {
|
2003
|
+
return {
|
2004
|
+
meta: s.value,
|
2005
|
+
errors: i.value,
|
2006
|
+
errorBag: a.value,
|
2007
|
+
values: o,
|
2008
|
+
isSubmitting: d.value,
|
2009
|
+
isValidating: f.value,
|
2010
|
+
submitCount: b.value,
|
2011
|
+
controlledValues: p.value,
|
2012
|
+
validate: T,
|
2013
|
+
validateField: O,
|
2014
|
+
handleSubmit: R,
|
2015
|
+
handleReset: B,
|
2016
|
+
submitForm: F,
|
2017
|
+
setErrors: q,
|
2018
|
+
setFieldError: z,
|
2019
|
+
setFieldValue: oe,
|
2020
|
+
setValues: J,
|
2021
|
+
setFieldTouched: m,
|
2022
|
+
setTouched: g,
|
2023
|
+
resetForm: H,
|
2024
|
+
resetField: y,
|
2025
|
+
getValues: X,
|
2026
|
+
getMeta: me,
|
2027
|
+
getErrors: re
|
2028
|
+
};
|
2029
|
+
}
|
2030
|
+
return t.expose({
|
2031
|
+
setFieldError: z,
|
2032
|
+
setErrors: q,
|
2033
|
+
setFieldValue: oe,
|
2034
|
+
setValues: J,
|
2035
|
+
setFieldTouched: m,
|
2036
|
+
setTouched: g,
|
2037
|
+
resetForm: H,
|
2038
|
+
validate: T,
|
2039
|
+
validateField: O,
|
2040
|
+
resetField: y,
|
2041
|
+
getValues: X,
|
2042
|
+
getMeta: me,
|
2043
|
+
getErrors: re,
|
2044
|
+
values: o,
|
2045
|
+
meta: s,
|
2046
|
+
errors: i
|
2047
|
+
}), function() {
|
2048
|
+
const D = e.as === "form" ? e.as : e.as ? yt(e.as) : null, ce = et(D, t, Z);
|
2049
|
+
return D ? He(D, Object.assign(Object.assign(Object.assign({}, D === "form" ? {
|
2050
|
+
// Disables native validation as vee-validate will handle it.
|
2051
|
+
novalidate: !0
|
2052
|
+
} : {}), t.attrs), { onSubmit: A, onReset: V }), ce) : ce;
|
2053
|
+
};
|
2054
|
+
}
|
2055
|
+
}), Tr = _r;
|
2056
|
+
function Sr(e) {
|
2057
|
+
const t = Le(Ae, void 0), n = ue([]), r = () => {
|
2058
|
+
}, i = {
|
2059
|
+
fields: n,
|
2060
|
+
remove: r,
|
2061
|
+
push: r,
|
2062
|
+
swap: r,
|
2063
|
+
insert: r,
|
2064
|
+
update: r,
|
2065
|
+
replace: r,
|
2066
|
+
prepend: r,
|
2067
|
+
move: r
|
2068
|
+
};
|
2069
|
+
if (!t)
|
2070
|
+
return process.env.NODE_ENV !== "production" && We("FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly"), i;
|
2071
|
+
if (!N(e))
|
2072
|
+
return process.env.NODE_ENV !== "production" && We("FieldArray requires a field path to be provided, did you forget to pass the `name` prop?"), i;
|
2073
|
+
const a = t.fieldArrays.find((m) => N(m.path) === N(e));
|
2074
|
+
if (a)
|
2075
|
+
return a;
|
2076
|
+
let o = 0;
|
2077
|
+
function s() {
|
2078
|
+
return $(t?.values, S(e), []) || [];
|
2079
|
+
}
|
2080
|
+
function d() {
|
2081
|
+
const m = s();
|
2082
|
+
Array.isArray(m) && (n.value = m.map((g, y) => b(g, y, n.value)), f());
|
2083
|
+
}
|
2084
|
+
d();
|
2085
|
+
function f() {
|
2086
|
+
const m = n.value.length;
|
2087
|
+
for (let g = 0; g < m; g++) {
|
2088
|
+
const y = n.value[g];
|
2089
|
+
y.isFirst = g === 0, y.isLast = g === m - 1;
|
2090
|
+
}
|
2091
|
+
}
|
2092
|
+
function b(m, g, y) {
|
2093
|
+
if (y && !we(g) && y[g])
|
2094
|
+
return y[g];
|
2095
|
+
const F = o++;
|
2096
|
+
return {
|
2097
|
+
key: F,
|
2098
|
+
value: Mn({
|
2099
|
+
get() {
|
2100
|
+
const V = $(t?.values, S(e), []) || [], R = n.value.findIndex((X) => X.key === F);
|
2101
|
+
return R === -1 ? m : V[R];
|
2102
|
+
},
|
2103
|
+
set(V) {
|
2104
|
+
const R = n.value.findIndex((X) => X.key === F);
|
2105
|
+
if (R === -1) {
|
2106
|
+
process.env.NODE_ENV !== "production" && We("Attempting to update a non-existent array item");
|
2107
|
+
return;
|
2108
|
+
}
|
2109
|
+
q(R, V);
|
2110
|
+
}
|
2111
|
+
}),
|
2112
|
+
// will be auto unwrapped
|
2113
|
+
isFirst: !1,
|
2114
|
+
isLast: !1
|
2115
|
+
};
|
2116
|
+
}
|
2117
|
+
function p() {
|
2118
|
+
f(), t?.validate({ mode: "silent" });
|
2119
|
+
}
|
2120
|
+
function T(m) {
|
2121
|
+
const g = S(e), y = $(t?.values, g);
|
2122
|
+
if (!y || !Array.isArray(y))
|
2123
|
+
return;
|
2124
|
+
const F = [...y];
|
2125
|
+
F.splice(m, 1);
|
2126
|
+
const A = g + `[${m}]`;
|
2127
|
+
t.destroyPath(A), t.unsetInitialValue(A), K(t.values, g, F), n.value.splice(m, 1), p();
|
2128
|
+
}
|
2129
|
+
function O(m) {
|
2130
|
+
const g = k(m), y = S(e), F = $(t?.values, y), A = we(F) ? [] : F;
|
2131
|
+
if (!Array.isArray(A))
|
2132
|
+
return;
|
2133
|
+
const V = [...A];
|
2134
|
+
V.push(g), t.stageInitialValue(y + `[${V.length - 1}]`, g), K(t.values, y, V), n.value.push(b(g)), p();
|
2135
|
+
}
|
2136
|
+
function B(m, g) {
|
2137
|
+
const y = S(e), F = $(t?.values, y);
|
2138
|
+
if (!Array.isArray(F) || !(m in F) || !(g in F))
|
2139
|
+
return;
|
2140
|
+
const A = [...F], V = [...n.value], R = A[m];
|
2141
|
+
A[m] = A[g], A[g] = R;
|
2142
|
+
const X = V[m];
|
2143
|
+
V[m] = V[g], V[g] = X, K(t.values, y, A), n.value = V, f();
|
2144
|
+
}
|
2145
|
+
function H(m, g) {
|
2146
|
+
const y = k(g), F = S(e), A = $(t?.values, F);
|
2147
|
+
if (!Array.isArray(A) || A.length < m)
|
2148
|
+
return;
|
2149
|
+
const V = [...A], R = [...n.value];
|
2150
|
+
V.splice(m, 0, y), R.splice(m, 0, b(y)), K(t.values, F, V), n.value = R, p();
|
2151
|
+
}
|
2152
|
+
function I(m) {
|
2153
|
+
const g = S(e);
|
2154
|
+
t.stageInitialValue(g, m), K(t.values, g, m), d(), p();
|
2155
|
+
}
|
2156
|
+
function q(m, g) {
|
2157
|
+
const y = S(e), F = $(t?.values, y);
|
2158
|
+
!Array.isArray(F) || F.length - 1 < m || (K(t.values, `${y}[${m}]`, g), t?.validate({ mode: "validated-only" }));
|
2159
|
+
}
|
2160
|
+
function z(m) {
|
2161
|
+
const g = k(m), y = S(e), F = $(t?.values, y), A = we(F) ? [] : F;
|
2162
|
+
if (!Array.isArray(A))
|
2163
|
+
return;
|
2164
|
+
const V = [g, ...A];
|
2165
|
+
K(t.values, y, V), t.stageInitialValue(y + "[0]", g), n.value.unshift(b(g)), p();
|
2166
|
+
}
|
2167
|
+
function oe(m, g) {
|
2168
|
+
const y = S(e), F = $(t?.values, y), A = we(F) ? [] : [...F];
|
2169
|
+
if (!Array.isArray(F) || !(m in F) || !(g in F))
|
2170
|
+
return;
|
2171
|
+
const V = [...n.value], R = V[m];
|
2172
|
+
V.splice(m, 1), V.splice(g, 0, R);
|
2173
|
+
const X = A[m];
|
2174
|
+
A.splice(m, 1), A.splice(g, 0, X), K(t.values, y, A), n.value = V, p();
|
2175
|
+
}
|
2176
|
+
const J = {
|
2177
|
+
fields: n,
|
2178
|
+
remove: T,
|
2179
|
+
push: O,
|
2180
|
+
swap: B,
|
2181
|
+
insert: H,
|
2182
|
+
update: q,
|
2183
|
+
replace: I,
|
2184
|
+
prepend: z,
|
2185
|
+
move: oe
|
2186
|
+
};
|
2187
|
+
return t.fieldArrays.push(Object.assign({ path: e, reset: d }, J)), Lt(() => {
|
2188
|
+
const m = t.fieldArrays.findIndex((g) => S(g.path) === S(e));
|
2189
|
+
m >= 0 && t.fieldArrays.splice(m, 1);
|
2190
|
+
}), de(s, (m) => {
|
2191
|
+
const g = n.value.map((y) => y.value);
|
2192
|
+
Q(m, g) || d();
|
2193
|
+
}), J;
|
2194
|
+
}
|
2195
|
+
const Er = /* @__PURE__ */ Ye({
|
2196
|
+
name: "FieldArray",
|
2197
|
+
inheritAttrs: !1,
|
2198
|
+
props: {
|
2199
|
+
name: {
|
2200
|
+
type: String,
|
2201
|
+
required: !0
|
2202
|
+
}
|
2203
|
+
},
|
2204
|
+
setup(e, t) {
|
2205
|
+
const { push: n, remove: r, swap: i, insert: a, replace: o, update: s, prepend: d, move: f, fields: b } = Sr(() => e.name);
|
2206
|
+
function p() {
|
2207
|
+
return {
|
2208
|
+
fields: b.value,
|
2209
|
+
push: n,
|
2210
|
+
remove: r,
|
2211
|
+
swap: i,
|
2212
|
+
insert: a,
|
2213
|
+
update: s,
|
2214
|
+
replace: o,
|
2215
|
+
prepend: d,
|
2216
|
+
move: f
|
2217
|
+
};
|
2218
|
+
}
|
2219
|
+
return t.expose({
|
2220
|
+
push: n,
|
2221
|
+
remove: r,
|
2222
|
+
swap: i,
|
2223
|
+
insert: a,
|
2224
|
+
update: s,
|
2225
|
+
replace: o,
|
2226
|
+
prepend: d,
|
2227
|
+
move: f
|
2228
|
+
}), () => et(void 0, t, p);
|
2229
|
+
}
|
2230
|
+
}), Pr = Er, Ar = /* @__PURE__ */ Ye({
|
2231
|
+
name: "ErrorMessage",
|
2232
|
+
props: {
|
2233
|
+
as: {
|
2234
|
+
type: String,
|
2235
|
+
default: void 0
|
2236
|
+
},
|
2237
|
+
name: {
|
2238
|
+
type: String,
|
2239
|
+
required: !0
|
2240
|
+
}
|
2241
|
+
},
|
2242
|
+
setup(e, t) {
|
2243
|
+
const n = ke(Ae, void 0), r = C(() => n?.errors.value[e.name]);
|
2244
|
+
function i() {
|
2245
|
+
return {
|
2246
|
+
message: r.value
|
2247
|
+
};
|
2248
|
+
}
|
2249
|
+
return () => {
|
2250
|
+
if (!r.value)
|
2251
|
+
return;
|
2252
|
+
const a = e.as ? yt(e.as) : e.as, o = et(a, t, i), s = Object.assign({ role: "alert" }, t.attrs);
|
2253
|
+
return !a && (Array.isArray(o) || !o) && o?.length ? o : (Array.isArray(o) || !o) && !o?.length ? He(a || "span", s, r.value) : He(a, s, o);
|
2254
|
+
};
|
2255
|
+
}
|
2256
|
+
}), Mr = Ar;
|
2257
|
+
function Ir(e) {
|
2258
|
+
const t = Vt(e);
|
2259
|
+
return C(() => {
|
2260
|
+
var n, r;
|
2261
|
+
return t && (r = "meta" in t ? t.meta.dirty : (n = t?.value) === null || n === void 0 ? void 0 : n.dirty) !== null && r !== void 0 ? r : !1;
|
2262
|
+
});
|
2263
|
+
}
|
2264
|
+
function Fr(e) {
|
2265
|
+
const t = Vt(e);
|
2266
|
+
return C(() => {
|
2267
|
+
var n, r;
|
2268
|
+
return t && (r = "meta" in t ? t.meta.touched : (n = t?.value) === null || n === void 0 ? void 0 : n.touched) !== null && r !== void 0 ? r : !1;
|
2269
|
+
});
|
2270
|
+
}
|
2271
|
+
function jr(e) {
|
2272
|
+
const t = Vt(e);
|
2273
|
+
return C(() => {
|
2274
|
+
var n, r;
|
2275
|
+
return t && (r = "meta" in t ? t.meta.valid : (n = t?.value) === null || n === void 0 ? void 0 : n.valid) !== null && r !== void 0 ? r : !1;
|
2276
|
+
});
|
2277
|
+
}
|
2278
|
+
function wr(e) {
|
2279
|
+
const t = Le(Ae), n = e ? void 0 : ke(Xe);
|
2280
|
+
return C(() => e ? t?.errors.value[S(e)] : n?.errorMessage.value);
|
2281
|
+
}
|
2282
|
+
function Br() {
|
2283
|
+
const e = ke(Xe), t = ke(vn), n = {
|
2284
|
+
valid: jr(),
|
2285
|
+
isDirty: Ir(),
|
2286
|
+
isTouched: Fr(),
|
2287
|
+
error: wr()
|
2288
|
+
};
|
2289
|
+
if (!e)
|
2290
|
+
throw new Error("useFormField should be used within <BuiFormField>");
|
2291
|
+
const { name: r } = e, i = t;
|
2292
|
+
return {
|
2293
|
+
id: i,
|
2294
|
+
name: r,
|
2295
|
+
formItemId: `${i}-form-item`,
|
2296
|
+
formDescriptionId: `${i}-form-item-description`,
|
2297
|
+
formMessageId: `${i}-form-item-message`,
|
2298
|
+
...n
|
2299
|
+
};
|
2300
|
+
}
|
2301
|
+
export {
|
2302
|
+
Mr as E,
|
2303
|
+
Tr as F,
|
2304
|
+
Nr as a,
|
2305
|
+
Pr as b,
|
2306
|
+
dr as c,
|
2307
|
+
Br as d,
|
2308
|
+
pr as u
|
2309
|
+
};
|