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