@inploi/plugin-chatbot 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.js +3 -3
- package/cdn/style.css +1 -1
- package/dist/{chatbot-body-c294edef.js → chatbot-body-68b4780b.js} +401 -398
- package/dist/chatbot-body-e9a02854.cjs +1 -0
- package/dist/chatbot.api.d.ts +22 -0
- package/dist/chatbot.d.ts +6 -3
- package/dist/chatbot.state.d.ts +2 -1
- package/dist/index-2b3a83c0.cjs +5 -0
- package/dist/{index-e35a0d9d.js → index-32cebead.js} +840 -829
- package/dist/mocks/flows.mocks.d.ts +1 -1
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/chatbot-body-51ed15c6.cjs +0 -1
- package/dist/index-9944cf27.cjs +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as Ue, i as Yt, k as
|
|
1
|
+
import { g as Ue, i as Yt, k as Ne, a as er, b as le, A as Fe, c as Ir, N as Ke, _ as D, d as tr, h as Y, e as re, p as ue, F as pt, u as G, o as l, f as De, j as dt, y as pe, s as I, l as Ze, m as he, n as Mr, q as at, r as ee, t as Fr, v as ke, w as Lr, x as rr, z as Nr, B as nr, C as Tr, D as Se, E as Q, G as Dr, V as Rr, H as sr, I as je, J as Te, K as Or, L as Br, M as Pr, O as $r, P as jr, Q as zr, R as qr, S as Ur, T as Kr, U as Gr } from "./index-32cebead.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const Ft = ({
|
|
4
4
|
condition: e,
|
|
@@ -44,7 +44,7 @@ const Ft = ({
|
|
|
44
44
|
};
|
|
45
45
|
switch (typeof u) {
|
|
46
46
|
case "boolean":
|
|
47
|
-
return
|
|
47
|
+
return Le(d, {
|
|
48
48
|
submissions: {
|
|
49
49
|
_temp: {
|
|
50
50
|
value: u,
|
|
@@ -54,7 +54,7 @@ const Ft = ({
|
|
|
54
54
|
context: t
|
|
55
55
|
});
|
|
56
56
|
case "string":
|
|
57
|
-
return
|
|
57
|
+
return Le(d, {
|
|
58
58
|
submissions: {
|
|
59
59
|
_temp: {
|
|
60
60
|
value: u,
|
|
@@ -64,7 +64,7 @@ const Ft = ({
|
|
|
64
64
|
context: t
|
|
65
65
|
});
|
|
66
66
|
case "number":
|
|
67
|
-
return
|
|
67
|
+
return Le(d, {
|
|
68
68
|
submissions: {
|
|
69
69
|
_temp: {
|
|
70
70
|
value: u,
|
|
@@ -74,7 +74,7 @@ const Ft = ({
|
|
|
74
74
|
context: t
|
|
75
75
|
});
|
|
76
76
|
case "object":
|
|
77
|
-
return Array.isArray(u) && u.every(Yt) ?
|
|
77
|
+
return Array.isArray(u) && u.every(Yt) ? Le(d, {
|
|
78
78
|
submissions: {
|
|
79
79
|
_temp: {
|
|
80
80
|
value: u,
|
|
@@ -146,7 +146,7 @@ const Ft = ({
|
|
|
146
146
|
}
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, Le = (e, {
|
|
150
150
|
context: t,
|
|
151
151
|
submissions: r
|
|
152
152
|
}) => {
|
|
@@ -188,11 +188,11 @@ const Ft = ({
|
|
|
188
188
|
case "boolean":
|
|
189
189
|
return d.value === !0 ? "true" : "false";
|
|
190
190
|
case "file":
|
|
191
|
-
return d.value.map((
|
|
191
|
+
return d.value.map((p) => `${p.name} (${Ne(p.sizeKb)})`).join(", ");
|
|
192
192
|
case "enum":
|
|
193
193
|
return d.value.join(", ");
|
|
194
194
|
case "address":
|
|
195
|
-
return Object.values(d.value).filter((
|
|
195
|
+
return Object.values(d.value).filter((p) => p && p.trim().length > 0).join(", ");
|
|
196
196
|
case "number":
|
|
197
197
|
case "string":
|
|
198
198
|
return d.value ? d.value.toString() : a;
|
|
@@ -201,17 +201,17 @@ const Ft = ({
|
|
|
201
201
|
case "integration": {
|
|
202
202
|
if (typeof d.value != "object" || Array.isArray(d.value))
|
|
203
203
|
break;
|
|
204
|
-
const
|
|
205
|
-
switch (typeof
|
|
204
|
+
const p = Ue(d.value, u.join("."));
|
|
205
|
+
switch (typeof p) {
|
|
206
206
|
case "boolean":
|
|
207
|
-
return
|
|
207
|
+
return p === !0 ? "true" : "false";
|
|
208
208
|
case "string":
|
|
209
|
-
return
|
|
209
|
+
return p;
|
|
210
210
|
case "number":
|
|
211
|
-
return
|
|
211
|
+
return p.toString();
|
|
212
212
|
case "object":
|
|
213
|
-
if (Array.isArray(
|
|
214
|
-
return
|
|
213
|
+
if (Array.isArray(p) && p.every(Yt))
|
|
214
|
+
return p.join(", ");
|
|
215
215
|
}
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
@@ -260,9 +260,9 @@ const Ft = ({
|
|
|
260
260
|
chatService: i,
|
|
261
261
|
onFlowEnd: u,
|
|
262
262
|
onInterpret: d,
|
|
263
|
-
t:
|
|
263
|
+
t: p
|
|
264
264
|
}) => {
|
|
265
|
-
let
|
|
265
|
+
let w = new AbortController();
|
|
266
266
|
const v = {
|
|
267
267
|
...t.service,
|
|
268
268
|
log: (k) => t.service.log({
|
|
@@ -272,7 +272,7 @@ const Ft = ({
|
|
|
272
272
|
...t.customProperties
|
|
273
273
|
}
|
|
274
274
|
})
|
|
275
|
-
},
|
|
275
|
+
}, h = async (k, y) => {
|
|
276
276
|
const A = a();
|
|
277
277
|
d == null || d(k, y);
|
|
278
278
|
try {
|
|
@@ -284,16 +284,16 @@ const Ft = ({
|
|
|
284
284
|
context: n,
|
|
285
285
|
node: k,
|
|
286
286
|
submissions: A,
|
|
287
|
-
t:
|
|
287
|
+
t: p,
|
|
288
288
|
chat: {
|
|
289
289
|
sendMessage: async (S) => i.send({
|
|
290
290
|
groupId: k.id,
|
|
291
291
|
message: S,
|
|
292
|
-
signal:
|
|
292
|
+
signal: w.signal
|
|
293
293
|
}),
|
|
294
294
|
userInput: async (S) => i.input({
|
|
295
295
|
input: S,
|
|
296
|
-
signal:
|
|
296
|
+
signal: w.signal
|
|
297
297
|
}),
|
|
298
298
|
addToSubmissions: i.addToSubmissions
|
|
299
299
|
},
|
|
@@ -302,7 +302,7 @@ const Ft = ({
|
|
|
302
302
|
childNode: k,
|
|
303
303
|
nodes: e.nodes
|
|
304
304
|
});
|
|
305
|
-
return E ?
|
|
305
|
+
return E ? h(E, k) : u == null ? void 0 : u(k);
|
|
306
306
|
},
|
|
307
307
|
end: () => u == null ? void 0 : u(k)
|
|
308
308
|
});
|
|
@@ -315,24 +315,24 @@ const Ft = ({
|
|
|
315
315
|
return {
|
|
316
316
|
interpret: async (k) => {
|
|
317
317
|
const y = e.nodes.find((A) => A.id === k) ?? er(e.nodes);
|
|
318
|
-
return
|
|
318
|
+
return h(y);
|
|
319
319
|
},
|
|
320
320
|
undo: (k) => {
|
|
321
321
|
let y = 1;
|
|
322
322
|
const A = e.nodes.find((E) => E.id === k[k.length - 1]);
|
|
323
323
|
for (let E = k.length - 2; E > 0; E--) {
|
|
324
|
-
const g = k[E],
|
|
325
|
-
if (!
|
|
324
|
+
const g = k[E], M = e.nodes.find((R) => R.id === g);
|
|
325
|
+
if (!M || (y++, M.type.startsWith("question-")))
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
w.abort(), w = new AbortController();
|
|
329
329
|
const S = e.nodes.find((E) => E.id === k[k.length - y]);
|
|
330
|
-
return le(S, "Undo failed: new start node not found"),
|
|
330
|
+
return le(S, "Undo failed: new start node not found"), h(S, A), {
|
|
331
331
|
removed: y
|
|
332
332
|
};
|
|
333
333
|
},
|
|
334
334
|
abort: () => {
|
|
335
|
-
|
|
335
|
+
w.abort();
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
338
|
}, Xe = (e) => `+${e.countryCode} ${e.phoneNumber}`;
|
|
@@ -512,8 +512,8 @@ async function tn({
|
|
|
512
512
|
flow: u,
|
|
513
513
|
t: d
|
|
514
514
|
}) {
|
|
515
|
-
const
|
|
516
|
-
|
|
515
|
+
const p = async (w) => {
|
|
516
|
+
w !== !0 && await e.userInput({
|
|
517
517
|
type: "submit",
|
|
518
518
|
key: void 0,
|
|
519
519
|
config: {
|
|
@@ -524,14 +524,14 @@ async function tn({
|
|
|
524
524
|
});
|
|
525
525
|
const {
|
|
526
526
|
anonymous_id: v,
|
|
527
|
-
session_id:
|
|
527
|
+
session_id: h
|
|
528
528
|
} = i.getSessionInfo(), k = await s.fetch("/flow/submit", {
|
|
529
529
|
method: "POST",
|
|
530
530
|
body: JSON.stringify({
|
|
531
531
|
log_submit: !1,
|
|
532
532
|
integration_id: r.data.integrationId,
|
|
533
533
|
anonymous_id: v,
|
|
534
|
-
session_id:
|
|
534
|
+
session_id: h,
|
|
535
535
|
job: u.job,
|
|
536
536
|
submissions: Ir(a || {})
|
|
537
537
|
})
|
|
@@ -540,16 +540,16 @@ async function tn({
|
|
|
540
540
|
type: "integration",
|
|
541
541
|
value: k
|
|
542
542
|
}), Ke(k).with({
|
|
543
|
-
integration_response:
|
|
544
|
-
service:
|
|
545
|
-
status:
|
|
546
|
-
data:
|
|
543
|
+
integration_response: D.select(D.union({
|
|
544
|
+
service: D.optional(D.string),
|
|
545
|
+
status: D.number,
|
|
546
|
+
data: D.any
|
|
547
547
|
}, {
|
|
548
|
-
service:
|
|
549
|
-
status:
|
|
548
|
+
service: D.optional(D.string),
|
|
549
|
+
status: D.number,
|
|
550
550
|
error: {
|
|
551
|
-
message:
|
|
552
|
-
data:
|
|
551
|
+
message: D.string,
|
|
552
|
+
data: D.any
|
|
553
553
|
}
|
|
554
554
|
}))
|
|
555
555
|
}, (y) => {
|
|
@@ -571,10 +571,10 @@ async function tn({
|
|
|
571
571
|
}).otherwise(() => {
|
|
572
572
|
}), await Ke(k).with({
|
|
573
573
|
integration_response: {
|
|
574
|
-
data:
|
|
575
|
-
redirect_url:
|
|
576
|
-
message:
|
|
577
|
-
button_text:
|
|
574
|
+
data: D.select("redirect", {
|
|
575
|
+
redirect_url: D.string,
|
|
576
|
+
message: D.optional(D.union(D.string, D.nullish)),
|
|
577
|
+
button_text: D.optional(D.union(D.string, D.nullish))
|
|
578
578
|
})
|
|
579
579
|
}
|
|
580
580
|
}, async (y) => {
|
|
@@ -590,7 +590,7 @@ async function tn({
|
|
|
590
590
|
href: A.toString(),
|
|
591
591
|
text: y.redirect.button_text ?? d("complete_submission"),
|
|
592
592
|
onClick: () => {
|
|
593
|
-
if (!
|
|
593
|
+
if (!h) {
|
|
594
594
|
n.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
595
595
|
return;
|
|
596
596
|
}
|
|
@@ -599,7 +599,7 @@ async function tn({
|
|
|
599
599
|
properties: {
|
|
600
600
|
flow_build: u.build,
|
|
601
601
|
flow_id: u.id,
|
|
602
|
-
flow_session_id:
|
|
602
|
+
flow_session_id: h,
|
|
603
603
|
flow_version: u.version,
|
|
604
604
|
href: A.toString(),
|
|
605
605
|
job: u.job
|
|
@@ -625,8 +625,8 @@ async function tn({
|
|
|
625
625
|
}), t(r.nextId);
|
|
626
626
|
}).with({
|
|
627
627
|
integration_response: {
|
|
628
|
-
error:
|
|
629
|
-
message:
|
|
628
|
+
error: D.select("error", {
|
|
629
|
+
message: D.string
|
|
630
630
|
})
|
|
631
631
|
}
|
|
632
632
|
}, async (y) => {
|
|
@@ -634,16 +634,16 @@ async function tn({
|
|
|
634
634
|
type: "system",
|
|
635
635
|
variant: "error",
|
|
636
636
|
text: y.error.message || d("submission_failed")
|
|
637
|
-
}), await
|
|
637
|
+
}), await p(!1);
|
|
638
638
|
}).otherwise(async (y) => {
|
|
639
639
|
n.error(y), await e.sendMessage({
|
|
640
640
|
type: "system",
|
|
641
641
|
variant: "error",
|
|
642
642
|
text: d("submission_failed")
|
|
643
|
-
}), await
|
|
643
|
+
}), await p(!1);
|
|
644
644
|
});
|
|
645
645
|
};
|
|
646
|
-
await
|
|
646
|
+
await p(r.data.skipConfirmation);
|
|
647
647
|
}
|
|
648
648
|
async function rn({
|
|
649
649
|
chat: e,
|
|
@@ -670,7 +670,7 @@ async function nn({
|
|
|
670
670
|
node: r,
|
|
671
671
|
context: n
|
|
672
672
|
}) {
|
|
673
|
-
t(
|
|
673
|
+
t(Le(r, {
|
|
674
674
|
submissions: e,
|
|
675
675
|
context: n
|
|
676
676
|
}) ? r.branchId : r.nextId);
|
|
@@ -1021,23 +1021,23 @@ function ft(e, t, r) {
|
|
|
1021
1021
|
var n, s, a, i, u;
|
|
1022
1022
|
t == null && (t = 100);
|
|
1023
1023
|
function d() {
|
|
1024
|
-
var
|
|
1025
|
-
|
|
1024
|
+
var w = Date.now() - i;
|
|
1025
|
+
w < t && w >= 0 ? n = setTimeout(d, t - w) : (n = null, r || (u = e.apply(a, s), a = s = null));
|
|
1026
1026
|
}
|
|
1027
|
-
var
|
|
1027
|
+
var p = function() {
|
|
1028
1028
|
a = this, s = arguments, i = Date.now();
|
|
1029
|
-
var
|
|
1030
|
-
return n || (n = setTimeout(d, t)),
|
|
1029
|
+
var w = r && !n;
|
|
1030
|
+
return n || (n = setTimeout(d, t)), w && (u = e.apply(a, s), a = s = null), u;
|
|
1031
1031
|
};
|
|
1032
|
-
return
|
|
1032
|
+
return p.clear = function() {
|
|
1033
1033
|
n && (clearTimeout(n), n = null);
|
|
1034
|
-
},
|
|
1034
|
+
}, p.flush = function() {
|
|
1035
1035
|
n && (u = e.apply(a, s), a = s = null, clearTimeout(n), n = null);
|
|
1036
|
-
},
|
|
1036
|
+
}, p;
|
|
1037
1037
|
}
|
|
1038
1038
|
ft.debounce = ft;
|
|
1039
1039
|
var mn = ft;
|
|
1040
|
-
const
|
|
1040
|
+
const Lt = /* @__PURE__ */ tr(mn);
|
|
1041
1041
|
function gn(e) {
|
|
1042
1042
|
let {
|
|
1043
1043
|
debounce: t,
|
|
@@ -1067,25 +1067,25 @@ function gn(e) {
|
|
|
1067
1067
|
scrollContainers: null,
|
|
1068
1068
|
resizeObserver: null,
|
|
1069
1069
|
lastBounds: i
|
|
1070
|
-
}),
|
|
1070
|
+
}), p = t ? typeof t == "number" ? t : t.scroll : null, w = t ? typeof t == "number" ? t : t.resize : null, v = re(!1);
|
|
1071
1071
|
ue(() => (v.current = !0, () => void (v.current = !1)));
|
|
1072
|
-
const [
|
|
1072
|
+
const [h, k, y] = pt(() => {
|
|
1073
1073
|
const g = () => {
|
|
1074
1074
|
if (!d.current.element)
|
|
1075
1075
|
return;
|
|
1076
1076
|
const {
|
|
1077
|
-
left:
|
|
1078
|
-
top:
|
|
1079
|
-
width:
|
|
1077
|
+
left: M,
|
|
1078
|
+
top: R,
|
|
1079
|
+
width: N,
|
|
1080
1080
|
height: me,
|
|
1081
1081
|
bottom: ce,
|
|
1082
1082
|
right: Ee,
|
|
1083
1083
|
x: H,
|
|
1084
1084
|
y: se
|
|
1085
1085
|
} = d.current.element.getBoundingClientRect(), q = {
|
|
1086
|
-
left:
|
|
1087
|
-
top:
|
|
1088
|
-
width:
|
|
1086
|
+
left: M,
|
|
1087
|
+
top: R,
|
|
1088
|
+
width: N,
|
|
1089
1089
|
height: me,
|
|
1090
1090
|
bottom: ce,
|
|
1091
1091
|
right: Ee,
|
|
@@ -1094,8 +1094,8 @@ function gn(e) {
|
|
|
1094
1094
|
};
|
|
1095
1095
|
d.current.element instanceof HTMLElement && s && (q.height = d.current.element.offsetHeight, q.width = d.current.element.offsetWidth), Object.freeze(q), v.current && !xn(d.current.lastBounds, q) && u(d.current.lastBounds = q);
|
|
1096
1096
|
};
|
|
1097
|
-
return [g,
|
|
1098
|
-
}, [u, s,
|
|
1097
|
+
return [g, w ? Lt(g, w) : g, p ? Lt(g, p) : g];
|
|
1098
|
+
}, [u, s, p, w]);
|
|
1099
1099
|
function A() {
|
|
1100
1100
|
d.current.scrollContainers && (d.current.scrollContainers.forEach((g) => g.removeEventListener("scroll", y, !0)), d.current.scrollContainers = null), d.current.resizeObserver && (d.current.resizeObserver.disconnect(), d.current.resizeObserver = null);
|
|
1101
1101
|
}
|
|
@@ -1110,7 +1110,7 @@ function gn(e) {
|
|
|
1110
1110
|
};
|
|
1111
1111
|
return yn(y, !!r), bn(k), ue(() => {
|
|
1112
1112
|
A(), S();
|
|
1113
|
-
}, [r, y, k]), ue(() => A, []), [E, i,
|
|
1113
|
+
}, [r, y, k]), ue(() => A, []), [E, i, h];
|
|
1114
1114
|
}
|
|
1115
1115
|
function bn(e) {
|
|
1116
1116
|
ue(() => {
|
|
@@ -1594,38 +1594,41 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1594
1594
|
return r ? {
|
|
1595
1595
|
enabled: !0,
|
|
1596
1596
|
getPredictions: async (s) => {
|
|
1597
|
+
var v;
|
|
1597
1598
|
const a = new URL(kn);
|
|
1598
|
-
a.searchParams.set("q", s), a.searchParams.set("session_token", r)
|
|
1599
|
-
const i =
|
|
1600
|
-
|
|
1601
|
-
|
|
1599
|
+
a.searchParams.set("q", s), a.searchParams.set("session_token", r);
|
|
1600
|
+
const i = (v = I.current$.peek().flow) == null ? void 0 : v.locationOrigin;
|
|
1601
|
+
i && i.lat !== void 0 && i.lng !== void 0 && i.lat >= -90 && i.lat <= 90 && i.lng >= -180 && i.lng <= 180 && a.searchParams.set("proximity", `${i.lng},${i.lat}`), a.searchParams.set("access_token", Cn(Sn));
|
|
1602
|
+
const d = await fetch(a);
|
|
1603
|
+
if (!d.ok)
|
|
1604
|
+
return e.error("Failed to get address details", d), {
|
|
1602
1605
|
ok: !1,
|
|
1603
1606
|
error: t("address_error")
|
|
1604
1607
|
};
|
|
1605
|
-
const
|
|
1606
|
-
if (
|
|
1607
|
-
return e.error("Failed to parse address details",
|
|
1608
|
+
const p = Lr(En, await d.json());
|
|
1609
|
+
if (p.success === !1)
|
|
1610
|
+
return e.error("Failed to parse address details", p.issues), {
|
|
1608
1611
|
ok: !1,
|
|
1609
1612
|
error: t("address_error")
|
|
1610
1613
|
};
|
|
1611
1614
|
const {
|
|
1612
|
-
suggestions:
|
|
1613
|
-
} =
|
|
1615
|
+
suggestions: w
|
|
1616
|
+
} = p.output;
|
|
1614
1617
|
return {
|
|
1615
1618
|
ok: !0,
|
|
1616
|
-
data:
|
|
1617
|
-
var
|
|
1619
|
+
data: w.map((h) => {
|
|
1620
|
+
var k, y, A, S, E, g, M, R, N;
|
|
1618
1621
|
return {
|
|
1619
1622
|
label: h.full_address ?? h.place_formatted ?? h.name ?? h.mapbox_id,
|
|
1620
1623
|
id: h.mapbox_id,
|
|
1621
1624
|
address: {
|
|
1622
|
-
line1: ((
|
|
1625
|
+
line1: ((k = h.context.address) == null ? void 0 : k.name) ?? ((y = h.context.street) == null ? void 0 : y.name),
|
|
1623
1626
|
line2: void 0,
|
|
1624
|
-
line3: ((
|
|
1625
|
-
city: ((
|
|
1626
|
-
state: (
|
|
1627
|
-
postcode: (
|
|
1628
|
-
country: (
|
|
1627
|
+
line3: ((A = h.context.neighborhood) == null ? void 0 : A.name) ?? ((S = h.context.locality) == null ? void 0 : S.name),
|
|
1628
|
+
city: ((E = h.context.place) == null ? void 0 : E.name) ?? ((g = h.context.district) == null ? void 0 : g.name),
|
|
1629
|
+
state: (M = h.context.region) == null ? void 0 : M.name,
|
|
1630
|
+
postcode: (R = h.context.postcode) == null ? void 0 : R.name,
|
|
1631
|
+
country: (N = h.context.country) == null ? void 0 : N.name
|
|
1629
1632
|
}
|
|
1630
1633
|
};
|
|
1631
1634
|
})
|
|
@@ -1634,7 +1637,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1634
1637
|
} : {
|
|
1635
1638
|
enabled: !1
|
|
1636
1639
|
};
|
|
1637
|
-
}, [e, t]),
|
|
1640
|
+
}, [e, t]), Nt = (e) => {
|
|
1638
1641
|
const {
|
|
1639
1642
|
t
|
|
1640
1643
|
} = G();
|
|
@@ -1666,12 +1669,12 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1666
1669
|
t: n
|
|
1667
1670
|
} = G(), [s, a] = Y(), [i, u] = Y([]), {
|
|
1668
1671
|
enabled: d,
|
|
1669
|
-
getPredictions:
|
|
1672
|
+
getPredictions: p
|
|
1670
1673
|
} = An({
|
|
1671
1674
|
logger: r,
|
|
1672
1675
|
t: n
|
|
1673
|
-
}), [
|
|
1674
|
-
le(d, "Query state should not be enabled"), E = E.trim(), E !== (
|
|
1676
|
+
}), [w, v] = Y(d ? "query" : "manual"), [h, k] = Y(""), [y, A] = Y(), S = (E) => {
|
|
1677
|
+
le(d, "Query state should not be enabled"), E = E.trim(), E !== (h == null ? void 0 : h.trim()) && (k(E), E === "" && u([]), A(void 0), p(E).then((g) => {
|
|
1675
1678
|
if (g.ok === !1) {
|
|
1676
1679
|
u([]), A(g.error);
|
|
1677
1680
|
return;
|
|
@@ -1679,7 +1682,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1679
1682
|
u(g.data);
|
|
1680
1683
|
}));
|
|
1681
1684
|
};
|
|
1682
|
-
switch (
|
|
1685
|
+
switch (w) {
|
|
1683
1686
|
case "query":
|
|
1684
1687
|
return le(d, "Query state should not be enabled"), l(In, {
|
|
1685
1688
|
input: e,
|
|
@@ -1689,14 +1692,14 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1689
1692
|
a(void 0), v("manual");
|
|
1690
1693
|
return;
|
|
1691
1694
|
}
|
|
1692
|
-
const g = i.find((
|
|
1695
|
+
const g = i.find((M) => M.id === E);
|
|
1693
1696
|
g && (a(g.address), v("details"));
|
|
1694
1697
|
},
|
|
1695
1698
|
onAddressSearch: (E) => {
|
|
1696
1699
|
S(E);
|
|
1697
1700
|
},
|
|
1698
1701
|
suggestions: i,
|
|
1699
|
-
query:
|
|
1702
|
+
query: h,
|
|
1700
1703
|
error: y
|
|
1701
1704
|
});
|
|
1702
1705
|
case "details":
|
|
@@ -1705,7 +1708,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1705
1708
|
logger: r,
|
|
1706
1709
|
onSubmitSuccess: t,
|
|
1707
1710
|
addressFields: s,
|
|
1708
|
-
actions: l(
|
|
1711
|
+
actions: l(Nt, {
|
|
1709
1712
|
onClick: () => {
|
|
1710
1713
|
v("query");
|
|
1711
1714
|
}
|
|
@@ -1717,7 +1720,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1717
1720
|
input: e,
|
|
1718
1721
|
onSubmitSuccess: t,
|
|
1719
1722
|
addressFields: {},
|
|
1720
|
-
actions: d ? l(
|
|
1723
|
+
actions: d ? l(Nt, {
|
|
1721
1724
|
onClick: () => {
|
|
1722
1725
|
v("query");
|
|
1723
1726
|
}
|
|
@@ -1741,9 +1744,9 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1741
1744
|
}, []), l(ke, {
|
|
1742
1745
|
children: [l("form", {
|
|
1743
1746
|
noValidate: !0,
|
|
1744
|
-
onSubmit: (
|
|
1745
|
-
|
|
1746
|
-
const v = new FormData(
|
|
1747
|
+
onSubmit: (p) => {
|
|
1748
|
+
p.preventDefault();
|
|
1749
|
+
const v = new FormData(p.currentTarget).get("address");
|
|
1747
1750
|
typeof v == "string" && a(v);
|
|
1748
1751
|
},
|
|
1749
1752
|
class: "flex gap-1 p-2.5",
|
|
@@ -1798,15 +1801,15 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1798
1801
|
message: i
|
|
1799
1802
|
}
|
|
1800
1803
|
}) : null, l("ul", {
|
|
1801
|
-
children: [r.map((
|
|
1804
|
+
children: [r.map((p) => l("li", {
|
|
1802
1805
|
children: l("button", {
|
|
1803
1806
|
class: "text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",
|
|
1804
1807
|
onClick: () => {
|
|
1805
|
-
n(
|
|
1808
|
+
n(p.id);
|
|
1806
1809
|
},
|
|
1807
1810
|
children: [l("span", {
|
|
1808
1811
|
class: "flex-grow",
|
|
1809
|
-
children:
|
|
1812
|
+
children: p.label
|
|
1810
1813
|
}), l("svg", {
|
|
1811
1814
|
class: "flex-none",
|
|
1812
1815
|
width: "16",
|
|
@@ -1821,7 +1824,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1821
1824
|
})
|
|
1822
1825
|
})]
|
|
1823
1826
|
})
|
|
1824
|
-
},
|
|
1827
|
+
}, p.id)), l("li", {
|
|
1825
1828
|
children: l("button", {
|
|
1826
1829
|
class: "text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",
|
|
1827
1830
|
onClick: () => {
|
|
@@ -1854,20 +1857,20 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1854
1857
|
return l("form", {
|
|
1855
1858
|
class: "bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",
|
|
1856
1859
|
onSubmit: (u) => {
|
|
1857
|
-
const d = new FormData(u.currentTarget),
|
|
1860
|
+
const d = new FormData(u.currentTarget), p = Object.fromEntries(d.entries());
|
|
1858
1861
|
t({
|
|
1859
1862
|
type: "address",
|
|
1860
|
-
value:
|
|
1863
|
+
value: p
|
|
1861
1864
|
});
|
|
1862
1865
|
},
|
|
1863
1866
|
children: [l("div", {
|
|
1864
1867
|
class: "bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",
|
|
1865
1868
|
ref: s,
|
|
1866
1869
|
children: Tt.map((u, d) => {
|
|
1867
|
-
const
|
|
1868
|
-
return
|
|
1870
|
+
const p = `isdk_${u}`, w = n.config.keys[u];
|
|
1871
|
+
return w ? l(ke, {
|
|
1869
1872
|
children: [l("label", {
|
|
1870
|
-
for:
|
|
1873
|
+
for: p,
|
|
1871
1874
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1872
1875
|
children: i(u)
|
|
1873
1876
|
}), l("div", {
|
|
@@ -1876,8 +1879,8 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1876
1879
|
class: "relative",
|
|
1877
1880
|
children: [l("select", {
|
|
1878
1881
|
class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",
|
|
1879
|
-
name:
|
|
1880
|
-
id:
|
|
1882
|
+
name: w,
|
|
1883
|
+
id: p,
|
|
1881
1884
|
defaultValue: e[u],
|
|
1882
1885
|
required: !0,
|
|
1883
1886
|
children: [e.country && !a.includes(e.country) ? l("option", {
|
|
@@ -1908,8 +1911,8 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1908
1911
|
}) : l("input", {
|
|
1909
1912
|
autoFocus: d === 0 ? !0 : void 0,
|
|
1910
1913
|
class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",
|
|
1911
|
-
name:
|
|
1912
|
-
id:
|
|
1914
|
+
name: w,
|
|
1915
|
+
id: p,
|
|
1913
1916
|
defaultValue: e[u],
|
|
1914
1917
|
required: !0
|
|
1915
1918
|
}), d === Tt.length - 1 ? l("hr", {
|
|
@@ -1947,7 +1950,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1947
1950
|
class: "truncate text-center text-base",
|
|
1948
1951
|
children: e
|
|
1949
1952
|
})
|
|
1950
|
-
})),
|
|
1953
|
+
})), Ln = ({
|
|
1951
1954
|
input: e,
|
|
1952
1955
|
onSubmitSuccess: t
|
|
1953
1956
|
}) => {
|
|
@@ -1957,7 +1960,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1957
1960
|
class: "",
|
|
1958
1961
|
onSubmit: (n) => {
|
|
1959
1962
|
n.preventDefault();
|
|
1960
|
-
const s =
|
|
1963
|
+
const s = Nr(n).value, a = nr(Mn, s);
|
|
1961
1964
|
t({
|
|
1962
1965
|
type: "boolean",
|
|
1963
1966
|
value: a === "true"
|
|
@@ -1984,7 +1987,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1984
1987
|
})
|
|
1985
1988
|
})]
|
|
1986
1989
|
});
|
|
1987
|
-
},
|
|
1990
|
+
}, Nn = (e) => new Promise((t, r) => {
|
|
1988
1991
|
const n = new FileReader();
|
|
1989
1992
|
n.readAsDataURL(e), n.onload = () => n.result ? t(n.result.toString()) : r("No result from reader"), n.onerror = r;
|
|
1990
1993
|
}), Tn = (e) => e.reduce((t, r) => t + r.sizeKb, 0), Dn = Se("file"), Rt = 3, Rn = ({
|
|
@@ -2008,7 +2011,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2008
2011
|
}), l("p", {
|
|
2009
2012
|
"aria-label": "File size",
|
|
2010
2013
|
class: "text-accent-11",
|
|
2011
|
-
children:
|
|
2014
|
+
children: Ne(e.sizeKb)
|
|
2012
2015
|
})]
|
|
2013
2016
|
});
|
|
2014
2017
|
}, Ot = ({
|
|
@@ -2036,28 +2039,28 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2036
2039
|
onSubmitSuccess: t
|
|
2037
2040
|
}) => {
|
|
2038
2041
|
var v;
|
|
2039
|
-
const r = (v = I.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n, s] = Y(Dn(r) ? r.value : []), [a, i] = Y(), u = n.length - Rt, d = Tn(n),
|
|
2040
|
-
t:
|
|
2042
|
+
const r = (v = I.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n, s] = Y(Dn(r) ? r.value : []), [a, i] = Y(), u = n.length - Rt, d = Tn(n), p = gt(), {
|
|
2043
|
+
t: w
|
|
2041
2044
|
} = G();
|
|
2042
2045
|
return l("form", {
|
|
2043
2046
|
class: "flex flex-col gap-1 p-2.5",
|
|
2044
|
-
onSubmit: (
|
|
2047
|
+
onSubmit: (h) => (h.preventDefault(), i(void 0), n.length === 0 ? i({
|
|
2045
2048
|
type: "required",
|
|
2046
|
-
message:
|
|
2049
|
+
message: w("validation_file")
|
|
2047
2050
|
}) : e.config.extensions.length > 0 && !On({
|
|
2048
2051
|
allowedExtensions: e.config.extensions,
|
|
2049
2052
|
files: n
|
|
2050
2053
|
}) ? i({
|
|
2051
2054
|
type: "validate",
|
|
2052
|
-
message: `${
|
|
2055
|
+
message: `${w("validation_file_ext", {
|
|
2053
2056
|
ext: e.config.extensions.join(", ")
|
|
2054
2057
|
})}`
|
|
2055
2058
|
}) : e.config.fileSizeLimitKib && d > e.config.fileSizeLimitKib ? i({
|
|
2056
2059
|
type: "max",
|
|
2057
|
-
message: `File size exceeds limit of ${
|
|
2060
|
+
message: `File size exceeds limit of ${Ne(e.config.fileSizeLimitKib)}`
|
|
2058
2061
|
}) : e.config.allowMultiple === !1 && n.length > 1 ? i({
|
|
2059
2062
|
type: "invalid",
|
|
2060
|
-
message:
|
|
2063
|
+
message: w("validation_file_max", {
|
|
2061
2064
|
count: 1
|
|
2062
2065
|
})
|
|
2063
2066
|
}) : t({
|
|
@@ -2067,14 +2070,14 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2067
2070
|
children: [l("div", {
|
|
2068
2071
|
class: "flex items-center gap-2",
|
|
2069
2072
|
children: [l("label", {
|
|
2070
|
-
ref:
|
|
2073
|
+
ref: p,
|
|
2071
2074
|
for: "dropzone-file",
|
|
2072
2075
|
class: "border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",
|
|
2073
2076
|
children: [n.length > 0 ? l(ke, {
|
|
2074
2077
|
children: [l("ul", {
|
|
2075
2078
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2076
|
-
children: [n.slice(0, Rt).map((
|
|
2077
|
-
const k =
|
|
2079
|
+
children: [n.slice(0, Rt).map((h) => {
|
|
2080
|
+
const k = h.name.split(".").pop(), y = h.name.replace(new RegExp(`.${k}$`), "");
|
|
2078
2081
|
return l(Ot, {
|
|
2079
2082
|
class: "flex overflow-hidden",
|
|
2080
2083
|
children: [l("span", {
|
|
@@ -2089,7 +2092,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2089
2092
|
}) : null]
|
|
2090
2093
|
}), l("p", {
|
|
2091
2094
|
class: "text-neutral-11 text-xs",
|
|
2092
|
-
children: [
|
|
2095
|
+
children: [Ne(d), " ", n.length > 1 ? "total" : ""]
|
|
2093
2096
|
})]
|
|
2094
2097
|
}) : l("div", {
|
|
2095
2098
|
class: "flex flex-col justify-center gap-4 pb-6 pt-5",
|
|
@@ -2110,13 +2113,13 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2110
2113
|
})
|
|
2111
2114
|
}), l("p", {
|
|
2112
2115
|
class: "text-neutral-12 tracking-[-0.01em]",
|
|
2113
|
-
children:
|
|
2116
|
+
children: w("upload_file", {
|
|
2114
2117
|
count: e.config.allowMultiple ? 2 : 1
|
|
2115
2118
|
})
|
|
2116
2119
|
}), e.config.fileSizeLimitKib ? l("p", {
|
|
2117
2120
|
class: "text-neutral-10 text-xs",
|
|
2118
|
-
children: ["(",
|
|
2119
|
-
size:
|
|
2121
|
+
children: ["(", w("file_max_size", {
|
|
2122
|
+
size: Ne(e.config.fileSizeLimitKib)
|
|
2120
2123
|
}), ")"]
|
|
2121
2124
|
}) : null]
|
|
2122
2125
|
}), l("aside", {
|
|
@@ -2124,22 +2127,22 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2124
2127
|
children: [l("p", {
|
|
2125
2128
|
id: "accepted-filetypes",
|
|
2126
2129
|
class: "sr-only",
|
|
2127
|
-
children:
|
|
2130
|
+
children: w("file_extensions")
|
|
2128
2131
|
}), l("ul", {
|
|
2129
2132
|
"aria-describedby": "accepted-filetypes",
|
|
2130
2133
|
class: "flex flex-wrap justify-center gap-2",
|
|
2131
|
-
children: e.config.extensions.map((
|
|
2134
|
+
children: e.config.extensions.map((h) => l("li", {
|
|
2132
2135
|
class: "ring-lowest outline-neutral-6 text-neutral-9 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2",
|
|
2133
|
-
children:
|
|
2136
|
+
children: h.replace(".", "")
|
|
2134
2137
|
}))
|
|
2135
2138
|
})]
|
|
2136
2139
|
})]
|
|
2137
2140
|
}), l("input", {
|
|
2138
2141
|
id: "dropzone-file",
|
|
2139
|
-
onInput: async (
|
|
2140
|
-
le(
|
|
2141
|
-
const k =
|
|
2142
|
-
const E = await
|
|
2142
|
+
onInput: async (h) => {
|
|
2143
|
+
le(h.target instanceof HTMLInputElement);
|
|
2144
|
+
const k = h.target.files ? Array.from(h.target.files) : [], y = await Promise.allSettled(k.map(async (S) => {
|
|
2145
|
+
const E = await Nn(S);
|
|
2143
2146
|
return {
|
|
2144
2147
|
name: Bn(S.name, 42),
|
|
2145
2148
|
data: E,
|
|
@@ -2196,11 +2199,11 @@ function oe(e) {
|
|
|
2196
2199
|
return e;
|
|
2197
2200
|
return t;
|
|
2198
2201
|
}
|
|
2199
|
-
var Be = (e) => Array.isArray(e) ? e.filter(Boolean) : [],
|
|
2202
|
+
var Be = (e) => Array.isArray(e) ? e.filter(Boolean) : [], B = (e) => e === void 0, x = (e, t, r) => {
|
|
2200
2203
|
if (!t || !$(e))
|
|
2201
2204
|
return r;
|
|
2202
2205
|
const n = Be(t.split(/[,[\].]+?/)).reduce((s, a) => U(s) ? s : s[a], e);
|
|
2203
|
-
return
|
|
2206
|
+
return B(n) || n === e ? B(e[t]) ? r : e[t] : n;
|
|
2204
2207
|
}, de = (e) => typeof e == "boolean";
|
|
2205
2208
|
const Bt = {
|
|
2206
2209
|
BLUR: "blur",
|
|
@@ -2250,16 +2253,16 @@ function Gn(e) {
|
|
|
2250
2253
|
};
|
|
2251
2254
|
}, [e.disabled]);
|
|
2252
2255
|
}
|
|
2253
|
-
var te = (e) => typeof e == "string", Hn = (e, t, r, n, s) => te(e) ? (n && t.watch.add(e),
|
|
2254
|
-
function
|
|
2256
|
+
var te = (e) => typeof e == "string", Hn = (e, t, r, n, s) => te(e) ? (n && t.watch.add(e), x(r, e, s)) : Array.isArray(e) ? e.map((a) => (n && t.watch.add(a), x(r, a))) : (n && (t.watchAll = !0), r), yt = (e) => /^\w*$/.test(e), hr = (e) => Be(e.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
2257
|
+
function L(e, t, r) {
|
|
2255
2258
|
let n = -1;
|
|
2256
2259
|
const s = yt(t) ? [t] : hr(t), a = s.length, i = a - 1;
|
|
2257
2260
|
for (; ++n < a; ) {
|
|
2258
2261
|
const u = s[n];
|
|
2259
2262
|
let d = r;
|
|
2260
2263
|
if (n !== i) {
|
|
2261
|
-
const
|
|
2262
|
-
d = $(
|
|
2264
|
+
const p = e[u];
|
|
2265
|
+
d = $(p) || Array.isArray(p) ? p : isNaN(+s[n + 1]) ? {} : [];
|
|
2263
2266
|
}
|
|
2264
2267
|
e[u] = d, e = e[u];
|
|
2265
2268
|
}
|
|
@@ -2280,7 +2283,7 @@ var pr = (e, t, r, n, s) => t ? {
|
|
|
2280
2283
|
}), $t = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2281
2284
|
const ze = (e, t, r, n) => {
|
|
2282
2285
|
for (const s of r || Object.keys(e)) {
|
|
2283
|
-
const a =
|
|
2286
|
+
const a = x(e, s);
|
|
2284
2287
|
if (a) {
|
|
2285
2288
|
const { _f: i, ...u } = a;
|
|
2286
2289
|
if (i) {
|
|
@@ -2294,8 +2297,8 @@ const ze = (e, t, r, n) => {
|
|
|
2294
2297
|
}
|
|
2295
2298
|
};
|
|
2296
2299
|
var Wn = (e, t, r) => {
|
|
2297
|
-
const n = Be(
|
|
2298
|
-
return
|
|
2300
|
+
const n = Be(x(e, r));
|
|
2301
|
+
return L(n, "root", t[r]), L(e, r, n), e;
|
|
2299
2302
|
}, vt = (e) => e.type === "file", fe = (e) => typeof e == "function", Ge = (e) => {
|
|
2300
2303
|
if (!bt)
|
|
2301
2304
|
return !1;
|
|
@@ -2314,7 +2317,7 @@ var mr = (e) => {
|
|
|
2314
2317
|
}
|
|
2315
2318
|
return e[0].checked && !e[0].disabled ? (
|
|
2316
2319
|
// @ts-expect-error expected to work in the browser
|
|
2317
|
-
e[0].attributes && !
|
|
2320
|
+
e[0].attributes && !B(e[0].attributes.value) ? B(e[0].value) || e[0].value === "" ? zt : { value: e[0].value, isValid: !0 } : zt
|
|
2318
2321
|
) : jt;
|
|
2319
2322
|
}
|
|
2320
2323
|
return jt;
|
|
@@ -2339,96 +2342,96 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2339
2342
|
value: e,
|
|
2340
2343
|
message: ""
|
|
2341
2344
|
}, Kt = async (e, t, r, n, s) => {
|
|
2342
|
-
const { ref: a, refs: i, required: u, maxLength: d, minLength:
|
|
2345
|
+
const { ref: a, refs: i, required: u, maxLength: d, minLength: p, min: w, max: v, pattern: h, validate: k, name: y, valueAsNumber: A, mount: S, disabled: E } = e._f, g = x(t, y);
|
|
2343
2346
|
if (!S || E)
|
|
2344
2347
|
return {};
|
|
2345
|
-
const
|
|
2346
|
-
n &&
|
|
2347
|
-
},
|
|
2348
|
-
const X =
|
|
2349
|
-
|
|
2350
|
-
type:
|
|
2348
|
+
const M = i ? i[0] : a, R = (F) => {
|
|
2349
|
+
n && M.reportValidity && (M.setCustomValidity(de(F) ? "" : F || ""), M.reportValidity());
|
|
2350
|
+
}, N = {}, me = xt(a), ce = Oe(a), Ee = me || ce, H = (A || vt(a)) && B(a.value) && B(g) || Ge(a) && a.value === "" || g === "" || Array.isArray(g) && !g.length, se = pr.bind(null, y, r, N), q = (F, V, O, K = ie.maxLength, W = ie.minLength) => {
|
|
2351
|
+
const X = F ? V : O;
|
|
2352
|
+
N[y] = {
|
|
2353
|
+
type: F ? K : W,
|
|
2351
2354
|
message: X,
|
|
2352
2355
|
ref: a,
|
|
2353
|
-
...se(
|
|
2356
|
+
...se(F ? K : W, X)
|
|
2354
2357
|
};
|
|
2355
2358
|
};
|
|
2356
2359
|
if (s ? !Array.isArray(g) || !g.length : u && (!Ee && (H || U(g)) || de(g) && !g || ce && !mr(i).isValid || me && !gr(i).isValid)) {
|
|
2357
|
-
const { value:
|
|
2358
|
-
if (
|
|
2360
|
+
const { value: F, message: V } = qe(u) ? { value: !!u, message: u } : we(u);
|
|
2361
|
+
if (F && (N[y] = {
|
|
2359
2362
|
type: ie.required,
|
|
2360
2363
|
message: V,
|
|
2361
|
-
ref:
|
|
2364
|
+
ref: M,
|
|
2362
2365
|
...se(ie.required, V)
|
|
2363
2366
|
}, !r))
|
|
2364
|
-
return
|
|
2367
|
+
return R(V), N;
|
|
2365
2368
|
}
|
|
2366
|
-
if (!H && (!U(
|
|
2367
|
-
let
|
|
2368
|
-
const
|
|
2369
|
+
if (!H && (!U(w) || !U(v))) {
|
|
2370
|
+
let F, V;
|
|
2371
|
+
const O = we(v), K = we(w);
|
|
2369
2372
|
if (!U(g) && !isNaN(g)) {
|
|
2370
2373
|
const W = a.valueAsNumber || g && +g;
|
|
2371
|
-
U(
|
|
2374
|
+
U(O.value) || (F = W > O.value), U(K.value) || (V = W < K.value);
|
|
2372
2375
|
} else {
|
|
2373
2376
|
const W = a.valueAsDate || new Date(g), X = (Pe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Pe), ge = a.type == "time", Ae = a.type == "week";
|
|
2374
|
-
te(
|
|
2377
|
+
te(O.value) && g && (F = ge ? X(g) > X(O.value) : Ae ? g > O.value : W > new Date(O.value)), te(K.value) && g && (V = ge ? X(g) < X(K.value) : Ae ? g < K.value : W < new Date(K.value));
|
|
2375
2378
|
}
|
|
2376
|
-
if ((
|
|
2377
|
-
return
|
|
2379
|
+
if ((F || V) && (q(!!F, O.message, K.message, ie.max, ie.min), !r))
|
|
2380
|
+
return R(N[y].message), N;
|
|
2378
2381
|
}
|
|
2379
|
-
if ((d ||
|
|
2380
|
-
const
|
|
2381
|
-
if ((
|
|
2382
|
-
return
|
|
2382
|
+
if ((d || p) && !H && (te(g) || s && Array.isArray(g))) {
|
|
2383
|
+
const F = we(d), V = we(p), O = !U(F.value) && g.length > +F.value, K = !U(V.value) && g.length < +V.value;
|
|
2384
|
+
if ((O || K) && (q(O, F.message, V.message), !r))
|
|
2385
|
+
return R(N[y].message), N;
|
|
2383
2386
|
}
|
|
2384
|
-
if (
|
|
2385
|
-
const { value:
|
|
2386
|
-
if (He(
|
|
2387
|
+
if (h && !H && te(g)) {
|
|
2388
|
+
const { value: F, message: V } = we(h);
|
|
2389
|
+
if (He(F) && !g.match(F) && (N[y] = {
|
|
2387
2390
|
type: ie.pattern,
|
|
2388
2391
|
message: V,
|
|
2389
2392
|
ref: a,
|
|
2390
2393
|
...se(ie.pattern, V)
|
|
2391
2394
|
}, !r))
|
|
2392
|
-
return
|
|
2395
|
+
return R(V), N;
|
|
2393
2396
|
}
|
|
2394
2397
|
if (k) {
|
|
2395
2398
|
if (fe(k)) {
|
|
2396
|
-
const
|
|
2397
|
-
if (V && (
|
|
2399
|
+
const F = await k(g, t), V = Ut(F, M);
|
|
2400
|
+
if (V && (N[y] = {
|
|
2398
2401
|
...V,
|
|
2399
2402
|
...se(ie.validate, V.message)
|
|
2400
2403
|
}, !r))
|
|
2401
|
-
return
|
|
2404
|
+
return R(V.message), N;
|
|
2402
2405
|
} else if ($(k)) {
|
|
2403
|
-
let
|
|
2406
|
+
let F = {};
|
|
2404
2407
|
for (const V in k) {
|
|
2405
|
-
if (!J(
|
|
2408
|
+
if (!J(F) && !r)
|
|
2406
2409
|
break;
|
|
2407
|
-
const
|
|
2408
|
-
|
|
2409
|
-
...
|
|
2410
|
-
...se(V,
|
|
2411
|
-
},
|
|
2410
|
+
const O = Ut(await k[V](g, t), M, V);
|
|
2411
|
+
O && (F = {
|
|
2412
|
+
...O,
|
|
2413
|
+
...se(V, O.message)
|
|
2414
|
+
}, R(O.message), r && (N[y] = F));
|
|
2412
2415
|
}
|
|
2413
|
-
if (!J(
|
|
2414
|
-
ref:
|
|
2415
|
-
...
|
|
2416
|
+
if (!J(F) && (N[y] = {
|
|
2417
|
+
ref: M,
|
|
2418
|
+
...F
|
|
2416
2419
|
}, !r))
|
|
2417
|
-
return
|
|
2420
|
+
return N;
|
|
2418
2421
|
}
|
|
2419
2422
|
}
|
|
2420
|
-
return
|
|
2423
|
+
return R(!0), N;
|
|
2421
2424
|
};
|
|
2422
2425
|
function Jn(e, t) {
|
|
2423
2426
|
const r = t.slice(0, -1).length;
|
|
2424
2427
|
let n = 0;
|
|
2425
2428
|
for (; n < r; )
|
|
2426
|
-
e =
|
|
2429
|
+
e = B(e) ? n++ : e[t[n++]];
|
|
2427
2430
|
return e;
|
|
2428
2431
|
}
|
|
2429
2432
|
function Zn(e) {
|
|
2430
2433
|
for (const t in e)
|
|
2431
|
-
if (e.hasOwnProperty(t) && !
|
|
2434
|
+
if (e.hasOwnProperty(t) && !B(e[t]))
|
|
2432
2435
|
return !1;
|
|
2433
2436
|
return !0;
|
|
2434
2437
|
}
|
|
@@ -2494,20 +2497,20 @@ function vr(e, t, r) {
|
|
|
2494
2497
|
const n = Array.isArray(e);
|
|
2495
2498
|
if ($(e) || n)
|
|
2496
2499
|
for (const s in e)
|
|
2497
|
-
Array.isArray(e[s]) || $(e[s]) && !yr(e[s]) ?
|
|
2500
|
+
Array.isArray(e[s]) || $(e[s]) && !yr(e[s]) ? B(t) || We(r[s]) ? r[s] = Array.isArray(e[s]) ? Je(e[s], []) : { ...Je(e[s]) } : vr(e[s], U(t) ? {} : t[s], r[s]) : r[s] = !be(e[s], t[s]);
|
|
2498
2501
|
return r;
|
|
2499
2502
|
}
|
|
2500
|
-
var ut = (e, t) => vr(e, t, Je(t)), xr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) =>
|
|
2503
|
+
var ut = (e, t) => vr(e, t, Je(t)), xr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) => B(e) ? e : t ? e === "" ? NaN : e && +e : r && te(e) ? new Date(e) : n ? n(e) : e;
|
|
2501
2504
|
function ct(e) {
|
|
2502
2505
|
const t = e.ref;
|
|
2503
2506
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : t.disabled))
|
|
2504
|
-
return vt(t) ? t.files : xt(t) ? gr(e.refs).value : br(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Oe(t) ? mr(e.refs).value : xr(
|
|
2507
|
+
return vt(t) ? t.files : xt(t) ? gr(e.refs).value : br(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Oe(t) ? mr(e.refs).value : xr(B(t.value) ? e.ref.value : t.value, e);
|
|
2505
2508
|
}
|
|
2506
2509
|
var Qn = (e, t, r, n) => {
|
|
2507
2510
|
const s = {};
|
|
2508
2511
|
for (const a of e) {
|
|
2509
|
-
const i =
|
|
2510
|
-
i &&
|
|
2512
|
+
const i = x(t, a);
|
|
2513
|
+
i && L(s, a, i._f);
|
|
2511
2514
|
}
|
|
2512
2515
|
return {
|
|
2513
2516
|
criteriaMode: r,
|
|
@@ -2515,9 +2518,9 @@ var Qn = (e, t, r, n) => {
|
|
|
2515
2518
|
fields: s,
|
|
2516
2519
|
shouldUseNativeValidation: n
|
|
2517
2520
|
};
|
|
2518
|
-
}, Ie = (e) =>
|
|
2521
|
+
}, Ie = (e) => B(e) ? e : He(e) ? e.source : $(e) ? He(e.value) ? e.value.source : e.value : e, Yn = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
2519
2522
|
function Gt(e, t, r) {
|
|
2520
|
-
const n =
|
|
2523
|
+
const n = x(e, r);
|
|
2521
2524
|
if (n || yt(r))
|
|
2522
2525
|
return {
|
|
2523
2526
|
error: n,
|
|
@@ -2525,7 +2528,7 @@ function Gt(e, t, r) {
|
|
|
2525
2528
|
};
|
|
2526
2529
|
const s = r.split(".");
|
|
2527
2530
|
for (; s.length; ) {
|
|
2528
|
-
const a = s.join("."), i =
|
|
2531
|
+
const a = s.join("."), i = x(t, a), u = x(e, a);
|
|
2529
2532
|
if (i && !Array.isArray(i) && r !== a)
|
|
2530
2533
|
return { name: r };
|
|
2531
2534
|
if (u && u.type)
|
|
@@ -2539,7 +2542,7 @@ function Gt(e, t, r) {
|
|
|
2539
2542
|
name: r
|
|
2540
2543
|
};
|
|
2541
2544
|
}
|
|
2542
|
-
var es = (e, t, r, n, s) => s.isOnAll ? !1 : !r && s.isOnTouch ? !(t || e) : (r ? n.isOnBlur : s.isOnBlur) ? !e : (r ? n.isOnChange : s.isOnChange) ? e : !0, ts = (e, t) => !Be(
|
|
2545
|
+
var es = (e, t, r, n, s) => s.isOnAll ? !1 : !r && s.isOnTouch ? !(t || e) : (r ? n.isOnBlur : s.isOnBlur) ? !e : (r ? n.isOnChange : s.isOnChange) ? e : !0, ts = (e, t) => !Be(x(e, t)).length && j(e, t);
|
|
2543
2546
|
const rs = {
|
|
2544
2547
|
mode: Z.onSubmit,
|
|
2545
2548
|
reValidateMode: Z.onChange,
|
|
@@ -2571,7 +2574,7 @@ function ns(e = {}, t) {
|
|
|
2571
2574
|
unMount: /* @__PURE__ */ new Set(),
|
|
2572
2575
|
array: /* @__PURE__ */ new Set(),
|
|
2573
2576
|
watch: /* @__PURE__ */ new Set()
|
|
2574
|
-
},
|
|
2577
|
+
}, p, w = 0;
|
|
2575
2578
|
const v = {
|
|
2576
2579
|
isDirty: !1,
|
|
2577
2580
|
dirtyFields: !1,
|
|
@@ -2579,36 +2582,36 @@ function ns(e = {}, t) {
|
|
|
2579
2582
|
isValidating: !1,
|
|
2580
2583
|
isValid: !1,
|
|
2581
2584
|
errors: !1
|
|
2582
|
-
},
|
|
2585
|
+
}, h = {
|
|
2583
2586
|
values: ot(),
|
|
2584
2587
|
array: ot(),
|
|
2585
2588
|
state: ot()
|
|
2586
2589
|
}, k = e.resetOptions && e.resetOptions.keepDirtyValues, y = Pt(r.mode), A = Pt(r.reValidateMode), S = r.criteriaMode === Z.all, E = (o) => (c) => {
|
|
2587
|
-
clearTimeout(
|
|
2590
|
+
clearTimeout(w), w = setTimeout(o, c);
|
|
2588
2591
|
}, g = async (o) => {
|
|
2589
2592
|
if (v.isValid || o) {
|
|
2590
2593
|
const c = r.resolver ? J((await H()).errors) : await q(s, !0);
|
|
2591
|
-
c !== n.isValid &&
|
|
2594
|
+
c !== n.isValid && h.state.next({
|
|
2592
2595
|
isValid: c
|
|
2593
2596
|
});
|
|
2594
2597
|
}
|
|
2595
|
-
},
|
|
2598
|
+
}, M = (o) => v.isValidating && h.state.next({
|
|
2596
2599
|
isValidating: o
|
|
2597
|
-
}),
|
|
2600
|
+
}), R = (o, c = [], f, _, b = !0, m = !0) => {
|
|
2598
2601
|
if (_ && f) {
|
|
2599
|
-
if (u.action = !0, m && Array.isArray(
|
|
2600
|
-
const C = f(
|
|
2601
|
-
b &&
|
|
2602
|
+
if (u.action = !0, m && Array.isArray(x(s, o))) {
|
|
2603
|
+
const C = f(x(s, o), _.argA, _.argB);
|
|
2604
|
+
b && L(s, o, C);
|
|
2602
2605
|
}
|
|
2603
|
-
if (m && Array.isArray(
|
|
2604
|
-
const C = f(
|
|
2605
|
-
b &&
|
|
2606
|
+
if (m && Array.isArray(x(n.errors, o))) {
|
|
2607
|
+
const C = f(x(n.errors, o), _.argA, _.argB);
|
|
2608
|
+
b && L(n.errors, o, C), ts(n.errors, o);
|
|
2606
2609
|
}
|
|
2607
|
-
if (v.touchedFields && m && Array.isArray(
|
|
2608
|
-
const C = f(
|
|
2609
|
-
b &&
|
|
2610
|
+
if (v.touchedFields && m && Array.isArray(x(n.touchedFields, o))) {
|
|
2611
|
+
const C = f(x(n.touchedFields, o), _.argA, _.argB);
|
|
2612
|
+
b && L(n.touchedFields, o, C);
|
|
2610
2613
|
}
|
|
2611
|
-
v.dirtyFields && (n.dirtyFields = ut(a, i)),
|
|
2614
|
+
v.dirtyFields && (n.dirtyFields = ut(a, i)), h.state.next({
|
|
2612
2615
|
name: o,
|
|
2613
2616
|
isDirty: V(o, c),
|
|
2614
2617
|
dirtyFields: n.dirtyFields,
|
|
@@ -2616,35 +2619,35 @@ function ns(e = {}, t) {
|
|
|
2616
2619
|
isValid: n.isValid
|
|
2617
2620
|
});
|
|
2618
2621
|
} else
|
|
2619
|
-
|
|
2620
|
-
},
|
|
2621
|
-
|
|
2622
|
+
L(i, o, c);
|
|
2623
|
+
}, N = (o, c) => {
|
|
2624
|
+
L(n.errors, o, c), h.state.next({
|
|
2622
2625
|
errors: n.errors
|
|
2623
2626
|
});
|
|
2624
2627
|
}, me = (o, c, f, _) => {
|
|
2625
|
-
const b =
|
|
2628
|
+
const b = x(s, o);
|
|
2626
2629
|
if (b) {
|
|
2627
|
-
const m =
|
|
2628
|
-
|
|
2630
|
+
const m = x(i, o, B(f) ? x(a, o) : f);
|
|
2631
|
+
B(m) || _ && _.defaultChecked || c ? L(i, o, c ? m : ct(b._f)) : W(o, m), u.mount && g();
|
|
2629
2632
|
}
|
|
2630
2633
|
}, ce = (o, c, f, _, b) => {
|
|
2631
2634
|
let m = !1, C = !1;
|
|
2632
|
-
const
|
|
2635
|
+
const T = {
|
|
2633
2636
|
name: o
|
|
2634
2637
|
};
|
|
2635
2638
|
if (!f || _) {
|
|
2636
|
-
v.isDirty && (C = n.isDirty, n.isDirty =
|
|
2637
|
-
const
|
|
2638
|
-
C =
|
|
2639
|
+
v.isDirty && (C = n.isDirty, n.isDirty = T.isDirty = V(), m = C !== T.isDirty);
|
|
2640
|
+
const P = be(x(a, o), c);
|
|
2641
|
+
C = x(n.dirtyFields, o), P ? j(n.dirtyFields, o) : L(n.dirtyFields, o, !0), T.dirtyFields = n.dirtyFields, m = m || v.dirtyFields && C !== !P;
|
|
2639
2642
|
}
|
|
2640
2643
|
if (f) {
|
|
2641
|
-
const
|
|
2642
|
-
|
|
2644
|
+
const P = x(n.touchedFields, o);
|
|
2645
|
+
P || (L(n.touchedFields, o, f), T.touchedFields = n.touchedFields, m = m || v.touchedFields && P !== f);
|
|
2643
2646
|
}
|
|
2644
|
-
return m && b &&
|
|
2647
|
+
return m && b && h.state.next(T), m ? T : {};
|
|
2645
2648
|
}, Ee = (o, c, f, _) => {
|
|
2646
|
-
const b =
|
|
2647
|
-
if (e.delayError && f ? (
|
|
2649
|
+
const b = x(n.errors, o), m = v.isValid && de(c) && n.isValid !== c;
|
|
2650
|
+
if (e.delayError && f ? (p = E(() => N(o, f)), p(e.delayError)) : (clearTimeout(w), p = null, f ? L(n.errors, o, f) : j(n.errors, o)), (f ? !be(b, f) : b) || !J(_) || m) {
|
|
2648
2651
|
const C = {
|
|
2649
2652
|
..._,
|
|
2650
2653
|
...m && de(c) ? { isValid: c } : {},
|
|
@@ -2654,15 +2657,15 @@ function ns(e = {}, t) {
|
|
|
2654
2657
|
n = {
|
|
2655
2658
|
...n,
|
|
2656
2659
|
...C
|
|
2657
|
-
},
|
|
2660
|
+
}, h.state.next(C);
|
|
2658
2661
|
}
|
|
2659
|
-
|
|
2662
|
+
M(!1);
|
|
2660
2663
|
}, H = async (o) => r.resolver(i, r.context, Qn(o || d.mount, s, r.criteriaMode, r.shouldUseNativeValidation)), se = async (o) => {
|
|
2661
2664
|
const { errors: c } = await H(o);
|
|
2662
2665
|
if (o)
|
|
2663
2666
|
for (const f of o) {
|
|
2664
|
-
const _ =
|
|
2665
|
-
_ ?
|
|
2667
|
+
const _ = x(c, f);
|
|
2668
|
+
_ ? L(n.errors, f, _) : j(n.errors, f);
|
|
2666
2669
|
}
|
|
2667
2670
|
else
|
|
2668
2671
|
n.errors = c;
|
|
@@ -2675,29 +2678,29 @@ function ns(e = {}, t) {
|
|
|
2675
2678
|
if (b) {
|
|
2676
2679
|
const { _f: m, ...C } = b;
|
|
2677
2680
|
if (m) {
|
|
2678
|
-
const
|
|
2679
|
-
if (
|
|
2681
|
+
const T = d.array.has(m.name), P = await Kt(b, i, S, r.shouldUseNativeValidation && !c, T);
|
|
2682
|
+
if (P[m.name] && (f.valid = !1, c))
|
|
2680
2683
|
break;
|
|
2681
|
-
!c && (
|
|
2684
|
+
!c && (x(P, m.name) ? T ? Wn(n.errors, P, m.name) : L(n.errors, m.name, P[m.name]) : j(n.errors, m.name));
|
|
2682
2685
|
}
|
|
2683
2686
|
C && await q(C, c, f);
|
|
2684
2687
|
}
|
|
2685
2688
|
}
|
|
2686
2689
|
return f.valid;
|
|
2687
|
-
},
|
|
2690
|
+
}, F = () => {
|
|
2688
2691
|
for (const o of d.unMount) {
|
|
2689
|
-
const c =
|
|
2692
|
+
const c = x(s, o);
|
|
2690
2693
|
c && (c._f.refs ? c._f.refs.every((f) => !lt(f)) : !lt(c._f.ref)) && tt(o);
|
|
2691
2694
|
}
|
|
2692
2695
|
d.unMount = /* @__PURE__ */ new Set();
|
|
2693
|
-
}, V = (o, c) => (o && c &&
|
|
2694
|
-
...u.mount ? i :
|
|
2695
|
-
}, f, c), K = (o) => Be(
|
|
2696
|
-
const _ =
|
|
2696
|
+
}, V = (o, c) => (o && c && L(i, o, c), !be(wt(), a)), O = (o, c, f) => Hn(o, d, {
|
|
2697
|
+
...u.mount ? i : B(c) ? a : te(o) ? { [o]: c } : c
|
|
2698
|
+
}, f, c), K = (o) => Be(x(u.mount ? i : a, o, e.shouldUnregister ? x(a, o, []) : [])), W = (o, c, f = {}) => {
|
|
2699
|
+
const _ = x(s, o);
|
|
2697
2700
|
let b = c;
|
|
2698
2701
|
if (_) {
|
|
2699
2702
|
const m = _._f;
|
|
2700
|
-
m && (!m.disabled &&
|
|
2703
|
+
m && (!m.disabled && L(i, o, xr(c, m)), b = Ge(m.ref) && U(c) ? "" : c, br(m.ref) ? [...m.ref.options].forEach((C) => C.selected = b.includes(C.value)) : m.refs ? Oe(m.ref) ? m.refs.length > 1 ? m.refs.forEach((C) => (!C.defaultChecked || !C.disabled) && (C.checked = Array.isArray(b) ? !!b.find((T) => T === C.value) : b === C.value)) : m.refs[0] && (m.refs[0].checked = !!b) : m.refs.forEach((C) => C.checked = C.value === b) : vt(m.ref) ? m.ref.value = "" : (m.ref.value = b, m.ref.type || h.values.next({
|
|
2701
2704
|
name: o,
|
|
2702
2705
|
values: { ...i }
|
|
2703
2706
|
})));
|
|
@@ -2705,64 +2708,64 @@ function ns(e = {}, t) {
|
|
|
2705
2708
|
(f.shouldDirty || f.shouldTouch) && ce(o, b, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && et(o);
|
|
2706
2709
|
}, X = (o, c, f) => {
|
|
2707
2710
|
for (const _ in c) {
|
|
2708
|
-
const b = c[_], m = `${o}.${_}`, C =
|
|
2711
|
+
const b = c[_], m = `${o}.${_}`, C = x(s, m);
|
|
2709
2712
|
(d.array.has(o) || !We(b) || C && !C._f) && !_e(b) ? X(m, b, f) : W(m, b, f);
|
|
2710
2713
|
}
|
|
2711
2714
|
}, ge = (o, c, f = {}) => {
|
|
2712
|
-
const _ =
|
|
2713
|
-
|
|
2715
|
+
const _ = x(s, o), b = d.array.has(o), m = oe(c);
|
|
2716
|
+
L(i, o, m), b ? (h.array.next({
|
|
2714
2717
|
name: o,
|
|
2715
2718
|
values: { ...i }
|
|
2716
|
-
}), (v.isDirty || v.dirtyFields) && f.shouldDirty &&
|
|
2719
|
+
}), (v.isDirty || v.dirtyFields) && f.shouldDirty && h.state.next({
|
|
2717
2720
|
name: o,
|
|
2718
2721
|
dirtyFields: ut(a, i),
|
|
2719
2722
|
isDirty: V(o, m)
|
|
2720
|
-
})) : _ && !_._f && !U(m) ? X(o, m, f) : W(o, m, f), $t(o, d) &&
|
|
2723
|
+
})) : _ && !_._f && !U(m) ? X(o, m, f) : W(o, m, f), $t(o, d) && h.state.next({ ...n }), h.values.next({
|
|
2721
2724
|
name: o,
|
|
2722
2725
|
values: { ...i }
|
|
2723
2726
|
}), !u.mount && t();
|
|
2724
2727
|
}, Ae = async (o) => {
|
|
2725
2728
|
const c = o.target;
|
|
2726
2729
|
let f = c.name, _ = !0;
|
|
2727
|
-
const b =
|
|
2728
|
-
_ = Number.isNaN(
|
|
2730
|
+
const b = x(s, f), m = () => c.type ? ct(b._f) : $n(o), C = (T) => {
|
|
2731
|
+
_ = Number.isNaN(T) || T === x(i, f, T);
|
|
2729
2732
|
};
|
|
2730
2733
|
if (b) {
|
|
2731
|
-
let
|
|
2732
|
-
const $e = m(), xe = o.type === Bt.BLUR || o.type === Bt.FOCUS_OUT, Er = !Yn(b._f) && !r.resolver && !
|
|
2733
|
-
|
|
2734
|
+
let T, P;
|
|
2735
|
+
const $e = m(), xe = o.type === Bt.BLUR || o.type === Bt.FOCUS_OUT, Er = !Yn(b._f) && !r.resolver && !x(n.errors, f) && !b._f.deps || es(xe, x(n.touchedFields, f), n.isSubmitted, A, y), nt = $t(f, d, xe);
|
|
2736
|
+
L(i, f, $e), xe ? (b._f.onBlur && b._f.onBlur(o), p && p(0)) : b._f.onChange && b._f.onChange(o);
|
|
2734
2737
|
const st = ce(f, $e, xe, !1), Ar = !J(st) || nt;
|
|
2735
|
-
if (!xe &&
|
|
2738
|
+
if (!xe && h.values.next({
|
|
2736
2739
|
name: f,
|
|
2737
2740
|
type: o.type,
|
|
2738
2741
|
values: { ...i }
|
|
2739
2742
|
}), Er)
|
|
2740
|
-
return v.isValid && g(), Ar &&
|
|
2741
|
-
if (!xe && nt &&
|
|
2743
|
+
return v.isValid && g(), Ar && h.state.next({ name: f, ...nt ? {} : st });
|
|
2744
|
+
if (!xe && nt && h.state.next({ ...n }), M(!0), r.resolver) {
|
|
2742
2745
|
const { errors: It } = await H([f]);
|
|
2743
2746
|
if (C($e), _) {
|
|
2744
2747
|
const Vr = Gt(n.errors, s, f), Mt = Gt(It, s, Vr.name || f);
|
|
2745
|
-
|
|
2748
|
+
T = Mt.error, f = Mt.name, P = J(It);
|
|
2746
2749
|
}
|
|
2747
2750
|
} else
|
|
2748
|
-
|
|
2749
|
-
_ && (b._f.deps && et(b._f.deps), Ee(f,
|
|
2751
|
+
T = (await Kt(b, i, S, r.shouldUseNativeValidation))[f], C($e), _ && (T ? P = !1 : v.isValid && (P = await q(s, !0)));
|
|
2752
|
+
_ && (b._f.deps && et(b._f.deps), Ee(f, P, T, st));
|
|
2750
2753
|
}
|
|
2751
2754
|
}, Pe = (o, c) => {
|
|
2752
|
-
if (
|
|
2755
|
+
if (x(n.errors, c) && o.focus)
|
|
2753
2756
|
return o.focus(), 1;
|
|
2754
2757
|
}, et = async (o, c = {}) => {
|
|
2755
2758
|
let f, _;
|
|
2756
2759
|
const b = it(o);
|
|
2757
|
-
if (
|
|
2758
|
-
const m = await se(
|
|
2759
|
-
f = J(m), _ = o ? !b.some((C) =>
|
|
2760
|
+
if (M(!0), r.resolver) {
|
|
2761
|
+
const m = await se(B(o) ? o : b);
|
|
2762
|
+
f = J(m), _ = o ? !b.some((C) => x(m, C)) : f;
|
|
2760
2763
|
} else
|
|
2761
2764
|
o ? (_ = (await Promise.all(b.map(async (m) => {
|
|
2762
|
-
const C =
|
|
2765
|
+
const C = x(s, m);
|
|
2763
2766
|
return await q(C && C._f ? { [m]: C } : C);
|
|
2764
2767
|
}))).every(Boolean), !(!_ && !n.isValid) && g()) : _ = f = await q(s);
|
|
2765
|
-
return
|
|
2768
|
+
return h.state.next({
|
|
2766
2769
|
...!te(o) || v.isValid && f !== n.isValid ? {} : { name: o },
|
|
2767
2770
|
...r.resolver || !o ? { isValid: f } : {},
|
|
2768
2771
|
errors: n.errors,
|
|
@@ -2773,46 +2776,46 @@ function ns(e = {}, t) {
|
|
|
2773
2776
|
...a,
|
|
2774
2777
|
...u.mount ? i : {}
|
|
2775
2778
|
};
|
|
2776
|
-
return
|
|
2779
|
+
return B(o) ? c : te(o) ? x(c, o) : o.map((f) => x(c, f));
|
|
2777
2780
|
}, _t = (o, c) => ({
|
|
2778
|
-
invalid: !!
|
|
2779
|
-
isDirty: !!
|
|
2780
|
-
isTouched: !!
|
|
2781
|
-
error:
|
|
2781
|
+
invalid: !!x((c || n).errors, o),
|
|
2782
|
+
isDirty: !!x((c || n).dirtyFields, o),
|
|
2783
|
+
isTouched: !!x((c || n).touchedFields, o),
|
|
2784
|
+
error: x((c || n).errors, o)
|
|
2782
2785
|
}), _r = (o) => {
|
|
2783
|
-
o && it(o).forEach((c) => j(n.errors, c)),
|
|
2786
|
+
o && it(o).forEach((c) => j(n.errors, c)), h.state.next({
|
|
2784
2787
|
errors: o ? n.errors : {}
|
|
2785
2788
|
});
|
|
2786
2789
|
}, kt = (o, c, f) => {
|
|
2787
|
-
const _ = (
|
|
2788
|
-
|
|
2790
|
+
const _ = (x(s, o, { _f: {} })._f || {}).ref;
|
|
2791
|
+
L(n.errors, o, {
|
|
2789
2792
|
...c,
|
|
2790
2793
|
ref: _
|
|
2791
|
-
}),
|
|
2794
|
+
}), h.state.next({
|
|
2792
2795
|
name: o,
|
|
2793
2796
|
errors: n.errors,
|
|
2794
2797
|
isValid: !1
|
|
2795
2798
|
}), f && f.shouldFocus && _ && _.focus && _.focus();
|
|
2796
|
-
}, kr = (o, c) => fe(o) ?
|
|
2797
|
-
next: (f) => o(
|
|
2798
|
-
}) :
|
|
2799
|
+
}, kr = (o, c) => fe(o) ? h.values.subscribe({
|
|
2800
|
+
next: (f) => o(O(void 0, c), f)
|
|
2801
|
+
}) : O(o, c, !0), tt = (o, c = {}) => {
|
|
2799
2802
|
for (const f of o ? it(o) : d.mount)
|
|
2800
2803
|
d.mount.delete(f), d.array.delete(f), c.keepValue || (j(s, f), j(i, f)), !c.keepError && j(n.errors, f), !c.keepDirty && j(n.dirtyFields, f), !c.keepTouched && j(n.touchedFields, f), !r.shouldUnregister && !c.keepDefaultValue && j(a, f);
|
|
2801
|
-
|
|
2804
|
+
h.values.next({
|
|
2802
2805
|
values: { ...i }
|
|
2803
|
-
}),
|
|
2806
|
+
}), h.state.next({
|
|
2804
2807
|
...n,
|
|
2805
2808
|
...c.keepDirty ? { isDirty: V() } : {}
|
|
2806
2809
|
}), !c.keepIsValid && g();
|
|
2807
2810
|
}, St = ({ disabled: o, name: c, field: f, fields: _, value: b }) => {
|
|
2808
2811
|
if (de(o)) {
|
|
2809
|
-
const m = o ? void 0 :
|
|
2810
|
-
|
|
2812
|
+
const m = o ? void 0 : B(b) ? ct(f ? f._f : x(_, c)._f) : b;
|
|
2813
|
+
L(i, c, m), ce(c, m, !1, !1, !0);
|
|
2811
2814
|
}
|
|
2812
2815
|
}, rt = (o, c = {}) => {
|
|
2813
|
-
let f =
|
|
2816
|
+
let f = x(s, o);
|
|
2814
2817
|
const _ = de(c.disabled);
|
|
2815
|
-
return
|
|
2818
|
+
return L(s, o, {
|
|
2816
2819
|
...f || {},
|
|
2817
2820
|
_f: {
|
|
2818
2821
|
...f && f._f ? f._f : { ref: { name: o } },
|
|
@@ -2839,44 +2842,44 @@ function ns(e = {}, t) {
|
|
|
2839
2842
|
onBlur: Ae,
|
|
2840
2843
|
ref: (b) => {
|
|
2841
2844
|
if (b) {
|
|
2842
|
-
rt(o, c), f =
|
|
2843
|
-
const m =
|
|
2844
|
-
if (C ?
|
|
2845
|
+
rt(o, c), f = x(s, o);
|
|
2846
|
+
const m = B(b.value) && b.querySelectorAll && b.querySelectorAll("input,select,textarea")[0] || b, C = Xn(m), T = f._f.refs || [];
|
|
2847
|
+
if (C ? T.find((P) => P === m) : m === f._f.ref)
|
|
2845
2848
|
return;
|
|
2846
|
-
|
|
2849
|
+
L(s, o, {
|
|
2847
2850
|
_f: {
|
|
2848
2851
|
...f._f,
|
|
2849
2852
|
...C ? {
|
|
2850
2853
|
refs: [
|
|
2851
|
-
...
|
|
2854
|
+
...T.filter(lt),
|
|
2852
2855
|
m,
|
|
2853
|
-
...Array.isArray(
|
|
2856
|
+
...Array.isArray(x(a, o)) ? [{}] : []
|
|
2854
2857
|
],
|
|
2855
2858
|
ref: { type: m.type, name: o }
|
|
2856
2859
|
} : { ref: m }
|
|
2857
2860
|
}
|
|
2858
2861
|
}), me(o, !1, void 0, m);
|
|
2859
2862
|
} else
|
|
2860
|
-
f =
|
|
2863
|
+
f = x(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || c.shouldUnregister) && !(zn(d.array, o) && u.action) && d.unMount.add(o);
|
|
2861
2864
|
}
|
|
2862
2865
|
};
|
|
2863
2866
|
}, Ct = () => r.shouldFocusError && ze(s, Pe, d.mount), Sr = (o) => {
|
|
2864
|
-
de(o) && (
|
|
2867
|
+
de(o) && (h.state.next({ disabled: o }), ze(s, (c) => {
|
|
2865
2868
|
c.disabled = o;
|
|
2866
2869
|
}, 0, !1));
|
|
2867
2870
|
}, Et = (o, c) => async (f) => {
|
|
2868
2871
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
2869
2872
|
let _ = oe(i);
|
|
2870
|
-
if (
|
|
2873
|
+
if (h.state.next({
|
|
2871
2874
|
isSubmitting: !0
|
|
2872
2875
|
}), r.resolver) {
|
|
2873
2876
|
const { errors: b, values: m } = await H();
|
|
2874
2877
|
n.errors = b, _ = m;
|
|
2875
2878
|
} else
|
|
2876
2879
|
await q(s);
|
|
2877
|
-
j(n.errors, "root"), J(n.errors) ? (
|
|
2880
|
+
j(n.errors, "root"), J(n.errors) ? (h.state.next({
|
|
2878
2881
|
errors: {}
|
|
2879
|
-
}), await o(_, f)) : (c && await c({ ...n.errors }, f), Ct(), setTimeout(Ct)),
|
|
2882
|
+
}), await o(_, f)) : (c && await c({ ...n.errors }, f), Ct(), setTimeout(Ct)), h.state.next({
|
|
2880
2883
|
isSubmitted: !0,
|
|
2881
2884
|
isSubmitting: !1,
|
|
2882
2885
|
isSubmitSuccessful: J(n.errors),
|
|
@@ -2884,23 +2887,23 @@ function ns(e = {}, t) {
|
|
|
2884
2887
|
errors: n.errors
|
|
2885
2888
|
});
|
|
2886
2889
|
}, Cr = (o, c = {}) => {
|
|
2887
|
-
|
|
2890
|
+
x(s, o) && (B(c.defaultValue) ? ge(o, x(a, o)) : (ge(o, c.defaultValue), L(a, o, c.defaultValue)), c.keepTouched || j(n.touchedFields, o), c.keepDirty || (j(n.dirtyFields, o), n.isDirty = c.defaultValue ? V(o, x(a, o)) : V()), c.keepError || (j(n.errors, o), v.isValid && g()), h.state.next({ ...n }));
|
|
2888
2891
|
}, At = (o, c = {}) => {
|
|
2889
2892
|
const f = o ? oe(o) : a, _ = oe(f), b = o && !J(o) ? _ : a;
|
|
2890
2893
|
if (c.keepDefaultValues || (a = f), !c.keepValues) {
|
|
2891
2894
|
if (c.keepDirtyValues || k)
|
|
2892
2895
|
for (const m of d.mount)
|
|
2893
|
-
|
|
2896
|
+
x(n.dirtyFields, m) ? L(b, m, x(i, m)) : ge(m, x(b, m));
|
|
2894
2897
|
else {
|
|
2895
|
-
if (bt &&
|
|
2898
|
+
if (bt && B(o))
|
|
2896
2899
|
for (const m of d.mount) {
|
|
2897
|
-
const C =
|
|
2900
|
+
const C = x(s, m);
|
|
2898
2901
|
if (C && C._f) {
|
|
2899
|
-
const
|
|
2900
|
-
if (Ge(
|
|
2901
|
-
const
|
|
2902
|
-
if (
|
|
2903
|
-
|
|
2902
|
+
const T = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
|
|
2903
|
+
if (Ge(T)) {
|
|
2904
|
+
const P = T.closest("form");
|
|
2905
|
+
if (P) {
|
|
2906
|
+
P.reset();
|
|
2904
2907
|
break;
|
|
2905
2908
|
}
|
|
2906
2909
|
}
|
|
@@ -2908,9 +2911,9 @@ function ns(e = {}, t) {
|
|
|
2908
2911
|
}
|
|
2909
2912
|
s = {};
|
|
2910
2913
|
}
|
|
2911
|
-
i = e.shouldUnregister ? c.keepDefaultValues ? oe(a) : {} : oe(b),
|
|
2914
|
+
i = e.shouldUnregister ? c.keepDefaultValues ? oe(a) : {} : oe(b), h.array.next({
|
|
2912
2915
|
values: { ...b }
|
|
2913
|
-
}),
|
|
2916
|
+
}), h.values.next({
|
|
2914
2917
|
values: { ...b }
|
|
2915
2918
|
});
|
|
2916
2919
|
}
|
|
@@ -2921,7 +2924,7 @@ function ns(e = {}, t) {
|
|
|
2921
2924
|
watch: /* @__PURE__ */ new Set(),
|
|
2922
2925
|
watchAll: !1,
|
|
2923
2926
|
focus: ""
|
|
2924
|
-
}, !u.mount && t(), u.mount = !v.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister,
|
|
2927
|
+
}, !u.mount && t(), u.mount = !v.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister, h.state.next({
|
|
2925
2928
|
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2926
2929
|
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !be(o, a)),
|
|
2927
2930
|
isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
|
|
@@ -2940,16 +2943,16 @@ function ns(e = {}, t) {
|
|
|
2940
2943
|
handleSubmit: Et,
|
|
2941
2944
|
setError: kt,
|
|
2942
2945
|
_executeSchema: H,
|
|
2943
|
-
_getWatch:
|
|
2946
|
+
_getWatch: O,
|
|
2944
2947
|
_getDirty: V,
|
|
2945
2948
|
_updateValid: g,
|
|
2946
|
-
_removeUnmounted:
|
|
2947
|
-
_updateFieldArray:
|
|
2949
|
+
_removeUnmounted: F,
|
|
2950
|
+
_updateFieldArray: R,
|
|
2948
2951
|
_updateDisabledField: St,
|
|
2949
2952
|
_getFieldArray: K,
|
|
2950
2953
|
_reset: At,
|
|
2951
2954
|
_resetDefaultValues: () => fe(r.defaultValues) && r.defaultValues().then((o) => {
|
|
2952
|
-
Vt(o, r.resetOptions),
|
|
2955
|
+
Vt(o, r.resetOptions), h.state.next({
|
|
2953
2956
|
isLoading: !1
|
|
2954
2957
|
});
|
|
2955
2958
|
}),
|
|
@@ -2960,7 +2963,7 @@ function ns(e = {}, t) {
|
|
|
2960
2963
|
};
|
|
2961
2964
|
},
|
|
2962
2965
|
_disableForm: Sr,
|
|
2963
|
-
_subjects:
|
|
2966
|
+
_subjects: h,
|
|
2964
2967
|
_proxyFormState: v,
|
|
2965
2968
|
get _fields() {
|
|
2966
2969
|
return s;
|
|
@@ -3011,7 +3014,7 @@ function ns(e = {}, t) {
|
|
|
3011
3014
|
unregister: tt,
|
|
3012
3015
|
setError: kt,
|
|
3013
3016
|
setFocus: (o, c = {}) => {
|
|
3014
|
-
const f =
|
|
3017
|
+
const f = x(s, o), _ = f && f._f;
|
|
3015
3018
|
if (_) {
|
|
3016
3019
|
const b = _.refs ? _.refs[0] : _.ref;
|
|
3017
3020
|
b.focus && (b.focus(), c.shouldSelect && b.select());
|
|
@@ -3061,7 +3064,7 @@ function Qe(e = {}) {
|
|
|
3061
3064
|
}
|
|
3062
3065
|
var Ht = function(e, t, r) {
|
|
3063
3066
|
if (e && "reportValidity" in e) {
|
|
3064
|
-
var n =
|
|
3067
|
+
var n = x(r, t);
|
|
3065
3068
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3066
3069
|
}
|
|
3067
3070
|
}, ss = function(e, t) {
|
|
@@ -3077,12 +3080,12 @@ var Ht = function(e, t, r) {
|
|
|
3077
3080
|
t.shouldUseNativeValidation && ss(e, t);
|
|
3078
3081
|
var r = {};
|
|
3079
3082
|
for (var n in e) {
|
|
3080
|
-
var s =
|
|
3083
|
+
var s = x(t.fields, n), a = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3081
3084
|
if (os(t.names || Object.keys(e), n)) {
|
|
3082
|
-
var i = Object.assign({}, is(
|
|
3083
|
-
|
|
3085
|
+
var i = Object.assign({}, is(x(r, n)));
|
|
3086
|
+
L(i, "root", a), L(r, n, i);
|
|
3084
3087
|
} else
|
|
3085
|
-
|
|
3088
|
+
L(r, n, a);
|
|
3086
3089
|
}
|
|
3087
3090
|
return r;
|
|
3088
3091
|
}, is = function(e) {
|
|
@@ -3112,14 +3115,14 @@ var Ht = function(e, t, r) {
|
|
|
3112
3115
|
return Promise.resolve(function(i, u) {
|
|
3113
3116
|
try {
|
|
3114
3117
|
var d = function() {
|
|
3115
|
-
function
|
|
3118
|
+
function p(v) {
|
|
3116
3119
|
return { values: r.raw ? n : v, errors: {} };
|
|
3117
3120
|
}
|
|
3118
|
-
var
|
|
3119
|
-
return r.mode === "sync" ?
|
|
3121
|
+
var w = Object.assign({}, { abortEarly: !1, abortPipeEarly: !1 }, t);
|
|
3122
|
+
return r.mode === "sync" ? p(nr(e, n, w)) : Promise.resolve(Dr(e, n, w)).then(p);
|
|
3120
3123
|
}();
|
|
3121
|
-
} catch (
|
|
3122
|
-
return u(
|
|
3124
|
+
} catch (p) {
|
|
3125
|
+
return u(p);
|
|
3123
3126
|
}
|
|
3124
3127
|
return d && d.then ? d.then(void 0, u) : d;
|
|
3125
3128
|
}(0, function(i) {
|
|
@@ -3171,8 +3174,8 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3171
3174
|
input: e,
|
|
3172
3175
|
onSubmitSuccess: t
|
|
3173
3176
|
}) => {
|
|
3174
|
-
var
|
|
3175
|
-
const r = e.key ? (
|
|
3177
|
+
var w, v;
|
|
3178
|
+
const r = e.key ? (w = I.current$.value.flow) == null ? void 0 : w.data.submissions[e.key] : void 0, n = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1, s = n && e.config.options.length === 2, {
|
|
3176
3179
|
t: a
|
|
3177
3180
|
} = G(), {
|
|
3178
3181
|
register: i,
|
|
@@ -3182,10 +3185,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3182
3185
|
}
|
|
3183
3186
|
} = Qe({
|
|
3184
3187
|
defaultValues: {
|
|
3185
|
-
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((
|
|
3188
|
+
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((h) => [h, !0])) : {}
|
|
3186
3189
|
},
|
|
3187
3190
|
resolver: cs(e.config, a)
|
|
3188
|
-
}),
|
|
3191
|
+
}), p = gt();
|
|
3189
3192
|
return s ? l("ul", {
|
|
3190
3193
|
style: {
|
|
3191
3194
|
maxHeight: 6.5 * Wt + 5 * Jt + 2 * Zt
|
|
@@ -3193,30 +3196,30 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3193
3196
|
class: Xt({
|
|
3194
3197
|
variant: "booleanLike"
|
|
3195
3198
|
}),
|
|
3196
|
-
children: e.config.options.map((
|
|
3199
|
+
children: e.config.options.map((h, k) => l("li", {
|
|
3197
3200
|
class: "flex-1",
|
|
3198
3201
|
children: l(cr, {
|
|
3199
3202
|
type: "submit",
|
|
3200
3203
|
ref: (y) => {
|
|
3201
|
-
y && k === 0 && (
|
|
3204
|
+
y && k === 0 && (p.current = y);
|
|
3202
3205
|
},
|
|
3203
|
-
label:
|
|
3206
|
+
label: h.label,
|
|
3204
3207
|
value: "true",
|
|
3205
3208
|
onClick: () => t({
|
|
3206
3209
|
type: "enum",
|
|
3207
|
-
value: [
|
|
3210
|
+
value: [h.value]
|
|
3208
3211
|
})
|
|
3209
3212
|
})
|
|
3210
|
-
},
|
|
3213
|
+
}, h.value))
|
|
3211
3214
|
}) : l("form", {
|
|
3212
3215
|
noValidate: !0,
|
|
3213
|
-
onSubmit: (
|
|
3216
|
+
onSubmit: (h) => u((k) => {
|
|
3214
3217
|
const y = k.checked;
|
|
3215
3218
|
t({
|
|
3216
3219
|
type: "enum",
|
|
3217
3220
|
value: y
|
|
3218
3221
|
});
|
|
3219
|
-
})(
|
|
3222
|
+
})(h),
|
|
3220
3223
|
children: [l("div", {
|
|
3221
3224
|
class: "flex items-center gap-1",
|
|
3222
3225
|
children: [l("ul", {
|
|
@@ -3226,27 +3229,27 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3226
3229
|
class: Xt({
|
|
3227
3230
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3228
3231
|
}),
|
|
3229
|
-
children: e.config.options.map((
|
|
3230
|
-
const y = `checked.${
|
|
3232
|
+
children: e.config.options.map((h, k) => {
|
|
3233
|
+
const y = `checked.${h.value}`, {
|
|
3231
3234
|
ref: A,
|
|
3232
3235
|
...S
|
|
3233
3236
|
} = i(y);
|
|
3234
3237
|
return l("li", {
|
|
3235
3238
|
class: "relative",
|
|
3236
3239
|
children: l(ds, {
|
|
3237
|
-
option:
|
|
3240
|
+
option: h,
|
|
3238
3241
|
autoFocus: k === 0,
|
|
3239
3242
|
ref: (E) => {
|
|
3240
|
-
E && k === 0 && (
|
|
3243
|
+
E && k === 0 && (p.current = E), A(E);
|
|
3241
3244
|
},
|
|
3242
3245
|
id: y,
|
|
3243
3246
|
...S,
|
|
3244
3247
|
onClick: n ? () => t({
|
|
3245
3248
|
type: "enum",
|
|
3246
|
-
value: [
|
|
3249
|
+
value: [h.value]
|
|
3247
3250
|
}) : void 0
|
|
3248
3251
|
})
|
|
3249
|
-
},
|
|
3252
|
+
}, h.value);
|
|
3250
3253
|
})
|
|
3251
3254
|
}), l("div", {
|
|
3252
3255
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
@@ -3296,19 +3299,19 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3296
3299
|
resolver: ps(e.config, s)
|
|
3297
3300
|
}), {
|
|
3298
3301
|
ref: d,
|
|
3299
|
-
...
|
|
3302
|
+
...p
|
|
3300
3303
|
} = a("number", {
|
|
3301
3304
|
required: !e.config.optional,
|
|
3302
3305
|
valueAsNumber: !0
|
|
3303
|
-
}),
|
|
3306
|
+
}), w = re();
|
|
3304
3307
|
return pe(() => {
|
|
3305
|
-
|
|
3308
|
+
w.current && (w.current.focus(), w.current.select());
|
|
3306
3309
|
}, []), l("form", {
|
|
3307
3310
|
class: "flex flex-col gap-1 p-2.5",
|
|
3308
|
-
onSubmit: i((
|
|
3309
|
-
|
|
3311
|
+
onSubmit: i((h) => {
|
|
3312
|
+
h.number !== void 0 && t({
|
|
3310
3313
|
type: "number",
|
|
3311
|
-
value:
|
|
3314
|
+
value: h.number
|
|
3312
3315
|
});
|
|
3313
3316
|
}),
|
|
3314
3317
|
children: [l("div", {
|
|
@@ -3316,14 +3319,14 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3316
3319
|
children: [l("div", {
|
|
3317
3320
|
class: "relative min-w-0 flex-grow",
|
|
3318
3321
|
children: [l("input", {
|
|
3319
|
-
...
|
|
3322
|
+
...p,
|
|
3320
3323
|
id: "chat-input",
|
|
3321
3324
|
autocomplete: "off",
|
|
3322
3325
|
autoCapitalize: "off",
|
|
3323
3326
|
autoCorrect: "off",
|
|
3324
3327
|
autoFocus: !0,
|
|
3325
|
-
ref: (
|
|
3326
|
-
|
|
3328
|
+
ref: (h) => {
|
|
3329
|
+
h && (w.current = h), d(h);
|
|
3327
3330
|
},
|
|
3328
3331
|
type: "text",
|
|
3329
3332
|
min: e.config.min,
|
|
@@ -3373,9 +3376,9 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3373
3376
|
register: u,
|
|
3374
3377
|
handleSubmit: d,
|
|
3375
3378
|
formState: {
|
|
3376
|
-
errors:
|
|
3379
|
+
errors: p
|
|
3377
3380
|
},
|
|
3378
|
-
watch:
|
|
3381
|
+
watch: w
|
|
3379
3382
|
} = Qe({
|
|
3380
3383
|
defaultValues: {
|
|
3381
3384
|
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ?? bs,
|
|
@@ -3384,10 +3387,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3384
3387
|
resolver: ws(n)
|
|
3385
3388
|
}), {
|
|
3386
3389
|
ref: v,
|
|
3387
|
-
...
|
|
3390
|
+
...h
|
|
3388
3391
|
} = u("phoneNumber", {
|
|
3389
3392
|
required: !e.config.optional
|
|
3390
|
-
}), k = re(), y =
|
|
3393
|
+
}), k = re(), y = w("countryCode");
|
|
3391
3394
|
return pe(() => {
|
|
3392
3395
|
k.current && (k.current.focus(), k.current.select());
|
|
3393
3396
|
}, []), l("form", {
|
|
@@ -3396,10 +3399,10 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3396
3399
|
onSubmit: d((S) => {
|
|
3397
3400
|
const E = S.phoneNumber.replace(/[^0-9]/g, ""), g = S.countryCode.replace(/[^0-9]/g, "");
|
|
3398
3401
|
a(void 0);
|
|
3399
|
-
const
|
|
3400
|
-
if (E.length + g.length <
|
|
3402
|
+
const M = e.config.minChars ?? 7;
|
|
3403
|
+
if (E.length + g.length < M)
|
|
3401
3404
|
return a(n("validation_phone_min_chars", {
|
|
3402
|
-
count:
|
|
3405
|
+
count: M
|
|
3403
3406
|
}));
|
|
3404
3407
|
e.config.submissionFormat === "phone" ? t({
|
|
3405
3408
|
type: "phone",
|
|
@@ -3431,7 +3434,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3431
3434
|
}, S))
|
|
3432
3435
|
})]
|
|
3433
3436
|
}), l("input", {
|
|
3434
|
-
...
|
|
3437
|
+
...h,
|
|
3435
3438
|
id: "chat-input",
|
|
3436
3439
|
type: "tel",
|
|
3437
3440
|
inputMode: "tel",
|
|
@@ -3453,7 +3456,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3453
3456
|
})]
|
|
3454
3457
|
}), l(ye, {})]
|
|
3455
3458
|
}), l(Ce, {
|
|
3456
|
-
error:
|
|
3459
|
+
error: p.countryCode || p.phoneNumber || {
|
|
3457
3460
|
message: s
|
|
3458
3461
|
}
|
|
3459
3462
|
})]
|
|
@@ -3541,19 +3544,19 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3541
3544
|
resolver: Es(e.config, r)
|
|
3542
3545
|
}), {
|
|
3543
3546
|
ref: d,
|
|
3544
|
-
...
|
|
3547
|
+
...p
|
|
3545
3548
|
} = a("text", {
|
|
3546
3549
|
required: !e.config.optional
|
|
3547
|
-
}),
|
|
3550
|
+
}), w = re();
|
|
3548
3551
|
return pe(() => {
|
|
3549
|
-
|
|
3552
|
+
w.current && (w.current.focus(), w.current.select());
|
|
3550
3553
|
}, []), l("form", {
|
|
3551
3554
|
noValidate: !0,
|
|
3552
3555
|
class: "flex flex-col gap-1 p-2.5",
|
|
3553
|
-
onSubmit: i((
|
|
3556
|
+
onSubmit: i((h) => {
|
|
3554
3557
|
t({
|
|
3555
3558
|
type: "string",
|
|
3556
|
-
value:
|
|
3559
|
+
value: h.text
|
|
3557
3560
|
});
|
|
3558
3561
|
}),
|
|
3559
3562
|
children: [l("div", {
|
|
@@ -3562,14 +3565,14 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3562
3565
|
class: "relative min-w-0 flex-1",
|
|
3563
3566
|
children: [l("input", {
|
|
3564
3567
|
id: "chat-input",
|
|
3565
|
-
...
|
|
3568
|
+
...p,
|
|
3566
3569
|
...Ss[e.config.format],
|
|
3567
3570
|
autocomplete: "off",
|
|
3568
3571
|
autoCapitalize: "off",
|
|
3569
3572
|
autoCorrect: "off",
|
|
3570
3573
|
autoFocus: !0,
|
|
3571
|
-
ref: (
|
|
3572
|
-
|
|
3574
|
+
ref: (h) => {
|
|
3575
|
+
h && (w.current = h), d(h);
|
|
3573
3576
|
},
|
|
3574
3577
|
placeholder: e.config.placeholder,
|
|
3575
3578
|
class: Re({
|
|
@@ -3589,7 +3592,7 @@ const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
|
3589
3592
|
text: As,
|
|
3590
3593
|
phone: _s,
|
|
3591
3594
|
"multiple-choice": fs,
|
|
3592
|
-
boolean:
|
|
3595
|
+
boolean: Ln,
|
|
3593
3596
|
file: Pn,
|
|
3594
3597
|
submit: ks,
|
|
3595
3598
|
address: Vn,
|
|
@@ -3647,13 +3650,13 @@ var Ms = function(e) {
|
|
|
3647
3650
|
return t && n.test(t) ? t.replace(r, "\\$&") : t;
|
|
3648
3651
|
}, wr = function(e) {
|
|
3649
3652
|
return typeof e == "string";
|
|
3650
|
-
},
|
|
3653
|
+
}, Ls = function(e) {
|
|
3651
3654
|
var t = [];
|
|
3652
3655
|
return e.forEach(function(r) {
|
|
3653
3656
|
Array.isArray(r) ? t = t.concat(r) : t.push(r);
|
|
3654
3657
|
}), t;
|
|
3655
3658
|
};
|
|
3656
|
-
function
|
|
3659
|
+
function Ns(e, t, r) {
|
|
3657
3660
|
var n = 0, s = 0;
|
|
3658
3661
|
if (e === "")
|
|
3659
3662
|
return e;
|
|
@@ -3671,18 +3674,18 @@ function Ls(e, t, r) {
|
|
|
3671
3674
|
return i;
|
|
3672
3675
|
}
|
|
3673
3676
|
var Ts = function(t, r, n) {
|
|
3674
|
-
return Array.isArray(t) || (t = [t]),
|
|
3675
|
-
return wr(s) ?
|
|
3677
|
+
return Array.isArray(t) || (t = [t]), Ls(t.map(function(s) {
|
|
3678
|
+
return wr(s) ? Ns(s, r, n) : s;
|
|
3676
3679
|
}));
|
|
3677
3680
|
};
|
|
3678
3681
|
const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]+)\]\(([^)]+)\)/, Os = /(https?:\/\/[^\s]+)/g, Bs = /_(.*?)_/g, Ps = /\*\*(.*?)\*\*/g, $s = /\\n|\n/g, Qt = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", js = (e) => {
|
|
3679
3682
|
const t = Me(e, Ds, (i, u) => {
|
|
3680
|
-
const [, d,
|
|
3681
|
-
return
|
|
3683
|
+
const [, d, p] = i.match(Rs) ?? [];
|
|
3684
|
+
return p ? l("a", {
|
|
3682
3685
|
class: Qt,
|
|
3683
|
-
href:
|
|
3684
|
-
children: d ??
|
|
3685
|
-
},
|
|
3686
|
+
href: p,
|
|
3687
|
+
children: d ?? p
|
|
3688
|
+
}, p + u) : l("span", {
|
|
3686
3689
|
children: "INVALID LINK"
|
|
3687
3690
|
});
|
|
3688
3691
|
}), r = Me(t, Os, (i, u) => l("a", {
|
|
@@ -3804,9 +3807,9 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3804
3807
|
children: a.text
|
|
3805
3808
|
})).with({
|
|
3806
3809
|
type: "text",
|
|
3807
|
-
author:
|
|
3810
|
+
author: D.union("bot", "user")
|
|
3808
3811
|
}, (a) => {
|
|
3809
|
-
const i = a.author === "user" && !t.slice(s + 1).some((
|
|
3812
|
+
const i = a.author === "user" && !t.slice(s + 1).some((p) => p.type === "text" && p.author === "user"), u = s === t.length - 1, d = a.author === "bot" ? js(a.text) : a.text;
|
|
3810
3813
|
return l(qs, {
|
|
3811
3814
|
animate: u,
|
|
3812
3815
|
side: Gs[a.author],
|
|
@@ -3860,21 +3863,21 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3860
3863
|
chatService: i
|
|
3861
3864
|
} = _n(), {
|
|
3862
3865
|
t: u
|
|
3863
|
-
} = G(), [d,
|
|
3866
|
+
} = G(), [d, p] = Y();
|
|
3864
3867
|
return pe(() => {
|
|
3865
3868
|
s === "maximised" && z.scrollToEnd.instant();
|
|
3866
3869
|
}, [s]), pe(() => {
|
|
3867
3870
|
var S, E;
|
|
3868
3871
|
const {
|
|
3869
|
-
state:
|
|
3872
|
+
state: w,
|
|
3870
3873
|
flow: v
|
|
3871
3874
|
} = I.current$.peek();
|
|
3872
|
-
if (
|
|
3875
|
+
if (w !== "loaded")
|
|
3873
3876
|
throw new Error(u("invalid_state"));
|
|
3874
|
-
let
|
|
3877
|
+
let h = v.data.nodeHistory.at(-1);
|
|
3875
3878
|
if (z.scrollToEnd.instant(), I.setInput(void 0), v.data.isFinished)
|
|
3876
3879
|
return;
|
|
3877
|
-
|
|
3880
|
+
h === void 0 ? (h = er(n.nodes).id, I.setCurrentNodeId(h), r.log({
|
|
3878
3881
|
event: "FLOW_START",
|
|
3879
3882
|
properties: {
|
|
3880
3883
|
flow_id: n.id,
|
|
@@ -3884,7 +3887,7 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3884
3887
|
job: n.job
|
|
3885
3888
|
},
|
|
3886
3889
|
customProperties: (S = n.analytics) == null ? void 0 : S.customProperties
|
|
3887
|
-
})) : I.removeMessagesSentByNodeIds([
|
|
3890
|
+
})) : I.removeMessagesSentByNodeIds([h]);
|
|
3888
3891
|
const {
|
|
3889
3892
|
interpret: k,
|
|
3890
3893
|
abort: y,
|
|
@@ -3905,26 +3908,26 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3905
3908
|
var g;
|
|
3906
3909
|
return (g = I.current$.peek().flow) == null ? void 0 : g.data.submissions;
|
|
3907
3910
|
},
|
|
3908
|
-
onInterpret: (g,
|
|
3909
|
-
var
|
|
3910
|
-
const
|
|
3911
|
-
le(
|
|
3911
|
+
onInterpret: (g, M) => {
|
|
3912
|
+
var N;
|
|
3913
|
+
const R = I.current$.peek().flow;
|
|
3914
|
+
le(R), M && (R.data.sequence = R.data.sequence + 1, r.log({
|
|
3912
3915
|
event: "FLOW_NODE",
|
|
3913
3916
|
properties: {
|
|
3914
3917
|
flow_id: n.id,
|
|
3915
3918
|
flow_version: n.version,
|
|
3916
|
-
from_node_id:
|
|
3919
|
+
from_node_id: M.id,
|
|
3917
3920
|
flow_build: n.build,
|
|
3918
3921
|
to_node_id: g.id,
|
|
3919
|
-
sequence:
|
|
3920
|
-
flow_session_id:
|
|
3922
|
+
sequence: R.data.sequence,
|
|
3923
|
+
flow_session_id: R.data.flowSessionId,
|
|
3921
3924
|
job: n.job
|
|
3922
3925
|
},
|
|
3923
|
-
customProperties: (
|
|
3926
|
+
customProperties: (N = n.analytics) == null ? void 0 : N.customProperties
|
|
3924
3927
|
})), I.setCurrentNodeId(g.id);
|
|
3925
3928
|
},
|
|
3926
3929
|
onFlowEnd: async () => {
|
|
3927
|
-
var
|
|
3930
|
+
var M;
|
|
3928
3931
|
I.markAsFinished();
|
|
3929
3932
|
const g = I.current$.peek().flow;
|
|
3930
3933
|
le(g), r.log({
|
|
@@ -3936,11 +3939,11 @@ const Me = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]
|
|
|
3936
3939
|
flow_build: n.build,
|
|
3937
3940
|
job: n.job
|
|
3938
3941
|
},
|
|
3939
|
-
customProperties: (
|
|
3942
|
+
customProperties: (M = n.analytics) == null ? void 0 : M.customProperties
|
|
3940
3943
|
});
|
|
3941
3944
|
}
|
|
3942
3945
|
});
|
|
3943
|
-
return
|
|
3946
|
+
return p(() => A), k(h), y;
|
|
3944
3947
|
}, [r, t, i, e, n, u]), l(ke, {
|
|
3945
3948
|
children: [l("div", {
|
|
3946
3949
|
ref: a,
|