@inploi/plugin-chatbot 4.0.1 → 4.0.3
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-5aef126c.js → chatbot-body-4157a64b.js} +703 -714
- package/dist/chatbot-body-faf3f35a.cjs +1 -0
- package/dist/i18n.d.ts +60 -0
- package/dist/{index-b245b94e.js → index-432cb092.js} +66 -56
- package/dist/index-fc252b7c.cjs +5 -0
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +3 -3
- package/dist/chatbot-body-1f8351bb.cjs +0 -1
- package/dist/index-4d7a0e94.cjs +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as Ue, i as
|
|
1
|
+
import { g as Ue, i as er, k as Ne, a as tr, b as le, A as Me, c as Mr, N as Ke, _ as I, d as rr, h as Y, e as re, p as ue, F as pt, u as J, o as l, f as Le, j as dt, y as pe, s as M, l as Ze, m as he, n as Fr, q as at, r as ee, t as Nr, v as ke, w as Lr, x as nr, z as Tr, B as sr, C as Dr, D as Se, E as X, G as Rr, V as Or, H as ar, I as $e, J as je, K as Br, L as Pr, M as $r, O as jr, P as zr, Q as qr, R as Ft, S as Ur, T as Kr, U as Gr } from "./index-432cb092.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const Nt = ({
|
|
4
4
|
condition: e,
|
|
@@ -9,7 +9,7 @@ const Nt = ({
|
|
|
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,
|
|
@@ -35,7 +35,7 @@ const Nt = ({
|
|
|
35
35
|
case "integration": {
|
|
36
36
|
if (typeof i.value != "object" || Array.isArray(i.value))
|
|
37
37
|
return !1;
|
|
38
|
-
const u = Ue(i.value, a.join(".")),
|
|
38
|
+
const u = Ue(i.value, a.join(".")), d = {
|
|
39
39
|
...n,
|
|
40
40
|
data: {
|
|
41
41
|
...n.data,
|
|
@@ -44,7 +44,7 @@ const Nt = ({
|
|
|
44
44
|
};
|
|
45
45
|
switch (typeof u) {
|
|
46
46
|
case "boolean":
|
|
47
|
-
return Fe(
|
|
47
|
+
return Fe(d, {
|
|
48
48
|
submissions: {
|
|
49
49
|
_temp: {
|
|
50
50
|
value: u,
|
|
@@ -54,7 +54,7 @@ const Nt = ({
|
|
|
54
54
|
context: t
|
|
55
55
|
});
|
|
56
56
|
case "string":
|
|
57
|
-
return Fe(
|
|
57
|
+
return Fe(d, {
|
|
58
58
|
submissions: {
|
|
59
59
|
_temp: {
|
|
60
60
|
value: u,
|
|
@@ -64,7 +64,7 @@ const Nt = ({
|
|
|
64
64
|
context: t
|
|
65
65
|
});
|
|
66
66
|
case "number":
|
|
67
|
-
return Fe(
|
|
67
|
+
return Fe(d, {
|
|
68
68
|
submissions: {
|
|
69
69
|
_temp: {
|
|
70
70
|
value: u,
|
|
@@ -74,7 +74,7 @@ const Nt = ({
|
|
|
74
74
|
context: t
|
|
75
75
|
});
|
|
76
76
|
case "object":
|
|
77
|
-
return Array.isArray(u) && u.every(
|
|
77
|
+
return Array.isArray(u) && u.every(er) ? Fe(d, {
|
|
78
78
|
submissions: {
|
|
79
79
|
_temp: {
|
|
80
80
|
value: u,
|
|
@@ -172,36 +172,36 @@ const Nt = ({
|
|
|
172
172
|
return !1;
|
|
173
173
|
return !0;
|
|
174
174
|
}
|
|
175
|
-
},
|
|
175
|
+
}, Hr = /{{\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("."),
|
|
178
|
+
}) => e.replace(Hr, (n, s, a = "") => {
|
|
179
|
+
const [i, ...u] = s.trim().split("."), d = or({
|
|
180
180
|
key: i,
|
|
181
181
|
path: u,
|
|
182
182
|
submissions: r,
|
|
183
183
|
context: t
|
|
184
184
|
});
|
|
185
|
-
if (!
|
|
185
|
+
if (!d)
|
|
186
186
|
return a;
|
|
187
|
-
switch (
|
|
187
|
+
switch (d.type) {
|
|
188
188
|
case "boolean":
|
|
189
|
-
return
|
|
189
|
+
return d.value === !0 ? "true" : "false";
|
|
190
190
|
case "file":
|
|
191
|
-
return
|
|
191
|
+
return d.value.map((h) => `${h.name} (${Ne(h.sizeKb)})`).join(", ");
|
|
192
192
|
case "enum":
|
|
193
|
-
return
|
|
193
|
+
return d.value.join(", ");
|
|
194
194
|
case "address":
|
|
195
|
-
return Object.values(
|
|
195
|
+
return Object.values(d.value).filter((h) => h && h.trim().length > 0).join(", ");
|
|
196
196
|
case "number":
|
|
197
197
|
case "string":
|
|
198
|
-
return
|
|
198
|
+
return d.value ? d.value.toString() : a;
|
|
199
199
|
case "phone":
|
|
200
|
-
return Qe(
|
|
200
|
+
return Qe(d.value);
|
|
201
201
|
case "integration": {
|
|
202
|
-
if (typeof
|
|
202
|
+
if (typeof d.value != "object" || Array.isArray(d.value))
|
|
203
203
|
break;
|
|
204
|
-
const h = Ue(
|
|
204
|
+
const h = Ue(d.value, u.join("."));
|
|
205
205
|
switch (typeof h) {
|
|
206
206
|
case "boolean":
|
|
207
207
|
return h === !0 ? "true" : "false";
|
|
@@ -210,14 +210,14 @@ const Nt = ({
|
|
|
210
210
|
case "number":
|
|
211
211
|
return h.toString();
|
|
212
212
|
case "object":
|
|
213
|
-
if (Array.isArray(h) && h.every(
|
|
213
|
+
if (Array.isArray(h) && h.every(er))
|
|
214
214
|
return h.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 Nt = ({
|
|
|
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
|
+
}, Wr = ({
|
|
235
235
|
childNode: e,
|
|
236
236
|
nodes: t
|
|
237
237
|
}) => {
|
|
@@ -241,7 +241,7 @@ const Nt = ({
|
|
|
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 Nt = ({
|
|
|
250
250
|
});
|
|
251
251
|
if (n != null && n.nextId)
|
|
252
252
|
return t.find((s) => s.id === n.nextId);
|
|
253
|
-
},
|
|
253
|
+
}, Jr = ({
|
|
254
254
|
flow: e,
|
|
255
255
|
analytics: t,
|
|
256
256
|
logger: r,
|
|
@@ -259,35 +259,35 @@ const Nt = ({
|
|
|
259
259
|
getSubmissions: a,
|
|
260
260
|
chatService: i,
|
|
261
261
|
onFlowEnd: u,
|
|
262
|
-
onInterpret:
|
|
262
|
+
onInterpret: d,
|
|
263
263
|
t: h
|
|
264
264
|
}) => {
|
|
265
265
|
let x = new AbortController();
|
|
266
|
-
const
|
|
266
|
+
const y = {
|
|
267
267
|
...t.service,
|
|
268
|
-
log: (
|
|
269
|
-
...
|
|
268
|
+
log: (_) => t.service.log({
|
|
269
|
+
..._,
|
|
270
270
|
customProperties: {
|
|
271
|
-
...
|
|
271
|
+
..._.customProperties,
|
|
272
272
|
...t.customProperties
|
|
273
273
|
}
|
|
274
274
|
})
|
|
275
|
-
}, p = async (
|
|
275
|
+
}, p = async (_, v) => {
|
|
276
276
|
const E = a();
|
|
277
|
-
|
|
277
|
+
d == null || d(_, v);
|
|
278
278
|
try {
|
|
279
|
-
await
|
|
279
|
+
await Zr({
|
|
280
280
|
flow: e,
|
|
281
|
-
analytics:
|
|
281
|
+
analytics: y,
|
|
282
282
|
logger: r,
|
|
283
283
|
apiClient: s,
|
|
284
284
|
context: n,
|
|
285
|
-
node:
|
|
285
|
+
node: _,
|
|
286
286
|
submissions: E,
|
|
287
287
|
t: h,
|
|
288
288
|
chat: {
|
|
289
289
|
sendMessage: async (S) => i.send({
|
|
290
|
-
groupId:
|
|
290
|
+
groupId: _.id,
|
|
291
291
|
message: S,
|
|
292
292
|
signal: x.signal
|
|
293
293
|
}),
|
|
@@ -298,13 +298,13 @@ const Nt = ({
|
|
|
298
298
|
addToSubmissions: i.addToSubmissions
|
|
299
299
|
},
|
|
300
300
|
next: (S) => {
|
|
301
|
-
const A = S ? e.nodes.find((g) => g.id === S) :
|
|
302
|
-
childNode:
|
|
301
|
+
const A = S ? e.nodes.find((g) => g.id === S) : Wr({
|
|
302
|
+
childNode: _,
|
|
303
303
|
nodes: e.nodes
|
|
304
304
|
});
|
|
305
|
-
return A ? p(A,
|
|
305
|
+
return A ? p(A, _) : u == null ? void 0 : u(_);
|
|
306
306
|
},
|
|
307
|
-
end: () => u == null ? void 0 : u(
|
|
307
|
+
end: () => u == null ? void 0 : u(_)
|
|
308
308
|
});
|
|
309
309
|
} catch (S) {
|
|
310
310
|
if (S instanceof Me)
|
|
@@ -313,20 +313,20 @@ const Nt = ({
|
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
return {
|
|
316
|
-
interpret: async (
|
|
317
|
-
const v = e.nodes.find((E) => E.id ===
|
|
316
|
+
interpret: async (_) => {
|
|
317
|
+
const v = e.nodes.find((E) => E.id === _) ?? tr(e.nodes);
|
|
318
318
|
return p(v);
|
|
319
319
|
},
|
|
320
|
-
undo: (
|
|
320
|
+
undo: (_) => {
|
|
321
321
|
let v = 1;
|
|
322
|
-
const E = e.nodes.find((A) => A.id ===
|
|
323
|
-
for (let A =
|
|
324
|
-
const g =
|
|
322
|
+
const E = e.nodes.find((A) => A.id === _[_.length - 1]);
|
|
323
|
+
for (let A = _.length - 2; A > 0; A--) {
|
|
324
|
+
const g = _[A], T = e.nodes.find((P) => P.id === g);
|
|
325
325
|
if (!T || (v++, T.type.startsWith("question-")))
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
x.abort(), x = new AbortController();
|
|
329
|
-
const S = e.nodes.find((A) => A.id ===
|
|
329
|
+
const S = e.nodes.find((A) => A.id === _[_.length - v]);
|
|
330
330
|
return le(S, "Undo failed: new start node not found"), p(S, E), {
|
|
331
331
|
removed: v
|
|
332
332
|
};
|
|
@@ -336,93 +336,93 @@ const Nt = ({
|
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
338
|
}, Qe = (e) => `+${e.countryCode} ${e.phoneNumber}`;
|
|
339
|
-
async function
|
|
339
|
+
async function Zr(e) {
|
|
340
340
|
const t = e.node;
|
|
341
341
|
switch (t.type) {
|
|
342
342
|
case "text":
|
|
343
|
-
return
|
|
343
|
+
return sn({
|
|
344
344
|
...e,
|
|
345
345
|
node: t
|
|
346
346
|
});
|
|
347
347
|
case "image":
|
|
348
|
-
return
|
|
348
|
+
return an({
|
|
349
349
|
...e,
|
|
350
350
|
node: t
|
|
351
351
|
});
|
|
352
352
|
case "question-text":
|
|
353
|
-
return
|
|
353
|
+
return on({
|
|
354
354
|
...e,
|
|
355
355
|
node: t
|
|
356
356
|
});
|
|
357
357
|
case "question-enum":
|
|
358
|
-
return
|
|
358
|
+
return cn({
|
|
359
359
|
...e,
|
|
360
360
|
node: t
|
|
361
361
|
});
|
|
362
362
|
case "question-number":
|
|
363
|
-
return
|
|
363
|
+
return ln({
|
|
364
364
|
...e,
|
|
365
365
|
node: t
|
|
366
366
|
});
|
|
367
367
|
case "question-phone":
|
|
368
|
-
return
|
|
368
|
+
return un({
|
|
369
369
|
...e,
|
|
370
370
|
node: t
|
|
371
371
|
});
|
|
372
372
|
case "question-boolean":
|
|
373
|
-
return
|
|
373
|
+
return dn({
|
|
374
374
|
...e,
|
|
375
375
|
node: t
|
|
376
376
|
});
|
|
377
377
|
case "question-file":
|
|
378
|
-
return
|
|
378
|
+
return hn({
|
|
379
379
|
...e,
|
|
380
380
|
node: t
|
|
381
381
|
});
|
|
382
382
|
case "question-address":
|
|
383
|
-
return
|
|
383
|
+
return fn({
|
|
384
384
|
...e,
|
|
385
385
|
node: t
|
|
386
386
|
});
|
|
387
387
|
case "end-flow":
|
|
388
|
-
return
|
|
388
|
+
return pn({
|
|
389
389
|
...e,
|
|
390
390
|
node: t
|
|
391
391
|
});
|
|
392
392
|
case "if-block":
|
|
393
|
-
return
|
|
393
|
+
return nn({
|
|
394
394
|
...e,
|
|
395
395
|
node: t
|
|
396
396
|
});
|
|
397
397
|
case "jump":
|
|
398
|
-
return
|
|
398
|
+
return Yr({
|
|
399
399
|
...e,
|
|
400
400
|
node: t
|
|
401
401
|
});
|
|
402
402
|
case "link":
|
|
403
|
-
return
|
|
403
|
+
return rn({
|
|
404
404
|
...e,
|
|
405
405
|
node: t
|
|
406
406
|
});
|
|
407
407
|
case "integration-application-submit":
|
|
408
|
-
return
|
|
408
|
+
return tn({
|
|
409
409
|
...e,
|
|
410
410
|
node: t
|
|
411
411
|
});
|
|
412
412
|
case "add-submission":
|
|
413
|
-
return
|
|
413
|
+
return en({
|
|
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 Xr({
|
|
421
421
|
...e,
|
|
422
422
|
node: t
|
|
423
423
|
});
|
|
424
424
|
case "feedback":
|
|
425
|
-
return
|
|
425
|
+
return Qr({
|
|
426
426
|
...e,
|
|
427
427
|
node: t
|
|
428
428
|
});
|
|
@@ -437,13 +437,13 @@ const Ie = (e, t) => {
|
|
|
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 Qr({
|
|
441
441
|
next: e,
|
|
442
442
|
node: t
|
|
443
443
|
}) {
|
|
444
444
|
e(t.nextId);
|
|
445
445
|
}
|
|
446
|
-
async function
|
|
446
|
+
async function Xr({
|
|
447
447
|
next: e,
|
|
448
448
|
node: t,
|
|
449
449
|
analytics: r,
|
|
@@ -476,13 +476,13 @@ async function Yr({
|
|
|
476
476
|
e(t.nextId);
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
async function
|
|
479
|
+
async function Yr({
|
|
480
480
|
next: e,
|
|
481
481
|
node: t
|
|
482
482
|
}) {
|
|
483
483
|
e(t.data.targetId);
|
|
484
484
|
}
|
|
485
|
-
async function
|
|
485
|
+
async function en({
|
|
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 tn({
|
|
505
505
|
chat: e,
|
|
506
506
|
next: t,
|
|
507
507
|
node: r,
|
|
@@ -510,7 +510,7 @@ async function rn({
|
|
|
510
510
|
submissions: a,
|
|
511
511
|
analytics: i,
|
|
512
512
|
flow: u,
|
|
513
|
-
t:
|
|
513
|
+
t: d
|
|
514
514
|
}) {
|
|
515
515
|
const h = async (x) => {
|
|
516
516
|
x !== !0 && await e.userInput({
|
|
@@ -523,23 +523,23 @@ async function rn({
|
|
|
523
523
|
type: "loading"
|
|
524
524
|
});
|
|
525
525
|
const {
|
|
526
|
-
anonymous_id:
|
|
526
|
+
anonymous_id: y,
|
|
527
527
|
session_id: p
|
|
528
|
-
} = i.getSessionInfo(),
|
|
528
|
+
} = i.getSessionInfo(), _ = await s.fetch("/flow/submit", {
|
|
529
529
|
method: "POST",
|
|
530
530
|
body: JSON.stringify({
|
|
531
531
|
log_submit: !1,
|
|
532
532
|
integration_id: r.data.integrationId,
|
|
533
|
-
anonymous_id:
|
|
533
|
+
anonymous_id: y,
|
|
534
534
|
session_id: p,
|
|
535
535
|
job: u.job,
|
|
536
|
-
submissions:
|
|
536
|
+
submissions: Mr(a || {})
|
|
537
537
|
})
|
|
538
538
|
}).catch((v) => v);
|
|
539
539
|
r.data.key && e.addToSubmissions(r.data.key, {
|
|
540
540
|
type: "integration",
|
|
541
|
-
value:
|
|
542
|
-
}), Ke(
|
|
541
|
+
value: _
|
|
542
|
+
}), Ke(_).with({
|
|
543
543
|
integration_response: I.select(I.union({
|
|
544
544
|
service: I.optional(I.string),
|
|
545
545
|
status: I.number,
|
|
@@ -569,7 +569,7 @@ async function rn({
|
|
|
569
569
|
}
|
|
570
570
|
});
|
|
571
571
|
}).otherwise(() => {
|
|
572
|
-
}), await Ke(
|
|
572
|
+
}), await Ke(_).with(I.union({
|
|
573
573
|
ats_data: I.select("redirect", {
|
|
574
574
|
redirect_url: I.string,
|
|
575
575
|
message: I.optional(I.union(I.string, I.nullish)),
|
|
@@ -588,14 +588,14 @@ async function rn({
|
|
|
588
588
|
await e.sendMessage({
|
|
589
589
|
type: "text",
|
|
590
590
|
author: "bot",
|
|
591
|
-
text: v.redirect.message ??
|
|
591
|
+
text: v.redirect.message ?? d("submission_redirect_message")
|
|
592
592
|
});
|
|
593
593
|
try {
|
|
594
594
|
const E = new URL(v.redirect.redirect_url);
|
|
595
|
-
|
|
595
|
+
y && !E.searchParams.has("anonymous_id") && E.searchParams.set("anonymous_id", y), await e.sendMessage({
|
|
596
596
|
type: "link",
|
|
597
597
|
href: E.toString(),
|
|
598
|
-
text: v.redirect.button_text ??
|
|
598
|
+
text: v.redirect.button_text ?? d("complete_submission"),
|
|
599
599
|
onClick: () => {
|
|
600
600
|
if (!p) {
|
|
601
601
|
n.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
@@ -618,7 +618,7 @@ async function rn({
|
|
|
618
618
|
n.error(`Invalid redirect URL: ${v.redirect.redirect_url}`, E), e.sendMessage({
|
|
619
619
|
type: "system",
|
|
620
620
|
variant: "error",
|
|
621
|
-
text:
|
|
621
|
+
text: d("redirect_url_error")
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
t(r.nextId);
|
|
@@ -629,7 +629,7 @@ async function rn({
|
|
|
629
629
|
r.data.skipConfirmation !== !0 && await e.sendMessage({
|
|
630
630
|
type: "system",
|
|
631
631
|
variant: "success",
|
|
632
|
-
text:
|
|
632
|
+
text: d("submission_completed")
|
|
633
633
|
}), t(r.nextId);
|
|
634
634
|
}).with(I.union({
|
|
635
635
|
success: !1,
|
|
@@ -647,19 +647,19 @@ async function rn({
|
|
|
647
647
|
n.error(v.error), await e.sendMessage({
|
|
648
648
|
type: "system",
|
|
649
649
|
variant: "error",
|
|
650
|
-
text: ((E = v.error) == null ? void 0 : E.message) ||
|
|
650
|
+
text: ((E = v.error) == null ? void 0 : E.message) || d("submission_failed")
|
|
651
651
|
}), await h(!1);
|
|
652
652
|
}).otherwise(async (v) => {
|
|
653
653
|
n.error(v), await e.sendMessage({
|
|
654
654
|
type: "system",
|
|
655
655
|
variant: "error",
|
|
656
|
-
text:
|
|
656
|
+
text: d("submission_failed")
|
|
657
657
|
}), await h(!1);
|
|
658
658
|
});
|
|
659
659
|
};
|
|
660
660
|
await h(r.data.skipConfirmation);
|
|
661
661
|
}
|
|
662
|
-
async function
|
|
662
|
+
async function rn({
|
|
663
663
|
chat: e,
|
|
664
664
|
next: t,
|
|
665
665
|
node: r,
|
|
@@ -678,7 +678,7 @@ async function nn({
|
|
|
678
678
|
})
|
|
679
679
|
}), t(r.nextId);
|
|
680
680
|
}
|
|
681
|
-
async function
|
|
681
|
+
async function nn({
|
|
682
682
|
submissions: e,
|
|
683
683
|
next: t,
|
|
684
684
|
node: r,
|
|
@@ -689,7 +689,7 @@ async function sn({
|
|
|
689
689
|
context: n
|
|
690
690
|
}) ? r.branchId : r.nextId);
|
|
691
691
|
}
|
|
692
|
-
async function
|
|
692
|
+
async function sn({
|
|
693
693
|
chat: e,
|
|
694
694
|
next: t,
|
|
695
695
|
node: r,
|
|
@@ -705,7 +705,7 @@ async function an({
|
|
|
705
705
|
})
|
|
706
706
|
}), t(r.nextId);
|
|
707
707
|
}
|
|
708
|
-
async function
|
|
708
|
+
async function an({
|
|
709
709
|
chat: e,
|
|
710
710
|
next: t,
|
|
711
711
|
node: r
|
|
@@ -718,7 +718,7 @@ async function on({
|
|
|
718
718
|
width: r.data.width
|
|
719
719
|
}), t(r.nextId);
|
|
720
720
|
}
|
|
721
|
-
async function
|
|
721
|
+
async function on({
|
|
722
722
|
chat: e,
|
|
723
723
|
next: t,
|
|
724
724
|
node: r,
|
|
@@ -766,7 +766,7 @@ async function ln({
|
|
|
766
766
|
text: i.type === "phone" ? Qe(i.value) : i.value
|
|
767
767
|
}), t(r.nextId);
|
|
768
768
|
}
|
|
769
|
-
async function
|
|
769
|
+
async function ln({
|
|
770
770
|
chat: e,
|
|
771
771
|
next: t,
|
|
772
772
|
node: r,
|
|
@@ -803,7 +803,7 @@ async function un({
|
|
|
803
803
|
text: i.value.toString()
|
|
804
804
|
}), t(r.nextId);
|
|
805
805
|
}
|
|
806
|
-
async function
|
|
806
|
+
async function un({
|
|
807
807
|
chat: e,
|
|
808
808
|
next: t,
|
|
809
809
|
node: r,
|
|
@@ -842,7 +842,7 @@ async function cn({
|
|
|
842
842
|
text: a.type === "phone" ? Qe(a.value) : a.value
|
|
843
843
|
}), t(r.nextId);
|
|
844
844
|
}
|
|
845
|
-
async function
|
|
845
|
+
async function cn({
|
|
846
846
|
chat: e,
|
|
847
847
|
next: t,
|
|
848
848
|
node: r,
|
|
@@ -873,7 +873,7 @@ async function dn({
|
|
|
873
873
|
text: r.data.options.filter((u) => i.value.includes(u.value)).map((u) => u.label).join(", ")
|
|
874
874
|
}), t(r.nextId);
|
|
875
875
|
}
|
|
876
|
-
async function
|
|
876
|
+
async function dn({
|
|
877
877
|
chat: e,
|
|
878
878
|
next: t,
|
|
879
879
|
node: r,
|
|
@@ -910,7 +910,7 @@ async function fn({
|
|
|
910
910
|
text: i.value === !0 ? r.data.trueLabel : r.data.falseLabel
|
|
911
911
|
}), t(r.nextId);
|
|
912
912
|
}
|
|
913
|
-
async function
|
|
913
|
+
async function fn({
|
|
914
914
|
chat: e,
|
|
915
915
|
next: t,
|
|
916
916
|
node: r,
|
|
@@ -946,7 +946,7 @@ async function hn({
|
|
|
946
946
|
}
|
|
947
947
|
return t(r.nextId);
|
|
948
948
|
}
|
|
949
|
-
async function
|
|
949
|
+
async function hn({
|
|
950
950
|
node: e,
|
|
951
951
|
chat: t,
|
|
952
952
|
next: r,
|
|
@@ -989,7 +989,7 @@ async function pn({
|
|
|
989
989
|
});
|
|
990
990
|
r(e.nextId);
|
|
991
991
|
}
|
|
992
|
-
async function
|
|
992
|
+
async function pn({
|
|
993
993
|
chat: e,
|
|
994
994
|
end: t,
|
|
995
995
|
node: r
|
|
@@ -1000,7 +1000,7 @@ async function mn({
|
|
|
1000
1000
|
text: r.data.systemMessage
|
|
1001
1001
|
}), t();
|
|
1002
1002
|
}
|
|
1003
|
-
const
|
|
1003
|
+
const or = ({
|
|
1004
1004
|
key: e,
|
|
1005
1005
|
path: t,
|
|
1006
1006
|
submissions: r,
|
|
@@ -1033,17 +1033,17 @@ const lr = ({
|
|
|
1033
1033
|
}
|
|
1034
1034
|
return r == null ? void 0 : r[e];
|
|
1035
1035
|
};
|
|
1036
|
-
function
|
|
1036
|
+
function ft(e, t, r) {
|
|
1037
1037
|
var n, s, a, i, u;
|
|
1038
1038
|
t == null && (t = 100);
|
|
1039
|
-
function
|
|
1039
|
+
function d() {
|
|
1040
1040
|
var x = Date.now() - i;
|
|
1041
|
-
x < t && x >= 0 ? n = setTimeout(
|
|
1041
|
+
x < t && x >= 0 ? n = setTimeout(d, t - x) : (n = null, r || (u = e.apply(a, s), a = s = null));
|
|
1042
1042
|
}
|
|
1043
1043
|
var h = function() {
|
|
1044
1044
|
a = this, s = arguments, i = Date.now();
|
|
1045
1045
|
var x = r && !n;
|
|
1046
|
-
return n || (n = setTimeout(
|
|
1046
|
+
return n || (n = setTimeout(d, t)), x && (u = e.apply(a, s), a = s = null), u;
|
|
1047
1047
|
};
|
|
1048
1048
|
return h.clear = function() {
|
|
1049
1049
|
n && (clearTimeout(n), n = null);
|
|
@@ -1051,10 +1051,10 @@ function ht(e, t, r) {
|
|
|
1051
1051
|
n && (u = e.apply(a, s), a = s = null, clearTimeout(n), n = null);
|
|
1052
1052
|
}, h;
|
|
1053
1053
|
}
|
|
1054
|
-
|
|
1055
|
-
var
|
|
1056
|
-
const
|
|
1057
|
-
function
|
|
1054
|
+
ft.debounce = ft;
|
|
1055
|
+
var mn = ft;
|
|
1056
|
+
const Lt = /* @__PURE__ */ rr(mn);
|
|
1057
|
+
function gn(e) {
|
|
1058
1058
|
let {
|
|
1059
1059
|
debounce: t,
|
|
1060
1060
|
scroll: r,
|
|
@@ -1078,16 +1078,16 @@ function yn(e) {
|
|
|
1078
1078
|
right: 0,
|
|
1079
1079
|
x: 0,
|
|
1080
1080
|
y: 0
|
|
1081
|
-
}),
|
|
1081
|
+
}), d = re({
|
|
1082
1082
|
element: null,
|
|
1083
1083
|
scrollContainers: null,
|
|
1084
1084
|
resizeObserver: null,
|
|
1085
1085
|
lastBounds: i
|
|
1086
|
-
}), h = t ? typeof t == "number" ? t : t.scroll : null, x = t ? typeof t == "number" ? t : t.resize : null,
|
|
1087
|
-
ue(() => (
|
|
1088
|
-
const [p,
|
|
1086
|
+
}), h = t ? typeof t == "number" ? t : t.scroll : null, x = t ? typeof t == "number" ? t : t.resize : null, y = re(!1);
|
|
1087
|
+
ue(() => (y.current = !0, () => void (y.current = !1)));
|
|
1088
|
+
const [p, _, v] = pt(() => {
|
|
1089
1089
|
const g = () => {
|
|
1090
|
-
if (!
|
|
1090
|
+
if (!d.current.element)
|
|
1091
1091
|
return;
|
|
1092
1092
|
const {
|
|
1093
1093
|
left: T,
|
|
@@ -1098,7 +1098,7 @@ function yn(e) {
|
|
|
1098
1098
|
right: Ae,
|
|
1099
1099
|
x: G,
|
|
1100
1100
|
y: se
|
|
1101
|
-
} =
|
|
1101
|
+
} = d.current.element.getBoundingClientRect(), q = {
|
|
1102
1102
|
left: T,
|
|
1103
1103
|
top: P,
|
|
1104
1104
|
width: D,
|
|
@@ -1108,33 +1108,33 @@ function yn(e) {
|
|
|
1108
1108
|
x: G,
|
|
1109
1109
|
y: se
|
|
1110
1110
|
};
|
|
1111
|
-
|
|
1111
|
+
d.current.element instanceof HTMLElement && s && (q.height = d.current.element.offsetHeight, q.width = d.current.element.offsetWidth), Object.freeze(q), y.current && !xn(d.current.lastBounds, q) && u(d.current.lastBounds = q);
|
|
1112
1112
|
};
|
|
1113
|
-
return [g, x ?
|
|
1113
|
+
return [g, x ? Lt(g, x) : g, h ? Lt(g, h) : g];
|
|
1114
1114
|
}, [u, s, h, x]);
|
|
1115
1115
|
function E() {
|
|
1116
|
-
|
|
1116
|
+
d.current.scrollContainers && (d.current.scrollContainers.forEach((g) => g.removeEventListener("scroll", v, !0)), d.current.scrollContainers = null), d.current.resizeObserver && (d.current.resizeObserver.disconnect(), d.current.resizeObserver = null);
|
|
1117
1117
|
}
|
|
1118
1118
|
function S() {
|
|
1119
|
-
|
|
1119
|
+
d.current.element && (d.current.resizeObserver = new a(v), d.current.resizeObserver.observe(d.current.element), r && d.current.scrollContainers && d.current.scrollContainers.forEach((g) => g.addEventListener("scroll", v, {
|
|
1120
1120
|
capture: !0,
|
|
1121
1121
|
passive: !0
|
|
1122
1122
|
})));
|
|
1123
1123
|
}
|
|
1124
1124
|
const A = (g) => {
|
|
1125
|
-
!g || g ===
|
|
1125
|
+
!g || g === d.current.element || (E(), d.current.element = g, d.current.scrollContainers = lr(g), S());
|
|
1126
1126
|
};
|
|
1127
|
-
return
|
|
1127
|
+
return bn(v, !!r), yn(_), ue(() => {
|
|
1128
1128
|
E(), S();
|
|
1129
|
-
}, [r, v,
|
|
1129
|
+
}, [r, v, _]), ue(() => E, []), [A, i, p];
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function yn(e) {
|
|
1132
1132
|
ue(() => {
|
|
1133
1133
|
const t = e;
|
|
1134
1134
|
return window.addEventListener("resize", t), () => void window.removeEventListener("resize", t);
|
|
1135
1135
|
}, [e]);
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function bn(e, t) {
|
|
1138
1138
|
ue(() => {
|
|
1139
1139
|
if (t) {
|
|
1140
1140
|
const r = e;
|
|
@@ -1145,7 +1145,7 @@ function vn(e, t) {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
}, [e, t]);
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1148
|
+
function lr(e) {
|
|
1149
1149
|
const t = [];
|
|
1150
1150
|
if (!e || e === document.body)
|
|
1151
1151
|
return t;
|
|
@@ -1154,17 +1154,17 @@ function ur(e) {
|
|
|
1154
1154
|
overflowX: n,
|
|
1155
1155
|
overflowY: s
|
|
1156
1156
|
} = window.getComputedStyle(e);
|
|
1157
|
-
return [r, n, s].some((a) => a === "auto" || a === "scroll") && t.push(e), [...t, ...
|
|
1157
|
+
return [r, n, s].some((a) => a === "auto" || a === "scroll") && t.push(e), [...t, ...lr(e.parentElement)];
|
|
1158
1158
|
}
|
|
1159
|
-
const
|
|
1159
|
+
const vn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], xn = (e, t) => vn.every((r) => e[r] === t[r]), be = ({
|
|
1160
1160
|
class: e,
|
|
1161
1161
|
...t
|
|
1162
1162
|
}) => {
|
|
1163
1163
|
const {
|
|
1164
1164
|
t: r
|
|
1165
|
-
} =
|
|
1165
|
+
} = J();
|
|
1166
1166
|
return l("button", {
|
|
1167
|
-
class:
|
|
1167
|
+
class: Le("bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50", e),
|
|
1168
1168
|
type: "submit",
|
|
1169
1169
|
...t,
|
|
1170
1170
|
children: l("svg", {
|
|
@@ -1185,23 +1185,23 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1185
1185
|
})]
|
|
1186
1186
|
})
|
|
1187
1187
|
});
|
|
1188
|
-
},
|
|
1188
|
+
}, wn = 25, ht = dt({
|
|
1189
1189
|
instant: () => {
|
|
1190
1190
|
},
|
|
1191
1191
|
smooth: () => {
|
|
1192
1192
|
}
|
|
1193
1193
|
}), z = {
|
|
1194
|
-
onSubmitSuccessFn$:
|
|
1194
|
+
onSubmitSuccessFn$: dt(() => {
|
|
1195
1195
|
}),
|
|
1196
|
-
isBotTyping$:
|
|
1196
|
+
isBotTyping$: dt(!1),
|
|
1197
1197
|
scrollToEnd: {
|
|
1198
|
-
instant: () =>
|
|
1199
|
-
smooth: () =>
|
|
1198
|
+
instant: () => ht.value.instant(),
|
|
1199
|
+
smooth: () => ht.value.smooth()
|
|
1200
1200
|
}
|
|
1201
1201
|
}, _n = () => {
|
|
1202
1202
|
const e = re(null);
|
|
1203
1203
|
pe(() => {
|
|
1204
|
-
|
|
1204
|
+
ht.value = {
|
|
1205
1205
|
instant: () => {
|
|
1206
1206
|
var r;
|
|
1207
1207
|
return (r = e.current) == null ? void 0 : r.scrollTo({
|
|
@@ -1217,7 +1217,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1217
1217
|
}
|
|
1218
1218
|
};
|
|
1219
1219
|
}, [e]);
|
|
1220
|
-
const t =
|
|
1220
|
+
const t = pt(() => ({
|
|
1221
1221
|
addToSubmissions: (n, s) => M.setSubmission(n, s),
|
|
1222
1222
|
send: async ({
|
|
1223
1223
|
message: n,
|
|
@@ -1231,8 +1231,8 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1231
1231
|
if (s != null && s.aborted)
|
|
1232
1232
|
throw new Me();
|
|
1233
1233
|
z.isBotTyping$.value = !0;
|
|
1234
|
-
const u = Math.min(Math.max(20, i.text.length), 100) *
|
|
1235
|
-
await new Promise((
|
|
1234
|
+
const u = Math.min(Math.max(20, i.text.length), 100) * wn;
|
|
1235
|
+
await new Promise((d) => setTimeout(d, u, {
|
|
1236
1236
|
signal: s
|
|
1237
1237
|
})), z.isBotTyping$.value = !1;
|
|
1238
1238
|
}).otherwise(async () => {
|
|
@@ -1299,10 +1299,10 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1299
1299
|
}) => {
|
|
1300
1300
|
const {
|
|
1301
1301
|
t: r
|
|
1302
|
-
} =
|
|
1302
|
+
} = J();
|
|
1303
1303
|
return l("button", {
|
|
1304
1304
|
type: "button",
|
|
1305
|
-
class:
|
|
1305
|
+
class: Le("fr text-neutral-9 flex flex-shrink-0 items-center justify-center gap-1 rounded-full py-[6px] pl-2 pr-3 text-sm underline-offset-2 transition-all", e),
|
|
1306
1306
|
...t,
|
|
1307
1307
|
children: [l("svg", {
|
|
1308
1308
|
"aria-hidden": !0,
|
|
@@ -1323,7 +1323,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1323
1323
|
})]
|
|
1324
1324
|
}), r("skip")]
|
|
1325
1325
|
});
|
|
1326
|
-
},
|
|
1326
|
+
}, mt = {
|
|
1327
1327
|
Afghanistan: "93",
|
|
1328
1328
|
Albania: "355",
|
|
1329
1329
|
Algeria: "213",
|
|
@@ -1581,10 +1581,10 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1581
1581
|
defaultVariants: {
|
|
1582
1582
|
optional: !1
|
|
1583
1583
|
}
|
|
1584
|
-
}),
|
|
1584
|
+
}), kn = "https://api.mapbox.com/search/searchbox/v1/suggest", Sn = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", Cn = (e) => atob(e).split("").reverse().join(""), ae = he({
|
|
1585
1585
|
name: ee()
|
|
1586
|
-
}),
|
|
1587
|
-
suggestions:
|
|
1586
|
+
}), An = he({
|
|
1587
|
+
suggestions: Fr(he({
|
|
1588
1588
|
full_address: at(ee()),
|
|
1589
1589
|
place_formatted: at(ee()),
|
|
1590
1590
|
name: at(ee()),
|
|
@@ -1601,43 +1601,43 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1601
1601
|
country: ae
|
|
1602
1602
|
}))
|
|
1603
1603
|
}))
|
|
1604
|
-
}),
|
|
1604
|
+
}), En = ({
|
|
1605
1605
|
logger: e,
|
|
1606
1606
|
t
|
|
1607
|
-
}) =>
|
|
1607
|
+
}) => pt(() => {
|
|
1608
1608
|
var n;
|
|
1609
1609
|
const r = (n = M.current$.peek().flow) == null ? void 0 : n.data.flowSessionId;
|
|
1610
1610
|
return r ? {
|
|
1611
1611
|
enabled: !0,
|
|
1612
1612
|
getPredictions: async (s) => {
|
|
1613
|
-
const a = new URL(
|
|
1614
|
-
a.searchParams.set("q", s), a.searchParams.set("session_token", r), a.searchParams.set("access_token",
|
|
1613
|
+
const a = new URL(kn);
|
|
1614
|
+
a.searchParams.set("q", s), a.searchParams.set("session_token", r), a.searchParams.set("access_token", Cn(Sn));
|
|
1615
1615
|
const i = await fetch(a);
|
|
1616
1616
|
if (!i.ok)
|
|
1617
1617
|
return e.error("Failed to get address details", i), {
|
|
1618
1618
|
ok: !1,
|
|
1619
1619
|
error: t("address_error")
|
|
1620
1620
|
};
|
|
1621
|
-
const u =
|
|
1621
|
+
const u = Lr(An, await i.json());
|
|
1622
1622
|
if (u.success === !1)
|
|
1623
1623
|
return e.error("Failed to parse address details", u.issues), {
|
|
1624
1624
|
ok: !1,
|
|
1625
1625
|
error: t("address_error")
|
|
1626
1626
|
};
|
|
1627
1627
|
const {
|
|
1628
|
-
suggestions:
|
|
1628
|
+
suggestions: d
|
|
1629
1629
|
} = u.output;
|
|
1630
1630
|
return {
|
|
1631
1631
|
ok: !0,
|
|
1632
|
-
data:
|
|
1633
|
-
var x,
|
|
1632
|
+
data: d.map((h) => {
|
|
1633
|
+
var x, y, p, _, v, E, S, A, g;
|
|
1634
1634
|
return {
|
|
1635
1635
|
label: h.full_address ?? h.place_formatted ?? h.name ?? h.mapbox_id,
|
|
1636
1636
|
id: h.mapbox_id,
|
|
1637
1637
|
address: {
|
|
1638
|
-
line1: ((x = h.context.address) == null ? void 0 : x.name) ?? ((
|
|
1638
|
+
line1: ((x = h.context.address) == null ? void 0 : x.name) ?? ((y = h.context.street) == null ? void 0 : y.name),
|
|
1639
1639
|
line2: void 0,
|
|
1640
|
-
line3: ((p = h.context.neighborhood) == null ? void 0 : p.name) ?? ((
|
|
1640
|
+
line3: ((p = h.context.neighborhood) == null ? void 0 : p.name) ?? ((_ = h.context.locality) == null ? void 0 : _.name),
|
|
1641
1641
|
city: ((v = h.context.place) == null ? void 0 : v.name) ?? ((E = h.context.district) == null ? void 0 : E.name),
|
|
1642
1642
|
state: (S = h.context.region) == null ? void 0 : S.name,
|
|
1643
1643
|
postcode: (A = h.context.postcode) == null ? void 0 : A.name,
|
|
@@ -1650,10 +1650,10 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1650
1650
|
} : {
|
|
1651
1651
|
enabled: !1
|
|
1652
1652
|
};
|
|
1653
|
-
}, [e, t]),
|
|
1653
|
+
}, [e, t]), Tt = (e) => {
|
|
1654
1654
|
const {
|
|
1655
1655
|
t
|
|
1656
|
-
} =
|
|
1656
|
+
} = J();
|
|
1657
1657
|
return l("button", {
|
|
1658
1658
|
type: "button",
|
|
1659
1659
|
class: "text-neutral-10 hover:bg-neutral-4 hover:text-neutral-12 hover:border-neutral-5 flex items-center gap-1 rounded-[18px] border border-solid border-transparent px-3 py-1 pl-1.5 text-sm transition-colors",
|
|
@@ -1673,21 +1673,21 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1673
1673
|
children: t("back")
|
|
1674
1674
|
})]
|
|
1675
1675
|
});
|
|
1676
|
-
},
|
|
1676
|
+
}, In = ({
|
|
1677
1677
|
input: e,
|
|
1678
1678
|
onSubmitSuccess: t,
|
|
1679
1679
|
logger: r
|
|
1680
1680
|
}) => {
|
|
1681
1681
|
const {
|
|
1682
1682
|
t: n
|
|
1683
|
-
} =
|
|
1684
|
-
enabled:
|
|
1683
|
+
} = J(), [s, a] = Y(), [i, u] = Y([]), {
|
|
1684
|
+
enabled: d,
|
|
1685
1685
|
getPredictions: h
|
|
1686
|
-
} =
|
|
1686
|
+
} = En({
|
|
1687
1687
|
logger: r,
|
|
1688
1688
|
t: n
|
|
1689
|
-
}), [x,
|
|
1690
|
-
le(
|
|
1689
|
+
}), [x, y] = Y(d ? "query" : "manual"), [p, _] = Y(""), [v, E] = Y(), S = (A) => {
|
|
1690
|
+
le(d, "Query state should not be enabled"), A = A.trim(), A !== (p == null ? void 0 : p.trim()) && (_(A), A === "" && u([]), E(void 0), h(A).then((g) => {
|
|
1691
1691
|
if (g.ok === !1) {
|
|
1692
1692
|
u([]), E(g.error);
|
|
1693
1693
|
return;
|
|
@@ -1697,16 +1697,16 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1697
1697
|
};
|
|
1698
1698
|
switch (x) {
|
|
1699
1699
|
case "query":
|
|
1700
|
-
return le(
|
|
1700
|
+
return le(d, "Query state should not be enabled"), l(Vn, {
|
|
1701
1701
|
input: e,
|
|
1702
1702
|
onSkip: () => t(null),
|
|
1703
1703
|
onAddressSelect: (A) => {
|
|
1704
1704
|
if (A === "") {
|
|
1705
|
-
a(void 0),
|
|
1705
|
+
a(void 0), y("manual");
|
|
1706
1706
|
return;
|
|
1707
1707
|
}
|
|
1708
1708
|
const g = i.find((T) => T.id === A);
|
|
1709
|
-
g && (a(g.address),
|
|
1709
|
+
g && (a(g.address), y("details"));
|
|
1710
1710
|
},
|
|
1711
1711
|
onAddressSearch: (A) => {
|
|
1712
1712
|
S(A);
|
|
@@ -1716,31 +1716,31 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1716
1716
|
error: v
|
|
1717
1717
|
});
|
|
1718
1718
|
case "details":
|
|
1719
|
-
return le(s !== void 0), l(
|
|
1719
|
+
return le(s !== void 0), l(Rt, {
|
|
1720
1720
|
input: e,
|
|
1721
1721
|
logger: r,
|
|
1722
1722
|
onSubmitSuccess: t,
|
|
1723
1723
|
addressFields: s,
|
|
1724
|
-
actions: l(
|
|
1724
|
+
actions: l(Tt, {
|
|
1725
1725
|
onClick: () => {
|
|
1726
|
-
|
|
1726
|
+
y("query");
|
|
1727
1727
|
}
|
|
1728
1728
|
})
|
|
1729
1729
|
});
|
|
1730
1730
|
case "manual":
|
|
1731
|
-
return l(
|
|
1731
|
+
return l(Rt, {
|
|
1732
1732
|
logger: r,
|
|
1733
1733
|
input: e,
|
|
1734
1734
|
onSubmitSuccess: t,
|
|
1735
1735
|
addressFields: {},
|
|
1736
|
-
actions:
|
|
1736
|
+
actions: d ? l(Tt, {
|
|
1737
1737
|
onClick: () => {
|
|
1738
|
-
|
|
1738
|
+
y("query");
|
|
1739
1739
|
}
|
|
1740
1740
|
}) : void 0
|
|
1741
1741
|
});
|
|
1742
1742
|
}
|
|
1743
|
-
},
|
|
1743
|
+
}, Vn = ({
|
|
1744
1744
|
input: e,
|
|
1745
1745
|
onSkip: t,
|
|
1746
1746
|
suggestions: r,
|
|
@@ -1751,22 +1751,22 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1751
1751
|
}) => {
|
|
1752
1752
|
const {
|
|
1753
1753
|
t: u
|
|
1754
|
-
} =
|
|
1754
|
+
} = J(), d = re(null);
|
|
1755
1755
|
return pe(() => {
|
|
1756
|
-
|
|
1757
|
-
}, []), l(
|
|
1756
|
+
d.current && (d.current.focus(), d.current.select());
|
|
1757
|
+
}, []), l(ke, {
|
|
1758
1758
|
children: [l("form", {
|
|
1759
1759
|
noValidate: !0,
|
|
1760
1760
|
onSubmit: (h) => {
|
|
1761
1761
|
h.preventDefault();
|
|
1762
|
-
const
|
|
1763
|
-
typeof
|
|
1762
|
+
const y = new FormData(h.currentTarget).get("address");
|
|
1763
|
+
typeof y == "string" && a(y);
|
|
1764
1764
|
},
|
|
1765
1765
|
class: "flex gap-1 p-2.5",
|
|
1766
1766
|
children: [l("div", {
|
|
1767
1767
|
class: "group relative flex-1",
|
|
1768
1768
|
children: [l("input", {
|
|
1769
|
-
ref:
|
|
1769
|
+
ref: d,
|
|
1770
1770
|
name: "address",
|
|
1771
1771
|
id: "chat-address",
|
|
1772
1772
|
autocomplete: "address-line1 country-name postal-code",
|
|
@@ -1851,15 +1851,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1851
1851
|
}, "")]
|
|
1852
1852
|
})]
|
|
1853
1853
|
});
|
|
1854
|
-
},
|
|
1855
|
-
line1: "Line 1",
|
|
1856
|
-
line2: "Line 2",
|
|
1857
|
-
line3: "Line 3",
|
|
1858
|
-
city: "City",
|
|
1859
|
-
state: "State",
|
|
1860
|
-
postcode: "Postcode",
|
|
1861
|
-
country: "Country"
|
|
1862
|
-
}, Rt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Ot = ({
|
|
1854
|
+
}, Dt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Rt = ({
|
|
1863
1855
|
addressFields: e,
|
|
1864
1856
|
onSubmitSuccess: t,
|
|
1865
1857
|
actions: r,
|
|
@@ -1868,50 +1860,52 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1868
1860
|
const s = re(null);
|
|
1869
1861
|
pe(() => {
|
|
1870
1862
|
if (s.current) {
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1863
|
+
const u = s.current.querySelector("input");
|
|
1864
|
+
u && (u.focus(), u.select());
|
|
1873
1865
|
}
|
|
1874
1866
|
}, []);
|
|
1875
|
-
const a = Object.keys(
|
|
1867
|
+
const a = Object.keys(mt), {
|
|
1868
|
+
t: i
|
|
1869
|
+
} = J();
|
|
1876
1870
|
return l("form", {
|
|
1877
1871
|
class: "bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",
|
|
1878
|
-
onSubmit: (
|
|
1879
|
-
const
|
|
1872
|
+
onSubmit: (u) => {
|
|
1873
|
+
const d = new FormData(u.currentTarget), h = Object.fromEntries(d.entries());
|
|
1880
1874
|
t({
|
|
1881
1875
|
type: "address",
|
|
1882
|
-
value:
|
|
1876
|
+
value: h
|
|
1883
1877
|
});
|
|
1884
1878
|
},
|
|
1885
1879
|
children: [l("div", {
|
|
1886
1880
|
class: "bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",
|
|
1887
1881
|
ref: s,
|
|
1888
|
-
children:
|
|
1889
|
-
const
|
|
1890
|
-
return
|
|
1882
|
+
children: Dt.map((u, d) => {
|
|
1883
|
+
const h = `isdk_${u}`, x = n.config.keys[u];
|
|
1884
|
+
return x ? l(ke, {
|
|
1891
1885
|
children: [l("label", {
|
|
1892
|
-
for:
|
|
1886
|
+
for: h,
|
|
1893
1887
|
class: "text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1894
|
-
children:
|
|
1888
|
+
children: i(u)
|
|
1895
1889
|
}), l("div", {
|
|
1896
1890
|
class: "flex flex-col items-stretch gap-1.5",
|
|
1897
|
-
children: [
|
|
1891
|
+
children: [u === "country" ? l("div", {
|
|
1898
1892
|
class: "relative",
|
|
1899
1893
|
children: [l("select", {
|
|
1900
1894
|
class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",
|
|
1901
|
-
name:
|
|
1902
|
-
id:
|
|
1903
|
-
defaultValue: e[
|
|
1895
|
+
name: x,
|
|
1896
|
+
id: h,
|
|
1897
|
+
defaultValue: e[u],
|
|
1904
1898
|
required: !0,
|
|
1905
1899
|
children: [e.country && !a.includes(e.country) ? l("option", {
|
|
1906
|
-
value: e[
|
|
1907
|
-
children: e[
|
|
1900
|
+
value: e[u],
|
|
1901
|
+
children: e[u]
|
|
1908
1902
|
}) : l("option", {
|
|
1909
1903
|
value: "",
|
|
1910
|
-
children: "
|
|
1911
|
-
}), a.map((
|
|
1912
|
-
value:
|
|
1913
|
-
children:
|
|
1914
|
-
},
|
|
1904
|
+
children: i("select_country")
|
|
1905
|
+
}), a.map((y) => l("option", {
|
|
1906
|
+
value: y,
|
|
1907
|
+
children: y
|
|
1908
|
+
}, y))]
|
|
1915
1909
|
}), l("svg", {
|
|
1916
1910
|
class: "text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",
|
|
1917
1911
|
width: "16",
|
|
@@ -1928,13 +1922,13 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1928
1922
|
})
|
|
1929
1923
|
})]
|
|
1930
1924
|
}) : l("input", {
|
|
1931
|
-
autoFocus:
|
|
1925
|
+
autoFocus: d === 0 ? !0 : void 0,
|
|
1932
1926
|
class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",
|
|
1933
|
-
name:
|
|
1934
|
-
id:
|
|
1935
|
-
defaultValue: e[
|
|
1927
|
+
name: x,
|
|
1928
|
+
id: h,
|
|
1929
|
+
defaultValue: e[u],
|
|
1936
1930
|
required: !0
|
|
1937
|
-
}),
|
|
1931
|
+
}), d === Dt.length - 1 ? l("hr", {
|
|
1938
1932
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1939
1933
|
}) : l("hr", {
|
|
1940
1934
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1952,13 +1946,13 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1952
1946
|
})]
|
|
1953
1947
|
})]
|
|
1954
1948
|
});
|
|
1955
|
-
},
|
|
1949
|
+
}, gt = () => {
|
|
1956
1950
|
const e = re(null);
|
|
1957
1951
|
return ue(() => {
|
|
1958
1952
|
var t;
|
|
1959
1953
|
(t = e.current) == null || t.focus();
|
|
1960
1954
|
}, []), e;
|
|
1961
|
-
},
|
|
1955
|
+
}, ur = ["true", "false"], Mn = Dr(ur), Fn = "answer", cr = "flex items-center gap-2 p-2.5", dr = nr(({
|
|
1962
1956
|
label: e,
|
|
1963
1957
|
...t
|
|
1964
1958
|
}, r) => l("button", {
|
|
@@ -1969,30 +1963,30 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
1969
1963
|
class: "truncate text-center text-base",
|
|
1970
1964
|
children: e
|
|
1971
1965
|
})
|
|
1972
|
-
})),
|
|
1966
|
+
})), Nn = ({
|
|
1973
1967
|
input: e,
|
|
1974
1968
|
onSubmitSuccess: t
|
|
1975
1969
|
}) => {
|
|
1976
|
-
const r =
|
|
1970
|
+
const r = gt();
|
|
1977
1971
|
return l("form", {
|
|
1978
1972
|
noValidate: !0,
|
|
1979
1973
|
class: "",
|
|
1980
1974
|
onSubmit: (n) => {
|
|
1981
1975
|
n.preventDefault();
|
|
1982
|
-
const s =
|
|
1976
|
+
const s = Tr(n).value, a = sr(Mn, s);
|
|
1983
1977
|
t({
|
|
1984
1978
|
type: "boolean",
|
|
1985
1979
|
value: a === "true"
|
|
1986
1980
|
});
|
|
1987
1981
|
},
|
|
1988
1982
|
children: [l("ul", {
|
|
1989
|
-
class:
|
|
1990
|
-
children:
|
|
1983
|
+
class: cr,
|
|
1984
|
+
children: ur.map((n, s) => l("li", {
|
|
1991
1985
|
class: "flex-1",
|
|
1992
|
-
children: l(
|
|
1986
|
+
children: l(dr, {
|
|
1993
1987
|
ref: s === 0 ? r : null,
|
|
1994
1988
|
type: "submit",
|
|
1995
|
-
name:
|
|
1989
|
+
name: Fn,
|
|
1996
1990
|
value: n,
|
|
1997
1991
|
label: e.config.labels[n]
|
|
1998
1992
|
}, n)
|
|
@@ -2006,17 +2000,17 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2006
2000
|
})
|
|
2007
2001
|
})]
|
|
2008
2002
|
});
|
|
2009
|
-
},
|
|
2003
|
+
}, Ln = (e) => new Promise((t, r) => {
|
|
2010
2004
|
const n = new FileReader();
|
|
2011
2005
|
n.readAsDataURL(e), n.onload = () => n.result ? t(n.result.toString()) : r("No result from reader"), n.onerror = r;
|
|
2012
|
-
}),
|
|
2006
|
+
}), Tn = (e) => e.reduce((t, r) => t + r.sizeKb, 0), Dn = Se("file"), Ot = 3, Rn = ({
|
|
2013
2007
|
file: e,
|
|
2014
2008
|
class: t,
|
|
2015
2009
|
...r
|
|
2016
2010
|
}) => {
|
|
2017
2011
|
const n = e.name.split(".").pop(), s = e.name.replace(new RegExp(`.${n}$`), "");
|
|
2018
2012
|
return l("div", {
|
|
2019
|
-
class:
|
|
2013
|
+
class: Le("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", t),
|
|
2020
2014
|
...r,
|
|
2021
2015
|
children: [l("p", {
|
|
2022
2016
|
"aria-label": "File name",
|
|
@@ -2030,43 +2024,43 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2030
2024
|
}), l("p", {
|
|
2031
2025
|
"aria-label": "File size",
|
|
2032
2026
|
class: "text-accent-11",
|
|
2033
|
-
children:
|
|
2027
|
+
children: Ne(e.sizeKb)
|
|
2034
2028
|
})]
|
|
2035
2029
|
});
|
|
2036
|
-
},
|
|
2030
|
+
}, Bt = ({
|
|
2037
2031
|
class: e,
|
|
2038
2032
|
...t
|
|
2039
2033
|
}) => l("li", {
|
|
2040
|
-
class:
|
|
2034
|
+
class: Le("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2041
2035
|
...t
|
|
2042
|
-
}),
|
|
2036
|
+
}), fr = (e) => {
|
|
2043
2037
|
const t = e.split(".").pop();
|
|
2044
2038
|
if (!t)
|
|
2045
2039
|
throw new Error("No file extension found");
|
|
2046
2040
|
return t ? "." + t : "";
|
|
2047
|
-
},
|
|
2041
|
+
}, On = ({
|
|
2048
2042
|
allowedExtensions: e,
|
|
2049
2043
|
files: t
|
|
2050
2044
|
}) => {
|
|
2051
2045
|
const r = e.map((n) => n.toLowerCase());
|
|
2052
|
-
return t.every((n) => r.includes(
|
|
2053
|
-
},
|
|
2054
|
-
const r =
|
|
2046
|
+
return t.every((n) => r.includes(fr(n.name).toLowerCase()));
|
|
2047
|
+
}, Bn = (e, t) => {
|
|
2048
|
+
const r = fr(e);
|
|
2055
2049
|
return `${e.replace(new RegExp(`${r}$`), "").slice(0, t)}${r}`;
|
|
2056
|
-
},
|
|
2050
|
+
}, Pn = ({
|
|
2057
2051
|
input: e,
|
|
2058
2052
|
onSubmitSuccess: t
|
|
2059
2053
|
}) => {
|
|
2060
|
-
var
|
|
2061
|
-
const r = (
|
|
2054
|
+
var y;
|
|
2055
|
+
const r = (y = M.current$.value.flow) == null ? void 0 : y.data.submissions[e.key], [n, s] = Y(Dn(r) ? r.value : []), [a, i] = Y(), u = n.length - Ot, d = Tn(n), h = gt(), {
|
|
2062
2056
|
t: x
|
|
2063
|
-
} =
|
|
2057
|
+
} = J();
|
|
2064
2058
|
return l("form", {
|
|
2065
2059
|
class: "flex flex-col gap-1 p-2.5",
|
|
2066
2060
|
onSubmit: (p) => (p.preventDefault(), i(void 0), n.length === 0 ? i({
|
|
2067
2061
|
type: "required",
|
|
2068
2062
|
message: x("validation_file")
|
|
2069
|
-
}) : e.config.extensions.length > 0 && !
|
|
2063
|
+
}) : e.config.extensions.length > 0 && !On({
|
|
2070
2064
|
allowedExtensions: e.config.extensions,
|
|
2071
2065
|
files: n
|
|
2072
2066
|
}) ? i({
|
|
@@ -2074,9 +2068,9 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2074
2068
|
message: `${x("validation_file_ext", {
|
|
2075
2069
|
ext: e.config.extensions.join(", ")
|
|
2076
2070
|
})}`
|
|
2077
|
-
}) : e.config.fileSizeLimitKib &&
|
|
2071
|
+
}) : e.config.fileSizeLimitKib && d > e.config.fileSizeLimitKib ? i({
|
|
2078
2072
|
type: "max",
|
|
2079
|
-
message: `File size exceeds limit of ${
|
|
2073
|
+
message: `File size exceeds limit of ${Ne(e.config.fileSizeLimitKib)}`
|
|
2080
2074
|
}) : e.config.allowMultiple === !1 && n.length > 1 ? i({
|
|
2081
2075
|
type: "invalid",
|
|
2082
2076
|
message: x("validation_file_max", {
|
|
@@ -2092,26 +2086,26 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2092
2086
|
ref: h,
|
|
2093
2087
|
for: "dropzone-file",
|
|
2094
2088
|
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",
|
|
2095
|
-
children: [n.length > 0 ? l(
|
|
2089
|
+
children: [n.length > 0 ? l(ke, {
|
|
2096
2090
|
children: [l("ul", {
|
|
2097
2091
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2098
|
-
children: [n.slice(0,
|
|
2099
|
-
const
|
|
2100
|
-
return l(
|
|
2092
|
+
children: [n.slice(0, Ot).map((p) => {
|
|
2093
|
+
const _ = p.name.split(".").pop(), v = p.name.replace(new RegExp(`.${_}$`), "");
|
|
2094
|
+
return l(Bt, {
|
|
2101
2095
|
class: "flex overflow-hidden",
|
|
2102
2096
|
children: [l("span", {
|
|
2103
2097
|
class: "block truncate",
|
|
2104
2098
|
children: v
|
|
2105
2099
|
}), l("span", {
|
|
2106
|
-
children: [".",
|
|
2100
|
+
children: [".", _]
|
|
2107
2101
|
})]
|
|
2108
2102
|
});
|
|
2109
|
-
}), u > 0 ? l(
|
|
2103
|
+
}), u > 0 ? l(Bt, {
|
|
2110
2104
|
children: ["+", u, " file", u !== 1 ? "s" : ""]
|
|
2111
2105
|
}) : null]
|
|
2112
2106
|
}), l("p", {
|
|
2113
2107
|
class: "text-neutral-11 text-xs",
|
|
2114
|
-
children: [
|
|
2108
|
+
children: [Ne(d), " ", n.length > 1 ? "total" : ""]
|
|
2115
2109
|
})]
|
|
2116
2110
|
}) : l("div", {
|
|
2117
2111
|
class: "flex flex-col justify-center gap-4 pb-6 pt-5",
|
|
@@ -2138,7 +2132,7 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2138
2132
|
}), e.config.fileSizeLimitKib ? l("p", {
|
|
2139
2133
|
class: "text-neutral-10 text-xs",
|
|
2140
2134
|
children: ["(", x("file_max_size", {
|
|
2141
|
-
size:
|
|
2135
|
+
size: Ne(e.config.fileSizeLimitKib)
|
|
2142
2136
|
}), ")"]
|
|
2143
2137
|
}) : null]
|
|
2144
2138
|
}), l("aside", {
|
|
@@ -2160,10 +2154,10 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2160
2154
|
id: "dropzone-file",
|
|
2161
2155
|
onInput: async (p) => {
|
|
2162
2156
|
le(p.target instanceof HTMLInputElement);
|
|
2163
|
-
const
|
|
2164
|
-
const A = await
|
|
2157
|
+
const _ = p.target.files ? Array.from(p.target.files) : [], v = await Promise.allSettled(_.map(async (S) => {
|
|
2158
|
+
const A = await Ln(S);
|
|
2165
2159
|
return {
|
|
2166
|
-
name:
|
|
2160
|
+
name: Bn(S.name, 42),
|
|
2167
2161
|
data: A,
|
|
2168
2162
|
sizeKb: S.size / 1e3
|
|
2169
2163
|
};
|
|
@@ -2195,12 +2189,12 @@ const xn = ["x", "y", "top", "bottom", "left", "right", "width", "height"], wn =
|
|
|
2195
2189
|
})]
|
|
2196
2190
|
});
|
|
2197
2191
|
};
|
|
2198
|
-
var De = (e) => e.type === "checkbox",
|
|
2199
|
-
const
|
|
2200
|
-
var $ = (e) => !U(e) && !Array.isArray(e) &&
|
|
2192
|
+
var De = (e) => e.type === "checkbox", _e = (e) => e instanceof Date, U = (e) => e == null;
|
|
2193
|
+
const hr = (e) => typeof e == "object";
|
|
2194
|
+
var $ = (e) => !U(e) && !Array.isArray(e) && hr(e) && !_e(e), $n = (e) => $(e) && e.target ? De(e.target) ? e.target.checked : e.target.value : e, jn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, zn = (e, t) => e.has(jn(t)), qn = (e) => {
|
|
2201
2195
|
const t = e.constructor && e.constructor.prototype;
|
|
2202
2196
|
return $(t) && t.hasOwnProperty("isPrototypeOf");
|
|
2203
|
-
},
|
|
2197
|
+
}, yt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2204
2198
|
function oe(e) {
|
|
2205
2199
|
let t;
|
|
2206
2200
|
const r = Array.isArray(e);
|
|
@@ -2208,8 +2202,8 @@ function oe(e) {
|
|
|
2208
2202
|
t = new Date(e);
|
|
2209
2203
|
else if (e instanceof Set)
|
|
2210
2204
|
t = new Set(e);
|
|
2211
|
-
else if (!(
|
|
2212
|
-
if (t = r ? [] : {}, !r && !
|
|
2205
|
+
else if (!(yt && (e instanceof Blob || e instanceof FileList)) && (r || $(e)))
|
|
2206
|
+
if (t = r ? [] : {}, !r && !qn(e))
|
|
2213
2207
|
t = e;
|
|
2214
2208
|
else
|
|
2215
2209
|
for (const n in e)
|
|
@@ -2224,11 +2218,11 @@ var Re = (e) => Array.isArray(e) ? e.filter(Boolean) : [], O = (e) => e === void
|
|
|
2224
2218
|
const n = Re(t.split(/[,[\].]+?/)).reduce((s, a) => U(s) ? s : s[a], e);
|
|
2225
2219
|
return O(n) || n === e ? O(e[t]) ? r : e[t] : n;
|
|
2226
2220
|
}, de = (e) => typeof e == "boolean";
|
|
2227
|
-
const
|
|
2221
|
+
const Pt = {
|
|
2228
2222
|
BLUR: "blur",
|
|
2229
2223
|
FOCUS_OUT: "focusout",
|
|
2230
2224
|
CHANGE: "change"
|
|
2231
|
-
},
|
|
2225
|
+
}, Z = {
|
|
2232
2226
|
onBlur: "onBlur",
|
|
2233
2227
|
onChange: "onChange",
|
|
2234
2228
|
onSubmit: "onSubmit",
|
|
@@ -2244,7 +2238,7 @@ const $t = {
|
|
|
2244
2238
|
validate: "validate"
|
|
2245
2239
|
};
|
|
2246
2240
|
X.createContext(null);
|
|
2247
|
-
var
|
|
2241
|
+
var Un = (e, t, r, n = !0) => {
|
|
2248
2242
|
const s = {
|
|
2249
2243
|
defaultValues: t._defaultValues
|
|
2250
2244
|
};
|
|
@@ -2252,16 +2246,16 @@ var Gn = (e, t, r, n = !0) => {
|
|
|
2252
2246
|
Object.defineProperty(s, a, {
|
|
2253
2247
|
get: () => {
|
|
2254
2248
|
const i = a;
|
|
2255
|
-
return t._proxyFormState[i] !==
|
|
2249
|
+
return t._proxyFormState[i] !== Z.all && (t._proxyFormState[i] = !n || Z.all), r && (r[i] = !0), e[i];
|
|
2256
2250
|
}
|
|
2257
2251
|
});
|
|
2258
2252
|
return s;
|
|
2259
|
-
}, W = (e) => $(e) && !Object.keys(e).length,
|
|
2253
|
+
}, W = (e) => $(e) && !Object.keys(e).length, Kn = (e, t, r, n) => {
|
|
2260
2254
|
r(e);
|
|
2261
2255
|
const { name: s, ...a } = e;
|
|
2262
|
-
return W(a) || Object.keys(a).length >= Object.keys(t).length || Object.keys(a).find((i) => t[i] === (!n ||
|
|
2256
|
+
return W(a) || Object.keys(a).length >= Object.keys(t).length || Object.keys(a).find((i) => t[i] === (!n || Z.all));
|
|
2263
2257
|
}, it = (e) => Array.isArray(e) ? e : [e];
|
|
2264
|
-
function
|
|
2258
|
+
function Gn(e) {
|
|
2265
2259
|
const t = X.useRef(e);
|
|
2266
2260
|
t.current = e, X.useEffect(() => {
|
|
2267
2261
|
const r = !e.disabled && t.current.subject && t.current.subject.subscribe({
|
|
@@ -2272,34 +2266,34 @@ function Wn(e) {
|
|
|
2272
2266
|
};
|
|
2273
2267
|
}, [e.disabled]);
|
|
2274
2268
|
}
|
|
2275
|
-
var te = (e) => typeof e == "string",
|
|
2276
|
-
function
|
|
2269
|
+
var te = (e) => typeof e == "string", Hn = (e, t, r, n, s) => te(e) ? (n && t.watch.add(e), w(r, e, s)) : Array.isArray(e) ? e.map((a) => (n && t.watch.add(a), w(r, a))) : (n && (t.watchAll = !0), r), bt = (e) => /^\w*$/.test(e), pr = (e) => Re(e.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
2270
|
+
function N(e, t, r) {
|
|
2277
2271
|
let n = -1;
|
|
2278
|
-
const s =
|
|
2272
|
+
const s = bt(t) ? [t] : pr(t), a = s.length, i = a - 1;
|
|
2279
2273
|
for (; ++n < a; ) {
|
|
2280
2274
|
const u = s[n];
|
|
2281
|
-
let
|
|
2275
|
+
let d = r;
|
|
2282
2276
|
if (n !== i) {
|
|
2283
2277
|
const h = e[u];
|
|
2284
|
-
|
|
2278
|
+
d = $(h) || Array.isArray(h) ? h : isNaN(+s[n + 1]) ? {} : [];
|
|
2285
2279
|
}
|
|
2286
|
-
e[u] =
|
|
2280
|
+
e[u] = d, e = e[u];
|
|
2287
2281
|
}
|
|
2288
2282
|
return e;
|
|
2289
2283
|
}
|
|
2290
|
-
var
|
|
2284
|
+
var mr = (e, t, r, n, s) => t ? {
|
|
2291
2285
|
...r[e],
|
|
2292
2286
|
types: {
|
|
2293
2287
|
...r[e] && r[e].types ? r[e].types : {},
|
|
2294
2288
|
[n]: s || !0
|
|
2295
2289
|
}
|
|
2296
|
-
} : {},
|
|
2297
|
-
isOnSubmit: !e || e ===
|
|
2298
|
-
isOnBlur: e ===
|
|
2299
|
-
isOnChange: e ===
|
|
2300
|
-
isOnAll: e ===
|
|
2301
|
-
isOnTouch: e ===
|
|
2302
|
-
}),
|
|
2290
|
+
} : {}, $t = (e) => ({
|
|
2291
|
+
isOnSubmit: !e || e === Z.onSubmit,
|
|
2292
|
+
isOnBlur: e === Z.onBlur,
|
|
2293
|
+
isOnChange: e === Z.onChange,
|
|
2294
|
+
isOnAll: e === Z.all,
|
|
2295
|
+
isOnTouch: e === Z.onTouched
|
|
2296
|
+
}), jt = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
2303
2297
|
const ze = (e, t, r, n) => {
|
|
2304
2298
|
for (const s of r || Object.keys(e)) {
|
|
2305
2299
|
const a = w(e, s);
|
|
@@ -2315,20 +2309,20 @@ const ze = (e, t, r, n) => {
|
|
|
2315
2309
|
}
|
|
2316
2310
|
}
|
|
2317
2311
|
};
|
|
2318
|
-
var
|
|
2312
|
+
var Wn = (e, t, r) => {
|
|
2319
2313
|
const n = Re(w(e, r));
|
|
2320
|
-
return
|
|
2321
|
-
},
|
|
2322
|
-
if (!
|
|
2314
|
+
return N(n, "root", t[r]), N(e, r, n), e;
|
|
2315
|
+
}, vt = (e) => e.type === "file", fe = (e) => typeof e == "function", Ge = (e) => {
|
|
2316
|
+
if (!yt)
|
|
2323
2317
|
return !1;
|
|
2324
2318
|
const t = e ? e.ownerDocument : 0;
|
|
2325
2319
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
2326
|
-
}, qe = (e) => te(e),
|
|
2327
|
-
const
|
|
2320
|
+
}, qe = (e) => te(e), xt = (e) => e.type === "radio", He = (e) => e instanceof RegExp;
|
|
2321
|
+
const zt = {
|
|
2328
2322
|
value: !1,
|
|
2329
2323
|
isValid: !1
|
|
2330
|
-
},
|
|
2331
|
-
var
|
|
2324
|
+
}, qt = { value: !0, isValid: !0 };
|
|
2325
|
+
var gr = (e) => {
|
|
2332
2326
|
if (Array.isArray(e)) {
|
|
2333
2327
|
if (e.length > 1) {
|
|
2334
2328
|
const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
@@ -2336,20 +2330,20 @@ var yr = (e) => {
|
|
|
2336
2330
|
}
|
|
2337
2331
|
return e[0].checked && !e[0].disabled ? (
|
|
2338
2332
|
// @ts-expect-error expected to work in the browser
|
|
2339
|
-
e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ?
|
|
2340
|
-
) :
|
|
2333
|
+
e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ? qt : { value: e[0].value, isValid: !0 } : qt
|
|
2334
|
+
) : zt;
|
|
2341
2335
|
}
|
|
2342
|
-
return
|
|
2336
|
+
return zt;
|
|
2343
2337
|
};
|
|
2344
|
-
const
|
|
2338
|
+
const Ut = {
|
|
2345
2339
|
isValid: !1,
|
|
2346
2340
|
value: null
|
|
2347
2341
|
};
|
|
2348
|
-
var
|
|
2342
|
+
var yr = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
|
|
2349
2343
|
isValid: !0,
|
|
2350
2344
|
value: r.value
|
|
2351
|
-
} : t,
|
|
2352
|
-
function
|
|
2345
|
+
} : t, Ut) : Ut;
|
|
2346
|
+
function Kt(e, t, r = "validate") {
|
|
2353
2347
|
if (qe(e) || Array.isArray(e) && e.every(qe) || de(e) && !e)
|
|
2354
2348
|
return {
|
|
2355
2349
|
type: r,
|
|
@@ -2360,13 +2354,13 @@ function Gt(e, t, r = "validate") {
|
|
|
2360
2354
|
var we = (e) => $(e) && !He(e) ? e : {
|
|
2361
2355
|
value: e,
|
|
2362
2356
|
message: ""
|
|
2363
|
-
},
|
|
2364
|
-
const { ref: a, refs: i, required: u, maxLength:
|
|
2357
|
+
}, Gt = async (e, t, r, n, s) => {
|
|
2358
|
+
const { ref: a, refs: i, required: u, maxLength: d, minLength: h, min: x, max: y, pattern: p, validate: _, name: v, valueAsNumber: E, mount: S, disabled: A } = e._f, g = w(t, v);
|
|
2365
2359
|
if (!S || A)
|
|
2366
2360
|
return {};
|
|
2367
2361
|
const T = i ? i[0] : a, P = (F) => {
|
|
2368
2362
|
n && T.reportValidity && (T.setCustomValidity(de(F) ? "" : F || ""), T.reportValidity());
|
|
2369
|
-
}, D = {}, me =
|
|
2363
|
+
}, D = {}, me = xt(a), ce = De(a), Ae = me || ce, G = (E || vt(a)) && O(a.value) && O(g) || Ge(a) && a.value === "" || g === "" || Array.isArray(g) && !g.length, se = mr.bind(null, v, r, D), q = (F, V, R, K = ie.maxLength, H = ie.minLength) => {
|
|
2370
2364
|
const Q = F ? V : R;
|
|
2371
2365
|
D[v] = {
|
|
2372
2366
|
type: F ? K : H,
|
|
@@ -2375,7 +2369,7 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2375
2369
|
...se(F ? K : H, Q)
|
|
2376
2370
|
};
|
|
2377
2371
|
};
|
|
2378
|
-
if (s ? !Array.isArray(g) || !g.length : u && (!Ae && (G || U(g)) || de(g) && !g || ce && !
|
|
2372
|
+
if (s ? !Array.isArray(g) || !g.length : u && (!Ae && (G || U(g)) || de(g) && !g || ce && !gr(i).isValid || me && !yr(i).isValid)) {
|
|
2379
2373
|
const { value: F, message: V } = qe(u) ? { value: !!u, message: u } : we(u);
|
|
2380
2374
|
if (F && (D[v] = {
|
|
2381
2375
|
type: ie.required,
|
|
@@ -2385,9 +2379,9 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2385
2379
|
}, !r))
|
|
2386
2380
|
return P(V), D;
|
|
2387
2381
|
}
|
|
2388
|
-
if (!G && (!U(x) || !U(
|
|
2382
|
+
if (!G && (!U(x) || !U(y))) {
|
|
2389
2383
|
let F, V;
|
|
2390
|
-
const R = we(
|
|
2384
|
+
const R = we(y), K = we(x);
|
|
2391
2385
|
if (!U(g) && !isNaN(g)) {
|
|
2392
2386
|
const H = a.valueAsNumber || g && +g;
|
|
2393
2387
|
U(R.value) || (F = H > R.value), U(K.value) || (V = H < K.value);
|
|
@@ -2398,8 +2392,8 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2398
2392
|
if ((F || V) && (q(!!F, R.message, K.message, ie.max, ie.min), !r))
|
|
2399
2393
|
return P(D[v].message), D;
|
|
2400
2394
|
}
|
|
2401
|
-
if ((
|
|
2402
|
-
const F = we(
|
|
2395
|
+
if ((d || h) && !G && (te(g) || s && Array.isArray(g))) {
|
|
2396
|
+
const F = we(d), V = we(h), R = !U(F.value) && g.length > +F.value, K = !U(V.value) && g.length < +V.value;
|
|
2403
2397
|
if ((R || K) && (q(R, F.message, V.message), !r))
|
|
2404
2398
|
return P(D[v].message), D;
|
|
2405
2399
|
}
|
|
@@ -2413,20 +2407,20 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2413
2407
|
}, !r))
|
|
2414
2408
|
return P(V), D;
|
|
2415
2409
|
}
|
|
2416
|
-
if (
|
|
2417
|
-
if (fe(
|
|
2418
|
-
const F = await
|
|
2410
|
+
if (_) {
|
|
2411
|
+
if (fe(_)) {
|
|
2412
|
+
const F = await _(g, t), V = Kt(F, T);
|
|
2419
2413
|
if (V && (D[v] = {
|
|
2420
2414
|
...V,
|
|
2421
2415
|
...se(ie.validate, V.message)
|
|
2422
2416
|
}, !r))
|
|
2423
2417
|
return P(V.message), D;
|
|
2424
|
-
} else if ($(
|
|
2418
|
+
} else if ($(_)) {
|
|
2425
2419
|
let F = {};
|
|
2426
|
-
for (const V in
|
|
2420
|
+
for (const V in _) {
|
|
2427
2421
|
if (!W(F) && !r)
|
|
2428
2422
|
break;
|
|
2429
|
-
const R =
|
|
2423
|
+
const R = Kt(await _[V](g, t), T, V);
|
|
2430
2424
|
R && (F = {
|
|
2431
2425
|
...R,
|
|
2432
2426
|
...se(V, R.message)
|
|
@@ -2441,22 +2435,22 @@ var we = (e) => $(e) && !He(e) ? e : {
|
|
|
2441
2435
|
}
|
|
2442
2436
|
return P(!0), D;
|
|
2443
2437
|
};
|
|
2444
|
-
function
|
|
2438
|
+
function Jn(e, t) {
|
|
2445
2439
|
const r = t.slice(0, -1).length;
|
|
2446
2440
|
let n = 0;
|
|
2447
2441
|
for (; n < r; )
|
|
2448
2442
|
e = O(e) ? n++ : e[t[n++]];
|
|
2449
2443
|
return e;
|
|
2450
2444
|
}
|
|
2451
|
-
function
|
|
2445
|
+
function Zn(e) {
|
|
2452
2446
|
for (const t in e)
|
|
2453
2447
|
if (e.hasOwnProperty(t) && !O(e[t]))
|
|
2454
2448
|
return !1;
|
|
2455
2449
|
return !0;
|
|
2456
2450
|
}
|
|
2457
2451
|
function j(e, t) {
|
|
2458
|
-
const r = Array.isArray(t) ? t :
|
|
2459
|
-
return n && delete n[a], s !== 0 && ($(n) && W(n) || Array.isArray(n) &&
|
|
2452
|
+
const r = Array.isArray(t) ? t : bt(t) ? [t] : pr(t), n = r.length === 1 ? e : Jn(e, r), s = r.length - 1, a = r[s];
|
|
2453
|
+
return n && delete n[a], s !== 0 && ($(n) && W(n) || Array.isArray(n) && Zn(n)) && j(e, r.slice(0, -1)), e;
|
|
2460
2454
|
}
|
|
2461
2455
|
function ot() {
|
|
2462
2456
|
let e = [];
|
|
@@ -2478,11 +2472,11 @@ function ot() {
|
|
|
2478
2472
|
}
|
|
2479
2473
|
};
|
|
2480
2474
|
}
|
|
2481
|
-
var We = (e) => U(e) || !
|
|
2475
|
+
var We = (e) => U(e) || !hr(e);
|
|
2482
2476
|
function ye(e, t) {
|
|
2483
2477
|
if (We(e) || We(t))
|
|
2484
2478
|
return e === t;
|
|
2485
|
-
if (
|
|
2479
|
+
if (_e(e) && _e(t))
|
|
2486
2480
|
return e.getTime() === t.getTime();
|
|
2487
2481
|
const r = Object.keys(e), n = Object.keys(t);
|
|
2488
2482
|
if (r.length !== n.length)
|
|
@@ -2493,13 +2487,13 @@ function ye(e, t) {
|
|
|
2493
2487
|
return !1;
|
|
2494
2488
|
if (s !== "ref") {
|
|
2495
2489
|
const i = t[s];
|
|
2496
|
-
if (
|
|
2490
|
+
if (_e(a) && _e(i) || $(a) && $(i) || Array.isArray(a) && Array.isArray(i) ? !ye(a, i) : a !== i)
|
|
2497
2491
|
return !1;
|
|
2498
2492
|
}
|
|
2499
2493
|
}
|
|
2500
2494
|
return !0;
|
|
2501
2495
|
}
|
|
2502
|
-
var
|
|
2496
|
+
var br = (e) => e.type === "select-multiple", Qn = (e) => xt(e) || De(e), lt = (e) => Ge(e) && e.isConnected, vr = (e) => {
|
|
2503
2497
|
for (const t in e)
|
|
2504
2498
|
if (fe(e[t]))
|
|
2505
2499
|
return !0;
|
|
@@ -2509,27 +2503,27 @@ function Je(e, t = {}) {
|
|
|
2509
2503
|
const r = Array.isArray(e);
|
|
2510
2504
|
if ($(e) || r)
|
|
2511
2505
|
for (const n in e)
|
|
2512
|
-
Array.isArray(e[n]) || $(e[n]) && !
|
|
2506
|
+
Array.isArray(e[n]) || $(e[n]) && !vr(e[n]) ? (t[n] = Array.isArray(e[n]) ? [] : {}, Je(e[n], t[n])) : U(e[n]) || (t[n] = !0);
|
|
2513
2507
|
return t;
|
|
2514
2508
|
}
|
|
2515
|
-
function
|
|
2509
|
+
function xr(e, t, r) {
|
|
2516
2510
|
const n = Array.isArray(e);
|
|
2517
2511
|
if ($(e) || n)
|
|
2518
2512
|
for (const s in e)
|
|
2519
|
-
Array.isArray(e[s]) || $(e[s]) && !
|
|
2513
|
+
Array.isArray(e[s]) || $(e[s]) && !vr(e[s]) ? O(t) || We(r[s]) ? r[s] = Array.isArray(e[s]) ? Je(e[s], []) : { ...Je(e[s]) } : xr(e[s], U(t) ? {} : t[s], r[s]) : r[s] = !ye(e[s], t[s]);
|
|
2520
2514
|
return r;
|
|
2521
2515
|
}
|
|
2522
|
-
var ut = (e, t) =>
|
|
2516
|
+
var ut = (e, t) => xr(e, t, Je(t)), wr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) => O(e) ? e : t ? e === "" ? NaN : e && +e : r && te(e) ? new Date(e) : n ? n(e) : e;
|
|
2523
2517
|
function ct(e) {
|
|
2524
2518
|
const t = e.ref;
|
|
2525
2519
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : t.disabled))
|
|
2526
|
-
return
|
|
2520
|
+
return vt(t) ? t.files : xt(t) ? yr(e.refs).value : br(t) ? [...t.selectedOptions].map(({ value: r }) => r) : De(t) ? gr(e.refs).value : wr(O(t.value) ? e.ref.value : t.value, e);
|
|
2527
2521
|
}
|
|
2528
|
-
var
|
|
2522
|
+
var Xn = (e, t, r, n) => {
|
|
2529
2523
|
const s = {};
|
|
2530
2524
|
for (const a of e) {
|
|
2531
2525
|
const i = w(t, a);
|
|
2532
|
-
i &&
|
|
2526
|
+
i && N(s, a, i._f);
|
|
2533
2527
|
}
|
|
2534
2528
|
return {
|
|
2535
2529
|
criteriaMode: r,
|
|
@@ -2537,10 +2531,10 @@ var es = (e, t, r, n) => {
|
|
|
2537
2531
|
fields: s,
|
|
2538
2532
|
shouldUseNativeValidation: n
|
|
2539
2533
|
};
|
|
2540
|
-
}, Ve = (e) => O(e) ? e : He(e) ? e.source : $(e) ? He(e.value) ? e.value.source : e.value : e,
|
|
2541
|
-
function
|
|
2534
|
+
}, Ve = (e) => O(e) ? e : He(e) ? e.source : $(e) ? He(e.value) ? e.value.source : e.value : e, Yn = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
2535
|
+
function Ht(e, t, r) {
|
|
2542
2536
|
const n = w(e, r);
|
|
2543
|
-
if (n ||
|
|
2537
|
+
if (n || bt(r))
|
|
2544
2538
|
return {
|
|
2545
2539
|
error: n,
|
|
2546
2540
|
name: r
|
|
@@ -2561,15 +2555,15 @@ function Wt(e, t, r) {
|
|
|
2561
2555
|
name: r
|
|
2562
2556
|
};
|
|
2563
2557
|
}
|
|
2564
|
-
var
|
|
2565
|
-
const
|
|
2566
|
-
mode:
|
|
2567
|
-
reValidateMode:
|
|
2558
|
+
var es = (e, t, r, n, s) => s.isOnAll ? !1 : !r && s.isOnTouch ? !(t || e) : (r ? n.isOnBlur : s.isOnBlur) ? !e : (r ? n.isOnChange : s.isOnChange) ? e : !0, ts = (e, t) => !Re(w(e, t)).length && j(e, t);
|
|
2559
|
+
const rs = {
|
|
2560
|
+
mode: Z.onSubmit,
|
|
2561
|
+
reValidateMode: Z.onChange,
|
|
2568
2562
|
shouldFocusError: !0
|
|
2569
2563
|
};
|
|
2570
|
-
function
|
|
2564
|
+
function ns(e = {}, t) {
|
|
2571
2565
|
let r = {
|
|
2572
|
-
...
|
|
2566
|
+
...rs,
|
|
2573
2567
|
...e
|
|
2574
2568
|
}, n = {
|
|
2575
2569
|
submitCount: 0,
|
|
@@ -2588,13 +2582,13 @@ function as(e = {}, t) {
|
|
|
2588
2582
|
action: !1,
|
|
2589
2583
|
mount: !1,
|
|
2590
2584
|
watch: !1
|
|
2591
|
-
},
|
|
2585
|
+
}, d = {
|
|
2592
2586
|
mount: /* @__PURE__ */ new Set(),
|
|
2593
2587
|
unMount: /* @__PURE__ */ new Set(),
|
|
2594
2588
|
array: /* @__PURE__ */ new Set(),
|
|
2595
2589
|
watch: /* @__PURE__ */ new Set()
|
|
2596
2590
|
}, h, x = 0;
|
|
2597
|
-
const
|
|
2591
|
+
const y = {
|
|
2598
2592
|
isDirty: !1,
|
|
2599
2593
|
dirtyFields: !1,
|
|
2600
2594
|
touchedFields: !1,
|
|
@@ -2605,71 +2599,71 @@ function as(e = {}, t) {
|
|
|
2605
2599
|
values: ot(),
|
|
2606
2600
|
array: ot(),
|
|
2607
2601
|
state: ot()
|
|
2608
|
-
},
|
|
2609
|
-
clearTimeout(x), x = setTimeout(o,
|
|
2602
|
+
}, _ = e.resetOptions && e.resetOptions.keepDirtyValues, v = $t(r.mode), E = $t(r.reValidateMode), S = r.criteriaMode === Z.all, A = (o) => (c) => {
|
|
2603
|
+
clearTimeout(x), x = setTimeout(o, c);
|
|
2610
2604
|
}, g = async (o) => {
|
|
2611
|
-
if (
|
|
2612
|
-
const
|
|
2613
|
-
|
|
2614
|
-
isValid:
|
|
2605
|
+
if (y.isValid || o) {
|
|
2606
|
+
const c = r.resolver ? W((await G()).errors) : await q(s, !0);
|
|
2607
|
+
c !== n.isValid && p.state.next({
|
|
2608
|
+
isValid: c
|
|
2615
2609
|
});
|
|
2616
2610
|
}
|
|
2617
|
-
}, T = (o) =>
|
|
2611
|
+
}, T = (o) => y.isValidating && p.state.next({
|
|
2618
2612
|
isValidating: o
|
|
2619
|
-
}), P = (o,
|
|
2620
|
-
if (
|
|
2613
|
+
}), P = (o, c = [], f, k, b = !0, m = !0) => {
|
|
2614
|
+
if (k && f) {
|
|
2621
2615
|
if (u.action = !0, m && Array.isArray(w(s, o))) {
|
|
2622
|
-
const C = f(w(s, o),
|
|
2623
|
-
|
|
2616
|
+
const C = f(w(s, o), k.argA, k.argB);
|
|
2617
|
+
b && N(s, o, C);
|
|
2624
2618
|
}
|
|
2625
2619
|
if (m && Array.isArray(w(n.errors, o))) {
|
|
2626
|
-
const C = f(w(n.errors, o),
|
|
2627
|
-
|
|
2620
|
+
const C = f(w(n.errors, o), k.argA, k.argB);
|
|
2621
|
+
b && N(n.errors, o, C), ts(n.errors, o);
|
|
2628
2622
|
}
|
|
2629
|
-
if (
|
|
2630
|
-
const C = f(w(n.touchedFields, o),
|
|
2631
|
-
|
|
2623
|
+
if (y.touchedFields && m && Array.isArray(w(n.touchedFields, o))) {
|
|
2624
|
+
const C = f(w(n.touchedFields, o), k.argA, k.argB);
|
|
2625
|
+
b && N(n.touchedFields, o, C);
|
|
2632
2626
|
}
|
|
2633
|
-
|
|
2627
|
+
y.dirtyFields && (n.dirtyFields = ut(a, i)), p.state.next({
|
|
2634
2628
|
name: o,
|
|
2635
|
-
isDirty: V(o,
|
|
2629
|
+
isDirty: V(o, c),
|
|
2636
2630
|
dirtyFields: n.dirtyFields,
|
|
2637
2631
|
errors: n.errors,
|
|
2638
2632
|
isValid: n.isValid
|
|
2639
2633
|
});
|
|
2640
2634
|
} else
|
|
2641
|
-
|
|
2642
|
-
}, D = (o,
|
|
2643
|
-
|
|
2635
|
+
N(i, o, c);
|
|
2636
|
+
}, D = (o, c) => {
|
|
2637
|
+
N(n.errors, o, c), p.state.next({
|
|
2644
2638
|
errors: n.errors
|
|
2645
2639
|
});
|
|
2646
|
-
}, me = (o,
|
|
2647
|
-
const
|
|
2648
|
-
if (
|
|
2640
|
+
}, me = (o, c, f, k) => {
|
|
2641
|
+
const b = w(s, o);
|
|
2642
|
+
if (b) {
|
|
2649
2643
|
const m = w(i, o, O(f) ? w(a, o) : f);
|
|
2650
|
-
O(m) ||
|
|
2644
|
+
O(m) || k && k.defaultChecked || c ? N(i, o, c ? m : ct(b._f)) : H(o, m), u.mount && g();
|
|
2651
2645
|
}
|
|
2652
|
-
}, ce = (o,
|
|
2646
|
+
}, ce = (o, c, f, k, b) => {
|
|
2653
2647
|
let m = !1, C = !1;
|
|
2654
|
-
const
|
|
2648
|
+
const L = {
|
|
2655
2649
|
name: o
|
|
2656
2650
|
};
|
|
2657
|
-
if (!f ||
|
|
2658
|
-
|
|
2659
|
-
const B = ye(w(a, o),
|
|
2660
|
-
C = w(n.dirtyFields, o), B ? j(n.dirtyFields, o) :
|
|
2651
|
+
if (!f || k) {
|
|
2652
|
+
y.isDirty && (C = n.isDirty, n.isDirty = L.isDirty = V(), m = C !== L.isDirty);
|
|
2653
|
+
const B = ye(w(a, o), c);
|
|
2654
|
+
C = w(n.dirtyFields, o), B ? j(n.dirtyFields, o) : N(n.dirtyFields, o, !0), L.dirtyFields = n.dirtyFields, m = m || y.dirtyFields && C !== !B;
|
|
2661
2655
|
}
|
|
2662
2656
|
if (f) {
|
|
2663
2657
|
const B = w(n.touchedFields, o);
|
|
2664
|
-
B || (
|
|
2658
|
+
B || (N(n.touchedFields, o, f), L.touchedFields = n.touchedFields, m = m || y.touchedFields && B !== f);
|
|
2665
2659
|
}
|
|
2666
|
-
return m &&
|
|
2667
|
-
}, Ae = (o,
|
|
2668
|
-
const
|
|
2669
|
-
if (e.delayError && f ? (h = A(() => D(o, f)), h(e.delayError)) : (clearTimeout(x), h = null, f ?
|
|
2660
|
+
return m && b && p.state.next(L), m ? L : {};
|
|
2661
|
+
}, Ae = (o, c, f, k) => {
|
|
2662
|
+
const b = w(n.errors, o), m = y.isValid && de(c) && n.isValid !== c;
|
|
2663
|
+
if (e.delayError && f ? (h = A(() => D(o, f)), h(e.delayError)) : (clearTimeout(x), h = null, f ? N(n.errors, o, f) : j(n.errors, o)), (f ? !ye(b, f) : b) || !W(k) || m) {
|
|
2670
2664
|
const C = {
|
|
2671
|
-
...
|
|
2672
|
-
...m && de(
|
|
2665
|
+
...k,
|
|
2666
|
+
...m && de(c) ? { isValid: c } : {},
|
|
2673
2667
|
errors: n.errors,
|
|
2674
2668
|
name: o
|
|
2675
2669
|
};
|
|
@@ -2679,198 +2673,198 @@ function as(e = {}, t) {
|
|
|
2679
2673
|
}, p.state.next(C);
|
|
2680
2674
|
}
|
|
2681
2675
|
T(!1);
|
|
2682
|
-
}, G = async (o) => r.resolver(i, r.context,
|
|
2683
|
-
const { errors:
|
|
2676
|
+
}, G = async (o) => r.resolver(i, r.context, Xn(o || d.mount, s, r.criteriaMode, r.shouldUseNativeValidation)), se = async (o) => {
|
|
2677
|
+
const { errors: c } = await G(o);
|
|
2684
2678
|
if (o)
|
|
2685
2679
|
for (const f of o) {
|
|
2686
|
-
const
|
|
2687
|
-
|
|
2680
|
+
const k = w(c, f);
|
|
2681
|
+
k ? N(n.errors, f, k) : j(n.errors, f);
|
|
2688
2682
|
}
|
|
2689
2683
|
else
|
|
2690
|
-
n.errors =
|
|
2691
|
-
return
|
|
2692
|
-
}, q = async (o,
|
|
2684
|
+
n.errors = c;
|
|
2685
|
+
return c;
|
|
2686
|
+
}, q = async (o, c, f = {
|
|
2693
2687
|
valid: !0
|
|
2694
2688
|
}) => {
|
|
2695
|
-
for (const
|
|
2696
|
-
const
|
|
2697
|
-
if (
|
|
2698
|
-
const { _f: m, ...C } =
|
|
2689
|
+
for (const k in o) {
|
|
2690
|
+
const b = o[k];
|
|
2691
|
+
if (b) {
|
|
2692
|
+
const { _f: m, ...C } = b;
|
|
2699
2693
|
if (m) {
|
|
2700
|
-
const
|
|
2701
|
-
if (B[m.name] && (f.valid = !1,
|
|
2694
|
+
const L = d.array.has(m.name), B = await Gt(b, i, S, r.shouldUseNativeValidation && !c, L);
|
|
2695
|
+
if (B[m.name] && (f.valid = !1, c))
|
|
2702
2696
|
break;
|
|
2703
|
-
!
|
|
2697
|
+
!c && (w(B, m.name) ? L ? Wn(n.errors, B, m.name) : N(n.errors, m.name, B[m.name]) : j(n.errors, m.name));
|
|
2704
2698
|
}
|
|
2705
|
-
C && await q(C,
|
|
2699
|
+
C && await q(C, c, f);
|
|
2706
2700
|
}
|
|
2707
2701
|
}
|
|
2708
2702
|
return f.valid;
|
|
2709
2703
|
}, F = () => {
|
|
2710
|
-
for (const o of
|
|
2711
|
-
const
|
|
2712
|
-
|
|
2704
|
+
for (const o of d.unMount) {
|
|
2705
|
+
const c = w(s, o);
|
|
2706
|
+
c && (c._f.refs ? c._f.refs.every((f) => !lt(f)) : !lt(c._f.ref)) && tt(o);
|
|
2713
2707
|
}
|
|
2714
|
-
|
|
2715
|
-
}, V = (o,
|
|
2716
|
-
...u.mount ? i : O(
|
|
2717
|
-
}, f,
|
|
2718
|
-
const
|
|
2719
|
-
let
|
|
2720
|
-
if (
|
|
2721
|
-
const m =
|
|
2722
|
-
m && (!m.disabled &&
|
|
2708
|
+
d.unMount = /* @__PURE__ */ new Set();
|
|
2709
|
+
}, V = (o, c) => (o && c && N(i, o, c), !ye(wt(), a)), R = (o, c, f) => Hn(o, d, {
|
|
2710
|
+
...u.mount ? i : O(c) ? a : te(o) ? { [o]: c } : c
|
|
2711
|
+
}, f, c), K = (o) => Re(w(u.mount ? i : a, o, e.shouldUnregister ? w(a, o, []) : [])), H = (o, c, f = {}) => {
|
|
2712
|
+
const k = w(s, o);
|
|
2713
|
+
let b = c;
|
|
2714
|
+
if (k) {
|
|
2715
|
+
const m = k._f;
|
|
2716
|
+
m && (!m.disabled && N(i, o, wr(c, m)), b = Ge(m.ref) && U(c) ? "" : c, br(m.ref) ? [...m.ref.options].forEach((C) => C.selected = b.includes(C.value)) : m.refs ? De(m.ref) ? m.refs.length > 1 ? m.refs.forEach((C) => (!C.defaultChecked || !C.disabled) && (C.checked = Array.isArray(b) ? !!b.find((L) => L === C.value) : b === C.value)) : m.refs[0] && (m.refs[0].checked = !!b) : m.refs.forEach((C) => C.checked = C.value === b) : vt(m.ref) ? m.ref.value = "" : (m.ref.value = b, m.ref.type || p.values.next({
|
|
2723
2717
|
name: o,
|
|
2724
2718
|
values: { ...i }
|
|
2725
2719
|
})));
|
|
2726
2720
|
}
|
|
2727
|
-
(f.shouldDirty || f.shouldTouch) && ce(o,
|
|
2728
|
-
}, Q = (o,
|
|
2729
|
-
for (const
|
|
2730
|
-
const
|
|
2731
|
-
(
|
|
2721
|
+
(f.shouldDirty || f.shouldTouch) && ce(o, b, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && et(o);
|
|
2722
|
+
}, Q = (o, c, f) => {
|
|
2723
|
+
for (const k in c) {
|
|
2724
|
+
const b = c[k], m = `${o}.${k}`, C = w(s, m);
|
|
2725
|
+
(d.array.has(o) || !We(b) || C && !C._f) && !_e(b) ? Q(m, b, f) : H(m, b, f);
|
|
2732
2726
|
}
|
|
2733
|
-
}, ge = (o,
|
|
2734
|
-
const
|
|
2735
|
-
|
|
2727
|
+
}, ge = (o, c, f = {}) => {
|
|
2728
|
+
const k = w(s, o), b = d.array.has(o), m = oe(c);
|
|
2729
|
+
N(i, o, m), b ? (p.array.next({
|
|
2736
2730
|
name: o,
|
|
2737
2731
|
values: { ...i }
|
|
2738
|
-
}), (
|
|
2732
|
+
}), (y.isDirty || y.dirtyFields) && f.shouldDirty && p.state.next({
|
|
2739
2733
|
name: o,
|
|
2740
2734
|
dirtyFields: ut(a, i),
|
|
2741
2735
|
isDirty: V(o, m)
|
|
2742
|
-
})) :
|
|
2736
|
+
})) : k && !k._f && !U(m) ? Q(o, m, f) : H(o, m, f), jt(o, d) && p.state.next({ ...n }), p.values.next({
|
|
2743
2737
|
name: o,
|
|
2744
2738
|
values: { ...i }
|
|
2745
2739
|
}), !u.mount && t();
|
|
2746
2740
|
}, Ee = async (o) => {
|
|
2747
|
-
const
|
|
2748
|
-
let f =
|
|
2749
|
-
const
|
|
2750
|
-
|
|
2741
|
+
const c = o.target;
|
|
2742
|
+
let f = c.name, k = !0;
|
|
2743
|
+
const b = w(s, f), m = () => c.type ? ct(b._f) : $n(o), C = (L) => {
|
|
2744
|
+
k = Number.isNaN(L) || L === w(i, f, L);
|
|
2751
2745
|
};
|
|
2752
|
-
if (
|
|
2753
|
-
let
|
|
2754
|
-
const Be = m(), xe = o.type ===
|
|
2755
|
-
|
|
2756
|
-
const st = ce(f, Be, xe, !1),
|
|
2746
|
+
if (b) {
|
|
2747
|
+
let L, B;
|
|
2748
|
+
const Be = m(), xe = o.type === Pt.BLUR || o.type === Pt.FOCUS_OUT, Er = !Yn(b._f) && !r.resolver && !w(n.errors, f) && !b._f.deps || es(xe, w(n.touchedFields, f), n.isSubmitted, E, v), nt = jt(f, d, xe);
|
|
2749
|
+
N(i, f, Be), xe ? (b._f.onBlur && b._f.onBlur(o), h && h(0)) : b._f.onChange && b._f.onChange(o);
|
|
2750
|
+
const st = ce(f, Be, xe, !1), Ir = !W(st) || nt;
|
|
2757
2751
|
if (!xe && p.values.next({
|
|
2758
2752
|
name: f,
|
|
2759
2753
|
type: o.type,
|
|
2760
2754
|
values: { ...i }
|
|
2761
|
-
}),
|
|
2762
|
-
return
|
|
2755
|
+
}), Er)
|
|
2756
|
+
return y.isValid && g(), Ir && p.state.next({ name: f, ...nt ? {} : st });
|
|
2763
2757
|
if (!xe && nt && p.state.next({ ...n }), T(!0), r.resolver) {
|
|
2764
|
-
const { errors:
|
|
2765
|
-
if (C(Be),
|
|
2766
|
-
const
|
|
2767
|
-
|
|
2758
|
+
const { errors: Vt } = await G([f]);
|
|
2759
|
+
if (C(Be), k) {
|
|
2760
|
+
const Vr = Ht(n.errors, s, f), Mt = Ht(Vt, s, Vr.name || f);
|
|
2761
|
+
L = Mt.error, f = Mt.name, B = W(Vt);
|
|
2768
2762
|
}
|
|
2769
2763
|
} else
|
|
2770
|
-
|
|
2771
|
-
|
|
2764
|
+
L = (await Gt(b, i, S, r.shouldUseNativeValidation))[f], C(Be), k && (L ? B = !1 : y.isValid && (B = await q(s, !0)));
|
|
2765
|
+
k && (b._f.deps && et(b._f.deps), Ae(f, B, L, st));
|
|
2772
2766
|
}
|
|
2773
|
-
}, Oe = (o,
|
|
2774
|
-
if (w(n.errors,
|
|
2767
|
+
}, Oe = (o, c) => {
|
|
2768
|
+
if (w(n.errors, c) && o.focus)
|
|
2775
2769
|
return o.focus(), 1;
|
|
2776
|
-
}, et = async (o,
|
|
2777
|
-
let f,
|
|
2778
|
-
const
|
|
2770
|
+
}, et = async (o, c = {}) => {
|
|
2771
|
+
let f, k;
|
|
2772
|
+
const b = it(o);
|
|
2779
2773
|
if (T(!0), r.resolver) {
|
|
2780
|
-
const m = await se(O(o) ? o :
|
|
2781
|
-
f = W(m),
|
|
2774
|
+
const m = await se(O(o) ? o : b);
|
|
2775
|
+
f = W(m), k = o ? !b.some((C) => w(m, C)) : f;
|
|
2782
2776
|
} else
|
|
2783
|
-
o ? (
|
|
2777
|
+
o ? (k = (await Promise.all(b.map(async (m) => {
|
|
2784
2778
|
const C = w(s, m);
|
|
2785
2779
|
return await q(C && C._f ? { [m]: C } : C);
|
|
2786
|
-
}))).every(Boolean), !(!
|
|
2780
|
+
}))).every(Boolean), !(!k && !n.isValid) && g()) : k = f = await q(s);
|
|
2787
2781
|
return p.state.next({
|
|
2788
|
-
...!te(o) ||
|
|
2782
|
+
...!te(o) || y.isValid && f !== n.isValid ? {} : { name: o },
|
|
2789
2783
|
...r.resolver || !o ? { isValid: f } : {},
|
|
2790
2784
|
errors: n.errors,
|
|
2791
2785
|
isValidating: !1
|
|
2792
|
-
}),
|
|
2793
|
-
},
|
|
2794
|
-
const
|
|
2786
|
+
}), c.shouldFocus && !k && ze(s, Oe, o ? b : d.mount), k;
|
|
2787
|
+
}, wt = (o) => {
|
|
2788
|
+
const c = {
|
|
2795
2789
|
...a,
|
|
2796
2790
|
...u.mount ? i : {}
|
|
2797
2791
|
};
|
|
2798
|
-
return O(o) ?
|
|
2799
|
-
}, _t = (o,
|
|
2800
|
-
invalid: !!w((
|
|
2801
|
-
isDirty: !!w((
|
|
2802
|
-
isTouched: !!w((
|
|
2803
|
-
error: w((
|
|
2804
|
-
}),
|
|
2805
|
-
o && it(o).forEach((
|
|
2792
|
+
return O(o) ? c : te(o) ? w(c, o) : o.map((f) => w(c, f));
|
|
2793
|
+
}, _t = (o, c) => ({
|
|
2794
|
+
invalid: !!w((c || n).errors, o),
|
|
2795
|
+
isDirty: !!w((c || n).dirtyFields, o),
|
|
2796
|
+
isTouched: !!w((c || n).touchedFields, o),
|
|
2797
|
+
error: w((c || n).errors, o)
|
|
2798
|
+
}), kr = (o) => {
|
|
2799
|
+
o && it(o).forEach((c) => j(n.errors, c)), p.state.next({
|
|
2806
2800
|
errors: o ? n.errors : {}
|
|
2807
2801
|
});
|
|
2808
|
-
},
|
|
2809
|
-
const
|
|
2810
|
-
|
|
2811
|
-
...
|
|
2812
|
-
ref:
|
|
2802
|
+
}, kt = (o, c, f) => {
|
|
2803
|
+
const k = (w(s, o, { _f: {} })._f || {}).ref;
|
|
2804
|
+
N(n.errors, o, {
|
|
2805
|
+
...c,
|
|
2806
|
+
ref: k
|
|
2813
2807
|
}), p.state.next({
|
|
2814
2808
|
name: o,
|
|
2815
2809
|
errors: n.errors,
|
|
2816
2810
|
isValid: !1
|
|
2817
|
-
}), f && f.shouldFocus &&
|
|
2818
|
-
},
|
|
2819
|
-
next: (f) => o(R(void 0,
|
|
2820
|
-
}) : R(o,
|
|
2821
|
-
for (const f of o ? it(o) :
|
|
2822
|
-
|
|
2811
|
+
}), f && f.shouldFocus && k && k.focus && k.focus();
|
|
2812
|
+
}, Sr = (o, c) => fe(o) ? p.values.subscribe({
|
|
2813
|
+
next: (f) => o(R(void 0, c), f)
|
|
2814
|
+
}) : R(o, c, !0), tt = (o, c = {}) => {
|
|
2815
|
+
for (const f of o ? it(o) : d.mount)
|
|
2816
|
+
d.mount.delete(f), d.array.delete(f), c.keepValue || (j(s, f), j(i, f)), !c.keepError && j(n.errors, f), !c.keepDirty && j(n.dirtyFields, f), !c.keepTouched && j(n.touchedFields, f), !r.shouldUnregister && !c.keepDefaultValue && j(a, f);
|
|
2823
2817
|
p.values.next({
|
|
2824
2818
|
values: { ...i }
|
|
2825
2819
|
}), p.state.next({
|
|
2826
2820
|
...n,
|
|
2827
|
-
...
|
|
2828
|
-
}), !
|
|
2829
|
-
},
|
|
2821
|
+
...c.keepDirty ? { isDirty: V() } : {}
|
|
2822
|
+
}), !c.keepIsValid && g();
|
|
2823
|
+
}, St = ({ disabled: o, name: c, field: f, fields: k, value: b }) => {
|
|
2830
2824
|
if (de(o)) {
|
|
2831
|
-
const m = o ? void 0 : O(
|
|
2832
|
-
|
|
2825
|
+
const m = o ? void 0 : O(b) ? ct(f ? f._f : w(k, c)._f) : b;
|
|
2826
|
+
N(i, c, m), ce(c, m, !1, !1, !0);
|
|
2833
2827
|
}
|
|
2834
|
-
}, rt = (o,
|
|
2828
|
+
}, rt = (o, c = {}) => {
|
|
2835
2829
|
let f = w(s, o);
|
|
2836
|
-
const
|
|
2837
|
-
return
|
|
2830
|
+
const k = de(c.disabled);
|
|
2831
|
+
return N(s, o, {
|
|
2838
2832
|
...f || {},
|
|
2839
2833
|
_f: {
|
|
2840
2834
|
...f && f._f ? f._f : { ref: { name: o } },
|
|
2841
2835
|
name: o,
|
|
2842
2836
|
mount: !0,
|
|
2843
|
-
...
|
|
2837
|
+
...c
|
|
2844
2838
|
}
|
|
2845
|
-
}),
|
|
2839
|
+
}), d.mount.add(o), f ? St({
|
|
2846
2840
|
field: f,
|
|
2847
|
-
disabled:
|
|
2841
|
+
disabled: c.disabled,
|
|
2848
2842
|
name: o
|
|
2849
|
-
}) : me(o, !0,
|
|
2850
|
-
...
|
|
2843
|
+
}) : me(o, !0, c.value), {
|
|
2844
|
+
...k ? { disabled: c.disabled } : {},
|
|
2851
2845
|
...r.progressive ? {
|
|
2852
|
-
required: !!
|
|
2853
|
-
min: Ve(
|
|
2854
|
-
max: Ve(
|
|
2855
|
-
minLength: Ve(
|
|
2856
|
-
maxLength: Ve(
|
|
2857
|
-
pattern: Ve(
|
|
2846
|
+
required: !!c.required,
|
|
2847
|
+
min: Ve(c.min),
|
|
2848
|
+
max: Ve(c.max),
|
|
2849
|
+
minLength: Ve(c.minLength),
|
|
2850
|
+
maxLength: Ve(c.maxLength),
|
|
2851
|
+
pattern: Ve(c.pattern)
|
|
2858
2852
|
} : {},
|
|
2859
2853
|
name: o,
|
|
2860
2854
|
onChange: Ee,
|
|
2861
2855
|
onBlur: Ee,
|
|
2862
|
-
ref: (
|
|
2863
|
-
if (
|
|
2864
|
-
rt(o,
|
|
2865
|
-
const m = O(
|
|
2866
|
-
if (C ?
|
|
2856
|
+
ref: (b) => {
|
|
2857
|
+
if (b) {
|
|
2858
|
+
rt(o, c), f = w(s, o);
|
|
2859
|
+
const m = O(b.value) && b.querySelectorAll && b.querySelectorAll("input,select,textarea")[0] || b, C = Qn(m), L = f._f.refs || [];
|
|
2860
|
+
if (C ? L.find((B) => B === m) : m === f._f.ref)
|
|
2867
2861
|
return;
|
|
2868
|
-
|
|
2862
|
+
N(s, o, {
|
|
2869
2863
|
_f: {
|
|
2870
2864
|
...f._f,
|
|
2871
2865
|
...C ? {
|
|
2872
2866
|
refs: [
|
|
2873
|
-
...
|
|
2867
|
+
...L.filter(lt),
|
|
2874
2868
|
m,
|
|
2875
2869
|
...Array.isArray(w(a, o)) ? [{}] : []
|
|
2876
2870
|
],
|
|
@@ -2879,48 +2873,48 @@ function as(e = {}, t) {
|
|
|
2879
2873
|
}
|
|
2880
2874
|
}), me(o, !1, void 0, m);
|
|
2881
2875
|
} else
|
|
2882
|
-
f = w(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister ||
|
|
2876
|
+
f = w(s, o, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || c.shouldUnregister) && !(zn(d.array, o) && u.action) && d.unMount.add(o);
|
|
2883
2877
|
}
|
|
2884
2878
|
};
|
|
2885
|
-
},
|
|
2886
|
-
de(o) && (p.state.next({ disabled: o }), ze(s, (
|
|
2887
|
-
|
|
2879
|
+
}, Ct = () => r.shouldFocusError && ze(s, Oe, d.mount), Cr = (o) => {
|
|
2880
|
+
de(o) && (p.state.next({ disabled: o }), ze(s, (c) => {
|
|
2881
|
+
c.disabled = o;
|
|
2888
2882
|
}, 0, !1));
|
|
2889
|
-
},
|
|
2883
|
+
}, At = (o, c) => async (f) => {
|
|
2890
2884
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
2891
|
-
let
|
|
2885
|
+
let k = oe(i);
|
|
2892
2886
|
if (p.state.next({
|
|
2893
2887
|
isSubmitting: !0
|
|
2894
2888
|
}), r.resolver) {
|
|
2895
|
-
const { errors:
|
|
2896
|
-
n.errors =
|
|
2889
|
+
const { errors: b, values: m } = await G();
|
|
2890
|
+
n.errors = b, k = m;
|
|
2897
2891
|
} else
|
|
2898
2892
|
await q(s);
|
|
2899
2893
|
j(n.errors, "root"), W(n.errors) ? (p.state.next({
|
|
2900
2894
|
errors: {}
|
|
2901
|
-
}), await o(
|
|
2895
|
+
}), await o(k, f)) : (c && await c({ ...n.errors }, f), Ct(), setTimeout(Ct)), p.state.next({
|
|
2902
2896
|
isSubmitted: !0,
|
|
2903
2897
|
isSubmitting: !1,
|
|
2904
2898
|
isSubmitSuccessful: W(n.errors),
|
|
2905
2899
|
submitCount: n.submitCount + 1,
|
|
2906
2900
|
errors: n.errors
|
|
2907
2901
|
});
|
|
2908
|
-
},
|
|
2909
|
-
w(s, o) && (O(
|
|
2910
|
-
},
|
|
2911
|
-
const f = o ? oe(o) : a,
|
|
2912
|
-
if (
|
|
2913
|
-
if (
|
|
2914
|
-
for (const m of
|
|
2915
|
-
w(n.dirtyFields, m) ?
|
|
2902
|
+
}, Ar = (o, c = {}) => {
|
|
2903
|
+
w(s, o) && (O(c.defaultValue) ? ge(o, w(a, o)) : (ge(o, c.defaultValue), N(a, o, c.defaultValue)), c.keepTouched || j(n.touchedFields, o), c.keepDirty || (j(n.dirtyFields, o), n.isDirty = c.defaultValue ? V(o, w(a, o)) : V()), c.keepError || (j(n.errors, o), y.isValid && g()), p.state.next({ ...n }));
|
|
2904
|
+
}, Et = (o, c = {}) => {
|
|
2905
|
+
const f = o ? oe(o) : a, k = oe(f), b = o && !W(o) ? k : a;
|
|
2906
|
+
if (c.keepDefaultValues || (a = f), !c.keepValues) {
|
|
2907
|
+
if (c.keepDirtyValues || _)
|
|
2908
|
+
for (const m of d.mount)
|
|
2909
|
+
w(n.dirtyFields, m) ? N(b, m, w(i, m)) : ge(m, w(b, m));
|
|
2916
2910
|
else {
|
|
2917
|
-
if (
|
|
2918
|
-
for (const m of
|
|
2911
|
+
if (yt && O(o))
|
|
2912
|
+
for (const m of d.mount) {
|
|
2919
2913
|
const C = w(s, m);
|
|
2920
2914
|
if (C && C._f) {
|
|
2921
|
-
const
|
|
2922
|
-
if (Ge(
|
|
2923
|
-
const B =
|
|
2915
|
+
const L = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
|
|
2916
|
+
if (Ge(L)) {
|
|
2917
|
+
const B = L.closest("form");
|
|
2924
2918
|
if (B) {
|
|
2925
2919
|
B.reset();
|
|
2926
2920
|
break;
|
|
@@ -2930,48 +2924,48 @@ function as(e = {}, t) {
|
|
|
2930
2924
|
}
|
|
2931
2925
|
s = {};
|
|
2932
2926
|
}
|
|
2933
|
-
i = e.shouldUnregister ?
|
|
2934
|
-
values: { ...
|
|
2927
|
+
i = e.shouldUnregister ? c.keepDefaultValues ? oe(a) : {} : oe(b), p.array.next({
|
|
2928
|
+
values: { ...b }
|
|
2935
2929
|
}), p.values.next({
|
|
2936
|
-
values: { ...
|
|
2930
|
+
values: { ...b }
|
|
2937
2931
|
});
|
|
2938
2932
|
}
|
|
2939
|
-
|
|
2933
|
+
d = {
|
|
2940
2934
|
mount: /* @__PURE__ */ new Set(),
|
|
2941
2935
|
unMount: /* @__PURE__ */ new Set(),
|
|
2942
2936
|
array: /* @__PURE__ */ new Set(),
|
|
2943
2937
|
watch: /* @__PURE__ */ new Set(),
|
|
2944
2938
|
watchAll: !1,
|
|
2945
2939
|
focus: ""
|
|
2946
|
-
}, !u.mount && t(), u.mount = !
|
|
2947
|
-
submitCount:
|
|
2948
|
-
isDirty:
|
|
2949
|
-
isSubmitted:
|
|
2950
|
-
dirtyFields:
|
|
2951
|
-
touchedFields:
|
|
2952
|
-
errors:
|
|
2953
|
-
isSubmitSuccessful:
|
|
2940
|
+
}, !u.mount && t(), u.mount = !y.isValid || !!c.keepIsValid, u.watch = !!e.shouldUnregister, p.state.next({
|
|
2941
|
+
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2942
|
+
isDirty: c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !ye(o, a)),
|
|
2943
|
+
isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
|
|
2944
|
+
dirtyFields: c.keepDirtyValues ? n.dirtyFields : c.keepDefaultValues && o ? ut(a, o) : {},
|
|
2945
|
+
touchedFields: c.keepTouched ? n.touchedFields : {},
|
|
2946
|
+
errors: c.keepErrors ? n.errors : {},
|
|
2947
|
+
isSubmitSuccessful: c.keepIsSubmitSuccessful ? n.isSubmitSuccessful : !1,
|
|
2954
2948
|
isSubmitting: !1
|
|
2955
2949
|
});
|
|
2956
|
-
},
|
|
2950
|
+
}, It = (o, c) => Et(fe(o) ? o(i) : o, c);
|
|
2957
2951
|
return {
|
|
2958
2952
|
control: {
|
|
2959
2953
|
register: rt,
|
|
2960
2954
|
unregister: tt,
|
|
2961
2955
|
getFieldState: _t,
|
|
2962
|
-
handleSubmit:
|
|
2963
|
-
setError:
|
|
2956
|
+
handleSubmit: At,
|
|
2957
|
+
setError: kt,
|
|
2964
2958
|
_executeSchema: G,
|
|
2965
2959
|
_getWatch: R,
|
|
2966
2960
|
_getDirty: V,
|
|
2967
2961
|
_updateValid: g,
|
|
2968
2962
|
_removeUnmounted: F,
|
|
2969
2963
|
_updateFieldArray: P,
|
|
2970
|
-
_updateDisabledField:
|
|
2964
|
+
_updateDisabledField: St,
|
|
2971
2965
|
_getFieldArray: K,
|
|
2972
|
-
_reset:
|
|
2966
|
+
_reset: Et,
|
|
2973
2967
|
_resetDefaultValues: () => fe(r.defaultValues) && r.defaultValues().then((o) => {
|
|
2974
|
-
|
|
2968
|
+
It(o, r.resetOptions), p.state.next({
|
|
2975
2969
|
isLoading: !1
|
|
2976
2970
|
});
|
|
2977
2971
|
}),
|
|
@@ -2981,9 +2975,9 @@ function as(e = {}, t) {
|
|
|
2981
2975
|
...o
|
|
2982
2976
|
};
|
|
2983
2977
|
},
|
|
2984
|
-
_disableForm:
|
|
2978
|
+
_disableForm: Cr,
|
|
2985
2979
|
_subjects: p,
|
|
2986
|
-
_proxyFormState:
|
|
2980
|
+
_proxyFormState: y,
|
|
2987
2981
|
get _fields() {
|
|
2988
2982
|
return s;
|
|
2989
2983
|
},
|
|
@@ -3000,10 +2994,10 @@ function as(e = {}, t) {
|
|
|
3000
2994
|
return a;
|
|
3001
2995
|
},
|
|
3002
2996
|
get _names() {
|
|
3003
|
-
return
|
|
2997
|
+
return d;
|
|
3004
2998
|
},
|
|
3005
2999
|
set _names(o) {
|
|
3006
|
-
|
|
3000
|
+
d = o;
|
|
3007
3001
|
},
|
|
3008
3002
|
get _formState() {
|
|
3009
3003
|
return n;
|
|
@@ -3023,20 +3017,20 @@ function as(e = {}, t) {
|
|
|
3023
3017
|
},
|
|
3024
3018
|
trigger: et,
|
|
3025
3019
|
register: rt,
|
|
3026
|
-
handleSubmit:
|
|
3027
|
-
watch:
|
|
3020
|
+
handleSubmit: At,
|
|
3021
|
+
watch: Sr,
|
|
3028
3022
|
setValue: ge,
|
|
3029
|
-
getValues:
|
|
3030
|
-
reset:
|
|
3031
|
-
resetField:
|
|
3032
|
-
clearErrors:
|
|
3023
|
+
getValues: wt,
|
|
3024
|
+
reset: It,
|
|
3025
|
+
resetField: Ar,
|
|
3026
|
+
clearErrors: kr,
|
|
3033
3027
|
unregister: tt,
|
|
3034
|
-
setError:
|
|
3035
|
-
setFocus: (o,
|
|
3036
|
-
const f = w(s, o),
|
|
3037
|
-
if (
|
|
3038
|
-
const
|
|
3039
|
-
|
|
3028
|
+
setError: kt,
|
|
3029
|
+
setFocus: (o, c = {}) => {
|
|
3030
|
+
const f = w(s, o), k = f && f._f;
|
|
3031
|
+
if (k) {
|
|
3032
|
+
const b = k.refs ? k.refs[0] : k.ref;
|
|
3033
|
+
b.focus && (b.focus(), c.shouldSelect && b.select());
|
|
3040
3034
|
}
|
|
3041
3035
|
},
|
|
3042
3036
|
getFieldState: _t
|
|
@@ -3059,14 +3053,14 @@ function Xe(e = {}) {
|
|
|
3059
3053
|
defaultValues: fe(e.defaultValues) ? void 0 : e.defaultValues
|
|
3060
3054
|
});
|
|
3061
3055
|
t.current || (t.current = {
|
|
3062
|
-
...
|
|
3056
|
+
...ns(e, () => s((i) => ({ ...i }))),
|
|
3063
3057
|
formState: n
|
|
3064
3058
|
});
|
|
3065
3059
|
const a = t.current.control;
|
|
3066
|
-
return a._options = e,
|
|
3060
|
+
return a._options = e, Gn({
|
|
3067
3061
|
subject: a._subjects.state,
|
|
3068
3062
|
next: (i) => {
|
|
3069
|
-
|
|
3063
|
+
Kn(i, a._proxyFormState, a._updateFormState, !0) && s({ ...a._formState });
|
|
3070
3064
|
}
|
|
3071
3065
|
}), X.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), X.useEffect(() => {
|
|
3072
3066
|
if (a._proxyFormState.isDirty) {
|
|
@@ -3079,41 +3073,41 @@ function Xe(e = {}) {
|
|
|
3079
3073
|
e.values && !ye(e.values, r.current) ? (a._reset(e.values, a._options.resetOptions), r.current = e.values) : a._resetDefaultValues();
|
|
3080
3074
|
}, [e.values, a]), X.useEffect(() => {
|
|
3081
3075
|
a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
3082
|
-
}), t.current.formState =
|
|
3076
|
+
}), t.current.formState = Un(n, a), t.current;
|
|
3083
3077
|
}
|
|
3084
|
-
var
|
|
3078
|
+
var Wt = function(e, t, r) {
|
|
3085
3079
|
if (e && "reportValidity" in e) {
|
|
3086
3080
|
var n = w(r, t);
|
|
3087
3081
|
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
3088
3082
|
}
|
|
3089
|
-
},
|
|
3083
|
+
}, ss = function(e, t) {
|
|
3090
3084
|
var r = function(s) {
|
|
3091
3085
|
var a = t.fields[s];
|
|
3092
|
-
a && a.ref && "reportValidity" in a.ref ?
|
|
3093
|
-
return
|
|
3086
|
+
a && a.ref && "reportValidity" in a.ref ? Wt(a.ref, s, e) : a.refs && a.refs.forEach(function(i) {
|
|
3087
|
+
return Wt(i, s, e);
|
|
3094
3088
|
});
|
|
3095
3089
|
};
|
|
3096
3090
|
for (var n in t.fields)
|
|
3097
3091
|
r(n);
|
|
3098
|
-
},
|
|
3099
|
-
t.shouldUseNativeValidation &&
|
|
3092
|
+
}, as = function(e, t) {
|
|
3093
|
+
t.shouldUseNativeValidation && ss(e, t);
|
|
3100
3094
|
var r = {};
|
|
3101
3095
|
for (var n in e) {
|
|
3102
3096
|
var s = w(t.fields, n), a = Object.assign(e[n] || {}, { ref: s && s.ref });
|
|
3103
|
-
if (
|
|
3104
|
-
var i = Object.assign({},
|
|
3105
|
-
|
|
3097
|
+
if (os(t.names || Object.keys(e), n)) {
|
|
3098
|
+
var i = Object.assign({}, is(w(r, n)));
|
|
3099
|
+
N(i, "root", a), N(r, n, i);
|
|
3106
3100
|
} else
|
|
3107
|
-
|
|
3101
|
+
N(r, n, a);
|
|
3108
3102
|
}
|
|
3109
3103
|
return r;
|
|
3110
|
-
},
|
|
3104
|
+
}, is = function(e) {
|
|
3111
3105
|
return Array.isArray(e) ? e.filter(Boolean) : [];
|
|
3112
|
-
},
|
|
3106
|
+
}, os = function(e, t) {
|
|
3113
3107
|
return e.some(function(r) {
|
|
3114
3108
|
return r.startsWith(t + ".");
|
|
3115
3109
|
});
|
|
3116
|
-
},
|
|
3110
|
+
}, ls = function(e, t) {
|
|
3117
3111
|
for (var r = {}; e.issues.length; ) {
|
|
3118
3112
|
var n = e.issues[0];
|
|
3119
3113
|
if (n.path) {
|
|
@@ -3122,7 +3116,7 @@ var Jt = function(e, t, r) {
|
|
|
3122
3116
|
}).join(".");
|
|
3123
3117
|
if (r[s] || (r[s] = { message: n.message, type: n.validation }), t) {
|
|
3124
3118
|
var a = r[s].types, i = a && a[n.validation];
|
|
3125
|
-
r[s] =
|
|
3119
|
+
r[s] = mr(s, t, r, n.validation, i ? [].concat(i, n.message) : n.message);
|
|
3126
3120
|
}
|
|
3127
3121
|
e.issues.shift();
|
|
3128
3122
|
}
|
|
@@ -3133,20 +3127,20 @@ var Jt = function(e, t, r) {
|
|
|
3133
3127
|
try {
|
|
3134
3128
|
return Promise.resolve(function(i, u) {
|
|
3135
3129
|
try {
|
|
3136
|
-
var
|
|
3137
|
-
function h(
|
|
3138
|
-
return { values: r.raw ? n :
|
|
3130
|
+
var d = function() {
|
|
3131
|
+
function h(y) {
|
|
3132
|
+
return { values: r.raw ? n : y, errors: {} };
|
|
3139
3133
|
}
|
|
3140
3134
|
var x = Object.assign({}, { abortEarly: !1, abortPipeEarly: !1 }, t);
|
|
3141
|
-
return r.mode === "sync" ? h(
|
|
3135
|
+
return r.mode === "sync" ? h(sr(e, n, x)) : Promise.resolve(Rr(e, n, x)).then(h);
|
|
3142
3136
|
}();
|
|
3143
3137
|
} catch (h) {
|
|
3144
3138
|
return u(h);
|
|
3145
3139
|
}
|
|
3146
|
-
return
|
|
3140
|
+
return d && d.then ? d.then(void 0, u) : d;
|
|
3147
3141
|
}(0, function(i) {
|
|
3148
|
-
if (i instanceof
|
|
3149
|
-
return { values: {}, errors:
|
|
3142
|
+
if (i instanceof Or)
|
|
3143
|
+
return { values: {}, errors: as(ls(i, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
|
|
3150
3144
|
throw i;
|
|
3151
3145
|
}));
|
|
3152
3146
|
} catch (i) {
|
|
@@ -3154,18 +3148,18 @@ var Jt = function(e, t, r) {
|
|
|
3154
3148
|
}
|
|
3155
3149
|
};
|
|
3156
3150
|
};
|
|
3157
|
-
const
|
|
3151
|
+
const Jt = 27, Zt = 12, Qt = 10, us = Se("enum"), cs = (e) => {
|
|
3158
3152
|
const t = {
|
|
3159
3153
|
min: e.minSelected ?? 0,
|
|
3160
3154
|
max: e.maxSelected ?? e.options.length
|
|
3161
3155
|
};
|
|
3162
3156
|
return Ye(he({
|
|
3163
|
-
checked:
|
|
3157
|
+
checked: ar(Br(Pr()), (r) => Object.entries(r).filter(([n, s]) => s).map(([n, s]) => n), [$e(t.max, `Please select at most ${t.max} option${t.max !== 1 ? "s" : ""}`), je(t.min, `Please select at least ${t.min} option${t.min !== 1 ? "s" : ""}`)])
|
|
3164
3158
|
}));
|
|
3165
|
-
},
|
|
3159
|
+
}, ds = nr(({
|
|
3166
3160
|
option: e,
|
|
3167
3161
|
...t
|
|
3168
|
-
}, r) => l(
|
|
3162
|
+
}, r) => l(ke, {
|
|
3169
3163
|
children: [l("input", {
|
|
3170
3164
|
class: "peer sr-only h-full",
|
|
3171
3165
|
type: "checkbox",
|
|
@@ -3176,16 +3170,16 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3176
3170
|
htmlFor: t.id,
|
|
3177
3171
|
children: e.label
|
|
3178
3172
|
})]
|
|
3179
|
-
})),
|
|
3173
|
+
})), Xt = Ze("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3180
3174
|
variants: {
|
|
3181
3175
|
variant: {
|
|
3182
3176
|
// In cases where there is only one option, we want to center it
|
|
3183
3177
|
singleOption: "justify-center",
|
|
3184
3178
|
// Two choices with exactly 1 min 1 max
|
|
3185
|
-
booleanLike:
|
|
3179
|
+
booleanLike: cr
|
|
3186
3180
|
}
|
|
3187
3181
|
}
|
|
3188
|
-
}),
|
|
3182
|
+
}), fs = ({
|
|
3189
3183
|
input: e,
|
|
3190
3184
|
onSubmitSuccess: t
|
|
3191
3185
|
}) => {
|
|
@@ -3198,71 +3192,71 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3198
3192
|
}
|
|
3199
3193
|
} = Xe({
|
|
3200
3194
|
defaultValues: {
|
|
3201
|
-
checked: n ? {} :
|
|
3195
|
+
checked: n ? {} : us(r) ? Object.fromEntries(r.value.map((y) => [y, !0])) : {}
|
|
3202
3196
|
},
|
|
3203
|
-
resolver:
|
|
3204
|
-
}),
|
|
3197
|
+
resolver: cs(e.config)
|
|
3198
|
+
}), d = gt();
|
|
3205
3199
|
return s ? l("ul", {
|
|
3206
3200
|
style: {
|
|
3207
|
-
maxHeight: 6.5 *
|
|
3201
|
+
maxHeight: 6.5 * Jt + 5 * Zt + 2 * Qt
|
|
3208
3202
|
},
|
|
3209
|
-
class:
|
|
3203
|
+
class: Xt({
|
|
3210
3204
|
variant: "booleanLike"
|
|
3211
3205
|
}),
|
|
3212
|
-
children: e.config.options.map((
|
|
3206
|
+
children: e.config.options.map((y, p) => l("li", {
|
|
3213
3207
|
class: "flex-1",
|
|
3214
|
-
children: l(
|
|
3208
|
+
children: l(dr, {
|
|
3215
3209
|
type: "submit",
|
|
3216
|
-
ref: (
|
|
3217
|
-
|
|
3210
|
+
ref: (_) => {
|
|
3211
|
+
_ && p === 0 && (d.current = _);
|
|
3218
3212
|
},
|
|
3219
|
-
label:
|
|
3213
|
+
label: y.label,
|
|
3220
3214
|
value: "true",
|
|
3221
3215
|
onClick: () => t({
|
|
3222
3216
|
type: "enum",
|
|
3223
|
-
value: [
|
|
3217
|
+
value: [y.value]
|
|
3224
3218
|
})
|
|
3225
3219
|
})
|
|
3226
|
-
},
|
|
3220
|
+
}, y.value))
|
|
3227
3221
|
}) : l("form", {
|
|
3228
3222
|
noValidate: !0,
|
|
3229
|
-
onSubmit: (
|
|
3230
|
-
const
|
|
3223
|
+
onSubmit: (y) => i((p) => {
|
|
3224
|
+
const _ = p.checked;
|
|
3231
3225
|
t({
|
|
3232
3226
|
type: "enum",
|
|
3233
|
-
value:
|
|
3227
|
+
value: _
|
|
3234
3228
|
});
|
|
3235
|
-
})(
|
|
3229
|
+
})(y),
|
|
3236
3230
|
children: [l("div", {
|
|
3237
3231
|
class: "flex items-center gap-1",
|
|
3238
3232
|
children: [l("ul", {
|
|
3239
3233
|
style: {
|
|
3240
|
-
maxHeight: 6.5 *
|
|
3234
|
+
maxHeight: 6.5 * Jt + 5 * Zt + 2 * Qt
|
|
3241
3235
|
},
|
|
3242
|
-
class:
|
|
3236
|
+
class: Xt({
|
|
3243
3237
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3244
3238
|
}),
|
|
3245
|
-
children: e.config.options.map((
|
|
3246
|
-
const
|
|
3239
|
+
children: e.config.options.map((y, p) => {
|
|
3240
|
+
const _ = `checked.${y.value}`, {
|
|
3247
3241
|
ref: v,
|
|
3248
3242
|
...E
|
|
3249
|
-
} = a(
|
|
3243
|
+
} = a(_);
|
|
3250
3244
|
return l("li", {
|
|
3251
3245
|
class: "relative",
|
|
3252
|
-
children: l(
|
|
3253
|
-
option:
|
|
3246
|
+
children: l(ds, {
|
|
3247
|
+
option: y,
|
|
3254
3248
|
autoFocus: p === 0,
|
|
3255
3249
|
ref: (S) => {
|
|
3256
|
-
S && p === 0 && (
|
|
3250
|
+
S && p === 0 && (d.current = S), v(S);
|
|
3257
3251
|
},
|
|
3258
|
-
id:
|
|
3252
|
+
id: _,
|
|
3259
3253
|
...E,
|
|
3260
3254
|
onClick: n ? () => t({
|
|
3261
3255
|
type: "enum",
|
|
3262
|
-
value: [
|
|
3256
|
+
value: [y.value]
|
|
3263
3257
|
}) : void 0
|
|
3264
3258
|
})
|
|
3265
|
-
},
|
|
3259
|
+
}, y.value);
|
|
3266
3260
|
})
|
|
3267
3261
|
}), l("div", {
|
|
3268
3262
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
@@ -3281,25 +3275,25 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3281
3275
|
})
|
|
3282
3276
|
})]
|
|
3283
3277
|
});
|
|
3284
|
-
},
|
|
3278
|
+
}, hs = Se("number"), ps = (e, t) => {
|
|
3285
3279
|
const r = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, s = e.decimalCases ?? 0;
|
|
3286
3280
|
return Ye(he({
|
|
3287
|
-
number:
|
|
3281
|
+
number: $r(t("validation_number"), [jr(r, t("validation_number_min", {
|
|
3288
3282
|
min: r
|
|
3289
|
-
})),
|
|
3283
|
+
})), zr(n, t("validation_number_max", {
|
|
3290
3284
|
max: n
|
|
3291
|
-
})),
|
|
3285
|
+
})), qr((a) => a === Number(a.toFixed(s)), t("validation_number_decimal_cases", {
|
|
3292
3286
|
count: s
|
|
3293
3287
|
}))])
|
|
3294
3288
|
}));
|
|
3295
|
-
},
|
|
3289
|
+
}, ms = ({
|
|
3296
3290
|
input: e,
|
|
3297
3291
|
onSubmitSuccess: t
|
|
3298
3292
|
}) => {
|
|
3299
|
-
var
|
|
3300
|
-
const r = e.config.defaultValue, n = e.key ? (
|
|
3293
|
+
var y;
|
|
3294
|
+
const r = e.config.defaultValue, n = e.key ? (y = M.current$.value.flow) == null ? void 0 : y.data.submissions[e.key] : void 0, {
|
|
3301
3295
|
t: s
|
|
3302
|
-
} =
|
|
3296
|
+
} = J(), {
|
|
3303
3297
|
register: a,
|
|
3304
3298
|
handleSubmit: i,
|
|
3305
3299
|
formState: {
|
|
@@ -3307,11 +3301,11 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3307
3301
|
}
|
|
3308
3302
|
} = Xe({
|
|
3309
3303
|
defaultValues: {
|
|
3310
|
-
number: r ? Number(r) :
|
|
3304
|
+
number: r ? Number(r) : hs(n) ? n.value : void 0
|
|
3311
3305
|
},
|
|
3312
|
-
resolver:
|
|
3306
|
+
resolver: ps(e.config, s)
|
|
3313
3307
|
}), {
|
|
3314
|
-
ref:
|
|
3308
|
+
ref: d,
|
|
3315
3309
|
...h
|
|
3316
3310
|
} = a("number", {
|
|
3317
3311
|
required: !e.config.optional,
|
|
@@ -3339,7 +3333,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3339
3333
|
autoCorrect: "off",
|
|
3340
3334
|
autoFocus: !0,
|
|
3341
3335
|
ref: (p) => {
|
|
3342
|
-
p && (x.current = p),
|
|
3336
|
+
p && (x.current = p), d(p);
|
|
3343
3337
|
},
|
|
3344
3338
|
type: "text",
|
|
3345
3339
|
min: e.config.min,
|
|
@@ -3358,13 +3352,13 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3358
3352
|
error: u.number
|
|
3359
3353
|
})]
|
|
3360
3354
|
});
|
|
3361
|
-
},
|
|
3355
|
+
}, gs = (e) => {
|
|
3362
3356
|
if (e === "")
|
|
3363
3357
|
return {
|
|
3364
3358
|
countryCode: "",
|
|
3365
3359
|
phoneNumber: ""
|
|
3366
3360
|
};
|
|
3367
|
-
const t = Object.entries(
|
|
3361
|
+
const t = Object.entries(mt).find((s) => e.startsWith(s[1])), r = t ? t[1] : "", n = e.replace(r, "");
|
|
3368
3362
|
return /^\d+$/.test(n) ? {
|
|
3369
3363
|
countryCode: r,
|
|
3370
3364
|
phoneNumber: n
|
|
@@ -3372,44 +3366,44 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3372
3366
|
countryCode: "",
|
|
3373
3367
|
phoneNumber: ""
|
|
3374
3368
|
};
|
|
3375
|
-
},
|
|
3376
|
-
const t = ee(e("validation_country_code"), [
|
|
3369
|
+
}, ys = "44", bs = Se("string"), vs = Se("phone"), xs = (e) => {
|
|
3370
|
+
const t = ee(e("validation_country_code"), [Ft(/^\+?[0-9 -]+$/, e("validation_country_code"))]);
|
|
3377
3371
|
return Ye(he({
|
|
3378
3372
|
countryCode: t,
|
|
3379
|
-
phoneNumber:
|
|
3373
|
+
phoneNumber: ar(ee(e("validation_phone"), [Ft(/^\+?[0-9 -]+$/, e("validation_phone"))]), (r) => r.replace(/[^0-9]/g, ""), [])
|
|
3380
3374
|
}));
|
|
3381
|
-
},
|
|
3375
|
+
}, ws = ({
|
|
3382
3376
|
input: e,
|
|
3383
3377
|
onSubmitSuccess: t
|
|
3384
3378
|
}) => {
|
|
3385
3379
|
var E;
|
|
3386
3380
|
const r = e.key ? (E = M.current$.value.flow) == null ? void 0 : E.data.submissions[e.key] : void 0, {
|
|
3387
3381
|
t: n
|
|
3388
|
-
} =
|
|
3382
|
+
} = J(), [s, a] = Y(), i = bs(r) ? gs(r.value) : vs(r) ? r.value : void 0, {
|
|
3389
3383
|
register: u,
|
|
3390
|
-
handleSubmit:
|
|
3384
|
+
handleSubmit: d,
|
|
3391
3385
|
formState: {
|
|
3392
3386
|
errors: h
|
|
3393
3387
|
},
|
|
3394
3388
|
watch: x
|
|
3395
3389
|
} = Xe({
|
|
3396
3390
|
defaultValues: {
|
|
3397
|
-
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3391
|
+
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ?? ys,
|
|
3398
3392
|
phoneNumber: (i == null ? void 0 : i.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3399
3393
|
},
|
|
3400
|
-
resolver:
|
|
3394
|
+
resolver: xs(n)
|
|
3401
3395
|
}), {
|
|
3402
|
-
ref:
|
|
3396
|
+
ref: y,
|
|
3403
3397
|
...p
|
|
3404
3398
|
} = u("phoneNumber", {
|
|
3405
3399
|
required: !e.config.optional
|
|
3406
|
-
}),
|
|
3400
|
+
}), _ = re(), v = x("countryCode");
|
|
3407
3401
|
return pe(() => {
|
|
3408
|
-
|
|
3402
|
+
_.current && (_.current.focus(), _.current.select());
|
|
3409
3403
|
}, []), l("form", {
|
|
3410
3404
|
noValidate: !0,
|
|
3411
3405
|
class: "flex flex-col gap-1 p-2.5",
|
|
3412
|
-
onSubmit:
|
|
3406
|
+
onSubmit: d((S) => {
|
|
3413
3407
|
const A = S.phoneNumber.replace(/[^0-9]/g, ""), g = S.countryCode.replace(/[^0-9]/g, "");
|
|
3414
3408
|
if (a(void 0), A.length + g.length > (e.config.maxChars || Number.POSITIVE_INFINITY))
|
|
3415
3409
|
return a(n("validation_max_chars", {
|
|
@@ -3443,7 +3437,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3443
3437
|
...u("countryCode", {}),
|
|
3444
3438
|
id: `isdk_phone_${e.key}`,
|
|
3445
3439
|
class: "absolute inset-0 opacity-0",
|
|
3446
|
-
children: Object.entries(
|
|
3440
|
+
children: Object.entries(mt).map(([S, A]) => l("option", {
|
|
3447
3441
|
value: A,
|
|
3448
3442
|
children: [S, " (+", A, ")"]
|
|
3449
3443
|
}, S))
|
|
@@ -3458,7 +3452,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3458
3452
|
autoCorrect: "off",
|
|
3459
3453
|
autoFocus: !0,
|
|
3460
3454
|
ref: (S) => {
|
|
3461
|
-
S && (
|
|
3455
|
+
S && (_.current = S), y(S);
|
|
3462
3456
|
},
|
|
3463
3457
|
class: Te({
|
|
3464
3458
|
optional: e.config.optional,
|
|
@@ -3476,7 +3470,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3476
3470
|
}
|
|
3477
3471
|
})]
|
|
3478
3472
|
});
|
|
3479
|
-
},
|
|
3473
|
+
}, _s = ({
|
|
3480
3474
|
input: e,
|
|
3481
3475
|
onSubmitSuccess: t
|
|
3482
3476
|
}) => l("div", {
|
|
@@ -3508,12 +3502,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3508
3502
|
})]
|
|
3509
3503
|
})
|
|
3510
3504
|
})
|
|
3511
|
-
}),
|
|
3512
|
-
empty: "Please enter some text",
|
|
3513
|
-
email: "That doesn’t look like a valid email address",
|
|
3514
|
-
phone: "That doesn’t look like a valid phone number",
|
|
3515
|
-
url: "That doesn’t look like a valid URL"
|
|
3516
|
-
}, Cs = {
|
|
3505
|
+
}), ks = {
|
|
3517
3506
|
email: {
|
|
3518
3507
|
type: "email",
|
|
3519
3508
|
inputMode: "email",
|
|
@@ -3528,7 +3517,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3528
3517
|
inputMode: "url",
|
|
3529
3518
|
formNoValidate: !0
|
|
3530
3519
|
}
|
|
3531
|
-
},
|
|
3520
|
+
}, Ss = Se("string"), Cs = (e, t) => {
|
|
3532
3521
|
const r = {
|
|
3533
3522
|
maxLength: t("validation_max_chars", {
|
|
3534
3523
|
count: e.maxChars ?? 999
|
|
@@ -3539,19 +3528,19 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3539
3528
|
};
|
|
3540
3529
|
return Ye(he({
|
|
3541
3530
|
text: {
|
|
3542
|
-
email: ee(
|
|
3531
|
+
email: ee(t("validation_email"), [Ur(t("validation_email")), je(e.minChars ?? 1, r.minLength), $e(e.maxChars ?? 1 / 0, r.maxLength)]),
|
|
3543
3532
|
text: ee([je(e.minChars ?? 1, r.minLength), $e(e.maxChars ?? 1 / 0, r.maxLength)]),
|
|
3544
|
-
url: ee([
|
|
3533
|
+
url: ee([Kr(t("validation_url")), je(e.minChars ?? 1, r.minLength), $e(e.maxChars ?? 1 / 0, r.maxLength)])
|
|
3545
3534
|
}[e.format]
|
|
3546
3535
|
}));
|
|
3547
|
-
},
|
|
3536
|
+
}, As = ({
|
|
3548
3537
|
input: e,
|
|
3549
3538
|
onSubmitSuccess: t
|
|
3550
3539
|
}) => {
|
|
3551
|
-
var
|
|
3540
|
+
var y;
|
|
3552
3541
|
const {
|
|
3553
3542
|
t: r
|
|
3554
|
-
} =
|
|
3543
|
+
} = J(), n = e.key ? (y = M.current$.value.flow) == null ? void 0 : y.data.submissions[e.key] : void 0, s = e.config.defaultValue, {
|
|
3555
3544
|
register: a,
|
|
3556
3545
|
handleSubmit: i,
|
|
3557
3546
|
formState: {
|
|
@@ -3559,11 +3548,11 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3559
3548
|
}
|
|
3560
3549
|
} = Xe({
|
|
3561
3550
|
defaultValues: {
|
|
3562
|
-
text: s || (
|
|
3551
|
+
text: s || (Ss(n) ? n.value : "")
|
|
3563
3552
|
},
|
|
3564
|
-
resolver:
|
|
3553
|
+
resolver: Cs(e.config, r)
|
|
3565
3554
|
}), {
|
|
3566
|
-
ref:
|
|
3555
|
+
ref: d,
|
|
3567
3556
|
...h
|
|
3568
3557
|
} = a("text", {
|
|
3569
3558
|
required: !e.config.optional
|
|
@@ -3586,13 +3575,13 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3586
3575
|
children: [l("input", {
|
|
3587
3576
|
id: "chat-input",
|
|
3588
3577
|
...h,
|
|
3589
|
-
...
|
|
3578
|
+
...ks[e.config.format],
|
|
3590
3579
|
autocomplete: "off",
|
|
3591
3580
|
autoCapitalize: "off",
|
|
3592
3581
|
autoCorrect: "off",
|
|
3593
3582
|
autoFocus: !0,
|
|
3594
3583
|
ref: (p) => {
|
|
3595
|
-
p && (x.current = p),
|
|
3584
|
+
p && (x.current = p), d(p);
|
|
3596
3585
|
},
|
|
3597
3586
|
placeholder: e.config.placeholder,
|
|
3598
3587
|
class: Te({
|
|
@@ -3608,20 +3597,20 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3608
3597
|
error: u.text
|
|
3609
3598
|
})]
|
|
3610
3599
|
});
|
|
3611
|
-
},
|
|
3612
|
-
text:
|
|
3613
|
-
phone:
|
|
3614
|
-
"multiple-choice":
|
|
3615
|
-
boolean:
|
|
3616
|
-
file:
|
|
3617
|
-
submit:
|
|
3618
|
-
address:
|
|
3619
|
-
number:
|
|
3620
|
-
},
|
|
3600
|
+
}, Es = {
|
|
3601
|
+
text: As,
|
|
3602
|
+
phone: ws,
|
|
3603
|
+
"multiple-choice": fs,
|
|
3604
|
+
boolean: Nn,
|
|
3605
|
+
file: Pn,
|
|
3606
|
+
submit: _s,
|
|
3607
|
+
address: In,
|
|
3608
|
+
number: ms
|
|
3609
|
+
}, Is = ({
|
|
3621
3610
|
logger: e
|
|
3622
3611
|
}) => {
|
|
3623
3612
|
var a;
|
|
3624
|
-
const t = (a = M.current$.value.flow) == null ? void 0 : a.data.currentInput, [r, n] =
|
|
3613
|
+
const t = (a = M.current$.value.flow) == null ? void 0 : a.data.currentInput, [r, n] = gn(), s = re(null);
|
|
3625
3614
|
return M.inputHeight$.value = n.height, ue(() => {
|
|
3626
3615
|
const i = s.current;
|
|
3627
3616
|
if (i)
|
|
@@ -3638,7 +3627,7 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3638
3627
|
ref: r,
|
|
3639
3628
|
class: "border-divider flex flex-col justify-end border-t",
|
|
3640
3629
|
children: t ? (() => {
|
|
3641
|
-
const i =
|
|
3630
|
+
const i = Es[t.type];
|
|
3642
3631
|
return l(i, {
|
|
3643
3632
|
logger: e,
|
|
3644
3633
|
onSubmitSuccess: z.onSubmitSuccessFn$.value,
|
|
@@ -3663,28 +3652,28 @@ const Zt = 27, Qt = 12, Xt = 10, ds = Se("enum"), fs = (e) => {
|
|
|
3663
3652
|
})
|
|
3664
3653
|
});
|
|
3665
3654
|
};
|
|
3666
|
-
var
|
|
3655
|
+
var Vs = function(e) {
|
|
3667
3656
|
return e instanceof RegExp;
|
|
3668
|
-
},
|
|
3657
|
+
}, Ms = function(t) {
|
|
3669
3658
|
var r = /[\\^$.*+?()[\]{}|]/g, n = RegExp(r.source);
|
|
3670
3659
|
return t && n.test(t) ? t.replace(r, "\\$&") : t;
|
|
3671
3660
|
}, _r = function(e) {
|
|
3672
3661
|
return typeof e == "string";
|
|
3673
|
-
},
|
|
3662
|
+
}, Fs = function(e) {
|
|
3674
3663
|
var t = [];
|
|
3675
3664
|
return e.forEach(function(r) {
|
|
3676
3665
|
Array.isArray(r) ? t = t.concat(r) : t.push(r);
|
|
3677
3666
|
}), t;
|
|
3678
3667
|
};
|
|
3679
|
-
function
|
|
3668
|
+
function Ns(e, t, r) {
|
|
3680
3669
|
var n = 0, s = 0;
|
|
3681
3670
|
if (e === "")
|
|
3682
3671
|
return e;
|
|
3683
3672
|
if (!e || !_r(e))
|
|
3684
3673
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3685
3674
|
var a = t;
|
|
3686
|
-
|
|
3687
|
-
for (var i = e.split(a), u = 1,
|
|
3675
|
+
Vs(a) || (a = new RegExp("(" + Ms(a) + ")", "gi"));
|
|
3676
|
+
for (var i = e.split(a), u = 1, d = i.length; u < d; u += 2) {
|
|
3688
3677
|
if (i[u] === void 0 || i[u - 1] === void 0) {
|
|
3689
3678
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
3690
3679
|
continue;
|
|
@@ -3693,32 +3682,32 @@ function Ts(e, t, r) {
|
|
|
3693
3682
|
}
|
|
3694
3683
|
return i;
|
|
3695
3684
|
}
|
|
3696
|
-
var
|
|
3697
|
-
return Array.isArray(t) || (t = [t]),
|
|
3698
|
-
return _r(s) ?
|
|
3685
|
+
var Ls = function(t, r, n) {
|
|
3686
|
+
return Array.isArray(t) || (t = [t]), Fs(t.map(function(s) {
|
|
3687
|
+
return _r(s) ? Ns(s, r, n) : s;
|
|
3699
3688
|
}));
|
|
3700
3689
|
};
|
|
3701
|
-
const Pe = /* @__PURE__ */
|
|
3702
|
-
const t = Pe(e,
|
|
3703
|
-
const [, u,
|
|
3704
|
-
return
|
|
3705
|
-
class:
|
|
3706
|
-
href:
|
|
3707
|
-
children: u ??
|
|
3708
|
-
},
|
|
3690
|
+
const Pe = /* @__PURE__ */ rr(Ls), Ts = /(\[[^\]]+\]\([^)]+\))/g, Ds = /\[([^\]]+)\]\(([^)]+)\)/, Rs = /(https?:\/\/[^\s]+)/g, Os = /_(.*?)_/g, Bs = /\*\*(.*?)\*\*/g, Yt = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", Ps = (e) => {
|
|
3691
|
+
const t = Pe(e, Ts, (a, i) => {
|
|
3692
|
+
const [, u, d] = a.match(Ds) ?? [];
|
|
3693
|
+
return d ? l("a", {
|
|
3694
|
+
class: Yt,
|
|
3695
|
+
href: d,
|
|
3696
|
+
children: u ?? d
|
|
3697
|
+
}, d + i) : l("span", {
|
|
3709
3698
|
children: "INVALID LINK"
|
|
3710
3699
|
});
|
|
3711
|
-
}), r = Pe(t,
|
|
3712
|
-
class:
|
|
3700
|
+
}), r = Pe(t, Rs, (a, i) => l("a", {
|
|
3701
|
+
class: Yt,
|
|
3713
3702
|
href: a,
|
|
3714
3703
|
children: a
|
|
3715
|
-
}, a + i)), n = Pe(r,
|
|
3704
|
+
}, a + i)), n = Pe(r, Os, (a, i) => l("em", {
|
|
3716
3705
|
children: a
|
|
3717
3706
|
}, a + i));
|
|
3718
|
-
return Pe(n,
|
|
3707
|
+
return Pe(n, Bs, (a, i) => l("strong", {
|
|
3719
3708
|
children: a
|
|
3720
3709
|
}, a + i));
|
|
3721
|
-
},
|
|
3710
|
+
}, $s = Ze("select-text max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative", {
|
|
3722
3711
|
variants: {
|
|
3723
3712
|
side: {
|
|
3724
3713
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -3732,7 +3721,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3732
3721
|
defaultVariants: {
|
|
3733
3722
|
side: "left"
|
|
3734
3723
|
}
|
|
3735
|
-
}),
|
|
3724
|
+
}), js = ({
|
|
3736
3725
|
children: e,
|
|
3737
3726
|
className: t,
|
|
3738
3727
|
animate: r,
|
|
@@ -3742,14 +3731,14 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3742
3731
|
style: {
|
|
3743
3732
|
transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
|
|
3744
3733
|
},
|
|
3745
|
-
class:
|
|
3734
|
+
class: $s({
|
|
3746
3735
|
className: t,
|
|
3747
3736
|
side: n,
|
|
3748
3737
|
animate: r
|
|
3749
3738
|
}),
|
|
3750
3739
|
...s,
|
|
3751
3740
|
children: e
|
|
3752
|
-
}),
|
|
3741
|
+
}), zs = ({
|
|
3753
3742
|
message: e
|
|
3754
3743
|
}) => l("div", {
|
|
3755
3744
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -3773,7 +3762,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3773
3762
|
})
|
|
3774
3763
|
})]
|
|
3775
3764
|
})
|
|
3776
|
-
}),
|
|
3765
|
+
}), qs = ({
|
|
3777
3766
|
className: e,
|
|
3778
3767
|
...t
|
|
3779
3768
|
}) => (ue(() => {
|
|
@@ -3782,7 +3771,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3782
3771
|
"aria-hidden": !0,
|
|
3783
3772
|
children: z.isBotTyping$.value === !0 ? l("div", {
|
|
3784
3773
|
"aria-label": "Typing…",
|
|
3785
|
-
class:
|
|
3774
|
+
class: Le("flex gap-1 p-4", e),
|
|
3786
3775
|
...t,
|
|
3787
3776
|
children: Array.from({
|
|
3788
3777
|
length: 3
|
|
@@ -3793,10 +3782,10 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3793
3782
|
}
|
|
3794
3783
|
}))
|
|
3795
3784
|
}) : void 0
|
|
3796
|
-
})),
|
|
3785
|
+
})), Us = {
|
|
3797
3786
|
bot: "left",
|
|
3798
3787
|
user: "right"
|
|
3799
|
-
},
|
|
3788
|
+
}, Ks = Ze("w-full select-none py-2 text-wrap-balance text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_var(--i-color-n-1)]", {
|
|
3800
3789
|
variants: {
|
|
3801
3790
|
variant: {
|
|
3802
3791
|
info: "text-neutral-8",
|
|
@@ -3805,7 +3794,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3805
3794
|
success: "text-[#4CAF50]"
|
|
3806
3795
|
}
|
|
3807
3796
|
}
|
|
3808
|
-
}),
|
|
3797
|
+
}), Gs = ({
|
|
3809
3798
|
lastSentMessageFooter: e
|
|
3810
3799
|
}) => {
|
|
3811
3800
|
var r;
|
|
@@ -3815,13 +3804,13 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3815
3804
|
}, [t.length]), l("ol", {
|
|
3816
3805
|
"aria-label": "Chat messages",
|
|
3817
3806
|
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
3818
|
-
children: [t.map((n, s) => l(
|
|
3807
|
+
children: [t.map((n, s) => l(ke, {
|
|
3819
3808
|
children: l("li", {
|
|
3820
3809
|
class: "flex",
|
|
3821
3810
|
children: Ke(n).with({
|
|
3822
3811
|
type: "system"
|
|
3823
3812
|
}, (a) => l("p", {
|
|
3824
|
-
class:
|
|
3813
|
+
class: Ks({
|
|
3825
3814
|
variant: a.variant
|
|
3826
3815
|
}),
|
|
3827
3816
|
children: a.text
|
|
@@ -3829,15 +3818,15 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3829
3818
|
type: "text",
|
|
3830
3819
|
author: I.union("bot", "user")
|
|
3831
3820
|
}, (a) => {
|
|
3832
|
-
const i = a.author === "user" && !t.slice(s + 1).some((h) => h.type === "text" && h.author === "user"), u = s === t.length - 1,
|
|
3833
|
-
return l(
|
|
3821
|
+
const i = a.author === "user" && !t.slice(s + 1).some((h) => h.type === "text" && h.author === "user"), u = s === t.length - 1, d = a.author === "bot" ? Ps(a.text) : a.text;
|
|
3822
|
+
return l(js, {
|
|
3834
3823
|
animate: u,
|
|
3835
|
-
side:
|
|
3836
|
-
children: [
|
|
3824
|
+
side: Us[a.author],
|
|
3825
|
+
children: [d, i ? e : null]
|
|
3837
3826
|
}, s);
|
|
3838
3827
|
}).with({
|
|
3839
3828
|
type: "link"
|
|
3840
|
-
}, (a) => l(
|
|
3829
|
+
}, (a) => l(zs, {
|
|
3841
3830
|
message: a
|
|
3842
3831
|
})).with({
|
|
3843
3832
|
type: "image"
|
|
@@ -3849,7 +3838,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3849
3838
|
}
|
|
3850
3839
|
})).with({
|
|
3851
3840
|
type: "file"
|
|
3852
|
-
}, (a) => l(
|
|
3841
|
+
}, (a) => l(Rn, {
|
|
3853
3842
|
class: a.author === "bot" ? void 0 : "ml-auto",
|
|
3854
3843
|
file: {
|
|
3855
3844
|
name: a.fileName,
|
|
@@ -3861,15 +3850,15 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3861
3850
|
const i = t[t.length - 1];
|
|
3862
3851
|
return !(a === i) || z.isBotTyping$.value ? null : l("div", {
|
|
3863
3852
|
class: "flex flex-grow flex-col items-center justify-center",
|
|
3864
|
-
children: l(
|
|
3853
|
+
children: l(Gr, {
|
|
3865
3854
|
class: "text-neutral-6 h-8 w-8"
|
|
3866
3855
|
})
|
|
3867
3856
|
});
|
|
3868
3857
|
}).exhaustive()
|
|
3869
3858
|
})
|
|
3870
|
-
}, s)), l(
|
|
3859
|
+
}, s)), l(qs, {}, "typing")]
|
|
3871
3860
|
});
|
|
3872
|
-
},
|
|
3861
|
+
}, ta = ({
|
|
3873
3862
|
logger: e,
|
|
3874
3863
|
apiClient: t,
|
|
3875
3864
|
analytics: r
|
|
@@ -3883,36 +3872,36 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3883
3872
|
chatService: i
|
|
3884
3873
|
} = _n(), {
|
|
3885
3874
|
t: u
|
|
3886
|
-
} =
|
|
3875
|
+
} = J(), [d, h] = Y();
|
|
3887
3876
|
return pe(() => {
|
|
3888
3877
|
s === "maximised" && z.scrollToEnd.instant();
|
|
3889
3878
|
}, [s]), pe(() => {
|
|
3890
3879
|
var S, A;
|
|
3891
3880
|
const {
|
|
3892
3881
|
state: x,
|
|
3893
|
-
flow:
|
|
3882
|
+
flow: y
|
|
3894
3883
|
} = M.current$.peek();
|
|
3895
3884
|
if (x !== "loaded")
|
|
3896
3885
|
throw new Error(u("invalid_state"));
|
|
3897
|
-
let p =
|
|
3898
|
-
if (z.scrollToEnd.instant(), M.setInput(void 0),
|
|
3886
|
+
let p = y.data.nodeHistory.at(-1);
|
|
3887
|
+
if (z.scrollToEnd.instant(), M.setInput(void 0), y.data.isFinished)
|
|
3899
3888
|
return;
|
|
3900
|
-
p === void 0 ? (p =
|
|
3889
|
+
p === void 0 ? (p = tr(n.nodes).id, M.setCurrentNodeId(p), r.log({
|
|
3901
3890
|
event: "FLOW_START",
|
|
3902
3891
|
properties: {
|
|
3903
3892
|
flow_id: n.id,
|
|
3904
3893
|
flow_version: n.version,
|
|
3905
|
-
flow_session_id:
|
|
3894
|
+
flow_session_id: y.data.flowSessionId,
|
|
3906
3895
|
flow_build: n.build,
|
|
3907
3896
|
job: n.job
|
|
3908
3897
|
},
|
|
3909
3898
|
customProperties: (S = n.analytics) == null ? void 0 : S.customProperties
|
|
3910
3899
|
})) : M.removeMessagesSentByNodeIds([p]);
|
|
3911
3900
|
const {
|
|
3912
|
-
interpret:
|
|
3901
|
+
interpret: _,
|
|
3913
3902
|
abort: v,
|
|
3914
3903
|
undo: E
|
|
3915
|
-
} =
|
|
3904
|
+
} = Jr({
|
|
3916
3905
|
context: n.context,
|
|
3917
3906
|
analytics: {
|
|
3918
3907
|
service: r,
|
|
@@ -3963,8 +3952,8 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3963
3952
|
});
|
|
3964
3953
|
}
|
|
3965
3954
|
});
|
|
3966
|
-
return h(() => E),
|
|
3967
|
-
}, [r, t, i, e, n, u]), l(
|
|
3955
|
+
return h(() => E), _(p), v;
|
|
3956
|
+
}, [r, t, i, e, n, u]), l(ke, {
|
|
3968
3957
|
children: [l("div", {
|
|
3969
3958
|
ref: a,
|
|
3970
3959
|
className: "hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",
|
|
@@ -3972,21 +3961,21 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3972
3961
|
WebkitOverflowScrolling: "touch",
|
|
3973
3962
|
paddingBottom: M.inputHeight$.value
|
|
3974
3963
|
},
|
|
3975
|
-
children: l(
|
|
3976
|
-
lastSentMessageFooter: n.data.isFinished || !
|
|
3977
|
-
undoFn:
|
|
3964
|
+
children: l(Gs, {
|
|
3965
|
+
lastSentMessageFooter: n.data.isFinished || !d ? null : l(Ws, {
|
|
3966
|
+
undoFn: d
|
|
3978
3967
|
})
|
|
3979
3968
|
})
|
|
3980
|
-
}), l(
|
|
3969
|
+
}), l(Is, {
|
|
3981
3970
|
logger: e
|
|
3982
3971
|
})]
|
|
3983
3972
|
});
|
|
3984
|
-
},
|
|
3973
|
+
}, Hs = (e) => "key" in e.data && e.data.key ? [e.data.key] : "keys" in e.data ? Object.values(e.data.keys).filter((t) => typeof t == "string") : [], Ws = ({
|
|
3985
3974
|
undoFn: e
|
|
3986
3975
|
}) => {
|
|
3987
3976
|
const {
|
|
3988
3977
|
t
|
|
3989
|
-
} =
|
|
3978
|
+
} = J();
|
|
3990
3979
|
return l("div", {
|
|
3991
3980
|
class: "absolute bottom-0 right-0 flex w-full translate-y-full justify-end",
|
|
3992
3981
|
children: l("button", {
|
|
@@ -3999,7 +3988,7 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
3999
3988
|
const {
|
|
4000
3989
|
removed: n
|
|
4001
3990
|
} = e(r.data.nodeHistory), s = r.data.nodeHistory.splice(-n);
|
|
4002
|
-
s.length !== 0 && (M.removeMessagesSentByNodeIds(s), M.setInput(void 0), s.pop(), s.map((a) => r.nodes.find((i) => i.id === a)).filter(Boolean).flatMap(
|
|
3991
|
+
s.length !== 0 && (M.removeMessagesSentByNodeIds(s), M.setInput(void 0), s.pop(), s.map((a) => r.nodes.find((i) => i.id === a)).filter(Boolean).flatMap(Hs).forEach((a) => delete r.data.submissions[a]), M.current$.value = {
|
|
4003
3992
|
...M.current$.value
|
|
4004
3993
|
});
|
|
4005
3994
|
},
|
|
@@ -4008,5 +3997,5 @@ const Pe = /* @__PURE__ */ nr(Ds), Rs = /(\[[^\]]+\]\([^)]+\))/g, Os = /\[([^\]]
|
|
|
4008
3997
|
});
|
|
4009
3998
|
};
|
|
4010
3999
|
export {
|
|
4011
|
-
|
|
4000
|
+
ta as ChatbotBody
|
|
4012
4001
|
};
|