@inploi/plugin-chatbot 14.18.1 → 14.19.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/README.md +10 -0
- package/cdn/index.js +11 -11
- package/dist/chatbot-body-B75cUCyM.js +3542 -0
- package/dist/chatbot-body-DNPAc97n.cjs +1 -0
- package/dist/index-CGRnGR-K.js +4132 -0
- package/dist/index-NnL-o0w8.cjs +25 -0
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +2 -2
- package/package.json +11 -10
- package/dist/chatbot-body-DjE1hhPI.js +0 -4309
- package/dist/chatbot-body-Y8XV3f3-.cjs +0 -5
- package/dist/index-C8Gr0Ijn.js +0 -3198
- package/dist/index-DSa7ZKqt.cjs +0 -21
|
@@ -0,0 +1,3542 @@
|
|
|
1
|
+
import { s as M, u as J, o as a, c as Le, y as ye, a as Ge, b as Xe, h as me, _ as ie, p as Ye, i as Ce, F as on, k as de, L as yt, g as ln, d as yr, S as je, e as cn, B as lt, f as un, q as dn, j as Re, C as Y, l as fn, O as hn, m as ne, n as pn, r as mn, t as gn, v as vr, w as br, M as yn, z as vn, x as bn, E as xn, A as wn, D as _n, G as kn, H as xr, I as Cn, J as Sn } from "./index-CGRnGR-K.js";
|
|
2
|
+
import { addressSearchCountry as Bt, searchAddressSuggestions as An, saveClosedRoleJobAlerts as En } from "@inploi/sdk";
|
|
3
|
+
var Ue = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z])\s*[\da-z]{4})\b/i, wr = /^(?:GIR0AA|[A-Z]{1,2}\d[\dA-Z]?\d[A-Z]{2})$/, _r = /^[A-Z](?:\d{2}|\d[A-Z])[\dA-Z]{4}$/, kr = ({
|
|
4
|
+
postcode: e,
|
|
5
|
+
label: r = "",
|
|
6
|
+
state: t,
|
|
7
|
+
country: n
|
|
8
|
+
}) => {
|
|
9
|
+
var c, h, p;
|
|
10
|
+
const i = ((e == null ? void 0 : e.trim()) || ((c = r.match(Ue)) == null ? void 0 : c[0]) || "").replace(/\s/g, "").toUpperCase();
|
|
11
|
+
if (wr.test(i))
|
|
12
|
+
return i.startsWith("BT") ? "ni" : "gb";
|
|
13
|
+
if (_r.test(i))
|
|
14
|
+
return "ie";
|
|
15
|
+
const s = (g) => g.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, " ").trim();
|
|
16
|
+
if (s(t ?? "") === "northern ireland" || r.split(",").some((g) => s(g) === "northern ireland"))
|
|
17
|
+
return "ni";
|
|
18
|
+
const o = (p = (n == null ? void 0 : n.trim()) || ((h = r.split(",").at(-1)) == null ? void 0 : h.trim())) == null ? void 0 : p.toLowerCase();
|
|
19
|
+
return o === "united kingdom" || o === "gb" ? "gb" : o === "ireland" || o === "ie" ? "ie" : null;
|
|
20
|
+
}, Fn = "https://maps.inploi.com/address", Vn = (e) => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, " ").trim(), jt = (e) => e.split(",").map(
|
|
21
|
+
(r) => Vn(r).replace(/^\d+[a-z]?(?:\s*[-/]\s*\d+[a-z]?)?(?:\s+|$)/, "").trim()
|
|
22
|
+
), Ut = (e) => wr.test(e) ? `gb:${e.slice(0, -3)}` : _r.test(e) ? `ie:${e.slice(0, 3)}` : null, In = (e, r, t) => {
|
|
23
|
+
const [n = "", i = ""] = jt(e), s = Ut(r), o = i.replace(Ue, "").trim(), c = o && !["united kingdom", "ireland", "england", "scotland", "wales", "northern ireland"].includes(o);
|
|
24
|
+
if (!n || !s && !c)
|
|
25
|
+
return null;
|
|
26
|
+
const h = t.slice(0, 3).findIndex((p) => {
|
|
27
|
+
var f;
|
|
28
|
+
const g = jt(p);
|
|
29
|
+
if (!g.includes(n))
|
|
30
|
+
return !1;
|
|
31
|
+
const m = ((f = p.match(Ue)) == null ? void 0 : f[0].replace(/\s/g, "").toUpperCase()) ?? "", v = Ut(m);
|
|
32
|
+
return s && v ? s === v : !!(c && g.some((b) => b.replace(Ue, "").trim() === o));
|
|
33
|
+
});
|
|
34
|
+
return h === -1 ? null : h + 1;
|
|
35
|
+
}, Dn = async ({
|
|
36
|
+
query: e,
|
|
37
|
+
country: r,
|
|
38
|
+
pickedLabel: t,
|
|
39
|
+
pickedPostcode: n,
|
|
40
|
+
pickedCountry: i,
|
|
41
|
+
pickedState: s,
|
|
42
|
+
log: o
|
|
43
|
+
}) => {
|
|
44
|
+
var h, p, g;
|
|
45
|
+
if (!r || !r.split(",").every((m) => /^(gb|ie)$/i.test(m.trim())))
|
|
46
|
+
return;
|
|
47
|
+
let c;
|
|
48
|
+
try {
|
|
49
|
+
const m = new AbortController();
|
|
50
|
+
c = setTimeout(() => m.abort(), 1500);
|
|
51
|
+
const v = new URL(Fn);
|
|
52
|
+
v.search = new URLSearchParams({ q: e, country: r, limit: "5" }).toString();
|
|
53
|
+
const f = await fetch(v.href, { signal: m.signal });
|
|
54
|
+
if (!f.ok)
|
|
55
|
+
return;
|
|
56
|
+
const b = await f.json();
|
|
57
|
+
if (typeof b != "object" || b === null || !("results" in b) || !Array.isArray(b.results) || !("source" in b) || b.source !== "photon" && b.source !== "mapbox")
|
|
58
|
+
return;
|
|
59
|
+
const F = b.results, k = [];
|
|
60
|
+
for (const K of F) {
|
|
61
|
+
if (typeof K != "object" || K === null || !("label" in K) || typeof K.label != "string")
|
|
62
|
+
return;
|
|
63
|
+
k.push(K.label);
|
|
64
|
+
}
|
|
65
|
+
const A = ((n == null ? void 0 : n.trim()) || ((h = t.match(Ue)) == null ? void 0 : h[0]) || "").replace(/\s/g, "").toUpperCase(), _ = In(t, A, k), L = (g = (p = f.headers.get("Server-Timing")) == null ? void 0 : p.match(/(?:^|,)\s*lookup\s*;\s*dur=([\d.]+)/)) == null ? void 0 : g[1], N = L === void 0 ? null : Number(L), D = f.headers.get("X-Geo-Fallback"), G = kr({
|
|
66
|
+
postcode: n,
|
|
67
|
+
label: t,
|
|
68
|
+
state: s,
|
|
69
|
+
country: i
|
|
70
|
+
});
|
|
71
|
+
await o({
|
|
72
|
+
hit: _ !== null,
|
|
73
|
+
rank: _,
|
|
74
|
+
results: k.length,
|
|
75
|
+
source: b.source,
|
|
76
|
+
// Only machine codes are telemetry: never forward arbitrary response text.
|
|
77
|
+
fallback: D && /^[a-z0-9_-]{1,64}$/i.test(D) ? D : null,
|
|
78
|
+
ms: N !== null && Number.isFinite(N) ? N : null,
|
|
79
|
+
region: G
|
|
80
|
+
});
|
|
81
|
+
} catch {
|
|
82
|
+
} finally {
|
|
83
|
+
clearTimeout(c);
|
|
84
|
+
}
|
|
85
|
+
}, Ln = "https://maps.inploi.com", Rn = async (e, r, t = Date.now() + 2500) => {
|
|
86
|
+
r == null || r.throwIfAborted();
|
|
87
|
+
const n = new AbortController(), i = () => n.abort(r == null ? void 0 : r.reason);
|
|
88
|
+
r == null || r.addEventListener("abort", i, { once: !0 });
|
|
89
|
+
let s;
|
|
90
|
+
try {
|
|
91
|
+
const o = new Promise((h, p) => {
|
|
92
|
+
n.signal.addEventListener("abort", () => p(n.signal.reason), { once: !0 }), s = setTimeout(() => n.abort(), Math.max(0, t - Date.now()));
|
|
93
|
+
}), c = await Promise.race([e(n.signal), o]);
|
|
94
|
+
return r == null || r.throwIfAborted(), c;
|
|
95
|
+
} catch {
|
|
96
|
+
r == null || r.throwIfAborted();
|
|
97
|
+
return;
|
|
98
|
+
} finally {
|
|
99
|
+
clearTimeout(s), r == null || r.removeEventListener("abort", i);
|
|
100
|
+
}
|
|
101
|
+
}, Tn = async (e, r, t) => await Rn(
|
|
102
|
+
async (i) => {
|
|
103
|
+
const { lookupAddress: s } = await import("./common.geo-transport-CJGUJXTA-BsgnqoTX.js");
|
|
104
|
+
return i.throwIfAborted(), s({ ...e, signal: i });
|
|
105
|
+
},
|
|
106
|
+
e.signal,
|
|
107
|
+
t
|
|
108
|
+
) ?? { results: await r(), arm: "direct", source: "direct" }, Mn = (e) => {
|
|
109
|
+
try {
|
|
110
|
+
const r = new URL("/outcome", Ln);
|
|
111
|
+
r.search = new URLSearchParams({
|
|
112
|
+
kind: e.kind,
|
|
113
|
+
surface: e.surface,
|
|
114
|
+
arm: e.arm,
|
|
115
|
+
picked: e.picked ? "1" : "0"
|
|
116
|
+
}).toString(), r.searchParams.set("source", e.source), e.picked && e.edited !== void 0 && r.searchParams.set("edited", e.edited ? "1" : "0"), e.region && r.searchParams.set("region", e.region), fetch(r.href, { keepalive: !0 }).catch(() => {
|
|
117
|
+
});
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const zt = (e, r, t) => {
|
|
122
|
+
var n;
|
|
123
|
+
return e.log({
|
|
124
|
+
event: t,
|
|
125
|
+
properties: {
|
|
126
|
+
flow_id: r.id,
|
|
127
|
+
flow_version: r.version,
|
|
128
|
+
flow_session_id: r.data.flowSessionId,
|
|
129
|
+
flow_build: r.build,
|
|
130
|
+
flow_type: "CHATBOT_DRAWER",
|
|
131
|
+
job: r.job
|
|
132
|
+
},
|
|
133
|
+
customProperties: (n = r.analytics) == null ? void 0 : n.customProperties
|
|
134
|
+
});
|
|
135
|
+
}, pt = "resume-prompt", Nn = async ({
|
|
136
|
+
chatService: e,
|
|
137
|
+
t: r,
|
|
138
|
+
signal: t
|
|
139
|
+
}) => {
|
|
140
|
+
await e.send({
|
|
141
|
+
message: { type: "text", author: "bot", text: r("resume_prompt") },
|
|
142
|
+
groupId: pt,
|
|
143
|
+
signal: t
|
|
144
|
+
});
|
|
145
|
+
const n = await e.input({
|
|
146
|
+
input: {
|
|
147
|
+
type: "boolean",
|
|
148
|
+
key: void 0,
|
|
149
|
+
config: { labels: { true: r("resume_continue"), false: r("resume_start_again") }, optional: !1 }
|
|
150
|
+
},
|
|
151
|
+
signal: t
|
|
152
|
+
});
|
|
153
|
+
return M.removeMessagesSentByNodeIds([pt]), (n == null ? void 0 : n.value) !== !1;
|
|
154
|
+
}, Se = ({ class: e, ...r }) => {
|
|
155
|
+
const { t } = J();
|
|
156
|
+
return /* @__PURE__ */ a(
|
|
157
|
+
"button",
|
|
158
|
+
{
|
|
159
|
+
class: Le(
|
|
160
|
+
"bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50",
|
|
161
|
+
e
|
|
162
|
+
),
|
|
163
|
+
type: "submit",
|
|
164
|
+
...r,
|
|
165
|
+
children: /* @__PURE__ */ a(
|
|
166
|
+
"svg",
|
|
167
|
+
{
|
|
168
|
+
class: "block",
|
|
169
|
+
width: "16",
|
|
170
|
+
height: "16",
|
|
171
|
+
viewBox: "0 0 16 16",
|
|
172
|
+
fill: "transparent",
|
|
173
|
+
stroke: "currentColor",
|
|
174
|
+
"stroke-linecap": "round",
|
|
175
|
+
"stroke-width": "2",
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ a("title", { children: t("send") }),
|
|
178
|
+
/* @__PURE__ */ a("path", { d: "M3.5 7.5L8 3L12.5 7.5" }),
|
|
179
|
+
/* @__PURE__ */ a("path", { d: "M8 4V13" })
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
let ce;
|
|
187
|
+
const On = {
|
|
188
|
+
lang: void 0,
|
|
189
|
+
message: void 0,
|
|
190
|
+
abortEarly: void 0,
|
|
191
|
+
abortPipeEarly: void 0
|
|
192
|
+
};
|
|
193
|
+
// @__NO_SIDE_EFFECTS__
|
|
194
|
+
function vt(e) {
|
|
195
|
+
return !e && !ce ? On : {
|
|
196
|
+
lang: (e == null ? void 0 : e.lang) ?? (ce == null ? void 0 : ce.lang),
|
|
197
|
+
message: e == null ? void 0 : e.message,
|
|
198
|
+
abortEarly: (e == null ? void 0 : e.abortEarly) ?? (ce == null ? void 0 : ce.abortEarly),
|
|
199
|
+
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (ce == null ? void 0 : ce.abortPipeEarly)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
let ct;
|
|
203
|
+
// @__NO_SIDE_EFFECTS__
|
|
204
|
+
function Pn(e) {
|
|
205
|
+
return ct == null ? void 0 : ct.get(e);
|
|
206
|
+
}
|
|
207
|
+
let ut;
|
|
208
|
+
// @__NO_SIDE_EFFECTS__
|
|
209
|
+
function Bn(e) {
|
|
210
|
+
return ut == null ? void 0 : ut.get(e);
|
|
211
|
+
}
|
|
212
|
+
let dt;
|
|
213
|
+
// @__NO_SIDE_EFFECTS__
|
|
214
|
+
function jn(e, r) {
|
|
215
|
+
var t;
|
|
216
|
+
return (t = dt == null ? void 0 : dt.get(e)) == null ? void 0 : t.get(r);
|
|
217
|
+
}
|
|
218
|
+
// @__NO_SIDE_EFFECTS__
|
|
219
|
+
function Ie(e) {
|
|
220
|
+
var t, n;
|
|
221
|
+
const r = typeof e;
|
|
222
|
+
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;
|
|
223
|
+
}
|
|
224
|
+
function Z(e, r, t, n, i) {
|
|
225
|
+
const s = i && "input" in i ? i.input : t.value, o = (i == null ? void 0 : i.expected) ?? e.expects ?? null, c = (i == null ? void 0 : i.received) ?? /* @__PURE__ */ Ie(s), h = {
|
|
226
|
+
kind: e.kind,
|
|
227
|
+
type: e.type,
|
|
228
|
+
input: s,
|
|
229
|
+
expected: o,
|
|
230
|
+
received: c,
|
|
231
|
+
message: `Invalid ${r}: ${o ? `Expected ${o} but r` : "R"}eceived ${c}`,
|
|
232
|
+
requirement: e.requirement,
|
|
233
|
+
path: i == null ? void 0 : i.path,
|
|
234
|
+
issues: i == null ? void 0 : i.issues,
|
|
235
|
+
lang: n.lang,
|
|
236
|
+
abortEarly: n.abortEarly,
|
|
237
|
+
abortPipeEarly: n.abortPipeEarly
|
|
238
|
+
}, p = e.kind === "schema", g = (i == null ? void 0 : i.message) ?? e.message ?? /* @__PURE__ */ jn(e.reference, h.lang) ?? (p ? /* @__PURE__ */ Bn(h.lang) : null) ?? n.message ?? /* @__PURE__ */ Pn(h.lang);
|
|
239
|
+
g !== void 0 && (h.message = typeof g == "function" ? g(h) : g), p && (t.typed = !1), t.issues ? t.issues.push(h) : t.issues = [h];
|
|
240
|
+
}
|
|
241
|
+
const qt = /* @__PURE__ */ new WeakMap();
|
|
242
|
+
// @__NO_SIDE_EFFECTS__
|
|
243
|
+
function fe(e) {
|
|
244
|
+
let r = qt.get(e);
|
|
245
|
+
return r || (r = {
|
|
246
|
+
version: 1,
|
|
247
|
+
vendor: "valibot",
|
|
248
|
+
validate(t) {
|
|
249
|
+
return e["~run"]({ value: t }, /* @__PURE__ */ vt());
|
|
250
|
+
}
|
|
251
|
+
}, qt.set(e, r)), r;
|
|
252
|
+
}
|
|
253
|
+
// @__NO_SIDE_EFFECTS__
|
|
254
|
+
function Un(e, r) {
|
|
255
|
+
return Object.prototype.hasOwnProperty.call(e, r) && r !== "__proto__" && r !== "prototype" && r !== "constructor";
|
|
256
|
+
}
|
|
257
|
+
// @__NO_SIDE_EFFECTS__
|
|
258
|
+
function zn(e, r) {
|
|
259
|
+
const t = [...new Set(e)];
|
|
260
|
+
return t.length > 1 ? `(${t.join(` ${r} `)})` : t[0] ?? "never";
|
|
261
|
+
}
|
|
262
|
+
// @__NO_SIDE_EFFECTS__
|
|
263
|
+
function qn(e) {
|
|
264
|
+
if (e.path) {
|
|
265
|
+
let r = "";
|
|
266
|
+
for (const t of e.path) if (typeof t.key == "string" || typeof t.key == "number") r ? r += `.${t.key}` : r += t.key;
|
|
267
|
+
else return null;
|
|
268
|
+
return r;
|
|
269
|
+
}
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
var Cr = class extends Error {
|
|
273
|
+
/**
|
|
274
|
+
* Creates a Valibot error with useful information.
|
|
275
|
+
*
|
|
276
|
+
* @param issues The error issues.
|
|
277
|
+
*/
|
|
278
|
+
constructor(e) {
|
|
279
|
+
super(e[0].message), this.name = "ValiError", this.issues = e;
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const $n = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
283
|
+
// @__NO_SIDE_EFFECTS__
|
|
284
|
+
function Sr(e, r) {
|
|
285
|
+
return {
|
|
286
|
+
kind: "validation",
|
|
287
|
+
type: "check",
|
|
288
|
+
reference: Sr,
|
|
289
|
+
async: !1,
|
|
290
|
+
expects: null,
|
|
291
|
+
requirement: e,
|
|
292
|
+
message: r,
|
|
293
|
+
"~run"(t, n) {
|
|
294
|
+
return t.typed && !this.requirement(t.value) && Z(this, "input", t, n), t;
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
// @__NO_SIDE_EFFECTS__
|
|
299
|
+
function Ar(e) {
|
|
300
|
+
return {
|
|
301
|
+
kind: "validation",
|
|
302
|
+
type: "email",
|
|
303
|
+
reference: Ar,
|
|
304
|
+
expects: null,
|
|
305
|
+
async: !1,
|
|
306
|
+
requirement: $n,
|
|
307
|
+
message: e,
|
|
308
|
+
"~run"(r, t) {
|
|
309
|
+
return r.typed && !this.requirement.test(r.value) && Z(this, "email", r, t), r;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
// @__NO_SIDE_EFFECTS__
|
|
314
|
+
function ze(e, r) {
|
|
315
|
+
return {
|
|
316
|
+
kind: "validation",
|
|
317
|
+
type: "max_length",
|
|
318
|
+
reference: ze,
|
|
319
|
+
async: !1,
|
|
320
|
+
expects: `<=${e}`,
|
|
321
|
+
requirement: e,
|
|
322
|
+
message: r,
|
|
323
|
+
"~run"(t, n) {
|
|
324
|
+
return t.typed && t.value.length > this.requirement && Z(this, "length", t, n, { received: `${t.value.length}` }), t;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
// @__NO_SIDE_EFFECTS__
|
|
329
|
+
function Er(e, r) {
|
|
330
|
+
return {
|
|
331
|
+
kind: "validation",
|
|
332
|
+
type: "max_value",
|
|
333
|
+
reference: Er,
|
|
334
|
+
async: !1,
|
|
335
|
+
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Ie(e)}`,
|
|
336
|
+
requirement: e,
|
|
337
|
+
message: r,
|
|
338
|
+
"~run"(t, n) {
|
|
339
|
+
return t.typed && !(t.value <= this.requirement) && Z(this, "value", t, n, { received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Ie(t.value) }), t;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
// @__NO_SIDE_EFFECTS__
|
|
344
|
+
function Ve(e, r) {
|
|
345
|
+
return {
|
|
346
|
+
kind: "validation",
|
|
347
|
+
type: "min_length",
|
|
348
|
+
reference: Ve,
|
|
349
|
+
async: !1,
|
|
350
|
+
expects: `>=${e}`,
|
|
351
|
+
requirement: e,
|
|
352
|
+
message: r,
|
|
353
|
+
"~run"(t, n) {
|
|
354
|
+
return t.typed && t.value.length < this.requirement && Z(this, "length", t, n, { received: `${t.value.length}` }), t;
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
// @__NO_SIDE_EFFECTS__
|
|
359
|
+
function Fr(e, r) {
|
|
360
|
+
return {
|
|
361
|
+
kind: "validation",
|
|
362
|
+
type: "min_value",
|
|
363
|
+
reference: Fr,
|
|
364
|
+
async: !1,
|
|
365
|
+
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Ie(e)}`,
|
|
366
|
+
requirement: e,
|
|
367
|
+
message: r,
|
|
368
|
+
"~run"(t, n) {
|
|
369
|
+
return t.typed && !(t.value >= this.requirement) && Z(this, "value", t, n, { received: t.value instanceof Date ? t.value.toJSON() : /* @__PURE__ */ Ie(t.value) }), t;
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
// @__NO_SIDE_EFFECTS__
|
|
374
|
+
function bt(e, r) {
|
|
375
|
+
return {
|
|
376
|
+
kind: "validation",
|
|
377
|
+
type: "regex",
|
|
378
|
+
reference: bt,
|
|
379
|
+
async: !1,
|
|
380
|
+
expects: `${e}`,
|
|
381
|
+
requirement: e,
|
|
382
|
+
message: r,
|
|
383
|
+
"~run"(t, n) {
|
|
384
|
+
return t.typed && !this.requirement.test(t.value) && Z(this, "format", t, n), t;
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
// @__NO_SIDE_EFFECTS__
|
|
389
|
+
function xt(e) {
|
|
390
|
+
return {
|
|
391
|
+
kind: "transformation",
|
|
392
|
+
type: "transform",
|
|
393
|
+
reference: xt,
|
|
394
|
+
async: !1,
|
|
395
|
+
operation: e,
|
|
396
|
+
"~run"(r) {
|
|
397
|
+
return r.value = this.operation(r.value), r;
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
// @__NO_SIDE_EFFECTS__
|
|
402
|
+
function Vr(e) {
|
|
403
|
+
return {
|
|
404
|
+
kind: "validation",
|
|
405
|
+
type: "url",
|
|
406
|
+
reference: Vr,
|
|
407
|
+
async: !1,
|
|
408
|
+
expects: null,
|
|
409
|
+
requirement(r) {
|
|
410
|
+
try {
|
|
411
|
+
return new URL(r), !0;
|
|
412
|
+
} catch {
|
|
413
|
+
return !1;
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
message: e,
|
|
417
|
+
"~run"(r, t) {
|
|
418
|
+
return r.typed && !this.requirement(r.value) && Z(this, "URL", r, t), r;
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
// @__NO_SIDE_EFFECTS__
|
|
423
|
+
function Gn(e, r, t) {
|
|
424
|
+
return typeof e.fallback == "function" ? e.fallback(r, t) : e.fallback;
|
|
425
|
+
}
|
|
426
|
+
// @__NO_SIDE_EFFECTS__
|
|
427
|
+
function Ir(e, r, t) {
|
|
428
|
+
return typeof e.default == "function" ? e.default(r, t) : e.default;
|
|
429
|
+
}
|
|
430
|
+
// @__NO_SIDE_EFFECTS__
|
|
431
|
+
function Dr(e, r) {
|
|
432
|
+
return {
|
|
433
|
+
kind: "schema",
|
|
434
|
+
type: "array",
|
|
435
|
+
reference: Dr,
|
|
436
|
+
expects: "Array",
|
|
437
|
+
async: !1,
|
|
438
|
+
item: e,
|
|
439
|
+
message: r,
|
|
440
|
+
get "~standard"() {
|
|
441
|
+
return /* @__PURE__ */ fe(this);
|
|
442
|
+
},
|
|
443
|
+
"~run"(t, n) {
|
|
444
|
+
var s;
|
|
445
|
+
const i = t.value;
|
|
446
|
+
if (Array.isArray(i)) {
|
|
447
|
+
t.typed = !0, t.value = [];
|
|
448
|
+
for (let o = 0; o < i.length; o++) {
|
|
449
|
+
const c = i[o], h = this.item["~run"]({ value: c }, n);
|
|
450
|
+
if (h.issues) {
|
|
451
|
+
const p = {
|
|
452
|
+
type: "array",
|
|
453
|
+
origin: "value",
|
|
454
|
+
input: i,
|
|
455
|
+
key: o,
|
|
456
|
+
value: c
|
|
457
|
+
};
|
|
458
|
+
for (const g of h.issues)
|
|
459
|
+
g.path ? g.path.unshift(p) : g.path = [p], (s = t.issues) == null || s.push(g);
|
|
460
|
+
if (t.issues || (t.issues = h.issues), n.abortEarly) {
|
|
461
|
+
t.typed = !1;
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
h.typed || (t.typed = !1), t.value.push(h.value);
|
|
466
|
+
}
|
|
467
|
+
} else Z(this, "type", t, n);
|
|
468
|
+
return t;
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
// @__NO_SIDE_EFFECTS__
|
|
473
|
+
function Lr(e) {
|
|
474
|
+
return {
|
|
475
|
+
kind: "schema",
|
|
476
|
+
type: "boolean",
|
|
477
|
+
reference: Lr,
|
|
478
|
+
expects: "boolean",
|
|
479
|
+
async: !1,
|
|
480
|
+
message: e,
|
|
481
|
+
get "~standard"() {
|
|
482
|
+
return /* @__PURE__ */ fe(this);
|
|
483
|
+
},
|
|
484
|
+
"~run"(r, t) {
|
|
485
|
+
return typeof r.value == "boolean" ? r.typed = !0 : Z(this, "type", r, t), r;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
// @__NO_SIDE_EFFECTS__
|
|
490
|
+
function Rr(e) {
|
|
491
|
+
return {
|
|
492
|
+
kind: "schema",
|
|
493
|
+
type: "number",
|
|
494
|
+
reference: Rr,
|
|
495
|
+
expects: "number",
|
|
496
|
+
async: !1,
|
|
497
|
+
message: e,
|
|
498
|
+
get "~standard"() {
|
|
499
|
+
return /* @__PURE__ */ fe(this);
|
|
500
|
+
},
|
|
501
|
+
"~run"(r, t) {
|
|
502
|
+
return typeof r.value == "number" && !isNaN(r.value) ? r.typed = !0 : Z(this, "type", r, t), r;
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
// @__NO_SIDE_EFFECTS__
|
|
507
|
+
function ge(e, r) {
|
|
508
|
+
return {
|
|
509
|
+
kind: "schema",
|
|
510
|
+
type: "object",
|
|
511
|
+
reference: ge,
|
|
512
|
+
expects: "Object",
|
|
513
|
+
async: !1,
|
|
514
|
+
entries: e,
|
|
515
|
+
message: r,
|
|
516
|
+
get "~standard"() {
|
|
517
|
+
return /* @__PURE__ */ fe(this);
|
|
518
|
+
},
|
|
519
|
+
"~run"(t, n) {
|
|
520
|
+
var s;
|
|
521
|
+
const i = t.value;
|
|
522
|
+
if (i && typeof i == "object") {
|
|
523
|
+
t.typed = !0, t.value = {};
|
|
524
|
+
for (const o in this.entries) {
|
|
525
|
+
const c = this.entries[o];
|
|
526
|
+
if (o in i || (c.type === "exact_optional" || c.type === "optional" || c.type === "nullish") && c.default !== void 0) {
|
|
527
|
+
const h = o in i ? i[o] : /* @__PURE__ */ Ir(c), p = c["~run"]({ value: h }, n);
|
|
528
|
+
if (p.issues) {
|
|
529
|
+
const g = {
|
|
530
|
+
type: "object",
|
|
531
|
+
origin: "value",
|
|
532
|
+
input: i,
|
|
533
|
+
key: o,
|
|
534
|
+
value: h
|
|
535
|
+
};
|
|
536
|
+
for (const m of p.issues)
|
|
537
|
+
m.path ? m.path.unshift(g) : m.path = [g], (s = t.issues) == null || s.push(m);
|
|
538
|
+
if (t.issues || (t.issues = p.issues), n.abortEarly) {
|
|
539
|
+
t.typed = !1;
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
p.typed || (t.typed = !1), t.value[o] = p.value;
|
|
544
|
+
} else if (c.fallback !== void 0) t.value[o] = /* @__PURE__ */ Gn(c);
|
|
545
|
+
else if (c.type !== "exact_optional" && c.type !== "optional" && c.type !== "nullish" && (Z(this, "key", t, n, {
|
|
546
|
+
input: void 0,
|
|
547
|
+
expected: `"${o}"`,
|
|
548
|
+
path: [{
|
|
549
|
+
type: "object",
|
|
550
|
+
origin: "key",
|
|
551
|
+
input: i,
|
|
552
|
+
key: o,
|
|
553
|
+
value: i[o]
|
|
554
|
+
}]
|
|
555
|
+
}), n.abortEarly))
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
} else Z(this, "type", t, n);
|
|
559
|
+
return t;
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
// @__NO_SIDE_EFFECTS__
|
|
564
|
+
function Fe(e, r) {
|
|
565
|
+
return {
|
|
566
|
+
kind: "schema",
|
|
567
|
+
type: "optional",
|
|
568
|
+
reference: Fe,
|
|
569
|
+
expects: `(${e.expects} | undefined)`,
|
|
570
|
+
async: !1,
|
|
571
|
+
wrapped: e,
|
|
572
|
+
default: r,
|
|
573
|
+
get "~standard"() {
|
|
574
|
+
return /* @__PURE__ */ fe(this);
|
|
575
|
+
},
|
|
576
|
+
"~run"(t, n) {
|
|
577
|
+
return t.value === void 0 && (this.default !== void 0 && (t.value = /* @__PURE__ */ Ir(this, t, n)), t.value === void 0) ? (t.typed = !0, t) : this.wrapped["~run"](t, n);
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
// @__NO_SIDE_EFFECTS__
|
|
582
|
+
function Tr(e, r) {
|
|
583
|
+
return {
|
|
584
|
+
kind: "schema",
|
|
585
|
+
type: "picklist",
|
|
586
|
+
reference: Tr,
|
|
587
|
+
expects: /* @__PURE__ */ zn(e.map(Ie), "|"),
|
|
588
|
+
async: !1,
|
|
589
|
+
options: e,
|
|
590
|
+
message: r,
|
|
591
|
+
get "~standard"() {
|
|
592
|
+
return /* @__PURE__ */ fe(this);
|
|
593
|
+
},
|
|
594
|
+
"~run"(t, n) {
|
|
595
|
+
return this.options.includes(t.value) ? t.typed = !0 : Z(this, "type", t, n), t;
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
// @__NO_SIDE_EFFECTS__
|
|
600
|
+
function Mr(e, r, t) {
|
|
601
|
+
return {
|
|
602
|
+
kind: "schema",
|
|
603
|
+
type: "record",
|
|
604
|
+
reference: Mr,
|
|
605
|
+
expects: "Object",
|
|
606
|
+
async: !1,
|
|
607
|
+
key: e,
|
|
608
|
+
value: r,
|
|
609
|
+
message: t,
|
|
610
|
+
get "~standard"() {
|
|
611
|
+
return /* @__PURE__ */ fe(this);
|
|
612
|
+
},
|
|
613
|
+
"~run"(n, i) {
|
|
614
|
+
var o, c;
|
|
615
|
+
const s = n.value;
|
|
616
|
+
if (s && typeof s == "object") {
|
|
617
|
+
n.typed = !0, n.value = {};
|
|
618
|
+
for (const h in s) if (/* @__PURE__ */ Un(s, h)) {
|
|
619
|
+
const p = s[h], g = this.key["~run"]({ value: h }, i);
|
|
620
|
+
if (g.issues) {
|
|
621
|
+
const v = {
|
|
622
|
+
type: "object",
|
|
623
|
+
origin: "key",
|
|
624
|
+
input: s,
|
|
625
|
+
key: h,
|
|
626
|
+
value: p
|
|
627
|
+
};
|
|
628
|
+
for (const f of g.issues)
|
|
629
|
+
f.path = [v], (o = n.issues) == null || o.push(f);
|
|
630
|
+
if (n.issues || (n.issues = g.issues), i.abortEarly) {
|
|
631
|
+
n.typed = !1;
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
const m = this.value["~run"]({ value: p }, i);
|
|
636
|
+
if (m.issues) {
|
|
637
|
+
const v = {
|
|
638
|
+
type: "object",
|
|
639
|
+
origin: "value",
|
|
640
|
+
input: s,
|
|
641
|
+
key: h,
|
|
642
|
+
value: p
|
|
643
|
+
};
|
|
644
|
+
for (const f of m.issues)
|
|
645
|
+
f.path ? f.path.unshift(v) : f.path = [v], (c = n.issues) == null || c.push(f);
|
|
646
|
+
if (n.issues || (n.issues = m.issues), i.abortEarly) {
|
|
647
|
+
n.typed = !1;
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
(!g.typed || !m.typed) && (n.typed = !1), g.typed && (n.value[g.value] = m.value);
|
|
652
|
+
}
|
|
653
|
+
} else Z(this, "type", n, i);
|
|
654
|
+
return n;
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
// @__NO_SIDE_EFFECTS__
|
|
659
|
+
function te(e) {
|
|
660
|
+
return {
|
|
661
|
+
kind: "schema",
|
|
662
|
+
type: "string",
|
|
663
|
+
reference: te,
|
|
664
|
+
expects: "string",
|
|
665
|
+
async: !1,
|
|
666
|
+
message: e,
|
|
667
|
+
get "~standard"() {
|
|
668
|
+
return /* @__PURE__ */ fe(this);
|
|
669
|
+
},
|
|
670
|
+
"~run"(r, t) {
|
|
671
|
+
return typeof r.value == "string" ? r.typed = !0 : Z(this, "type", r, t), r;
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function Nr(e, r, t) {
|
|
676
|
+
const n = e["~run"]({ value: r }, /* @__PURE__ */ vt(t));
|
|
677
|
+
if (n.issues) throw new Cr(n.issues);
|
|
678
|
+
return n.value;
|
|
679
|
+
}
|
|
680
|
+
// @__NO_SIDE_EFFECTS__
|
|
681
|
+
function Kn(e, r) {
|
|
682
|
+
const t = {};
|
|
683
|
+
for (const n in e.entries) t[n] = /* @__PURE__ */ Fe(e.entries[n]);
|
|
684
|
+
return {
|
|
685
|
+
...e,
|
|
686
|
+
entries: t,
|
|
687
|
+
get "~standard"() {
|
|
688
|
+
return /* @__PURE__ */ fe(this);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
// @__NO_SIDE_EFFECTS__
|
|
693
|
+
function we(...e) {
|
|
694
|
+
return {
|
|
695
|
+
...e[0],
|
|
696
|
+
pipe: e,
|
|
697
|
+
get "~standard"() {
|
|
698
|
+
return /* @__PURE__ */ fe(this);
|
|
699
|
+
},
|
|
700
|
+
"~run"(r, t) {
|
|
701
|
+
for (const n of e) if (n.kind !== "metadata") {
|
|
702
|
+
if (r.issues && (n.kind === "schema" || n.kind === "transformation")) {
|
|
703
|
+
r.typed = !1;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
(!r.issues || !t.abortEarly && !t.abortPipeEarly) && (r = n["~run"](r, t));
|
|
707
|
+
}
|
|
708
|
+
return r;
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
// @__NO_SIDE_EFFECTS__
|
|
713
|
+
async function Hn(e, r, t) {
|
|
714
|
+
const n = await e["~run"]({ value: r }, /* @__PURE__ */ vt(t));
|
|
715
|
+
return {
|
|
716
|
+
typed: n.typed,
|
|
717
|
+
success: !n.issues,
|
|
718
|
+
output: n.value,
|
|
719
|
+
issues: n.issues
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
const Te = ({ error: e, refusal: r = !1 }) => {
|
|
723
|
+
const t = e == null ? void 0 : e.message;
|
|
724
|
+
return ye(() => {
|
|
725
|
+
const n = M.current$.peek().flow;
|
|
726
|
+
r && t && n && Ge(n).refused();
|
|
727
|
+
}, [t, r]), !e || !e.message ? null : /* @__PURE__ */ a("div", { role: "alert", class: "text-error-11 flex max-w-full items-start gap-1 overflow-hidden rounded-2xl px-2 py-2", children: [
|
|
728
|
+
/* @__PURE__ */ a(
|
|
729
|
+
"svg",
|
|
730
|
+
{
|
|
731
|
+
class: "text-error-9 mt-0.5 h-4 w-4 shrink-0",
|
|
732
|
+
viewBox: "0 0 16 16",
|
|
733
|
+
fill: "none",
|
|
734
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
735
|
+
children: [
|
|
736
|
+
/* @__PURE__ */ a("circle", { cx: "8", cy: "8", r: "6.3", stroke: "currentColor", "stroke-width": "1.4" }),
|
|
737
|
+
/* @__PURE__ */ a("rect", { x: "7", y: "4", width: "2", height: "5", fill: "currentColor" }),
|
|
738
|
+
/* @__PURE__ */ a("rect", { x: "7", y: "10", width: "2", height: "2", fill: "currentColor" })
|
|
739
|
+
]
|
|
740
|
+
}
|
|
741
|
+
),
|
|
742
|
+
/* @__PURE__ */ a("p", { class: "break-words pr-1 text-sm", children: e.message })
|
|
743
|
+
] });
|
|
744
|
+
}, ve = ({ class: e, ...r }) => {
|
|
745
|
+
const { t } = J();
|
|
746
|
+
return /* @__PURE__ */ a(
|
|
747
|
+
"button",
|
|
748
|
+
{
|
|
749
|
+
type: "button",
|
|
750
|
+
class: Le(
|
|
751
|
+
"fr touch-hitbox text-neutral-11 bg-neutral-1 ring-divider hover:ring-divider active:ring-interactive-bg-hover hover:text-neutral-12 active:text-neutral-12 hover:bg-divider active:bg-interactive-bg-hover flex flex-shrink-0 items-center justify-center gap-1 self-center rounded-full py-1 pl-2 pr-2.5 text-sm ring-1 transition-all",
|
|
752
|
+
e
|
|
753
|
+
),
|
|
754
|
+
...r,
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ a(
|
|
757
|
+
"svg",
|
|
758
|
+
{
|
|
759
|
+
"aria-hidden": !0,
|
|
760
|
+
class: "block",
|
|
761
|
+
width: "16",
|
|
762
|
+
height: "16",
|
|
763
|
+
viewBox: "0 0 16 16",
|
|
764
|
+
fill: "transparent",
|
|
765
|
+
stroke: "currentColor",
|
|
766
|
+
"stroke-linecap": "round",
|
|
767
|
+
"stroke-width": "1.5",
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ a("title", { children: t("skip") }),
|
|
770
|
+
/* @__PURE__ */ a("path", { d: "M3.25 11.25A5 5 0 0 1 12 7" }),
|
|
771
|
+
/* @__PURE__ */ a("path", { d: "M13.25 4.5V8.25H9.5" })
|
|
772
|
+
]
|
|
773
|
+
}
|
|
774
|
+
),
|
|
775
|
+
t("skip")
|
|
776
|
+
]
|
|
777
|
+
}
|
|
778
|
+
);
|
|
779
|
+
};
|
|
780
|
+
var wt = { Afghanistan: "93", Albania: "355", Algeria: "213", "American Samoa": "1 684", Andorra: "376", Angola: "244", Anguilla: "1 264", Antarctica: "672", "Antigua and Barbuda": "1 268", Argentina: "54", Armenia: "374", Aruba: "297", Australia: "61", Austria: "43", Azerbaijan: "994", Bahrain: "973", Bangladesh: "880", Barbados: "1 246", Belarus: "375", Belgium: "32", Belize: "501", Benin: "229", Bermuda: "1 441", Bhutan: "975", Bolivia: "591", "Bosnia and Herzegovina": "387", Botswana: "267", "Bouvet Island": "47", Brazil: "55", "British Indian Ocean Territory": "246", "British Virgin Islands": "1 284", Brunei: "673", Bulgaria: "359", "Burkina Faso": "226", Burundi: "257", "Cabo Verde": "238", Cambodia: "855", Cameroon: "237", Canada: "1", "Caribbean Netherlands": "599", "Cayman Islands": "1 345", "Central African Republic": "236", Chad: "235", Chile: "56", China: "86", "Christmas Island": "61", "Cocos (Keeling) Islands": "61", Colombia: "57", Comoros: "269", "Cook Islands": "682", "Costa Rica": "506", Croatia: "385", Cuba: "53", Curaçao: "599", Cyprus: "357", Czechia: "420", "Côte d'Ivoire": "225", "Democratic Republic of the Congo": "243", Denmark: "45", Djibouti: "253", "Dominican Republic": "1 809", Ecuador: "593", Egypt: "20", "El Salvador": "503", "Equatorial Guinea": "240", Eritrea: "291", Estonia: "372", Eswatini: "268", Ethiopia: "251", "Falkland Islands (Islas Malvinas)": "500", "Faroe Islands": "298", Fiji: "679", Finland: "358", France: "33", "French Guiana": "594", "French Polynesia": "689", "French Southern and Antarctic Lands": "262", Gabon: "241", Georgia: "995", Germany: "49", Ghana: "233", Gibraltar: "350", Greece: "30", Greenland: "299", Grenada: "1 473", Guadeloupe: "590", Guam: "1 671", Guatemala: "502", Guernsey: "44", Guinea: "224", "Guinea-Bissau": "245", Guyana: "592", Haiti: "509", Honduras: "504", "Hong Kong": "852", Hungary: "36", Iceland: "354", India: "91", Indonesia: "62", Iran: "98", Iraq: "964", Ireland: "353", "Isle of Man": "44", Israel: "972", Italy: "39", Jamaica: "1 876", Japan: "81", Jersey: "44", Jordan: "962", Kazakhstan: "7", Kenya: "254", Kiribati: "686", Kosovo: "383", Kuwait: "965", Kyrgyzstan: "996", Laos: "856", Latvia: "371", Lebanon: "961", Lesotho: "266", Liberia: "231", Libya: "218", Liechtenstein: "423", Lithuania: "370", Luxembourg: "352", Macao: "853", Madagascar: "261", Malawi: "265", Malaysia: "60", Maldives: "960", Mali: "223", Malta: "356", "Marshall Islands": "692", Martinique: "596", Mauritania: "222", Mauritius: "230", Mayotte: "262", Mexico: "52", Micronesia: "691", Moldova: "373", Monaco: "377", Mongolia: "976", Montenegro: "382", Montserrat: "1 664", Morocco: "212", Mozambique: "258", "Myanmar (Burma)": "95", Namibia: "264", Nauru: "674", Nepal: "977", Netherlands: "31", "New Caledonia": "687", "New Zealand": "64", Nicaragua: "505", Niger: "227", Nigeria: "234", Niue: "683", "Norfolk Island": "672", "North Korea": "850", "North Macedonia": "389", "Northern Mariana Islands": "1 670", Norway: "47", Oman: "968", Pakistan: "92", Palau: "680", Palestine: "970", Panama: "507", "Papua New Guinea": "675", Paraguay: "595", Peru: "51", Philippines: "63", "Pitcairn Islands": "64", Poland: "48", Portugal: "351", "Puerto Rico": "1 787", Qatar: "974", Romania: "40", Russia: "7", Rwanda: "250", Réunion: "262", "Saint Barthélemy": "590", "Saint Helena, Ascension and Tristan da Cunha": "290", "Saint Kitts and Nevis": "1 869", "Saint Lucia": "1 758", "Saint Martin": "590", "Saint Pierre and Miquelon": "508", "Saint Vincent and the Grenadines": "1 784", Samoa: "685", "San Marino": "378", "Saudi Arabia": "966", Senegal: "221", Serbia: "381", Seychelles: "248", "Sierra Leone": "232", Singapore: "65", "Sint Maarten": "1 721", Slovakia: "421", Slovenia: "386", "Solomon Islands": "677", Somalia: "252", "South Africa": "27", "South Georgia and the South Sandwich Islands": "500", "South Korea": "82", "South Sudan": "211", Spain: "34", "Sri Lanka": "94", Sudan: "249", Suriname: "597", "Svalbard and Jan Mayen": "47", Sweden: "46", Switzerland: "41", Syria: "963", "São Tomé and Príncipe": "239", Taiwan: "886", Tajikistan: "992", Tanzania: "255", Thailand: "66", "The Bahamas": "1 242", "The Gambia": "220", "Timor-Leste": "670", Togo: "228", Tokelau: "690", Tonga: "676", "Trinidad and Tobago": "1 868", Tunisia: "216", Turkmenistan: "993", "Turks and Caicos Islands": "1 649", Tuvalu: "688", Türkiye: "90", "U.S. Virgin Islands": "1 340", Uganda: "256", Ukraine: "380", "United Arab Emirates": "971", "United Kingdom": "44", "United States": "1", "United States Minor Outlying Islands": "1", Uruguay: "598", Uzbekistan: "998", Vanuatu: "678", "Vatican City": "379", Venezuela: "58", Vietnam: "84", "Wallis and Futuna": "681", "Western Sahara": "212", Yemen: "967", Zambia: "260", Zimbabwe: "263", "Åland Islands": "358" }, Wn = (e) => {
|
|
781
|
+
if (e === "") return { countryCode: "", phoneNumber: "" };
|
|
782
|
+
let r = Object.values(wt).find((n) => e.startsWith(n)) ?? "", t = e.replace(r, "");
|
|
783
|
+
return /^\d+$/.test(t) ? { countryCode: r, phoneNumber: t } : { countryCode: "", phoneNumber: "" };
|
|
784
|
+
};
|
|
785
|
+
const De = Xe(
|
|
786
|
+
"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest py-1 text-base outline outline-2 transition-all",
|
|
787
|
+
{
|
|
788
|
+
variants: {
|
|
789
|
+
optional: {
|
|
790
|
+
true: "pr-16 pl-3",
|
|
791
|
+
false: "pl-3 pr-3"
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
defaultVariants: {
|
|
795
|
+
optional: !1
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
), Jn = "https://api.mapbox.com/search/searchbox/v1/suggest", Zn = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", Xn = (e) => atob(e).split("").reverse().join(""), he = /* @__PURE__ */ ge({
|
|
799
|
+
name: /* @__PURE__ */ te()
|
|
800
|
+
}), Yn = /* @__PURE__ */ ge({
|
|
801
|
+
suggestions: /* @__PURE__ */ Dr(
|
|
802
|
+
/* @__PURE__ */ ge({
|
|
803
|
+
feature_type: /* @__PURE__ */ Fe(/* @__PURE__ */ te()),
|
|
804
|
+
full_address: /* @__PURE__ */ Fe(/* @__PURE__ */ te()),
|
|
805
|
+
place_formatted: /* @__PURE__ */ Fe(/* @__PURE__ */ te()),
|
|
806
|
+
name: /* @__PURE__ */ Fe(/* @__PURE__ */ te()),
|
|
807
|
+
mapbox_id: /* @__PURE__ */ te(),
|
|
808
|
+
context: /* @__PURE__ */ Kn(
|
|
809
|
+
/* @__PURE__ */ ge({
|
|
810
|
+
address: he,
|
|
811
|
+
street: he,
|
|
812
|
+
neighborhood: he,
|
|
813
|
+
locality: he,
|
|
814
|
+
district: he,
|
|
815
|
+
place: he,
|
|
816
|
+
region: he,
|
|
817
|
+
postcode: he,
|
|
818
|
+
country: he
|
|
819
|
+
})
|
|
820
|
+
)
|
|
821
|
+
})
|
|
822
|
+
)
|
|
823
|
+
}), Qn = (e) => (Ye(() => {
|
|
824
|
+
e && Bt(e);
|
|
825
|
+
}, [e]), on(() => {
|
|
826
|
+
var t;
|
|
827
|
+
const r = (t = M.current$.peek().flow) == null ? void 0 : t.data.flowSessionId;
|
|
828
|
+
return r ? {
|
|
829
|
+
enabled: !0,
|
|
830
|
+
getPredictions: async (n, i) => {
|
|
831
|
+
var p;
|
|
832
|
+
const s = e && Bt(e), o = (p = M.current$.peek().flow) == null ? void 0 : p.locationOrigin, c = o && o.lat !== void 0 && o.lng !== void 0 && Number.isFinite(o.lat) && Number.isFinite(o.lng) && o.lat >= -90 && o.lat <= 90 && o.lng >= -180 && o.lng <= 180;
|
|
833
|
+
return { ...await Tn(
|
|
834
|
+
{
|
|
835
|
+
query: n,
|
|
836
|
+
country: s,
|
|
837
|
+
session: r,
|
|
838
|
+
surface: "chatbot",
|
|
839
|
+
...c ? { lat: o.lat, lng: o.lng } : {},
|
|
840
|
+
signal: i
|
|
841
|
+
},
|
|
842
|
+
async () => {
|
|
843
|
+
const g = new URL(Jn);
|
|
844
|
+
return g.searchParams.set("q", n), g.searchParams.set("session_token", r), g.searchParams.set("limit", "5"), c && g.searchParams.set("proximity", `${o.lng},${o.lat}`), g.searchParams.set("access_token", Xn(Zn)), (await An(async (f) => {
|
|
845
|
+
const b = new URL(g);
|
|
846
|
+
f && b.searchParams.set("country", f);
|
|
847
|
+
const F = await fetch(b.href, { signal: i });
|
|
848
|
+
if (!F.ok) throw new Error(`Address lookup failed with ${F.status}`);
|
|
849
|
+
return Nr(Yn, await F.json()).suggestions;
|
|
850
|
+
}, s, i)).map((f) => {
|
|
851
|
+
var b, F, k, A, _, L, N, D, G;
|
|
852
|
+
return {
|
|
853
|
+
country: s,
|
|
854
|
+
// A postcode result has no full address and is named by the postcode itself (PROD-7311).
|
|
855
|
+
label: f.full_address ?? ([f.name, f.place_formatted].filter(Boolean).join(", ") || f.mapbox_id),
|
|
856
|
+
id: f.mapbox_id,
|
|
857
|
+
address: {
|
|
858
|
+
line1: ((b = f.context.address) == null ? void 0 : b.name) ?? ((F = f.context.street) == null ? void 0 : F.name),
|
|
859
|
+
line2: void 0,
|
|
860
|
+
line3: ((k = f.context.neighborhood) == null ? void 0 : k.name) ?? ((A = f.context.locality) == null ? void 0 : A.name),
|
|
861
|
+
city: ((_ = f.context.place) == null ? void 0 : _.name) ?? ((L = f.context.district) == null ? void 0 : L.name),
|
|
862
|
+
state: (N = f.context.region) == null ? void 0 : N.name,
|
|
863
|
+
postcode: ((D = f.context.postcode) == null ? void 0 : D.name) ?? (f.feature_type === "postcode" ? f.name : void 0),
|
|
864
|
+
country: (G = f.context.country) == null ? void 0 : G.name
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
), country: s };
|
|
870
|
+
}
|
|
871
|
+
} : { enabled: !1 };
|
|
872
|
+
}, [e])), $t = (e) => {
|
|
873
|
+
const { t: r } = J();
|
|
874
|
+
return /* @__PURE__ */ a(
|
|
875
|
+
"button",
|
|
876
|
+
{
|
|
877
|
+
type: "button",
|
|
878
|
+
class: "touch-hitbox text-neutral-11 hover:bg-neutral-4 hover:text-neutral-12 hover:border-neutral-5 relative flex items-center gap-1 rounded-[18px] border border-solid border-transparent px-3 py-1 pl-1.5 text-sm transition-colors",
|
|
879
|
+
...e,
|
|
880
|
+
children: [
|
|
881
|
+
/* @__PURE__ */ a(
|
|
882
|
+
"svg",
|
|
883
|
+
{
|
|
884
|
+
width: "16",
|
|
885
|
+
height: "16",
|
|
886
|
+
viewBox: "0 0 16 16",
|
|
887
|
+
stroke: "currentColor",
|
|
888
|
+
"stroke-width": "1.5",
|
|
889
|
+
fill: "none",
|
|
890
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
891
|
+
children: /* @__PURE__ */ a("path", { d: "M10 3L5 8L10 13" })
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
/* @__PURE__ */ a("span", { children: r("back") })
|
|
895
|
+
]
|
|
896
|
+
}
|
|
897
|
+
);
|
|
898
|
+
}, es = ({
|
|
899
|
+
input: e,
|
|
900
|
+
onSubmitSuccess: r,
|
|
901
|
+
logger: t,
|
|
902
|
+
analytics: n,
|
|
903
|
+
rpcClient: i
|
|
904
|
+
}) => {
|
|
905
|
+
const { t: s } = J(), [o, c] = me(), { enabled: h, getPredictions: p } = Qn(i), [g, m] = me(h ? "query" : "manual"), [v, f] = me(""), [b, F] = me(), k = ie(), A = () => {
|
|
906
|
+
var S;
|
|
907
|
+
(S = k.current) == null || S.controller.abort(), k.current = void 0;
|
|
908
|
+
};
|
|
909
|
+
Ye(() => A, []);
|
|
910
|
+
const _ = ie(), L = ie(), N = ie(!1), D = (S) => {
|
|
911
|
+
const I = S !== null ? _.current : void 0, R = (I == null ? void 0 : I.lookup) ?? L.current;
|
|
912
|
+
if (R && !N.current) {
|
|
913
|
+
N.current = !0;
|
|
914
|
+
const j = (z) => {
|
|
915
|
+
const H = e.config.keys[z];
|
|
916
|
+
return S && H ? S.value[H] : void 0;
|
|
917
|
+
}, V = j("country") ?? (I == null ? void 0 : I.suggestion.address.country) ?? (I == null ? void 0 : I.suggestion.country), T = S && kr({
|
|
918
|
+
postcode: j("postcode") ?? (I != null && I.edited || o == null ? void 0 : o.postcode),
|
|
919
|
+
label: I != null && I.edited || I == null ? void 0 : I.suggestion.label,
|
|
920
|
+
state: j("state") ?? (I != null && I.edited || o == null ? void 0 : o.state),
|
|
921
|
+
country: V
|
|
922
|
+
});
|
|
923
|
+
Mn({
|
|
924
|
+
kind: "address",
|
|
925
|
+
surface: "chatbot",
|
|
926
|
+
...R,
|
|
927
|
+
picked: !!I,
|
|
928
|
+
...I ? { edited: I.edited } : {},
|
|
929
|
+
region: T ?? (V != null && V.trim() ? "other" : null)
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
r(S);
|
|
933
|
+
}, G = (S) => {
|
|
934
|
+
var R;
|
|
935
|
+
if (Ce(h, "Query state should not be enabled"), S = S.trim(), S === ((R = k.current) == null ? void 0 : R.query) || S === (b == null ? void 0 : b.query) && b.status === "done") return;
|
|
936
|
+
if (A(), f(S), S === "") {
|
|
937
|
+
F(void 0);
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
const I = k.current = { query: S, controller: new AbortController() };
|
|
941
|
+
F({ query: S, status: "pending" }), p(S, I.controller.signal).then(
|
|
942
|
+
(j) => {
|
|
943
|
+
k.current === I && (k.current = void 0, L.current = { arm: j.arm, source: j.source }, F({
|
|
944
|
+
query: S,
|
|
945
|
+
status: "done",
|
|
946
|
+
items: j.results,
|
|
947
|
+
...L.current,
|
|
948
|
+
country: j.country
|
|
949
|
+
}));
|
|
950
|
+
},
|
|
951
|
+
(j) => {
|
|
952
|
+
k.current === I && (k.current = void 0, L.current = { arm: "direct", source: "direct" }, t.error("Failed to get address details", j instanceof Cr ? "Unexpected response" : j), F({ query: S, status: "failed", error: s("address_error") }));
|
|
953
|
+
}
|
|
954
|
+
);
|
|
955
|
+
}, K = (S, I) => {
|
|
956
|
+
_.current && (o == null ? void 0 : o[S]) !== I && (_.current.edited = !0), c((R) => ({ ...R, [S]: I }));
|
|
957
|
+
};
|
|
958
|
+
switch (g) {
|
|
959
|
+
case "query":
|
|
960
|
+
return Ce(h, "Query state should not be enabled"), /* @__PURE__ */ a(
|
|
961
|
+
ts,
|
|
962
|
+
{
|
|
963
|
+
input: e,
|
|
964
|
+
onSkip: () => D(null),
|
|
965
|
+
onAddressSelect: (S, I) => {
|
|
966
|
+
var j;
|
|
967
|
+
if (S === "") {
|
|
968
|
+
k.current && (A(), F(void 0)), m("manual");
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
if ((b == null ? void 0 : b.status) !== "done") return;
|
|
972
|
+
const R = b.items.find((V) => V.id === S);
|
|
973
|
+
R && (b.arm !== "inploi" && Dn({
|
|
974
|
+
query: I,
|
|
975
|
+
country: b.country,
|
|
976
|
+
pickedLabel: R.label,
|
|
977
|
+
pickedPostcode: R.address.postcode,
|
|
978
|
+
pickedCountry: R.address.country,
|
|
979
|
+
pickedState: R.address.state,
|
|
980
|
+
log: (V) => n.log({ event: "ADDRESS_SHADOW_COMPARED", properties: V })
|
|
981
|
+
}), ((j = _.current) == null ? void 0 : j.suggestion.id) !== S ? (c(R.address), _.current = { suggestion: R, lookup: { arm: b.arm, source: b.source }, edited: !1 }) : _.current.lookup = { arm: b.arm, source: b.source }, m("details"));
|
|
982
|
+
},
|
|
983
|
+
onAddressSearch: G,
|
|
984
|
+
lookup: b,
|
|
985
|
+
query: v
|
|
986
|
+
}
|
|
987
|
+
);
|
|
988
|
+
case "details":
|
|
989
|
+
return Ce(o !== void 0), /* @__PURE__ */ a(
|
|
990
|
+
Gt,
|
|
991
|
+
{
|
|
992
|
+
input: e,
|
|
993
|
+
logger: t,
|
|
994
|
+
onSubmitSuccess: D,
|
|
995
|
+
addressFields: o,
|
|
996
|
+
onFieldChange: K,
|
|
997
|
+
actions: /* @__PURE__ */ a(
|
|
998
|
+
$t,
|
|
999
|
+
{
|
|
1000
|
+
onClick: () => {
|
|
1001
|
+
m("query");
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
)
|
|
1005
|
+
}
|
|
1006
|
+
);
|
|
1007
|
+
case "manual":
|
|
1008
|
+
return /* @__PURE__ */ a(
|
|
1009
|
+
Gt,
|
|
1010
|
+
{
|
|
1011
|
+
logger: t,
|
|
1012
|
+
input: e,
|
|
1013
|
+
onSubmitSuccess: D,
|
|
1014
|
+
addressFields: o ?? {},
|
|
1015
|
+
onFieldChange: K,
|
|
1016
|
+
actions: h ? /* @__PURE__ */ a(
|
|
1017
|
+
$t,
|
|
1018
|
+
{
|
|
1019
|
+
onClick: () => {
|
|
1020
|
+
m("query");
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
) : e.config.optional ? (
|
|
1024
|
+
// Without address search this is the only screen, so an optional question needs its own way past.
|
|
1025
|
+
/* @__PURE__ */ a(ve, { onClick: () => D(null) })
|
|
1026
|
+
) : void 0
|
|
1027
|
+
}
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
}, ts = ({
|
|
1031
|
+
input: e,
|
|
1032
|
+
onSkip: r,
|
|
1033
|
+
lookup: t,
|
|
1034
|
+
onAddressSelect: n,
|
|
1035
|
+
query: i,
|
|
1036
|
+
onAddressSearch: s
|
|
1037
|
+
}) => {
|
|
1038
|
+
const { t: o } = J(), c = ie(null);
|
|
1039
|
+
return ye(() => {
|
|
1040
|
+
c.current && (c.current.focus(), c.current.select());
|
|
1041
|
+
}, []), /* @__PURE__ */ a(de, { children: [
|
|
1042
|
+
/* @__PURE__ */ a(
|
|
1043
|
+
"form",
|
|
1044
|
+
{
|
|
1045
|
+
noValidate: !0,
|
|
1046
|
+
onSubmit: (h) => {
|
|
1047
|
+
h.preventDefault();
|
|
1048
|
+
const g = new FormData(h.currentTarget).get("address");
|
|
1049
|
+
typeof g == "string" && s(g);
|
|
1050
|
+
},
|
|
1051
|
+
class: "flex gap-2 p-2.5",
|
|
1052
|
+
children: [
|
|
1053
|
+
/* @__PURE__ */ a("div", { class: "group relative flex-1", children: [
|
|
1054
|
+
/* @__PURE__ */ a(
|
|
1055
|
+
"input",
|
|
1056
|
+
{
|
|
1057
|
+
ref: c,
|
|
1058
|
+
name: "address",
|
|
1059
|
+
id: "chat-address",
|
|
1060
|
+
autocomplete: "address-line1",
|
|
1061
|
+
autoFocus: !0,
|
|
1062
|
+
placeholder: e.config.placeholder || o("address_search"),
|
|
1063
|
+
defaultValue: i,
|
|
1064
|
+
class: De({ optional: !!e.config.optional, className: "w-full rounded-full" })
|
|
1065
|
+
}
|
|
1066
|
+
),
|
|
1067
|
+
/* @__PURE__ */ a(
|
|
1068
|
+
"button",
|
|
1069
|
+
{
|
|
1070
|
+
type: "submit",
|
|
1071
|
+
class: "touch-hitbox text-neutral-12 hover:bg-neutral-3 fr absolute bottom-0 right-0 top-0 flex cursor-pointer items-center gap-1 rounded-full px-3 transition-all",
|
|
1072
|
+
children: [
|
|
1073
|
+
/* @__PURE__ */ a(
|
|
1074
|
+
"svg",
|
|
1075
|
+
{
|
|
1076
|
+
"aria-hidden": "true",
|
|
1077
|
+
width: "16",
|
|
1078
|
+
height: "16",
|
|
1079
|
+
viewBox: "0 0 16 16",
|
|
1080
|
+
fill: "none",
|
|
1081
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1082
|
+
children: /* @__PURE__ */ a("g", { id: "inploi", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", strokeWidth: "1.5", children: [
|
|
1083
|
+
/* @__PURE__ */ a("circle", { cx: "7", cy: "7", r: "4" }),
|
|
1084
|
+
/* @__PURE__ */ a("path", { d: "M10 10L13 13" })
|
|
1085
|
+
] })
|
|
1086
|
+
}
|
|
1087
|
+
),
|
|
1088
|
+
/* @__PURE__ */ a("span", { class: "sr-only", children: o("search") })
|
|
1089
|
+
]
|
|
1090
|
+
}
|
|
1091
|
+
)
|
|
1092
|
+
] }),
|
|
1093
|
+
e.config.optional && /* @__PURE__ */ a(ve, { class: "relative", onClick: r })
|
|
1094
|
+
]
|
|
1095
|
+
}
|
|
1096
|
+
),
|
|
1097
|
+
(t == null ? void 0 : t.status) === "failed" ? /* @__PURE__ */ a(Te, { error: { message: t.error } }) : null,
|
|
1098
|
+
/* @__PURE__ */ a(
|
|
1099
|
+
"p",
|
|
1100
|
+
{
|
|
1101
|
+
role: "status",
|
|
1102
|
+
class: (t == null ? void 0 : t.status) === "pending" || (t == null ? void 0 : t.status) === "done" && t.items.length === 0 ? "text-neutral-11 flex items-center gap-2 px-4 py-2 text-sm" : "sr-only",
|
|
1103
|
+
children: (t == null ? void 0 : t.status) === "pending" ? /* @__PURE__ */ a(de, { children: [
|
|
1104
|
+
/* @__PURE__ */ a(yt, { "aria-hidden": "true", class: "h-4 w-4 shrink-0" }),
|
|
1105
|
+
o("address_searching")
|
|
1106
|
+
] }) : (t == null ? void 0 : t.status) === "done" && t.items.length === 0 ? o("address_no_results") : null
|
|
1107
|
+
}
|
|
1108
|
+
),
|
|
1109
|
+
/* @__PURE__ */ a("ul", { children: [
|
|
1110
|
+
((t == null ? void 0 : t.status) === "done" ? t.items : []).map((h) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
1111
|
+
"button",
|
|
1112
|
+
{
|
|
1113
|
+
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",
|
|
1114
|
+
onClick: () => {
|
|
1115
|
+
var p;
|
|
1116
|
+
n(h.id, ((p = c.current) == null ? void 0 : p.value) ?? i ?? "");
|
|
1117
|
+
},
|
|
1118
|
+
children: [
|
|
1119
|
+
/* @__PURE__ */ a("span", { class: "flex-grow", children: h.label }),
|
|
1120
|
+
/* @__PURE__ */ a(
|
|
1121
|
+
"svg",
|
|
1122
|
+
{
|
|
1123
|
+
class: "flex-none",
|
|
1124
|
+
width: "16",
|
|
1125
|
+
height: "16",
|
|
1126
|
+
viewBox: "0 0 16 16",
|
|
1127
|
+
stroke: "currentColor",
|
|
1128
|
+
"stroke-width": "1.5",
|
|
1129
|
+
fill: "none",
|
|
1130
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1131
|
+
children: /* @__PURE__ */ a("path", { d: "M6 3L11 8L6 13" })
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
]
|
|
1135
|
+
}
|
|
1136
|
+
) }, h.id)),
|
|
1137
|
+
/* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
1138
|
+
"button",
|
|
1139
|
+
{
|
|
1140
|
+
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",
|
|
1141
|
+
onClick: () => {
|
|
1142
|
+
var h;
|
|
1143
|
+
n("", ((h = c.current) == null ? void 0 : h.value) ?? i ?? "");
|
|
1144
|
+
},
|
|
1145
|
+
children: /* @__PURE__ */ a("span", { class: "flex-grow", children: o("address_manual") })
|
|
1146
|
+
}
|
|
1147
|
+
) }, "")
|
|
1148
|
+
] })
|
|
1149
|
+
] });
|
|
1150
|
+
}, ft = ["line1", "line2", "line3", "city", "state", "postcode", "country"], Gt = ({
|
|
1151
|
+
addressFields: e,
|
|
1152
|
+
onFieldChange: r,
|
|
1153
|
+
onSubmitSuccess: t,
|
|
1154
|
+
actions: n,
|
|
1155
|
+
input: i
|
|
1156
|
+
}) => {
|
|
1157
|
+
const s = ie(null), o = ie(!1);
|
|
1158
|
+
ye(() => {
|
|
1159
|
+
if (s.current) {
|
|
1160
|
+
const p = s.current.querySelector("input");
|
|
1161
|
+
p && (p.focus(), p.select());
|
|
1162
|
+
}
|
|
1163
|
+
}, []);
|
|
1164
|
+
const c = Object.keys(wt), { t: h } = J();
|
|
1165
|
+
return /* @__PURE__ */ a(
|
|
1166
|
+
"form",
|
|
1167
|
+
{
|
|
1168
|
+
class: "flex flex-col px-2 pt-2",
|
|
1169
|
+
onInputCapture: () => {
|
|
1170
|
+
o.current = !1;
|
|
1171
|
+
},
|
|
1172
|
+
onInvalidCapture: () => {
|
|
1173
|
+
const p = M.current$.peek().flow;
|
|
1174
|
+
!o.current && p && Ge(p).refused(), o.current = !0;
|
|
1175
|
+
},
|
|
1176
|
+
onSubmit: (p) => {
|
|
1177
|
+
p.preventDefault();
|
|
1178
|
+
const g = p.currentTarget, m = [...g.querySelectorAll("input")].filter((b) => b.value !== "" && !b.value.trim());
|
|
1179
|
+
for (const b of m) {
|
|
1180
|
+
b.value = "";
|
|
1181
|
+
const F = ft.find((k) => i.config.keys[k] === b.name);
|
|
1182
|
+
F && r(F, "");
|
|
1183
|
+
}
|
|
1184
|
+
if (m.length > 0 && !g.checkValidity()) {
|
|
1185
|
+
g.reportValidity();
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
const v = new FormData(g), f = Object.fromEntries(v.entries());
|
|
1189
|
+
t({ type: "address", value: f });
|
|
1190
|
+
},
|
|
1191
|
+
children: [
|
|
1192
|
+
/* @__PURE__ */ a(
|
|
1193
|
+
"div",
|
|
1194
|
+
{
|
|
1195
|
+
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]",
|
|
1196
|
+
ref: s,
|
|
1197
|
+
children: ft.map((p, g) => {
|
|
1198
|
+
const m = `isdk_${p}`, v = i.config.keys[p];
|
|
1199
|
+
return v ? /* @__PURE__ */ a(de, { children: [
|
|
1200
|
+
/* @__PURE__ */ a(
|
|
1201
|
+
"label",
|
|
1202
|
+
{
|
|
1203
|
+
for: m,
|
|
1204
|
+
class: "text-neutral-11 [&:has(+*>input:focus)]:text-neutral-12 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",
|
|
1205
|
+
children: h(p)
|
|
1206
|
+
}
|
|
1207
|
+
),
|
|
1208
|
+
/* @__PURE__ */ a("div", { class: "flex flex-col items-stretch gap-1.5", children: [
|
|
1209
|
+
p === "country" ? /* @__PURE__ */ a("div", { class: "relative", children: [
|
|
1210
|
+
/* @__PURE__ */ a(
|
|
1211
|
+
"select",
|
|
1212
|
+
{
|
|
1213
|
+
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",
|
|
1214
|
+
name: v,
|
|
1215
|
+
id: m,
|
|
1216
|
+
defaultValue: e[p],
|
|
1217
|
+
onChange: (f) => r(p, f.currentTarget.value),
|
|
1218
|
+
required: !0,
|
|
1219
|
+
children: [
|
|
1220
|
+
e.country && !c.includes(e.country) ? /* @__PURE__ */ a("option", { value: e[p], children: e[p] }) : /* @__PURE__ */ a("option", { value: "", children: h("select_country") }),
|
|
1221
|
+
c.map((f) => /* @__PURE__ */ a("option", { value: f, children: f }, f))
|
|
1222
|
+
]
|
|
1223
|
+
}
|
|
1224
|
+
),
|
|
1225
|
+
/* @__PURE__ */ a(
|
|
1226
|
+
"svg",
|
|
1227
|
+
{
|
|
1228
|
+
class: "text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",
|
|
1229
|
+
width: "16",
|
|
1230
|
+
height: "16",
|
|
1231
|
+
stroke: "currentColor",
|
|
1232
|
+
"stroke-width": "1.5",
|
|
1233
|
+
"stroke-linecap": "round",
|
|
1234
|
+
"stroke-linejoin": "round",
|
|
1235
|
+
viewBox: "0 0 16 16",
|
|
1236
|
+
fill: "none",
|
|
1237
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1238
|
+
children: /* @__PURE__ */ a("path", { d: "M4 6.5L8 10.5L12 6.5" })
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1241
|
+
] }) : /* @__PURE__ */ a(
|
|
1242
|
+
"input",
|
|
1243
|
+
{
|
|
1244
|
+
autoFocus: g === 0 ? !0 : void 0,
|
|
1245
|
+
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",
|
|
1246
|
+
name: v,
|
|
1247
|
+
id: m,
|
|
1248
|
+
defaultValue: e[p],
|
|
1249
|
+
onInput: (f) => r(p, f.currentTarget.value),
|
|
1250
|
+
required: p === "line2" ? i.config.line2Required === !0 : p !== "line3"
|
|
1251
|
+
}
|
|
1252
|
+
),
|
|
1253
|
+
g === ft.length - 1 ? /* @__PURE__ */ a("hr", { class: "m-0 w-full border-b border-b-transparent" }) : /* @__PURE__ */ a("hr", { class: "border-b-neutral-5 m-0 w-full border-b border-solid" })
|
|
1254
|
+
] })
|
|
1255
|
+
] }) : null;
|
|
1256
|
+
})
|
|
1257
|
+
}
|
|
1258
|
+
),
|
|
1259
|
+
/* @__PURE__ */ a("div", { class: "bg-neutral-1 sticky bottom-0 flex items-center py-2", children: [
|
|
1260
|
+
n,
|
|
1261
|
+
/* @__PURE__ */ a(Se, { class: "ml-auto" })
|
|
1262
|
+
] })
|
|
1263
|
+
]
|
|
1264
|
+
}
|
|
1265
|
+
);
|
|
1266
|
+
}, _t = () => {
|
|
1267
|
+
const e = ie(null);
|
|
1268
|
+
return Ye(() => {
|
|
1269
|
+
var r;
|
|
1270
|
+
(r = e.current) == null || r.focus();
|
|
1271
|
+
}, []), e;
|
|
1272
|
+
}, Or = ["true", "false"], rs = /* @__PURE__ */ Tr(Or), ns = "answer", Pr = "flex items-center flex-wrap gap-2 p-2.5", Br = "min-w-0 max-w-full flex-auto", jr = yr(
|
|
1273
|
+
({ label: e, ...r }, t) => /* @__PURE__ */ a(
|
|
1274
|
+
"button",
|
|
1275
|
+
{
|
|
1276
|
+
class: "bg-lowest ease-expo-out ring-divider text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr block w-full overflow-hidden rounded-2xl px-2 py-2.5 ring-2 transition-all selection:bg-transparent",
|
|
1277
|
+
...r,
|
|
1278
|
+
ref: t,
|
|
1279
|
+
children: /* @__PURE__ */ a("p", { class: "text-center text-base", children: e })
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
), ss = ({ input: e, onSubmitSuccess: r }) => {
|
|
1283
|
+
const t = _t();
|
|
1284
|
+
return /* @__PURE__ */ a(
|
|
1285
|
+
"form",
|
|
1286
|
+
{
|
|
1287
|
+
noValidate: !0,
|
|
1288
|
+
class: "",
|
|
1289
|
+
onSubmit: (n) => {
|
|
1290
|
+
n.preventDefault();
|
|
1291
|
+
const i = ln(n).value, s = Nr(rs, i);
|
|
1292
|
+
r({ type: "boolean", value: s === "true" });
|
|
1293
|
+
},
|
|
1294
|
+
children: [
|
|
1295
|
+
/* @__PURE__ */ a("ul", { class: Pr, children: Or.map((n, i) => /* @__PURE__ */ a("li", { class: Br, children: /* @__PURE__ */ a(
|
|
1296
|
+
jr,
|
|
1297
|
+
{
|
|
1298
|
+
ref: i === 0 ? t : null,
|
|
1299
|
+
type: "submit",
|
|
1300
|
+
name: ns,
|
|
1301
|
+
value: n,
|
|
1302
|
+
label: e.config.labels[n]
|
|
1303
|
+
},
|
|
1304
|
+
n
|
|
1305
|
+
) })) }),
|
|
1306
|
+
e.config.optional && /* @__PURE__ */ a("div", { class: "px-2 pb-2", children: /* @__PURE__ */ a(ve, { class: "relative w-full", type: "button", onClick: () => r(null) }) })
|
|
1307
|
+
]
|
|
1308
|
+
}
|
|
1309
|
+
);
|
|
1310
|
+
}, Kt = (e) => e.reduce((r, t) => r + t.sizeKb, 0), is = Re("file"), Ht = 3, Qe = (e) => {
|
|
1311
|
+
const r = e.lastIndexOf(".");
|
|
1312
|
+
return r === -1 ? [e, ""] : [e.slice(0, r), e.slice(r)];
|
|
1313
|
+
}, as = ({
|
|
1314
|
+
file: e,
|
|
1315
|
+
class: r,
|
|
1316
|
+
...t
|
|
1317
|
+
}) => {
|
|
1318
|
+
const { t: n } = J(), [i, s] = Qe(e.name);
|
|
1319
|
+
return /* @__PURE__ */ a(
|
|
1320
|
+
"div",
|
|
1321
|
+
{
|
|
1322
|
+
class: Le(
|
|
1323
|
+
"bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline",
|
|
1324
|
+
r
|
|
1325
|
+
),
|
|
1326
|
+
...t,
|
|
1327
|
+
children: [
|
|
1328
|
+
/* @__PURE__ */ a("p", { class: "text-accent-12 flex flex-grow overflow-hidden", children: [
|
|
1329
|
+
/* @__PURE__ */ a("span", { class: "sr-only", children: [
|
|
1330
|
+
n("file_name"),
|
|
1331
|
+
": "
|
|
1332
|
+
] }),
|
|
1333
|
+
/* @__PURE__ */ a("span", { class: "block truncate", children: i }),
|
|
1334
|
+
/* @__PURE__ */ a("span", { children: s })
|
|
1335
|
+
] }),
|
|
1336
|
+
/* @__PURE__ */ a("p", { class: "text-accent-11", children: [
|
|
1337
|
+
/* @__PURE__ */ a("span", { class: "sr-only", children: [
|
|
1338
|
+
n("file_size"),
|
|
1339
|
+
": "
|
|
1340
|
+
] }),
|
|
1341
|
+
je(e.sizeKb)
|
|
1342
|
+
] })
|
|
1343
|
+
]
|
|
1344
|
+
}
|
|
1345
|
+
);
|
|
1346
|
+
}, Wt = ({ class: e, ...r }) => /* @__PURE__ */ a(
|
|
1347
|
+
"li",
|
|
1348
|
+
{
|
|
1349
|
+
class: Le(
|
|
1350
|
+
"outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",
|
|
1351
|
+
e
|
|
1352
|
+
),
|
|
1353
|
+
...r
|
|
1354
|
+
}
|
|
1355
|
+
), os = (e, r) => {
|
|
1356
|
+
const [t, n] = Qe(e);
|
|
1357
|
+
return `${t.slice(0, r)}${n}`;
|
|
1358
|
+
}, He = (e) => ({ name: os(e.name, 42), sizeKb: e.size / 1e3 }), ls = [
|
|
1359
|
+
".heic",
|
|
1360
|
+
".heif",
|
|
1361
|
+
".jpg",
|
|
1362
|
+
".jpeg",
|
|
1363
|
+
".png",
|
|
1364
|
+
".gif",
|
|
1365
|
+
".webp",
|
|
1366
|
+
".txt",
|
|
1367
|
+
".rtf",
|
|
1368
|
+
".odt",
|
|
1369
|
+
".pages",
|
|
1370
|
+
".zip"
|
|
1371
|
+
], cs = (e, r, t) => {
|
|
1372
|
+
const n = Qe(r.name)[1].toLowerCase(), i = [...t.map((o) => o.toLowerCase()), ...ls], s = n === "" ? "none" : i.includes(n) ? n : "other";
|
|
1373
|
+
return `chatbot-file-refused:${e}:${s}`;
|
|
1374
|
+
}, us = ({ input: e, onSubmitSuccess: r, analytics: t }) => {
|
|
1375
|
+
var k;
|
|
1376
|
+
const n = (k = M.current$.value.flow) == null ? void 0 : k.data.submissions[e.key], [i, s] = me(
|
|
1377
|
+
is(n) && n.value.length ? { status: "ready", files: n.value } : { status: "empty" }
|
|
1378
|
+
), o = ie(0), c = i.status === "ready" ? i.files : [], h = i.status === "ready" || i.status === "pending" ? i.files : [], p = i.status === "error" ? i.error : void 0, g = h.length - Ht, m = Kt(h), v = _t(), { t: f } = J(), b = (A, _ = e.config.extensions) => {
|
|
1379
|
+
if (!A.length) return { reason: "required", error: { type: "required", message: f("validation_file") } };
|
|
1380
|
+
if (!lt(A, _))
|
|
1381
|
+
return {
|
|
1382
|
+
reason: "type",
|
|
1383
|
+
file: A.find((L) => !lt([L], _)),
|
|
1384
|
+
error: { type: "validate", message: f("validation_file_ext", { ext: e.config.extensions.join(", ") }) }
|
|
1385
|
+
};
|
|
1386
|
+
if (A.some((L) => L.sizeKb === 0))
|
|
1387
|
+
return {
|
|
1388
|
+
reason: "empty",
|
|
1389
|
+
file: A.find((L) => L.sizeKb === 0),
|
|
1390
|
+
error: { type: "validate", message: f("validation_file_empty") }
|
|
1391
|
+
};
|
|
1392
|
+
if (e.config.fileSizeLimitKib && Kt(A) > e.config.fileSizeLimitKib)
|
|
1393
|
+
return {
|
|
1394
|
+
reason: "size",
|
|
1395
|
+
error: {
|
|
1396
|
+
type: "max",
|
|
1397
|
+
message: f("validation_file_size", { size: je(e.config.fileSizeLimitKib) })
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
if (!e.config.allowMultiple && A.length > 1)
|
|
1401
|
+
return { reason: "count", error: { type: "invalid", message: f("validation_file_max", { count: 1 }) } };
|
|
1402
|
+
}, F = (A, _) => {
|
|
1403
|
+
var L, N;
|
|
1404
|
+
return t.log({
|
|
1405
|
+
event: "INTERACTION",
|
|
1406
|
+
properties: { tag: cs(A, _, e.config.extensions) },
|
|
1407
|
+
customProperties: (N = (L = M.current$.peek().flow) == null ? void 0 : L.analytics) == null ? void 0 : N.customProperties
|
|
1408
|
+
});
|
|
1409
|
+
};
|
|
1410
|
+
return /* @__PURE__ */ a(
|
|
1411
|
+
"form",
|
|
1412
|
+
{
|
|
1413
|
+
class: "flex flex-col gap-1 p-2.5",
|
|
1414
|
+
onSubmit: (A) => {
|
|
1415
|
+
if (A.preventDefault(), i.status === "pending" || i.status === "error") return;
|
|
1416
|
+
const _ = b(c);
|
|
1417
|
+
_ ? s({ status: "error", error: _.error }) : r({ type: "file", value: c });
|
|
1418
|
+
},
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ a("div", { class: "flex items-center gap-2", children: [
|
|
1421
|
+
/* @__PURE__ */ a(
|
|
1422
|
+
"label",
|
|
1423
|
+
{
|
|
1424
|
+
ref: v,
|
|
1425
|
+
for: "dropzone-file",
|
|
1426
|
+
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",
|
|
1427
|
+
children: [
|
|
1428
|
+
h.length > 0 ? /* @__PURE__ */ a("ul", { class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1", children: [
|
|
1429
|
+
h.slice(0, Ht).map((A) => {
|
|
1430
|
+
const [_, L] = Qe(A.name);
|
|
1431
|
+
return /* @__PURE__ */ a(Wt, { class: "flex overflow-hidden", children: [
|
|
1432
|
+
/* @__PURE__ */ a("span", { class: "block truncate", children: _ }),
|
|
1433
|
+
/* @__PURE__ */ a("span", { children: L })
|
|
1434
|
+
] });
|
|
1435
|
+
}),
|
|
1436
|
+
g > 0 ? /* @__PURE__ */ a(Wt, { children: f("file_more", { count: g }) }) : null
|
|
1437
|
+
] }) : /* @__PURE__ */ a("div", { class: "flex flex-col justify-center gap-4 pb-6 pt-5", children: [
|
|
1438
|
+
/* @__PURE__ */ a("header", { class: "flex flex-col items-center gap-0", children: [
|
|
1439
|
+
/* @__PURE__ */ a(
|
|
1440
|
+
"svg",
|
|
1441
|
+
{
|
|
1442
|
+
class: "text-neutral-11 mb-1 h-8 w-8",
|
|
1443
|
+
"aria-hidden": "true",
|
|
1444
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1445
|
+
fill: "none",
|
|
1446
|
+
viewBox: "0 0 20 16",
|
|
1447
|
+
children: /* @__PURE__ */ a(
|
|
1448
|
+
"path",
|
|
1449
|
+
{
|
|
1450
|
+
stroke: "currentColor",
|
|
1451
|
+
"stroke-linecap": "round",
|
|
1452
|
+
"stroke-linejoin": "round",
|
|
1453
|
+
"stroke-width": "1.5",
|
|
1454
|
+
d: "M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
|
|
1455
|
+
}
|
|
1456
|
+
)
|
|
1457
|
+
}
|
|
1458
|
+
),
|
|
1459
|
+
/* @__PURE__ */ a("p", { class: "text-neutral-12 tracking-[-0.01em]", children: f("upload_file", { count: e.config.allowMultiple ? 2 : 1 }) }),
|
|
1460
|
+
e.config.fileSizeLimitKib ? /* @__PURE__ */ a("p", { class: "text-neutral-11 text-xs", children: [
|
|
1461
|
+
"(",
|
|
1462
|
+
f("file_max_size", { size: je(e.config.fileSizeLimitKib) }),
|
|
1463
|
+
")"
|
|
1464
|
+
] }) : null
|
|
1465
|
+
] }),
|
|
1466
|
+
/* @__PURE__ */ a("aside", { class: "flex flex-col items-center gap-2", children: [
|
|
1467
|
+
/* @__PURE__ */ a("p", { id: "accepted-filetypes", class: "sr-only", children: f("file_extensions") }),
|
|
1468
|
+
/* @__PURE__ */ a("ul", { "aria-describedby": "accepted-filetypes", class: "flex flex-wrap justify-center gap-2", children: e.config.extensions.map((A) => /* @__PURE__ */ a("li", { class: "ring-lowest outline-neutral-6 text-neutral-11 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2", children: A.replace(".", "") })) })
|
|
1469
|
+
] })
|
|
1470
|
+
] }),
|
|
1471
|
+
/* @__PURE__ */ a(
|
|
1472
|
+
"p",
|
|
1473
|
+
{
|
|
1474
|
+
role: "status",
|
|
1475
|
+
class: Le("text-neutral-11 flex items-center gap-1.5 text-xs", h.length === 0 && "sr-only"),
|
|
1476
|
+
children: i.status === "pending" ? /* @__PURE__ */ a(de, { children: [
|
|
1477
|
+
/* @__PURE__ */ a(yt, { "aria-hidden": "true", class: "h-4 w-4" }),
|
|
1478
|
+
f("file_preparing", { count: h.length })
|
|
1479
|
+
] }) : i.status === "ready" ? /* @__PURE__ */ a(de, { children: [
|
|
1480
|
+
c.length > 1 ? f("file_total_size", { size: je(m) }) : je(m),
|
|
1481
|
+
/* @__PURE__ */ a("span", { class: "sr-only", children: [
|
|
1482
|
+
". ",
|
|
1483
|
+
f("file_ready", { count: c.length })
|
|
1484
|
+
] })
|
|
1485
|
+
] }) : null
|
|
1486
|
+
}
|
|
1487
|
+
),
|
|
1488
|
+
/* @__PURE__ */ a(
|
|
1489
|
+
"input",
|
|
1490
|
+
{
|
|
1491
|
+
id: "dropzone-file",
|
|
1492
|
+
"aria-label": f("upload_file", { count: e.config.allowMultiple ? 2 : 1 }),
|
|
1493
|
+
onInput: async (A) => {
|
|
1494
|
+
Ce(A.target instanceof HTMLInputElement);
|
|
1495
|
+
const _ = A.target.files ? Array.from(A.target.files) : [];
|
|
1496
|
+
if (A.target.value = "", !_[0]) return;
|
|
1497
|
+
const L = ++o.current, N = i.status === "ready";
|
|
1498
|
+
let D = _;
|
|
1499
|
+
if (!lt(_, e.config.extensions)) {
|
|
1500
|
+
const R = b(_.map(He), []);
|
|
1501
|
+
if (R)
|
|
1502
|
+
return F(R.reason, R.file ?? _[0]), s({ status: "error", error: R.error });
|
|
1503
|
+
s({ status: "pending", files: _.map(He) });
|
|
1504
|
+
let j;
|
|
1505
|
+
try {
|
|
1506
|
+
D = await Promise.all(
|
|
1507
|
+
_.map(
|
|
1508
|
+
(V) => un(V, e.config.extensions).catch((T) => {
|
|
1509
|
+
throw j ?? (j = V), T;
|
|
1510
|
+
})
|
|
1511
|
+
)
|
|
1512
|
+
);
|
|
1513
|
+
} catch {
|
|
1514
|
+
return o.current !== L ? void 0 : (F("unreadable", j ?? _[0]), s({
|
|
1515
|
+
status: "error",
|
|
1516
|
+
error: {
|
|
1517
|
+
type: "invalid",
|
|
1518
|
+
message: f(N ? "file_read_error_replacement" : "file_read_error")
|
|
1519
|
+
}
|
|
1520
|
+
}));
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
const [G] = D;
|
|
1524
|
+
if (!G || o.current !== L) return;
|
|
1525
|
+
const K = D.map(He), S = b(K);
|
|
1526
|
+
if (S)
|
|
1527
|
+
return F(S.reason, S.file ?? G), s({ status: "error", error: S.error });
|
|
1528
|
+
s({ status: "pending", files: K });
|
|
1529
|
+
let I;
|
|
1530
|
+
try {
|
|
1531
|
+
const R = await Promise.all(
|
|
1532
|
+
D.map(async (j) => {
|
|
1533
|
+
try {
|
|
1534
|
+
return { ...He(j), data: await dn(j) };
|
|
1535
|
+
} catch (V) {
|
|
1536
|
+
throw I ?? (I = j), V;
|
|
1537
|
+
}
|
|
1538
|
+
})
|
|
1539
|
+
);
|
|
1540
|
+
o.current === L && s({ status: "ready", files: R });
|
|
1541
|
+
} catch {
|
|
1542
|
+
if (o.current !== L) return;
|
|
1543
|
+
F("unreadable", I ?? G), s({
|
|
1544
|
+
status: "error",
|
|
1545
|
+
error: {
|
|
1546
|
+
type: "invalid",
|
|
1547
|
+
message: f(N ? "file_read_error_replacement" : "file_read_error")
|
|
1548
|
+
}
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
multiple: e.config.allowMultiple,
|
|
1553
|
+
accept: cn(e.config.extensions),
|
|
1554
|
+
type: "file",
|
|
1555
|
+
class: "sr-only"
|
|
1556
|
+
}
|
|
1557
|
+
)
|
|
1558
|
+
]
|
|
1559
|
+
}
|
|
1560
|
+
),
|
|
1561
|
+
/* @__PURE__ */ a("div", { class: "flex h-full flex-col items-center gap-2", children: [
|
|
1562
|
+
/* @__PURE__ */ a(Se, { disabled: c.length === 0 }),
|
|
1563
|
+
e.config.optional && /* @__PURE__ */ a(ve, { class: "relative", onClick: () => r(null) })
|
|
1564
|
+
] })
|
|
1565
|
+
] }),
|
|
1566
|
+
/* @__PURE__ */ a(Te, { error: p, refusal: !0 })
|
|
1567
|
+
]
|
|
1568
|
+
}
|
|
1569
|
+
);
|
|
1570
|
+
};
|
|
1571
|
+
var Ke = (e) => e.type === "checkbox", ke = (e) => e instanceof Date, ee = (e) => e == null;
|
|
1572
|
+
const Ur = (e) => typeof e == "object";
|
|
1573
|
+
var $ = (e) => !ee(e) && !Array.isArray(e) && Ur(e) && !ke(e), ds = (e) => $(e) && e.target ? Ke(e.target) ? e.target.checked : e.target.value : e, fs = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, hs = (e, r) => e.has(fs(r)), ps = (e) => {
|
|
1574
|
+
const r = e.constructor && e.constructor.prototype;
|
|
1575
|
+
return $(r) && r.hasOwnProperty("isPrototypeOf");
|
|
1576
|
+
}, kt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
1577
|
+
function W(e) {
|
|
1578
|
+
if (e instanceof Date)
|
|
1579
|
+
return new Date(e);
|
|
1580
|
+
const r = typeof FileList < "u" && e instanceof FileList;
|
|
1581
|
+
if (kt && (e instanceof Blob || r))
|
|
1582
|
+
return e;
|
|
1583
|
+
const t = Array.isArray(e);
|
|
1584
|
+
if (!t && !($(e) && ps(e)))
|
|
1585
|
+
return e;
|
|
1586
|
+
const n = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1587
|
+
for (const i in e)
|
|
1588
|
+
Object.prototype.hasOwnProperty.call(e, i) && (n[i] = W(e[i]));
|
|
1589
|
+
return n;
|
|
1590
|
+
}
|
|
1591
|
+
var et = (e) => /^\w*$/.test(e), U = (e) => e === void 0, Ct = (e) => Array.isArray(e) ? e.filter(Boolean) : [], St = (e) => Ct(e.replace(/["|']|\]/g, "").split(/\.|\[/)), C = (e, r, t) => {
|
|
1592
|
+
if (!r || !$(e))
|
|
1593
|
+
return t;
|
|
1594
|
+
const n = (et(r) ? [r] : St(r)).reduce((i, s) => ee(i) ? i : i[s], e);
|
|
1595
|
+
return U(n) || n === e ? U(e[r]) ? t : e[r] : n;
|
|
1596
|
+
}, ue = (e) => typeof e == "boolean", oe = (e) => typeof e == "function", B = (e, r, t) => {
|
|
1597
|
+
let n = -1;
|
|
1598
|
+
const i = et(r) ? [r] : St(r), s = i.length, o = s - 1;
|
|
1599
|
+
for (; ++n < s; ) {
|
|
1600
|
+
const c = i[n];
|
|
1601
|
+
let h = t;
|
|
1602
|
+
if (n !== o) {
|
|
1603
|
+
const p = e[c];
|
|
1604
|
+
h = $(p) || Array.isArray(p) ? p : isNaN(+i[n + 1]) ? {} : [];
|
|
1605
|
+
}
|
|
1606
|
+
if (c === "__proto__" || c === "constructor" || c === "prototype")
|
|
1607
|
+
return;
|
|
1608
|
+
e[c] = h, e = e[c];
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1611
|
+
const Jt = {
|
|
1612
|
+
BLUR: "blur",
|
|
1613
|
+
FOCUS_OUT: "focusout"
|
|
1614
|
+
}, le = {
|
|
1615
|
+
onBlur: "onBlur",
|
|
1616
|
+
onChange: "onChange",
|
|
1617
|
+
onSubmit: "onSubmit",
|
|
1618
|
+
onTouched: "onTouched",
|
|
1619
|
+
all: "all"
|
|
1620
|
+
}, pe = {
|
|
1621
|
+
max: "max",
|
|
1622
|
+
min: "min",
|
|
1623
|
+
maxLength: "maxLength",
|
|
1624
|
+
minLength: "minLength",
|
|
1625
|
+
pattern: "pattern",
|
|
1626
|
+
required: "required",
|
|
1627
|
+
validate: "validate"
|
|
1628
|
+
}, ms = Y.createContext(null);
|
|
1629
|
+
ms.displayName = "HookFormControlContext";
|
|
1630
|
+
var gs = (e, r, t, n = !0) => {
|
|
1631
|
+
const i = {
|
|
1632
|
+
defaultValues: r._defaultValues
|
|
1633
|
+
};
|
|
1634
|
+
for (const s in e)
|
|
1635
|
+
Object.defineProperty(i, s, {
|
|
1636
|
+
get: () => {
|
|
1637
|
+
const o = s;
|
|
1638
|
+
return r._proxyFormState[o] !== le.all && (r._proxyFormState[o] = !n || le.all), e[o];
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
return i;
|
|
1642
|
+
};
|
|
1643
|
+
const ys = typeof window < "u" ? Y.useLayoutEffect : Y.useEffect;
|
|
1644
|
+
var se = (e) => typeof e == "string", vs = (e, r, t, n, i) => se(e) ? (n && r.watch.add(e), C(t, e, i)) : Array.isArray(e) ? e.map((s) => (n && r.watch.add(s), C(t, s))) : (n && (r.watchAll = !0), t), mt = (e) => ee(e) || !Ur(e);
|
|
1645
|
+
function xe(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
1646
|
+
if (mt(e) || mt(r))
|
|
1647
|
+
return Object.is(e, r);
|
|
1648
|
+
if (ke(e) && ke(r))
|
|
1649
|
+
return Object.is(e.getTime(), r.getTime());
|
|
1650
|
+
const n = Object.keys(e), i = Object.keys(r);
|
|
1651
|
+
if (n.length !== i.length)
|
|
1652
|
+
return !1;
|
|
1653
|
+
if (t.has(e) || t.has(r))
|
|
1654
|
+
return !0;
|
|
1655
|
+
t.add(e), t.add(r);
|
|
1656
|
+
for (const s of n) {
|
|
1657
|
+
const o = e[s];
|
|
1658
|
+
if (!i.includes(s))
|
|
1659
|
+
return !1;
|
|
1660
|
+
if (s !== "ref") {
|
|
1661
|
+
const c = r[s];
|
|
1662
|
+
if (ke(o) && ke(c) || $(o) && $(c) || Array.isArray(o) && Array.isArray(c) ? !xe(o, c, t) : !Object.is(o, c))
|
|
1663
|
+
return !1;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
return !0;
|
|
1667
|
+
}
|
|
1668
|
+
const bs = Y.createContext(null);
|
|
1669
|
+
bs.displayName = "HookFormContext";
|
|
1670
|
+
var zr = (e, r, t, n, i) => r ? {
|
|
1671
|
+
...t[e],
|
|
1672
|
+
types: {
|
|
1673
|
+
...t[e] && t[e].types ? t[e].types : {},
|
|
1674
|
+
[n]: i || !0
|
|
1675
|
+
}
|
|
1676
|
+
} : {}, qe = (e) => Array.isArray(e) ? e : [e], Zt = () => {
|
|
1677
|
+
let e = [];
|
|
1678
|
+
return {
|
|
1679
|
+
get observers() {
|
|
1680
|
+
return e;
|
|
1681
|
+
},
|
|
1682
|
+
next: (i) => {
|
|
1683
|
+
for (const s of e)
|
|
1684
|
+
s.next && s.next(i);
|
|
1685
|
+
},
|
|
1686
|
+
subscribe: (i) => (e.push(i), {
|
|
1687
|
+
unsubscribe: () => {
|
|
1688
|
+
e = e.filter((s) => s !== i);
|
|
1689
|
+
}
|
|
1690
|
+
}),
|
|
1691
|
+
unsubscribe: () => {
|
|
1692
|
+
e = [];
|
|
1693
|
+
}
|
|
1694
|
+
};
|
|
1695
|
+
};
|
|
1696
|
+
function qr(e, r) {
|
|
1697
|
+
const t = {};
|
|
1698
|
+
for (const n in e)
|
|
1699
|
+
if (e.hasOwnProperty(n)) {
|
|
1700
|
+
const i = e[n], s = r[n];
|
|
1701
|
+
if (i && $(i) && s) {
|
|
1702
|
+
const o = qr(i, s);
|
|
1703
|
+
$(o) && (t[n] = o);
|
|
1704
|
+
} else e[n] && (t[n] = s);
|
|
1705
|
+
}
|
|
1706
|
+
return t;
|
|
1707
|
+
}
|
|
1708
|
+
var Q = (e) => $(e) && !Object.keys(e).length, At = (e) => e.type === "file", Je = (e) => {
|
|
1709
|
+
if (!kt)
|
|
1710
|
+
return !1;
|
|
1711
|
+
const r = e ? e.ownerDocument : 0;
|
|
1712
|
+
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
1713
|
+
}, $r = (e) => e.type === "select-multiple", Et = (e) => e.type === "radio", xs = (e) => Et(e) || Ke(e), ht = (e) => Je(e) && e.isConnected;
|
|
1714
|
+
function ws(e, r) {
|
|
1715
|
+
const t = r.slice(0, -1).length;
|
|
1716
|
+
let n = 0;
|
|
1717
|
+
for (; n < t; )
|
|
1718
|
+
e = U(e) ? n++ : e[r[n++]];
|
|
1719
|
+
return e;
|
|
1720
|
+
}
|
|
1721
|
+
function _s(e) {
|
|
1722
|
+
for (const r in e)
|
|
1723
|
+
if (e.hasOwnProperty(r) && !U(e[r]))
|
|
1724
|
+
return !1;
|
|
1725
|
+
return !0;
|
|
1726
|
+
}
|
|
1727
|
+
function q(e, r) {
|
|
1728
|
+
const t = Array.isArray(r) ? r : et(r) ? [r] : St(r), n = t.length === 1 ? e : ws(e, t), i = t.length - 1, s = t[i];
|
|
1729
|
+
return n && delete n[s], i !== 0 && ($(n) && Q(n) || Array.isArray(n) && _s(n)) && q(e, t.slice(0, -1)), e;
|
|
1730
|
+
}
|
|
1731
|
+
var ks = (e) => {
|
|
1732
|
+
for (const r in e)
|
|
1733
|
+
if (oe(e[r]))
|
|
1734
|
+
return !0;
|
|
1735
|
+
return !1;
|
|
1736
|
+
};
|
|
1737
|
+
function Gr(e) {
|
|
1738
|
+
return Array.isArray(e) || $(e) && !ks(e);
|
|
1739
|
+
}
|
|
1740
|
+
function gt(e, r = {}) {
|
|
1741
|
+
for (const t in e) {
|
|
1742
|
+
const n = e[t];
|
|
1743
|
+
Gr(n) ? (r[t] = Array.isArray(n) ? [] : {}, gt(n, r[t])) : U(n) || (r[t] = !0);
|
|
1744
|
+
}
|
|
1745
|
+
return r;
|
|
1746
|
+
}
|
|
1747
|
+
function Ee(e, r, t) {
|
|
1748
|
+
t || (t = gt(r));
|
|
1749
|
+
for (const n in e) {
|
|
1750
|
+
const i = e[n];
|
|
1751
|
+
if (Gr(i))
|
|
1752
|
+
U(r) || mt(t[n]) ? t[n] = gt(i, Array.isArray(i) ? [] : {}) : Ee(i, ee(r) ? {} : r[n], t[n]);
|
|
1753
|
+
else {
|
|
1754
|
+
const s = r[n];
|
|
1755
|
+
t[n] = !xe(i, s);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
return t;
|
|
1759
|
+
}
|
|
1760
|
+
const Xt = {
|
|
1761
|
+
value: !1,
|
|
1762
|
+
isValid: !1
|
|
1763
|
+
}, Yt = { value: !0, isValid: !0 };
|
|
1764
|
+
var Kr = (e) => {
|
|
1765
|
+
if (Array.isArray(e)) {
|
|
1766
|
+
if (e.length > 1) {
|
|
1767
|
+
const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
|
|
1768
|
+
return { value: r, isValid: !!r.length };
|
|
1769
|
+
}
|
|
1770
|
+
return e[0].checked && !e[0].disabled ? (
|
|
1771
|
+
// @ts-expect-error expected to work in the browser
|
|
1772
|
+
e[0].attributes && !U(e[0].attributes.value) ? U(e[0].value) || e[0].value === "" ? Yt : { value: e[0].value, isValid: !0 } : Yt
|
|
1773
|
+
) : Xt;
|
|
1774
|
+
}
|
|
1775
|
+
return Xt;
|
|
1776
|
+
}, Hr = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => U(e) ? e : r ? e === "" ? NaN : e && +e : t && se(e) ? new Date(e) : n ? n(e) : e;
|
|
1777
|
+
const Qt = {
|
|
1778
|
+
isValid: !1,
|
|
1779
|
+
value: null
|
|
1780
|
+
};
|
|
1781
|
+
var Wr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
1782
|
+
isValid: !0,
|
|
1783
|
+
value: t.value
|
|
1784
|
+
} : r, Qt) : Qt;
|
|
1785
|
+
function er(e) {
|
|
1786
|
+
const r = e.ref;
|
|
1787
|
+
return At(r) ? r.files : Et(r) ? Wr(e.refs).value : $r(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Ke(r) ? Kr(e.refs).value : Hr(U(r.value) ? e.ref.value : r.value, e);
|
|
1788
|
+
}
|
|
1789
|
+
var Cs = (e, r, t, n) => {
|
|
1790
|
+
const i = {};
|
|
1791
|
+
for (const s of e) {
|
|
1792
|
+
const o = C(r, s);
|
|
1793
|
+
o && B(i, s, o._f);
|
|
1794
|
+
}
|
|
1795
|
+
return {
|
|
1796
|
+
criteriaMode: t,
|
|
1797
|
+
names: [...e],
|
|
1798
|
+
fields: i,
|
|
1799
|
+
shouldUseNativeValidation: n
|
|
1800
|
+
};
|
|
1801
|
+
}, Ze = (e) => e instanceof RegExp, Pe = (e) => U(e) ? e : Ze(e) ? e.source : $(e) ? Ze(e.value) ? e.value.source : e.value : e, tr = (e) => ({
|
|
1802
|
+
isOnSubmit: !e || e === le.onSubmit,
|
|
1803
|
+
isOnBlur: e === le.onBlur,
|
|
1804
|
+
isOnChange: e === le.onChange,
|
|
1805
|
+
isOnAll: e === le.all,
|
|
1806
|
+
isOnTouch: e === le.onTouched
|
|
1807
|
+
});
|
|
1808
|
+
const rr = "AsyncFunction";
|
|
1809
|
+
var Ss = (e) => !!e && !!e.validate && !!(oe(e.validate) && e.validate.constructor.name === rr || $(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === rr)), As = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), nr = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
1810
|
+
const $e = (e, r, t, n) => {
|
|
1811
|
+
for (const i of t || Object.keys(e)) {
|
|
1812
|
+
const s = C(e, i);
|
|
1813
|
+
if (s) {
|
|
1814
|
+
const { _f: o, ...c } = s;
|
|
1815
|
+
if (o) {
|
|
1816
|
+
if (o.refs && o.refs[0] && r(o.refs[0], i) && !n)
|
|
1817
|
+
return !0;
|
|
1818
|
+
if (o.ref && r(o.ref, o.name) && !n)
|
|
1819
|
+
return !0;
|
|
1820
|
+
if ($e(c, r))
|
|
1821
|
+
break;
|
|
1822
|
+
} else if ($(c) && $e(c, r))
|
|
1823
|
+
break;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
function sr(e, r, t) {
|
|
1828
|
+
const n = C(e, t);
|
|
1829
|
+
if (n || et(t))
|
|
1830
|
+
return {
|
|
1831
|
+
error: n,
|
|
1832
|
+
name: t
|
|
1833
|
+
};
|
|
1834
|
+
const i = t.split(".");
|
|
1835
|
+
for (; i.length; ) {
|
|
1836
|
+
const s = i.join("."), o = C(r, s), c = C(e, s);
|
|
1837
|
+
if (o && !Array.isArray(o) && t !== s)
|
|
1838
|
+
return { name: t };
|
|
1839
|
+
if (c && c.type)
|
|
1840
|
+
return {
|
|
1841
|
+
name: s,
|
|
1842
|
+
error: c
|
|
1843
|
+
};
|
|
1844
|
+
if (c && c.root && c.root.type)
|
|
1845
|
+
return {
|
|
1846
|
+
name: `${s}.root`,
|
|
1847
|
+
error: c.root
|
|
1848
|
+
};
|
|
1849
|
+
i.pop();
|
|
1850
|
+
}
|
|
1851
|
+
return {
|
|
1852
|
+
name: t
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
var Es = (e, r, t, n) => {
|
|
1856
|
+
t(e);
|
|
1857
|
+
const { name: i, ...s } = e;
|
|
1858
|
+
return Q(s) || Object.keys(s).length >= Object.keys(r).length || Object.keys(s).find((o) => r[o] === (!n || le.all));
|
|
1859
|
+
}, Fs = (e, r, t) => !e || !r || e === r || qe(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), Vs = (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, Is = (e, r) => !Ct(C(e, r)).length && q(e, r), Ds = (e, r, t) => {
|
|
1860
|
+
const n = qe(C(e, t));
|
|
1861
|
+
return B(n, "root", r[t]), B(e, t, n), e;
|
|
1862
|
+
};
|
|
1863
|
+
function ir(e, r, t = "validate") {
|
|
1864
|
+
if (se(e) || Array.isArray(e) && e.every(se) || ue(e) && !e)
|
|
1865
|
+
return {
|
|
1866
|
+
type: t,
|
|
1867
|
+
message: se(e) ? e : "",
|
|
1868
|
+
ref: r
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
var Ae = (e) => $(e) && !Ze(e) ? e : {
|
|
1872
|
+
value: e,
|
|
1873
|
+
message: ""
|
|
1874
|
+
}, ar = async (e, r, t, n, i, s) => {
|
|
1875
|
+
const { ref: o, refs: c, required: h, maxLength: p, minLength: g, min: m, max: v, pattern: f, validate: b, name: F, valueAsNumber: k, mount: A } = e._f, _ = C(t, F);
|
|
1876
|
+
if (!A || r.has(F))
|
|
1877
|
+
return {};
|
|
1878
|
+
const L = c ? c[0] : o, N = (V) => {
|
|
1879
|
+
i && L.reportValidity && (L.setCustomValidity(ue(V) ? "" : V || ""), L.reportValidity());
|
|
1880
|
+
}, D = {}, G = Et(o), K = Ke(o), S = G || K, I = (k || At(o)) && U(o.value) && U(_) || Je(o) && o.value === "" || _ === "" || Array.isArray(_) && !_.length, R = zr.bind(null, F, n, D), j = (V, T, z, H = pe.maxLength, ae = pe.minLength) => {
|
|
1881
|
+
const re = V ? T : z;
|
|
1882
|
+
D[F] = {
|
|
1883
|
+
type: V ? H : ae,
|
|
1884
|
+
message: re,
|
|
1885
|
+
ref: o,
|
|
1886
|
+
...R(V ? H : ae, re)
|
|
1887
|
+
};
|
|
1888
|
+
};
|
|
1889
|
+
if (s ? !Array.isArray(_) || !_.length : h && (!S && (I || ee(_)) || ue(_) && !_ || K && !Kr(c).isValid || G && !Wr(c).isValid)) {
|
|
1890
|
+
const { value: V, message: T } = se(h) ? { value: !!h, message: h } : Ae(h);
|
|
1891
|
+
if (V && (D[F] = {
|
|
1892
|
+
type: pe.required,
|
|
1893
|
+
message: T,
|
|
1894
|
+
ref: L,
|
|
1895
|
+
...R(pe.required, T)
|
|
1896
|
+
}, !n))
|
|
1897
|
+
return N(T), D;
|
|
1898
|
+
}
|
|
1899
|
+
if (!I && (!ee(m) || !ee(v))) {
|
|
1900
|
+
let V, T;
|
|
1901
|
+
const z = Ae(v), H = Ae(m);
|
|
1902
|
+
if (!ee(_) && !isNaN(_)) {
|
|
1903
|
+
const ae = o.valueAsNumber || _ && +_;
|
|
1904
|
+
ee(z.value) || (V = ae > z.value), ee(H.value) || (T = ae < H.value);
|
|
1905
|
+
} else {
|
|
1906
|
+
const ae = o.valueAsDate || new Date(_), re = (Oe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Oe), Me = o.type == "time", Ne = o.type == "week";
|
|
1907
|
+
se(z.value) && _ && (V = Me ? re(_) > re(z.value) : Ne ? _ > z.value : ae > new Date(z.value)), se(H.value) && _ && (T = Me ? re(_) < re(H.value) : Ne ? _ < H.value : ae < new Date(H.value));
|
|
1908
|
+
}
|
|
1909
|
+
if ((V || T) && (j(!!V, z.message, H.message, pe.max, pe.min), !n))
|
|
1910
|
+
return N(D[F].message), D;
|
|
1911
|
+
}
|
|
1912
|
+
if ((p || g) && !I && (se(_) || s && Array.isArray(_))) {
|
|
1913
|
+
const V = Ae(p), T = Ae(g), z = !ee(V.value) && _.length > +V.value, H = !ee(T.value) && _.length < +T.value;
|
|
1914
|
+
if ((z || H) && (j(z, V.message, T.message), !n))
|
|
1915
|
+
return N(D[F].message), D;
|
|
1916
|
+
}
|
|
1917
|
+
if (f && !I && se(_)) {
|
|
1918
|
+
const { value: V, message: T } = Ae(f);
|
|
1919
|
+
if (Ze(V) && !_.match(V) && (D[F] = {
|
|
1920
|
+
type: pe.pattern,
|
|
1921
|
+
message: T,
|
|
1922
|
+
ref: o,
|
|
1923
|
+
...R(pe.pattern, T)
|
|
1924
|
+
}, !n))
|
|
1925
|
+
return N(T), D;
|
|
1926
|
+
}
|
|
1927
|
+
if (b) {
|
|
1928
|
+
if (oe(b)) {
|
|
1929
|
+
const V = await b(_, t), T = ir(V, L);
|
|
1930
|
+
if (T && (D[F] = {
|
|
1931
|
+
...T,
|
|
1932
|
+
...R(pe.validate, T.message)
|
|
1933
|
+
}, !n))
|
|
1934
|
+
return N(T.message), D;
|
|
1935
|
+
} else if ($(b)) {
|
|
1936
|
+
let V = {};
|
|
1937
|
+
for (const T in b) {
|
|
1938
|
+
if (!Q(V) && !n)
|
|
1939
|
+
break;
|
|
1940
|
+
const z = ir(await b[T](_, t), L, T);
|
|
1941
|
+
z && (V = {
|
|
1942
|
+
...z,
|
|
1943
|
+
...R(T, z.message)
|
|
1944
|
+
}, N(z.message), n && (D[F] = V));
|
|
1945
|
+
}
|
|
1946
|
+
if (!Q(V) && (D[F] = {
|
|
1947
|
+
ref: L,
|
|
1948
|
+
...V
|
|
1949
|
+
}, !n))
|
|
1950
|
+
return D;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
return N(!0), D;
|
|
1954
|
+
};
|
|
1955
|
+
const Ls = {
|
|
1956
|
+
mode: le.onSubmit,
|
|
1957
|
+
reValidateMode: le.onChange,
|
|
1958
|
+
shouldFocusError: !0
|
|
1959
|
+
};
|
|
1960
|
+
function Rs(e = {}) {
|
|
1961
|
+
let r = {
|
|
1962
|
+
...Ls,
|
|
1963
|
+
...e
|
|
1964
|
+
}, t = {
|
|
1965
|
+
submitCount: 0,
|
|
1966
|
+
isDirty: !1,
|
|
1967
|
+
isReady: !1,
|
|
1968
|
+
isLoading: oe(r.defaultValues),
|
|
1969
|
+
isValidating: !1,
|
|
1970
|
+
isSubmitted: !1,
|
|
1971
|
+
isSubmitting: !1,
|
|
1972
|
+
isSubmitSuccessful: !1,
|
|
1973
|
+
isValid: !1,
|
|
1974
|
+
touchedFields: {},
|
|
1975
|
+
dirtyFields: {},
|
|
1976
|
+
validatingFields: {},
|
|
1977
|
+
errors: r.errors || {},
|
|
1978
|
+
disabled: r.disabled || !1
|
|
1979
|
+
}, n = {}, i = $(r.defaultValues) || $(r.values) ? W(r.defaultValues || r.values) || {} : {}, s = r.shouldUnregister ? {} : W(i), o = {
|
|
1980
|
+
action: !1,
|
|
1981
|
+
mount: !1,
|
|
1982
|
+
watch: !1,
|
|
1983
|
+
keepIsValid: !1
|
|
1984
|
+
}, c = {
|
|
1985
|
+
mount: /* @__PURE__ */ new Set(),
|
|
1986
|
+
disabled: /* @__PURE__ */ new Set(),
|
|
1987
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
1988
|
+
array: /* @__PURE__ */ new Set(),
|
|
1989
|
+
watch: /* @__PURE__ */ new Set()
|
|
1990
|
+
}, h, p = 0;
|
|
1991
|
+
const g = {
|
|
1992
|
+
isDirty: !1,
|
|
1993
|
+
dirtyFields: !1,
|
|
1994
|
+
validatingFields: !1,
|
|
1995
|
+
touchedFields: !1,
|
|
1996
|
+
isValidating: !1,
|
|
1997
|
+
isValid: !1,
|
|
1998
|
+
errors: !1
|
|
1999
|
+
}, m = {
|
|
2000
|
+
...g
|
|
2001
|
+
};
|
|
2002
|
+
let v = {
|
|
2003
|
+
...m
|
|
2004
|
+
};
|
|
2005
|
+
const f = {
|
|
2006
|
+
array: Zt(),
|
|
2007
|
+
state: Zt()
|
|
2008
|
+
}, b = r.criteriaMode === le.all, F = (l) => (u) => {
|
|
2009
|
+
clearTimeout(p), p = setTimeout(l, u);
|
|
2010
|
+
}, k = async (l) => {
|
|
2011
|
+
if (!o.keepIsValid && !r.disabled && (m.isValid || v.isValid || l)) {
|
|
2012
|
+
let u;
|
|
2013
|
+
r.resolver ? (u = Q((await S()).errors), A()) : u = await R(n, !0), u !== t.isValid && f.state.next({
|
|
2014
|
+
isValid: u
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
}, A = (l, u) => {
|
|
2018
|
+
!r.disabled && (m.isValidating || m.validatingFields || v.isValidating || v.validatingFields) && ((l || Array.from(c.mount)).forEach((d) => {
|
|
2019
|
+
d && (u ? B(t.validatingFields, d, u) : q(t.validatingFields, d));
|
|
2020
|
+
}), f.state.next({
|
|
2021
|
+
validatingFields: t.validatingFields,
|
|
2022
|
+
isValidating: !Q(t.validatingFields)
|
|
2023
|
+
}));
|
|
2024
|
+
}, _ = (l, u = [], d, w, x = !0, y = !0) => {
|
|
2025
|
+
if (w && d && !r.disabled) {
|
|
2026
|
+
if (o.action = !0, y && Array.isArray(C(n, l))) {
|
|
2027
|
+
const E = d(C(n, l), w.argA, w.argB);
|
|
2028
|
+
x && B(n, l, E);
|
|
2029
|
+
}
|
|
2030
|
+
if (y && Array.isArray(C(t.errors, l))) {
|
|
2031
|
+
const E = d(C(t.errors, l), w.argA, w.argB);
|
|
2032
|
+
x && B(t.errors, l, E), Is(t.errors, l);
|
|
2033
|
+
}
|
|
2034
|
+
if ((m.touchedFields || v.touchedFields) && y && Array.isArray(C(t.touchedFields, l))) {
|
|
2035
|
+
const E = d(C(t.touchedFields, l), w.argA, w.argB);
|
|
2036
|
+
x && B(t.touchedFields, l, E);
|
|
2037
|
+
}
|
|
2038
|
+
(m.dirtyFields || v.dirtyFields) && (t.dirtyFields = Ee(i, s)), f.state.next({
|
|
2039
|
+
name: l,
|
|
2040
|
+
isDirty: V(l, u),
|
|
2041
|
+
dirtyFields: t.dirtyFields,
|
|
2042
|
+
errors: t.errors,
|
|
2043
|
+
isValid: t.isValid
|
|
2044
|
+
});
|
|
2045
|
+
} else
|
|
2046
|
+
B(s, l, u);
|
|
2047
|
+
}, L = (l, u) => {
|
|
2048
|
+
B(t.errors, l, u), f.state.next({
|
|
2049
|
+
errors: t.errors
|
|
2050
|
+
});
|
|
2051
|
+
}, N = (l) => {
|
|
2052
|
+
t.errors = l, f.state.next({
|
|
2053
|
+
errors: t.errors,
|
|
2054
|
+
isValid: !1
|
|
2055
|
+
});
|
|
2056
|
+
}, D = (l, u, d, w) => {
|
|
2057
|
+
const x = C(n, l);
|
|
2058
|
+
if (x) {
|
|
2059
|
+
const y = C(s, l, U(d) ? C(i, l) : d);
|
|
2060
|
+
U(y) || w && w.defaultChecked || u ? B(s, l, u ? y : er(x._f)) : H(l, y), o.mount && !o.action && k();
|
|
2061
|
+
}
|
|
2062
|
+
}, G = (l, u, d, w, x) => {
|
|
2063
|
+
let y = !1, E = !1;
|
|
2064
|
+
const O = {
|
|
2065
|
+
name: l
|
|
2066
|
+
};
|
|
2067
|
+
if (!r.disabled) {
|
|
2068
|
+
if (!d || w) {
|
|
2069
|
+
(m.isDirty || v.isDirty) && (E = t.isDirty, t.isDirty = O.isDirty = V(), y = E !== O.isDirty);
|
|
2070
|
+
const P = xe(C(i, l), u);
|
|
2071
|
+
E = !!C(t.dirtyFields, l), P ? q(t.dirtyFields, l) : B(t.dirtyFields, l, !0), O.dirtyFields = t.dirtyFields, y = y || (m.dirtyFields || v.dirtyFields) && E !== !P;
|
|
2072
|
+
}
|
|
2073
|
+
if (d) {
|
|
2074
|
+
const P = C(t.touchedFields, l);
|
|
2075
|
+
P || (B(t.touchedFields, l, d), O.touchedFields = t.touchedFields, y = y || (m.touchedFields || v.touchedFields) && P !== d);
|
|
2076
|
+
}
|
|
2077
|
+
y && x && f.state.next(O);
|
|
2078
|
+
}
|
|
2079
|
+
return y ? O : {};
|
|
2080
|
+
}, K = (l, u, d, w) => {
|
|
2081
|
+
const x = C(t.errors, l), y = (m.isValid || v.isValid) && ue(u) && t.isValid !== u;
|
|
2082
|
+
if (r.delayError && d ? (h = F(() => L(l, d)), h(r.delayError)) : (clearTimeout(p), h = null, d ? B(t.errors, l, d) : q(t.errors, l)), (d ? !xe(x, d) : x) || !Q(w) || y) {
|
|
2083
|
+
const E = {
|
|
2084
|
+
...w,
|
|
2085
|
+
...y && ue(u) ? { isValid: u } : {},
|
|
2086
|
+
errors: t.errors,
|
|
2087
|
+
name: l
|
|
2088
|
+
};
|
|
2089
|
+
t = {
|
|
2090
|
+
...t,
|
|
2091
|
+
...E
|
|
2092
|
+
}, f.state.next(E);
|
|
2093
|
+
}
|
|
2094
|
+
}, S = async (l) => (A(l, !0), await r.resolver(s, r.context, Cs(l || c.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), I = async (l) => {
|
|
2095
|
+
const { errors: u } = await S(l);
|
|
2096
|
+
if (A(l), l)
|
|
2097
|
+
for (const d of l) {
|
|
2098
|
+
const w = C(u, d);
|
|
2099
|
+
w ? B(t.errors, d, w) : q(t.errors, d);
|
|
2100
|
+
}
|
|
2101
|
+
else
|
|
2102
|
+
t.errors = u;
|
|
2103
|
+
return u;
|
|
2104
|
+
}, R = async (l, u, d = {
|
|
2105
|
+
valid: !0
|
|
2106
|
+
}) => {
|
|
2107
|
+
for (const w in l) {
|
|
2108
|
+
const x = l[w];
|
|
2109
|
+
if (x) {
|
|
2110
|
+
const { _f: y, ...E } = x;
|
|
2111
|
+
if (y) {
|
|
2112
|
+
const O = c.array.has(y.name), P = x._f && Ss(x._f);
|
|
2113
|
+
P && m.validatingFields && A([y.name], !0);
|
|
2114
|
+
const X = await ar(x, c.disabled, s, b, r.shouldUseNativeValidation && !u, O);
|
|
2115
|
+
if (P && m.validatingFields && A([y.name]), X[y.name] && (d.valid = !1, u || e.shouldUseNativeValidation))
|
|
2116
|
+
break;
|
|
2117
|
+
!u && (C(X, y.name) ? O ? Ds(t.errors, X, y.name) : B(t.errors, y.name, X[y.name]) : q(t.errors, y.name));
|
|
2118
|
+
}
|
|
2119
|
+
!Q(E) && await R(E, u, d);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
return d.valid;
|
|
2123
|
+
}, j = () => {
|
|
2124
|
+
for (const l of c.unMount) {
|
|
2125
|
+
const u = C(n, l);
|
|
2126
|
+
u && (u._f.refs ? u._f.refs.every((d) => !ht(d)) : !ht(u._f.ref)) && nt(l);
|
|
2127
|
+
}
|
|
2128
|
+
c.unMount = /* @__PURE__ */ new Set();
|
|
2129
|
+
}, V = (l, u) => !r.disabled && (l && u && B(s, l, u), !xe(Ft(), i)), T = (l, u, d) => vs(l, c, {
|
|
2130
|
+
...o.mount ? s : U(u) ? i : se(l) ? { [l]: u } : u
|
|
2131
|
+
}, d, u), z = (l) => Ct(C(o.mount ? s : i, l, r.shouldUnregister ? C(i, l, []) : [])), H = (l, u, d = {}) => {
|
|
2132
|
+
const w = C(n, l);
|
|
2133
|
+
let x = u;
|
|
2134
|
+
if (w) {
|
|
2135
|
+
const y = w._f;
|
|
2136
|
+
y && (!y.disabled && B(s, l, Hr(u, y)), x = Je(y.ref) && ee(u) ? "" : u, $r(y.ref) ? [...y.ref.options].forEach((E) => E.selected = x.includes(E.value)) : y.refs ? Ke(y.ref) ? y.refs.forEach((E) => {
|
|
2137
|
+
(!E.defaultChecked || !E.disabled) && (Array.isArray(x) ? E.checked = !!x.find((O) => O === E.value) : E.checked = x === E.value || !!x);
|
|
2138
|
+
}) : y.refs.forEach((E) => E.checked = E.value === x) : At(y.ref) ? y.ref.value = "" : (y.ref.value = x, y.ref.type || f.state.next({
|
|
2139
|
+
name: l,
|
|
2140
|
+
values: W(s)
|
|
2141
|
+
})));
|
|
2142
|
+
}
|
|
2143
|
+
(d.shouldDirty || d.shouldTouch) && G(l, x, d.shouldTouch, d.shouldDirty, !0), d.shouldValidate && Oe(l);
|
|
2144
|
+
}, ae = (l, u, d) => {
|
|
2145
|
+
for (const w in u) {
|
|
2146
|
+
if (!u.hasOwnProperty(w))
|
|
2147
|
+
return;
|
|
2148
|
+
const x = u[w], y = l + "." + w, E = C(n, y);
|
|
2149
|
+
(c.array.has(l) || $(x) || E && !E._f) && !ke(x) ? ae(y, x, d) : H(y, x, d);
|
|
2150
|
+
}
|
|
2151
|
+
}, re = (l, u, d = {}) => {
|
|
2152
|
+
const w = C(n, l), x = c.array.has(l), y = W(u);
|
|
2153
|
+
B(s, l, y), x ? (f.array.next({
|
|
2154
|
+
name: l,
|
|
2155
|
+
values: W(s)
|
|
2156
|
+
}), (m.isDirty || m.dirtyFields || v.isDirty || v.dirtyFields) && d.shouldDirty && f.state.next({
|
|
2157
|
+
name: l,
|
|
2158
|
+
dirtyFields: Ee(i, s),
|
|
2159
|
+
isDirty: V(l, y)
|
|
2160
|
+
})) : w && !w._f && !ee(y) ? ae(l, y, d) : H(l, y, d), nr(l, c) ? f.state.next({
|
|
2161
|
+
...t,
|
|
2162
|
+
name: l,
|
|
2163
|
+
values: W(s)
|
|
2164
|
+
}) : f.state.next({
|
|
2165
|
+
name: o.mount ? l : void 0,
|
|
2166
|
+
values: W(s)
|
|
2167
|
+
});
|
|
2168
|
+
}, Me = async (l) => {
|
|
2169
|
+
o.mount = !0;
|
|
2170
|
+
const u = l.target;
|
|
2171
|
+
let d = u.name, w = !0;
|
|
2172
|
+
const x = C(n, d), y = (P) => {
|
|
2173
|
+
w = Number.isNaN(P) || ke(P) && isNaN(P.getTime()) || xe(P, C(s, d, P));
|
|
2174
|
+
}, E = tr(r.mode), O = tr(r.reValidateMode);
|
|
2175
|
+
if (x) {
|
|
2176
|
+
let P, X;
|
|
2177
|
+
const _e = u.type ? er(x._f) : ds(l), be = l.type === Jt.BLUR || l.type === Jt.FOCUS_OUT, nn = !As(x._f) && !r.resolver && !C(t.errors, d) && !x._f.deps || Vs(be, C(t.touchedFields, d), t.isSubmitted, O, E), at = nr(d, c, be);
|
|
2178
|
+
B(s, d, _e), be ? (!u || !u.readOnly) && (x._f.onBlur && x._f.onBlur(l), h && h(0)) : x._f.onChange && x._f.onChange(l);
|
|
2179
|
+
const ot = G(d, _e, be), sn = !Q(ot) || at;
|
|
2180
|
+
if (!be && f.state.next({
|
|
2181
|
+
name: d,
|
|
2182
|
+
type: l.type,
|
|
2183
|
+
values: W(s)
|
|
2184
|
+
}), nn)
|
|
2185
|
+
return (m.isValid || v.isValid) && (r.mode === "onBlur" ? be && k() : be || k()), sn && f.state.next({ name: d, ...at ? {} : ot });
|
|
2186
|
+
if (!be && at && f.state.next({ ...t }), r.resolver) {
|
|
2187
|
+
const { errors: Ot } = await S([d]);
|
|
2188
|
+
if (A([d]), y(_e), w) {
|
|
2189
|
+
const an = sr(t.errors, n, d), Pt = sr(Ot, n, an.name || d);
|
|
2190
|
+
P = Pt.error, d = Pt.name, X = Q(Ot);
|
|
2191
|
+
}
|
|
2192
|
+
} else
|
|
2193
|
+
A([d], !0), P = (await ar(x, c.disabled, s, b, r.shouldUseNativeValidation))[d], A([d]), y(_e), w && (P ? X = !1 : (m.isValid || v.isValid) && (X = await R(n, !0)));
|
|
2194
|
+
w && (x._f.deps && (!Array.isArray(x._f.deps) || x._f.deps.length > 0) && Oe(x._f.deps), K(d, X, P, ot));
|
|
2195
|
+
}
|
|
2196
|
+
}, Ne = (l, u) => {
|
|
2197
|
+
if (C(t.errors, u) && l.focus)
|
|
2198
|
+
return l.focus(), 1;
|
|
2199
|
+
}, Oe = async (l, u = {}) => {
|
|
2200
|
+
let d, w;
|
|
2201
|
+
const x = qe(l);
|
|
2202
|
+
if (r.resolver) {
|
|
2203
|
+
const y = await I(U(l) ? l : x);
|
|
2204
|
+
d = Q(y), w = l ? !x.some((E) => C(y, E)) : d;
|
|
2205
|
+
} else l ? (w = (await Promise.all(x.map(async (y) => {
|
|
2206
|
+
const E = C(n, y);
|
|
2207
|
+
return await R(E && E._f ? { [y]: E } : E);
|
|
2208
|
+
}))).every(Boolean), !(!w && !t.isValid) && k()) : w = d = await R(n);
|
|
2209
|
+
return f.state.next({
|
|
2210
|
+
...!se(l) || (m.isValid || v.isValid) && d !== t.isValid ? {} : { name: l },
|
|
2211
|
+
...r.resolver || !l ? { isValid: d } : {},
|
|
2212
|
+
errors: t.errors
|
|
2213
|
+
}), u.shouldFocus && !w && $e(n, Ne, l ? x : c.mount), w;
|
|
2214
|
+
}, Ft = (l, u) => {
|
|
2215
|
+
let d = {
|
|
2216
|
+
...o.mount ? s : i
|
|
2217
|
+
};
|
|
2218
|
+
return u && (d = qr(u.dirtyFields ? t.dirtyFields : t.touchedFields, d)), U(l) ? d : se(l) ? C(d, l) : l.map((w) => C(d, w));
|
|
2219
|
+
}, Vt = (l, u) => ({
|
|
2220
|
+
invalid: !!C((u || t).errors, l),
|
|
2221
|
+
isDirty: !!C((u || t).dirtyFields, l),
|
|
2222
|
+
error: C((u || t).errors, l),
|
|
2223
|
+
isValidating: !!C(t.validatingFields, l),
|
|
2224
|
+
isTouched: !!C((u || t).touchedFields, l)
|
|
2225
|
+
}), Zr = (l) => {
|
|
2226
|
+
const u = l ? qe(l) : void 0;
|
|
2227
|
+
u == null || u.forEach((d) => q(t.errors, d)), u ? u.forEach((d) => {
|
|
2228
|
+
f.state.next({
|
|
2229
|
+
name: d,
|
|
2230
|
+
errors: t.errors
|
|
2231
|
+
});
|
|
2232
|
+
}) : f.state.next({
|
|
2233
|
+
errors: {}
|
|
2234
|
+
});
|
|
2235
|
+
}, It = (l, u, d) => {
|
|
2236
|
+
const w = (C(n, l, { _f: {} })._f || {}).ref, x = C(t.errors, l) || {}, { ref: y, message: E, type: O, ...P } = x;
|
|
2237
|
+
B(t.errors, l, {
|
|
2238
|
+
...P,
|
|
2239
|
+
...u,
|
|
2240
|
+
ref: w
|
|
2241
|
+
}), f.state.next({
|
|
2242
|
+
name: l,
|
|
2243
|
+
errors: t.errors,
|
|
2244
|
+
isValid: !1
|
|
2245
|
+
}), d && d.shouldFocus && w && w.focus && w.focus();
|
|
2246
|
+
}, Xr = (l, u) => oe(l) ? f.state.subscribe({
|
|
2247
|
+
next: (d) => "values" in d && l(T(void 0, u), d)
|
|
2248
|
+
}) : T(l, u, !0), Dt = (l) => f.state.subscribe({
|
|
2249
|
+
next: (u) => {
|
|
2250
|
+
Fs(l.name, u.name, l.exact) && Es(u, l.formState || m, rn, l.reRenderRoot) && l.callback({
|
|
2251
|
+
values: { ...s },
|
|
2252
|
+
...t,
|
|
2253
|
+
...u,
|
|
2254
|
+
defaultValues: i
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
}).unsubscribe, Yr = (l) => (o.mount = !0, v = {
|
|
2258
|
+
...v,
|
|
2259
|
+
...l.formState
|
|
2260
|
+
}, Dt({
|
|
2261
|
+
...l,
|
|
2262
|
+
formState: {
|
|
2263
|
+
...g,
|
|
2264
|
+
...l.formState
|
|
2265
|
+
}
|
|
2266
|
+
})), nt = (l, u = {}) => {
|
|
2267
|
+
for (const d of l ? qe(l) : c.mount)
|
|
2268
|
+
c.mount.delete(d), c.array.delete(d), u.keepValue || (q(n, d), q(s, d)), !u.keepError && q(t.errors, d), !u.keepDirty && q(t.dirtyFields, d), !u.keepTouched && q(t.touchedFields, d), !u.keepIsValidating && q(t.validatingFields, d), !r.shouldUnregister && !u.keepDefaultValue && q(i, d);
|
|
2269
|
+
f.state.next({
|
|
2270
|
+
values: W(s)
|
|
2271
|
+
}), f.state.next({
|
|
2272
|
+
...t,
|
|
2273
|
+
...u.keepDirty ? { isDirty: V() } : {}
|
|
2274
|
+
}), !u.keepIsValid && k();
|
|
2275
|
+
}, Lt = ({ disabled: l, name: u }) => {
|
|
2276
|
+
if (ue(l) && o.mount || l || c.disabled.has(u)) {
|
|
2277
|
+
const x = c.disabled.has(u) !== !!l;
|
|
2278
|
+
l ? c.disabled.add(u) : c.disabled.delete(u), x && o.mount && !o.action && k();
|
|
2279
|
+
}
|
|
2280
|
+
}, st = (l, u = {}) => {
|
|
2281
|
+
let d = C(n, l);
|
|
2282
|
+
const w = ue(u.disabled) || ue(r.disabled);
|
|
2283
|
+
return B(n, l, {
|
|
2284
|
+
...d || {},
|
|
2285
|
+
_f: {
|
|
2286
|
+
...d && d._f ? d._f : { ref: { name: l } },
|
|
2287
|
+
name: l,
|
|
2288
|
+
mount: !0,
|
|
2289
|
+
...u
|
|
2290
|
+
}
|
|
2291
|
+
}), c.mount.add(l), d ? Lt({
|
|
2292
|
+
disabled: ue(u.disabled) ? u.disabled : r.disabled,
|
|
2293
|
+
name: l
|
|
2294
|
+
}) : D(l, !0, u.value), {
|
|
2295
|
+
...w ? { disabled: u.disabled || r.disabled } : {},
|
|
2296
|
+
...r.progressive ? {
|
|
2297
|
+
required: !!u.required,
|
|
2298
|
+
min: Pe(u.min),
|
|
2299
|
+
max: Pe(u.max),
|
|
2300
|
+
minLength: Pe(u.minLength),
|
|
2301
|
+
maxLength: Pe(u.maxLength),
|
|
2302
|
+
pattern: Pe(u.pattern)
|
|
2303
|
+
} : {},
|
|
2304
|
+
name: l,
|
|
2305
|
+
onChange: Me,
|
|
2306
|
+
onBlur: Me,
|
|
2307
|
+
ref: (x) => {
|
|
2308
|
+
if (x) {
|
|
2309
|
+
st(l, u), d = C(n, l);
|
|
2310
|
+
const y = U(x.value) && x.querySelectorAll && x.querySelectorAll("input,select,textarea")[0] || x, E = xs(y), O = d._f.refs || [];
|
|
2311
|
+
if (E ? O.find((P) => P === y) : y === d._f.ref)
|
|
2312
|
+
return;
|
|
2313
|
+
B(n, l, {
|
|
2314
|
+
_f: {
|
|
2315
|
+
...d._f,
|
|
2316
|
+
...E ? {
|
|
2317
|
+
refs: [
|
|
2318
|
+
...O.filter(ht),
|
|
2319
|
+
y,
|
|
2320
|
+
...Array.isArray(C(i, l)) ? [{}] : []
|
|
2321
|
+
],
|
|
2322
|
+
ref: { type: y.type, name: l }
|
|
2323
|
+
} : { ref: y }
|
|
2324
|
+
}
|
|
2325
|
+
}), D(l, !1, void 0, y);
|
|
2326
|
+
} else
|
|
2327
|
+
d = C(n, l, {}), d._f && (d._f.mount = !1), (r.shouldUnregister || u.shouldUnregister) && !(hs(c.array, l) && o.action) && c.unMount.add(l);
|
|
2328
|
+
}
|
|
2329
|
+
};
|
|
2330
|
+
}, it = () => r.shouldFocusError && $e(n, Ne, c.mount), Qr = (l) => {
|
|
2331
|
+
ue(l) && (f.state.next({ disabled: l }), $e(n, (u, d) => {
|
|
2332
|
+
const w = C(n, d);
|
|
2333
|
+
w && (u.disabled = w._f.disabled || l, Array.isArray(w._f.refs) && w._f.refs.forEach((x) => {
|
|
2334
|
+
x.disabled = w._f.disabled || l;
|
|
2335
|
+
}));
|
|
2336
|
+
}, 0, !1));
|
|
2337
|
+
}, Rt = (l, u) => async (d) => {
|
|
2338
|
+
let w;
|
|
2339
|
+
d && (d.preventDefault && d.preventDefault(), d.persist && d.persist());
|
|
2340
|
+
let x = W(s);
|
|
2341
|
+
if (f.state.next({
|
|
2342
|
+
isSubmitting: !0
|
|
2343
|
+
}), r.resolver) {
|
|
2344
|
+
const { errors: y, values: E } = await S();
|
|
2345
|
+
A(), t.errors = y, x = W(E);
|
|
2346
|
+
} else
|
|
2347
|
+
await R(n);
|
|
2348
|
+
if (c.disabled.size)
|
|
2349
|
+
for (const y of c.disabled)
|
|
2350
|
+
q(x, y);
|
|
2351
|
+
if (q(t.errors, "root"), Q(t.errors)) {
|
|
2352
|
+
f.state.next({
|
|
2353
|
+
errors: {}
|
|
2354
|
+
});
|
|
2355
|
+
try {
|
|
2356
|
+
await l(x, d);
|
|
2357
|
+
} catch (y) {
|
|
2358
|
+
w = y;
|
|
2359
|
+
}
|
|
2360
|
+
} else
|
|
2361
|
+
u && await u({ ...t.errors }, d), it(), setTimeout(it);
|
|
2362
|
+
if (f.state.next({
|
|
2363
|
+
isSubmitted: !0,
|
|
2364
|
+
isSubmitting: !1,
|
|
2365
|
+
isSubmitSuccessful: Q(t.errors) && !w,
|
|
2366
|
+
submitCount: t.submitCount + 1,
|
|
2367
|
+
errors: t.errors
|
|
2368
|
+
}), w)
|
|
2369
|
+
throw w;
|
|
2370
|
+
}, en = (l, u = {}) => {
|
|
2371
|
+
C(n, l) && (U(u.defaultValue) ? re(l, W(C(i, l))) : (re(l, u.defaultValue), B(i, l, W(u.defaultValue))), u.keepTouched || q(t.touchedFields, l), u.keepDirty || (q(t.dirtyFields, l), t.isDirty = u.defaultValue ? V(l, W(C(i, l))) : V()), u.keepError || (q(t.errors, l), m.isValid && k()), f.state.next({ ...t }));
|
|
2372
|
+
}, Tt = (l, u = {}) => {
|
|
2373
|
+
const d = l ? W(l) : i, w = W(d), x = Q(l), y = x ? i : w;
|
|
2374
|
+
if (u.keepDefaultValues || (i = d), !u.keepValues) {
|
|
2375
|
+
if (u.keepDirtyValues) {
|
|
2376
|
+
const E = /* @__PURE__ */ new Set([
|
|
2377
|
+
...c.mount,
|
|
2378
|
+
...Object.keys(Ee(i, s))
|
|
2379
|
+
]);
|
|
2380
|
+
for (const O of Array.from(E)) {
|
|
2381
|
+
const P = C(t.dirtyFields, O), X = C(s, O), _e = C(y, O);
|
|
2382
|
+
P && !U(X) ? B(y, O, X) : !P && !U(_e) && re(O, _e);
|
|
2383
|
+
}
|
|
2384
|
+
} else {
|
|
2385
|
+
if (kt && U(l))
|
|
2386
|
+
for (const E of c.mount) {
|
|
2387
|
+
const O = C(n, E);
|
|
2388
|
+
if (O && O._f) {
|
|
2389
|
+
const P = Array.isArray(O._f.refs) ? O._f.refs[0] : O._f.ref;
|
|
2390
|
+
if (Je(P)) {
|
|
2391
|
+
const X = P.closest("form");
|
|
2392
|
+
if (X) {
|
|
2393
|
+
X.reset();
|
|
2394
|
+
break;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
if (u.keepFieldsRef)
|
|
2400
|
+
for (const E of c.mount)
|
|
2401
|
+
re(E, C(y, E));
|
|
2402
|
+
else
|
|
2403
|
+
n = {};
|
|
2404
|
+
}
|
|
2405
|
+
s = r.shouldUnregister ? u.keepDefaultValues ? W(i) : {} : W(y), f.array.next({
|
|
2406
|
+
values: { ...y }
|
|
2407
|
+
}), f.state.next({
|
|
2408
|
+
values: { ...y }
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
c = {
|
|
2412
|
+
mount: u.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
|
|
2413
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
2414
|
+
array: /* @__PURE__ */ new Set(),
|
|
2415
|
+
disabled: /* @__PURE__ */ new Set(),
|
|
2416
|
+
watch: /* @__PURE__ */ new Set(),
|
|
2417
|
+
watchAll: !1,
|
|
2418
|
+
focus: ""
|
|
2419
|
+
}, o.mount = !m.isValid || !!u.keepIsValid || !!u.keepDirtyValues || !r.shouldUnregister && !Q(y), o.watch = !!r.shouldUnregister, o.keepIsValid = !!u.keepIsValid, o.action = !1, u.keepErrors || (t.errors = {}), f.state.next({
|
|
2420
|
+
submitCount: u.keepSubmitCount ? t.submitCount : 0,
|
|
2421
|
+
isDirty: x ? !1 : u.keepDirty ? t.isDirty : !!(u.keepDefaultValues && !xe(l, i)),
|
|
2422
|
+
isSubmitted: u.keepIsSubmitted ? t.isSubmitted : !1,
|
|
2423
|
+
dirtyFields: x ? {} : u.keepDirtyValues ? u.keepDefaultValues && s ? Ee(i, s) : t.dirtyFields : u.keepDefaultValues && l ? Ee(i, l) : u.keepDirty ? t.dirtyFields : {},
|
|
2424
|
+
touchedFields: u.keepTouched ? t.touchedFields : {},
|
|
2425
|
+
errors: u.keepErrors ? t.errors : {},
|
|
2426
|
+
isSubmitSuccessful: u.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
2427
|
+
isSubmitting: !1,
|
|
2428
|
+
defaultValues: i
|
|
2429
|
+
});
|
|
2430
|
+
}, Mt = (l, u) => Tt(oe(l) ? l(s) : l, { ...r.resetOptions, ...u }), tn = (l, u = {}) => {
|
|
2431
|
+
const d = C(n, l), w = d && d._f;
|
|
2432
|
+
if (w) {
|
|
2433
|
+
const x = w.refs ? w.refs[0] : w.ref;
|
|
2434
|
+
x.focus && setTimeout(() => {
|
|
2435
|
+
x.focus(), u.shouldSelect && oe(x.select) && x.select();
|
|
2436
|
+
});
|
|
2437
|
+
}
|
|
2438
|
+
}, rn = (l) => {
|
|
2439
|
+
t = {
|
|
2440
|
+
...t,
|
|
2441
|
+
...l
|
|
2442
|
+
};
|
|
2443
|
+
}, Nt = {
|
|
2444
|
+
control: {
|
|
2445
|
+
register: st,
|
|
2446
|
+
unregister: nt,
|
|
2447
|
+
getFieldState: Vt,
|
|
2448
|
+
handleSubmit: Rt,
|
|
2449
|
+
setError: It,
|
|
2450
|
+
_subscribe: Dt,
|
|
2451
|
+
_runSchema: S,
|
|
2452
|
+
_updateIsValidating: A,
|
|
2453
|
+
_focusError: it,
|
|
2454
|
+
_getWatch: T,
|
|
2455
|
+
_getDirty: V,
|
|
2456
|
+
_setValid: k,
|
|
2457
|
+
_setFieldArray: _,
|
|
2458
|
+
_setDisabledField: Lt,
|
|
2459
|
+
_setErrors: N,
|
|
2460
|
+
_getFieldArray: z,
|
|
2461
|
+
_reset: Tt,
|
|
2462
|
+
_resetDefaultValues: () => oe(r.defaultValues) && r.defaultValues().then((l) => {
|
|
2463
|
+
Mt(l, r.resetOptions), f.state.next({
|
|
2464
|
+
isLoading: !1
|
|
2465
|
+
});
|
|
2466
|
+
}),
|
|
2467
|
+
_removeUnmounted: j,
|
|
2468
|
+
_disableForm: Qr,
|
|
2469
|
+
_subjects: f,
|
|
2470
|
+
_proxyFormState: m,
|
|
2471
|
+
get _fields() {
|
|
2472
|
+
return n;
|
|
2473
|
+
},
|
|
2474
|
+
get _formValues() {
|
|
2475
|
+
return s;
|
|
2476
|
+
},
|
|
2477
|
+
get _state() {
|
|
2478
|
+
return o;
|
|
2479
|
+
},
|
|
2480
|
+
set _state(l) {
|
|
2481
|
+
o = l;
|
|
2482
|
+
},
|
|
2483
|
+
get _defaultValues() {
|
|
2484
|
+
return i;
|
|
2485
|
+
},
|
|
2486
|
+
get _names() {
|
|
2487
|
+
return c;
|
|
2488
|
+
},
|
|
2489
|
+
set _names(l) {
|
|
2490
|
+
c = l;
|
|
2491
|
+
},
|
|
2492
|
+
get _formState() {
|
|
2493
|
+
return t;
|
|
2494
|
+
},
|
|
2495
|
+
get _options() {
|
|
2496
|
+
return r;
|
|
2497
|
+
},
|
|
2498
|
+
set _options(l) {
|
|
2499
|
+
r = {
|
|
2500
|
+
...r,
|
|
2501
|
+
...l
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2504
|
+
},
|
|
2505
|
+
subscribe: Yr,
|
|
2506
|
+
trigger: Oe,
|
|
2507
|
+
register: st,
|
|
2508
|
+
handleSubmit: Rt,
|
|
2509
|
+
watch: Xr,
|
|
2510
|
+
setValue: re,
|
|
2511
|
+
getValues: Ft,
|
|
2512
|
+
reset: Mt,
|
|
2513
|
+
resetField: en,
|
|
2514
|
+
clearErrors: Zr,
|
|
2515
|
+
unregister: nt,
|
|
2516
|
+
setError: It,
|
|
2517
|
+
setFocus: tn,
|
|
2518
|
+
getFieldState: Vt
|
|
2519
|
+
};
|
|
2520
|
+
return {
|
|
2521
|
+
...Nt,
|
|
2522
|
+
formControl: Nt
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
function tt(e = {}) {
|
|
2526
|
+
const r = Y.useRef(void 0), t = Y.useRef(void 0), [n, i] = Y.useState({
|
|
2527
|
+
isDirty: !1,
|
|
2528
|
+
isValidating: !1,
|
|
2529
|
+
isLoading: oe(e.defaultValues),
|
|
2530
|
+
isSubmitted: !1,
|
|
2531
|
+
isSubmitting: !1,
|
|
2532
|
+
isSubmitSuccessful: !1,
|
|
2533
|
+
isValid: !1,
|
|
2534
|
+
submitCount: 0,
|
|
2535
|
+
dirtyFields: {},
|
|
2536
|
+
touchedFields: {},
|
|
2537
|
+
validatingFields: {},
|
|
2538
|
+
errors: e.errors || {},
|
|
2539
|
+
disabled: e.disabled || !1,
|
|
2540
|
+
isReady: !1,
|
|
2541
|
+
defaultValues: oe(e.defaultValues) ? void 0 : e.defaultValues
|
|
2542
|
+
});
|
|
2543
|
+
if (!r.current)
|
|
2544
|
+
if (e.formControl)
|
|
2545
|
+
r.current = {
|
|
2546
|
+
...e.formControl,
|
|
2547
|
+
formState: n
|
|
2548
|
+
}, e.defaultValues && !oe(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
2549
|
+
else {
|
|
2550
|
+
const { formControl: o, ...c } = Rs(e);
|
|
2551
|
+
r.current = {
|
|
2552
|
+
...c,
|
|
2553
|
+
formState: n
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
const s = r.current.control;
|
|
2557
|
+
return s._options = e, ys(() => {
|
|
2558
|
+
const o = s._subscribe({
|
|
2559
|
+
formState: s._proxyFormState,
|
|
2560
|
+
callback: () => i({ ...s._formState }),
|
|
2561
|
+
reRenderRoot: !0
|
|
2562
|
+
});
|
|
2563
|
+
return i((c) => ({
|
|
2564
|
+
...c,
|
|
2565
|
+
isReady: !0
|
|
2566
|
+
})), s._formState.isReady = !0, o;
|
|
2567
|
+
}, [s]), Y.useEffect(() => s._disableForm(e.disabled), [s, e.disabled]), Y.useEffect(() => {
|
|
2568
|
+
e.mode && (s._options.mode = e.mode), e.reValidateMode && (s._options.reValidateMode = e.reValidateMode);
|
|
2569
|
+
}, [s, e.mode, e.reValidateMode]), Y.useEffect(() => {
|
|
2570
|
+
e.errors && (s._setErrors(e.errors), s._focusError());
|
|
2571
|
+
}, [s, e.errors]), Y.useEffect(() => {
|
|
2572
|
+
e.shouldUnregister && s._subjects.state.next({
|
|
2573
|
+
values: s._getWatch()
|
|
2574
|
+
});
|
|
2575
|
+
}, [s, e.shouldUnregister]), Y.useEffect(() => {
|
|
2576
|
+
if (s._proxyFormState.isDirty) {
|
|
2577
|
+
const o = s._getDirty();
|
|
2578
|
+
o !== n.isDirty && s._subjects.state.next({
|
|
2579
|
+
isDirty: o
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2582
|
+
}, [s, n.isDirty]), Y.useEffect(() => {
|
|
2583
|
+
var o;
|
|
2584
|
+
e.values && !xe(e.values, t.current) ? (s._reset(e.values, {
|
|
2585
|
+
keepFieldsRef: !0,
|
|
2586
|
+
...s._options.resetOptions
|
|
2587
|
+
}), !((o = s._options.resetOptions) === null || o === void 0) && o.keepIsValid || s._setValid(), t.current = e.values, i((c) => ({ ...c }))) : s._resetDefaultValues();
|
|
2588
|
+
}, [s, e.values]), Y.useEffect(() => {
|
|
2589
|
+
s._state.mount || (s._setValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
|
|
2590
|
+
}), r.current.formState = Y.useMemo(() => gs(n, s), [s, n]), r.current;
|
|
2591
|
+
}
|
|
2592
|
+
const or = (e, r, t) => {
|
|
2593
|
+
if (e && "reportValidity" in e) {
|
|
2594
|
+
const n = C(t, r);
|
|
2595
|
+
e.setCustomValidity(n && n.message || ""), e.reportValidity();
|
|
2596
|
+
}
|
|
2597
|
+
}, Ts = (e, r) => {
|
|
2598
|
+
for (const t in r.fields) {
|
|
2599
|
+
const n = r.fields[t];
|
|
2600
|
+
n && n.ref && "reportValidity" in n.ref ? or(n.ref, t, e) : n.refs && n.refs.forEach((i) => or(i, t, e));
|
|
2601
|
+
}
|
|
2602
|
+
}, Ms = (e, r) => {
|
|
2603
|
+
r.shouldUseNativeValidation && Ts(e, r);
|
|
2604
|
+
const t = {};
|
|
2605
|
+
for (const n in e) {
|
|
2606
|
+
const i = C(r.fields, n), s = Object.assign(e[n] || {}, { ref: i && i.ref });
|
|
2607
|
+
if (Ns(r.names || Object.keys(e), n)) {
|
|
2608
|
+
const o = Object.assign({}, C(t, n));
|
|
2609
|
+
B(o, "root", s), B(t, n, o);
|
|
2610
|
+
} else B(t, n, s);
|
|
2611
|
+
}
|
|
2612
|
+
return t;
|
|
2613
|
+
}, Ns = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
2614
|
+
var rt = function(e, r, t) {
|
|
2615
|
+
return t === void 0 && (t = {}), function(n, i, s) {
|
|
2616
|
+
try {
|
|
2617
|
+
var o = !s.shouldUseNativeValidation && s.criteriaMode === "all";
|
|
2618
|
+
return Promise.resolve(/* @__PURE__ */ Hn(e, n, Object.assign({}, r, { abortPipeEarly: !o }))).then(function(c) {
|
|
2619
|
+
if (c.issues) {
|
|
2620
|
+
for (var h = {}; c.issues.length; ) {
|
|
2621
|
+
var p = c.issues[0], g = /* @__PURE__ */ qn(p);
|
|
2622
|
+
if (g && (h[g] || (h[g] = { message: p.message, type: p.type }), o)) {
|
|
2623
|
+
var m = h[g].types, v = m && m[p.type];
|
|
2624
|
+
h[g] = zr(g, o, h, p.type, v ? [].concat(v, p.message) : p.message);
|
|
2625
|
+
}
|
|
2626
|
+
c.issues.shift();
|
|
2627
|
+
}
|
|
2628
|
+
return { values: {}, errors: Ms(h, s) };
|
|
2629
|
+
}
|
|
2630
|
+
return { values: t.raw ? n : c.output, errors: {} };
|
|
2631
|
+
});
|
|
2632
|
+
} catch (c) {
|
|
2633
|
+
return Promise.reject(c);
|
|
2634
|
+
}
|
|
2635
|
+
};
|
|
2636
|
+
};
|
|
2637
|
+
const lr = 27, cr = 12, ur = 10, Os = Re("enum"), Ps = (e, r) => {
|
|
2638
|
+
const t = {
|
|
2639
|
+
min: e.minSelected ?? 0,
|
|
2640
|
+
max: e.maxSelected ?? e.options.length
|
|
2641
|
+
};
|
|
2642
|
+
return rt(
|
|
2643
|
+
/* @__PURE__ */ ge({
|
|
2644
|
+
checked: /* @__PURE__ */ we(
|
|
2645
|
+
/* @__PURE__ */ Mr(/* @__PURE__ */ te(), /* @__PURE__ */ Lr()),
|
|
2646
|
+
/* @__PURE__ */ xt(
|
|
2647
|
+
(n) => Object.entries(n).filter(([i, s]) => s).map(([i, s]) => i)
|
|
2648
|
+
),
|
|
2649
|
+
/* @__PURE__ */ ze(t.max, r("validation_multiple_choice_max", { count: t.max })),
|
|
2650
|
+
/* @__PURE__ */ Ve(t.min, r("validation_multiple_choice_min", { count: t.min }))
|
|
2651
|
+
)
|
|
2652
|
+
})
|
|
2653
|
+
);
|
|
2654
|
+
}, Bs = yr(({ option: e, ...r }, t) => /* @__PURE__ */ a(de, { children: [
|
|
2655
|
+
/* @__PURE__ */ a("input", { class: "peer sr-only h-full", type: "checkbox", ...r, ref: t }),
|
|
2656
|
+
/* @__PURE__ */ a(
|
|
2657
|
+
"label",
|
|
2658
|
+
{
|
|
2659
|
+
class: "bg-lowest hover:bg-neutral-2 active:outline-neutral-8 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 peer-focus-visible:ring-accent-9 peer-focus-visible:ring-offset-accent-7 block cursor-pointer select-none rounded-2xl px-3 py-1.5 outline outline-1 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4",
|
|
2660
|
+
htmlFor: r.id,
|
|
2661
|
+
children: e.label
|
|
2662
|
+
}
|
|
2663
|
+
)
|
|
2664
|
+
] })), dr = Xe(
|
|
2665
|
+
"gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4",
|
|
2666
|
+
{
|
|
2667
|
+
variants: {
|
|
2668
|
+
variant: {
|
|
2669
|
+
// In cases where there is only one option, we want to center it
|
|
2670
|
+
singleOption: "justify-center",
|
|
2671
|
+
// Two choices, one answer
|
|
2672
|
+
booleanLike: Pr
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
), js = ({ input: e, onSubmitSuccess: r }) => {
|
|
2677
|
+
var g, m;
|
|
2678
|
+
const t = e.key ? (g = M.current$.value.flow) == null ? void 0 : g.data.submissions[e.key] : void 0, n = e.config.maxSelected === 1, i = n && e.config.options.length === 2, { t: s } = J(), {
|
|
2679
|
+
register: o,
|
|
2680
|
+
handleSubmit: c,
|
|
2681
|
+
formState: { errors: h }
|
|
2682
|
+
} = tt({
|
|
2683
|
+
defaultValues: {
|
|
2684
|
+
checked: n ? {} : Os(t) ? Object.fromEntries(t.value.map((v) => [v, !0])) : {}
|
|
2685
|
+
},
|
|
2686
|
+
resolver: Ps(e.config, s)
|
|
2687
|
+
}), p = _t();
|
|
2688
|
+
return i ? /* @__PURE__ */ a(de, { children: [
|
|
2689
|
+
/* @__PURE__ */ a(
|
|
2690
|
+
"ul",
|
|
2691
|
+
{
|
|
2692
|
+
style: { maxHeight: 6.5 * lr + 5 * cr + 2 * ur },
|
|
2693
|
+
class: dr({ variant: "booleanLike" }),
|
|
2694
|
+
children: e.config.options.map((v, f) => /* @__PURE__ */ a("li", { class: Br, children: /* @__PURE__ */ a(
|
|
2695
|
+
jr,
|
|
2696
|
+
{
|
|
2697
|
+
type: "submit",
|
|
2698
|
+
ref: (b) => {
|
|
2699
|
+
b && f === 0 && (p.current = b);
|
|
2700
|
+
},
|
|
2701
|
+
label: v.label,
|
|
2702
|
+
value: "true",
|
|
2703
|
+
onClick: () => r({ type: "enum", value: [v.value] })
|
|
2704
|
+
}
|
|
2705
|
+
) }, v.value))
|
|
2706
|
+
}
|
|
2707
|
+
),
|
|
2708
|
+
e.config.minSelected === 0 && /* @__PURE__ */ a("div", { class: "px-2 pb-2", children: /* @__PURE__ */ a(
|
|
2709
|
+
ve,
|
|
2710
|
+
{
|
|
2711
|
+
class: "relative w-full",
|
|
2712
|
+
type: "button",
|
|
2713
|
+
onClick: () => r({ type: "enum", value: [] })
|
|
2714
|
+
}
|
|
2715
|
+
) })
|
|
2716
|
+
] }) : /* @__PURE__ */ a(
|
|
2717
|
+
"form",
|
|
2718
|
+
{
|
|
2719
|
+
noValidate: !0,
|
|
2720
|
+
onSubmit: (v) => c((f) => {
|
|
2721
|
+
const b = f.checked;
|
|
2722
|
+
r({ type: "enum", value: b });
|
|
2723
|
+
})(v),
|
|
2724
|
+
children: [
|
|
2725
|
+
/* @__PURE__ */ a("div", { class: "flex items-center gap-1", children: [
|
|
2726
|
+
/* @__PURE__ */ a(
|
|
2727
|
+
"ul",
|
|
2728
|
+
{
|
|
2729
|
+
style: { maxHeight: 6.5 * lr + 5 * cr + 2 * ur },
|
|
2730
|
+
class: dr({
|
|
2731
|
+
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
2732
|
+
}),
|
|
2733
|
+
children: e.config.options.map((v, f) => {
|
|
2734
|
+
const b = `checked.${v.value}`, { ref: F, ...k } = o(b);
|
|
2735
|
+
return /* @__PURE__ */ a("li", { class: "relative", children: /* @__PURE__ */ a(
|
|
2736
|
+
Bs,
|
|
2737
|
+
{
|
|
2738
|
+
option: v,
|
|
2739
|
+
autoFocus: f === 0,
|
|
2740
|
+
ref: (A) => {
|
|
2741
|
+
A && f === 0 && (p.current = A), F(A);
|
|
2742
|
+
},
|
|
2743
|
+
id: b,
|
|
2744
|
+
...k,
|
|
2745
|
+
onClick: n ? () => r({ type: "enum", value: [v.value] }) : void 0
|
|
2746
|
+
}
|
|
2747
|
+
) }, v.value);
|
|
2748
|
+
})
|
|
2749
|
+
}
|
|
2750
|
+
),
|
|
2751
|
+
/* @__PURE__ */ a("div", { class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5", children: [
|
|
2752
|
+
n ? null : /* @__PURE__ */ a(Se, {}),
|
|
2753
|
+
e.config.minSelected === 0 && /* @__PURE__ */ a(ve, { class: "relative", type: "button", onClick: () => r({ type: "enum", value: [] }) })
|
|
2754
|
+
] })
|
|
2755
|
+
] }),
|
|
2756
|
+
/* @__PURE__ */ a("div", { class: "px-1", children: /* @__PURE__ */ a(Te, { error: (m = h.checked) == null ? void 0 : m.root, refusal: !0 }) })
|
|
2757
|
+
]
|
|
2758
|
+
}
|
|
2759
|
+
);
|
|
2760
|
+
}, Us = Re("number"), zs = (e, r) => {
|
|
2761
|
+
const t = e.min ?? Number.MIN_SAFE_INTEGER, n = e.max ?? Number.MAX_SAFE_INTEGER, i = e.decimalCases ?? 0;
|
|
2762
|
+
return rt(
|
|
2763
|
+
/* @__PURE__ */ ge({
|
|
2764
|
+
number: /* @__PURE__ */ we(
|
|
2765
|
+
/* @__PURE__ */ Rr(r("validation_number")),
|
|
2766
|
+
/* @__PURE__ */ Fr(t, r("validation_number_min", { min: t })),
|
|
2767
|
+
/* @__PURE__ */ Er(n, r("validation_number_max", { max: n })),
|
|
2768
|
+
/* @__PURE__ */ Sr(
|
|
2769
|
+
(s) => s === Number(s.toFixed(i)),
|
|
2770
|
+
r("validation_number_decimal_cases", { count: i })
|
|
2771
|
+
)
|
|
2772
|
+
)
|
|
2773
|
+
})
|
|
2774
|
+
);
|
|
2775
|
+
}, qs = ({ input: e, onSubmitSuccess: r }) => {
|
|
2776
|
+
var m;
|
|
2777
|
+
const t = e.config.defaultValue, n = e.key ? (m = M.current$.value.flow) == null ? void 0 : m.data.submissions[e.key] : void 0, { t: i } = J(), {
|
|
2778
|
+
register: s,
|
|
2779
|
+
handleSubmit: o,
|
|
2780
|
+
formState: { errors: c }
|
|
2781
|
+
} = tt({
|
|
2782
|
+
defaultValues: {
|
|
2783
|
+
number: Us(n) ? n.value : t ? Number(t) : void 0
|
|
2784
|
+
},
|
|
2785
|
+
resolver: zs(e.config, i)
|
|
2786
|
+
}), { ref: h, ...p } = s("number", { required: !e.config.optional, valueAsNumber: !0 }), g = ie();
|
|
2787
|
+
return ye(() => {
|
|
2788
|
+
g.current && (g.current.focus(), g.current.select());
|
|
2789
|
+
}, []), /* @__PURE__ */ a(
|
|
2790
|
+
"form",
|
|
2791
|
+
{
|
|
2792
|
+
class: "flex flex-col gap-1 p-2.5",
|
|
2793
|
+
onSubmit: o((v) => {
|
|
2794
|
+
v.number !== void 0 && r({ type: "number", value: v.number });
|
|
2795
|
+
}),
|
|
2796
|
+
children: [
|
|
2797
|
+
/* @__PURE__ */ a("div", { class: "flex items-center gap-2", children: [
|
|
2798
|
+
/* @__PURE__ */ a("div", { class: "relative min-w-0 flex-grow", children: [
|
|
2799
|
+
/* @__PURE__ */ a(
|
|
2800
|
+
"input",
|
|
2801
|
+
{
|
|
2802
|
+
...p,
|
|
2803
|
+
id: "chat-input",
|
|
2804
|
+
autocomplete: "off",
|
|
2805
|
+
autoCapitalize: "off",
|
|
2806
|
+
autoCorrect: "off",
|
|
2807
|
+
autoFocus: !0,
|
|
2808
|
+
ref: (v) => {
|
|
2809
|
+
v && (g.current = v), h(v);
|
|
2810
|
+
},
|
|
2811
|
+
type: "text",
|
|
2812
|
+
min: e.config.min,
|
|
2813
|
+
max: e.config.max,
|
|
2814
|
+
class: De({
|
|
2815
|
+
optional: e.config.optional,
|
|
2816
|
+
className: "[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"
|
|
2817
|
+
}),
|
|
2818
|
+
placeholder: e.config.placeholder
|
|
2819
|
+
}
|
|
2820
|
+
),
|
|
2821
|
+
e.config.optional && /* @__PURE__ */ a(ve, { class: "absolute bottom-0 right-0.5 top-0", onClick: () => r(null) })
|
|
2822
|
+
] }),
|
|
2823
|
+
/* @__PURE__ */ a(Se, {})
|
|
2824
|
+
] }),
|
|
2825
|
+
/* @__PURE__ */ a(Te, { error: c.number, refusal: !0 })
|
|
2826
|
+
]
|
|
2827
|
+
}
|
|
2828
|
+
);
|
|
2829
|
+
}, $s = "44", Gs = /^[0-9 ]+$/, Ks = Re("string"), Hs = Re("phone"), Ws = (e) => {
|
|
2830
|
+
const r = /* @__PURE__ */ we(
|
|
2831
|
+
/* @__PURE__ */ te(e("validation_country_code")),
|
|
2832
|
+
/* @__PURE__ */ bt(Gs, e("validation_country_code"))
|
|
2833
|
+
), t = /* @__PURE__ */ we(
|
|
2834
|
+
/* @__PURE__ */ te(e("validation_phone")),
|
|
2835
|
+
/* @__PURE__ */ Ve(1, e("validation_phone")),
|
|
2836
|
+
/* @__PURE__ */ xt((n) => n.replace(/[^0-9]/g, ""))
|
|
2837
|
+
);
|
|
2838
|
+
return rt(
|
|
2839
|
+
/* @__PURE__ */ ge({
|
|
2840
|
+
countryCode: r,
|
|
2841
|
+
phoneNumber: t
|
|
2842
|
+
})
|
|
2843
|
+
);
|
|
2844
|
+
}, Js = ({ input: e, onSubmitSuccess: r }) => {
|
|
2845
|
+
var F;
|
|
2846
|
+
const t = e.key ? (F = M.current$.value.flow) == null ? void 0 : F.data.submissions[e.key] : void 0, { t: n } = J(), [i, s] = me(), o = Ks(t) ? Wn(t.value) : Hs(t) ? t.value : void 0, {
|
|
2847
|
+
register: c,
|
|
2848
|
+
handleSubmit: h,
|
|
2849
|
+
formState: { errors: p },
|
|
2850
|
+
watch: g
|
|
2851
|
+
} = tt({
|
|
2852
|
+
defaultValues: {
|
|
2853
|
+
countryCode: (o == null ? void 0 : o.countryCode) ?? e.config.defaultValue.countryCode ?? $s,
|
|
2854
|
+
phoneNumber: (o == null ? void 0 : o.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
2855
|
+
},
|
|
2856
|
+
resolver: Ws(n)
|
|
2857
|
+
}), { ref: m, ...v } = c("phoneNumber", {
|
|
2858
|
+
required: !e.config.optional
|
|
2859
|
+
}), f = ie(), b = g("countryCode");
|
|
2860
|
+
return ye(() => {
|
|
2861
|
+
f.current && (f.current.focus(), f.current.select());
|
|
2862
|
+
}, []), /* @__PURE__ */ a(
|
|
2863
|
+
"form",
|
|
2864
|
+
{
|
|
2865
|
+
noValidate: !0,
|
|
2866
|
+
class: "flex flex-col gap-1 p-2.5",
|
|
2867
|
+
onSubmit: h((k) => {
|
|
2868
|
+
const A = k.phoneNumber.replace(/[^0-9]/g, ""), _ = k.countryCode.replace(/[^0-9]/g, "");
|
|
2869
|
+
s(void 0);
|
|
2870
|
+
const L = e.config.minChars ?? 7, N = A.length + _.length;
|
|
2871
|
+
if (N < L) return s(n("validation_phone_min_chars", { count: L }));
|
|
2872
|
+
const D = e.config.maxChars;
|
|
2873
|
+
if (D != null && N > D) return s(n("validation_max_chars", { count: D }));
|
|
2874
|
+
e.config.submissionFormat === "phone" ? r({
|
|
2875
|
+
type: "phone",
|
|
2876
|
+
value: { countryCode: _, phoneNumber: A }
|
|
2877
|
+
}) : r({ type: "string", value: b + k.phoneNumber });
|
|
2878
|
+
}),
|
|
2879
|
+
children: [
|
|
2880
|
+
/* @__PURE__ */ a("div", { class: "flex items-center gap-2", children: [
|
|
2881
|
+
/* @__PURE__ */ a("div", { class: "relative flex min-w-0 flex-1 flex-grow gap-2", children: [
|
|
2882
|
+
/* @__PURE__ */ a(
|
|
2883
|
+
"label",
|
|
2884
|
+
{
|
|
2885
|
+
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",
|
|
2886
|
+
htmlFor: `isdk_phone_${e.key}`,
|
|
2887
|
+
children: [
|
|
2888
|
+
/* @__PURE__ */ a("span", { children: [
|
|
2889
|
+
"+",
|
|
2890
|
+
b
|
|
2891
|
+
] }),
|
|
2892
|
+
/* @__PURE__ */ a("select", { ...c("countryCode", {}), id: `isdk_phone_${e.key}`, class: "absolute inset-0 opacity-0", children: Object.entries(wt).map(([k, A]) => /* @__PURE__ */ a("option", { value: A, children: [
|
|
2893
|
+
k,
|
|
2894
|
+
" (+",
|
|
2895
|
+
A,
|
|
2896
|
+
")"
|
|
2897
|
+
] }, k)) })
|
|
2898
|
+
]
|
|
2899
|
+
}
|
|
2900
|
+
),
|
|
2901
|
+
/* @__PURE__ */ a(
|
|
2902
|
+
"input",
|
|
2903
|
+
{
|
|
2904
|
+
...v,
|
|
2905
|
+
id: "chat-input",
|
|
2906
|
+
type: "tel",
|
|
2907
|
+
inputMode: "tel",
|
|
2908
|
+
autocomplete: "off",
|
|
2909
|
+
autoCapitalize: "off",
|
|
2910
|
+
autoCorrect: "off",
|
|
2911
|
+
autoFocus: !0,
|
|
2912
|
+
ref: (k) => {
|
|
2913
|
+
k && (f.current = k), m(k);
|
|
2914
|
+
},
|
|
2915
|
+
class: De({ optional: e.config.optional, className: "min-w-0 flex-1 rounded-r-full" }),
|
|
2916
|
+
placeholder: e.config.placeholder
|
|
2917
|
+
}
|
|
2918
|
+
),
|
|
2919
|
+
e.config.optional && /* @__PURE__ */ a(ve, { class: "absolute bottom-0 right-1 top-0", onClick: () => r(null) })
|
|
2920
|
+
] }),
|
|
2921
|
+
/* @__PURE__ */ a(Se, {})
|
|
2922
|
+
] }),
|
|
2923
|
+
/* @__PURE__ */ a(Te, { error: p.countryCode || p.phoneNumber || { message: i }, refusal: !0 })
|
|
2924
|
+
]
|
|
2925
|
+
}
|
|
2926
|
+
);
|
|
2927
|
+
}, We = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)), fr = (e, r, t, n) => t !== void 0 && n * 1e3 > fn ? e("submission_available_at", { time: hn(t, r) }) : e("submission_cooldown", { count: n }), Zs = (e, r) => {
|
|
2928
|
+
const t = e == null ? void 0 : e.trim();
|
|
2929
|
+
return t && t !== "Submit" ? t : r("submit");
|
|
2930
|
+
}, Xs = ({ input: e, onSubmitSuccess: r }) => {
|
|
2931
|
+
const { t, locale: n } = J(), { availableAt: i } = e.config, [s, o] = me(() => We(i)), [c, h] = me("");
|
|
2932
|
+
Ye(() => {
|
|
2933
|
+
const g = We(i);
|
|
2934
|
+
if (o(g), g === 0) return;
|
|
2935
|
+
h(fr(t, n, i, g));
|
|
2936
|
+
const m = setInterval(() => {
|
|
2937
|
+
const v = We(i);
|
|
2938
|
+
o(v), !(v > 0) && (clearInterval(m), h(t("submission_cooldown_ready")));
|
|
2939
|
+
}, 250);
|
|
2940
|
+
return () => clearInterval(m);
|
|
2941
|
+
}, [i, n, t]);
|
|
2942
|
+
const p = s > 0;
|
|
2943
|
+
return /* @__PURE__ */ a("div", { class: "flex flex-col items-center gap-2 py-3", children: [
|
|
2944
|
+
/* @__PURE__ */ a(
|
|
2945
|
+
"button",
|
|
2946
|
+
{
|
|
2947
|
+
class: "bg-accent-9 hover:bg-accent-10 active:bg-submit-bg-active hover:border-accent-10 active:border-submit-bg-active border-accent-9 ring-accent-6 focus-visible:outline-accent-8 ring-offset-neutral-1 aria-disabled:hover:bg-accent-9 aria-disabled:hover:border-accent-9 flex cursor-pointer rounded-full border border-solid px-5 py-3 pr-4 text-white outline-none ring-1 ring-offset-[1.5px] transition-all duration-300 focus-visible:outline-2 active:ring-2 active:ring-offset-2 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:active:ring-1 aria-disabled:active:ring-offset-[1.5px]",
|
|
2948
|
+
name: e.key,
|
|
2949
|
+
"aria-disabled": p,
|
|
2950
|
+
"aria-describedby": p ? "submit-cooldown" : void 0,
|
|
2951
|
+
onClick: () => {
|
|
2952
|
+
We(i) > 0 || r(null);
|
|
2953
|
+
},
|
|
2954
|
+
children: /* @__PURE__ */ a("span", { class: "flex items-center gap-1.5", children: [
|
|
2955
|
+
/* @__PURE__ */ a("span", { class: "inline-flex items-center text-sm font-medium", children: Zs(e.config.label, t) }),
|
|
2956
|
+
/* @__PURE__ */ a(
|
|
2957
|
+
"svg",
|
|
2958
|
+
{
|
|
2959
|
+
stroke: "currentColor",
|
|
2960
|
+
"stroke-width": "1.5",
|
|
2961
|
+
width: "16",
|
|
2962
|
+
height: "16",
|
|
2963
|
+
viewBox: "0 0 16 16",
|
|
2964
|
+
fill: "none",
|
|
2965
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2966
|
+
children: [
|
|
2967
|
+
/* @__PURE__ */ a("path", { d: "M4 8L8 4L12 8" }),
|
|
2968
|
+
/* @__PURE__ */ a("path", { d: "M8 4V13" })
|
|
2969
|
+
]
|
|
2970
|
+
}
|
|
2971
|
+
)
|
|
2972
|
+
] })
|
|
2973
|
+
}
|
|
2974
|
+
),
|
|
2975
|
+
p && /* @__PURE__ */ a("p", { id: "submit-cooldown", "aria-hidden": "true", class: "text-neutral-11 text-xs", children: fr(t, n, i, s) }),
|
|
2976
|
+
/* @__PURE__ */ a("p", { role: "status", class: "sr-only", children: c })
|
|
2977
|
+
] });
|
|
2978
|
+
}, Ys = 160, hr = (e) => {
|
|
2979
|
+
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, Ys)}px`;
|
|
2980
|
+
}, Qs = {
|
|
2981
|
+
date: {
|
|
2982
|
+
type: "date",
|
|
2983
|
+
inputMode: "text"
|
|
2984
|
+
},
|
|
2985
|
+
email: {
|
|
2986
|
+
type: "email",
|
|
2987
|
+
inputMode: "email",
|
|
2988
|
+
formNoValidate: !0
|
|
2989
|
+
},
|
|
2990
|
+
text: {
|
|
2991
|
+
type: "text",
|
|
2992
|
+
inputMode: "text"
|
|
2993
|
+
},
|
|
2994
|
+
url: {
|
|
2995
|
+
type: "url",
|
|
2996
|
+
inputMode: "url",
|
|
2997
|
+
formNoValidate: !0
|
|
2998
|
+
}
|
|
2999
|
+
}, ei = Re("string"), ti = (e, r) => {
|
|
3000
|
+
const t = {
|
|
3001
|
+
maxLength: r("validation_max_chars", { count: e.maxChars ?? 999 }),
|
|
3002
|
+
minLength: r("validation_min_chars", { count: e.minChars ?? 1 })
|
|
3003
|
+
};
|
|
3004
|
+
return rt(
|
|
3005
|
+
/* @__PURE__ */ ge({
|
|
3006
|
+
text: {
|
|
3007
|
+
date: /* @__PURE__ */ we(/* @__PURE__ */ te(r("validation_date")), /* @__PURE__ */ bt(/^\d{4}-\d{2}-\d{2}$/, r("validation_date"))),
|
|
3008
|
+
email: /* @__PURE__ */ we(
|
|
3009
|
+
/* @__PURE__ */ te(r("validation_email")),
|
|
3010
|
+
/* @__PURE__ */ Ar(r("validation_email")),
|
|
3011
|
+
/* @__PURE__ */ Ve(e.minChars ?? 1, t.minLength),
|
|
3012
|
+
/* @__PURE__ */ ze(e.maxChars ?? 1 / 0, t.maxLength)
|
|
3013
|
+
),
|
|
3014
|
+
text: /* @__PURE__ */ we(
|
|
3015
|
+
/* @__PURE__ */ te(),
|
|
3016
|
+
/* @__PURE__ */ Ve(e.minChars ?? 1, t.minLength),
|
|
3017
|
+
/* @__PURE__ */ ze(e.maxChars ?? 1 / 0, t.maxLength)
|
|
3018
|
+
),
|
|
3019
|
+
url: /* @__PURE__ */ we(
|
|
3020
|
+
/* @__PURE__ */ te(r("validation_url")),
|
|
3021
|
+
/* @__PURE__ */ Vr(r("validation_url")),
|
|
3022
|
+
/* @__PURE__ */ Ve(e.minChars ?? 1, t.minLength),
|
|
3023
|
+
/* @__PURE__ */ ze(e.maxChars ?? 1 / 0, t.maxLength)
|
|
3024
|
+
)
|
|
3025
|
+
}[e.format]
|
|
3026
|
+
})
|
|
3027
|
+
);
|
|
3028
|
+
}, ri = ({ input: e, onSubmitSuccess: r }) => {
|
|
3029
|
+
var F;
|
|
3030
|
+
const { t } = J(), n = e.key ? (F = M.current$.value.flow) == null ? void 0 : F.data.submissions[e.key] : void 0, i = e.config.defaultValue, s = e.config.multiline === !0 && e.config.format === "text", {
|
|
3031
|
+
register: o,
|
|
3032
|
+
handleSubmit: c,
|
|
3033
|
+
watch: h,
|
|
3034
|
+
formState: { errors: p }
|
|
3035
|
+
} = tt({
|
|
3036
|
+
defaultValues: {
|
|
3037
|
+
text: ei(n) ? n.value : i ?? ""
|
|
3038
|
+
},
|
|
3039
|
+
resolver: ti(e.config, t)
|
|
3040
|
+
}), { ref: g, ...m } = o("text", { required: !e.config.optional }), v = ie();
|
|
3041
|
+
ye(() => {
|
|
3042
|
+
v.current && (v.current instanceof HTMLTextAreaElement && hr(v.current), v.current.focus(), v.current.select());
|
|
3043
|
+
}, []);
|
|
3044
|
+
const f = e.config.maxChars, b = s && f !== void 0 ? h("text").length : void 0;
|
|
3045
|
+
return /* @__PURE__ */ a(
|
|
3046
|
+
"form",
|
|
3047
|
+
{
|
|
3048
|
+
noValidate: !0,
|
|
3049
|
+
class: "flex flex-col gap-1 p-2.5",
|
|
3050
|
+
onSubmit: c((k) => {
|
|
3051
|
+
r({ type: "string", value: k.text });
|
|
3052
|
+
}),
|
|
3053
|
+
children: [
|
|
3054
|
+
/* @__PURE__ */ a("div", { class: s ? "flex items-end gap-2" : "flex items-center gap-2", children: [
|
|
3055
|
+
/* @__PURE__ */ a("div", { class: "relative min-w-0 flex-1", children: [
|
|
3056
|
+
s ? /* @__PURE__ */ a(
|
|
3057
|
+
"textarea",
|
|
3058
|
+
{
|
|
3059
|
+
id: "chat-input",
|
|
3060
|
+
...m,
|
|
3061
|
+
rows: 2,
|
|
3062
|
+
maxLength: f,
|
|
3063
|
+
autoFocus: !0,
|
|
3064
|
+
"aria-describedby": b !== void 0 ? "chat-input-count" : void 0,
|
|
3065
|
+
onInput: (k) => hr(k.currentTarget),
|
|
3066
|
+
onKeyDown: (k) => {
|
|
3067
|
+
var A;
|
|
3068
|
+
k.key === "Enter" && (k.ctrlKey || k.metaKey) && (k.preventDefault(), (A = k.currentTarget.form) == null || A.requestSubmit());
|
|
3069
|
+
},
|
|
3070
|
+
ref: (k) => {
|
|
3071
|
+
k && (v.current = k), g(k);
|
|
3072
|
+
},
|
|
3073
|
+
placeholder: e.config.placeholder,
|
|
3074
|
+
class: De({
|
|
3075
|
+
optional: !!e.config.optional,
|
|
3076
|
+
className: "block w-full resize-none overflow-y-auto rounded-2xl"
|
|
3077
|
+
})
|
|
3078
|
+
}
|
|
3079
|
+
) : /* @__PURE__ */ a(
|
|
3080
|
+
"input",
|
|
3081
|
+
{
|
|
3082
|
+
id: "chat-input",
|
|
3083
|
+
...m,
|
|
3084
|
+
...Qs[e.config.format],
|
|
3085
|
+
autocomplete: "off",
|
|
3086
|
+
autoCapitalize: "off",
|
|
3087
|
+
autoCorrect: "off",
|
|
3088
|
+
autoFocus: !0,
|
|
3089
|
+
ref: (k) => {
|
|
3090
|
+
k && (v.current = k), g(k);
|
|
3091
|
+
},
|
|
3092
|
+
placeholder: e.config.placeholder,
|
|
3093
|
+
class: De({ optional: !!e.config.optional, className: "w-full rounded-full" })
|
|
3094
|
+
}
|
|
3095
|
+
),
|
|
3096
|
+
e.config.optional && /* @__PURE__ */ a(
|
|
3097
|
+
ve,
|
|
3098
|
+
{
|
|
3099
|
+
class: s ? "absolute bottom-1 right-0.5" : "absolute bottom-0 right-0.5 top-0",
|
|
3100
|
+
onClick: () => r(null)
|
|
3101
|
+
}
|
|
3102
|
+
)
|
|
3103
|
+
] }),
|
|
3104
|
+
/* @__PURE__ */ a(Se, {})
|
|
3105
|
+
] }),
|
|
3106
|
+
b !== void 0 && f !== void 0 && /* @__PURE__ */ a("p", { id: "chat-input-count", class: "text-neutral-10 px-3 text-right text-xs", children: [
|
|
3107
|
+
b,
|
|
3108
|
+
"/",
|
|
3109
|
+
f
|
|
3110
|
+
] }),
|
|
3111
|
+
/* @__PURE__ */ a(Te, { error: p.text, refusal: !0 })
|
|
3112
|
+
]
|
|
3113
|
+
}
|
|
3114
|
+
);
|
|
3115
|
+
}, ni = {
|
|
3116
|
+
text: ri,
|
|
3117
|
+
phone: Js,
|
|
3118
|
+
"multiple-choice": js,
|
|
3119
|
+
boolean: ss,
|
|
3120
|
+
file: us,
|
|
3121
|
+
submit: Xs,
|
|
3122
|
+
address: es,
|
|
3123
|
+
number: qs
|
|
3124
|
+
}, si = ({
|
|
3125
|
+
logger: e,
|
|
3126
|
+
analytics: r,
|
|
3127
|
+
rpcClient: t
|
|
3128
|
+
}) => {
|
|
3129
|
+
var o;
|
|
3130
|
+
const n = (o = M.current$.value.flow) == null ? void 0 : o.data.currentInput, i = ie(null), s = () => ne.onInteractionFn$.value();
|
|
3131
|
+
return ye(() => {
|
|
3132
|
+
var c;
|
|
3133
|
+
(c = i.current) == null || c.scrollTo({ top: 0 });
|
|
3134
|
+
}, [n]), /* @__PURE__ */ a(
|
|
3135
|
+
"div",
|
|
3136
|
+
{
|
|
3137
|
+
ref: i,
|
|
3138
|
+
class: "border-divider max-h-[calc(100%-var(--header-height)-4rem)] w-full shrink-0 scroll-pb-12 overflow-y-auto overscroll-contain border-t",
|
|
3139
|
+
children: /* @__PURE__ */ a(
|
|
3140
|
+
"div",
|
|
3141
|
+
{
|
|
3142
|
+
class: "flex flex-col",
|
|
3143
|
+
onPointerDownCapture: n ? s : void 0,
|
|
3144
|
+
onKeyDownCapture: n ? s : void 0,
|
|
3145
|
+
onInputCapture: n ? s : void 0,
|
|
3146
|
+
children: n ? (() => {
|
|
3147
|
+
const c = ni[n.type];
|
|
3148
|
+
return /* @__PURE__ */ a(
|
|
3149
|
+
c,
|
|
3150
|
+
{
|
|
3151
|
+
logger: e,
|
|
3152
|
+
analytics: r,
|
|
3153
|
+
rpcClient: t,
|
|
3154
|
+
onSubmitSuccess: ne.onSubmitSuccessFn$.value,
|
|
3155
|
+
input: n
|
|
3156
|
+
}
|
|
3157
|
+
);
|
|
3158
|
+
})() : /* @__PURE__ */ a("div", { class: "flex items-center gap-2 p-2.5", children: [
|
|
3159
|
+
/* @__PURE__ */ a(
|
|
3160
|
+
"input",
|
|
3161
|
+
{
|
|
3162
|
+
"aria-hidden": "true",
|
|
3163
|
+
id: "chat-input",
|
|
3164
|
+
class: De({ optional: !1, className: "flex-grow rounded-full" }),
|
|
3165
|
+
disabled: !0
|
|
3166
|
+
}
|
|
3167
|
+
),
|
|
3168
|
+
/* @__PURE__ */ a(Se, { disabled: !0, "aria-hidden": "true", tabIndex: -1 })
|
|
3169
|
+
] })
|
|
3170
|
+
}
|
|
3171
|
+
)
|
|
3172
|
+
}
|
|
3173
|
+
);
|
|
3174
|
+
};
|
|
3175
|
+
function ii(e) {
|
|
3176
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3177
|
+
}
|
|
3178
|
+
var ai = function(e) {
|
|
3179
|
+
return e instanceof RegExp;
|
|
3180
|
+
}, oi = function(r) {
|
|
3181
|
+
var t = /[\\^$.*+?()[\]{}|]/g, n = RegExp(t.source);
|
|
3182
|
+
return r && n.test(r) ? r.replace(t, "\\$&") : r;
|
|
3183
|
+
}, Jr = function(e) {
|
|
3184
|
+
return typeof e == "string";
|
|
3185
|
+
}, li = function(e) {
|
|
3186
|
+
var r = [];
|
|
3187
|
+
return e.forEach(function(t) {
|
|
3188
|
+
Array.isArray(t) ? r = r.concat(t) : r.push(t);
|
|
3189
|
+
}), r;
|
|
3190
|
+
};
|
|
3191
|
+
function ci(e, r, t) {
|
|
3192
|
+
var n = 0, i = 0;
|
|
3193
|
+
if (e === "")
|
|
3194
|
+
return e;
|
|
3195
|
+
if (!e || !Jr(e))
|
|
3196
|
+
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3197
|
+
var s = r;
|
|
3198
|
+
ai(s) || (s = new RegExp("(" + oi(s) + ")", "gi"));
|
|
3199
|
+
for (var o = e.split(s), c = 1, h = o.length; c < h; c += 2) {
|
|
3200
|
+
if (o[c] === void 0 || o[c - 1] === void 0) {
|
|
3201
|
+
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
3202
|
+
continue;
|
|
3203
|
+
}
|
|
3204
|
+
i = o[c].length, n += o[c - 1].length, o[c] = t(o[c], c, n), n += i;
|
|
3205
|
+
}
|
|
3206
|
+
return o;
|
|
3207
|
+
}
|
|
3208
|
+
var ui = function(r, t, n) {
|
|
3209
|
+
return Array.isArray(r) || (r = [r]), li(r.map(function(i) {
|
|
3210
|
+
return Jr(i) ? ci(i, t, n) : i;
|
|
3211
|
+
}));
|
|
3212
|
+
};
|
|
3213
|
+
const Be = /* @__PURE__ */ ii(ui), di = /(\[[^\]]+\]\([^)]+\))/g, fi = /\[([^\]]+)\]\(([^)]+)\)/, hi = /(https?:\/\/[^\s]+)/g, pi = /_(.*?)_/g, mi = /\*\*(.*?)\*\*/g, gi = /(\\n|\n)/g, pr = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", yi = (e) => {
|
|
3214
|
+
const r = Be(e, di, (c, h) => {
|
|
3215
|
+
const [, p, g] = c.match(fi) ?? [];
|
|
3216
|
+
return g ? /* @__PURE__ */ a("a", { class: pr, href: g, children: p ?? g }, g + h) : /* @__PURE__ */ a("span", { children: "INVALID LINK" });
|
|
3217
|
+
}), t = Be(r, hi, (c, h) => /* @__PURE__ */ a("a", { class: pr, href: c, children: c }, c + h)), n = Be(t, pi, (c, h) => /* @__PURE__ */ a("em", { children: c }, c + h)), i = Be(n, mi, (c, h) => /* @__PURE__ */ a("strong", { children: c }, c + h));
|
|
3218
|
+
let s = 0;
|
|
3219
|
+
return Be(i, gi, () => /* @__PURE__ */ a("br", {}, `br-${s++}`));
|
|
3220
|
+
}, vi = Xe(
|
|
3221
|
+
"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",
|
|
3222
|
+
{
|
|
3223
|
+
variants: {
|
|
3224
|
+
side: {
|
|
3225
|
+
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
3226
|
+
right: "ml-auto bg-accent-9 text-white rounded-br-md shadow-surface-sm shadow-bubble-strong-shadow"
|
|
3227
|
+
},
|
|
3228
|
+
animate: {
|
|
3229
|
+
true: "animate-bubble-in",
|
|
3230
|
+
false: ""
|
|
3231
|
+
}
|
|
3232
|
+
},
|
|
3233
|
+
defaultVariants: {
|
|
3234
|
+
side: "left"
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
), bi = ({ children: e, className: r, animate: t, side: n, ...i }) => /* @__PURE__ */ a(
|
|
3238
|
+
"p",
|
|
3239
|
+
{
|
|
3240
|
+
style: { transformOrigin: n === "left" ? "0% 50%" : "100% 50%" },
|
|
3241
|
+
class: vi({ className: r, side: n, animate: t }),
|
|
3242
|
+
...i,
|
|
3243
|
+
children: e
|
|
3244
|
+
}
|
|
3245
|
+
), mr = /* @__PURE__ */ new Map(), gr = mn({ overrides: {}, locale: void 0 }), xi = (e, r) => {
|
|
3246
|
+
const t = r == null ? void 0 : r.trim();
|
|
3247
|
+
if (!t) return e("job_alerts_privacy");
|
|
3248
|
+
const n = e("job_alerts_privacy_sender", { employer: t });
|
|
3249
|
+
return e("job_alerts_privacy") !== gr("job_alerts_privacy") && n === gr("job_alerts_privacy_sender", { employer: t }) ? e("job_alerts_privacy") : n;
|
|
3250
|
+
}, wi = ({ flow: e, rpcClient: r }) => {
|
|
3251
|
+
const { t } = J(), n = e.data.flowSessionId, i = mr.get(n) ?? pn("offer");
|
|
3252
|
+
mr.set(n, i);
|
|
3253
|
+
const s = (h) => {
|
|
3254
|
+
const p = e.data.submissions[h];
|
|
3255
|
+
return (p == null ? void 0 : p.type) === "string" ? p.value.trim() : void 0;
|
|
3256
|
+
}, o = s("email") || e.nodes.flatMap((h) => h.type === "question-text" && h.data.format === "email" ? [s(h.data.key)] : []).find((h) => !!h);
|
|
3257
|
+
if (!o || i.value === "declined") return null;
|
|
3258
|
+
if (i.value === "success") return /* @__PURE__ */ a("p", { role: "status", children: t("job_alerts_success") });
|
|
3259
|
+
const c = async () => {
|
|
3260
|
+
if (!(i.value !== "offer" && i.value !== "error")) {
|
|
3261
|
+
i.value = "saving";
|
|
3262
|
+
try {
|
|
3263
|
+
await En(r, {
|
|
3264
|
+
contact: { email: o, first_name: s("first_name"), last_name: s("last_name") },
|
|
3265
|
+
job: e.job
|
|
3266
|
+
}), i.value = "success";
|
|
3267
|
+
} catch {
|
|
3268
|
+
i.value = "error";
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
};
|
|
3272
|
+
return /* @__PURE__ */ a("div", { class: "bg-neutral-2 flex flex-col gap-2 rounded-xl p-3 text-sm", children: [
|
|
3273
|
+
/* @__PURE__ */ a("p", { children: t("job_alerts_offer", { email: o }) }),
|
|
3274
|
+
i.value === "error" ? /* @__PURE__ */ a("p", { role: "alert", children: t("job_alerts_error") }) : null,
|
|
3275
|
+
/* @__PURE__ */ a("div", { class: "flex gap-2", children: [
|
|
3276
|
+
/* @__PURE__ */ a(
|
|
3277
|
+
"button",
|
|
3278
|
+
{
|
|
3279
|
+
type: "button",
|
|
3280
|
+
class: "bg-accent-9 min-h-[44px] rounded-lg px-3 py-2 text-white",
|
|
3281
|
+
disabled: i.value === "saving",
|
|
3282
|
+
onClick: c,
|
|
3283
|
+
children: t("job_alerts_accept")
|
|
3284
|
+
}
|
|
3285
|
+
),
|
|
3286
|
+
/* @__PURE__ */ a(
|
|
3287
|
+
"button",
|
|
3288
|
+
{
|
|
3289
|
+
type: "button",
|
|
3290
|
+
class: "min-h-[44px] rounded-lg px-3 py-2",
|
|
3291
|
+
disabled: i.value === "saving",
|
|
3292
|
+
onClick: () => {
|
|
3293
|
+
i.value !== "offer" && i.value !== "error" || (i.value = "declined");
|
|
3294
|
+
},
|
|
3295
|
+
children: t("job_alerts_decline")
|
|
3296
|
+
}
|
|
3297
|
+
)
|
|
3298
|
+
] }),
|
|
3299
|
+
/* @__PURE__ */ a("p", { class: "text-xs", children: xi(t, e.employer) })
|
|
3300
|
+
] });
|
|
3301
|
+
}, _i = ({
|
|
3302
|
+
message: e,
|
|
3303
|
+
analytics: r
|
|
3304
|
+
}) => /* @__PURE__ */ a("div", { class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2", children: /* @__PURE__ */ a(
|
|
3305
|
+
"a",
|
|
3306
|
+
{
|
|
3307
|
+
onClick: () => {
|
|
3308
|
+
var i;
|
|
3309
|
+
const t = M.current$.peek().flow, n = t == null ? void 0 : t.nodes.find((s) => s.id === e.groupId);
|
|
3310
|
+
t && ((n == null ? void 0 : n.type) === "integration-application-submit" || (n == null ? void 0 : n.type) === "link" && gn(n.data.href, e.href)) && (Ge(t).redirected(), vr(r, t, "redirect")), (i = e.onClick) == null || i.call(e);
|
|
3311
|
+
},
|
|
3312
|
+
class: "bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",
|
|
3313
|
+
target: "_blank",
|
|
3314
|
+
href: e.href,
|
|
3315
|
+
children: [
|
|
3316
|
+
e.text,
|
|
3317
|
+
/* @__PURE__ */ a(
|
|
3318
|
+
"svg",
|
|
3319
|
+
{
|
|
3320
|
+
class: "flex-none",
|
|
3321
|
+
width: "15",
|
|
3322
|
+
height: "15",
|
|
3323
|
+
viewBox: "0 0 15 15",
|
|
3324
|
+
fill: "none",
|
|
3325
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3326
|
+
children: /* @__PURE__ */ a(
|
|
3327
|
+
"path",
|
|
3328
|
+
{
|
|
3329
|
+
d: "M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",
|
|
3330
|
+
fill: "currentColor",
|
|
3331
|
+
"fill-rule": "evenodd",
|
|
3332
|
+
"clip-rule": "evenodd"
|
|
3333
|
+
}
|
|
3334
|
+
)
|
|
3335
|
+
}
|
|
3336
|
+
)
|
|
3337
|
+
]
|
|
3338
|
+
}
|
|
3339
|
+
) }), ki = ({ className: e, ...r }) => /* @__PURE__ */ a("div", { "aria-hidden": !0, children: ne.isBotTyping$.value === !0 ? /* @__PURE__ */ a("div", { "data-testid": "typing-indicator", class: Le("flex gap-1 p-4", e), ...r, children: Array.from({ length: 3 }, (t, n) => /* @__PURE__ */ a(
|
|
3340
|
+
"div",
|
|
3341
|
+
{
|
|
3342
|
+
class: "bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",
|
|
3343
|
+
style: { animationDelay: `${-n * 200}ms` }
|
|
3344
|
+
}
|
|
3345
|
+
)) }) : void 0 }), Ci = {
|
|
3346
|
+
bot: "left",
|
|
3347
|
+
user: "right"
|
|
3348
|
+
}, Si = Xe(
|
|
3349
|
+
"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)]",
|
|
3350
|
+
{
|
|
3351
|
+
variants: {
|
|
3352
|
+
variant: {
|
|
3353
|
+
info: "text-neutral-11",
|
|
3354
|
+
warning: "text-system-warning",
|
|
3355
|
+
error: "text-error-11",
|
|
3356
|
+
success: "text-system-success"
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
), Ai = ({
|
|
3361
|
+
env: e,
|
|
3362
|
+
lastSentMessageFooter: r,
|
|
3363
|
+
rpcClient: t,
|
|
3364
|
+
analytics: n
|
|
3365
|
+
}) => {
|
|
3366
|
+
const { t: i } = J(), s = M.current$.value.flow, o = (s == null ? void 0 : s.data.messages) ?? [], c = o.findIndex(
|
|
3367
|
+
(p) => p.type === "system" && p.semantic === "submission-closed"
|
|
3368
|
+
), h = s ? br(s) : void 0;
|
|
3369
|
+
return /* @__PURE__ */ a(
|
|
3370
|
+
"ol",
|
|
3371
|
+
{
|
|
3372
|
+
"aria-label": i("chat_messages"),
|
|
3373
|
+
"aria-live": "polite",
|
|
3374
|
+
class: "mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",
|
|
3375
|
+
children: [
|
|
3376
|
+
o.map((p, g) => /* @__PURE__ */ a(de, { children: [
|
|
3377
|
+
/* @__PURE__ */ a("li", { class: "flex", tabIndex: g === o.length - 1 ? -1 : void 0, children: [
|
|
3378
|
+
h && p.groupId === h && !o.slice(g + 1).some((m) => m.groupId === h) ? r : null,
|
|
3379
|
+
yn(p).with({ type: "system" }, (m) => /* @__PURE__ */ a("p", { class: Si({ variant: m.variant }), children: m.text })).with({ type: "text", author: vn.union("bot", "user") }, (m) => {
|
|
3380
|
+
const v = g === o.length - 1, f = m.author === "bot" ? yi(m.text) : m.text;
|
|
3381
|
+
return /* @__PURE__ */ a(de, { children: /* @__PURE__ */ a(bi, { animate: v, side: Ci[m.author], children: f }, g) });
|
|
3382
|
+
}).with({ type: "link" }, (m) => /* @__PURE__ */ a(_i, { message: m, analytics: n })).with({ type: "image" }, (m) => /* @__PURE__ */ a(
|
|
3383
|
+
"img",
|
|
3384
|
+
{
|
|
3385
|
+
class: "shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",
|
|
3386
|
+
src: m.url,
|
|
3387
|
+
style: { aspectRatio: m.width / m.height }
|
|
3388
|
+
}
|
|
3389
|
+
)).with({ type: "file" }, (m) => /* @__PURE__ */ a(
|
|
3390
|
+
as,
|
|
3391
|
+
{
|
|
3392
|
+
class: m.author === "bot" ? void 0 : "ml-auto",
|
|
3393
|
+
file: { name: m.fileName, sizeKb: m.fileSizeKb }
|
|
3394
|
+
}
|
|
3395
|
+
)).with({ type: "loading" }, (m) => {
|
|
3396
|
+
const v = o[o.length - 1];
|
|
3397
|
+
return !(m === v) || ne.isBotTyping$.value || s != null && s.data.isFinished ? null : /* @__PURE__ */ a("div", { class: "flex flex-grow flex-col items-center justify-center gap-2", children: [
|
|
3398
|
+
/* @__PURE__ */ a(
|
|
3399
|
+
yt,
|
|
3400
|
+
{
|
|
3401
|
+
"aria-hidden": m.text ? "true" : void 0,
|
|
3402
|
+
class: "text-neutral-6 h-8 w-8"
|
|
3403
|
+
}
|
|
3404
|
+
),
|
|
3405
|
+
m.text ? /* @__PURE__ */ a("p", { role: "status", class: "text-neutral-11 text-sm", children: m.text }) : null
|
|
3406
|
+
] });
|
|
3407
|
+
}).exhaustive()
|
|
3408
|
+
] }),
|
|
3409
|
+
g === c && (s != null && s.jobAlerts) && t ? /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(wi, { flow: s, rpcClient: t }, s.data.flowSessionId) }) : null
|
|
3410
|
+
] }, g)),
|
|
3411
|
+
e && e !== "production" && (s == null ? void 0 : s.data.isFinished) && s.data.stagingDestination && /* @__PURE__ */ a("li", { class: "text-neutral-11 text-center text-xs", children: s.data.stagingDestination }),
|
|
3412
|
+
/* @__PURE__ */ a("li", { class: ne.captchaVisible$.value ? "flex" : "hidden", children: /* @__PURE__ */ a(
|
|
3413
|
+
"div",
|
|
3414
|
+
{
|
|
3415
|
+
"data-captcha-slot": !0,
|
|
3416
|
+
tabIndex: -1,
|
|
3417
|
+
role: "group",
|
|
3418
|
+
"aria-label": i("captcha_check"),
|
|
3419
|
+
class: "w-full max-w-[min(100%,24rem)] rounded-md"
|
|
3420
|
+
}
|
|
3421
|
+
) }, "captcha"),
|
|
3422
|
+
/* @__PURE__ */ a(ki, {}, "typing")
|
|
3423
|
+
]
|
|
3424
|
+
}
|
|
3425
|
+
);
|
|
3426
|
+
}, Di = ({ logger: e, apiClient: r, rpcClient: t, analytics: n, talentBankClient: i, env: s }) => {
|
|
3427
|
+
const { flow: o } = M.current$.value;
|
|
3428
|
+
Ce(o, "Flow is required to exist to show chatbot body");
|
|
3429
|
+
const c = M.viewState$.value, { chatRef: h, chatService: p } = bn(), { t: g } = J(), [m, v] = me();
|
|
3430
|
+
return ye(() => {
|
|
3431
|
+
c === "maximised" && ne.scrollToEnd();
|
|
3432
|
+
}, [c]), ye(() => {
|
|
3433
|
+
var K;
|
|
3434
|
+
const { state: f, flow: b } = M.current$.peek();
|
|
3435
|
+
if (f !== "loaded") throw new Error(g("invalid_state"));
|
|
3436
|
+
let F = b.data.nodeHistory.at(-1);
|
|
3437
|
+
if (ne.scrollToEnd(), M.setInput(void 0), b.data.isFinished) return;
|
|
3438
|
+
const k = () => {
|
|
3439
|
+
const S = M.current$.peek().flow;
|
|
3440
|
+
S && Ge(S).active(), !(!S || S.data.hasInteracted) && (M.markAsInteracted(), zt(n, S, "FLOW_INTERACT"));
|
|
3441
|
+
};
|
|
3442
|
+
ne.onInteractionFn$.value = k, F === void 0 ? (F = xn(o.nodes).id, M.setCurrentNodeId(F), zt(n, b, "FLOW_START")) : M.removeMessagesSentByNodeIds([F, pt]);
|
|
3443
|
+
const { interpret: A, abort: _, undo: L } = wn({
|
|
3444
|
+
context: o.context,
|
|
3445
|
+
analytics: { service: n, customProperties: (K = o.analytics) == null ? void 0 : K.customProperties },
|
|
3446
|
+
apiClient: Sn(r, n, b),
|
|
3447
|
+
logger: e,
|
|
3448
|
+
talentBankClient: i,
|
|
3449
|
+
flow: o,
|
|
3450
|
+
chatService: p,
|
|
3451
|
+
t: g,
|
|
3452
|
+
getApplicationRecovery: () => {
|
|
3453
|
+
var S;
|
|
3454
|
+
return (S = M.current$.peek().flow) == null ? void 0 : S.data.applicationRecovery;
|
|
3455
|
+
},
|
|
3456
|
+
setApplicationRecovery: M.setApplicationRecovery,
|
|
3457
|
+
persistWriteBarrier: () => M.persistWriteBarrier(b),
|
|
3458
|
+
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
3459
|
+
getSubmissions: () => {
|
|
3460
|
+
var S;
|
|
3461
|
+
return (S = M.current$.peek().flow) == null ? void 0 : S.data.submissions;
|
|
3462
|
+
},
|
|
3463
|
+
onInterpret: (S) => M.setCurrentNodeId(S.id),
|
|
3464
|
+
onFlowEnd: async () => {
|
|
3465
|
+
var I;
|
|
3466
|
+
M.markAsFinished(), vr(n, b, "submit");
|
|
3467
|
+
const S = M.current$.peek().flow;
|
|
3468
|
+
Ce(S), n.log({
|
|
3469
|
+
event: "FLOW_END",
|
|
3470
|
+
properties: {
|
|
3471
|
+
flow_id: o.id,
|
|
3472
|
+
flow_version: o.version,
|
|
3473
|
+
flow_session_id: S.data.flowSessionId,
|
|
3474
|
+
flow_build: o.build,
|
|
3475
|
+
job: o.job
|
|
3476
|
+
},
|
|
3477
|
+
customProperties: (I = o.analytics) == null ? void 0 : I.customProperties
|
|
3478
|
+
});
|
|
3479
|
+
}
|
|
3480
|
+
}), N = F, D = () => {
|
|
3481
|
+
v(() => L), A(N);
|
|
3482
|
+
}, G = new AbortController();
|
|
3483
|
+
return b.offerResume ? Nn({ chatService: p, t: g, signal: G.signal }).then((S) => (M.settleResume(b), S ? D() : (M.restart(), _n.flushStateData()))).catch((S) => {
|
|
3484
|
+
S instanceof kn || e.error("Resume prompt failed", S);
|
|
3485
|
+
}) : D(), () => {
|
|
3486
|
+
G.abort(), ne.onInteractionFn$.value === k && (ne.onInteractionFn$.value = () => {
|
|
3487
|
+
}), _();
|
|
3488
|
+
};
|
|
3489
|
+
}, [n, r, p, e, o, i, g]), /* @__PURE__ */ a(de, { children: [
|
|
3490
|
+
/* @__PURE__ */ a("div", { class: "relative flex min-h-0 w-full max-w-full flex-grow flex-col", children: [
|
|
3491
|
+
/* @__PURE__ */ a(
|
|
3492
|
+
"div",
|
|
3493
|
+
{
|
|
3494
|
+
ref: h,
|
|
3495
|
+
role: "region",
|
|
3496
|
+
"aria-label": g("conversation_history"),
|
|
3497
|
+
tabIndex: 0,
|
|
3498
|
+
className: "hide-scrollbars fr flex min-h-0 w-full max-w-full flex-grow flex-col overflow-y-auto ring-inset",
|
|
3499
|
+
style: { WebkitOverflowScrolling: "touch" },
|
|
3500
|
+
children: /* @__PURE__ */ a(
|
|
3501
|
+
Ai,
|
|
3502
|
+
{
|
|
3503
|
+
analytics: n,
|
|
3504
|
+
env: s,
|
|
3505
|
+
rpcClient: t,
|
|
3506
|
+
lastSentMessageFooter: !br(o) || !m ? null : /* @__PURE__ */ a(Ei, { undoFn: m })
|
|
3507
|
+
}
|
|
3508
|
+
)
|
|
3509
|
+
}
|
|
3510
|
+
),
|
|
3511
|
+
ne.isReadingHistory$.value && !o.data.isFinished && !ne.isBotTyping$.value && /* @__PURE__ */ a("div", { class: "absolute bottom-2 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ a(
|
|
3512
|
+
xr,
|
|
3513
|
+
{
|
|
3514
|
+
class: "bg-neutral-1 ring-divider shadow-surface-md ring-1",
|
|
3515
|
+
"aria-label": g("jump_to_current"),
|
|
3516
|
+
onClick: () => {
|
|
3517
|
+
var b, F;
|
|
3518
|
+
ne.scrollToEnd(), (F = ((b = h.current) == null ? void 0 : b.querySelector('li[tabindex="-1"]')) ?? h.current) == null || F.focus({ preventScroll: !0 });
|
|
3519
|
+
},
|
|
3520
|
+
children: /* @__PURE__ */ a(Cn, {})
|
|
3521
|
+
}
|
|
3522
|
+
) })
|
|
3523
|
+
] }),
|
|
3524
|
+
/* @__PURE__ */ a(si, { logger: e, analytics: n, rpcClient: t })
|
|
3525
|
+
] });
|
|
3526
|
+
}, Ei = ({ undoFn: e }) => {
|
|
3527
|
+
const { t: r } = J();
|
|
3528
|
+
return /* @__PURE__ */ a("div", { class: "flex flex-1 items-center justify-end px-1", children: /* @__PURE__ */ a(
|
|
3529
|
+
xr,
|
|
3530
|
+
{
|
|
3531
|
+
"aria-label": r("undo"),
|
|
3532
|
+
onClick: async () => {
|
|
3533
|
+
const { flow: t } = M.current$.peek();
|
|
3534
|
+
Ce(t), Ge(t).active(), e(t.data.nodeHistory);
|
|
3535
|
+
},
|
|
3536
|
+
children: /* @__PURE__ */ a("path", { d: "M3 13h2.67l6.66-6.67a1.9 1.9 0 0 0 0-2.66 1.91 1.91 0 0 0-2.66 0L3 10.33V13Zm4.6-7.25 2.67 2.67" })
|
|
3537
|
+
}
|
|
3538
|
+
) });
|
|
3539
|
+
};
|
|
3540
|
+
export {
|
|
3541
|
+
Di as ChatbotBody
|
|
3542
|
+
};
|