@inploi/plugin-chatbot 4.4.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.js +3 -3
- package/dist/{chatbot-body-78dc7e6c.js → chatbot-body-81bfa2bc.js} +518 -518
- package/dist/{chatbot-body-b911ba6f.cjs → chatbot-body-f17e1b0d.cjs} +1 -1
- package/dist/chatbot.api.d.ts +51 -1984
- package/dist/chatbot.d.ts +2 -1
- package/dist/chatbot.utils.d.ts +1 -1
- package/dist/index-4da34b43.js +3763 -0
- package/dist/index-610bb8d8.cjs +5 -0
- package/dist/mocks/flows.mocks.d.ts +6 -2
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/rpc.d.ts +495 -0
- package/package.json +7 -7
- package/dist/index-2066a89b.cjs +0 -5
- package/dist/index-2463356b.js +0 -3621
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as Ke, i as er, k as Te, a as tr, b as le, A as Le, c as Mr, N as Ge, _ as D, d as rr, h as ee, e as re, p as ue, F as mt, u as G, o as l, f as Re, j as ft, y as pe, s as I, l as Xe, m as ve, n as Fr, q as he, r as Lr, t as it, v as X, w as Nr, x as nr, z as Tr, B as sr, C as Dr, D as Ce, E as Y, G as Rr, V as Or, H as be, I as De, J as ze, K as ar, 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, W as Hr, X as Wr } from "./index-4da34b43.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
|
-
const
|
|
3
|
+
const Lt = ({
|
|
4
4
|
condition: e,
|
|
5
5
|
context: t,
|
|
6
6
|
submissions: r,
|
|
@@ -9,7 +9,7 @@ const Ft = ({
|
|
|
9
9
|
const [s, ...a] = e.compareKey.split(".");
|
|
10
10
|
if (!s)
|
|
11
11
|
return !1;
|
|
12
|
-
const i =
|
|
12
|
+
const i = or({
|
|
13
13
|
context: t,
|
|
14
14
|
key: s,
|
|
15
15
|
path: a,
|
|
@@ -19,7 +19,7 @@ const Ft = ({
|
|
|
19
19
|
return !1;
|
|
20
20
|
switch (i.type) {
|
|
21
21
|
case "address": {
|
|
22
|
-
const u =
|
|
22
|
+
const u = Ke(i.value, a.join("."));
|
|
23
23
|
switch (e.compare) {
|
|
24
24
|
case "equals":
|
|
25
25
|
return u === e.compareValue;
|
|
@@ -35,7 +35,7 @@ const Ft = ({
|
|
|
35
35
|
case "integration": {
|
|
36
36
|
if (typeof i.value != "object" || Array.isArray(i.value))
|
|
37
37
|
return !1;
|
|
38
|
-
const u =
|
|
38
|
+
const u = Ke(i.value, a.join(".")), d = {
|
|
39
39
|
...n,
|
|
40
40
|
data: {
|
|
41
41
|
...n.data,
|
|
@@ -44,7 +44,7 @@ const Ft = ({
|
|
|
44
44
|
};
|
|
45
45
|
switch (typeof u) {
|
|
46
46
|
case "boolean":
|
|
47
|
-
return
|
|
47
|
+
return Ne(d, {
|
|
48
48
|
submissions: {
|
|
49
49
|
_temp: {
|
|
50
50
|
value: u,
|
|
@@ -54,7 +54,7 @@ const Ft = ({
|
|
|
54
54
|
context: t
|
|
55
55
|
});
|
|
56
56
|
case "string":
|
|
57
|
-
return
|
|
57
|
+
return Ne(d, {
|
|
58
58
|
submissions: {
|
|
59
59
|
_temp: {
|
|
60
60
|
value: u,
|
|
@@ -64,7 +64,7 @@ const Ft = ({
|
|
|
64
64
|
context: t
|
|
65
65
|
});
|
|
66
66
|
case "number":
|
|
67
|
-
return
|
|
67
|
+
return Ne(d, {
|
|
68
68
|
submissions: {
|
|
69
69
|
_temp: {
|
|
70
70
|
value: u,
|
|
@@ -74,7 +74,7 @@ const Ft = ({
|
|
|
74
74
|
context: t
|
|
75
75
|
});
|
|
76
76
|
case "object":
|
|
77
|
-
return Array.isArray(u) && u.every(
|
|
77
|
+
return Array.isArray(u) && u.every(er) ? Ne(d, {
|
|
78
78
|
submissions: {
|
|
79
79
|
_temp: {
|
|
80
80
|
value: u,
|
|
@@ -98,7 +98,7 @@ const Ft = ({
|
|
|
98
98
|
}
|
|
99
99
|
case "phone":
|
|
100
100
|
case "string": {
|
|
101
|
-
const u = i.type === "phone" ?
|
|
101
|
+
const u = i.type === "phone" ? Qe(i.value) : i.value;
|
|
102
102
|
switch (e.compare) {
|
|
103
103
|
case "equals":
|
|
104
104
|
return u === e.compareValue;
|
|
@@ -146,14 +146,14 @@ const Ft = ({
|
|
|
146
146
|
}
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, Ne = (e, {
|
|
150
150
|
context: t,
|
|
151
151
|
submissions: r
|
|
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
155
|
for (const a of n)
|
|
156
|
-
if (
|
|
156
|
+
if (Lt({
|
|
157
157
|
condition: a,
|
|
158
158
|
context: t,
|
|
159
159
|
submissions: r,
|
|
@@ -163,7 +163,7 @@ const Ft = ({
|
|
|
163
163
|
return !1;
|
|
164
164
|
} else {
|
|
165
165
|
for (const a of n)
|
|
166
|
-
if (!
|
|
166
|
+
if (!Lt({
|
|
167
167
|
condition: a,
|
|
168
168
|
context: t,
|
|
169
169
|
submissions: r,
|
|
@@ -172,11 +172,11 @@ const Ft = ({
|
|
|
172
172
|
return !1;
|
|
173
173
|
return !0;
|
|
174
174
|
}
|
|
175
|
-
},
|
|
175
|
+
}, Jr = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, ne = (e, {
|
|
176
176
|
context: t,
|
|
177
177
|
submissions: r
|
|
178
|
-
}) => e.replace(
|
|
179
|
-
const [i, ...u] = s.trim().split("."), d =
|
|
178
|
+
}) => e.replace(Jr, (n, s, a = "") => {
|
|
179
|
+
const [i, ...u] = s.trim().split("."), d = or({
|
|
180
180
|
key: i,
|
|
181
181
|
path: u,
|
|
182
182
|
submissions: r,
|
|
@@ -188,7 +188,7 @@ const Ft = ({
|
|
|
188
188
|
case "boolean":
|
|
189
189
|
return d.value === !0 ? "true" : "false";
|
|
190
190
|
case "file":
|
|
191
|
-
return d.value.map((p) => `${p.name} (${
|
|
191
|
+
return d.value.map((p) => `${p.name} (${Te(p.sizeKb)})`).join(", ");
|
|
192
192
|
case "enum":
|
|
193
193
|
return d.value.join(", ");
|
|
194
194
|
case "address":
|
|
@@ -197,11 +197,11 @@ const Ft = ({
|
|
|
197
197
|
case "string":
|
|
198
198
|
return d.value ? d.value.toString() : a;
|
|
199
199
|
case "phone":
|
|
200
|
-
return
|
|
200
|
+
return Qe(d.value);
|
|
201
201
|
case "integration": {
|
|
202
202
|
if (typeof d.value != "object" || Array.isArray(d.value))
|
|
203
203
|
break;
|
|
204
|
-
const p =
|
|
204
|
+
const p = Ke(d.value, u.join("."));
|
|
205
205
|
switch (typeof p) {
|
|
206
206
|
case "boolean":
|
|
207
207
|
return p === !0 ? "true" : "false";
|
|
@@ -210,14 +210,14 @@ const Ft = ({
|
|
|
210
210
|
case "number":
|
|
211
211
|
return p.toString();
|
|
212
212
|
case "object":
|
|
213
|
-
if (Array.isArray(p) && p.every(
|
|
213
|
+
if (Array.isArray(p) && p.every(er))
|
|
214
214
|
return p.join(", ");
|
|
215
215
|
}
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
return a;
|
|
220
|
-
}),
|
|
220
|
+
}), ir = ({
|
|
221
221
|
node: e,
|
|
222
222
|
nodes: t,
|
|
223
223
|
stopWhen: r
|
|
@@ -226,12 +226,12 @@ const Ft = ({
|
|
|
226
226
|
return e;
|
|
227
227
|
const n = e.nextId ? t.find((s) => s.id === e.nextId) : void 0;
|
|
228
228
|
if (n)
|
|
229
|
-
return
|
|
229
|
+
return ir({
|
|
230
230
|
node: n,
|
|
231
231
|
nodes: t,
|
|
232
232
|
stopWhen: r
|
|
233
233
|
});
|
|
234
|
-
},
|
|
234
|
+
}, Zr = ({
|
|
235
235
|
childNode: e,
|
|
236
236
|
nodes: t
|
|
237
237
|
}) => {
|
|
@@ -241,7 +241,7 @@ const Ft = ({
|
|
|
241
241
|
const a = t.find((u) => u.id === s.branchId);
|
|
242
242
|
if (!a)
|
|
243
243
|
return !1;
|
|
244
|
-
const i =
|
|
244
|
+
const i = ir({
|
|
245
245
|
node: a,
|
|
246
246
|
nodes: t,
|
|
247
247
|
stopWhen: (u) => u.id === e.id
|
|
@@ -250,7 +250,7 @@ const Ft = ({
|
|
|
250
250
|
});
|
|
251
251
|
if (n != null && n.nextId)
|
|
252
252
|
return t.find((s) => s.id === n.nextId);
|
|
253
|
-
},
|
|
253
|
+
}, Xr = ({
|
|
254
254
|
flow: e,
|
|
255
255
|
analytics: t,
|
|
256
256
|
logger: r,
|
|
@@ -276,7 +276,7 @@ const Ft = ({
|
|
|
276
276
|
const A = a();
|
|
277
277
|
d == null || d(k, b);
|
|
278
278
|
try {
|
|
279
|
-
await
|
|
279
|
+
await Qr({
|
|
280
280
|
flow: e,
|
|
281
281
|
analytics: v,
|
|
282
282
|
logger: r,
|
|
@@ -298,7 +298,7 @@ const Ft = ({
|
|
|
298
298
|
addToSubmissions: i.addToSubmissions
|
|
299
299
|
},
|
|
300
300
|
next: (S) => {
|
|
301
|
-
const E = S ? e.nodes.find((g) => g.id === S) :
|
|
301
|
+
const E = S ? e.nodes.find((g) => g.id === S) : Zr({
|
|
302
302
|
childNode: k,
|
|
303
303
|
nodes: e.nodes
|
|
304
304
|
});
|
|
@@ -307,14 +307,14 @@ const Ft = ({
|
|
|
307
307
|
end: () => u == null ? void 0 : u(k)
|
|
308
308
|
});
|
|
309
309
|
} catch (S) {
|
|
310
|
-
if (S instanceof
|
|
310
|
+
if (S instanceof Le)
|
|
311
311
|
return;
|
|
312
312
|
throw S;
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
return {
|
|
316
316
|
interpret: async (k) => {
|
|
317
|
-
const b = e.nodes.find((A) => A.id === k) ??
|
|
317
|
+
const b = e.nodes.find((A) => A.id === k) ?? tr(e.nodes);
|
|
318
318
|
return h(b);
|
|
319
319
|
},
|
|
320
320
|
undo: (k) => {
|
|
@@ -335,94 +335,94 @@ const Ft = ({
|
|
|
335
335
|
w.abort();
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
},
|
|
339
|
-
async function
|
|
338
|
+
}, Qe = (e) => `+${e.countryCode} ${e.phoneNumber}`;
|
|
339
|
+
async function Qr(e) {
|
|
340
340
|
const t = e.node;
|
|
341
341
|
switch (t.type) {
|
|
342
342
|
case "text":
|
|
343
|
-
return
|
|
343
|
+
return on({
|
|
344
344
|
...e,
|
|
345
345
|
node: t
|
|
346
346
|
});
|
|
347
347
|
case "image":
|
|
348
|
-
return
|
|
348
|
+
return ln({
|
|
349
349
|
...e,
|
|
350
350
|
node: t
|
|
351
351
|
});
|
|
352
352
|
case "question-text":
|
|
353
|
-
return
|
|
353
|
+
return un({
|
|
354
354
|
...e,
|
|
355
355
|
node: t
|
|
356
356
|
});
|
|
357
357
|
case "question-enum":
|
|
358
|
-
return
|
|
358
|
+
return fn({
|
|
359
359
|
...e,
|
|
360
360
|
node: t
|
|
361
361
|
});
|
|
362
362
|
case "question-number":
|
|
363
|
-
return
|
|
363
|
+
return cn({
|
|
364
364
|
...e,
|
|
365
365
|
node: t
|
|
366
366
|
});
|
|
367
367
|
case "question-phone":
|
|
368
|
-
return
|
|
368
|
+
return dn({
|
|
369
369
|
...e,
|
|
370
370
|
node: t
|
|
371
371
|
});
|
|
372
372
|
case "question-boolean":
|
|
373
|
-
return
|
|
373
|
+
return hn({
|
|
374
374
|
...e,
|
|
375
375
|
node: t
|
|
376
376
|
});
|
|
377
377
|
case "question-file":
|
|
378
|
-
return
|
|
378
|
+
return mn({
|
|
379
379
|
...e,
|
|
380
380
|
node: t
|
|
381
381
|
});
|
|
382
382
|
case "question-address":
|
|
383
|
-
return
|
|
383
|
+
return pn({
|
|
384
384
|
...e,
|
|
385
385
|
node: t
|
|
386
386
|
});
|
|
387
387
|
case "end-flow":
|
|
388
|
-
return
|
|
388
|
+
return gn({
|
|
389
389
|
...e,
|
|
390
390
|
node: t
|
|
391
391
|
});
|
|
392
392
|
case "if-block":
|
|
393
|
-
return
|
|
393
|
+
return an({
|
|
394
394
|
...e,
|
|
395
395
|
node: t
|
|
396
396
|
});
|
|
397
397
|
case "jump":
|
|
398
|
-
return
|
|
398
|
+
return tn({
|
|
399
399
|
...e,
|
|
400
400
|
node: t
|
|
401
401
|
});
|
|
402
402
|
case "link":
|
|
403
|
-
return
|
|
403
|
+
return sn({
|
|
404
404
|
...e,
|
|
405
405
|
node: t
|
|
406
406
|
});
|
|
407
407
|
case "integration-application-submit":
|
|
408
|
-
return
|
|
408
|
+
return nn({
|
|
409
409
|
...e,
|
|
410
410
|
node: t
|
|
411
411
|
});
|
|
412
412
|
case "add-submission":
|
|
413
|
-
return
|
|
413
|
+
return rn({
|
|
414
414
|
...e,
|
|
415
415
|
node: t
|
|
416
416
|
});
|
|
417
417
|
case "integration-workflow-get":
|
|
418
418
|
throw Error("Workflow should be unreachable");
|
|
419
419
|
case "identify":
|
|
420
|
-
return
|
|
420
|
+
return en({
|
|
421
421
|
...e,
|
|
422
422
|
node: t
|
|
423
423
|
});
|
|
424
424
|
case "feedback":
|
|
425
|
-
return
|
|
425
|
+
return Yr({
|
|
426
426
|
...e,
|
|
427
427
|
node: t
|
|
428
428
|
});
|
|
@@ -430,20 +430,20 @@ async function Xr(e) {
|
|
|
430
430
|
throw new Error(`Unknown node: ${JSON.stringify(t)}`);
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
const
|
|
433
|
+
const Ie = (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 Yr({
|
|
441
441
|
next: e,
|
|
442
442
|
node: t
|
|
443
443
|
}) {
|
|
444
444
|
e(t.nextId);
|
|
445
445
|
}
|
|
446
|
-
async function
|
|
446
|
+
async function en({
|
|
447
447
|
next: e,
|
|
448
448
|
node: t,
|
|
449
449
|
analytics: r,
|
|
@@ -456,11 +456,11 @@ async function Yr({
|
|
|
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: Ie(n, t.data.key).toString(),
|
|
460
|
+
first_name: t.data.firstName ? Ie(n, t.data.firstName).toString() : void 0,
|
|
461
|
+
last_name: t.data.lastName ? Ie(n, t.data.lastName).toString() : void 0,
|
|
462
|
+
email: t.data.email ? Ie(n, t.data.email).toString() : void 0,
|
|
463
|
+
phone_number: t.data.phoneNumber ? Ie(n, t.data.phoneNumber).toString() : void 0,
|
|
464
464
|
custom_traits: t.data.customTraits ? Object.fromEntries(t.data.customTraits.map(({
|
|
465
465
|
key: a,
|
|
466
466
|
value: i
|
|
@@ -476,13 +476,13 @@ async function Yr({
|
|
|
476
476
|
e(t.nextId);
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
async function
|
|
479
|
+
async function tn({
|
|
480
480
|
next: e,
|
|
481
481
|
node: t
|
|
482
482
|
}) {
|
|
483
483
|
e(t.data.targetId);
|
|
484
484
|
}
|
|
485
|
-
async function
|
|
485
|
+
async function rn({
|
|
486
486
|
next: e,
|
|
487
487
|
node: t,
|
|
488
488
|
logger: r,
|
|
@@ -501,7 +501,7 @@ async function tn({
|
|
|
501
501
|
})
|
|
502
502
|
}, e(t.nextId);
|
|
503
503
|
}
|
|
504
|
-
async function
|
|
504
|
+
async function nn({
|
|
505
505
|
chat: e,
|
|
506
506
|
next: t,
|
|
507
507
|
node: r,
|
|
@@ -533,13 +533,13 @@ async function rn({
|
|
|
533
533
|
anonymous_id: v,
|
|
534
534
|
session_id: h,
|
|
535
535
|
job: u.job,
|
|
536
|
-
submissions:
|
|
536
|
+
submissions: Mr(a || {})
|
|
537
537
|
})
|
|
538
538
|
}).catch((b) => b);
|
|
539
539
|
r.data.key && e.addToSubmissions(r.data.key, {
|
|
540
540
|
type: "integration",
|
|
541
541
|
value: k
|
|
542
|
-
}),
|
|
542
|
+
}), Ge(k).with({
|
|
543
543
|
integration_response: D.select(D.union({
|
|
544
544
|
service: D.optional(D.string),
|
|
545
545
|
status: D.number,
|
|
@@ -569,7 +569,7 @@ async function rn({
|
|
|
569
569
|
}
|
|
570
570
|
});
|
|
571
571
|
}).otherwise(() => {
|
|
572
|
-
}), await
|
|
572
|
+
}), await Ge(k).with({
|
|
573
573
|
integration_response: {
|
|
574
574
|
data: D.select("redirect", {
|
|
575
575
|
redirect_url: D.string,
|
|
@@ -645,7 +645,7 @@ async function rn({
|
|
|
645
645
|
};
|
|
646
646
|
await p(r.data.skipConfirmation);
|
|
647
647
|
}
|
|
648
|
-
async function
|
|
648
|
+
async function sn({
|
|
649
649
|
chat: e,
|
|
650
650
|
next: t,
|
|
651
651
|
node: r,
|
|
@@ -664,18 +664,18 @@ async function nn({
|
|
|
664
664
|
})
|
|
665
665
|
}), t(r.nextId);
|
|
666
666
|
}
|
|
667
|
-
async function
|
|
667
|
+
async function an({
|
|
668
668
|
submissions: e,
|
|
669
669
|
next: t,
|
|
670
670
|
node: r,
|
|
671
671
|
context: n
|
|
672
672
|
}) {
|
|
673
|
-
t(
|
|
673
|
+
t(Ne(r, {
|
|
674
674
|
submissions: e,
|
|
675
675
|
context: n
|
|
676
676
|
}) ? r.branchId : r.nextId);
|
|
677
677
|
}
|
|
678
|
-
async function
|
|
678
|
+
async function on({
|
|
679
679
|
chat: e,
|
|
680
680
|
next: t,
|
|
681
681
|
node: r,
|
|
@@ -691,7 +691,7 @@ async function an({
|
|
|
691
691
|
})
|
|
692
692
|
}), t(r.nextId);
|
|
693
693
|
}
|
|
694
|
-
async function
|
|
694
|
+
async function ln({
|
|
695
695
|
chat: e,
|
|
696
696
|
next: t,
|
|
697
697
|
node: r
|
|
@@ -704,7 +704,7 @@ async function on({
|
|
|
704
704
|
width: r.data.width
|
|
705
705
|
}), t(r.nextId);
|
|
706
706
|
}
|
|
707
|
-
async function
|
|
707
|
+
async function un({
|
|
708
708
|
chat: e,
|
|
709
709
|
next: t,
|
|
710
710
|
node: r,
|
|
@@ -748,10 +748,10 @@ async function ln({
|
|
|
748
748
|
}) : await e.sendMessage({
|
|
749
749
|
author: "user",
|
|
750
750
|
type: "text",
|
|
751
|
-
text: i.type === "phone" ?
|
|
751
|
+
text: i.type === "phone" ? Qe(i.value) : i.value
|
|
752
752
|
}), t(r.nextId);
|
|
753
753
|
}
|
|
754
|
-
async function
|
|
754
|
+
async function cn({
|
|
755
755
|
chat: e,
|
|
756
756
|
next: t,
|
|
757
757
|
node: r,
|
|
@@ -788,7 +788,7 @@ async function un({
|
|
|
788
788
|
text: i.value.toString()
|
|
789
789
|
}), t(r.nextId);
|
|
790
790
|
}
|
|
791
|
-
async function
|
|
791
|
+
async function dn({
|
|
792
792
|
chat: e,
|
|
793
793
|
next: t,
|
|
794
794
|
node: r,
|
|
@@ -823,10 +823,10 @@ async function cn({
|
|
|
823
823
|
}) : await e.sendMessage({
|
|
824
824
|
author: "user",
|
|
825
825
|
type: "text",
|
|
826
|
-
text: a.type === "phone" ?
|
|
826
|
+
text: a.type === "phone" ? Qe(a.value) : a.value
|
|
827
827
|
}), t(r.nextId);
|
|
828
828
|
}
|
|
829
|
-
async function
|
|
829
|
+
async function fn({
|
|
830
830
|
chat: e,
|
|
831
831
|
next: t,
|
|
832
832
|
node: r,
|
|
@@ -857,7 +857,7 @@ async function dn({
|
|
|
857
857
|
text: r.data.options.filter((u) => i.value.includes(u.value)).map((u) => u.label).join(", ")
|
|
858
858
|
}), t(r.nextId);
|
|
859
859
|
}
|
|
860
|
-
async function
|
|
860
|
+
async function hn({
|
|
861
861
|
chat: e,
|
|
862
862
|
next: t,
|
|
863
863
|
node: r,
|
|
@@ -894,7 +894,7 @@ async function fn({
|
|
|
894
894
|
text: i.value === !0 ? r.data.trueLabel : r.data.falseLabel
|
|
895
895
|
}), t(r.nextId);
|
|
896
896
|
}
|
|
897
|
-
async function
|
|
897
|
+
async function pn({
|
|
898
898
|
chat: e,
|
|
899
899
|
next: t,
|
|
900
900
|
node: r,
|
|
@@ -930,7 +930,7 @@ async function hn({
|
|
|
930
930
|
}
|
|
931
931
|
return t(r.nextId);
|
|
932
932
|
}
|
|
933
|
-
async function
|
|
933
|
+
async function mn({
|
|
934
934
|
node: e,
|
|
935
935
|
chat: t,
|
|
936
936
|
next: r,
|
|
@@ -973,7 +973,7 @@ async function pn({
|
|
|
973
973
|
});
|
|
974
974
|
r(e.nextId);
|
|
975
975
|
}
|
|
976
|
-
async function
|
|
976
|
+
async function gn({
|
|
977
977
|
chat: e,
|
|
978
978
|
end: t,
|
|
979
979
|
node: r
|
|
@@ -984,7 +984,7 @@ async function mn({
|
|
|
984
984
|
text: r.data.systemMessage
|
|
985
985
|
}), t();
|
|
986
986
|
}
|
|
987
|
-
const
|
|
987
|
+
const or = ({
|
|
988
988
|
key: e,
|
|
989
989
|
path: t,
|
|
990
990
|
submissions: r,
|
|
@@ -993,7 +993,7 @@ const ir = ({
|
|
|
993
993
|
if (e === "$context") {
|
|
994
994
|
if (!t)
|
|
995
995
|
return;
|
|
996
|
-
const s =
|
|
996
|
+
const s = Ke(n, t.join("."));
|
|
997
997
|
switch (typeof s) {
|
|
998
998
|
case "string":
|
|
999
999
|
return {
|
|
@@ -1017,7 +1017,7 @@ const ir = ({
|
|
|
1017
1017
|
}
|
|
1018
1018
|
return r == null ? void 0 : r[e];
|
|
1019
1019
|
};
|
|
1020
|
-
function
|
|
1020
|
+
function ht(e, t, r) {
|
|
1021
1021
|
var n, s, a, i, u;
|
|
1022
1022
|
t == null && (t = 100);
|
|
1023
1023
|
function d() {
|
|
@@ -1035,10 +1035,10 @@ function ft(e, t, r) {
|
|
|
1035
1035
|
n && (u = e.apply(a, s), a = s = null, clearTimeout(n), n = null);
|
|
1036
1036
|
}, p;
|
|
1037
1037
|
}
|
|
1038
|
-
|
|
1039
|
-
var
|
|
1040
|
-
const
|
|
1041
|
-
function
|
|
1038
|
+
ht.debounce = ht;
|
|
1039
|
+
var yn = ht;
|
|
1040
|
+
const Nt = /* @__PURE__ */ rr(yn);
|
|
1041
|
+
function bn(e) {
|
|
1042
1042
|
let {
|
|
1043
1043
|
debounce: t,
|
|
1044
1044
|
scroll: r,
|
|
@@ -1053,7 +1053,7 @@ function yn(e) {
|
|
|
1053
1053
|
} : window.ResizeObserver);
|
|
1054
1054
|
if (!a)
|
|
1055
1055
|
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");
|
|
1056
|
-
const [i, u] =
|
|
1056
|
+
const [i, u] = ee({
|
|
1057
1057
|
left: 0,
|
|
1058
1058
|
top: 0,
|
|
1059
1059
|
width: 0,
|
|
@@ -1069,7 +1069,7 @@ function yn(e) {
|
|
|
1069
1069
|
lastBounds: i
|
|
1070
1070
|
}), p = t ? typeof t == "number" ? t : t.scroll : null, w = t ? typeof t == "number" ? t : t.resize : null, v = re(!1);
|
|
1071
1071
|
ue(() => (v.current = !0, () => void (v.current = !1)));
|
|
1072
|
-
const [h, k, b] =
|
|
1072
|
+
const [h, k, b] = mt(() => {
|
|
1073
1073
|
const g = () => {
|
|
1074
1074
|
if (!d.current.element)
|
|
1075
1075
|
return;
|
|
@@ -1079,7 +1079,7 @@ function yn(e) {
|
|
|
1079
1079
|
width: N,
|
|
1080
1080
|
height: me,
|
|
1081
1081
|
bottom: ce,
|
|
1082
|
-
right:
|
|
1082
|
+
right: Ae,
|
|
1083
1083
|
x: H,
|
|
1084
1084
|
y: se
|
|
1085
1085
|
} = d.current.element.getBoundingClientRect(), q = {
|
|
@@ -1088,13 +1088,13 @@ function yn(e) {
|
|
|
1088
1088
|
width: N,
|
|
1089
1089
|
height: me,
|
|
1090
1090
|
bottom: ce,
|
|
1091
|
-
right:
|
|
1091
|
+
right: Ae,
|
|
1092
1092
|
x: H,
|
|
1093
1093
|
y: se
|
|
1094
1094
|
};
|
|
1095
|
-
d.current.element instanceof HTMLElement && s && (q.height = d.current.element.offsetHeight, q.width = d.current.element.offsetWidth), Object.freeze(q), v.current && !
|
|
1095
|
+
d.current.element instanceof HTMLElement && s && (q.height = d.current.element.offsetHeight, q.width = d.current.element.offsetWidth), Object.freeze(q), v.current && !_n(d.current.lastBounds, q) && u(d.current.lastBounds = q);
|
|
1096
1096
|
};
|
|
1097
|
-
return [g, w ?
|
|
1097
|
+
return [g, w ? Nt(g, w) : g, p ? Nt(g, p) : g];
|
|
1098
1098
|
}, [u, s, p, w]);
|
|
1099
1099
|
function A() {
|
|
1100
1100
|
d.current.scrollContainers && (d.current.scrollContainers.forEach((g) => g.removeEventListener("scroll", b, !0)), d.current.scrollContainers = null), d.current.resizeObserver && (d.current.resizeObserver.disconnect(), d.current.resizeObserver = null);
|
|
@@ -1106,19 +1106,19 @@ function yn(e) {
|
|
|
1106
1106
|
})));
|
|
1107
1107
|
}
|
|
1108
1108
|
const E = (g) => {
|
|
1109
|
-
!g || g === d.current.element || (A(), d.current.element = g, d.current.scrollContainers =
|
|
1109
|
+
!g || g === d.current.element || (A(), d.current.element = g, d.current.scrollContainers = lr(g), S());
|
|
1110
1110
|
};
|
|
1111
|
-
return
|
|
1111
|
+
return xn(b, !!r), vn(k), ue(() => {
|
|
1112
1112
|
A(), S();
|
|
1113
1113
|
}, [r, b, k]), ue(() => A, []), [E, i, h];
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function vn(e) {
|
|
1116
1116
|
ue(() => {
|
|
1117
1117
|
const t = e;
|
|
1118
1118
|
return window.addEventListener("resize", t), () => void window.removeEventListener("resize", t);
|
|
1119
1119
|
}, [e]);
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1121
|
+
function xn(e, t) {
|
|
1122
1122
|
ue(() => {
|
|
1123
1123
|
if (t) {
|
|
1124
1124
|
const r = e;
|
|
@@ -1129,7 +1129,7 @@ function vn(e, t) {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
}, [e, t]);
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function lr(e) {
|
|
1133
1133
|
const t = [];
|
|
1134
1134
|
if (!e || e === document.body)
|
|
1135
1135
|
return t;
|
|
@@ -1138,9 +1138,9 @@ function or(e) {
|
|
|
1138
1138
|
overflowX: n,
|
|
1139
1139
|
overflowY: s
|
|
1140
1140
|
} = window.getComputedStyle(e);
|
|
1141
|
-
return [r, n, s].some((a) => a === "auto" || a === "scroll") && t.push(e), [...t, ...
|
|
1141
|
+
return [r, n, s].some((a) => a === "auto" || a === "scroll") && t.push(e), [...t, ...lr(e.parentElement)];
|
|
1142
1142
|
}
|
|
1143
|
-
const
|
|
1143
|
+
const wn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], _n = (e, t) => wn.every((r) => e[r] === t[r]), xe = ({
|
|
1144
1144
|
class: e,
|
|
1145
1145
|
...t
|
|
1146
1146
|
}) => {
|
|
@@ -1148,7 +1148,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1148
1148
|
t: r
|
|
1149
1149
|
} = G();
|
|
1150
1150
|
return l("button", {
|
|
1151
|
-
class:
|
|
1151
|
+
class: Re("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),
|
|
1152
1152
|
type: "submit",
|
|
1153
1153
|
...t,
|
|
1154
1154
|
children: l("svg", {
|
|
@@ -1169,23 +1169,23 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1169
1169
|
})]
|
|
1170
1170
|
})
|
|
1171
1171
|
});
|
|
1172
|
-
},
|
|
1172
|
+
}, kn = 25, pt = ft({
|
|
1173
1173
|
instant: () => {
|
|
1174
1174
|
},
|
|
1175
1175
|
smooth: () => {
|
|
1176
1176
|
}
|
|
1177
1177
|
}), z = {
|
|
1178
|
-
onSubmitSuccessFn$:
|
|
1178
|
+
onSubmitSuccessFn$: ft(() => {
|
|
1179
1179
|
}),
|
|
1180
|
-
isBotTyping$:
|
|
1180
|
+
isBotTyping$: ft(!1),
|
|
1181
1181
|
scrollToEnd: {
|
|
1182
|
-
instant: () =>
|
|
1183
|
-
smooth: () =>
|
|
1182
|
+
instant: () => pt.value.instant(),
|
|
1183
|
+
smooth: () => pt.value.smooth()
|
|
1184
1184
|
}
|
|
1185
|
-
},
|
|
1185
|
+
}, Sn = () => {
|
|
1186
1186
|
const e = re(null);
|
|
1187
1187
|
pe(() => {
|
|
1188
|
-
|
|
1188
|
+
pt.value = {
|
|
1189
1189
|
instant: () => {
|
|
1190
1190
|
var r;
|
|
1191
1191
|
return (r = e.current) == null ? void 0 : r.scrollTo({
|
|
@@ -1201,27 +1201,27 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1201
1201
|
}
|
|
1202
1202
|
};
|
|
1203
1203
|
}, [e]);
|
|
1204
|
-
const t =
|
|
1204
|
+
const t = mt(() => ({
|
|
1205
1205
|
addToSubmissions: (n, s) => I.setSubmission(n, s),
|
|
1206
1206
|
send: async ({
|
|
1207
1207
|
message: n,
|
|
1208
1208
|
signal: s,
|
|
1209
1209
|
groupId: a
|
|
1210
1210
|
}) => {
|
|
1211
|
-
if (await
|
|
1211
|
+
if (await Ge(n).with({
|
|
1212
1212
|
author: "bot",
|
|
1213
1213
|
type: "text"
|
|
1214
1214
|
}, async (i) => {
|
|
1215
1215
|
if (s != null && s.aborted)
|
|
1216
|
-
throw new
|
|
1216
|
+
throw new Le();
|
|
1217
1217
|
z.isBotTyping$.value = !0;
|
|
1218
|
-
const u = Math.min(Math.max(20, i.text.length), 100) *
|
|
1218
|
+
const u = Math.min(Math.max(20, i.text.length), 100) * kn;
|
|
1219
1219
|
await new Promise((d) => setTimeout(d, u, {
|
|
1220
1220
|
signal: s
|
|
1221
1221
|
})), z.isBotTyping$.value = !1;
|
|
1222
1222
|
}).otherwise(async () => {
|
|
1223
1223
|
}), s != null && s.aborted)
|
|
1224
|
-
throw new
|
|
1224
|
+
throw new Le();
|
|
1225
1225
|
I.addMessage(n, a);
|
|
1226
1226
|
},
|
|
1227
1227
|
input: ({
|
|
@@ -1229,11 +1229,11 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1229
1229
|
signal: s
|
|
1230
1230
|
}) => {
|
|
1231
1231
|
if (s != null && s.aborted)
|
|
1232
|
-
throw new
|
|
1232
|
+
throw new Le();
|
|
1233
1233
|
return I.setInput(n), new Promise((a) => {
|
|
1234
1234
|
const i = (u) => {
|
|
1235
1235
|
if (s != null && s.aborted)
|
|
1236
|
-
throw new
|
|
1236
|
+
throw new Le();
|
|
1237
1237
|
I.setInput(void 0), n.key && I.setSubmission(n.key, u), a(u);
|
|
1238
1238
|
};
|
|
1239
1239
|
z.onSubmitSuccessFn$.value = i;
|
|
@@ -1244,7 +1244,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1244
1244
|
chatRef: e,
|
|
1245
1245
|
chatService: t
|
|
1246
1246
|
};
|
|
1247
|
-
},
|
|
1247
|
+
}, Ee = ({
|
|
1248
1248
|
error: e
|
|
1249
1249
|
}) => !e || !e.message ? null : l("div", {
|
|
1250
1250
|
role: "alert",
|
|
@@ -1277,7 +1277,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1277
1277
|
class: "truncate pr-1 text-sm",
|
|
1278
1278
|
children: e.message
|
|
1279
1279
|
})]
|
|
1280
|
-
}),
|
|
1280
|
+
}), we = ({
|
|
1281
1281
|
class: e,
|
|
1282
1282
|
...t
|
|
1283
1283
|
}) => {
|
|
@@ -1286,7 +1286,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1286
1286
|
} = G();
|
|
1287
1287
|
return l("button", {
|
|
1288
1288
|
type: "button",
|
|
1289
|
-
class:
|
|
1289
|
+
class: Re("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),
|
|
1290
1290
|
...t,
|
|
1291
1291
|
children: [l("svg", {
|
|
1292
1292
|
"aria-hidden": !0,
|
|
@@ -1307,7 +1307,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1307
1307
|
})]
|
|
1308
1308
|
}), r("skip")]
|
|
1309
1309
|
});
|
|
1310
|
-
},
|
|
1310
|
+
}, gt = {
|
|
1311
1311
|
Afghanistan: "93",
|
|
1312
1312
|
Albania: "355",
|
|
1313
1313
|
Algeria: "213",
|
|
@@ -1555,7 +1555,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1555
1555
|
Zambia: "260",
|
|
1556
1556
|
Zimbabwe: "263",
|
|
1557
1557
|
"Åland Islands": "358"
|
|
1558
|
-
},
|
|
1558
|
+
}, Oe = Xe("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", {
|
|
1559
1559
|
variants: {
|
|
1560
1560
|
optional: {
|
|
1561
1561
|
true: "pr-16 pl-3",
|
|
@@ -1565,15 +1565,15 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1565
1565
|
defaultVariants: {
|
|
1566
1566
|
optional: !1
|
|
1567
1567
|
}
|
|
1568
|
-
}),
|
|
1569
|
-
name:
|
|
1570
|
-
}),
|
|
1571
|
-
suggestions:
|
|
1572
|
-
full_address:
|
|
1573
|
-
place_formatted:
|
|
1574
|
-
name:
|
|
1575
|
-
mapbox_id:
|
|
1576
|
-
context:
|
|
1568
|
+
}), Cn = "https://api.mapbox.com/search/searchbox/v1/suggest", En = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", An = (e) => atob(e).split("").reverse().join(""), ae = he({
|
|
1569
|
+
name: X()
|
|
1570
|
+
}), Vn = he({
|
|
1571
|
+
suggestions: Lr(he({
|
|
1572
|
+
full_address: it(X()),
|
|
1573
|
+
place_formatted: it(X()),
|
|
1574
|
+
name: it(X()),
|
|
1575
|
+
mapbox_id: X(),
|
|
1576
|
+
context: Nr(he({
|
|
1577
1577
|
address: ae,
|
|
1578
1578
|
street: ae,
|
|
1579
1579
|
neighborhood: ae,
|
|
@@ -1585,27 +1585,27 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1585
1585
|
country: ae
|
|
1586
1586
|
}))
|
|
1587
1587
|
}))
|
|
1588
|
-
}),
|
|
1588
|
+
}), In = ({
|
|
1589
1589
|
logger: e,
|
|
1590
1590
|
t
|
|
1591
|
-
}) =>
|
|
1591
|
+
}) => mt(() => {
|
|
1592
1592
|
var n;
|
|
1593
1593
|
const r = (n = I.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1594
1594
|
return r ? {
|
|
1595
1595
|
enabled: !0,
|
|
1596
1596
|
getPredictions: async (s) => {
|
|
1597
1597
|
var v;
|
|
1598
|
-
const a = new URL(
|
|
1598
|
+
const a = new URL(Cn);
|
|
1599
1599
|
a.searchParams.set("q", s), a.searchParams.set("session_token", r);
|
|
1600
1600
|
const i = (v = I.current$.peek().flow) == null ? void 0 : v.locationOrigin;
|
|
1601
|
-
i && i.lat !== void 0 && i.lng !== void 0 && i.lat >= -90 && i.lat <= 90 && i.lng >= -180 && i.lng <= 180 && a.searchParams.set("proximity", `${i.lng},${i.lat}`), a.searchParams.set("access_token", En
|
|
1601
|
+
i && i.lat !== void 0 && i.lng !== void 0 && i.lat >= -90 && i.lat <= 90 && i.lng >= -180 && i.lng <= 180 && a.searchParams.set("proximity", `${i.lng},${i.lat}`), a.searchParams.set("access_token", An(En));
|
|
1602
1602
|
const d = await fetch(a);
|
|
1603
1603
|
if (!d.ok)
|
|
1604
1604
|
return e.error("Failed to get address details", d), {
|
|
1605
1605
|
ok: !1,
|
|
1606
1606
|
error: t("address_error")
|
|
1607
1607
|
};
|
|
1608
|
-
const p =
|
|
1608
|
+
const p = Fr(Vn, await d.json());
|
|
1609
1609
|
if (p.success === !1)
|
|
1610
1610
|
return e.error("Failed to parse address details", p.issues), {
|
|
1611
1611
|
ok: !1,
|
|
@@ -1637,7 +1637,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1637
1637
|
} : {
|
|
1638
1638
|
enabled: !1
|
|
1639
1639
|
};
|
|
1640
|
-
}, [e, t]),
|
|
1640
|
+
}, [e, t]), Tt = (e) => {
|
|
1641
1641
|
const {
|
|
1642
1642
|
t
|
|
1643
1643
|
} = G();
|
|
@@ -1660,20 +1660,20 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1660
1660
|
children: t("back")
|
|
1661
1661
|
})]
|
|
1662
1662
|
});
|
|
1663
|
-
},
|
|
1663
|
+
}, Mn = ({
|
|
1664
1664
|
input: e,
|
|
1665
1665
|
onSubmitSuccess: t,
|
|
1666
1666
|
logger: r
|
|
1667
1667
|
}) => {
|
|
1668
1668
|
const {
|
|
1669
1669
|
t: n
|
|
1670
|
-
} = G(), [s, a] =
|
|
1670
|
+
} = G(), [s, a] = ee(), [i, u] = ee([]), {
|
|
1671
1671
|
enabled: d,
|
|
1672
1672
|
getPredictions: p
|
|
1673
|
-
} =
|
|
1673
|
+
} = In({
|
|
1674
1674
|
logger: r,
|
|
1675
1675
|
t: n
|
|
1676
|
-
}), [w, v] =
|
|
1676
|
+
}), [w, v] = ee(d ? "query" : "manual"), [h, k] = ee(""), [b, A] = ee(), S = (E) => {
|
|
1677
1677
|
le(d, "Query state should not be enabled"), E = E.trim(), E !== (h == null ? void 0 : h.trim()) && (k(E), E === "" && u([]), A(void 0), p(E).then((g) => {
|
|
1678
1678
|
if (g.ok === !1) {
|
|
1679
1679
|
u([]), A(g.error);
|
|
@@ -1684,7 +1684,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1684
1684
|
};
|
|
1685
1685
|
switch (w) {
|
|
1686
1686
|
case "query":
|
|
1687
|
-
return le(d, "Query state should not be enabled"), l(
|
|
1687
|
+
return le(d, "Query state should not be enabled"), l(Fn, {
|
|
1688
1688
|
input: e,
|
|
1689
1689
|
onSkip: () => t(null),
|
|
1690
1690
|
onAddressSelect: (E) => {
|
|
@@ -1703,31 +1703,31 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1703
1703
|
error: b
|
|
1704
1704
|
});
|
|
1705
1705
|
case "details":
|
|
1706
|
-
return le(s !== void 0), l(
|
|
1706
|
+
return le(s !== void 0), l(Rt, {
|
|
1707
1707
|
input: e,
|
|
1708
1708
|
logger: r,
|
|
1709
1709
|
onSubmitSuccess: t,
|
|
1710
1710
|
addressFields: s,
|
|
1711
|
-
actions: l(
|
|
1711
|
+
actions: l(Tt, {
|
|
1712
1712
|
onClick: () => {
|
|
1713
1713
|
v("query");
|
|
1714
1714
|
}
|
|
1715
1715
|
})
|
|
1716
1716
|
});
|
|
1717
1717
|
case "manual":
|
|
1718
|
-
return l(
|
|
1718
|
+
return l(Rt, {
|
|
1719
1719
|
logger: r,
|
|
1720
1720
|
input: e,
|
|
1721
1721
|
onSubmitSuccess: t,
|
|
1722
1722
|
addressFields: {},
|
|
1723
|
-
actions: d ? l(
|
|
1723
|
+
actions: d ? l(Tt, {
|
|
1724
1724
|
onClick: () => {
|
|
1725
1725
|
v("query");
|
|
1726
1726
|
}
|
|
1727
1727
|
}) : void 0
|
|
1728
1728
|
});
|
|
1729
1729
|
}
|
|
1730
|
-
},
|
|
1730
|
+
}, Fn = ({
|
|
1731
1731
|
input: e,
|
|
1732
1732
|
onSkip: t,
|
|
1733
1733
|
suggestions: r,
|
|
@@ -1741,7 +1741,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1741
1741
|
} = G(), d = re(null);
|
|
1742
1742
|
return pe(() => {
|
|
1743
1743
|
d.current && (d.current.focus(), d.current.select());
|
|
1744
|
-
}, []), l(
|
|
1744
|
+
}, []), l(ve, {
|
|
1745
1745
|
children: [l("form", {
|
|
1746
1746
|
noValidate: !0,
|
|
1747
1747
|
onSubmit: (p) => {
|
|
@@ -1760,7 +1760,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1760
1760
|
autoFocus: !0,
|
|
1761
1761
|
placeholder: e.config.placeholder || u("address_search"),
|
|
1762
1762
|
defaultValue: s,
|
|
1763
|
-
class:
|
|
1763
|
+
class: Oe({
|
|
1764
1764
|
optional: !!e.config.optional,
|
|
1765
1765
|
className: "w-full rounded-full"
|
|
1766
1766
|
})
|
|
@@ -1792,11 +1792,11 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1792
1792
|
})]
|
|
1793
1793
|
})
|
|
1794
1794
|
})]
|
|
1795
|
-
}), e.config.optional && l(
|
|
1795
|
+
}), e.config.optional && l(we, {
|
|
1796
1796
|
class: "",
|
|
1797
1797
|
onClick: t
|
|
1798
1798
|
})]
|
|
1799
|
-
}), i ? l(
|
|
1799
|
+
}), i ? l(Ee, {
|
|
1800
1800
|
error: {
|
|
1801
1801
|
message: i
|
|
1802
1802
|
}
|
|
@@ -1838,7 +1838,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1838
1838
|
}, "")]
|
|
1839
1839
|
})]
|
|
1840
1840
|
});
|
|
1841
|
-
},
|
|
1841
|
+
}, Dt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Rt = ({
|
|
1842
1842
|
addressFields: e,
|
|
1843
1843
|
onSubmitSuccess: t,
|
|
1844
1844
|
actions: r,
|
|
@@ -1851,7 +1851,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1851
1851
|
u && (u.focus(), u.select());
|
|
1852
1852
|
}
|
|
1853
1853
|
}, []);
|
|
1854
|
-
const a = Object.keys(
|
|
1854
|
+
const a = Object.keys(gt), {
|
|
1855
1855
|
t: i
|
|
1856
1856
|
} = G();
|
|
1857
1857
|
return l("form", {
|
|
@@ -1866,9 +1866,9 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1866
1866
|
children: [l("div", {
|
|
1867
1867
|
class: "bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",
|
|
1868
1868
|
ref: s,
|
|
1869
|
-
children:
|
|
1869
|
+
children: Dt.map((u, d) => {
|
|
1870
1870
|
const p = `isdk_${u}`, w = n.config.keys[u];
|
|
1871
|
-
return w ? l(
|
|
1871
|
+
return w ? l(ve, {
|
|
1872
1872
|
children: [l("label", {
|
|
1873
1873
|
for: p,
|
|
1874
1874
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
@@ -1915,7 +1915,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1915
1915
|
id: p,
|
|
1916
1916
|
defaultValue: e[u],
|
|
1917
1917
|
required: !0
|
|
1918
|
-
}), d ===
|
|
1918
|
+
}), d === Dt.length - 1 ? l("hr", {
|
|
1919
1919
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1920
1920
|
}) : l("hr", {
|
|
1921
1921
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1928,18 +1928,18 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1928
1928
|
children: [l("div", {
|
|
1929
1929
|
class: "flex-grow",
|
|
1930
1930
|
children: r
|
|
1931
|
-
}), l(
|
|
1931
|
+
}), l(xe, {
|
|
1932
1932
|
class: "flex items-center justify-center"
|
|
1933
1933
|
})]
|
|
1934
1934
|
})]
|
|
1935
1935
|
});
|
|
1936
|
-
},
|
|
1936
|
+
}, yt = () => {
|
|
1937
1937
|
const e = re(null);
|
|
1938
1938
|
return ue(() => {
|
|
1939
1939
|
var t;
|
|
1940
1940
|
(t = e.current) == null || t.focus();
|
|
1941
1941
|
}, []), e;
|
|
1942
|
-
},
|
|
1942
|
+
}, ur = ["true", "false"], Ln = Dr(ur), Nn = "answer", cr = "flex items-center gap-2 p-2.5", dr = nr(({
|
|
1943
1943
|
label: e,
|
|
1944
1944
|
...t
|
|
1945
1945
|
}, r) => l("button", {
|
|
@@ -1950,54 +1950,54 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1950
1950
|
class: "truncate text-center text-base",
|
|
1951
1951
|
children: e
|
|
1952
1952
|
})
|
|
1953
|
-
})),
|
|
1953
|
+
})), Tn = ({
|
|
1954
1954
|
input: e,
|
|
1955
1955
|
onSubmitSuccess: t
|
|
1956
1956
|
}) => {
|
|
1957
|
-
const r =
|
|
1957
|
+
const r = yt();
|
|
1958
1958
|
return l("form", {
|
|
1959
1959
|
noValidate: !0,
|
|
1960
1960
|
class: "",
|
|
1961
1961
|
onSubmit: (n) => {
|
|
1962
1962
|
n.preventDefault();
|
|
1963
|
-
const s =
|
|
1963
|
+
const s = Tr(n).value, a = sr(Ln, s);
|
|
1964
1964
|
t({
|
|
1965
1965
|
type: "boolean",
|
|
1966
1966
|
value: a === "true"
|
|
1967
1967
|
});
|
|
1968
1968
|
},
|
|
1969
1969
|
children: [l("ul", {
|
|
1970
|
-
class:
|
|
1971
|
-
children:
|
|
1970
|
+
class: cr,
|
|
1971
|
+
children: ur.map((n, s) => l("li", {
|
|
1972
1972
|
class: "flex-1",
|
|
1973
|
-
children: l(
|
|
1973
|
+
children: l(dr, {
|
|
1974
1974
|
ref: s === 0 ? r : null,
|
|
1975
1975
|
type: "submit",
|
|
1976
|
-
name:
|
|
1976
|
+
name: Nn,
|
|
1977
1977
|
value: n,
|
|
1978
1978
|
label: e.config.labels[n]
|
|
1979
1979
|
}, n)
|
|
1980
1980
|
}))
|
|
1981
1981
|
}), e.config.optional && l("div", {
|
|
1982
1982
|
class: "px-2 pb-2",
|
|
1983
|
-
children: l(
|
|
1983
|
+
children: l(we, {
|
|
1984
1984
|
class: "w-full",
|
|
1985
1985
|
type: "button",
|
|
1986
1986
|
onClick: () => t(null)
|
|
1987
1987
|
})
|
|
1988
1988
|
})]
|
|
1989
1989
|
});
|
|
1990
|
-
},
|
|
1990
|
+
}, Dn = (e) => new Promise((t, r) => {
|
|
1991
1991
|
const n = new FileReader();
|
|
1992
1992
|
n.readAsDataURL(e), n.onload = () => n.result ? t(n.result.toString()) : r("No result from reader"), n.onerror = r;
|
|
1993
|
-
}),
|
|
1993
|
+
}), Rn = (e) => e.reduce((t, r) => t + r.sizeKb, 0), On = Ce("file"), Ot = 3, Bn = ({
|
|
1994
1994
|
file: e,
|
|
1995
1995
|
class: t,
|
|
1996
1996
|
...r
|
|
1997
1997
|
}) => {
|
|
1998
1998
|
const n = e.name.split(".").pop(), s = e.name.replace(new RegExp(`.${n}$`), "");
|
|
1999
1999
|
return l("div", {
|
|
2000
|
-
class:
|
|
2000
|
+
class: Re("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", t),
|
|
2001
2001
|
...r,
|
|
2002
2002
|
children: [l("p", {
|
|
2003
2003
|
"aria-label": "File name",
|
|
@@ -2011,35 +2011,35 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2011
2011
|
}), l("p", {
|
|
2012
2012
|
"aria-label": "File size",
|
|
2013
2013
|
class: "text-accent-11",
|
|
2014
|
-
children:
|
|
2014
|
+
children: Te(e.sizeKb)
|
|
2015
2015
|
})]
|
|
2016
2016
|
});
|
|
2017
|
-
},
|
|
2017
|
+
}, Bt = ({
|
|
2018
2018
|
class: e,
|
|
2019
2019
|
...t
|
|
2020
2020
|
}) => l("li", {
|
|
2021
|
-
class:
|
|
2021
|
+
class: Re("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2022
2022
|
...t
|
|
2023
|
-
}),
|
|
2023
|
+
}), fr = (e) => {
|
|
2024
2024
|
const t = e.split(".").pop();
|
|
2025
2025
|
if (!t)
|
|
2026
2026
|
throw new Error("No file extension found");
|
|
2027
2027
|
return t ? "." + t : "";
|
|
2028
|
-
},
|
|
2028
|
+
}, Pn = ({
|
|
2029
2029
|
allowedExtensions: e,
|
|
2030
2030
|
files: t
|
|
2031
2031
|
}) => {
|
|
2032
2032
|
const r = e.map((n) => n.toLowerCase());
|
|
2033
|
-
return t.every((n) => r.includes(
|
|
2034
|
-
},
|
|
2035
|
-
const r =
|
|
2033
|
+
return t.every((n) => r.includes(fr(n.name).toLowerCase()));
|
|
2034
|
+
}, $n = (e, t) => {
|
|
2035
|
+
const r = fr(e);
|
|
2036
2036
|
return `${e.replace(new RegExp(`${r}$`), "").slice(0, t)}${r}`;
|
|
2037
|
-
},
|
|
2037
|
+
}, jn = ({
|
|
2038
2038
|
input: e,
|
|
2039
2039
|
onSubmitSuccess: t
|
|
2040
2040
|
}) => {
|
|
2041
2041
|
var v;
|
|
2042
|
-
const r = (v = I.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n, s] =
|
|
2042
|
+
const r = (v = I.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n, s] = ee(On(r) ? r.value : []), [a, i] = ee(), u = n.length - Ot, d = Rn(n), p = yt(), {
|
|
2043
2043
|
t: w
|
|
2044
2044
|
} = G();
|
|
2045
2045
|
return l("form", {
|
|
@@ -2047,7 +2047,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2047
2047
|
onSubmit: (h) => (h.preventDefault(), i(void 0), n.length === 0 ? i({
|
|
2048
2048
|
type: "required",
|
|
2049
2049
|
message: w("validation_file")
|
|
2050
|
-
}) : e.config.extensions.length > 0 && !
|
|
2050
|
+
}) : e.config.extensions.length > 0 && !Pn({
|
|
2051
2051
|
allowedExtensions: e.config.extensions,
|
|
2052
2052
|
files: n
|
|
2053
2053
|
}) ? i({
|
|
@@ -2057,7 +2057,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2057
2057
|
})}`
|
|
2058
2058
|
}) : e.config.fileSizeLimitKib && d > e.config.fileSizeLimitKib ? i({
|
|
2059
2059
|
type: "max",
|
|
2060
|
-
message: `File size exceeds limit of ${
|
|
2060
|
+
message: `File size exceeds limit of ${Te(e.config.fileSizeLimitKib)}`
|
|
2061
2061
|
}) : e.config.allowMultiple === !1 && n.length > 1 ? i({
|
|
2062
2062
|
type: "invalid",
|
|
2063
2063
|
message: w("validation_file_max", {
|
|
@@ -2073,12 +2073,12 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2073
2073
|
ref: p,
|
|
2074
2074
|
for: "dropzone-file",
|
|
2075
2075
|
class: "border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",
|
|
2076
|
-
children: [n.length > 0 ? l(
|
|
2076
|
+
children: [n.length > 0 ? l(ve, {
|
|
2077
2077
|
children: [l("ul", {
|
|
2078
2078
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2079
|
-
children: [n.slice(0,
|
|
2079
|
+
children: [n.slice(0, Ot).map((h) => {
|
|
2080
2080
|
const k = h.name.split(".").pop(), b = h.name.replace(new RegExp(`.${k}$`), "");
|
|
2081
|
-
return l(
|
|
2081
|
+
return l(Bt, {
|
|
2082
2082
|
class: "flex overflow-hidden",
|
|
2083
2083
|
children: [l("span", {
|
|
2084
2084
|
class: "block truncate",
|
|
@@ -2087,12 +2087,12 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2087
2087
|
children: [".", k]
|
|
2088
2088
|
})]
|
|
2089
2089
|
});
|
|
2090
|
-
}), u > 0 ? l(
|
|
2090
|
+
}), u > 0 ? l(Bt, {
|
|
2091
2091
|
children: ["+", u, " file", u !== 1 ? "s" : ""]
|
|
2092
2092
|
}) : null]
|
|
2093
2093
|
}), l("p", {
|
|
2094
2094
|
class: "text-neutral-11 text-xs",
|
|
2095
|
-
children: [
|
|
2095
|
+
children: [Te(d), " ", n.length > 1 ? "total" : ""]
|
|
2096
2096
|
})]
|
|
2097
2097
|
}) : l("div", {
|
|
2098
2098
|
class: "flex flex-col justify-center gap-4 pb-6 pt-5",
|
|
@@ -2119,7 +2119,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2119
2119
|
}), e.config.fileSizeLimitKib ? l("p", {
|
|
2120
2120
|
class: "text-neutral-10 text-xs",
|
|
2121
2121
|
children: ["(", w("file_max_size", {
|
|
2122
|
-
size:
|
|
2122
|
+
size: Te(e.config.fileSizeLimitKib)
|
|
2123
2123
|
}), ")"]
|
|
2124
2124
|
}) : null]
|
|
2125
2125
|
}), l("aside", {
|
|
@@ -2142,9 +2142,9 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2142
2142
|
onInput: async (h) => {
|
|
2143
2143
|
le(h.target instanceof HTMLInputElement);
|
|
2144
2144
|
const k = h.target.files ? Array.from(h.target.files) : [], b = await Promise.allSettled(k.map(async (S) => {
|
|
2145
|
-
const E = await
|
|
2145
|
+
const E = await Dn(S);
|
|
2146
2146
|
return {
|
|
2147
|
-
name:
|
|
2147
|
+
name: $n(S.name, 42),
|
|
2148
2148
|
data: E,
|
|
2149
2149
|
sizeKb: S.size / 1e3
|
|
2150
2150
|
};
|
|
@@ -2165,23 +2165,23 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2165
2165
|
})]
|
|
2166
2166
|
}), l("div", {
|
|
2167
2167
|
class: "flex h-full flex-col items-center gap-2",
|
|
2168
|
-
children: [l(
|
|
2168
|
+
children: [l(xe, {
|
|
2169
2169
|
disabled: n.length === 0
|
|
2170
|
-
}), e.config.optional && l(
|
|
2170
|
+
}), e.config.optional && l(we, {
|
|
2171
2171
|
onClick: () => t(null)
|
|
2172
2172
|
})]
|
|
2173
2173
|
})]
|
|
2174
|
-
}), l(
|
|
2174
|
+
}), l(Ee, {
|
|
2175
2175
|
error: a
|
|
2176
2176
|
})]
|
|
2177
2177
|
});
|
|
2178
2178
|
};
|
|
2179
|
-
var
|
|
2180
|
-
const
|
|
2181
|
-
var $ = (e) => !U(e) && !Array.isArray(e) &&
|
|
2179
|
+
var Be = (e) => e.type === "checkbox", Se = (e) => e instanceof Date, U = (e) => e == null;
|
|
2180
|
+
const hr = (e) => typeof e == "object";
|
|
2181
|
+
var $ = (e) => !U(e) && !Array.isArray(e) && hr(e) && !Se(e), zn = (e) => $(e) && e.target ? Be(e.target) ? e.target.checked : e.target.value : e, qn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Un = (e, t) => e.has(qn(t)), Kn = (e) => {
|
|
2182
2182
|
const t = e.constructor && e.constructor.prototype;
|
|
2183
2183
|
return $(t) && t.hasOwnProperty("isPrototypeOf");
|
|
2184
|
-
},
|
|
2184
|
+
}, bt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2185
2185
|
function oe(e) {
|
|
2186
2186
|
let t;
|
|
2187
2187
|
const r = Array.isArray(e);
|
|
@@ -2189,8 +2189,8 @@ function oe(e) {
|
|
|
2189
2189
|
t = new Date(e);
|
|
2190
2190
|
else if (e instanceof Set)
|
|
2191
2191
|
t = new Set(e);
|
|
2192
|
-
else if (!(
|
|
2193
|
-
if (t = r ? [] : {}, !r && !
|
|
2192
|
+
else if (!(bt && (e instanceof Blob || e instanceof FileList)) && (r || $(e)))
|
|
2193
|
+
if (t = r ? [] : {}, !r && !Kn(e))
|
|
2194
2194
|
t = e;
|
|
2195
2195
|
else
|
|
2196
2196
|
for (const n in e)
|
|
@@ -2199,13 +2199,13 @@ function oe(e) {
|
|
|
2199
2199
|
return e;
|
|
2200
2200
|
return t;
|
|
2201
2201
|
}
|
|
2202
|
-
var
|
|
2202
|
+
var Pe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], B = (e) => e === void 0, x = (e, t, r) => {
|
|
2203
2203
|
if (!t || !$(e))
|
|
2204
2204
|
return r;
|
|
2205
|
-
const n =
|
|
2205
|
+
const n = Pe(t.split(/[,[\].]+?/)).reduce((s, a) => U(s) ? s : s[a], e);
|
|
2206
2206
|
return B(n) || n === e ? B(e[t]) ? r : e[t] : n;
|
|
2207
2207
|
}, de = (e) => typeof e == "boolean";
|
|
2208
|
-
const
|
|
2208
|
+
const Pt = {
|
|
2209
2209
|
BLUR: "blur",
|
|
2210
2210
|
FOCUS_OUT: "focusout",
|
|
2211
2211
|
CHANGE: "change"
|
|
@@ -2224,8 +2224,8 @@ const Bt = {
|
|
|
2224
2224
|
required: "required",
|
|
2225
2225
|
validate: "validate"
|
|
2226
2226
|
};
|
|
2227
|
-
|
|
2228
|
-
var
|
|
2227
|
+
Y.createContext(null);
|
|
2228
|
+
var Gn = (e, t, r, n = !0) => {
|
|
2229
2229
|
const s = {
|
|
2230
2230
|
defaultValues: t._defaultValues
|
|
2231
2231
|
};
|
|
@@ -2237,14 +2237,14 @@ var Kn = (e, t, r, n = !0) => {
|
|
|
2237
2237
|
}
|
|
2238
2238
|
});
|
|
2239
2239
|
return s;
|
|
2240
|
-
}, J = (e) => $(e) && !Object.keys(e).length,
|
|
2240
|
+
}, J = (e) => $(e) && !Object.keys(e).length, Hn = (e, t, r, n) => {
|
|
2241
2241
|
r(e);
|
|
2242
2242
|
const { name: s, ...a } = e;
|
|
2243
2243
|
return J(a) || Object.keys(a).length >= Object.keys(t).length || Object.keys(a).find((i) => t[i] === (!n || Z.all));
|
|
2244
|
-
},
|
|
2245
|
-
function
|
|
2246
|
-
const t =
|
|
2247
|
-
t.current = e,
|
|
2244
|
+
}, ot = (e) => Array.isArray(e) ? e : [e];
|
|
2245
|
+
function Wn(e) {
|
|
2246
|
+
const t = Y.useRef(e);
|
|
2247
|
+
t.current = e, Y.useEffect(() => {
|
|
2248
2248
|
const r = !e.disabled && t.current.subject && t.current.subject.subscribe({
|
|
2249
2249
|
next: t.current.next
|
|
2250
2250
|
});
|
|
@@ -2253,10 +2253,10 @@ function Hn(e) {
|
|
|
2253
2253
|
};
|
|
2254
2254
|
}, [e.disabled]);
|
|
2255
2255
|
}
|
|
2256
|
-
var te = (e) => typeof e == "string",
|
|
2256
|
+
var te = (e) => typeof e == "string", Jn = (e, t, r, n, s) => te(e) ? (n && t.watch.add(e), x(r, e, s)) : Array.isArray(e) ? e.map((a) => (n && t.watch.add(a), x(r, a))) : (n && (t.watchAll = !0), r), vt = (e) => /^\w*$/.test(e), pr = (e) => Pe(e.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
2257
2257
|
function L(e, t, r) {
|
|
2258
2258
|
let n = -1;
|
|
2259
|
-
const s =
|
|
2259
|
+
const s = vt(t) ? [t] : pr(t), a = s.length, i = a - 1;
|
|
2260
2260
|
for (; ++n < a; ) {
|
|
2261
2261
|
const u = s[n];
|
|
2262
2262
|
let d = r;
|
|
@@ -2268,20 +2268,20 @@ function L(e, t, r) {
|
|
|
2268
2268
|
}
|
|
2269
2269
|
return e;
|
|
2270
2270
|
}
|
|
2271
|
-
var
|
|
2271
|
+
var mr = (e, t, r, n, s) => t ? {
|
|
2272
2272
|
...r[e],
|
|
2273
2273
|
types: {
|
|
2274
2274
|
...r[e] && r[e].types ? r[e].types : {},
|
|
2275
2275
|
[n]: s || !0
|
|
2276
2276
|
}
|
|
2277
|
-
} : {},
|
|
2277
|
+
} : {}, $t = (e) => ({
|
|
2278
2278
|
isOnSubmit: !e || e === Z.onSubmit,
|
|
2279
2279
|
isOnBlur: e === Z.onBlur,
|
|
2280
2280
|
isOnChange: e === Z.onChange,
|
|
2281
2281
|
isOnAll: e === Z.all,
|
|
2282
2282
|
isOnTouch: e === Z.onTouched
|
|
2283
|
-
}),
|
|
2284
|
-
const
|
|
2283
|
+
}), jt = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2284
|
+
const qe = (e, t, r, n) => {
|
|
2285
2285
|
for (const s of r || Object.keys(e)) {
|
|
2286
2286
|
const a = x(e, s);
|
|
2287
2287
|
if (a) {
|
|
@@ -2292,24 +2292,24 @@ const ze = (e, t, r, n) => {
|
|
|
2292
2292
|
if (i.ref && t(i.ref, i.name) && !n)
|
|
2293
2293
|
break;
|
|
2294
2294
|
} else
|
|
2295
|
-
$(u) &&
|
|
2295
|
+
$(u) && qe(u, t);
|
|
2296
2296
|
}
|
|
2297
2297
|
}
|
|
2298
2298
|
};
|
|
2299
|
-
var
|
|
2300
|
-
const n =
|
|
2299
|
+
var Zn = (e, t, r) => {
|
|
2300
|
+
const n = Pe(x(e, r));
|
|
2301
2301
|
return L(n, "root", t[r]), L(e, r, n), e;
|
|
2302
|
-
},
|
|
2303
|
-
if (!
|
|
2302
|
+
}, xt = (e) => e.type === "file", fe = (e) => typeof e == "function", He = (e) => {
|
|
2303
|
+
if (!bt)
|
|
2304
2304
|
return !1;
|
|
2305
2305
|
const t = e ? e.ownerDocument : 0;
|
|
2306
2306
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
2307
|
-
},
|
|
2308
|
-
const
|
|
2307
|
+
}, Ue = (e) => te(e), wt = (e) => e.type === "radio", We = (e) => e instanceof RegExp;
|
|
2308
|
+
const zt = {
|
|
2309
2309
|
value: !1,
|
|
2310
2310
|
isValid: !1
|
|
2311
|
-
},
|
|
2312
|
-
var
|
|
2311
|
+
}, qt = { value: !0, isValid: !0 };
|
|
2312
|
+
var gr = (e) => {
|
|
2313
2313
|
if (Array.isArray(e)) {
|
|
2314
2314
|
if (e.length > 1) {
|
|
2315
2315
|
const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
@@ -2317,47 +2317,47 @@ var mr = (e) => {
|
|
|
2317
2317
|
}
|
|
2318
2318
|
return e[0].checked && !e[0].disabled ? (
|
|
2319
2319
|
// @ts-expect-error expected to work in the browser
|
|
2320
|
-
e[0].attributes && !B(e[0].attributes.value) ? B(e[0].value) || e[0].value === "" ?
|
|
2321
|
-
) :
|
|
2320
|
+
e[0].attributes && !B(e[0].attributes.value) ? B(e[0].value) || e[0].value === "" ? qt : { value: e[0].value, isValid: !0 } : qt
|
|
2321
|
+
) : zt;
|
|
2322
2322
|
}
|
|
2323
|
-
return
|
|
2323
|
+
return zt;
|
|
2324
2324
|
};
|
|
2325
|
-
const
|
|
2325
|
+
const Ut = {
|
|
2326
2326
|
isValid: !1,
|
|
2327
2327
|
value: null
|
|
2328
2328
|
};
|
|
2329
|
-
var
|
|
2329
|
+
var yr = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
|
|
2330
2330
|
isValid: !0,
|
|
2331
2331
|
value: r.value
|
|
2332
|
-
} : t,
|
|
2333
|
-
function
|
|
2334
|
-
if (
|
|
2332
|
+
} : t, Ut) : Ut;
|
|
2333
|
+
function Kt(e, t, r = "validate") {
|
|
2334
|
+
if (Ue(e) || Array.isArray(e) && e.every(Ue) || de(e) && !e)
|
|
2335
2335
|
return {
|
|
2336
2336
|
type: r,
|
|
2337
|
-
message:
|
|
2337
|
+
message: Ue(e) ? e : "",
|
|
2338
2338
|
ref: t
|
|
2339
2339
|
};
|
|
2340
2340
|
}
|
|
2341
|
-
var
|
|
2341
|
+
var ke = (e) => $(e) && !We(e) ? e : {
|
|
2342
2342
|
value: e,
|
|
2343
2343
|
message: ""
|
|
2344
|
-
},
|
|
2344
|
+
}, Gt = async (e, t, r, n, s) => {
|
|
2345
2345
|
const { ref: a, refs: i, required: u, maxLength: d, minLength: p, min: w, max: v, pattern: h, validate: k, name: b, valueAsNumber: A, mount: S, disabled: E } = e._f, g = x(t, b);
|
|
2346
2346
|
if (!S || E)
|
|
2347
2347
|
return {};
|
|
2348
2348
|
const M = i ? i[0] : a, R = (F) => {
|
|
2349
2349
|
n && M.reportValidity && (M.setCustomValidity(de(F) ? "" : F || ""), M.reportValidity());
|
|
2350
|
-
}, N = {}, me =
|
|
2351
|
-
const
|
|
2350
|
+
}, N = {}, me = wt(a), ce = Be(a), Ae = me || ce, H = (A || xt(a)) && B(a.value) && B(g) || He(a) && a.value === "" || g === "" || Array.isArray(g) && !g.length, se = mr.bind(null, b, r, N), q = (F, V, O, K = ie.maxLength, W = ie.minLength) => {
|
|
2351
|
+
const Q = F ? V : O;
|
|
2352
2352
|
N[b] = {
|
|
2353
2353
|
type: F ? K : W,
|
|
2354
|
-
message:
|
|
2354
|
+
message: Q,
|
|
2355
2355
|
ref: a,
|
|
2356
|
-
...se(F ? K : W,
|
|
2356
|
+
...se(F ? K : W, Q)
|
|
2357
2357
|
};
|
|
2358
2358
|
};
|
|
2359
|
-
if (s ? !Array.isArray(g) || !g.length : u && (!
|
|
2360
|
-
const { value: F, message: V } =
|
|
2359
|
+
if (s ? !Array.isArray(g) || !g.length : u && (!Ae && (H || U(g)) || de(g) && !g || ce && !gr(i).isValid || me && !yr(i).isValid)) {
|
|
2360
|
+
const { value: F, message: V } = Ue(u) ? { value: !!u, message: u } : ke(u);
|
|
2361
2361
|
if (F && (N[b] = {
|
|
2362
2362
|
type: ie.required,
|
|
2363
2363
|
message: V,
|
|
@@ -2368,25 +2368,25 @@ var _e = (e) => $(e) && !He(e) ? e : {
|
|
|
2368
2368
|
}
|
|
2369
2369
|
if (!H && (!U(w) || !U(v))) {
|
|
2370
2370
|
let F, V;
|
|
2371
|
-
const O =
|
|
2371
|
+
const O = ke(v), K = ke(w);
|
|
2372
2372
|
if (!U(g) && !isNaN(g)) {
|
|
2373
2373
|
const W = a.valueAsNumber || g && +g;
|
|
2374
2374
|
U(O.value) || (F = W > O.value), U(K.value) || (V = W < K.value);
|
|
2375
2375
|
} else {
|
|
2376
|
-
const W = a.valueAsDate || new Date(g),
|
|
2377
|
-
te(O.value) && g && (F = ge ?
|
|
2376
|
+
const W = a.valueAsDate || new Date(g), Q = ($e) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + $e), ge = a.type == "time", Ve = a.type == "week";
|
|
2377
|
+
te(O.value) && g && (F = ge ? Q(g) > Q(O.value) : Ve ? g > O.value : W > new Date(O.value)), te(K.value) && g && (V = ge ? Q(g) < Q(K.value) : Ve ? g < K.value : W < new Date(K.value));
|
|
2378
2378
|
}
|
|
2379
2379
|
if ((F || V) && (q(!!F, O.message, K.message, ie.max, ie.min), !r))
|
|
2380
2380
|
return R(N[b].message), N;
|
|
2381
2381
|
}
|
|
2382
2382
|
if ((d || p) && !H && (te(g) || s && Array.isArray(g))) {
|
|
2383
|
-
const F =
|
|
2383
|
+
const F = ke(d), V = ke(p), O = !U(F.value) && g.length > +F.value, K = !U(V.value) && g.length < +V.value;
|
|
2384
2384
|
if ((O || K) && (q(O, F.message, V.message), !r))
|
|
2385
2385
|
return R(N[b].message), N;
|
|
2386
2386
|
}
|
|
2387
2387
|
if (h && !H && te(g)) {
|
|
2388
|
-
const { value: F, message: V } =
|
|
2389
|
-
if (
|
|
2388
|
+
const { value: F, message: V } = ke(h);
|
|
2389
|
+
if (We(F) && !g.match(F) && (N[b] = {
|
|
2390
2390
|
type: ie.pattern,
|
|
2391
2391
|
message: V,
|
|
2392
2392
|
ref: a,
|
|
@@ -2396,7 +2396,7 @@ var _e = (e) => $(e) && !He(e) ? e : {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
if (k) {
|
|
2398
2398
|
if (fe(k)) {
|
|
2399
|
-
const F = await k(g, t), V =
|
|
2399
|
+
const F = await k(g, t), V = Kt(F, M);
|
|
2400
2400
|
if (V && (N[b] = {
|
|
2401
2401
|
...V,
|
|
2402
2402
|
...se(ie.validate, V.message)
|
|
@@ -2407,7 +2407,7 @@ var _e = (e) => $(e) && !He(e) ? e : {
|
|
|
2407
2407
|
for (const V in k) {
|
|
2408
2408
|
if (!J(F) && !r)
|
|
2409
2409
|
break;
|
|
2410
|
-
const O =
|
|
2410
|
+
const O = Kt(await k[V](g, t), M, V);
|
|
2411
2411
|
O && (F = {
|
|
2412
2412
|
...O,
|
|
2413
2413
|
...se(V, O.message)
|
|
@@ -2422,24 +2422,24 @@ var _e = (e) => $(e) && !He(e) ? e : {
|
|
|
2422
2422
|
}
|
|
2423
2423
|
return R(!0), N;
|
|
2424
2424
|
};
|
|
2425
|
-
function
|
|
2425
|
+
function Xn(e, t) {
|
|
2426
2426
|
const r = t.slice(0, -1).length;
|
|
2427
2427
|
let n = 0;
|
|
2428
2428
|
for (; n < r; )
|
|
2429
2429
|
e = B(e) ? n++ : e[t[n++]];
|
|
2430
2430
|
return e;
|
|
2431
2431
|
}
|
|
2432
|
-
function
|
|
2432
|
+
function Qn(e) {
|
|
2433
2433
|
for (const t in e)
|
|
2434
2434
|
if (e.hasOwnProperty(t) && !B(e[t]))
|
|
2435
2435
|
return !1;
|
|
2436
2436
|
return !0;
|
|
2437
2437
|
}
|
|
2438
2438
|
function j(e, t) {
|
|
2439
|
-
const r = Array.isArray(t) ? t :
|
|
2440
|
-
return n && delete n[a], s !== 0 && ($(n) && J(n) || Array.isArray(n) &&
|
|
2439
|
+
const r = Array.isArray(t) ? t : vt(t) ? [t] : pr(t), n = r.length === 1 ? e : Xn(e, r), s = r.length - 1, a = r[s];
|
|
2440
|
+
return n && delete n[a], s !== 0 && ($(n) && J(n) || Array.isArray(n) && Qn(n)) && j(e, r.slice(0, -1)), e;
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function lt() {
|
|
2443
2443
|
let e = [];
|
|
2444
2444
|
return {
|
|
2445
2445
|
get observers() {
|
|
@@ -2459,11 +2459,11 @@ function ot() {
|
|
|
2459
2459
|
}
|
|
2460
2460
|
};
|
|
2461
2461
|
}
|
|
2462
|
-
var
|
|
2462
|
+
var Je = (e) => U(e) || !hr(e);
|
|
2463
2463
|
function ye(e, t) {
|
|
2464
|
-
if (
|
|
2464
|
+
if (Je(e) || Je(t))
|
|
2465
2465
|
return e === t;
|
|
2466
|
-
if (
|
|
2466
|
+
if (Se(e) && Se(t))
|
|
2467
2467
|
return e.getTime() === t.getTime();
|
|
2468
2468
|
const r = Object.keys(e), n = Object.keys(t);
|
|
2469
2469
|
if (r.length !== n.length)
|
|
@@ -2474,39 +2474,39 @@ function ye(e, t) {
|
|
|
2474
2474
|
return !1;
|
|
2475
2475
|
if (s !== "ref") {
|
|
2476
2476
|
const i = t[s];
|
|
2477
|
-
if (
|
|
2477
|
+
if (Se(a) && Se(i) || $(a) && $(i) || Array.isArray(a) && Array.isArray(i) ? !ye(a, i) : a !== i)
|
|
2478
2478
|
return !1;
|
|
2479
2479
|
}
|
|
2480
2480
|
}
|
|
2481
2481
|
return !0;
|
|
2482
2482
|
}
|
|
2483
|
-
var
|
|
2483
|
+
var br = (e) => e.type === "select-multiple", Yn = (e) => wt(e) || Be(e), ut = (e) => He(e) && e.isConnected, vr = (e) => {
|
|
2484
2484
|
for (const t in e)
|
|
2485
2485
|
if (fe(e[t]))
|
|
2486
2486
|
return !0;
|
|
2487
2487
|
return !1;
|
|
2488
2488
|
};
|
|
2489
|
-
function
|
|
2489
|
+
function Ze(e, t = {}) {
|
|
2490
2490
|
const r = Array.isArray(e);
|
|
2491
2491
|
if ($(e) || r)
|
|
2492
2492
|
for (const n in e)
|
|
2493
|
-
Array.isArray(e[n]) || $(e[n]) && !
|
|
2493
|
+
Array.isArray(e[n]) || $(e[n]) && !vr(e[n]) ? (t[n] = Array.isArray(e[n]) ? [] : {}, Ze(e[n], t[n])) : U(e[n]) || (t[n] = !0);
|
|
2494
2494
|
return t;
|
|
2495
2495
|
}
|
|
2496
|
-
function
|
|
2496
|
+
function xr(e, t, r) {
|
|
2497
2497
|
const n = Array.isArray(e);
|
|
2498
2498
|
if ($(e) || n)
|
|
2499
2499
|
for (const s in e)
|
|
2500
|
-
Array.isArray(e[s]) || $(e[s]) && !
|
|
2500
|
+
Array.isArray(e[s]) || $(e[s]) && !vr(e[s]) ? B(t) || Je(r[s]) ? r[s] = Array.isArray(e[s]) ? Ze(e[s], []) : { ...Ze(e[s]) } : xr(e[s], U(t) ? {} : t[s], r[s]) : r[s] = !ye(e[s], t[s]);
|
|
2501
2501
|
return r;
|
|
2502
2502
|
}
|
|
2503
|
-
var
|
|
2504
|
-
function
|
|
2503
|
+
var ct = (e, t) => xr(e, t, Ze(t)), wr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) => B(e) ? e : t ? e === "" ? NaN : e && +e : r && te(e) ? new Date(e) : n ? n(e) : e;
|
|
2504
|
+
function dt(e) {
|
|
2505
2505
|
const t = e.ref;
|
|
2506
2506
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : t.disabled))
|
|
2507
|
-
return
|
|
2507
|
+
return xt(t) ? t.files : wt(t) ? yr(e.refs).value : br(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Be(t) ? gr(e.refs).value : wr(B(t.value) ? e.ref.value : t.value, e);
|
|
2508
2508
|
}
|
|
2509
|
-
var
|
|
2509
|
+
var es = (e, t, r, n) => {
|
|
2510
2510
|
const s = {};
|
|
2511
2511
|
for (const a of e) {
|
|
2512
2512
|
const i = x(t, a);
|
|
@@ -2518,10 +2518,10 @@ var Yn = (e, t, r, n) => {
|
|
|
2518
2518
|
fields: s,
|
|
2519
2519
|
shouldUseNativeValidation: n
|
|
2520
2520
|
};
|
|
2521
|
-
},
|
|
2522
|
-
function
|
|
2521
|
+
}, Me = (e) => B(e) ? e : We(e) ? e.source : $(e) ? We(e.value) ? e.value.source : e.value : e, ts = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
2522
|
+
function Ht(e, t, r) {
|
|
2523
2523
|
const n = x(e, r);
|
|
2524
|
-
if (n ||
|
|
2524
|
+
if (n || vt(r))
|
|
2525
2525
|
return {
|
|
2526
2526
|
error: n,
|
|
2527
2527
|
name: r
|
|
@@ -2542,15 +2542,15 @@ function Gt(e, t, r) {
|
|
|
2542
2542
|
name: r
|
|
2543
2543
|
};
|
|
2544
2544
|
}
|
|
2545
|
-
var
|
|
2546
|
-
const
|
|
2545
|
+
var rs = (e, t, r, n, s) => s.isOnAll ? !1 : !r && s.isOnTouch ? !(t || e) : (r ? n.isOnBlur : s.isOnBlur) ? !e : (r ? n.isOnChange : s.isOnChange) ? e : !0, ns = (e, t) => !Pe(x(e, t)).length && j(e, t);
|
|
2546
|
+
const ss = {
|
|
2547
2547
|
mode: Z.onSubmit,
|
|
2548
2548
|
reValidateMode: Z.onChange,
|
|
2549
2549
|
shouldFocusError: !0
|
|
2550
2550
|
};
|
|
2551
|
-
function
|
|
2551
|
+
function as(e = {}, t) {
|
|
2552
2552
|
let r = {
|
|
2553
|
-
...
|
|
2553
|
+
...ss,
|
|
2554
2554
|
...e
|
|
2555
2555
|
}, n = {
|
|
2556
2556
|
submitCount: 0,
|
|
@@ -2583,10 +2583,10 @@ function ss(e = {}, t) {
|
|
|
2583
2583
|
isValid: !1,
|
|
2584
2584
|
errors: !1
|
|
2585
2585
|
}, h = {
|
|
2586
|
-
values:
|
|
2587
|
-
array:
|
|
2588
|
-
state:
|
|
2589
|
-
}, k = e.resetOptions && e.resetOptions.keepDirtyValues, b =
|
|
2586
|
+
values: lt(),
|
|
2587
|
+
array: lt(),
|
|
2588
|
+
state: lt()
|
|
2589
|
+
}, k = e.resetOptions && e.resetOptions.keepDirtyValues, b = $t(r.mode), A = $t(r.reValidateMode), S = r.criteriaMode === Z.all, E = (o) => (c) => {
|
|
2590
2590
|
clearTimeout(w), w = setTimeout(o, c);
|
|
2591
2591
|
}, g = async (o) => {
|
|
2592
2592
|
if (v.isValid || o) {
|
|
@@ -2605,13 +2605,13 @@ function ss(e = {}, t) {
|
|
|
2605
2605
|
}
|
|
2606
2606
|
if (m && Array.isArray(x(n.errors, o))) {
|
|
2607
2607
|
const C = f(x(n.errors, o), _.argA, _.argB);
|
|
2608
|
-
y && L(n.errors, o, C),
|
|
2608
|
+
y && L(n.errors, o, C), ns(n.errors, o);
|
|
2609
2609
|
}
|
|
2610
2610
|
if (v.touchedFields && m && Array.isArray(x(n.touchedFields, o))) {
|
|
2611
2611
|
const C = f(x(n.touchedFields, o), _.argA, _.argB);
|
|
2612
2612
|
y && L(n.touchedFields, o, C);
|
|
2613
2613
|
}
|
|
2614
|
-
v.dirtyFields && (n.dirtyFields =
|
|
2614
|
+
v.dirtyFields && (n.dirtyFields = ct(a, i)), h.state.next({
|
|
2615
2615
|
name: o,
|
|
2616
2616
|
isDirty: V(o, c),
|
|
2617
2617
|
dirtyFields: n.dirtyFields,
|
|
@@ -2628,7 +2628,7 @@ function ss(e = {}, t) {
|
|
|
2628
2628
|
const y = x(s, o);
|
|
2629
2629
|
if (y) {
|
|
2630
2630
|
const m = x(i, o, B(f) ? x(a, o) : f);
|
|
2631
|
-
B(m) || _ && _.defaultChecked || c ? L(i, o, c ? m :
|
|
2631
|
+
B(m) || _ && _.defaultChecked || c ? L(i, o, c ? m : dt(y._f)) : W(o, m), u.mount && g();
|
|
2632
2632
|
}
|
|
2633
2633
|
}, ce = (o, c, f, _, y) => {
|
|
2634
2634
|
let m = !1, C = !1;
|
|
@@ -2645,7 +2645,7 @@ function ss(e = {}, t) {
|
|
|
2645
2645
|
P || (L(n.touchedFields, o, f), T.touchedFields = n.touchedFields, m = m || v.touchedFields && P !== f);
|
|
2646
2646
|
}
|
|
2647
2647
|
return m && y && h.state.next(T), m ? T : {};
|
|
2648
|
-
},
|
|
2648
|
+
}, Ae = (o, c, f, _) => {
|
|
2649
2649
|
const y = x(n.errors, o), m = v.isValid && de(c) && n.isValid !== c;
|
|
2650
2650
|
if (e.delayError && f ? (p = E(() => N(o, f)), p(e.delayError)) : (clearTimeout(w), p = null, f ? L(n.errors, o, f) : j(n.errors, o)), (f ? !ye(y, f) : y) || !J(_) || m) {
|
|
2651
2651
|
const C = {
|
|
@@ -2660,7 +2660,7 @@ function ss(e = {}, t) {
|
|
|
2660
2660
|
}, h.state.next(C);
|
|
2661
2661
|
}
|
|
2662
2662
|
M(!1);
|
|
2663
|
-
}, H = async (o) => r.resolver(i, r.context,
|
|
2663
|
+
}, H = async (o) => r.resolver(i, r.context, es(o || d.mount, s, r.criteriaMode, r.shouldUseNativeValidation)), se = async (o) => {
|
|
2664
2664
|
const { errors: c } = await H(o);
|
|
2665
2665
|
if (o)
|
|
2666
2666
|
for (const f of o) {
|
|
@@ -2678,10 +2678,10 @@ function ss(e = {}, t) {
|
|
|
2678
2678
|
if (y) {
|
|
2679
2679
|
const { _f: m, ...C } = y;
|
|
2680
2680
|
if (m) {
|
|
2681
|
-
const T = d.array.has(m.name), P = await
|
|
2681
|
+
const T = d.array.has(m.name), P = await Gt(y, i, S, r.shouldUseNativeValidation && !c, T);
|
|
2682
2682
|
if (P[m.name] && (f.valid = !1, c))
|
|
2683
2683
|
break;
|
|
2684
|
-
!c && (x(P, m.name) ? T ?
|
|
2684
|
+
!c && (x(P, m.name) ? T ? Zn(n.errors, P, m.name) : L(n.errors, m.name, P[m.name]) : j(n.errors, m.name));
|
|
2685
2685
|
}
|
|
2686
2686
|
C && await q(C, c, f);
|
|
2687
2687
|
}
|
|
@@ -2690,26 +2690,26 @@ function ss(e = {}, t) {
|
|
|
2690
2690
|
}, F = () => {
|
|
2691
2691
|
for (const o of d.unMount) {
|
|
2692
2692
|
const c = x(s, o);
|
|
2693
|
-
c && (c._f.refs ? c._f.refs.every((f) => !
|
|
2693
|
+
c && (c._f.refs ? c._f.refs.every((f) => !ut(f)) : !ut(c._f.ref)) && rt(o);
|
|
2694
2694
|
}
|
|
2695
2695
|
d.unMount = /* @__PURE__ */ new Set();
|
|
2696
|
-
}, V = (o, c) => (o && c && L(i, o, c), !ye(
|
|
2696
|
+
}, V = (o, c) => (o && c && L(i, o, c), !ye(_t(), a)), O = (o, c, f) => Jn(o, d, {
|
|
2697
2697
|
...u.mount ? i : B(c) ? a : te(o) ? { [o]: c } : c
|
|
2698
|
-
}, f, c), K = (o) =>
|
|
2698
|
+
}, f, c), K = (o) => Pe(x(u.mount ? i : a, o, e.shouldUnregister ? x(a, o, []) : [])), W = (o, c, f = {}) => {
|
|
2699
2699
|
const _ = x(s, o);
|
|
2700
2700
|
let y = c;
|
|
2701
2701
|
if (_) {
|
|
2702
2702
|
const m = _._f;
|
|
2703
|
-
m && (!m.disabled && L(i, o,
|
|
2703
|
+
m && (!m.disabled && L(i, o, wr(c, m)), y = He(m.ref) && U(c) ? "" : c, br(m.ref) ? [...m.ref.options].forEach((C) => C.selected = y.includes(C.value)) : m.refs ? Be(m.ref) ? m.refs.length > 1 ? m.refs.forEach((C) => (!C.defaultChecked || !C.disabled) && (C.checked = Array.isArray(y) ? !!y.find((T) => T === C.value) : y === C.value)) : m.refs[0] && (m.refs[0].checked = !!y) : m.refs.forEach((C) => C.checked = C.value === y) : xt(m.ref) ? m.ref.value = "" : (m.ref.value = y, m.ref.type || h.values.next({
|
|
2704
2704
|
name: o,
|
|
2705
2705
|
values: { ...i }
|
|
2706
2706
|
})));
|
|
2707
2707
|
}
|
|
2708
|
-
(f.shouldDirty || f.shouldTouch) && ce(o, y, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate &&
|
|
2709
|
-
},
|
|
2708
|
+
(f.shouldDirty || f.shouldTouch) && ce(o, y, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && tt(o);
|
|
2709
|
+
}, Q = (o, c, f) => {
|
|
2710
2710
|
for (const _ in c) {
|
|
2711
2711
|
const y = c[_], m = `${o}.${_}`, C = x(s, m);
|
|
2712
|
-
(d.array.has(o) || !
|
|
2712
|
+
(d.array.has(o) || !Je(y) || C && !C._f) && !Se(y) ? Q(m, y, f) : W(m, y, f);
|
|
2713
2713
|
}
|
|
2714
2714
|
}, ge = (o, c, f = {}) => {
|
|
2715
2715
|
const _ = x(s, o), y = d.array.has(o), m = oe(c);
|
|
@@ -2718,45 +2718,45 @@ function ss(e = {}, t) {
|
|
|
2718
2718
|
values: { ...i }
|
|
2719
2719
|
}), (v.isDirty || v.dirtyFields) && f.shouldDirty && h.state.next({
|
|
2720
2720
|
name: o,
|
|
2721
|
-
dirtyFields:
|
|
2721
|
+
dirtyFields: ct(a, i),
|
|
2722
2722
|
isDirty: V(o, m)
|
|
2723
|
-
})) : _ && !_._f && !U(m) ?
|
|
2723
|
+
})) : _ && !_._f && !U(m) ? Q(o, m, f) : W(o, m, f), jt(o, d) && h.state.next({ ...n }), h.values.next({
|
|
2724
2724
|
name: o,
|
|
2725
2725
|
values: { ...i }
|
|
2726
2726
|
}), !u.mount && t();
|
|
2727
|
-
},
|
|
2727
|
+
}, Ve = async (o) => {
|
|
2728
2728
|
const c = o.target;
|
|
2729
2729
|
let f = c.name, _ = !0;
|
|
2730
|
-
const y = x(s, f), m = () => c.type ?
|
|
2730
|
+
const y = x(s, f), m = () => c.type ? dt(y._f) : zn(o), C = (T) => {
|
|
2731
2731
|
_ = Number.isNaN(T) || T === x(i, f, T);
|
|
2732
2732
|
};
|
|
2733
2733
|
if (y) {
|
|
2734
2734
|
let T, P;
|
|
2735
|
-
const
|
|
2736
|
-
L(i, f,
|
|
2737
|
-
const
|
|
2738
|
-
if (!
|
|
2735
|
+
const je = m(), _e = o.type === Pt.BLUR || o.type === Pt.FOCUS_OUT, Ar = !ts(y._f) && !r.resolver && !x(n.errors, f) && !y._f.deps || rs(_e, x(n.touchedFields, f), n.isSubmitted, A, b), st = jt(f, d, _e);
|
|
2736
|
+
L(i, f, je), _e ? (y._f.onBlur && y._f.onBlur(o), p && p(0)) : y._f.onChange && y._f.onChange(o);
|
|
2737
|
+
const at = ce(f, je, _e, !1), Vr = !J(at) || st;
|
|
2738
|
+
if (!_e && h.values.next({
|
|
2739
2739
|
name: f,
|
|
2740
2740
|
type: o.type,
|
|
2741
2741
|
values: { ...i }
|
|
2742
|
-
}),
|
|
2743
|
-
return v.isValid && g(),
|
|
2744
|
-
if (!
|
|
2745
|
-
const { errors:
|
|
2746
|
-
if (C(
|
|
2747
|
-
const
|
|
2748
|
-
T =
|
|
2742
|
+
}), Ar)
|
|
2743
|
+
return v.isValid && g(), Vr && h.state.next({ name: f, ...st ? {} : at });
|
|
2744
|
+
if (!_e && st && h.state.next({ ...n }), M(!0), r.resolver) {
|
|
2745
|
+
const { errors: Mt } = await H([f]);
|
|
2746
|
+
if (C(je), _) {
|
|
2747
|
+
const Ir = Ht(n.errors, s, f), Ft = Ht(Mt, s, Ir.name || f);
|
|
2748
|
+
T = Ft.error, f = Ft.name, P = J(Mt);
|
|
2749
2749
|
}
|
|
2750
2750
|
} else
|
|
2751
|
-
T = (await
|
|
2752
|
-
_ && (y._f.deps &&
|
|
2751
|
+
T = (await Gt(y, i, S, r.shouldUseNativeValidation))[f], C(je), _ && (T ? P = !1 : v.isValid && (P = await q(s, !0)));
|
|
2752
|
+
_ && (y._f.deps && tt(y._f.deps), Ae(f, P, T, at));
|
|
2753
2753
|
}
|
|
2754
|
-
},
|
|
2754
|
+
}, $e = (o, c) => {
|
|
2755
2755
|
if (x(n.errors, c) && o.focus)
|
|
2756
2756
|
return o.focus(), 1;
|
|
2757
|
-
},
|
|
2757
|
+
}, tt = async (o, c = {}) => {
|
|
2758
2758
|
let f, _;
|
|
2759
|
-
const y =
|
|
2759
|
+
const y = ot(o);
|
|
2760
2760
|
if (M(!0), r.resolver) {
|
|
2761
2761
|
const m = await se(B(o) ? o : y);
|
|
2762
2762
|
f = J(m), _ = o ? !y.some((C) => x(m, C)) : f;
|
|
@@ -2770,23 +2770,23 @@ function ss(e = {}, t) {
|
|
|
2770
2770
|
...r.resolver || !o ? { isValid: f } : {},
|
|
2771
2771
|
errors: n.errors,
|
|
2772
2772
|
isValidating: !1
|
|
2773
|
-
}), c.shouldFocus && !_ &&
|
|
2774
|
-
},
|
|
2773
|
+
}), c.shouldFocus && !_ && qe(s, $e, o ? y : d.mount), _;
|
|
2774
|
+
}, _t = (o) => {
|
|
2775
2775
|
const c = {
|
|
2776
2776
|
...a,
|
|
2777
2777
|
...u.mount ? i : {}
|
|
2778
2778
|
};
|
|
2779
2779
|
return B(o) ? c : te(o) ? x(c, o) : o.map((f) => x(c, f));
|
|
2780
|
-
},
|
|
2780
|
+
}, kt = (o, c) => ({
|
|
2781
2781
|
invalid: !!x((c || n).errors, o),
|
|
2782
2782
|
isDirty: !!x((c || n).dirtyFields, o),
|
|
2783
2783
|
isTouched: !!x((c || n).touchedFields, o),
|
|
2784
2784
|
error: x((c || n).errors, o)
|
|
2785
|
-
}),
|
|
2786
|
-
o &&
|
|
2785
|
+
}), kr = (o) => {
|
|
2786
|
+
o && ot(o).forEach((c) => j(n.errors, c)), h.state.next({
|
|
2787
2787
|
errors: o ? n.errors : {}
|
|
2788
2788
|
});
|
|
2789
|
-
},
|
|
2789
|
+
}, St = (o, c, f) => {
|
|
2790
2790
|
const _ = (x(s, o, { _f: {} })._f || {}).ref;
|
|
2791
2791
|
L(n.errors, o, {
|
|
2792
2792
|
...c,
|
|
@@ -2796,10 +2796,10 @@ function ss(e = {}, t) {
|
|
|
2796
2796
|
errors: n.errors,
|
|
2797
2797
|
isValid: !1
|
|
2798
2798
|
}), f && f.shouldFocus && _ && _.focus && _.focus();
|
|
2799
|
-
},
|
|
2799
|
+
}, Sr = (o, c) => fe(o) ? h.values.subscribe({
|
|
2800
2800
|
next: (f) => o(O(void 0, c), f)
|
|
2801
|
-
}) : O(o, c, !0),
|
|
2802
|
-
for (const f of o ?
|
|
2801
|
+
}) : O(o, c, !0), rt = (o, c = {}) => {
|
|
2802
|
+
for (const f of o ? ot(o) : d.mount)
|
|
2803
2803
|
d.mount.delete(f), d.array.delete(f), c.keepValue || (j(s, f), j(i, f)), !c.keepError && j(n.errors, f), !c.keepDirty && j(n.dirtyFields, f), !c.keepTouched && j(n.touchedFields, f), !r.shouldUnregister && !c.keepDefaultValue && j(a, f);
|
|
2804
2804
|
h.values.next({
|
|
2805
2805
|
values: { ...i }
|
|
@@ -2807,12 +2807,12 @@ function ss(e = {}, t) {
|
|
|
2807
2807
|
...n,
|
|
2808
2808
|
...c.keepDirty ? { isDirty: V() } : {}
|
|
2809
2809
|
}), !c.keepIsValid && g();
|
|
2810
|
-
},
|
|
2810
|
+
}, Ct = ({ disabled: o, name: c, field: f, fields: _, value: y }) => {
|
|
2811
2811
|
if (de(o)) {
|
|
2812
|
-
const m = o ? void 0 : B(y) ?
|
|
2812
|
+
const m = o ? void 0 : B(y) ? dt(f ? f._f : x(_, c)._f) : y;
|
|
2813
2813
|
L(i, c, m), ce(c, m, !1, !1, !0);
|
|
2814
2814
|
}
|
|
2815
|
-
},
|
|
2815
|
+
}, nt = (o, c = {}) => {
|
|
2816
2816
|
let f = x(s, o);
|
|
2817
2817
|
const _ = de(c.disabled);
|
|
2818
2818
|
return L(s, o, {
|
|
@@ -2823,7 +2823,7 @@ function ss(e = {}, t) {
|
|
|
2823
2823
|
mount: !0,
|
|
2824
2824
|
...c
|
|
2825
2825
|
}
|
|
2826
|
-
}), d.mount.add(o), f ?
|
|
2826
|
+
}), d.mount.add(o), f ? Ct({
|
|
2827
2827
|
field: f,
|
|
2828
2828
|
disabled: c.disabled,
|
|
2829
2829
|
name: o
|
|
@@ -2831,19 +2831,19 @@ function ss(e = {}, t) {
|
|
|
2831
2831
|
..._ ? { disabled: c.disabled } : {},
|
|
2832
2832
|
...r.progressive ? {
|
|
2833
2833
|
required: !!c.required,
|
|
2834
|
-
min:
|
|
2835
|
-
max:
|
|
2836
|
-
minLength:
|
|
2837
|
-
maxLength:
|
|
2838
|
-
pattern:
|
|
2834
|
+
min: Me(c.min),
|
|
2835
|
+
max: Me(c.max),
|
|
2836
|
+
minLength: Me(c.minLength),
|
|
2837
|
+
maxLength: Me(c.maxLength),
|
|
2838
|
+
pattern: Me(c.pattern)
|
|
2839
2839
|
} : {},
|
|
2840
2840
|
name: o,
|
|
2841
|
-
onChange:
|
|
2842
|
-
onBlur:
|
|
2841
|
+
onChange: Ve,
|
|
2842
|
+
onBlur: Ve,
|
|
2843
2843
|
ref: (y) => {
|
|
2844
2844
|
if (y) {
|
|
2845
|
-
|
|
2846
|
-
const m = B(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, C =
|
|
2845
|
+
nt(o, c), f = x(s, o);
|
|
2846
|
+
const m = B(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, C = Yn(m), T = f._f.refs || [];
|
|
2847
2847
|
if (C ? T.find((P) => P === m) : m === f._f.ref)
|
|
2848
2848
|
return;
|
|
2849
2849
|
L(s, o, {
|
|
@@ -2851,7 +2851,7 @@ function ss(e = {}, t) {
|
|
|
2851
2851
|
...f._f,
|
|
2852
2852
|
...C ? {
|
|
2853
2853
|
refs: [
|
|
2854
|
-
...T.filter(
|
|
2854
|
+
...T.filter(ut),
|
|
2855
2855
|
m,
|
|
2856
2856
|
...Array.isArray(x(a, o)) ? [{}] : []
|
|
2857
2857
|
],
|
|
@@ -2860,14 +2860,14 @@ function ss(e = {}, t) {
|
|
|
2860
2860
|
}
|
|
2861
2861
|
}), me(o, !1, void 0, m);
|
|
2862
2862
|
} else
|
|
2863
|
-
f = x(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || c.shouldUnregister) && !(
|
|
2863
|
+
f = x(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || c.shouldUnregister) && !(Un(d.array, o) && u.action) && d.unMount.add(o);
|
|
2864
2864
|
}
|
|
2865
2865
|
};
|
|
2866
|
-
},
|
|
2867
|
-
de(o) && (h.state.next({ disabled: o }),
|
|
2866
|
+
}, Et = () => r.shouldFocusError && qe(s, $e, d.mount), Cr = (o) => {
|
|
2867
|
+
de(o) && (h.state.next({ disabled: o }), qe(s, (c) => {
|
|
2868
2868
|
c.disabled = o;
|
|
2869
2869
|
}, 0, !1));
|
|
2870
|
-
},
|
|
2870
|
+
}, At = (o, c) => async (f) => {
|
|
2871
2871
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
2872
2872
|
let _ = oe(i);
|
|
2873
2873
|
if (h.state.next({
|
|
@@ -2879,28 +2879,28 @@ function ss(e = {}, t) {
|
|
|
2879
2879
|
await q(s);
|
|
2880
2880
|
j(n.errors, "root"), J(n.errors) ? (h.state.next({
|
|
2881
2881
|
errors: {}
|
|
2882
|
-
}), await o(_, f)) : (c && await c({ ...n.errors }, f),
|
|
2882
|
+
}), await o(_, f)) : (c && await c({ ...n.errors }, f), Et(), setTimeout(Et)), h.state.next({
|
|
2883
2883
|
isSubmitted: !0,
|
|
2884
2884
|
isSubmitting: !1,
|
|
2885
2885
|
isSubmitSuccessful: J(n.errors),
|
|
2886
2886
|
submitCount: n.submitCount + 1,
|
|
2887
2887
|
errors: n.errors
|
|
2888
2888
|
});
|
|
2889
|
-
},
|
|
2889
|
+
}, Er = (o, c = {}) => {
|
|
2890
2890
|
x(s, o) && (B(c.defaultValue) ? ge(o, x(a, o)) : (ge(o, c.defaultValue), L(a, o, c.defaultValue)), c.keepTouched || j(n.touchedFields, o), c.keepDirty || (j(n.dirtyFields, o), n.isDirty = c.defaultValue ? V(o, x(a, o)) : V()), c.keepError || (j(n.errors, o), v.isValid && g()), h.state.next({ ...n }));
|
|
2891
|
-
},
|
|
2891
|
+
}, Vt = (o, c = {}) => {
|
|
2892
2892
|
const f = o ? oe(o) : a, _ = oe(f), y = o && !J(o) ? _ : a;
|
|
2893
2893
|
if (c.keepDefaultValues || (a = f), !c.keepValues) {
|
|
2894
2894
|
if (c.keepDirtyValues || k)
|
|
2895
2895
|
for (const m of d.mount)
|
|
2896
2896
|
x(n.dirtyFields, m) ? L(y, m, x(i, m)) : ge(m, x(y, m));
|
|
2897
2897
|
else {
|
|
2898
|
-
if (
|
|
2898
|
+
if (bt && B(o))
|
|
2899
2899
|
for (const m of d.mount) {
|
|
2900
2900
|
const C = x(s, m);
|
|
2901
2901
|
if (C && C._f) {
|
|
2902
2902
|
const T = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
|
|
2903
|
-
if (
|
|
2903
|
+
if (He(T)) {
|
|
2904
2904
|
const P = T.closest("form");
|
|
2905
2905
|
if (P) {
|
|
2906
2906
|
P.reset();
|
|
@@ -2928,31 +2928,31 @@ function ss(e = {}, t) {
|
|
|
2928
2928
|
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2929
2929
|
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !ye(o, a)),
|
|
2930
2930
|
isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
|
|
2931
|
-
dirtyFields: c.keepDirtyValues ? n.dirtyFields : c.keepDefaultValues && o ?
|
|
2931
|
+
dirtyFields: c.keepDirtyValues ? n.dirtyFields : c.keepDefaultValues && o ? ct(a, o) : {},
|
|
2932
2932
|
touchedFields: c.keepTouched ? n.touchedFields : {},
|
|
2933
2933
|
errors: c.keepErrors ? n.errors : {},
|
|
2934
2934
|
isSubmitSuccessful: c.keepIsSubmitSuccessful ? n.isSubmitSuccessful : !1,
|
|
2935
2935
|
isSubmitting: !1
|
|
2936
2936
|
});
|
|
2937
|
-
},
|
|
2937
|
+
}, It = (o, c) => Vt(fe(o) ? o(i) : o, c);
|
|
2938
2938
|
return {
|
|
2939
2939
|
control: {
|
|
2940
|
-
register:
|
|
2941
|
-
unregister:
|
|
2942
|
-
getFieldState:
|
|
2943
|
-
handleSubmit:
|
|
2944
|
-
setError:
|
|
2940
|
+
register: nt,
|
|
2941
|
+
unregister: rt,
|
|
2942
|
+
getFieldState: kt,
|
|
2943
|
+
handleSubmit: At,
|
|
2944
|
+
setError: St,
|
|
2945
2945
|
_executeSchema: H,
|
|
2946
2946
|
_getWatch: O,
|
|
2947
2947
|
_getDirty: V,
|
|
2948
2948
|
_updateValid: g,
|
|
2949
2949
|
_removeUnmounted: F,
|
|
2950
2950
|
_updateFieldArray: R,
|
|
2951
|
-
_updateDisabledField:
|
|
2951
|
+
_updateDisabledField: Ct,
|
|
2952
2952
|
_getFieldArray: K,
|
|
2953
|
-
_reset:
|
|
2953
|
+
_reset: Vt,
|
|
2954
2954
|
_resetDefaultValues: () => fe(r.defaultValues) && r.defaultValues().then((o) => {
|
|
2955
|
-
|
|
2955
|
+
It(o, r.resetOptions), h.state.next({
|
|
2956
2956
|
isLoading: !1
|
|
2957
2957
|
});
|
|
2958
2958
|
}),
|
|
@@ -2962,7 +2962,7 @@ function ss(e = {}, t) {
|
|
|
2962
2962
|
...o
|
|
2963
2963
|
};
|
|
2964
2964
|
},
|
|
2965
|
-
_disableForm:
|
|
2965
|
+
_disableForm: Cr,
|
|
2966
2966
|
_subjects: h,
|
|
2967
2967
|
_proxyFormState: v,
|
|
2968
2968
|
get _fields() {
|
|
@@ -3002,17 +3002,17 @@ function ss(e = {}, t) {
|
|
|
3002
3002
|
};
|
|
3003
3003
|
}
|
|
3004
3004
|
},
|
|
3005
|
-
trigger:
|
|
3006
|
-
register:
|
|
3007
|
-
handleSubmit:
|
|
3008
|
-
watch:
|
|
3005
|
+
trigger: tt,
|
|
3006
|
+
register: nt,
|
|
3007
|
+
handleSubmit: At,
|
|
3008
|
+
watch: Sr,
|
|
3009
3009
|
setValue: ge,
|
|
3010
|
-
getValues:
|
|
3011
|
-
reset:
|
|
3012
|
-
resetField:
|
|
3013
|
-
clearErrors:
|
|
3014
|
-
unregister:
|
|
3015
|
-
setError:
|
|
3010
|
+
getValues: _t,
|
|
3011
|
+
reset: It,
|
|
3012
|
+
resetField: Er,
|
|
3013
|
+
clearErrors: kr,
|
|
3014
|
+
unregister: rt,
|
|
3015
|
+
setError: St,
|
|
3016
3016
|
setFocus: (o, c = {}) => {
|
|
3017
3017
|
const f = x(s, o), _ = f && f._f;
|
|
3018
3018
|
if (_) {
|
|
@@ -3020,11 +3020,11 @@ function ss(e = {}, t) {
|
|
|
3020
3020
|
y.focus && (y.focus(), c.shouldSelect && y.select());
|
|
3021
3021
|
}
|
|
3022
3022
|
},
|
|
3023
|
-
getFieldState:
|
|
3023
|
+
getFieldState: kt
|
|
3024
3024
|
};
|
|
3025
3025
|
}
|
|
3026
|
-
function
|
|
3027
|
-
const t =
|
|
3026
|
+
function Ye(e = {}) {
|
|
3027
|
+
const t = Y.useRef(), r = Y.useRef(), [n, s] = Y.useState({
|
|
3028
3028
|
isDirty: !1,
|
|
3029
3029
|
isValidating: !1,
|
|
3030
3030
|
isLoading: fe(e.defaultValues),
|
|
@@ -3040,61 +3040,61 @@ function Qe(e = {}) {
|
|
|
3040
3040
|
defaultValues: fe(e.defaultValues) ? void 0 : e.defaultValues
|
|
3041
3041
|
});
|
|
3042
3042
|
t.current || (t.current = {
|
|
3043
|
-
...
|
|
3043
|
+
...as(e, () => s((i) => ({ ...i }))),
|
|
3044
3044
|
formState: n
|
|
3045
3045
|
});
|
|
3046
3046
|
const a = t.current.control;
|
|
3047
|
-
return a._options = e,
|
|
3047
|
+
return a._options = e, Wn({
|
|
3048
3048
|
subject: a._subjects.state,
|
|
3049
3049
|
next: (i) => {
|
|
3050
|
-
|
|
3050
|
+
Hn(i, a._proxyFormState, a._updateFormState, !0) && s({ ...a._formState });
|
|
3051
3051
|
}
|
|
3052
|
-
}),
|
|
3052
|
+
}), Y.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), Y.useEffect(() => {
|
|
3053
3053
|
if (a._proxyFormState.isDirty) {
|
|
3054
3054
|
const i = a._getDirty();
|
|
3055
3055
|
i !== n.isDirty && a._subjects.state.next({
|
|
3056
3056
|
isDirty: i
|
|
3057
3057
|
});
|
|
3058
3058
|
}
|
|
3059
|
-
}, [a, n.isDirty]),
|
|
3059
|
+
}, [a, n.isDirty]), Y.useEffect(() => {
|
|
3060
3060
|
e.values && !ye(e.values, r.current) ? (a._reset(e.values, a._options.resetOptions), r.current = e.values) : a._resetDefaultValues();
|
|
3061
|
-
}, [e.values, a]),
|
|
3061
|
+
}, [e.values, a]), Y.useEffect(() => {
|
|
3062
3062
|
a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
3063
|
-
}), t.current.formState =
|
|
3063
|
+
}), t.current.formState = Gn(n, a), t.current;
|
|
3064
3064
|
}
|
|
3065
|
-
var
|
|
3065
|
+
var Wt = function(e, t, r) {
|
|
3066
3066
|
if (e && "reportValidity" in e) {
|
|
3067
3067
|
var n = x(r, t);
|
|
3068
3068
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3069
3069
|
}
|
|
3070
|
-
},
|
|
3070
|
+
}, is = function(e, t) {
|
|
3071
3071
|
var r = function(s) {
|
|
3072
3072
|
var a = t.fields[s];
|
|
3073
|
-
a && a.ref && "reportValidity" in a.ref ?
|
|
3074
|
-
return
|
|
3073
|
+
a && a.ref && "reportValidity" in a.ref ? Wt(a.ref, s, e) : a.refs && a.refs.forEach(function(i) {
|
|
3074
|
+
return Wt(i, s, e);
|
|
3075
3075
|
});
|
|
3076
3076
|
};
|
|
3077
3077
|
for (var n in t.fields)
|
|
3078
3078
|
r(n);
|
|
3079
|
-
},
|
|
3080
|
-
t.shouldUseNativeValidation &&
|
|
3079
|
+
}, os = function(e, t) {
|
|
3080
|
+
t.shouldUseNativeValidation && is(e, t);
|
|
3081
3081
|
var r = {};
|
|
3082
3082
|
for (var n in e) {
|
|
3083
3083
|
var s = x(t.fields, n), a = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3084
|
-
if (
|
|
3085
|
-
var i = Object.assign({},
|
|
3084
|
+
if (us(t.names || Object.keys(e), n)) {
|
|
3085
|
+
var i = Object.assign({}, ls(x(r, n)));
|
|
3086
3086
|
L(i, "root", a), L(r, n, i);
|
|
3087
3087
|
} else
|
|
3088
3088
|
L(r, n, a);
|
|
3089
3089
|
}
|
|
3090
3090
|
return r;
|
|
3091
|
-
},
|
|
3091
|
+
}, ls = function(e) {
|
|
3092
3092
|
return Array.isArray(e) ? e.filter(Boolean) : [];
|
|
3093
|
-
},
|
|
3093
|
+
}, us = function(e, t) {
|
|
3094
3094
|
return e.some(function(r) {
|
|
3095
3095
|
return r.startsWith(t + ".");
|
|
3096
3096
|
});
|
|
3097
|
-
},
|
|
3097
|
+
}, cs = function(e, t) {
|
|
3098
3098
|
for (var r = {}; e.issues.length; ) {
|
|
3099
3099
|
var n = e.issues[0];
|
|
3100
3100
|
if (n.path) {
|
|
@@ -3103,13 +3103,13 @@ var Ht = function(e, t, r) {
|
|
|
3103
3103
|
}).join(".");
|
|
3104
3104
|
if (r[s] || (r[s] = { message: n.message, type: n.validation }), t) {
|
|
3105
3105
|
var a = r[s].types, i = a && a[n.validation];
|
|
3106
|
-
r[s] =
|
|
3106
|
+
r[s] = mr(s, t, r, n.validation, i ? [].concat(i, n.message) : n.message);
|
|
3107
3107
|
}
|
|
3108
3108
|
e.issues.shift();
|
|
3109
3109
|
}
|
|
3110
3110
|
}
|
|
3111
3111
|
return r;
|
|
3112
|
-
},
|
|
3112
|
+
}, et = function(e, t, r) {
|
|
3113
3113
|
return r === void 0 && (r = {}), function(n, s, a) {
|
|
3114
3114
|
try {
|
|
3115
3115
|
return Promise.resolve(function(i, u) {
|
|
@@ -3119,15 +3119,15 @@ var Ht = function(e, t, r) {
|
|
|
3119
3119
|
return { values: r.raw ? n : v, errors: {} };
|
|
3120
3120
|
}
|
|
3121
3121
|
var w = Object.assign({}, { abortEarly: !1, abortPipeEarly: !1 }, t);
|
|
3122
|
-
return r.mode === "sync" ? p(
|
|
3122
|
+
return r.mode === "sync" ? p(sr(e, n, w)) : Promise.resolve(Rr(e, n, w)).then(p);
|
|
3123
3123
|
}();
|
|
3124
3124
|
} catch (p) {
|
|
3125
3125
|
return u(p);
|
|
3126
3126
|
}
|
|
3127
3127
|
return d && d.then ? d.then(void 0, u) : d;
|
|
3128
3128
|
}(0, function(i) {
|
|
3129
|
-
if (i instanceof
|
|
3130
|
-
return { values: {}, errors:
|
|
3129
|
+
if (i instanceof Or)
|
|
3130
|
+
return { values: {}, errors: os(cs(i, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
|
|
3131
3131
|
throw i;
|
|
3132
3132
|
}));
|
|
3133
3133
|
} catch (i) {
|
|
@@ -3135,22 +3135,22 @@ var Ht = function(e, t, r) {
|
|
|
3135
3135
|
}
|
|
3136
3136
|
};
|
|
3137
3137
|
};
|
|
3138
|
-
const
|
|
3138
|
+
const Jt = 27, Zt = 12, Xt = 10, ds = Ce("enum"), fs = (e, t) => {
|
|
3139
3139
|
const r = {
|
|
3140
3140
|
min: e.minSelected ?? 0,
|
|
3141
3141
|
max: e.maxSelected ?? e.options.length
|
|
3142
3142
|
};
|
|
3143
|
-
return
|
|
3144
|
-
checked:
|
|
3143
|
+
return et(he({
|
|
3144
|
+
checked: be(Br(X(), Pr()), ar((n) => Object.entries(n).filter(([s, a]) => a).map(([s, a]) => s)), ze(r.max, t("validation_multiple_choice_max", {
|
|
3145
3145
|
count: r.max
|
|
3146
|
-
})),
|
|
3146
|
+
})), De(r.min, t("validation_multiple_choice_min", {
|
|
3147
3147
|
count: r.min
|
|
3148
|
-
}))
|
|
3148
|
+
})))
|
|
3149
3149
|
}));
|
|
3150
|
-
},
|
|
3150
|
+
}, hs = nr(({
|
|
3151
3151
|
option: e,
|
|
3152
3152
|
...t
|
|
3153
|
-
}, r) => l(
|
|
3153
|
+
}, r) => l(ve, {
|
|
3154
3154
|
children: [l("input", {
|
|
3155
3155
|
class: "peer sr-only h-full",
|
|
3156
3156
|
type: "checkbox",
|
|
@@ -3161,16 +3161,16 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3161
3161
|
htmlFor: t.id,
|
|
3162
3162
|
children: e.label
|
|
3163
3163
|
})]
|
|
3164
|
-
})),
|
|
3164
|
+
})), Qt = Xe("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3165
3165
|
variants: {
|
|
3166
3166
|
variant: {
|
|
3167
3167
|
// In cases where there is only one option, we want to center it
|
|
3168
3168
|
singleOption: "justify-center",
|
|
3169
3169
|
// Two choices with exactly 1 min 1 max
|
|
3170
|
-
booleanLike:
|
|
3170
|
+
booleanLike: cr
|
|
3171
3171
|
}
|
|
3172
3172
|
}
|
|
3173
|
-
}),
|
|
3173
|
+
}), ps = ({
|
|
3174
3174
|
input: e,
|
|
3175
3175
|
onSubmitSuccess: t
|
|
3176
3176
|
}) => {
|
|
@@ -3183,22 +3183,22 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3183
3183
|
formState: {
|
|
3184
3184
|
errors: d
|
|
3185
3185
|
}
|
|
3186
|
-
} =
|
|
3186
|
+
} = Ye({
|
|
3187
3187
|
defaultValues: {
|
|
3188
|
-
checked: n ? {} :
|
|
3188
|
+
checked: n ? {} : ds(r) ? Object.fromEntries(r.value.map((h) => [h, !0])) : {}
|
|
3189
3189
|
},
|
|
3190
|
-
resolver:
|
|
3191
|
-
}), p =
|
|
3190
|
+
resolver: fs(e.config, a)
|
|
3191
|
+
}), p = yt();
|
|
3192
3192
|
return s ? l("ul", {
|
|
3193
3193
|
style: {
|
|
3194
|
-
maxHeight: 6.5 *
|
|
3194
|
+
maxHeight: 6.5 * Jt + 5 * Zt + 2 * Xt
|
|
3195
3195
|
},
|
|
3196
|
-
class:
|
|
3196
|
+
class: Qt({
|
|
3197
3197
|
variant: "booleanLike"
|
|
3198
3198
|
}),
|
|
3199
3199
|
children: e.config.options.map((h, k) => l("li", {
|
|
3200
3200
|
class: "flex-1",
|
|
3201
|
-
children: l(
|
|
3201
|
+
children: l(dr, {
|
|
3202
3202
|
type: "submit",
|
|
3203
3203
|
ref: (b) => {
|
|
3204
3204
|
b && k === 0 && (p.current = b);
|
|
@@ -3224,9 +3224,9 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3224
3224
|
class: "flex items-center gap-1",
|
|
3225
3225
|
children: [l("ul", {
|
|
3226
3226
|
style: {
|
|
3227
|
-
maxHeight: 6.5 *
|
|
3227
|
+
maxHeight: 6.5 * Jt + 5 * Zt + 2 * Xt
|
|
3228
3228
|
},
|
|
3229
|
-
class:
|
|
3229
|
+
class: Qt({
|
|
3230
3230
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3231
3231
|
}),
|
|
3232
3232
|
children: e.config.options.map((h, k) => {
|
|
@@ -3236,7 +3236,7 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3236
3236
|
} = i(b);
|
|
3237
3237
|
return l("li", {
|
|
3238
3238
|
class: "relative",
|
|
3239
|
-
children: l(
|
|
3239
|
+
children: l(hs, {
|
|
3240
3240
|
option: h,
|
|
3241
3241
|
autoFocus: k === 0,
|
|
3242
3242
|
ref: (E) => {
|
|
@@ -3253,7 +3253,7 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3253
3253
|
})
|
|
3254
3254
|
}), l("div", {
|
|
3255
3255
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
3256
|
-
children: [n ? null : l(
|
|
3256
|
+
children: [n ? null : l(xe, {}), e.config.minSelected === 0 && l(we, {
|
|
3257
3257
|
type: "button",
|
|
3258
3258
|
onClick: () => t({
|
|
3259
3259
|
type: "enum",
|
|
@@ -3263,23 +3263,23 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3263
3263
|
})]
|
|
3264
3264
|
}), l("div", {
|
|
3265
3265
|
class: "px-1",
|
|
3266
|
-
children: l(
|
|
3266
|
+
children: l(Ee, {
|
|
3267
3267
|
error: (v = d.checked) == null ? void 0 : v.root
|
|
3268
3268
|
})
|
|
3269
3269
|
})]
|
|
3270
3270
|
});
|
|
3271
|
-
},
|
|
3271
|
+
}, ms = Ce("number"), gs = (e, t) => {
|
|
3272
3272
|
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, s = e.decimalCases ?? 0;
|
|
3273
|
-
return
|
|
3274
|
-
number:
|
|
3273
|
+
return et(he({
|
|
3274
|
+
number: be(qr(t("validation_number")), zr(r, t("validation_number_min", {
|
|
3275
3275
|
min: r
|
|
3276
3276
|
})), jr(n, t("validation_number_max", {
|
|
3277
3277
|
max: n
|
|
3278
|
-
})),
|
|
3278
|
+
})), $r((a) => a === Number(a.toFixed(s)), t("validation_number_decimal_cases", {
|
|
3279
3279
|
count: s
|
|
3280
|
-
}))
|
|
3280
|
+
})))
|
|
3281
3281
|
}));
|
|
3282
|
-
},
|
|
3282
|
+
}, ys = ({
|
|
3283
3283
|
input: e,
|
|
3284
3284
|
onSubmitSuccess: t
|
|
3285
3285
|
}) => {
|
|
@@ -3292,11 +3292,11 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3292
3292
|
formState: {
|
|
3293
3293
|
errors: u
|
|
3294
3294
|
}
|
|
3295
|
-
} =
|
|
3295
|
+
} = Ye({
|
|
3296
3296
|
defaultValues: {
|
|
3297
|
-
number: r ? Number(r) :
|
|
3297
|
+
number: r ? Number(r) : ms(n) ? n.value : void 0
|
|
3298
3298
|
},
|
|
3299
|
-
resolver:
|
|
3299
|
+
resolver: gs(e.config, s)
|
|
3300
3300
|
}), {
|
|
3301
3301
|
ref: d,
|
|
3302
3302
|
...p
|
|
@@ -3331,27 +3331,27 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3331
3331
|
type: "text",
|
|
3332
3332
|
min: e.config.min,
|
|
3333
3333
|
max: e.config.max,
|
|
3334
|
-
class:
|
|
3334
|
+
class: Oe({
|
|
3335
3335
|
optional: e.config.optional,
|
|
3336
3336
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3337
3337
|
}),
|
|
3338
3338
|
placeholder: e.config.placeholder
|
|
3339
|
-
}), e.config.optional && l(
|
|
3339
|
+
}), e.config.optional && l(we, {
|
|
3340
3340
|
class: "absolute right-0 top-0",
|
|
3341
3341
|
onClick: () => t(null)
|
|
3342
3342
|
})]
|
|
3343
|
-
}), l(
|
|
3344
|
-
}), l(
|
|
3343
|
+
}), l(xe, {})]
|
|
3344
|
+
}), l(Ee, {
|
|
3345
3345
|
error: u.number
|
|
3346
3346
|
})]
|
|
3347
3347
|
});
|
|
3348
|
-
},
|
|
3348
|
+
}, bs = (e) => {
|
|
3349
3349
|
if (e === "")
|
|
3350
3350
|
return {
|
|
3351
3351
|
countryCode: "",
|
|
3352
3352
|
phoneNumber: ""
|
|
3353
3353
|
};
|
|
3354
|
-
const t = Object.entries(
|
|
3354
|
+
const t = Object.entries(gt).find((s) => e.startsWith(s[1])), r = t ? t[1] : "", n = e.replace(r, "");
|
|
3355
3355
|
return /^\d+$/.test(n) ? {
|
|
3356
3356
|
countryCode: r,
|
|
3357
3357
|
phoneNumber: n
|
|
@@ -3359,32 +3359,32 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3359
3359
|
countryCode: "",
|
|
3360
3360
|
phoneNumber: ""
|
|
3361
3361
|
};
|
|
3362
|
-
},
|
|
3363
|
-
const t =
|
|
3364
|
-
return
|
|
3362
|
+
}, vs = "44", xs = /^[0-9 ]+$/, ws = Ce("string"), _s = Ce("phone"), ks = (e) => {
|
|
3363
|
+
const t = be(X(e("validation_country_code")), Ur(xs, e("validation_country_code"))), r = be(X(e("validation_phone")), De(1, e("validation_phone")), ar((n) => n.replace(/[^0-9]/g, "")));
|
|
3364
|
+
return et(he({
|
|
3365
3365
|
countryCode: t,
|
|
3366
3366
|
phoneNumber: r
|
|
3367
3367
|
}));
|
|
3368
|
-
},
|
|
3368
|
+
}, Ss = ({
|
|
3369
3369
|
input: e,
|
|
3370
3370
|
onSubmitSuccess: t
|
|
3371
3371
|
}) => {
|
|
3372
3372
|
var A;
|
|
3373
3373
|
const r = e.key ? (A = I.current$.value.flow) == null ? void 0 : A.data.submissions[e.key] : void 0, {
|
|
3374
3374
|
t: n
|
|
3375
|
-
} = G(), [s, a] =
|
|
3375
|
+
} = G(), [s, a] = ee(), i = ws(r) ? bs(r.value) : _s(r) ? r.value : void 0, {
|
|
3376
3376
|
register: u,
|
|
3377
3377
|
handleSubmit: d,
|
|
3378
3378
|
formState: {
|
|
3379
3379
|
errors: p
|
|
3380
3380
|
},
|
|
3381
3381
|
watch: w
|
|
3382
|
-
} =
|
|
3382
|
+
} = Ye({
|
|
3383
3383
|
defaultValues: {
|
|
3384
|
-
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3384
|
+
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ?? vs,
|
|
3385
3385
|
phoneNumber: (i == null ? void 0 : i.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3386
3386
|
},
|
|
3387
|
-
resolver:
|
|
3387
|
+
resolver: ks(n)
|
|
3388
3388
|
}), {
|
|
3389
3389
|
ref: v,
|
|
3390
3390
|
...h
|
|
@@ -3428,7 +3428,7 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3428
3428
|
...u("countryCode", {}),
|
|
3429
3429
|
id: `isdk_phone_${e.key}`,
|
|
3430
3430
|
class: "absolute inset-0 opacity-0",
|
|
3431
|
-
children: Object.entries(
|
|
3431
|
+
children: Object.entries(gt).map(([S, E]) => l("option", {
|
|
3432
3432
|
value: E,
|
|
3433
3433
|
children: [S, " (+", E, ")"]
|
|
3434
3434
|
}, S))
|
|
@@ -3445,23 +3445,23 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3445
3445
|
ref: (S) => {
|
|
3446
3446
|
S && (k.current = S), v(S);
|
|
3447
3447
|
},
|
|
3448
|
-
class:
|
|
3448
|
+
class: Oe({
|
|
3449
3449
|
optional: e.config.optional,
|
|
3450
3450
|
className: "min-w-0 flex-1 rounded-r-full"
|
|
3451
3451
|
}),
|
|
3452
3452
|
placeholder: e.config.placeholder
|
|
3453
|
-
}), e.config.optional && l(
|
|
3453
|
+
}), e.config.optional && l(we, {
|
|
3454
3454
|
class: "absolute bottom-0 right-0 top-0",
|
|
3455
3455
|
onClick: () => t(null)
|
|
3456
3456
|
})]
|
|
3457
|
-
}), l(
|
|
3458
|
-
}), l(
|
|
3457
|
+
}), l(xe, {})]
|
|
3458
|
+
}), l(Ee, {
|
|
3459
3459
|
error: p.countryCode || p.phoneNumber || {
|
|
3460
3460
|
message: s
|
|
3461
3461
|
}
|
|
3462
3462
|
})]
|
|
3463
3463
|
});
|
|
3464
|
-
},
|
|
3464
|
+
}, Cs = ({
|
|
3465
3465
|
input: e,
|
|
3466
3466
|
onSubmitSuccess: t
|
|
3467
3467
|
}) => l("div", {
|
|
@@ -3493,7 +3493,7 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3493
3493
|
})]
|
|
3494
3494
|
})
|
|
3495
3495
|
})
|
|
3496
|
-
}),
|
|
3496
|
+
}), Es = {
|
|
3497
3497
|
email: {
|
|
3498
3498
|
type: "email",
|
|
3499
3499
|
inputMode: "email",
|
|
@@ -3508,7 +3508,7 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3508
3508
|
inputMode: "url",
|
|
3509
3509
|
formNoValidate: !0
|
|
3510
3510
|
}
|
|
3511
|
-
},
|
|
3511
|
+
}, As = Ce("string"), Vs = (e, t) => {
|
|
3512
3512
|
const r = {
|
|
3513
3513
|
maxLength: t("validation_max_chars", {
|
|
3514
3514
|
count: e.maxChars ?? 999
|
|
@@ -3517,14 +3517,14 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3517
3517
|
count: e.minChars ?? 1
|
|
3518
3518
|
})
|
|
3519
3519
|
};
|
|
3520
|
-
return
|
|
3520
|
+
return et(he({
|
|
3521
3521
|
text: {
|
|
3522
|
-
email:
|
|
3523
|
-
text:
|
|
3524
|
-
url:
|
|
3522
|
+
email: be(X(t("validation_email")), Kr(t("validation_email")), De(e.minChars ?? 1, r.minLength), ze(e.maxChars ?? 1 / 0, r.maxLength)),
|
|
3523
|
+
text: be(X(), De(e.minChars ?? 1, r.minLength), ze(e.maxChars ?? 1 / 0, r.maxLength)),
|
|
3524
|
+
url: be(X(t("validation_url")), Gr(t("validation_url")), De(e.minChars ?? 1, r.minLength), ze(e.maxChars ?? 1 / 0, r.maxLength))
|
|
3525
3525
|
}[e.format]
|
|
3526
3526
|
}));
|
|
3527
|
-
},
|
|
3527
|
+
}, Is = ({
|
|
3528
3528
|
input: e,
|
|
3529
3529
|
onSubmitSuccess: t
|
|
3530
3530
|
}) => {
|
|
@@ -3537,11 +3537,11 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3537
3537
|
formState: {
|
|
3538
3538
|
errors: u
|
|
3539
3539
|
}
|
|
3540
|
-
} =
|
|
3540
|
+
} = Ye({
|
|
3541
3541
|
defaultValues: {
|
|
3542
|
-
text: s || (
|
|
3542
|
+
text: s || (As(n) ? n.value : "")
|
|
3543
3543
|
},
|
|
3544
|
-
resolver:
|
|
3544
|
+
resolver: Vs(e.config, r)
|
|
3545
3545
|
}), {
|
|
3546
3546
|
ref: d,
|
|
3547
3547
|
...p
|
|
@@ -3566,7 +3566,7 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3566
3566
|
children: [l("input", {
|
|
3567
3567
|
id: "chat-input",
|
|
3568
3568
|
...p,
|
|
3569
|
-
...
|
|
3569
|
+
...Es[e.config.format],
|
|
3570
3570
|
autocomplete: "off",
|
|
3571
3571
|
autoCapitalize: "off",
|
|
3572
3572
|
autoCorrect: "off",
|
|
@@ -3575,33 +3575,33 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3575
3575
|
h && (w.current = h), d(h);
|
|
3576
3576
|
},
|
|
3577
3577
|
placeholder: e.config.placeholder,
|
|
3578
|
-
class:
|
|
3578
|
+
class: Oe({
|
|
3579
3579
|
optional: !!e.config.optional,
|
|
3580
3580
|
className: "w-full rounded-full"
|
|
3581
3581
|
})
|
|
3582
|
-
}), e.config.optional && l(
|
|
3582
|
+
}), e.config.optional && l(we, {
|
|
3583
3583
|
class: "absolute right-0 top-0",
|
|
3584
3584
|
onClick: () => t(null)
|
|
3585
3585
|
})]
|
|
3586
|
-
}), l(
|
|
3587
|
-
}), l(
|
|
3586
|
+
}), l(xe, {})]
|
|
3587
|
+
}), l(Ee, {
|
|
3588
3588
|
error: u.text
|
|
3589
3589
|
})]
|
|
3590
3590
|
});
|
|
3591
|
-
},
|
|
3592
|
-
text:
|
|
3593
|
-
phone:
|
|
3594
|
-
"multiple-choice":
|
|
3595
|
-
boolean:
|
|
3596
|
-
file:
|
|
3597
|
-
submit:
|
|
3598
|
-
address:
|
|
3599
|
-
number:
|
|
3600
|
-
},
|
|
3591
|
+
}, Ms = {
|
|
3592
|
+
text: Is,
|
|
3593
|
+
phone: Ss,
|
|
3594
|
+
"multiple-choice": ps,
|
|
3595
|
+
boolean: Tn,
|
|
3596
|
+
file: jn,
|
|
3597
|
+
submit: Cs,
|
|
3598
|
+
address: Mn,
|
|
3599
|
+
number: ys
|
|
3600
|
+
}, Fs = ({
|
|
3601
3601
|
logger: e
|
|
3602
3602
|
}) => {
|
|
3603
3603
|
var a;
|
|
3604
|
-
const t = (a = I.current$.value.flow) == null ? void 0 : a.data.currentInput, [r, n] =
|
|
3604
|
+
const t = (a = I.current$.value.flow) == null ? void 0 : a.data.currentInput, [r, n] = bn(), s = re(null);
|
|
3605
3605
|
return I.inputHeight$.value = n.height, ue(() => {
|
|
3606
3606
|
const i = s.current;
|
|
3607
3607
|
if (i)
|
|
@@ -3618,7 +3618,7 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3618
3618
|
ref: r,
|
|
3619
3619
|
class: "border-divider flex flex-col justify-end border-t",
|
|
3620
3620
|
children: t ? (() => {
|
|
3621
|
-
const i =
|
|
3621
|
+
const i = Ms[t.type];
|
|
3622
3622
|
return l(i, {
|
|
3623
3623
|
logger: e,
|
|
3624
3624
|
onSubmitSuccess: z.onSubmitSuccessFn$.value,
|
|
@@ -3629,12 +3629,12 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3629
3629
|
children: [l("input", {
|
|
3630
3630
|
"aria-hidden": "true",
|
|
3631
3631
|
id: "chat-input",
|
|
3632
|
-
class:
|
|
3632
|
+
class: Oe({
|
|
3633
3633
|
optional: !1,
|
|
3634
3634
|
className: "flex-grow rounded-full"
|
|
3635
3635
|
}),
|
|
3636
3636
|
disabled: !0
|
|
3637
|
-
}), l(
|
|
3637
|
+
}), l(xe, {
|
|
3638
3638
|
disabled: !0,
|
|
3639
3639
|
"aria-hidden": "true",
|
|
3640
3640
|
tabIndex: -1
|
|
@@ -3643,27 +3643,27 @@ const Wt = 27, Jt = 12, Zt = 10, cs = Se("enum"), ds = (e, t) => {
|
|
|
3643
3643
|
})
|
|
3644
3644
|
});
|
|
3645
3645
|
};
|
|
3646
|
-
var
|
|
3646
|
+
var Ls = function(e) {
|
|
3647
3647
|
return e instanceof RegExp;
|
|
3648
|
-
},
|
|
3648
|
+
}, Ns = function(t) {
|
|
3649
3649
|
var r = /[\\^$.*+?()[\]{}|]/g, n = RegExp(r.source);
|
|
3650
3650
|
return t && n.test(t) ? t.replace(r, "\\$&") : t;
|
|
3651
|
-
},
|
|
3651
|
+
}, _r = function(e) {
|
|
3652
3652
|
return typeof e == "string";
|
|
3653
|
-
},
|
|
3653
|
+
}, Ts = function(e) {
|
|
3654
3654
|
var t = [];
|
|
3655
3655
|
return e.forEach(function(r) {
|
|
3656
3656
|
Array.isArray(r) ? t = t.concat(r) : t.push(r);
|
|
3657
3657
|
}), t;
|
|
3658
3658
|
};
|
|
3659
|
-
function
|
|
3659
|
+
function Ds(e, t, r) {
|
|
3660
3660
|
var n = 0, s = 0;
|
|
3661
3661
|
if (e === "")
|
|
3662
3662
|
return e;
|
|
3663
|
-
if (!e || !
|
|
3663
|
+
if (!e || !_r(e))
|
|
3664
3664
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3665
3665
|
var a = t;
|
|
3666
|
-
|
|
3666
|
+
Ls(a) || (a = new RegExp("(" + Ns(a) + ")", "gi"));
|
|
3667
3667
|
for (var i = e.split(a), u = 1, d = i.length; u < d; u += 2) {
|
|
3668
3668
|
if (i[u] === void 0 || i[u - 1] === void 0) {
|
|
3669
3669
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
@@ -3673,32 +3673,32 @@ function Ts(e, t, r) {
|
|
|
3673
3673
|
}
|
|
3674
3674
|
return i;
|
|
3675
3675
|
}
|
|
3676
|
-
var
|
|
3677
|
-
return Array.isArray(t) || (t = [t]),
|
|
3678
|
-
return
|
|
3676
|
+
var Rs = function(t, r, n) {
|
|
3677
|
+
return Array.isArray(t) || (t = [t]), Ts(t.map(function(s) {
|
|
3678
|
+
return _r(s) ? Ds(s, r, n) : s;
|
|
3679
3679
|
}));
|
|
3680
3680
|
};
|
|
3681
|
-
const
|
|
3682
|
-
const t =
|
|
3683
|
-
const [, d, p] = i.match(
|
|
3681
|
+
const Fe = /* @__PURE__ */ rr(Rs), Os = /(\[[^\]]+\]\([^)]+\))/g, Bs = /\[([^\]]+)\]\(([^)]+)\)/, Ps = /(https?:\/\/[^\s]+)/g, $s = /_(.*?)_/g, js = /\*\*(.*?)\*\*/g, zs = /\\n|\n/g, Yt = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", qs = (e) => {
|
|
3682
|
+
const t = Fe(e, Os, (i, u) => {
|
|
3683
|
+
const [, d, p] = i.match(Bs) ?? [];
|
|
3684
3684
|
return p ? l("a", {
|
|
3685
|
-
class:
|
|
3685
|
+
class: Yt,
|
|
3686
3686
|
href: p,
|
|
3687
3687
|
children: d ?? p
|
|
3688
3688
|
}, p + u) : l("span", {
|
|
3689
3689
|
children: "INVALID LINK"
|
|
3690
3690
|
});
|
|
3691
|
-
}), r =
|
|
3692
|
-
class:
|
|
3691
|
+
}), r = Fe(t, Ps, (i, u) => l("a", {
|
|
3692
|
+
class: Yt,
|
|
3693
3693
|
href: i,
|
|
3694
3694
|
children: i
|
|
3695
|
-
}, i + u)), n =
|
|
3695
|
+
}, i + u)), n = Fe(r, $s, (i, u) => l("em", {
|
|
3696
3696
|
children: i
|
|
3697
|
-
}, i + u)), s =
|
|
3697
|
+
}, i + u)), s = Fe(n, js, (i, u) => l("strong", {
|
|
3698
3698
|
children: i
|
|
3699
3699
|
}, i + u));
|
|
3700
|
-
return
|
|
3701
|
-
},
|
|
3700
|
+
return Fe(s, zs, (i, u) => l("br", {}, `br-${u}`));
|
|
3701
|
+
}, Us = Xe("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", {
|
|
3702
3702
|
variants: {
|
|
3703
3703
|
side: {
|
|
3704
3704
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -3712,7 +3712,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3712
3712
|
defaultVariants: {
|
|
3713
3713
|
side: "left"
|
|
3714
3714
|
}
|
|
3715
|
-
}),
|
|
3715
|
+
}), Ks = ({
|
|
3716
3716
|
children: e,
|
|
3717
3717
|
className: t,
|
|
3718
3718
|
animate: r,
|
|
@@ -3722,14 +3722,14 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3722
3722
|
style: {
|
|
3723
3723
|
transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
|
|
3724
3724
|
},
|
|
3725
|
-
class:
|
|
3725
|
+
class: Us({
|
|
3726
3726
|
className: t,
|
|
3727
3727
|
side: n,
|
|
3728
3728
|
animate: r
|
|
3729
3729
|
}),
|
|
3730
3730
|
...s,
|
|
3731
3731
|
children: e
|
|
3732
|
-
}),
|
|
3732
|
+
}), Gs = ({
|
|
3733
3733
|
message: e
|
|
3734
3734
|
}) => l("div", {
|
|
3735
3735
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -3753,7 +3753,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3753
3753
|
})
|
|
3754
3754
|
})]
|
|
3755
3755
|
})
|
|
3756
|
-
}),
|
|
3756
|
+
}), Hs = ({
|
|
3757
3757
|
className: e,
|
|
3758
3758
|
...t
|
|
3759
3759
|
}) => (ue(() => {
|
|
@@ -3762,7 +3762,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3762
3762
|
"aria-hidden": !0,
|
|
3763
3763
|
children: z.isBotTyping$.value === !0 ? l("div", {
|
|
3764
3764
|
"aria-label": "Typing…",
|
|
3765
|
-
class:
|
|
3765
|
+
class: Re("flex gap-1 p-4", e),
|
|
3766
3766
|
...t,
|
|
3767
3767
|
children: Array.from({
|
|
3768
3768
|
length: 3
|
|
@@ -3773,10 +3773,10 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3773
3773
|
}
|
|
3774
3774
|
}))
|
|
3775
3775
|
}) : void 0
|
|
3776
|
-
})),
|
|
3776
|
+
})), Ws = {
|
|
3777
3777
|
bot: "left",
|
|
3778
3778
|
user: "right"
|
|
3779
|
-
},
|
|
3779
|
+
}, Js = Xe("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)]", {
|
|
3780
3780
|
variants: {
|
|
3781
3781
|
variant: {
|
|
3782
3782
|
info: "text-neutral-8",
|
|
@@ -3785,7 +3785,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3785
3785
|
success: "text-[#4CAF50]"
|
|
3786
3786
|
}
|
|
3787
3787
|
}
|
|
3788
|
-
}),
|
|
3788
|
+
}), Zs = ({
|
|
3789
3789
|
lastSentMessageFooter: e
|
|
3790
3790
|
}) => {
|
|
3791
3791
|
var r;
|
|
@@ -3795,13 +3795,13 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3795
3795
|
}, [t.length]), l("ol", {
|
|
3796
3796
|
"aria-label": "Chat messages",
|
|
3797
3797
|
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
3798
|
-
children: [t.map((n, s) => l(
|
|
3798
|
+
children: [t.map((n, s) => l(ve, {
|
|
3799
3799
|
children: l("li", {
|
|
3800
3800
|
class: "flex",
|
|
3801
|
-
children:
|
|
3801
|
+
children: Ge(n).with({
|
|
3802
3802
|
type: "system"
|
|
3803
3803
|
}, (a) => l("p", {
|
|
3804
|
-
class:
|
|
3804
|
+
class: Js({
|
|
3805
3805
|
variant: a.variant
|
|
3806
3806
|
}),
|
|
3807
3807
|
children: a.text
|
|
@@ -3809,17 +3809,17 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3809
3809
|
type: "text",
|
|
3810
3810
|
author: D.union("bot", "user")
|
|
3811
3811
|
}, (a) => {
|
|
3812
|
-
const i = a.author === "user" && !t.slice(s + 1).some((p) => p.type === "text" && p.author === "user"), u = s === t.length - 1, d = a.author === "bot" ?
|
|
3813
|
-
return l(
|
|
3814
|
-
children: [i ? e : null, l(
|
|
3812
|
+
const i = a.author === "user" && !t.slice(s + 1).some((p) => p.type === "text" && p.author === "user"), u = s === t.length - 1, d = a.author === "bot" ? qs(a.text) : a.text;
|
|
3813
|
+
return l(ve, {
|
|
3814
|
+
children: [i ? e : null, l(Ks, {
|
|
3815
3815
|
animate: u,
|
|
3816
|
-
side:
|
|
3816
|
+
side: Ws[a.author],
|
|
3817
3817
|
children: d
|
|
3818
3818
|
}, s)]
|
|
3819
3819
|
});
|
|
3820
3820
|
}).with({
|
|
3821
3821
|
type: "link"
|
|
3822
|
-
}, (a) => l(
|
|
3822
|
+
}, (a) => l(Gs, {
|
|
3823
3823
|
message: a
|
|
3824
3824
|
})).with({
|
|
3825
3825
|
type: "image"
|
|
@@ -3831,7 +3831,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3831
3831
|
}
|
|
3832
3832
|
})).with({
|
|
3833
3833
|
type: "file"
|
|
3834
|
-
}, (a) => l(
|
|
3834
|
+
}, (a) => l(Bn, {
|
|
3835
3835
|
class: a.author === "bot" ? void 0 : "ml-auto",
|
|
3836
3836
|
file: {
|
|
3837
3837
|
name: a.fileName,
|
|
@@ -3843,15 +3843,15 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3843
3843
|
const i = t[t.length - 1];
|
|
3844
3844
|
return !(a === i) || z.isBotTyping$.value ? null : l("div", {
|
|
3845
3845
|
class: "flex flex-grow flex-col items-center justify-center",
|
|
3846
|
-
children: l(
|
|
3846
|
+
children: l(Hr, {
|
|
3847
3847
|
class: "text-neutral-6 h-8 w-8"
|
|
3848
3848
|
})
|
|
3849
3849
|
});
|
|
3850
3850
|
}).exhaustive()
|
|
3851
3851
|
})
|
|
3852
|
-
}, s)), l(
|
|
3852
|
+
}, s)), l(Hs, {}, "typing")]
|
|
3853
3853
|
});
|
|
3854
|
-
},
|
|
3854
|
+
}, aa = ({
|
|
3855
3855
|
logger: e,
|
|
3856
3856
|
apiClient: t,
|
|
3857
3857
|
analytics: r
|
|
@@ -3863,9 +3863,9 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3863
3863
|
const s = I.viewState$.value, {
|
|
3864
3864
|
chatRef: a,
|
|
3865
3865
|
chatService: i
|
|
3866
|
-
} =
|
|
3866
|
+
} = Sn(), {
|
|
3867
3867
|
t: u
|
|
3868
|
-
} = G(), [d, p] =
|
|
3868
|
+
} = G(), [d, p] = ee();
|
|
3869
3869
|
return pe(() => {
|
|
3870
3870
|
s === "maximised" && z.scrollToEnd.instant();
|
|
3871
3871
|
}, [s]), pe(() => {
|
|
@@ -3879,7 +3879,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3879
3879
|
let h = v.data.nodeHistory.at(-1);
|
|
3880
3880
|
if (z.scrollToEnd.instant(), I.setInput(void 0), v.data.isFinished)
|
|
3881
3881
|
return;
|
|
3882
|
-
h === void 0 ? (h =
|
|
3882
|
+
h === void 0 ? (h = tr(n.nodes).id, I.setCurrentNodeId(h), r.log({
|
|
3883
3883
|
event: "FLOW_START",
|
|
3884
3884
|
properties: {
|
|
3885
3885
|
flow_id: n.id,
|
|
@@ -3894,7 +3894,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3894
3894
|
interpret: k,
|
|
3895
3895
|
abort: b,
|
|
3896
3896
|
undo: A
|
|
3897
|
-
} =
|
|
3897
|
+
} = Xr({
|
|
3898
3898
|
context: n.context,
|
|
3899
3899
|
analytics: {
|
|
3900
3900
|
service: r,
|
|
@@ -3946,7 +3946,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3946
3946
|
}
|
|
3947
3947
|
});
|
|
3948
3948
|
return p(() => A), k(h), b;
|
|
3949
|
-
}, [r, t, i, e, n, u]), l(
|
|
3949
|
+
}, [r, t, i, e, n, u]), l(ve, {
|
|
3950
3950
|
children: [l("div", {
|
|
3951
3951
|
ref: a,
|
|
3952
3952
|
className: "hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",
|
|
@@ -3954,22 +3954,22 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3954
3954
|
WebkitOverflowScrolling: "touch",
|
|
3955
3955
|
paddingBottom: I.inputHeight$.value
|
|
3956
3956
|
},
|
|
3957
|
-
children: l(
|
|
3958
|
-
lastSentMessageFooter: n.data.isFinished || !d ? null : l(
|
|
3957
|
+
children: l(Zs, {
|
|
3958
|
+
lastSentMessageFooter: n.data.isFinished || !d ? null : l(Qs, {
|
|
3959
3959
|
undoFn: d
|
|
3960
3960
|
})
|
|
3961
3961
|
})
|
|
3962
|
-
}), l(
|
|
3962
|
+
}), l(Fs, {
|
|
3963
3963
|
logger: e
|
|
3964
3964
|
})]
|
|
3965
3965
|
});
|
|
3966
|
-
},
|
|
3966
|
+
}, Xs = (e) => e.type === "identify" ? [] : "key" in e.data && e.data.key ? [e.data.key] : "keys" in e.data ? Object.values(e.data.keys).filter((t) => typeof t == "string") : [], Qs = ({
|
|
3967
3967
|
undoFn: e
|
|
3968
3968
|
}) => {
|
|
3969
3969
|
const {
|
|
3970
3970
|
t
|
|
3971
3971
|
} = G();
|
|
3972
|
-
return l(
|
|
3972
|
+
return l(Wr, {
|
|
3973
3973
|
onClick: async () => {
|
|
3974
3974
|
const {
|
|
3975
3975
|
flow: r
|
|
@@ -3978,7 +3978,7 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3978
3978
|
const {
|
|
3979
3979
|
removed: n
|
|
3980
3980
|
} = e(r.data.nodeHistory), s = r.data.nodeHistory.splice(-n);
|
|
3981
|
-
s.length !== 0 && (I.removeMessagesSentByNodeIds(s), I.setInput(void 0), s.pop(), s.map((a) => r.nodes.find((i) => i.id === a)).filter(Boolean).flatMap(
|
|
3981
|
+
s.length !== 0 && (I.removeMessagesSentByNodeIds(s), I.setInput(void 0), s.pop(), s.map((a) => r.nodes.find((i) => i.id === a)).filter(Boolean).flatMap(Xs).forEach((a) => delete r.data.submissions[a]), I.current$.value = {
|
|
3982
3982
|
...I.current$.value
|
|
3983
3983
|
});
|
|
3984
3984
|
},
|
|
@@ -3990,5 +3990,5 @@ const Me = /* @__PURE__ */ tr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3990
3990
|
});
|
|
3991
3991
|
};
|
|
3992
3992
|
export {
|
|
3993
|
-
|
|
3993
|
+
aa as ChatbotBody
|
|
3994
3994
|
};
|