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