@inploi/plugin-chatbot 4.0.4 → 4.1.1
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/dist/{chatbot-body-4157a64b.js → chatbot-body-38907c4e.js} +953 -951
- package/dist/chatbot-body-d941017f.cjs +1 -0
- package/dist/chatbot.api.d.ts +0 -11
- package/dist/chatbot.utils.d.ts +0 -1
- package/dist/components/chat-input/chat-input.phone-number.d.ts +0 -1
- package/dist/i18n.d.ts +54 -0
- package/dist/{index-432cb092.js → index-41ded41e.js} +11 -2
- package/dist/index-4fe4e036.cjs +5 -0
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +3 -3
- package/dist/chatbot-body-faf3f35a.cjs +0 -1
- package/dist/index-fc252b7c.cjs +0 -5
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { g as Ue, i as
|
|
1
|
+
import { g as Ue, i as Yt, k as Ne, a as er, b as le, A as Me, c as Ir, N as Ke, _ as V, d as tr, h as Y, e as re, p as ue, F as pt, u as G, o as l, f as Te, j as dt, y as pe, s as M, l as Ze, m as he, n as Mr, q as at, r as ee, t as Fr, v as ke, w as Nr, x as rr, z as Lr, 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 Le, 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-41ded41e.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
|
-
const
|
|
3
|
+
const Ft = ({
|
|
4
4
|
condition: e,
|
|
5
5
|
context: t,
|
|
6
6
|
submissions: r,
|
|
7
7
|
ifBlock: n
|
|
8
8
|
}) => {
|
|
9
|
-
const [
|
|
10
|
-
if (!
|
|
9
|
+
const [a, ...s] = e.compareKey.split(".");
|
|
10
|
+
if (!a)
|
|
11
11
|
return !1;
|
|
12
|
-
const i =
|
|
12
|
+
const i = ir({
|
|
13
13
|
context: t,
|
|
14
|
-
key:
|
|
15
|
-
path:
|
|
14
|
+
key: a,
|
|
15
|
+
path: s,
|
|
16
16
|
submissions: r
|
|
17
17
|
});
|
|
18
18
|
if (!i)
|
|
19
19
|
return !1;
|
|
20
20
|
switch (i.type) {
|
|
21
21
|
case "address": {
|
|
22
|
-
const u = Ue(i.value,
|
|
22
|
+
const u = Ue(i.value, s.join("."));
|
|
23
23
|
switch (e.compare) {
|
|
24
24
|
case "equals":
|
|
25
25
|
return u === e.compareValue;
|
|
@@ -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,
|
|
38
|
+
const u = Ue(i.value, s.join(".")), d = {
|
|
39
39
|
...n,
|
|
40
40
|
data: {
|
|
41
41
|
...n.data,
|
|
@@ -74,7 +74,7 @@ const Nt = ({
|
|
|
74
74
|
context: t
|
|
75
75
|
});
|
|
76
76
|
case "object":
|
|
77
|
-
return Array.isArray(u) && u.every(
|
|
77
|
+
return Array.isArray(u) && u.every(Yt) ? Fe(d, {
|
|
78
78
|
submissions: {
|
|
79
79
|
_temp: {
|
|
80
80
|
value: u,
|
|
@@ -98,7 +98,7 @@ const Nt = ({
|
|
|
98
98
|
}
|
|
99
99
|
case "phone":
|
|
100
100
|
case "string": {
|
|
101
|
-
const u = i.type === "phone" ?
|
|
101
|
+
const u = i.type === "phone" ? Xe(i.value) : i.value;
|
|
102
102
|
switch (e.compare) {
|
|
103
103
|
case "equals":
|
|
104
104
|
return u === e.compareValue;
|
|
@@ -152,9 +152,9 @@ const Nt = ({
|
|
|
152
152
|
}) => {
|
|
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
|
-
for (const
|
|
156
|
-
if (
|
|
157
|
-
condition:
|
|
155
|
+
for (const s of n)
|
|
156
|
+
if (Ft({
|
|
157
|
+
condition: s,
|
|
158
158
|
context: t,
|
|
159
159
|
submissions: r,
|
|
160
160
|
ifBlock: e
|
|
@@ -162,9 +162,9 @@ const Nt = ({
|
|
|
162
162
|
return !0;
|
|
163
163
|
return !1;
|
|
164
164
|
} else {
|
|
165
|
-
for (const
|
|
166
|
-
if (!
|
|
167
|
-
condition:
|
|
165
|
+
for (const s of n)
|
|
166
|
+
if (!Ft({
|
|
167
|
+
condition: s,
|
|
168
168
|
context: t,
|
|
169
169
|
submissions: r,
|
|
170
170
|
ifBlock: e
|
|
@@ -175,58 +175,58 @@ const Nt = ({
|
|
|
175
175
|
}, Hr = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, ne = (e, {
|
|
176
176
|
context: t,
|
|
177
177
|
submissions: r
|
|
178
|
-
}) => e.replace(Hr, (n,
|
|
179
|
-
const [i, ...u] =
|
|
178
|
+
}) => e.replace(Hr, (n, a, s = "") => {
|
|
179
|
+
const [i, ...u] = a.trim().split("."), d = ir({
|
|
180
180
|
key: i,
|
|
181
181
|
path: u,
|
|
182
182
|
submissions: r,
|
|
183
183
|
context: t
|
|
184
184
|
});
|
|
185
185
|
if (!d)
|
|
186
|
-
return
|
|
186
|
+
return s;
|
|
187
187
|
switch (d.type) {
|
|
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
|
-
return d.value ? d.value.toString() :
|
|
198
|
+
return d.value ? d.value.toString() : s;
|
|
199
199
|
case "phone":
|
|
200
|
-
return
|
|
200
|
+
return Xe(d.value);
|
|
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
|
}
|
|
218
218
|
}
|
|
219
|
-
return
|
|
220
|
-
}),
|
|
219
|
+
return s;
|
|
220
|
+
}), ar = ({
|
|
221
221
|
node: e,
|
|
222
222
|
nodes: t,
|
|
223
223
|
stopWhen: r
|
|
224
224
|
}) => {
|
|
225
225
|
if ((r == null ? void 0 : r(e)) === !0)
|
|
226
226
|
return e;
|
|
227
|
-
const n = e.nextId ? t.find((
|
|
227
|
+
const n = e.nextId ? t.find((a) => a.id === e.nextId) : void 0;
|
|
228
228
|
if (n)
|
|
229
|
-
return
|
|
229
|
+
return ar({
|
|
230
230
|
node: n,
|
|
231
231
|
nodes: t,
|
|
232
232
|
stopWhen: r
|
|
@@ -235,59 +235,59 @@ const Nt = ({
|
|
|
235
235
|
childNode: e,
|
|
236
236
|
nodes: t
|
|
237
237
|
}) => {
|
|
238
|
-
const n = t.filter((
|
|
239
|
-
if (!
|
|
238
|
+
const n = t.filter((a) => a.type === "if-block").find((a) => {
|
|
239
|
+
if (!a.branchId)
|
|
240
240
|
return !1;
|
|
241
|
-
const
|
|
242
|
-
if (!
|
|
241
|
+
const s = t.find((u) => u.id === a.branchId);
|
|
242
|
+
if (!s)
|
|
243
243
|
return !1;
|
|
244
|
-
const i =
|
|
245
|
-
node:
|
|
244
|
+
const i = ar({
|
|
245
|
+
node: s,
|
|
246
246
|
nodes: t,
|
|
247
247
|
stopWhen: (u) => u.id === e.id
|
|
248
248
|
});
|
|
249
249
|
return !(!i || i.id !== e.id);
|
|
250
250
|
});
|
|
251
251
|
if (n != null && n.nextId)
|
|
252
|
-
return t.find((
|
|
252
|
+
return t.find((a) => a.id === n.nextId);
|
|
253
253
|
}, Jr = ({
|
|
254
254
|
flow: e,
|
|
255
255
|
analytics: t,
|
|
256
256
|
logger: r,
|
|
257
257
|
context: n,
|
|
258
|
-
apiClient:
|
|
259
|
-
getSubmissions:
|
|
258
|
+
apiClient: a,
|
|
259
|
+
getSubmissions: s,
|
|
260
260
|
chatService: i,
|
|
261
261
|
onFlowEnd: u,
|
|
262
262
|
onInterpret: d,
|
|
263
|
-
t:
|
|
263
|
+
t: p
|
|
264
264
|
}) => {
|
|
265
265
|
let x = new AbortController();
|
|
266
|
-
const
|
|
266
|
+
const v = {
|
|
267
267
|
...t.service,
|
|
268
|
-
log: (
|
|
269
|
-
...
|
|
268
|
+
log: (k) => t.service.log({
|
|
269
|
+
...k,
|
|
270
270
|
customProperties: {
|
|
271
|
-
...
|
|
271
|
+
...k.customProperties,
|
|
272
272
|
...t.customProperties
|
|
273
273
|
}
|
|
274
274
|
})
|
|
275
|
-
},
|
|
276
|
-
const
|
|
277
|
-
d == null || d(
|
|
275
|
+
}, h = async (k, y) => {
|
|
276
|
+
const A = s();
|
|
277
|
+
d == null || d(k, y);
|
|
278
278
|
try {
|
|
279
279
|
await Zr({
|
|
280
280
|
flow: e,
|
|
281
|
-
analytics:
|
|
281
|
+
analytics: v,
|
|
282
282
|
logger: r,
|
|
283
|
-
apiClient:
|
|
283
|
+
apiClient: a,
|
|
284
284
|
context: n,
|
|
285
|
-
node:
|
|
286
|
-
submissions:
|
|
287
|
-
t:
|
|
285
|
+
node: k,
|
|
286
|
+
submissions: A,
|
|
287
|
+
t: p,
|
|
288
288
|
chat: {
|
|
289
289
|
sendMessage: async (S) => i.send({
|
|
290
|
-
groupId:
|
|
290
|
+
groupId: k.id,
|
|
291
291
|
message: S,
|
|
292
292
|
signal: x.signal
|
|
293
293
|
}),
|
|
@@ -298,13 +298,13 @@ const Nt = ({
|
|
|
298
298
|
addToSubmissions: i.addToSubmissions
|
|
299
299
|
},
|
|
300
300
|
next: (S) => {
|
|
301
|
-
const
|
|
302
|
-
childNode:
|
|
301
|
+
const E = S ? e.nodes.find((g) => g.id === S) : Wr({
|
|
302
|
+
childNode: k,
|
|
303
303
|
nodes: e.nodes
|
|
304
304
|
});
|
|
305
|
-
return
|
|
305
|
+
return E ? h(E, k) : u == null ? void 0 : u(k);
|
|
306
306
|
},
|
|
307
|
-
end: () => u == null ? void 0 : u(
|
|
307
|
+
end: () => u == null ? void 0 : u(k)
|
|
308
308
|
});
|
|
309
309
|
} catch (S) {
|
|
310
310
|
if (S instanceof Me)
|
|
@@ -313,29 +313,29 @@ const Nt = ({
|
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
return {
|
|
316
|
-
interpret: async (
|
|
317
|
-
const
|
|
318
|
-
return
|
|
316
|
+
interpret: async (k) => {
|
|
317
|
+
const y = e.nodes.find((A) => A.id === k) ?? er(e.nodes);
|
|
318
|
+
return h(y);
|
|
319
319
|
},
|
|
320
|
-
undo: (
|
|
321
|
-
let
|
|
322
|
-
const
|
|
323
|
-
for (let
|
|
324
|
-
const g =
|
|
325
|
-
if (!
|
|
320
|
+
undo: (k) => {
|
|
321
|
+
let y = 1;
|
|
322
|
+
const A = e.nodes.find((E) => E.id === k[k.length - 1]);
|
|
323
|
+
for (let E = k.length - 2; E > 0; E--) {
|
|
324
|
+
const g = k[E], N = e.nodes.find((P) => P.id === g);
|
|
325
|
+
if (!N || (y++, N.type.startsWith("question-")))
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
x.abort(), x = new AbortController();
|
|
329
|
-
const S = e.nodes.find((
|
|
330
|
-
return le(S, "Undo failed: new start node not found"),
|
|
331
|
-
removed:
|
|
329
|
+
const S = e.nodes.find((E) => E.id === k[k.length - y]);
|
|
330
|
+
return le(S, "Undo failed: new start node not found"), h(S, A), {
|
|
331
|
+
removed: y
|
|
332
332
|
};
|
|
333
333
|
},
|
|
334
334
|
abort: () => {
|
|
335
335
|
x.abort();
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
},
|
|
338
|
+
}, Xe = (e) => `+${e.countryCode} ${e.phoneNumber}`;
|
|
339
339
|
async function Zr(e) {
|
|
340
340
|
const t = e.node;
|
|
341
341
|
switch (t.type) {
|
|
@@ -417,12 +417,12 @@ async function Zr(e) {
|
|
|
417
417
|
case "integration-workflow-get":
|
|
418
418
|
throw Error("Workflow should be unreachable");
|
|
419
419
|
case "identify":
|
|
420
|
-
return
|
|
420
|
+
return Qr({
|
|
421
421
|
...e,
|
|
422
422
|
node: t
|
|
423
423
|
});
|
|
424
424
|
case "feedback":
|
|
425
|
-
return
|
|
425
|
+
return Xr({
|
|
426
426
|
...e,
|
|
427
427
|
node: t
|
|
428
428
|
});
|
|
@@ -430,25 +430,25 @@ async function Zr(e) {
|
|
|
430
430
|
throw new Error(`Unknown node: ${JSON.stringify(t)}`);
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
const
|
|
433
|
+
const Ve = (e, t) => {
|
|
434
434
|
var n;
|
|
435
435
|
const r = (n = e[t]) == null ? void 0 : n.value;
|
|
436
436
|
if (typeof r != "string" && typeof r != "number")
|
|
437
437
|
throw new Error(`Submission at “${t}” is not a string or number`);
|
|
438
438
|
return r;
|
|
439
439
|
};
|
|
440
|
-
async function
|
|
440
|
+
async function Xr({
|
|
441
441
|
next: e,
|
|
442
442
|
node: t
|
|
443
443
|
}) {
|
|
444
444
|
e(t.nextId);
|
|
445
445
|
}
|
|
446
|
-
async function
|
|
446
|
+
async function Qr({
|
|
447
447
|
next: e,
|
|
448
448
|
node: t,
|
|
449
449
|
analytics: r,
|
|
450
450
|
submissions: n,
|
|
451
|
-
logger:
|
|
451
|
+
logger: a
|
|
452
452
|
}) {
|
|
453
453
|
if (!n)
|
|
454
454
|
return e(t.nextId);
|
|
@@ -456,22 +456,22 @@ async function Xr({
|
|
|
456
456
|
r.log({
|
|
457
457
|
event: "IDENTIFY",
|
|
458
458
|
properties: {
|
|
459
|
-
identifier:
|
|
460
|
-
first_name: t.data.firstName ?
|
|
461
|
-
last_name: t.data.lastName ?
|
|
462
|
-
email: t.data.email ?
|
|
463
|
-
phone_number: t.data.phoneNumber ?
|
|
459
|
+
identifier: Ve(n, t.data.key).toString(),
|
|
460
|
+
first_name: t.data.firstName ? Ve(n, t.data.firstName).toString() : void 0,
|
|
461
|
+
last_name: t.data.lastName ? Ve(n, t.data.lastName).toString() : void 0,
|
|
462
|
+
email: t.data.email ? Ve(n, t.data.email).toString() : void 0,
|
|
463
|
+
phone_number: t.data.phoneNumber ? Ve(n, t.data.phoneNumber).toString() : void 0,
|
|
464
464
|
custom_traits: t.data.customTraits ? Object.fromEntries(t.data.customTraits.map(({
|
|
465
|
-
key:
|
|
465
|
+
key: s,
|
|
466
466
|
value: i
|
|
467
467
|
}) => {
|
|
468
468
|
var u;
|
|
469
|
-
return [
|
|
469
|
+
return [s, (u = n[i]) == null ? void 0 : u.value];
|
|
470
470
|
})) : void 0
|
|
471
471
|
}
|
|
472
472
|
});
|
|
473
|
-
} catch (
|
|
474
|
-
|
|
473
|
+
} catch (s) {
|
|
474
|
+
a.error(s);
|
|
475
475
|
} finally {
|
|
476
476
|
e(t.nextId);
|
|
477
477
|
}
|
|
@@ -487,7 +487,7 @@ async function en({
|
|
|
487
487
|
node: t,
|
|
488
488
|
logger: r,
|
|
489
489
|
submissions: n,
|
|
490
|
-
context:
|
|
490
|
+
context: a
|
|
491
491
|
}) {
|
|
492
492
|
if (!n) {
|
|
493
493
|
r.error("Submissions not found");
|
|
@@ -497,7 +497,7 @@ async function en({
|
|
|
497
497
|
type: "string",
|
|
498
498
|
value: ne(t.data.value, {
|
|
499
499
|
submissions: n,
|
|
500
|
-
context:
|
|
500
|
+
context: a
|
|
501
501
|
})
|
|
502
502
|
}, e(t.nextId);
|
|
503
503
|
}
|
|
@@ -506,13 +506,13 @@ async function tn({
|
|
|
506
506
|
next: t,
|
|
507
507
|
node: r,
|
|
508
508
|
logger: n,
|
|
509
|
-
apiClient:
|
|
510
|
-
submissions:
|
|
509
|
+
apiClient: a,
|
|
510
|
+
submissions: s,
|
|
511
511
|
analytics: i,
|
|
512
512
|
flow: u,
|
|
513
513
|
t: d
|
|
514
514
|
}) {
|
|
515
|
-
const
|
|
515
|
+
const p = async (x) => {
|
|
516
516
|
x !== !0 && await e.userInput({
|
|
517
517
|
type: "submit",
|
|
518
518
|
key: void 0,
|
|
@@ -523,36 +523,36 @@ async function tn({
|
|
|
523
523
|
type: "loading"
|
|
524
524
|
});
|
|
525
525
|
const {
|
|
526
|
-
anonymous_id:
|
|
527
|
-
session_id:
|
|
528
|
-
} = i.getSessionInfo(),
|
|
526
|
+
anonymous_id: v,
|
|
527
|
+
session_id: h
|
|
528
|
+
} = i.getSessionInfo(), k = await a.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:
|
|
534
|
-
session_id:
|
|
533
|
+
anonymous_id: v,
|
|
534
|
+
session_id: h,
|
|
535
535
|
job: u.job,
|
|
536
|
-
submissions:
|
|
536
|
+
submissions: Ir(s || {})
|
|
537
537
|
})
|
|
538
|
-
}).catch((
|
|
538
|
+
}).catch((y) => y);
|
|
539
539
|
r.data.key && e.addToSubmissions(r.data.key, {
|
|
540
540
|
type: "integration",
|
|
541
|
-
value:
|
|
542
|
-
}), Ke(
|
|
543
|
-
integration_response:
|
|
544
|
-
service:
|
|
545
|
-
status:
|
|
546
|
-
data:
|
|
541
|
+
value: k
|
|
542
|
+
}), Ke(k).with({
|
|
543
|
+
integration_response: V.select(V.union({
|
|
544
|
+
service: V.optional(V.string),
|
|
545
|
+
status: V.number,
|
|
546
|
+
data: V.any
|
|
547
547
|
}, {
|
|
548
|
-
service:
|
|
549
|
-
status:
|
|
548
|
+
service: V.optional(V.string),
|
|
549
|
+
status: V.number,
|
|
550
550
|
error: {
|
|
551
|
-
message:
|
|
552
|
-
data:
|
|
551
|
+
message: V.string,
|
|
552
|
+
data: V.any
|
|
553
553
|
}
|
|
554
554
|
}))
|
|
555
|
-
}, (
|
|
555
|
+
}, (y) => {
|
|
556
556
|
i.log({
|
|
557
557
|
event: "FLOW_SUBMIT",
|
|
558
558
|
properties: {
|
|
@@ -560,44 +560,44 @@ async function tn({
|
|
|
560
560
|
flow_version: u.version,
|
|
561
561
|
flow_session_id: u.data.flowSessionId,
|
|
562
562
|
flow_build: u.build,
|
|
563
|
-
service:
|
|
563
|
+
service: y.service ?? "INVALID_SERVICE",
|
|
564
564
|
response: {
|
|
565
|
-
status:
|
|
566
|
-
payload: "data" in
|
|
565
|
+
status: y.status,
|
|
566
|
+
payload: "data" in y ? y.data : y.error.data ?? null
|
|
567
567
|
},
|
|
568
568
|
job: u.job
|
|
569
569
|
}
|
|
570
570
|
});
|
|
571
571
|
}).otherwise(() => {
|
|
572
|
-
}), await Ke(
|
|
573
|
-
ats_data:
|
|
574
|
-
redirect_url:
|
|
575
|
-
message:
|
|
576
|
-
button_text:
|
|
572
|
+
}), await Ke(k).with(V.union({
|
|
573
|
+
ats_data: V.select("redirect", {
|
|
574
|
+
redirect_url: V.string,
|
|
575
|
+
message: V.optional(V.union(V.string, V.nullish)),
|
|
576
|
+
button_text: V.optional(V.union(V.string, V.nullish))
|
|
577
577
|
})
|
|
578
578
|
}, {
|
|
579
579
|
integration_response: {
|
|
580
|
-
data:
|
|
581
|
-
redirect_url:
|
|
582
|
-
message:
|
|
583
|
-
button_text:
|
|
580
|
+
data: V.select("redirect", {
|
|
581
|
+
redirect_url: V.string,
|
|
582
|
+
message: V.optional(V.union(V.string, V.nullish)),
|
|
583
|
+
button_text: V.optional(V.union(V.string, V.nullish))
|
|
584
584
|
})
|
|
585
585
|
}
|
|
586
|
-
}), async (
|
|
587
|
-
if (
|
|
586
|
+
}), async (y) => {
|
|
587
|
+
if (y.redirect !== void 0) {
|
|
588
588
|
await e.sendMessage({
|
|
589
589
|
type: "text",
|
|
590
590
|
author: "bot",
|
|
591
|
-
text:
|
|
591
|
+
text: y.redirect.message ?? d("submission_redirect_message")
|
|
592
592
|
});
|
|
593
593
|
try {
|
|
594
|
-
const
|
|
595
|
-
|
|
594
|
+
const A = new URL(y.redirect.redirect_url);
|
|
595
|
+
v && !A.searchParams.has("anonymous_id") && A.searchParams.set("anonymous_id", v), await e.sendMessage({
|
|
596
596
|
type: "link",
|
|
597
|
-
href:
|
|
598
|
-
text:
|
|
597
|
+
href: A.toString(),
|
|
598
|
+
text: y.redirect.button_text ?? d("complete_submission"),
|
|
599
599
|
onClick: () => {
|
|
600
|
-
if (!
|
|
600
|
+
if (!h) {
|
|
601
601
|
n.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
602
602
|
return;
|
|
603
603
|
}
|
|
@@ -606,16 +606,16 @@ async function tn({
|
|
|
606
606
|
properties: {
|
|
607
607
|
flow_build: u.build,
|
|
608
608
|
flow_id: u.id,
|
|
609
|
-
flow_session_id:
|
|
609
|
+
flow_session_id: h,
|
|
610
610
|
flow_version: u.version,
|
|
611
|
-
href:
|
|
611
|
+
href: A.toString(),
|
|
612
612
|
job: u.job
|
|
613
613
|
}
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
616
|
});
|
|
617
|
-
} catch (
|
|
618
|
-
n.error(`Invalid redirect URL: ${
|
|
617
|
+
} catch (A) {
|
|
618
|
+
n.error(`Invalid redirect URL: ${y.redirect.redirect_url}`, A), e.sendMessage({
|
|
619
619
|
type: "system",
|
|
620
620
|
variant: "error",
|
|
621
621
|
text: d("redirect_url_error")
|
|
@@ -631,50 +631,50 @@ async function tn({
|
|
|
631
631
|
variant: "success",
|
|
632
632
|
text: d("submission_completed")
|
|
633
633
|
}), t(r.nextId);
|
|
634
|
-
}).with(
|
|
634
|
+
}).with(V.union({
|
|
635
635
|
success: !1,
|
|
636
|
-
ats_data:
|
|
637
|
-
message:
|
|
636
|
+
ats_data: V.select("error", {
|
|
637
|
+
message: V.string
|
|
638
638
|
})
|
|
639
639
|
}, {
|
|
640
640
|
integration_response: {
|
|
641
|
-
error:
|
|
642
|
-
message:
|
|
641
|
+
error: V.select("error", {
|
|
642
|
+
message: V.string
|
|
643
643
|
})
|
|
644
644
|
}
|
|
645
|
-
}), async (
|
|
646
|
-
var
|
|
647
|
-
n.error(
|
|
645
|
+
}), async (y) => {
|
|
646
|
+
var A;
|
|
647
|
+
n.error(y.error), await e.sendMessage({
|
|
648
648
|
type: "system",
|
|
649
649
|
variant: "error",
|
|
650
|
-
text: ((
|
|
651
|
-
}), await
|
|
652
|
-
}).otherwise(async (
|
|
653
|
-
n.error(
|
|
650
|
+
text: ((A = y.error) == null ? void 0 : A.message) || d("submission_failed")
|
|
651
|
+
}), await p(!1);
|
|
652
|
+
}).otherwise(async (y) => {
|
|
653
|
+
n.error(y), await e.sendMessage({
|
|
654
654
|
type: "system",
|
|
655
655
|
variant: "error",
|
|
656
656
|
text: d("submission_failed")
|
|
657
|
-
}), await
|
|
657
|
+
}), await p(!1);
|
|
658
658
|
});
|
|
659
659
|
};
|
|
660
|
-
await
|
|
660
|
+
await p(r.data.skipConfirmation);
|
|
661
661
|
}
|
|
662
662
|
async function rn({
|
|
663
663
|
chat: e,
|
|
664
664
|
next: t,
|
|
665
665
|
node: r,
|
|
666
666
|
submissions: n,
|
|
667
|
-
context:
|
|
667
|
+
context: a
|
|
668
668
|
}) {
|
|
669
669
|
await e.sendMessage({
|
|
670
670
|
type: "link",
|
|
671
671
|
href: ne(r.data.href, {
|
|
672
672
|
submissions: n,
|
|
673
|
-
context:
|
|
673
|
+
context: a
|
|
674
674
|
}),
|
|
675
675
|
text: ne(r.data.cta, {
|
|
676
676
|
submissions: n,
|
|
677
|
-
context:
|
|
677
|
+
context: a
|
|
678
678
|
})
|
|
679
679
|
}), t(r.nextId);
|
|
680
680
|
}
|
|
@@ -694,14 +694,14 @@ async function sn({
|
|
|
694
694
|
next: t,
|
|
695
695
|
node: r,
|
|
696
696
|
submissions: n,
|
|
697
|
-
context:
|
|
697
|
+
context: a
|
|
698
698
|
}) {
|
|
699
699
|
await e.sendMessage({
|
|
700
700
|
author: "bot",
|
|
701
701
|
type: "text",
|
|
702
702
|
text: ne(r.data.text, {
|
|
703
703
|
submissions: n,
|
|
704
|
-
context:
|
|
704
|
+
context: a
|
|
705
705
|
})
|
|
706
706
|
}), t(r.nextId);
|
|
707
707
|
}
|
|
@@ -723,15 +723,15 @@ async function on({
|
|
|
723
723
|
next: t,
|
|
724
724
|
node: r,
|
|
725
725
|
submissions: n,
|
|
726
|
-
context:
|
|
727
|
-
t:
|
|
726
|
+
context: a,
|
|
727
|
+
t: s
|
|
728
728
|
}) {
|
|
729
729
|
await e.sendMessage({
|
|
730
730
|
author: "bot",
|
|
731
731
|
type: "text",
|
|
732
732
|
text: ne(r.data.question, {
|
|
733
733
|
submissions: n,
|
|
734
|
-
context:
|
|
734
|
+
context: a
|
|
735
735
|
})
|
|
736
736
|
});
|
|
737
737
|
const i = r.data.format === "phone" ? await e.userInput({
|
|
@@ -740,7 +740,6 @@ async function on({
|
|
|
740
740
|
config: {
|
|
741
741
|
optional: r.data.optional,
|
|
742
742
|
placeholder: r.data.placeholder,
|
|
743
|
-
maxChars: r.data.maxChars,
|
|
744
743
|
minChars: r.data.minChars,
|
|
745
744
|
submissionFormat: "text",
|
|
746
745
|
defaultValue: {}
|
|
@@ -759,11 +758,11 @@ async function on({
|
|
|
759
758
|
i === null ? await e.sendMessage({
|
|
760
759
|
type: "system",
|
|
761
760
|
variant: "info",
|
|
762
|
-
text:
|
|
761
|
+
text: s("skipped")
|
|
763
762
|
}) : await e.sendMessage({
|
|
764
763
|
author: "user",
|
|
765
764
|
type: "text",
|
|
766
|
-
text: i.type === "phone" ?
|
|
765
|
+
text: i.type === "phone" ? Xe(i.value) : i.value
|
|
767
766
|
}), t(r.nextId);
|
|
768
767
|
}
|
|
769
768
|
async function ln({
|
|
@@ -771,15 +770,15 @@ async function ln({
|
|
|
771
770
|
next: t,
|
|
772
771
|
node: r,
|
|
773
772
|
submissions: n,
|
|
774
|
-
context:
|
|
775
|
-
t:
|
|
773
|
+
context: a,
|
|
774
|
+
t: s
|
|
776
775
|
}) {
|
|
777
776
|
await e.sendMessage({
|
|
778
777
|
author: "bot",
|
|
779
778
|
type: "text",
|
|
780
779
|
text: ne(r.data.question, {
|
|
781
780
|
submissions: n,
|
|
782
|
-
context:
|
|
781
|
+
context: a
|
|
783
782
|
})
|
|
784
783
|
});
|
|
785
784
|
const i = await e.userInput({
|
|
@@ -796,7 +795,7 @@ async function ln({
|
|
|
796
795
|
i === null ? await e.sendMessage({
|
|
797
796
|
type: "system",
|
|
798
797
|
variant: "info",
|
|
799
|
-
text:
|
|
798
|
+
text: s("skipped")
|
|
800
799
|
}) : await e.sendMessage({
|
|
801
800
|
author: "user",
|
|
802
801
|
type: "text",
|
|
@@ -808,22 +807,21 @@ async function un({
|
|
|
808
807
|
next: t,
|
|
809
808
|
node: r,
|
|
810
809
|
submissions: n,
|
|
811
|
-
context:
|
|
810
|
+
context: a
|
|
812
811
|
}) {
|
|
813
812
|
await e.sendMessage({
|
|
814
813
|
author: "bot",
|
|
815
814
|
type: "text",
|
|
816
815
|
text: ne(r.data.question, {
|
|
817
816
|
submissions: n,
|
|
818
|
-
context:
|
|
817
|
+
context: a
|
|
819
818
|
})
|
|
820
819
|
});
|
|
821
|
-
const
|
|
820
|
+
const s = await e.userInput({
|
|
822
821
|
key: r.data.key,
|
|
823
822
|
type: "phone",
|
|
824
823
|
config: {
|
|
825
824
|
minChars: r.data.minChars,
|
|
826
|
-
maxChars: r.data.maxChars,
|
|
827
825
|
defaultValue: {
|
|
828
826
|
countryCode: r.data.defaultCountryCode
|
|
829
827
|
},
|
|
@@ -832,14 +830,14 @@ async function un({
|
|
|
832
830
|
optional: r.data.optional
|
|
833
831
|
}
|
|
834
832
|
});
|
|
835
|
-
|
|
833
|
+
s === null ? await e.sendMessage({
|
|
836
834
|
type: "system",
|
|
837
835
|
variant: "info",
|
|
838
836
|
text: "Skipped"
|
|
839
837
|
}) : await e.sendMessage({
|
|
840
838
|
author: "user",
|
|
841
839
|
type: "text",
|
|
842
|
-
text:
|
|
840
|
+
text: s.type === "phone" ? Xe(s.value) : s.value
|
|
843
841
|
}), t(r.nextId);
|
|
844
842
|
}
|
|
845
843
|
async function cn({
|
|
@@ -847,15 +845,15 @@ async function cn({
|
|
|
847
845
|
next: t,
|
|
848
846
|
node: r,
|
|
849
847
|
submissions: n,
|
|
850
|
-
context:
|
|
851
|
-
t:
|
|
848
|
+
context: a,
|
|
849
|
+
t: s
|
|
852
850
|
}) {
|
|
853
851
|
await e.sendMessage({
|
|
854
852
|
author: "bot",
|
|
855
853
|
type: "text",
|
|
856
854
|
text: ne(r.data.question, {
|
|
857
855
|
submissions: n,
|
|
858
|
-
context:
|
|
856
|
+
context: a
|
|
859
857
|
})
|
|
860
858
|
});
|
|
861
859
|
const i = await e.userInput({
|
|
@@ -866,7 +864,7 @@ async function cn({
|
|
|
866
864
|
i.value.length === 0 ? await e.sendMessage({
|
|
867
865
|
type: "system",
|
|
868
866
|
variant: "info",
|
|
869
|
-
text:
|
|
867
|
+
text: s("skipped")
|
|
870
868
|
}) : await e.sendMessage({
|
|
871
869
|
author: "user",
|
|
872
870
|
type: "text",
|
|
@@ -878,15 +876,15 @@ async function dn({
|
|
|
878
876
|
next: t,
|
|
879
877
|
node: r,
|
|
880
878
|
submissions: n,
|
|
881
|
-
context:
|
|
882
|
-
t:
|
|
879
|
+
context: a,
|
|
880
|
+
t: s
|
|
883
881
|
}) {
|
|
884
882
|
await e.sendMessage({
|
|
885
883
|
author: "bot",
|
|
886
884
|
type: "text",
|
|
887
885
|
text: ne(r.data.question, {
|
|
888
886
|
submissions: n,
|
|
889
|
-
context:
|
|
887
|
+
context: a
|
|
890
888
|
})
|
|
891
889
|
});
|
|
892
890
|
const i = await e.userInput({
|
|
@@ -903,7 +901,7 @@ async function dn({
|
|
|
903
901
|
i === null ? await e.sendMessage({
|
|
904
902
|
type: "system",
|
|
905
903
|
variant: "info",
|
|
906
|
-
text:
|
|
904
|
+
text: s("skipped")
|
|
907
905
|
}) : await e.sendMessage({
|
|
908
906
|
author: "user",
|
|
909
907
|
type: "text",
|
|
@@ -921,7 +919,7 @@ async function fn({
|
|
|
921
919
|
type: "text",
|
|
922
920
|
text: r.data.question
|
|
923
921
|
});
|
|
924
|
-
const
|
|
922
|
+
const a = await e.userInput({
|
|
925
923
|
type: "address",
|
|
926
924
|
key: r.data.key,
|
|
927
925
|
config: {
|
|
@@ -930,18 +928,18 @@ async function fn({
|
|
|
930
928
|
placeholder: r.data.placeholder
|
|
931
929
|
}
|
|
932
930
|
});
|
|
933
|
-
if (
|
|
931
|
+
if (a === null)
|
|
934
932
|
await e.sendMessage({
|
|
935
933
|
type: "system",
|
|
936
934
|
variant: "info",
|
|
937
935
|
text: n("skipped")
|
|
938
936
|
});
|
|
939
937
|
else {
|
|
940
|
-
const
|
|
938
|
+
const s = Object.values(a.value).filter((i) => i && i.trim().length > 0).join(", ");
|
|
941
939
|
await e.sendMessage({
|
|
942
940
|
author: "user",
|
|
943
941
|
type: "text",
|
|
944
|
-
text:
|
|
942
|
+
text: s
|
|
945
943
|
});
|
|
946
944
|
}
|
|
947
945
|
return t(r.nextId);
|
|
@@ -951,15 +949,15 @@ async function hn({
|
|
|
951
949
|
chat: t,
|
|
952
950
|
next: r,
|
|
953
951
|
submissions: n,
|
|
954
|
-
context:
|
|
955
|
-
t:
|
|
952
|
+
context: a,
|
|
953
|
+
t: s
|
|
956
954
|
}) {
|
|
957
955
|
await t.sendMessage({
|
|
958
956
|
author: "bot",
|
|
959
957
|
type: "text",
|
|
960
958
|
text: ne(e.data.question, {
|
|
961
959
|
submissions: n,
|
|
962
|
-
context:
|
|
960
|
+
context: a
|
|
963
961
|
})
|
|
964
962
|
});
|
|
965
963
|
const i = await t.userInput({
|
|
@@ -977,7 +975,7 @@ async function hn({
|
|
|
977
975
|
await t.sendMessage({
|
|
978
976
|
type: "system",
|
|
979
977
|
variant: "info",
|
|
980
|
-
text:
|
|
978
|
+
text: s("skipped")
|
|
981
979
|
});
|
|
982
980
|
else
|
|
983
981
|
for (const u of i.value)
|
|
@@ -1000,7 +998,7 @@ async function pn({
|
|
|
1000
998
|
text: r.data.systemMessage
|
|
1001
999
|
}), t();
|
|
1002
1000
|
}
|
|
1003
|
-
const
|
|
1001
|
+
const ir = ({
|
|
1004
1002
|
key: e,
|
|
1005
1003
|
path: t,
|
|
1006
1004
|
submissions: r,
|
|
@@ -1009,65 +1007,65 @@ const or = ({
|
|
|
1009
1007
|
if (e === "$context") {
|
|
1010
1008
|
if (!t)
|
|
1011
1009
|
return;
|
|
1012
|
-
const
|
|
1013
|
-
switch (typeof
|
|
1010
|
+
const a = Ue(n, t.join("."));
|
|
1011
|
+
switch (typeof a) {
|
|
1014
1012
|
case "string":
|
|
1015
1013
|
return {
|
|
1016
1014
|
type: "string",
|
|
1017
|
-
value:
|
|
1015
|
+
value: a
|
|
1018
1016
|
};
|
|
1019
1017
|
case "number":
|
|
1020
1018
|
return {
|
|
1021
1019
|
type: "number",
|
|
1022
|
-
value:
|
|
1020
|
+
value: a
|
|
1023
1021
|
};
|
|
1024
1022
|
case "boolean":
|
|
1025
1023
|
return {
|
|
1026
1024
|
type: "boolean",
|
|
1027
|
-
value:
|
|
1025
|
+
value: a
|
|
1028
1026
|
};
|
|
1029
1027
|
default:
|
|
1030
|
-
console.warn(`Unexpected type for $context.${t.join(".")}`,
|
|
1028
|
+
console.warn(`Unexpected type for $context.${t.join(".")}`, a);
|
|
1031
1029
|
return;
|
|
1032
1030
|
}
|
|
1033
1031
|
}
|
|
1034
1032
|
return r == null ? void 0 : r[e];
|
|
1035
1033
|
};
|
|
1036
1034
|
function ft(e, t, r) {
|
|
1037
|
-
var n,
|
|
1035
|
+
var n, a, s, i, u;
|
|
1038
1036
|
t == null && (t = 100);
|
|
1039
1037
|
function d() {
|
|
1040
1038
|
var x = Date.now() - i;
|
|
1041
|
-
x < t && x >= 0 ? n = setTimeout(d, t - x) : (n = null, r || (u = e.apply(
|
|
1039
|
+
x < t && x >= 0 ? n = setTimeout(d, t - x) : (n = null, r || (u = e.apply(s, a), s = a = null));
|
|
1042
1040
|
}
|
|
1043
|
-
var
|
|
1044
|
-
|
|
1041
|
+
var p = function() {
|
|
1042
|
+
s = this, a = arguments, i = Date.now();
|
|
1045
1043
|
var x = r && !n;
|
|
1046
|
-
return n || (n = setTimeout(d, t)), x && (u = e.apply(
|
|
1044
|
+
return n || (n = setTimeout(d, t)), x && (u = e.apply(s, a), s = a = null), u;
|
|
1047
1045
|
};
|
|
1048
|
-
return
|
|
1046
|
+
return p.clear = function() {
|
|
1049
1047
|
n && (clearTimeout(n), n = null);
|
|
1050
|
-
},
|
|
1051
|
-
n && (u = e.apply(
|
|
1052
|
-
},
|
|
1048
|
+
}, p.flush = function() {
|
|
1049
|
+
n && (u = e.apply(s, a), s = a = null, clearTimeout(n), n = null);
|
|
1050
|
+
}, p;
|
|
1053
1051
|
}
|
|
1054
1052
|
ft.debounce = ft;
|
|
1055
1053
|
var mn = ft;
|
|
1056
|
-
const
|
|
1054
|
+
const Nt = /* @__PURE__ */ tr(mn);
|
|
1057
1055
|
function gn(e) {
|
|
1058
1056
|
let {
|
|
1059
1057
|
debounce: t,
|
|
1060
1058
|
scroll: r,
|
|
1061
1059
|
polyfill: n,
|
|
1062
|
-
offsetSize:
|
|
1060
|
+
offsetSize: a
|
|
1063
1061
|
} = e === void 0 ? {
|
|
1064
1062
|
debounce: 0,
|
|
1065
1063
|
scroll: !1,
|
|
1066
1064
|
offsetSize: !1
|
|
1067
1065
|
} : e;
|
|
1068
|
-
const
|
|
1066
|
+
const s = n || (typeof window > "u" ? class {
|
|
1069
1067
|
} : window.ResizeObserver);
|
|
1070
|
-
if (!
|
|
1068
|
+
if (!s)
|
|
1071
1069
|
throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");
|
|
1072
1070
|
const [i, u] = Y({
|
|
1073
1071
|
left: 0,
|
|
@@ -1083,58 +1081,58 @@ function gn(e) {
|
|
|
1083
1081
|
scrollContainers: null,
|
|
1084
1082
|
resizeObserver: null,
|
|
1085
1083
|
lastBounds: i
|
|
1086
|
-
}),
|
|
1087
|
-
ue(() => (
|
|
1088
|
-
const [
|
|
1084
|
+
}), p = t ? typeof t == "number" ? t : t.scroll : null, x = t ? typeof t == "number" ? t : t.resize : null, v = re(!1);
|
|
1085
|
+
ue(() => (v.current = !0, () => void (v.current = !1)));
|
|
1086
|
+
const [h, k, y] = pt(() => {
|
|
1089
1087
|
const g = () => {
|
|
1090
1088
|
if (!d.current.element)
|
|
1091
1089
|
return;
|
|
1092
1090
|
const {
|
|
1093
|
-
left:
|
|
1091
|
+
left: N,
|
|
1094
1092
|
top: P,
|
|
1095
1093
|
width: D,
|
|
1096
1094
|
height: me,
|
|
1097
1095
|
bottom: ce,
|
|
1098
|
-
right:
|
|
1099
|
-
x:
|
|
1096
|
+
right: Ee,
|
|
1097
|
+
x: H,
|
|
1100
1098
|
y: se
|
|
1101
1099
|
} = d.current.element.getBoundingClientRect(), q = {
|
|
1102
|
-
left:
|
|
1100
|
+
left: N,
|
|
1103
1101
|
top: P,
|
|
1104
1102
|
width: D,
|
|
1105
1103
|
height: me,
|
|
1106
1104
|
bottom: ce,
|
|
1107
|
-
right:
|
|
1108
|
-
x:
|
|
1105
|
+
right: Ee,
|
|
1106
|
+
x: H,
|
|
1109
1107
|
y: se
|
|
1110
1108
|
};
|
|
1111
|
-
d.current.element instanceof HTMLElement &&
|
|
1109
|
+
d.current.element instanceof HTMLElement && a && (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);
|
|
1112
1110
|
};
|
|
1113
|
-
return [g, x ?
|
|
1114
|
-
}, [u,
|
|
1115
|
-
function
|
|
1116
|
-
d.current.scrollContainers && (d.current.scrollContainers.forEach((g) => g.removeEventListener("scroll",
|
|
1111
|
+
return [g, x ? Nt(g, x) : g, p ? Nt(g, p) : g];
|
|
1112
|
+
}, [u, a, p, x]);
|
|
1113
|
+
function A() {
|
|
1114
|
+
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);
|
|
1117
1115
|
}
|
|
1118
1116
|
function S() {
|
|
1119
|
-
d.current.element && (d.current.resizeObserver = new
|
|
1117
|
+
d.current.element && (d.current.resizeObserver = new s(y), d.current.resizeObserver.observe(d.current.element), r && d.current.scrollContainers && d.current.scrollContainers.forEach((g) => g.addEventListener("scroll", y, {
|
|
1120
1118
|
capture: !0,
|
|
1121
1119
|
passive: !0
|
|
1122
1120
|
})));
|
|
1123
1121
|
}
|
|
1124
|
-
const
|
|
1125
|
-
!g || g === d.current.element || (
|
|
1122
|
+
const E = (g) => {
|
|
1123
|
+
!g || g === d.current.element || (A(), d.current.element = g, d.current.scrollContainers = or(g), S());
|
|
1126
1124
|
};
|
|
1127
|
-
return
|
|
1128
|
-
|
|
1129
|
-
}, [r,
|
|
1125
|
+
return yn(y, !!r), bn(k), ue(() => {
|
|
1126
|
+
A(), S();
|
|
1127
|
+
}, [r, y, k]), ue(() => A, []), [E, i, h];
|
|
1130
1128
|
}
|
|
1131
|
-
function
|
|
1129
|
+
function bn(e) {
|
|
1132
1130
|
ue(() => {
|
|
1133
1131
|
const t = e;
|
|
1134
1132
|
return window.addEventListener("resize", t), () => void window.removeEventListener("resize", t);
|
|
1135
1133
|
}, [e]);
|
|
1136
1134
|
}
|
|
1137
|
-
function
|
|
1135
|
+
function yn(e, t) {
|
|
1138
1136
|
ue(() => {
|
|
1139
1137
|
if (t) {
|
|
1140
1138
|
const r = e;
|
|
@@ -1145,26 +1143,26 @@ function bn(e, t) {
|
|
|
1145
1143
|
}
|
|
1146
1144
|
}, [e, t]);
|
|
1147
1145
|
}
|
|
1148
|
-
function
|
|
1146
|
+
function or(e) {
|
|
1149
1147
|
const t = [];
|
|
1150
1148
|
if (!e || e === document.body)
|
|
1151
1149
|
return t;
|
|
1152
1150
|
const {
|
|
1153
1151
|
overflow: r,
|
|
1154
1152
|
overflowX: n,
|
|
1155
|
-
overflowY:
|
|
1153
|
+
overflowY: a
|
|
1156
1154
|
} = window.getComputedStyle(e);
|
|
1157
|
-
return [r, n,
|
|
1155
|
+
return [r, n, a].some((s) => s === "auto" || s === "scroll") && t.push(e), [...t, ...or(e.parentElement)];
|
|
1158
1156
|
}
|
|
1159
|
-
const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn = (e, t) => vn.every((r) => e[r] === t[r]),
|
|
1157
|
+
const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn = (e, t) => vn.every((r) => e[r] === t[r]), ye = ({
|
|
1160
1158
|
class: e,
|
|
1161
1159
|
...t
|
|
1162
1160
|
}) => {
|
|
1163
1161
|
const {
|
|
1164
1162
|
t: r
|
|
1165
|
-
} =
|
|
1163
|
+
} = G();
|
|
1166
1164
|
return l("button", {
|
|
1167
|
-
class:
|
|
1165
|
+
class: Te("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
1166
|
type: "submit",
|
|
1169
1167
|
...t,
|
|
1170
1168
|
children: l("svg", {
|
|
@@ -1218,39 +1216,39 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1218
1216
|
};
|
|
1219
1217
|
}, [e]);
|
|
1220
1218
|
const t = pt(() => ({
|
|
1221
|
-
addToSubmissions: (n,
|
|
1219
|
+
addToSubmissions: (n, a) => M.setSubmission(n, a),
|
|
1222
1220
|
send: async ({
|
|
1223
1221
|
message: n,
|
|
1224
|
-
signal:
|
|
1225
|
-
groupId:
|
|
1222
|
+
signal: a,
|
|
1223
|
+
groupId: s
|
|
1226
1224
|
}) => {
|
|
1227
1225
|
if (await Ke(n).with({
|
|
1228
1226
|
author: "bot",
|
|
1229
1227
|
type: "text"
|
|
1230
1228
|
}, async (i) => {
|
|
1231
|
-
if (
|
|
1229
|
+
if (a != null && a.aborted)
|
|
1232
1230
|
throw new Me();
|
|
1233
1231
|
z.isBotTyping$.value = !0;
|
|
1234
1232
|
const u = Math.min(Math.max(20, i.text.length), 100) * wn;
|
|
1235
1233
|
await new Promise((d) => setTimeout(d, u, {
|
|
1236
|
-
signal:
|
|
1234
|
+
signal: a
|
|
1237
1235
|
})), z.isBotTyping$.value = !1;
|
|
1238
1236
|
}).otherwise(async () => {
|
|
1239
|
-
}),
|
|
1237
|
+
}), a != null && a.aborted)
|
|
1240
1238
|
throw new Me();
|
|
1241
|
-
M.addMessage(n,
|
|
1239
|
+
M.addMessage(n, s);
|
|
1242
1240
|
},
|
|
1243
1241
|
input: ({
|
|
1244
1242
|
input: n,
|
|
1245
|
-
signal:
|
|
1243
|
+
signal: a
|
|
1246
1244
|
}) => {
|
|
1247
|
-
if (
|
|
1245
|
+
if (a != null && a.aborted)
|
|
1248
1246
|
throw new Me();
|
|
1249
|
-
return M.setInput(n), new Promise((
|
|
1247
|
+
return M.setInput(n), new Promise((s) => {
|
|
1250
1248
|
const i = (u) => {
|
|
1251
|
-
if (
|
|
1249
|
+
if (a != null && a.aborted)
|
|
1252
1250
|
throw new Me();
|
|
1253
|
-
M.setInput(void 0), n.key && M.setSubmission(n.key, u),
|
|
1251
|
+
M.setInput(void 0), n.key && M.setSubmission(n.key, u), s(u);
|
|
1254
1252
|
};
|
|
1255
1253
|
z.onSubmitSuccessFn$.value = i;
|
|
1256
1254
|
});
|
|
@@ -1299,10 +1297,10 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1299
1297
|
}) => {
|
|
1300
1298
|
const {
|
|
1301
1299
|
t: r
|
|
1302
|
-
} =
|
|
1300
|
+
} = G();
|
|
1303
1301
|
return l("button", {
|
|
1304
1302
|
type: "button",
|
|
1305
|
-
class:
|
|
1303
|
+
class: Te("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
1304
|
...t,
|
|
1307
1305
|
children: [l("svg", {
|
|
1308
1306
|
"aria-hidden": !0,
|
|
@@ -1571,7 +1569,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1571
1569
|
Zambia: "260",
|
|
1572
1570
|
Zimbabwe: "263",
|
|
1573
1571
|
"Åland Islands": "358"
|
|
1574
|
-
},
|
|
1572
|
+
}, De = Ze("outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest py-1 text-base outline outline-2 transition-all", {
|
|
1575
1573
|
variants: {
|
|
1576
1574
|
optional: {
|
|
1577
1575
|
true: "pr-16 pl-3",
|
|
@@ -1583,13 +1581,13 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1583
1581
|
}
|
|
1584
1582
|
}), kn = "https://api.mapbox.com/search/searchbox/v1/suggest", Sn = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", Cn = (e) => atob(e).split("").reverse().join(""), ae = he({
|
|
1585
1583
|
name: ee()
|
|
1586
|
-
}),
|
|
1587
|
-
suggestions:
|
|
1584
|
+
}), En = he({
|
|
1585
|
+
suggestions: Mr(he({
|
|
1588
1586
|
full_address: at(ee()),
|
|
1589
1587
|
place_formatted: at(ee()),
|
|
1590
1588
|
name: at(ee()),
|
|
1591
1589
|
mapbox_id: ee(),
|
|
1592
|
-
context:
|
|
1590
|
+
context: Fr(he({
|
|
1593
1591
|
address: ae,
|
|
1594
1592
|
street: ae,
|
|
1595
1593
|
neighborhood: ae,
|
|
@@ -1601,7 +1599,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1601
1599
|
country: ae
|
|
1602
1600
|
}))
|
|
1603
1601
|
}))
|
|
1604
|
-
}),
|
|
1602
|
+
}), An = ({
|
|
1605
1603
|
logger: e,
|
|
1606
1604
|
t
|
|
1607
1605
|
}) => pt(() => {
|
|
@@ -1609,16 +1607,16 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1609
1607
|
const r = (n = M.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1610
1608
|
return r ? {
|
|
1611
1609
|
enabled: !0,
|
|
1612
|
-
getPredictions: async (
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1615
|
-
const i = await fetch(
|
|
1610
|
+
getPredictions: async (a) => {
|
|
1611
|
+
const s = new URL(kn);
|
|
1612
|
+
s.searchParams.set("q", a), s.searchParams.set("session_token", r), s.searchParams.set("access_token", Cn(Sn));
|
|
1613
|
+
const i = await fetch(s);
|
|
1616
1614
|
if (!i.ok)
|
|
1617
1615
|
return e.error("Failed to get address details", i), {
|
|
1618
1616
|
ok: !1,
|
|
1619
1617
|
error: t("address_error")
|
|
1620
1618
|
};
|
|
1621
|
-
const u =
|
|
1619
|
+
const u = Nr(En, await i.json());
|
|
1622
1620
|
if (u.success === !1)
|
|
1623
1621
|
return e.error("Failed to parse address details", u.issues), {
|
|
1624
1622
|
ok: !1,
|
|
@@ -1629,19 +1627,19 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1629
1627
|
} = u.output;
|
|
1630
1628
|
return {
|
|
1631
1629
|
ok: !0,
|
|
1632
|
-
data: d.map((
|
|
1633
|
-
var x,
|
|
1630
|
+
data: d.map((p) => {
|
|
1631
|
+
var x, v, h, k, y, A, S, E, g;
|
|
1634
1632
|
return {
|
|
1635
|
-
label:
|
|
1636
|
-
id:
|
|
1633
|
+
label: p.full_address ?? p.place_formatted ?? p.name ?? p.mapbox_id,
|
|
1634
|
+
id: p.mapbox_id,
|
|
1637
1635
|
address: {
|
|
1638
|
-
line1: ((x =
|
|
1636
|
+
line1: ((x = p.context.address) == null ? void 0 : x.name) ?? ((v = p.context.street) == null ? void 0 : v.name),
|
|
1639
1637
|
line2: void 0,
|
|
1640
|
-
line3: ((
|
|
1641
|
-
city: ((
|
|
1642
|
-
state: (S =
|
|
1643
|
-
postcode: (
|
|
1644
|
-
country: (g =
|
|
1638
|
+
line3: ((h = p.context.neighborhood) == null ? void 0 : h.name) ?? ((k = p.context.locality) == null ? void 0 : k.name),
|
|
1639
|
+
city: ((y = p.context.place) == null ? void 0 : y.name) ?? ((A = p.context.district) == null ? void 0 : A.name),
|
|
1640
|
+
state: (S = p.context.region) == null ? void 0 : S.name,
|
|
1641
|
+
postcode: (E = p.context.postcode) == null ? void 0 : E.name,
|
|
1642
|
+
country: (g = p.context.country) == null ? void 0 : g.name
|
|
1645
1643
|
}
|
|
1646
1644
|
};
|
|
1647
1645
|
})
|
|
@@ -1650,10 +1648,10 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1650
1648
|
} : {
|
|
1651
1649
|
enabled: !1
|
|
1652
1650
|
};
|
|
1653
|
-
}, [e, t]),
|
|
1651
|
+
}, [e, t]), Lt = (e) => {
|
|
1654
1652
|
const {
|
|
1655
1653
|
t
|
|
1656
|
-
} =
|
|
1654
|
+
} = G();
|
|
1657
1655
|
return l("button", {
|
|
1658
1656
|
type: "button",
|
|
1659
1657
|
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",
|
|
@@ -1673,23 +1671,23 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1673
1671
|
children: t("back")
|
|
1674
1672
|
})]
|
|
1675
1673
|
});
|
|
1676
|
-
},
|
|
1674
|
+
}, Vn = ({
|
|
1677
1675
|
input: e,
|
|
1678
1676
|
onSubmitSuccess: t,
|
|
1679
1677
|
logger: r
|
|
1680
1678
|
}) => {
|
|
1681
1679
|
const {
|
|
1682
1680
|
t: n
|
|
1683
|
-
} =
|
|
1681
|
+
} = G(), [a, s] = Y(), [i, u] = Y([]), {
|
|
1684
1682
|
enabled: d,
|
|
1685
|
-
getPredictions:
|
|
1686
|
-
} =
|
|
1683
|
+
getPredictions: p
|
|
1684
|
+
} = An({
|
|
1687
1685
|
logger: r,
|
|
1688
1686
|
t: n
|
|
1689
|
-
}), [x,
|
|
1690
|
-
le(d, "Query state should not be enabled"),
|
|
1687
|
+
}), [x, v] = Y(d ? "query" : "manual"), [h, k] = Y(""), [y, A] = Y(), S = (E) => {
|
|
1688
|
+
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) => {
|
|
1691
1689
|
if (g.ok === !1) {
|
|
1692
|
-
u([]),
|
|
1690
|
+
u([]), A(g.error);
|
|
1693
1691
|
return;
|
|
1694
1692
|
}
|
|
1695
1693
|
u(g.data);
|
|
@@ -1697,70 +1695,70 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1697
1695
|
};
|
|
1698
1696
|
switch (x) {
|
|
1699
1697
|
case "query":
|
|
1700
|
-
return le(d, "Query state should not be enabled"), l(
|
|
1698
|
+
return le(d, "Query state should not be enabled"), l(In, {
|
|
1701
1699
|
input: e,
|
|
1702
1700
|
onSkip: () => t(null),
|
|
1703
|
-
onAddressSelect: (
|
|
1704
|
-
if (
|
|
1705
|
-
|
|
1701
|
+
onAddressSelect: (E) => {
|
|
1702
|
+
if (E === "") {
|
|
1703
|
+
s(void 0), v("manual");
|
|
1706
1704
|
return;
|
|
1707
1705
|
}
|
|
1708
|
-
const g = i.find((
|
|
1709
|
-
g && (
|
|
1706
|
+
const g = i.find((N) => N.id === E);
|
|
1707
|
+
g && (s(g.address), v("details"));
|
|
1710
1708
|
},
|
|
1711
|
-
onAddressSearch: (
|
|
1712
|
-
S(
|
|
1709
|
+
onAddressSearch: (E) => {
|
|
1710
|
+
S(E);
|
|
1713
1711
|
},
|
|
1714
1712
|
suggestions: i,
|
|
1715
|
-
query:
|
|
1716
|
-
error:
|
|
1713
|
+
query: h,
|
|
1714
|
+
error: y
|
|
1717
1715
|
});
|
|
1718
1716
|
case "details":
|
|
1719
|
-
return le(
|
|
1717
|
+
return le(a !== void 0), l(Dt, {
|
|
1720
1718
|
input: e,
|
|
1721
1719
|
logger: r,
|
|
1722
1720
|
onSubmitSuccess: t,
|
|
1723
|
-
addressFields:
|
|
1724
|
-
actions: l(
|
|
1721
|
+
addressFields: a,
|
|
1722
|
+
actions: l(Lt, {
|
|
1725
1723
|
onClick: () => {
|
|
1726
|
-
|
|
1724
|
+
v("query");
|
|
1727
1725
|
}
|
|
1728
1726
|
})
|
|
1729
1727
|
});
|
|
1730
1728
|
case "manual":
|
|
1731
|
-
return l(
|
|
1729
|
+
return l(Dt, {
|
|
1732
1730
|
logger: r,
|
|
1733
1731
|
input: e,
|
|
1734
1732
|
onSubmitSuccess: t,
|
|
1735
1733
|
addressFields: {},
|
|
1736
|
-
actions: d ? l(
|
|
1734
|
+
actions: d ? l(Lt, {
|
|
1737
1735
|
onClick: () => {
|
|
1738
|
-
|
|
1736
|
+
v("query");
|
|
1739
1737
|
}
|
|
1740
1738
|
}) : void 0
|
|
1741
1739
|
});
|
|
1742
1740
|
}
|
|
1743
|
-
},
|
|
1741
|
+
}, In = ({
|
|
1744
1742
|
input: e,
|
|
1745
1743
|
onSkip: t,
|
|
1746
1744
|
suggestions: r,
|
|
1747
1745
|
onAddressSelect: n,
|
|
1748
|
-
query:
|
|
1749
|
-
onAddressSearch:
|
|
1746
|
+
query: a,
|
|
1747
|
+
onAddressSearch: s,
|
|
1750
1748
|
error: i
|
|
1751
1749
|
}) => {
|
|
1752
1750
|
const {
|
|
1753
1751
|
t: u
|
|
1754
|
-
} =
|
|
1752
|
+
} = G(), d = re(null);
|
|
1755
1753
|
return pe(() => {
|
|
1756
1754
|
d.current && (d.current.focus(), d.current.select());
|
|
1757
1755
|
}, []), l(ke, {
|
|
1758
1756
|
children: [l("form", {
|
|
1759
1757
|
noValidate: !0,
|
|
1760
|
-
onSubmit: (
|
|
1761
|
-
|
|
1762
|
-
const
|
|
1763
|
-
typeof
|
|
1758
|
+
onSubmit: (p) => {
|
|
1759
|
+
p.preventDefault();
|
|
1760
|
+
const v = new FormData(p.currentTarget).get("address");
|
|
1761
|
+
typeof v == "string" && s(v);
|
|
1764
1762
|
},
|
|
1765
1763
|
class: "flex gap-1 p-2.5",
|
|
1766
1764
|
children: [l("div", {
|
|
@@ -1772,8 +1770,8 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1772
1770
|
autocomplete: "address-line1 country-name postal-code",
|
|
1773
1771
|
autoFocus: !0,
|
|
1774
1772
|
placeholder: e.config.placeholder || u("address_search"),
|
|
1775
|
-
defaultValue:
|
|
1776
|
-
class:
|
|
1773
|
+
defaultValue: a,
|
|
1774
|
+
class: De({
|
|
1777
1775
|
optional: !!e.config.optional,
|
|
1778
1776
|
className: "w-full rounded-full"
|
|
1779
1777
|
})
|
|
@@ -1814,15 +1812,15 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1814
1812
|
message: i
|
|
1815
1813
|
}
|
|
1816
1814
|
}) : null, l("ul", {
|
|
1817
|
-
children: [r.map((
|
|
1815
|
+
children: [r.map((p) => l("li", {
|
|
1818
1816
|
children: l("button", {
|
|
1819
1817
|
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",
|
|
1820
1818
|
onClick: () => {
|
|
1821
|
-
n(
|
|
1819
|
+
n(p.id);
|
|
1822
1820
|
},
|
|
1823
1821
|
children: [l("span", {
|
|
1824
1822
|
class: "flex-grow",
|
|
1825
|
-
children:
|
|
1823
|
+
children: p.label
|
|
1826
1824
|
}), l("svg", {
|
|
1827
1825
|
class: "flex-none",
|
|
1828
1826
|
width: "16",
|
|
@@ -1837,7 +1835,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1837
1835
|
})
|
|
1838
1836
|
})]
|
|
1839
1837
|
})
|
|
1840
|
-
},
|
|
1838
|
+
}, p.id)), l("li", {
|
|
1841
1839
|
children: l("button", {
|
|
1842
1840
|
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",
|
|
1843
1841
|
onClick: () => {
|
|
@@ -1851,39 +1849,39 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1851
1849
|
}, "")]
|
|
1852
1850
|
})]
|
|
1853
1851
|
});
|
|
1854
|
-
},
|
|
1852
|
+
}, Tt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Dt = ({
|
|
1855
1853
|
addressFields: e,
|
|
1856
1854
|
onSubmitSuccess: t,
|
|
1857
1855
|
actions: r,
|
|
1858
1856
|
input: n
|
|
1859
1857
|
}) => {
|
|
1860
|
-
const
|
|
1858
|
+
const a = re(null);
|
|
1861
1859
|
pe(() => {
|
|
1862
|
-
if (
|
|
1863
|
-
const u =
|
|
1860
|
+
if (a.current) {
|
|
1861
|
+
const u = a.current.querySelector("input");
|
|
1864
1862
|
u && (u.focus(), u.select());
|
|
1865
1863
|
}
|
|
1866
1864
|
}, []);
|
|
1867
|
-
const
|
|
1865
|
+
const s = Object.keys(mt), {
|
|
1868
1866
|
t: i
|
|
1869
|
-
} =
|
|
1867
|
+
} = G();
|
|
1870
1868
|
return l("form", {
|
|
1871
1869
|
class: "bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",
|
|
1872
1870
|
onSubmit: (u) => {
|
|
1873
|
-
const d = new FormData(u.currentTarget),
|
|
1871
|
+
const d = new FormData(u.currentTarget), p = Object.fromEntries(d.entries());
|
|
1874
1872
|
t({
|
|
1875
1873
|
type: "address",
|
|
1876
|
-
value:
|
|
1874
|
+
value: p
|
|
1877
1875
|
});
|
|
1878
1876
|
},
|
|
1879
1877
|
children: [l("div", {
|
|
1880
1878
|
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]",
|
|
1881
|
-
ref:
|
|
1882
|
-
children:
|
|
1883
|
-
const
|
|
1879
|
+
ref: a,
|
|
1880
|
+
children: Tt.map((u, d) => {
|
|
1881
|
+
const p = `isdk_${u}`, x = n.config.keys[u];
|
|
1884
1882
|
return x ? l(ke, {
|
|
1885
1883
|
children: [l("label", {
|
|
1886
|
-
for:
|
|
1884
|
+
for: p,
|
|
1887
1885
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1888
1886
|
children: i(u)
|
|
1889
1887
|
}), l("div", {
|
|
@@ -1893,19 +1891,19 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1893
1891
|
children: [l("select", {
|
|
1894
1892
|
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",
|
|
1895
1893
|
name: x,
|
|
1896
|
-
id:
|
|
1894
|
+
id: p,
|
|
1897
1895
|
defaultValue: e[u],
|
|
1898
1896
|
required: !0,
|
|
1899
|
-
children: [e.country && !
|
|
1897
|
+
children: [e.country && !s.includes(e.country) ? l("option", {
|
|
1900
1898
|
value: e[u],
|
|
1901
1899
|
children: e[u]
|
|
1902
1900
|
}) : l("option", {
|
|
1903
1901
|
value: "",
|
|
1904
1902
|
children: i("select_country")
|
|
1905
|
-
}),
|
|
1906
|
-
value:
|
|
1907
|
-
children:
|
|
1908
|
-
},
|
|
1903
|
+
}), s.map((v) => l("option", {
|
|
1904
|
+
value: v,
|
|
1905
|
+
children: v
|
|
1906
|
+
}, v))]
|
|
1909
1907
|
}), l("svg", {
|
|
1910
1908
|
class: "text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",
|
|
1911
1909
|
width: "16",
|
|
@@ -1925,10 +1923,10 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1925
1923
|
autoFocus: d === 0 ? !0 : void 0,
|
|
1926
1924
|
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",
|
|
1927
1925
|
name: x,
|
|
1928
|
-
id:
|
|
1926
|
+
id: p,
|
|
1929
1927
|
defaultValue: e[u],
|
|
1930
1928
|
required: !0
|
|
1931
|
-
}), d ===
|
|
1929
|
+
}), d === Tt.length - 1 ? l("hr", {
|
|
1932
1930
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1933
1931
|
}) : l("hr", {
|
|
1934
1932
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1941,7 +1939,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1941
1939
|
children: [l("div", {
|
|
1942
1940
|
class: "flex-grow",
|
|
1943
1941
|
children: r
|
|
1944
|
-
}), l(
|
|
1942
|
+
}), l(ye, {
|
|
1945
1943
|
class: "flex items-center justify-center"
|
|
1946
1944
|
})]
|
|
1947
1945
|
})]
|
|
@@ -1952,7 +1950,7 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1952
1950
|
var t;
|
|
1953
1951
|
(t = e.current) == null || t.focus();
|
|
1954
1952
|
}, []), e;
|
|
1955
|
-
},
|
|
1953
|
+
}, lr = ["true", "false"], Mn = Tr(lr), Fn = "answer", ur = "flex items-center gap-2 p-2.5", cr = rr(({
|
|
1956
1954
|
label: e,
|
|
1957
1955
|
...t
|
|
1958
1956
|
}, r) => l("button", {
|
|
@@ -1973,18 +1971,18 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
1973
1971
|
class: "",
|
|
1974
1972
|
onSubmit: (n) => {
|
|
1975
1973
|
n.preventDefault();
|
|
1976
|
-
const
|
|
1974
|
+
const a = Lr(n).value, s = nr(Mn, a);
|
|
1977
1975
|
t({
|
|
1978
1976
|
type: "boolean",
|
|
1979
|
-
value:
|
|
1977
|
+
value: s === "true"
|
|
1980
1978
|
});
|
|
1981
1979
|
},
|
|
1982
1980
|
children: [l("ul", {
|
|
1983
|
-
class:
|
|
1984
|
-
children:
|
|
1981
|
+
class: ur,
|
|
1982
|
+
children: lr.map((n, a) => l("li", {
|
|
1985
1983
|
class: "flex-1",
|
|
1986
|
-
children: l(
|
|
1987
|
-
ref:
|
|
1984
|
+
children: l(cr, {
|
|
1985
|
+
ref: a === 0 ? r : null,
|
|
1988
1986
|
type: "submit",
|
|
1989
1987
|
name: Fn,
|
|
1990
1988
|
value: n,
|
|
@@ -2003,21 +2001,21 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2003
2001
|
}, Ln = (e) => new Promise((t, r) => {
|
|
2004
2002
|
const n = new FileReader();
|
|
2005
2003
|
n.readAsDataURL(e), n.onload = () => n.result ? t(n.result.toString()) : r("No result from reader"), n.onerror = r;
|
|
2006
|
-
}), Tn = (e) => e.reduce((t, r) => t + r.sizeKb, 0), Dn = Se("file"),
|
|
2004
|
+
}), Tn = (e) => e.reduce((t, r) => t + r.sizeKb, 0), Dn = Se("file"), Rt = 3, Rn = ({
|
|
2007
2005
|
file: e,
|
|
2008
2006
|
class: t,
|
|
2009
2007
|
...r
|
|
2010
2008
|
}) => {
|
|
2011
|
-
const n = e.name.split(".").pop(),
|
|
2009
|
+
const n = e.name.split(".").pop(), a = e.name.replace(new RegExp(`.${n}$`), "");
|
|
2012
2010
|
return l("div", {
|
|
2013
|
-
class:
|
|
2011
|
+
class: Te("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", t),
|
|
2014
2012
|
...r,
|
|
2015
2013
|
children: [l("p", {
|
|
2016
2014
|
"aria-label": "File name",
|
|
2017
2015
|
class: "text-accent-12 flex flex-grow overflow-hidden",
|
|
2018
2016
|
children: [l("span", {
|
|
2019
2017
|
class: "block truncate",
|
|
2020
|
-
children:
|
|
2018
|
+
children: a
|
|
2021
2019
|
}), l("span", {
|
|
2022
2020
|
children: [".", n]
|
|
2023
2021
|
})]
|
|
@@ -2027,13 +2025,13 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2027
2025
|
children: Ne(e.sizeKb)
|
|
2028
2026
|
})]
|
|
2029
2027
|
});
|
|
2030
|
-
},
|
|
2028
|
+
}, Ot = ({
|
|
2031
2029
|
class: e,
|
|
2032
2030
|
...t
|
|
2033
2031
|
}) => l("li", {
|
|
2034
|
-
class:
|
|
2032
|
+
class: Te("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2035
2033
|
...t
|
|
2036
|
-
}),
|
|
2034
|
+
}), dr = (e) => {
|
|
2037
2035
|
const t = e.split(".").pop();
|
|
2038
2036
|
if (!t)
|
|
2039
2037
|
throw new Error("No file extension found");
|
|
@@ -2043,21 +2041,21 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2043
2041
|
files: t
|
|
2044
2042
|
}) => {
|
|
2045
2043
|
const r = e.map((n) => n.toLowerCase());
|
|
2046
|
-
return t.every((n) => r.includes(
|
|
2044
|
+
return t.every((n) => r.includes(dr(n.name).toLowerCase()));
|
|
2047
2045
|
}, Bn = (e, t) => {
|
|
2048
|
-
const r =
|
|
2046
|
+
const r = dr(e);
|
|
2049
2047
|
return `${e.replace(new RegExp(`${r}$`), "").slice(0, t)}${r}`;
|
|
2050
2048
|
}, Pn = ({
|
|
2051
2049
|
input: e,
|
|
2052
2050
|
onSubmitSuccess: t
|
|
2053
2051
|
}) => {
|
|
2054
|
-
var
|
|
2055
|
-
const r = (
|
|
2052
|
+
var v;
|
|
2053
|
+
const r = (v = M.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n, a] = Y(Dn(r) ? r.value : []), [s, i] = Y(), u = n.length - Rt, d = Tn(n), p = gt(), {
|
|
2056
2054
|
t: x
|
|
2057
|
-
} =
|
|
2055
|
+
} = G();
|
|
2058
2056
|
return l("form", {
|
|
2059
2057
|
class: "flex flex-col gap-1 p-2.5",
|
|
2060
|
-
onSubmit: (
|
|
2058
|
+
onSubmit: (h) => (h.preventDefault(), i(void 0), n.length === 0 ? i({
|
|
2061
2059
|
type: "required",
|
|
2062
2060
|
message: x("validation_file")
|
|
2063
2061
|
}) : e.config.extensions.length > 0 && !On({
|
|
@@ -2083,24 +2081,24 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2083
2081
|
children: [l("div", {
|
|
2084
2082
|
class: "flex items-center gap-2",
|
|
2085
2083
|
children: [l("label", {
|
|
2086
|
-
ref:
|
|
2084
|
+
ref: p,
|
|
2087
2085
|
for: "dropzone-file",
|
|
2088
2086
|
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",
|
|
2089
2087
|
children: [n.length > 0 ? l(ke, {
|
|
2090
2088
|
children: [l("ul", {
|
|
2091
2089
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2092
|
-
children: [n.slice(0,
|
|
2093
|
-
const
|
|
2094
|
-
return l(
|
|
2090
|
+
children: [n.slice(0, Rt).map((h) => {
|
|
2091
|
+
const k = h.name.split(".").pop(), y = h.name.replace(new RegExp(`.${k}$`), "");
|
|
2092
|
+
return l(Ot, {
|
|
2095
2093
|
class: "flex overflow-hidden",
|
|
2096
2094
|
children: [l("span", {
|
|
2097
2095
|
class: "block truncate",
|
|
2098
|
-
children:
|
|
2096
|
+
children: y
|
|
2099
2097
|
}), l("span", {
|
|
2100
|
-
children: [".",
|
|
2098
|
+
children: [".", k]
|
|
2101
2099
|
})]
|
|
2102
2100
|
});
|
|
2103
|
-
}), u > 0 ? l(
|
|
2101
|
+
}), u > 0 ? l(Ot, {
|
|
2104
2102
|
children: ["+", u, " file", u !== 1 ? "s" : ""]
|
|
2105
2103
|
}) : null]
|
|
2106
2104
|
}), l("p", {
|
|
@@ -2144,33 +2142,33 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2144
2142
|
}), l("ul", {
|
|
2145
2143
|
"aria-describedby": "accepted-filetypes",
|
|
2146
2144
|
class: "flex flex-wrap justify-center gap-2",
|
|
2147
|
-
children: e.config.extensions.map((
|
|
2145
|
+
children: e.config.extensions.map((h) => l("li", {
|
|
2148
2146
|
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",
|
|
2149
|
-
children:
|
|
2147
|
+
children: h.replace(".", "")
|
|
2150
2148
|
}))
|
|
2151
2149
|
})]
|
|
2152
2150
|
})]
|
|
2153
2151
|
}), l("input", {
|
|
2154
2152
|
id: "dropzone-file",
|
|
2155
|
-
onInput: async (
|
|
2156
|
-
le(
|
|
2157
|
-
const
|
|
2158
|
-
const
|
|
2153
|
+
onInput: async (h) => {
|
|
2154
|
+
le(h.target instanceof HTMLInputElement);
|
|
2155
|
+
const k = h.target.files ? Array.from(h.target.files) : [], y = await Promise.allSettled(k.map(async (S) => {
|
|
2156
|
+
const E = await Ln(S);
|
|
2159
2157
|
return {
|
|
2160
2158
|
name: Bn(S.name, 42),
|
|
2161
|
-
data:
|
|
2159
|
+
data: E,
|
|
2162
2160
|
sizeKb: S.size / 1e3
|
|
2163
2161
|
};
|
|
2164
2162
|
}));
|
|
2165
|
-
if (
|
|
2163
|
+
if (y.some(({
|
|
2166
2164
|
status: S
|
|
2167
2165
|
}) => S === "rejected"))
|
|
2168
2166
|
return i({
|
|
2169
2167
|
type: "invalid",
|
|
2170
2168
|
message: "Invalid file"
|
|
2171
2169
|
});
|
|
2172
|
-
const
|
|
2173
|
-
|
|
2170
|
+
const A = y.map((S) => S.status === "fulfilled" ? S.value : null).filter(Boolean);
|
|
2171
|
+
a(A);
|
|
2174
2172
|
},
|
|
2175
2173
|
multiple: e.config.allowMultiple,
|
|
2176
2174
|
type: "file",
|
|
@@ -2178,23 +2176,23 @@ const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn =
|
|
|
2178
2176
|
})]
|
|
2179
2177
|
}), l("div", {
|
|
2180
2178
|
class: "flex h-full flex-col items-center gap-2",
|
|
2181
|
-
children: [l(
|
|
2179
|
+
children: [l(ye, {
|
|
2182
2180
|
disabled: n.length === 0
|
|
2183
2181
|
}), e.config.optional && l(ve, {
|
|
2184
2182
|
onClick: () => t(null)
|
|
2185
2183
|
})]
|
|
2186
2184
|
})]
|
|
2187
2185
|
}), l(Ce, {
|
|
2188
|
-
error:
|
|
2186
|
+
error: s
|
|
2189
2187
|
})]
|
|
2190
2188
|
});
|
|
2191
2189
|
};
|
|
2192
|
-
var
|
|
2193
|
-
const
|
|
2194
|
-
var $ = (e) => !U(e) && !Array.isArray(e) &&
|
|
2190
|
+
var Re = (e) => e.type === "checkbox", _e = (e) => e instanceof Date, U = (e) => e == null;
|
|
2191
|
+
const fr = (e) => typeof e == "object";
|
|
2192
|
+
var $ = (e) => !U(e) && !Array.isArray(e) && fr(e) && !_e(e), $n = (e) => $(e) && e.target ? Re(e.target) ? e.target.checked : e.target.value : e, jn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, zn = (e, t) => e.has(jn(t)), qn = (e) => {
|
|
2195
2193
|
const t = e.constructor && e.constructor.prototype;
|
|
2196
2194
|
return $(t) && t.hasOwnProperty("isPrototypeOf");
|
|
2197
|
-
},
|
|
2195
|
+
}, bt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2198
2196
|
function oe(e) {
|
|
2199
2197
|
let t;
|
|
2200
2198
|
const r = Array.isArray(e);
|
|
@@ -2202,7 +2200,7 @@ function oe(e) {
|
|
|
2202
2200
|
t = new Date(e);
|
|
2203
2201
|
else if (e instanceof Set)
|
|
2204
2202
|
t = new Set(e);
|
|
2205
|
-
else if (!(
|
|
2203
|
+
else if (!(bt && (e instanceof Blob || e instanceof FileList)) && (r || $(e)))
|
|
2206
2204
|
if (t = r ? [] : {}, !r && !qn(e))
|
|
2207
2205
|
t = e;
|
|
2208
2206
|
else
|
|
@@ -2212,13 +2210,13 @@ function oe(e) {
|
|
|
2212
2210
|
return e;
|
|
2213
2211
|
return t;
|
|
2214
2212
|
}
|
|
2215
|
-
var
|
|
2213
|
+
var Oe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], O = (e) => e === void 0, w = (e, t, r) => {
|
|
2216
2214
|
if (!t || !$(e))
|
|
2217
2215
|
return r;
|
|
2218
|
-
const n =
|
|
2216
|
+
const n = Oe(t.split(/[,[\].]+?/)).reduce((a, s) => U(a) ? a : a[s], e);
|
|
2219
2217
|
return O(n) || n === e ? O(e[t]) ? r : e[t] : n;
|
|
2220
2218
|
}, de = (e) => typeof e == "boolean";
|
|
2221
|
-
const
|
|
2219
|
+
const Bt = {
|
|
2222
2220
|
BLUR: "blur",
|
|
2223
2221
|
FOCUS_OUT: "focusout",
|
|
2224
2222
|
CHANGE: "change"
|
|
@@ -2237,27 +2235,27 @@ const Pt = {
|
|
|
2237
2235
|
required: "required",
|
|
2238
2236
|
validate: "validate"
|
|
2239
2237
|
};
|
|
2240
|
-
|
|
2238
|
+
Q.createContext(null);
|
|
2241
2239
|
var Un = (e, t, r, n = !0) => {
|
|
2242
|
-
const
|
|
2240
|
+
const a = {
|
|
2243
2241
|
defaultValues: t._defaultValues
|
|
2244
2242
|
};
|
|
2245
|
-
for (const
|
|
2246
|
-
Object.defineProperty(
|
|
2243
|
+
for (const s in e)
|
|
2244
|
+
Object.defineProperty(a, s, {
|
|
2247
2245
|
get: () => {
|
|
2248
|
-
const i =
|
|
2246
|
+
const i = s;
|
|
2249
2247
|
return t._proxyFormState[i] !== Z.all && (t._proxyFormState[i] = !n || Z.all), r && (r[i] = !0), e[i];
|
|
2250
2248
|
}
|
|
2251
2249
|
});
|
|
2252
|
-
return
|
|
2253
|
-
},
|
|
2250
|
+
return a;
|
|
2251
|
+
}, J = (e) => $(e) && !Object.keys(e).length, Kn = (e, t, r, n) => {
|
|
2254
2252
|
r(e);
|
|
2255
|
-
const { name:
|
|
2256
|
-
return
|
|
2253
|
+
const { name: a, ...s } = e;
|
|
2254
|
+
return J(s) || Object.keys(s).length >= Object.keys(t).length || Object.keys(s).find((i) => t[i] === (!n || Z.all));
|
|
2257
2255
|
}, it = (e) => Array.isArray(e) ? e : [e];
|
|
2258
2256
|
function Gn(e) {
|
|
2259
|
-
const t =
|
|
2260
|
-
t.current = e,
|
|
2257
|
+
const t = Q.useRef(e);
|
|
2258
|
+
t.current = e, Q.useEffect(() => {
|
|
2261
2259
|
const r = !e.disabled && t.current.subject && t.current.subject.subscribe({
|
|
2262
2260
|
next: t.current.next
|
|
2263
2261
|
});
|
|
@@ -2266,41 +2264,41 @@ function Gn(e) {
|
|
|
2266
2264
|
};
|
|
2267
2265
|
}, [e.disabled]);
|
|
2268
2266
|
}
|
|
2269
|
-
var te = (e) => typeof e == "string", Hn = (e, t, r, n,
|
|
2270
|
-
function
|
|
2267
|
+
var te = (e) => typeof e == "string", Hn = (e, t, r, n, a) => te(e) ? (n && t.watch.add(e), w(r, e, a)) : Array.isArray(e) ? e.map((s) => (n && t.watch.add(s), w(r, s))) : (n && (t.watchAll = !0), r), yt = (e) => /^\w*$/.test(e), hr = (e) => Oe(e.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
2268
|
+
function L(e, t, r) {
|
|
2271
2269
|
let n = -1;
|
|
2272
|
-
const
|
|
2273
|
-
for (; ++n <
|
|
2274
|
-
const u =
|
|
2270
|
+
const a = yt(t) ? [t] : hr(t), s = a.length, i = s - 1;
|
|
2271
|
+
for (; ++n < s; ) {
|
|
2272
|
+
const u = a[n];
|
|
2275
2273
|
let d = r;
|
|
2276
2274
|
if (n !== i) {
|
|
2277
|
-
const
|
|
2278
|
-
d = $(
|
|
2275
|
+
const p = e[u];
|
|
2276
|
+
d = $(p) || Array.isArray(p) ? p : isNaN(+a[n + 1]) ? {} : [];
|
|
2279
2277
|
}
|
|
2280
2278
|
e[u] = d, e = e[u];
|
|
2281
2279
|
}
|
|
2282
2280
|
return e;
|
|
2283
2281
|
}
|
|
2284
|
-
var
|
|
2282
|
+
var pr = (e, t, r, n, a) => t ? {
|
|
2285
2283
|
...r[e],
|
|
2286
2284
|
types: {
|
|
2287
2285
|
...r[e] && r[e].types ? r[e].types : {},
|
|
2288
|
-
[n]:
|
|
2286
|
+
[n]: a || !0
|
|
2289
2287
|
}
|
|
2290
|
-
} : {},
|
|
2288
|
+
} : {}, Pt = (e) => ({
|
|
2291
2289
|
isOnSubmit: !e || e === Z.onSubmit,
|
|
2292
2290
|
isOnBlur: e === Z.onBlur,
|
|
2293
2291
|
isOnChange: e === Z.onChange,
|
|
2294
2292
|
isOnAll: e === Z.all,
|
|
2295
2293
|
isOnTouch: e === Z.onTouched
|
|
2296
|
-
}),
|
|
2294
|
+
}), $t = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2297
2295
|
const ze = (e, t, r, n) => {
|
|
2298
|
-
for (const
|
|
2299
|
-
const
|
|
2300
|
-
if (
|
|
2301
|
-
const { _f: i, ...u } =
|
|
2296
|
+
for (const a of r || Object.keys(e)) {
|
|
2297
|
+
const s = w(e, a);
|
|
2298
|
+
if (s) {
|
|
2299
|
+
const { _f: i, ...u } = s;
|
|
2302
2300
|
if (i) {
|
|
2303
|
-
if (i.refs && i.refs[0] && t(i.refs[0],
|
|
2301
|
+
if (i.refs && i.refs[0] && t(i.refs[0], a) && !n)
|
|
2304
2302
|
break;
|
|
2305
2303
|
if (i.ref && t(i.ref, i.name) && !n)
|
|
2306
2304
|
break;
|
|
@@ -2310,19 +2308,19 @@ const ze = (e, t, r, n) => {
|
|
|
2310
2308
|
}
|
|
2311
2309
|
};
|
|
2312
2310
|
var Wn = (e, t, r) => {
|
|
2313
|
-
const n =
|
|
2314
|
-
return
|
|
2311
|
+
const n = Oe(w(e, r));
|
|
2312
|
+
return L(n, "root", t[r]), L(e, r, n), e;
|
|
2315
2313
|
}, vt = (e) => e.type === "file", fe = (e) => typeof e == "function", Ge = (e) => {
|
|
2316
|
-
if (!
|
|
2314
|
+
if (!bt)
|
|
2317
2315
|
return !1;
|
|
2318
2316
|
const t = e ? e.ownerDocument : 0;
|
|
2319
2317
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
2320
2318
|
}, qe = (e) => te(e), xt = (e) => e.type === "radio", He = (e) => e instanceof RegExp;
|
|
2321
|
-
const
|
|
2319
|
+
const jt = {
|
|
2322
2320
|
value: !1,
|
|
2323
2321
|
isValid: !1
|
|
2324
|
-
},
|
|
2325
|
-
var
|
|
2322
|
+
}, zt = { value: !0, isValid: !0 };
|
|
2323
|
+
var mr = (e) => {
|
|
2326
2324
|
if (Array.isArray(e)) {
|
|
2327
2325
|
if (e.length > 1) {
|
|
2328
2326
|
const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
@@ -2330,20 +2328,20 @@ var gr = (e) => {
|
|
|
2330
2328
|
}
|
|
2331
2329
|
return e[0].checked && !e[0].disabled ? (
|
|
2332
2330
|
// @ts-expect-error expected to work in the browser
|
|
2333
|
-
e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ?
|
|
2334
|
-
) :
|
|
2331
|
+
e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ? zt : { value: e[0].value, isValid: !0 } : zt
|
|
2332
|
+
) : jt;
|
|
2335
2333
|
}
|
|
2336
|
-
return
|
|
2334
|
+
return jt;
|
|
2337
2335
|
};
|
|
2338
|
-
const
|
|
2336
|
+
const qt = {
|
|
2339
2337
|
isValid: !1,
|
|
2340
2338
|
value: null
|
|
2341
2339
|
};
|
|
2342
|
-
var
|
|
2340
|
+
var gr = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
|
|
2343
2341
|
isValid: !0,
|
|
2344
2342
|
value: r.value
|
|
2345
|
-
} : t,
|
|
2346
|
-
function
|
|
2343
|
+
} : t, qt) : qt;
|
|
2344
|
+
function Ut(e, t, r = "validate") {
|
|
2347
2345
|
if (qe(e) || Array.isArray(e) && e.every(qe) || de(e) && !e)
|
|
2348
2346
|
return {
|
|
2349
2347
|
type: r,
|
|
@@ -2354,80 +2352,80 @@ function Kt(e, t, r = "validate") {
|
|
|
2354
2352
|
var we = (e) => $(e) && !He(e) ? e : {
|
|
2355
2353
|
value: e,
|
|
2356
2354
|
message: ""
|
|
2357
|
-
},
|
|
2358
|
-
const { ref:
|
|
2359
|
-
if (!S ||
|
|
2355
|
+
}, Kt = async (e, t, r, n, a) => {
|
|
2356
|
+
const { ref: s, refs: i, required: u, maxLength: d, minLength: p, min: x, max: v, pattern: h, validate: k, name: y, valueAsNumber: A, mount: S, disabled: E } = e._f, g = w(t, y);
|
|
2357
|
+
if (!S || E)
|
|
2360
2358
|
return {};
|
|
2361
|
-
const
|
|
2362
|
-
n &&
|
|
2363
|
-
}, D = {}, me = xt(
|
|
2364
|
-
const
|
|
2365
|
-
D[
|
|
2366
|
-
type: F ? K :
|
|
2367
|
-
message:
|
|
2368
|
-
ref:
|
|
2369
|
-
...se(F ? K :
|
|
2359
|
+
const N = i ? i[0] : s, P = (F) => {
|
|
2360
|
+
n && N.reportValidity && (N.setCustomValidity(de(F) ? "" : F || ""), N.reportValidity());
|
|
2361
|
+
}, D = {}, me = xt(s), ce = Re(s), Ee = me || ce, H = (A || vt(s)) && O(s.value) && O(g) || Ge(s) && s.value === "" || g === "" || Array.isArray(g) && !g.length, se = pr.bind(null, y, r, D), q = (F, I, R, K = ie.maxLength, W = ie.minLength) => {
|
|
2362
|
+
const X = F ? I : R;
|
|
2363
|
+
D[y] = {
|
|
2364
|
+
type: F ? K : W,
|
|
2365
|
+
message: X,
|
|
2366
|
+
ref: s,
|
|
2367
|
+
...se(F ? K : W, X)
|
|
2370
2368
|
};
|
|
2371
2369
|
};
|
|
2372
|
-
if (
|
|
2373
|
-
const { value: F, message:
|
|
2374
|
-
if (F && (D[
|
|
2370
|
+
if (a ? !Array.isArray(g) || !g.length : u && (!Ee && (H || U(g)) || de(g) && !g || ce && !mr(i).isValid || me && !gr(i).isValid)) {
|
|
2371
|
+
const { value: F, message: I } = qe(u) ? { value: !!u, message: u } : we(u);
|
|
2372
|
+
if (F && (D[y] = {
|
|
2375
2373
|
type: ie.required,
|
|
2376
|
-
message:
|
|
2377
|
-
ref:
|
|
2378
|
-
...se(ie.required,
|
|
2374
|
+
message: I,
|
|
2375
|
+
ref: N,
|
|
2376
|
+
...se(ie.required, I)
|
|
2379
2377
|
}, !r))
|
|
2380
|
-
return P(
|
|
2378
|
+
return P(I), D;
|
|
2381
2379
|
}
|
|
2382
|
-
if (!
|
|
2383
|
-
let F,
|
|
2384
|
-
const R = we(
|
|
2380
|
+
if (!H && (!U(x) || !U(v))) {
|
|
2381
|
+
let F, I;
|
|
2382
|
+
const R = we(v), K = we(x);
|
|
2385
2383
|
if (!U(g) && !isNaN(g)) {
|
|
2386
|
-
const
|
|
2387
|
-
U(R.value) || (F =
|
|
2384
|
+
const W = s.valueAsNumber || g && +g;
|
|
2385
|
+
U(R.value) || (F = W > R.value), U(K.value) || (I = W < K.value);
|
|
2388
2386
|
} else {
|
|
2389
|
-
const
|
|
2390
|
-
te(R.value) && g && (F = ge ?
|
|
2387
|
+
const W = s.valueAsDate || new Date(g), X = (Be) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Be), ge = s.type == "time", Ae = s.type == "week";
|
|
2388
|
+
te(R.value) && g && (F = ge ? X(g) > X(R.value) : Ae ? g > R.value : W > new Date(R.value)), te(K.value) && g && (I = ge ? X(g) < X(K.value) : Ae ? g < K.value : W < new Date(K.value));
|
|
2391
2389
|
}
|
|
2392
|
-
if ((F ||
|
|
2393
|
-
return P(D[
|
|
2390
|
+
if ((F || I) && (q(!!F, R.message, K.message, ie.max, ie.min), !r))
|
|
2391
|
+
return P(D[y].message), D;
|
|
2394
2392
|
}
|
|
2395
|
-
if ((d ||
|
|
2396
|
-
const F = we(d),
|
|
2397
|
-
if ((R || K) && (q(R, F.message,
|
|
2398
|
-
return P(D[
|
|
2393
|
+
if ((d || p) && !H && (te(g) || a && Array.isArray(g))) {
|
|
2394
|
+
const F = we(d), I = we(p), R = !U(F.value) && g.length > +F.value, K = !U(I.value) && g.length < +I.value;
|
|
2395
|
+
if ((R || K) && (q(R, F.message, I.message), !r))
|
|
2396
|
+
return P(D[y].message), D;
|
|
2399
2397
|
}
|
|
2400
|
-
if (
|
|
2401
|
-
const { value: F, message:
|
|
2402
|
-
if (He(F) && !g.match(F) && (D[
|
|
2398
|
+
if (h && !H && te(g)) {
|
|
2399
|
+
const { value: F, message: I } = we(h);
|
|
2400
|
+
if (He(F) && !g.match(F) && (D[y] = {
|
|
2403
2401
|
type: ie.pattern,
|
|
2404
|
-
message:
|
|
2405
|
-
ref:
|
|
2406
|
-
...se(ie.pattern,
|
|
2402
|
+
message: I,
|
|
2403
|
+
ref: s,
|
|
2404
|
+
...se(ie.pattern, I)
|
|
2407
2405
|
}, !r))
|
|
2408
|
-
return P(
|
|
2406
|
+
return P(I), D;
|
|
2409
2407
|
}
|
|
2410
|
-
if (
|
|
2411
|
-
if (fe(
|
|
2412
|
-
const F = await
|
|
2413
|
-
if (
|
|
2414
|
-
...
|
|
2415
|
-
...se(ie.validate,
|
|
2408
|
+
if (k) {
|
|
2409
|
+
if (fe(k)) {
|
|
2410
|
+
const F = await k(g, t), I = Ut(F, N);
|
|
2411
|
+
if (I && (D[y] = {
|
|
2412
|
+
...I,
|
|
2413
|
+
...se(ie.validate, I.message)
|
|
2416
2414
|
}, !r))
|
|
2417
|
-
return P(
|
|
2418
|
-
} else if ($(
|
|
2415
|
+
return P(I.message), D;
|
|
2416
|
+
} else if ($(k)) {
|
|
2419
2417
|
let F = {};
|
|
2420
|
-
for (const
|
|
2421
|
-
if (!
|
|
2418
|
+
for (const I in k) {
|
|
2419
|
+
if (!J(F) && !r)
|
|
2422
2420
|
break;
|
|
2423
|
-
const R =
|
|
2421
|
+
const R = Ut(await k[I](g, t), N, I);
|
|
2424
2422
|
R && (F = {
|
|
2425
2423
|
...R,
|
|
2426
|
-
...se(
|
|
2427
|
-
}, P(R.message), r && (D[
|
|
2424
|
+
...se(I, R.message)
|
|
2425
|
+
}, P(R.message), r && (D[y] = F));
|
|
2428
2426
|
}
|
|
2429
|
-
if (!
|
|
2430
|
-
ref:
|
|
2427
|
+
if (!J(F) && (D[y] = {
|
|
2428
|
+
ref: N,
|
|
2431
2429
|
...F
|
|
2432
2430
|
}, !r))
|
|
2433
2431
|
return D;
|
|
@@ -2449,8 +2447,8 @@ function Zn(e) {
|
|
|
2449
2447
|
return !0;
|
|
2450
2448
|
}
|
|
2451
2449
|
function j(e, t) {
|
|
2452
|
-
const r = Array.isArray(t) ? t :
|
|
2453
|
-
return n && delete n[
|
|
2450
|
+
const r = Array.isArray(t) ? t : yt(t) ? [t] : hr(t), n = r.length === 1 ? e : Jn(e, r), a = r.length - 1, s = r[a];
|
|
2451
|
+
return n && delete n[s], a !== 0 && ($(n) && J(n) || Array.isArray(n) && Zn(n)) && j(e, r.slice(0, -1)), e;
|
|
2454
2452
|
}
|
|
2455
2453
|
function ot() {
|
|
2456
2454
|
let e = [];
|
|
@@ -2458,13 +2456,13 @@ function ot() {
|
|
|
2458
2456
|
get observers() {
|
|
2459
2457
|
return e;
|
|
2460
2458
|
},
|
|
2461
|
-
next: (
|
|
2462
|
-
for (const
|
|
2463
|
-
|
|
2459
|
+
next: (a) => {
|
|
2460
|
+
for (const s of e)
|
|
2461
|
+
s.next && s.next(a);
|
|
2464
2462
|
},
|
|
2465
|
-
subscribe: (
|
|
2463
|
+
subscribe: (a) => (e.push(a), {
|
|
2466
2464
|
unsubscribe: () => {
|
|
2467
|
-
e = e.filter((
|
|
2465
|
+
e = e.filter((s) => s !== a);
|
|
2468
2466
|
}
|
|
2469
2467
|
}),
|
|
2470
2468
|
unsubscribe: () => {
|
|
@@ -2472,8 +2470,8 @@ function ot() {
|
|
|
2472
2470
|
}
|
|
2473
2471
|
};
|
|
2474
2472
|
}
|
|
2475
|
-
var We = (e) => U(e) || !
|
|
2476
|
-
function
|
|
2473
|
+
var We = (e) => U(e) || !fr(e);
|
|
2474
|
+
function be(e, t) {
|
|
2477
2475
|
if (We(e) || We(t))
|
|
2478
2476
|
return e === t;
|
|
2479
2477
|
if (_e(e) && _e(t))
|
|
@@ -2481,19 +2479,19 @@ function ye(e, t) {
|
|
|
2481
2479
|
const r = Object.keys(e), n = Object.keys(t);
|
|
2482
2480
|
if (r.length !== n.length)
|
|
2483
2481
|
return !1;
|
|
2484
|
-
for (const
|
|
2485
|
-
const
|
|
2486
|
-
if (!n.includes(
|
|
2482
|
+
for (const a of r) {
|
|
2483
|
+
const s = e[a];
|
|
2484
|
+
if (!n.includes(a))
|
|
2487
2485
|
return !1;
|
|
2488
|
-
if (
|
|
2489
|
-
const i = t[
|
|
2490
|
-
if (_e(
|
|
2486
|
+
if (a !== "ref") {
|
|
2487
|
+
const i = t[a];
|
|
2488
|
+
if (_e(s) && _e(i) || $(s) && $(i) || Array.isArray(s) && Array.isArray(i) ? !be(s, i) : s !== i)
|
|
2491
2489
|
return !1;
|
|
2492
2490
|
}
|
|
2493
2491
|
}
|
|
2494
2492
|
return !0;
|
|
2495
2493
|
}
|
|
2496
|
-
var br = (e) => e.type === "select-multiple",
|
|
2494
|
+
var br = (e) => e.type === "select-multiple", Xn = (e) => xt(e) || Re(e), lt = (e) => Ge(e) && e.isConnected, yr = (e) => {
|
|
2497
2495
|
for (const t in e)
|
|
2498
2496
|
if (fe(e[t]))
|
|
2499
2497
|
return !0;
|
|
@@ -2503,59 +2501,59 @@ function Je(e, t = {}) {
|
|
|
2503
2501
|
const r = Array.isArray(e);
|
|
2504
2502
|
if ($(e) || r)
|
|
2505
2503
|
for (const n in e)
|
|
2506
|
-
Array.isArray(e[n]) || $(e[n]) && !
|
|
2504
|
+
Array.isArray(e[n]) || $(e[n]) && !yr(e[n]) ? (t[n] = Array.isArray(e[n]) ? [] : {}, Je(e[n], t[n])) : U(e[n]) || (t[n] = !0);
|
|
2507
2505
|
return t;
|
|
2508
2506
|
}
|
|
2509
|
-
function
|
|
2507
|
+
function vr(e, t, r) {
|
|
2510
2508
|
const n = Array.isArray(e);
|
|
2511
2509
|
if ($(e) || n)
|
|
2512
|
-
for (const
|
|
2513
|
-
Array.isArray(e[
|
|
2510
|
+
for (const a in e)
|
|
2511
|
+
Array.isArray(e[a]) || $(e[a]) && !yr(e[a]) ? O(t) || We(r[a]) ? r[a] = Array.isArray(e[a]) ? Je(e[a], []) : { ...Je(e[a]) } : vr(e[a], U(t) ? {} : t[a], r[a]) : r[a] = !be(e[a], t[a]);
|
|
2514
2512
|
return r;
|
|
2515
2513
|
}
|
|
2516
|
-
var ut = (e, t) =>
|
|
2514
|
+
var ut = (e, t) => vr(e, t, Je(t)), xr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) => O(e) ? e : t ? e === "" ? NaN : e && +e : r && te(e) ? new Date(e) : n ? n(e) : e;
|
|
2517
2515
|
function ct(e) {
|
|
2518
2516
|
const t = e.ref;
|
|
2519
2517
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : t.disabled))
|
|
2520
|
-
return vt(t) ? t.files : xt(t) ?
|
|
2518
|
+
return vt(t) ? t.files : xt(t) ? gr(e.refs).value : br(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Re(t) ? mr(e.refs).value : xr(O(t.value) ? e.ref.value : t.value, e);
|
|
2521
2519
|
}
|
|
2522
|
-
var
|
|
2523
|
-
const
|
|
2524
|
-
for (const
|
|
2525
|
-
const i = w(t,
|
|
2526
|
-
i &&
|
|
2520
|
+
var Qn = (e, t, r, n) => {
|
|
2521
|
+
const a = {};
|
|
2522
|
+
for (const s of e) {
|
|
2523
|
+
const i = w(t, s);
|
|
2524
|
+
i && L(a, s, i._f);
|
|
2527
2525
|
}
|
|
2528
2526
|
return {
|
|
2529
2527
|
criteriaMode: r,
|
|
2530
2528
|
names: [...e],
|
|
2531
|
-
fields:
|
|
2529
|
+
fields: a,
|
|
2532
2530
|
shouldUseNativeValidation: n
|
|
2533
2531
|
};
|
|
2534
|
-
},
|
|
2535
|
-
function
|
|
2532
|
+
}, Ie = (e) => O(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);
|
|
2533
|
+
function Gt(e, t, r) {
|
|
2536
2534
|
const n = w(e, r);
|
|
2537
|
-
if (n ||
|
|
2535
|
+
if (n || yt(r))
|
|
2538
2536
|
return {
|
|
2539
2537
|
error: n,
|
|
2540
2538
|
name: r
|
|
2541
2539
|
};
|
|
2542
|
-
const
|
|
2543
|
-
for (;
|
|
2544
|
-
const
|
|
2545
|
-
if (i && !Array.isArray(i) && r !==
|
|
2540
|
+
const a = r.split(".");
|
|
2541
|
+
for (; a.length; ) {
|
|
2542
|
+
const s = a.join("."), i = w(t, s), u = w(e, s);
|
|
2543
|
+
if (i && !Array.isArray(i) && r !== s)
|
|
2546
2544
|
return { name: r };
|
|
2547
2545
|
if (u && u.type)
|
|
2548
2546
|
return {
|
|
2549
|
-
name:
|
|
2547
|
+
name: s,
|
|
2550
2548
|
error: u
|
|
2551
2549
|
};
|
|
2552
|
-
|
|
2550
|
+
a.pop();
|
|
2553
2551
|
}
|
|
2554
2552
|
return {
|
|
2555
2553
|
name: r
|
|
2556
2554
|
};
|
|
2557
2555
|
}
|
|
2558
|
-
var es = (e, t, r, n,
|
|
2556
|
+
var es = (e, t, r, n, a) => a.isOnAll ? !1 : !r && a.isOnTouch ? !(t || e) : (r ? n.isOnBlur : a.isOnBlur) ? !e : (r ? n.isOnChange : a.isOnChange) ? e : !0, ts = (e, t) => !Oe(w(e, t)).length && j(e, t);
|
|
2559
2557
|
const rs = {
|
|
2560
2558
|
mode: Z.onSubmit,
|
|
2561
2559
|
reValidateMode: Z.onChange,
|
|
@@ -2578,7 +2576,7 @@ function ns(e = {}, t) {
|
|
|
2578
2576
|
dirtyFields: {},
|
|
2579
2577
|
errors: {},
|
|
2580
2578
|
disabled: !1
|
|
2581
|
-
},
|
|
2579
|
+
}, a = {}, s = $(r.defaultValues) || $(r.values) ? oe(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : oe(s), u = {
|
|
2582
2580
|
action: !1,
|
|
2583
2581
|
mount: !1,
|
|
2584
2582
|
watch: !1
|
|
@@ -2587,82 +2585,82 @@ function ns(e = {}, t) {
|
|
|
2587
2585
|
unMount: /* @__PURE__ */ new Set(),
|
|
2588
2586
|
array: /* @__PURE__ */ new Set(),
|
|
2589
2587
|
watch: /* @__PURE__ */ new Set()
|
|
2590
|
-
},
|
|
2591
|
-
const
|
|
2588
|
+
}, p, x = 0;
|
|
2589
|
+
const v = {
|
|
2592
2590
|
isDirty: !1,
|
|
2593
2591
|
dirtyFields: !1,
|
|
2594
2592
|
touchedFields: !1,
|
|
2595
2593
|
isValidating: !1,
|
|
2596
2594
|
isValid: !1,
|
|
2597
2595
|
errors: !1
|
|
2598
|
-
},
|
|
2596
|
+
}, h = {
|
|
2599
2597
|
values: ot(),
|
|
2600
2598
|
array: ot(),
|
|
2601
2599
|
state: ot()
|
|
2602
|
-
},
|
|
2600
|
+
}, k = e.resetOptions && e.resetOptions.keepDirtyValues, y = Pt(r.mode), A = Pt(r.reValidateMode), S = r.criteriaMode === Z.all, E = (o) => (c) => {
|
|
2603
2601
|
clearTimeout(x), x = setTimeout(o, c);
|
|
2604
2602
|
}, g = async (o) => {
|
|
2605
|
-
if (
|
|
2606
|
-
const c = r.resolver ?
|
|
2607
|
-
c !== n.isValid &&
|
|
2603
|
+
if (v.isValid || o) {
|
|
2604
|
+
const c = r.resolver ? J((await H()).errors) : await q(a, !0);
|
|
2605
|
+
c !== n.isValid && h.state.next({
|
|
2608
2606
|
isValid: c
|
|
2609
2607
|
});
|
|
2610
2608
|
}
|
|
2611
|
-
},
|
|
2609
|
+
}, N = (o) => v.isValidating && h.state.next({
|
|
2612
2610
|
isValidating: o
|
|
2613
|
-
}), P = (o, c = [], f,
|
|
2614
|
-
if (
|
|
2615
|
-
if (u.action = !0, m && Array.isArray(w(
|
|
2616
|
-
const C = f(w(
|
|
2617
|
-
b &&
|
|
2611
|
+
}), P = (o, c = [], f, _, b = !0, m = !0) => {
|
|
2612
|
+
if (_ && f) {
|
|
2613
|
+
if (u.action = !0, m && Array.isArray(w(a, o))) {
|
|
2614
|
+
const C = f(w(a, o), _.argA, _.argB);
|
|
2615
|
+
b && L(a, o, C);
|
|
2618
2616
|
}
|
|
2619
2617
|
if (m && Array.isArray(w(n.errors, o))) {
|
|
2620
|
-
const C = f(w(n.errors, o),
|
|
2621
|
-
b &&
|
|
2618
|
+
const C = f(w(n.errors, o), _.argA, _.argB);
|
|
2619
|
+
b && L(n.errors, o, C), ts(n.errors, o);
|
|
2622
2620
|
}
|
|
2623
|
-
if (
|
|
2624
|
-
const C = f(w(n.touchedFields, o),
|
|
2625
|
-
b &&
|
|
2621
|
+
if (v.touchedFields && m && Array.isArray(w(n.touchedFields, o))) {
|
|
2622
|
+
const C = f(w(n.touchedFields, o), _.argA, _.argB);
|
|
2623
|
+
b && L(n.touchedFields, o, C);
|
|
2626
2624
|
}
|
|
2627
|
-
|
|
2625
|
+
v.dirtyFields && (n.dirtyFields = ut(s, i)), h.state.next({
|
|
2628
2626
|
name: o,
|
|
2629
|
-
isDirty:
|
|
2627
|
+
isDirty: I(o, c),
|
|
2630
2628
|
dirtyFields: n.dirtyFields,
|
|
2631
2629
|
errors: n.errors,
|
|
2632
2630
|
isValid: n.isValid
|
|
2633
2631
|
});
|
|
2634
2632
|
} else
|
|
2635
|
-
|
|
2633
|
+
L(i, o, c);
|
|
2636
2634
|
}, D = (o, c) => {
|
|
2637
|
-
|
|
2635
|
+
L(n.errors, o, c), h.state.next({
|
|
2638
2636
|
errors: n.errors
|
|
2639
2637
|
});
|
|
2640
|
-
}, me = (o, c, f,
|
|
2641
|
-
const b = w(
|
|
2638
|
+
}, me = (o, c, f, _) => {
|
|
2639
|
+
const b = w(a, o);
|
|
2642
2640
|
if (b) {
|
|
2643
|
-
const m = w(i, o, O(f) ? w(
|
|
2644
|
-
O(m) ||
|
|
2641
|
+
const m = w(i, o, O(f) ? w(s, o) : f);
|
|
2642
|
+
O(m) || _ && _.defaultChecked || c ? L(i, o, c ? m : ct(b._f)) : W(o, m), u.mount && g();
|
|
2645
2643
|
}
|
|
2646
|
-
}, ce = (o, c, f,
|
|
2644
|
+
}, ce = (o, c, f, _, b) => {
|
|
2647
2645
|
let m = !1, C = !1;
|
|
2648
|
-
const
|
|
2646
|
+
const T = {
|
|
2649
2647
|
name: o
|
|
2650
2648
|
};
|
|
2651
|
-
if (!f ||
|
|
2652
|
-
|
|
2653
|
-
const B =
|
|
2654
|
-
C = w(n.dirtyFields, o), B ? j(n.dirtyFields, o) :
|
|
2649
|
+
if (!f || _) {
|
|
2650
|
+
v.isDirty && (C = n.isDirty, n.isDirty = T.isDirty = I(), m = C !== T.isDirty);
|
|
2651
|
+
const B = be(w(s, o), c);
|
|
2652
|
+
C = w(n.dirtyFields, o), B ? j(n.dirtyFields, o) : L(n.dirtyFields, o, !0), T.dirtyFields = n.dirtyFields, m = m || v.dirtyFields && C !== !B;
|
|
2655
2653
|
}
|
|
2656
2654
|
if (f) {
|
|
2657
2655
|
const B = w(n.touchedFields, o);
|
|
2658
|
-
B || (
|
|
2656
|
+
B || (L(n.touchedFields, o, f), T.touchedFields = n.touchedFields, m = m || v.touchedFields && B !== f);
|
|
2659
2657
|
}
|
|
2660
|
-
return m && b &&
|
|
2661
|
-
},
|
|
2662
|
-
const b = w(n.errors, o), m =
|
|
2663
|
-
if (e.delayError && f ? (
|
|
2658
|
+
return m && b && h.state.next(T), m ? T : {};
|
|
2659
|
+
}, Ee = (o, c, f, _) => {
|
|
2660
|
+
const b = w(n.errors, o), m = v.isValid && de(c) && n.isValid !== c;
|
|
2661
|
+
if (e.delayError && f ? (p = E(() => D(o, f)), p(e.delayError)) : (clearTimeout(x), p = null, f ? L(n.errors, o, f) : j(n.errors, o)), (f ? !be(b, f) : b) || !J(_) || m) {
|
|
2664
2662
|
const C = {
|
|
2665
|
-
...
|
|
2663
|
+
..._,
|
|
2666
2664
|
...m && de(c) ? { isValid: c } : {},
|
|
2667
2665
|
errors: n.errors,
|
|
2668
2666
|
name: o
|
|
@@ -2670,15 +2668,15 @@ function ns(e = {}, t) {
|
|
|
2670
2668
|
n = {
|
|
2671
2669
|
...n,
|
|
2672
2670
|
...C
|
|
2673
|
-
},
|
|
2671
|
+
}, h.state.next(C);
|
|
2674
2672
|
}
|
|
2675
|
-
|
|
2676
|
-
},
|
|
2677
|
-
const { errors: c } = await
|
|
2673
|
+
N(!1);
|
|
2674
|
+
}, H = async (o) => r.resolver(i, r.context, Qn(o || d.mount, a, r.criteriaMode, r.shouldUseNativeValidation)), se = async (o) => {
|
|
2675
|
+
const { errors: c } = await H(o);
|
|
2678
2676
|
if (o)
|
|
2679
2677
|
for (const f of o) {
|
|
2680
|
-
const
|
|
2681
|
-
|
|
2678
|
+
const _ = w(c, f);
|
|
2679
|
+
_ ? L(n.errors, f, _) : j(n.errors, f);
|
|
2682
2680
|
}
|
|
2683
2681
|
else
|
|
2684
2682
|
n.errors = c;
|
|
@@ -2686,15 +2684,15 @@ function ns(e = {}, t) {
|
|
|
2686
2684
|
}, q = async (o, c, f = {
|
|
2687
2685
|
valid: !0
|
|
2688
2686
|
}) => {
|
|
2689
|
-
for (const
|
|
2690
|
-
const b = o[
|
|
2687
|
+
for (const _ in o) {
|
|
2688
|
+
const b = o[_];
|
|
2691
2689
|
if (b) {
|
|
2692
2690
|
const { _f: m, ...C } = b;
|
|
2693
2691
|
if (m) {
|
|
2694
|
-
const
|
|
2692
|
+
const T = d.array.has(m.name), B = await Kt(b, i, S, r.shouldUseNativeValidation && !c, T);
|
|
2695
2693
|
if (B[m.name] && (f.valid = !1, c))
|
|
2696
2694
|
break;
|
|
2697
|
-
!c && (w(B, m.name) ?
|
|
2695
|
+
!c && (w(B, m.name) ? T ? Wn(n.errors, B, m.name) : L(n.errors, m.name, B[m.name]) : j(n.errors, m.name));
|
|
2698
2696
|
}
|
|
2699
2697
|
C && await q(C, c, f);
|
|
2700
2698
|
}
|
|
@@ -2702,91 +2700,91 @@ function ns(e = {}, t) {
|
|
|
2702
2700
|
return f.valid;
|
|
2703
2701
|
}, F = () => {
|
|
2704
2702
|
for (const o of d.unMount) {
|
|
2705
|
-
const c = w(
|
|
2703
|
+
const c = w(a, o);
|
|
2706
2704
|
c && (c._f.refs ? c._f.refs.every((f) => !lt(f)) : !lt(c._f.ref)) && tt(o);
|
|
2707
2705
|
}
|
|
2708
2706
|
d.unMount = /* @__PURE__ */ new Set();
|
|
2709
|
-
},
|
|
2710
|
-
...u.mount ? i : O(c) ?
|
|
2711
|
-
}, f, c), K = (o) =>
|
|
2712
|
-
const
|
|
2707
|
+
}, I = (o, c) => (o && c && L(i, o, c), !be(wt(), s)), R = (o, c, f) => Hn(o, d, {
|
|
2708
|
+
...u.mount ? i : O(c) ? s : te(o) ? { [o]: c } : c
|
|
2709
|
+
}, f, c), K = (o) => Oe(w(u.mount ? i : s, o, e.shouldUnregister ? w(s, o, []) : [])), W = (o, c, f = {}) => {
|
|
2710
|
+
const _ = w(a, o);
|
|
2713
2711
|
let b = c;
|
|
2714
|
-
if (
|
|
2715
|
-
const m =
|
|
2716
|
-
m && (!m.disabled &&
|
|
2712
|
+
if (_) {
|
|
2713
|
+
const m = _._f;
|
|
2714
|
+
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 ? Re(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({
|
|
2717
2715
|
name: o,
|
|
2718
2716
|
values: { ...i }
|
|
2719
2717
|
})));
|
|
2720
2718
|
}
|
|
2721
2719
|
(f.shouldDirty || f.shouldTouch) && ce(o, b, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && et(o);
|
|
2722
|
-
},
|
|
2723
|
-
for (const
|
|
2724
|
-
const b = c[
|
|
2725
|
-
(d.array.has(o) || !We(b) || C && !C._f) && !_e(b) ?
|
|
2720
|
+
}, X = (o, c, f) => {
|
|
2721
|
+
for (const _ in c) {
|
|
2722
|
+
const b = c[_], m = `${o}.${_}`, C = w(a, m);
|
|
2723
|
+
(d.array.has(o) || !We(b) || C && !C._f) && !_e(b) ? X(m, b, f) : W(m, b, f);
|
|
2726
2724
|
}
|
|
2727
2725
|
}, ge = (o, c, f = {}) => {
|
|
2728
|
-
const
|
|
2729
|
-
|
|
2726
|
+
const _ = w(a, o), b = d.array.has(o), m = oe(c);
|
|
2727
|
+
L(i, o, m), b ? (h.array.next({
|
|
2730
2728
|
name: o,
|
|
2731
2729
|
values: { ...i }
|
|
2732
|
-
}), (
|
|
2730
|
+
}), (v.isDirty || v.dirtyFields) && f.shouldDirty && h.state.next({
|
|
2733
2731
|
name: o,
|
|
2734
|
-
dirtyFields: ut(
|
|
2735
|
-
isDirty:
|
|
2736
|
-
})) :
|
|
2732
|
+
dirtyFields: ut(s, i),
|
|
2733
|
+
isDirty: I(o, m)
|
|
2734
|
+
})) : _ && !_._f && !U(m) ? X(o, m, f) : W(o, m, f), $t(o, d) && h.state.next({ ...n }), h.values.next({
|
|
2737
2735
|
name: o,
|
|
2738
2736
|
values: { ...i }
|
|
2739
2737
|
}), !u.mount && t();
|
|
2740
|
-
},
|
|
2738
|
+
}, Ae = async (o) => {
|
|
2741
2739
|
const c = o.target;
|
|
2742
|
-
let f = c.name,
|
|
2743
|
-
const b = w(
|
|
2744
|
-
|
|
2740
|
+
let f = c.name, _ = !0;
|
|
2741
|
+
const b = w(a, f), m = () => c.type ? ct(b._f) : $n(o), C = (T) => {
|
|
2742
|
+
_ = Number.isNaN(T) || T === w(i, f, T);
|
|
2745
2743
|
};
|
|
2746
2744
|
if (b) {
|
|
2747
|
-
let
|
|
2748
|
-
const
|
|
2749
|
-
|
|
2750
|
-
const st = ce(f,
|
|
2751
|
-
if (!xe &&
|
|
2745
|
+
let T, B;
|
|
2746
|
+
const Pe = m(), xe = o.type === Bt.BLUR || o.type === Bt.FOCUS_OUT, Er = !Yn(b._f) && !r.resolver && !w(n.errors, f) && !b._f.deps || es(xe, w(n.touchedFields, f), n.isSubmitted, A, y), nt = $t(f, d, xe);
|
|
2747
|
+
L(i, f, Pe), xe ? (b._f.onBlur && b._f.onBlur(o), p && p(0)) : b._f.onChange && b._f.onChange(o);
|
|
2748
|
+
const st = ce(f, Pe, xe, !1), Ar = !J(st) || nt;
|
|
2749
|
+
if (!xe && h.values.next({
|
|
2752
2750
|
name: f,
|
|
2753
2751
|
type: o.type,
|
|
2754
2752
|
values: { ...i }
|
|
2755
2753
|
}), Er)
|
|
2756
|
-
return
|
|
2757
|
-
if (!xe && nt &&
|
|
2758
|
-
const { errors:
|
|
2759
|
-
if (C(
|
|
2760
|
-
const Vr =
|
|
2761
|
-
|
|
2754
|
+
return v.isValid && g(), Ar && h.state.next({ name: f, ...nt ? {} : st });
|
|
2755
|
+
if (!xe && nt && h.state.next({ ...n }), N(!0), r.resolver) {
|
|
2756
|
+
const { errors: It } = await H([f]);
|
|
2757
|
+
if (C(Pe), _) {
|
|
2758
|
+
const Vr = Gt(n.errors, a, f), Mt = Gt(It, a, Vr.name || f);
|
|
2759
|
+
T = Mt.error, f = Mt.name, B = J(It);
|
|
2762
2760
|
}
|
|
2763
2761
|
} else
|
|
2764
|
-
|
|
2765
|
-
|
|
2762
|
+
T = (await Kt(b, i, S, r.shouldUseNativeValidation))[f], C(Pe), _ && (T ? B = !1 : v.isValid && (B = await q(a, !0)));
|
|
2763
|
+
_ && (b._f.deps && et(b._f.deps), Ee(f, B, T, st));
|
|
2766
2764
|
}
|
|
2767
|
-
},
|
|
2765
|
+
}, Be = (o, c) => {
|
|
2768
2766
|
if (w(n.errors, c) && o.focus)
|
|
2769
2767
|
return o.focus(), 1;
|
|
2770
2768
|
}, et = async (o, c = {}) => {
|
|
2771
|
-
let f,
|
|
2769
|
+
let f, _;
|
|
2772
2770
|
const b = it(o);
|
|
2773
|
-
if (
|
|
2771
|
+
if (N(!0), r.resolver) {
|
|
2774
2772
|
const m = await se(O(o) ? o : b);
|
|
2775
|
-
f =
|
|
2773
|
+
f = J(m), _ = o ? !b.some((C) => w(m, C)) : f;
|
|
2776
2774
|
} else
|
|
2777
|
-
o ? (
|
|
2778
|
-
const C = w(
|
|
2775
|
+
o ? (_ = (await Promise.all(b.map(async (m) => {
|
|
2776
|
+
const C = w(a, m);
|
|
2779
2777
|
return await q(C && C._f ? { [m]: C } : C);
|
|
2780
|
-
}))).every(Boolean), !(!
|
|
2781
|
-
return
|
|
2782
|
-
...!te(o) ||
|
|
2778
|
+
}))).every(Boolean), !(!_ && !n.isValid) && g()) : _ = f = await q(a);
|
|
2779
|
+
return h.state.next({
|
|
2780
|
+
...!te(o) || v.isValid && f !== n.isValid ? {} : { name: o },
|
|
2783
2781
|
...r.resolver || !o ? { isValid: f } : {},
|
|
2784
2782
|
errors: n.errors,
|
|
2785
2783
|
isValidating: !1
|
|
2786
|
-
}), c.shouldFocus && !
|
|
2784
|
+
}), c.shouldFocus && !_ && ze(a, Be, o ? b : d.mount), _;
|
|
2787
2785
|
}, wt = (o) => {
|
|
2788
2786
|
const c = {
|
|
2789
|
-
...
|
|
2787
|
+
...s,
|
|
2790
2788
|
...u.mount ? i : {}
|
|
2791
2789
|
};
|
|
2792
2790
|
return O(o) ? c : te(o) ? w(c, o) : o.map((f) => w(c, f));
|
|
@@ -2795,40 +2793,40 @@ function ns(e = {}, t) {
|
|
|
2795
2793
|
isDirty: !!w((c || n).dirtyFields, o),
|
|
2796
2794
|
isTouched: !!w((c || n).touchedFields, o),
|
|
2797
2795
|
error: w((c || n).errors, o)
|
|
2798
|
-
}),
|
|
2799
|
-
o && it(o).forEach((c) => j(n.errors, c)),
|
|
2796
|
+
}), _r = (o) => {
|
|
2797
|
+
o && it(o).forEach((c) => j(n.errors, c)), h.state.next({
|
|
2800
2798
|
errors: o ? n.errors : {}
|
|
2801
2799
|
});
|
|
2802
2800
|
}, kt = (o, c, f) => {
|
|
2803
|
-
const
|
|
2804
|
-
|
|
2801
|
+
const _ = (w(a, o, { _f: {} })._f || {}).ref;
|
|
2802
|
+
L(n.errors, o, {
|
|
2805
2803
|
...c,
|
|
2806
|
-
ref:
|
|
2807
|
-
}),
|
|
2804
|
+
ref: _
|
|
2805
|
+
}), h.state.next({
|
|
2808
2806
|
name: o,
|
|
2809
2807
|
errors: n.errors,
|
|
2810
2808
|
isValid: !1
|
|
2811
|
-
}), f && f.shouldFocus &&
|
|
2812
|
-
},
|
|
2809
|
+
}), f && f.shouldFocus && _ && _.focus && _.focus();
|
|
2810
|
+
}, kr = (o, c) => fe(o) ? h.values.subscribe({
|
|
2813
2811
|
next: (f) => o(R(void 0, c), f)
|
|
2814
2812
|
}) : R(o, c, !0), tt = (o, c = {}) => {
|
|
2815
2813
|
for (const f of o ? it(o) : d.mount)
|
|
2816
|
-
d.mount.delete(f), d.array.delete(f), c.keepValue || (j(
|
|
2817
|
-
|
|
2814
|
+
d.mount.delete(f), d.array.delete(f), c.keepValue || (j(a, 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(s, f);
|
|
2815
|
+
h.values.next({
|
|
2818
2816
|
values: { ...i }
|
|
2819
|
-
}),
|
|
2817
|
+
}), h.state.next({
|
|
2820
2818
|
...n,
|
|
2821
|
-
...c.keepDirty ? { isDirty:
|
|
2819
|
+
...c.keepDirty ? { isDirty: I() } : {}
|
|
2822
2820
|
}), !c.keepIsValid && g();
|
|
2823
|
-
}, St = ({ disabled: o, name: c, field: f, fields:
|
|
2821
|
+
}, St = ({ disabled: o, name: c, field: f, fields: _, value: b }) => {
|
|
2824
2822
|
if (de(o)) {
|
|
2825
|
-
const m = o ? void 0 : O(b) ? ct(f ? f._f : w(
|
|
2826
|
-
|
|
2823
|
+
const m = o ? void 0 : O(b) ? ct(f ? f._f : w(_, c)._f) : b;
|
|
2824
|
+
L(i, c, m), ce(c, m, !1, !1, !0);
|
|
2827
2825
|
}
|
|
2828
2826
|
}, rt = (o, c = {}) => {
|
|
2829
|
-
let f = w(
|
|
2830
|
-
const
|
|
2831
|
-
return
|
|
2827
|
+
let f = w(a, o);
|
|
2828
|
+
const _ = de(c.disabled);
|
|
2829
|
+
return L(a, o, {
|
|
2832
2830
|
...f || {},
|
|
2833
2831
|
_f: {
|
|
2834
2832
|
...f && f._f ? f._f : { ref: { name: o } },
|
|
@@ -2841,80 +2839,80 @@ function ns(e = {}, t) {
|
|
|
2841
2839
|
disabled: c.disabled,
|
|
2842
2840
|
name: o
|
|
2843
2841
|
}) : me(o, !0, c.value), {
|
|
2844
|
-
...
|
|
2842
|
+
..._ ? { disabled: c.disabled } : {},
|
|
2845
2843
|
...r.progressive ? {
|
|
2846
2844
|
required: !!c.required,
|
|
2847
|
-
min:
|
|
2848
|
-
max:
|
|
2849
|
-
minLength:
|
|
2850
|
-
maxLength:
|
|
2851
|
-
pattern:
|
|
2845
|
+
min: Ie(c.min),
|
|
2846
|
+
max: Ie(c.max),
|
|
2847
|
+
minLength: Ie(c.minLength),
|
|
2848
|
+
maxLength: Ie(c.maxLength),
|
|
2849
|
+
pattern: Ie(c.pattern)
|
|
2852
2850
|
} : {},
|
|
2853
2851
|
name: o,
|
|
2854
|
-
onChange:
|
|
2855
|
-
onBlur:
|
|
2852
|
+
onChange: Ae,
|
|
2853
|
+
onBlur: Ae,
|
|
2856
2854
|
ref: (b) => {
|
|
2857
2855
|
if (b) {
|
|
2858
|
-
rt(o, c), f = w(
|
|
2859
|
-
const m = O(b.value) && b.querySelectorAll && b.querySelectorAll("input,select,textarea")[0] || b, C =
|
|
2860
|
-
if (C ?
|
|
2856
|
+
rt(o, c), f = w(a, o);
|
|
2857
|
+
const m = O(b.value) && b.querySelectorAll && b.querySelectorAll("input,select,textarea")[0] || b, C = Xn(m), T = f._f.refs || [];
|
|
2858
|
+
if (C ? T.find((B) => B === m) : m === f._f.ref)
|
|
2861
2859
|
return;
|
|
2862
|
-
|
|
2860
|
+
L(a, o, {
|
|
2863
2861
|
_f: {
|
|
2864
2862
|
...f._f,
|
|
2865
2863
|
...C ? {
|
|
2866
2864
|
refs: [
|
|
2867
|
-
...
|
|
2865
|
+
...T.filter(lt),
|
|
2868
2866
|
m,
|
|
2869
|
-
...Array.isArray(w(
|
|
2867
|
+
...Array.isArray(w(s, o)) ? [{}] : []
|
|
2870
2868
|
],
|
|
2871
2869
|
ref: { type: m.type, name: o }
|
|
2872
2870
|
} : { ref: m }
|
|
2873
2871
|
}
|
|
2874
2872
|
}), me(o, !1, void 0, m);
|
|
2875
2873
|
} else
|
|
2876
|
-
f = w(
|
|
2874
|
+
f = w(a, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || c.shouldUnregister) && !(zn(d.array, o) && u.action) && d.unMount.add(o);
|
|
2877
2875
|
}
|
|
2878
2876
|
};
|
|
2879
|
-
}, Ct = () => r.shouldFocusError && ze(
|
|
2880
|
-
de(o) && (
|
|
2877
|
+
}, Ct = () => r.shouldFocusError && ze(a, Be, d.mount), Sr = (o) => {
|
|
2878
|
+
de(o) && (h.state.next({ disabled: o }), ze(a, (c) => {
|
|
2881
2879
|
c.disabled = o;
|
|
2882
2880
|
}, 0, !1));
|
|
2883
|
-
},
|
|
2881
|
+
}, Et = (o, c) => async (f) => {
|
|
2884
2882
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
2885
|
-
let
|
|
2886
|
-
if (
|
|
2883
|
+
let _ = oe(i);
|
|
2884
|
+
if (h.state.next({
|
|
2887
2885
|
isSubmitting: !0
|
|
2888
2886
|
}), r.resolver) {
|
|
2889
|
-
const { errors: b, values: m } = await
|
|
2890
|
-
n.errors = b,
|
|
2887
|
+
const { errors: b, values: m } = await H();
|
|
2888
|
+
n.errors = b, _ = m;
|
|
2891
2889
|
} else
|
|
2892
|
-
await q(
|
|
2893
|
-
j(n.errors, "root"),
|
|
2890
|
+
await q(a);
|
|
2891
|
+
j(n.errors, "root"), J(n.errors) ? (h.state.next({
|
|
2894
2892
|
errors: {}
|
|
2895
|
-
}), await o(
|
|
2893
|
+
}), await o(_, f)) : (c && await c({ ...n.errors }, f), Ct(), setTimeout(Ct)), h.state.next({
|
|
2896
2894
|
isSubmitted: !0,
|
|
2897
2895
|
isSubmitting: !1,
|
|
2898
|
-
isSubmitSuccessful:
|
|
2896
|
+
isSubmitSuccessful: J(n.errors),
|
|
2899
2897
|
submitCount: n.submitCount + 1,
|
|
2900
2898
|
errors: n.errors
|
|
2901
2899
|
});
|
|
2902
|
-
},
|
|
2903
|
-
w(
|
|
2904
|
-
},
|
|
2905
|
-
const f = o ? oe(o) :
|
|
2906
|
-
if (c.keepDefaultValues || (
|
|
2907
|
-
if (c.keepDirtyValues ||
|
|
2900
|
+
}, Cr = (o, c = {}) => {
|
|
2901
|
+
w(a, o) && (O(c.defaultValue) ? ge(o, w(s, o)) : (ge(o, c.defaultValue), L(s, o, c.defaultValue)), c.keepTouched || j(n.touchedFields, o), c.keepDirty || (j(n.dirtyFields, o), n.isDirty = c.defaultValue ? I(o, w(s, o)) : I()), c.keepError || (j(n.errors, o), v.isValid && g()), h.state.next({ ...n }));
|
|
2902
|
+
}, At = (o, c = {}) => {
|
|
2903
|
+
const f = o ? oe(o) : s, _ = oe(f), b = o && !J(o) ? _ : s;
|
|
2904
|
+
if (c.keepDefaultValues || (s = f), !c.keepValues) {
|
|
2905
|
+
if (c.keepDirtyValues || k)
|
|
2908
2906
|
for (const m of d.mount)
|
|
2909
|
-
w(n.dirtyFields, m) ?
|
|
2907
|
+
w(n.dirtyFields, m) ? L(b, m, w(i, m)) : ge(m, w(b, m));
|
|
2910
2908
|
else {
|
|
2911
|
-
if (
|
|
2909
|
+
if (bt && O(o))
|
|
2912
2910
|
for (const m of d.mount) {
|
|
2913
|
-
const C = w(
|
|
2911
|
+
const C = w(a, m);
|
|
2914
2912
|
if (C && C._f) {
|
|
2915
|
-
const
|
|
2916
|
-
if (Ge(
|
|
2917
|
-
const B =
|
|
2913
|
+
const T = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
|
|
2914
|
+
if (Ge(T)) {
|
|
2915
|
+
const B = T.closest("form");
|
|
2918
2916
|
if (B) {
|
|
2919
2917
|
B.reset();
|
|
2920
2918
|
break;
|
|
@@ -2922,11 +2920,11 @@ function ns(e = {}, t) {
|
|
|
2922
2920
|
}
|
|
2923
2921
|
}
|
|
2924
2922
|
}
|
|
2925
|
-
|
|
2923
|
+
a = {};
|
|
2926
2924
|
}
|
|
2927
|
-
i = e.shouldUnregister ? c.keepDefaultValues ? oe(
|
|
2925
|
+
i = e.shouldUnregister ? c.keepDefaultValues ? oe(s) : {} : oe(b), h.array.next({
|
|
2928
2926
|
values: { ...b }
|
|
2929
|
-
}),
|
|
2927
|
+
}), h.values.next({
|
|
2930
2928
|
values: { ...b }
|
|
2931
2929
|
});
|
|
2932
2930
|
}
|
|
@@ -2937,35 +2935,35 @@ function ns(e = {}, t) {
|
|
|
2937
2935
|
watch: /* @__PURE__ */ new Set(),
|
|
2938
2936
|
watchAll: !1,
|
|
2939
2937
|
focus: ""
|
|
2940
|
-
}, !u.mount && t(), u.mount = !
|
|
2938
|
+
}, !u.mount && t(), u.mount = !v.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister, h.state.next({
|
|
2941
2939
|
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2942
|
-
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !
|
|
2940
|
+
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !be(o, s)),
|
|
2943
2941
|
isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
|
|
2944
|
-
dirtyFields: c.keepDirtyValues ? n.dirtyFields : c.keepDefaultValues && o ? ut(
|
|
2942
|
+
dirtyFields: c.keepDirtyValues ? n.dirtyFields : c.keepDefaultValues && o ? ut(s, o) : {},
|
|
2945
2943
|
touchedFields: c.keepTouched ? n.touchedFields : {},
|
|
2946
2944
|
errors: c.keepErrors ? n.errors : {},
|
|
2947
2945
|
isSubmitSuccessful: c.keepIsSubmitSuccessful ? n.isSubmitSuccessful : !1,
|
|
2948
2946
|
isSubmitting: !1
|
|
2949
2947
|
});
|
|
2950
|
-
},
|
|
2948
|
+
}, Vt = (o, c) => At(fe(o) ? o(i) : o, c);
|
|
2951
2949
|
return {
|
|
2952
2950
|
control: {
|
|
2953
2951
|
register: rt,
|
|
2954
2952
|
unregister: tt,
|
|
2955
2953
|
getFieldState: _t,
|
|
2956
|
-
handleSubmit:
|
|
2954
|
+
handleSubmit: Et,
|
|
2957
2955
|
setError: kt,
|
|
2958
|
-
_executeSchema:
|
|
2956
|
+
_executeSchema: H,
|
|
2959
2957
|
_getWatch: R,
|
|
2960
|
-
_getDirty:
|
|
2958
|
+
_getDirty: I,
|
|
2961
2959
|
_updateValid: g,
|
|
2962
2960
|
_removeUnmounted: F,
|
|
2963
2961
|
_updateFieldArray: P,
|
|
2964
2962
|
_updateDisabledField: St,
|
|
2965
2963
|
_getFieldArray: K,
|
|
2966
|
-
_reset:
|
|
2964
|
+
_reset: At,
|
|
2967
2965
|
_resetDefaultValues: () => fe(r.defaultValues) && r.defaultValues().then((o) => {
|
|
2968
|
-
|
|
2966
|
+
Vt(o, r.resetOptions), h.state.next({
|
|
2969
2967
|
isLoading: !1
|
|
2970
2968
|
});
|
|
2971
2969
|
}),
|
|
@@ -2975,11 +2973,11 @@ function ns(e = {}, t) {
|
|
|
2975
2973
|
...o
|
|
2976
2974
|
};
|
|
2977
2975
|
},
|
|
2978
|
-
_disableForm:
|
|
2979
|
-
_subjects:
|
|
2980
|
-
_proxyFormState:
|
|
2976
|
+
_disableForm: Sr,
|
|
2977
|
+
_subjects: h,
|
|
2978
|
+
_proxyFormState: v,
|
|
2981
2979
|
get _fields() {
|
|
2982
|
-
return
|
|
2980
|
+
return a;
|
|
2983
2981
|
},
|
|
2984
2982
|
get _formValues() {
|
|
2985
2983
|
return i;
|
|
@@ -2991,7 +2989,7 @@ function ns(e = {}, t) {
|
|
|
2991
2989
|
u = o;
|
|
2992
2990
|
},
|
|
2993
2991
|
get _defaultValues() {
|
|
2994
|
-
return
|
|
2992
|
+
return s;
|
|
2995
2993
|
},
|
|
2996
2994
|
get _names() {
|
|
2997
2995
|
return d;
|
|
@@ -3017,27 +3015,27 @@ function ns(e = {}, t) {
|
|
|
3017
3015
|
},
|
|
3018
3016
|
trigger: et,
|
|
3019
3017
|
register: rt,
|
|
3020
|
-
handleSubmit:
|
|
3021
|
-
watch:
|
|
3018
|
+
handleSubmit: Et,
|
|
3019
|
+
watch: kr,
|
|
3022
3020
|
setValue: ge,
|
|
3023
3021
|
getValues: wt,
|
|
3024
|
-
reset:
|
|
3025
|
-
resetField:
|
|
3026
|
-
clearErrors:
|
|
3022
|
+
reset: Vt,
|
|
3023
|
+
resetField: Cr,
|
|
3024
|
+
clearErrors: _r,
|
|
3027
3025
|
unregister: tt,
|
|
3028
3026
|
setError: kt,
|
|
3029
3027
|
setFocus: (o, c = {}) => {
|
|
3030
|
-
const f = w(
|
|
3031
|
-
if (
|
|
3032
|
-
const b =
|
|
3028
|
+
const f = w(a, o), _ = f && f._f;
|
|
3029
|
+
if (_) {
|
|
3030
|
+
const b = _.refs ? _.refs[0] : _.ref;
|
|
3033
3031
|
b.focus && (b.focus(), c.shouldSelect && b.select());
|
|
3034
3032
|
}
|
|
3035
3033
|
},
|
|
3036
3034
|
getFieldState: _t
|
|
3037
3035
|
};
|
|
3038
3036
|
}
|
|
3039
|
-
function
|
|
3040
|
-
const t =
|
|
3037
|
+
function Qe(e = {}) {
|
|
3038
|
+
const t = Q.useRef(), r = Q.useRef(), [n, a] = Q.useState({
|
|
3041
3039
|
isDirty: !1,
|
|
3042
3040
|
isValidating: !1,
|
|
3043
3041
|
isLoading: fe(e.defaultValues),
|
|
@@ -3053,38 +3051,38 @@ function Xe(e = {}) {
|
|
|
3053
3051
|
defaultValues: fe(e.defaultValues) ? void 0 : e.defaultValues
|
|
3054
3052
|
});
|
|
3055
3053
|
t.current || (t.current = {
|
|
3056
|
-
...ns(e, () =>
|
|
3054
|
+
...ns(e, () => a((i) => ({ ...i }))),
|
|
3057
3055
|
formState: n
|
|
3058
3056
|
});
|
|
3059
|
-
const
|
|
3060
|
-
return
|
|
3061
|
-
subject:
|
|
3057
|
+
const s = t.current.control;
|
|
3058
|
+
return s._options = e, Gn({
|
|
3059
|
+
subject: s._subjects.state,
|
|
3062
3060
|
next: (i) => {
|
|
3063
|
-
Kn(i,
|
|
3061
|
+
Kn(i, s._proxyFormState, s._updateFormState, !0) && a({ ...s._formState });
|
|
3064
3062
|
}
|
|
3065
|
-
}),
|
|
3066
|
-
if (
|
|
3067
|
-
const i =
|
|
3068
|
-
i !== n.isDirty &&
|
|
3063
|
+
}), Q.useEffect(() => s._disableForm(e.disabled), [s, e.disabled]), Q.useEffect(() => {
|
|
3064
|
+
if (s._proxyFormState.isDirty) {
|
|
3065
|
+
const i = s._getDirty();
|
|
3066
|
+
i !== n.isDirty && s._subjects.state.next({
|
|
3069
3067
|
isDirty: i
|
|
3070
3068
|
});
|
|
3071
3069
|
}
|
|
3072
|
-
}, [
|
|
3073
|
-
e.values && !
|
|
3074
|
-
}, [e.values,
|
|
3075
|
-
|
|
3076
|
-
}), t.current.formState = Un(n,
|
|
3070
|
+
}, [s, n.isDirty]), Q.useEffect(() => {
|
|
3071
|
+
e.values && !be(e.values, r.current) ? (s._reset(e.values, s._options.resetOptions), r.current = e.values) : s._resetDefaultValues();
|
|
3072
|
+
}, [e.values, s]), Q.useEffect(() => {
|
|
3073
|
+
s._state.mount || (s._updateValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
|
|
3074
|
+
}), t.current.formState = Un(n, s), t.current;
|
|
3077
3075
|
}
|
|
3078
|
-
var
|
|
3076
|
+
var Ht = function(e, t, r) {
|
|
3079
3077
|
if (e && "reportValidity" in e) {
|
|
3080
3078
|
var n = w(r, t);
|
|
3081
3079
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3082
3080
|
}
|
|
3083
3081
|
}, ss = function(e, t) {
|
|
3084
|
-
var r = function(
|
|
3085
|
-
var
|
|
3086
|
-
|
|
3087
|
-
return
|
|
3082
|
+
var r = function(a) {
|
|
3083
|
+
var s = t.fields[a];
|
|
3084
|
+
s && s.ref && "reportValidity" in s.ref ? Ht(s.ref, a, e) : s.refs && s.refs.forEach(function(i) {
|
|
3085
|
+
return Ht(i, a, e);
|
|
3088
3086
|
});
|
|
3089
3087
|
};
|
|
3090
3088
|
for (var n in t.fields)
|
|
@@ -3093,12 +3091,12 @@ var Wt = function(e, t, r) {
|
|
|
3093
3091
|
t.shouldUseNativeValidation && ss(e, t);
|
|
3094
3092
|
var r = {};
|
|
3095
3093
|
for (var n in e) {
|
|
3096
|
-
var
|
|
3094
|
+
var a = w(t.fields, n), s = Object.assign(e[n] || {}, { ref: a && a.ref });
|
|
3097
3095
|
if (os(t.names || Object.keys(e), n)) {
|
|
3098
3096
|
var i = Object.assign({}, is(w(r, n)));
|
|
3099
|
-
|
|
3097
|
+
L(i, "root", s), L(r, n, i);
|
|
3100
3098
|
} else
|
|
3101
|
-
|
|
3099
|
+
L(r, n, s);
|
|
3102
3100
|
}
|
|
3103
3101
|
return r;
|
|
3104
3102
|
}, is = function(e) {
|
|
@@ -3111,36 +3109,36 @@ var Wt = function(e, t, r) {
|
|
|
3111
3109
|
for (var r = {}; e.issues.length; ) {
|
|
3112
3110
|
var n = e.issues[0];
|
|
3113
3111
|
if (n.path) {
|
|
3114
|
-
var
|
|
3112
|
+
var a = n.path.map(function(u) {
|
|
3115
3113
|
return u.key;
|
|
3116
3114
|
}).join(".");
|
|
3117
|
-
if (r[
|
|
3118
|
-
var
|
|
3119
|
-
r[
|
|
3115
|
+
if (r[a] || (r[a] = { message: n.message, type: n.validation }), t) {
|
|
3116
|
+
var s = r[a].types, i = s && s[n.validation];
|
|
3117
|
+
r[a] = pr(a, t, r, n.validation, i ? [].concat(i, n.message) : n.message);
|
|
3120
3118
|
}
|
|
3121
3119
|
e.issues.shift();
|
|
3122
3120
|
}
|
|
3123
3121
|
}
|
|
3124
3122
|
return r;
|
|
3125
3123
|
}, Ye = function(e, t, r) {
|
|
3126
|
-
return r === void 0 && (r = {}), function(n,
|
|
3124
|
+
return r === void 0 && (r = {}), function(n, a, s) {
|
|
3127
3125
|
try {
|
|
3128
3126
|
return Promise.resolve(function(i, u) {
|
|
3129
3127
|
try {
|
|
3130
3128
|
var d = function() {
|
|
3131
|
-
function
|
|
3132
|
-
return { values: r.raw ? n :
|
|
3129
|
+
function p(v) {
|
|
3130
|
+
return { values: r.raw ? n : v, errors: {} };
|
|
3133
3131
|
}
|
|
3134
3132
|
var x = Object.assign({}, { abortEarly: !1, abortPipeEarly: !1 }, t);
|
|
3135
|
-
return r.mode === "sync" ?
|
|
3133
|
+
return r.mode === "sync" ? p(nr(e, n, x)) : Promise.resolve(Dr(e, n, x)).then(p);
|
|
3136
3134
|
}();
|
|
3137
|
-
} catch (
|
|
3138
|
-
return u(
|
|
3135
|
+
} catch (p) {
|
|
3136
|
+
return u(p);
|
|
3139
3137
|
}
|
|
3140
3138
|
return d && d.then ? d.then(void 0, u) : d;
|
|
3141
3139
|
}(0, function(i) {
|
|
3142
|
-
if (i instanceof
|
|
3143
|
-
return { values: {}, errors: as(ls(i, !
|
|
3140
|
+
if (i instanceof Rr)
|
|
3141
|
+
return { values: {}, errors: as(ls(i, !s.shouldUseNativeValidation && s.criteriaMode === "all"), s) };
|
|
3144
3142
|
throw i;
|
|
3145
3143
|
}));
|
|
3146
3144
|
} catch (i) {
|
|
@@ -3148,15 +3146,19 @@ var Wt = function(e, t, r) {
|
|
|
3148
3146
|
}
|
|
3149
3147
|
};
|
|
3150
3148
|
};
|
|
3151
|
-
const
|
|
3152
|
-
const
|
|
3149
|
+
const Wt = 27, Jt = 12, Zt = 10, us = Se("enum"), cs = (e, t) => {
|
|
3150
|
+
const r = {
|
|
3153
3151
|
min: e.minSelected ?? 0,
|
|
3154
3152
|
max: e.maxSelected ?? e.options.length
|
|
3155
3153
|
};
|
|
3156
3154
|
return Ye(he({
|
|
3157
|
-
checked:
|
|
3155
|
+
checked: sr(Or(Br()), (n) => Object.entries(n).filter(([a, s]) => s).map(([a, s]) => a), [je(r.max, t("validation_multiple_choice_max", {
|
|
3156
|
+
count: r.max
|
|
3157
|
+
})), Le(r.min, t("validation_multiple_choice_min", {
|
|
3158
|
+
count: r.min
|
|
3159
|
+
}))])
|
|
3158
3160
|
}));
|
|
3159
|
-
}, ds =
|
|
3161
|
+
}, ds = rr(({
|
|
3160
3162
|
option: e,
|
|
3161
3163
|
...t
|
|
3162
3164
|
}, r) => l(ke, {
|
|
@@ -3176,91 +3178,93 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3176
3178
|
// In cases where there is only one option, we want to center it
|
|
3177
3179
|
singleOption: "justify-center",
|
|
3178
3180
|
// Two choices with exactly 1 min 1 max
|
|
3179
|
-
booleanLike:
|
|
3181
|
+
booleanLike: ur
|
|
3180
3182
|
}
|
|
3181
3183
|
}
|
|
3182
3184
|
}), fs = ({
|
|
3183
3185
|
input: e,
|
|
3184
3186
|
onSubmitSuccess: t
|
|
3185
3187
|
}) => {
|
|
3186
|
-
var
|
|
3187
|
-
const r = e.key ? (
|
|
3188
|
-
|
|
3189
|
-
|
|
3188
|
+
var x, v;
|
|
3189
|
+
const r = e.key ? (x = M.current$.value.flow) == null ? void 0 : x.data.submissions[e.key] : void 0, n = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1, a = n && e.config.options.length === 2, {
|
|
3190
|
+
t: s
|
|
3191
|
+
} = G(), {
|
|
3192
|
+
register: i,
|
|
3193
|
+
handleSubmit: u,
|
|
3190
3194
|
formState: {
|
|
3191
|
-
errors:
|
|
3195
|
+
errors: d
|
|
3192
3196
|
}
|
|
3193
|
-
} =
|
|
3197
|
+
} = Qe({
|
|
3194
3198
|
defaultValues: {
|
|
3195
|
-
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((
|
|
3199
|
+
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((h) => [h, !0])) : {}
|
|
3196
3200
|
},
|
|
3197
|
-
resolver: cs(e.config)
|
|
3198
|
-
}),
|
|
3199
|
-
return
|
|
3201
|
+
resolver: cs(e.config, s)
|
|
3202
|
+
}), p = gt();
|
|
3203
|
+
return a ? l("ul", {
|
|
3200
3204
|
style: {
|
|
3201
|
-
maxHeight: 6.5 *
|
|
3205
|
+
maxHeight: 6.5 * Wt + 5 * Jt + 2 * Zt
|
|
3202
3206
|
},
|
|
3203
3207
|
class: Xt({
|
|
3204
3208
|
variant: "booleanLike"
|
|
3205
3209
|
}),
|
|
3206
|
-
children: e.config.options.map((
|
|
3210
|
+
children: e.config.options.map((h, k) => l("li", {
|
|
3207
3211
|
class: "flex-1",
|
|
3208
|
-
children: l(
|
|
3212
|
+
children: l(cr, {
|
|
3209
3213
|
type: "submit",
|
|
3210
|
-
ref: (
|
|
3211
|
-
|
|
3214
|
+
ref: (y) => {
|
|
3215
|
+
y && k === 0 && (p.current = y);
|
|
3212
3216
|
},
|
|
3213
|
-
label:
|
|
3217
|
+
label: h.label,
|
|
3214
3218
|
value: "true",
|
|
3215
3219
|
onClick: () => t({
|
|
3216
3220
|
type: "enum",
|
|
3217
|
-
value: [
|
|
3221
|
+
value: [h.value]
|
|
3218
3222
|
})
|
|
3219
3223
|
})
|
|
3220
|
-
},
|
|
3224
|
+
}, h.value))
|
|
3221
3225
|
}) : l("form", {
|
|
3222
3226
|
noValidate: !0,
|
|
3223
|
-
onSubmit: (
|
|
3224
|
-
const
|
|
3227
|
+
onSubmit: (h) => u((k) => {
|
|
3228
|
+
const y = k.checked;
|
|
3225
3229
|
t({
|
|
3226
3230
|
type: "enum",
|
|
3227
|
-
value:
|
|
3231
|
+
value: y
|
|
3228
3232
|
});
|
|
3229
|
-
})(
|
|
3233
|
+
})(h),
|
|
3230
3234
|
children: [l("div", {
|
|
3231
3235
|
class: "flex items-center gap-1",
|
|
3232
3236
|
children: [l("ul", {
|
|
3233
3237
|
style: {
|
|
3234
|
-
maxHeight: 6.5 *
|
|
3238
|
+
maxHeight: 6.5 * Wt + 5 * Jt + 2 * Zt
|
|
3235
3239
|
},
|
|
3236
3240
|
class: Xt({
|
|
3237
3241
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3238
3242
|
}),
|
|
3239
|
-
children: e.config.options.map((
|
|
3240
|
-
const
|
|
3241
|
-
ref:
|
|
3242
|
-
...
|
|
3243
|
-
} =
|
|
3243
|
+
children: e.config.options.map((h, k) => {
|
|
3244
|
+
const y = `checked.${h.value}`, {
|
|
3245
|
+
ref: A,
|
|
3246
|
+
...S
|
|
3247
|
+
} = i(y);
|
|
3244
3248
|
return l("li", {
|
|
3245
3249
|
class: "relative",
|
|
3246
3250
|
children: l(ds, {
|
|
3247
|
-
option:
|
|
3248
|
-
autoFocus:
|
|
3249
|
-
ref: (
|
|
3250
|
-
|
|
3251
|
+
option: h,
|
|
3252
|
+
autoFocus: k === 0,
|
|
3253
|
+
ref: (E) => {
|
|
3254
|
+
E && k === 0 && (p.current = E), A(E);
|
|
3251
3255
|
},
|
|
3252
|
-
id:
|
|
3253
|
-
...
|
|
3256
|
+
id: y,
|
|
3257
|
+
...S,
|
|
3254
3258
|
onClick: n ? () => t({
|
|
3255
3259
|
type: "enum",
|
|
3256
|
-
value: [
|
|
3260
|
+
value: [h.value]
|
|
3257
3261
|
}) : void 0
|
|
3258
3262
|
})
|
|
3259
|
-
},
|
|
3263
|
+
}, h.value);
|
|
3260
3264
|
})
|
|
3261
3265
|
}), l("div", {
|
|
3262
3266
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
3263
|
-
children: [n ? null : l(
|
|
3267
|
+
children: [n ? null : l(ye, {}), e.config.minSelected === 0 && l(ve, {
|
|
3264
3268
|
type: "button",
|
|
3265
3269
|
onClick: () => t({
|
|
3266
3270
|
type: "enum",
|
|
@@ -3271,43 +3275,43 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3271
3275
|
}), l("div", {
|
|
3272
3276
|
class: "px-1",
|
|
3273
3277
|
children: l(Ce, {
|
|
3274
|
-
error: (
|
|
3278
|
+
error: (v = d.checked) == null ? void 0 : v.root
|
|
3275
3279
|
})
|
|
3276
3280
|
})]
|
|
3277
3281
|
});
|
|
3278
3282
|
}, hs = Se("number"), ps = (e, t) => {
|
|
3279
|
-
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER,
|
|
3283
|
+
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, a = e.decimalCases ?? 0;
|
|
3280
3284
|
return Ye(he({
|
|
3281
|
-
number:
|
|
3285
|
+
number: Pr(t("validation_number"), [$r(r, t("validation_number_min", {
|
|
3282
3286
|
min: r
|
|
3283
|
-
})),
|
|
3287
|
+
})), jr(n, t("validation_number_max", {
|
|
3284
3288
|
max: n
|
|
3285
|
-
})),
|
|
3286
|
-
count:
|
|
3289
|
+
})), zr((s) => s === Number(s.toFixed(a)), t("validation_number_decimal_cases", {
|
|
3290
|
+
count: a
|
|
3287
3291
|
}))])
|
|
3288
3292
|
}));
|
|
3289
3293
|
}, ms = ({
|
|
3290
3294
|
input: e,
|
|
3291
3295
|
onSubmitSuccess: t
|
|
3292
3296
|
}) => {
|
|
3293
|
-
var
|
|
3294
|
-
const r = e.config.defaultValue, n = e.key ? (
|
|
3295
|
-
t:
|
|
3296
|
-
} =
|
|
3297
|
-
register:
|
|
3297
|
+
var v;
|
|
3298
|
+
const r = e.config.defaultValue, n = e.key ? (v = M.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, {
|
|
3299
|
+
t: a
|
|
3300
|
+
} = G(), {
|
|
3301
|
+
register: s,
|
|
3298
3302
|
handleSubmit: i,
|
|
3299
3303
|
formState: {
|
|
3300
3304
|
errors: u
|
|
3301
3305
|
}
|
|
3302
|
-
} =
|
|
3306
|
+
} = Qe({
|
|
3303
3307
|
defaultValues: {
|
|
3304
3308
|
number: r ? Number(r) : hs(n) ? n.value : void 0
|
|
3305
3309
|
},
|
|
3306
|
-
resolver: ps(e.config,
|
|
3310
|
+
resolver: ps(e.config, a)
|
|
3307
3311
|
}), {
|
|
3308
3312
|
ref: d,
|
|
3309
|
-
...
|
|
3310
|
-
} =
|
|
3313
|
+
...p
|
|
3314
|
+
} = s("number", {
|
|
3311
3315
|
required: !e.config.optional,
|
|
3312
3316
|
valueAsNumber: !0
|
|
3313
3317
|
}), x = re();
|
|
@@ -3315,10 +3319,10 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3315
3319
|
x.current && (x.current.focus(), x.current.select());
|
|
3316
3320
|
}, []), l("form", {
|
|
3317
3321
|
class: "flex flex-col gap-1 p-2.5",
|
|
3318
|
-
onSubmit: i((
|
|
3319
|
-
|
|
3322
|
+
onSubmit: i((h) => {
|
|
3323
|
+
h.number !== void 0 && t({
|
|
3320
3324
|
type: "number",
|
|
3321
|
-
value:
|
|
3325
|
+
value: h.number
|
|
3322
3326
|
});
|
|
3323
3327
|
}),
|
|
3324
3328
|
children: [l("div", {
|
|
@@ -3326,19 +3330,19 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3326
3330
|
children: [l("div", {
|
|
3327
3331
|
class: "relative min-w-0 flex-grow",
|
|
3328
3332
|
children: [l("input", {
|
|
3329
|
-
...
|
|
3333
|
+
...p,
|
|
3330
3334
|
id: "chat-input",
|
|
3331
3335
|
autocomplete: "off",
|
|
3332
3336
|
autoCapitalize: "off",
|
|
3333
3337
|
autoCorrect: "off",
|
|
3334
3338
|
autoFocus: !0,
|
|
3335
|
-
ref: (
|
|
3336
|
-
|
|
3339
|
+
ref: (h) => {
|
|
3340
|
+
h && (x.current = h), d(h);
|
|
3337
3341
|
},
|
|
3338
3342
|
type: "text",
|
|
3339
3343
|
min: e.config.min,
|
|
3340
3344
|
max: e.config.max,
|
|
3341
|
-
class:
|
|
3345
|
+
class: De({
|
|
3342
3346
|
optional: e.config.optional,
|
|
3343
3347
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3344
3348
|
}),
|
|
@@ -3347,7 +3351,7 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3347
3351
|
class: "absolute right-0 top-0",
|
|
3348
3352
|
onClick: () => t(null)
|
|
3349
3353
|
})]
|
|
3350
|
-
}), l(
|
|
3354
|
+
}), l(ye, {})]
|
|
3351
3355
|
}), l(Ce, {
|
|
3352
3356
|
error: u.number
|
|
3353
3357
|
})]
|
|
@@ -3358,7 +3362,7 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3358
3362
|
countryCode: "",
|
|
3359
3363
|
phoneNumber: ""
|
|
3360
3364
|
};
|
|
3361
|
-
const t = Object.entries(mt).find((
|
|
3365
|
+
const t = Object.entries(mt).find((a) => e.startsWith(a[1])), r = t ? t[1] : "", n = e.replace(r, "");
|
|
3362
3366
|
return /^\d+$/.test(n) ? {
|
|
3363
3367
|
countryCode: r,
|
|
3364
3368
|
phoneNumber: n
|
|
@@ -3366,62 +3370,60 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3366
3370
|
countryCode: "",
|
|
3367
3371
|
phoneNumber: ""
|
|
3368
3372
|
};
|
|
3369
|
-
},
|
|
3370
|
-
const t = ee(e("validation_country_code"), [
|
|
3373
|
+
}, bs = "44", ys = /^[0-9 ]+$/, vs = Se("string"), xs = Se("phone"), ws = (e) => {
|
|
3374
|
+
const t = ee(e("validation_country_code"), [qr(ys, e("validation_country_code"))]), r = sr(ee(e("validation_phone"), [Le(1, e("validation_phone"))]), (n) => n.replace(/[^0-9]/g, ""), []);
|
|
3371
3375
|
return Ye(he({
|
|
3372
3376
|
countryCode: t,
|
|
3373
|
-
phoneNumber:
|
|
3377
|
+
phoneNumber: r
|
|
3374
3378
|
}));
|
|
3375
|
-
},
|
|
3379
|
+
}, _s = ({
|
|
3376
3380
|
input: e,
|
|
3377
3381
|
onSubmitSuccess: t
|
|
3378
3382
|
}) => {
|
|
3379
|
-
var
|
|
3380
|
-
const r = e.key ? (
|
|
3383
|
+
var A;
|
|
3384
|
+
const r = e.key ? (A = M.current$.value.flow) == null ? void 0 : A.data.submissions[e.key] : void 0, {
|
|
3381
3385
|
t: n
|
|
3382
|
-
} =
|
|
3386
|
+
} = G(), [a, s] = Y(), i = vs(r) ? gs(r.value) : xs(r) ? r.value : void 0, {
|
|
3383
3387
|
register: u,
|
|
3384
3388
|
handleSubmit: d,
|
|
3385
3389
|
formState: {
|
|
3386
|
-
errors:
|
|
3390
|
+
errors: p
|
|
3387
3391
|
},
|
|
3388
3392
|
watch: x
|
|
3389
|
-
} =
|
|
3393
|
+
} = Qe({
|
|
3390
3394
|
defaultValues: {
|
|
3391
|
-
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3395
|
+
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ?? bs,
|
|
3392
3396
|
phoneNumber: (i == null ? void 0 : i.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3393
3397
|
},
|
|
3394
|
-
resolver:
|
|
3398
|
+
resolver: ws(n)
|
|
3395
3399
|
}), {
|
|
3396
|
-
ref:
|
|
3397
|
-
...
|
|
3400
|
+
ref: v,
|
|
3401
|
+
...h
|
|
3398
3402
|
} = u("phoneNumber", {
|
|
3399
3403
|
required: !e.config.optional
|
|
3400
|
-
}),
|
|
3404
|
+
}), k = re(), y = x("countryCode");
|
|
3401
3405
|
return pe(() => {
|
|
3402
|
-
|
|
3406
|
+
k.current && (k.current.focus(), k.current.select());
|
|
3403
3407
|
}, []), l("form", {
|
|
3404
3408
|
noValidate: !0,
|
|
3405
3409
|
class: "flex flex-col gap-1 p-2.5",
|
|
3406
3410
|
onSubmit: d((S) => {
|
|
3407
|
-
const
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
return a(n("validation_min_chars", {
|
|
3414
|
-
count: e.config.minChars ?? 1
|
|
3411
|
+
const E = S.phoneNumber.replace(/[^0-9]/g, ""), g = S.countryCode.replace(/[^0-9]/g, "");
|
|
3412
|
+
s(void 0);
|
|
3413
|
+
const N = e.config.minChars ?? 7;
|
|
3414
|
+
if (E.length + g.length < N)
|
|
3415
|
+
return s(n("validation_phone_min_chars", {
|
|
3416
|
+
count: N
|
|
3415
3417
|
}));
|
|
3416
3418
|
e.config.submissionFormat === "phone" ? t({
|
|
3417
3419
|
type: "phone",
|
|
3418
3420
|
value: {
|
|
3419
3421
|
countryCode: g,
|
|
3420
|
-
phoneNumber:
|
|
3422
|
+
phoneNumber: E
|
|
3421
3423
|
}
|
|
3422
3424
|
}) : t({
|
|
3423
3425
|
type: "string",
|
|
3424
|
-
value:
|
|
3426
|
+
value: y + S.phoneNumber
|
|
3425
3427
|
});
|
|
3426
3428
|
}),
|
|
3427
3429
|
children: [l("div", {
|
|
@@ -3432,18 +3434,18 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3432
3434
|
class: "text-neutral-12 bg-lowest hover:bg-neutral-5 placeholder:text-neutral-8 focus-visible:outline-accent-7 focus-within:bg-neutral-5 focus-within:outline-accent-7 outline-divider relative flex h-full cursor-pointer appearance-none items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap rounded-l-full border-solid px-3 py-1.5 text-center text-base outline outline-2 transition-all focus-within:outline-none",
|
|
3433
3435
|
htmlFor: `isdk_phone_${e.key}`,
|
|
3434
3436
|
children: [l("span", {
|
|
3435
|
-
children: ["+",
|
|
3437
|
+
children: ["+", y]
|
|
3436
3438
|
}), l("select", {
|
|
3437
3439
|
...u("countryCode", {}),
|
|
3438
3440
|
id: `isdk_phone_${e.key}`,
|
|
3439
3441
|
class: "absolute inset-0 opacity-0",
|
|
3440
|
-
children: Object.entries(mt).map(([S,
|
|
3441
|
-
value:
|
|
3442
|
-
children: [S, " (+",
|
|
3442
|
+
children: Object.entries(mt).map(([S, E]) => l("option", {
|
|
3443
|
+
value: E,
|
|
3444
|
+
children: [S, " (+", E, ")"]
|
|
3443
3445
|
}, S))
|
|
3444
3446
|
})]
|
|
3445
3447
|
}), l("input", {
|
|
3446
|
-
...
|
|
3448
|
+
...h,
|
|
3447
3449
|
id: "chat-input",
|
|
3448
3450
|
type: "tel",
|
|
3449
3451
|
inputMode: "tel",
|
|
@@ -3452,25 +3454,25 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3452
3454
|
autoCorrect: "off",
|
|
3453
3455
|
autoFocus: !0,
|
|
3454
3456
|
ref: (S) => {
|
|
3455
|
-
S && (
|
|
3457
|
+
S && (k.current = S), v(S);
|
|
3456
3458
|
},
|
|
3457
|
-
class:
|
|
3459
|
+
class: De({
|
|
3458
3460
|
optional: e.config.optional,
|
|
3459
|
-
className: "flex-1 rounded-r-full"
|
|
3461
|
+
className: "min-w-0 flex-1 rounded-r-full"
|
|
3460
3462
|
}),
|
|
3461
3463
|
placeholder: e.config.placeholder
|
|
3462
3464
|
}), e.config.optional && l(ve, {
|
|
3463
|
-
class: "absolute right-0 top-0",
|
|
3465
|
+
class: "absolute bottom-0 right-0 top-0",
|
|
3464
3466
|
onClick: () => t(null)
|
|
3465
3467
|
})]
|
|
3466
|
-
}), l(
|
|
3468
|
+
}), l(ye, {})]
|
|
3467
3469
|
}), l(Ce, {
|
|
3468
|
-
error:
|
|
3469
|
-
message:
|
|
3470
|
+
error: p.countryCode || p.phoneNumber || {
|
|
3471
|
+
message: a
|
|
3470
3472
|
}
|
|
3471
3473
|
})]
|
|
3472
3474
|
});
|
|
3473
|
-
},
|
|
3475
|
+
}, ks = ({
|
|
3474
3476
|
input: e,
|
|
3475
3477
|
onSubmitSuccess: t
|
|
3476
3478
|
}) => l("div", {
|
|
@@ -3502,7 +3504,7 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3502
3504
|
})]
|
|
3503
3505
|
})
|
|
3504
3506
|
})
|
|
3505
|
-
}),
|
|
3507
|
+
}), Ss = {
|
|
3506
3508
|
email: {
|
|
3507
3509
|
type: "email",
|
|
3508
3510
|
inputMode: "email",
|
|
@@ -3517,7 +3519,7 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3517
3519
|
inputMode: "url",
|
|
3518
3520
|
formNoValidate: !0
|
|
3519
3521
|
}
|
|
3520
|
-
},
|
|
3522
|
+
}, Cs = Se("string"), Es = (e, t) => {
|
|
3521
3523
|
const r = {
|
|
3522
3524
|
maxLength: t("validation_max_chars", {
|
|
3523
3525
|
count: e.maxChars ?? 999
|
|
@@ -3528,33 +3530,33 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3528
3530
|
};
|
|
3529
3531
|
return Ye(he({
|
|
3530
3532
|
text: {
|
|
3531
|
-
email: ee(t("validation_email"), [Ur(t("validation_email")),
|
|
3532
|
-
text: ee([
|
|
3533
|
-
url: ee([Kr(t("validation_url")),
|
|
3533
|
+
email: ee(t("validation_email"), [Ur(t("validation_email")), Le(e.minChars ?? 1, r.minLength), je(e.maxChars ?? 1 / 0, r.maxLength)]),
|
|
3534
|
+
text: ee([Le(e.minChars ?? 1, r.minLength), je(e.maxChars ?? 1 / 0, r.maxLength)]),
|
|
3535
|
+
url: ee([Kr(t("validation_url")), Le(e.minChars ?? 1, r.minLength), je(e.maxChars ?? 1 / 0, r.maxLength)])
|
|
3534
3536
|
}[e.format]
|
|
3535
3537
|
}));
|
|
3536
3538
|
}, As = ({
|
|
3537
3539
|
input: e,
|
|
3538
3540
|
onSubmitSuccess: t
|
|
3539
3541
|
}) => {
|
|
3540
|
-
var
|
|
3542
|
+
var v;
|
|
3541
3543
|
const {
|
|
3542
3544
|
t: r
|
|
3543
|
-
} =
|
|
3544
|
-
register:
|
|
3545
|
+
} = G(), n = e.key ? (v = M.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, a = e.config.defaultValue, {
|
|
3546
|
+
register: s,
|
|
3545
3547
|
handleSubmit: i,
|
|
3546
3548
|
formState: {
|
|
3547
3549
|
errors: u
|
|
3548
3550
|
}
|
|
3549
|
-
} =
|
|
3551
|
+
} = Qe({
|
|
3550
3552
|
defaultValues: {
|
|
3551
|
-
text:
|
|
3553
|
+
text: a || (Cs(n) ? n.value : "")
|
|
3552
3554
|
},
|
|
3553
|
-
resolver:
|
|
3555
|
+
resolver: Es(e.config, r)
|
|
3554
3556
|
}), {
|
|
3555
3557
|
ref: d,
|
|
3556
|
-
...
|
|
3557
|
-
} =
|
|
3558
|
+
...p
|
|
3559
|
+
} = s("text", {
|
|
3558
3560
|
required: !e.config.optional
|
|
3559
3561
|
}), x = re();
|
|
3560
3562
|
return pe(() => {
|
|
@@ -3562,10 +3564,10 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3562
3564
|
}, []), l("form", {
|
|
3563
3565
|
noValidate: !0,
|
|
3564
3566
|
class: "flex flex-col gap-1 p-2.5",
|
|
3565
|
-
onSubmit: i((
|
|
3567
|
+
onSubmit: i((h) => {
|
|
3566
3568
|
t({
|
|
3567
3569
|
type: "string",
|
|
3568
|
-
value:
|
|
3570
|
+
value: h.text
|
|
3569
3571
|
});
|
|
3570
3572
|
}),
|
|
3571
3573
|
children: [l("div", {
|
|
@@ -3574,17 +3576,17 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3574
3576
|
class: "relative min-w-0 flex-1",
|
|
3575
3577
|
children: [l("input", {
|
|
3576
3578
|
id: "chat-input",
|
|
3577
|
-
...
|
|
3578
|
-
...
|
|
3579
|
+
...p,
|
|
3580
|
+
...Ss[e.config.format],
|
|
3579
3581
|
autocomplete: "off",
|
|
3580
3582
|
autoCapitalize: "off",
|
|
3581
3583
|
autoCorrect: "off",
|
|
3582
3584
|
autoFocus: !0,
|
|
3583
|
-
ref: (
|
|
3584
|
-
|
|
3585
|
+
ref: (h) => {
|
|
3586
|
+
h && (x.current = h), d(h);
|
|
3585
3587
|
},
|
|
3586
3588
|
placeholder: e.config.placeholder,
|
|
3587
|
-
class:
|
|
3589
|
+
class: De({
|
|
3588
3590
|
optional: !!e.config.optional,
|
|
3589
3591
|
className: "w-full rounded-full"
|
|
3590
3592
|
})
|
|
@@ -3592,33 +3594,33 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3592
3594
|
class: "absolute right-0 top-0",
|
|
3593
3595
|
onClick: () => t(null)
|
|
3594
3596
|
})]
|
|
3595
|
-
}), l(
|
|
3597
|
+
}), l(ye, {})]
|
|
3596
3598
|
}), l(Ce, {
|
|
3597
3599
|
error: u.text
|
|
3598
3600
|
})]
|
|
3599
3601
|
});
|
|
3600
|
-
},
|
|
3602
|
+
}, Vs = {
|
|
3601
3603
|
text: As,
|
|
3602
|
-
phone:
|
|
3604
|
+
phone: _s,
|
|
3603
3605
|
"multiple-choice": fs,
|
|
3604
3606
|
boolean: Nn,
|
|
3605
3607
|
file: Pn,
|
|
3606
|
-
submit:
|
|
3607
|
-
address:
|
|
3608
|
+
submit: ks,
|
|
3609
|
+
address: Vn,
|
|
3608
3610
|
number: ms
|
|
3609
3611
|
}, Is = ({
|
|
3610
3612
|
logger: e
|
|
3611
3613
|
}) => {
|
|
3612
|
-
var
|
|
3613
|
-
const t = (
|
|
3614
|
+
var s;
|
|
3615
|
+
const t = (s = M.current$.value.flow) == null ? void 0 : s.data.currentInput, [r, n] = gn(), a = re(null);
|
|
3614
3616
|
return M.inputHeight$.value = n.height, ue(() => {
|
|
3615
|
-
const i =
|
|
3617
|
+
const i = a.current;
|
|
3616
3618
|
if (i)
|
|
3617
3619
|
return i.addEventListener("transitionstart", z.scrollToEnd.smooth), i.addEventListener("transitioncancel", z.scrollToEnd.smooth), i.addEventListener("transitionend", z.scrollToEnd.smooth), () => {
|
|
3618
3620
|
i.removeEventListener("transitionstart", z.scrollToEnd.smooth), i.removeEventListener("transitioncancel", z.scrollToEnd.smooth), i.removeEventListener("transitionend", z.scrollToEnd.smooth);
|
|
3619
3621
|
};
|
|
3620
3622
|
}, []), l("div", {
|
|
3621
|
-
ref:
|
|
3623
|
+
ref: a,
|
|
3622
3624
|
class: "ease-expo-out absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-xl transition-all duration-700 will-change-[height]",
|
|
3623
3625
|
style: {
|
|
3624
3626
|
height: n.height
|
|
@@ -3627,7 +3629,7 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3627
3629
|
ref: r,
|
|
3628
3630
|
class: "border-divider flex flex-col justify-end border-t",
|
|
3629
3631
|
children: t ? (() => {
|
|
3630
|
-
const i =
|
|
3632
|
+
const i = Vs[t.type];
|
|
3631
3633
|
return l(i, {
|
|
3632
3634
|
logger: e,
|
|
3633
3635
|
onSubmitSuccess: z.onSubmitSuccessFn$.value,
|
|
@@ -3638,12 +3640,12 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3638
3640
|
children: [l("input", {
|
|
3639
3641
|
"aria-hidden": "true",
|
|
3640
3642
|
id: "chat-input",
|
|
3641
|
-
class:
|
|
3643
|
+
class: De({
|
|
3642
3644
|
optional: !1,
|
|
3643
3645
|
className: "flex-grow rounded-full"
|
|
3644
3646
|
}),
|
|
3645
3647
|
disabled: !0
|
|
3646
|
-
}), l(
|
|
3648
|
+
}), l(ye, {
|
|
3647
3649
|
disabled: !0,
|
|
3648
3650
|
"aria-hidden": "true",
|
|
3649
3651
|
tabIndex: -1
|
|
@@ -3652,62 +3654,62 @@ const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
|
3652
3654
|
})
|
|
3653
3655
|
});
|
|
3654
3656
|
};
|
|
3655
|
-
var
|
|
3657
|
+
var Ms = function(e) {
|
|
3656
3658
|
return e instanceof RegExp;
|
|
3657
|
-
},
|
|
3659
|
+
}, Fs = function(t) {
|
|
3658
3660
|
var r = /[\\^$.*+?()[\]{}|]/g, n = RegExp(r.source);
|
|
3659
3661
|
return t && n.test(t) ? t.replace(r, "\\$&") : t;
|
|
3660
|
-
},
|
|
3662
|
+
}, wr = function(e) {
|
|
3661
3663
|
return typeof e == "string";
|
|
3662
|
-
},
|
|
3664
|
+
}, Ns = function(e) {
|
|
3663
3665
|
var t = [];
|
|
3664
3666
|
return e.forEach(function(r) {
|
|
3665
3667
|
Array.isArray(r) ? t = t.concat(r) : t.push(r);
|
|
3666
3668
|
}), t;
|
|
3667
3669
|
};
|
|
3668
|
-
function
|
|
3669
|
-
var n = 0,
|
|
3670
|
+
function Ls(e, t, r) {
|
|
3671
|
+
var n = 0, a = 0;
|
|
3670
3672
|
if (e === "")
|
|
3671
3673
|
return e;
|
|
3672
|
-
if (!e || !
|
|
3674
|
+
if (!e || !wr(e))
|
|
3673
3675
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3674
|
-
var
|
|
3675
|
-
|
|
3676
|
-
for (var i = e.split(
|
|
3676
|
+
var s = t;
|
|
3677
|
+
Ms(s) || (s = new RegExp("(" + Fs(s) + ")", "gi"));
|
|
3678
|
+
for (var i = e.split(s), u = 1, d = i.length; u < d; u += 2) {
|
|
3677
3679
|
if (i[u] === void 0 || i[u - 1] === void 0) {
|
|
3678
3680
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
3679
3681
|
continue;
|
|
3680
3682
|
}
|
|
3681
|
-
|
|
3683
|
+
a = i[u].length, n += i[u - 1].length, i[u] = r(i[u], u, n), n += a;
|
|
3682
3684
|
}
|
|
3683
3685
|
return i;
|
|
3684
3686
|
}
|
|
3685
|
-
var
|
|
3686
|
-
return Array.isArray(t) || (t = [t]),
|
|
3687
|
-
return
|
|
3687
|
+
var Ts = function(t, r, n) {
|
|
3688
|
+
return Array.isArray(t) || (t = [t]), Ns(t.map(function(a) {
|
|
3689
|
+
return wr(a) ? Ls(a, r, n) : a;
|
|
3688
3690
|
}));
|
|
3689
3691
|
};
|
|
3690
|
-
const
|
|
3691
|
-
const t =
|
|
3692
|
-
const [, u, d] =
|
|
3692
|
+
const $e = /* @__PURE__ */ tr(Ts), Ds = /(\[[^\]]+\]\([^)]+\))/g, Rs = /\[([^\]]+)\]\(([^)]+)\)/, Os = /(https?:\/\/[^\s]+)/g, Bs = /_(.*?)_/g, Ps = /\*\*(.*?)\*\*/g, Qt = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", $s = (e) => {
|
|
3693
|
+
const t = $e(e, Ds, (s, i) => {
|
|
3694
|
+
const [, u, d] = s.match(Rs) ?? [];
|
|
3693
3695
|
return d ? l("a", {
|
|
3694
|
-
class:
|
|
3696
|
+
class: Qt,
|
|
3695
3697
|
href: d,
|
|
3696
3698
|
children: u ?? d
|
|
3697
3699
|
}, d + i) : l("span", {
|
|
3698
3700
|
children: "INVALID LINK"
|
|
3699
3701
|
});
|
|
3700
|
-
}), r =
|
|
3701
|
-
class:
|
|
3702
|
-
href:
|
|
3703
|
-
children:
|
|
3704
|
-
},
|
|
3705
|
-
children:
|
|
3706
|
-
},
|
|
3707
|
-
return
|
|
3708
|
-
children:
|
|
3709
|
-
},
|
|
3710
|
-
},
|
|
3702
|
+
}), r = $e(t, Os, (s, i) => l("a", {
|
|
3703
|
+
class: Qt,
|
|
3704
|
+
href: s,
|
|
3705
|
+
children: s
|
|
3706
|
+
}, s + i)), n = $e(r, Bs, (s, i) => l("em", {
|
|
3707
|
+
children: s
|
|
3708
|
+
}, s + i));
|
|
3709
|
+
return $e(n, Ps, (s, i) => l("strong", {
|
|
3710
|
+
children: s
|
|
3711
|
+
}, s + i));
|
|
3712
|
+
}, 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", {
|
|
3711
3713
|
variants: {
|
|
3712
3714
|
side: {
|
|
3713
3715
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -3721,24 +3723,24 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3721
3723
|
defaultVariants: {
|
|
3722
3724
|
side: "left"
|
|
3723
3725
|
}
|
|
3724
|
-
}),
|
|
3726
|
+
}), zs = ({
|
|
3725
3727
|
children: e,
|
|
3726
3728
|
className: t,
|
|
3727
3729
|
animate: r,
|
|
3728
3730
|
side: n,
|
|
3729
|
-
...
|
|
3731
|
+
...a
|
|
3730
3732
|
}) => l("p", {
|
|
3731
3733
|
style: {
|
|
3732
3734
|
transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
|
|
3733
3735
|
},
|
|
3734
|
-
class:
|
|
3736
|
+
class: js({
|
|
3735
3737
|
className: t,
|
|
3736
3738
|
side: n,
|
|
3737
3739
|
animate: r
|
|
3738
3740
|
}),
|
|
3739
|
-
...
|
|
3741
|
+
...a,
|
|
3740
3742
|
children: e
|
|
3741
|
-
}),
|
|
3743
|
+
}), qs = ({
|
|
3742
3744
|
message: e
|
|
3743
3745
|
}) => l("div", {
|
|
3744
3746
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -3762,7 +3764,7 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3762
3764
|
})
|
|
3763
3765
|
})]
|
|
3764
3766
|
})
|
|
3765
|
-
}),
|
|
3767
|
+
}), Us = ({
|
|
3766
3768
|
className: e,
|
|
3767
3769
|
...t
|
|
3768
3770
|
}) => (ue(() => {
|
|
@@ -3771,7 +3773,7 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3771
3773
|
"aria-hidden": !0,
|
|
3772
3774
|
children: z.isBotTyping$.value === !0 ? l("div", {
|
|
3773
3775
|
"aria-label": "Typing…",
|
|
3774
|
-
class:
|
|
3776
|
+
class: Te("flex gap-1 p-4", e),
|
|
3775
3777
|
...t,
|
|
3776
3778
|
children: Array.from({
|
|
3777
3779
|
length: 3
|
|
@@ -3782,10 +3784,10 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3782
3784
|
}
|
|
3783
3785
|
}))
|
|
3784
3786
|
}) : void 0
|
|
3785
|
-
})),
|
|
3787
|
+
})), Ks = {
|
|
3786
3788
|
bot: "left",
|
|
3787
3789
|
user: "right"
|
|
3788
|
-
},
|
|
3790
|
+
}, 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)]", {
|
|
3789
3791
|
variants: {
|
|
3790
3792
|
variant: {
|
|
3791
3793
|
info: "text-neutral-8",
|
|
@@ -3794,7 +3796,7 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3794
3796
|
success: "text-[#4CAF50]"
|
|
3795
3797
|
}
|
|
3796
3798
|
}
|
|
3797
|
-
}),
|
|
3799
|
+
}), Hs = ({
|
|
3798
3800
|
lastSentMessageFooter: e
|
|
3799
3801
|
}) => {
|
|
3800
3802
|
var r;
|
|
@@ -3804,51 +3806,51 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3804
3806
|
}, [t.length]), l("ol", {
|
|
3805
3807
|
"aria-label": "Chat messages",
|
|
3806
3808
|
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
3807
|
-
children: [t.map((n,
|
|
3809
|
+
children: [t.map((n, a) => l(ke, {
|
|
3808
3810
|
children: l("li", {
|
|
3809
3811
|
class: "flex",
|
|
3810
3812
|
children: Ke(n).with({
|
|
3811
3813
|
type: "system"
|
|
3812
|
-
}, (
|
|
3813
|
-
class:
|
|
3814
|
-
variant:
|
|
3814
|
+
}, (s) => l("p", {
|
|
3815
|
+
class: Gs({
|
|
3816
|
+
variant: s.variant
|
|
3815
3817
|
}),
|
|
3816
|
-
children:
|
|
3818
|
+
children: s.text
|
|
3817
3819
|
})).with({
|
|
3818
3820
|
type: "text",
|
|
3819
|
-
author:
|
|
3820
|
-
}, (
|
|
3821
|
-
const i =
|
|
3822
|
-
return l(
|
|
3821
|
+
author: V.union("bot", "user")
|
|
3822
|
+
}, (s) => {
|
|
3823
|
+
const i = s.author === "user" && !t.slice(a + 1).some((p) => p.type === "text" && p.author === "user"), u = a === t.length - 1, d = s.author === "bot" ? $s(s.text) : s.text;
|
|
3824
|
+
return l(zs, {
|
|
3823
3825
|
animate: u,
|
|
3824
|
-
side:
|
|
3826
|
+
side: Ks[s.author],
|
|
3825
3827
|
children: [d, i ? e : null]
|
|
3826
|
-
},
|
|
3828
|
+
}, a);
|
|
3827
3829
|
}).with({
|
|
3828
3830
|
type: "link"
|
|
3829
|
-
}, (
|
|
3830
|
-
message:
|
|
3831
|
+
}, (s) => l(qs, {
|
|
3832
|
+
message: s
|
|
3831
3833
|
})).with({
|
|
3832
3834
|
type: "image"
|
|
3833
|
-
}, (
|
|
3835
|
+
}, (s) => l("img", {
|
|
3834
3836
|
class: "shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",
|
|
3835
|
-
src:
|
|
3837
|
+
src: s.url,
|
|
3836
3838
|
style: {
|
|
3837
|
-
aspectRatio:
|
|
3839
|
+
aspectRatio: s.width / s.height
|
|
3838
3840
|
}
|
|
3839
3841
|
})).with({
|
|
3840
3842
|
type: "file"
|
|
3841
|
-
}, (
|
|
3842
|
-
class:
|
|
3843
|
+
}, (s) => l(Rn, {
|
|
3844
|
+
class: s.author === "bot" ? void 0 : "ml-auto",
|
|
3843
3845
|
file: {
|
|
3844
|
-
name:
|
|
3845
|
-
sizeKb:
|
|
3846
|
+
name: s.fileName,
|
|
3847
|
+
sizeKb: s.fileSizeKb
|
|
3846
3848
|
}
|
|
3847
3849
|
})).with({
|
|
3848
3850
|
type: "loading"
|
|
3849
|
-
}, (
|
|
3851
|
+
}, (s) => {
|
|
3850
3852
|
const i = t[t.length - 1];
|
|
3851
|
-
return !(
|
|
3853
|
+
return !(s === i) || z.isBotTyping$.value ? null : l("div", {
|
|
3852
3854
|
class: "flex flex-grow flex-col items-center justify-center",
|
|
3853
3855
|
children: l(Gr, {
|
|
3854
3856
|
class: "text-neutral-6 h-8 w-8"
|
|
@@ -3856,9 +3858,9 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3856
3858
|
});
|
|
3857
3859
|
}).exhaustive()
|
|
3858
3860
|
})
|
|
3859
|
-
},
|
|
3861
|
+
}, a)), l(Us, {}, "typing")]
|
|
3860
3862
|
});
|
|
3861
|
-
},
|
|
3863
|
+
}, ra = ({
|
|
3862
3864
|
logger: e,
|
|
3863
3865
|
apiClient: t,
|
|
3864
3866
|
analytics: r
|
|
@@ -3867,45 +3869,45 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3867
3869
|
flow: n
|
|
3868
3870
|
} = M.current$.value;
|
|
3869
3871
|
le(n, "Flow is required to exist to show chatbot body");
|
|
3870
|
-
const
|
|
3871
|
-
chatRef:
|
|
3872
|
+
const a = M.viewState$.value, {
|
|
3873
|
+
chatRef: s,
|
|
3872
3874
|
chatService: i
|
|
3873
3875
|
} = _n(), {
|
|
3874
3876
|
t: u
|
|
3875
|
-
} =
|
|
3877
|
+
} = G(), [d, p] = Y();
|
|
3876
3878
|
return pe(() => {
|
|
3877
|
-
|
|
3878
|
-
}, [
|
|
3879
|
-
var S,
|
|
3879
|
+
a === "maximised" && z.scrollToEnd.instant();
|
|
3880
|
+
}, [a]), pe(() => {
|
|
3881
|
+
var S, E;
|
|
3880
3882
|
const {
|
|
3881
3883
|
state: x,
|
|
3882
|
-
flow:
|
|
3884
|
+
flow: v
|
|
3883
3885
|
} = M.current$.peek();
|
|
3884
3886
|
if (x !== "loaded")
|
|
3885
3887
|
throw new Error(u("invalid_state"));
|
|
3886
|
-
let
|
|
3887
|
-
if (z.scrollToEnd.instant(), M.setInput(void 0),
|
|
3888
|
+
let h = v.data.nodeHistory.at(-1);
|
|
3889
|
+
if (z.scrollToEnd.instant(), M.setInput(void 0), v.data.isFinished)
|
|
3888
3890
|
return;
|
|
3889
|
-
|
|
3891
|
+
h === void 0 ? (h = er(n.nodes).id, M.setCurrentNodeId(h), r.log({
|
|
3890
3892
|
event: "FLOW_START",
|
|
3891
3893
|
properties: {
|
|
3892
3894
|
flow_id: n.id,
|
|
3893
3895
|
flow_version: n.version,
|
|
3894
|
-
flow_session_id:
|
|
3896
|
+
flow_session_id: v.data.flowSessionId,
|
|
3895
3897
|
flow_build: n.build,
|
|
3896
3898
|
job: n.job
|
|
3897
3899
|
},
|
|
3898
3900
|
customProperties: (S = n.analytics) == null ? void 0 : S.customProperties
|
|
3899
|
-
})) : M.removeMessagesSentByNodeIds([
|
|
3901
|
+
})) : M.removeMessagesSentByNodeIds([h]);
|
|
3900
3902
|
const {
|
|
3901
|
-
interpret:
|
|
3902
|
-
abort:
|
|
3903
|
-
undo:
|
|
3903
|
+
interpret: k,
|
|
3904
|
+
abort: y,
|
|
3905
|
+
undo: A
|
|
3904
3906
|
} = Jr({
|
|
3905
3907
|
context: n.context,
|
|
3906
3908
|
analytics: {
|
|
3907
3909
|
service: r,
|
|
3908
|
-
customProperties: (
|
|
3910
|
+
customProperties: (E = n.analytics) == null ? void 0 : E.customProperties
|
|
3909
3911
|
},
|
|
3910
3912
|
apiClient: t,
|
|
3911
3913
|
logger: e,
|
|
@@ -3917,15 +3919,15 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3917
3919
|
var g;
|
|
3918
3920
|
return (g = M.current$.peek().flow) == null ? void 0 : g.data.submissions;
|
|
3919
3921
|
},
|
|
3920
|
-
onInterpret: (g,
|
|
3922
|
+
onInterpret: (g, N) => {
|
|
3921
3923
|
var D;
|
|
3922
3924
|
const P = M.current$.peek().flow;
|
|
3923
|
-
le(P),
|
|
3925
|
+
le(P), N && (P.data.sequence = P.data.sequence + 1, r.log({
|
|
3924
3926
|
event: "FLOW_NODE",
|
|
3925
3927
|
properties: {
|
|
3926
3928
|
flow_id: n.id,
|
|
3927
3929
|
flow_version: n.version,
|
|
3928
|
-
from_node_id:
|
|
3930
|
+
from_node_id: N.id,
|
|
3929
3931
|
flow_build: n.build,
|
|
3930
3932
|
to_node_id: g.id,
|
|
3931
3933
|
sequence: P.data.sequence,
|
|
@@ -3936,7 +3938,7 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3936
3938
|
})), M.setCurrentNodeId(g.id);
|
|
3937
3939
|
},
|
|
3938
3940
|
onFlowEnd: async () => {
|
|
3939
|
-
var
|
|
3941
|
+
var N;
|
|
3940
3942
|
M.markAsFinished();
|
|
3941
3943
|
const g = M.current$.peek().flow;
|
|
3942
3944
|
le(g), r.log({
|
|
@@ -3948,21 +3950,21 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3948
3950
|
flow_build: n.build,
|
|
3949
3951
|
job: n.job
|
|
3950
3952
|
},
|
|
3951
|
-
customProperties: (
|
|
3953
|
+
customProperties: (N = n.analytics) == null ? void 0 : N.customProperties
|
|
3952
3954
|
});
|
|
3953
3955
|
}
|
|
3954
3956
|
});
|
|
3955
|
-
return
|
|
3957
|
+
return p(() => A), k(h), y;
|
|
3956
3958
|
}, [r, t, i, e, n, u]), l(ke, {
|
|
3957
3959
|
children: [l("div", {
|
|
3958
|
-
ref:
|
|
3960
|
+
ref: s,
|
|
3959
3961
|
className: "hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",
|
|
3960
3962
|
style: {
|
|
3961
3963
|
WebkitOverflowScrolling: "touch",
|
|
3962
3964
|
paddingBottom: M.inputHeight$.value
|
|
3963
3965
|
},
|
|
3964
|
-
children: l(
|
|
3965
|
-
lastSentMessageFooter: n.data.isFinished || !d ? null : l(
|
|
3966
|
+
children: l(Hs, {
|
|
3967
|
+
lastSentMessageFooter: n.data.isFinished || !d ? null : l(Js, {
|
|
3966
3968
|
undoFn: d
|
|
3967
3969
|
})
|
|
3968
3970
|
})
|
|
@@ -3970,12 +3972,12 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3970
3972
|
logger: e
|
|
3971
3973
|
})]
|
|
3972
3974
|
});
|
|
3973
|
-
},
|
|
3975
|
+
}, 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 = ({
|
|
3974
3976
|
undoFn: e
|
|
3975
3977
|
}) => {
|
|
3976
3978
|
const {
|
|
3977
3979
|
t
|
|
3978
|
-
} =
|
|
3980
|
+
} = G();
|
|
3979
3981
|
return l("div", {
|
|
3980
3982
|
class: "absolute bottom-0 right-0 flex w-full translate-y-full justify-end",
|
|
3981
3983
|
children: l("button", {
|
|
@@ -3987,8 +3989,8 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3987
3989
|
le(r);
|
|
3988
3990
|
const {
|
|
3989
3991
|
removed: n
|
|
3990
|
-
} = e(r.data.nodeHistory),
|
|
3991
|
-
|
|
3992
|
+
} = e(r.data.nodeHistory), a = r.data.nodeHistory.splice(-n);
|
|
3993
|
+
a.length !== 0 && (M.removeMessagesSentByNodeIds(a), M.setInput(void 0), a.pop(), a.map((s) => r.nodes.find((i) => i.id === s)).filter(Boolean).flatMap(Ws).forEach((s) => delete r.data.submissions[s]), M.current$.value = {
|
|
3992
3994
|
...M.current$.value
|
|
3993
3995
|
});
|
|
3994
3996
|
},
|
|
@@ -3997,5 +3999,5 @@ const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]
|
|
|
3997
3999
|
});
|
|
3998
4000
|
};
|
|
3999
4001
|
export {
|
|
4000
|
-
|
|
4002
|
+
ra as ChatbotBody
|
|
4001
4003
|
};
|