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