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