@inploi/plugin-chatbot 14.3.0 → 14.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.js +6 -6
- package/dist/chatbot-body-1daebc9e.cjs +5 -0
- package/dist/{chatbot-body-e43bddcd.js → chatbot-body-389badb2.js} +1033 -1008
- package/dist/chatbot.state.d.ts +6 -2
- package/dist/chatbot.utils.d.ts +1 -0
- package/dist/components/chat-input/chat-input.address.d.ts +1 -0
- package/dist/index-94e88490.cjs +5 -0
- package/dist/{index-616a7727.js → index-985be818.js} +185 -182
- package/dist/interpreter.d.ts +9 -0
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +3 -3
- package/dist/chatbot-body-677bfa5c.cjs +0 -5
- package/dist/index-af5b0510.cjs +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isApiErrorWithData as
|
|
3
|
-
const
|
|
1
|
+
import { G as yr, Q as rt, _ as xt, J as ze, Y as mr, g as gr, a as kt, A as ss, z as ns, j as is, F as br, I as as, K as os, Z as ls, W as $t, u as se, o as u, c as Oe, b as st, h as me, d as ce, i as Me, y as Ie, k as be, L as Ct, e as us, s as $, p as vr, f as xr, l as cs, m as Re, H as qt, C as ee, n as ae, M as ds, q as fs, r as hs, S as wr, t as ps } from "./index-985be818.js";
|
|
2
|
+
import { isApiErrorWithData as ys, ApiError as ms } from "@inploi/sdk";
|
|
3
|
+
const Ut = (e, r, t) => {
|
|
4
4
|
var s;
|
|
5
5
|
return e.log({
|
|
6
6
|
event: t,
|
|
@@ -15,16 +15,16 @@ const Pt = (e, r, t) => {
|
|
|
15
15
|
customProperties: (s = r.analytics) == null ? void 0 : s.customProperties
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
var
|
|
18
|
+
var zt = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
19
19
|
let [i, ...a] = e.compareKey.split(".");
|
|
20
20
|
if (!i)
|
|
21
21
|
return !1;
|
|
22
|
-
let n =
|
|
22
|
+
let n = yr({ context: r, key: i, path: a, submissions: t });
|
|
23
23
|
if (!n)
|
|
24
24
|
return !1;
|
|
25
25
|
switch (n.type) {
|
|
26
26
|
case "address": {
|
|
27
|
-
let o =
|
|
27
|
+
let o = xt(n.value, a);
|
|
28
28
|
switch (e.compare) {
|
|
29
29
|
case "equals":
|
|
30
30
|
return o === e.compareValue;
|
|
@@ -40,16 +40,16 @@ var $t = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
|
40
40
|
case "integration": {
|
|
41
41
|
if (typeof n.value != "object" || Array.isArray(n.value))
|
|
42
42
|
return !1;
|
|
43
|
-
let o =
|
|
43
|
+
let o = xt(n.value, a), c = { ...s, data: { compareKey: "_temp", compare: e.compare, compareValue: e.compareValue } };
|
|
44
44
|
switch (typeof o) {
|
|
45
45
|
case "boolean":
|
|
46
|
-
return
|
|
46
|
+
return Ue(c, { submissions: { _temp: { value: o, type: "boolean" } }, context: r });
|
|
47
47
|
case "string":
|
|
48
|
-
return
|
|
48
|
+
return Ue(c, { submissions: { _temp: { value: o, type: "string" } }, context: r });
|
|
49
49
|
case "number":
|
|
50
|
-
return
|
|
50
|
+
return Ue(c, { submissions: { _temp: { value: o, type: "number" } }, context: r });
|
|
51
51
|
case "object":
|
|
52
|
-
return Array.isArray(o) && o.every((
|
|
52
|
+
return Array.isArray(o) && o.every((h) => typeof h == "string") ? Ue(c, { submissions: { _temp: { value: o, type: "enum" } }, context: r }) : !1;
|
|
53
53
|
}
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
@@ -65,7 +65,7 @@ var $t = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
|
65
65
|
}
|
|
66
66
|
case "phone":
|
|
67
67
|
case "string": {
|
|
68
|
-
let o = n.type === "phone" ?
|
|
68
|
+
let o = n.type === "phone" ? rt(n.value) : n.value;
|
|
69
69
|
switch (e.compare) {
|
|
70
70
|
case "equals":
|
|
71
71
|
return o === e.compareValue;
|
|
@@ -113,64 +113,64 @@ var $t = ({ condition: e, context: r, submissions: t, ifBlock: s }) => {
|
|
|
113
113
|
}
|
|
114
114
|
break;
|
|
115
115
|
}
|
|
116
|
-
},
|
|
116
|
+
}, Ue = (e, { context: r, submissions: t }) => {
|
|
117
117
|
let s = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
118
118
|
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
119
119
|
for (let i of s)
|
|
120
|
-
if (
|
|
120
|
+
if (zt({ condition: i, context: r, submissions: t, ifBlock: e }))
|
|
121
121
|
return !0;
|
|
122
122
|
return !1;
|
|
123
123
|
} else {
|
|
124
124
|
for (let i of s)
|
|
125
|
-
if (
|
|
125
|
+
if (!zt({ condition: i, context: r, submissions: t, ifBlock: e }))
|
|
126
126
|
return !1;
|
|
127
127
|
return !0;
|
|
128
128
|
}
|
|
129
|
-
},
|
|
130
|
-
let [n, ...o] = i.trim().split("."), c =
|
|
129
|
+
}, gs = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, bs = (e, { context: r, submissions: t }) => e.replace(gs, (s, i, a = "") => {
|
|
130
|
+
let [n, ...o] = i.trim().split("."), c = yr({ key: n, path: o, submissions: t, context: r });
|
|
131
131
|
if (!c)
|
|
132
132
|
return a;
|
|
133
133
|
switch (c.type) {
|
|
134
134
|
case "boolean":
|
|
135
135
|
return c.value === !0 ? "true" : "false";
|
|
136
136
|
case "file":
|
|
137
|
-
return c.value.map((
|
|
137
|
+
return c.value.map((h) => `${h.name} (${ze(h.sizeKb)})`).join(", ");
|
|
138
138
|
case "enum":
|
|
139
139
|
return c.value.join(", ");
|
|
140
140
|
case "address":
|
|
141
|
-
return Object.values(c.value).filter((
|
|
141
|
+
return Object.values(c.value).filter((h) => h && h.trim().length > 0).join(", ");
|
|
142
142
|
case "number":
|
|
143
143
|
case "string":
|
|
144
144
|
return c.value ? c.value.toString() : a;
|
|
145
145
|
case "phone":
|
|
146
|
-
return
|
|
146
|
+
return rt(c.value);
|
|
147
147
|
case "integration": {
|
|
148
148
|
if (typeof c.value != "object" || Array.isArray(c.value))
|
|
149
149
|
break;
|
|
150
|
-
let
|
|
151
|
-
switch (typeof
|
|
150
|
+
let h = xt(c.value, o);
|
|
151
|
+
switch (typeof h) {
|
|
152
152
|
case "boolean":
|
|
153
|
-
return
|
|
153
|
+
return h === !0 ? "true" : "false";
|
|
154
154
|
case "string":
|
|
155
|
-
return
|
|
155
|
+
return h;
|
|
156
156
|
case "number":
|
|
157
|
-
return
|
|
157
|
+
return h.toString();
|
|
158
158
|
case "object":
|
|
159
|
-
if (Array.isArray(
|
|
160
|
-
return
|
|
159
|
+
if (Array.isArray(h) && h.every((b) => typeof b == "string"))
|
|
160
|
+
return h.join(", ");
|
|
161
161
|
}
|
|
162
162
|
break;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
return a;
|
|
166
166
|
});
|
|
167
|
-
const
|
|
167
|
+
const _r = ({
|
|
168
168
|
context: e,
|
|
169
169
|
submissions: r
|
|
170
170
|
}) => ({
|
|
171
171
|
context: e,
|
|
172
172
|
submissions: r ?? {}
|
|
173
|
-
}), de = (e, r) =>
|
|
173
|
+
}), de = (e, r) => bs(e, _r(r)), vs = (e, r) => Ue(e, _r(r)), kr = ({
|
|
174
174
|
node: e,
|
|
175
175
|
nodes: r,
|
|
176
176
|
stopWhen: t
|
|
@@ -179,12 +179,12 @@ const wr = ({
|
|
|
179
179
|
return e;
|
|
180
180
|
const s = e.nextId ? r.find((i) => i.id === e.nextId) : void 0;
|
|
181
181
|
if (s)
|
|
182
|
-
return
|
|
182
|
+
return kr({
|
|
183
183
|
node: s,
|
|
184
184
|
nodes: r,
|
|
185
185
|
stopWhen: t
|
|
186
186
|
});
|
|
187
|
-
},
|
|
187
|
+
}, xs = ({
|
|
188
188
|
childNode: e,
|
|
189
189
|
nodes: r
|
|
190
190
|
}) => {
|
|
@@ -194,7 +194,7 @@ const wr = ({
|
|
|
194
194
|
const a = r.find((o) => o.id === i.branchId);
|
|
195
195
|
if (!a)
|
|
196
196
|
return !1;
|
|
197
|
-
const n =
|
|
197
|
+
const n = kr({
|
|
198
198
|
node: a,
|
|
199
199
|
nodes: r,
|
|
200
200
|
stopWhen: (o) => o.id === e.id
|
|
@@ -203,7 +203,7 @@ const wr = ({
|
|
|
203
203
|
});
|
|
204
204
|
if (s != null && s.nextId)
|
|
205
205
|
return r.find((i) => i.id === s.nextId);
|
|
206
|
-
},
|
|
206
|
+
}, ws = ({
|
|
207
207
|
flow: e,
|
|
208
208
|
analytics: r,
|
|
209
209
|
logger: t,
|
|
@@ -213,22 +213,22 @@ const wr = ({
|
|
|
213
213
|
getSubmissions: n,
|
|
214
214
|
getApplicationRecovery: o,
|
|
215
215
|
setApplicationRecovery: c,
|
|
216
|
-
chatService:
|
|
216
|
+
chatService: h,
|
|
217
217
|
persistWriteBarrier: b,
|
|
218
218
|
onFlowEnd: x,
|
|
219
|
-
onInterpret:
|
|
219
|
+
onInterpret: p,
|
|
220
220
|
t: m
|
|
221
221
|
}) => {
|
|
222
222
|
var I;
|
|
223
|
-
let
|
|
223
|
+
let C = new AbortController();
|
|
224
224
|
(I = e.data).startedWriteNodeIds ?? (I.startedWriteNodeIds = e.nodes.flatMap((y) => {
|
|
225
|
-
var
|
|
225
|
+
var M, D;
|
|
226
226
|
if (y.type !== "integration-application-submit" || !e.data.nodeHistory.includes(y.id))
|
|
227
227
|
return [];
|
|
228
|
-
const
|
|
229
|
-
return (
|
|
228
|
+
const _ = y.data.key ? (M = n()) == null ? void 0 : M[y.data.key] : void 0;
|
|
229
|
+
return (_ == null ? void 0 : _.type) === "integration" && ((D = mr(_.value)) == null ? void 0 : D.verdict) === "not_submitted" ? [] : [y.id];
|
|
230
230
|
}));
|
|
231
|
-
const
|
|
231
|
+
const E = {
|
|
232
232
|
...r.service,
|
|
233
233
|
log: (y) => r.service.log({
|
|
234
234
|
...y,
|
|
@@ -237,28 +237,28 @@ const wr = ({
|
|
|
237
237
|
...r.customProperties
|
|
238
238
|
}
|
|
239
239
|
})
|
|
240
|
-
}, A = async (y,
|
|
241
|
-
const V =
|
|
240
|
+
}, A = async (y, _) => {
|
|
241
|
+
const V = C.signal;
|
|
242
242
|
if (V.aborted)
|
|
243
243
|
return;
|
|
244
|
-
const
|
|
244
|
+
const M = n(), D = o(), G = (D == null ? void 0 : D.submitNodeId) === y.id ? e.nodes.find((N) => {
|
|
245
245
|
var q;
|
|
246
|
-
return N.id ===
|
|
246
|
+
return N.id === D.fileQuestionNodeId && N.type === "question-file" && ((q = M == null ? void 0 : M[N.data.key]) == null ? void 0 : q.type) !== "file";
|
|
247
247
|
}) : void 0;
|
|
248
|
-
if (
|
|
249
|
-
return A(
|
|
250
|
-
|
|
248
|
+
if (G)
|
|
249
|
+
return A(G, _);
|
|
250
|
+
p == null || p(y, _);
|
|
251
251
|
try {
|
|
252
|
-
await
|
|
252
|
+
await _s({
|
|
253
253
|
flow: e,
|
|
254
|
-
analytics:
|
|
254
|
+
analytics: E,
|
|
255
255
|
logger: t,
|
|
256
256
|
talentBankClient: s,
|
|
257
257
|
apiClient: a,
|
|
258
258
|
context: i,
|
|
259
259
|
node: y,
|
|
260
|
-
submissions:
|
|
261
|
-
applicationRecovery:
|
|
260
|
+
submissions: M,
|
|
261
|
+
applicationRecovery: D,
|
|
262
262
|
setApplicationRecovery: async (N) => {
|
|
263
263
|
if (!V.aborted)
|
|
264
264
|
try {
|
|
@@ -267,28 +267,28 @@ const wr = ({
|
|
|
267
267
|
t.error("Failed to persist application recovery", q);
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
|
-
forceSubmitConfirmation: (
|
|
270
|
+
forceSubmitConfirmation: (D == null ? void 0 : D.submitNodeId) === y.id,
|
|
271
271
|
persistWriteBarrier: b,
|
|
272
272
|
signal: V,
|
|
273
273
|
t: m,
|
|
274
274
|
chat: {
|
|
275
|
-
sendMessage: async (N) =>
|
|
275
|
+
sendMessage: async (N) => h.send({
|
|
276
276
|
groupId: y.id,
|
|
277
277
|
message: N,
|
|
278
278
|
signal: V
|
|
279
279
|
}),
|
|
280
|
-
userInput: async (N) =>
|
|
280
|
+
userInput: async (N) => h.input({
|
|
281
281
|
input: N,
|
|
282
282
|
signal: V
|
|
283
283
|
}),
|
|
284
284
|
setSubmission: (N, q) => {
|
|
285
|
-
V.aborted ||
|
|
285
|
+
V.aborted || h.setSubmission(N, q);
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
288
|
next: (N) => {
|
|
289
289
|
if (V.aborted)
|
|
290
290
|
return;
|
|
291
|
-
const q = (
|
|
291
|
+
const q = (D == null ? void 0 : D.fileQuestionNodeId) === y.id ? D.submitNodeId : N, L = q ? e.nodes.find((O) => O.id === q) : xs({
|
|
292
292
|
childNode: y,
|
|
293
293
|
nodes: e.nodes
|
|
294
294
|
});
|
|
@@ -299,15 +299,15 @@ const wr = ({
|
|
|
299
299
|
}
|
|
300
300
|
});
|
|
301
301
|
} catch (N) {
|
|
302
|
-
if (N instanceof
|
|
302
|
+
if (N instanceof ss)
|
|
303
303
|
return;
|
|
304
304
|
throw N;
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
307
|
return {
|
|
308
308
|
interpret: async (y) => {
|
|
309
|
-
const
|
|
310
|
-
return A(
|
|
309
|
+
const _ = e.nodes.find((V) => V.id === y) ?? gr(e.nodes);
|
|
310
|
+
return A(_);
|
|
311
311
|
},
|
|
312
312
|
undo: (y) => {
|
|
313
313
|
var q;
|
|
@@ -315,32 +315,32 @@ const wr = ({
|
|
|
315
315
|
return {
|
|
316
316
|
removed: 0
|
|
317
317
|
};
|
|
318
|
-
const
|
|
319
|
-
if (V === -1 || !
|
|
318
|
+
const _ = kt(e), V = _ ? y.lastIndexOf(_) : -1, M = e.nodes.find((L) => L.id === _);
|
|
319
|
+
if (V === -1 || !M)
|
|
320
320
|
return {
|
|
321
321
|
removed: 0
|
|
322
322
|
};
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
const
|
|
326
|
-
e.data.messages = e.data.messages.filter((L) => !L.groupId || !
|
|
323
|
+
const D = e.nodes.find((L) => L.id === y[y.length - 1]);
|
|
324
|
+
C.abort();
|
|
325
|
+
const G = y.splice(V);
|
|
326
|
+
e.data.messages = e.data.messages.filter((L) => !L.groupId || !G.includes(L.groupId)), e.data.currentInput = null;
|
|
327
327
|
const N = n();
|
|
328
|
-
for (const L of
|
|
329
|
-
const
|
|
330
|
-
if (!(!
|
|
331
|
-
for (const w of Object.values(
|
|
328
|
+
for (const L of G.slice(1)) {
|
|
329
|
+
const O = e.nodes.find((w) => w.id === L);
|
|
330
|
+
if (!(!O || !N || O.id === _) && ("key" in O.data && O.data.key && delete N[O.data.key], "keys" in O.data))
|
|
331
|
+
for (const w of Object.values(O.data.keys))
|
|
332
332
|
typeof w == "string" && delete N[w];
|
|
333
333
|
}
|
|
334
|
-
return
|
|
335
|
-
removed:
|
|
334
|
+
return C = new AbortController(), A(M, D), {
|
|
335
|
+
removed: G.length
|
|
336
336
|
};
|
|
337
337
|
},
|
|
338
338
|
abort: () => {
|
|
339
|
-
|
|
339
|
+
C.abort();
|
|
340
340
|
}
|
|
341
341
|
};
|
|
342
342
|
};
|
|
343
|
-
async function
|
|
343
|
+
async function _s(e) {
|
|
344
344
|
const r = e.node;
|
|
345
345
|
switch (r.type) {
|
|
346
346
|
case "flow-section":
|
|
@@ -350,94 +350,94 @@ async function ws(e) {
|
|
|
350
350
|
text: r.data.title
|
|
351
351
|
}), e.next(r.nextId);
|
|
352
352
|
case "pre-apply-result":
|
|
353
|
-
return
|
|
353
|
+
return zs({
|
|
354
354
|
...e,
|
|
355
355
|
node: r
|
|
356
356
|
});
|
|
357
357
|
case "text":
|
|
358
|
-
return
|
|
358
|
+
return Ts({
|
|
359
359
|
...e,
|
|
360
360
|
node: r
|
|
361
361
|
});
|
|
362
362
|
case "image":
|
|
363
|
-
return
|
|
363
|
+
return Ds({
|
|
364
364
|
...e,
|
|
365
365
|
node: r
|
|
366
366
|
});
|
|
367
367
|
case "question-text":
|
|
368
|
-
return
|
|
368
|
+
return Os({
|
|
369
369
|
...e,
|
|
370
370
|
node: r
|
|
371
371
|
});
|
|
372
372
|
case "question-enum":
|
|
373
|
-
return
|
|
373
|
+
return Ps({
|
|
374
374
|
...e,
|
|
375
375
|
node: r
|
|
376
376
|
});
|
|
377
377
|
case "question-number":
|
|
378
|
-
return
|
|
378
|
+
return Rs({
|
|
379
379
|
...e,
|
|
380
380
|
node: r
|
|
381
381
|
});
|
|
382
382
|
case "question-phone":
|
|
383
|
-
return
|
|
383
|
+
return Bs({
|
|
384
384
|
...e,
|
|
385
385
|
node: r
|
|
386
386
|
});
|
|
387
387
|
case "question-boolean":
|
|
388
|
-
return
|
|
388
|
+
return js({
|
|
389
389
|
...e,
|
|
390
390
|
node: r
|
|
391
391
|
});
|
|
392
392
|
case "question-file":
|
|
393
|
-
return
|
|
393
|
+
return qs({
|
|
394
394
|
...e,
|
|
395
395
|
node: r
|
|
396
396
|
});
|
|
397
397
|
case "question-address":
|
|
398
|
-
return
|
|
398
|
+
return $s({
|
|
399
399
|
...e,
|
|
400
400
|
node: r
|
|
401
401
|
});
|
|
402
402
|
case "end-flow":
|
|
403
|
-
return
|
|
403
|
+
return Us({
|
|
404
404
|
...e,
|
|
405
405
|
node: r
|
|
406
406
|
});
|
|
407
407
|
case "if-block":
|
|
408
|
-
return
|
|
408
|
+
return Ls({
|
|
409
409
|
...e,
|
|
410
410
|
node: r
|
|
411
411
|
});
|
|
412
412
|
case "jump":
|
|
413
|
-
return
|
|
413
|
+
return Ss({
|
|
414
414
|
...e,
|
|
415
415
|
node: r
|
|
416
416
|
});
|
|
417
417
|
case "link":
|
|
418
|
-
return
|
|
418
|
+
return Ns({
|
|
419
419
|
...e,
|
|
420
420
|
node: r
|
|
421
421
|
});
|
|
422
422
|
case "integration-application-submit":
|
|
423
|
-
return
|
|
423
|
+
return Es({
|
|
424
424
|
...e,
|
|
425
425
|
node: r
|
|
426
426
|
});
|
|
427
427
|
case "add-submission":
|
|
428
|
-
return
|
|
428
|
+
return Is({
|
|
429
429
|
...e,
|
|
430
430
|
node: r
|
|
431
431
|
});
|
|
432
432
|
case "integration-workflow-get":
|
|
433
433
|
throw Error("Workflow should be unreachable");
|
|
434
434
|
case "check-duplicate":
|
|
435
|
-
return
|
|
435
|
+
return Cs({
|
|
436
436
|
...e,
|
|
437
437
|
node: r
|
|
438
438
|
});
|
|
439
439
|
case "feedback":
|
|
440
|
-
return
|
|
440
|
+
return ks({
|
|
441
441
|
...e,
|
|
442
442
|
node: r
|
|
443
443
|
});
|
|
@@ -445,13 +445,13 @@ async function ws(e) {
|
|
|
445
445
|
throw new Error(`Unknown node: ${JSON.stringify(r)}`);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
async function
|
|
448
|
+
async function ks({
|
|
449
449
|
next: e,
|
|
450
450
|
node: r
|
|
451
451
|
}) {
|
|
452
452
|
e(r.nextId);
|
|
453
453
|
}
|
|
454
|
-
async function
|
|
454
|
+
async function Cs({
|
|
455
455
|
next: e,
|
|
456
456
|
node: r,
|
|
457
457
|
talentBankClient: t,
|
|
@@ -465,15 +465,15 @@ async function ks({
|
|
|
465
465
|
isDuplicate: !1
|
|
466
466
|
};
|
|
467
467
|
if (s && t) {
|
|
468
|
-
const
|
|
469
|
-
if (r.data.scope === "company" ||
|
|
468
|
+
const h = r.data.scope === "job" ? (c = i.job) == null ? void 0 : c.id : void 0;
|
|
469
|
+
if (r.data.scope === "company" || h != null)
|
|
470
470
|
try {
|
|
471
471
|
o = await t.checkDuplicate({
|
|
472
|
-
email:
|
|
472
|
+
email: ns({
|
|
473
473
|
key: r.data.email,
|
|
474
474
|
submissions: s
|
|
475
475
|
}).toString(),
|
|
476
|
-
jobId:
|
|
476
|
+
jobId: h,
|
|
477
477
|
scope: r.data.scope
|
|
478
478
|
});
|
|
479
479
|
} catch (b) {
|
|
@@ -485,13 +485,13 @@ async function ks({
|
|
|
485
485
|
value: o
|
|
486
486
|
}), e(r.nextId);
|
|
487
487
|
}
|
|
488
|
-
async function
|
|
488
|
+
async function Ss({
|
|
489
489
|
next: e,
|
|
490
490
|
node: r
|
|
491
491
|
}) {
|
|
492
492
|
e(r.data.targetId);
|
|
493
493
|
}
|
|
494
|
-
async function
|
|
494
|
+
async function Is({
|
|
495
495
|
next: e,
|
|
496
496
|
node: r,
|
|
497
497
|
logger: t,
|
|
@@ -510,8 +510,20 @@ async function Ss({
|
|
|
510
510
|
})
|
|
511
511
|
}, e(r.nextId);
|
|
512
512
|
}
|
|
513
|
-
const
|
|
514
|
-
|
|
513
|
+
const Fs = 5e3, Cr = 3e4, Vs = 2e4, As = 6e4, Sr = 12e4, Ms = (e, r, t) => {
|
|
514
|
+
if ((t == null ? void 0 : t.providerStatus) !== 429 || t.retryable !== !0)
|
|
515
|
+
return {
|
|
516
|
+
key: e,
|
|
517
|
+
until: Date.now() + Cr
|
|
518
|
+
};
|
|
519
|
+
const s = ((r == null ? void 0 : r.throttles) ?? 0) + 1, i = Math.min(s * Vs, As), a = (t.retryAfterSeconds ?? 0) * 1e3;
|
|
520
|
+
return {
|
|
521
|
+
key: e,
|
|
522
|
+
until: Date.now() + Math.min(Math.max(i, a), Sr),
|
|
523
|
+
throttles: s
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
async function Es({
|
|
515
527
|
chat: e,
|
|
516
528
|
next: r,
|
|
517
529
|
end: t,
|
|
@@ -521,25 +533,25 @@ async function Fs({
|
|
|
521
533
|
submissions: n,
|
|
522
534
|
analytics: o,
|
|
523
535
|
flow: c,
|
|
524
|
-
applicationRecovery:
|
|
536
|
+
applicationRecovery: h,
|
|
525
537
|
setApplicationRecovery: b,
|
|
526
538
|
forceSubmitConfirmation: x,
|
|
527
|
-
persistWriteBarrier:
|
|
539
|
+
persistWriteBarrier: p,
|
|
528
540
|
signal: m,
|
|
529
|
-
t:
|
|
541
|
+
t: C
|
|
530
542
|
}) {
|
|
531
543
|
var I;
|
|
532
|
-
if ((I = c.data.startedWriteNodeIds) != null && I.includes(s.id) && (
|
|
544
|
+
if ((I = c.data.startedWriteNodeIds) != null && I.includes(s.id) && (h == null ? void 0 : h.submitNodeId) !== s.id)
|
|
533
545
|
return await e.sendMessage({
|
|
534
546
|
type: "system",
|
|
535
547
|
variant: "warning",
|
|
536
|
-
text:
|
|
548
|
+
text: C("submission_unknown")
|
|
537
549
|
}), t();
|
|
538
|
-
const
|
|
539
|
-
var
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
const V =
|
|
550
|
+
const E = c.job ? `${s.id}@${c.job.id_type}:${c.job.id}` : s.id, A = async (y) => {
|
|
551
|
+
var ve, xe, we, Pe, je, Xe;
|
|
552
|
+
const _ = ((ve = c.data.submitCooldown) == null ? void 0 : ve.key) === E ? c.data.submitCooldown : void 0;
|
|
553
|
+
_ && (_.until = Math.min(_.until, Date.now() + (_.throttles ? Sr : Cr)));
|
|
554
|
+
const V = _ == null ? void 0 : _.until;
|
|
543
555
|
(y !== !0 || V !== void 0 && V > Date.now()) && await e.userInput({
|
|
544
556
|
type: "submit",
|
|
545
557
|
key: void 0,
|
|
@@ -551,16 +563,16 @@ async function Fs({
|
|
|
551
563
|
}
|
|
552
564
|
}), await e.sendMessage({
|
|
553
565
|
type: "loading",
|
|
554
|
-
text:
|
|
566
|
+
text: C("submitting")
|
|
555
567
|
});
|
|
556
568
|
const {
|
|
557
|
-
anonymous_id:
|
|
558
|
-
session_id:
|
|
569
|
+
anonymous_id: M,
|
|
570
|
+
session_id: D
|
|
559
571
|
} = o.getSessionInfo();
|
|
560
572
|
if (m.aborted)
|
|
561
573
|
return;
|
|
562
|
-
const
|
|
563
|
-
if ((
|
|
574
|
+
const G = ((xe = c.data.startedWriteNodeIds) == null ? void 0 : xe.includes(s.id)) === !0;
|
|
575
|
+
if ((h == null ? void 0 : h.submitNodeId) === s.id && await b(void 0), G || (c.data.startedWriteNodeIds = [...c.data.startedWriteNodeIds ?? [], s.id]), await p().catch((P) => i.error("Failed to persist application write barrier", P)), m.aborted)
|
|
564
576
|
return;
|
|
565
577
|
let N;
|
|
566
578
|
const q = setTimeout(() => {
|
|
@@ -568,34 +580,34 @@ async function Fs({
|
|
|
568
580
|
await e.sendMessage({
|
|
569
581
|
type: "text",
|
|
570
582
|
author: "bot",
|
|
571
|
-
text:
|
|
583
|
+
text: C("submission_still_working")
|
|
572
584
|
}), await e.sendMessage({
|
|
573
585
|
type: "loading",
|
|
574
|
-
text:
|
|
586
|
+
text: C("submitting")
|
|
575
587
|
});
|
|
576
|
-
})().catch((
|
|
577
|
-
},
|
|
588
|
+
})().catch((P) => i.error("Failed to send submission progress message", P));
|
|
589
|
+
}, Fs);
|
|
578
590
|
let L;
|
|
579
|
-
const
|
|
591
|
+
const O = await a.fetch("/flow/submit", {
|
|
580
592
|
method: "POST",
|
|
581
593
|
body: JSON.stringify({
|
|
582
594
|
log_submit: !1,
|
|
583
595
|
integration_id: s.data.integrationId,
|
|
584
|
-
anonymous_id:
|
|
585
|
-
session_id:
|
|
596
|
+
anonymous_id: M,
|
|
597
|
+
session_id: D,
|
|
586
598
|
job: c.job,
|
|
587
599
|
flow_build: c.build,
|
|
588
|
-
submissions:
|
|
589
|
-
pre_apply:
|
|
600
|
+
submissions: as(c.nodes, os(n || {}, s.data.submitKeys)),
|
|
601
|
+
pre_apply: br(c.nodes, n || {}, c.data.flowSessionId)
|
|
590
602
|
})
|
|
591
|
-
}).catch((
|
|
603
|
+
}).catch((P) => (L = P, ys(P) ? P.data : P));
|
|
592
604
|
if (clearTimeout(q), await N, m.aborted)
|
|
593
605
|
return;
|
|
594
606
|
s.data.key && e.setSubmission(s.data.key, {
|
|
595
607
|
type: "integration",
|
|
596
|
-
value:
|
|
608
|
+
value: O
|
|
597
609
|
});
|
|
598
|
-
const w =
|
|
610
|
+
const w = mr(O, L instanceof ms ? L.status : void 0), T = ((we = c.data.unconfirmedAttemptKeys) == null ? void 0 : we.includes(E)) === !0, U = ls(O);
|
|
599
611
|
if (U && o.log({
|
|
600
612
|
event: "FLOW_SUBMIT",
|
|
601
613
|
properties: {
|
|
@@ -609,28 +621,28 @@ async function Fs({
|
|
|
609
621
|
job: c.job,
|
|
610
622
|
// Measures how many duplicates follow the candidate's own unconfirmed attempt.
|
|
611
623
|
...(w == null ? void 0 : w.outcome) === "duplicate" && {
|
|
612
|
-
outcome:
|
|
624
|
+
outcome: T ? "duplicate_after_own_attempt" : "duplicate"
|
|
613
625
|
}
|
|
614
626
|
}
|
|
615
|
-
}),
|
|
627
|
+
}), ($t(O) || (O == null ? void 0 : O.success) === !0) && ((Pe = c.data.submitCooldown) == null ? void 0 : Pe.throttles) !== void 0 && (delete c.data.submitCooldown.throttles, await p().catch((P) => i.error("Failed to persist submit cooldown reset", P))), $t(O)) {
|
|
616
628
|
const {
|
|
617
|
-
redirect_url:
|
|
618
|
-
message:
|
|
619
|
-
button_text:
|
|
620
|
-
} =
|
|
629
|
+
redirect_url: P,
|
|
630
|
+
message: ut,
|
|
631
|
+
button_text: Ye
|
|
632
|
+
} = O.integration_response.data;
|
|
621
633
|
await e.sendMessage({
|
|
622
634
|
type: "text",
|
|
623
635
|
author: "bot",
|
|
624
|
-
text:
|
|
636
|
+
text: ut ?? C("submission_redirect_message")
|
|
625
637
|
});
|
|
626
638
|
try {
|
|
627
|
-
const _e = new URL(
|
|
628
|
-
|
|
639
|
+
const _e = new URL(P);
|
|
640
|
+
M && !_e.searchParams.has("anonymous_id") && _e.searchParams.set("anonymous_id", M), await e.sendMessage({
|
|
629
641
|
type: "link",
|
|
630
642
|
href: _e.toString(),
|
|
631
|
-
text:
|
|
643
|
+
text: Ye ?? C("complete_submission"),
|
|
632
644
|
onClick: () => {
|
|
633
|
-
if (!
|
|
645
|
+
if (!D) {
|
|
634
646
|
i.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
635
647
|
return;
|
|
636
648
|
}
|
|
@@ -639,7 +651,7 @@ async function Fs({
|
|
|
639
651
|
properties: {
|
|
640
652
|
flow_build: c.build,
|
|
641
653
|
flow_id: c.id,
|
|
642
|
-
flow_session_id:
|
|
654
|
+
flow_session_id: D,
|
|
643
655
|
flow_version: c.version,
|
|
644
656
|
href: _e.toString(),
|
|
645
657
|
job: c.job
|
|
@@ -648,60 +660,57 @@ async function Fs({
|
|
|
648
660
|
}
|
|
649
661
|
});
|
|
650
662
|
} catch (_e) {
|
|
651
|
-
i.error(`Invalid redirect URL: ${
|
|
663
|
+
i.error(`Invalid redirect URL: ${P}`, _e), e.sendMessage({
|
|
652
664
|
type: "system",
|
|
653
665
|
variant: "error",
|
|
654
|
-
text:
|
|
666
|
+
text: C("redirect_url_error")
|
|
655
667
|
});
|
|
656
668
|
}
|
|
657
669
|
return r(s.nextId);
|
|
658
670
|
}
|
|
659
|
-
if ((
|
|
671
|
+
if ((O == null ? void 0 : O.success) === !0)
|
|
660
672
|
return s.data.skipConfirmation !== !0 && await e.sendMessage({
|
|
661
673
|
type: "system",
|
|
662
674
|
variant: "success",
|
|
663
|
-
text:
|
|
675
|
+
text: C("submission_completed")
|
|
664
676
|
}), r(s.nextId);
|
|
665
|
-
const
|
|
666
|
-
return
|
|
667
|
-
|
|
668
|
-
until: Date.now() + qt
|
|
669
|
-
}), (w == null ? void 0 : w.verdict) === "not_submitted" || (w == null ? void 0 : w.outcome) === "duplicate" || (w == null ? void 0 : w.outcome) === "closed" ? (H || (c.data.startedWriteNodeIds = (je = c.data.startedWriteNodeIds) == null ? void 0 : je.filter(($) => $ !== s.id)), (p == null ? void 0 : p.submitNodeId) === s.id && await b(p), await h().catch(($) => i.error("Failed to persist application write barrier release", $))) : (w == null ? void 0 : w.verdict) !== "confirmed" && !D ? (c.data.unconfirmedAttemptKeys = [...c.data.unconfirmedAttemptKeys ?? [], M], await h().catch(($) => i.error("Failed to persist unconfirmed attempt", $))) : await h().catch(($) => i.error("Failed to persist submit cooldown", $)), w ? (i.error(L ?? w.message), Z && K !== void 0 ? (e.setSubmission(K, null), await b({
|
|
670
|
-
fileQuestionNodeId: Z.id,
|
|
677
|
+
const X = (w == null ? void 0 : w.phase) === "submit" && w.verdict === "confirmed" && w.code === "unreadable_document" && typeof w.field == "string" && w.status !== void 0 && w.status >= 400 && w.status < 500 && ((je = n == null ? void 0 : n[w.field]) == null ? void 0 : je.type) === "file" ? w.field : void 0, J = X === void 0 ? void 0 : c.nodes.find((P) => P.type === "question-file" && P.data.key === X);
|
|
678
|
+
return J || (c.data.submitCooldown = Ms(E, _, w)), (w == null ? void 0 : w.verdict) === "not_submitted" || (w == null ? void 0 : w.outcome) === "duplicate" || (w == null ? void 0 : w.outcome) === "closed" ? (G || (c.data.startedWriteNodeIds = (Xe = c.data.startedWriteNodeIds) == null ? void 0 : Xe.filter((P) => P !== s.id)), (h == null ? void 0 : h.submitNodeId) === s.id && await b(h), await p().catch((P) => i.error("Failed to persist application write barrier release", P))) : (w == null ? void 0 : w.verdict) !== "confirmed" && !T ? (c.data.unconfirmedAttemptKeys = [...c.data.unconfirmedAttemptKeys ?? [], E], await p().catch((P) => i.error("Failed to persist unconfirmed attempt", P))) : await p().catch((P) => i.error("Failed to persist submit cooldown", P)), w ? (i.error(L ?? w.message), J && X !== void 0 ? (e.setSubmission(X, null), await b({
|
|
679
|
+
fileQuestionNodeId: J.id,
|
|
671
680
|
submitNodeId: s.id
|
|
672
681
|
}), await e.sendMessage({
|
|
673
682
|
type: "system",
|
|
674
683
|
variant: "error",
|
|
675
|
-
text:
|
|
676
|
-
}), r(
|
|
684
|
+
text: C("submission_unreadable_document")
|
|
685
|
+
}), r(J.id)) : w.outcome === "duplicate" ? (await e.sendMessage({
|
|
677
686
|
type: "system",
|
|
678
687
|
variant: "info",
|
|
679
|
-
text:
|
|
688
|
+
text: C(T ? "submission_duplicate_earlier_attempt" : "submission_duplicate")
|
|
680
689
|
}), A(!1)) : w.outcome === "closed" ? (await e.sendMessage({
|
|
681
690
|
type: "system",
|
|
682
691
|
variant: "info",
|
|
683
|
-
text:
|
|
692
|
+
text: C("submission_closed")
|
|
684
693
|
}), A(!1)) : w.outcome === "unknown" ? (await e.sendMessage({
|
|
685
694
|
type: "system",
|
|
686
695
|
variant: "warning",
|
|
687
|
-
text:
|
|
696
|
+
text: C("submission_unknown")
|
|
688
697
|
}), A(!1)) : (w.phase === "workflow" || w.phase === "authentication") && w.retryable === !0 && w.verdict === "not_submitted" ? (await e.sendMessage({
|
|
689
698
|
type: "system",
|
|
690
699
|
variant: "error",
|
|
691
|
-
text:
|
|
700
|
+
text: C("submission_retryable")
|
|
692
701
|
}), A(!1)) : (await e.sendMessage({
|
|
693
702
|
type: "system",
|
|
694
703
|
variant: "error",
|
|
695
|
-
text:
|
|
696
|
-
}), t())) : (i.error(L ??
|
|
704
|
+
text: C("submission_failed")
|
|
705
|
+
}), t())) : (i.error(L ?? O), await e.sendMessage({
|
|
697
706
|
type: "system",
|
|
698
707
|
variant: "error",
|
|
699
|
-
text:
|
|
708
|
+
text: C("submission_failed")
|
|
700
709
|
}), t());
|
|
701
710
|
};
|
|
702
711
|
await A(x === !0 ? !1 : s.data.skipConfirmation);
|
|
703
712
|
}
|
|
704
|
-
async function
|
|
713
|
+
async function Ns({
|
|
705
714
|
chat: e,
|
|
706
715
|
next: r,
|
|
707
716
|
node: t,
|
|
@@ -720,18 +729,18 @@ async function Vs({
|
|
|
720
729
|
})
|
|
721
730
|
}), r(t.nextId);
|
|
722
731
|
}
|
|
723
|
-
async function
|
|
732
|
+
async function Ls({
|
|
724
733
|
submissions: e,
|
|
725
734
|
next: r,
|
|
726
735
|
node: t,
|
|
727
736
|
context: s
|
|
728
737
|
}) {
|
|
729
|
-
r(
|
|
738
|
+
r(vs(t, {
|
|
730
739
|
submissions: e,
|
|
731
740
|
context: s
|
|
732
741
|
}) ? t.branchId : t.nextId);
|
|
733
742
|
}
|
|
734
|
-
async function
|
|
743
|
+
async function Ts({
|
|
735
744
|
chat: e,
|
|
736
745
|
next: r,
|
|
737
746
|
node: t,
|
|
@@ -747,7 +756,7 @@ async function Es({
|
|
|
747
756
|
})
|
|
748
757
|
}), r(t.nextId);
|
|
749
758
|
}
|
|
750
|
-
async function
|
|
759
|
+
async function Ds({
|
|
751
760
|
chat: e,
|
|
752
761
|
next: r,
|
|
753
762
|
node: t
|
|
@@ -760,7 +769,7 @@ async function Ms({
|
|
|
760
769
|
width: t.data.width
|
|
761
770
|
}), r(t.nextId);
|
|
762
771
|
}
|
|
763
|
-
async function
|
|
772
|
+
async function Os({
|
|
764
773
|
chat: e,
|
|
765
774
|
next: r,
|
|
766
775
|
node: t,
|
|
@@ -805,10 +814,10 @@ async function Ns({
|
|
|
805
814
|
}) : await e.sendMessage({
|
|
806
815
|
author: "user",
|
|
807
816
|
type: "text",
|
|
808
|
-
text: n.type === "phone" ?
|
|
817
|
+
text: n.type === "phone" ? rt(n.value) : n.value
|
|
809
818
|
}), r(t.nextId);
|
|
810
819
|
}
|
|
811
|
-
async function
|
|
820
|
+
async function Rs({
|
|
812
821
|
chat: e,
|
|
813
822
|
next: r,
|
|
814
823
|
node: t,
|
|
@@ -845,7 +854,7 @@ async function Ls({
|
|
|
845
854
|
text: n.value.toString()
|
|
846
855
|
}), r(t.nextId);
|
|
847
856
|
}
|
|
848
|
-
async function
|
|
857
|
+
async function Bs({
|
|
849
858
|
chat: e,
|
|
850
859
|
next: r,
|
|
851
860
|
node: t,
|
|
@@ -881,10 +890,10 @@ async function Ds({
|
|
|
881
890
|
}) : await e.sendMessage({
|
|
882
891
|
author: "user",
|
|
883
892
|
type: "text",
|
|
884
|
-
text: n.type === "phone" ?
|
|
893
|
+
text: n.type === "phone" ? rt(n.value) : n.value
|
|
885
894
|
}), r(t.nextId);
|
|
886
895
|
}
|
|
887
|
-
async function
|
|
896
|
+
async function Ps({
|
|
888
897
|
chat: e,
|
|
889
898
|
next: r,
|
|
890
899
|
node: t,
|
|
@@ -915,7 +924,7 @@ async function Ts({
|
|
|
915
924
|
text: t.data.options.filter((o) => n.value.includes(o.value)).map((o) => o.label).join(", ")
|
|
916
925
|
}), r(t.nextId);
|
|
917
926
|
}
|
|
918
|
-
async function
|
|
927
|
+
async function js({
|
|
919
928
|
chat: e,
|
|
920
929
|
next: r,
|
|
921
930
|
node: t,
|
|
@@ -952,7 +961,7 @@ async function Os({
|
|
|
952
961
|
text: n.value === !0 ? t.data.trueLabel : t.data.falseLabel
|
|
953
962
|
}), r(t.nextId);
|
|
954
963
|
}
|
|
955
|
-
async function
|
|
964
|
+
async function $s({
|
|
956
965
|
chat: e,
|
|
957
966
|
next: r,
|
|
958
967
|
node: t,
|
|
@@ -969,6 +978,7 @@ async function Rs({
|
|
|
969
978
|
config: {
|
|
970
979
|
optional: t.data.optional,
|
|
971
980
|
keys: t.data.keys,
|
|
981
|
+
line2Required: t.data.line2Required,
|
|
972
982
|
placeholder: t.data.placeholder
|
|
973
983
|
}
|
|
974
984
|
});
|
|
@@ -988,7 +998,7 @@ async function Rs({
|
|
|
988
998
|
}
|
|
989
999
|
return r(t.nextId);
|
|
990
1000
|
}
|
|
991
|
-
async function
|
|
1001
|
+
async function qs({
|
|
992
1002
|
node: e,
|
|
993
1003
|
chat: r,
|
|
994
1004
|
next: t,
|
|
@@ -1031,7 +1041,7 @@ async function Bs({
|
|
|
1031
1041
|
});
|
|
1032
1042
|
return t(e.nextId);
|
|
1033
1043
|
}
|
|
1034
|
-
async function
|
|
1044
|
+
async function Us({
|
|
1035
1045
|
chat: e,
|
|
1036
1046
|
end: r,
|
|
1037
1047
|
node: t
|
|
@@ -1042,7 +1052,7 @@ async function js({
|
|
|
1042
1052
|
text: t.data.systemMessage
|
|
1043
1053
|
}), r();
|
|
1044
1054
|
}
|
|
1045
|
-
async function
|
|
1055
|
+
async function zs({
|
|
1046
1056
|
node: e,
|
|
1047
1057
|
flow: r,
|
|
1048
1058
|
submissions: t,
|
|
@@ -1051,13 +1061,13 @@ async function Ps({
|
|
|
1051
1061
|
apiClient: a,
|
|
1052
1062
|
analytics: n
|
|
1053
1063
|
}) {
|
|
1054
|
-
const o =
|
|
1064
|
+
const o = is(r.nodes, t || {}), {
|
|
1055
1065
|
answers: c,
|
|
1056
|
-
...
|
|
1066
|
+
...h
|
|
1057
1067
|
} = o;
|
|
1058
1068
|
s.setSubmission(e.data.key, {
|
|
1059
1069
|
type: "integration",
|
|
1060
|
-
value:
|
|
1070
|
+
value: h
|
|
1061
1071
|
});
|
|
1062
1072
|
const b = new AbortController(), x = setTimeout(() => b.abort(), 5e3);
|
|
1063
1073
|
if (a.fetch("/flow/pre-apply", {
|
|
@@ -1067,15 +1077,15 @@ async function Ps({
|
|
|
1067
1077
|
...n.getSessionInfo(),
|
|
1068
1078
|
job: r.job,
|
|
1069
1079
|
flow_build: r.build,
|
|
1070
|
-
pre_apply:
|
|
1080
|
+
pre_apply: br(r.nodes, t || {}, r.data.flowSessionId)
|
|
1071
1081
|
})
|
|
1072
1082
|
}).catch(() => {
|
|
1073
1083
|
}).finally(() => clearTimeout(x)), o.status !== "skipped") {
|
|
1074
1084
|
const m = [o.status === "unavailable" ? "We could not prepare your pre-apply summary. You can still continue to your application." : o.hasHardConcerns ? e.data.messages.hard : o.hasAdvisoryConcerns ? e.data.messages.advisory : e.data.messages.matched];
|
|
1075
|
-
for (const
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
` +
|
|
1085
|
+
for (const C of ["hard", "advisory"]) {
|
|
1086
|
+
const E = c.filter((A) => !A.matched && A.severity === C);
|
|
1087
|
+
E.length && m.push((C === "hard" ? "Role requirements" : "Other things to consider") + `
|
|
1088
|
+
` + E.map((A) => `• ${A.message}`).join(`
|
|
1079
1089
|
`));
|
|
1080
1090
|
}
|
|
1081
1091
|
await s.sendMessage({
|
|
@@ -1128,40 +1138,40 @@ const Ee = ({
|
|
|
1128
1138
|
})
|
|
1129
1139
|
});
|
|
1130
1140
|
};
|
|
1131
|
-
var
|
|
1141
|
+
var he;
|
|
1132
1142
|
// @__NO_SIDE_EFFECTS__
|
|
1133
|
-
function
|
|
1143
|
+
function nt(e) {
|
|
1134
1144
|
return {
|
|
1135
|
-
lang: (e == null ? void 0 : e.lang) ?? (
|
|
1145
|
+
lang: (e == null ? void 0 : e.lang) ?? (he == null ? void 0 : he.lang),
|
|
1136
1146
|
message: e == null ? void 0 : e.message,
|
|
1137
|
-
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (
|
|
1138
|
-
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (
|
|
1147
|
+
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (he == null ? void 0 : he.abortEarly),
|
|
1148
|
+
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (he == null ? void 0 : he.abortPipeEarly)
|
|
1139
1149
|
};
|
|
1140
1150
|
}
|
|
1141
|
-
var
|
|
1151
|
+
var yt;
|
|
1142
1152
|
// @__NO_SIDE_EFFECTS__
|
|
1143
|
-
function
|
|
1144
|
-
return
|
|
1153
|
+
function Ks(e) {
|
|
1154
|
+
return yt == null ? void 0 : yt.get(e);
|
|
1145
1155
|
}
|
|
1146
|
-
var
|
|
1156
|
+
var mt;
|
|
1147
1157
|
// @__NO_SIDE_EFFECTS__
|
|
1148
|
-
function
|
|
1149
|
-
return
|
|
1158
|
+
function Ws(e) {
|
|
1159
|
+
return mt == null ? void 0 : mt.get(e);
|
|
1150
1160
|
}
|
|
1151
|
-
var
|
|
1161
|
+
var gt;
|
|
1152
1162
|
// @__NO_SIDE_EFFECTS__
|
|
1153
|
-
function
|
|
1163
|
+
function Gs(e, r) {
|
|
1154
1164
|
var t;
|
|
1155
|
-
return (t =
|
|
1165
|
+
return (t = gt == null ? void 0 : gt.get(e)) == null ? void 0 : t.get(r);
|
|
1156
1166
|
}
|
|
1157
1167
|
// @__NO_SIDE_EFFECTS__
|
|
1158
|
-
function
|
|
1168
|
+
function De(e) {
|
|
1159
1169
|
var t, s;
|
|
1160
1170
|
const r = typeof e;
|
|
1161
1171
|
return r === "string" ? `"${e}"` : r === "number" || r === "bigint" || r === "boolean" ? `${e}` : r === "object" || r === "function" ? (e && ((s = (t = Object.getPrototypeOf(e)) == null ? void 0 : t.constructor) == null ? void 0 : s.name)) ?? "null" : r;
|
|
1162
1172
|
}
|
|
1163
1173
|
function Y(e, r, t, s, i) {
|
|
1164
|
-
const a = i && "input" in i ? i.input : t.value, n = (i == null ? void 0 : i.expected) ?? e.expects ?? null, o = (i == null ? void 0 : i.received) ?? /* @__PURE__ */
|
|
1174
|
+
const a = i && "input" in i ? i.input : t.value, n = (i == null ? void 0 : i.expected) ?? e.expects ?? null, o = (i == null ? void 0 : i.received) ?? /* @__PURE__ */ De(a), c = {
|
|
1165
1175
|
kind: e.kind,
|
|
1166
1176
|
type: e.type,
|
|
1167
1177
|
input: a,
|
|
@@ -1174,11 +1184,11 @@ function Y(e, r, t, s, i) {
|
|
|
1174
1184
|
lang: s.lang,
|
|
1175
1185
|
abortEarly: s.abortEarly,
|
|
1176
1186
|
abortPipeEarly: s.abortPipeEarly
|
|
1177
|
-
},
|
|
1187
|
+
}, h = e.kind === "schema", b = (i == null ? void 0 : i.message) ?? e.message ?? /* @__PURE__ */ Gs(e.reference, c.lang) ?? (h ? /* @__PURE__ */ Ws(c.lang) : null) ?? s.message ?? /* @__PURE__ */ Ks(c.lang);
|
|
1178
1188
|
b !== void 0 && (c.message = typeof b == "function" ? (
|
|
1179
1189
|
// @ts-expect-error
|
|
1180
1190
|
b(c)
|
|
1181
|
-
) : b),
|
|
1191
|
+
) : b), h && (t.typed = !1), t.issues ? t.issues.push(c) : t.issues = [c];
|
|
1182
1192
|
}
|
|
1183
1193
|
// @__NO_SIDE_EFFECTS__
|
|
1184
1194
|
function fe(e) {
|
|
@@ -1186,21 +1196,21 @@ function fe(e) {
|
|
|
1186
1196
|
version: 1,
|
|
1187
1197
|
vendor: "valibot",
|
|
1188
1198
|
validate(r) {
|
|
1189
|
-
return e["~run"]({ value: r }, /* @__PURE__ */
|
|
1199
|
+
return e["~run"]({ value: r }, /* @__PURE__ */ nt());
|
|
1190
1200
|
}
|
|
1191
1201
|
};
|
|
1192
1202
|
}
|
|
1193
1203
|
// @__NO_SIDE_EFFECTS__
|
|
1194
|
-
function
|
|
1204
|
+
function Hs(e, r) {
|
|
1195
1205
|
return Object.hasOwn(e, r) && r !== "__proto__" && r !== "prototype" && r !== "constructor";
|
|
1196
1206
|
}
|
|
1197
1207
|
// @__NO_SIDE_EFFECTS__
|
|
1198
|
-
function
|
|
1208
|
+
function Js(e, r) {
|
|
1199
1209
|
const t = [...new Set(e)];
|
|
1200
1210
|
return t.length > 1 ? `(${t.join(` ${r} `)})` : t[0] ?? "never";
|
|
1201
1211
|
}
|
|
1202
1212
|
// @__NO_SIDE_EFFECTS__
|
|
1203
|
-
function
|
|
1213
|
+
function Zs(e) {
|
|
1204
1214
|
if (e.path) {
|
|
1205
1215
|
let r = "";
|
|
1206
1216
|
for (const t of e.path)
|
|
@@ -1212,7 +1222,7 @@ function Ws(e) {
|
|
|
1212
1222
|
}
|
|
1213
1223
|
return null;
|
|
1214
1224
|
}
|
|
1215
|
-
var
|
|
1225
|
+
var Xs = class extends Error {
|
|
1216
1226
|
/**
|
|
1217
1227
|
* Creates a Valibot error with useful information.
|
|
1218
1228
|
*
|
|
@@ -1221,13 +1231,13 @@ var Gs = class extends Error {
|
|
|
1221
1231
|
constructor(e) {
|
|
1222
1232
|
super(e[0].message), this.name = "ValiError", this.issues = e;
|
|
1223
1233
|
}
|
|
1224
|
-
},
|
|
1234
|
+
}, Ys = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
1225
1235
|
// @__NO_SIDE_EFFECTS__
|
|
1226
|
-
function
|
|
1236
|
+
function Ir(e, r) {
|
|
1227
1237
|
return {
|
|
1228
1238
|
kind: "validation",
|
|
1229
1239
|
type: "check",
|
|
1230
|
-
reference:
|
|
1240
|
+
reference: Ir,
|
|
1231
1241
|
async: !1,
|
|
1232
1242
|
expects: null,
|
|
1233
1243
|
requirement: e,
|
|
@@ -1238,14 +1248,14 @@ function kr(e, r) {
|
|
|
1238
1248
|
};
|
|
1239
1249
|
}
|
|
1240
1250
|
// @__NO_SIDE_EFFECTS__
|
|
1241
|
-
function
|
|
1251
|
+
function Fr(e) {
|
|
1242
1252
|
return {
|
|
1243
1253
|
kind: "validation",
|
|
1244
1254
|
type: "email",
|
|
1245
|
-
reference:
|
|
1255
|
+
reference: Fr,
|
|
1246
1256
|
expects: null,
|
|
1247
1257
|
async: !1,
|
|
1248
|
-
requirement:
|
|
1258
|
+
requirement: Ys,
|
|
1249
1259
|
message: e,
|
|
1250
1260
|
"~run"(r, t) {
|
|
1251
1261
|
return r.typed && !this.requirement.test(r.value) && Y(this, "email", r, t), r;
|
|
@@ -1253,11 +1263,11 @@ function Cr(e) {
|
|
|
1253
1263
|
};
|
|
1254
1264
|
}
|
|
1255
1265
|
// @__NO_SIDE_EFFECTS__
|
|
1256
|
-
function
|
|
1266
|
+
function Ke(e, r) {
|
|
1257
1267
|
return {
|
|
1258
1268
|
kind: "validation",
|
|
1259
1269
|
type: "max_length",
|
|
1260
|
-
reference:
|
|
1270
|
+
reference: Ke,
|
|
1261
1271
|
async: !1,
|
|
1262
1272
|
expects: `<=${e}`,
|
|
1263
1273
|
requirement: e,
|
|
@@ -1270,28 +1280,28 @@ function ze(e, r) {
|
|
|
1270
1280
|
};
|
|
1271
1281
|
}
|
|
1272
1282
|
// @__NO_SIDE_EFFECTS__
|
|
1273
|
-
function
|
|
1283
|
+
function Vr(e, r) {
|
|
1274
1284
|
return {
|
|
1275
1285
|
kind: "validation",
|
|
1276
1286
|
type: "max_value",
|
|
1277
|
-
reference:
|
|
1287
|
+
reference: Vr,
|
|
1278
1288
|
async: !1,
|
|
1279
|
-
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1289
|
+
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ De(e)}`,
|
|
1280
1290
|
requirement: e,
|
|
1281
1291
|
message: r,
|
|
1282
1292
|
"~run"(t, s) {
|
|
1283
1293
|
return t.typed && !(t.value <= this.requirement) && Y(this, "value", t, s, {
|
|
1284
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
1294
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ De(t.value)
|
|
1285
1295
|
}), t;
|
|
1286
1296
|
}
|
|
1287
1297
|
};
|
|
1288
1298
|
}
|
|
1289
1299
|
// @__NO_SIDE_EFFECTS__
|
|
1290
|
-
function
|
|
1300
|
+
function Te(e, r) {
|
|
1291
1301
|
return {
|
|
1292
1302
|
kind: "validation",
|
|
1293
1303
|
type: "min_length",
|
|
1294
|
-
reference:
|
|
1304
|
+
reference: Te,
|
|
1295
1305
|
async: !1,
|
|
1296
1306
|
expects: `>=${e}`,
|
|
1297
1307
|
requirement: e,
|
|
@@ -1304,28 +1314,28 @@ function De(e, r) {
|
|
|
1304
1314
|
};
|
|
1305
1315
|
}
|
|
1306
1316
|
// @__NO_SIDE_EFFECTS__
|
|
1307
|
-
function
|
|
1317
|
+
function Ar(e, r) {
|
|
1308
1318
|
return {
|
|
1309
1319
|
kind: "validation",
|
|
1310
1320
|
type: "min_value",
|
|
1311
|
-
reference:
|
|
1321
|
+
reference: Ar,
|
|
1312
1322
|
async: !1,
|
|
1313
|
-
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1323
|
+
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ De(e)}`,
|
|
1314
1324
|
requirement: e,
|
|
1315
1325
|
message: r,
|
|
1316
1326
|
"~run"(t, s) {
|
|
1317
1327
|
return t.typed && !(t.value >= this.requirement) && Y(this, "value", t, s, {
|
|
1318
|
-
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */
|
|
1328
|
+
received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ De(t.value)
|
|
1319
1329
|
}), t;
|
|
1320
1330
|
}
|
|
1321
1331
|
};
|
|
1322
1332
|
}
|
|
1323
1333
|
// @__NO_SIDE_EFFECTS__
|
|
1324
|
-
function
|
|
1334
|
+
function St(e, r) {
|
|
1325
1335
|
return {
|
|
1326
1336
|
kind: "validation",
|
|
1327
1337
|
type: "regex",
|
|
1328
|
-
reference:
|
|
1338
|
+
reference: St,
|
|
1329
1339
|
async: !1,
|
|
1330
1340
|
expects: `${e}`,
|
|
1331
1341
|
requirement: e,
|
|
@@ -1336,11 +1346,11 @@ function _t(e, r) {
|
|
|
1336
1346
|
};
|
|
1337
1347
|
}
|
|
1338
1348
|
// @__NO_SIDE_EFFECTS__
|
|
1339
|
-
function
|
|
1349
|
+
function It(e) {
|
|
1340
1350
|
return {
|
|
1341
1351
|
kind: "transformation",
|
|
1342
1352
|
type: "transform",
|
|
1343
|
-
reference:
|
|
1353
|
+
reference: It,
|
|
1344
1354
|
async: !1,
|
|
1345
1355
|
operation: e,
|
|
1346
1356
|
"~run"(r) {
|
|
@@ -1349,11 +1359,11 @@ function kt(e) {
|
|
|
1349
1359
|
};
|
|
1350
1360
|
}
|
|
1351
1361
|
// @__NO_SIDE_EFFECTS__
|
|
1352
|
-
function
|
|
1362
|
+
function Mr(e) {
|
|
1353
1363
|
return {
|
|
1354
1364
|
kind: "validation",
|
|
1355
1365
|
type: "url",
|
|
1356
|
-
reference:
|
|
1366
|
+
reference: Mr,
|
|
1357
1367
|
async: !1,
|
|
1358
1368
|
expects: null,
|
|
1359
1369
|
requirement(r) {
|
|
@@ -1370,7 +1380,7 @@ function Fr(e) {
|
|
|
1370
1380
|
};
|
|
1371
1381
|
}
|
|
1372
1382
|
// @__NO_SIDE_EFFECTS__
|
|
1373
|
-
function
|
|
1383
|
+
function Qs(e, r, t) {
|
|
1374
1384
|
return typeof e.fallback == "function" ? (
|
|
1375
1385
|
// @ts-expect-error
|
|
1376
1386
|
e.fallback(r, t)
|
|
@@ -1380,7 +1390,7 @@ function Js(e, r, t) {
|
|
|
1380
1390
|
);
|
|
1381
1391
|
}
|
|
1382
1392
|
// @__NO_SIDE_EFFECTS__
|
|
1383
|
-
function
|
|
1393
|
+
function Er(e, r, t) {
|
|
1384
1394
|
return typeof e.default == "function" ? (
|
|
1385
1395
|
// @ts-expect-error
|
|
1386
1396
|
e.default(r, t)
|
|
@@ -1390,11 +1400,11 @@ function Vr(e, r, t) {
|
|
|
1390
1400
|
);
|
|
1391
1401
|
}
|
|
1392
1402
|
// @__NO_SIDE_EFFECTS__
|
|
1393
|
-
function
|
|
1403
|
+
function Nr(e, r) {
|
|
1394
1404
|
return {
|
|
1395
1405
|
kind: "schema",
|
|
1396
1406
|
type: "array",
|
|
1397
|
-
reference:
|
|
1407
|
+
reference: Nr,
|
|
1398
1408
|
expects: "Array",
|
|
1399
1409
|
async: !1,
|
|
1400
1410
|
item: e,
|
|
@@ -1410,7 +1420,7 @@ function Ar(e, r) {
|
|
|
1410
1420
|
for (let n = 0; n < i.length; n++) {
|
|
1411
1421
|
const o = i[n], c = this.item["~run"]({ value: o }, s);
|
|
1412
1422
|
if (c.issues) {
|
|
1413
|
-
const
|
|
1423
|
+
const h = {
|
|
1414
1424
|
type: "array",
|
|
1415
1425
|
origin: "value",
|
|
1416
1426
|
input: i,
|
|
@@ -1418,7 +1428,7 @@ function Ar(e, r) {
|
|
|
1418
1428
|
value: o
|
|
1419
1429
|
};
|
|
1420
1430
|
for (const b of c.issues)
|
|
1421
|
-
b.path ? b.path.unshift(
|
|
1431
|
+
b.path ? b.path.unshift(h) : b.path = [h], (a = t.issues) == null || a.push(b);
|
|
1422
1432
|
if (t.issues || (t.issues = c.issues), s.abortEarly) {
|
|
1423
1433
|
t.typed = !1;
|
|
1424
1434
|
break;
|
|
@@ -1433,11 +1443,11 @@ function Ar(e, r) {
|
|
|
1433
1443
|
};
|
|
1434
1444
|
}
|
|
1435
1445
|
// @__NO_SIDE_EFFECTS__
|
|
1436
|
-
function
|
|
1446
|
+
function Lr(e) {
|
|
1437
1447
|
return {
|
|
1438
1448
|
kind: "schema",
|
|
1439
1449
|
type: "boolean",
|
|
1440
|
-
reference:
|
|
1450
|
+
reference: Lr,
|
|
1441
1451
|
expects: "boolean",
|
|
1442
1452
|
async: !1,
|
|
1443
1453
|
message: e,
|
|
@@ -1450,11 +1460,11 @@ function Er(e) {
|
|
|
1450
1460
|
};
|
|
1451
1461
|
}
|
|
1452
1462
|
// @__NO_SIDE_EFFECTS__
|
|
1453
|
-
function
|
|
1463
|
+
function Tr(e) {
|
|
1454
1464
|
return {
|
|
1455
1465
|
kind: "schema",
|
|
1456
1466
|
type: "number",
|
|
1457
|
-
reference:
|
|
1467
|
+
reference: Tr,
|
|
1458
1468
|
expects: "number",
|
|
1459
1469
|
async: !1,
|
|
1460
1470
|
message: e,
|
|
@@ -1491,8 +1501,8 @@ function ge(e, r) {
|
|
|
1491
1501
|
const c = n in i ? (
|
|
1492
1502
|
// @ts-expect-error
|
|
1493
1503
|
i[n]
|
|
1494
|
-
) : /* @__PURE__ */
|
|
1495
|
-
if (
|
|
1504
|
+
) : /* @__PURE__ */ Er(o), h = o["~run"]({ value: c }, s);
|
|
1505
|
+
if (h.issues) {
|
|
1496
1506
|
const b = {
|
|
1497
1507
|
type: "object",
|
|
1498
1508
|
origin: "value",
|
|
@@ -1500,16 +1510,16 @@ function ge(e, r) {
|
|
|
1500
1510
|
key: n,
|
|
1501
1511
|
value: c
|
|
1502
1512
|
};
|
|
1503
|
-
for (const x of
|
|
1513
|
+
for (const x of h.issues)
|
|
1504
1514
|
x.path ? x.path.unshift(b) : x.path = [b], (a = t.issues) == null || a.push(x);
|
|
1505
|
-
if (t.issues || (t.issues =
|
|
1515
|
+
if (t.issues || (t.issues = h.issues), s.abortEarly) {
|
|
1506
1516
|
t.typed = !1;
|
|
1507
1517
|
break;
|
|
1508
1518
|
}
|
|
1509
1519
|
}
|
|
1510
|
-
|
|
1520
|
+
h.typed || (t.typed = !1), t.value[n] = h.value;
|
|
1511
1521
|
} else if (o.fallback !== void 0)
|
|
1512
|
-
t.value[n] = /* @__PURE__ */
|
|
1522
|
+
t.value[n] = /* @__PURE__ */ Qs(o);
|
|
1513
1523
|
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (Y(this, "key", t, s, {
|
|
1514
1524
|
input: void 0,
|
|
1515
1525
|
expected: `"${n}"`,
|
|
@@ -1533,11 +1543,11 @@ function ge(e, r) {
|
|
|
1533
1543
|
};
|
|
1534
1544
|
}
|
|
1535
1545
|
// @__NO_SIDE_EFFECTS__
|
|
1536
|
-
function
|
|
1546
|
+
function We(e, r) {
|
|
1537
1547
|
return {
|
|
1538
1548
|
kind: "schema",
|
|
1539
1549
|
type: "optional",
|
|
1540
|
-
reference:
|
|
1550
|
+
reference: We,
|
|
1541
1551
|
expects: `(${e.expects} | undefined)`,
|
|
1542
1552
|
async: !1,
|
|
1543
1553
|
wrapped: e,
|
|
@@ -1546,17 +1556,17 @@ function Ke(e, r) {
|
|
|
1546
1556
|
return /* @__PURE__ */ fe(this);
|
|
1547
1557
|
},
|
|
1548
1558
|
"~run"(t, s) {
|
|
1549
|
-
return t.value === void 0 && (this.default !== void 0 && (t.value = /* @__PURE__ */
|
|
1559
|
+
return t.value === void 0 && (this.default !== void 0 && (t.value = /* @__PURE__ */ Er(this, t, s)), t.value === void 0) ? (t.typed = !0, t) : this.wrapped["~run"](t, s);
|
|
1550
1560
|
}
|
|
1551
1561
|
};
|
|
1552
1562
|
}
|
|
1553
1563
|
// @__NO_SIDE_EFFECTS__
|
|
1554
|
-
function
|
|
1564
|
+
function Dr(e, r) {
|
|
1555
1565
|
return {
|
|
1556
1566
|
kind: "schema",
|
|
1557
1567
|
type: "picklist",
|
|
1558
|
-
reference:
|
|
1559
|
-
expects: /* @__PURE__ */
|
|
1568
|
+
reference: Dr,
|
|
1569
|
+
expects: /* @__PURE__ */ Js(e.map(De), "|"),
|
|
1560
1570
|
async: !1,
|
|
1561
1571
|
options: e,
|
|
1562
1572
|
message: r,
|
|
@@ -1569,11 +1579,11 @@ function Nr(e, r) {
|
|
|
1569
1579
|
};
|
|
1570
1580
|
}
|
|
1571
1581
|
// @__NO_SIDE_EFFECTS__
|
|
1572
|
-
function
|
|
1582
|
+
function Or(e, r, t) {
|
|
1573
1583
|
return {
|
|
1574
1584
|
kind: "schema",
|
|
1575
1585
|
type: "record",
|
|
1576
|
-
reference:
|
|
1586
|
+
reference: Or,
|
|
1577
1587
|
expects: "Object",
|
|
1578
1588
|
async: !1,
|
|
1579
1589
|
key: e,
|
|
@@ -1588,37 +1598,37 @@ function Lr(e, r, t) {
|
|
|
1588
1598
|
if (a && typeof a == "object") {
|
|
1589
1599
|
s.typed = !0, s.value = {};
|
|
1590
1600
|
for (const c in a)
|
|
1591
|
-
if (/* @__PURE__ */
|
|
1592
|
-
const
|
|
1601
|
+
if (/* @__PURE__ */ Hs(a, c)) {
|
|
1602
|
+
const h = a[c], b = this.key["~run"]({ value: c }, i);
|
|
1593
1603
|
if (b.issues) {
|
|
1594
|
-
const
|
|
1604
|
+
const p = {
|
|
1595
1605
|
type: "object",
|
|
1596
1606
|
origin: "key",
|
|
1597
1607
|
input: a,
|
|
1598
1608
|
key: c,
|
|
1599
|
-
value:
|
|
1609
|
+
value: h
|
|
1600
1610
|
};
|
|
1601
1611
|
for (const m of b.issues)
|
|
1602
|
-
m.path = [
|
|
1612
|
+
m.path = [p], (n = s.issues) == null || n.push(m);
|
|
1603
1613
|
if (s.issues || (s.issues = b.issues), i.abortEarly) {
|
|
1604
1614
|
s.typed = !1;
|
|
1605
1615
|
break;
|
|
1606
1616
|
}
|
|
1607
1617
|
}
|
|
1608
1618
|
const x = this.value["~run"](
|
|
1609
|
-
{ value:
|
|
1619
|
+
{ value: h },
|
|
1610
1620
|
i
|
|
1611
1621
|
);
|
|
1612
1622
|
if (x.issues) {
|
|
1613
|
-
const
|
|
1623
|
+
const p = {
|
|
1614
1624
|
type: "object",
|
|
1615
1625
|
origin: "value",
|
|
1616
1626
|
input: a,
|
|
1617
1627
|
key: c,
|
|
1618
|
-
value:
|
|
1628
|
+
value: h
|
|
1619
1629
|
};
|
|
1620
1630
|
for (const m of x.issues)
|
|
1621
|
-
m.path ? m.path.unshift(
|
|
1631
|
+
m.path ? m.path.unshift(p) : m.path = [p], (o = s.issues) == null || o.push(m);
|
|
1622
1632
|
if (s.issues || (s.issues = x.issues), i.abortEarly) {
|
|
1623
1633
|
s.typed = !1;
|
|
1624
1634
|
break;
|
|
@@ -1649,17 +1659,17 @@ function ie(e) {
|
|
|
1649
1659
|
}
|
|
1650
1660
|
};
|
|
1651
1661
|
}
|
|
1652
|
-
function
|
|
1653
|
-
const s = e["~run"]({ value: r }, /* @__PURE__ */
|
|
1662
|
+
function en(e, r, t) {
|
|
1663
|
+
const s = e["~run"]({ value: r }, /* @__PURE__ */ nt(t));
|
|
1654
1664
|
if (s.issues)
|
|
1655
|
-
throw new
|
|
1665
|
+
throw new Xs(s.issues);
|
|
1656
1666
|
return s.value;
|
|
1657
1667
|
}
|
|
1658
1668
|
// @__NO_SIDE_EFFECTS__
|
|
1659
|
-
function
|
|
1669
|
+
function tn(e, r) {
|
|
1660
1670
|
const t = {};
|
|
1661
1671
|
for (const s in e.entries)
|
|
1662
|
-
t[s] = !r || r.includes(s) ? /* @__PURE__ */
|
|
1672
|
+
t[s] = !r || r.includes(s) ? /* @__PURE__ */ We(e.entries[s]) : e.entries[s];
|
|
1663
1673
|
return {
|
|
1664
1674
|
...e,
|
|
1665
1675
|
entries: t,
|
|
@@ -1690,8 +1700,8 @@ function Se(...e) {
|
|
|
1690
1700
|
};
|
|
1691
1701
|
}
|
|
1692
1702
|
// @__NO_SIDE_EFFECTS__
|
|
1693
|
-
function
|
|
1694
|
-
const s = e["~run"]({ value: r }, /* @__PURE__ */
|
|
1703
|
+
function rn(e, r, t) {
|
|
1704
|
+
const s = e["~run"]({ value: r }, /* @__PURE__ */ nt(t));
|
|
1695
1705
|
return {
|
|
1696
1706
|
typed: s.typed,
|
|
1697
1707
|
success: !s.issues,
|
|
@@ -1700,10 +1710,10 @@ function Ys(e, r, t) {
|
|
|
1700
1710
|
};
|
|
1701
1711
|
}
|
|
1702
1712
|
// @__NO_SIDE_EFFECTS__
|
|
1703
|
-
async function
|
|
1713
|
+
async function sn(e, r, t) {
|
|
1704
1714
|
const s = await e["~run"](
|
|
1705
1715
|
{ value: r },
|
|
1706
|
-
/* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ nt(t)
|
|
1707
1717
|
);
|
|
1708
1718
|
return {
|
|
1709
1719
|
typed: s.typed,
|
|
@@ -1745,7 +1755,7 @@ const Be = ({
|
|
|
1745
1755
|
class: "break-words pr-1 text-sm",
|
|
1746
1756
|
children: e.message
|
|
1747
1757
|
})]
|
|
1748
|
-
}),
|
|
1758
|
+
}), Fe = ({
|
|
1749
1759
|
class: e,
|
|
1750
1760
|
...r
|
|
1751
1761
|
}) => {
|
|
@@ -1776,8 +1786,8 @@ const Be = ({
|
|
|
1776
1786
|
}), t("skip")]
|
|
1777
1787
|
});
|
|
1778
1788
|
};
|
|
1779
|
-
var
|
|
1780
|
-
const
|
|
1789
|
+
var Ft = { Afghanistan: "93", Albania: "355", Algeria: "213", "American Samoa": "1 684", Andorra: "376", Angola: "244", Anguilla: "1 264", Antarctica: "672", "Antigua and Barbuda": "1 268", Argentina: "54", Armenia: "374", Aruba: "297", Australia: "61", Austria: "43", Azerbaijan: "994", Bahrain: "973", Bangladesh: "880", Barbados: "1 246", Belarus: "375", Belgium: "32", Belize: "501", Benin: "229", Bermuda: "1 441", Bhutan: "975", Bolivia: "591", "Bosnia and Herzegovina": "387", Botswana: "267", "Bouvet Island": "47", Brazil: "55", "British Indian Ocean Territory": "246", "British Virgin Islands": "1 284", Brunei: "673", Bulgaria: "359", "Burkina Faso": "226", Burundi: "257", "Cabo Verde": "238", Cambodia: "855", Cameroon: "237", Canada: "1", "Caribbean Netherlands": "599", "Cayman Islands": "1 345", "Central African Republic": "236", Chad: "235", Chile: "56", China: "86", "Christmas Island": "61", "Cocos (Keeling) Islands": "61", Colombia: "57", Comoros: "269", "Cook Islands": "682", "Costa Rica": "506", Croatia: "385", Cuba: "53", Curaçao: "599", Cyprus: "357", Czechia: "420", "Côte d'Ivoire": "225", "Democratic Republic of the Congo": "243", Denmark: "45", Djibouti: "253", "Dominican Republic": "1 809", Ecuador: "593", Egypt: "20", "El Salvador": "503", "Equatorial Guinea": "240", Eritrea: "291", Estonia: "372", Eswatini: "268", Ethiopia: "251", "Falkland Islands (Islas Malvinas)": "500", "Faroe Islands": "298", Fiji: "679", Finland: "358", France: "33", "French Guiana": "594", "French Polynesia": "689", "French Southern and Antarctic Lands": "262", Gabon: "241", Georgia: "995", Germany: "49", Ghana: "233", Gibraltar: "350", Greece: "30", Greenland: "299", Grenada: "1 473", Guadeloupe: "590", Guam: "1 671", Guatemala: "502", Guernsey: "44", Guinea: "224", "Guinea-Bissau": "245", Guyana: "592", Haiti: "509", Honduras: "504", "Hong Kong": "852", Hungary: "36", Iceland: "354", India: "91", Indonesia: "62", Iran: "98", Iraq: "964", Ireland: "353", "Isle of Man": "44", Israel: "972", Italy: "39", Jamaica: "1 876", Japan: "81", Jersey: "44", Jordan: "962", Kazakhstan: "7", Kenya: "254", Kiribati: "686", Kosovo: "383", Kuwait: "965", Kyrgyzstan: "996", Laos: "856", Latvia: "371", Lebanon: "961", Lesotho: "266", Liberia: "231", Libya: "218", Liechtenstein: "423", Lithuania: "370", Luxembourg: "352", Macao: "853", Madagascar: "261", Malawi: "265", Malaysia: "60", Maldives: "960", Mali: "223", Malta: "356", "Marshall Islands": "692", Martinique: "596", Mauritania: "222", Mauritius: "230", Mayotte: "262", Mexico: "52", Micronesia: "691", Moldova: "373", Monaco: "377", Mongolia: "976", Montenegro: "382", Montserrat: "1 664", Morocco: "212", Mozambique: "258", "Myanmar (Burma)": "95", Namibia: "264", Nauru: "674", Nepal: "977", Netherlands: "31", "New Caledonia": "687", "New Zealand": "64", Nicaragua: "505", Niger: "227", Nigeria: "234", Niue: "683", "Norfolk Island": "672", "North Korea": "850", "North Macedonia": "389", "Northern Mariana Islands": "1 670", Norway: "47", Oman: "968", Pakistan: "92", Palau: "680", Palestine: "970", Panama: "507", "Papua New Guinea": "675", Paraguay: "595", Peru: "51", Philippines: "63", "Pitcairn Islands": "64", Poland: "48", Portugal: "351", "Puerto Rico": "1 787", Qatar: "974", Romania: "40", Russia: "7", Rwanda: "250", Réunion: "262", "Saint Barthélemy": "590", "Saint Helena, Ascension and Tristan da Cunha": "290", "Saint Kitts and Nevis": "1 869", "Saint Lucia": "1 758", "Saint Martin": "590", "Saint Pierre and Miquelon": "508", "Saint Vincent and the Grenadines": "1 784", Samoa: "685", "San Marino": "378", "Saudi Arabia": "966", Senegal: "221", Serbia: "381", Seychelles: "248", "Sierra Leone": "232", Singapore: "65", "Sint Maarten": "1 721", Slovakia: "421", Slovenia: "386", "Solomon Islands": "677", Somalia: "252", "South Africa": "27", "South Georgia and the South Sandwich Islands": "500", "South Korea": "82", "South Sudan": "211", Spain: "34", "Sri Lanka": "94", Sudan: "249", Suriname: "597", "Svalbard and Jan Mayen": "47", Sweden: "46", Switzerland: "41", Syria: "963", "São Tomé and Príncipe": "239", Taiwan: "886", Tajikistan: "992", Tanzania: "255", Thailand: "66", "The Bahamas": "1 242", "The Gambia": "220", "Timor-Leste": "670", Togo: "228", Tokelau: "690", Tonga: "676", "Trinidad and Tobago": "1 868", Tunisia: "216", Turkmenistan: "993", "Turks and Caicos Islands": "1 649", Tuvalu: "688", Türkiye: "90", "U.S. Virgin Islands": "1 340", Uganda: "256", Ukraine: "380", "United Arab Emirates": "971", "United Kingdom": "44", "United States": "1", "United States Minor Outlying Islands": "1", Uruguay: "598", Uzbekistan: "998", Vanuatu: "678", "Vatican City": "379", Venezuela: "58", Vietnam: "84", "Wallis and Futuna": "681", "Western Sahara": "212", Yemen: "967", Zambia: "260", Zimbabwe: "263", "Åland Islands": "358" };
|
|
1790
|
+
const Je = st("outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest py-1 text-base outline outline-2 transition-all", {
|
|
1781
1791
|
variants: {
|
|
1782
1792
|
optional: {
|
|
1783
1793
|
true: "pr-16 pl-3",
|
|
@@ -1787,70 +1797,70 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1787
1797
|
defaultVariants: {
|
|
1788
1798
|
optional: !1
|
|
1789
1799
|
}
|
|
1790
|
-
}),
|
|
1800
|
+
}), nn = "https://api.mapbox.com/search/searchbox/v1/suggest", an = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", on = (e) => atob(e).split("").reverse().join(""), pe = /* @__PURE__ */ ge({
|
|
1791
1801
|
name: /* @__PURE__ */ ie()
|
|
1792
|
-
}),
|
|
1793
|
-
suggestions: /* @__PURE__ */
|
|
1794
|
-
full_address: /* @__PURE__ */
|
|
1795
|
-
place_formatted: /* @__PURE__ */
|
|
1796
|
-
name: /* @__PURE__ */
|
|
1802
|
+
}), ln = /* @__PURE__ */ ge({
|
|
1803
|
+
suggestions: /* @__PURE__ */ Nr(/* @__PURE__ */ ge({
|
|
1804
|
+
full_address: /* @__PURE__ */ We(/* @__PURE__ */ ie()),
|
|
1805
|
+
place_formatted: /* @__PURE__ */ We(/* @__PURE__ */ ie()),
|
|
1806
|
+
name: /* @__PURE__ */ We(/* @__PURE__ */ ie()),
|
|
1797
1807
|
mapbox_id: /* @__PURE__ */ ie(),
|
|
1798
|
-
context: /* @__PURE__ */
|
|
1799
|
-
address:
|
|
1800
|
-
street:
|
|
1801
|
-
neighborhood:
|
|
1802
|
-
locality:
|
|
1803
|
-
district:
|
|
1804
|
-
place:
|
|
1805
|
-
region:
|
|
1806
|
-
postcode:
|
|
1807
|
-
country:
|
|
1808
|
+
context: /* @__PURE__ */ tn(/* @__PURE__ */ ge({
|
|
1809
|
+
address: pe,
|
|
1810
|
+
street: pe,
|
|
1811
|
+
neighborhood: pe,
|
|
1812
|
+
locality: pe,
|
|
1813
|
+
district: pe,
|
|
1814
|
+
place: pe,
|
|
1815
|
+
region: pe,
|
|
1816
|
+
postcode: pe,
|
|
1817
|
+
country: pe
|
|
1808
1818
|
}))
|
|
1809
1819
|
}))
|
|
1810
|
-
}),
|
|
1820
|
+
}), un = ({
|
|
1811
1821
|
logger: e,
|
|
1812
1822
|
t: r
|
|
1813
|
-
}) =>
|
|
1823
|
+
}) => us(() => {
|
|
1814
1824
|
var s;
|
|
1815
|
-
const t = (s =
|
|
1825
|
+
const t = (s = $.current$.peek().flow) == null ? void 0 : s.data.flowSessionId;
|
|
1816
1826
|
return t ? {
|
|
1817
1827
|
enabled: !0,
|
|
1818
1828
|
getPredictions: async (i) => {
|
|
1819
1829
|
var x;
|
|
1820
|
-
const a = new URL(
|
|
1830
|
+
const a = new URL(nn);
|
|
1821
1831
|
a.searchParams.set("q", i), a.searchParams.set("session_token", t);
|
|
1822
|
-
const n = (x =
|
|
1823
|
-
n && n.lat !== void 0 && n.lng !== void 0 && n.lat >= -90 && n.lat <= 90 && n.lng >= -180 && n.lng <= 180 && a.searchParams.set("proximity", `${n.lng},${n.lat}`), a.searchParams.set("access_token",
|
|
1832
|
+
const n = (x = $.current$.peek().flow) == null ? void 0 : x.locationOrigin;
|
|
1833
|
+
n && n.lat !== void 0 && n.lng !== void 0 && n.lat >= -90 && n.lat <= 90 && n.lng >= -180 && n.lng <= 180 && a.searchParams.set("proximity", `${n.lng},${n.lat}`), a.searchParams.set("access_token", on(an));
|
|
1824
1834
|
const c = await fetch(a);
|
|
1825
1835
|
if (!c.ok)
|
|
1826
1836
|
return e.error("Failed to get address details", c), {
|
|
1827
1837
|
ok: !1,
|
|
1828
1838
|
error: r("address_error")
|
|
1829
1839
|
};
|
|
1830
|
-
const
|
|
1831
|
-
if (
|
|
1832
|
-
return e.error("Failed to parse address details",
|
|
1840
|
+
const h = /* @__PURE__ */ rn(ln, await c.json());
|
|
1841
|
+
if (h.success === !1)
|
|
1842
|
+
return e.error("Failed to parse address details", h.issues), {
|
|
1833
1843
|
ok: !1,
|
|
1834
1844
|
error: r("address_error")
|
|
1835
1845
|
};
|
|
1836
1846
|
const {
|
|
1837
1847
|
suggestions: b
|
|
1838
|
-
} =
|
|
1848
|
+
} = h.output;
|
|
1839
1849
|
return {
|
|
1840
1850
|
ok: !0,
|
|
1841
|
-
data: b.map((
|
|
1842
|
-
var m,
|
|
1851
|
+
data: b.map((p) => {
|
|
1852
|
+
var m, C, E, A, I, y, _, V, M;
|
|
1843
1853
|
return {
|
|
1844
|
-
label:
|
|
1845
|
-
id:
|
|
1854
|
+
label: p.full_address ?? p.place_formatted ?? p.name ?? p.mapbox_id,
|
|
1855
|
+
id: p.mapbox_id,
|
|
1846
1856
|
address: {
|
|
1847
|
-
line1: ((m =
|
|
1857
|
+
line1: ((m = p.context.address) == null ? void 0 : m.name) ?? ((C = p.context.street) == null ? void 0 : C.name),
|
|
1848
1858
|
line2: void 0,
|
|
1849
|
-
line3: ((
|
|
1850
|
-
city: ((I =
|
|
1851
|
-
state: (
|
|
1852
|
-
postcode: (V =
|
|
1853
|
-
country: (
|
|
1859
|
+
line3: ((E = p.context.neighborhood) == null ? void 0 : E.name) ?? ((A = p.context.locality) == null ? void 0 : A.name),
|
|
1860
|
+
city: ((I = p.context.place) == null ? void 0 : I.name) ?? ((y = p.context.district) == null ? void 0 : y.name),
|
|
1861
|
+
state: (_ = p.context.region) == null ? void 0 : _.name,
|
|
1862
|
+
postcode: (V = p.context.postcode) == null ? void 0 : V.name,
|
|
1863
|
+
country: (M = p.context.country) == null ? void 0 : M.name
|
|
1854
1864
|
}
|
|
1855
1865
|
};
|
|
1856
1866
|
})
|
|
@@ -1859,7 +1869,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1859
1869
|
} : {
|
|
1860
1870
|
enabled: !1
|
|
1861
1871
|
};
|
|
1862
|
-
}, [e, r]),
|
|
1872
|
+
}, [e, r]), Kt = (e) => {
|
|
1863
1873
|
const {
|
|
1864
1874
|
t: r
|
|
1865
1875
|
} = se();
|
|
@@ -1882,7 +1892,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1882
1892
|
children: r("back")
|
|
1883
1893
|
})]
|
|
1884
1894
|
});
|
|
1885
|
-
},
|
|
1895
|
+
}, cn = ({
|
|
1886
1896
|
input: e,
|
|
1887
1897
|
onSubmitSuccess: r,
|
|
1888
1898
|
logger: t
|
|
@@ -1892,91 +1902,96 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1892
1902
|
} = se(), [i, a] = me(), {
|
|
1893
1903
|
enabled: n,
|
|
1894
1904
|
getPredictions: o
|
|
1895
|
-
} =
|
|
1905
|
+
} = un({
|
|
1896
1906
|
logger: t,
|
|
1897
1907
|
t: s
|
|
1898
|
-
}), [c,
|
|
1908
|
+
}), [c, h] = me(n ? "query" : "manual"), [b, x] = me(""), [p, m] = me(), C = ce(), E = ce(), A = (y) => {
|
|
1899
1909
|
var V;
|
|
1900
|
-
if (
|
|
1910
|
+
if (Me(n, "Query state should not be enabled"), y = y.trim(), y === ((V = C.current) == null ? void 0 : V.query) || y === (p == null ? void 0 : p.query) && p.status === "done")
|
|
1901
1911
|
return;
|
|
1902
1912
|
if (x(y), y === "") {
|
|
1903
|
-
|
|
1913
|
+
C.current = void 0, m(void 0);
|
|
1904
1914
|
return;
|
|
1905
1915
|
}
|
|
1906
|
-
const
|
|
1916
|
+
const _ = C.current = {
|
|
1907
1917
|
query: y
|
|
1908
1918
|
};
|
|
1909
1919
|
m({
|
|
1910
1920
|
query: y,
|
|
1911
1921
|
status: "pending"
|
|
1912
|
-
}), o(y).then((
|
|
1913
|
-
|
|
1922
|
+
}), o(y).then((M) => {
|
|
1923
|
+
C.current === _ && (C.current = void 0, m(M.ok ? {
|
|
1914
1924
|
query: y,
|
|
1915
1925
|
status: "done",
|
|
1916
|
-
items:
|
|
1926
|
+
items: M.data
|
|
1917
1927
|
} : {
|
|
1918
1928
|
query: y,
|
|
1919
1929
|
status: "failed",
|
|
1920
|
-
error:
|
|
1930
|
+
error: M.error
|
|
1921
1931
|
}));
|
|
1922
|
-
}, (
|
|
1923
|
-
|
|
1932
|
+
}, (M) => {
|
|
1933
|
+
C.current === _ && (C.current = void 0, t.error("Failed to get address details", M), m({
|
|
1924
1934
|
query: y,
|
|
1925
1935
|
status: "failed",
|
|
1926
1936
|
error: s("address_error")
|
|
1927
1937
|
}));
|
|
1928
1938
|
});
|
|
1929
|
-
}, I = (y,
|
|
1939
|
+
}, I = (y, _) => {
|
|
1930
1940
|
a((V) => ({
|
|
1931
1941
|
...V,
|
|
1932
|
-
[y]:
|
|
1942
|
+
[y]: _
|
|
1933
1943
|
}));
|
|
1934
1944
|
};
|
|
1935
1945
|
switch (c) {
|
|
1936
1946
|
case "query":
|
|
1937
|
-
return
|
|
1947
|
+
return Me(n, "Query state should not be enabled"), u(dn, {
|
|
1938
1948
|
input: e,
|
|
1939
1949
|
onSkip: () => r(null),
|
|
1940
1950
|
onAddressSelect: (y) => {
|
|
1941
1951
|
if (y === "") {
|
|
1942
|
-
|
|
1952
|
+
C.current && (C.current = void 0, m(void 0)), h("manual");
|
|
1943
1953
|
return;
|
|
1944
1954
|
}
|
|
1945
|
-
const
|
|
1946
|
-
|
|
1955
|
+
const _ = (p == null ? void 0 : p.status) === "done" ? p.items.find((V) => V.id === y) : void 0;
|
|
1956
|
+
_ && (E.current !== y && a(_.address), E.current = y, h("details"));
|
|
1947
1957
|
},
|
|
1948
1958
|
onAddressSearch: A,
|
|
1949
|
-
lookup:
|
|
1959
|
+
lookup: p,
|
|
1950
1960
|
query: b
|
|
1951
1961
|
});
|
|
1952
1962
|
case "details":
|
|
1953
|
-
return
|
|
1963
|
+
return Me(i !== void 0), u(Wt, {
|
|
1954
1964
|
input: e,
|
|
1955
1965
|
logger: t,
|
|
1956
1966
|
onSubmitSuccess: r,
|
|
1957
1967
|
addressFields: i,
|
|
1958
1968
|
onFieldChange: I,
|
|
1959
|
-
actions: u(
|
|
1969
|
+
actions: u(Kt, {
|
|
1960
1970
|
onClick: () => {
|
|
1961
|
-
|
|
1971
|
+
h("query");
|
|
1962
1972
|
}
|
|
1963
1973
|
})
|
|
1964
1974
|
});
|
|
1965
1975
|
case "manual":
|
|
1966
|
-
return u(
|
|
1976
|
+
return u(Wt, {
|
|
1967
1977
|
logger: t,
|
|
1968
1978
|
input: e,
|
|
1969
1979
|
onSubmitSuccess: r,
|
|
1970
1980
|
addressFields: i ?? {},
|
|
1971
1981
|
onFieldChange: I,
|
|
1972
|
-
actions: n ? u(
|
|
1982
|
+
actions: n ? u(Kt, {
|
|
1973
1983
|
onClick: () => {
|
|
1974
|
-
|
|
1984
|
+
h("query");
|
|
1975
1985
|
}
|
|
1976
|
-
}) :
|
|
1986
|
+
}) : e.config.optional ? (
|
|
1987
|
+
// Without address search this is the only screen, so an optional question needs its own way past.
|
|
1988
|
+
u(Fe, {
|
|
1989
|
+
onClick: () => r(null)
|
|
1990
|
+
})
|
|
1991
|
+
) : void 0
|
|
1977
1992
|
});
|
|
1978
1993
|
}
|
|
1979
|
-
},
|
|
1994
|
+
}, dn = ({
|
|
1980
1995
|
input: e,
|
|
1981
1996
|
onSkip: r,
|
|
1982
1997
|
lookup: t,
|
|
@@ -2008,7 +2023,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2008
2023
|
autoFocus: !0,
|
|
2009
2024
|
placeholder: e.config.placeholder || n("address_search"),
|
|
2010
2025
|
defaultValue: i,
|
|
2011
|
-
class:
|
|
2026
|
+
class: Je({
|
|
2012
2027
|
optional: !!e.config.optional,
|
|
2013
2028
|
className: "w-full rounded-full"
|
|
2014
2029
|
})
|
|
@@ -2041,7 +2056,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2041
2056
|
children: n("search")
|
|
2042
2057
|
})]
|
|
2043
2058
|
})]
|
|
2044
|
-
}), e.config.optional && u(
|
|
2059
|
+
}), e.config.optional && u(Fe, {
|
|
2045
2060
|
class: "relative",
|
|
2046
2061
|
onClick: r
|
|
2047
2062
|
})]
|
|
@@ -2053,7 +2068,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2053
2068
|
role: "status",
|
|
2054
2069
|
class: (t == null ? void 0 : t.status) === "pending" || (t == null ? void 0 : t.status) === "done" && t.items.length === 0 ? "text-neutral-10 flex items-center gap-2 px-4 py-2 text-sm" : "sr-only",
|
|
2055
2070
|
children: (t == null ? void 0 : t.status) === "pending" ? u(be, {
|
|
2056
|
-
children: [u(
|
|
2071
|
+
children: [u(Ct, {
|
|
2057
2072
|
"aria-hidden": "true",
|
|
2058
2073
|
class: "h-4 w-4 shrink-0"
|
|
2059
2074
|
}), n("address_searching")]
|
|
@@ -2096,7 +2111,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2096
2111
|
}, "")]
|
|
2097
2112
|
})]
|
|
2098
2113
|
});
|
|
2099
|
-
},
|
|
2114
|
+
}, bt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Wt = ({
|
|
2100
2115
|
addressFields: e,
|
|
2101
2116
|
onFieldChange: r,
|
|
2102
2117
|
onSubmitSuccess: t,
|
|
@@ -2110,22 +2125,32 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2110
2125
|
c && (c.focus(), c.select());
|
|
2111
2126
|
}
|
|
2112
2127
|
}, []);
|
|
2113
|
-
const n = Object.keys(
|
|
2128
|
+
const n = Object.keys(Ft), {
|
|
2114
2129
|
t: o
|
|
2115
2130
|
} = se();
|
|
2116
2131
|
return u("form", {
|
|
2117
2132
|
class: "flex flex-col px-2 pt-2",
|
|
2118
2133
|
onSubmit: (c) => {
|
|
2119
|
-
const
|
|
2134
|
+
const h = c.currentTarget, b = [...h.querySelectorAll("input")].filter((m) => m.value !== "" && !m.value.trim());
|
|
2135
|
+
for (const m of b) {
|
|
2136
|
+
m.value = "";
|
|
2137
|
+
const C = bt.find((E) => i.config.keys[E] === m.name);
|
|
2138
|
+
C && r(C, "");
|
|
2139
|
+
}
|
|
2140
|
+
if (b.length > 0 && !h.checkValidity()) {
|
|
2141
|
+
c.preventDefault(), h.reportValidity();
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
const x = new FormData(h), p = Object.fromEntries(x.entries());
|
|
2120
2145
|
t({
|
|
2121
2146
|
type: "address",
|
|
2122
|
-
value:
|
|
2147
|
+
value: p
|
|
2123
2148
|
});
|
|
2124
2149
|
},
|
|
2125
2150
|
children: [u("div", {
|
|
2126
2151
|
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]",
|
|
2127
2152
|
ref: a,
|
|
2128
|
-
children:
|
|
2153
|
+
children: bt.map((c, h) => {
|
|
2129
2154
|
const b = `isdk_${c}`, x = i.config.keys[c];
|
|
2130
2155
|
return x ? u(be, {
|
|
2131
2156
|
children: [u("label", {
|
|
@@ -2141,7 +2166,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2141
2166
|
name: x,
|
|
2142
2167
|
id: b,
|
|
2143
2168
|
defaultValue: e[c],
|
|
2144
|
-
onChange: (
|
|
2169
|
+
onChange: (p) => r(c, p.currentTarget.value),
|
|
2145
2170
|
required: !0,
|
|
2146
2171
|
children: [e.country && !n.includes(e.country) ? u("option", {
|
|
2147
2172
|
value: e[c],
|
|
@@ -2149,10 +2174,10 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2149
2174
|
}) : u("option", {
|
|
2150
2175
|
value: "",
|
|
2151
2176
|
children: o("select_country")
|
|
2152
|
-
}), n.map((
|
|
2153
|
-
value:
|
|
2154
|
-
children:
|
|
2155
|
-
},
|
|
2177
|
+
}), n.map((p) => u("option", {
|
|
2178
|
+
value: p,
|
|
2179
|
+
children: p
|
|
2180
|
+
}, p))]
|
|
2156
2181
|
}), u("svg", {
|
|
2157
2182
|
class: "text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",
|
|
2158
2183
|
width: "16",
|
|
@@ -2169,14 +2194,14 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2169
2194
|
})
|
|
2170
2195
|
})]
|
|
2171
2196
|
}) : u("input", {
|
|
2172
|
-
autoFocus:
|
|
2197
|
+
autoFocus: h === 0 ? !0 : void 0,
|
|
2173
2198
|
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",
|
|
2174
2199
|
name: x,
|
|
2175
2200
|
id: b,
|
|
2176
2201
|
defaultValue: e[c],
|
|
2177
|
-
onInput: (
|
|
2178
|
-
required: !0
|
|
2179
|
-
}),
|
|
2202
|
+
onInput: (p) => r(c, p.currentTarget.value),
|
|
2203
|
+
required: c !== "line2" || i.config.line2Required === !0
|
|
2204
|
+
}), h === bt.length - 1 ? u("hr", {
|
|
2180
2205
|
class: "m-0 w-full border-b border-b-transparent"
|
|
2181
2206
|
}) : u("hr", {
|
|
2182
2207
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -2191,13 +2216,13 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2191
2216
|
})]
|
|
2192
2217
|
})]
|
|
2193
2218
|
});
|
|
2194
|
-
},
|
|
2219
|
+
}, Vt = () => {
|
|
2195
2220
|
const e = ce(null);
|
|
2196
|
-
return
|
|
2221
|
+
return vr(() => {
|
|
2197
2222
|
var r;
|
|
2198
2223
|
(r = e.current) == null || r.focus();
|
|
2199
2224
|
}, []), e;
|
|
2200
|
-
},
|
|
2225
|
+
}, Rr = ["true", "false"], fn = /* @__PURE__ */ Dr(Rr), hn = "answer", Br = "flex items-center flex-wrap gap-2 p-2.5", Pr = "min-w-0 max-w-full flex-auto", jr = xr(({
|
|
2201
2226
|
label: e,
|
|
2202
2227
|
...r
|
|
2203
2228
|
}, t) => u("button", {
|
|
@@ -2208,59 +2233,59 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2208
2233
|
class: "text-center text-base",
|
|
2209
2234
|
children: e
|
|
2210
2235
|
})
|
|
2211
|
-
})),
|
|
2236
|
+
})), pn = ({
|
|
2212
2237
|
input: e,
|
|
2213
2238
|
onSubmitSuccess: r
|
|
2214
2239
|
}) => {
|
|
2215
|
-
const t =
|
|
2240
|
+
const t = Vt();
|
|
2216
2241
|
return u("form", {
|
|
2217
2242
|
noValidate: !0,
|
|
2218
2243
|
class: "",
|
|
2219
2244
|
onSubmit: (s) => {
|
|
2220
2245
|
s.preventDefault();
|
|
2221
|
-
const i =
|
|
2246
|
+
const i = cs(s).value, a = en(fn, i);
|
|
2222
2247
|
r({
|
|
2223
2248
|
type: "boolean",
|
|
2224
2249
|
value: a === "true"
|
|
2225
2250
|
});
|
|
2226
2251
|
},
|
|
2227
2252
|
children: [u("ul", {
|
|
2228
|
-
class:
|
|
2229
|
-
children:
|
|
2230
|
-
class:
|
|
2231
|
-
children: u(
|
|
2253
|
+
class: Br,
|
|
2254
|
+
children: Rr.map((s, i) => u("li", {
|
|
2255
|
+
class: Pr,
|
|
2256
|
+
children: u(jr, {
|
|
2232
2257
|
ref: i === 0 ? t : null,
|
|
2233
2258
|
type: "submit",
|
|
2234
|
-
name:
|
|
2259
|
+
name: hn,
|
|
2235
2260
|
value: s,
|
|
2236
2261
|
label: e.config.labels[s]
|
|
2237
2262
|
}, s)
|
|
2238
2263
|
}))
|
|
2239
2264
|
}), e.config.optional && u("div", {
|
|
2240
2265
|
class: "px-2 pb-2",
|
|
2241
|
-
children: u(
|
|
2266
|
+
children: u(Fe, {
|
|
2242
2267
|
class: "relative w-full",
|
|
2243
2268
|
type: "button",
|
|
2244
2269
|
onClick: () => r(null)
|
|
2245
2270
|
})
|
|
2246
2271
|
})]
|
|
2247
2272
|
});
|
|
2248
|
-
},
|
|
2273
|
+
}, yn = (e) => new Promise((r, t) => {
|
|
2249
2274
|
const s = new FileReader();
|
|
2250
2275
|
s.onload = () => {
|
|
2251
2276
|
if (typeof s.result != "string" || !s.result)
|
|
2252
2277
|
return t(new Error("Invalid file"));
|
|
2253
2278
|
r(s.result);
|
|
2254
2279
|
}, s.onerror = t, s.readAsDataURL(e);
|
|
2255
|
-
}),
|
|
2280
|
+
}), Gt = (e) => e.reduce((r, t) => r + t.sizeKb, 0), mn = Re("file"), Ht = 3, it = (e) => {
|
|
2256
2281
|
const r = e.lastIndexOf(".");
|
|
2257
2282
|
return r === -1 ? [e, ""] : [e.slice(0, r), e.slice(r)];
|
|
2258
|
-
},
|
|
2283
|
+
}, gn = ({
|
|
2259
2284
|
file: e,
|
|
2260
2285
|
class: r,
|
|
2261
2286
|
...t
|
|
2262
2287
|
}) => {
|
|
2263
|
-
const [s, i] =
|
|
2288
|
+
const [s, i] = it(e.name);
|
|
2264
2289
|
return u("div", {
|
|
2265
2290
|
class: Oe("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", r),
|
|
2266
2291
|
...t,
|
|
@@ -2276,38 +2301,38 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2276
2301
|
}), u("p", {
|
|
2277
2302
|
"aria-label": "File size",
|
|
2278
2303
|
class: "text-accent-11",
|
|
2279
|
-
children:
|
|
2304
|
+
children: ze(e.sizeKb)
|
|
2280
2305
|
})]
|
|
2281
2306
|
});
|
|
2282
|
-
},
|
|
2307
|
+
}, Jt = ({
|
|
2283
2308
|
class: e,
|
|
2284
2309
|
...r
|
|
2285
2310
|
}) => u("li", {
|
|
2286
2311
|
class: Oe("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1", e),
|
|
2287
2312
|
...r
|
|
2288
|
-
}),
|
|
2289
|
-
const [t, s] =
|
|
2313
|
+
}), bn = (e, r) => {
|
|
2314
|
+
const [t, s] = it(e);
|
|
2290
2315
|
return `${t.slice(0, r)}${s}`;
|
|
2291
|
-
},
|
|
2292
|
-
name:
|
|
2316
|
+
}, Zt = (e) => ({
|
|
2317
|
+
name: bn(e.name, 42),
|
|
2293
2318
|
sizeKb: e.size / 1e3
|
|
2294
|
-
}),
|
|
2295
|
-
const s =
|
|
2319
|
+
}), vn = [".heic", ".heif", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".txt", ".rtf", ".odt", ".pages", ".zip"], xn = (e, r, t) => {
|
|
2320
|
+
const s = it(r.name)[1].toLowerCase(), i = [...t.map((n) => n.toLowerCase()), ...vn], a = s === "" ? "none" : i.includes(s) ? s : "other";
|
|
2296
2321
|
return `chatbot-file-refused:${e}:${a}`;
|
|
2297
|
-
},
|
|
2322
|
+
}, wn = ({
|
|
2298
2323
|
input: e,
|
|
2299
2324
|
onSubmitSuccess: r,
|
|
2300
2325
|
analytics: t
|
|
2301
2326
|
}) => {
|
|
2302
2327
|
var A;
|
|
2303
|
-
const s = (A =
|
|
2328
|
+
const s = (A = $.current$.value.flow) == null ? void 0 : A.data.submissions[e.key], [i, a] = me(mn(s) && s.value.length ? {
|
|
2304
2329
|
status: "ready",
|
|
2305
2330
|
files: s.value
|
|
2306
2331
|
} : {
|
|
2307
2332
|
status: "empty"
|
|
2308
|
-
}), n = ce(0), o = i.status === "ready" ? i.files : [], c = i.status === "ready" || i.status === "pending" ? i.files : [],
|
|
2333
|
+
}), n = ce(0), o = i.status === "ready" ? i.files : [], c = i.status === "ready" || i.status === "pending" ? i.files : [], h = i.status === "error" ? i.error : void 0, b = c.length - Ht, x = Gt(c), p = Vt(), {
|
|
2309
2334
|
t: m
|
|
2310
|
-
} = se(),
|
|
2335
|
+
} = se(), C = (I) => {
|
|
2311
2336
|
if (!I.length)
|
|
2312
2337
|
return {
|
|
2313
2338
|
reason: "required",
|
|
@@ -2316,10 +2341,10 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2316
2341
|
message: m("validation_file")
|
|
2317
2342
|
}
|
|
2318
2343
|
};
|
|
2319
|
-
if (!
|
|
2344
|
+
if (!qt(I, e.config.extensions))
|
|
2320
2345
|
return {
|
|
2321
2346
|
reason: "type",
|
|
2322
|
-
file: I.find((y) => !
|
|
2347
|
+
file: I.find((y) => !qt([y], e.config.extensions)),
|
|
2323
2348
|
error: {
|
|
2324
2349
|
type: "validate",
|
|
2325
2350
|
message: m("validation_file_ext", {
|
|
@@ -2327,13 +2352,13 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2327
2352
|
})
|
|
2328
2353
|
}
|
|
2329
2354
|
};
|
|
2330
|
-
if (e.config.fileSizeLimitKib &&
|
|
2355
|
+
if (e.config.fileSizeLimitKib && Gt(I) > e.config.fileSizeLimitKib)
|
|
2331
2356
|
return {
|
|
2332
2357
|
reason: "size",
|
|
2333
2358
|
error: {
|
|
2334
2359
|
type: "max",
|
|
2335
2360
|
message: m("validation_file_size", {
|
|
2336
|
-
size:
|
|
2361
|
+
size: ze(e.config.fileSizeLimitKib)
|
|
2337
2362
|
})
|
|
2338
2363
|
}
|
|
2339
2364
|
};
|
|
@@ -2347,14 +2372,14 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2347
2372
|
})
|
|
2348
2373
|
}
|
|
2349
2374
|
};
|
|
2350
|
-
},
|
|
2351
|
-
var
|
|
2375
|
+
}, E = (I, y) => {
|
|
2376
|
+
var _, V;
|
|
2352
2377
|
return t.log({
|
|
2353
2378
|
event: "INTERACTION",
|
|
2354
2379
|
properties: {
|
|
2355
|
-
tag:
|
|
2380
|
+
tag: xn(I, y, e.config.extensions)
|
|
2356
2381
|
},
|
|
2357
|
-
customProperties: (V = (
|
|
2382
|
+
customProperties: (V = (_ = $.current$.peek().flow) == null ? void 0 : _.analytics) == null ? void 0 : V.customProperties
|
|
2358
2383
|
});
|
|
2359
2384
|
};
|
|
2360
2385
|
return u("form", {
|
|
@@ -2362,7 +2387,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2362
2387
|
onSubmit: (I) => {
|
|
2363
2388
|
if (I.preventDefault(), i.status === "pending" || i.status === "error")
|
|
2364
2389
|
return;
|
|
2365
|
-
const y =
|
|
2390
|
+
const y = C(o);
|
|
2366
2391
|
y ? a({
|
|
2367
2392
|
status: "error",
|
|
2368
2393
|
error: y.error
|
|
@@ -2374,23 +2399,23 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2374
2399
|
children: [u("div", {
|
|
2375
2400
|
class: "flex items-center gap-2",
|
|
2376
2401
|
children: [u("label", {
|
|
2377
|
-
ref:
|
|
2402
|
+
ref: p,
|
|
2378
2403
|
for: "dropzone-file",
|
|
2379
2404
|
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",
|
|
2380
2405
|
children: [c.length > 0 ? u("ul", {
|
|
2381
2406
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2382
|
-
children: [c.slice(0,
|
|
2383
|
-
const [y,
|
|
2384
|
-
return u(
|
|
2407
|
+
children: [c.slice(0, Ht).map((I) => {
|
|
2408
|
+
const [y, _] = it(I.name);
|
|
2409
|
+
return u(Jt, {
|
|
2385
2410
|
class: "flex overflow-hidden",
|
|
2386
2411
|
children: [u("span", {
|
|
2387
2412
|
class: "block truncate",
|
|
2388
2413
|
children: y
|
|
2389
2414
|
}), u("span", {
|
|
2390
|
-
children:
|
|
2415
|
+
children: _
|
|
2391
2416
|
})]
|
|
2392
2417
|
});
|
|
2393
|
-
}), b > 0 ? u(
|
|
2418
|
+
}), b > 0 ? u(Jt, {
|
|
2394
2419
|
children: ["+", b, " file", b !== 1 ? "s" : ""]
|
|
2395
2420
|
}) : null]
|
|
2396
2421
|
}) : u("div", {
|
|
@@ -2418,7 +2443,7 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2418
2443
|
}), e.config.fileSizeLimitKib ? u("p", {
|
|
2419
2444
|
class: "text-neutral-10 text-xs",
|
|
2420
2445
|
children: ["(", m("file_max_size", {
|
|
2421
|
-
size:
|
|
2446
|
+
size: ze(e.config.fileSizeLimitKib)
|
|
2422
2447
|
}), ")"]
|
|
2423
2448
|
}) : null]
|
|
2424
2449
|
}), u("aside", {
|
|
@@ -2440,14 +2465,14 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2440
2465
|
role: "status",
|
|
2441
2466
|
class: Oe("text-neutral-11 flex items-center gap-1.5 text-xs", c.length === 0 && "sr-only"),
|
|
2442
2467
|
children: i.status === "pending" ? u(be, {
|
|
2443
|
-
children: [u(
|
|
2468
|
+
children: [u(Ct, {
|
|
2444
2469
|
"aria-hidden": "true",
|
|
2445
2470
|
class: "h-4 w-4"
|
|
2446
2471
|
}), m("file_preparing", {
|
|
2447
2472
|
count: c.length
|
|
2448
2473
|
})]
|
|
2449
2474
|
}) : i.status === "ready" ? u(be, {
|
|
2450
|
-
children: [
|
|
2475
|
+
children: [ze(x), " ", o.length > 1 ? "total" : "", u("span", {
|
|
2451
2476
|
class: "sr-only",
|
|
2452
2477
|
children: [". ", m("file_ready", {
|
|
2453
2478
|
count: o.length
|
|
@@ -2457,32 +2482,32 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2457
2482
|
}), u("input", {
|
|
2458
2483
|
id: "dropzone-file",
|
|
2459
2484
|
onInput: async (I) => {
|
|
2460
|
-
|
|
2485
|
+
Me(I.target instanceof HTMLInputElement);
|
|
2461
2486
|
const y = I.target.files ? Array.from(I.target.files) : [];
|
|
2462
2487
|
I.target.value = "";
|
|
2463
|
-
const [
|
|
2464
|
-
if (!
|
|
2488
|
+
const [_] = y;
|
|
2489
|
+
if (!_)
|
|
2465
2490
|
return;
|
|
2466
|
-
const V = ++n.current,
|
|
2467
|
-
if (
|
|
2468
|
-
return
|
|
2491
|
+
const V = ++n.current, M = i.status === "ready", D = y.map(Zt), G = C(D);
|
|
2492
|
+
if (G)
|
|
2493
|
+
return E(G.reason, G.file ?? _), a({
|
|
2469
2494
|
status: "error",
|
|
2470
|
-
error:
|
|
2495
|
+
error: G.error
|
|
2471
2496
|
});
|
|
2472
2497
|
a({
|
|
2473
2498
|
status: "pending",
|
|
2474
|
-
files:
|
|
2499
|
+
files: D
|
|
2475
2500
|
});
|
|
2476
2501
|
let N;
|
|
2477
2502
|
try {
|
|
2478
2503
|
const q = await Promise.all(y.map(async (L) => {
|
|
2479
2504
|
try {
|
|
2480
2505
|
return {
|
|
2481
|
-
...
|
|
2482
|
-
data: await
|
|
2506
|
+
...Zt(L),
|
|
2507
|
+
data: await yn(L)
|
|
2483
2508
|
};
|
|
2484
|
-
} catch (
|
|
2485
|
-
throw N ?? (N = L),
|
|
2509
|
+
} catch (O) {
|
|
2510
|
+
throw N ?? (N = L), O;
|
|
2486
2511
|
}
|
|
2487
2512
|
}));
|
|
2488
2513
|
n.current === V && a({
|
|
@@ -2492,11 +2517,11 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2492
2517
|
} catch {
|
|
2493
2518
|
if (n.current !== V)
|
|
2494
2519
|
return;
|
|
2495
|
-
|
|
2520
|
+
E("unreadable", N ?? _), a({
|
|
2496
2521
|
status: "error",
|
|
2497
2522
|
error: {
|
|
2498
2523
|
type: "invalid",
|
|
2499
|
-
message: m(
|
|
2524
|
+
message: m(M ? "file_read_error_replacement" : "file_read_error")
|
|
2500
2525
|
}
|
|
2501
2526
|
});
|
|
2502
2527
|
}
|
|
@@ -2510,57 +2535,57 @@ const He = tt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2510
2535
|
class: "flex h-full flex-col items-center gap-2",
|
|
2511
2536
|
children: [u(Ee, {
|
|
2512
2537
|
disabled: o.length === 0
|
|
2513
|
-
}), e.config.optional && u(
|
|
2538
|
+
}), e.config.optional && u(Fe, {
|
|
2514
2539
|
class: "relative",
|
|
2515
2540
|
onClick: () => r(null)
|
|
2516
2541
|
})]
|
|
2517
2542
|
})]
|
|
2518
2543
|
}), u(Be, {
|
|
2519
|
-
error:
|
|
2544
|
+
error: h
|
|
2520
2545
|
})]
|
|
2521
2546
|
});
|
|
2522
2547
|
};
|
|
2523
|
-
var
|
|
2524
|
-
const
|
|
2525
|
-
var
|
|
2548
|
+
var Ze = (e) => e.type === "checkbox", Ae = (e) => e instanceof Date, re = (e) => e == null;
|
|
2549
|
+
const $r = (e) => typeof e == "object";
|
|
2550
|
+
var W = (e) => !re(e) && !Array.isArray(e) && $r(e) && !Ae(e), _n = (e) => W(e) && e.target ? Ze(e.target) ? e.target.checked : e.target.value : e, kn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Cn = (e, r) => e.has(kn(r)), Sn = (e) => {
|
|
2526
2551
|
const r = e.constructor && e.constructor.prototype;
|
|
2527
|
-
return
|
|
2528
|
-
},
|
|
2529
|
-
function
|
|
2552
|
+
return W(r) && r.hasOwnProperty("isPrototypeOf");
|
|
2553
|
+
}, At = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2554
|
+
function H(e) {
|
|
2530
2555
|
if (e instanceof Date)
|
|
2531
2556
|
return new Date(e);
|
|
2532
2557
|
const r = typeof FileList < "u" && e instanceof FileList;
|
|
2533
|
-
if (
|
|
2558
|
+
if (At && (e instanceof Blob || r))
|
|
2534
2559
|
return e;
|
|
2535
2560
|
const t = Array.isArray(e);
|
|
2536
|
-
if (!t && !(
|
|
2561
|
+
if (!t && !(W(e) && Sn(e)))
|
|
2537
2562
|
return e;
|
|
2538
2563
|
const s = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2539
2564
|
for (const i in e)
|
|
2540
|
-
Object.prototype.hasOwnProperty.call(e, i) && (s[i] =
|
|
2565
|
+
Object.prototype.hasOwnProperty.call(e, i) && (s[i] = H(e[i]));
|
|
2541
2566
|
return s;
|
|
2542
2567
|
}
|
|
2543
|
-
var
|
|
2544
|
-
if (!r || !
|
|
2568
|
+
var at = (e) => /^\w*$/.test(e), z = (e) => e === void 0, Mt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Et = (e) => Mt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), S = (e, r, t) => {
|
|
2569
|
+
if (!r || !W(e))
|
|
2545
2570
|
return t;
|
|
2546
|
-
const s = (
|
|
2571
|
+
const s = (at(r) ? [r] : Et(r)).reduce((i, a) => re(i) ? i : i[a], e);
|
|
2547
2572
|
return z(s) || s === e ? z(e[r]) ? t : e[r] : s;
|
|
2548
|
-
}, ue = (e) => typeof e == "boolean", oe = (e) => typeof e == "function",
|
|
2573
|
+
}, ue = (e) => typeof e == "boolean", oe = (e) => typeof e == "function", j = (e, r, t) => {
|
|
2549
2574
|
let s = -1;
|
|
2550
|
-
const i =
|
|
2575
|
+
const i = at(r) ? [r] : Et(r), a = i.length, n = a - 1;
|
|
2551
2576
|
for (; ++s < a; ) {
|
|
2552
2577
|
const o = i[s];
|
|
2553
2578
|
let c = t;
|
|
2554
2579
|
if (s !== n) {
|
|
2555
|
-
const
|
|
2556
|
-
c =
|
|
2580
|
+
const h = e[o];
|
|
2581
|
+
c = W(h) || Array.isArray(h) ? h : isNaN(+i[s + 1]) ? {} : [];
|
|
2557
2582
|
}
|
|
2558
2583
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
2559
2584
|
return;
|
|
2560
2585
|
e[o] = c, e = e[o];
|
|
2561
2586
|
}
|
|
2562
2587
|
};
|
|
2563
|
-
const
|
|
2588
|
+
const Xt = {
|
|
2564
2589
|
BLUR: "blur",
|
|
2565
2590
|
FOCUS_OUT: "focusout",
|
|
2566
2591
|
CHANGE: "change"
|
|
@@ -2578,9 +2603,9 @@ const Zt = {
|
|
|
2578
2603
|
pattern: "pattern",
|
|
2579
2604
|
required: "required",
|
|
2580
2605
|
validate: "validate"
|
|
2581
|
-
},
|
|
2582
|
-
|
|
2583
|
-
var
|
|
2606
|
+
}, In = ee.createContext(null);
|
|
2607
|
+
In.displayName = "HookFormControlContext";
|
|
2608
|
+
var Fn = (e, r, t, s = !0) => {
|
|
2584
2609
|
const i = {
|
|
2585
2610
|
defaultValues: r._defaultValues
|
|
2586
2611
|
};
|
|
@@ -2593,12 +2618,12 @@ var kn = (e, r, t, s = !0) => {
|
|
|
2593
2618
|
});
|
|
2594
2619
|
return i;
|
|
2595
2620
|
};
|
|
2596
|
-
const
|
|
2597
|
-
var ne = (e) => typeof e == "string",
|
|
2621
|
+
const Vn = typeof window < "u" ? ee.useLayoutEffect : ee.useEffect;
|
|
2622
|
+
var ne = (e) => typeof e == "string", An = (e, r, t, s, i) => ne(e) ? (s && r.watch.add(e), S(t, e, i)) : Array.isArray(e) ? e.map((a) => (s && r.watch.add(a), S(t, a))) : (s && (r.watchAll = !0), t), wt = (e) => re(e) || !$r(e);
|
|
2598
2623
|
function Ce(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
2599
|
-
if (
|
|
2624
|
+
if (wt(e) || wt(r))
|
|
2600
2625
|
return Object.is(e, r);
|
|
2601
|
-
if (
|
|
2626
|
+
if (Ae(e) && Ae(r))
|
|
2602
2627
|
return Object.is(e.getTime(), r.getTime());
|
|
2603
2628
|
const s = Object.keys(e), i = Object.keys(r);
|
|
2604
2629
|
if (s.length !== i.length)
|
|
@@ -2612,21 +2637,21 @@ function Ce(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
2612
2637
|
return !1;
|
|
2613
2638
|
if (a !== "ref") {
|
|
2614
2639
|
const o = r[a];
|
|
2615
|
-
if (
|
|
2640
|
+
if (Ae(n) && Ae(o) || W(n) && W(o) || Array.isArray(n) && Array.isArray(o) ? !Ce(n, o, t) : !Object.is(n, o))
|
|
2616
2641
|
return !1;
|
|
2617
2642
|
}
|
|
2618
2643
|
}
|
|
2619
2644
|
return !0;
|
|
2620
2645
|
}
|
|
2621
|
-
const
|
|
2622
|
-
|
|
2623
|
-
var
|
|
2646
|
+
const Mn = ee.createContext(null);
|
|
2647
|
+
Mn.displayName = "HookFormContext";
|
|
2648
|
+
var qr = (e, r, t, s, i) => r ? {
|
|
2624
2649
|
...t[e],
|
|
2625
2650
|
types: {
|
|
2626
2651
|
...t[e] && t[e].types ? t[e].types : {},
|
|
2627
2652
|
[s]: i || !0
|
|
2628
2653
|
}
|
|
2629
|
-
} : {},
|
|
2654
|
+
} : {}, Ge = (e) => Array.isArray(e) ? e : [e], Yt = () => {
|
|
2630
2655
|
let e = [];
|
|
2631
2656
|
return {
|
|
2632
2657
|
get observers() {
|
|
@@ -2646,64 +2671,64 @@ var jr = (e, r, t, s, i) => r ? {
|
|
|
2646
2671
|
}
|
|
2647
2672
|
};
|
|
2648
2673
|
};
|
|
2649
|
-
function
|
|
2674
|
+
function Ur(e, r) {
|
|
2650
2675
|
const t = {};
|
|
2651
2676
|
for (const s in e)
|
|
2652
2677
|
if (e.hasOwnProperty(s)) {
|
|
2653
2678
|
const i = e[s], a = r[s];
|
|
2654
|
-
if (i &&
|
|
2655
|
-
const n =
|
|
2656
|
-
|
|
2679
|
+
if (i && W(i) && a) {
|
|
2680
|
+
const n = Ur(i, a);
|
|
2681
|
+
W(n) && (t[s] = n);
|
|
2657
2682
|
} else
|
|
2658
2683
|
e[s] && (t[s] = a);
|
|
2659
2684
|
}
|
|
2660
2685
|
return t;
|
|
2661
2686
|
}
|
|
2662
|
-
var te = (e) =>
|
|
2663
|
-
if (!
|
|
2687
|
+
var te = (e) => W(e) && !Object.keys(e).length, Nt = (e) => e.type === "file", et = (e) => {
|
|
2688
|
+
if (!At)
|
|
2664
2689
|
return !1;
|
|
2665
2690
|
const r = e ? e.ownerDocument : 0;
|
|
2666
2691
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
2667
|
-
},
|
|
2668
|
-
function
|
|
2692
|
+
}, zr = (e) => e.type === "select-multiple", Lt = (e) => e.type === "radio", En = (e) => Lt(e) || Ze(e), vt = (e) => et(e) && e.isConnected;
|
|
2693
|
+
function Nn(e, r) {
|
|
2669
2694
|
const t = r.slice(0, -1).length;
|
|
2670
2695
|
let s = 0;
|
|
2671
2696
|
for (; s < t; )
|
|
2672
2697
|
e = z(e) ? s++ : e[r[s++]];
|
|
2673
2698
|
return e;
|
|
2674
2699
|
}
|
|
2675
|
-
function
|
|
2700
|
+
function Ln(e) {
|
|
2676
2701
|
for (const r in e)
|
|
2677
2702
|
if (e.hasOwnProperty(r) && !z(e[r]))
|
|
2678
2703
|
return !1;
|
|
2679
2704
|
return !0;
|
|
2680
2705
|
}
|
|
2681
|
-
function
|
|
2682
|
-
const t = Array.isArray(r) ? r :
|
|
2683
|
-
return s && delete s[a], i !== 0 && (
|
|
2706
|
+
function K(e, r) {
|
|
2707
|
+
const t = Array.isArray(r) ? r : at(r) ? [r] : Et(r), s = t.length === 1 ? e : Nn(e, t), i = t.length - 1, a = t[i];
|
|
2708
|
+
return s && delete s[a], i !== 0 && (W(s) && te(s) || Array.isArray(s) && Ln(s)) && K(e, t.slice(0, -1)), e;
|
|
2684
2709
|
}
|
|
2685
|
-
var
|
|
2710
|
+
var Tn = (e) => {
|
|
2686
2711
|
for (const r in e)
|
|
2687
2712
|
if (oe(e[r]))
|
|
2688
2713
|
return !0;
|
|
2689
2714
|
return !1;
|
|
2690
2715
|
};
|
|
2691
|
-
function
|
|
2692
|
-
return Array.isArray(e) ||
|
|
2716
|
+
function Kr(e) {
|
|
2717
|
+
return Array.isArray(e) || W(e) && !Tn(e);
|
|
2693
2718
|
}
|
|
2694
|
-
function
|
|
2719
|
+
function _t(e, r = {}) {
|
|
2695
2720
|
for (const t in e) {
|
|
2696
2721
|
const s = e[t];
|
|
2697
|
-
|
|
2722
|
+
Kr(s) ? (r[t] = Array.isArray(s) ? [] : {}, _t(s, r[t])) : z(s) || (r[t] = !0);
|
|
2698
2723
|
}
|
|
2699
2724
|
return r;
|
|
2700
2725
|
}
|
|
2701
2726
|
function Le(e, r, t) {
|
|
2702
|
-
t || (t =
|
|
2727
|
+
t || (t = _t(r));
|
|
2703
2728
|
for (const s in e) {
|
|
2704
2729
|
const i = e[s];
|
|
2705
|
-
if (
|
|
2706
|
-
z(r) ||
|
|
2730
|
+
if (Kr(i))
|
|
2731
|
+
z(r) || wt(t[s]) ? t[s] = _t(i, Array.isArray(i) ? [] : {}) : Le(i, re(r) ? {} : r[s], t[s]);
|
|
2707
2732
|
else {
|
|
2708
2733
|
const a = r[s];
|
|
2709
2734
|
t[s] = !Ce(i, a);
|
|
@@ -2711,11 +2736,11 @@ function Le(e, r, t) {
|
|
|
2711
2736
|
}
|
|
2712
2737
|
return t;
|
|
2713
2738
|
}
|
|
2714
|
-
const
|
|
2739
|
+
const Qt = {
|
|
2715
2740
|
value: !1,
|
|
2716
2741
|
isValid: !1
|
|
2717
|
-
},
|
|
2718
|
-
var
|
|
2742
|
+
}, er = { value: !0, isValid: !0 };
|
|
2743
|
+
var Wr = (e) => {
|
|
2719
2744
|
if (Array.isArray(e)) {
|
|
2720
2745
|
if (e.length > 1) {
|
|
2721
2746
|
const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
|
|
@@ -2723,28 +2748,28 @@ var Ur = (e) => {
|
|
|
2723
2748
|
}
|
|
2724
2749
|
return e[0].checked && !e[0].disabled ? (
|
|
2725
2750
|
// @ts-expect-error expected to work in the browser
|
|
2726
|
-
e[0].attributes && !z(e[0].attributes.value) ? z(e[0].value) || e[0].value === "" ?
|
|
2727
|
-
) :
|
|
2751
|
+
e[0].attributes && !z(e[0].attributes.value) ? z(e[0].value) || e[0].value === "" ? er : { value: e[0].value, isValid: !0 } : er
|
|
2752
|
+
) : Qt;
|
|
2728
2753
|
}
|
|
2729
|
-
return
|
|
2730
|
-
},
|
|
2731
|
-
const
|
|
2754
|
+
return Qt;
|
|
2755
|
+
}, Gr = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: s }) => z(e) ? e : r ? e === "" ? NaN : e && +e : t && ne(e) ? new Date(e) : s ? s(e) : e;
|
|
2756
|
+
const tr = {
|
|
2732
2757
|
isValid: !1,
|
|
2733
2758
|
value: null
|
|
2734
2759
|
};
|
|
2735
|
-
var
|
|
2760
|
+
var Hr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
2736
2761
|
isValid: !0,
|
|
2737
2762
|
value: t.value
|
|
2738
|
-
} : r,
|
|
2739
|
-
function
|
|
2763
|
+
} : r, tr) : tr;
|
|
2764
|
+
function rr(e) {
|
|
2740
2765
|
const r = e.ref;
|
|
2741
|
-
return
|
|
2766
|
+
return Nt(r) ? r.files : Lt(r) ? Hr(e.refs).value : zr(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Ze(r) ? Wr(e.refs).value : Gr(z(r.value) ? e.ref.value : r.value, e);
|
|
2742
2767
|
}
|
|
2743
|
-
var
|
|
2768
|
+
var Dn = (e, r, t, s) => {
|
|
2744
2769
|
const i = {};
|
|
2745
2770
|
for (const a of e) {
|
|
2746
|
-
const n =
|
|
2747
|
-
n &&
|
|
2771
|
+
const n = S(r, a);
|
|
2772
|
+
n && j(i, a, n._f);
|
|
2748
2773
|
}
|
|
2749
2774
|
return {
|
|
2750
2775
|
criteriaMode: t,
|
|
@@ -2752,18 +2777,18 @@ var Mn = (e, r, t, s) => {
|
|
|
2752
2777
|
fields: i,
|
|
2753
2778
|
shouldUseNativeValidation: s
|
|
2754
2779
|
};
|
|
2755
|
-
},
|
|
2780
|
+
}, tt = (e) => e instanceof RegExp, $e = (e) => z(e) ? e : tt(e) ? e.source : W(e) ? tt(e.value) ? e.value.source : e.value : e, sr = (e) => ({
|
|
2756
2781
|
isOnSubmit: !e || e === le.onSubmit,
|
|
2757
2782
|
isOnBlur: e === le.onBlur,
|
|
2758
2783
|
isOnChange: e === le.onChange,
|
|
2759
2784
|
isOnAll: e === le.all,
|
|
2760
2785
|
isOnTouch: e === le.onTouched
|
|
2761
2786
|
});
|
|
2762
|
-
const
|
|
2763
|
-
var
|
|
2764
|
-
const
|
|
2787
|
+
const nr = "AsyncFunction";
|
|
2788
|
+
var On = (e) => !!e && !!e.validate && !!(oe(e.validate) && e.validate.constructor.name === nr || W(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === nr)), Rn = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), ir = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
|
|
2789
|
+
const He = (e, r, t, s) => {
|
|
2765
2790
|
for (const i of t || Object.keys(e)) {
|
|
2766
|
-
const a =
|
|
2791
|
+
const a = S(e, i);
|
|
2767
2792
|
if (a) {
|
|
2768
2793
|
const { _f: n, ...o } = a;
|
|
2769
2794
|
if (n) {
|
|
@@ -2771,23 +2796,23 @@ const Ge = (e, r, t, s) => {
|
|
|
2771
2796
|
return !0;
|
|
2772
2797
|
if (n.ref && r(n.ref, n.name) && !s)
|
|
2773
2798
|
return !0;
|
|
2774
|
-
if (
|
|
2799
|
+
if (He(o, r))
|
|
2775
2800
|
break;
|
|
2776
|
-
} else if (
|
|
2801
|
+
} else if (W(o) && He(o, r))
|
|
2777
2802
|
break;
|
|
2778
2803
|
}
|
|
2779
2804
|
}
|
|
2780
2805
|
};
|
|
2781
|
-
function
|
|
2782
|
-
const s =
|
|
2783
|
-
if (s ||
|
|
2806
|
+
function ar(e, r, t) {
|
|
2807
|
+
const s = S(e, t);
|
|
2808
|
+
if (s || at(t))
|
|
2784
2809
|
return {
|
|
2785
2810
|
error: s,
|
|
2786
2811
|
name: t
|
|
2787
2812
|
};
|
|
2788
2813
|
const i = t.split(".");
|
|
2789
2814
|
for (; i.length; ) {
|
|
2790
|
-
const a = i.join("."), n =
|
|
2815
|
+
const a = i.join("."), n = S(r, a), o = S(e, a);
|
|
2791
2816
|
if (n && !Array.isArray(n) && t !== a)
|
|
2792
2817
|
return { name: t };
|
|
2793
2818
|
if (o && o.type)
|
|
@@ -2806,15 +2831,15 @@ function ir(e, r, t) {
|
|
|
2806
2831
|
name: t
|
|
2807
2832
|
};
|
|
2808
2833
|
}
|
|
2809
|
-
var
|
|
2834
|
+
var Bn = (e, r, t, s) => {
|
|
2810
2835
|
t(e);
|
|
2811
2836
|
const { name: i, ...a } = e;
|
|
2812
2837
|
return te(a) || Object.keys(a).length >= Object.keys(r).length || Object.keys(a).find((n) => r[n] === (!s || le.all));
|
|
2813
|
-
},
|
|
2814
|
-
const s =
|
|
2815
|
-
return
|
|
2838
|
+
}, Pn = (e, r, t) => !e || !r || e === r || Ge(e).some((s) => s && (t ? s === r : s.startsWith(r) || r.startsWith(s))), jn = (e, r, t, s, i) => i.isOnAll ? !1 : !t && i.isOnTouch ? !(r || e) : (t ? s.isOnBlur : i.isOnBlur) ? !e : (t ? s.isOnChange : i.isOnChange) ? e : !0, $n = (e, r) => !Mt(S(e, r)).length && K(e, r), qn = (e, r, t) => {
|
|
2839
|
+
const s = Ge(S(e, t));
|
|
2840
|
+
return j(s, "root", r[t]), j(e, t, s), e;
|
|
2816
2841
|
};
|
|
2817
|
-
function
|
|
2842
|
+
function or(e, r, t = "validate") {
|
|
2818
2843
|
if (ne(e) || Array.isArray(e) && e.every(ne) || ue(e) && !e)
|
|
2819
2844
|
return {
|
|
2820
2845
|
type: t,
|
|
@@ -2822,98 +2847,98 @@ function ar(e, r, t = "validate") {
|
|
|
2822
2847
|
ref: r
|
|
2823
2848
|
};
|
|
2824
2849
|
}
|
|
2825
|
-
var Ne = (e) =>
|
|
2850
|
+
var Ne = (e) => W(e) && !tt(e) ? e : {
|
|
2826
2851
|
value: e,
|
|
2827
2852
|
message: ""
|
|
2828
|
-
},
|
|
2829
|
-
const { ref: n, refs: o, required: c, maxLength:
|
|
2830
|
-
if (!I || r.has(
|
|
2853
|
+
}, lr = async (e, r, t, s, i, a) => {
|
|
2854
|
+
const { ref: n, refs: o, required: c, maxLength: h, minLength: b, min: x, max: p, pattern: m, validate: C, name: E, valueAsNumber: A, mount: I } = e._f, y = S(t, E);
|
|
2855
|
+
if (!I || r.has(E))
|
|
2831
2856
|
return {};
|
|
2832
|
-
const
|
|
2833
|
-
i &&
|
|
2834
|
-
},
|
|
2835
|
-
const
|
|
2836
|
-
E
|
|
2837
|
-
type: w ?
|
|
2838
|
-
message:
|
|
2857
|
+
const _ = o ? o[0] : n, V = (w) => {
|
|
2858
|
+
i && _.reportValidity && (_.setCustomValidity(ue(w) ? "" : w || ""), _.reportValidity());
|
|
2859
|
+
}, M = {}, D = Lt(n), G = Ze(n), N = D || G, q = (A || Nt(n)) && z(n.value) && z(y) || et(n) && n.value === "" || y === "" || Array.isArray(y) && !y.length, L = qr.bind(null, E, s, M), O = (w, T, U, Z = ye.maxLength, X = ye.minLength) => {
|
|
2860
|
+
const J = w ? T : U;
|
|
2861
|
+
M[E] = {
|
|
2862
|
+
type: w ? Z : X,
|
|
2863
|
+
message: J,
|
|
2839
2864
|
ref: n,
|
|
2840
|
-
...L(w ?
|
|
2865
|
+
...L(w ? Z : X, J)
|
|
2841
2866
|
};
|
|
2842
2867
|
};
|
|
2843
|
-
if (a ? !Array.isArray(y) || !y.length : c && (!N && (q || re(y)) || ue(y) && !y ||
|
|
2844
|
-
const { value: w, message:
|
|
2845
|
-
if (w && (E
|
|
2868
|
+
if (a ? !Array.isArray(y) || !y.length : c && (!N && (q || re(y)) || ue(y) && !y || G && !Wr(o).isValid || D && !Hr(o).isValid)) {
|
|
2869
|
+
const { value: w, message: T } = ne(c) ? { value: !!c, message: c } : Ne(c);
|
|
2870
|
+
if (w && (M[E] = {
|
|
2846
2871
|
type: ye.required,
|
|
2847
|
-
message:
|
|
2848
|
-
ref:
|
|
2849
|
-
...L(ye.required,
|
|
2872
|
+
message: T,
|
|
2873
|
+
ref: _,
|
|
2874
|
+
...L(ye.required, T)
|
|
2850
2875
|
}, !s))
|
|
2851
|
-
return V(
|
|
2876
|
+
return V(T), M;
|
|
2852
2877
|
}
|
|
2853
|
-
if (!q && (!re(x) || !re(
|
|
2854
|
-
let w,
|
|
2855
|
-
const U = Ne(
|
|
2878
|
+
if (!q && (!re(x) || !re(p))) {
|
|
2879
|
+
let w, T;
|
|
2880
|
+
const U = Ne(p), Z = Ne(x);
|
|
2856
2881
|
if (!re(y) && !isNaN(y)) {
|
|
2857
|
-
const
|
|
2858
|
-
re(U.value) || (w =
|
|
2882
|
+
const X = n.valueAsNumber || y && +y;
|
|
2883
|
+
re(U.value) || (w = X > U.value), re(Z.value) || (T = X < Z.value);
|
|
2859
2884
|
} else {
|
|
2860
|
-
const
|
|
2861
|
-
ne(U.value) && y && (w = ve ?
|
|
2885
|
+
const X = n.valueAsDate || new Date(y), J = (we) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + we), ve = n.type == "time", xe = n.type == "week";
|
|
2886
|
+
ne(U.value) && y && (w = ve ? J(y) > J(U.value) : xe ? y > U.value : X > new Date(U.value)), ne(Z.value) && y && (T = ve ? J(y) < J(Z.value) : xe ? y < Z.value : X < new Date(Z.value));
|
|
2862
2887
|
}
|
|
2863
|
-
if ((w ||
|
|
2864
|
-
return V(E
|
|
2888
|
+
if ((w || T) && (O(!!w, U.message, Z.message, ye.max, ye.min), !s))
|
|
2889
|
+
return V(M[E].message), M;
|
|
2865
2890
|
}
|
|
2866
|
-
if ((
|
|
2867
|
-
const w = Ne(
|
|
2868
|
-
if ((U ||
|
|
2869
|
-
return V(E
|
|
2891
|
+
if ((h || b) && !q && (ne(y) || a && Array.isArray(y))) {
|
|
2892
|
+
const w = Ne(h), T = Ne(b), U = !re(w.value) && y.length > +w.value, Z = !re(T.value) && y.length < +T.value;
|
|
2893
|
+
if ((U || Z) && (O(U, w.message, T.message), !s))
|
|
2894
|
+
return V(M[E].message), M;
|
|
2870
2895
|
}
|
|
2871
2896
|
if (m && !q && ne(y)) {
|
|
2872
|
-
const { value: w, message:
|
|
2873
|
-
if (
|
|
2897
|
+
const { value: w, message: T } = Ne(m);
|
|
2898
|
+
if (tt(w) && !y.match(w) && (M[E] = {
|
|
2874
2899
|
type: ye.pattern,
|
|
2875
|
-
message:
|
|
2900
|
+
message: T,
|
|
2876
2901
|
ref: n,
|
|
2877
|
-
...L(ye.pattern,
|
|
2902
|
+
...L(ye.pattern, T)
|
|
2878
2903
|
}, !s))
|
|
2879
|
-
return V(
|
|
2904
|
+
return V(T), M;
|
|
2880
2905
|
}
|
|
2881
|
-
if (
|
|
2882
|
-
if (oe(
|
|
2883
|
-
const w = await
|
|
2884
|
-
if (
|
|
2885
|
-
...
|
|
2886
|
-
...L(ye.validate,
|
|
2906
|
+
if (C) {
|
|
2907
|
+
if (oe(C)) {
|
|
2908
|
+
const w = await C(y, t), T = or(w, _);
|
|
2909
|
+
if (T && (M[E] = {
|
|
2910
|
+
...T,
|
|
2911
|
+
...L(ye.validate, T.message)
|
|
2887
2912
|
}, !s))
|
|
2888
|
-
return V(
|
|
2889
|
-
} else if (
|
|
2913
|
+
return V(T.message), M;
|
|
2914
|
+
} else if (W(C)) {
|
|
2890
2915
|
let w = {};
|
|
2891
|
-
for (const
|
|
2916
|
+
for (const T in C) {
|
|
2892
2917
|
if (!te(w) && !s)
|
|
2893
2918
|
break;
|
|
2894
|
-
const U =
|
|
2919
|
+
const U = or(await C[T](y, t), _, T);
|
|
2895
2920
|
U && (w = {
|
|
2896
2921
|
...U,
|
|
2897
|
-
...L(
|
|
2898
|
-
}, V(U.message), s && (E
|
|
2922
|
+
...L(T, U.message)
|
|
2923
|
+
}, V(U.message), s && (M[E] = w));
|
|
2899
2924
|
}
|
|
2900
|
-
if (!te(w) && (E
|
|
2901
|
-
ref:
|
|
2925
|
+
if (!te(w) && (M[E] = {
|
|
2926
|
+
ref: _,
|
|
2902
2927
|
...w
|
|
2903
2928
|
}, !s))
|
|
2904
|
-
return
|
|
2929
|
+
return M;
|
|
2905
2930
|
}
|
|
2906
2931
|
}
|
|
2907
|
-
return V(!0),
|
|
2932
|
+
return V(!0), M;
|
|
2908
2933
|
};
|
|
2909
|
-
const
|
|
2934
|
+
const Un = {
|
|
2910
2935
|
mode: le.onSubmit,
|
|
2911
2936
|
reValidateMode: le.onChange,
|
|
2912
2937
|
shouldFocusError: !0
|
|
2913
2938
|
};
|
|
2914
|
-
function
|
|
2939
|
+
function zn(e = {}) {
|
|
2915
2940
|
let r = {
|
|
2916
|
-
...
|
|
2941
|
+
...Un,
|
|
2917
2942
|
...e
|
|
2918
2943
|
}, t = {
|
|
2919
2944
|
submitCount: 0,
|
|
@@ -2930,7 +2955,7 @@ function Pn(e = {}) {
|
|
|
2930
2955
|
validatingFields: {},
|
|
2931
2956
|
errors: r.errors || {},
|
|
2932
2957
|
disabled: r.disabled || !1
|
|
2933
|
-
}, s = {}, i =
|
|
2958
|
+
}, s = {}, i = W(r.defaultValues) || W(r.values) ? H(r.defaultValues || r.values) || {} : {}, a = r.shouldUnregister ? {} : H(i), n = {
|
|
2934
2959
|
action: !1,
|
|
2935
2960
|
mount: !1,
|
|
2936
2961
|
watch: !1,
|
|
@@ -2941,7 +2966,7 @@ function Pn(e = {}) {
|
|
|
2941
2966
|
unMount: /* @__PURE__ */ new Set(),
|
|
2942
2967
|
array: /* @__PURE__ */ new Set(),
|
|
2943
2968
|
watch: /* @__PURE__ */ new Set()
|
|
2944
|
-
}, c,
|
|
2969
|
+
}, c, h = 0;
|
|
2945
2970
|
const b = {
|
|
2946
2971
|
isDirty: !1,
|
|
2947
2972
|
dirtyFields: !1,
|
|
@@ -2953,43 +2978,43 @@ function Pn(e = {}) {
|
|
|
2953
2978
|
}, x = {
|
|
2954
2979
|
...b
|
|
2955
2980
|
};
|
|
2956
|
-
let
|
|
2981
|
+
let p = {
|
|
2957
2982
|
...x
|
|
2958
2983
|
};
|
|
2959
2984
|
const m = {
|
|
2960
|
-
array:
|
|
2961
|
-
state:
|
|
2962
|
-
},
|
|
2963
|
-
clearTimeout(
|
|
2985
|
+
array: Yt(),
|
|
2986
|
+
state: Yt()
|
|
2987
|
+
}, C = r.criteriaMode === le.all, E = (l) => (d) => {
|
|
2988
|
+
clearTimeout(h), h = setTimeout(l, d);
|
|
2964
2989
|
}, A = async (l) => {
|
|
2965
|
-
if (!n.keepIsValid && !r.disabled && (x.isValid ||
|
|
2990
|
+
if (!n.keepIsValid && !r.disabled && (x.isValid || p.isValid || l)) {
|
|
2966
2991
|
let d;
|
|
2967
2992
|
r.resolver ? (d = te((await N()).errors), I()) : d = await L(s, !0), d !== t.isValid && m.state.next({
|
|
2968
2993
|
isValid: d
|
|
2969
2994
|
});
|
|
2970
2995
|
}
|
|
2971
2996
|
}, I = (l, d) => {
|
|
2972
|
-
!r.disabled && (x.isValidating || x.validatingFields ||
|
|
2973
|
-
f && (d ?
|
|
2997
|
+
!r.disabled && (x.isValidating || x.validatingFields || p.isValidating || p.validatingFields) && ((l || Array.from(o.mount)).forEach((f) => {
|
|
2998
|
+
f && (d ? j(t.validatingFields, f, d) : K(t.validatingFields, f));
|
|
2974
2999
|
}), m.state.next({
|
|
2975
3000
|
validatingFields: t.validatingFields,
|
|
2976
3001
|
isValidating: !te(t.validatingFields)
|
|
2977
3002
|
}));
|
|
2978
|
-
}, y = (l, d = [], f,
|
|
2979
|
-
if (
|
|
2980
|
-
if (n.action = !0, g && Array.isArray(
|
|
2981
|
-
const F = f(
|
|
2982
|
-
v &&
|
|
3003
|
+
}, y = (l, d = [], f, k, v = !0, g = !0) => {
|
|
3004
|
+
if (k && f && !r.disabled) {
|
|
3005
|
+
if (n.action = !0, g && Array.isArray(S(s, l))) {
|
|
3006
|
+
const F = f(S(s, l), k.argA, k.argB);
|
|
3007
|
+
v && j(s, l, F);
|
|
2983
3008
|
}
|
|
2984
|
-
if (g && Array.isArray(
|
|
2985
|
-
const F = f(
|
|
2986
|
-
v &&
|
|
3009
|
+
if (g && Array.isArray(S(t.errors, l))) {
|
|
3010
|
+
const F = f(S(t.errors, l), k.argA, k.argB);
|
|
3011
|
+
v && j(t.errors, l, F), $n(t.errors, l);
|
|
2987
3012
|
}
|
|
2988
|
-
if ((x.touchedFields ||
|
|
2989
|
-
const F = f(
|
|
2990
|
-
v &&
|
|
3013
|
+
if ((x.touchedFields || p.touchedFields) && g && Array.isArray(S(t.touchedFields, l))) {
|
|
3014
|
+
const F = f(S(t.touchedFields, l), k.argA, k.argB);
|
|
3015
|
+
v && j(t.touchedFields, l, F);
|
|
2991
3016
|
}
|
|
2992
|
-
(x.dirtyFields ||
|
|
3017
|
+
(x.dirtyFields || p.dirtyFields) && (t.dirtyFields = Le(i, a)), m.state.next({
|
|
2993
3018
|
name: l,
|
|
2994
3019
|
isDirty: w(l, d),
|
|
2995
3020
|
dirtyFields: t.dirtyFields,
|
|
@@ -2997,9 +3022,9 @@ function Pn(e = {}) {
|
|
|
2997
3022
|
isValid: t.isValid
|
|
2998
3023
|
});
|
|
2999
3024
|
} else
|
|
3000
|
-
|
|
3001
|
-
},
|
|
3002
|
-
|
|
3025
|
+
j(a, l, d);
|
|
3026
|
+
}, _ = (l, d) => {
|
|
3027
|
+
j(t.errors, l, d), m.state.next({
|
|
3003
3028
|
errors: t.errors
|
|
3004
3029
|
});
|
|
3005
3030
|
}, V = (l) => {
|
|
@@ -3007,35 +3032,35 @@ function Pn(e = {}) {
|
|
|
3007
3032
|
errors: t.errors,
|
|
3008
3033
|
isValid: !1
|
|
3009
3034
|
});
|
|
3010
|
-
},
|
|
3011
|
-
const v =
|
|
3035
|
+
}, M = (l, d, f, k) => {
|
|
3036
|
+
const v = S(s, l);
|
|
3012
3037
|
if (v) {
|
|
3013
|
-
const g =
|
|
3014
|
-
z(g) ||
|
|
3038
|
+
const g = S(a, l, z(f) ? S(i, l) : f);
|
|
3039
|
+
z(g) || k && k.defaultChecked || d ? j(a, l, d ? g : rr(v._f)) : Z(l, g), n.mount && !n.action && A();
|
|
3015
3040
|
}
|
|
3016
|
-
},
|
|
3041
|
+
}, D = (l, d, f, k, v) => {
|
|
3017
3042
|
let g = !1, F = !1;
|
|
3018
|
-
const
|
|
3043
|
+
const R = {
|
|
3019
3044
|
name: l
|
|
3020
3045
|
};
|
|
3021
3046
|
if (!r.disabled) {
|
|
3022
|
-
if (!f ||
|
|
3023
|
-
(x.isDirty ||
|
|
3024
|
-
const
|
|
3025
|
-
F = !!
|
|
3047
|
+
if (!f || k) {
|
|
3048
|
+
(x.isDirty || p.isDirty) && (F = t.isDirty, t.isDirty = R.isDirty = w(), g = F !== R.isDirty);
|
|
3049
|
+
const B = Ce(S(i, l), d);
|
|
3050
|
+
F = !!S(t.dirtyFields, l), B ? K(t.dirtyFields, l) : j(t.dirtyFields, l, !0), R.dirtyFields = t.dirtyFields, g = g || (x.dirtyFields || p.dirtyFields) && F !== !B;
|
|
3026
3051
|
}
|
|
3027
3052
|
if (f) {
|
|
3028
|
-
const
|
|
3029
|
-
|
|
3053
|
+
const B = S(t.touchedFields, l);
|
|
3054
|
+
B || (j(t.touchedFields, l, f), R.touchedFields = t.touchedFields, g = g || (x.touchedFields || p.touchedFields) && B !== f);
|
|
3030
3055
|
}
|
|
3031
|
-
g && v && m.state.next(
|
|
3056
|
+
g && v && m.state.next(R);
|
|
3032
3057
|
}
|
|
3033
|
-
return g ?
|
|
3034
|
-
},
|
|
3035
|
-
const v =
|
|
3036
|
-
if (r.delayError && f ? (c =
|
|
3058
|
+
return g ? R : {};
|
|
3059
|
+
}, G = (l, d, f, k) => {
|
|
3060
|
+
const v = S(t.errors, l), g = (x.isValid || p.isValid) && ue(d) && t.isValid !== d;
|
|
3061
|
+
if (r.delayError && f ? (c = E(() => _(l, f)), c(r.delayError)) : (clearTimeout(h), c = null, f ? j(t.errors, l, f) : K(t.errors, l)), (f ? !Ce(v, f) : v) || !te(k) || g) {
|
|
3037
3062
|
const F = {
|
|
3038
|
-
...
|
|
3063
|
+
...k,
|
|
3039
3064
|
...g && ue(d) ? { isValid: d } : {},
|
|
3040
3065
|
errors: t.errors,
|
|
3041
3066
|
name: l
|
|
@@ -3045,12 +3070,12 @@ function Pn(e = {}) {
|
|
|
3045
3070
|
...F
|
|
3046
3071
|
}, m.state.next(F);
|
|
3047
3072
|
}
|
|
3048
|
-
}, N = async (l) => (I(l, !0), await r.resolver(a, r.context,
|
|
3073
|
+
}, N = async (l) => (I(l, !0), await r.resolver(a, r.context, Dn(l || o.mount, s, r.criteriaMode, r.shouldUseNativeValidation))), q = async (l) => {
|
|
3049
3074
|
const { errors: d } = await N(l);
|
|
3050
3075
|
if (I(l), l)
|
|
3051
3076
|
for (const f of l) {
|
|
3052
|
-
const
|
|
3053
|
-
|
|
3077
|
+
const k = S(d, f);
|
|
3078
|
+
k ? j(t.errors, f, k) : K(t.errors, f);
|
|
3054
3079
|
}
|
|
3055
3080
|
else
|
|
3056
3081
|
t.errors = d;
|
|
@@ -3058,128 +3083,128 @@ function Pn(e = {}) {
|
|
|
3058
3083
|
}, L = async (l, d, f = {
|
|
3059
3084
|
valid: !0
|
|
3060
3085
|
}) => {
|
|
3061
|
-
for (const
|
|
3062
|
-
const v = l[
|
|
3086
|
+
for (const k in l) {
|
|
3087
|
+
const v = l[k];
|
|
3063
3088
|
if (v) {
|
|
3064
3089
|
const { _f: g, ...F } = v;
|
|
3065
3090
|
if (g) {
|
|
3066
|
-
const
|
|
3067
|
-
|
|
3068
|
-
const Q = await
|
|
3069
|
-
if (
|
|
3091
|
+
const R = o.array.has(g.name), B = v._f && On(v._f);
|
|
3092
|
+
B && x.validatingFields && I([g.name], !0);
|
|
3093
|
+
const Q = await lr(v, o.disabled, a, C, r.shouldUseNativeValidation && !d, R);
|
|
3094
|
+
if (B && x.validatingFields && I([g.name]), Q[g.name] && (f.valid = !1, d || e.shouldUseNativeValidation))
|
|
3070
3095
|
break;
|
|
3071
|
-
!d && (
|
|
3096
|
+
!d && (S(Q, g.name) ? R ? qn(t.errors, Q, g.name) : j(t.errors, g.name, Q[g.name]) : K(t.errors, g.name));
|
|
3072
3097
|
}
|
|
3073
3098
|
!te(F) && await L(F, d, f);
|
|
3074
3099
|
}
|
|
3075
3100
|
}
|
|
3076
3101
|
return f.valid;
|
|
3077
|
-
},
|
|
3102
|
+
}, O = () => {
|
|
3078
3103
|
for (const l of o.unMount) {
|
|
3079
|
-
const d =
|
|
3080
|
-
d && (d._f.refs ? d._f.refs.every((f) => !
|
|
3104
|
+
const d = S(s, l);
|
|
3105
|
+
d && (d._f.refs ? d._f.refs.every((f) => !vt(f)) : !vt(d._f.ref)) && ct(l);
|
|
3081
3106
|
}
|
|
3082
3107
|
o.unMount = /* @__PURE__ */ new Set();
|
|
3083
|
-
}, w = (l, d) => !r.disabled && (l && d &&
|
|
3108
|
+
}, w = (l, d) => !r.disabled && (l && d && j(a, l, d), !Ce(Pe(), i)), T = (l, d, f) => An(l, o, {
|
|
3084
3109
|
...n.mount ? a : z(d) ? i : ne(l) ? { [l]: d } : d
|
|
3085
|
-
}, f, d), U = (l) =>
|
|
3086
|
-
const
|
|
3110
|
+
}, f, d), U = (l) => Mt(S(n.mount ? a : i, l, r.shouldUnregister ? S(i, l, []) : [])), Z = (l, d, f = {}) => {
|
|
3111
|
+
const k = S(s, l);
|
|
3087
3112
|
let v = d;
|
|
3088
|
-
if (
|
|
3089
|
-
const g =
|
|
3090
|
-
g && (!g.disabled &&
|
|
3091
|
-
(!F.defaultChecked || !F.disabled) && (Array.isArray(v) ? F.checked = !!v.find((
|
|
3092
|
-
}) : g.refs.forEach((F) => F.checked = F.value === v) :
|
|
3113
|
+
if (k) {
|
|
3114
|
+
const g = k._f;
|
|
3115
|
+
g && (!g.disabled && j(a, l, Gr(d, g)), v = et(g.ref) && re(d) ? "" : d, zr(g.ref) ? [...g.ref.options].forEach((F) => F.selected = v.includes(F.value)) : g.refs ? Ze(g.ref) ? g.refs.forEach((F) => {
|
|
3116
|
+
(!F.defaultChecked || !F.disabled) && (Array.isArray(v) ? F.checked = !!v.find((R) => R === F.value) : F.checked = v === F.value || !!v);
|
|
3117
|
+
}) : g.refs.forEach((F) => F.checked = F.value === v) : Nt(g.ref) ? g.ref.value = "" : (g.ref.value = v, g.ref.type || m.state.next({
|
|
3093
3118
|
name: l,
|
|
3094
|
-
values:
|
|
3119
|
+
values: H(a)
|
|
3095
3120
|
})));
|
|
3096
3121
|
}
|
|
3097
|
-
(f.shouldDirty || f.shouldTouch) &&
|
|
3098
|
-
},
|
|
3099
|
-
for (const
|
|
3100
|
-
if (!d.hasOwnProperty(
|
|
3122
|
+
(f.shouldDirty || f.shouldTouch) && D(l, v, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && we(l);
|
|
3123
|
+
}, X = (l, d, f) => {
|
|
3124
|
+
for (const k in d) {
|
|
3125
|
+
if (!d.hasOwnProperty(k))
|
|
3101
3126
|
return;
|
|
3102
|
-
const v = d[
|
|
3103
|
-
(o.array.has(l) ||
|
|
3127
|
+
const v = d[k], g = l + "." + k, F = S(s, g);
|
|
3128
|
+
(o.array.has(l) || W(v) || F && !F._f) && !Ae(v) ? X(g, v, f) : Z(g, v, f);
|
|
3104
3129
|
}
|
|
3105
|
-
},
|
|
3106
|
-
const
|
|
3107
|
-
|
|
3130
|
+
}, J = (l, d, f = {}) => {
|
|
3131
|
+
const k = S(s, l), v = o.array.has(l), g = H(d);
|
|
3132
|
+
j(a, l, g), v ? (m.array.next({
|
|
3108
3133
|
name: l,
|
|
3109
|
-
values:
|
|
3110
|
-
}), (x.isDirty || x.dirtyFields ||
|
|
3134
|
+
values: H(a)
|
|
3135
|
+
}), (x.isDirty || x.dirtyFields || p.isDirty || p.dirtyFields) && f.shouldDirty && m.state.next({
|
|
3111
3136
|
name: l,
|
|
3112
3137
|
dirtyFields: Le(i, a),
|
|
3113
3138
|
isDirty: w(l, g)
|
|
3114
|
-
})) :
|
|
3139
|
+
})) : k && !k._f && !re(g) ? X(l, g, f) : Z(l, g, f), ir(l, o) ? m.state.next({
|
|
3115
3140
|
...t,
|
|
3116
3141
|
name: l,
|
|
3117
|
-
values:
|
|
3142
|
+
values: H(a)
|
|
3118
3143
|
}) : m.state.next({
|
|
3119
3144
|
name: n.mount ? l : void 0,
|
|
3120
|
-
values:
|
|
3145
|
+
values: H(a)
|
|
3121
3146
|
});
|
|
3122
3147
|
}, ve = async (l) => {
|
|
3123
3148
|
n.mount = !0;
|
|
3124
3149
|
const d = l.target;
|
|
3125
|
-
let f = d.name,
|
|
3126
|
-
const v =
|
|
3127
|
-
|
|
3128
|
-
}, F =
|
|
3150
|
+
let f = d.name, k = !0;
|
|
3151
|
+
const v = S(s, f), g = (B) => {
|
|
3152
|
+
k = Number.isNaN(B) || Ae(B) && isNaN(B.getTime()) || Ce(B, S(a, f, B));
|
|
3153
|
+
}, F = sr(r.mode), R = sr(r.reValidateMode);
|
|
3129
3154
|
if (v) {
|
|
3130
|
-
let
|
|
3131
|
-
const
|
|
3132
|
-
|
|
3133
|
-
const
|
|
3155
|
+
let B, Q;
|
|
3156
|
+
const Ve = d.type ? rr(v._f) : _n(l), ke = l.type === Xt.BLUR || l.type === Xt.FOCUS_OUT, es = !Rn(v._f) && !r.resolver && !S(t.errors, f) && !v._f.deps || jn(ke, S(t.touchedFields, f), t.isSubmitted, R, F), ht = ir(f, o, ke);
|
|
3157
|
+
j(a, f, Ve), ke ? (!d || !d.readOnly) && (v._f.onBlur && v._f.onBlur(l), c && c(0)) : v._f.onChange && v._f.onChange(l);
|
|
3158
|
+
const pt = D(f, Ve, ke), ts = !te(pt) || ht;
|
|
3134
3159
|
if (!ke && m.state.next({
|
|
3135
3160
|
name: f,
|
|
3136
3161
|
type: l.type,
|
|
3137
|
-
values:
|
|
3138
|
-
}),
|
|
3139
|
-
return (x.isValid ||
|
|
3140
|
-
if (!ke &&
|
|
3141
|
-
const { errors:
|
|
3142
|
-
if (I([f]), g(
|
|
3143
|
-
const
|
|
3144
|
-
|
|
3162
|
+
values: H(a)
|
|
3163
|
+
}), es)
|
|
3164
|
+
return (x.isValid || p.isValid) && (r.mode === "onBlur" ? ke && A() : ke || A()), ts && m.state.next({ name: f, ...ht ? {} : pt });
|
|
3165
|
+
if (!ke && ht && m.state.next({ ...t }), r.resolver) {
|
|
3166
|
+
const { errors: Pt } = await N([f]);
|
|
3167
|
+
if (I([f]), g(Ve), k) {
|
|
3168
|
+
const rs = ar(t.errors, s, f), jt = ar(Pt, s, rs.name || f);
|
|
3169
|
+
B = jt.error, f = jt.name, Q = te(Pt);
|
|
3145
3170
|
}
|
|
3146
3171
|
} else
|
|
3147
|
-
I([f], !0),
|
|
3148
|
-
|
|
3172
|
+
I([f], !0), B = (await lr(v, o.disabled, a, C, r.shouldUseNativeValidation))[f], I([f]), g(Ve), k && (B ? Q = !1 : (x.isValid || p.isValid) && (Q = await L(s, !0)));
|
|
3173
|
+
k && (v._f.deps && (!Array.isArray(v._f.deps) || v._f.deps.length > 0) && we(v._f.deps), G(f, Q, B, pt));
|
|
3149
3174
|
}
|
|
3150
3175
|
}, xe = (l, d) => {
|
|
3151
|
-
if (
|
|
3176
|
+
if (S(t.errors, d) && l.focus)
|
|
3152
3177
|
return l.focus(), 1;
|
|
3153
3178
|
}, we = async (l, d = {}) => {
|
|
3154
|
-
let f,
|
|
3155
|
-
const v =
|
|
3179
|
+
let f, k;
|
|
3180
|
+
const v = Ge(l);
|
|
3156
3181
|
if (r.resolver) {
|
|
3157
3182
|
const g = await q(z(l) ? l : v);
|
|
3158
|
-
f = te(g),
|
|
3183
|
+
f = te(g), k = l ? !v.some((F) => S(g, F)) : f;
|
|
3159
3184
|
} else
|
|
3160
|
-
l ? (
|
|
3161
|
-
const F =
|
|
3185
|
+
l ? (k = (await Promise.all(v.map(async (g) => {
|
|
3186
|
+
const F = S(s, g);
|
|
3162
3187
|
return await L(F && F._f ? { [g]: F } : F);
|
|
3163
|
-
}))).every(Boolean), !(!
|
|
3188
|
+
}))).every(Boolean), !(!k && !t.isValid) && A()) : k = f = await L(s);
|
|
3164
3189
|
return m.state.next({
|
|
3165
|
-
...!ne(l) || (x.isValid ||
|
|
3190
|
+
...!ne(l) || (x.isValid || p.isValid) && f !== t.isValid ? {} : { name: l },
|
|
3166
3191
|
...r.resolver || !l ? { isValid: f } : {},
|
|
3167
3192
|
errors: t.errors
|
|
3168
|
-
}), d.shouldFocus && !
|
|
3169
|
-
},
|
|
3193
|
+
}), d.shouldFocus && !k && He(s, xe, l ? v : o.mount), k;
|
|
3194
|
+
}, Pe = (l, d) => {
|
|
3170
3195
|
let f = {
|
|
3171
3196
|
...n.mount ? a : i
|
|
3172
3197
|
};
|
|
3173
|
-
return d && (f =
|
|
3174
|
-
},
|
|
3175
|
-
invalid: !!
|
|
3176
|
-
isDirty: !!
|
|
3177
|
-
error:
|
|
3178
|
-
isValidating: !!
|
|
3179
|
-
isTouched: !!
|
|
3180
|
-
}),
|
|
3181
|
-
const d = l ?
|
|
3182
|
-
d == null || d.forEach((f) =>
|
|
3198
|
+
return d && (f = Ur(d.dirtyFields ? t.dirtyFields : t.touchedFields, f)), z(l) ? f : ne(l) ? S(f, l) : l.map((k) => S(f, k));
|
|
3199
|
+
}, je = (l, d) => ({
|
|
3200
|
+
invalid: !!S((d || t).errors, l),
|
|
3201
|
+
isDirty: !!S((d || t).dirtyFields, l),
|
|
3202
|
+
error: S((d || t).errors, l),
|
|
3203
|
+
isValidating: !!S(t.validatingFields, l),
|
|
3204
|
+
isTouched: !!S((d || t).touchedFields, l)
|
|
3205
|
+
}), Xe = (l) => {
|
|
3206
|
+
const d = l ? Ge(l) : void 0;
|
|
3207
|
+
d == null || d.forEach((f) => K(t.errors, f)), d ? d.forEach((f) => {
|
|
3183
3208
|
m.state.next({
|
|
3184
3209
|
name: f,
|
|
3185
3210
|
errors: t.errors
|
|
@@ -3187,55 +3212,55 @@ function Pn(e = {}) {
|
|
|
3187
3212
|
}) : m.state.next({
|
|
3188
3213
|
errors: {}
|
|
3189
3214
|
});
|
|
3190
|
-
},
|
|
3191
|
-
const
|
|
3192
|
-
|
|
3193
|
-
...
|
|
3215
|
+
}, P = (l, d, f) => {
|
|
3216
|
+
const k = (S(s, l, { _f: {} })._f || {}).ref, v = S(t.errors, l) || {}, { ref: g, message: F, type: R, ...B } = v;
|
|
3217
|
+
j(t.errors, l, {
|
|
3218
|
+
...B,
|
|
3194
3219
|
...d,
|
|
3195
|
-
ref:
|
|
3220
|
+
ref: k
|
|
3196
3221
|
}), m.state.next({
|
|
3197
3222
|
name: l,
|
|
3198
3223
|
errors: t.errors,
|
|
3199
3224
|
isValid: !1
|
|
3200
|
-
}), f && f.shouldFocus &&
|
|
3201
|
-
},
|
|
3202
|
-
next: (f) => "values" in f && l(
|
|
3203
|
-
}) :
|
|
3225
|
+
}), f && f.shouldFocus && k && k.focus && k.focus();
|
|
3226
|
+
}, ut = (l, d) => oe(l) ? m.state.subscribe({
|
|
3227
|
+
next: (f) => "values" in f && l(T(void 0, d), f)
|
|
3228
|
+
}) : T(l, d, !0), Ye = (l) => m.state.subscribe({
|
|
3204
3229
|
next: (d) => {
|
|
3205
|
-
|
|
3230
|
+
Pn(l.name, d.name, l.exact) && Bn(d, l.formState || x, Qr, l.reRenderRoot) && l.callback({
|
|
3206
3231
|
values: { ...a },
|
|
3207
3232
|
...t,
|
|
3208
3233
|
...d,
|
|
3209
3234
|
defaultValues: i
|
|
3210
3235
|
});
|
|
3211
3236
|
}
|
|
3212
|
-
}).unsubscribe,
|
|
3213
|
-
...
|
|
3237
|
+
}).unsubscribe, _e = (l) => (n.mount = !0, p = {
|
|
3238
|
+
...p,
|
|
3214
3239
|
...l.formState
|
|
3215
|
-
},
|
|
3240
|
+
}, Ye({
|
|
3216
3241
|
...l,
|
|
3217
3242
|
formState: {
|
|
3218
3243
|
...b,
|
|
3219
3244
|
...l.formState
|
|
3220
3245
|
}
|
|
3221
|
-
})),
|
|
3222
|
-
for (const f of l ?
|
|
3223
|
-
o.mount.delete(f), o.array.delete(f), d.keepValue || (
|
|
3246
|
+
})), ct = (l, d = {}) => {
|
|
3247
|
+
for (const f of l ? Ge(l) : o.mount)
|
|
3248
|
+
o.mount.delete(f), o.array.delete(f), d.keepValue || (K(s, f), K(a, f)), !d.keepError && K(t.errors, f), !d.keepDirty && K(t.dirtyFields, f), !d.keepTouched && K(t.touchedFields, f), !d.keepIsValidating && K(t.validatingFields, f), !r.shouldUnregister && !d.keepDefaultValue && K(i, f);
|
|
3224
3249
|
m.state.next({
|
|
3225
|
-
values:
|
|
3250
|
+
values: H(a)
|
|
3226
3251
|
}), m.state.next({
|
|
3227
3252
|
...t,
|
|
3228
3253
|
...d.keepDirty ? { isDirty: w() } : {}
|
|
3229
3254
|
}), !d.keepIsValid && A();
|
|
3230
|
-
},
|
|
3255
|
+
}, Tt = ({ disabled: l, name: d }) => {
|
|
3231
3256
|
if (ue(l) && n.mount || l || o.disabled.has(d)) {
|
|
3232
3257
|
const v = o.disabled.has(d) !== !!l;
|
|
3233
3258
|
l ? o.disabled.add(d) : o.disabled.delete(d), v && n.mount && !n.action && A();
|
|
3234
3259
|
}
|
|
3235
|
-
},
|
|
3236
|
-
let f =
|
|
3237
|
-
const
|
|
3238
|
-
return
|
|
3260
|
+
}, dt = (l, d = {}) => {
|
|
3261
|
+
let f = S(s, l);
|
|
3262
|
+
const k = ue(d.disabled) || ue(r.disabled);
|
|
3263
|
+
return j(s, l, {
|
|
3239
3264
|
...f || {},
|
|
3240
3265
|
_f: {
|
|
3241
3266
|
...f && f._f ? f._f : { ref: { name: l } },
|
|
@@ -3243,107 +3268,107 @@ function Pn(e = {}) {
|
|
|
3243
3268
|
mount: !0,
|
|
3244
3269
|
...d
|
|
3245
3270
|
}
|
|
3246
|
-
}), o.mount.add(l), f ?
|
|
3271
|
+
}), o.mount.add(l), f ? Tt({
|
|
3247
3272
|
disabled: ue(d.disabled) ? d.disabled : r.disabled,
|
|
3248
3273
|
name: l
|
|
3249
|
-
}) :
|
|
3250
|
-
...
|
|
3274
|
+
}) : M(l, !0, d.value), {
|
|
3275
|
+
...k ? { disabled: d.disabled || r.disabled } : {},
|
|
3251
3276
|
...r.progressive ? {
|
|
3252
3277
|
required: !!d.required,
|
|
3253
|
-
min:
|
|
3254
|
-
max:
|
|
3255
|
-
minLength:
|
|
3256
|
-
maxLength:
|
|
3257
|
-
pattern:
|
|
3278
|
+
min: $e(d.min),
|
|
3279
|
+
max: $e(d.max),
|
|
3280
|
+
minLength: $e(d.minLength),
|
|
3281
|
+
maxLength: $e(d.maxLength),
|
|
3282
|
+
pattern: $e(d.pattern)
|
|
3258
3283
|
} : {},
|
|
3259
3284
|
name: l,
|
|
3260
3285
|
onChange: ve,
|
|
3261
3286
|
onBlur: ve,
|
|
3262
3287
|
ref: (v) => {
|
|
3263
3288
|
if (v) {
|
|
3264
|
-
|
|
3265
|
-
const g = z(v.value) && v.querySelectorAll && v.querySelectorAll("input,select,textarea")[0] || v, F =
|
|
3266
|
-
if (F ?
|
|
3289
|
+
dt(l, d), f = S(s, l);
|
|
3290
|
+
const g = z(v.value) && v.querySelectorAll && v.querySelectorAll("input,select,textarea")[0] || v, F = En(g), R = f._f.refs || [];
|
|
3291
|
+
if (F ? R.find((B) => B === g) : g === f._f.ref)
|
|
3267
3292
|
return;
|
|
3268
|
-
|
|
3293
|
+
j(s, l, {
|
|
3269
3294
|
_f: {
|
|
3270
3295
|
...f._f,
|
|
3271
3296
|
...F ? {
|
|
3272
3297
|
refs: [
|
|
3273
|
-
...
|
|
3298
|
+
...R.filter(vt),
|
|
3274
3299
|
g,
|
|
3275
|
-
...Array.isArray(
|
|
3300
|
+
...Array.isArray(S(i, l)) ? [{}] : []
|
|
3276
3301
|
],
|
|
3277
3302
|
ref: { type: g.type, name: l }
|
|
3278
3303
|
} : { ref: g }
|
|
3279
3304
|
}
|
|
3280
|
-
}),
|
|
3305
|
+
}), M(l, !1, void 0, g);
|
|
3281
3306
|
} else
|
|
3282
|
-
f =
|
|
3307
|
+
f = S(s, l, {}), f._f && (f._f.mount = !1), (r.shouldUnregister || d.shouldUnregister) && !(Cn(o.array, l) && n.action) && o.unMount.add(l);
|
|
3283
3308
|
}
|
|
3284
3309
|
};
|
|
3285
|
-
},
|
|
3286
|
-
ue(l) && (m.state.next({ disabled: l }),
|
|
3287
|
-
const
|
|
3288
|
-
|
|
3289
|
-
v.disabled =
|
|
3310
|
+
}, ft = () => r.shouldFocusError && He(s, xe, o.mount), Zr = (l) => {
|
|
3311
|
+
ue(l) && (m.state.next({ disabled: l }), He(s, (d, f) => {
|
|
3312
|
+
const k = S(s, f);
|
|
3313
|
+
k && (d.disabled = k._f.disabled || l, Array.isArray(k._f.refs) && k._f.refs.forEach((v) => {
|
|
3314
|
+
v.disabled = k._f.disabled || l;
|
|
3290
3315
|
}));
|
|
3291
3316
|
}, 0, !1));
|
|
3292
|
-
},
|
|
3293
|
-
let
|
|
3317
|
+
}, Dt = (l, d) => async (f) => {
|
|
3318
|
+
let k;
|
|
3294
3319
|
f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
|
|
3295
|
-
let v =
|
|
3320
|
+
let v = H(a);
|
|
3296
3321
|
if (m.state.next({
|
|
3297
3322
|
isSubmitting: !0
|
|
3298
3323
|
}), r.resolver) {
|
|
3299
3324
|
const { errors: g, values: F } = await N();
|
|
3300
|
-
I(), t.errors = g, v =
|
|
3325
|
+
I(), t.errors = g, v = H(F);
|
|
3301
3326
|
} else
|
|
3302
3327
|
await L(s);
|
|
3303
3328
|
if (o.disabled.size)
|
|
3304
3329
|
for (const g of o.disabled)
|
|
3305
|
-
|
|
3306
|
-
if (
|
|
3330
|
+
K(v, g);
|
|
3331
|
+
if (K(t.errors, "root"), te(t.errors)) {
|
|
3307
3332
|
m.state.next({
|
|
3308
3333
|
errors: {}
|
|
3309
3334
|
});
|
|
3310
3335
|
try {
|
|
3311
3336
|
await l(v, f);
|
|
3312
3337
|
} catch (g) {
|
|
3313
|
-
|
|
3338
|
+
k = g;
|
|
3314
3339
|
}
|
|
3315
3340
|
} else
|
|
3316
|
-
d && await d({ ...t.errors }, f),
|
|
3341
|
+
d && await d({ ...t.errors }, f), ft(), setTimeout(ft);
|
|
3317
3342
|
if (m.state.next({
|
|
3318
3343
|
isSubmitted: !0,
|
|
3319
3344
|
isSubmitting: !1,
|
|
3320
|
-
isSubmitSuccessful: te(t.errors) && !
|
|
3345
|
+
isSubmitSuccessful: te(t.errors) && !k,
|
|
3321
3346
|
submitCount: t.submitCount + 1,
|
|
3322
3347
|
errors: t.errors
|
|
3323
|
-
}),
|
|
3324
|
-
throw
|
|
3325
|
-
},
|
|
3326
|
-
|
|
3327
|
-
},
|
|
3328
|
-
const f = l ?
|
|
3348
|
+
}), k)
|
|
3349
|
+
throw k;
|
|
3350
|
+
}, Xr = (l, d = {}) => {
|
|
3351
|
+
S(s, l) && (z(d.defaultValue) ? J(l, H(S(i, l))) : (J(l, d.defaultValue), j(i, l, H(d.defaultValue))), d.keepTouched || K(t.touchedFields, l), d.keepDirty || (K(t.dirtyFields, l), t.isDirty = d.defaultValue ? w(l, H(S(i, l))) : w()), d.keepError || (K(t.errors, l), x.isValid && A()), m.state.next({ ...t }));
|
|
3352
|
+
}, Ot = (l, d = {}) => {
|
|
3353
|
+
const f = l ? H(l) : i, k = H(f), v = te(l), g = v ? i : k;
|
|
3329
3354
|
if (d.keepDefaultValues || (i = f), !d.keepValues) {
|
|
3330
3355
|
if (d.keepDirtyValues) {
|
|
3331
3356
|
const F = /* @__PURE__ */ new Set([
|
|
3332
3357
|
...o.mount,
|
|
3333
3358
|
...Object.keys(Le(i, a))
|
|
3334
3359
|
]);
|
|
3335
|
-
for (const
|
|
3336
|
-
const
|
|
3337
|
-
|
|
3360
|
+
for (const R of Array.from(F)) {
|
|
3361
|
+
const B = S(t.dirtyFields, R), Q = S(a, R), Ve = S(g, R);
|
|
3362
|
+
B && !z(Q) ? j(g, R, Q) : !B && !z(Ve) && J(R, Ve);
|
|
3338
3363
|
}
|
|
3339
3364
|
} else {
|
|
3340
|
-
if (
|
|
3365
|
+
if (At && z(l))
|
|
3341
3366
|
for (const F of o.mount) {
|
|
3342
|
-
const
|
|
3343
|
-
if (
|
|
3344
|
-
const
|
|
3345
|
-
if (
|
|
3346
|
-
const Q =
|
|
3367
|
+
const R = S(s, F);
|
|
3368
|
+
if (R && R._f) {
|
|
3369
|
+
const B = Array.isArray(R._f.refs) ? R._f.refs[0] : R._f.ref;
|
|
3370
|
+
if (et(B)) {
|
|
3371
|
+
const Q = B.closest("form");
|
|
3347
3372
|
if (Q) {
|
|
3348
3373
|
Q.reset();
|
|
3349
3374
|
break;
|
|
@@ -3353,11 +3378,11 @@ function Pn(e = {}) {
|
|
|
3353
3378
|
}
|
|
3354
3379
|
if (d.keepFieldsRef)
|
|
3355
3380
|
for (const F of o.mount)
|
|
3356
|
-
|
|
3381
|
+
J(F, S(g, F));
|
|
3357
3382
|
else
|
|
3358
3383
|
s = {};
|
|
3359
3384
|
}
|
|
3360
|
-
a = r.shouldUnregister ? d.keepDefaultValues ?
|
|
3385
|
+
a = r.shouldUnregister ? d.keepDefaultValues ? H(i) : {} : H(g), m.array.next({
|
|
3361
3386
|
values: { ...g }
|
|
3362
3387
|
}), m.state.next({
|
|
3363
3388
|
values: { ...g }
|
|
@@ -3382,45 +3407,45 @@ function Pn(e = {}) {
|
|
|
3382
3407
|
isSubmitting: !1,
|
|
3383
3408
|
defaultValues: i
|
|
3384
3409
|
});
|
|
3385
|
-
},
|
|
3386
|
-
const f =
|
|
3387
|
-
if (
|
|
3388
|
-
const v =
|
|
3410
|
+
}, Rt = (l, d) => Ot(oe(l) ? l(a) : l, { ...r.resetOptions, ...d }), Yr = (l, d = {}) => {
|
|
3411
|
+
const f = S(s, l), k = f && f._f;
|
|
3412
|
+
if (k) {
|
|
3413
|
+
const v = k.refs ? k.refs[0] : k.ref;
|
|
3389
3414
|
v.focus && setTimeout(() => {
|
|
3390
3415
|
v.focus(), d.shouldSelect && oe(v.select) && v.select();
|
|
3391
3416
|
});
|
|
3392
3417
|
}
|
|
3393
|
-
},
|
|
3418
|
+
}, Qr = (l) => {
|
|
3394
3419
|
t = {
|
|
3395
3420
|
...t,
|
|
3396
3421
|
...l
|
|
3397
3422
|
};
|
|
3398
|
-
},
|
|
3423
|
+
}, Bt = {
|
|
3399
3424
|
control: {
|
|
3400
|
-
register:
|
|
3401
|
-
unregister:
|
|
3402
|
-
getFieldState:
|
|
3403
|
-
handleSubmit:
|
|
3404
|
-
setError:
|
|
3405
|
-
_subscribe:
|
|
3425
|
+
register: dt,
|
|
3426
|
+
unregister: ct,
|
|
3427
|
+
getFieldState: je,
|
|
3428
|
+
handleSubmit: Dt,
|
|
3429
|
+
setError: P,
|
|
3430
|
+
_subscribe: Ye,
|
|
3406
3431
|
_runSchema: N,
|
|
3407
3432
|
_updateIsValidating: I,
|
|
3408
|
-
_focusError:
|
|
3409
|
-
_getWatch:
|
|
3433
|
+
_focusError: ft,
|
|
3434
|
+
_getWatch: T,
|
|
3410
3435
|
_getDirty: w,
|
|
3411
3436
|
_setValid: A,
|
|
3412
3437
|
_setFieldArray: y,
|
|
3413
|
-
_setDisabledField:
|
|
3438
|
+
_setDisabledField: Tt,
|
|
3414
3439
|
_setErrors: V,
|
|
3415
3440
|
_getFieldArray: U,
|
|
3416
|
-
_reset:
|
|
3441
|
+
_reset: Ot,
|
|
3417
3442
|
_resetDefaultValues: () => oe(r.defaultValues) && r.defaultValues().then((l) => {
|
|
3418
|
-
|
|
3443
|
+
Rt(l, r.resetOptions), m.state.next({
|
|
3419
3444
|
isLoading: !1
|
|
3420
3445
|
});
|
|
3421
3446
|
}),
|
|
3422
|
-
_removeUnmounted:
|
|
3423
|
-
_disableForm:
|
|
3447
|
+
_removeUnmounted: O,
|
|
3448
|
+
_disableForm: Zr,
|
|
3424
3449
|
_subjects: m,
|
|
3425
3450
|
_proxyFormState: x,
|
|
3426
3451
|
get _fields() {
|
|
@@ -3457,27 +3482,27 @@ function Pn(e = {}) {
|
|
|
3457
3482
|
};
|
|
3458
3483
|
}
|
|
3459
3484
|
},
|
|
3460
|
-
subscribe:
|
|
3485
|
+
subscribe: _e,
|
|
3461
3486
|
trigger: we,
|
|
3462
|
-
register:
|
|
3463
|
-
handleSubmit:
|
|
3464
|
-
watch:
|
|
3465
|
-
setValue:
|
|
3466
|
-
getValues:
|
|
3467
|
-
reset:
|
|
3468
|
-
resetField:
|
|
3469
|
-
clearErrors:
|
|
3470
|
-
unregister:
|
|
3471
|
-
setError:
|
|
3472
|
-
setFocus:
|
|
3473
|
-
getFieldState:
|
|
3487
|
+
register: dt,
|
|
3488
|
+
handleSubmit: Dt,
|
|
3489
|
+
watch: ut,
|
|
3490
|
+
setValue: J,
|
|
3491
|
+
getValues: Pe,
|
|
3492
|
+
reset: Rt,
|
|
3493
|
+
resetField: Xr,
|
|
3494
|
+
clearErrors: Xe,
|
|
3495
|
+
unregister: ct,
|
|
3496
|
+
setError: P,
|
|
3497
|
+
setFocus: Yr,
|
|
3498
|
+
getFieldState: je
|
|
3474
3499
|
};
|
|
3475
3500
|
return {
|
|
3476
|
-
...
|
|
3477
|
-
formControl:
|
|
3501
|
+
...Bt,
|
|
3502
|
+
formControl: Bt
|
|
3478
3503
|
};
|
|
3479
3504
|
}
|
|
3480
|
-
function
|
|
3505
|
+
function ot(e = {}) {
|
|
3481
3506
|
const r = ee.useRef(void 0), t = ee.useRef(void 0), [s, i] = ee.useState({
|
|
3482
3507
|
isDirty: !1,
|
|
3483
3508
|
isValidating: !1,
|
|
@@ -3502,14 +3527,14 @@ function it(e = {}) {
|
|
|
3502
3527
|
formState: s
|
|
3503
3528
|
}, e.defaultValues && !oe(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
3504
3529
|
else {
|
|
3505
|
-
const { formControl: n, ...o } =
|
|
3530
|
+
const { formControl: n, ...o } = zn(e);
|
|
3506
3531
|
r.current = {
|
|
3507
3532
|
...o,
|
|
3508
3533
|
formState: s
|
|
3509
3534
|
};
|
|
3510
3535
|
}
|
|
3511
3536
|
const a = r.current.control;
|
|
3512
|
-
return a._options = e,
|
|
3537
|
+
return a._options = e, Vn(() => {
|
|
3513
3538
|
const n = a._subscribe({
|
|
3514
3539
|
formState: a._proxyFormState,
|
|
3515
3540
|
callback: () => i({ ...a._formState }),
|
|
@@ -3542,46 +3567,46 @@ function it(e = {}) {
|
|
|
3542
3567
|
}), !((n = a._options.resetOptions) === null || n === void 0) && n.keepIsValid || a._setValid(), t.current = e.values, i((o) => ({ ...o }))) : a._resetDefaultValues();
|
|
3543
3568
|
}, [a, e.values]), ee.useEffect(() => {
|
|
3544
3569
|
a._state.mount || (a._setValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
3545
|
-
}), r.current.formState = ee.useMemo(() =>
|
|
3570
|
+
}), r.current.formState = ee.useMemo(() => Fn(s, a), [a, s]), r.current;
|
|
3546
3571
|
}
|
|
3547
|
-
const
|
|
3572
|
+
const ur = (e, r, t) => {
|
|
3548
3573
|
if (e && "reportValidity" in e) {
|
|
3549
|
-
const s =
|
|
3574
|
+
const s = S(t, r);
|
|
3550
3575
|
e.setCustomValidity(s && s.message || ""), e.reportValidity();
|
|
3551
3576
|
}
|
|
3552
|
-
},
|
|
3577
|
+
}, Kn = (e, r) => {
|
|
3553
3578
|
for (const t in r.fields) {
|
|
3554
3579
|
const s = r.fields[t];
|
|
3555
|
-
s && s.ref && "reportValidity" in s.ref ?
|
|
3580
|
+
s && s.ref && "reportValidity" in s.ref ? ur(s.ref, t, e) : s.refs && s.refs.forEach((i) => ur(i, t, e));
|
|
3556
3581
|
}
|
|
3557
|
-
},
|
|
3558
|
-
r.shouldUseNativeValidation &&
|
|
3582
|
+
}, Wn = (e, r) => {
|
|
3583
|
+
r.shouldUseNativeValidation && Kn(e, r);
|
|
3559
3584
|
const t = {};
|
|
3560
3585
|
for (const s in e) {
|
|
3561
|
-
const i =
|
|
3562
|
-
if (
|
|
3563
|
-
const n = Object.assign({},
|
|
3564
|
-
|
|
3586
|
+
const i = S(r.fields, s), a = Object.assign(e[s] || {}, { ref: i && i.ref });
|
|
3587
|
+
if (Gn(r.names || Object.keys(e), s)) {
|
|
3588
|
+
const n = Object.assign({}, S(t, s));
|
|
3589
|
+
j(n, "root", a), j(t, s, n);
|
|
3565
3590
|
} else
|
|
3566
|
-
|
|
3591
|
+
j(t, s, a);
|
|
3567
3592
|
}
|
|
3568
3593
|
return t;
|
|
3569
|
-
},
|
|
3570
|
-
var
|
|
3594
|
+
}, Gn = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
3595
|
+
var lt = function(e, r, t) {
|
|
3571
3596
|
return t === void 0 && (t = {}), function(s, i, a) {
|
|
3572
3597
|
try {
|
|
3573
3598
|
var n = !a.shouldUseNativeValidation && a.criteriaMode === "all";
|
|
3574
|
-
return Promise.resolve(/* @__PURE__ */
|
|
3599
|
+
return Promise.resolve(/* @__PURE__ */ sn(e, s, Object.assign({}, r, { abortPipeEarly: !n }))).then(function(o) {
|
|
3575
3600
|
if (o.issues) {
|
|
3576
3601
|
for (var c = {}; o.issues.length; ) {
|
|
3577
|
-
var
|
|
3578
|
-
if (b && (c[b] || (c[b] = { message:
|
|
3579
|
-
var x = c[b].types,
|
|
3580
|
-
c[b] =
|
|
3602
|
+
var h = o.issues[0], b = /* @__PURE__ */ Zs(h);
|
|
3603
|
+
if (b && (c[b] || (c[b] = { message: h.message, type: h.type }), n)) {
|
|
3604
|
+
var x = c[b].types, p = x && x[h.type];
|
|
3605
|
+
c[b] = qr(b, n, c, h.type, p ? [].concat(p, h.message) : h.message);
|
|
3581
3606
|
}
|
|
3582
3607
|
o.issues.shift();
|
|
3583
3608
|
}
|
|
3584
|
-
return { values: {}, errors:
|
|
3609
|
+
return { values: {}, errors: Wn(c, a) };
|
|
3585
3610
|
}
|
|
3586
3611
|
return { values: t.raw ? s : o.output, errors: {} };
|
|
3587
3612
|
});
|
|
@@ -3590,19 +3615,19 @@ var at = function(e, r, t) {
|
|
|
3590
3615
|
}
|
|
3591
3616
|
};
|
|
3592
3617
|
};
|
|
3593
|
-
const
|
|
3618
|
+
const cr = 27, dr = 12, fr = 10, Hn = Re("enum"), Jn = (e, r) => {
|
|
3594
3619
|
const t = {
|
|
3595
3620
|
min: e.minSelected ?? 0,
|
|
3596
3621
|
max: e.maxSelected ?? e.options.length
|
|
3597
3622
|
};
|
|
3598
|
-
return
|
|
3599
|
-
checked: /* @__PURE__ */ Se(/* @__PURE__ */
|
|
3623
|
+
return lt(/* @__PURE__ */ ge({
|
|
3624
|
+
checked: /* @__PURE__ */ Se(/* @__PURE__ */ Or(/* @__PURE__ */ ie(), /* @__PURE__ */ Lr()), /* @__PURE__ */ It((s) => Object.entries(s).filter(([i, a]) => a).map(([i, a]) => i)), /* @__PURE__ */ Ke(t.max, r("validation_multiple_choice_max", {
|
|
3600
3625
|
count: t.max
|
|
3601
|
-
})), /* @__PURE__ */
|
|
3626
|
+
})), /* @__PURE__ */ Te(t.min, r("validation_multiple_choice_min", {
|
|
3602
3627
|
count: t.min
|
|
3603
3628
|
})))
|
|
3604
3629
|
}));
|
|
3605
|
-
},
|
|
3630
|
+
}, Zn = xr(({
|
|
3606
3631
|
option: e,
|
|
3607
3632
|
...r
|
|
3608
3633
|
}, t) => u(be, {
|
|
@@ -3616,21 +3641,21 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3616
3641
|
htmlFor: r.id,
|
|
3617
3642
|
children: e.label
|
|
3618
3643
|
})]
|
|
3619
|
-
})),
|
|
3644
|
+
})), hr = st("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3620
3645
|
variants: {
|
|
3621
3646
|
variant: {
|
|
3622
3647
|
// In cases where there is only one option, we want to center it
|
|
3623
3648
|
singleOption: "justify-center",
|
|
3624
3649
|
// Two choices with exactly 1 min 1 max
|
|
3625
|
-
booleanLike:
|
|
3650
|
+
booleanLike: Br
|
|
3626
3651
|
}
|
|
3627
3652
|
}
|
|
3628
|
-
}),
|
|
3653
|
+
}), Xn = ({
|
|
3629
3654
|
input: e,
|
|
3630
3655
|
onSubmitSuccess: r
|
|
3631
3656
|
}) => {
|
|
3632
3657
|
var b, x;
|
|
3633
|
-
const t = e.key ? (b =
|
|
3658
|
+
const t = e.key ? (b = $.current$.value.flow) == null ? void 0 : b.data.submissions[e.key] : void 0, s = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1, i = s && e.config.options.length === 2, {
|
|
3634
3659
|
t: a
|
|
3635
3660
|
} = se(), {
|
|
3636
3661
|
register: n,
|
|
@@ -3638,77 +3663,77 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3638
3663
|
formState: {
|
|
3639
3664
|
errors: c
|
|
3640
3665
|
}
|
|
3641
|
-
} =
|
|
3666
|
+
} = ot({
|
|
3642
3667
|
defaultValues: {
|
|
3643
|
-
checked: s ? {} :
|
|
3668
|
+
checked: s ? {} : Hn(t) ? Object.fromEntries(t.value.map((p) => [p, !0])) : {}
|
|
3644
3669
|
},
|
|
3645
|
-
resolver:
|
|
3646
|
-
}),
|
|
3670
|
+
resolver: Jn(e.config, a)
|
|
3671
|
+
}), h = Vt();
|
|
3647
3672
|
return i ? u("ul", {
|
|
3648
3673
|
style: {
|
|
3649
|
-
maxHeight: 6.5 *
|
|
3674
|
+
maxHeight: 6.5 * cr + 5 * dr + 2 * fr
|
|
3650
3675
|
},
|
|
3651
|
-
class:
|
|
3676
|
+
class: hr({
|
|
3652
3677
|
variant: "booleanLike"
|
|
3653
3678
|
}),
|
|
3654
|
-
children: e.config.options.map((
|
|
3655
|
-
class:
|
|
3656
|
-
children: u(
|
|
3679
|
+
children: e.config.options.map((p, m) => u("li", {
|
|
3680
|
+
class: Pr,
|
|
3681
|
+
children: u(jr, {
|
|
3657
3682
|
type: "submit",
|
|
3658
|
-
ref: (
|
|
3659
|
-
|
|
3683
|
+
ref: (C) => {
|
|
3684
|
+
C && m === 0 && (h.current = C);
|
|
3660
3685
|
},
|
|
3661
|
-
label:
|
|
3686
|
+
label: p.label,
|
|
3662
3687
|
value: "true",
|
|
3663
3688
|
onClick: () => r({
|
|
3664
3689
|
type: "enum",
|
|
3665
|
-
value: [
|
|
3690
|
+
value: [p.value]
|
|
3666
3691
|
})
|
|
3667
3692
|
})
|
|
3668
|
-
},
|
|
3693
|
+
}, p.value))
|
|
3669
3694
|
}) : u("form", {
|
|
3670
3695
|
noValidate: !0,
|
|
3671
|
-
onSubmit: (
|
|
3672
|
-
const
|
|
3696
|
+
onSubmit: (p) => o((m) => {
|
|
3697
|
+
const C = m.checked;
|
|
3673
3698
|
r({
|
|
3674
3699
|
type: "enum",
|
|
3675
|
-
value:
|
|
3700
|
+
value: C
|
|
3676
3701
|
});
|
|
3677
|
-
})(
|
|
3702
|
+
})(p),
|
|
3678
3703
|
children: [u("div", {
|
|
3679
3704
|
class: "flex items-center gap-1",
|
|
3680
3705
|
children: [u("ul", {
|
|
3681
3706
|
style: {
|
|
3682
|
-
maxHeight: 6.5 *
|
|
3707
|
+
maxHeight: 6.5 * cr + 5 * dr + 2 * fr
|
|
3683
3708
|
},
|
|
3684
|
-
class:
|
|
3709
|
+
class: hr({
|
|
3685
3710
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3686
3711
|
}),
|
|
3687
|
-
children: e.config.options.map((
|
|
3688
|
-
const
|
|
3689
|
-
ref:
|
|
3712
|
+
children: e.config.options.map((p, m) => {
|
|
3713
|
+
const C = `checked.${p.value}`, {
|
|
3714
|
+
ref: E,
|
|
3690
3715
|
...A
|
|
3691
|
-
} = n(
|
|
3716
|
+
} = n(C);
|
|
3692
3717
|
return u("li", {
|
|
3693
3718
|
class: "relative",
|
|
3694
|
-
children: u(
|
|
3695
|
-
option:
|
|
3719
|
+
children: u(Zn, {
|
|
3720
|
+
option: p,
|
|
3696
3721
|
autoFocus: m === 0,
|
|
3697
3722
|
ref: (I) => {
|
|
3698
|
-
I && m === 0 && (
|
|
3723
|
+
I && m === 0 && (h.current = I), E(I);
|
|
3699
3724
|
},
|
|
3700
|
-
id:
|
|
3725
|
+
id: C,
|
|
3701
3726
|
...A,
|
|
3702
3727
|
onClick: s ? () => r({
|
|
3703
3728
|
type: "enum",
|
|
3704
|
-
value: [
|
|
3729
|
+
value: [p.value]
|
|
3705
3730
|
}) : void 0
|
|
3706
3731
|
})
|
|
3707
|
-
},
|
|
3732
|
+
}, p.value);
|
|
3708
3733
|
})
|
|
3709
3734
|
}), u("div", {
|
|
3710
3735
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
3711
|
-
children: [s ? null : u(Ee, {}), e.config.minSelected === 0 && u(
|
|
3736
|
+
children: [s ? null : u(Ee, {}), e.config.minSelected === 0 && u(Fe, {
|
|
3712
3737
|
class: "relative",
|
|
3713
3738
|
type: "button",
|
|
3714
3739
|
onClick: () => r({
|
|
@@ -3724,23 +3749,23 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3724
3749
|
})
|
|
3725
3750
|
})]
|
|
3726
3751
|
});
|
|
3727
|
-
},
|
|
3752
|
+
}, Yn = Re("number"), Qn = (e, r) => {
|
|
3728
3753
|
const t = e.min ?? Number.MIN_SAFE_INTEGER, s = e.max ?? Number.MAX_SAFE_INTEGER, i = e.decimalCases ?? 0;
|
|
3729
|
-
return
|
|
3730
|
-
number: /* @__PURE__ */ Se(/* @__PURE__ */
|
|
3754
|
+
return lt(/* @__PURE__ */ ge({
|
|
3755
|
+
number: /* @__PURE__ */ Se(/* @__PURE__ */ Tr(r("validation_number")), /* @__PURE__ */ Ar(t, r("validation_number_min", {
|
|
3731
3756
|
min: t
|
|
3732
|
-
})), /* @__PURE__ */
|
|
3757
|
+
})), /* @__PURE__ */ Vr(s, r("validation_number_max", {
|
|
3733
3758
|
max: s
|
|
3734
|
-
})), /* @__PURE__ */
|
|
3759
|
+
})), /* @__PURE__ */ Ir((a) => a === Number(a.toFixed(i)), r("validation_number_decimal_cases", {
|
|
3735
3760
|
count: i
|
|
3736
3761
|
})))
|
|
3737
3762
|
}));
|
|
3738
|
-
},
|
|
3763
|
+
}, ei = ({
|
|
3739
3764
|
input: e,
|
|
3740
3765
|
onSubmitSuccess: r
|
|
3741
3766
|
}) => {
|
|
3742
3767
|
var x;
|
|
3743
|
-
const t = e.config.defaultValue, s = e.key ? (x =
|
|
3768
|
+
const t = e.config.defaultValue, s = e.key ? (x = $.current$.value.flow) == null ? void 0 : x.data.submissions[e.key] : void 0, {
|
|
3744
3769
|
t: i
|
|
3745
3770
|
} = se(), {
|
|
3746
3771
|
register: a,
|
|
@@ -3748,14 +3773,14 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3748
3773
|
formState: {
|
|
3749
3774
|
errors: o
|
|
3750
3775
|
}
|
|
3751
|
-
} =
|
|
3776
|
+
} = ot({
|
|
3752
3777
|
defaultValues: {
|
|
3753
|
-
number:
|
|
3778
|
+
number: Yn(s) ? s.value : t ? Number(t) : void 0
|
|
3754
3779
|
},
|
|
3755
|
-
resolver:
|
|
3780
|
+
resolver: Qn(e.config, i)
|
|
3756
3781
|
}), {
|
|
3757
3782
|
ref: c,
|
|
3758
|
-
...
|
|
3783
|
+
...h
|
|
3759
3784
|
} = a("number", {
|
|
3760
3785
|
required: !e.config.optional,
|
|
3761
3786
|
valueAsNumber: !0
|
|
@@ -3764,10 +3789,10 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3764
3789
|
b.current && (b.current.focus(), b.current.select());
|
|
3765
3790
|
}, []), u("form", {
|
|
3766
3791
|
class: "flex flex-col gap-1 p-2.5",
|
|
3767
|
-
onSubmit: n((
|
|
3768
|
-
|
|
3792
|
+
onSubmit: n((p) => {
|
|
3793
|
+
p.number !== void 0 && r({
|
|
3769
3794
|
type: "number",
|
|
3770
|
-
value:
|
|
3795
|
+
value: p.number
|
|
3771
3796
|
});
|
|
3772
3797
|
}),
|
|
3773
3798
|
children: [u("div", {
|
|
@@ -3775,24 +3800,24 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3775
3800
|
children: [u("div", {
|
|
3776
3801
|
class: "relative min-w-0 flex-grow",
|
|
3777
3802
|
children: [u("input", {
|
|
3778
|
-
...
|
|
3803
|
+
...h,
|
|
3779
3804
|
id: "chat-input",
|
|
3780
3805
|
autocomplete: "off",
|
|
3781
3806
|
autoCapitalize: "off",
|
|
3782
3807
|
autoCorrect: "off",
|
|
3783
3808
|
autoFocus: !0,
|
|
3784
|
-
ref: (
|
|
3785
|
-
|
|
3809
|
+
ref: (p) => {
|
|
3810
|
+
p && (b.current = p), c(p);
|
|
3786
3811
|
},
|
|
3787
3812
|
type: "text",
|
|
3788
3813
|
min: e.config.min,
|
|
3789
3814
|
max: e.config.max,
|
|
3790
|
-
class:
|
|
3815
|
+
class: Je({
|
|
3791
3816
|
optional: e.config.optional,
|
|
3792
3817
|
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
3793
3818
|
}),
|
|
3794
3819
|
placeholder: e.config.placeholder
|
|
3795
|
-
}), e.config.optional && u(
|
|
3820
|
+
}), e.config.optional && u(Fe, {
|
|
3796
3821
|
class: "absolute bottom-0 right-0.5 top-0",
|
|
3797
3822
|
onClick: () => r(null)
|
|
3798
3823
|
})]
|
|
@@ -3801,13 +3826,13 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3801
3826
|
error: o.number
|
|
3802
3827
|
})]
|
|
3803
3828
|
});
|
|
3804
|
-
},
|
|
3829
|
+
}, ti = (e) => {
|
|
3805
3830
|
if (e === "")
|
|
3806
3831
|
return {
|
|
3807
3832
|
countryCode: "",
|
|
3808
3833
|
phoneNumber: ""
|
|
3809
3834
|
};
|
|
3810
|
-
const r = Object.entries(
|
|
3835
|
+
const r = Object.entries(Ft).find((i) => e.startsWith(i[1])), t = r ? r[1] : "", s = e.replace(t, "");
|
|
3811
3836
|
return /^\d+$/.test(s) ? {
|
|
3812
3837
|
countryCode: t,
|
|
3813
3838
|
phoneNumber: s
|
|
@@ -3815,38 +3840,38 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3815
3840
|
countryCode: "",
|
|
3816
3841
|
phoneNumber: ""
|
|
3817
3842
|
};
|
|
3818
|
-
},
|
|
3819
|
-
const r = /* @__PURE__ */ Se(/* @__PURE__ */ ie(e("validation_country_code")), /* @__PURE__ */
|
|
3820
|
-
return
|
|
3843
|
+
}, ri = "44", si = /^[0-9 ]+$/, ni = Re("string"), ii = Re("phone"), ai = (e) => {
|
|
3844
|
+
const r = /* @__PURE__ */ Se(/* @__PURE__ */ ie(e("validation_country_code")), /* @__PURE__ */ St(si, e("validation_country_code"))), t = /* @__PURE__ */ Se(/* @__PURE__ */ ie(e("validation_phone")), /* @__PURE__ */ Te(1, e("validation_phone")), /* @__PURE__ */ It((s) => s.replace(/[^0-9]/g, "")));
|
|
3845
|
+
return lt(/* @__PURE__ */ ge({
|
|
3821
3846
|
countryCode: r,
|
|
3822
3847
|
phoneNumber: t
|
|
3823
3848
|
}));
|
|
3824
|
-
},
|
|
3849
|
+
}, oi = ({
|
|
3825
3850
|
input: e,
|
|
3826
3851
|
onSubmitSuccess: r
|
|
3827
3852
|
}) => {
|
|
3828
|
-
var
|
|
3829
|
-
const t = e.key ? (
|
|
3853
|
+
var E;
|
|
3854
|
+
const t = e.key ? (E = $.current$.value.flow) == null ? void 0 : E.data.submissions[e.key] : void 0, {
|
|
3830
3855
|
t: s
|
|
3831
|
-
} = se(), [i, a] = me(), n =
|
|
3856
|
+
} = se(), [i, a] = me(), n = ni(t) ? ti(t.value) : ii(t) ? t.value : void 0, {
|
|
3832
3857
|
register: o,
|
|
3833
3858
|
handleSubmit: c,
|
|
3834
3859
|
formState: {
|
|
3835
|
-
errors:
|
|
3860
|
+
errors: h
|
|
3836
3861
|
},
|
|
3837
3862
|
watch: b
|
|
3838
|
-
} =
|
|
3863
|
+
} = ot({
|
|
3839
3864
|
defaultValues: {
|
|
3840
|
-
countryCode: (n == null ? void 0 : n.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3865
|
+
countryCode: (n == null ? void 0 : n.countryCode) ?? e.config.defaultValue.countryCode ?? ri,
|
|
3841
3866
|
phoneNumber: (n == null ? void 0 : n.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3842
3867
|
},
|
|
3843
|
-
resolver:
|
|
3868
|
+
resolver: ai(s)
|
|
3844
3869
|
}), {
|
|
3845
3870
|
ref: x,
|
|
3846
|
-
...
|
|
3871
|
+
...p
|
|
3847
3872
|
} = o("phoneNumber", {
|
|
3848
3873
|
required: !e.config.optional
|
|
3849
|
-
}), m = ce(),
|
|
3874
|
+
}), m = ce(), C = b("countryCode");
|
|
3850
3875
|
return Ie(() => {
|
|
3851
3876
|
m.current && (m.current.focus(), m.current.select());
|
|
3852
3877
|
}, []), u("form", {
|
|
@@ -3855,15 +3880,15 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3855
3880
|
onSubmit: c((A) => {
|
|
3856
3881
|
const I = A.phoneNumber.replace(/[^0-9]/g, ""), y = A.countryCode.replace(/[^0-9]/g, "");
|
|
3857
3882
|
a(void 0);
|
|
3858
|
-
const
|
|
3859
|
-
if (V <
|
|
3883
|
+
const _ = e.config.minChars ?? 7, V = I.length + y.length;
|
|
3884
|
+
if (V < _)
|
|
3860
3885
|
return a(s("validation_phone_min_chars", {
|
|
3861
|
-
count:
|
|
3886
|
+
count: _
|
|
3862
3887
|
}));
|
|
3863
|
-
const
|
|
3864
|
-
if (
|
|
3888
|
+
const M = e.config.maxChars;
|
|
3889
|
+
if (M != null && V > M)
|
|
3865
3890
|
return a(s("validation_max_chars", {
|
|
3866
|
-
count:
|
|
3891
|
+
count: M
|
|
3867
3892
|
}));
|
|
3868
3893
|
e.config.submissionFormat === "phone" ? r({
|
|
3869
3894
|
type: "phone",
|
|
@@ -3873,7 +3898,7 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3873
3898
|
}
|
|
3874
3899
|
}) : r({
|
|
3875
3900
|
type: "string",
|
|
3876
|
-
value:
|
|
3901
|
+
value: C + A.phoneNumber
|
|
3877
3902
|
});
|
|
3878
3903
|
}),
|
|
3879
3904
|
children: [u("div", {
|
|
@@ -3884,18 +3909,18 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3884
3909
|
class: "text-neutral-12 bg-lowest hover:bg-neutral-5 placeholder:text-neutral-8 focus-visible:outline-accent-7 focus-within:bg-neutral-5 focus-within:outline-accent-7 outline-divider relative flex h-full cursor-pointer appearance-none items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap rounded-l-full border-solid px-3 py-1.5 text-center text-base outline outline-2 transition-all focus-within:outline-none",
|
|
3885
3910
|
htmlFor: `isdk_phone_${e.key}`,
|
|
3886
3911
|
children: [u("span", {
|
|
3887
|
-
children: ["+",
|
|
3912
|
+
children: ["+", C]
|
|
3888
3913
|
}), u("select", {
|
|
3889
3914
|
...o("countryCode", {}),
|
|
3890
3915
|
id: `isdk_phone_${e.key}`,
|
|
3891
3916
|
class: "absolute inset-0 opacity-0",
|
|
3892
|
-
children: Object.entries(
|
|
3917
|
+
children: Object.entries(Ft).map(([A, I]) => u("option", {
|
|
3893
3918
|
value: I,
|
|
3894
3919
|
children: [A, " (+", I, ")"]
|
|
3895
3920
|
}, A))
|
|
3896
3921
|
})]
|
|
3897
3922
|
}), u("input", {
|
|
3898
|
-
...
|
|
3923
|
+
...p,
|
|
3899
3924
|
id: "chat-input",
|
|
3900
3925
|
type: "tel",
|
|
3901
3926
|
inputMode: "tel",
|
|
@@ -3906,23 +3931,23 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3906
3931
|
ref: (A) => {
|
|
3907
3932
|
A && (m.current = A), x(A);
|
|
3908
3933
|
},
|
|
3909
|
-
class:
|
|
3934
|
+
class: Je({
|
|
3910
3935
|
optional: e.config.optional,
|
|
3911
3936
|
className: "min-w-0 flex-1 rounded-r-full"
|
|
3912
3937
|
}),
|
|
3913
3938
|
placeholder: e.config.placeholder
|
|
3914
|
-
}), e.config.optional && u(
|
|
3939
|
+
}), e.config.optional && u(Fe, {
|
|
3915
3940
|
class: "absolute bottom-0 right-1 top-0",
|
|
3916
3941
|
onClick: () => r(null)
|
|
3917
3942
|
})]
|
|
3918
3943
|
}), u(Ee, {})]
|
|
3919
3944
|
}), u(Be, {
|
|
3920
|
-
error:
|
|
3945
|
+
error: h.countryCode || h.phoneNumber || {
|
|
3921
3946
|
message: i
|
|
3922
3947
|
}
|
|
3923
3948
|
})]
|
|
3924
3949
|
});
|
|
3925
|
-
},
|
|
3950
|
+
}, Qe = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)), li = ({
|
|
3926
3951
|
input: e,
|
|
3927
3952
|
onSubmitSuccess: r
|
|
3928
3953
|
}) => {
|
|
@@ -3930,16 +3955,16 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3930
3955
|
t
|
|
3931
3956
|
} = se(), {
|
|
3932
3957
|
availableAt: s
|
|
3933
|
-
} = e.config, [i, a] = me(() =>
|
|
3934
|
-
|
|
3935
|
-
const
|
|
3936
|
-
if (a(
|
|
3958
|
+
} = e.config, [i, a] = me(() => Qe(s)), [n, o] = me("");
|
|
3959
|
+
vr(() => {
|
|
3960
|
+
const h = Qe(s);
|
|
3961
|
+
if (a(h), h === 0)
|
|
3937
3962
|
return;
|
|
3938
3963
|
o(t("submission_cooldown", {
|
|
3939
|
-
count:
|
|
3964
|
+
count: h
|
|
3940
3965
|
}));
|
|
3941
3966
|
const b = setInterval(() => {
|
|
3942
|
-
const x =
|
|
3967
|
+
const x = Qe(s);
|
|
3943
3968
|
a(x), !(x > 0) && (clearInterval(b), o(t("submission_cooldown_ready")));
|
|
3944
3969
|
}, 250);
|
|
3945
3970
|
return () => clearInterval(b);
|
|
@@ -3953,7 +3978,7 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3953
3978
|
"aria-disabled": c,
|
|
3954
3979
|
"aria-describedby": c ? "submit-cooldown" : void 0,
|
|
3955
3980
|
onClick: () => {
|
|
3956
|
-
|
|
3981
|
+
Qe(s) > 0 || r(null);
|
|
3957
3982
|
},
|
|
3958
3983
|
children: u("span", {
|
|
3959
3984
|
class: "flex items-center gap-1.5",
|
|
@@ -3988,7 +4013,7 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
3988
4013
|
children: n
|
|
3989
4014
|
})]
|
|
3990
4015
|
});
|
|
3991
|
-
},
|
|
4016
|
+
}, ui = {
|
|
3992
4017
|
date: {
|
|
3993
4018
|
type: "date",
|
|
3994
4019
|
inputMode: "text"
|
|
@@ -4007,7 +4032,7 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
4007
4032
|
inputMode: "url",
|
|
4008
4033
|
formNoValidate: !0
|
|
4009
4034
|
}
|
|
4010
|
-
},
|
|
4035
|
+
}, ci = Re("string"), di = (e, r) => {
|
|
4011
4036
|
const t = {
|
|
4012
4037
|
maxLength: r("validation_max_chars", {
|
|
4013
4038
|
count: e.maxChars ?? 999
|
|
@@ -4016,35 +4041,35 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
4016
4041
|
count: e.minChars ?? 1
|
|
4017
4042
|
})
|
|
4018
4043
|
};
|
|
4019
|
-
return
|
|
4044
|
+
return lt(/* @__PURE__ */ ge({
|
|
4020
4045
|
text: {
|
|
4021
|
-
date: /* @__PURE__ */ Se(/* @__PURE__ */ ie(r("validation_date")), /* @__PURE__ */
|
|
4022
|
-
email: /* @__PURE__ */ Se(/* @__PURE__ */ ie(r("validation_email")), /* @__PURE__ */
|
|
4023
|
-
text: /* @__PURE__ */ Se(/* @__PURE__ */ ie(), /* @__PURE__ */
|
|
4024
|
-
url: /* @__PURE__ */ Se(/* @__PURE__ */ ie(r("validation_url")), /* @__PURE__ */
|
|
4046
|
+
date: /* @__PURE__ */ Se(/* @__PURE__ */ ie(r("validation_date")), /* @__PURE__ */ St(/^\d{4}-\d{2}-\d{2}$/, r("validation_date"))),
|
|
4047
|
+
email: /* @__PURE__ */ Se(/* @__PURE__ */ ie(r("validation_email")), /* @__PURE__ */ Fr(r("validation_email")), /* @__PURE__ */ Te(e.minChars ?? 1, t.minLength), /* @__PURE__ */ Ke(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
4048
|
+
text: /* @__PURE__ */ Se(/* @__PURE__ */ ie(), /* @__PURE__ */ Te(e.minChars ?? 1, t.minLength), /* @__PURE__ */ Ke(e.maxChars ?? 1 / 0, t.maxLength)),
|
|
4049
|
+
url: /* @__PURE__ */ Se(/* @__PURE__ */ ie(r("validation_url")), /* @__PURE__ */ Mr(r("validation_url")), /* @__PURE__ */ Te(e.minChars ?? 1, t.minLength), /* @__PURE__ */ Ke(e.maxChars ?? 1 / 0, t.maxLength))
|
|
4025
4050
|
}[e.format]
|
|
4026
4051
|
}));
|
|
4027
|
-
},
|
|
4052
|
+
}, fi = ({
|
|
4028
4053
|
input: e,
|
|
4029
4054
|
onSubmitSuccess: r
|
|
4030
4055
|
}) => {
|
|
4031
4056
|
var x;
|
|
4032
4057
|
const {
|
|
4033
4058
|
t
|
|
4034
|
-
} = se(), s = e.key ? (x =
|
|
4059
|
+
} = se(), s = e.key ? (x = $.current$.value.flow) == null ? void 0 : x.data.submissions[e.key] : void 0, i = e.config.defaultValue, {
|
|
4035
4060
|
register: a,
|
|
4036
4061
|
handleSubmit: n,
|
|
4037
4062
|
formState: {
|
|
4038
4063
|
errors: o
|
|
4039
4064
|
}
|
|
4040
|
-
} =
|
|
4065
|
+
} = ot({
|
|
4041
4066
|
defaultValues: {
|
|
4042
|
-
text:
|
|
4067
|
+
text: ci(s) ? s.value : i ?? ""
|
|
4043
4068
|
},
|
|
4044
|
-
resolver:
|
|
4069
|
+
resolver: di(e.config, t)
|
|
4045
4070
|
}), {
|
|
4046
4071
|
ref: c,
|
|
4047
|
-
...
|
|
4072
|
+
...h
|
|
4048
4073
|
} = a("text", {
|
|
4049
4074
|
required: !e.config.optional
|
|
4050
4075
|
}), b = ce();
|
|
@@ -4053,10 +4078,10 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
4053
4078
|
}, []), u("form", {
|
|
4054
4079
|
noValidate: !0,
|
|
4055
4080
|
class: "flex flex-col gap-1 p-2.5",
|
|
4056
|
-
onSubmit: n((
|
|
4081
|
+
onSubmit: n((p) => {
|
|
4057
4082
|
r({
|
|
4058
4083
|
type: "string",
|
|
4059
|
-
value:
|
|
4084
|
+
value: p.text
|
|
4060
4085
|
});
|
|
4061
4086
|
}),
|
|
4062
4087
|
children: [u("div", {
|
|
@@ -4065,21 +4090,21 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
4065
4090
|
class: "relative min-w-0 flex-1",
|
|
4066
4091
|
children: [u("input", {
|
|
4067
4092
|
id: "chat-input",
|
|
4068
|
-
...
|
|
4069
|
-
...
|
|
4093
|
+
...h,
|
|
4094
|
+
...ui[e.config.format],
|
|
4070
4095
|
autocomplete: "off",
|
|
4071
4096
|
autoCapitalize: "off",
|
|
4072
4097
|
autoCorrect: "off",
|
|
4073
4098
|
autoFocus: !0,
|
|
4074
|
-
ref: (
|
|
4075
|
-
|
|
4099
|
+
ref: (p) => {
|
|
4100
|
+
p && (b.current = p), c(p);
|
|
4076
4101
|
},
|
|
4077
4102
|
placeholder: e.config.placeholder,
|
|
4078
|
-
class:
|
|
4103
|
+
class: Je({
|
|
4079
4104
|
optional: !!e.config.optional,
|
|
4080
4105
|
className: "w-full rounded-full"
|
|
4081
4106
|
})
|
|
4082
|
-
}), e.config.optional && u(
|
|
4107
|
+
}), e.config.optional && u(Fe, {
|
|
4083
4108
|
class: "absolute bottom-0 right-0.5 top-0",
|
|
4084
4109
|
onClick: () => r(null)
|
|
4085
4110
|
})]
|
|
@@ -4088,21 +4113,21 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
4088
4113
|
error: o.text
|
|
4089
4114
|
})]
|
|
4090
4115
|
});
|
|
4091
|
-
},
|
|
4092
|
-
text:
|
|
4093
|
-
phone:
|
|
4094
|
-
"multiple-choice":
|
|
4095
|
-
boolean:
|
|
4096
|
-
file:
|
|
4097
|
-
submit:
|
|
4098
|
-
address:
|
|
4099
|
-
number:
|
|
4100
|
-
},
|
|
4116
|
+
}, hi = {
|
|
4117
|
+
text: fi,
|
|
4118
|
+
phone: oi,
|
|
4119
|
+
"multiple-choice": Xn,
|
|
4120
|
+
boolean: pn,
|
|
4121
|
+
file: wn,
|
|
4122
|
+
submit: li,
|
|
4123
|
+
address: cn,
|
|
4124
|
+
number: ei
|
|
4125
|
+
}, pi = ({
|
|
4101
4126
|
logger: e,
|
|
4102
4127
|
analytics: r
|
|
4103
4128
|
}) => {
|
|
4104
4129
|
var a;
|
|
4105
|
-
const t = (a =
|
|
4130
|
+
const t = (a = $.current$.value.flow) == null ? void 0 : a.data.currentInput, s = ce(null), i = () => ae.onInteractionFn$.value();
|
|
4106
4131
|
return Ie(() => {
|
|
4107
4132
|
var n;
|
|
4108
4133
|
(n = s.current) == null || n.scrollTo({
|
|
@@ -4116,7 +4141,7 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
4116
4141
|
onPointerDownCapture: t ? i : void 0,
|
|
4117
4142
|
onKeyDownCapture: t ? i : void 0,
|
|
4118
4143
|
children: t ? (() => {
|
|
4119
|
-
const n =
|
|
4144
|
+
const n = hi[t.type];
|
|
4120
4145
|
return u(n, {
|
|
4121
4146
|
logger: e,
|
|
4122
4147
|
analytics: r,
|
|
@@ -4128,7 +4153,7 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
4128
4153
|
children: [u("input", {
|
|
4129
4154
|
"aria-hidden": "true",
|
|
4130
4155
|
id: "chat-input",
|
|
4131
|
-
class:
|
|
4156
|
+
class: Je({
|
|
4132
4157
|
optional: !1,
|
|
4133
4158
|
className: "flex-grow rounded-full"
|
|
4134
4159
|
}),
|
|
@@ -4142,30 +4167,30 @@ const ur = 27, cr = 12, dr = 10, zn = Re("enum"), Kn = (e, r) => {
|
|
|
4142
4167
|
})
|
|
4143
4168
|
});
|
|
4144
4169
|
};
|
|
4145
|
-
function
|
|
4170
|
+
function yi(e) {
|
|
4146
4171
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4147
4172
|
}
|
|
4148
|
-
var
|
|
4173
|
+
var mi = function(e) {
|
|
4149
4174
|
return e instanceof RegExp;
|
|
4150
|
-
},
|
|
4175
|
+
}, gi = function(r) {
|
|
4151
4176
|
var t = /[\\^$.*+?()[\]{}|]/g, s = RegExp(t.source);
|
|
4152
4177
|
return r && s.test(r) ? r.replace(t, "\\$&") : r;
|
|
4153
|
-
},
|
|
4178
|
+
}, Jr = function(e) {
|
|
4154
4179
|
return typeof e == "string";
|
|
4155
|
-
},
|
|
4180
|
+
}, bi = function(e) {
|
|
4156
4181
|
var r = [];
|
|
4157
4182
|
return e.forEach(function(t) {
|
|
4158
4183
|
Array.isArray(t) ? r = r.concat(t) : r.push(t);
|
|
4159
4184
|
}), r;
|
|
4160
4185
|
};
|
|
4161
|
-
function
|
|
4186
|
+
function vi(e, r, t) {
|
|
4162
4187
|
var s = 0, i = 0;
|
|
4163
4188
|
if (e === "")
|
|
4164
4189
|
return e;
|
|
4165
|
-
if (!e || !
|
|
4190
|
+
if (!e || !Jr(e))
|
|
4166
4191
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
4167
4192
|
var a = r;
|
|
4168
|
-
|
|
4193
|
+
mi(a) || (a = new RegExp("(" + gi(a) + ")", "gi"));
|
|
4169
4194
|
for (var n = e.split(a), o = 1, c = n.length; o < c; o += 2) {
|
|
4170
4195
|
if (n[o] === void 0 || n[o - 1] === void 0) {
|
|
4171
4196
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
@@ -4175,32 +4200,32 @@ function yi(e, r, t) {
|
|
|
4175
4200
|
}
|
|
4176
4201
|
return n;
|
|
4177
4202
|
}
|
|
4178
|
-
var
|
|
4179
|
-
return Array.isArray(r) || (r = [r]),
|
|
4180
|
-
return
|
|
4203
|
+
var xi = function(r, t, s) {
|
|
4204
|
+
return Array.isArray(r) || (r = [r]), bi(r.map(function(i) {
|
|
4205
|
+
return Jr(i) ? vi(i, t, s) : i;
|
|
4181
4206
|
}));
|
|
4182
4207
|
};
|
|
4183
|
-
const
|
|
4184
|
-
const r =
|
|
4185
|
-
const [, c,
|
|
4186
|
-
return
|
|
4208
|
+
const qe = /* @__PURE__ */ yi(xi), wi = /(\[[^\]]+\]\([^)]+\))/g, _i = /\[([^\]]+)\]\(([^)]+)\)/, ki = /(https?:\/\/[^\s]+)/g, Ci = /_(.*?)_/g, Si = /\*\*(.*?)\*\*/g, Ii = /\\n|\n/g, pr = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", Fi = (e) => {
|
|
4209
|
+
const r = qe(e, wi, (n, o) => {
|
|
4210
|
+
const [, c, h] = n.match(_i) ?? [];
|
|
4211
|
+
return h ? u("a", {
|
|
4187
4212
|
class: pr,
|
|
4188
|
-
href:
|
|
4189
|
-
children: c ??
|
|
4190
|
-
},
|
|
4213
|
+
href: h,
|
|
4214
|
+
children: c ?? h
|
|
4215
|
+
}, h + o) : u("span", {
|
|
4191
4216
|
children: "INVALID LINK"
|
|
4192
4217
|
});
|
|
4193
|
-
}), t =
|
|
4218
|
+
}), t = qe(r, ki, (n, o) => u("a", {
|
|
4194
4219
|
class: pr,
|
|
4195
4220
|
href: n,
|
|
4196
4221
|
children: n
|
|
4197
|
-
}, n + o)), s =
|
|
4222
|
+
}, n + o)), s = qe(t, Ci, (n, o) => u("em", {
|
|
4198
4223
|
children: n
|
|
4199
|
-
}, n + o)), i =
|
|
4224
|
+
}, n + o)), i = qe(s, Si, (n, o) => u("strong", {
|
|
4200
4225
|
children: n
|
|
4201
4226
|
}, n + o));
|
|
4202
|
-
return
|
|
4203
|
-
},
|
|
4227
|
+
return qe(i, Ii, (n, o) => u("br", {}, `br-${o}`));
|
|
4228
|
+
}, Vi = st("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", {
|
|
4204
4229
|
variants: {
|
|
4205
4230
|
side: {
|
|
4206
4231
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -4214,7 +4239,7 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4214
4239
|
defaultVariants: {
|
|
4215
4240
|
side: "left"
|
|
4216
4241
|
}
|
|
4217
|
-
}),
|
|
4242
|
+
}), Ai = ({
|
|
4218
4243
|
children: e,
|
|
4219
4244
|
className: r,
|
|
4220
4245
|
animate: t,
|
|
@@ -4224,14 +4249,14 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4224
4249
|
style: {
|
|
4225
4250
|
transformOrigin: s === "left" ? "0% 50%" : "100% 50%"
|
|
4226
4251
|
},
|
|
4227
|
-
class:
|
|
4252
|
+
class: Vi({
|
|
4228
4253
|
className: r,
|
|
4229
4254
|
side: s,
|
|
4230
4255
|
animate: t
|
|
4231
4256
|
}),
|
|
4232
4257
|
...i,
|
|
4233
4258
|
children: e
|
|
4234
|
-
}),
|
|
4259
|
+
}), Mi = ({
|
|
4235
4260
|
message: e
|
|
4236
4261
|
}) => u("div", {
|
|
4237
4262
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -4255,7 +4280,7 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4255
4280
|
})
|
|
4256
4281
|
})]
|
|
4257
4282
|
})
|
|
4258
|
-
}),
|
|
4283
|
+
}), Ei = ({
|
|
4259
4284
|
className: e,
|
|
4260
4285
|
...r
|
|
4261
4286
|
}) => u("div", {
|
|
@@ -4273,10 +4298,10 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4273
4298
|
}
|
|
4274
4299
|
}))
|
|
4275
4300
|
}) : void 0
|
|
4276
|
-
}),
|
|
4301
|
+
}), Ni = {
|
|
4277
4302
|
bot: "left",
|
|
4278
4303
|
user: "right"
|
|
4279
|
-
},
|
|
4304
|
+
}, Li = st("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)]", {
|
|
4280
4305
|
variants: {
|
|
4281
4306
|
variant: {
|
|
4282
4307
|
info: "text-neutral-8",
|
|
@@ -4285,10 +4310,10 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4285
4310
|
success: "text-[#4CAF50]"
|
|
4286
4311
|
}
|
|
4287
4312
|
}
|
|
4288
|
-
}),
|
|
4313
|
+
}), Ti = ({
|
|
4289
4314
|
lastSentMessageFooter: e
|
|
4290
4315
|
}) => {
|
|
4291
|
-
const r =
|
|
4316
|
+
const r = $.current$.value.flow, t = (r == null ? void 0 : r.data.messages) ?? [], s = r ? kt(r) : void 0;
|
|
4292
4317
|
return u("ol", {
|
|
4293
4318
|
"aria-label": "Chat messages",
|
|
4294
4319
|
"aria-live": "polite",
|
|
@@ -4297,28 +4322,28 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4297
4322
|
children: u("li", {
|
|
4298
4323
|
class: "flex",
|
|
4299
4324
|
tabIndex: a === t.length - 1 ? -1 : void 0,
|
|
4300
|
-
children: [s && i.groupId === s && !t.slice(a + 1).some((n) => n.groupId === s) ? e : null,
|
|
4325
|
+
children: [s && i.groupId === s && !t.slice(a + 1).some((n) => n.groupId === s) ? e : null, ds(i).with({
|
|
4301
4326
|
type: "system"
|
|
4302
4327
|
}, (n) => u("p", {
|
|
4303
|
-
class:
|
|
4328
|
+
class: Li({
|
|
4304
4329
|
variant: n.variant
|
|
4305
4330
|
}),
|
|
4306
4331
|
children: n.text
|
|
4307
4332
|
})).with({
|
|
4308
4333
|
type: "text",
|
|
4309
|
-
author:
|
|
4334
|
+
author: fs.union("bot", "user")
|
|
4310
4335
|
}, (n) => {
|
|
4311
|
-
const o = a === t.length - 1, c = n.author === "bot" ?
|
|
4336
|
+
const o = a === t.length - 1, c = n.author === "bot" ? Fi(n.text) : n.text;
|
|
4312
4337
|
return u(be, {
|
|
4313
|
-
children: u(
|
|
4338
|
+
children: u(Ai, {
|
|
4314
4339
|
animate: o,
|
|
4315
|
-
side:
|
|
4340
|
+
side: Ni[n.author],
|
|
4316
4341
|
children: c
|
|
4317
4342
|
}, a)
|
|
4318
4343
|
});
|
|
4319
4344
|
}).with({
|
|
4320
4345
|
type: "link"
|
|
4321
|
-
}, (n) => u(
|
|
4346
|
+
}, (n) => u(Mi, {
|
|
4322
4347
|
message: n
|
|
4323
4348
|
})).with({
|
|
4324
4349
|
type: "image"
|
|
@@ -4330,7 +4355,7 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4330
4355
|
}
|
|
4331
4356
|
})).with({
|
|
4332
4357
|
type: "file"
|
|
4333
|
-
}, (n) => u(
|
|
4358
|
+
}, (n) => u(gn, {
|
|
4334
4359
|
class: n.author === "bot" ? void 0 : "ml-auto",
|
|
4335
4360
|
file: {
|
|
4336
4361
|
name: n.fileName,
|
|
@@ -4342,7 +4367,7 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4342
4367
|
const o = t[t.length - 1];
|
|
4343
4368
|
return !(n === o) || ae.isBotTyping$.value ? null : u("div", {
|
|
4344
4369
|
class: "flex flex-grow flex-col items-center justify-center gap-2",
|
|
4345
|
-
children: [u(
|
|
4370
|
+
children: [u(Ct, {
|
|
4346
4371
|
"aria-hidden": n.text ? "true" : void 0,
|
|
4347
4372
|
class: "text-neutral-6 h-8 w-8"
|
|
4348
4373
|
}), n.text ? u("p", {
|
|
@@ -4353,9 +4378,9 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4353
4378
|
});
|
|
4354
4379
|
}).exhaustive()]
|
|
4355
4380
|
})
|
|
4356
|
-
}, a)), u(
|
|
4381
|
+
}, a)), u(Ei, {}, "typing")]
|
|
4357
4382
|
});
|
|
4358
|
-
},
|
|
4383
|
+
}, Pi = ({
|
|
4359
4384
|
logger: e,
|
|
4360
4385
|
apiClient: r,
|
|
4361
4386
|
analytics: t,
|
|
@@ -4363,37 +4388,37 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4363
4388
|
}) => {
|
|
4364
4389
|
const {
|
|
4365
4390
|
flow: i
|
|
4366
|
-
} =
|
|
4367
|
-
|
|
4368
|
-
const a =
|
|
4391
|
+
} = $.current$.value;
|
|
4392
|
+
Me(i, "Flow is required to exist to show chatbot body");
|
|
4393
|
+
const a = $.viewState$.value, {
|
|
4369
4394
|
chatRef: n,
|
|
4370
4395
|
chatService: o
|
|
4371
|
-
} =
|
|
4396
|
+
} = hs(), {
|
|
4372
4397
|
t: c
|
|
4373
|
-
} = se(), [
|
|
4398
|
+
} = se(), [h, b] = me();
|
|
4374
4399
|
return Ie(() => {
|
|
4375
4400
|
a === "maximised" && ae.scrollToEnd();
|
|
4376
4401
|
}, [a]), Ie(() => {
|
|
4377
4402
|
var y;
|
|
4378
4403
|
const {
|
|
4379
4404
|
state: x,
|
|
4380
|
-
flow:
|
|
4381
|
-
} =
|
|
4405
|
+
flow: p
|
|
4406
|
+
} = $.current$.peek();
|
|
4382
4407
|
if (x !== "loaded")
|
|
4383
4408
|
throw new Error(c("invalid_state"));
|
|
4384
|
-
let m =
|
|
4385
|
-
if (ae.scrollToEnd(),
|
|
4409
|
+
let m = p.data.nodeHistory.at(-1);
|
|
4410
|
+
if (ae.scrollToEnd(), $.setInput(void 0), p.data.isFinished)
|
|
4386
4411
|
return;
|
|
4387
|
-
const
|
|
4388
|
-
const
|
|
4389
|
-
!
|
|
4412
|
+
const C = () => {
|
|
4413
|
+
const _ = $.current$.peek().flow;
|
|
4414
|
+
!_ || _.data.hasInteracted || ($.markAsInteracted(), Ut(t, _, "FLOW_INTERACT"));
|
|
4390
4415
|
};
|
|
4391
|
-
ae.onInteractionFn$.value =
|
|
4416
|
+
ae.onInteractionFn$.value = C, m === void 0 ? (m = gr(i.nodes).id, $.setCurrentNodeId(m), Ut(t, p, "FLOW_START")) : $.removeMessagesSentByNodeIds([m]);
|
|
4392
4417
|
const {
|
|
4393
|
-
interpret:
|
|
4418
|
+
interpret: E,
|
|
4394
4419
|
abort: A,
|
|
4395
4420
|
undo: I
|
|
4396
|
-
} =
|
|
4421
|
+
} = ws({
|
|
4397
4422
|
context: i.context,
|
|
4398
4423
|
analytics: {
|
|
4399
4424
|
service: t,
|
|
@@ -4406,27 +4431,27 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4406
4431
|
chatService: o,
|
|
4407
4432
|
t: c,
|
|
4408
4433
|
getApplicationRecovery: () => {
|
|
4409
|
-
var
|
|
4410
|
-
return (
|
|
4434
|
+
var _;
|
|
4435
|
+
return (_ = $.current$.peek().flow) == null ? void 0 : _.data.applicationRecovery;
|
|
4411
4436
|
},
|
|
4412
|
-
setApplicationRecovery:
|
|
4413
|
-
persistWriteBarrier: () =>
|
|
4437
|
+
setApplicationRecovery: $.setApplicationRecovery,
|
|
4438
|
+
persistWriteBarrier: () => $.persistWriteBarrier(p),
|
|
4414
4439
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
4415
4440
|
getSubmissions: () => {
|
|
4416
|
-
var
|
|
4417
|
-
return (
|
|
4441
|
+
var _;
|
|
4442
|
+
return (_ = $.current$.peek().flow) == null ? void 0 : _.data.submissions;
|
|
4418
4443
|
},
|
|
4419
|
-
onInterpret: (
|
|
4444
|
+
onInterpret: (_) => $.setCurrentNodeId(_.id),
|
|
4420
4445
|
onFlowEnd: async () => {
|
|
4421
4446
|
var V;
|
|
4422
|
-
|
|
4423
|
-
const
|
|
4424
|
-
|
|
4447
|
+
$.markAsFinished();
|
|
4448
|
+
const _ = $.current$.peek().flow;
|
|
4449
|
+
Me(_), t.log({
|
|
4425
4450
|
event: "FLOW_END",
|
|
4426
4451
|
properties: {
|
|
4427
4452
|
flow_id: i.id,
|
|
4428
4453
|
flow_version: i.version,
|
|
4429
|
-
flow_session_id:
|
|
4454
|
+
flow_session_id: _.data.flowSessionId,
|
|
4430
4455
|
flow_build: i.build,
|
|
4431
4456
|
job: i.job
|
|
4432
4457
|
},
|
|
@@ -4434,8 +4459,8 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4434
4459
|
});
|
|
4435
4460
|
}
|
|
4436
4461
|
});
|
|
4437
|
-
return b(() => I),
|
|
4438
|
-
ae.onInteractionFn$.value ===
|
|
4462
|
+
return b(() => I), E(m), () => {
|
|
4463
|
+
ae.onInteractionFn$.value === C && (ae.onInteractionFn$.value = () => {
|
|
4439
4464
|
}), A();
|
|
4440
4465
|
};
|
|
4441
4466
|
}, [t, r, o, e, i, s, c]), u(be, {
|
|
@@ -4450,31 +4475,31 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4450
4475
|
style: {
|
|
4451
4476
|
WebkitOverflowScrolling: "touch"
|
|
4452
4477
|
},
|
|
4453
|
-
children: u(
|
|
4454
|
-
lastSentMessageFooter: !
|
|
4455
|
-
undoFn:
|
|
4478
|
+
children: u(Ti, {
|
|
4479
|
+
lastSentMessageFooter: !kt(i) || !h ? null : u(Di, {
|
|
4480
|
+
undoFn: h
|
|
4456
4481
|
})
|
|
4457
4482
|
})
|
|
4458
4483
|
}), ae.isReadingHistory$.value && !i.data.isFinished && !ae.isBotTyping$.value && u("div", {
|
|
4459
4484
|
class: "absolute bottom-2 left-1/2 -translate-x-1/2",
|
|
4460
|
-
children: u(
|
|
4485
|
+
children: u(wr, {
|
|
4461
4486
|
class: "bg-neutral-1 ring-divider shadow-surface-md ring-1",
|
|
4462
4487
|
"aria-label": c("jump_to_current"),
|
|
4463
4488
|
onClick: () => {
|
|
4464
|
-
var
|
|
4465
|
-
ae.scrollToEnd(), (m = ((
|
|
4489
|
+
var p, m;
|
|
4490
|
+
ae.scrollToEnd(), (m = ((p = n.current) == null ? void 0 : p.querySelector('li[tabindex="-1"]')) ?? n.current) == null || m.focus({
|
|
4466
4491
|
preventScroll: !0
|
|
4467
4492
|
});
|
|
4468
4493
|
},
|
|
4469
4494
|
children: u(ps, {})
|
|
4470
4495
|
})
|
|
4471
4496
|
})]
|
|
4472
|
-
}), u(
|
|
4497
|
+
}), u(pi, {
|
|
4473
4498
|
logger: e,
|
|
4474
4499
|
analytics: t
|
|
4475
4500
|
})]
|
|
4476
4501
|
});
|
|
4477
|
-
},
|
|
4502
|
+
}, Di = ({
|
|
4478
4503
|
undoFn: e
|
|
4479
4504
|
}) => {
|
|
4480
4505
|
const {
|
|
@@ -4482,13 +4507,13 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4482
4507
|
} = se();
|
|
4483
4508
|
return u("div", {
|
|
4484
4509
|
class: "flex flex-1 items-center justify-end px-1",
|
|
4485
|
-
children: u(
|
|
4510
|
+
children: u(wr, {
|
|
4486
4511
|
"aria-label": r("undo"),
|
|
4487
4512
|
onClick: async () => {
|
|
4488
4513
|
const {
|
|
4489
4514
|
flow: t
|
|
4490
|
-
} =
|
|
4491
|
-
|
|
4515
|
+
} = $.current$.peek();
|
|
4516
|
+
Me(t), e(t.data.nodeHistory);
|
|
4492
4517
|
},
|
|
4493
4518
|
children: u("path", {
|
|
4494
4519
|
d: "M3 13h2.67l6.66-6.67a1.9 1.9 0 0 0 0-2.66 1.91 1.91 0 0 0-2.66 0L3 10.33V13Zm4.6-7.25 2.67 2.67"
|
|
@@ -4497,5 +4522,5 @@ const $e = /* @__PURE__ */ di(mi), gi = /(\[[^\]]+\]\([^)]+\))/g, bi = /\[([^\]]
|
|
|
4497
4522
|
});
|
|
4498
4523
|
};
|
|
4499
4524
|
export {
|
|
4500
|
-
|
|
4525
|
+
Pi as ChatbotBody
|
|
4501
4526
|
};
|