@inploi/plugin-chatbot 4.0.1 → 4.0.2
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 +2 -2
- package/dist/{chatbot-body-5aef126c.js → chatbot-body-3dfd1aa9.js} +460 -466
- package/dist/chatbot-body-ee776a4a.cjs +1 -0
- package/dist/i18n.d.ts +48 -0
- package/dist/index-8ae8589d.cjs +5 -0
- package/dist/{index-b245b94e.js → index-daa7b492.js} +63 -55
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +2 -2
- package/dist/chatbot-body-1f8351bb.cjs +0 -1
- package/dist/index-4d7a0e94.cjs +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as Ue, i as tr, k as
|
|
1
|
+
import { g as Ue, i as tr, k as Ne, a as rr, b as le, A as Me, c as Fr, N as Ke, _ as I, d as nr, h as Y, e as re, p as ue, F as mt, u as J, o as l, f as Le, j as ft, y as pe, s as M, l as Ze, m as he, n as Nr, q as at, r as ee, t as Lr, v as _e, w as Tr, x as sr, z as Dr, B as ar, C as Rr, D as Se, E as X, G as Or, V as Br, H as ir, I as $e, J as je, K as Pr, L as $r, M as jr, O as zr, P as qr, Q as Ur, R as Nt, S as Kr, T as Gr, U as Hr } from "./index-daa7b492.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
|
-
const
|
|
3
|
+
const Lt = ({
|
|
4
4
|
condition: e,
|
|
5
5
|
context: t,
|
|
6
6
|
submissions: r,
|
|
@@ -35,7 +35,7 @@ const Nt = ({
|
|
|
35
35
|
case "integration": {
|
|
36
36
|
if (typeof i.value != "object" || Array.isArray(i.value))
|
|
37
37
|
return !1;
|
|
38
|
-
const u = Ue(i.value, a.join(".")),
|
|
38
|
+
const u = Ue(i.value, a.join(".")), d = {
|
|
39
39
|
...n,
|
|
40
40
|
data: {
|
|
41
41
|
...n.data,
|
|
@@ -44,7 +44,7 @@ const Nt = ({
|
|
|
44
44
|
};
|
|
45
45
|
switch (typeof u) {
|
|
46
46
|
case "boolean":
|
|
47
|
-
return Fe(
|
|
47
|
+
return Fe(d, {
|
|
48
48
|
submissions: {
|
|
49
49
|
_temp: {
|
|
50
50
|
value: u,
|
|
@@ -54,7 +54,7 @@ const Nt = ({
|
|
|
54
54
|
context: t
|
|
55
55
|
});
|
|
56
56
|
case "string":
|
|
57
|
-
return Fe(
|
|
57
|
+
return Fe(d, {
|
|
58
58
|
submissions: {
|
|
59
59
|
_temp: {
|
|
60
60
|
value: u,
|
|
@@ -64,7 +64,7 @@ const Nt = ({
|
|
|
64
64
|
context: t
|
|
65
65
|
});
|
|
66
66
|
case "number":
|
|
67
|
-
return Fe(
|
|
67
|
+
return Fe(d, {
|
|
68
68
|
submissions: {
|
|
69
69
|
_temp: {
|
|
70
70
|
value: u,
|
|
@@ -74,7 +74,7 @@ const Nt = ({
|
|
|
74
74
|
context: t
|
|
75
75
|
});
|
|
76
76
|
case "object":
|
|
77
|
-
return Array.isArray(u) && u.every(tr) ? Fe(
|
|
77
|
+
return Array.isArray(u) && u.every(tr) ? Fe(d, {
|
|
78
78
|
submissions: {
|
|
79
79
|
_temp: {
|
|
80
80
|
value: u,
|
|
@@ -153,7 +153,7 @@ const Nt = ({
|
|
|
153
153
|
const n = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
154
154
|
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
155
155
|
for (const a of n)
|
|
156
|
-
if (
|
|
156
|
+
if (Lt({
|
|
157
157
|
condition: a,
|
|
158
158
|
context: t,
|
|
159
159
|
submissions: r,
|
|
@@ -163,7 +163,7 @@ const Nt = ({
|
|
|
163
163
|
return !1;
|
|
164
164
|
} else {
|
|
165
165
|
for (const a of n)
|
|
166
|
-
if (!
|
|
166
|
+
if (!Lt({
|
|
167
167
|
condition: a,
|
|
168
168
|
context: t,
|
|
169
169
|
submissions: r,
|
|
@@ -176,32 +176,32 @@ const Nt = ({
|
|
|
176
176
|
context: t,
|
|
177
177
|
submissions: r
|
|
178
178
|
}) => e.replace(Wr, (n, s, a = "") => {
|
|
179
|
-
const [i, ...u] = s.trim().split("."),
|
|
179
|
+
const [i, ...u] = s.trim().split("."), d = lr({
|
|
180
180
|
key: i,
|
|
181
181
|
path: u,
|
|
182
182
|
submissions: r,
|
|
183
183
|
context: t
|
|
184
184
|
});
|
|
185
|
-
if (!
|
|
185
|
+
if (!d)
|
|
186
186
|
return a;
|
|
187
|
-
switch (
|
|
187
|
+
switch (d.type) {
|
|
188
188
|
case "boolean":
|
|
189
|
-
return
|
|
189
|
+
return d.value === !0 ? "true" : "false";
|
|
190
190
|
case "file":
|
|
191
|
-
return
|
|
191
|
+
return d.value.map((h) => `${h.name} (${Ne(h.sizeKb)})`).join(", ");
|
|
192
192
|
case "enum":
|
|
193
|
-
return
|
|
193
|
+
return d.value.join(", ");
|
|
194
194
|
case "address":
|
|
195
|
-
return Object.values(
|
|
195
|
+
return Object.values(d.value).filter((h) => h && h.trim().length > 0).join(", ");
|
|
196
196
|
case "number":
|
|
197
197
|
case "string":
|
|
198
|
-
return
|
|
198
|
+
return d.value ? d.value.toString() : a;
|
|
199
199
|
case "phone":
|
|
200
|
-
return Qe(
|
|
200
|
+
return Qe(d.value);
|
|
201
201
|
case "integration": {
|
|
202
|
-
if (typeof
|
|
202
|
+
if (typeof d.value != "object" || Array.isArray(d.value))
|
|
203
203
|
break;
|
|
204
|
-
const h = Ue(
|
|
204
|
+
const h = Ue(d.value, u.join("."));
|
|
205
205
|
switch (typeof h) {
|
|
206
206
|
case "boolean":
|
|
207
207
|
return h === !0 ? "true" : "false";
|
|
@@ -259,11 +259,11 @@ const Nt = ({
|
|
|
259
259
|
getSubmissions: a,
|
|
260
260
|
chatService: i,
|
|
261
261
|
onFlowEnd: u,
|
|
262
|
-
onInterpret:
|
|
262
|
+
onInterpret: d,
|
|
263
263
|
t: h
|
|
264
264
|
}) => {
|
|
265
265
|
let x = new AbortController();
|
|
266
|
-
const
|
|
266
|
+
const y = {
|
|
267
267
|
...t.service,
|
|
268
268
|
log: (k) => t.service.log({
|
|
269
269
|
...k,
|
|
@@ -274,11 +274,11 @@ const Nt = ({
|
|
|
274
274
|
})
|
|
275
275
|
}, p = async (k, v) => {
|
|
276
276
|
const E = a();
|
|
277
|
-
|
|
277
|
+
d == null || d(k, v);
|
|
278
278
|
try {
|
|
279
279
|
await Qr({
|
|
280
280
|
flow: e,
|
|
281
|
-
analytics:
|
|
281
|
+
analytics: y,
|
|
282
282
|
logger: r,
|
|
283
283
|
apiClient: s,
|
|
284
284
|
context: n,
|
|
@@ -510,7 +510,7 @@ async function rn({
|
|
|
510
510
|
submissions: a,
|
|
511
511
|
analytics: i,
|
|
512
512
|
flow: u,
|
|
513
|
-
t:
|
|
513
|
+
t: d
|
|
514
514
|
}) {
|
|
515
515
|
const h = async (x) => {
|
|
516
516
|
x !== !0 && await e.userInput({
|
|
@@ -523,14 +523,14 @@ async function rn({
|
|
|
523
523
|
type: "loading"
|
|
524
524
|
});
|
|
525
525
|
const {
|
|
526
|
-
anonymous_id:
|
|
526
|
+
anonymous_id: y,
|
|
527
527
|
session_id: p
|
|
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
|
-
anonymous_id:
|
|
533
|
+
anonymous_id: y,
|
|
534
534
|
session_id: p,
|
|
535
535
|
job: u.job,
|
|
536
536
|
submissions: Fr(a || {})
|
|
@@ -588,14 +588,14 @@ async function rn({
|
|
|
588
588
|
await e.sendMessage({
|
|
589
589
|
type: "text",
|
|
590
590
|
author: "bot",
|
|
591
|
-
text: v.redirect.message ??
|
|
591
|
+
text: v.redirect.message ?? d("submission_redirect_message")
|
|
592
592
|
});
|
|
593
593
|
try {
|
|
594
594
|
const E = new URL(v.redirect.redirect_url);
|
|
595
|
-
|
|
595
|
+
y && !E.searchParams.has("anonymous_id") && E.searchParams.set("anonymous_id", y), await e.sendMessage({
|
|
596
596
|
type: "link",
|
|
597
597
|
href: E.toString(),
|
|
598
|
-
text: v.redirect.button_text ??
|
|
598
|
+
text: v.redirect.button_text ?? d("complete_submission"),
|
|
599
599
|
onClick: () => {
|
|
600
600
|
if (!p) {
|
|
601
601
|
n.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
@@ -618,7 +618,7 @@ async function rn({
|
|
|
618
618
|
n.error(`Invalid redirect URL: ${v.redirect.redirect_url}`, E), e.sendMessage({
|
|
619
619
|
type: "system",
|
|
620
620
|
variant: "error",
|
|
621
|
-
text:
|
|
621
|
+
text: d("redirect_url_error")
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
t(r.nextId);
|
|
@@ -629,7 +629,7 @@ async function rn({
|
|
|
629
629
|
r.data.skipConfirmation !== !0 && await e.sendMessage({
|
|
630
630
|
type: "system",
|
|
631
631
|
variant: "success",
|
|
632
|
-
text:
|
|
632
|
+
text: d("submission_completed")
|
|
633
633
|
}), t(r.nextId);
|
|
634
634
|
}).with(I.union({
|
|
635
635
|
success: !1,
|
|
@@ -647,13 +647,13 @@ async function rn({
|
|
|
647
647
|
n.error(v.error), await e.sendMessage({
|
|
648
648
|
type: "system",
|
|
649
649
|
variant: "error",
|
|
650
|
-
text: ((E = v.error) == null ? void 0 : E.message) ||
|
|
650
|
+
text: ((E = v.error) == null ? void 0 : E.message) || d("submission_failed")
|
|
651
651
|
}), await h(!1);
|
|
652
652
|
}).otherwise(async (v) => {
|
|
653
653
|
n.error(v), await e.sendMessage({
|
|
654
654
|
type: "system",
|
|
655
655
|
variant: "error",
|
|
656
|
-
text:
|
|
656
|
+
text: d("submission_failed")
|
|
657
657
|
}), await h(!1);
|
|
658
658
|
});
|
|
659
659
|
};
|
|
@@ -1036,14 +1036,14 @@ const lr = ({
|
|
|
1036
1036
|
function ht(e, t, r) {
|
|
1037
1037
|
var n, s, a, i, u;
|
|
1038
1038
|
t == null && (t = 100);
|
|
1039
|
-
function
|
|
1039
|
+
function d() {
|
|
1040
1040
|
var x = Date.now() - i;
|
|
1041
|
-
x < t && x >= 0 ? n = setTimeout(
|
|
1041
|
+
x < t && x >= 0 ? n = setTimeout(d, t - x) : (n = null, r || (u = e.apply(a, s), a = s = null));
|
|
1042
1042
|
}
|
|
1043
1043
|
var h = function() {
|
|
1044
1044
|
a = this, s = arguments, i = Date.now();
|
|
1045
1045
|
var x = r && !n;
|
|
1046
|
-
return n || (n = setTimeout(
|
|
1046
|
+
return n || (n = setTimeout(d, t)), x && (u = e.apply(a, s), a = s = null), u;
|
|
1047
1047
|
};
|
|
1048
1048
|
return h.clear = function() {
|
|
1049
1049
|
n && (clearTimeout(n), n = null);
|
|
@@ -1078,16 +1078,16 @@ function yn(e) {
|
|
|
1078
1078
|
right: 0,
|
|
1079
1079
|
x: 0,
|
|
1080
1080
|
y: 0
|
|
1081
|
-
}),
|
|
1081
|
+
}), d = re({
|
|
1082
1082
|
element: null,
|
|
1083
1083
|
scrollContainers: null,
|
|
1084
1084
|
resizeObserver: null,
|
|
1085
1085
|
lastBounds: i
|
|
1086
|
-
}), h = t ? typeof t == "number" ? t : t.scroll : null, x = t ? typeof t == "number" ? t : t.resize : null,
|
|
1087
|
-
ue(() => (
|
|
1086
|
+
}), h = t ? typeof t == "number" ? t : t.scroll : null, x = t ? typeof t == "number" ? t : t.resize : null, y = re(!1);
|
|
1087
|
+
ue(() => (y.current = !0, () => void (y.current = !1)));
|
|
1088
1088
|
const [p, k, v] = mt(() => {
|
|
1089
1089
|
const g = () => {
|
|
1090
|
-
if (!
|
|
1090
|
+
if (!d.current.element)
|
|
1091
1091
|
return;
|
|
1092
1092
|
const {
|
|
1093
1093
|
left: T,
|
|
@@ -1098,7 +1098,7 @@ function yn(e) {
|
|
|
1098
1098
|
right: Ae,
|
|
1099
1099
|
x: G,
|
|
1100
1100
|
y: se
|
|
1101
|
-
} =
|
|
1101
|
+
} = d.current.element.getBoundingClientRect(), q = {
|
|
1102
1102
|
left: T,
|
|
1103
1103
|
top: P,
|
|
1104
1104
|
width: D,
|
|
@@ -1108,21 +1108,21 @@ function yn(e) {
|
|
|
1108
1108
|
x: G,
|
|
1109
1109
|
y: se
|
|
1110
1110
|
};
|
|
1111
|
-
|
|
1111
|
+
d.current.element instanceof HTMLElement && s && (q.height = d.current.element.offsetHeight, q.width = d.current.element.offsetWidth), Object.freeze(q), y.current && !wn(d.current.lastBounds, q) && u(d.current.lastBounds = q);
|
|
1112
1112
|
};
|
|
1113
1113
|
return [g, x ? Tt(g, x) : g, h ? Tt(g, h) : g];
|
|
1114
1114
|
}, [u, s, h, x]);
|
|
1115
1115
|
function E() {
|
|
1116
|
-
|
|
1116
|
+
d.current.scrollContainers && (d.current.scrollContainers.forEach((g) => g.removeEventListener("scroll", v, !0)), d.current.scrollContainers = null), d.current.resizeObserver && (d.current.resizeObserver.disconnect(), d.current.resizeObserver = null);
|
|
1117
1117
|
}
|
|
1118
1118
|
function S() {
|
|
1119
|
-
|
|
1119
|
+
d.current.element && (d.current.resizeObserver = new a(v), d.current.resizeObserver.observe(d.current.element), r && d.current.scrollContainers && d.current.scrollContainers.forEach((g) => g.addEventListener("scroll", v, {
|
|
1120
1120
|
capture: !0,
|
|
1121
1121
|
passive: !0
|
|
1122
1122
|
})));
|
|
1123
1123
|
}
|
|
1124
1124
|
const A = (g) => {
|
|
1125
|
-
!g || g ===
|
|
1125
|
+
!g || g === d.current.element || (E(), d.current.element = g, d.current.scrollContainers = ur(g), S());
|
|
1126
1126
|
};
|
|
1127
1127
|
return vn(v, !!r), bn(k), ue(() => {
|
|
1128
1128
|
E(), S();
|
|
@@ -1162,9 +1162,9 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1162
1162
|
}) => {
|
|
1163
1163
|
const {
|
|
1164
1164
|
t: r
|
|
1165
|
-
} =
|
|
1165
|
+
} = J();
|
|
1166
1166
|
return l("button", {
|
|
1167
|
-
class:
|
|
1167
|
+
class: Le("bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50", e),
|
|
1168
1168
|
type: "submit",
|
|
1169
1169
|
...t,
|
|
1170
1170
|
children: l("svg", {
|
|
@@ -1232,7 +1232,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1232
1232
|
throw new Me();
|
|
1233
1233
|
z.isBotTyping$.value = !0;
|
|
1234
1234
|
const u = Math.min(Math.max(20, i.text.length), 100) * kn;
|
|
1235
|
-
await new Promise((
|
|
1235
|
+
await new Promise((d) => setTimeout(d, u, {
|
|
1236
1236
|
signal: s
|
|
1237
1237
|
})), z.isBotTyping$.value = !1;
|
|
1238
1238
|
}).otherwise(async () => {
|
|
@@ -1299,10 +1299,10 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1299
1299
|
}) => {
|
|
1300
1300
|
const {
|
|
1301
1301
|
t: r
|
|
1302
|
-
} =
|
|
1302
|
+
} = J();
|
|
1303
1303
|
return l("button", {
|
|
1304
1304
|
type: "button",
|
|
1305
|
-
class:
|
|
1305
|
+
class: Le("fr text-neutral-9 flex flex-shrink-0 items-center justify-center gap-1 rounded-full py-[6px] pl-2 pr-3 text-sm underline-offset-2 transition-all", e),
|
|
1306
1306
|
...t,
|
|
1307
1307
|
children: [l("svg", {
|
|
1308
1308
|
"aria-hidden": !0,
|
|
@@ -1584,12 +1584,12 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1584
1584
|
}), Sn = "https://api.mapbox.com/search/searchbox/v1/suggest", Cn = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", An = (e) => atob(e).split("").reverse().join(""), ae = he({
|
|
1585
1585
|
name: ee()
|
|
1586
1586
|
}), En = he({
|
|
1587
|
-
suggestions:
|
|
1587
|
+
suggestions: Nr(he({
|
|
1588
1588
|
full_address: at(ee()),
|
|
1589
1589
|
place_formatted: at(ee()),
|
|
1590
1590
|
name: at(ee()),
|
|
1591
1591
|
mapbox_id: ee(),
|
|
1592
|
-
context:
|
|
1592
|
+
context: Lr(he({
|
|
1593
1593
|
address: ae,
|
|
1594
1594
|
street: ae,
|
|
1595
1595
|
neighborhood: ae,
|
|
@@ -1625,17 +1625,17 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1625
1625
|
error: t("address_error")
|
|
1626
1626
|
};
|
|
1627
1627
|
const {
|
|
1628
|
-
suggestions:
|
|
1628
|
+
suggestions: d
|
|
1629
1629
|
} = u.output;
|
|
1630
1630
|
return {
|
|
1631
1631
|
ok: !0,
|
|
1632
|
-
data:
|
|
1633
|
-
var x,
|
|
1632
|
+
data: d.map((h) => {
|
|
1633
|
+
var x, y, p, k, v, E, S, A, g;
|
|
1634
1634
|
return {
|
|
1635
1635
|
label: h.full_address ?? h.place_formatted ?? h.name ?? h.mapbox_id,
|
|
1636
1636
|
id: h.mapbox_id,
|
|
1637
1637
|
address: {
|
|
1638
|
-
line1: ((x = h.context.address) == null ? void 0 : x.name) ?? ((
|
|
1638
|
+
line1: ((x = h.context.address) == null ? void 0 : x.name) ?? ((y = h.context.street) == null ? void 0 : y.name),
|
|
1639
1639
|
line2: void 0,
|
|
1640
1640
|
line3: ((p = h.context.neighborhood) == null ? void 0 : p.name) ?? ((k = h.context.locality) == null ? void 0 : k.name),
|
|
1641
1641
|
city: ((v = h.context.place) == null ? void 0 : v.name) ?? ((E = h.context.district) == null ? void 0 : E.name),
|
|
@@ -1653,7 +1653,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1653
1653
|
}, [e, t]), Dt = (e) => {
|
|
1654
1654
|
const {
|
|
1655
1655
|
t
|
|
1656
|
-
} =
|
|
1656
|
+
} = J();
|
|
1657
1657
|
return l("button", {
|
|
1658
1658
|
type: "button",
|
|
1659
1659
|
class: "text-neutral-10 hover:bg-neutral-4 hover:text-neutral-12 hover:border-neutral-5 flex items-center gap-1 rounded-[18px] border border-solid border-transparent px-3 py-1 pl-1.5 text-sm transition-colors",
|
|
@@ -1680,14 +1680,14 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1680
1680
|
}) => {
|
|
1681
1681
|
const {
|
|
1682
1682
|
t: n
|
|
1683
|
-
} =
|
|
1684
|
-
enabled:
|
|
1683
|
+
} = J(), [s, a] = Y(), [i, u] = Y([]), {
|
|
1684
|
+
enabled: d,
|
|
1685
1685
|
getPredictions: h
|
|
1686
1686
|
} = In({
|
|
1687
1687
|
logger: r,
|
|
1688
1688
|
t: n
|
|
1689
|
-
}), [x,
|
|
1690
|
-
le(
|
|
1689
|
+
}), [x, y] = Y(d ? "query" : "manual"), [p, k] = Y(""), [v, E] = Y(), S = (A) => {
|
|
1690
|
+
le(d, "Query state should not be enabled"), A = A.trim(), A !== (p == null ? void 0 : p.trim()) && (k(A), A === "" && u([]), E(void 0), h(A).then((g) => {
|
|
1691
1691
|
if (g.ok === !1) {
|
|
1692
1692
|
u([]), E(g.error);
|
|
1693
1693
|
return;
|
|
@@ -1697,16 +1697,16 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1697
1697
|
};
|
|
1698
1698
|
switch (x) {
|
|
1699
1699
|
case "query":
|
|
1700
|
-
return le(
|
|
1700
|
+
return le(d, "Query state should not be enabled"), l(Mn, {
|
|
1701
1701
|
input: e,
|
|
1702
1702
|
onSkip: () => t(null),
|
|
1703
1703
|
onAddressSelect: (A) => {
|
|
1704
1704
|
if (A === "") {
|
|
1705
|
-
a(void 0),
|
|
1705
|
+
a(void 0), y("manual");
|
|
1706
1706
|
return;
|
|
1707
1707
|
}
|
|
1708
1708
|
const g = i.find((T) => T.id === A);
|
|
1709
|
-
g && (a(g.address),
|
|
1709
|
+
g && (a(g.address), y("details"));
|
|
1710
1710
|
},
|
|
1711
1711
|
onAddressSearch: (A) => {
|
|
1712
1712
|
S(A);
|
|
@@ -1723,7 +1723,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1723
1723
|
addressFields: s,
|
|
1724
1724
|
actions: l(Dt, {
|
|
1725
1725
|
onClick: () => {
|
|
1726
|
-
|
|
1726
|
+
y("query");
|
|
1727
1727
|
}
|
|
1728
1728
|
})
|
|
1729
1729
|
});
|
|
@@ -1733,9 +1733,9 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1733
1733
|
input: e,
|
|
1734
1734
|
onSubmitSuccess: t,
|
|
1735
1735
|
addressFields: {},
|
|
1736
|
-
actions:
|
|
1736
|
+
actions: d ? l(Dt, {
|
|
1737
1737
|
onClick: () => {
|
|
1738
|
-
|
|
1738
|
+
y("query");
|
|
1739
1739
|
}
|
|
1740
1740
|
}) : void 0
|
|
1741
1741
|
});
|
|
@@ -1751,22 +1751,22 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1751
1751
|
}) => {
|
|
1752
1752
|
const {
|
|
1753
1753
|
t: u
|
|
1754
|
-
} =
|
|
1754
|
+
} = J(), d = re(null);
|
|
1755
1755
|
return pe(() => {
|
|
1756
|
-
|
|
1756
|
+
d.current && (d.current.focus(), d.current.select());
|
|
1757
1757
|
}, []), l(_e, {
|
|
1758
1758
|
children: [l("form", {
|
|
1759
1759
|
noValidate: !0,
|
|
1760
1760
|
onSubmit: (h) => {
|
|
1761
1761
|
h.preventDefault();
|
|
1762
|
-
const
|
|
1763
|
-
typeof
|
|
1762
|
+
const y = new FormData(h.currentTarget).get("address");
|
|
1763
|
+
typeof y == "string" && a(y);
|
|
1764
1764
|
},
|
|
1765
1765
|
class: "flex gap-1 p-2.5",
|
|
1766
1766
|
children: [l("div", {
|
|
1767
1767
|
class: "group relative flex-1",
|
|
1768
1768
|
children: [l("input", {
|
|
1769
|
-
ref:
|
|
1769
|
+
ref: d,
|
|
1770
1770
|
name: "address",
|
|
1771
1771
|
id: "chat-address",
|
|
1772
1772
|
autocomplete: "address-line1 country-name postal-code",
|
|
@@ -1851,14 +1851,6 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1851
1851
|
}, "")]
|
|
1852
1852
|
})]
|
|
1853
1853
|
});
|
|
1854
|
-
}, Fn = {
|
|
1855
|
-
line1: "Line 1",
|
|
1856
|
-
line2: "Line 2",
|
|
1857
|
-
line3: "Line 3",
|
|
1858
|
-
city: "City",
|
|
1859
|
-
state: "State",
|
|
1860
|
-
postcode: "Postcode",
|
|
1861
|
-
country: "Country"
|
|
1862
1854
|
}, Rt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Ot = ({
|
|
1863
1855
|
addressFields: e,
|
|
1864
1856
|
onSubmitSuccess: t,
|
|
@@ -1868,50 +1860,52 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1868
1860
|
const s = re(null);
|
|
1869
1861
|
pe(() => {
|
|
1870
1862
|
if (s.current) {
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1863
|
+
const u = s.current.querySelector("input");
|
|
1864
|
+
u && (u.focus(), u.select());
|
|
1873
1865
|
}
|
|
1874
1866
|
}, []);
|
|
1875
|
-
const a = Object.keys(gt)
|
|
1867
|
+
const a = Object.keys(gt), {
|
|
1868
|
+
t: i
|
|
1869
|
+
} = J();
|
|
1876
1870
|
return l("form", {
|
|
1877
1871
|
class: "bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",
|
|
1878
|
-
onSubmit: (
|
|
1879
|
-
const
|
|
1872
|
+
onSubmit: (u) => {
|
|
1873
|
+
const d = new FormData(u.currentTarget), h = Object.fromEntries(d.entries());
|
|
1880
1874
|
t({
|
|
1881
1875
|
type: "address",
|
|
1882
|
-
value:
|
|
1876
|
+
value: h
|
|
1883
1877
|
});
|
|
1884
1878
|
},
|
|
1885
1879
|
children: [l("div", {
|
|
1886
1880
|
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]",
|
|
1887
1881
|
ref: s,
|
|
1888
|
-
children: Rt.map((
|
|
1889
|
-
const
|
|
1890
|
-
return
|
|
1882
|
+
children: Rt.map((u, d) => {
|
|
1883
|
+
const h = `isdk_${u}`, x = n.config.keys[u];
|
|
1884
|
+
return x ? l(_e, {
|
|
1891
1885
|
children: [l("label", {
|
|
1892
|
-
for:
|
|
1886
|
+
for: h,
|
|
1893
1887
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1894
|
-
children:
|
|
1888
|
+
children: i(u)
|
|
1895
1889
|
}), l("div", {
|
|
1896
1890
|
class: "flex flex-col items-stretch gap-1.5",
|
|
1897
|
-
children: [
|
|
1891
|
+
children: [u === "country" ? l("div", {
|
|
1898
1892
|
class: "relative",
|
|
1899
1893
|
children: [l("select", {
|
|
1900
1894
|
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",
|
|
1901
|
-
name:
|
|
1902
|
-
id:
|
|
1903
|
-
defaultValue: e[
|
|
1895
|
+
name: x,
|
|
1896
|
+
id: h,
|
|
1897
|
+
defaultValue: e[u],
|
|
1904
1898
|
required: !0,
|
|
1905
1899
|
children: [e.country && !a.includes(e.country) ? l("option", {
|
|
1906
|
-
value: e[
|
|
1907
|
-
children: e[
|
|
1900
|
+
value: e[u],
|
|
1901
|
+
children: e[u]
|
|
1908
1902
|
}) : l("option", {
|
|
1909
1903
|
value: "",
|
|
1910
|
-
children: "
|
|
1911
|
-
}), a.map((
|
|
1912
|
-
value:
|
|
1913
|
-
children:
|
|
1914
|
-
},
|
|
1904
|
+
children: i("select_country")
|
|
1905
|
+
}), a.map((y) => l("option", {
|
|
1906
|
+
value: y,
|
|
1907
|
+
children: y
|
|
1908
|
+
}, y))]
|
|
1915
1909
|
}), l("svg", {
|
|
1916
1910
|
class: "text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",
|
|
1917
1911
|
width: "16",
|
|
@@ -1928,13 +1922,13 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1928
1922
|
})
|
|
1929
1923
|
})]
|
|
1930
1924
|
}) : l("input", {
|
|
1931
|
-
autoFocus:
|
|
1925
|
+
autoFocus: d === 0 ? !0 : void 0,
|
|
1932
1926
|
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",
|
|
1933
|
-
name:
|
|
1934
|
-
id:
|
|
1935
|
-
defaultValue: e[
|
|
1927
|
+
name: x,
|
|
1928
|
+
id: h,
|
|
1929
|
+
defaultValue: e[u],
|
|
1936
1930
|
required: !0
|
|
1937
|
-
}),
|
|
1931
|
+
}), d === Rt.length - 1 ? l("hr", {
|
|
1938
1932
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1939
1933
|
}) : l("hr", {
|
|
1940
1934
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1958,7 +1952,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1958
1952
|
var t;
|
|
1959
1953
|
(t = e.current) == null || t.focus();
|
|
1960
1954
|
}, []), e;
|
|
1961
|
-
}, cr = ["true", "false"],
|
|
1955
|
+
}, cr = ["true", "false"], Fn = Rr(cr), Nn = "answer", dr = "flex items-center gap-2 p-2.5", fr = sr(({
|
|
1962
1956
|
label: e,
|
|
1963
1957
|
...t
|
|
1964
1958
|
}, r) => l("button", {
|
|
@@ -1969,7 +1963,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1969
1963
|
class: "truncate text-center text-base",
|
|
1970
1964
|
children: e
|
|
1971
1965
|
})
|
|
1972
|
-
})),
|
|
1966
|
+
})), Ln = ({
|
|
1973
1967
|
input: e,
|
|
1974
1968
|
onSubmitSuccess: t
|
|
1975
1969
|
}) => {
|
|
@@ -1979,7 +1973,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1979
1973
|
class: "",
|
|
1980
1974
|
onSubmit: (n) => {
|
|
1981
1975
|
n.preventDefault();
|
|
1982
|
-
const s = Dr(n).value, a = ar(
|
|
1976
|
+
const s = Dr(n).value, a = ar(Fn, s);
|
|
1983
1977
|
t({
|
|
1984
1978
|
type: "boolean",
|
|
1985
1979
|
value: a === "true"
|
|
@@ -2006,17 +2000,17 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2006
2000
|
})
|
|
2007
2001
|
})]
|
|
2008
2002
|
});
|
|
2009
|
-
},
|
|
2003
|
+
}, Tn = (e) => new Promise((t, r) => {
|
|
2010
2004
|
const n = new FileReader();
|
|
2011
2005
|
n.readAsDataURL(e), n.onload = () => n.result ? t(n.result.toString()) : r("No result from reader"), n.onerror = r;
|
|
2012
|
-
}),
|
|
2006
|
+
}), Dn = (e) => e.reduce((t, r) => t + r.sizeKb, 0), Rn = Se("file"), Bt = 3, On = ({
|
|
2013
2007
|
file: e,
|
|
2014
2008
|
class: t,
|
|
2015
2009
|
...r
|
|
2016
2010
|
}) => {
|
|
2017
2011
|
const n = e.name.split(".").pop(), s = e.name.replace(new RegExp(`.${n}$`), "");
|
|
2018
2012
|
return l("div", {
|
|
2019
|
-
class:
|
|
2013
|
+
class: Le("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", t),
|
|
2020
2014
|
...r,
|
|
2021
2015
|
children: [l("p", {
|
|
2022
2016
|
"aria-label": "File name",
|
|
@@ -2030,43 +2024,43 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2030
2024
|
}), l("p", {
|
|
2031
2025
|
"aria-label": "File size",
|
|
2032
2026
|
class: "text-accent-11",
|
|
2033
|
-
children:
|
|
2027
|
+
children: Ne(e.sizeKb)
|
|
2034
2028
|
})]
|
|
2035
2029
|
});
|
|
2036
2030
|
}, Pt = ({
|
|
2037
2031
|
class: e,
|
|
2038
2032
|
...t
|
|
2039
2033
|
}) => l("li", {
|
|
2040
|
-
class:
|
|
2034
|
+
class: Le("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2041
2035
|
...t
|
|
2042
2036
|
}), hr = (e) => {
|
|
2043
2037
|
const t = e.split(".").pop();
|
|
2044
2038
|
if (!t)
|
|
2045
2039
|
throw new Error("No file extension found");
|
|
2046
2040
|
return t ? "." + t : "";
|
|
2047
|
-
},
|
|
2041
|
+
}, Bn = ({
|
|
2048
2042
|
allowedExtensions: e,
|
|
2049
2043
|
files: t
|
|
2050
2044
|
}) => {
|
|
2051
2045
|
const r = e.map((n) => n.toLowerCase());
|
|
2052
2046
|
return t.every((n) => r.includes(hr(n.name).toLowerCase()));
|
|
2053
|
-
},
|
|
2047
|
+
}, Pn = (e, t) => {
|
|
2054
2048
|
const r = hr(e);
|
|
2055
2049
|
return `${e.replace(new RegExp(`${r}$`), "").slice(0, t)}${r}`;
|
|
2056
|
-
},
|
|
2050
|
+
}, $n = ({
|
|
2057
2051
|
input: e,
|
|
2058
2052
|
onSubmitSuccess: t
|
|
2059
2053
|
}) => {
|
|
2060
|
-
var
|
|
2061
|
-
const r = (
|
|
2054
|
+
var y;
|
|
2055
|
+
const r = (y = M.current$.value.flow) == null ? void 0 : y.data.submissions[e.key], [n, s] = Y(Rn(r) ? r.value : []), [a, i] = Y(), u = n.length - Bt, d = Dn(n), h = yt(), {
|
|
2062
2056
|
t: x
|
|
2063
|
-
} =
|
|
2057
|
+
} = J();
|
|
2064
2058
|
return l("form", {
|
|
2065
2059
|
class: "flex flex-col gap-1 p-2.5",
|
|
2066
2060
|
onSubmit: (p) => (p.preventDefault(), i(void 0), n.length === 0 ? i({
|
|
2067
2061
|
type: "required",
|
|
2068
2062
|
message: x("validation_file")
|
|
2069
|
-
}) : e.config.extensions.length > 0 && !
|
|
2063
|
+
}) : e.config.extensions.length > 0 && !Bn({
|
|
2070
2064
|
allowedExtensions: e.config.extensions,
|
|
2071
2065
|
files: n
|
|
2072
2066
|
}) ? i({
|
|
@@ -2074,9 +2068,9 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2074
2068
|
message: `${x("validation_file_ext", {
|
|
2075
2069
|
ext: e.config.extensions.join(", ")
|
|
2076
2070
|
})}`
|
|
2077
|
-
}) : e.config.fileSizeLimitKib &&
|
|
2071
|
+
}) : e.config.fileSizeLimitKib && d > e.config.fileSizeLimitKib ? i({
|
|
2078
2072
|
type: "max",
|
|
2079
|
-
message: `File size exceeds limit of ${
|
|
2073
|
+
message: `File size exceeds limit of ${Ne(e.config.fileSizeLimitKib)}`
|
|
2080
2074
|
}) : e.config.allowMultiple === !1 && n.length > 1 ? i({
|
|
2081
2075
|
type: "invalid",
|
|
2082
2076
|
message: x("validation_file_max", {
|
|
@@ -2111,7 +2105,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2111
2105
|
}) : null]
|
|
2112
2106
|
}), l("p", {
|
|
2113
2107
|
class: "text-neutral-11 text-xs",
|
|
2114
|
-
children: [
|
|
2108
|
+
children: [Ne(d), " ", n.length > 1 ? "total" : ""]
|
|
2115
2109
|
})]
|
|
2116
2110
|
}) : l("div", {
|
|
2117
2111
|
class: "flex flex-col justify-center gap-4 pb-6 pt-5",
|
|
@@ -2138,7 +2132,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2138
2132
|
}), e.config.fileSizeLimitKib ? l("p", {
|
|
2139
2133
|
class: "text-neutral-10 text-xs",
|
|
2140
2134
|
children: ["(", x("file_max_size", {
|
|
2141
|
-
size:
|
|
2135
|
+
size: Ne(e.config.fileSizeLimitKib)
|
|
2142
2136
|
}), ")"]
|
|
2143
2137
|
}) : null]
|
|
2144
2138
|
}), l("aside", {
|
|
@@ -2161,9 +2155,9 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2161
2155
|
onInput: async (p) => {
|
|
2162
2156
|
le(p.target instanceof HTMLInputElement);
|
|
2163
2157
|
const k = p.target.files ? Array.from(p.target.files) : [], v = await Promise.allSettled(k.map(async (S) => {
|
|
2164
|
-
const A = await
|
|
2158
|
+
const A = await Tn(S);
|
|
2165
2159
|
return {
|
|
2166
|
-
name:
|
|
2160
|
+
name: Pn(S.name, 42),
|
|
2167
2161
|
data: A,
|
|
2168
2162
|
sizeKb: S.size / 1e3
|
|
2169
2163
|
};
|
|
@@ -2197,7 +2191,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2197
2191
|
};
|
|
2198
2192
|
var De = (e) => e.type === "checkbox", ke = (e) => e instanceof Date, U = (e) => e == null;
|
|
2199
2193
|
const pr = (e) => typeof e == "object";
|
|
2200
|
-
var $ = (e) => !U(e) && !Array.isArray(e) && pr(e) && !ke(e),
|
|
2194
|
+
var $ = (e) => !U(e) && !Array.isArray(e) && pr(e) && !ke(e), jn = (e) => $(e) && e.target ? De(e.target) ? e.target.checked : e.target.value : e, zn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, qn = (e, t) => e.has(zn(t)), Un = (e) => {
|
|
2201
2195
|
const t = e.constructor && e.constructor.prototype;
|
|
2202
2196
|
return $(t) && t.hasOwnProperty("isPrototypeOf");
|
|
2203
2197
|
}, bt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -2209,7 +2203,7 @@ function oe(e) {
|
|
|
2209
2203
|
else if (e instanceof Set)
|
|
2210
2204
|
t = new Set(e);
|
|
2211
2205
|
else if (!(bt && (e instanceof Blob || e instanceof FileList)) && (r || $(e)))
|
|
2212
|
-
if (t = r ? [] : {}, !r && !
|
|
2206
|
+
if (t = r ? [] : {}, !r && !Un(e))
|
|
2213
2207
|
t = e;
|
|
2214
2208
|
else
|
|
2215
2209
|
for (const n in e)
|
|
@@ -2228,7 +2222,7 @@ const $t = {
|
|
|
2228
2222
|
BLUR: "blur",
|
|
2229
2223
|
FOCUS_OUT: "focusout",
|
|
2230
2224
|
CHANGE: "change"
|
|
2231
|
-
},
|
|
2225
|
+
}, Z = {
|
|
2232
2226
|
onBlur: "onBlur",
|
|
2233
2227
|
onChange: "onChange",
|
|
2234
2228
|
onSubmit: "onSubmit",
|
|
@@ -2244,7 +2238,7 @@ const $t = {
|
|
|
2244
2238
|
validate: "validate"
|
|
2245
2239
|
};
|
|
2246
2240
|
X.createContext(null);
|
|
2247
|
-
var
|
|
2241
|
+
var Kn = (e, t, r, n = !0) => {
|
|
2248
2242
|
const s = {
|
|
2249
2243
|
defaultValues: t._defaultValues
|
|
2250
2244
|
};
|
|
@@ -2252,16 +2246,16 @@ var Gn = (e, t, r, n = !0) => {
|
|
|
2252
2246
|
Object.defineProperty(s, a, {
|
|
2253
2247
|
get: () => {
|
|
2254
2248
|
const i = a;
|
|
2255
|
-
return t._proxyFormState[i] !==
|
|
2249
|
+
return t._proxyFormState[i] !== Z.all && (t._proxyFormState[i] = !n || Z.all), r && (r[i] = !0), e[i];
|
|
2256
2250
|
}
|
|
2257
2251
|
});
|
|
2258
2252
|
return s;
|
|
2259
|
-
}, W = (e) => $(e) && !Object.keys(e).length,
|
|
2253
|
+
}, W = (e) => $(e) && !Object.keys(e).length, Gn = (e, t, r, n) => {
|
|
2260
2254
|
r(e);
|
|
2261
2255
|
const { name: s, ...a } = e;
|
|
2262
|
-
return W(a) || Object.keys(a).length >= Object.keys(t).length || Object.keys(a).find((i) => t[i] === (!n ||
|
|
2256
|
+
return W(a) || Object.keys(a).length >= Object.keys(t).length || Object.keys(a).find((i) => t[i] === (!n || Z.all));
|
|
2263
2257
|
}, it = (e) => Array.isArray(e) ? e : [e];
|
|
2264
|
-
function
|
|
2258
|
+
function Hn(e) {
|
|
2265
2259
|
const t = X.useRef(e);
|
|
2266
2260
|
t.current = e, X.useEffect(() => {
|
|
2267
2261
|
const r = !e.disabled && t.current.subject && t.current.subject.subscribe({
|
|
@@ -2272,18 +2266,18 @@ function Wn(e) {
|
|
|
2272
2266
|
};
|
|
2273
2267
|
}, [e.disabled]);
|
|
2274
2268
|
}
|
|
2275
|
-
var te = (e) => typeof e == "string",
|
|
2276
|
-
function
|
|
2269
|
+
var te = (e) => typeof e == "string", Wn = (e, t, r, n, s) => te(e) ? (n && t.watch.add(e), w(r, e, s)) : Array.isArray(e) ? e.map((a) => (n && t.watch.add(a), w(r, a))) : (n && (t.watchAll = !0), r), vt = (e) => /^\w*$/.test(e), mr = (e) => Re(e.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
2270
|
+
function N(e, t, r) {
|
|
2277
2271
|
let n = -1;
|
|
2278
2272
|
const s = vt(t) ? [t] : mr(t), a = s.length, i = a - 1;
|
|
2279
2273
|
for (; ++n < a; ) {
|
|
2280
2274
|
const u = s[n];
|
|
2281
|
-
let
|
|
2275
|
+
let d = r;
|
|
2282
2276
|
if (n !== i) {
|
|
2283
2277
|
const h = e[u];
|
|
2284
|
-
|
|
2278
|
+
d = $(h) || Array.isArray(h) ? h : isNaN(+s[n + 1]) ? {} : [];
|
|
2285
2279
|
}
|
|
2286
|
-
e[u] =
|
|
2280
|
+
e[u] = d, e = e[u];
|
|
2287
2281
|
}
|
|
2288
2282
|
return e;
|
|
2289
2283
|
}
|
|
@@ -2294,11 +2288,11 @@ var gr = (e, t, r, n, s) => t ? {
|
|
|
2294
2288
|
[n]: s || !0
|
|
2295
2289
|
}
|
|
2296
2290
|
} : {}, jt = (e) => ({
|
|
2297
|
-
isOnSubmit: !e || e ===
|
|
2298
|
-
isOnBlur: e ===
|
|
2299
|
-
isOnChange: e ===
|
|
2300
|
-
isOnAll: e ===
|
|
2301
|
-
isOnTouch: e ===
|
|
2291
|
+
isOnSubmit: !e || e === Z.onSubmit,
|
|
2292
|
+
isOnBlur: e === Z.onBlur,
|
|
2293
|
+
isOnChange: e === Z.onChange,
|
|
2294
|
+
isOnAll: e === Z.all,
|
|
2295
|
+
isOnTouch: e === Z.onTouched
|
|
2302
2296
|
}), zt = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2303
2297
|
const ze = (e, t, r, n) => {
|
|
2304
2298
|
for (const s of r || Object.keys(e)) {
|
|
@@ -2315,9 +2309,9 @@ const ze = (e, t, r, n) => {
|
|
|
2315
2309
|
}
|
|
2316
2310
|
}
|
|
2317
2311
|
};
|
|
2318
|
-
var
|
|
2312
|
+
var Jn = (e, t, r) => {
|
|
2319
2313
|
const n = Re(w(e, r));
|
|
2320
|
-
return
|
|
2314
|
+
return N(n, "root", t[r]), N(e, r, n), e;
|
|
2321
2315
|
}, xt = (e) => e.type === "file", fe = (e) => typeof e == "function", Ge = (e) => {
|
|
2322
2316
|
if (!bt)
|
|
2323
2317
|
return !1;
|
|
@@ -2361,7 +2355,7 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2361
2355
|
value: e,
|
|
2362
2356
|
message: ""
|
|
2363
2357
|
}, Ht = async (e, t, r, n, s) => {
|
|
2364
|
-
const { ref: a, refs: i, required: u, maxLength:
|
|
2358
|
+
const { ref: a, refs: i, required: u, maxLength: d, minLength: h, min: x, max: y, pattern: p, validate: k, name: v, valueAsNumber: E, mount: S, disabled: A } = e._f, g = w(t, v);
|
|
2365
2359
|
if (!S || A)
|
|
2366
2360
|
return {};
|
|
2367
2361
|
const T = i ? i[0] : a, P = (F) => {
|
|
@@ -2385,9 +2379,9 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2385
2379
|
}, !r))
|
|
2386
2380
|
return P(V), D;
|
|
2387
2381
|
}
|
|
2388
|
-
if (!G && (!U(x) || !U(
|
|
2382
|
+
if (!G && (!U(x) || !U(y))) {
|
|
2389
2383
|
let F, V;
|
|
2390
|
-
const R = we(
|
|
2384
|
+
const R = we(y), K = we(x);
|
|
2391
2385
|
if (!U(g) && !isNaN(g)) {
|
|
2392
2386
|
const H = a.valueAsNumber || g && +g;
|
|
2393
2387
|
U(R.value) || (F = H > R.value), U(K.value) || (V = H < K.value);
|
|
@@ -2398,8 +2392,8 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2398
2392
|
if ((F || V) && (q(!!F, R.message, K.message, ie.max, ie.min), !r))
|
|
2399
2393
|
return P(D[v].message), D;
|
|
2400
2394
|
}
|
|
2401
|
-
if ((
|
|
2402
|
-
const F = we(
|
|
2395
|
+
if ((d || h) && !G && (te(g) || s && Array.isArray(g))) {
|
|
2396
|
+
const F = we(d), V = we(h), R = !U(F.value) && g.length > +F.value, K = !U(V.value) && g.length < +V.value;
|
|
2403
2397
|
if ((R || K) && (q(R, F.message, V.message), !r))
|
|
2404
2398
|
return P(D[v].message), D;
|
|
2405
2399
|
}
|
|
@@ -2441,22 +2435,22 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2441
2435
|
}
|
|
2442
2436
|
return P(!0), D;
|
|
2443
2437
|
};
|
|
2444
|
-
function
|
|
2438
|
+
function Zn(e, t) {
|
|
2445
2439
|
const r = t.slice(0, -1).length;
|
|
2446
2440
|
let n = 0;
|
|
2447
2441
|
for (; n < r; )
|
|
2448
2442
|
e = O(e) ? n++ : e[t[n++]];
|
|
2449
2443
|
return e;
|
|
2450
2444
|
}
|
|
2451
|
-
function
|
|
2445
|
+
function Qn(e) {
|
|
2452
2446
|
for (const t in e)
|
|
2453
2447
|
if (e.hasOwnProperty(t) && !O(e[t]))
|
|
2454
2448
|
return !1;
|
|
2455
2449
|
return !0;
|
|
2456
2450
|
}
|
|
2457
2451
|
function j(e, t) {
|
|
2458
|
-
const r = Array.isArray(t) ? t : vt(t) ? [t] : mr(t), n = r.length === 1 ? e :
|
|
2459
|
-
return n && delete n[a], s !== 0 && ($(n) && W(n) || Array.isArray(n) &&
|
|
2452
|
+
const r = Array.isArray(t) ? t : vt(t) ? [t] : mr(t), n = r.length === 1 ? e : Zn(e, r), s = r.length - 1, a = r[s];
|
|
2453
|
+
return n && delete n[a], s !== 0 && ($(n) && W(n) || Array.isArray(n) && Qn(n)) && j(e, r.slice(0, -1)), e;
|
|
2460
2454
|
}
|
|
2461
2455
|
function ot() {
|
|
2462
2456
|
let e = [];
|
|
@@ -2499,7 +2493,7 @@ function ye(e, t) {
|
|
|
2499
2493
|
}
|
|
2500
2494
|
return !0;
|
|
2501
2495
|
}
|
|
2502
|
-
var vr = (e) => e.type === "select-multiple",
|
|
2496
|
+
var vr = (e) => e.type === "select-multiple", Xn = (e) => wt(e) || De(e), lt = (e) => Ge(e) && e.isConnected, xr = (e) => {
|
|
2503
2497
|
for (const t in e)
|
|
2504
2498
|
if (fe(e[t]))
|
|
2505
2499
|
return !0;
|
|
@@ -2525,11 +2519,11 @@ function ct(e) {
|
|
|
2525
2519
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : t.disabled))
|
|
2526
2520
|
return xt(t) ? t.files : wt(t) ? br(e.refs).value : vr(t) ? [...t.selectedOptions].map(({ value: r }) => r) : De(t) ? yr(e.refs).value : kr(O(t.value) ? e.ref.value : t.value, e);
|
|
2527
2521
|
}
|
|
2528
|
-
var
|
|
2522
|
+
var Yn = (e, t, r, n) => {
|
|
2529
2523
|
const s = {};
|
|
2530
2524
|
for (const a of e) {
|
|
2531
2525
|
const i = w(t, a);
|
|
2532
|
-
i &&
|
|
2526
|
+
i && N(s, a, i._f);
|
|
2533
2527
|
}
|
|
2534
2528
|
return {
|
|
2535
2529
|
criteriaMode: r,
|
|
@@ -2537,7 +2531,7 @@ var es = (e, t, r, n) => {
|
|
|
2537
2531
|
fields: s,
|
|
2538
2532
|
shouldUseNativeValidation: n
|
|
2539
2533
|
};
|
|
2540
|
-
}, Ve = (e) => O(e) ? e : He(e) ? e.source : $(e) ? He(e.value) ? e.value.source : e.value : e,
|
|
2534
|
+
}, Ve = (e) => O(e) ? e : He(e) ? e.source : $(e) ? He(e.value) ? e.value.source : e.value : e, es = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
2541
2535
|
function Wt(e, t, r) {
|
|
2542
2536
|
const n = w(e, r);
|
|
2543
2537
|
if (n || vt(r))
|
|
@@ -2561,15 +2555,15 @@ function Wt(e, t, r) {
|
|
|
2561
2555
|
name: r
|
|
2562
2556
|
};
|
|
2563
2557
|
}
|
|
2564
|
-
var
|
|
2565
|
-
const
|
|
2566
|
-
mode:
|
|
2567
|
-
reValidateMode:
|
|
2558
|
+
var ts = (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, rs = (e, t) => !Re(w(e, t)).length && j(e, t);
|
|
2559
|
+
const ns = {
|
|
2560
|
+
mode: Z.onSubmit,
|
|
2561
|
+
reValidateMode: Z.onChange,
|
|
2568
2562
|
shouldFocusError: !0
|
|
2569
2563
|
};
|
|
2570
|
-
function
|
|
2564
|
+
function ss(e = {}, t) {
|
|
2571
2565
|
let r = {
|
|
2572
|
-
...
|
|
2566
|
+
...ns,
|
|
2573
2567
|
...e
|
|
2574
2568
|
}, n = {
|
|
2575
2569
|
submitCount: 0,
|
|
@@ -2588,13 +2582,13 @@ function as(e = {}, t) {
|
|
|
2588
2582
|
action: !1,
|
|
2589
2583
|
mount: !1,
|
|
2590
2584
|
watch: !1
|
|
2591
|
-
},
|
|
2585
|
+
}, d = {
|
|
2592
2586
|
mount: /* @__PURE__ */ new Set(),
|
|
2593
2587
|
unMount: /* @__PURE__ */ new Set(),
|
|
2594
2588
|
array: /* @__PURE__ */ new Set(),
|
|
2595
2589
|
watch: /* @__PURE__ */ new Set()
|
|
2596
2590
|
}, h, x = 0;
|
|
2597
|
-
const
|
|
2591
|
+
const y = {
|
|
2598
2592
|
isDirty: !1,
|
|
2599
2593
|
dirtyFields: !1,
|
|
2600
2594
|
touchedFields: !1,
|
|
@@ -2605,71 +2599,71 @@ function as(e = {}, t) {
|
|
|
2605
2599
|
values: ot(),
|
|
2606
2600
|
array: ot(),
|
|
2607
2601
|
state: ot()
|
|
2608
|
-
}, k = e.resetOptions && e.resetOptions.keepDirtyValues, v = jt(r.mode), E = jt(r.reValidateMode), S = r.criteriaMode ===
|
|
2609
|
-
clearTimeout(x), x = setTimeout(o,
|
|
2602
|
+
}, k = e.resetOptions && e.resetOptions.keepDirtyValues, v = jt(r.mode), E = jt(r.reValidateMode), S = r.criteriaMode === Z.all, A = (o) => (c) => {
|
|
2603
|
+
clearTimeout(x), x = setTimeout(o, c);
|
|
2610
2604
|
}, g = async (o) => {
|
|
2611
|
-
if (
|
|
2612
|
-
const
|
|
2613
|
-
|
|
2614
|
-
isValid:
|
|
2605
|
+
if (y.isValid || o) {
|
|
2606
|
+
const c = r.resolver ? W((await G()).errors) : await q(s, !0);
|
|
2607
|
+
c !== n.isValid && p.state.next({
|
|
2608
|
+
isValid: c
|
|
2615
2609
|
});
|
|
2616
2610
|
}
|
|
2617
|
-
}, T = (o) =>
|
|
2611
|
+
}, T = (o) => y.isValidating && p.state.next({
|
|
2618
2612
|
isValidating: o
|
|
2619
|
-
}), P = (o,
|
|
2613
|
+
}), P = (o, c = [], f, _, b = !0, m = !0) => {
|
|
2620
2614
|
if (_ && f) {
|
|
2621
2615
|
if (u.action = !0, m && Array.isArray(w(s, o))) {
|
|
2622
2616
|
const C = f(w(s, o), _.argA, _.argB);
|
|
2623
|
-
|
|
2617
|
+
b && N(s, o, C);
|
|
2624
2618
|
}
|
|
2625
2619
|
if (m && Array.isArray(w(n.errors, o))) {
|
|
2626
2620
|
const C = f(w(n.errors, o), _.argA, _.argB);
|
|
2627
|
-
|
|
2621
|
+
b && N(n.errors, o, C), rs(n.errors, o);
|
|
2628
2622
|
}
|
|
2629
|
-
if (
|
|
2623
|
+
if (y.touchedFields && m && Array.isArray(w(n.touchedFields, o))) {
|
|
2630
2624
|
const C = f(w(n.touchedFields, o), _.argA, _.argB);
|
|
2631
|
-
|
|
2625
|
+
b && N(n.touchedFields, o, C);
|
|
2632
2626
|
}
|
|
2633
|
-
|
|
2627
|
+
y.dirtyFields && (n.dirtyFields = ut(a, i)), p.state.next({
|
|
2634
2628
|
name: o,
|
|
2635
|
-
isDirty: V(o,
|
|
2629
|
+
isDirty: V(o, c),
|
|
2636
2630
|
dirtyFields: n.dirtyFields,
|
|
2637
2631
|
errors: n.errors,
|
|
2638
2632
|
isValid: n.isValid
|
|
2639
2633
|
});
|
|
2640
2634
|
} else
|
|
2641
|
-
|
|
2642
|
-
}, D = (o,
|
|
2643
|
-
|
|
2635
|
+
N(i, o, c);
|
|
2636
|
+
}, D = (o, c) => {
|
|
2637
|
+
N(n.errors, o, c), p.state.next({
|
|
2644
2638
|
errors: n.errors
|
|
2645
2639
|
});
|
|
2646
|
-
}, me = (o,
|
|
2647
|
-
const
|
|
2648
|
-
if (
|
|
2640
|
+
}, me = (o, c, f, _) => {
|
|
2641
|
+
const b = w(s, o);
|
|
2642
|
+
if (b) {
|
|
2649
2643
|
const m = w(i, o, O(f) ? w(a, o) : f);
|
|
2650
|
-
O(m) || _ && _.defaultChecked ||
|
|
2644
|
+
O(m) || _ && _.defaultChecked || c ? N(i, o, c ? m : ct(b._f)) : H(o, m), u.mount && g();
|
|
2651
2645
|
}
|
|
2652
|
-
}, ce = (o,
|
|
2646
|
+
}, ce = (o, c, f, _, b) => {
|
|
2653
2647
|
let m = !1, C = !1;
|
|
2654
|
-
const
|
|
2648
|
+
const L = {
|
|
2655
2649
|
name: o
|
|
2656
2650
|
};
|
|
2657
2651
|
if (!f || _) {
|
|
2658
|
-
|
|
2659
|
-
const B = ye(w(a, o),
|
|
2660
|
-
C = w(n.dirtyFields, o), B ? j(n.dirtyFields, o) :
|
|
2652
|
+
y.isDirty && (C = n.isDirty, n.isDirty = L.isDirty = V(), m = C !== L.isDirty);
|
|
2653
|
+
const B = ye(w(a, o), c);
|
|
2654
|
+
C = w(n.dirtyFields, o), B ? j(n.dirtyFields, o) : N(n.dirtyFields, o, !0), L.dirtyFields = n.dirtyFields, m = m || y.dirtyFields && C !== !B;
|
|
2661
2655
|
}
|
|
2662
2656
|
if (f) {
|
|
2663
2657
|
const B = w(n.touchedFields, o);
|
|
2664
|
-
B || (
|
|
2658
|
+
B || (N(n.touchedFields, o, f), L.touchedFields = n.touchedFields, m = m || y.touchedFields && B !== f);
|
|
2665
2659
|
}
|
|
2666
|
-
return m &&
|
|
2667
|
-
}, Ae = (o,
|
|
2668
|
-
const
|
|
2669
|
-
if (e.delayError && f ? (h = A(() => D(o, f)), h(e.delayError)) : (clearTimeout(x), h = null, f ?
|
|
2660
|
+
return m && b && p.state.next(L), m ? L : {};
|
|
2661
|
+
}, Ae = (o, c, f, _) => {
|
|
2662
|
+
const b = w(n.errors, o), m = y.isValid && de(c) && n.isValid !== c;
|
|
2663
|
+
if (e.delayError && f ? (h = A(() => D(o, f)), h(e.delayError)) : (clearTimeout(x), h = null, f ? N(n.errors, o, f) : j(n.errors, o)), (f ? !ye(b, f) : b) || !W(_) || m) {
|
|
2670
2664
|
const C = {
|
|
2671
2665
|
..._,
|
|
2672
|
-
...m && de(
|
|
2666
|
+
...m && de(c) ? { isValid: c } : {},
|
|
2673
2667
|
errors: n.errors,
|
|
2674
2668
|
name: o
|
|
2675
2669
|
};
|
|
@@ -2679,198 +2673,198 @@ function as(e = {}, t) {
|
|
|
2679
2673
|
}, p.state.next(C);
|
|
2680
2674
|
}
|
|
2681
2675
|
T(!1);
|
|
2682
|
-
}, G = async (o) => r.resolver(i, r.context,
|
|
2683
|
-
const { errors:
|
|
2676
|
+
}, G = async (o) => r.resolver(i, r.context, Yn(o || d.mount, s, r.criteriaMode, r.shouldUseNativeValidation)), se = async (o) => {
|
|
2677
|
+
const { errors: c } = await G(o);
|
|
2684
2678
|
if (o)
|
|
2685
2679
|
for (const f of o) {
|
|
2686
|
-
const _ = w(
|
|
2687
|
-
_ ?
|
|
2680
|
+
const _ = w(c, f);
|
|
2681
|
+
_ ? N(n.errors, f, _) : j(n.errors, f);
|
|
2688
2682
|
}
|
|
2689
2683
|
else
|
|
2690
|
-
n.errors =
|
|
2691
|
-
return
|
|
2692
|
-
}, q = async (o,
|
|
2684
|
+
n.errors = c;
|
|
2685
|
+
return c;
|
|
2686
|
+
}, q = async (o, c, f = {
|
|
2693
2687
|
valid: !0
|
|
2694
2688
|
}) => {
|
|
2695
2689
|
for (const _ in o) {
|
|
2696
|
-
const
|
|
2697
|
-
if (
|
|
2698
|
-
const { _f: m, ...C } =
|
|
2690
|
+
const b = o[_];
|
|
2691
|
+
if (b) {
|
|
2692
|
+
const { _f: m, ...C } = b;
|
|
2699
2693
|
if (m) {
|
|
2700
|
-
const
|
|
2701
|
-
if (B[m.name] && (f.valid = !1,
|
|
2694
|
+
const L = d.array.has(m.name), B = await Ht(b, i, S, r.shouldUseNativeValidation && !c, L);
|
|
2695
|
+
if (B[m.name] && (f.valid = !1, c))
|
|
2702
2696
|
break;
|
|
2703
|
-
!
|
|
2697
|
+
!c && (w(B, m.name) ? L ? Jn(n.errors, B, m.name) : N(n.errors, m.name, B[m.name]) : j(n.errors, m.name));
|
|
2704
2698
|
}
|
|
2705
|
-
C && await q(C,
|
|
2699
|
+
C && await q(C, c, f);
|
|
2706
2700
|
}
|
|
2707
2701
|
}
|
|
2708
2702
|
return f.valid;
|
|
2709
2703
|
}, F = () => {
|
|
2710
|
-
for (const o of
|
|
2711
|
-
const
|
|
2712
|
-
|
|
2704
|
+
for (const o of d.unMount) {
|
|
2705
|
+
const c = w(s, o);
|
|
2706
|
+
c && (c._f.refs ? c._f.refs.every((f) => !lt(f)) : !lt(c._f.ref)) && tt(o);
|
|
2713
2707
|
}
|
|
2714
|
-
|
|
2715
|
-
}, V = (o,
|
|
2716
|
-
...u.mount ? i : O(
|
|
2717
|
-
}, f,
|
|
2708
|
+
d.unMount = /* @__PURE__ */ new Set();
|
|
2709
|
+
}, V = (o, c) => (o && c && N(i, o, c), !ye(kt(), a)), R = (o, c, f) => Wn(o, d, {
|
|
2710
|
+
...u.mount ? i : O(c) ? a : te(o) ? { [o]: c } : c
|
|
2711
|
+
}, f, c), K = (o) => Re(w(u.mount ? i : a, o, e.shouldUnregister ? w(a, o, []) : [])), H = (o, c, f = {}) => {
|
|
2718
2712
|
const _ = w(s, o);
|
|
2719
|
-
let
|
|
2713
|
+
let b = c;
|
|
2720
2714
|
if (_) {
|
|
2721
2715
|
const m = _._f;
|
|
2722
|
-
m && (!m.disabled &&
|
|
2716
|
+
m && (!m.disabled && N(i, o, kr(c, m)), b = Ge(m.ref) && U(c) ? "" : c, vr(m.ref) ? [...m.ref.options].forEach((C) => C.selected = b.includes(C.value)) : m.refs ? De(m.ref) ? m.refs.length > 1 ? m.refs.forEach((C) => (!C.defaultChecked || !C.disabled) && (C.checked = Array.isArray(b) ? !!b.find((L) => L === C.value) : b === C.value)) : m.refs[0] && (m.refs[0].checked = !!b) : m.refs.forEach((C) => C.checked = C.value === b) : xt(m.ref) ? m.ref.value = "" : (m.ref.value = b, m.ref.type || p.values.next({
|
|
2723
2717
|
name: o,
|
|
2724
2718
|
values: { ...i }
|
|
2725
2719
|
})));
|
|
2726
2720
|
}
|
|
2727
|
-
(f.shouldDirty || f.shouldTouch) && ce(o,
|
|
2728
|
-
}, Q = (o,
|
|
2729
|
-
for (const _ in
|
|
2730
|
-
const
|
|
2731
|
-
(
|
|
2721
|
+
(f.shouldDirty || f.shouldTouch) && ce(o, b, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && et(o);
|
|
2722
|
+
}, Q = (o, c, f) => {
|
|
2723
|
+
for (const _ in c) {
|
|
2724
|
+
const b = c[_], m = `${o}.${_}`, C = w(s, m);
|
|
2725
|
+
(d.array.has(o) || !We(b) || C && !C._f) && !ke(b) ? Q(m, b, f) : H(m, b, f);
|
|
2732
2726
|
}
|
|
2733
|
-
}, ge = (o,
|
|
2734
|
-
const _ = w(s, o),
|
|
2735
|
-
|
|
2727
|
+
}, ge = (o, c, f = {}) => {
|
|
2728
|
+
const _ = w(s, o), b = d.array.has(o), m = oe(c);
|
|
2729
|
+
N(i, o, m), b ? (p.array.next({
|
|
2736
2730
|
name: o,
|
|
2737
2731
|
values: { ...i }
|
|
2738
|
-
}), (
|
|
2732
|
+
}), (y.isDirty || y.dirtyFields) && f.shouldDirty && p.state.next({
|
|
2739
2733
|
name: o,
|
|
2740
2734
|
dirtyFields: ut(a, i),
|
|
2741
2735
|
isDirty: V(o, m)
|
|
2742
|
-
})) : _ && !_._f && !U(m) ? Q(o, m, f) : H(o, m, f), zt(o,
|
|
2736
|
+
})) : _ && !_._f && !U(m) ? Q(o, m, f) : H(o, m, f), zt(o, d) && p.state.next({ ...n }), p.values.next({
|
|
2743
2737
|
name: o,
|
|
2744
2738
|
values: { ...i }
|
|
2745
2739
|
}), !u.mount && t();
|
|
2746
2740
|
}, Ee = async (o) => {
|
|
2747
|
-
const
|
|
2748
|
-
let f =
|
|
2749
|
-
const
|
|
2750
|
-
_ = Number.isNaN(
|
|
2741
|
+
const c = o.target;
|
|
2742
|
+
let f = c.name, _ = !0;
|
|
2743
|
+
const b = w(s, f), m = () => c.type ? ct(b._f) : jn(o), C = (L) => {
|
|
2744
|
+
_ = Number.isNaN(L) || L === w(i, f, L);
|
|
2751
2745
|
};
|
|
2752
|
-
if (
|
|
2753
|
-
let
|
|
2754
|
-
const Be = m(), xe = o.type === $t.BLUR || o.type === $t.FOCUS_OUT, Ir = !
|
|
2755
|
-
|
|
2746
|
+
if (b) {
|
|
2747
|
+
let L, B;
|
|
2748
|
+
const Be = m(), xe = o.type === $t.BLUR || o.type === $t.FOCUS_OUT, Ir = !es(b._f) && !r.resolver && !w(n.errors, f) && !b._f.deps || ts(xe, w(n.touchedFields, f), n.isSubmitted, E, v), nt = zt(f, d, xe);
|
|
2749
|
+
N(i, f, Be), xe ? (b._f.onBlur && b._f.onBlur(o), h && h(0)) : b._f.onChange && b._f.onChange(o);
|
|
2756
2750
|
const st = ce(f, Be, xe, !1), Vr = !W(st) || nt;
|
|
2757
2751
|
if (!xe && p.values.next({
|
|
2758
2752
|
name: f,
|
|
2759
2753
|
type: o.type,
|
|
2760
2754
|
values: { ...i }
|
|
2761
2755
|
}), Ir)
|
|
2762
|
-
return
|
|
2756
|
+
return y.isValid && g(), Vr && p.state.next({ name: f, ...nt ? {} : st });
|
|
2763
2757
|
if (!xe && nt && p.state.next({ ...n }), T(!0), r.resolver) {
|
|
2764
2758
|
const { errors: Mt } = await G([f]);
|
|
2765
2759
|
if (C(Be), _) {
|
|
2766
2760
|
const Mr = Wt(n.errors, s, f), Ft = Wt(Mt, s, Mr.name || f);
|
|
2767
|
-
|
|
2761
|
+
L = Ft.error, f = Ft.name, B = W(Mt);
|
|
2768
2762
|
}
|
|
2769
2763
|
} else
|
|
2770
|
-
|
|
2771
|
-
_ && (
|
|
2764
|
+
L = (await Ht(b, i, S, r.shouldUseNativeValidation))[f], C(Be), _ && (L ? B = !1 : y.isValid && (B = await q(s, !0)));
|
|
2765
|
+
_ && (b._f.deps && et(b._f.deps), Ae(f, B, L, st));
|
|
2772
2766
|
}
|
|
2773
|
-
}, Oe = (o,
|
|
2774
|
-
if (w(n.errors,
|
|
2767
|
+
}, Oe = (o, c) => {
|
|
2768
|
+
if (w(n.errors, c) && o.focus)
|
|
2775
2769
|
return o.focus(), 1;
|
|
2776
|
-
}, et = async (o,
|
|
2770
|
+
}, et = async (o, c = {}) => {
|
|
2777
2771
|
let f, _;
|
|
2778
|
-
const
|
|
2772
|
+
const b = it(o);
|
|
2779
2773
|
if (T(!0), r.resolver) {
|
|
2780
|
-
const m = await se(O(o) ? o :
|
|
2781
|
-
f = W(m), _ = o ? !
|
|
2774
|
+
const m = await se(O(o) ? o : b);
|
|
2775
|
+
f = W(m), _ = o ? !b.some((C) => w(m, C)) : f;
|
|
2782
2776
|
} else
|
|
2783
|
-
o ? (_ = (await Promise.all(
|
|
2777
|
+
o ? (_ = (await Promise.all(b.map(async (m) => {
|
|
2784
2778
|
const C = w(s, m);
|
|
2785
2779
|
return await q(C && C._f ? { [m]: C } : C);
|
|
2786
2780
|
}))).every(Boolean), !(!_ && !n.isValid) && g()) : _ = f = await q(s);
|
|
2787
2781
|
return p.state.next({
|
|
2788
|
-
...!te(o) ||
|
|
2782
|
+
...!te(o) || y.isValid && f !== n.isValid ? {} : { name: o },
|
|
2789
2783
|
...r.resolver || !o ? { isValid: f } : {},
|
|
2790
2784
|
errors: n.errors,
|
|
2791
2785
|
isValidating: !1
|
|
2792
|
-
}),
|
|
2786
|
+
}), c.shouldFocus && !_ && ze(s, Oe, o ? b : d.mount), _;
|
|
2793
2787
|
}, kt = (o) => {
|
|
2794
|
-
const
|
|
2788
|
+
const c = {
|
|
2795
2789
|
...a,
|
|
2796
2790
|
...u.mount ? i : {}
|
|
2797
2791
|
};
|
|
2798
|
-
return O(o) ?
|
|
2799
|
-
}, _t = (o,
|
|
2800
|
-
invalid: !!w((
|
|
2801
|
-
isDirty: !!w((
|
|
2802
|
-
isTouched: !!w((
|
|
2803
|
-
error: w((
|
|
2792
|
+
return O(o) ? c : te(o) ? w(c, o) : o.map((f) => w(c, f));
|
|
2793
|
+
}, _t = (o, c) => ({
|
|
2794
|
+
invalid: !!w((c || n).errors, o),
|
|
2795
|
+
isDirty: !!w((c || n).dirtyFields, o),
|
|
2796
|
+
isTouched: !!w((c || n).touchedFields, o),
|
|
2797
|
+
error: w((c || n).errors, o)
|
|
2804
2798
|
}), Sr = (o) => {
|
|
2805
|
-
o && it(o).forEach((
|
|
2799
|
+
o && it(o).forEach((c) => j(n.errors, c)), p.state.next({
|
|
2806
2800
|
errors: o ? n.errors : {}
|
|
2807
2801
|
});
|
|
2808
|
-
}, St = (o,
|
|
2802
|
+
}, St = (o, c, f) => {
|
|
2809
2803
|
const _ = (w(s, o, { _f: {} })._f || {}).ref;
|
|
2810
|
-
|
|
2811
|
-
...
|
|
2804
|
+
N(n.errors, o, {
|
|
2805
|
+
...c,
|
|
2812
2806
|
ref: _
|
|
2813
2807
|
}), p.state.next({
|
|
2814
2808
|
name: o,
|
|
2815
2809
|
errors: n.errors,
|
|
2816
2810
|
isValid: !1
|
|
2817
2811
|
}), f && f.shouldFocus && _ && _.focus && _.focus();
|
|
2818
|
-
}, Cr = (o,
|
|
2819
|
-
next: (f) => o(R(void 0,
|
|
2820
|
-
}) : R(o,
|
|
2821
|
-
for (const f of o ? it(o) :
|
|
2822
|
-
|
|
2812
|
+
}, Cr = (o, c) => fe(o) ? p.values.subscribe({
|
|
2813
|
+
next: (f) => o(R(void 0, c), f)
|
|
2814
|
+
}) : R(o, c, !0), tt = (o, c = {}) => {
|
|
2815
|
+
for (const f of o ? it(o) : d.mount)
|
|
2816
|
+
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);
|
|
2823
2817
|
p.values.next({
|
|
2824
2818
|
values: { ...i }
|
|
2825
2819
|
}), p.state.next({
|
|
2826
2820
|
...n,
|
|
2827
|
-
...
|
|
2828
|
-
}), !
|
|
2829
|
-
}, Ct = ({ disabled: o, name:
|
|
2821
|
+
...c.keepDirty ? { isDirty: V() } : {}
|
|
2822
|
+
}), !c.keepIsValid && g();
|
|
2823
|
+
}, Ct = ({ disabled: o, name: c, field: f, fields: _, value: b }) => {
|
|
2830
2824
|
if (de(o)) {
|
|
2831
|
-
const m = o ? void 0 : O(
|
|
2832
|
-
|
|
2825
|
+
const m = o ? void 0 : O(b) ? ct(f ? f._f : w(_, c)._f) : b;
|
|
2826
|
+
N(i, c, m), ce(c, m, !1, !1, !0);
|
|
2833
2827
|
}
|
|
2834
|
-
}, rt = (o,
|
|
2828
|
+
}, rt = (o, c = {}) => {
|
|
2835
2829
|
let f = w(s, o);
|
|
2836
|
-
const _ = de(
|
|
2837
|
-
return
|
|
2830
|
+
const _ = de(c.disabled);
|
|
2831
|
+
return N(s, o, {
|
|
2838
2832
|
...f || {},
|
|
2839
2833
|
_f: {
|
|
2840
2834
|
...f && f._f ? f._f : { ref: { name: o } },
|
|
2841
2835
|
name: o,
|
|
2842
2836
|
mount: !0,
|
|
2843
|
-
...
|
|
2837
|
+
...c
|
|
2844
2838
|
}
|
|
2845
|
-
}),
|
|
2839
|
+
}), d.mount.add(o), f ? Ct({
|
|
2846
2840
|
field: f,
|
|
2847
|
-
disabled:
|
|
2841
|
+
disabled: c.disabled,
|
|
2848
2842
|
name: o
|
|
2849
|
-
}) : me(o, !0,
|
|
2850
|
-
..._ ? { disabled:
|
|
2843
|
+
}) : me(o, !0, c.value), {
|
|
2844
|
+
..._ ? { disabled: c.disabled } : {},
|
|
2851
2845
|
...r.progressive ? {
|
|
2852
|
-
required: !!
|
|
2853
|
-
min: Ve(
|
|
2854
|
-
max: Ve(
|
|
2855
|
-
minLength: Ve(
|
|
2856
|
-
maxLength: Ve(
|
|
2857
|
-
pattern: Ve(
|
|
2846
|
+
required: !!c.required,
|
|
2847
|
+
min: Ve(c.min),
|
|
2848
|
+
max: Ve(c.max),
|
|
2849
|
+
minLength: Ve(c.minLength),
|
|
2850
|
+
maxLength: Ve(c.maxLength),
|
|
2851
|
+
pattern: Ve(c.pattern)
|
|
2858
2852
|
} : {},
|
|
2859
2853
|
name: o,
|
|
2860
2854
|
onChange: Ee,
|
|
2861
2855
|
onBlur: Ee,
|
|
2862
|
-
ref: (
|
|
2863
|
-
if (
|
|
2864
|
-
rt(o,
|
|
2865
|
-
const m = O(
|
|
2866
|
-
if (C ?
|
|
2856
|
+
ref: (b) => {
|
|
2857
|
+
if (b) {
|
|
2858
|
+
rt(o, c), f = w(s, o);
|
|
2859
|
+
const m = O(b.value) && b.querySelectorAll && b.querySelectorAll("input,select,textarea")[0] || b, C = Xn(m), L = f._f.refs || [];
|
|
2860
|
+
if (C ? L.find((B) => B === m) : m === f._f.ref)
|
|
2867
2861
|
return;
|
|
2868
|
-
|
|
2862
|
+
N(s, o, {
|
|
2869
2863
|
_f: {
|
|
2870
2864
|
...f._f,
|
|
2871
2865
|
...C ? {
|
|
2872
2866
|
refs: [
|
|
2873
|
-
...
|
|
2867
|
+
...L.filter(lt),
|
|
2874
2868
|
m,
|
|
2875
2869
|
...Array.isArray(w(a, o)) ? [{}] : []
|
|
2876
2870
|
],
|
|
@@ -2879,48 +2873,48 @@ function as(e = {}, t) {
|
|
|
2879
2873
|
}
|
|
2880
2874
|
}), me(o, !1, void 0, m);
|
|
2881
2875
|
} else
|
|
2882
|
-
f = w(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister ||
|
|
2876
|
+
f = w(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || c.shouldUnregister) && !(qn(d.array, o) && u.action) && d.unMount.add(o);
|
|
2883
2877
|
}
|
|
2884
2878
|
};
|
|
2885
|
-
}, At = () => r.shouldFocusError && ze(s, Oe,
|
|
2886
|
-
de(o) && (p.state.next({ disabled: o }), ze(s, (
|
|
2887
|
-
|
|
2879
|
+
}, At = () => r.shouldFocusError && ze(s, Oe, d.mount), Ar = (o) => {
|
|
2880
|
+
de(o) && (p.state.next({ disabled: o }), ze(s, (c) => {
|
|
2881
|
+
c.disabled = o;
|
|
2888
2882
|
}, 0, !1));
|
|
2889
|
-
}, Et = (o,
|
|
2883
|
+
}, Et = (o, c) => async (f) => {
|
|
2890
2884
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
2891
2885
|
let _ = oe(i);
|
|
2892
2886
|
if (p.state.next({
|
|
2893
2887
|
isSubmitting: !0
|
|
2894
2888
|
}), r.resolver) {
|
|
2895
|
-
const { errors:
|
|
2896
|
-
n.errors =
|
|
2889
|
+
const { errors: b, values: m } = await G();
|
|
2890
|
+
n.errors = b, _ = m;
|
|
2897
2891
|
} else
|
|
2898
2892
|
await q(s);
|
|
2899
2893
|
j(n.errors, "root"), W(n.errors) ? (p.state.next({
|
|
2900
2894
|
errors: {}
|
|
2901
|
-
}), await o(_, f)) : (
|
|
2895
|
+
}), await o(_, f)) : (c && await c({ ...n.errors }, f), At(), setTimeout(At)), p.state.next({
|
|
2902
2896
|
isSubmitted: !0,
|
|
2903
2897
|
isSubmitting: !1,
|
|
2904
2898
|
isSubmitSuccessful: W(n.errors),
|
|
2905
2899
|
submitCount: n.submitCount + 1,
|
|
2906
2900
|
errors: n.errors
|
|
2907
2901
|
});
|
|
2908
|
-
}, Er = (o,
|
|
2909
|
-
w(s, o) && (O(
|
|
2910
|
-
}, It = (o,
|
|
2911
|
-
const f = o ? oe(o) : a, _ = oe(f),
|
|
2912
|
-
if (
|
|
2913
|
-
if (
|
|
2914
|
-
for (const m of
|
|
2915
|
-
w(n.dirtyFields, m) ?
|
|
2902
|
+
}, Er = (o, c = {}) => {
|
|
2903
|
+
w(s, o) && (O(c.defaultValue) ? ge(o, w(a, o)) : (ge(o, c.defaultValue), N(a, o, c.defaultValue)), c.keepTouched || j(n.touchedFields, o), c.keepDirty || (j(n.dirtyFields, o), n.isDirty = c.defaultValue ? V(o, w(a, o)) : V()), c.keepError || (j(n.errors, o), y.isValid && g()), p.state.next({ ...n }));
|
|
2904
|
+
}, It = (o, c = {}) => {
|
|
2905
|
+
const f = o ? oe(o) : a, _ = oe(f), b = o && !W(o) ? _ : a;
|
|
2906
|
+
if (c.keepDefaultValues || (a = f), !c.keepValues) {
|
|
2907
|
+
if (c.keepDirtyValues || k)
|
|
2908
|
+
for (const m of d.mount)
|
|
2909
|
+
w(n.dirtyFields, m) ? N(b, m, w(i, m)) : ge(m, w(b, m));
|
|
2916
2910
|
else {
|
|
2917
2911
|
if (bt && O(o))
|
|
2918
|
-
for (const m of
|
|
2912
|
+
for (const m of d.mount) {
|
|
2919
2913
|
const C = w(s, m);
|
|
2920
2914
|
if (C && C._f) {
|
|
2921
|
-
const
|
|
2922
|
-
if (Ge(
|
|
2923
|
-
const B =
|
|
2915
|
+
const L = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
|
|
2916
|
+
if (Ge(L)) {
|
|
2917
|
+
const B = L.closest("form");
|
|
2924
2918
|
if (B) {
|
|
2925
2919
|
B.reset();
|
|
2926
2920
|
break;
|
|
@@ -2930,30 +2924,30 @@ function as(e = {}, t) {
|
|
|
2930
2924
|
}
|
|
2931
2925
|
s = {};
|
|
2932
2926
|
}
|
|
2933
|
-
i = e.shouldUnregister ?
|
|
2934
|
-
values: { ...
|
|
2927
|
+
i = e.shouldUnregister ? c.keepDefaultValues ? oe(a) : {} : oe(b), p.array.next({
|
|
2928
|
+
values: { ...b }
|
|
2935
2929
|
}), p.values.next({
|
|
2936
|
-
values: { ...
|
|
2930
|
+
values: { ...b }
|
|
2937
2931
|
});
|
|
2938
2932
|
}
|
|
2939
|
-
|
|
2933
|
+
d = {
|
|
2940
2934
|
mount: /* @__PURE__ */ new Set(),
|
|
2941
2935
|
unMount: /* @__PURE__ */ new Set(),
|
|
2942
2936
|
array: /* @__PURE__ */ new Set(),
|
|
2943
2937
|
watch: /* @__PURE__ */ new Set(),
|
|
2944
2938
|
watchAll: !1,
|
|
2945
2939
|
focus: ""
|
|
2946
|
-
}, !u.mount && t(), u.mount = !
|
|
2947
|
-
submitCount:
|
|
2948
|
-
isDirty:
|
|
2949
|
-
isSubmitted:
|
|
2950
|
-
dirtyFields:
|
|
2951
|
-
touchedFields:
|
|
2952
|
-
errors:
|
|
2953
|
-
isSubmitSuccessful:
|
|
2940
|
+
}, !u.mount && t(), u.mount = !y.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister, p.state.next({
|
|
2941
|
+
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2942
|
+
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !ye(o, a)),
|
|
2943
|
+
isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
|
|
2944
|
+
dirtyFields: c.keepDirtyValues ? n.dirtyFields : c.keepDefaultValues && o ? ut(a, o) : {},
|
|
2945
|
+
touchedFields: c.keepTouched ? n.touchedFields : {},
|
|
2946
|
+
errors: c.keepErrors ? n.errors : {},
|
|
2947
|
+
isSubmitSuccessful: c.keepIsSubmitSuccessful ? n.isSubmitSuccessful : !1,
|
|
2954
2948
|
isSubmitting: !1
|
|
2955
2949
|
});
|
|
2956
|
-
}, Vt = (o,
|
|
2950
|
+
}, Vt = (o, c) => It(fe(o) ? o(i) : o, c);
|
|
2957
2951
|
return {
|
|
2958
2952
|
control: {
|
|
2959
2953
|
register: rt,
|
|
@@ -2983,7 +2977,7 @@ function as(e = {}, t) {
|
|
|
2983
2977
|
},
|
|
2984
2978
|
_disableForm: Ar,
|
|
2985
2979
|
_subjects: p,
|
|
2986
|
-
_proxyFormState:
|
|
2980
|
+
_proxyFormState: y,
|
|
2987
2981
|
get _fields() {
|
|
2988
2982
|
return s;
|
|
2989
2983
|
},
|
|
@@ -3000,10 +2994,10 @@ function as(e = {}, t) {
|
|
|
3000
2994
|
return a;
|
|
3001
2995
|
},
|
|
3002
2996
|
get _names() {
|
|
3003
|
-
return
|
|
2997
|
+
return d;
|
|
3004
2998
|
},
|
|
3005
2999
|
set _names(o) {
|
|
3006
|
-
|
|
3000
|
+
d = o;
|
|
3007
3001
|
},
|
|
3008
3002
|
get _formState() {
|
|
3009
3003
|
return n;
|
|
@@ -3032,11 +3026,11 @@ function as(e = {}, t) {
|
|
|
3032
3026
|
clearErrors: Sr,
|
|
3033
3027
|
unregister: tt,
|
|
3034
3028
|
setError: St,
|
|
3035
|
-
setFocus: (o,
|
|
3029
|
+
setFocus: (o, c = {}) => {
|
|
3036
3030
|
const f = w(s, o), _ = f && f._f;
|
|
3037
3031
|
if (_) {
|
|
3038
|
-
const
|
|
3039
|
-
|
|
3032
|
+
const b = _.refs ? _.refs[0] : _.ref;
|
|
3033
|
+
b.focus && (b.focus(), c.shouldSelect && b.select());
|
|
3040
3034
|
}
|
|
3041
3035
|
},
|
|
3042
3036
|
getFieldState: _t
|
|
@@ -3059,14 +3053,14 @@ function Xe(e = {}) {
|
|
|
3059
3053
|
defaultValues: fe(e.defaultValues) ? void 0 : e.defaultValues
|
|
3060
3054
|
});
|
|
3061
3055
|
t.current || (t.current = {
|
|
3062
|
-
...
|
|
3056
|
+
...ss(e, () => s((i) => ({ ...i }))),
|
|
3063
3057
|
formState: n
|
|
3064
3058
|
});
|
|
3065
3059
|
const a = t.current.control;
|
|
3066
|
-
return a._options = e,
|
|
3060
|
+
return a._options = e, Hn({
|
|
3067
3061
|
subject: a._subjects.state,
|
|
3068
3062
|
next: (i) => {
|
|
3069
|
-
|
|
3063
|
+
Gn(i, a._proxyFormState, a._updateFormState, !0) && s({ ...a._formState });
|
|
3070
3064
|
}
|
|
3071
3065
|
}), X.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), X.useEffect(() => {
|
|
3072
3066
|
if (a._proxyFormState.isDirty) {
|
|
@@ -3079,14 +3073,14 @@ function Xe(e = {}) {
|
|
|
3079
3073
|
e.values && !ye(e.values, r.current) ? (a._reset(e.values, a._options.resetOptions), r.current = e.values) : a._resetDefaultValues();
|
|
3080
3074
|
}, [e.values, a]), X.useEffect(() => {
|
|
3081
3075
|
a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
3082
|
-
}), t.current.formState =
|
|
3076
|
+
}), t.current.formState = Kn(n, a), t.current;
|
|
3083
3077
|
}
|
|
3084
3078
|
var Jt = function(e, t, r) {
|
|
3085
3079
|
if (e && "reportValidity" in e) {
|
|
3086
3080
|
var n = w(r, t);
|
|
3087
3081
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3088
3082
|
}
|
|
3089
|
-
},
|
|
3083
|
+
}, as = function(e, t) {
|
|
3090
3084
|
var r = function(s) {
|
|
3091
3085
|
var a = t.fields[s];
|
|
3092
3086
|
a && a.ref && "reportValidity" in a.ref ? Jt(a.ref, s, e) : a.refs && a.refs.forEach(function(i) {
|
|
@@ -3095,25 +3089,25 @@ var Jt = function(e, t, r) {
|
|
|
3095
3089
|
};
|
|
3096
3090
|
for (var n in t.fields)
|
|
3097
3091
|
r(n);
|
|
3098
|
-
},
|
|
3099
|
-
t.shouldUseNativeValidation &&
|
|
3092
|
+
}, is = function(e, t) {
|
|
3093
|
+
t.shouldUseNativeValidation && as(e, t);
|
|
3100
3094
|
var r = {};
|
|
3101
3095
|
for (var n in e) {
|
|
3102
3096
|
var s = w(t.fields, n), a = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3103
|
-
if (
|
|
3104
|
-
var i = Object.assign({},
|
|
3105
|
-
|
|
3097
|
+
if (ls(t.names || Object.keys(e), n)) {
|
|
3098
|
+
var i = Object.assign({}, os(w(r, n)));
|
|
3099
|
+
N(i, "root", a), N(r, n, i);
|
|
3106
3100
|
} else
|
|
3107
|
-
|
|
3101
|
+
N(r, n, a);
|
|
3108
3102
|
}
|
|
3109
3103
|
return r;
|
|
3110
|
-
},
|
|
3104
|
+
}, os = function(e) {
|
|
3111
3105
|
return Array.isArray(e) ? e.filter(Boolean) : [];
|
|
3112
|
-
},
|
|
3106
|
+
}, ls = function(e, t) {
|
|
3113
3107
|
return e.some(function(r) {
|
|
3114
3108
|
return r.startsWith(t + ".");
|
|
3115
3109
|
});
|
|
3116
|
-
},
|
|
3110
|
+
}, us = function(e, t) {
|
|
3117
3111
|
for (var r = {}; e.issues.length; ) {
|
|
3118
3112
|
var n = e.issues[0];
|
|
3119
3113
|
if (n.path) {
|
|
@@ -3133,9 +3127,9 @@ var Jt = function(e, t, r) {
|
|
|
3133
3127
|
try {
|
|
3134
3128
|
return Promise.resolve(function(i, u) {
|
|
3135
3129
|
try {
|
|
3136
|
-
var
|
|
3137
|
-
function h(
|
|
3138
|
-
return { values: r.raw ? n :
|
|
3130
|
+
var d = function() {
|
|
3131
|
+
function h(y) {
|
|
3132
|
+
return { values: r.raw ? n : y, errors: {} };
|
|
3139
3133
|
}
|
|
3140
3134
|
var x = Object.assign({}, { abortEarly: !1, abortPipeEarly: !1 }, t);
|
|
3141
3135
|
return r.mode === "sync" ? h(ar(e, n, x)) : Promise.resolve(Or(e, n, x)).then(h);
|
|
@@ -3143,10 +3137,10 @@ var Jt = function(e, t, r) {
|
|
|
3143
3137
|
} catch (h) {
|
|
3144
3138
|
return u(h);
|
|
3145
3139
|
}
|
|
3146
|
-
return
|
|
3140
|
+
return d && d.then ? d.then(void 0, u) : d;
|
|
3147
3141
|
}(0, function(i) {
|
|
3148
3142
|
if (i instanceof Br)
|
|
3149
|
-
return { values: {}, errors:
|
|
3143
|
+
return { values: {}, errors: is(us(i, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
|
|
3150
3144
|
throw i;
|
|
3151
3145
|
}));
|
|
3152
3146
|
} catch (i) {
|
|
@@ -3154,7 +3148,7 @@ var Jt = function(e, t, r) {
|
|
|
3154
3148
|
}
|
|
3155
3149
|
};
|
|
3156
3150
|
};
|
|
3157
|
-
const Zt = 27, Qt = 12, Xt = 10,
|
|
3151
|
+
const Zt = 27, Qt = 12, Xt = 10, cs = Se("enum"), ds = (e) => {
|
|
3158
3152
|
const t = {
|
|
3159
3153
|
min: e.minSelected ?? 0,
|
|
3160
3154
|
max: e.maxSelected ?? e.options.length
|
|
@@ -3162,7 +3156,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3162
3156
|
return Ye(he({
|
|
3163
3157
|
checked: ir(Pr($r()), (r) => Object.entries(r).filter(([n, s]) => s).map(([n, s]) => n), [$e(t.max, `Please select at most ${t.max} option${t.max !== 1 ? "s" : ""}`), je(t.min, `Please select at least ${t.min} option${t.min !== 1 ? "s" : ""}`)])
|
|
3164
3158
|
}));
|
|
3165
|
-
},
|
|
3159
|
+
}, fs = sr(({
|
|
3166
3160
|
option: e,
|
|
3167
3161
|
...t
|
|
3168
3162
|
}, r) => l(_e, {
|
|
@@ -3185,7 +3179,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3185
3179
|
booleanLike: dr
|
|
3186
3180
|
}
|
|
3187
3181
|
}
|
|
3188
|
-
}),
|
|
3182
|
+
}), hs = ({
|
|
3189
3183
|
input: e,
|
|
3190
3184
|
onSubmitSuccess: t
|
|
3191
3185
|
}) => {
|
|
@@ -3198,10 +3192,10 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3198
3192
|
}
|
|
3199
3193
|
} = Xe({
|
|
3200
3194
|
defaultValues: {
|
|
3201
|
-
checked: n ? {} :
|
|
3195
|
+
checked: n ? {} : cs(r) ? Object.fromEntries(r.value.map((y) => [y, !0])) : {}
|
|
3202
3196
|
},
|
|
3203
|
-
resolver:
|
|
3204
|
-
}),
|
|
3197
|
+
resolver: ds(e.config)
|
|
3198
|
+
}), d = yt();
|
|
3205
3199
|
return s ? l("ul", {
|
|
3206
3200
|
style: {
|
|
3207
3201
|
maxHeight: 6.5 * Zt + 5 * Qt + 2 * Xt
|
|
@@ -3209,30 +3203,30 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3209
3203
|
class: Yt({
|
|
3210
3204
|
variant: "booleanLike"
|
|
3211
3205
|
}),
|
|
3212
|
-
children: e.config.options.map((
|
|
3206
|
+
children: e.config.options.map((y, p) => l("li", {
|
|
3213
3207
|
class: "flex-1",
|
|
3214
3208
|
children: l(fr, {
|
|
3215
3209
|
type: "submit",
|
|
3216
3210
|
ref: (k) => {
|
|
3217
|
-
k && p === 0 && (
|
|
3211
|
+
k && p === 0 && (d.current = k);
|
|
3218
3212
|
},
|
|
3219
|
-
label:
|
|
3213
|
+
label: y.label,
|
|
3220
3214
|
value: "true",
|
|
3221
3215
|
onClick: () => t({
|
|
3222
3216
|
type: "enum",
|
|
3223
|
-
value: [
|
|
3217
|
+
value: [y.value]
|
|
3224
3218
|
})
|
|
3225
3219
|
})
|
|
3226
|
-
},
|
|
3220
|
+
}, y.value))
|
|
3227
3221
|
}) : l("form", {
|
|
3228
3222
|
noValidate: !0,
|
|
3229
|
-
onSubmit: (
|
|
3223
|
+
onSubmit: (y) => i((p) => {
|
|
3230
3224
|
const k = p.checked;
|
|
3231
3225
|
t({
|
|
3232
3226
|
type: "enum",
|
|
3233
3227
|
value: k
|
|
3234
3228
|
});
|
|
3235
|
-
})(
|
|
3229
|
+
})(y),
|
|
3236
3230
|
children: [l("div", {
|
|
3237
3231
|
class: "flex items-center gap-1",
|
|
3238
3232
|
children: [l("ul", {
|
|
@@ -3242,27 +3236,27 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3242
3236
|
class: Yt({
|
|
3243
3237
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3244
3238
|
}),
|
|
3245
|
-
children: e.config.options.map((
|
|
3246
|
-
const k = `checked.${
|
|
3239
|
+
children: e.config.options.map((y, p) => {
|
|
3240
|
+
const k = `checked.${y.value}`, {
|
|
3247
3241
|
ref: v,
|
|
3248
3242
|
...E
|
|
3249
3243
|
} = a(k);
|
|
3250
3244
|
return l("li", {
|
|
3251
3245
|
class: "relative",
|
|
3252
|
-
children: l(
|
|
3253
|
-
option:
|
|
3246
|
+
children: l(fs, {
|
|
3247
|
+
option: y,
|
|
3254
3248
|
autoFocus: p === 0,
|
|
3255
3249
|
ref: (S) => {
|
|
3256
|
-
S && p === 0 && (
|
|
3250
|
+
S && p === 0 && (d.current = S), v(S);
|
|
3257
3251
|
},
|
|
3258
3252
|
id: k,
|
|
3259
3253
|
...E,
|
|
3260
3254
|
onClick: n ? () => t({
|
|
3261
3255
|
type: "enum",
|
|
3262
|
-
value: [
|
|
3256
|
+
value: [y.value]
|
|
3263
3257
|
}) : void 0
|
|
3264
3258
|
})
|
|
3265
|
-
},
|
|
3259
|
+
}, y.value);
|
|
3266
3260
|
})
|
|
3267
3261
|
}), l("div", {
|
|
3268
3262
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
@@ -3281,7 +3275,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3281
3275
|
})
|
|
3282
3276
|
})]
|
|
3283
3277
|
});
|
|
3284
|
-
},
|
|
3278
|
+
}, ps = Se("number"), ms = (e, t) => {
|
|
3285
3279
|
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, s = e.decimalCases ?? 0;
|
|
3286
3280
|
return Ye(he({
|
|
3287
3281
|
number: jr(t("validation_number"), [zr(r, t("validation_number_min", {
|
|
@@ -3292,14 +3286,14 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3292
3286
|
count: s
|
|
3293
3287
|
}))])
|
|
3294
3288
|
}));
|
|
3295
|
-
},
|
|
3289
|
+
}, gs = ({
|
|
3296
3290
|
input: e,
|
|
3297
3291
|
onSubmitSuccess: t
|
|
3298
3292
|
}) => {
|
|
3299
|
-
var
|
|
3300
|
-
const r = e.config.defaultValue, n = e.key ? (
|
|
3293
|
+
var y;
|
|
3294
|
+
const r = e.config.defaultValue, n = e.key ? (y = M.current$.value.flow) == null ? void 0 : y.data.submissions[e.key] : void 0, {
|
|
3301
3295
|
t: s
|
|
3302
|
-
} =
|
|
3296
|
+
} = J(), {
|
|
3303
3297
|
register: a,
|
|
3304
3298
|
handleSubmit: i,
|
|
3305
3299
|
formState: {
|
|
@@ -3307,11 +3301,11 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3307
3301
|
}
|
|
3308
3302
|
} = Xe({
|
|
3309
3303
|
defaultValues: {
|
|
3310
|
-
number: r ? Number(r) :
|
|
3304
|
+
number: r ? Number(r) : ps(n) ? n.value : void 0
|
|
3311
3305
|
},
|
|
3312
|
-
resolver:
|
|
3306
|
+
resolver: ms(e.config, s)
|
|
3313
3307
|
}), {
|
|
3314
|
-
ref:
|
|
3308
|
+
ref: d,
|
|
3315
3309
|
...h
|
|
3316
3310
|
} = a("number", {
|
|
3317
3311
|
required: !e.config.optional,
|
|
@@ -3339,7 +3333,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3339
3333
|
autoCorrect: "off",
|
|
3340
3334
|
autoFocus: !0,
|
|
3341
3335
|
ref: (p) => {
|
|
3342
|
-
p && (x.current = p),
|
|
3336
|
+
p && (x.current = p), d(p);
|
|
3343
3337
|
},
|
|
3344
3338
|
type: "text",
|
|
3345
3339
|
min: e.config.min,
|
|
@@ -3358,7 +3352,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3358
3352
|
error: u.number
|
|
3359
3353
|
})]
|
|
3360
3354
|
});
|
|
3361
|
-
},
|
|
3355
|
+
}, ys = (e) => {
|
|
3362
3356
|
if (e === "")
|
|
3363
3357
|
return {
|
|
3364
3358
|
countryCode: "",
|
|
@@ -3372,34 +3366,34 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3372
3366
|
countryCode: "",
|
|
3373
3367
|
phoneNumber: ""
|
|
3374
3368
|
};
|
|
3375
|
-
},
|
|
3376
|
-
const t = ee(e("validation_country_code"), [
|
|
3369
|
+
}, bs = "44", vs = Se("string"), xs = Se("phone"), ws = (e) => {
|
|
3370
|
+
const t = ee(e("validation_country_code"), [Nt(/^\+?[0-9 -]+$/, e("validation_country_code"))]);
|
|
3377
3371
|
return Ye(he({
|
|
3378
3372
|
countryCode: t,
|
|
3379
|
-
phoneNumber: ir(ee(e("validation_phone"), [
|
|
3373
|
+
phoneNumber: ir(ee(e("validation_phone"), [Nt(/^\+?[0-9 -]+$/, e("validation_phone"))]), (r) => r.replace(/[^0-9]/g, ""), [])
|
|
3380
3374
|
}));
|
|
3381
|
-
},
|
|
3375
|
+
}, ks = ({
|
|
3382
3376
|
input: e,
|
|
3383
3377
|
onSubmitSuccess: t
|
|
3384
3378
|
}) => {
|
|
3385
3379
|
var E;
|
|
3386
3380
|
const r = e.key ? (E = M.current$.value.flow) == null ? void 0 : E.data.submissions[e.key] : void 0, {
|
|
3387
3381
|
t: n
|
|
3388
|
-
} =
|
|
3382
|
+
} = J(), [s, a] = Y(), i = vs(r) ? ys(r.value) : xs(r) ? r.value : void 0, {
|
|
3389
3383
|
register: u,
|
|
3390
|
-
handleSubmit:
|
|
3384
|
+
handleSubmit: d,
|
|
3391
3385
|
formState: {
|
|
3392
3386
|
errors: h
|
|
3393
3387
|
},
|
|
3394
3388
|
watch: x
|
|
3395
3389
|
} = Xe({
|
|
3396
3390
|
defaultValues: {
|
|
3397
|
-
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3391
|
+
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ?? bs,
|
|
3398
3392
|
phoneNumber: (i == null ? void 0 : i.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3399
3393
|
},
|
|
3400
|
-
resolver:
|
|
3394
|
+
resolver: ws(n)
|
|
3401
3395
|
}), {
|
|
3402
|
-
ref:
|
|
3396
|
+
ref: y,
|
|
3403
3397
|
...p
|
|
3404
3398
|
} = u("phoneNumber", {
|
|
3405
3399
|
required: !e.config.optional
|
|
@@ -3409,7 +3403,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3409
3403
|
}, []), l("form", {
|
|
3410
3404
|
noValidate: !0,
|
|
3411
3405
|
class: "flex flex-col gap-1 p-2.5",
|
|
3412
|
-
onSubmit:
|
|
3406
|
+
onSubmit: d((S) => {
|
|
3413
3407
|
const A = S.phoneNumber.replace(/[^0-9]/g, ""), g = S.countryCode.replace(/[^0-9]/g, "");
|
|
3414
3408
|
if (a(void 0), A.length + g.length > (e.config.maxChars || Number.POSITIVE_INFINITY))
|
|
3415
3409
|
return a(n("validation_max_chars", {
|
|
@@ -3458,7 +3452,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3458
3452
|
autoCorrect: "off",
|
|
3459
3453
|
autoFocus: !0,
|
|
3460
3454
|
ref: (S) => {
|
|
3461
|
-
S && (k.current = S),
|
|
3455
|
+
S && (k.current = S), y(S);
|
|
3462
3456
|
},
|
|
3463
3457
|
class: Te({
|
|
3464
3458
|
optional: e.config.optional,
|
|
@@ -3476,7 +3470,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3476
3470
|
}
|
|
3477
3471
|
})]
|
|
3478
3472
|
});
|
|
3479
|
-
},
|
|
3473
|
+
}, _s = ({
|
|
3480
3474
|
input: e,
|
|
3481
3475
|
onSubmitSuccess: t
|
|
3482
3476
|
}) => l("div", {
|
|
@@ -3513,7 +3507,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3513
3507
|
email: "That doesn’t look like a valid email address",
|
|
3514
3508
|
phone: "That doesn’t look like a valid phone number",
|
|
3515
3509
|
url: "That doesn’t look like a valid URL"
|
|
3516
|
-
},
|
|
3510
|
+
}, Ss = {
|
|
3517
3511
|
email: {
|
|
3518
3512
|
type: "email",
|
|
3519
3513
|
inputMode: "email",
|
|
@@ -3528,7 +3522,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3528
3522
|
inputMode: "url",
|
|
3529
3523
|
formNoValidate: !0
|
|
3530
3524
|
}
|
|
3531
|
-
},
|
|
3525
|
+
}, Cs = Se("string"), As = (e, t) => {
|
|
3532
3526
|
const r = {
|
|
3533
3527
|
maxLength: t("validation_max_chars", {
|
|
3534
3528
|
count: e.maxChars ?? 999
|
|
@@ -3544,14 +3538,14 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3544
3538
|
url: ee([Gr(dt.url), je(e.minChars ?? 1, r.minLength), $e(e.maxChars ?? 1 / 0, r.maxLength)])
|
|
3545
3539
|
}[e.format]
|
|
3546
3540
|
}));
|
|
3547
|
-
},
|
|
3541
|
+
}, Es = ({
|
|
3548
3542
|
input: e,
|
|
3549
3543
|
onSubmitSuccess: t
|
|
3550
3544
|
}) => {
|
|
3551
|
-
var
|
|
3545
|
+
var y;
|
|
3552
3546
|
const {
|
|
3553
3547
|
t: r
|
|
3554
|
-
} =
|
|
3548
|
+
} = J(), n = e.key ? (y = M.current$.value.flow) == null ? void 0 : y.data.submissions[e.key] : void 0, s = e.config.defaultValue, {
|
|
3555
3549
|
register: a,
|
|
3556
3550
|
handleSubmit: i,
|
|
3557
3551
|
formState: {
|
|
@@ -3559,11 +3553,11 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3559
3553
|
}
|
|
3560
3554
|
} = Xe({
|
|
3561
3555
|
defaultValues: {
|
|
3562
|
-
text: s || (
|
|
3556
|
+
text: s || (Cs(n) ? n.value : "")
|
|
3563
3557
|
},
|
|
3564
|
-
resolver:
|
|
3558
|
+
resolver: As(e.config, r)
|
|
3565
3559
|
}), {
|
|
3566
|
-
ref:
|
|
3560
|
+
ref: d,
|
|
3567
3561
|
...h
|
|
3568
3562
|
} = a("text", {
|
|
3569
3563
|
required: !e.config.optional
|
|
@@ -3586,13 +3580,13 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3586
3580
|
children: [l("input", {
|
|
3587
3581
|
id: "chat-input",
|
|
3588
3582
|
...h,
|
|
3589
|
-
...
|
|
3583
|
+
...Ss[e.config.format],
|
|
3590
3584
|
autocomplete: "off",
|
|
3591
3585
|
autoCapitalize: "off",
|
|
3592
3586
|
autoCorrect: "off",
|
|
3593
3587
|
autoFocus: !0,
|
|
3594
3588
|
ref: (p) => {
|
|
3595
|
-
p && (x.current = p),
|
|
3589
|
+
p && (x.current = p), d(p);
|
|
3596
3590
|
},
|
|
3597
3591
|
placeholder: e.config.placeholder,
|
|
3598
3592
|
class: Te({
|
|
@@ -3608,16 +3602,16 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3608
3602
|
error: u.text
|
|
3609
3603
|
})]
|
|
3610
3604
|
});
|
|
3611
|
-
},
|
|
3612
|
-
text:
|
|
3613
|
-
phone:
|
|
3614
|
-
"multiple-choice":
|
|
3615
|
-
boolean:
|
|
3616
|
-
file:
|
|
3617
|
-
submit:
|
|
3605
|
+
}, Is = {
|
|
3606
|
+
text: Es,
|
|
3607
|
+
phone: ks,
|
|
3608
|
+
"multiple-choice": hs,
|
|
3609
|
+
boolean: Ln,
|
|
3610
|
+
file: $n,
|
|
3611
|
+
submit: _s,
|
|
3618
3612
|
address: Vn,
|
|
3619
|
-
number:
|
|
3620
|
-
},
|
|
3613
|
+
number: gs
|
|
3614
|
+
}, Vs = ({
|
|
3621
3615
|
logger: e
|
|
3622
3616
|
}) => {
|
|
3623
3617
|
var a;
|
|
@@ -3638,7 +3632,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3638
3632
|
ref: r,
|
|
3639
3633
|
class: "border-divider flex flex-col justify-end border-t",
|
|
3640
3634
|
children: t ? (() => {
|
|
3641
|
-
const i =
|
|
3635
|
+
const i = Is[t.type];
|
|
3642
3636
|
return l(i, {
|
|
3643
3637
|
logger: e,
|
|
3644
3638
|
onSubmitSuccess: z.onSubmitSuccessFn$.value,
|
|
@@ -3663,9 +3657,9 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3663
3657
|
})
|
|
3664
3658
|
});
|
|
3665
3659
|
};
|
|
3666
|
-
var
|
|
3660
|
+
var Ms = function(e) {
|
|
3667
3661
|
return e instanceof RegExp;
|
|
3668
|
-
},
|
|
3662
|
+
}, Fs = function(t) {
|
|
3669
3663
|
var r = /[\\^$.*+?()[\]{}|]/g, n = RegExp(r.source);
|
|
3670
3664
|
return t && n.test(t) ? t.replace(r, "\\$&") : t;
|
|
3671
3665
|
}, _r = function(e) {
|
|
@@ -3676,15 +3670,15 @@ var Fs = function(e) {
|
|
|
3676
3670
|
Array.isArray(r) ? t = t.concat(r) : t.push(r);
|
|
3677
3671
|
}), t;
|
|
3678
3672
|
};
|
|
3679
|
-
function
|
|
3673
|
+
function Ls(e, t, r) {
|
|
3680
3674
|
var n = 0, s = 0;
|
|
3681
3675
|
if (e === "")
|
|
3682
3676
|
return e;
|
|
3683
3677
|
if (!e || !_r(e))
|
|
3684
3678
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3685
3679
|
var a = t;
|
|
3686
|
-
|
|
3687
|
-
for (var i = e.split(a), u = 1,
|
|
3680
|
+
Ms(a) || (a = new RegExp("(" + Fs(a) + ")", "gi"));
|
|
3681
|
+
for (var i = e.split(a), u = 1, d = i.length; u < d; u += 2) {
|
|
3688
3682
|
if (i[u] === void 0 || i[u - 1] === void 0) {
|
|
3689
3683
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
3690
3684
|
continue;
|
|
@@ -3693,32 +3687,32 @@ function Ts(e, t, r) {
|
|
|
3693
3687
|
}
|
|
3694
3688
|
return i;
|
|
3695
3689
|
}
|
|
3696
|
-
var
|
|
3690
|
+
var Ts = function(t, r, n) {
|
|
3697
3691
|
return Array.isArray(t) || (t = [t]), Ns(t.map(function(s) {
|
|
3698
|
-
return _r(s) ?
|
|
3692
|
+
return _r(s) ? Ls(s, r, n) : s;
|
|
3699
3693
|
}));
|
|
3700
3694
|
};
|
|
3701
|
-
const Pe = /* @__PURE__ */ nr(
|
|
3702
|
-
const t = Pe(e,
|
|
3703
|
-
const [, u,
|
|
3704
|
-
return
|
|
3695
|
+
const Pe = /* @__PURE__ */ nr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]+)\]\(([^)]+)\)/, Os = /(https?:\/\/[^\s]+)/g, Bs = /_(.*?)_/g, Ps = /\*\*(.*?)\*\*/g, er = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", $s = (e) => {
|
|
3696
|
+
const t = Pe(e, Ds, (a, i) => {
|
|
3697
|
+
const [, u, d] = a.match(Rs) ?? [];
|
|
3698
|
+
return d ? l("a", {
|
|
3705
3699
|
class: er,
|
|
3706
|
-
href:
|
|
3707
|
-
children: u ??
|
|
3708
|
-
},
|
|
3700
|
+
href: d,
|
|
3701
|
+
children: u ?? d
|
|
3702
|
+
}, d + i) : l("span", {
|
|
3709
3703
|
children: "INVALID LINK"
|
|
3710
3704
|
});
|
|
3711
|
-
}), r = Pe(t,
|
|
3705
|
+
}), r = Pe(t, Os, (a, i) => l("a", {
|
|
3712
3706
|
class: er,
|
|
3713
3707
|
href: a,
|
|
3714
3708
|
children: a
|
|
3715
|
-
}, a + i)), n = Pe(r,
|
|
3709
|
+
}, a + i)), n = Pe(r, Bs, (a, i) => l("em", {
|
|
3716
3710
|
children: a
|
|
3717
3711
|
}, a + i));
|
|
3718
|
-
return Pe(n,
|
|
3712
|
+
return Pe(n, Ps, (a, i) => l("strong", {
|
|
3719
3713
|
children: a
|
|
3720
3714
|
}, a + i));
|
|
3721
|
-
},
|
|
3715
|
+
}, js = Ze("select-text max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative", {
|
|
3722
3716
|
variants: {
|
|
3723
3717
|
side: {
|
|
3724
3718
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -3732,7 +3726,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3732
3726
|
defaultVariants: {
|
|
3733
3727
|
side: "left"
|
|
3734
3728
|
}
|
|
3735
|
-
}),
|
|
3729
|
+
}), zs = ({
|
|
3736
3730
|
children: e,
|
|
3737
3731
|
className: t,
|
|
3738
3732
|
animate: r,
|
|
@@ -3742,14 +3736,14 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3742
3736
|
style: {
|
|
3743
3737
|
transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
|
|
3744
3738
|
},
|
|
3745
|
-
class:
|
|
3739
|
+
class: js({
|
|
3746
3740
|
className: t,
|
|
3747
3741
|
side: n,
|
|
3748
3742
|
animate: r
|
|
3749
3743
|
}),
|
|
3750
3744
|
...s,
|
|
3751
3745
|
children: e
|
|
3752
|
-
}),
|
|
3746
|
+
}), qs = ({
|
|
3753
3747
|
message: e
|
|
3754
3748
|
}) => l("div", {
|
|
3755
3749
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -3773,7 +3767,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3773
3767
|
})
|
|
3774
3768
|
})]
|
|
3775
3769
|
})
|
|
3776
|
-
}),
|
|
3770
|
+
}), Us = ({
|
|
3777
3771
|
className: e,
|
|
3778
3772
|
...t
|
|
3779
3773
|
}) => (ue(() => {
|
|
@@ -3782,7 +3776,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3782
3776
|
"aria-hidden": !0,
|
|
3783
3777
|
children: z.isBotTyping$.value === !0 ? l("div", {
|
|
3784
3778
|
"aria-label": "Typing…",
|
|
3785
|
-
class:
|
|
3779
|
+
class: Le("flex gap-1 p-4", e),
|
|
3786
3780
|
...t,
|
|
3787
3781
|
children: Array.from({
|
|
3788
3782
|
length: 3
|
|
@@ -3793,10 +3787,10 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3793
3787
|
}
|
|
3794
3788
|
}))
|
|
3795
3789
|
}) : void 0
|
|
3796
|
-
})),
|
|
3790
|
+
})), Ks = {
|
|
3797
3791
|
bot: "left",
|
|
3798
3792
|
user: "right"
|
|
3799
|
-
},
|
|
3793
|
+
}, Gs = Ze("w-full select-none py-2 text-wrap-balance text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_var(--i-color-n-1)]", {
|
|
3800
3794
|
variants: {
|
|
3801
3795
|
variant: {
|
|
3802
3796
|
info: "text-neutral-8",
|
|
@@ -3805,7 +3799,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3805
3799
|
success: "text-[#4CAF50]"
|
|
3806
3800
|
}
|
|
3807
3801
|
}
|
|
3808
|
-
}),
|
|
3802
|
+
}), Hs = ({
|
|
3809
3803
|
lastSentMessageFooter: e
|
|
3810
3804
|
}) => {
|
|
3811
3805
|
var r;
|
|
@@ -3821,7 +3815,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3821
3815
|
children: Ke(n).with({
|
|
3822
3816
|
type: "system"
|
|
3823
3817
|
}, (a) => l("p", {
|
|
3824
|
-
class:
|
|
3818
|
+
class: Gs({
|
|
3825
3819
|
variant: a.variant
|
|
3826
3820
|
}),
|
|
3827
3821
|
children: a.text
|
|
@@ -3829,15 +3823,15 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3829
3823
|
type: "text",
|
|
3830
3824
|
author: I.union("bot", "user")
|
|
3831
3825
|
}, (a) => {
|
|
3832
|
-
const i = a.author === "user" && !t.slice(s + 1).some((h) => h.type === "text" && h.author === "user"), u = s === t.length - 1,
|
|
3833
|
-
return l(
|
|
3826
|
+
const i = a.author === "user" && !t.slice(s + 1).some((h) => h.type === "text" && h.author === "user"), u = s === t.length - 1, d = a.author === "bot" ? $s(a.text) : a.text;
|
|
3827
|
+
return l(zs, {
|
|
3834
3828
|
animate: u,
|
|
3835
|
-
side:
|
|
3836
|
-
children: [
|
|
3829
|
+
side: Ks[a.author],
|
|
3830
|
+
children: [d, i ? e : null]
|
|
3837
3831
|
}, s);
|
|
3838
3832
|
}).with({
|
|
3839
3833
|
type: "link"
|
|
3840
|
-
}, (a) => l(
|
|
3834
|
+
}, (a) => l(qs, {
|
|
3841
3835
|
message: a
|
|
3842
3836
|
})).with({
|
|
3843
3837
|
type: "image"
|
|
@@ -3849,7 +3843,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3849
3843
|
}
|
|
3850
3844
|
})).with({
|
|
3851
3845
|
type: "file"
|
|
3852
|
-
}, (a) => l(
|
|
3846
|
+
}, (a) => l(On, {
|
|
3853
3847
|
class: a.author === "bot" ? void 0 : "ml-auto",
|
|
3854
3848
|
file: {
|
|
3855
3849
|
name: a.fileName,
|
|
@@ -3867,9 +3861,9 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3867
3861
|
});
|
|
3868
3862
|
}).exhaustive()
|
|
3869
3863
|
})
|
|
3870
|
-
}, s)), l(
|
|
3864
|
+
}, s)), l(Us, {}, "typing")]
|
|
3871
3865
|
});
|
|
3872
|
-
},
|
|
3866
|
+
}, ra = ({
|
|
3873
3867
|
logger: e,
|
|
3874
3868
|
apiClient: t,
|
|
3875
3869
|
analytics: r
|
|
@@ -3883,26 +3877,26 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3883
3877
|
chatService: i
|
|
3884
3878
|
} = _n(), {
|
|
3885
3879
|
t: u
|
|
3886
|
-
} =
|
|
3880
|
+
} = J(), [d, h] = Y();
|
|
3887
3881
|
return pe(() => {
|
|
3888
3882
|
s === "maximised" && z.scrollToEnd.instant();
|
|
3889
3883
|
}, [s]), pe(() => {
|
|
3890
3884
|
var S, A;
|
|
3891
3885
|
const {
|
|
3892
3886
|
state: x,
|
|
3893
|
-
flow:
|
|
3887
|
+
flow: y
|
|
3894
3888
|
} = M.current$.peek();
|
|
3895
3889
|
if (x !== "loaded")
|
|
3896
3890
|
throw new Error(u("invalid_state"));
|
|
3897
|
-
let p =
|
|
3898
|
-
if (z.scrollToEnd.instant(), M.setInput(void 0),
|
|
3891
|
+
let p = y.data.nodeHistory.at(-1);
|
|
3892
|
+
if (z.scrollToEnd.instant(), M.setInput(void 0), y.data.isFinished)
|
|
3899
3893
|
return;
|
|
3900
3894
|
p === void 0 ? (p = rr(n.nodes).id, M.setCurrentNodeId(p), r.log({
|
|
3901
3895
|
event: "FLOW_START",
|
|
3902
3896
|
properties: {
|
|
3903
3897
|
flow_id: n.id,
|
|
3904
3898
|
flow_version: n.version,
|
|
3905
|
-
flow_session_id:
|
|
3899
|
+
flow_session_id: y.data.flowSessionId,
|
|
3906
3900
|
flow_build: n.build,
|
|
3907
3901
|
job: n.job
|
|
3908
3902
|
},
|
|
@@ -3972,21 +3966,21 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3972
3966
|
WebkitOverflowScrolling: "touch",
|
|
3973
3967
|
paddingBottom: M.inputHeight$.value
|
|
3974
3968
|
},
|
|
3975
|
-
children: l(
|
|
3976
|
-
lastSentMessageFooter: n.data.isFinished || !
|
|
3977
|
-
undoFn:
|
|
3969
|
+
children: l(Hs, {
|
|
3970
|
+
lastSentMessageFooter: n.data.isFinished || !d ? null : l(Js, {
|
|
3971
|
+
undoFn: d
|
|
3978
3972
|
})
|
|
3979
3973
|
})
|
|
3980
|
-
}), l(
|
|
3974
|
+
}), l(Vs, {
|
|
3981
3975
|
logger: e
|
|
3982
3976
|
})]
|
|
3983
3977
|
});
|
|
3984
|
-
},
|
|
3978
|
+
}, Ws = (e) => "key" in e.data && e.data.key ? [e.data.key] : "keys" in e.data ? Object.values(e.data.keys).filter((t) => typeof t == "string") : [], Js = ({
|
|
3985
3979
|
undoFn: e
|
|
3986
3980
|
}) => {
|
|
3987
3981
|
const {
|
|
3988
3982
|
t
|
|
3989
|
-
} =
|
|
3983
|
+
} = J();
|
|
3990
3984
|
return l("div", {
|
|
3991
3985
|
class: "absolute bottom-0 right-0 flex w-full translate-y-full justify-end",
|
|
3992
3986
|
children: l("button", {
|
|
@@ -3999,7 +3993,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3999
3993
|
const {
|
|
4000
3994
|
removed: n
|
|
4001
3995
|
} = e(r.data.nodeHistory), s = r.data.nodeHistory.splice(-n);
|
|
4002
|
-
s.length !== 0 && (M.removeMessagesSentByNodeIds(s), M.setInput(void 0), s.pop(), s.map((a) => r.nodes.find((i) => i.id === a)).filter(Boolean).flatMap(
|
|
3996
|
+
s.length !== 0 && (M.removeMessagesSentByNodeIds(s), M.setInput(void 0), s.pop(), s.map((a) => r.nodes.find((i) => i.id === a)).filter(Boolean).flatMap(Ws).forEach((a) => delete r.data.submissions[a]), M.current$.value = {
|
|
4003
3997
|
...M.current$.value
|
|
4004
3998
|
});
|
|
4005
3999
|
},
|
|
@@ -4008,5 +4002,5 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
4008
4002
|
});
|
|
4009
4003
|
};
|
|
4010
4004
|
export {
|
|
4011
|
-
|
|
4005
|
+
ra as ChatbotBody
|
|
4012
4006
|
};
|