@inploi/plugin-chatbot 14.18.1 → 14.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.js +10 -10
- package/dist/chatbot-body-B9-4nZ6I.cjs +5 -0
- package/dist/{chatbot-body-DjE1hhPI.js → chatbot-body-nYJfLJVU.js} +1072 -1038
- package/dist/index-BQAeBeON.cjs +21 -0
- package/dist/{index-C8Gr0Ijn.js → index-DZr-JCDW.js} +655 -639
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +3 -3
- package/dist/chatbot-body-Y8XV3f3-.cjs +0 -5
- package/dist/index-DSa7ZKqt.cjs +0 -21
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Ns = (e, t, r) => t in e ?
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { addressSearchCountry as
|
|
1
|
+
var Ds = Object.defineProperty;
|
|
2
|
+
var Ns = (e, t, r) => t in e ? Ds(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var te = (e, t, r) => Ns(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { h as Wr, R as wt, V as Bt, S as We, F as Hr, D as Gr, x as Os, a as $s, U as Bs, M as Kr, v as js, $ as Ps, y as Us, I as qs, T as zs, b as Ws, z as or, Q as lr, L as Hs, c as cr, A as Gs, j as Ks, O as Jr, P as Js, N as Zs, C as Xs, d as Ys, i as Zr, o as Qs, e as en, s as W, u as ne, f as c, g as Ze, k as _t, l as Se, _ as fe, p as kt, m as je, n as tn, q as Re, r as ge, t as Ht, w as rn, B as Xr, E as sn, G as Lt, H as nn, J as an, K as Xe, W as ie, X as ue, Y as on, Z as ln, a0 as cn, a1 as un, a2 as dn, a3 as fn, a4 as Yr, a5 as hn } from "./index-DZr-JCDW.js";
|
|
5
|
+
import { addressSearchCountry as ur, searchAddressSuggestions as pn, saveClosedRoleJobAlerts as mn } from "@inploi/sdk";
|
|
6
6
|
var ct = /\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, Qr = /^(?:GIR0AA|[A-Z]{1,2}\d[\dA-Z]?\d[A-Z]{2})$/, es = /^[A-Z](?:\d{2}|\d[A-Z])[\dA-Z]{4}$/, ts = ({
|
|
7
7
|
postcode: e,
|
|
8
8
|
label: t = "",
|
|
@@ -20,22 +20,22 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
20
20
|
return "ni";
|
|
21
21
|
const a = (f = (s == null ? void 0 : s.trim()) || ((l = t.split(",").at(-1)) == null ? void 0 : l.trim())) == null ? void 0 : f.toLowerCase();
|
|
22
22
|
return a === "united kingdom" || a === "gb" ? "gb" : a === "ireland" || a === "ie" ? "ie" : null;
|
|
23
|
-
},
|
|
24
|
-
(t) =>
|
|
25
|
-
),
|
|
26
|
-
const [s = "", n = ""] =
|
|
23
|
+
}, yn = "https://maps.inploi.com/address", bn = (e) => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, " ").trim(), dr = (e) => e.split(",").map(
|
|
24
|
+
(t) => bn(t).replace(/^\d+[a-z]?(?:\s*[-/]\s*\d+[a-z]?)?(?:\s+|$)/, "").trim()
|
|
25
|
+
), fr = (e) => Qr.test(e) ? `gb:${e.slice(0, -3)}` : es.test(e) ? `ie:${e.slice(0, 3)}` : null, gn = (e, t, r) => {
|
|
26
|
+
const [s = "", n = ""] = dr(e), i = fr(t), a = n.replace(ct, "").trim(), o = a && !["united kingdom", "ireland", "england", "scotland", "wales", "northern ireland"].includes(a);
|
|
27
27
|
if (!s || !i && !o)
|
|
28
28
|
return null;
|
|
29
29
|
const l = r.slice(0, 3).findIndex((f) => {
|
|
30
30
|
var p;
|
|
31
|
-
const h =
|
|
31
|
+
const h = dr(f);
|
|
32
32
|
if (!h.includes(s))
|
|
33
33
|
return !1;
|
|
34
|
-
const b = ((p = f.match(ct)) == null ? void 0 : p[0].replace(/\s/g, "").toUpperCase()) ?? "", g =
|
|
35
|
-
return i && g ? i === g : !!(o && h.some((
|
|
34
|
+
const b = ((p = f.match(ct)) == null ? void 0 : p[0].replace(/\s/g, "").toUpperCase()) ?? "", g = fr(b);
|
|
35
|
+
return i && g ? i === g : !!(o && h.some((x) => x.replace(ct, "").trim() === a));
|
|
36
36
|
});
|
|
37
37
|
return l === -1 ? null : l + 1;
|
|
38
|
-
},
|
|
38
|
+
}, vn = async ({
|
|
39
39
|
query: e,
|
|
40
40
|
country: t,
|
|
41
41
|
pickedLabel: r,
|
|
@@ -51,41 +51,41 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
51
51
|
try {
|
|
52
52
|
const b = new AbortController();
|
|
53
53
|
o = setTimeout(() => b.abort(), 1500);
|
|
54
|
-
const g = new URL(
|
|
54
|
+
const g = new URL(yn);
|
|
55
55
|
g.search = new URLSearchParams({ q: e, country: t, limit: "5" }).toString();
|
|
56
56
|
const p = await fetch(g.href, { signal: b.signal });
|
|
57
57
|
if (!p.ok)
|
|
58
58
|
return;
|
|
59
|
-
const
|
|
60
|
-
if (typeof
|
|
59
|
+
const x = await p.json();
|
|
60
|
+
if (typeof x != "object" || x === null || !("results" in x) || !Array.isArray(x.results) || !("source" in x) || x.source !== "photon" && x.source !== "mapbox")
|
|
61
61
|
return;
|
|
62
|
-
const w =
|
|
63
|
-
for (const
|
|
64
|
-
if (typeof
|
|
62
|
+
const w = x.results, k = [];
|
|
63
|
+
for (const P of w) {
|
|
64
|
+
if (typeof P != "object" || P === null || !("label" in P) || typeof P.label != "string")
|
|
65
65
|
return;
|
|
66
|
-
k.push(
|
|
66
|
+
k.push(P.label);
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const A = ((s == null ? void 0 : s.trim()) || ((l = r.match(ct)) == null ? void 0 : l[0]) || "").replace(/\s/g, "").toUpperCase(), v = gn(r, A, k), R = (h = (f = p.headers.get("Server-Timing")) == null ? void 0 : f.match(/(?:^|,)\s*lookup\s*;\s*dur=([\d.]+)/)) == null ? void 0 : h[1], N = R === void 0 ? null : Number(R), T = p.headers.get("X-Geo-Fallback"), H = ts({
|
|
69
69
|
postcode: s,
|
|
70
70
|
label: r,
|
|
71
71
|
state: i,
|
|
72
72
|
country: n
|
|
73
73
|
});
|
|
74
74
|
await a({
|
|
75
|
-
hit:
|
|
76
|
-
rank:
|
|
75
|
+
hit: v !== null,
|
|
76
|
+
rank: v,
|
|
77
77
|
results: k.length,
|
|
78
|
-
source:
|
|
78
|
+
source: x.source,
|
|
79
79
|
// Only machine codes are telemetry: never forward arbitrary response text.
|
|
80
|
-
fallback:
|
|
80
|
+
fallback: T && /^[a-z0-9_-]{1,64}$/i.test(T) ? T : null,
|
|
81
81
|
ms: N !== null && Number.isFinite(N) ? N : null,
|
|
82
|
-
region:
|
|
82
|
+
region: H
|
|
83
83
|
});
|
|
84
84
|
} catch {
|
|
85
85
|
} finally {
|
|
86
86
|
clearTimeout(o);
|
|
87
87
|
}
|
|
88
|
-
},
|
|
88
|
+
}, xn = "https://maps.inploi.com", wn = async (e, t, r = Date.now() + 2500) => {
|
|
89
89
|
t == null || t.throwIfAborted();
|
|
90
90
|
const s = new AbortController(), n = () => s.abort(t == null ? void 0 : t.reason);
|
|
91
91
|
t == null || t.addEventListener("abort", n, { once: !0 });
|
|
@@ -101,16 +101,16 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
101
101
|
} finally {
|
|
102
102
|
clearTimeout(i), t == null || t.removeEventListener("abort", n);
|
|
103
103
|
}
|
|
104
|
-
},
|
|
104
|
+
}, _n = async (e, t, r) => await wn(
|
|
105
105
|
async (n) => {
|
|
106
106
|
const { lookupAddress: i } = await import("./common.geo-transport-CJGUJXTA-BsgnqoTX.js");
|
|
107
107
|
return n.throwIfAborted(), i({ ...e, signal: n });
|
|
108
108
|
},
|
|
109
109
|
e.signal,
|
|
110
110
|
r
|
|
111
|
-
) ?? { results: await t(), arm: "direct", source: "direct" },
|
|
111
|
+
) ?? { results: await t(), arm: "direct", source: "direct" }, kn = (e) => {
|
|
112
112
|
try {
|
|
113
|
-
const t = new URL("/outcome",
|
|
113
|
+
const t = new URL("/outcome", xn);
|
|
114
114
|
t.search = new URLSearchParams({
|
|
115
115
|
kind: e.kind,
|
|
116
116
|
surface: e.surface,
|
|
@@ -120,31 +120,31 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
120
120
|
});
|
|
121
121
|
} catch {
|
|
122
122
|
}
|
|
123
|
-
},
|
|
124
|
-
let t =
|
|
123
|
+
}, Cn = "9.14.1", rs = `https://sdk.inploi.com/@inploi/flows@${Cn}/cdn/captcha/index.html`, Sn = new URL(rs).origin, hr = 3e4, An = 5 * 6e4, In = (e) => typeof e == "object" && e !== null && e.source === "inploi-captcha", Mt = /* @__PURE__ */ new WeakMap(), En = (e) => {
|
|
124
|
+
let t = Mt.get(e);
|
|
125
125
|
return t || (t = e.fetch("/flow/captcha").then((r) => {
|
|
126
126
|
let s = r == null ? void 0 : r.site_key;
|
|
127
127
|
return typeof s == "string" && s !== "" ? s : void 0;
|
|
128
128
|
}).catch((r) => {
|
|
129
|
-
throw
|
|
130
|
-
}),
|
|
131
|
-
},
|
|
129
|
+
throw Mt.delete(e), r;
|
|
130
|
+
}), Mt.set(e, t)), t;
|
|
131
|
+
}, Fn = (e, t = {}) => new Promise((r, s) => {
|
|
132
132
|
let { signal: n, container: i = null, theme: a, onInteractive: o } = t instanceof AbortSignal ? { signal: t } : t, l = !1, f = () => {
|
|
133
133
|
}, h = (w) => {
|
|
134
134
|
l || (l = !0, clearTimeout(p), n == null || n.removeEventListener("abort", g), f(), w());
|
|
135
|
-
}, b = (w) => h(() => s(new Error(w))), g = () => b("Captcha aborted"), p,
|
|
135
|
+
}, b = (w) => h(() => s(new Error(w))), g = () => b("Captcha aborted"), p, x = (w) => {
|
|
136
136
|
clearTimeout(p), p = setTimeout(() => b("Captcha timed out"), w);
|
|
137
137
|
};
|
|
138
|
-
if (
|
|
138
|
+
if (x(hr), n == null ? void 0 : n.aborted) return g();
|
|
139
139
|
n == null || n.addEventListener("abort", g), (async () => {
|
|
140
|
-
let w = await
|
|
140
|
+
let w = await En(e);
|
|
141
141
|
if (w === void 0) return h(() => r(void 0));
|
|
142
142
|
if (l) return;
|
|
143
143
|
let k = document.createElement("iframe");
|
|
144
144
|
k.src = `${rs}?${new URLSearchParams({ sitekey: w, origin: window.location.origin, ...a && { theme: a } }).toString()}`, k.title = "Cloudflare security check", k.style.cssText = `display:block;border:0;width:${i ? "100%" : "300px"};height:0;color-scheme:normal`, i ? i.appendChild(k) : (k.style.cssText += ";position:fixed;bottom:16px;right:16px;z-index:2147483647", document.body.appendChild(k));
|
|
145
|
-
let
|
|
146
|
-
if (!k.contentWindow ||
|
|
147
|
-
let N =
|
|
145
|
+
let A = !1, v = (R) => {
|
|
146
|
+
if (!k.contentWindow || R.source !== k.contentWindow || R.origin !== Sn || !In(R.data)) return;
|
|
147
|
+
let N = R.data;
|
|
148
148
|
switch (N.type) {
|
|
149
149
|
case "token":
|
|
150
150
|
return h(() => r(N.token));
|
|
@@ -152,11 +152,11 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
152
152
|
k.style.height = `${Math.max(0, Math.ceil(N.height))}px`;
|
|
153
153
|
return;
|
|
154
154
|
case "before-interactive":
|
|
155
|
-
return
|
|
155
|
+
return A = !0, x(An), o == null ? void 0 : o();
|
|
156
156
|
case "after-interactive":
|
|
157
|
-
return
|
|
157
|
+
return A = !1, x(hr);
|
|
158
158
|
case "error":
|
|
159
|
-
!
|
|
159
|
+
!A && !N.interactive && b("Captcha failed");
|
|
160
160
|
return;
|
|
161
161
|
case "expired":
|
|
162
162
|
return b("Captcha expired");
|
|
@@ -164,18 +164,18 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
164
164
|
return b("Captcha timed out");
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
window.addEventListener("message",
|
|
168
|
-
window.removeEventListener("message",
|
|
167
|
+
window.addEventListener("message", v), f = () => {
|
|
168
|
+
window.removeEventListener("message", v), k.remove();
|
|
169
169
|
};
|
|
170
170
|
})().catch((w) => h(() => s(w)));
|
|
171
|
-
}),
|
|
171
|
+
}), pr = ({ condition: e, context: t, submissions: r, ifBlock: s }) => {
|
|
172
172
|
let [n, ...i] = e.compareKey.split(".");
|
|
173
173
|
if (!n) return !1;
|
|
174
|
-
let a =
|
|
174
|
+
let a = Wr({ context: t, key: n, path: i, submissions: r });
|
|
175
175
|
if (!a) return !1;
|
|
176
176
|
switch (a.type) {
|
|
177
177
|
case "address": {
|
|
178
|
-
let o =
|
|
178
|
+
let o = Bt(a.value, i);
|
|
179
179
|
switch (e.compare) {
|
|
180
180
|
case "equals":
|
|
181
181
|
return o === e.compareValue;
|
|
@@ -190,7 +190,7 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
190
190
|
}
|
|
191
191
|
case "integration": {
|
|
192
192
|
if (typeof a.value != "object" || Array.isArray(a.value)) return !1;
|
|
193
|
-
let o =
|
|
193
|
+
let o = Bt(a.value, i), l = { ...s, data: { compareKey: "_temp", compare: e.compare, compareValue: e.compareValue } };
|
|
194
194
|
switch (typeof o) {
|
|
195
195
|
case "boolean":
|
|
196
196
|
return lt(l, { submissions: { _temp: { value: o, type: "boolean" } }, context: t });
|
|
@@ -215,7 +215,7 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
215
215
|
}
|
|
216
216
|
case "phone":
|
|
217
217
|
case "string": {
|
|
218
|
-
let o = a.type === "phone" ?
|
|
218
|
+
let o = a.type === "phone" ? wt(a.value) : a.value;
|
|
219
219
|
switch (e.compare) {
|
|
220
220
|
case "equals":
|
|
221
221
|
return o === e.compareValue;
|
|
@@ -266,20 +266,20 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
266
266
|
}, lt = (e, { context: t, submissions: r }) => {
|
|
267
267
|
let s = "combinator" in e.data ? e.data.conditions : [e.data];
|
|
268
268
|
if (("combinator" in e.data ? e.data.combinator : "and") === "or") {
|
|
269
|
-
for (let n of s) if (
|
|
269
|
+
for (let n of s) if (pr({ condition: n, context: t, submissions: r, ifBlock: e })) return !0;
|
|
270
270
|
return !1;
|
|
271
271
|
} else {
|
|
272
|
-
for (let n of s) if (!
|
|
272
|
+
for (let n of s) if (!pr({ condition: n, context: t, submissions: r, ifBlock: e })) return !1;
|
|
273
273
|
return !0;
|
|
274
274
|
}
|
|
275
|
-
},
|
|
276
|
-
let [a, ...o] = n.trim().split("."), l =
|
|
275
|
+
}, Vn = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, Ln = (e, { context: t, submissions: r }) => e.replace(Vn, (s, n, i = "") => {
|
|
276
|
+
let [a, ...o] = n.trim().split("."), l = Wr({ key: a, path: o, submissions: r, context: t });
|
|
277
277
|
if (!l) return i;
|
|
278
278
|
switch (l.type) {
|
|
279
279
|
case "boolean":
|
|
280
280
|
return l.value === !0 ? "true" : "false";
|
|
281
281
|
case "file":
|
|
282
|
-
return l.value.map((f) => `${f.name} (${
|
|
282
|
+
return l.value.map((f) => `${f.name} (${We(f.sizeKb)})`).join(", ");
|
|
283
283
|
case "enum":
|
|
284
284
|
return l.value.join(", ");
|
|
285
285
|
case "address":
|
|
@@ -288,10 +288,10 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
288
288
|
case "string":
|
|
289
289
|
return l.value ? l.value.toString() : i;
|
|
290
290
|
case "phone":
|
|
291
|
-
return
|
|
291
|
+
return wt(l.value);
|
|
292
292
|
case "integration": {
|
|
293
293
|
if (typeof l.value != "object" || Array.isArray(l.value)) break;
|
|
294
|
-
let f =
|
|
294
|
+
let f = Bt(l.value, o);
|
|
295
295
|
switch (typeof f) {
|
|
296
296
|
case "boolean":
|
|
297
297
|
return f === !0 ? "true" : "false";
|
|
@@ -308,25 +308,25 @@ var ct = /\b(?:GIR\s*0AA|[a-z]{1,2}\d[\da-z]?\s*\d[a-z]{2}|[a-z](?:\d{2}|\d[a-z]
|
|
|
308
308
|
return i;
|
|
309
309
|
});
|
|
310
310
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
311
|
-
function
|
|
311
|
+
function Mn(e) {
|
|
312
312
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
const s =
|
|
314
|
+
function Gt(e, t, r = "") {
|
|
315
|
+
const s = Mn(e), n = e == null ? void 0 : e.length;
|
|
316
316
|
if (!s || t !== void 0) {
|
|
317
317
|
const a = r && `"${r}" `, o = "", l = s ? `length=${n}` : `type=${typeof e}`;
|
|
318
318
|
throw new Error(a + "expected Uint8Array" + o + ", got " + l);
|
|
319
319
|
}
|
|
320
320
|
return e;
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function mr(e, t = !0) {
|
|
323
323
|
if (e.destroyed)
|
|
324
324
|
throw new Error("Hash instance has been destroyed");
|
|
325
325
|
if (t && e.finished)
|
|
326
326
|
throw new Error("Hash#digest() has already been called");
|
|
327
327
|
}
|
|
328
|
-
function
|
|
329
|
-
|
|
328
|
+
function Rn(e, t) {
|
|
329
|
+
Gt(e, void 0, "digestInto() output");
|
|
330
330
|
const r = t.outputLen;
|
|
331
331
|
if (e.length < r)
|
|
332
332
|
throw new Error('"digestInto() output" expected to be of length >=' + r);
|
|
@@ -335,56 +335,56 @@ function jt(...e) {
|
|
|
335
335
|
for (let t = 0; t < e.length; t++)
|
|
336
336
|
e[t].fill(0);
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function Rt(e) {
|
|
339
339
|
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
340
340
|
}
|
|
341
341
|
function ye(e, t) {
|
|
342
342
|
return e << 32 - t | e >>> t;
|
|
343
343
|
}
|
|
344
|
-
const
|
|
345
|
-
function
|
|
346
|
-
if (
|
|
344
|
+
const Tn = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Dn = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
|
|
345
|
+
function Nn(e) {
|
|
346
|
+
if (Gt(e), Tn)
|
|
347
347
|
return e.toHex();
|
|
348
348
|
let t = "";
|
|
349
349
|
for (let r = 0; r < e.length; r++)
|
|
350
|
-
t +=
|
|
350
|
+
t += Dn[e[r]];
|
|
351
351
|
return t;
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function On(e, t = {}) {
|
|
354
354
|
const r = (n, i) => e(i).update(n).digest(), s = e(void 0);
|
|
355
355
|
return r.outputLen = s.outputLen, r.blockLen = s.blockLen, r.create = (n) => e(n), Object.assign(r, t), Object.freeze(r);
|
|
356
356
|
}
|
|
357
|
-
const
|
|
357
|
+
const $n = (e) => ({
|
|
358
358
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
|
|
359
359
|
});
|
|
360
|
-
function
|
|
360
|
+
function Bn(e, t, r) {
|
|
361
361
|
return e & t ^ ~e & r;
|
|
362
362
|
}
|
|
363
363
|
function jn(e, t, r) {
|
|
364
364
|
return e & t ^ e & r ^ t & r;
|
|
365
365
|
}
|
|
366
|
-
class
|
|
366
|
+
class Pn {
|
|
367
367
|
constructor(t, r, s, n) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
368
|
+
te(this, "blockLen");
|
|
369
|
+
te(this, "outputLen");
|
|
370
|
+
te(this, "padOffset");
|
|
371
|
+
te(this, "isLE");
|
|
372
372
|
// For partial updates less than block size
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
this.blockLen = t, this.outputLen = r, this.padOffset = s, this.isLE = n, this.buffer = new Uint8Array(t), this.view =
|
|
373
|
+
te(this, "buffer");
|
|
374
|
+
te(this, "view");
|
|
375
|
+
te(this, "finished", !1);
|
|
376
|
+
te(this, "length", 0);
|
|
377
|
+
te(this, "pos", 0);
|
|
378
|
+
te(this, "destroyed", !1);
|
|
379
|
+
this.blockLen = t, this.outputLen = r, this.padOffset = s, this.isLE = n, this.buffer = new Uint8Array(t), this.view = Rt(this.buffer);
|
|
380
380
|
}
|
|
381
381
|
update(t) {
|
|
382
|
-
|
|
382
|
+
mr(this), Gt(t);
|
|
383
383
|
const { view: r, buffer: s, blockLen: n } = this, i = t.length;
|
|
384
384
|
for (let a = 0; a < i; ) {
|
|
385
385
|
const o = Math.min(n - this.pos, i - a);
|
|
386
386
|
if (o === n) {
|
|
387
|
-
const l =
|
|
387
|
+
const l = Rt(t);
|
|
388
388
|
for (; n <= i - a; a += n)
|
|
389
389
|
this.process(l, a);
|
|
390
390
|
continue;
|
|
@@ -394,14 +394,14 @@ class $n {
|
|
|
394
394
|
return this.length += t.length, this.roundClean(), this;
|
|
395
395
|
}
|
|
396
396
|
digestInto(t) {
|
|
397
|
-
|
|
397
|
+
mr(this), Rn(t, this), this.finished = !0;
|
|
398
398
|
const { buffer: r, view: s, blockLen: n, isLE: i } = this;
|
|
399
399
|
let { pos: a } = this;
|
|
400
400
|
r[a++] = 128, jt(this.buffer.subarray(a)), this.padOffset > n - a && (this.process(s, 0), a = 0);
|
|
401
401
|
for (let b = a; b < n; b++)
|
|
402
402
|
r[b] = 0;
|
|
403
403
|
s.setBigUint64(n - 8, BigInt(this.length * 8), i), this.process(s, 0);
|
|
404
|
-
const o =
|
|
404
|
+
const o = Rt(t), l = this.outputLen;
|
|
405
405
|
if (l % 4)
|
|
406
406
|
throw new Error("_sha2: outputLen must be aligned to 32bit");
|
|
407
407
|
const f = l / 4, h = this.get();
|
|
@@ -434,7 +434,7 @@ const Fe = /* @__PURE__ */ Uint32Array.from([
|
|
|
434
434
|
2600822924,
|
|
435
435
|
528734635,
|
|
436
436
|
1541459225
|
|
437
|
-
]),
|
|
437
|
+
]), Un = /* @__PURE__ */ Uint32Array.from([
|
|
438
438
|
1116352408,
|
|
439
439
|
1899447441,
|
|
440
440
|
3049323471,
|
|
@@ -500,7 +500,7 @@ const Fe = /* @__PURE__ */ Uint32Array.from([
|
|
|
500
500
|
3204031479,
|
|
501
501
|
3329325298
|
|
502
502
|
]), Ve = /* @__PURE__ */ new Uint32Array(64);
|
|
503
|
-
class
|
|
503
|
+
class qn extends Pn {
|
|
504
504
|
constructor(t) {
|
|
505
505
|
super(64, t, 8, !1);
|
|
506
506
|
}
|
|
@@ -516,12 +516,12 @@ class Pn extends $n {
|
|
|
516
516
|
for (let b = 0; b < 16; b++, r += 4)
|
|
517
517
|
Ve[b] = t.getUint32(r, !1);
|
|
518
518
|
for (let b = 16; b < 64; b++) {
|
|
519
|
-
const g = Ve[b - 15], p = Ve[b - 2],
|
|
520
|
-
Ve[b] = w + Ve[b - 7] +
|
|
519
|
+
const g = Ve[b - 15], p = Ve[b - 2], x = ye(g, 7) ^ ye(g, 18) ^ g >>> 3, w = ye(p, 17) ^ ye(p, 19) ^ p >>> 10;
|
|
520
|
+
Ve[b] = w + Ve[b - 7] + x + Ve[b - 16] | 0;
|
|
521
521
|
}
|
|
522
522
|
let { A: s, B: n, C: i, D: a, E: o, F: l, G: f, H: h } = this;
|
|
523
523
|
for (let b = 0; b < 64; b++) {
|
|
524
|
-
const g = ye(o, 6) ^ ye(o, 11) ^ ye(o, 25), p = h + g +
|
|
524
|
+
const g = ye(o, 6) ^ ye(o, 11) ^ ye(o, 25), p = h + g + Bn(o, l, f) + Un[b] + Ve[b] | 0, w = (ye(s, 2) ^ ye(s, 13) ^ ye(s, 22)) + jn(s, n, i) | 0;
|
|
525
525
|
h = f, f = l, l = o, o = a + p | 0, a = i, i = n, n = s, s = p + w | 0;
|
|
526
526
|
}
|
|
527
527
|
s = s + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, l = l + this.F | 0, f = f + this.G | 0, h = h + this.H | 0, this.set(s, n, i, a, o, l, f, h);
|
|
@@ -533,37 +533,37 @@ class Pn extends $n {
|
|
|
533
533
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), jt(this.buffer);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
class
|
|
536
|
+
class zn extends qn {
|
|
537
537
|
constructor() {
|
|
538
538
|
super(32);
|
|
539
539
|
// We cannot use array here since array allows indexing by variable
|
|
540
540
|
// which means optimizer/compiler cannot use registers.
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
541
|
+
te(this, "A", Fe[0] | 0);
|
|
542
|
+
te(this, "B", Fe[1] | 0);
|
|
543
|
+
te(this, "C", Fe[2] | 0);
|
|
544
|
+
te(this, "D", Fe[3] | 0);
|
|
545
|
+
te(this, "E", Fe[4] | 0);
|
|
546
|
+
te(this, "F", Fe[5] | 0);
|
|
547
|
+
te(this, "G", Fe[6] | 0);
|
|
548
|
+
te(this, "H", Fe[7] | 0);
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
|
-
const
|
|
552
|
-
() => new
|
|
553
|
-
/* @__PURE__ */
|
|
551
|
+
const Wn = /* @__PURE__ */ On(
|
|
552
|
+
() => new zn(),
|
|
553
|
+
/* @__PURE__ */ $n(1)
|
|
554
554
|
);
|
|
555
555
|
var ss = (e) => {
|
|
556
556
|
let t = e.find((r) => r.isHead);
|
|
557
557
|
if (!t) throw new Error("No head node found");
|
|
558
558
|
return t;
|
|
559
|
-
},
|
|
559
|
+
}, Kt = (e) => {
|
|
560
560
|
var t, r;
|
|
561
561
|
if (!(e.data.isFinished || (t = e.data.startedWriteNodeIds) != null && t.length)) return (r = [...e.data.messages].reverse().find((s) => s.groupId && e.nodes.some((n) => n.id === s.groupId && n.type.startsWith("question-")) && (s.type === "system" || "author" in s && s.author === "user"))) == null ? void 0 : r.groupId;
|
|
562
|
-
},
|
|
563
|
-
function
|
|
562
|
+
}, Pt = (e) => Array.isArray(e) ? e.map(Pt) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => [t, Pt(r)])) : typeof e == "function" ? void 0 : e, Hn = (e) => Nn(Wn(new TextEncoder().encode(JSON.stringify(Pt(e)))));
|
|
563
|
+
function Gn(e, t, r, s) {
|
|
564
564
|
var n;
|
|
565
565
|
if (s != null && s.aborted) return;
|
|
566
|
-
let i =
|
|
566
|
+
let i = Hn(r), a = (n = e.data).preApplyFingerprints ?? (n.preApplyFingerprints = []);
|
|
567
567
|
if (a.includes(i)) return;
|
|
568
568
|
a.push(i);
|
|
569
569
|
let o = new AbortController(), l = setTimeout(() => o.abort(), 5e3);
|
|
@@ -574,11 +574,11 @@ function Hn(e, t, r, s) {
|
|
|
574
574
|
clearTimeout(l);
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
|
-
var ns = ({ context: e, submissions: t }) => ({ context: e, submissions: t ?? {} }), me = (e, t) =>
|
|
577
|
+
var ns = ({ context: e, submissions: t }) => ({ context: e, submissions: t ?? {} }), me = (e, t) => Ln(e, ns(t)), Kn = (e, t) => lt(e, ns(t)), as = ({ node: e, nodes: t, stopWhen: r }) => {
|
|
578
578
|
if ((r == null ? void 0 : r(e)) === !0) return e;
|
|
579
579
|
let s = e.nextId ? t.find((n) => n.id === e.nextId) : void 0;
|
|
580
580
|
if (s) return as({ node: s, nodes: t, stopWhen: r });
|
|
581
|
-
},
|
|
581
|
+
}, Jn = ({ childNode: e, nodes: t }) => {
|
|
582
582
|
let r = t.filter((s) => s.type === "if-block").find((s) => {
|
|
583
583
|
if (!s.branchId) return !1;
|
|
584
584
|
let n = t.find((a) => a.id === s.branchId);
|
|
@@ -587,118 +587,126 @@ var ns = ({ context: e, submissions: t }) => ({ context: e, submissions: t ?? {}
|
|
|
587
587
|
return !(!i || i.id !== e.id);
|
|
588
588
|
});
|
|
589
589
|
if (r != null && r.nextId) return t.find((s) => s.id === r.nextId);
|
|
590
|
-
},
|
|
591
|
-
var
|
|
592
|
-
let
|
|
593
|
-
(
|
|
594
|
-
var
|
|
595
|
-
if (
|
|
596
|
-
let
|
|
597
|
-
return (
|
|
590
|
+
}, Zn = 3, Xn = ({ flow: e, analytics: t, logger: r, talentBankClient: s, context: n, apiClient: i, getSubmissions: a, getApplicationRecovery: o, setApplicationRecovery: l, chatService: f, persistWriteBarrier: h, onSubmitNetworkError: b, closedRoleBehaviour: g, settledOutcomes: p = g, dateEchoLocale: x, onFlowEnd: w, onInterpret: k, holdBefore: A, forceSubmitConfirmation: v, flowType: R, t: N }) => {
|
|
591
|
+
var T;
|
|
592
|
+
let H = new AbortController(), P = { submitAccepted: !1 };
|
|
593
|
+
(T = e.data).startedWriteNodeIds ?? (T.startedWriteNodeIds = e.nodes.flatMap((I) => {
|
|
594
|
+
var L, $;
|
|
595
|
+
if (I.type !== "integration-application-submit" || !e.data.nodeHistory.includes(I.id)) return [];
|
|
596
|
+
let C = I.data.key ? (L = a()) == null ? void 0 : L[I.data.key] : void 0;
|
|
597
|
+
return (C == null ? void 0 : C.type) === "integration" && (($ = Hr(C.value)) == null ? void 0 : $.verdict) === "not_submitted" ? [] : [I.id];
|
|
598
598
|
}));
|
|
599
|
-
let
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
599
|
+
let E = { ...t.service, log: (I) => t.service.log({ ...I, customProperties: { ...I.customProperties, ...t.customProperties } }) }, M = (I, C) => {
|
|
600
|
+
if (C.aborted) return;
|
|
601
|
+
let L = A == null ? void 0 : A(void 0);
|
|
602
|
+
return L ? L.then(() => {
|
|
603
|
+
if (!C.aborted) return w == null ? void 0 : w(I);
|
|
604
|
+
}) : w == null ? void 0 : w(I);
|
|
605
|
+
}, D = async (I, C) => {
|
|
606
|
+
let L = H.signal;
|
|
607
|
+
if (L.aborted) return;
|
|
608
|
+
let $ = A == null ? void 0 : A(I);
|
|
609
|
+
if ($ && (await $, L.aborted)) return;
|
|
610
|
+
let B = a(), q = o(), X = (q == null ? void 0 : q.submitNodeId) === I.id ? e.nodes.find((G) => {
|
|
611
|
+
var K;
|
|
612
|
+
return G.id === q.fileQuestionNodeId && G.type === "question-file" && ((K = B == null ? void 0 : B[G.data.key]) == null ? void 0 : K.type) !== "file";
|
|
605
613
|
}) : void 0;
|
|
606
|
-
if (
|
|
607
|
-
k == null || k(
|
|
614
|
+
if (X) return D(X, C);
|
|
615
|
+
k == null || k(I, C);
|
|
608
616
|
try {
|
|
609
|
-
await
|
|
610
|
-
if (!
|
|
611
|
-
await l(
|
|
612
|
-
} catch (
|
|
613
|
-
r.error("Failed to persist application recovery",
|
|
617
|
+
await Yn({ flow: e, analytics: E, logger: r, talentBankClient: s, apiClient: i, context: n, node: I, submissions: B, applicationRecovery: q, setApplicationRecovery: async (G) => {
|
|
618
|
+
if (!L.aborted) try {
|
|
619
|
+
await l(G);
|
|
620
|
+
} catch (K) {
|
|
621
|
+
r.error("Failed to persist application recovery", K);
|
|
614
622
|
}
|
|
615
|
-
}, forceSubmitConfirmation:
|
|
616
|
-
|
|
617
|
-
}, captcha: f.captcha }, next: (
|
|
618
|
-
if (
|
|
619
|
-
let
|
|
620
|
-
return
|
|
623
|
+
}, forceSubmitConfirmation: v || (q == null ? void 0 : q.submitNodeId) === I.id, run: P, persistWriteBarrier: h, onSubmitNetworkError: b, settledOutcomes: p, dateEchoLocale: x, flowType: R, signal: L, t: N, chat: { sendMessage: async (G) => f.send({ groupId: I.id, message: G, signal: L }), userInput: async (G) => f.input({ input: G, signal: L }), setSubmission: (G, K) => {
|
|
624
|
+
L.aborted || f.setSubmission(G, K);
|
|
625
|
+
}, captcha: f.captcha }, next: (G) => {
|
|
626
|
+
if (L.aborted) return;
|
|
627
|
+
let K = (q == null ? void 0 : q.fileQuestionNodeId) === I.id ? q.submitNodeId : G, Z = K ? e.nodes.find((z) => z.id === K) : Jn({ childNode: I, nodes: e.nodes });
|
|
628
|
+
return Z ? D(Z, I) : M(I, L);
|
|
621
629
|
}, end: () => {
|
|
622
|
-
|
|
630
|
+
M(I, L);
|
|
623
631
|
} });
|
|
624
|
-
} catch (
|
|
625
|
-
if (
|
|
626
|
-
throw
|
|
632
|
+
} catch (G) {
|
|
633
|
+
if (G instanceof Gr) return;
|
|
634
|
+
throw G;
|
|
627
635
|
}
|
|
628
636
|
};
|
|
629
|
-
return { interpret: async (
|
|
630
|
-
let
|
|
631
|
-
return
|
|
632
|
-
}, undo: (
|
|
633
|
-
var
|
|
634
|
-
if (delete e.data.reviewReplay, ((
|
|
635
|
-
let
|
|
636
|
-
if (
|
|
637
|
-
let
|
|
638
|
-
|
|
639
|
-
let
|
|
640
|
-
e.data.messages = e.data.messages.filter((
|
|
641
|
-
let
|
|
642
|
-
for (let
|
|
643
|
-
let
|
|
644
|
-
if (!(!
|
|
637
|
+
return { interpret: async (I) => {
|
|
638
|
+
let C = e.nodes.find((L) => L.id === I) ?? ss(e.nodes);
|
|
639
|
+
return D(C);
|
|
640
|
+
}, undo: (I) => {
|
|
641
|
+
var G;
|
|
642
|
+
if (delete e.data.reviewReplay, ((G = e.data.startedWriteNodeIds) == null ? void 0 : G.length) || e.data.isFinished) return { removed: 0 };
|
|
643
|
+
let C = Kt(e), L = C ? I.lastIndexOf(C) : -1, $ = e.nodes.find((K) => K.id === C);
|
|
644
|
+
if (L === -1 || !$) return { removed: 0 };
|
|
645
|
+
let B = e.nodes.find((K) => K.id === I[I.length - 1]);
|
|
646
|
+
H.abort();
|
|
647
|
+
let q = I.splice(L);
|
|
648
|
+
e.data.messages = e.data.messages.filter((K) => !K.groupId || !q.includes(K.groupId)), e.data.currentInput = null;
|
|
649
|
+
let X = a();
|
|
650
|
+
for (let K of q.slice(1)) {
|
|
651
|
+
let Z = e.nodes.find((z) => z.id === K);
|
|
652
|
+
if (!(!Z || !X || Z.id === C) && ("key" in Z.data && Z.data.key && delete X[Z.data.key], "keys" in Z.data)) for (let z of Object.values(Z.data.keys)) typeof z == "string" && delete X[z];
|
|
645
653
|
}
|
|
646
|
-
return
|
|
654
|
+
return H = new AbortController(), D($, B), { removed: q.length };
|
|
647
655
|
}, abort: () => {
|
|
648
|
-
|
|
656
|
+
H.abort();
|
|
649
657
|
} };
|
|
650
658
|
};
|
|
651
|
-
async function
|
|
659
|
+
async function Yn(e) {
|
|
652
660
|
let t = e.node;
|
|
653
661
|
switch (t.type) {
|
|
654
662
|
case "flow-section":
|
|
655
663
|
return await e.chat.sendMessage({ type: "system", variant: "info", text: t.data.title }), e.next(t.nextId);
|
|
656
664
|
case "pre-apply-result":
|
|
657
|
-
return
|
|
665
|
+
return ka({ ...e, node: t });
|
|
658
666
|
case "text":
|
|
659
|
-
return
|
|
667
|
+
return ha({ ...e, node: t });
|
|
660
668
|
case "image":
|
|
661
|
-
return
|
|
669
|
+
return pa({ ...e, node: t });
|
|
662
670
|
case "question-text":
|
|
663
|
-
return
|
|
671
|
+
return ma({ ...e, node: t });
|
|
664
672
|
case "question-enum":
|
|
665
|
-
return
|
|
673
|
+
return ga({ ...e, node: t });
|
|
666
674
|
case "question-number":
|
|
667
|
-
return
|
|
675
|
+
return ya({ ...e, node: t });
|
|
668
676
|
case "question-phone":
|
|
669
|
-
return ma({ ...e, node: t });
|
|
670
|
-
case "question-boolean":
|
|
671
677
|
return ba({ ...e, node: t });
|
|
672
|
-
case "question-
|
|
678
|
+
case "question-boolean":
|
|
673
679
|
return va({ ...e, node: t });
|
|
680
|
+
case "question-file":
|
|
681
|
+
return wa({ ...e, node: t });
|
|
674
682
|
case "question-address":
|
|
675
|
-
return ga({ ...e, node: t });
|
|
676
|
-
case "end-flow":
|
|
677
683
|
return xa({ ...e, node: t });
|
|
684
|
+
case "end-flow":
|
|
685
|
+
return _a({ ...e, node: t });
|
|
678
686
|
case "if-block":
|
|
679
|
-
return
|
|
687
|
+
return fa({ ...e, node: t });
|
|
680
688
|
case "jump":
|
|
681
|
-
return
|
|
689
|
+
return ta({ ...e, node: t });
|
|
682
690
|
case "link":
|
|
683
|
-
return
|
|
691
|
+
return da({ ...e, node: t });
|
|
684
692
|
case "integration-application-submit":
|
|
685
|
-
return
|
|
693
|
+
return la({ ...e, node: t });
|
|
686
694
|
case "add-submission":
|
|
687
|
-
return
|
|
695
|
+
return ra({ ...e, node: t });
|
|
688
696
|
case "integration-workflow-get":
|
|
689
697
|
throw Error("Workflow should be unreachable");
|
|
690
698
|
case "check-duplicate":
|
|
691
|
-
return
|
|
699
|
+
return ea({ ...e, node: t });
|
|
692
700
|
case "feedback":
|
|
693
|
-
return
|
|
701
|
+
return Qn({ ...e, node: t });
|
|
694
702
|
default:
|
|
695
703
|
throw new Error(`Unknown node: ${JSON.stringify(t)}`);
|
|
696
704
|
}
|
|
697
705
|
}
|
|
698
|
-
async function
|
|
706
|
+
async function Qn({ next: e, node: t }) {
|
|
699
707
|
e(t.nextId);
|
|
700
708
|
}
|
|
701
|
-
async function
|
|
709
|
+
async function ea({ next: e, node: t, talentBankClient: r, submissions: s, flow: n, logger: i, chat: a }) {
|
|
702
710
|
var l;
|
|
703
711
|
let o = { isDuplicate: !1 };
|
|
704
712
|
if (s && r) {
|
|
@@ -711,108 +719,108 @@ async function Yn({ next: e, node: t, talentBankClient: r, submissions: s, flow:
|
|
|
711
719
|
}
|
|
712
720
|
a.setSubmission(t.data.key, { type: "integration", value: o }), e(t.nextId);
|
|
713
721
|
}
|
|
714
|
-
async function
|
|
722
|
+
async function ta({ next: e, node: t }) {
|
|
715
723
|
e(t.data.targetId);
|
|
716
724
|
}
|
|
717
|
-
async function
|
|
725
|
+
async function ra({ next: e, node: t, logger: r, submissions: s, context: n }) {
|
|
718
726
|
if (!s) {
|
|
719
727
|
r.error("Submissions not found");
|
|
720
728
|
return;
|
|
721
729
|
}
|
|
722
730
|
s[t.data.key] = { type: "string", value: me(t.data.value, { submissions: s, context: n }) }, e(t.nextId);
|
|
723
731
|
}
|
|
724
|
-
var
|
|
732
|
+
var sa = 5e3, na = (e, t) => t ? `${e}@${t.id_type}:${t.id}` : e, aa = (e, t = Date.now()) => Math.min(e.until, t + (e.maintenance ? Ys : e.throttles ? Zr : Qs)), ia = (e, t, r) => {
|
|
725
733
|
let { waitMs: s, throttles: n, maintenance: i } = en(t == null ? void 0 : t.throttles, r);
|
|
726
734
|
return { key: e, until: Date.now() + s, ...n !== void 0 && { throttles: n }, ...i && { maintenance: i } };
|
|
727
|
-
},
|
|
728
|
-
let t =
|
|
735
|
+
}, oa = ["ApiError", "NotFoundError", "UnauthorisedError", "SchemaValidationError", "ParsingError"], Ut = (e) => e instanceof Error && oa.includes(e.name) ? e : void 0, yr = (e) => {
|
|
736
|
+
let t = Ut(e);
|
|
729
737
|
return (t == null ? void 0 : t.name) === "ApiError" ? t : void 0;
|
|
730
738
|
};
|
|
731
|
-
async function
|
|
732
|
-
var
|
|
733
|
-
let
|
|
734
|
-
let { anonymous_id:
|
|
735
|
-
await e.sendMessage({ type: "text", author: "bot", text:
|
|
739
|
+
async function la({ chat: e, next: t, end: r, node: s, logger: n, apiClient: i, submissions: a, analytics: o, flow: l, applicationRecovery: f, setApplicationRecovery: h, forceSubmitConfirmation: b, flowType: g, run: p, persistWriteBarrier: x, signal: w, onSubmitNetworkError: k, settledOutcomes: A, t: v }) {
|
|
740
|
+
var E, M;
|
|
741
|
+
let R = async ({ redirect_url: D, message: I, button_text: C }) => {
|
|
742
|
+
let { anonymous_id: L, session_id: $ } = o.getSessionInfo();
|
|
743
|
+
await e.sendMessage({ type: "text", author: "bot", text: I ?? v("submission_redirect_message") });
|
|
736
744
|
try {
|
|
737
|
-
let
|
|
738
|
-
|
|
739
|
-
if (
|
|
745
|
+
let B = new URL(D);
|
|
746
|
+
L && !B.searchParams.has("anonymous_id") && B.searchParams.set("anonymous_id", L), await e.sendMessage({ type: "link", href: B.toString(), text: C ?? v("complete_submission"), onClick: () => {
|
|
747
|
+
if (!$) {
|
|
740
748
|
n.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
741
749
|
return;
|
|
742
750
|
}
|
|
743
|
-
o.log({ event: "FLOW_REDIRECT", properties: { flow_build: l.build, flow_id: l.id, flow_session_id:
|
|
751
|
+
o.log({ event: "FLOW_REDIRECT", properties: { flow_build: l.build, flow_id: l.id, flow_session_id: $, flow_version: l.version, href: B.toString(), job: l.job } });
|
|
744
752
|
} });
|
|
745
|
-
} catch (
|
|
746
|
-
n.error(`Invalid redirect URL: ${
|
|
753
|
+
} catch (B) {
|
|
754
|
+
n.error(`Invalid redirect URL: ${D}`, B), e.sendMessage({ type: "system", variant: "error", text: v("redirect_url_error") });
|
|
747
755
|
}
|
|
748
756
|
};
|
|
749
|
-
if ((
|
|
750
|
-
let
|
|
751
|
-
return
|
|
757
|
+
if ((E = l.data.startedWriteNodeIds) != null && E.includes(s.id) && (f == null ? void 0 : f.submitNodeId) !== s.id) {
|
|
758
|
+
let D = (M = l.data.submitRedirects) == null ? void 0 : M[s.id];
|
|
759
|
+
return D ? (await R(D), t(s.nextId)) : (await e.sendMessage({ type: "system", variant: "warning", text: v("submission_unknown") }), r());
|
|
752
760
|
}
|
|
753
|
-
let N =
|
|
761
|
+
let N = na(s.id, l.job), T = 0, H = p.submitAccepted && s.data.skipConfirmation === !0 && (f == null ? void 0 : f.submitNodeId) !== s.id, P = async (D) => {
|
|
754
762
|
var mt, yt, Et, at, u, d, m, S, _;
|
|
755
|
-
let
|
|
756
|
-
|
|
757
|
-
let
|
|
758
|
-
(l.data.reviewRequiresSend === !0 && !
|
|
759
|
-
let
|
|
763
|
+
let I = ((mt = l.data.submitCooldown) == null ? void 0 : mt.key) === N ? l.data.submitCooldown : void 0;
|
|
764
|
+
I && (I.until = aa(I));
|
|
765
|
+
let C = I == null ? void 0 : I.until;
|
|
766
|
+
(l.data.reviewRequiresSend === !0 && !H || D !== !0 || C !== void 0 && C > Date.now()) && await e.userInput({ type: "submit", key: void 0, config: { label: s.data.submitLabel, ...C !== void 0 && { availableAt: C } } }), H = !1;
|
|
767
|
+
let L;
|
|
760
768
|
if (s.data.captcha) {
|
|
761
|
-
let y = e.captcha,
|
|
769
|
+
let y = e.captcha, F = !0;
|
|
762
770
|
try {
|
|
763
|
-
|
|
764
|
-
e.sendMessage({ type: "text", author: "bot", text:
|
|
771
|
+
L = await Fn(i, { signal: w, container: (y == null ? void 0 : y.container()) ?? null, theme: y == null ? void 0 : y.theme, onInteractive: () => {
|
|
772
|
+
e.sendMessage({ type: "text", author: "bot", text: v("captcha_check") }).catch(() => {
|
|
765
773
|
}).then(() => {
|
|
766
|
-
|
|
774
|
+
F && (y == null || y.reveal(!0));
|
|
767
775
|
});
|
|
768
776
|
} });
|
|
769
|
-
} catch (
|
|
770
|
-
if (n.error("Captcha check failed",
|
|
777
|
+
} catch (j) {
|
|
778
|
+
if (n.error("Captcha check failed", j), w.aborted) return;
|
|
771
779
|
} finally {
|
|
772
|
-
|
|
780
|
+
F = !1, y == null || y.reveal(!1);
|
|
773
781
|
}
|
|
774
782
|
}
|
|
775
|
-
await e.sendMessage({ type: "loading", text:
|
|
776
|
-
let { anonymous_id:
|
|
783
|
+
await e.sendMessage({ type: "loading", text: v("submitting") });
|
|
784
|
+
let { anonymous_id: $, session_id: B } = o.getSessionInfo();
|
|
777
785
|
if (w.aborted) return;
|
|
778
|
-
let
|
|
779
|
-
if ((f == null ? void 0 : f.submitNodeId) === s.id && await h(void 0),
|
|
780
|
-
let
|
|
781
|
-
|
|
782
|
-
},
|
|
783
|
-
|
|
784
|
-
let
|
|
785
|
-
return (
|
|
786
|
+
let q = ((yt = l.data.startedWriteNodeIds) == null ? void 0 : yt.includes(s.id)) === !0;
|
|
787
|
+
if ((f == null ? void 0 : f.submitNodeId) === s.id && await h(void 0), q || (l.data.startedWriteNodeIds = [...l.data.startedWriteNodeIds ?? [], s.id]), await x().catch((y) => n.error("Failed to persist application write barrier", y)), w.aborted) return;
|
|
788
|
+
let X, G = setTimeout(() => {
|
|
789
|
+
X = e.sendMessage({ type: "loading", semantic: "submission-still-working", text: v("submission_still_working") }).catch((y) => n.error("Failed to send submission progress message", y));
|
|
790
|
+
}, sa), K = js(), Z, z = await i.fetch("/flow/submit", { method: "POST", body: JSON.stringify({ ...K !== void 0 && { browser_timezone: K }, log_submit: !1, integration_id: s.data.integrationId, anonymous_id: $, session_id: B, job: l.job, flow_build: l.build, ...L !== void 0 && { captcha_token: L }, submissions: Ps(l.nodes, Us(a || {}, s.data.submitKeys)), pre_apply: Kr(l.nodes, a || {}, l.data.flowSessionId) }) }).catch((y) => {
|
|
791
|
+
Z = y;
|
|
792
|
+
let F = yr(y);
|
|
793
|
+
return (F == null ? void 0 : F.data) !== void 0 ? F.data : y;
|
|
786
794
|
});
|
|
787
|
-
if (clearTimeout(
|
|
788
|
-
if (
|
|
789
|
-
l.data.stagingDestination = qs(
|
|
790
|
-
let Qe = (Et =
|
|
791
|
-
|
|
792
|
-
let rt = xe !== void 0 && Date.now() - xe < zs || ((at = l.data.unconfirmedAttemptKeys) == null ? void 0 : at.includes(N)) === !0, Ue = (u =
|
|
793
|
-
we && o.log({ event: "FLOW_SUBMIT", properties: { flow_id: l.id, flow_version: l.version, flow_session_id: l.data.flowSessionId, flow_build: l.build, service: we.service, response: we.response, captured: (
|
|
794
|
-
let pt =
|
|
795
|
-
if ((pt ||
|
|
796
|
-
let { redirect_url: y, message:
|
|
797
|
-
return w.aborted ? void 0 : (l.data.submitRedirects = { ...l.data.submitRedirects, [s.id]: U }, await
|
|
795
|
+
if (clearTimeout(G), await X, w.aborted) return;
|
|
796
|
+
if (Z !== void 0 && !Ut(Z) && k) return await k(Z, w), P(!0);
|
|
797
|
+
l.data.stagingDestination = qs(z), s.data.key && e.setSubmission(s.data.key, { type: "integration", value: z });
|
|
798
|
+
let Qe = (Et = yr(Z)) == null ? void 0 : Et.status, et = typeof Qe == "number" ? Qe : void 0, O = Hr(z, et), tt = O === void 0 && et === 429, Te = A === "terminal" && ((O == null ? void 0 : O.outcome) === "closed" || (O == null ? void 0 : O.outcome) === "duplicate"), De = l.data.failedAttemptAt, xe = De == null ? void 0 : De[N];
|
|
799
|
+
De && xe !== void 0 && xe > Date.now() && (xe = De[N] = Date.now());
|
|
800
|
+
let rt = xe !== void 0 && Date.now() - xe < zs || ((at = l.data.unconfirmedAttemptKeys) == null ? void 0 : at.includes(N)) === !0, Ue = (u = Ut(Z)) == null ? void 0 : u.status, we = Ws(z, typeof Ue == "number" ? Ue : void 0);
|
|
801
|
+
we && o.log({ event: "FLOW_SUBMIT", properties: { flow_id: l.id, flow_version: l.version, flow_session_id: l.data.flowSessionId, flow_build: l.build, service: we.service, response: we.response, captured: (z == null ? void 0 : z.captured) === !0, flow_type: (g == null ? void 0 : g()) ?? "CHATBOT_DRAWER", job: l.job, ...(O == null ? void 0 : O.outcome) === "duplicate" && { outcome: rt ? "duplicate_after_own_attempt" : "duplicate" }, ...we.outcome && { outcome: we.outcome } } });
|
|
802
|
+
let pt = or(z) || (z == null ? void 0 : z.success) === !0;
|
|
803
|
+
if ((pt || lr(z)) && (p.submitAccepted = !0), pt && ((d = l.data.submitCooldown) == null ? void 0 : d.throttles) !== void 0 && (delete l.data.submitCooldown.throttles, await x().catch((y) => n.error("Failed to persist submit cooldown reset", y))), or(z)) {
|
|
804
|
+
let { redirect_url: y, message: F, button_text: j } = z.integration_response.data, U = { redirect_url: y, message: F, button_text: j };
|
|
805
|
+
return w.aborted ? void 0 : (l.data.submitRedirects = { ...l.data.submitRedirects, [s.id]: U }, await x().catch((se) => n.error("Failed to persist submit redirect", se)), await R(U), t(s.nextId));
|
|
798
806
|
}
|
|
799
|
-
let st =
|
|
800
|
-
if (st) return await e.sendMessage({ type: "system", variant: "success", text: st.message ??
|
|
801
|
-
if ((
|
|
802
|
-
let nt =
|
|
803
|
-
if (!Oe && !
|
|
804
|
-
if (n.error(
|
|
805
|
-
if (
|
|
806
|
-
if (
|
|
807
|
-
let y =
|
|
808
|
-
return y ? (await e.sendMessage({ type: "system", variant: "warning", text: y.until === void 0 ?
|
|
807
|
+
let st = lr(z);
|
|
808
|
+
if (st) return await e.sendMessage({ type: "system", variant: "success", text: st.message ?? v("submission_pending") }), t(s.nextId);
|
|
809
|
+
if ((z == null ? void 0 : z.success) === !0) return s.data.skipConfirmation !== !0 && await e.sendMessage({ type: "system", variant: "success", text: v("submission_completed") }), t(s.nextId);
|
|
810
|
+
let nt = Hs(O), Ne = nt !== void 0 && ((m = a == null ? void 0 : a[nt]) == null ? void 0 : m.type) === "file" ? nt : void 0, Oe = Ne === void 0 ? void 0 : l.nodes.find((y) => y.type === "question-file" && y.data.key === Ne);
|
|
811
|
+
if (!Oe && !Te && !cr(O) && (l.data.submitCooldown = ia(N, I, O)), (O == null ? void 0 : O.outcome) !== "duplicate" && !tt && (l.data.failedAttemptAt = { ...l.data.failedAttemptAt, [N]: Date.now() }, (S = l.data.unconfirmedAttemptKeys) != null && S.includes(N) && (l.data.unconfirmedAttemptKeys = l.data.unconfirmedAttemptKeys.filter((y) => y !== N))), (O == null ? void 0 : O.verdict) === "not_submitted" || (O == null ? void 0 : O.outcome) === "duplicate" || (O == null ? void 0 : O.outcome) === "closed" || tt || Gs(z, et) ? (q || (l.data.startedWriteNodeIds = (_ = l.data.startedWriteNodeIds) == null ? void 0 : _.filter((y) => y !== s.id)), (f == null ? void 0 : f.submitNodeId) === s.id && await h(f), await x().catch((y) => n.error("Failed to persist application write barrier release", y))) : await x().catch((y) => n.error("Failed to persist submit cooldown", y)), O) {
|
|
812
|
+
if (n.error(Z ?? O.message), Oe && Ne !== void 0) return e.setSubmission(Ne, null), await h({ fileQuestionNodeId: Oe.id, submitNodeId: s.id }), await e.sendMessage({ type: "system", variant: "error", text: v("submission_unreadable_document") }), t(Oe.id);
|
|
813
|
+
if (O.outcome === "duplicate") return await e.sendMessage({ type: "system", variant: Te ? "success" : "info", semantic: "submission-duplicate", text: v(rt ? "submission_duplicate_earlier_attempt" : "submission_duplicate") }), Te ? (delete l.data.submitCooldown, r()) : P(!1);
|
|
814
|
+
if (O.outcome === "closed") return await e.sendMessage({ type: "system", variant: "info", semantic: "submission-closed", text: v("submission_closed") }), Te ? (delete l.data.submitCooldown, r()) : P(!1);
|
|
815
|
+
let y = Ks(O);
|
|
816
|
+
return y ? (await e.sendMessage({ type: "system", variant: "warning", text: y.until === void 0 ? v("submission_provider_maintenance_later") : v("submission_provider_maintenance", { time: Jr(y.until, void 0) }) }), P(!1)) : O.outcome === "unknown" ? (await e.sendMessage({ type: "system", variant: "warning", text: v(Js(O) ? "submission_unknown_do_not_resubmit" : "submission_unknown") }), P(!1)) : cr(O) ? Zs(z) ? (await e.sendMessage({ type: "text", author: "bot", text: O.message }), P(!1)) : (T === 0 && await e.sendMessage({ type: "system", variant: "warning", text: v("captcha_failed") }), T++, P(T <= Zn)) : Xs(O) ? (await e.sendMessage({ type: "system", variant: "error", text: v("submission_retryable") }), P(!1)) : (await e.sendMessage({ type: "system", variant: "error", text: v("submission_failed") }), r());
|
|
809
817
|
}
|
|
810
|
-
return n.error(
|
|
818
|
+
return n.error(Z ?? z), tt ? (await e.sendMessage({ type: "system", variant: "error", text: v("submission_retryable") }), P(!1)) : (await e.sendMessage({ type: "system", variant: "error", text: v("submission_failed") }), r());
|
|
811
819
|
};
|
|
812
|
-
await
|
|
820
|
+
await P(b === !0 && !H ? !1 : s.data.skipConfirmation);
|
|
813
821
|
}
|
|
814
|
-
var
|
|
815
|
-
if (!
|
|
822
|
+
var ca = /{{\s*\$context\.job\.apply_url\s*(?:\|[^}]*)?}}/, ua = (e, t) => {
|
|
823
|
+
if (!ca.test(e)) return !1;
|
|
816
824
|
try {
|
|
817
825
|
let { protocol: r } = new URL(t);
|
|
818
826
|
return r === "https:" || r === "http:";
|
|
@@ -820,47 +828,47 @@ var oa = /{{\s*\$context\.job\.apply_url\s*(?:\|[^}]*)?}}/, la = (e, t) => {
|
|
|
820
828
|
return !1;
|
|
821
829
|
}
|
|
822
830
|
};
|
|
823
|
-
async function
|
|
831
|
+
async function da({ chat: e, next: t, node: r, submissions: s, context: n, analytics: i, flow: a }) {
|
|
824
832
|
let o = me(r.data.href, { submissions: s, context: n }), { flowSessionId: l } = a.data;
|
|
825
|
-
await e.sendMessage({ type: "link", href: o, text: me(r.data.cta, { submissions: s, context: n }), ...
|
|
833
|
+
await e.sendMessage({ type: "link", href: o, text: me(r.data.cta, { submissions: s, context: n }), ...ua(r.data.href, o) && { onClick: () => {
|
|
826
834
|
i.log({ event: "FLOW_REDIRECT", properties: { flow_build: a.build, flow_id: a.id, flow_session_id: l, flow_version: a.version, href: o, job: a.job } });
|
|
827
835
|
} } }), t(r.nextId);
|
|
828
836
|
}
|
|
829
|
-
async function
|
|
830
|
-
t(
|
|
837
|
+
async function fa({ submissions: e, next: t, node: r, context: s }) {
|
|
838
|
+
t(Kn(r, { submissions: e, context: s }) ? r.branchId : r.nextId);
|
|
831
839
|
}
|
|
832
|
-
async function
|
|
840
|
+
async function ha({ chat: e, next: t, node: r, submissions: s, context: n }) {
|
|
833
841
|
await e.sendMessage({ author: "bot", type: "text", text: me(r.data.text, { submissions: s, context: n }) }), t(r.nextId);
|
|
834
842
|
}
|
|
835
|
-
async function
|
|
843
|
+
async function pa({ chat: e, next: t, node: r }) {
|
|
836
844
|
await e.sendMessage({ author: "bot", type: "image", url: r.data.url, height: r.data.height, width: r.data.width }), t(r.nextId);
|
|
837
845
|
}
|
|
838
|
-
async function
|
|
846
|
+
async function ma({ chat: e, next: t, node: r, submissions: s, context: n, t: i, dateEchoLocale: a }) {
|
|
839
847
|
await e.sendMessage({ author: "bot", type: "text", text: me(r.data.question, { submissions: s, context: n }) });
|
|
840
848
|
let o = r.data.format === "phone" ? await e.userInput({ key: r.data.key, type: "phone", config: { optional: r.data.optional, placeholder: r.data.placeholder, minChars: r.data.minChars, maxChars: r.data.maxChars, submissionFormat: "text", defaultValue: {} } }) : await e.userInput({ key: r.data.key, type: "text", config: { optional: r.data.optional, placeholder: r.data.placeholder, format: r.data.format, maxChars: r.data.maxChars, minChars: r.data.minChars, multiline: r.data.format === "text" && r.data.multiline === !0 } });
|
|
841
|
-
o === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: o.type === "phone" ?
|
|
849
|
+
o === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: o.type === "phone" ? wt(o.value) : r.data.format === "date" && a !== void 0 ? $s(o.value, a) : o.value }), t(r.nextId);
|
|
842
850
|
}
|
|
843
|
-
async function
|
|
851
|
+
async function ya({ chat: e, next: t, node: r, submissions: s, context: n, t: i }) {
|
|
844
852
|
await e.sendMessage({ author: "bot", type: "text", text: me(r.data.question, { submissions: s, context: n }) });
|
|
845
853
|
let a = await e.userInput({ key: r.data.key, type: "number", config: { max: r.data.max, min: r.data.min, optional: r.data.optional, placeholder: r.data.placeholder, decimalCases: r.data.decimalCases } });
|
|
846
854
|
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.value.toString() }), t(r.nextId);
|
|
847
855
|
}
|
|
848
|
-
async function
|
|
856
|
+
async function ba({ chat: e, next: t, node: r, submissions: s, context: n, t: i }) {
|
|
849
857
|
await e.sendMessage({ author: "bot", type: "text", text: me(r.data.question, { submissions: s, context: n }) });
|
|
850
858
|
let a = await e.userInput({ key: r.data.key, type: "phone", config: { minChars: r.data.minChars, defaultValue: { countryCode: r.data.defaultCountryCode }, placeholder: r.data.placeholder, submissionFormat: "phone", optional: r.data.optional } });
|
|
851
|
-
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.type === "phone" ?
|
|
859
|
+
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.type === "phone" ? wt(a.value) : a.value }), t(r.nextId);
|
|
852
860
|
}
|
|
853
|
-
async function
|
|
861
|
+
async function ga({ chat: e, next: t, node: r, submissions: s, context: n, t: i }) {
|
|
854
862
|
await e.sendMessage({ author: "bot", type: "text", text: me(r.data.question, { submissions: s, context: n }) });
|
|
855
863
|
let a = await e.userInput({ key: r.data.key, type: "multiple-choice", config: r.data });
|
|
856
864
|
a.value.length === 0 ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: r.data.options.filter((o) => a.value.includes(o.value)).map((o) => o.label).join(", ") }), t(r.nextId);
|
|
857
865
|
}
|
|
858
|
-
async function
|
|
866
|
+
async function va({ chat: e, next: t, node: r, submissions: s, context: n, t: i }) {
|
|
859
867
|
await e.sendMessage({ author: "bot", type: "text", text: me(r.data.question, { submissions: s, context: n }) });
|
|
860
868
|
let a = await e.userInput({ key: r.data.key, type: "boolean", config: { optional: r.data.optional, labels: { true: r.data.trueLabel, false: r.data.falseLabel } } });
|
|
861
869
|
a === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: a.value === !0 ? r.data.trueLabel : r.data.falseLabel }), t(r.nextId);
|
|
862
870
|
}
|
|
863
|
-
async function
|
|
871
|
+
async function xa({ chat: e, next: t, node: r, t: s }) {
|
|
864
872
|
await e.sendMessage({ author: "bot", type: "text", text: r.data.question });
|
|
865
873
|
let n = await e.userInput({ type: "address", key: r.data.key, config: { optional: r.data.optional, keys: r.data.keys, line2Required: r.data.line2Required, placeholder: r.data.placeholder } });
|
|
866
874
|
if (n === null) await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: s("skipped") });
|
|
@@ -870,24 +878,24 @@ async function ga({ chat: e, next: t, node: r, t: s }) {
|
|
|
870
878
|
}
|
|
871
879
|
return t(r.nextId);
|
|
872
880
|
}
|
|
873
|
-
async function
|
|
881
|
+
async function wa({ node: e, chat: t, next: r, submissions: s, context: n, t: i }) {
|
|
874
882
|
await t.sendMessage({ author: "bot", type: "text", text: me(e.data.question, { submissions: s, context: n }) });
|
|
875
883
|
let a = await t.userInput({ key: e.data.key, type: "file", config: { optional: e.data.optional, extensions: e.data.extensions, fileSizeLimitKib: e.data.maxSizeKb ?? 10 * 1024, allowMultiple: e.data.multiple === !0 } });
|
|
876
884
|
if (a === null) await t.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: i("skipped") });
|
|
877
885
|
else for (let o of a.value) await t.sendMessage({ author: "user", type: "file", fileName: o.name, fileSizeKb: o.sizeKb });
|
|
878
886
|
return r(e.nextId);
|
|
879
887
|
}
|
|
880
|
-
async function
|
|
888
|
+
async function _a({ chat: e, end: t, node: r }) {
|
|
881
889
|
await e.sendMessage({ type: "system", variant: "info", text: r.data.systemMessage }), t();
|
|
882
890
|
}
|
|
883
|
-
async function
|
|
884
|
-
let f =
|
|
885
|
-
if (s.setSubmission(e.data.key, { type: "integration", value: b }),
|
|
891
|
+
async function ka({ node: e, flow: t, submissions: r, chat: s, next: n, apiClient: i, analytics: a, signal: o, context: l }) {
|
|
892
|
+
let f = Bs(t.nodes, r || {}), { answers: h, ...b } = f;
|
|
893
|
+
if (s.setSubmission(e.data.key, { type: "integration", value: b }), Gn(t, i, { ...a.getSessionInfo(), job: t.job, flow_build: t.build, pre_apply: Kr(t.nodes, r || {}, t.data.flowSessionId) }, o), f.status !== "skipped") {
|
|
886
894
|
let g = [f.status === "unavailable" ? "We could not prepare your pre-apply summary. You can still continue to your application." : f.hasHardConcerns ? e.data.messages.hard : f.hasAdvisoryConcerns ? e.data.messages.advisory : e.data.messages.matched];
|
|
887
895
|
for (let p of ["hard", "advisory"]) {
|
|
888
|
-
let
|
|
889
|
-
|
|
890
|
-
` +
|
|
896
|
+
let x = h.filter((w) => !w.matched && w.severity === p);
|
|
897
|
+
x.length && g.push((p === "hard" ? "Role requirements" : "Other things to consider") + `
|
|
898
|
+
` + x.map((w) => `• ${w.message}`).join(`
|
|
891
899
|
`));
|
|
892
900
|
}
|
|
893
901
|
await s.sendMessage({ type: "text", author: "bot", text: g.join(`
|
|
@@ -896,7 +904,7 @@ async function wa({ node: e, flow: t, submissions: r, chat: s, next: n, apiClien
|
|
|
896
904
|
}
|
|
897
905
|
return n(e.nextId);
|
|
898
906
|
}
|
|
899
|
-
const
|
|
907
|
+
const br = (e, t, r) => {
|
|
900
908
|
var s;
|
|
901
909
|
return e.log({
|
|
902
910
|
event: r,
|
|
@@ -910,14 +918,14 @@ const yr = (e, t, r) => {
|
|
|
910
918
|
},
|
|
911
919
|
customProperties: (s = t.analytics) == null ? void 0 : s.customProperties
|
|
912
920
|
});
|
|
913
|
-
},
|
|
921
|
+
}, qt = "resume-prompt", Ca = async ({
|
|
914
922
|
chatService: e,
|
|
915
923
|
t,
|
|
916
924
|
signal: r
|
|
917
925
|
}) => {
|
|
918
926
|
await e.send({
|
|
919
927
|
message: { type: "text", author: "bot", text: t("resume_prompt") },
|
|
920
|
-
groupId:
|
|
928
|
+
groupId: qt,
|
|
921
929
|
signal: r
|
|
922
930
|
});
|
|
923
931
|
const s = await e.input({
|
|
@@ -928,9 +936,9 @@ const yr = (e, t, r) => {
|
|
|
928
936
|
},
|
|
929
937
|
signal: r
|
|
930
938
|
});
|
|
931
|
-
return
|
|
939
|
+
return W.removeMessagesSentByNodeIds([qt]), (s == null ? void 0 : s.value) !== !1;
|
|
932
940
|
}, Pe = ({ class: e, ...t }) => {
|
|
933
|
-
const { t: r } =
|
|
941
|
+
const { t: r } = ne();
|
|
934
942
|
return /* @__PURE__ */ c(
|
|
935
943
|
"button",
|
|
936
944
|
{
|
|
@@ -963,7 +971,7 @@ const yr = (e, t, r) => {
|
|
|
963
971
|
};
|
|
964
972
|
var _e;
|
|
965
973
|
// @__NO_SIDE_EFFECTS__
|
|
966
|
-
function
|
|
974
|
+
function Jt(e) {
|
|
967
975
|
return {
|
|
968
976
|
lang: (e == null ? void 0 : e.lang) ?? (_e == null ? void 0 : _e.lang),
|
|
969
977
|
message: e == null ? void 0 : e.message,
|
|
@@ -971,30 +979,30 @@ function Kt(e) {
|
|
|
971
979
|
abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (_e == null ? void 0 : _e.abortPipeEarly)
|
|
972
980
|
};
|
|
973
981
|
}
|
|
974
|
-
var
|
|
982
|
+
var Tt;
|
|
975
983
|
// @__NO_SIDE_EFFECTS__
|
|
976
|
-
function
|
|
977
|
-
return
|
|
984
|
+
function Sa(e) {
|
|
985
|
+
return Tt == null ? void 0 : Tt.get(e);
|
|
978
986
|
}
|
|
979
|
-
var
|
|
987
|
+
var Dt;
|
|
980
988
|
// @__NO_SIDE_EFFECTS__
|
|
981
|
-
function
|
|
982
|
-
return
|
|
989
|
+
function Aa(e) {
|
|
990
|
+
return Dt == null ? void 0 : Dt.get(e);
|
|
983
991
|
}
|
|
984
|
-
var
|
|
992
|
+
var Nt;
|
|
985
993
|
// @__NO_SIDE_EFFECTS__
|
|
986
|
-
function
|
|
994
|
+
function Ia(e, t) {
|
|
987
995
|
var r;
|
|
988
|
-
return (r =
|
|
996
|
+
return (r = Nt == null ? void 0 : Nt.get(e)) == null ? void 0 : r.get(t);
|
|
989
997
|
}
|
|
990
998
|
// @__NO_SIDE_EFFECTS__
|
|
991
|
-
function
|
|
999
|
+
function Ke(e) {
|
|
992
1000
|
var r, s;
|
|
993
1001
|
const t = typeof e;
|
|
994
1002
|
return t === "string" ? `"${e}"` : t === "number" || t === "bigint" || t === "boolean" ? `${e}` : t === "object" || t === "function" ? (e && ((s = (r = Object.getPrototypeOf(e)) == null ? void 0 : r.constructor) == null ? void 0 : s.name)) ?? "null" : t;
|
|
995
1003
|
}
|
|
996
|
-
function
|
|
997
|
-
const i = n && "input" in n ? n.input : r.value, a = (n == null ? void 0 : n.expected) ?? e.expects ?? null, o = (n == null ? void 0 : n.received) ?? /* @__PURE__ */
|
|
1004
|
+
function ae(e, t, r, s, n) {
|
|
1005
|
+
const i = n && "input" in n ? n.input : r.value, a = (n == null ? void 0 : n.expected) ?? e.expects ?? null, o = (n == null ? void 0 : n.received) ?? /* @__PURE__ */ Ke(i), l = {
|
|
998
1006
|
kind: e.kind,
|
|
999
1007
|
type: e.type,
|
|
1000
1008
|
input: i,
|
|
@@ -1007,7 +1015,7 @@ function se(e, t, r, s, n) {
|
|
|
1007
1015
|
lang: s.lang,
|
|
1008
1016
|
abortEarly: s.abortEarly,
|
|
1009
1017
|
abortPipeEarly: s.abortPipeEarly
|
|
1010
|
-
}, f = e.kind === "schema", h = (n == null ? void 0 : n.message) ?? e.message ?? /* @__PURE__ */
|
|
1018
|
+
}, f = e.kind === "schema", h = (n == null ? void 0 : n.message) ?? e.message ?? /* @__PURE__ */ Ia(e.reference, l.lang) ?? (f ? /* @__PURE__ */ Aa(l.lang) : null) ?? s.message ?? /* @__PURE__ */ Sa(l.lang);
|
|
1011
1019
|
h !== void 0 && (l.message = typeof h == "function" ? (
|
|
1012
1020
|
// @ts-expect-error
|
|
1013
1021
|
h(l)
|
|
@@ -1019,21 +1027,21 @@ function ve(e) {
|
|
|
1019
1027
|
version: 1,
|
|
1020
1028
|
vendor: "valibot",
|
|
1021
1029
|
validate(t) {
|
|
1022
|
-
return e["~run"]({ value: t }, /* @__PURE__ */
|
|
1030
|
+
return e["~run"]({ value: t }, /* @__PURE__ */ Jt());
|
|
1023
1031
|
}
|
|
1024
1032
|
};
|
|
1025
1033
|
}
|
|
1026
1034
|
// @__NO_SIDE_EFFECTS__
|
|
1027
|
-
function
|
|
1035
|
+
function Ea(e, t) {
|
|
1028
1036
|
return Object.hasOwn(e, t) && t !== "__proto__" && t !== "prototype" && t !== "constructor";
|
|
1029
1037
|
}
|
|
1030
1038
|
// @__NO_SIDE_EFFECTS__
|
|
1031
|
-
function
|
|
1039
|
+
function Fa(e, t) {
|
|
1032
1040
|
const r = [...new Set(e)];
|
|
1033
1041
|
return r.length > 1 ? `(${r.join(` ${t} `)})` : r[0] ?? "never";
|
|
1034
1042
|
}
|
|
1035
1043
|
// @__NO_SIDE_EFFECTS__
|
|
1036
|
-
function
|
|
1044
|
+
function Va(e) {
|
|
1037
1045
|
if (e.path) {
|
|
1038
1046
|
let t = "";
|
|
1039
1047
|
for (const r of e.path)
|
|
@@ -1054,7 +1062,7 @@ var is = class extends Error {
|
|
|
1054
1062
|
constructor(e) {
|
|
1055
1063
|
super(e[0].message), this.name = "ValiError", this.issues = e;
|
|
1056
1064
|
}
|
|
1057
|
-
},
|
|
1065
|
+
}, La = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
1058
1066
|
// @__NO_SIDE_EFFECTS__
|
|
1059
1067
|
function os(e, t) {
|
|
1060
1068
|
return {
|
|
@@ -1066,7 +1074,7 @@ function os(e, t) {
|
|
|
1066
1074
|
requirement: e,
|
|
1067
1075
|
message: t,
|
|
1068
1076
|
"~run"(r, s) {
|
|
1069
|
-
return r.typed && !this.requirement(r.value) &&
|
|
1077
|
+
return r.typed && !this.requirement(r.value) && ae(this, "input", r, s), r;
|
|
1070
1078
|
}
|
|
1071
1079
|
};
|
|
1072
1080
|
}
|
|
@@ -1078,10 +1086,10 @@ function ls(e) {
|
|
|
1078
1086
|
reference: ls,
|
|
1079
1087
|
expects: null,
|
|
1080
1088
|
async: !1,
|
|
1081
|
-
requirement:
|
|
1089
|
+
requirement: La,
|
|
1082
1090
|
message: e,
|
|
1083
1091
|
"~run"(t, r) {
|
|
1084
|
-
return t.typed && !this.requirement.test(t.value) &&
|
|
1092
|
+
return t.typed && !this.requirement.test(t.value) && ae(this, "email", t, r), t;
|
|
1085
1093
|
}
|
|
1086
1094
|
};
|
|
1087
1095
|
}
|
|
@@ -1096,7 +1104,7 @@ function ut(e, t) {
|
|
|
1096
1104
|
requirement: e,
|
|
1097
1105
|
message: t,
|
|
1098
1106
|
"~run"(r, s) {
|
|
1099
|
-
return r.typed && r.value.length > this.requirement &&
|
|
1107
|
+
return r.typed && r.value.length > this.requirement && ae(this, "length", r, s, {
|
|
1100
1108
|
received: `${r.value.length}`
|
|
1101
1109
|
}), r;
|
|
1102
1110
|
}
|
|
@@ -1109,28 +1117,28 @@ function cs(e, t) {
|
|
|
1109
1117
|
type: "max_value",
|
|
1110
1118
|
reference: cs,
|
|
1111
1119
|
async: !1,
|
|
1112
|
-
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1120
|
+
expects: `<=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Ke(e)}`,
|
|
1113
1121
|
requirement: e,
|
|
1114
1122
|
message: t,
|
|
1115
1123
|
"~run"(r, s) {
|
|
1116
|
-
return r.typed && !(r.value <= this.requirement) &&
|
|
1117
|
-
received: r.value instanceof Date ? r.value.toJSON() : /* @__PURE__ */
|
|
1124
|
+
return r.typed && !(r.value <= this.requirement) && ae(this, "value", r, s, {
|
|
1125
|
+
received: r.value instanceof Date ? r.value.toJSON() : /* @__PURE__ */ Ke(r.value)
|
|
1118
1126
|
}), r;
|
|
1119
1127
|
}
|
|
1120
1128
|
};
|
|
1121
1129
|
}
|
|
1122
1130
|
// @__NO_SIDE_EFFECTS__
|
|
1123
|
-
function
|
|
1131
|
+
function Ge(e, t) {
|
|
1124
1132
|
return {
|
|
1125
1133
|
kind: "validation",
|
|
1126
1134
|
type: "min_length",
|
|
1127
|
-
reference:
|
|
1135
|
+
reference: Ge,
|
|
1128
1136
|
async: !1,
|
|
1129
1137
|
expects: `>=${e}`,
|
|
1130
1138
|
requirement: e,
|
|
1131
1139
|
message: t,
|
|
1132
1140
|
"~run"(r, s) {
|
|
1133
|
-
return r.typed && r.value.length < this.requirement &&
|
|
1141
|
+
return r.typed && r.value.length < this.requirement && ae(this, "length", r, s, {
|
|
1134
1142
|
received: `${r.value.length}`
|
|
1135
1143
|
}), r;
|
|
1136
1144
|
}
|
|
@@ -1143,37 +1151,37 @@ function us(e, t) {
|
|
|
1143
1151
|
type: "min_value",
|
|
1144
1152
|
reference: us,
|
|
1145
1153
|
async: !1,
|
|
1146
|
-
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */
|
|
1154
|
+
expects: `>=${e instanceof Date ? e.toJSON() : /* @__PURE__ */ Ke(e)}`,
|
|
1147
1155
|
requirement: e,
|
|
1148
1156
|
message: t,
|
|
1149
1157
|
"~run"(r, s) {
|
|
1150
|
-
return r.typed && !(r.value >= this.requirement) &&
|
|
1151
|
-
received: r.value instanceof Date ? r.value.toJSON() : /* @__PURE__ */
|
|
1158
|
+
return r.typed && !(r.value >= this.requirement) && ae(this, "value", r, s, {
|
|
1159
|
+
received: r.value instanceof Date ? r.value.toJSON() : /* @__PURE__ */ Ke(r.value)
|
|
1152
1160
|
}), r;
|
|
1153
1161
|
}
|
|
1154
1162
|
};
|
|
1155
1163
|
}
|
|
1156
1164
|
// @__NO_SIDE_EFFECTS__
|
|
1157
|
-
function
|
|
1165
|
+
function Zt(e, t) {
|
|
1158
1166
|
return {
|
|
1159
1167
|
kind: "validation",
|
|
1160
1168
|
type: "regex",
|
|
1161
|
-
reference:
|
|
1169
|
+
reference: Zt,
|
|
1162
1170
|
async: !1,
|
|
1163
1171
|
expects: `${e}`,
|
|
1164
1172
|
requirement: e,
|
|
1165
1173
|
message: t,
|
|
1166
1174
|
"~run"(r, s) {
|
|
1167
|
-
return r.typed && !this.requirement.test(r.value) &&
|
|
1175
|
+
return r.typed && !this.requirement.test(r.value) && ae(this, "format", r, s), r;
|
|
1168
1176
|
}
|
|
1169
1177
|
};
|
|
1170
1178
|
}
|
|
1171
1179
|
// @__NO_SIDE_EFFECTS__
|
|
1172
|
-
function
|
|
1180
|
+
function Xt(e) {
|
|
1173
1181
|
return {
|
|
1174
1182
|
kind: "transformation",
|
|
1175
1183
|
type: "transform",
|
|
1176
|
-
reference:
|
|
1184
|
+
reference: Xt,
|
|
1177
1185
|
async: !1,
|
|
1178
1186
|
operation: e,
|
|
1179
1187
|
"~run"(t) {
|
|
@@ -1198,12 +1206,12 @@ function ds(e) {
|
|
|
1198
1206
|
},
|
|
1199
1207
|
message: e,
|
|
1200
1208
|
"~run"(t, r) {
|
|
1201
|
-
return t.typed && !this.requirement(t.value) &&
|
|
1209
|
+
return t.typed && !this.requirement(t.value) && ae(this, "URL", t, r), t;
|
|
1202
1210
|
}
|
|
1203
1211
|
};
|
|
1204
1212
|
}
|
|
1205
1213
|
// @__NO_SIDE_EFFECTS__
|
|
1206
|
-
function
|
|
1214
|
+
function Ma(e, t, r) {
|
|
1207
1215
|
return typeof e.fallback == "function" ? (
|
|
1208
1216
|
// @ts-expect-error
|
|
1209
1217
|
e.fallback(t, r)
|
|
@@ -1260,7 +1268,7 @@ function hs(e, t) {
|
|
|
1260
1268
|
l.typed || (r.typed = !1), r.value.push(l.value);
|
|
1261
1269
|
}
|
|
1262
1270
|
} else
|
|
1263
|
-
|
|
1271
|
+
ae(this, "type", r, s);
|
|
1264
1272
|
return r;
|
|
1265
1273
|
}
|
|
1266
1274
|
};
|
|
@@ -1278,7 +1286,7 @@ function ps(e) {
|
|
|
1278
1286
|
return /* @__PURE__ */ ve(this);
|
|
1279
1287
|
},
|
|
1280
1288
|
"~run"(t, r) {
|
|
1281
|
-
return typeof t.value == "boolean" ? t.typed = !0 :
|
|
1289
|
+
return typeof t.value == "boolean" ? t.typed = !0 : ae(this, "type", t, r), t;
|
|
1282
1290
|
}
|
|
1283
1291
|
};
|
|
1284
1292
|
}
|
|
@@ -1295,7 +1303,7 @@ function ms(e) {
|
|
|
1295
1303
|
return /* @__PURE__ */ ve(this);
|
|
1296
1304
|
},
|
|
1297
1305
|
"~run"(t, r) {
|
|
1298
|
-
return typeof t.value == "number" && !isNaN(t.value) ? t.typed = !0 :
|
|
1306
|
+
return typeof t.value == "number" && !isNaN(t.value) ? t.typed = !0 : ae(this, "type", t, r), t;
|
|
1299
1307
|
}
|
|
1300
1308
|
};
|
|
1301
1309
|
}
|
|
@@ -1342,8 +1350,8 @@ function Ae(e, t) {
|
|
|
1342
1350
|
}
|
|
1343
1351
|
f.typed || (r.typed = !1), r.value[a] = f.value;
|
|
1344
1352
|
} else if (o.fallback !== void 0)
|
|
1345
|
-
r.value[a] = /* @__PURE__ */
|
|
1346
|
-
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (
|
|
1353
|
+
r.value[a] = /* @__PURE__ */ Ma(o);
|
|
1354
|
+
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (ae(this, "key", r, s, {
|
|
1347
1355
|
input: void 0,
|
|
1348
1356
|
expected: `"${a}"`,
|
|
1349
1357
|
path: [
|
|
@@ -1360,17 +1368,17 @@ function Ae(e, t) {
|
|
|
1360
1368
|
break;
|
|
1361
1369
|
}
|
|
1362
1370
|
} else
|
|
1363
|
-
|
|
1371
|
+
ae(this, "type", r, s);
|
|
1364
1372
|
return r;
|
|
1365
1373
|
}
|
|
1366
1374
|
};
|
|
1367
1375
|
}
|
|
1368
1376
|
// @__NO_SIDE_EFFECTS__
|
|
1369
|
-
function
|
|
1377
|
+
function He(e, t) {
|
|
1370
1378
|
return {
|
|
1371
1379
|
kind: "schema",
|
|
1372
1380
|
type: "optional",
|
|
1373
|
-
reference:
|
|
1381
|
+
reference: He,
|
|
1374
1382
|
expects: `(${e.expects} | undefined)`,
|
|
1375
1383
|
async: !1,
|
|
1376
1384
|
wrapped: e,
|
|
@@ -1389,7 +1397,7 @@ function ys(e, t) {
|
|
|
1389
1397
|
kind: "schema",
|
|
1390
1398
|
type: "picklist",
|
|
1391
1399
|
reference: ys,
|
|
1392
|
-
expects: /* @__PURE__ */
|
|
1400
|
+
expects: /* @__PURE__ */ Fa(e.map(Ke), "|"),
|
|
1393
1401
|
async: !1,
|
|
1394
1402
|
options: e,
|
|
1395
1403
|
message: t,
|
|
@@ -1397,7 +1405,7 @@ function ys(e, t) {
|
|
|
1397
1405
|
return /* @__PURE__ */ ve(this);
|
|
1398
1406
|
},
|
|
1399
1407
|
"~run"(r, s) {
|
|
1400
|
-
return this.options.includes(r.value) ? r.typed = !0 :
|
|
1408
|
+
return this.options.includes(r.value) ? r.typed = !0 : ae(this, "type", r, s), r;
|
|
1401
1409
|
}
|
|
1402
1410
|
};
|
|
1403
1411
|
}
|
|
@@ -1421,7 +1429,7 @@ function bs(e, t, r) {
|
|
|
1421
1429
|
if (i && typeof i == "object") {
|
|
1422
1430
|
s.typed = !0, s.value = {};
|
|
1423
1431
|
for (const l in i)
|
|
1424
|
-
if (/* @__PURE__ */
|
|
1432
|
+
if (/* @__PURE__ */ Ea(i, l)) {
|
|
1425
1433
|
const f = i[l], h = this.key["~run"]({ value: l }, n);
|
|
1426
1434
|
if (h.issues) {
|
|
1427
1435
|
const g = {
|
|
@@ -1460,17 +1468,17 @@ function bs(e, t, r) {
|
|
|
1460
1468
|
(!h.typed || !b.typed) && (s.typed = !1), h.typed && (s.value[h.value] = b.value);
|
|
1461
1469
|
}
|
|
1462
1470
|
} else
|
|
1463
|
-
|
|
1471
|
+
ae(this, "type", s, n);
|
|
1464
1472
|
return s;
|
|
1465
1473
|
}
|
|
1466
1474
|
};
|
|
1467
1475
|
}
|
|
1468
1476
|
// @__NO_SIDE_EFFECTS__
|
|
1469
|
-
function
|
|
1477
|
+
function ce(e) {
|
|
1470
1478
|
return {
|
|
1471
1479
|
kind: "schema",
|
|
1472
1480
|
type: "string",
|
|
1473
|
-
reference:
|
|
1481
|
+
reference: ce,
|
|
1474
1482
|
expects: "string",
|
|
1475
1483
|
async: !1,
|
|
1476
1484
|
message: e,
|
|
@@ -1478,21 +1486,21 @@ function le(e) {
|
|
|
1478
1486
|
return /* @__PURE__ */ ve(this);
|
|
1479
1487
|
},
|
|
1480
1488
|
"~run"(t, r) {
|
|
1481
|
-
return typeof t.value == "string" ? t.typed = !0 :
|
|
1489
|
+
return typeof t.value == "string" ? t.typed = !0 : ae(this, "type", t, r), t;
|
|
1482
1490
|
}
|
|
1483
1491
|
};
|
|
1484
1492
|
}
|
|
1485
1493
|
function gs(e, t, r) {
|
|
1486
|
-
const s = e["~run"]({ value: t }, /* @__PURE__ */
|
|
1494
|
+
const s = e["~run"]({ value: t }, /* @__PURE__ */ Jt(r));
|
|
1487
1495
|
if (s.issues)
|
|
1488
1496
|
throw new is(s.issues);
|
|
1489
1497
|
return s.value;
|
|
1490
1498
|
}
|
|
1491
1499
|
// @__NO_SIDE_EFFECTS__
|
|
1492
|
-
function
|
|
1500
|
+
function Ra(e, t) {
|
|
1493
1501
|
const r = {};
|
|
1494
1502
|
for (const s in e.entries)
|
|
1495
|
-
r[s] = /* @__PURE__ */
|
|
1503
|
+
r[s] = /* @__PURE__ */ He(e.entries[s]);
|
|
1496
1504
|
return {
|
|
1497
1505
|
...e,
|
|
1498
1506
|
entries: r,
|
|
@@ -1523,10 +1531,10 @@ function Me(...e) {
|
|
|
1523
1531
|
};
|
|
1524
1532
|
}
|
|
1525
1533
|
// @__NO_SIDE_EFFECTS__
|
|
1526
|
-
async function
|
|
1534
|
+
async function Ta(e, t, r) {
|
|
1527
1535
|
const s = await e["~run"](
|
|
1528
1536
|
{ value: t },
|
|
1529
|
-
/* @__PURE__ */
|
|
1537
|
+
/* @__PURE__ */ Jt(r)
|
|
1530
1538
|
);
|
|
1531
1539
|
return {
|
|
1532
1540
|
typed: s.typed,
|
|
@@ -1551,8 +1559,8 @@ const Ye = ({ error: e }) => !e || !e.message ? null : /* @__PURE__ */ c("div",
|
|
|
1551
1559
|
}
|
|
1552
1560
|
),
|
|
1553
1561
|
/* @__PURE__ */ c("p", { class: "break-words pr-1 text-sm", children: e.message })
|
|
1554
|
-
] }),
|
|
1555
|
-
const { t: r } =
|
|
1562
|
+
] }), Ie = ({ class: e, ...t }) => {
|
|
1563
|
+
const { t: r } = ne();
|
|
1556
1564
|
return /* @__PURE__ */ c(
|
|
1557
1565
|
"button",
|
|
1558
1566
|
{
|
|
@@ -1587,12 +1595,12 @@ const Ye = ({ error: e }) => !e || !e.message ? null : /* @__PURE__ */ c("div",
|
|
|
1587
1595
|
}
|
|
1588
1596
|
);
|
|
1589
1597
|
};
|
|
1590
|
-
var
|
|
1598
|
+
var Yt = { 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" }, Da = (e) => {
|
|
1591
1599
|
if (e === "") return { countryCode: "", phoneNumber: "" };
|
|
1592
|
-
let t = Object.values(
|
|
1600
|
+
let t = Object.values(Yt).find((s) => e.startsWith(s)) ?? "", r = e.replace(t, "");
|
|
1593
1601
|
return /^\d+$/.test(r) ? { countryCode: t, phoneNumber: r } : { countryCode: "", phoneNumber: "" };
|
|
1594
1602
|
};
|
|
1595
|
-
const Je =
|
|
1603
|
+
const Je = _t(
|
|
1596
1604
|
"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",
|
|
1597
1605
|
{
|
|
1598
1606
|
variants: {
|
|
@@ -1605,17 +1613,17 @@ const Je = wt(
|
|
|
1605
1613
|
optional: !1
|
|
1606
1614
|
}
|
|
1607
1615
|
}
|
|
1608
|
-
),
|
|
1609
|
-
name: /* @__PURE__ */
|
|
1610
|
-
}),
|
|
1616
|
+
), Na = "https://api.mapbox.com/search/searchbox/v1/suggest", Oa = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", $a = (e) => atob(e).split("").reverse().join(""), ke = /* @__PURE__ */ Ae({
|
|
1617
|
+
name: /* @__PURE__ */ ce()
|
|
1618
|
+
}), Ba = /* @__PURE__ */ Ae({
|
|
1611
1619
|
suggestions: /* @__PURE__ */ hs(
|
|
1612
1620
|
/* @__PURE__ */ Ae({
|
|
1613
|
-
feature_type: /* @__PURE__ */
|
|
1614
|
-
full_address: /* @__PURE__ */
|
|
1615
|
-
place_formatted: /* @__PURE__ */
|
|
1616
|
-
name: /* @__PURE__ */
|
|
1617
|
-
mapbox_id: /* @__PURE__ */
|
|
1618
|
-
context: /* @__PURE__ */
|
|
1621
|
+
feature_type: /* @__PURE__ */ He(/* @__PURE__ */ ce()),
|
|
1622
|
+
full_address: /* @__PURE__ */ He(/* @__PURE__ */ ce()),
|
|
1623
|
+
place_formatted: /* @__PURE__ */ He(/* @__PURE__ */ ce()),
|
|
1624
|
+
name: /* @__PURE__ */ He(/* @__PURE__ */ ce()),
|
|
1625
|
+
mapbox_id: /* @__PURE__ */ ce(),
|
|
1626
|
+
context: /* @__PURE__ */ Ra(
|
|
1619
1627
|
/* @__PURE__ */ Ae({
|
|
1620
1628
|
address: ke,
|
|
1621
1629
|
street: ke,
|
|
@@ -1630,17 +1638,17 @@ const Je = wt(
|
|
|
1630
1638
|
)
|
|
1631
1639
|
})
|
|
1632
1640
|
)
|
|
1633
|
-
}), ja = (e) => (
|
|
1634
|
-
e &&
|
|
1641
|
+
}), ja = (e) => (kt(() => {
|
|
1642
|
+
e && ur(e);
|
|
1635
1643
|
}, [e]), tn(() => {
|
|
1636
1644
|
var r;
|
|
1637
|
-
const t = (r =
|
|
1645
|
+
const t = (r = W.current$.peek().flow) == null ? void 0 : r.data.flowSessionId;
|
|
1638
1646
|
return t ? {
|
|
1639
1647
|
enabled: !0,
|
|
1640
1648
|
getPredictions: async (s, n) => {
|
|
1641
1649
|
var f;
|
|
1642
|
-
const i = e &&
|
|
1643
|
-
return { ...await
|
|
1650
|
+
const i = e && ur(e), a = (f = W.current$.peek().flow) == null ? void 0 : f.locationOrigin, o = a && a.lat !== void 0 && a.lng !== void 0 && Number.isFinite(a.lat) && Number.isFinite(a.lng) && a.lat >= -90 && a.lat <= 90 && a.lng >= -180 && a.lng <= 180;
|
|
1651
|
+
return { ...await _n(
|
|
1644
1652
|
{
|
|
1645
1653
|
query: s,
|
|
1646
1654
|
country: i,
|
|
@@ -1650,28 +1658,28 @@ const Je = wt(
|
|
|
1650
1658
|
signal: n
|
|
1651
1659
|
},
|
|
1652
1660
|
async () => {
|
|
1653
|
-
const h = new URL(
|
|
1654
|
-
return h.searchParams.set("q", s), h.searchParams.set("session_token", t), h.searchParams.set("limit", "5"), o && h.searchParams.set("proximity", `${a.lng},${a.lat}`), h.searchParams.set("access_token",
|
|
1655
|
-
const
|
|
1656
|
-
p &&
|
|
1657
|
-
const w = await fetch(
|
|
1661
|
+
const h = new URL(Na);
|
|
1662
|
+
return h.searchParams.set("q", s), h.searchParams.set("session_token", t), h.searchParams.set("limit", "5"), o && h.searchParams.set("proximity", `${a.lng},${a.lat}`), h.searchParams.set("access_token", $a(Oa)), (await pn(async (p) => {
|
|
1663
|
+
const x = new URL(h);
|
|
1664
|
+
p && x.searchParams.set("country", p);
|
|
1665
|
+
const w = await fetch(x.href, { signal: n });
|
|
1658
1666
|
if (!w.ok) throw new Error(`Address lookup failed with ${w.status}`);
|
|
1659
|
-
return gs(
|
|
1667
|
+
return gs(Ba, await w.json()).suggestions;
|
|
1660
1668
|
}, i, n)).map((p) => {
|
|
1661
|
-
var
|
|
1669
|
+
var x, w, k, A, v, R, N, T, H;
|
|
1662
1670
|
return {
|
|
1663
1671
|
country: i,
|
|
1664
1672
|
// A postcode result has no full address and is named by the postcode itself (PROD-7311).
|
|
1665
1673
|
label: p.full_address ?? ([p.name, p.place_formatted].filter(Boolean).join(", ") || p.mapbox_id),
|
|
1666
1674
|
id: p.mapbox_id,
|
|
1667
1675
|
address: {
|
|
1668
|
-
line1: ((
|
|
1676
|
+
line1: ((x = p.context.address) == null ? void 0 : x.name) ?? ((w = p.context.street) == null ? void 0 : w.name),
|
|
1669
1677
|
line2: void 0,
|
|
1670
|
-
line3: ((k = p.context.neighborhood) == null ? void 0 : k.name) ?? ((
|
|
1671
|
-
city: ((
|
|
1678
|
+
line3: ((k = p.context.neighborhood) == null ? void 0 : k.name) ?? ((A = p.context.locality) == null ? void 0 : A.name),
|
|
1679
|
+
city: ((v = p.context.place) == null ? void 0 : v.name) ?? ((R = p.context.district) == null ? void 0 : R.name),
|
|
1672
1680
|
state: (N = p.context.region) == null ? void 0 : N.name,
|
|
1673
|
-
postcode: ((
|
|
1674
|
-
country: (
|
|
1681
|
+
postcode: ((T = p.context.postcode) == null ? void 0 : T.name) ?? (p.feature_type === "postcode" ? p.name : void 0),
|
|
1682
|
+
country: (H = p.context.country) == null ? void 0 : H.name
|
|
1675
1683
|
}
|
|
1676
1684
|
};
|
|
1677
1685
|
});
|
|
@@ -1679,8 +1687,8 @@ const Je = wt(
|
|
|
1679
1687
|
), country: i };
|
|
1680
1688
|
}
|
|
1681
1689
|
} : { enabled: !1 };
|
|
1682
|
-
}, [e])),
|
|
1683
|
-
const { t } =
|
|
1690
|
+
}, [e])), gr = (e) => {
|
|
1691
|
+
const { t } = ne();
|
|
1684
1692
|
return /* @__PURE__ */ c(
|
|
1685
1693
|
"button",
|
|
1686
1694
|
{
|
|
@@ -1705,107 +1713,107 @@ const Je = wt(
|
|
|
1705
1713
|
]
|
|
1706
1714
|
}
|
|
1707
1715
|
);
|
|
1708
|
-
},
|
|
1716
|
+
}, Pa = ({
|
|
1709
1717
|
input: e,
|
|
1710
1718
|
onSubmitSuccess: t,
|
|
1711
1719
|
logger: r,
|
|
1712
1720
|
analytics: s,
|
|
1713
1721
|
rpcClient: n
|
|
1714
1722
|
}) => {
|
|
1715
|
-
const { t: i } =
|
|
1716
|
-
var
|
|
1717
|
-
(
|
|
1723
|
+
const { t: i } = ne(), [a, o] = Se(), { enabled: l, getPredictions: f } = ja(n), [h, b] = Se(l ? "query" : "manual"), [g, p] = Se(""), [x, w] = Se(), k = fe(), A = () => {
|
|
1724
|
+
var E;
|
|
1725
|
+
(E = k.current) == null || E.controller.abort(), k.current = void 0;
|
|
1718
1726
|
};
|
|
1719
|
-
|
|
1720
|
-
const
|
|
1721
|
-
const
|
|
1722
|
-
if (
|
|
1727
|
+
kt(() => A, []);
|
|
1728
|
+
const v = fe(), R = fe(), N = fe(!1), T = (E) => {
|
|
1729
|
+
const M = E !== null ? v.current : void 0, D = (M == null ? void 0 : M.lookup) ?? R.current;
|
|
1730
|
+
if (D && !N.current) {
|
|
1723
1731
|
N.current = !0;
|
|
1724
|
-
const
|
|
1725
|
-
const
|
|
1726
|
-
return
|
|
1727
|
-
},
|
|
1728
|
-
postcode:
|
|
1729
|
-
label:
|
|
1730
|
-
state:
|
|
1731
|
-
country:
|
|
1732
|
+
const I = ($) => {
|
|
1733
|
+
const B = e.config.keys[$];
|
|
1734
|
+
return E && B ? E.value[B] : void 0;
|
|
1735
|
+
}, C = I("country") ?? (M == null ? void 0 : M.suggestion.address.country) ?? (M == null ? void 0 : M.suggestion.country), L = E && ts({
|
|
1736
|
+
postcode: I("postcode") ?? (M != null && M.edited || a == null ? void 0 : a.postcode),
|
|
1737
|
+
label: M != null && M.edited || M == null ? void 0 : M.suggestion.label,
|
|
1738
|
+
state: I("state") ?? (M != null && M.edited || a == null ? void 0 : a.state),
|
|
1739
|
+
country: C
|
|
1732
1740
|
});
|
|
1733
|
-
|
|
1741
|
+
kn({
|
|
1734
1742
|
kind: "address",
|
|
1735
1743
|
surface: "chatbot",
|
|
1736
|
-
...
|
|
1737
|
-
picked: !!
|
|
1738
|
-
...
|
|
1739
|
-
region:
|
|
1744
|
+
...D,
|
|
1745
|
+
picked: !!M,
|
|
1746
|
+
...M ? { edited: M.edited } : {},
|
|
1747
|
+
region: L ?? (C != null && C.trim() ? "other" : null)
|
|
1740
1748
|
});
|
|
1741
1749
|
}
|
|
1742
|
-
t(
|
|
1743
|
-
},
|
|
1744
|
-
var
|
|
1745
|
-
if (
|
|
1746
|
-
if (
|
|
1750
|
+
t(E);
|
|
1751
|
+
}, H = (E) => {
|
|
1752
|
+
var D;
|
|
1753
|
+
if (je(l, "Query state should not be enabled"), E = E.trim(), E === ((D = k.current) == null ? void 0 : D.query) || E === (x == null ? void 0 : x.query) && x.status === "done") return;
|
|
1754
|
+
if (A(), p(E), E === "") {
|
|
1747
1755
|
w(void 0);
|
|
1748
1756
|
return;
|
|
1749
1757
|
}
|
|
1750
|
-
const
|
|
1751
|
-
w({ query:
|
|
1752
|
-
(
|
|
1753
|
-
k.current ===
|
|
1754
|
-
query:
|
|
1758
|
+
const M = k.current = { query: E, controller: new AbortController() };
|
|
1759
|
+
w({ query: E, status: "pending" }), f(E, M.controller.signal).then(
|
|
1760
|
+
(I) => {
|
|
1761
|
+
k.current === M && (k.current = void 0, R.current = { arm: I.arm, source: I.source }, w({
|
|
1762
|
+
query: E,
|
|
1755
1763
|
status: "done",
|
|
1756
|
-
items:
|
|
1757
|
-
...
|
|
1758
|
-
country:
|
|
1764
|
+
items: I.results,
|
|
1765
|
+
...R.current,
|
|
1766
|
+
country: I.country
|
|
1759
1767
|
}));
|
|
1760
1768
|
},
|
|
1761
|
-
(
|
|
1762
|
-
k.current ===
|
|
1769
|
+
(I) => {
|
|
1770
|
+
k.current === M && (k.current = void 0, R.current = { arm: "direct", source: "direct" }, r.error("Failed to get address details", I instanceof is ? "Unexpected response" : I), w({ query: E, status: "failed", error: i("address_error") }));
|
|
1763
1771
|
}
|
|
1764
1772
|
);
|
|
1765
|
-
},
|
|
1766
|
-
|
|
1773
|
+
}, P = (E, M) => {
|
|
1774
|
+
v.current && (a == null ? void 0 : a[E]) !== M && (v.current.edited = !0), o((D) => ({ ...D, [E]: M }));
|
|
1767
1775
|
};
|
|
1768
1776
|
switch (h) {
|
|
1769
1777
|
case "query":
|
|
1770
|
-
return
|
|
1771
|
-
|
|
1778
|
+
return je(l, "Query state should not be enabled"), /* @__PURE__ */ c(
|
|
1779
|
+
Ua,
|
|
1772
1780
|
{
|
|
1773
1781
|
input: e,
|
|
1774
|
-
onSkip: () =>
|
|
1775
|
-
onAddressSelect: (
|
|
1776
|
-
var
|
|
1777
|
-
if (
|
|
1778
|
-
k.current && (
|
|
1782
|
+
onSkip: () => T(null),
|
|
1783
|
+
onAddressSelect: (E, M) => {
|
|
1784
|
+
var I;
|
|
1785
|
+
if (E === "") {
|
|
1786
|
+
k.current && (A(), w(void 0)), b("manual");
|
|
1779
1787
|
return;
|
|
1780
1788
|
}
|
|
1781
|
-
if ((
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
query:
|
|
1785
|
-
country:
|
|
1786
|
-
pickedLabel:
|
|
1787
|
-
pickedPostcode:
|
|
1788
|
-
pickedCountry:
|
|
1789
|
-
pickedState:
|
|
1790
|
-
log: (
|
|
1791
|
-
}), ((
|
|
1789
|
+
if ((x == null ? void 0 : x.status) !== "done") return;
|
|
1790
|
+
const D = x.items.find((C) => C.id === E);
|
|
1791
|
+
D && (x.arm !== "inploi" && vn({
|
|
1792
|
+
query: M,
|
|
1793
|
+
country: x.country,
|
|
1794
|
+
pickedLabel: D.label,
|
|
1795
|
+
pickedPostcode: D.address.postcode,
|
|
1796
|
+
pickedCountry: D.address.country,
|
|
1797
|
+
pickedState: D.address.state,
|
|
1798
|
+
log: (C) => s.log({ event: "ADDRESS_SHADOW_COMPARED", properties: C })
|
|
1799
|
+
}), ((I = v.current) == null ? void 0 : I.suggestion.id) !== E ? (o(D.address), v.current = { suggestion: D, lookup: { arm: x.arm, source: x.source }, edited: !1 }) : v.current.lookup = { arm: x.arm, source: x.source }, b("details"));
|
|
1792
1800
|
},
|
|
1793
|
-
onAddressSearch:
|
|
1794
|
-
lookup:
|
|
1801
|
+
onAddressSearch: H,
|
|
1802
|
+
lookup: x,
|
|
1795
1803
|
query: g
|
|
1796
1804
|
}
|
|
1797
1805
|
);
|
|
1798
1806
|
case "details":
|
|
1799
|
-
return
|
|
1800
|
-
|
|
1807
|
+
return je(a !== void 0), /* @__PURE__ */ c(
|
|
1808
|
+
vr,
|
|
1801
1809
|
{
|
|
1802
1810
|
input: e,
|
|
1803
1811
|
logger: r,
|
|
1804
|
-
onSubmitSuccess:
|
|
1812
|
+
onSubmitSuccess: T,
|
|
1805
1813
|
addressFields: a,
|
|
1806
|
-
onFieldChange:
|
|
1814
|
+
onFieldChange: P,
|
|
1807
1815
|
actions: /* @__PURE__ */ c(
|
|
1808
|
-
|
|
1816
|
+
gr,
|
|
1809
1817
|
{
|
|
1810
1818
|
onClick: () => {
|
|
1811
1819
|
b("query");
|
|
@@ -1816,15 +1824,15 @@ const Je = wt(
|
|
|
1816
1824
|
);
|
|
1817
1825
|
case "manual":
|
|
1818
1826
|
return /* @__PURE__ */ c(
|
|
1819
|
-
|
|
1827
|
+
vr,
|
|
1820
1828
|
{
|
|
1821
1829
|
logger: r,
|
|
1822
1830
|
input: e,
|
|
1823
|
-
onSubmitSuccess:
|
|
1831
|
+
onSubmitSuccess: T,
|
|
1824
1832
|
addressFields: a ?? {},
|
|
1825
|
-
onFieldChange:
|
|
1833
|
+
onFieldChange: P,
|
|
1826
1834
|
actions: l ? /* @__PURE__ */ c(
|
|
1827
|
-
|
|
1835
|
+
gr,
|
|
1828
1836
|
{
|
|
1829
1837
|
onClick: () => {
|
|
1830
1838
|
b("query");
|
|
@@ -1832,12 +1840,12 @@ const Je = wt(
|
|
|
1832
1840
|
}
|
|
1833
1841
|
) : e.config.optional ? (
|
|
1834
1842
|
// Without address search this is the only screen, so an optional question needs its own way past.
|
|
1835
|
-
/* @__PURE__ */ c(
|
|
1843
|
+
/* @__PURE__ */ c(Ie, { onClick: () => T(null) })
|
|
1836
1844
|
) : void 0
|
|
1837
1845
|
}
|
|
1838
1846
|
);
|
|
1839
1847
|
}
|
|
1840
|
-
},
|
|
1848
|
+
}, Ua = ({
|
|
1841
1849
|
input: e,
|
|
1842
1850
|
onSkip: t,
|
|
1843
1851
|
lookup: r,
|
|
@@ -1845,7 +1853,7 @@ const Je = wt(
|
|
|
1845
1853
|
query: n,
|
|
1846
1854
|
onAddressSearch: i
|
|
1847
1855
|
}) => {
|
|
1848
|
-
const { t: a } =
|
|
1856
|
+
const { t: a } = ne(), o = fe(null);
|
|
1849
1857
|
return Re(() => {
|
|
1850
1858
|
o.current && (o.current.focus(), o.current.select());
|
|
1851
1859
|
}, []), /* @__PURE__ */ c(ge, { children: [
|
|
@@ -1900,7 +1908,7 @@ const Je = wt(
|
|
|
1900
1908
|
}
|
|
1901
1909
|
)
|
|
1902
1910
|
] }),
|
|
1903
|
-
e.config.optional && /* @__PURE__ */ c(
|
|
1911
|
+
e.config.optional && /* @__PURE__ */ c(Ie, { class: "relative", onClick: t })
|
|
1904
1912
|
]
|
|
1905
1913
|
}
|
|
1906
1914
|
),
|
|
@@ -1911,7 +1919,7 @@ const Je = wt(
|
|
|
1911
1919
|
role: "status",
|
|
1912
1920
|
class: (r == null ? void 0 : r.status) === "pending" || (r == null ? void 0 : r.status) === "done" && r.items.length === 0 ? "text-neutral-11 flex items-center gap-2 px-4 py-2 text-sm" : "sr-only",
|
|
1913
1921
|
children: (r == null ? void 0 : r.status) === "pending" ? /* @__PURE__ */ c(ge, { children: [
|
|
1914
|
-
/* @__PURE__ */ c(
|
|
1922
|
+
/* @__PURE__ */ c(Ht, { "aria-hidden": "true", class: "h-4 w-4 shrink-0" }),
|
|
1915
1923
|
a("address_searching")
|
|
1916
1924
|
] }) : (r == null ? void 0 : r.status) === "done" && r.items.length === 0 ? a("address_no_results") : null
|
|
1917
1925
|
}
|
|
@@ -1957,7 +1965,7 @@ const Je = wt(
|
|
|
1957
1965
|
) }, "")
|
|
1958
1966
|
] })
|
|
1959
1967
|
] });
|
|
1960
|
-
},
|
|
1968
|
+
}, Ot = ["line1", "line2", "line3", "city", "state", "postcode", "country"], vr = ({
|
|
1961
1969
|
addressFields: e,
|
|
1962
1970
|
onFieldChange: t,
|
|
1963
1971
|
onSubmitSuccess: r,
|
|
@@ -1971,7 +1979,7 @@ const Je = wt(
|
|
|
1971
1979
|
l && (l.focus(), l.select());
|
|
1972
1980
|
}
|
|
1973
1981
|
}, []);
|
|
1974
|
-
const a = Object.keys(
|
|
1982
|
+
const a = Object.keys(Yt), { t: o } = ne();
|
|
1975
1983
|
return /* @__PURE__ */ c(
|
|
1976
1984
|
"form",
|
|
1977
1985
|
{
|
|
@@ -1981,8 +1989,8 @@ const Je = wt(
|
|
|
1981
1989
|
const f = l.currentTarget, h = [...f.querySelectorAll("input")].filter((p) => p.value !== "" && !p.value.trim());
|
|
1982
1990
|
for (const p of h) {
|
|
1983
1991
|
p.value = "";
|
|
1984
|
-
const
|
|
1985
|
-
|
|
1992
|
+
const x = Ot.find((w) => n.config.keys[w] === p.name);
|
|
1993
|
+
x && t(x, "");
|
|
1986
1994
|
}
|
|
1987
1995
|
if (h.length > 0 && !f.checkValidity()) {
|
|
1988
1996
|
f.reportValidity();
|
|
@@ -1997,7 +2005,7 @@ const Je = wt(
|
|
|
1997
2005
|
{
|
|
1998
2006
|
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]",
|
|
1999
2007
|
ref: i,
|
|
2000
|
-
children:
|
|
2008
|
+
children: Ot.map((l, f) => {
|
|
2001
2009
|
const h = `isdk_${l}`, b = n.config.keys[l];
|
|
2002
2010
|
return b ? /* @__PURE__ */ c(ge, { children: [
|
|
2003
2011
|
/* @__PURE__ */ c(
|
|
@@ -2053,7 +2061,7 @@ const Je = wt(
|
|
|
2053
2061
|
required: l === "line2" ? n.config.line2Required === !0 : l !== "line3"
|
|
2054
2062
|
}
|
|
2055
2063
|
),
|
|
2056
|
-
f ===
|
|
2064
|
+
f === Ot.length - 1 ? /* @__PURE__ */ c("hr", { class: "m-0 w-full border-b border-b-transparent" }) : /* @__PURE__ */ c("hr", { class: "border-b-neutral-5 m-0 w-full border-b border-solid" })
|
|
2057
2065
|
] })
|
|
2058
2066
|
] }) : null;
|
|
2059
2067
|
})
|
|
@@ -2066,13 +2074,13 @@ const Je = wt(
|
|
|
2066
2074
|
]
|
|
2067
2075
|
}
|
|
2068
2076
|
);
|
|
2069
|
-
},
|
|
2077
|
+
}, Qt = () => {
|
|
2070
2078
|
const e = fe(null);
|
|
2071
|
-
return
|
|
2079
|
+
return kt(() => {
|
|
2072
2080
|
var t;
|
|
2073
2081
|
(t = e.current) == null || t.focus();
|
|
2074
2082
|
}, []), e;
|
|
2075
|
-
}, vs = ["true", "false"],
|
|
2083
|
+
}, vs = ["true", "false"], qa = /* @__PURE__ */ ys(vs), za = "answer", xs = "flex items-center flex-wrap gap-2 p-2.5", ws = "min-w-0 max-w-full flex-auto", _s = Xr(
|
|
2076
2084
|
({ label: e, ...t }, r) => /* @__PURE__ */ c(
|
|
2077
2085
|
"button",
|
|
2078
2086
|
{
|
|
@@ -2082,8 +2090,8 @@ const Je = wt(
|
|
|
2082
2090
|
children: /* @__PURE__ */ c("p", { class: "text-center text-base", children: e })
|
|
2083
2091
|
}
|
|
2084
2092
|
)
|
|
2085
|
-
),
|
|
2086
|
-
const r =
|
|
2093
|
+
), Wa = ({ input: e, onSubmitSuccess: t }) => {
|
|
2094
|
+
const r = Qt();
|
|
2087
2095
|
return /* @__PURE__ */ c(
|
|
2088
2096
|
"form",
|
|
2089
2097
|
{
|
|
@@ -2091,7 +2099,7 @@ const Je = wt(
|
|
|
2091
2099
|
class: "",
|
|
2092
2100
|
onSubmit: (s) => {
|
|
2093
2101
|
s.preventDefault();
|
|
2094
|
-
const n = rn(s).value, i = gs(
|
|
2102
|
+
const n = rn(s).value, i = gs(qa, n);
|
|
2095
2103
|
t({ type: "boolean", value: i === "true" });
|
|
2096
2104
|
},
|
|
2097
2105
|
children: [
|
|
@@ -2100,25 +2108,25 @@ const Je = wt(
|
|
|
2100
2108
|
{
|
|
2101
2109
|
ref: n === 0 ? r : null,
|
|
2102
2110
|
type: "submit",
|
|
2103
|
-
name:
|
|
2111
|
+
name: za,
|
|
2104
2112
|
value: s,
|
|
2105
2113
|
label: e.config.labels[s]
|
|
2106
2114
|
},
|
|
2107
2115
|
s
|
|
2108
2116
|
) })) }),
|
|
2109
|
-
e.config.optional && /* @__PURE__ */ c("div", { class: "px-2 pb-2", children: /* @__PURE__ */ c(
|
|
2117
|
+
e.config.optional && /* @__PURE__ */ c("div", { class: "px-2 pb-2", children: /* @__PURE__ */ c(Ie, { class: "relative w-full", type: "button", onClick: () => t(null) }) })
|
|
2110
2118
|
]
|
|
2111
2119
|
}
|
|
2112
2120
|
);
|
|
2113
|
-
},
|
|
2121
|
+
}, xr = (e) => e.reduce((t, r) => t + r.sizeKb, 0), Ha = Xe("file"), wr = 3, Ct = (e) => {
|
|
2114
2122
|
const t = e.lastIndexOf(".");
|
|
2115
2123
|
return t === -1 ? [e, ""] : [e.slice(0, t), e.slice(t)];
|
|
2116
|
-
},
|
|
2124
|
+
}, Ga = ({
|
|
2117
2125
|
file: e,
|
|
2118
2126
|
class: t,
|
|
2119
2127
|
...r
|
|
2120
2128
|
}) => {
|
|
2121
|
-
const { t: s } =
|
|
2129
|
+
const { t: s } = ne(), [n, i] = Ct(e.name);
|
|
2122
2130
|
return /* @__PURE__ */ c(
|
|
2123
2131
|
"div",
|
|
2124
2132
|
{
|
|
@@ -2141,12 +2149,12 @@ const Je = wt(
|
|
|
2141
2149
|
s("file_size"),
|
|
2142
2150
|
": "
|
|
2143
2151
|
] }),
|
|
2144
|
-
|
|
2152
|
+
We(e.sizeKb)
|
|
2145
2153
|
] })
|
|
2146
2154
|
]
|
|
2147
2155
|
}
|
|
2148
2156
|
);
|
|
2149
|
-
},
|
|
2157
|
+
}, _r = ({ class: e, ...t }) => /* @__PURE__ */ c(
|
|
2150
2158
|
"li",
|
|
2151
2159
|
{
|
|
2152
2160
|
class: Ze(
|
|
@@ -2155,10 +2163,10 @@ const Je = wt(
|
|
|
2155
2163
|
),
|
|
2156
2164
|
...t
|
|
2157
2165
|
}
|
|
2158
|
-
),
|
|
2159
|
-
const [r, s] =
|
|
2166
|
+
), Ka = (e, t) => {
|
|
2167
|
+
const [r, s] = Ct(e);
|
|
2160
2168
|
return `${r.slice(0, t)}${s}`;
|
|
2161
|
-
},
|
|
2169
|
+
}, bt = (e) => ({ name: Ka(e.name, 42), sizeKb: e.size / 1e3 }), Ja = [
|
|
2162
2170
|
".heic",
|
|
2163
2171
|
".heif",
|
|
2164
2172
|
".jpg",
|
|
@@ -2171,53 +2179,53 @@ const Je = wt(
|
|
|
2171
2179
|
".odt",
|
|
2172
2180
|
".pages",
|
|
2173
2181
|
".zip"
|
|
2174
|
-
],
|
|
2175
|
-
const s =
|
|
2182
|
+
], Za = (e, t, r) => {
|
|
2183
|
+
const s = Ct(t.name)[1].toLowerCase(), n = [...r.map((a) => a.toLowerCase()), ...Ja], i = s === "" ? "none" : n.includes(s) ? s : "other";
|
|
2176
2184
|
return `chatbot-file-refused:${e}:${i}`;
|
|
2177
|
-
},
|
|
2185
|
+
}, Xa = ({ input: e, onSubmitSuccess: t, analytics: r }) => {
|
|
2178
2186
|
var k;
|
|
2179
|
-
const s = (k =
|
|
2180
|
-
|
|
2181
|
-
), a = fe(0), o = n.status === "ready" ? n.files : [], l = n.status === "ready" || n.status === "pending" ? n.files : [], f = n.status === "error" ? n.error : void 0, h = l.length -
|
|
2182
|
-
if (!
|
|
2183
|
-
if (!
|
|
2187
|
+
const s = (k = W.current$.value.flow) == null ? void 0 : k.data.submissions[e.key], [n, i] = Se(
|
|
2188
|
+
Ha(s) && s.value.length ? { status: "ready", files: s.value } : { status: "empty" }
|
|
2189
|
+
), a = fe(0), o = n.status === "ready" ? n.files : [], l = n.status === "ready" || n.status === "pending" ? n.files : [], f = n.status === "error" ? n.error : void 0, h = l.length - wr, b = xr(l), g = Qt(), { t: p } = ne(), x = (A, v = e.config.extensions) => {
|
|
2190
|
+
if (!A.length) return { reason: "required", error: { type: "required", message: p("validation_file") } };
|
|
2191
|
+
if (!Lt(A, v))
|
|
2184
2192
|
return {
|
|
2185
2193
|
reason: "type",
|
|
2186
|
-
file:
|
|
2194
|
+
file: A.find((R) => !Lt([R], v)),
|
|
2187
2195
|
error: { type: "validate", message: p("validation_file_ext", { ext: e.config.extensions.join(", ") }) }
|
|
2188
2196
|
};
|
|
2189
|
-
if (
|
|
2197
|
+
if (A.some((R) => R.sizeKb === 0))
|
|
2190
2198
|
return {
|
|
2191
2199
|
reason: "empty",
|
|
2192
|
-
file:
|
|
2200
|
+
file: A.find((R) => R.sizeKb === 0),
|
|
2193
2201
|
error: { type: "validate", message: p("validation_file_empty") }
|
|
2194
2202
|
};
|
|
2195
|
-
if (e.config.fileSizeLimitKib &&
|
|
2203
|
+
if (e.config.fileSizeLimitKib && xr(A) > e.config.fileSizeLimitKib)
|
|
2196
2204
|
return {
|
|
2197
2205
|
reason: "size",
|
|
2198
2206
|
error: {
|
|
2199
2207
|
type: "max",
|
|
2200
|
-
message: p("validation_file_size", { size:
|
|
2208
|
+
message: p("validation_file_size", { size: We(e.config.fileSizeLimitKib) })
|
|
2201
2209
|
}
|
|
2202
2210
|
};
|
|
2203
|
-
if (!e.config.allowMultiple &&
|
|
2211
|
+
if (!e.config.allowMultiple && A.length > 1)
|
|
2204
2212
|
return { reason: "count", error: { type: "invalid", message: p("validation_file_max", { count: 1 }) } };
|
|
2205
|
-
}, w = (
|
|
2206
|
-
var
|
|
2213
|
+
}, w = (A, v) => {
|
|
2214
|
+
var R, N;
|
|
2207
2215
|
return r.log({
|
|
2208
2216
|
event: "INTERACTION",
|
|
2209
|
-
properties: { tag:
|
|
2210
|
-
customProperties: (N = (
|
|
2217
|
+
properties: { tag: Za(A, v, e.config.extensions) },
|
|
2218
|
+
customProperties: (N = (R = W.current$.peek().flow) == null ? void 0 : R.analytics) == null ? void 0 : N.customProperties
|
|
2211
2219
|
});
|
|
2212
2220
|
};
|
|
2213
2221
|
return /* @__PURE__ */ c(
|
|
2214
2222
|
"form",
|
|
2215
2223
|
{
|
|
2216
2224
|
class: "flex flex-col gap-1 p-2.5",
|
|
2217
|
-
onSubmit: (
|
|
2218
|
-
if (
|
|
2219
|
-
const
|
|
2220
|
-
|
|
2225
|
+
onSubmit: (A) => {
|
|
2226
|
+
if (A.preventDefault(), n.status === "pending" || n.status === "error") return;
|
|
2227
|
+
const v = x(o);
|
|
2228
|
+
v ? i({ status: "error", error: v.error }) : t({ type: "file", value: o });
|
|
2221
2229
|
},
|
|
2222
2230
|
children: [
|
|
2223
2231
|
/* @__PURE__ */ c("div", { class: "flex items-center gap-2", children: [
|
|
@@ -2229,14 +2237,14 @@ const Je = wt(
|
|
|
2229
2237
|
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",
|
|
2230
2238
|
children: [
|
|
2231
2239
|
l.length > 0 ? /* @__PURE__ */ c("ul", { class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1", children: [
|
|
2232
|
-
l.slice(0,
|
|
2233
|
-
const [
|
|
2234
|
-
return /* @__PURE__ */ c(
|
|
2235
|
-
/* @__PURE__ */ c("span", { class: "block truncate", children:
|
|
2236
|
-
/* @__PURE__ */ c("span", { children:
|
|
2240
|
+
l.slice(0, wr).map((A) => {
|
|
2241
|
+
const [v, R] = Ct(A.name);
|
|
2242
|
+
return /* @__PURE__ */ c(_r, { class: "flex overflow-hidden", children: [
|
|
2243
|
+
/* @__PURE__ */ c("span", { class: "block truncate", children: v }),
|
|
2244
|
+
/* @__PURE__ */ c("span", { children: R })
|
|
2237
2245
|
] });
|
|
2238
2246
|
}),
|
|
2239
|
-
h > 0 ? /* @__PURE__ */ c(
|
|
2247
|
+
h > 0 ? /* @__PURE__ */ c(_r, { children: p("file_more", { count: h }) }) : null
|
|
2240
2248
|
] }) : /* @__PURE__ */ c("div", { class: "flex flex-col justify-center gap-4 pb-6 pt-5", children: [
|
|
2241
2249
|
/* @__PURE__ */ c("header", { class: "flex flex-col items-center gap-0", children: [
|
|
2242
2250
|
/* @__PURE__ */ c(
|
|
@@ -2262,13 +2270,13 @@ const Je = wt(
|
|
|
2262
2270
|
/* @__PURE__ */ c("p", { class: "text-neutral-12 tracking-[-0.01em]", children: p("upload_file", { count: e.config.allowMultiple ? 2 : 1 }) }),
|
|
2263
2271
|
e.config.fileSizeLimitKib ? /* @__PURE__ */ c("p", { class: "text-neutral-11 text-xs", children: [
|
|
2264
2272
|
"(",
|
|
2265
|
-
p("file_max_size", { size:
|
|
2273
|
+
p("file_max_size", { size: We(e.config.fileSizeLimitKib) }),
|
|
2266
2274
|
")"
|
|
2267
2275
|
] }) : null
|
|
2268
2276
|
] }),
|
|
2269
2277
|
/* @__PURE__ */ c("aside", { class: "flex flex-col items-center gap-2", children: [
|
|
2270
2278
|
/* @__PURE__ */ c("p", { id: "accepted-filetypes", class: "sr-only", children: p("file_extensions") }),
|
|
2271
|
-
/* @__PURE__ */ c("ul", { "aria-describedby": "accepted-filetypes", class: "flex flex-wrap justify-center gap-2", children: e.config.extensions.map((
|
|
2279
|
+
/* @__PURE__ */ c("ul", { "aria-describedby": "accepted-filetypes", class: "flex flex-wrap justify-center gap-2", children: e.config.extensions.map((A) => /* @__PURE__ */ c("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(".", "") })) })
|
|
2272
2280
|
] })
|
|
2273
2281
|
] }),
|
|
2274
2282
|
/* @__PURE__ */ c(
|
|
@@ -2277,10 +2285,10 @@ const Je = wt(
|
|
|
2277
2285
|
role: "status",
|
|
2278
2286
|
class: Ze("text-neutral-11 flex items-center gap-1.5 text-xs", l.length === 0 && "sr-only"),
|
|
2279
2287
|
children: n.status === "pending" ? /* @__PURE__ */ c(ge, { children: [
|
|
2280
|
-
/* @__PURE__ */ c(
|
|
2288
|
+
/* @__PURE__ */ c(Ht, { "aria-hidden": "true", class: "h-4 w-4" }),
|
|
2281
2289
|
p("file_preparing", { count: l.length })
|
|
2282
2290
|
] }) : n.status === "ready" ? /* @__PURE__ */ c(ge, { children: [
|
|
2283
|
-
o.length > 1 ? p("file_total_size", { size:
|
|
2291
|
+
o.length > 1 ? p("file_total_size", { size: We(b) }) : We(b),
|
|
2284
2292
|
/* @__PURE__ */ c("span", { class: "sr-only", children: [
|
|
2285
2293
|
". ",
|
|
2286
2294
|
p("file_ready", { count: o.length })
|
|
@@ -2293,41 +2301,67 @@ const Je = wt(
|
|
|
2293
2301
|
{
|
|
2294
2302
|
id: "dropzone-file",
|
|
2295
2303
|
"aria-label": p("upload_file", { count: e.config.allowMultiple ? 2 : 1 }),
|
|
2296
|
-
onInput: async (
|
|
2297
|
-
|
|
2298
|
-
const
|
|
2299
|
-
|
|
2300
|
-
const
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2304
|
+
onInput: async (A) => {
|
|
2305
|
+
je(A.target instanceof HTMLInputElement);
|
|
2306
|
+
const v = A.target.files ? Array.from(A.target.files) : [];
|
|
2307
|
+
if (A.target.value = "", !v[0]) return;
|
|
2308
|
+
const R = ++a.current, N = n.status === "ready";
|
|
2309
|
+
let T = v;
|
|
2310
|
+
if (!Lt(v, e.config.extensions)) {
|
|
2311
|
+
const D = x(v.map(bt), []);
|
|
2312
|
+
if (D)
|
|
2313
|
+
return w(D.reason, D.file ?? v[0]), i({ status: "error", error: D.error });
|
|
2314
|
+
i({ status: "pending", files: v.map(bt) });
|
|
2315
|
+
let I;
|
|
2316
|
+
try {
|
|
2317
|
+
T = await Promise.all(
|
|
2318
|
+
v.map(
|
|
2319
|
+
(C) => nn(C, e.config.extensions).catch((L) => {
|
|
2320
|
+
throw I ?? (I = C), L;
|
|
2321
|
+
})
|
|
2322
|
+
)
|
|
2323
|
+
);
|
|
2324
|
+
} catch {
|
|
2325
|
+
return a.current !== R ? void 0 : (w("unreadable", I ?? v[0]), i({
|
|
2326
|
+
status: "error",
|
|
2327
|
+
error: {
|
|
2328
|
+
type: "invalid",
|
|
2329
|
+
message: p(N ? "file_read_error_replacement" : "file_read_error")
|
|
2330
|
+
}
|
|
2331
|
+
}));
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
const [H] = T;
|
|
2335
|
+
if (!H || a.current !== R) return;
|
|
2336
|
+
const P = T.map(bt), E = x(P);
|
|
2337
|
+
if (E)
|
|
2338
|
+
return w(E.reason, E.file ?? H), i({ status: "error", error: E.error });
|
|
2339
|
+
i({ status: "pending", files: P });
|
|
2340
|
+
let M;
|
|
2307
2341
|
try {
|
|
2308
|
-
const
|
|
2309
|
-
|
|
2342
|
+
const D = await Promise.all(
|
|
2343
|
+
T.map(async (I) => {
|
|
2310
2344
|
try {
|
|
2311
|
-
return { ...
|
|
2312
|
-
} catch (
|
|
2313
|
-
throw
|
|
2345
|
+
return { ...bt(I), data: await an(I) };
|
|
2346
|
+
} catch (C) {
|
|
2347
|
+
throw M ?? (M = I), C;
|
|
2314
2348
|
}
|
|
2315
2349
|
})
|
|
2316
2350
|
);
|
|
2317
|
-
a.current ===
|
|
2351
|
+
a.current === R && i({ status: "ready", files: D });
|
|
2318
2352
|
} catch {
|
|
2319
|
-
if (a.current !==
|
|
2320
|
-
w("unreadable",
|
|
2353
|
+
if (a.current !== R) return;
|
|
2354
|
+
w("unreadable", M ?? H), i({
|
|
2321
2355
|
status: "error",
|
|
2322
2356
|
error: {
|
|
2323
2357
|
type: "invalid",
|
|
2324
|
-
message: p(
|
|
2358
|
+
message: p(N ? "file_read_error_replacement" : "file_read_error")
|
|
2325
2359
|
}
|
|
2326
2360
|
});
|
|
2327
2361
|
}
|
|
2328
2362
|
},
|
|
2329
2363
|
multiple: e.config.allowMultiple,
|
|
2330
|
-
accept: e.config.extensions
|
|
2364
|
+
accept: sn(e.config.extensions),
|
|
2331
2365
|
type: "file",
|
|
2332
2366
|
class: "sr-only"
|
|
2333
2367
|
}
|
|
@@ -2337,7 +2371,7 @@ const Je = wt(
|
|
|
2337
2371
|
),
|
|
2338
2372
|
/* @__PURE__ */ c("div", { class: "flex h-full flex-col items-center gap-2", children: [
|
|
2339
2373
|
/* @__PURE__ */ c(Pe, { disabled: o.length === 0 }),
|
|
2340
|
-
e.config.optional && /* @__PURE__ */ c(
|
|
2374
|
+
e.config.optional && /* @__PURE__ */ c(Ie, { class: "relative", onClick: () => t(null) })
|
|
2341
2375
|
] })
|
|
2342
2376
|
] }),
|
|
2343
2377
|
/* @__PURE__ */ c(Ye, { error: f })
|
|
@@ -2345,40 +2379,40 @@ const Je = wt(
|
|
|
2345
2379
|
}
|
|
2346
2380
|
);
|
|
2347
2381
|
};
|
|
2348
|
-
var ht = (e) => e.type === "checkbox",
|
|
2382
|
+
var ht = (e) => e.type === "checkbox", Be = (e) => e instanceof Date, le = (e) => e == null;
|
|
2349
2383
|
const ks = (e) => typeof e == "object";
|
|
2350
|
-
var
|
|
2384
|
+
var ee = (e) => !le(e) && !Array.isArray(e) && ks(e) && !Be(e), Ya = (e) => ee(e) && e.target ? ht(e.target) ? e.target.checked : e.target.value : e, Qa = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ei = (e, t) => e.has(Qa(t)), ti = (e) => {
|
|
2351
2385
|
const t = e.constructor && e.constructor.prototype;
|
|
2352
|
-
return
|
|
2353
|
-
},
|
|
2354
|
-
function
|
|
2386
|
+
return ee(t) && t.hasOwnProperty("isPrototypeOf");
|
|
2387
|
+
}, er = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
2388
|
+
function re(e) {
|
|
2355
2389
|
if (e instanceof Date)
|
|
2356
2390
|
return new Date(e);
|
|
2357
2391
|
const t = typeof FileList < "u" && e instanceof FileList;
|
|
2358
|
-
if (
|
|
2392
|
+
if (er && (e instanceof Blob || t))
|
|
2359
2393
|
return e;
|
|
2360
2394
|
const r = Array.isArray(e);
|
|
2361
|
-
if (!r && !(
|
|
2395
|
+
if (!r && !(ee(e) && ti(e)))
|
|
2362
2396
|
return e;
|
|
2363
2397
|
const s = r ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2364
2398
|
for (const n in e)
|
|
2365
|
-
Object.prototype.hasOwnProperty.call(e, n) && (s[n] =
|
|
2399
|
+
Object.prototype.hasOwnProperty.call(e, n) && (s[n] = re(e[n]));
|
|
2366
2400
|
return s;
|
|
2367
2401
|
}
|
|
2368
|
-
var
|
|
2369
|
-
if (!t || !
|
|
2402
|
+
var St = (e) => /^\w*$/.test(e), Y = (e) => e === void 0, tr = (e) => Array.isArray(e) ? e.filter(Boolean) : [], rr = (e) => tr(e.replace(/["|']|\]/g, "").split(/\.|\[/)), V = (e, t, r) => {
|
|
2403
|
+
if (!t || !ee(e))
|
|
2370
2404
|
return r;
|
|
2371
|
-
const s = (
|
|
2372
|
-
return
|
|
2373
|
-
}, be = (e) => typeof e == "boolean", he = (e) => typeof e == "function",
|
|
2405
|
+
const s = (St(t) ? [t] : rr(t)).reduce((n, i) => le(n) ? n : n[i], e);
|
|
2406
|
+
return Y(s) || s === e ? Y(e[t]) ? r : e[t] : s;
|
|
2407
|
+
}, be = (e) => typeof e == "boolean", he = (e) => typeof e == "function", J = (e, t, r) => {
|
|
2374
2408
|
let s = -1;
|
|
2375
|
-
const n =
|
|
2409
|
+
const n = St(t) ? [t] : rr(t), i = n.length, a = i - 1;
|
|
2376
2410
|
for (; ++s < i; ) {
|
|
2377
2411
|
const o = n[s];
|
|
2378
2412
|
let l = r;
|
|
2379
2413
|
if (s !== a) {
|
|
2380
2414
|
const f = e[o];
|
|
2381
|
-
l =
|
|
2415
|
+
l = ee(f) || Array.isArray(f) ? f : isNaN(+n[s + 1]) ? {} : [];
|
|
2382
2416
|
}
|
|
2383
2417
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
2384
2418
|
return;
|
|
@@ -2402,9 +2436,9 @@ const kr = {
|
|
|
2402
2436
|
pattern: "pattern",
|
|
2403
2437
|
required: "required",
|
|
2404
2438
|
validate: "validate"
|
|
2405
|
-
},
|
|
2406
|
-
|
|
2407
|
-
var
|
|
2439
|
+
}, ri = ie.createContext(null);
|
|
2440
|
+
ri.displayName = "HookFormControlContext";
|
|
2441
|
+
var si = (e, t, r, s = !0) => {
|
|
2408
2442
|
const n = {
|
|
2409
2443
|
defaultValues: t._defaultValues
|
|
2410
2444
|
};
|
|
@@ -2417,12 +2451,12 @@ var ti = (e, t, r, s = !0) => {
|
|
|
2417
2451
|
});
|
|
2418
2452
|
return n;
|
|
2419
2453
|
};
|
|
2420
|
-
const
|
|
2421
|
-
var de = (e) => typeof e == "string",
|
|
2454
|
+
const ni = typeof window < "u" ? ie.useLayoutEffect : ie.useEffect;
|
|
2455
|
+
var de = (e) => typeof e == "string", ai = (e, t, r, s, n) => de(e) ? (s && t.watch.add(e), V(r, e, n)) : Array.isArray(e) ? e.map((i) => (s && t.watch.add(i), V(r, i))) : (s && (t.watchAll = !0), r), zt = (e) => le(e) || !ks(e);
|
|
2422
2456
|
function Le(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
2423
|
-
if (
|
|
2457
|
+
if (zt(e) || zt(t))
|
|
2424
2458
|
return Object.is(e, t);
|
|
2425
|
-
if (
|
|
2459
|
+
if (Be(e) && Be(t))
|
|
2426
2460
|
return Object.is(e.getTime(), t.getTime());
|
|
2427
2461
|
const s = Object.keys(e), n = Object.keys(t);
|
|
2428
2462
|
if (s.length !== n.length)
|
|
@@ -2436,14 +2470,14 @@ function Le(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
|
2436
2470
|
return !1;
|
|
2437
2471
|
if (i !== "ref") {
|
|
2438
2472
|
const o = t[i];
|
|
2439
|
-
if (
|
|
2473
|
+
if (Be(a) && Be(o) || ee(a) && ee(o) || Array.isArray(a) && Array.isArray(o) ? !Le(a, o, r) : !Object.is(a, o))
|
|
2440
2474
|
return !1;
|
|
2441
2475
|
}
|
|
2442
2476
|
}
|
|
2443
2477
|
return !0;
|
|
2444
2478
|
}
|
|
2445
|
-
const
|
|
2446
|
-
|
|
2479
|
+
const ii = ie.createContext(null);
|
|
2480
|
+
ii.displayName = "HookFormContext";
|
|
2447
2481
|
var Cs = (e, t, r, s, n) => t ? {
|
|
2448
2482
|
...r[e],
|
|
2449
2483
|
types: {
|
|
@@ -2475,58 +2509,58 @@ function Ss(e, t) {
|
|
|
2475
2509
|
for (const s in e)
|
|
2476
2510
|
if (e.hasOwnProperty(s)) {
|
|
2477
2511
|
const n = e[s], i = t[s];
|
|
2478
|
-
if (n &&
|
|
2512
|
+
if (n && ee(n) && i) {
|
|
2479
2513
|
const a = Ss(n, i);
|
|
2480
|
-
|
|
2514
|
+
ee(a) && (r[s] = a);
|
|
2481
2515
|
} else e[s] && (r[s] = i);
|
|
2482
2516
|
}
|
|
2483
2517
|
return r;
|
|
2484
2518
|
}
|
|
2485
|
-
var
|
|
2486
|
-
if (!
|
|
2519
|
+
var oe = (e) => ee(e) && !Object.keys(e).length, sr = (e) => e.type === "file", vt = (e) => {
|
|
2520
|
+
if (!er)
|
|
2487
2521
|
return !1;
|
|
2488
2522
|
const t = e ? e.ownerDocument : 0;
|
|
2489
2523
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
2490
|
-
}, As = (e) => e.type === "select-multiple",
|
|
2491
|
-
function
|
|
2524
|
+
}, As = (e) => e.type === "select-multiple", nr = (e) => e.type === "radio", oi = (e) => nr(e) || ht(e), $t = (e) => vt(e) && e.isConnected;
|
|
2525
|
+
function li(e, t) {
|
|
2492
2526
|
const r = t.slice(0, -1).length;
|
|
2493
2527
|
let s = 0;
|
|
2494
2528
|
for (; s < r; )
|
|
2495
|
-
e =
|
|
2529
|
+
e = Y(e) ? s++ : e[t[s++]];
|
|
2496
2530
|
return e;
|
|
2497
2531
|
}
|
|
2498
|
-
function
|
|
2532
|
+
function ci(e) {
|
|
2499
2533
|
for (const t in e)
|
|
2500
|
-
if (e.hasOwnProperty(t) && !
|
|
2534
|
+
if (e.hasOwnProperty(t) && !Y(e[t]))
|
|
2501
2535
|
return !1;
|
|
2502
2536
|
return !0;
|
|
2503
2537
|
}
|
|
2504
|
-
function
|
|
2505
|
-
const r = Array.isArray(t) ? t :
|
|
2506
|
-
return s && delete s[i], n !== 0 && (
|
|
2538
|
+
function Q(e, t) {
|
|
2539
|
+
const r = Array.isArray(t) ? t : St(t) ? [t] : rr(t), s = r.length === 1 ? e : li(e, r), n = r.length - 1, i = r[n];
|
|
2540
|
+
return s && delete s[i], n !== 0 && (ee(s) && oe(s) || Array.isArray(s) && ci(s)) && Q(e, r.slice(0, -1)), e;
|
|
2507
2541
|
}
|
|
2508
|
-
var
|
|
2542
|
+
var ui = (e) => {
|
|
2509
2543
|
for (const t in e)
|
|
2510
2544
|
if (he(e[t]))
|
|
2511
2545
|
return !0;
|
|
2512
2546
|
return !1;
|
|
2513
2547
|
};
|
|
2514
|
-
function
|
|
2515
|
-
return Array.isArray(e) ||
|
|
2548
|
+
function Is(e) {
|
|
2549
|
+
return Array.isArray(e) || ee(e) && !ui(e);
|
|
2516
2550
|
}
|
|
2517
|
-
function
|
|
2551
|
+
function Wt(e, t = {}) {
|
|
2518
2552
|
for (const r in e) {
|
|
2519
2553
|
const s = e[r];
|
|
2520
|
-
|
|
2554
|
+
Is(s) ? (t[r] = Array.isArray(s) ? [] : {}, Wt(s, t[r])) : Y(s) || (t[r] = !0);
|
|
2521
2555
|
}
|
|
2522
2556
|
return t;
|
|
2523
2557
|
}
|
|
2524
2558
|
function ze(e, t, r) {
|
|
2525
|
-
r || (r =
|
|
2559
|
+
r || (r = Wt(t));
|
|
2526
2560
|
for (const s in e) {
|
|
2527
2561
|
const n = e[s];
|
|
2528
|
-
if (
|
|
2529
|
-
|
|
2562
|
+
if (Is(n))
|
|
2563
|
+
Y(t) || zt(r[s]) ? r[s] = Wt(n, Array.isArray(n) ? [] : {}) : ze(n, le(t) ? {} : t[s], r[s]);
|
|
2530
2564
|
else {
|
|
2531
2565
|
const i = t[s];
|
|
2532
2566
|
r[s] = !Le(n, i);
|
|
@@ -2538,7 +2572,7 @@ const Sr = {
|
|
|
2538
2572
|
value: !1,
|
|
2539
2573
|
isValid: !1
|
|
2540
2574
|
}, Ar = { value: !0, isValid: !0 };
|
|
2541
|
-
var
|
|
2575
|
+
var Es = (e) => {
|
|
2542
2576
|
if (Array.isArray(e)) {
|
|
2543
2577
|
if (e.length > 1) {
|
|
2544
2578
|
const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
@@ -2546,28 +2580,28 @@ var Is = (e) => {
|
|
|
2546
2580
|
}
|
|
2547
2581
|
return e[0].checked && !e[0].disabled ? (
|
|
2548
2582
|
// @ts-expect-error expected to work in the browser
|
|
2549
|
-
e[0].attributes && !
|
|
2583
|
+
e[0].attributes && !Y(e[0].attributes.value) ? Y(e[0].value) || e[0].value === "" ? Ar : { value: e[0].value, isValid: !0 } : Ar
|
|
2550
2584
|
) : Sr;
|
|
2551
2585
|
}
|
|
2552
2586
|
return Sr;
|
|
2553
|
-
}, Fs = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: s }) =>
|
|
2554
|
-
const
|
|
2587
|
+
}, Fs = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: s }) => Y(e) ? e : t ? e === "" ? NaN : e && +e : r && de(e) ? new Date(e) : s ? s(e) : e;
|
|
2588
|
+
const Ir = {
|
|
2555
2589
|
isValid: !1,
|
|
2556
2590
|
value: null
|
|
2557
2591
|
};
|
|
2558
2592
|
var Vs = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
|
|
2559
2593
|
isValid: !0,
|
|
2560
2594
|
value: r.value
|
|
2561
|
-
} : t,
|
|
2562
|
-
function
|
|
2595
|
+
} : t, Ir) : Ir;
|
|
2596
|
+
function Er(e) {
|
|
2563
2597
|
const t = e.ref;
|
|
2564
|
-
return
|
|
2598
|
+
return sr(t) ? t.files : nr(t) ? Vs(e.refs).value : As(t) ? [...t.selectedOptions].map(({ value: r }) => r) : ht(t) ? Es(e.refs).value : Fs(Y(t.value) ? e.ref.value : t.value, e);
|
|
2565
2599
|
}
|
|
2566
|
-
var
|
|
2600
|
+
var di = (e, t, r, s) => {
|
|
2567
2601
|
const n = {};
|
|
2568
2602
|
for (const i of e) {
|
|
2569
|
-
const a =
|
|
2570
|
-
a &&
|
|
2603
|
+
const a = V(t, i);
|
|
2604
|
+
a && J(n, i, a._f);
|
|
2571
2605
|
}
|
|
2572
2606
|
return {
|
|
2573
2607
|
criteriaMode: r,
|
|
@@ -2575,7 +2609,7 @@ var ci = (e, t, r, s) => {
|
|
|
2575
2609
|
fields: n,
|
|
2576
2610
|
shouldUseNativeValidation: s
|
|
2577
2611
|
};
|
|
2578
|
-
},
|
|
2612
|
+
}, xt = (e) => e instanceof RegExp, it = (e) => Y(e) ? e : xt(e) ? e.source : ee(e) ? xt(e.value) ? e.value.source : e.value : e, Fr = (e) => ({
|
|
2579
2613
|
isOnSubmit: !e || e === pe.onSubmit,
|
|
2580
2614
|
isOnBlur: e === pe.onBlur,
|
|
2581
2615
|
isOnChange: e === pe.onChange,
|
|
@@ -2583,10 +2617,10 @@ var ci = (e, t, r, s) => {
|
|
|
2583
2617
|
isOnTouch: e === pe.onTouched
|
|
2584
2618
|
});
|
|
2585
2619
|
const Vr = "AsyncFunction";
|
|
2586
|
-
var
|
|
2620
|
+
var fi = (e) => !!e && !!e.validate && !!(he(e.validate) && e.validate.constructor.name === Vr || ee(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === Vr)), hi = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Lr = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
|
|
2587
2621
|
const ft = (e, t, r, s) => {
|
|
2588
2622
|
for (const n of r || Object.keys(e)) {
|
|
2589
|
-
const i =
|
|
2623
|
+
const i = V(e, n);
|
|
2590
2624
|
if (i) {
|
|
2591
2625
|
const { _f: a, ...o } = i;
|
|
2592
2626
|
if (a) {
|
|
@@ -2596,21 +2630,21 @@ const ft = (e, t, r, s) => {
|
|
|
2596
2630
|
return !0;
|
|
2597
2631
|
if (ft(o, t))
|
|
2598
2632
|
break;
|
|
2599
|
-
} else if (
|
|
2633
|
+
} else if (ee(o) && ft(o, t))
|
|
2600
2634
|
break;
|
|
2601
2635
|
}
|
|
2602
2636
|
}
|
|
2603
2637
|
};
|
|
2604
2638
|
function Mr(e, t, r) {
|
|
2605
|
-
const s =
|
|
2606
|
-
if (s ||
|
|
2639
|
+
const s = V(e, r);
|
|
2640
|
+
if (s || St(r))
|
|
2607
2641
|
return {
|
|
2608
2642
|
error: s,
|
|
2609
2643
|
name: r
|
|
2610
2644
|
};
|
|
2611
2645
|
const n = r.split(".");
|
|
2612
2646
|
for (; n.length; ) {
|
|
2613
|
-
const i = n.join("."), a =
|
|
2647
|
+
const i = n.join("."), a = V(t, i), o = V(e, i);
|
|
2614
2648
|
if (a && !Array.isArray(a) && r !== i)
|
|
2615
2649
|
return { name: r };
|
|
2616
2650
|
if (o && o.type)
|
|
@@ -2629,13 +2663,13 @@ function Mr(e, t, r) {
|
|
|
2629
2663
|
name: r
|
|
2630
2664
|
};
|
|
2631
2665
|
}
|
|
2632
|
-
var
|
|
2666
|
+
var pi = (e, t, r, s) => {
|
|
2633
2667
|
r(e);
|
|
2634
2668
|
const { name: n, ...i } = e;
|
|
2635
|
-
return
|
|
2636
|
-
},
|
|
2637
|
-
const s = dt(
|
|
2638
|
-
return
|
|
2669
|
+
return oe(i) || Object.keys(i).length >= Object.keys(t).length || Object.keys(i).find((a) => t[a] === (!s || pe.all));
|
|
2670
|
+
}, mi = (e, t, r) => !e || !t || e === t || dt(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), yi = (e, t, r, s, n) => n.isOnAll ? !1 : !r && n.isOnTouch ? !(t || e) : (r ? s.isOnBlur : n.isOnBlur) ? !e : (r ? s.isOnChange : n.isOnChange) ? e : !0, bi = (e, t) => !tr(V(e, t)).length && Q(e, t), gi = (e, t, r) => {
|
|
2671
|
+
const s = dt(V(e, r));
|
|
2672
|
+
return J(s, "root", t[r]), J(e, r, s), e;
|
|
2639
2673
|
};
|
|
2640
2674
|
function Rr(e, t, r = "validate") {
|
|
2641
2675
|
if (de(e) || Array.isArray(e) && e.every(de) || be(e) && !e)
|
|
@@ -2645,98 +2679,98 @@ function Rr(e, t, r = "validate") {
|
|
|
2645
2679
|
ref: t
|
|
2646
2680
|
};
|
|
2647
2681
|
}
|
|
2648
|
-
var qe = (e) =>
|
|
2682
|
+
var qe = (e) => ee(e) && !xt(e) ? e : {
|
|
2649
2683
|
value: e,
|
|
2650
2684
|
message: ""
|
|
2651
|
-
},
|
|
2652
|
-
const { ref: a, refs: o, required: l, maxLength: f, minLength: h, min: b, max: g, pattern: p, validate:
|
|
2653
|
-
if (!
|
|
2685
|
+
}, Tr = async (e, t, r, s, n, i) => {
|
|
2686
|
+
const { ref: a, refs: o, required: l, maxLength: f, minLength: h, min: b, max: g, pattern: p, validate: x, name: w, valueAsNumber: k, mount: A } = e._f, v = V(r, w);
|
|
2687
|
+
if (!A || t.has(w))
|
|
2654
2688
|
return {};
|
|
2655
|
-
const
|
|
2656
|
-
n &&
|
|
2657
|
-
},
|
|
2658
|
-
const
|
|
2659
|
-
|
|
2660
|
-
type:
|
|
2661
|
-
message:
|
|
2689
|
+
const R = o ? o[0] : a, N = (C) => {
|
|
2690
|
+
n && R.reportValidity && (R.setCustomValidity(be(C) ? "" : C || ""), R.reportValidity());
|
|
2691
|
+
}, T = {}, H = nr(a), P = ht(a), E = H || P, M = (k || sr(a)) && Y(a.value) && Y(v) || vt(a) && a.value === "" || v === "" || Array.isArray(v) && !v.length, D = Cs.bind(null, w, s, T), I = (C, L, $, B = Ce.maxLength, q = Ce.minLength) => {
|
|
2692
|
+
const X = C ? L : $;
|
|
2693
|
+
T[w] = {
|
|
2694
|
+
type: C ? B : q,
|
|
2695
|
+
message: X,
|
|
2662
2696
|
ref: a,
|
|
2663
|
-
...
|
|
2697
|
+
...D(C ? B : q, X)
|
|
2664
2698
|
};
|
|
2665
2699
|
};
|
|
2666
|
-
if (i ? !Array.isArray(
|
|
2667
|
-
const { value:
|
|
2668
|
-
if (
|
|
2700
|
+
if (i ? !Array.isArray(v) || !v.length : l && (!E && (M || le(v)) || be(v) && !v || P && !Es(o).isValid || H && !Vs(o).isValid)) {
|
|
2701
|
+
const { value: C, message: L } = de(l) ? { value: !!l, message: l } : qe(l);
|
|
2702
|
+
if (C && (T[w] = {
|
|
2669
2703
|
type: Ce.required,
|
|
2670
|
-
message:
|
|
2671
|
-
ref:
|
|
2672
|
-
...
|
|
2704
|
+
message: L,
|
|
2705
|
+
ref: R,
|
|
2706
|
+
...D(Ce.required, L)
|
|
2673
2707
|
}, !s))
|
|
2674
|
-
return N(
|
|
2708
|
+
return N(L), T;
|
|
2675
2709
|
}
|
|
2676
|
-
if (!
|
|
2677
|
-
let
|
|
2678
|
-
const
|
|
2679
|
-
if (!
|
|
2680
|
-
const
|
|
2681
|
-
|
|
2710
|
+
if (!M && (!le(b) || !le(g))) {
|
|
2711
|
+
let C, L;
|
|
2712
|
+
const $ = qe(g), B = qe(b);
|
|
2713
|
+
if (!le(v) && !isNaN(v)) {
|
|
2714
|
+
const q = a.valueAsNumber || v && +v;
|
|
2715
|
+
le($.value) || (C = q > $.value), le(B.value) || (L = q < B.value);
|
|
2682
2716
|
} else {
|
|
2683
|
-
const
|
|
2684
|
-
de(
|
|
2717
|
+
const q = a.valueAsDate || new Date(v), X = (Z) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Z), G = a.type == "time", K = a.type == "week";
|
|
2718
|
+
de($.value) && v && (C = G ? X(v) > X($.value) : K ? v > $.value : q > new Date($.value)), de(B.value) && v && (L = G ? X(v) < X(B.value) : K ? v < B.value : q < new Date(B.value));
|
|
2685
2719
|
}
|
|
2686
|
-
if ((
|
|
2687
|
-
return N(
|
|
2720
|
+
if ((C || L) && (I(!!C, $.message, B.message, Ce.max, Ce.min), !s))
|
|
2721
|
+
return N(T[w].message), T;
|
|
2688
2722
|
}
|
|
2689
|
-
if ((f || h) && !
|
|
2690
|
-
const
|
|
2691
|
-
if ((
|
|
2692
|
-
return N(
|
|
2723
|
+
if ((f || h) && !M && (de(v) || i && Array.isArray(v))) {
|
|
2724
|
+
const C = qe(f), L = qe(h), $ = !le(C.value) && v.length > +C.value, B = !le(L.value) && v.length < +L.value;
|
|
2725
|
+
if (($ || B) && (I($, C.message, L.message), !s))
|
|
2726
|
+
return N(T[w].message), T;
|
|
2693
2727
|
}
|
|
2694
|
-
if (p && !
|
|
2695
|
-
const { value:
|
|
2696
|
-
if (
|
|
2728
|
+
if (p && !M && de(v)) {
|
|
2729
|
+
const { value: C, message: L } = qe(p);
|
|
2730
|
+
if (xt(C) && !v.match(C) && (T[w] = {
|
|
2697
2731
|
type: Ce.pattern,
|
|
2698
|
-
message:
|
|
2732
|
+
message: L,
|
|
2699
2733
|
ref: a,
|
|
2700
|
-
...
|
|
2734
|
+
...D(Ce.pattern, L)
|
|
2701
2735
|
}, !s))
|
|
2702
|
-
return N(
|
|
2736
|
+
return N(L), T;
|
|
2703
2737
|
}
|
|
2704
|
-
if (
|
|
2705
|
-
if (he(
|
|
2706
|
-
const
|
|
2707
|
-
if (
|
|
2708
|
-
...
|
|
2709
|
-
...
|
|
2738
|
+
if (x) {
|
|
2739
|
+
if (he(x)) {
|
|
2740
|
+
const C = await x(v, r), L = Rr(C, R);
|
|
2741
|
+
if (L && (T[w] = {
|
|
2742
|
+
...L,
|
|
2743
|
+
...D(Ce.validate, L.message)
|
|
2710
2744
|
}, !s))
|
|
2711
|
-
return N(
|
|
2712
|
-
} else if (
|
|
2713
|
-
let
|
|
2714
|
-
for (const
|
|
2715
|
-
if (!
|
|
2745
|
+
return N(L.message), T;
|
|
2746
|
+
} else if (ee(x)) {
|
|
2747
|
+
let C = {};
|
|
2748
|
+
for (const L in x) {
|
|
2749
|
+
if (!oe(C) && !s)
|
|
2716
2750
|
break;
|
|
2717
|
-
const
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
...L
|
|
2721
|
-
}, N(
|
|
2751
|
+
const $ = Rr(await x[L](v, r), R, L);
|
|
2752
|
+
$ && (C = {
|
|
2753
|
+
...$,
|
|
2754
|
+
...D(L, $.message)
|
|
2755
|
+
}, N($.message), s && (T[w] = C));
|
|
2722
2756
|
}
|
|
2723
|
-
if (!
|
|
2724
|
-
ref:
|
|
2725
|
-
...
|
|
2757
|
+
if (!oe(C) && (T[w] = {
|
|
2758
|
+
ref: R,
|
|
2759
|
+
...C
|
|
2726
2760
|
}, !s))
|
|
2727
|
-
return
|
|
2761
|
+
return T;
|
|
2728
2762
|
}
|
|
2729
2763
|
}
|
|
2730
|
-
return N(!0),
|
|
2764
|
+
return N(!0), T;
|
|
2731
2765
|
};
|
|
2732
|
-
const
|
|
2766
|
+
const vi = {
|
|
2733
2767
|
mode: pe.onSubmit,
|
|
2734
2768
|
reValidateMode: pe.onChange,
|
|
2735
2769
|
shouldFocusError: !0
|
|
2736
2770
|
};
|
|
2737
|
-
function
|
|
2771
|
+
function xi(e = {}) {
|
|
2738
2772
|
let t = {
|
|
2739
|
-
...
|
|
2773
|
+
...vi,
|
|
2740
2774
|
...e
|
|
2741
2775
|
}, r = {
|
|
2742
2776
|
submitCount: 0,
|
|
@@ -2753,7 +2787,7 @@ function gi(e = {}) {
|
|
|
2753
2787
|
validatingFields: {},
|
|
2754
2788
|
errors: t.errors || {},
|
|
2755
2789
|
disabled: t.disabled || !1
|
|
2756
|
-
}, s = {}, n =
|
|
2790
|
+
}, s = {}, n = ee(t.defaultValues) || ee(t.values) ? re(t.defaultValues || t.values) || {} : {}, i = t.shouldUnregister ? {} : re(n), a = {
|
|
2757
2791
|
action: !1,
|
|
2758
2792
|
mount: !1,
|
|
2759
2793
|
watch: !1,
|
|
@@ -2782,47 +2816,47 @@ function gi(e = {}) {
|
|
|
2782
2816
|
const p = {
|
|
2783
2817
|
array: Cr(),
|
|
2784
2818
|
state: Cr()
|
|
2785
|
-
},
|
|
2819
|
+
}, x = t.criteriaMode === pe.all, w = (u) => (d) => {
|
|
2786
2820
|
clearTimeout(f), f = setTimeout(u, d);
|
|
2787
2821
|
}, k = async (u) => {
|
|
2788
2822
|
if (!a.keepIsValid && !t.disabled && (b.isValid || g.isValid || u)) {
|
|
2789
2823
|
let d;
|
|
2790
|
-
t.resolver ? (d =
|
|
2824
|
+
t.resolver ? (d = oe((await E()).errors), A()) : d = await D(s, !0), d !== r.isValid && p.state.next({
|
|
2791
2825
|
isValid: d
|
|
2792
2826
|
});
|
|
2793
2827
|
}
|
|
2794
|
-
},
|
|
2828
|
+
}, A = (u, d) => {
|
|
2795
2829
|
!t.disabled && (b.isValidating || b.validatingFields || g.isValidating || g.validatingFields) && ((u || Array.from(o.mount)).forEach((m) => {
|
|
2796
|
-
m && (d ?
|
|
2830
|
+
m && (d ? J(r.validatingFields, m, d) : Q(r.validatingFields, m));
|
|
2797
2831
|
}), p.state.next({
|
|
2798
2832
|
validatingFields: r.validatingFields,
|
|
2799
|
-
isValidating: !
|
|
2833
|
+
isValidating: !oe(r.validatingFields)
|
|
2800
2834
|
}));
|
|
2801
|
-
},
|
|
2835
|
+
}, v = (u, d = [], m, S, _ = !0, y = !0) => {
|
|
2802
2836
|
if (S && m && !t.disabled) {
|
|
2803
|
-
if (a.action = !0, y && Array.isArray(
|
|
2804
|
-
const
|
|
2805
|
-
_ &&
|
|
2837
|
+
if (a.action = !0, y && Array.isArray(V(s, u))) {
|
|
2838
|
+
const F = m(V(s, u), S.argA, S.argB);
|
|
2839
|
+
_ && J(s, u, F);
|
|
2806
2840
|
}
|
|
2807
|
-
if (y && Array.isArray(
|
|
2808
|
-
const
|
|
2809
|
-
_ &&
|
|
2841
|
+
if (y && Array.isArray(V(r.errors, u))) {
|
|
2842
|
+
const F = m(V(r.errors, u), S.argA, S.argB);
|
|
2843
|
+
_ && J(r.errors, u, F), bi(r.errors, u);
|
|
2810
2844
|
}
|
|
2811
|
-
if ((b.touchedFields || g.touchedFields) && y && Array.isArray(
|
|
2812
|
-
const
|
|
2813
|
-
_ &&
|
|
2845
|
+
if ((b.touchedFields || g.touchedFields) && y && Array.isArray(V(r.touchedFields, u))) {
|
|
2846
|
+
const F = m(V(r.touchedFields, u), S.argA, S.argB);
|
|
2847
|
+
_ && J(r.touchedFields, u, F);
|
|
2814
2848
|
}
|
|
2815
2849
|
(b.dirtyFields || g.dirtyFields) && (r.dirtyFields = ze(n, i)), p.state.next({
|
|
2816
2850
|
name: u,
|
|
2817
|
-
isDirty:
|
|
2851
|
+
isDirty: C(u, d),
|
|
2818
2852
|
dirtyFields: r.dirtyFields,
|
|
2819
2853
|
errors: r.errors,
|
|
2820
2854
|
isValid: r.isValid
|
|
2821
2855
|
});
|
|
2822
2856
|
} else
|
|
2823
|
-
|
|
2824
|
-
},
|
|
2825
|
-
|
|
2857
|
+
J(i, u, d);
|
|
2858
|
+
}, R = (u, d) => {
|
|
2859
|
+
J(r.errors, u, d), p.state.next({
|
|
2826
2860
|
errors: r.errors
|
|
2827
2861
|
});
|
|
2828
2862
|
}, N = (u) => {
|
|
@@ -2830,34 +2864,34 @@ function gi(e = {}) {
|
|
|
2830
2864
|
errors: r.errors,
|
|
2831
2865
|
isValid: !1
|
|
2832
2866
|
});
|
|
2833
|
-
},
|
|
2834
|
-
const _ =
|
|
2867
|
+
}, T = (u, d, m, S) => {
|
|
2868
|
+
const _ = V(s, u);
|
|
2835
2869
|
if (_) {
|
|
2836
|
-
const y =
|
|
2837
|
-
|
|
2870
|
+
const y = V(i, u, Y(m) ? V(n, u) : m);
|
|
2871
|
+
Y(y) || S && S.defaultChecked || d ? J(i, u, d ? y : Er(_._f)) : B(u, y), a.mount && !a.action && k();
|
|
2838
2872
|
}
|
|
2839
|
-
},
|
|
2840
|
-
let y = !1,
|
|
2841
|
-
const
|
|
2873
|
+
}, H = (u, d, m, S, _) => {
|
|
2874
|
+
let y = !1, F = !1;
|
|
2875
|
+
const j = {
|
|
2842
2876
|
name: u
|
|
2843
2877
|
};
|
|
2844
2878
|
if (!t.disabled) {
|
|
2845
2879
|
if (!m || S) {
|
|
2846
|
-
(b.isDirty || g.isDirty) && (
|
|
2847
|
-
const U = Le(
|
|
2848
|
-
|
|
2880
|
+
(b.isDirty || g.isDirty) && (F = r.isDirty, r.isDirty = j.isDirty = C(), y = F !== j.isDirty);
|
|
2881
|
+
const U = Le(V(n, u), d);
|
|
2882
|
+
F = !!V(r.dirtyFields, u), U ? Q(r.dirtyFields, u) : J(r.dirtyFields, u, !0), j.dirtyFields = r.dirtyFields, y = y || (b.dirtyFields || g.dirtyFields) && F !== !U;
|
|
2849
2883
|
}
|
|
2850
2884
|
if (m) {
|
|
2851
|
-
const U =
|
|
2852
|
-
U || (
|
|
2885
|
+
const U = V(r.touchedFields, u);
|
|
2886
|
+
U || (J(r.touchedFields, u, m), j.touchedFields = r.touchedFields, y = y || (b.touchedFields || g.touchedFields) && U !== m);
|
|
2853
2887
|
}
|
|
2854
|
-
y && _ && p.state.next(
|
|
2888
|
+
y && _ && p.state.next(j);
|
|
2855
2889
|
}
|
|
2856
|
-
return y ?
|
|
2857
|
-
},
|
|
2858
|
-
const _ =
|
|
2859
|
-
if (t.delayError && m ? (l = w(() =>
|
|
2860
|
-
const
|
|
2890
|
+
return y ? j : {};
|
|
2891
|
+
}, P = (u, d, m, S) => {
|
|
2892
|
+
const _ = V(r.errors, u), y = (b.isValid || g.isValid) && be(d) && r.isValid !== d;
|
|
2893
|
+
if (t.delayError && m ? (l = w(() => R(u, m)), l(t.delayError)) : (clearTimeout(f), l = null, m ? J(r.errors, u, m) : Q(r.errors, u)), (m ? !Le(_, m) : _) || !oe(S) || y) {
|
|
2894
|
+
const F = {
|
|
2861
2895
|
...S,
|
|
2862
2896
|
...y && be(d) ? { isValid: d } : {},
|
|
2863
2897
|
errors: r.errors,
|
|
@@ -2865,143 +2899,143 @@ function gi(e = {}) {
|
|
|
2865
2899
|
};
|
|
2866
2900
|
r = {
|
|
2867
2901
|
...r,
|
|
2868
|
-
...
|
|
2869
|
-
}, p.state.next(
|
|
2902
|
+
...F
|
|
2903
|
+
}, p.state.next(F);
|
|
2870
2904
|
}
|
|
2871
|
-
},
|
|
2872
|
-
const { errors: d } = await
|
|
2873
|
-
if (
|
|
2905
|
+
}, E = async (u) => (A(u, !0), await t.resolver(i, t.context, di(u || o.mount, s, t.criteriaMode, t.shouldUseNativeValidation))), M = async (u) => {
|
|
2906
|
+
const { errors: d } = await E(u);
|
|
2907
|
+
if (A(u), u)
|
|
2874
2908
|
for (const m of u) {
|
|
2875
|
-
const S =
|
|
2876
|
-
S ?
|
|
2909
|
+
const S = V(d, m);
|
|
2910
|
+
S ? J(r.errors, m, S) : Q(r.errors, m);
|
|
2877
2911
|
}
|
|
2878
2912
|
else
|
|
2879
2913
|
r.errors = d;
|
|
2880
2914
|
return d;
|
|
2881
|
-
},
|
|
2915
|
+
}, D = async (u, d, m = {
|
|
2882
2916
|
valid: !0
|
|
2883
2917
|
}) => {
|
|
2884
2918
|
for (const S in u) {
|
|
2885
2919
|
const _ = u[S];
|
|
2886
2920
|
if (_) {
|
|
2887
|
-
const { _f: y, ...
|
|
2921
|
+
const { _f: y, ...F } = _;
|
|
2888
2922
|
if (y) {
|
|
2889
|
-
const
|
|
2890
|
-
U && b.validatingFields &&
|
|
2891
|
-
const
|
|
2892
|
-
if (U && b.validatingFields &&
|
|
2923
|
+
const j = o.array.has(y.name), U = _._f && fi(_._f);
|
|
2924
|
+
U && b.validatingFields && A([y.name], !0);
|
|
2925
|
+
const se = await Tr(_, o.disabled, i, x, t.shouldUseNativeValidation && !d, j);
|
|
2926
|
+
if (U && b.validatingFields && A([y.name]), se[y.name] && (m.valid = !1, d || e.shouldUseNativeValidation))
|
|
2893
2927
|
break;
|
|
2894
|
-
!d && (
|
|
2928
|
+
!d && (V(se, y.name) ? j ? gi(r.errors, se, y.name) : J(r.errors, y.name, se[y.name]) : Q(r.errors, y.name));
|
|
2895
2929
|
}
|
|
2896
|
-
!
|
|
2930
|
+
!oe(F) && await D(F, d, m);
|
|
2897
2931
|
}
|
|
2898
2932
|
}
|
|
2899
2933
|
return m.valid;
|
|
2900
|
-
},
|
|
2934
|
+
}, I = () => {
|
|
2901
2935
|
for (const u of o.unMount) {
|
|
2902
|
-
const d =
|
|
2903
|
-
d && (d._f.refs ? d._f.refs.every((m) =>
|
|
2936
|
+
const d = V(s, u);
|
|
2937
|
+
d && (d._f.refs ? d._f.refs.every((m) => !$t(m)) : !$t(d._f.ref)) && xe(u);
|
|
2904
2938
|
}
|
|
2905
2939
|
o.unMount = /* @__PURE__ */ new Set();
|
|
2906
|
-
},
|
|
2907
|
-
...a.mount ? i :
|
|
2908
|
-
}, m, d),
|
|
2909
|
-
const S =
|
|
2940
|
+
}, C = (u, d) => !t.disabled && (u && d && J(i, u, d), !Le(z(), n)), L = (u, d, m) => ai(u, o, {
|
|
2941
|
+
...a.mount ? i : Y(d) ? n : de(u) ? { [u]: d } : d
|
|
2942
|
+
}, m, d), $ = (u) => tr(V(a.mount ? i : n, u, t.shouldUnregister ? V(n, u, []) : [])), B = (u, d, m = {}) => {
|
|
2943
|
+
const S = V(s, u);
|
|
2910
2944
|
let _ = d;
|
|
2911
2945
|
if (S) {
|
|
2912
2946
|
const y = S._f;
|
|
2913
|
-
y && (!y.disabled &&
|
|
2914
|
-
(!
|
|
2915
|
-
}) : y.refs.forEach((
|
|
2947
|
+
y && (!y.disabled && J(i, u, Fs(d, y)), _ = vt(y.ref) && le(d) ? "" : d, As(y.ref) ? [...y.ref.options].forEach((F) => F.selected = _.includes(F.value)) : y.refs ? ht(y.ref) ? y.refs.forEach((F) => {
|
|
2948
|
+
(!F.defaultChecked || !F.disabled) && (Array.isArray(_) ? F.checked = !!_.find((j) => j === F.value) : F.checked = _ === F.value || !!_);
|
|
2949
|
+
}) : y.refs.forEach((F) => F.checked = F.value === _) : sr(y.ref) ? y.ref.value = "" : (y.ref.value = _, y.ref.type || p.state.next({
|
|
2916
2950
|
name: u,
|
|
2917
|
-
values:
|
|
2951
|
+
values: re(i)
|
|
2918
2952
|
})));
|
|
2919
2953
|
}
|
|
2920
|
-
(m.shouldDirty || m.shouldTouch) &&
|
|
2921
|
-
},
|
|
2954
|
+
(m.shouldDirty || m.shouldTouch) && H(u, _, m.shouldTouch, m.shouldDirty, !0), m.shouldValidate && Z(u);
|
|
2955
|
+
}, q = (u, d, m) => {
|
|
2922
2956
|
for (const S in d) {
|
|
2923
2957
|
if (!d.hasOwnProperty(S))
|
|
2924
2958
|
return;
|
|
2925
|
-
const _ = d[S], y = u + "." + S,
|
|
2926
|
-
(o.array.has(u) ||
|
|
2959
|
+
const _ = d[S], y = u + "." + S, F = V(s, y);
|
|
2960
|
+
(o.array.has(u) || ee(_) || F && !F._f) && !Be(_) ? q(y, _, m) : B(y, _, m);
|
|
2927
2961
|
}
|
|
2928
|
-
},
|
|
2929
|
-
const S =
|
|
2930
|
-
|
|
2962
|
+
}, X = (u, d, m = {}) => {
|
|
2963
|
+
const S = V(s, u), _ = o.array.has(u), y = re(d);
|
|
2964
|
+
J(i, u, y), _ ? (p.array.next({
|
|
2931
2965
|
name: u,
|
|
2932
|
-
values:
|
|
2966
|
+
values: re(i)
|
|
2933
2967
|
}), (b.isDirty || b.dirtyFields || g.isDirty || g.dirtyFields) && m.shouldDirty && p.state.next({
|
|
2934
2968
|
name: u,
|
|
2935
2969
|
dirtyFields: ze(n, i),
|
|
2936
|
-
isDirty:
|
|
2937
|
-
})) : S && !S._f && !
|
|
2970
|
+
isDirty: C(u, y)
|
|
2971
|
+
})) : S && !S._f && !le(y) ? q(u, y, m) : B(u, y, m), Lr(u, o) ? p.state.next({
|
|
2938
2972
|
...r,
|
|
2939
2973
|
name: u,
|
|
2940
|
-
values:
|
|
2974
|
+
values: re(i)
|
|
2941
2975
|
}) : p.state.next({
|
|
2942
2976
|
name: a.mount ? u : void 0,
|
|
2943
|
-
values:
|
|
2977
|
+
values: re(i)
|
|
2944
2978
|
});
|
|
2945
|
-
},
|
|
2979
|
+
}, G = async (u) => {
|
|
2946
2980
|
a.mount = !0;
|
|
2947
2981
|
const d = u.target;
|
|
2948
2982
|
let m = d.name, S = !0;
|
|
2949
|
-
const _ =
|
|
2950
|
-
S = Number.isNaN(U) ||
|
|
2951
|
-
},
|
|
2983
|
+
const _ = V(s, m), y = (U) => {
|
|
2984
|
+
S = Number.isNaN(U) || Be(U) && isNaN(U.getTime()) || Le(U, V(i, m, U));
|
|
2985
|
+
}, F = Fr(t.mode), j = Fr(t.reValidateMode);
|
|
2952
2986
|
if (_) {
|
|
2953
|
-
let U,
|
|
2954
|
-
const
|
|
2955
|
-
|
|
2956
|
-
const
|
|
2957
|
-
if (!
|
|
2987
|
+
let U, se;
|
|
2988
|
+
const $e = d.type ? Er(_._f) : Ya(u), Ee = u.type === kr.BLUR || u.type === kr.FOCUS_OUT, Ms = !hi(_._f) && !t.resolver && !V(r.errors, m) && !_._f.deps || yi(Ee, V(r.touchedFields, m), r.isSubmitted, j, F), Ft = Lr(m, o, Ee);
|
|
2989
|
+
J(i, m, $e), Ee ? (!d || !d.readOnly) && (_._f.onBlur && _._f.onBlur(u), l && l(0)) : _._f.onChange && _._f.onChange(u);
|
|
2990
|
+
const Vt = H(m, $e, Ee), Rs = !oe(Vt) || Ft;
|
|
2991
|
+
if (!Ee && p.state.next({
|
|
2958
2992
|
name: m,
|
|
2959
2993
|
type: u.type,
|
|
2960
|
-
values:
|
|
2994
|
+
values: re(i)
|
|
2961
2995
|
}), Ms)
|
|
2962
|
-
return (b.isValid || g.isValid) && (t.mode === "onBlur" ?
|
|
2963
|
-
if (!
|
|
2964
|
-
const { errors:
|
|
2965
|
-
if (
|
|
2966
|
-
const
|
|
2967
|
-
U =
|
|
2996
|
+
return (b.isValid || g.isValid) && (t.mode === "onBlur" ? Ee && k() : Ee || k()), Rs && p.state.next({ name: m, ...Ft ? {} : Vt });
|
|
2997
|
+
if (!Ee && Ft && p.state.next({ ...r }), t.resolver) {
|
|
2998
|
+
const { errors: ar } = await E([m]);
|
|
2999
|
+
if (A([m]), y($e), S) {
|
|
3000
|
+
const Ts = Mr(r.errors, s, m), ir = Mr(ar, s, Ts.name || m);
|
|
3001
|
+
U = ir.error, m = ir.name, se = oe(ar);
|
|
2968
3002
|
}
|
|
2969
3003
|
} else
|
|
2970
|
-
|
|
2971
|
-
S && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) &&
|
|
3004
|
+
A([m], !0), U = (await Tr(_, o.disabled, i, x, t.shouldUseNativeValidation))[m], A([m]), y($e), S && (U ? se = !1 : (b.isValid || g.isValid) && (se = await D(s, !0)));
|
|
3005
|
+
S && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) && Z(_._f.deps), P(m, se, U, Vt));
|
|
2972
3006
|
}
|
|
2973
|
-
},
|
|
2974
|
-
if (
|
|
3007
|
+
}, K = (u, d) => {
|
|
3008
|
+
if (V(r.errors, d) && u.focus)
|
|
2975
3009
|
return u.focus(), 1;
|
|
2976
|
-
},
|
|
3010
|
+
}, Z = async (u, d = {}) => {
|
|
2977
3011
|
let m, S;
|
|
2978
3012
|
const _ = dt(u);
|
|
2979
3013
|
if (t.resolver) {
|
|
2980
|
-
const y = await
|
|
2981
|
-
m =
|
|
3014
|
+
const y = await M(Y(u) ? u : _);
|
|
3015
|
+
m = oe(y), S = u ? !_.some((F) => V(y, F)) : m;
|
|
2982
3016
|
} else u ? (S = (await Promise.all(_.map(async (y) => {
|
|
2983
|
-
const
|
|
2984
|
-
return await
|
|
2985
|
-
}))).every(Boolean), !(!S && !r.isValid) && k()) : S = m = await
|
|
3017
|
+
const F = V(s, y);
|
|
3018
|
+
return await D(F && F._f ? { [y]: F } : F);
|
|
3019
|
+
}))).every(Boolean), !(!S && !r.isValid) && k()) : S = m = await D(s);
|
|
2986
3020
|
return p.state.next({
|
|
2987
3021
|
...!de(u) || (b.isValid || g.isValid) && m !== r.isValid ? {} : { name: u },
|
|
2988
3022
|
...t.resolver || !u ? { isValid: m } : {},
|
|
2989
3023
|
errors: r.errors
|
|
2990
|
-
}), d.shouldFocus && !S && ft(s,
|
|
2991
|
-
},
|
|
3024
|
+
}), d.shouldFocus && !S && ft(s, K, u ? _ : o.mount), S;
|
|
3025
|
+
}, z = (u, d) => {
|
|
2992
3026
|
let m = {
|
|
2993
3027
|
...a.mount ? i : n
|
|
2994
3028
|
};
|
|
2995
|
-
return d && (m = Ss(d.dirtyFields ? r.dirtyFields : r.touchedFields, m)),
|
|
3029
|
+
return d && (m = Ss(d.dirtyFields ? r.dirtyFields : r.touchedFields, m)), Y(u) ? m : de(u) ? V(m, u) : u.map((S) => V(m, S));
|
|
2996
3030
|
}, Qe = (u, d) => ({
|
|
2997
|
-
invalid: !!
|
|
2998
|
-
isDirty: !!
|
|
2999
|
-
error:
|
|
3000
|
-
isValidating: !!
|
|
3001
|
-
isTouched: !!
|
|
3031
|
+
invalid: !!V((d || r).errors, u),
|
|
3032
|
+
isDirty: !!V((d || r).dirtyFields, u),
|
|
3033
|
+
error: V((d || r).errors, u),
|
|
3034
|
+
isValidating: !!V(r.validatingFields, u),
|
|
3035
|
+
isTouched: !!V((d || r).touchedFields, u)
|
|
3002
3036
|
}), et = (u) => {
|
|
3003
3037
|
const d = u ? dt(u) : void 0;
|
|
3004
|
-
d == null || d.forEach((m) =>
|
|
3038
|
+
d == null || d.forEach((m) => Q(r.errors, m)), d ? d.forEach((m) => {
|
|
3005
3039
|
p.state.next({
|
|
3006
3040
|
name: m,
|
|
3007
3041
|
errors: r.errors
|
|
@@ -3009,9 +3043,9 @@ function gi(e = {}) {
|
|
|
3009
3043
|
}) : p.state.next({
|
|
3010
3044
|
errors: {}
|
|
3011
3045
|
});
|
|
3012
|
-
},
|
|
3013
|
-
const S = (
|
|
3014
|
-
|
|
3046
|
+
}, O = (u, d, m) => {
|
|
3047
|
+
const S = (V(s, u, { _f: {} })._f || {}).ref, _ = V(r.errors, u) || {}, { ref: y, message: F, type: j, ...U } = _;
|
|
3048
|
+
J(r.errors, u, {
|
|
3015
3049
|
...U,
|
|
3016
3050
|
...d,
|
|
3017
3051
|
ref: S
|
|
@@ -3021,20 +3055,20 @@ function gi(e = {}) {
|
|
|
3021
3055
|
isValid: !1
|
|
3022
3056
|
}), m && m.shouldFocus && S && S.focus && S.focus();
|
|
3023
3057
|
}, tt = (u, d) => he(u) ? p.state.subscribe({
|
|
3024
|
-
next: (m) => "values" in m && u(
|
|
3025
|
-
}) :
|
|
3058
|
+
next: (m) => "values" in m && u(L(void 0, d), m)
|
|
3059
|
+
}) : L(u, d, !0), Te = (u) => p.state.subscribe({
|
|
3026
3060
|
next: (d) => {
|
|
3027
|
-
|
|
3061
|
+
mi(u.name, d.name, u.exact) && pi(d, u.formState || b, yt, u.reRenderRoot) && u.callback({
|
|
3028
3062
|
values: { ...i },
|
|
3029
3063
|
...r,
|
|
3030
3064
|
...d,
|
|
3031
3065
|
defaultValues: n
|
|
3032
3066
|
});
|
|
3033
3067
|
}
|
|
3034
|
-
}).unsubscribe,
|
|
3068
|
+
}).unsubscribe, De = (u) => (a.mount = !0, g = {
|
|
3035
3069
|
...g,
|
|
3036
3070
|
...u.formState
|
|
3037
|
-
},
|
|
3071
|
+
}, Te({
|
|
3038
3072
|
...u,
|
|
3039
3073
|
formState: {
|
|
3040
3074
|
...h,
|
|
@@ -3042,12 +3076,12 @@ function gi(e = {}) {
|
|
|
3042
3076
|
}
|
|
3043
3077
|
})), xe = (u, d = {}) => {
|
|
3044
3078
|
for (const m of u ? dt(u) : o.mount)
|
|
3045
|
-
o.mount.delete(m), o.array.delete(m), d.keepValue || (
|
|
3079
|
+
o.mount.delete(m), o.array.delete(m), d.keepValue || (Q(s, m), Q(i, m)), !d.keepError && Q(r.errors, m), !d.keepDirty && Q(r.dirtyFields, m), !d.keepTouched && Q(r.touchedFields, m), !d.keepIsValidating && Q(r.validatingFields, m), !t.shouldUnregister && !d.keepDefaultValue && Q(n, m);
|
|
3046
3080
|
p.state.next({
|
|
3047
|
-
values:
|
|
3081
|
+
values: re(i)
|
|
3048
3082
|
}), p.state.next({
|
|
3049
3083
|
...r,
|
|
3050
|
-
...d.keepDirty ? { isDirty:
|
|
3084
|
+
...d.keepDirty ? { isDirty: C() } : {}
|
|
3051
3085
|
}), !d.keepIsValid && k();
|
|
3052
3086
|
}, rt = ({ disabled: u, name: d }) => {
|
|
3053
3087
|
if (be(u) && a.mount || u || o.disabled.has(d)) {
|
|
@@ -3055,9 +3089,9 @@ function gi(e = {}) {
|
|
|
3055
3089
|
u ? o.disabled.add(d) : o.disabled.delete(d), _ && a.mount && !a.action && k();
|
|
3056
3090
|
}
|
|
3057
3091
|
}, Ue = (u, d = {}) => {
|
|
3058
|
-
let m =
|
|
3092
|
+
let m = V(s, u);
|
|
3059
3093
|
const S = be(d.disabled) || be(t.disabled);
|
|
3060
|
-
return
|
|
3094
|
+
return J(s, u, {
|
|
3061
3095
|
...m || {},
|
|
3062
3096
|
_f: {
|
|
3063
3097
|
...m && m._f ? m._f : { ref: { name: u } },
|
|
@@ -3068,7 +3102,7 @@ function gi(e = {}) {
|
|
|
3068
3102
|
}), o.mount.add(u), m ? rt({
|
|
3069
3103
|
disabled: be(d.disabled) ? d.disabled : t.disabled,
|
|
3070
3104
|
name: u
|
|
3071
|
-
}) :
|
|
3105
|
+
}) : T(u, !0, d.value), {
|
|
3072
3106
|
...S ? { disabled: d.disabled || t.disabled } : {},
|
|
3073
3107
|
...t.progressive ? {
|
|
3074
3108
|
required: !!d.required,
|
|
@@ -3079,34 +3113,34 @@ function gi(e = {}) {
|
|
|
3079
3113
|
pattern: it(d.pattern)
|
|
3080
3114
|
} : {},
|
|
3081
3115
|
name: u,
|
|
3082
|
-
onChange:
|
|
3083
|
-
onBlur:
|
|
3116
|
+
onChange: G,
|
|
3117
|
+
onBlur: G,
|
|
3084
3118
|
ref: (_) => {
|
|
3085
3119
|
if (_) {
|
|
3086
|
-
Ue(u, d), m =
|
|
3087
|
-
const y =
|
|
3088
|
-
if (
|
|
3120
|
+
Ue(u, d), m = V(s, u);
|
|
3121
|
+
const y = Y(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, F = oi(y), j = m._f.refs || [];
|
|
3122
|
+
if (F ? j.find((U) => U === y) : y === m._f.ref)
|
|
3089
3123
|
return;
|
|
3090
|
-
|
|
3124
|
+
J(s, u, {
|
|
3091
3125
|
_f: {
|
|
3092
3126
|
...m._f,
|
|
3093
|
-
...
|
|
3127
|
+
...F ? {
|
|
3094
3128
|
refs: [
|
|
3095
|
-
...
|
|
3129
|
+
...j.filter($t),
|
|
3096
3130
|
y,
|
|
3097
|
-
...Array.isArray(
|
|
3131
|
+
...Array.isArray(V(n, u)) ? [{}] : []
|
|
3098
3132
|
],
|
|
3099
3133
|
ref: { type: y.type, name: u }
|
|
3100
3134
|
} : { ref: y }
|
|
3101
3135
|
}
|
|
3102
|
-
}),
|
|
3136
|
+
}), T(u, !1, void 0, y);
|
|
3103
3137
|
} else
|
|
3104
|
-
m =
|
|
3138
|
+
m = V(s, u, {}), m._f && (m._f.mount = !1), (t.shouldUnregister || d.shouldUnregister) && !(ei(o.array, u) && a.action) && o.unMount.add(u);
|
|
3105
3139
|
}
|
|
3106
3140
|
};
|
|
3107
|
-
}, we = () => t.shouldFocusError && ft(s,
|
|
3141
|
+
}, we = () => t.shouldFocusError && ft(s, K, o.mount), pt = (u) => {
|
|
3108
3142
|
be(u) && (p.state.next({ disabled: u }), ft(s, (d, m) => {
|
|
3109
|
-
const S =
|
|
3143
|
+
const S = V(s, m);
|
|
3110
3144
|
S && (d.disabled = S._f.disabled || u, Array.isArray(S._f.refs) && S._f.refs.forEach((_) => {
|
|
3111
3145
|
_.disabled = S._f.disabled || u;
|
|
3112
3146
|
}));
|
|
@@ -3114,18 +3148,18 @@ function gi(e = {}) {
|
|
|
3114
3148
|
}, st = (u, d) => async (m) => {
|
|
3115
3149
|
let S;
|
|
3116
3150
|
m && (m.preventDefault && m.preventDefault(), m.persist && m.persist());
|
|
3117
|
-
let _ =
|
|
3151
|
+
let _ = re(i);
|
|
3118
3152
|
if (p.state.next({
|
|
3119
3153
|
isSubmitting: !0
|
|
3120
3154
|
}), t.resolver) {
|
|
3121
|
-
const { errors: y, values:
|
|
3122
|
-
|
|
3155
|
+
const { errors: y, values: F } = await E();
|
|
3156
|
+
A(), r.errors = y, _ = re(F);
|
|
3123
3157
|
} else
|
|
3124
|
-
await
|
|
3158
|
+
await D(s);
|
|
3125
3159
|
if (o.disabled.size)
|
|
3126
3160
|
for (const y of o.disabled)
|
|
3127
|
-
|
|
3128
|
-
if (
|
|
3161
|
+
Q(_, y);
|
|
3162
|
+
if (Q(r.errors, "root"), oe(r.errors)) {
|
|
3129
3163
|
p.state.next({
|
|
3130
3164
|
errors: {}
|
|
3131
3165
|
});
|
|
@@ -3139,47 +3173,47 @@ function gi(e = {}) {
|
|
|
3139
3173
|
if (p.state.next({
|
|
3140
3174
|
isSubmitted: !0,
|
|
3141
3175
|
isSubmitting: !1,
|
|
3142
|
-
isSubmitSuccessful:
|
|
3176
|
+
isSubmitSuccessful: oe(r.errors) && !S,
|
|
3143
3177
|
submitCount: r.submitCount + 1,
|
|
3144
3178
|
errors: r.errors
|
|
3145
3179
|
}), S)
|
|
3146
3180
|
throw S;
|
|
3147
3181
|
}, nt = (u, d = {}) => {
|
|
3148
|
-
|
|
3182
|
+
V(s, u) && (Y(d.defaultValue) ? X(u, re(V(n, u))) : (X(u, d.defaultValue), J(n, u, re(d.defaultValue))), d.keepTouched || Q(r.touchedFields, u), d.keepDirty || (Q(r.dirtyFields, u), r.isDirty = d.defaultValue ? C(u, re(V(n, u))) : C()), d.keepError || (Q(r.errors, u), b.isValid && k()), p.state.next({ ...r }));
|
|
3149
3183
|
}, Ne = (u, d = {}) => {
|
|
3150
|
-
const m = u ?
|
|
3184
|
+
const m = u ? re(u) : n, S = re(m), _ = oe(u), y = _ ? n : S;
|
|
3151
3185
|
if (d.keepDefaultValues || (n = m), !d.keepValues) {
|
|
3152
3186
|
if (d.keepDirtyValues) {
|
|
3153
|
-
const
|
|
3187
|
+
const F = /* @__PURE__ */ new Set([
|
|
3154
3188
|
...o.mount,
|
|
3155
3189
|
...Object.keys(ze(n, i))
|
|
3156
3190
|
]);
|
|
3157
|
-
for (const
|
|
3158
|
-
const U =
|
|
3159
|
-
U && !
|
|
3191
|
+
for (const j of Array.from(F)) {
|
|
3192
|
+
const U = V(r.dirtyFields, j), se = V(i, j), $e = V(y, j);
|
|
3193
|
+
U && !Y(se) ? J(y, j, se) : !U && !Y($e) && X(j, $e);
|
|
3160
3194
|
}
|
|
3161
3195
|
} else {
|
|
3162
|
-
if (
|
|
3163
|
-
for (const
|
|
3164
|
-
const
|
|
3165
|
-
if (
|
|
3166
|
-
const U = Array.isArray(
|
|
3167
|
-
if (
|
|
3168
|
-
const
|
|
3169
|
-
if (
|
|
3170
|
-
|
|
3196
|
+
if (er && Y(u))
|
|
3197
|
+
for (const F of o.mount) {
|
|
3198
|
+
const j = V(s, F);
|
|
3199
|
+
if (j && j._f) {
|
|
3200
|
+
const U = Array.isArray(j._f.refs) ? j._f.refs[0] : j._f.ref;
|
|
3201
|
+
if (vt(U)) {
|
|
3202
|
+
const se = U.closest("form");
|
|
3203
|
+
if (se) {
|
|
3204
|
+
se.reset();
|
|
3171
3205
|
break;
|
|
3172
3206
|
}
|
|
3173
3207
|
}
|
|
3174
3208
|
}
|
|
3175
3209
|
}
|
|
3176
3210
|
if (d.keepFieldsRef)
|
|
3177
|
-
for (const
|
|
3178
|
-
|
|
3211
|
+
for (const F of o.mount)
|
|
3212
|
+
X(F, V(y, F));
|
|
3179
3213
|
else
|
|
3180
3214
|
s = {};
|
|
3181
3215
|
}
|
|
3182
|
-
i = t.shouldUnregister ? d.keepDefaultValues ?
|
|
3216
|
+
i = t.shouldUnregister ? d.keepDefaultValues ? re(n) : {} : re(y), p.array.next({
|
|
3183
3217
|
values: { ...y }
|
|
3184
3218
|
}), p.state.next({
|
|
3185
3219
|
values: { ...y }
|
|
@@ -3193,7 +3227,7 @@ function gi(e = {}) {
|
|
|
3193
3227
|
watch: /* @__PURE__ */ new Set(),
|
|
3194
3228
|
watchAll: !1,
|
|
3195
3229
|
focus: ""
|
|
3196
|
-
}, a.mount = !b.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !t.shouldUnregister && !
|
|
3230
|
+
}, a.mount = !b.isValid || !!d.keepIsValid || !!d.keepDirtyValues || !t.shouldUnregister && !oe(y), a.watch = !!t.shouldUnregister, a.keepIsValid = !!d.keepIsValid, a.action = !1, d.keepErrors || (r.errors = {}), p.state.next({
|
|
3197
3231
|
submitCount: d.keepSubmitCount ? r.submitCount : 0,
|
|
3198
3232
|
isDirty: _ ? !1 : d.keepDirty ? r.isDirty : !!(d.keepDefaultValues && !Le(u, n)),
|
|
3199
3233
|
isSubmitted: d.keepIsSubmitted ? r.isSubmitted : !1,
|
|
@@ -3205,7 +3239,7 @@ function gi(e = {}) {
|
|
|
3205
3239
|
defaultValues: n
|
|
3206
3240
|
});
|
|
3207
3241
|
}, Oe = (u, d) => Ne(he(u) ? u(i) : u, { ...t.resetOptions, ...d }), mt = (u, d = {}) => {
|
|
3208
|
-
const m =
|
|
3242
|
+
const m = V(s, u), S = m && m._f;
|
|
3209
3243
|
if (S) {
|
|
3210
3244
|
const _ = S.refs ? S.refs[0] : S.ref;
|
|
3211
3245
|
_.focus && setTimeout(() => {
|
|
@@ -3223,25 +3257,25 @@ function gi(e = {}) {
|
|
|
3223
3257
|
unregister: xe,
|
|
3224
3258
|
getFieldState: Qe,
|
|
3225
3259
|
handleSubmit: st,
|
|
3226
|
-
setError:
|
|
3227
|
-
_subscribe:
|
|
3228
|
-
_runSchema:
|
|
3229
|
-
_updateIsValidating:
|
|
3260
|
+
setError: O,
|
|
3261
|
+
_subscribe: Te,
|
|
3262
|
+
_runSchema: E,
|
|
3263
|
+
_updateIsValidating: A,
|
|
3230
3264
|
_focusError: we,
|
|
3231
|
-
_getWatch:
|
|
3232
|
-
_getDirty:
|
|
3265
|
+
_getWatch: L,
|
|
3266
|
+
_getDirty: C,
|
|
3233
3267
|
_setValid: k,
|
|
3234
|
-
_setFieldArray:
|
|
3268
|
+
_setFieldArray: v,
|
|
3235
3269
|
_setDisabledField: rt,
|
|
3236
3270
|
_setErrors: N,
|
|
3237
|
-
_getFieldArray:
|
|
3271
|
+
_getFieldArray: $,
|
|
3238
3272
|
_reset: Ne,
|
|
3239
3273
|
_resetDefaultValues: () => he(t.defaultValues) && t.defaultValues().then((u) => {
|
|
3240
3274
|
Oe(u, t.resetOptions), p.state.next({
|
|
3241
3275
|
isLoading: !1
|
|
3242
3276
|
});
|
|
3243
3277
|
}),
|
|
3244
|
-
_removeUnmounted:
|
|
3278
|
+
_removeUnmounted: I,
|
|
3245
3279
|
_disableForm: pt,
|
|
3246
3280
|
_subjects: p,
|
|
3247
3281
|
_proxyFormState: b,
|
|
@@ -3279,18 +3313,18 @@ function gi(e = {}) {
|
|
|
3279
3313
|
};
|
|
3280
3314
|
}
|
|
3281
3315
|
},
|
|
3282
|
-
subscribe:
|
|
3283
|
-
trigger:
|
|
3316
|
+
subscribe: De,
|
|
3317
|
+
trigger: Z,
|
|
3284
3318
|
register: Ue,
|
|
3285
3319
|
handleSubmit: st,
|
|
3286
3320
|
watch: tt,
|
|
3287
|
-
setValue:
|
|
3288
|
-
getValues:
|
|
3321
|
+
setValue: X,
|
|
3322
|
+
getValues: z,
|
|
3289
3323
|
reset: Oe,
|
|
3290
3324
|
resetField: nt,
|
|
3291
3325
|
clearErrors: et,
|
|
3292
3326
|
unregister: xe,
|
|
3293
|
-
setError:
|
|
3327
|
+
setError: O,
|
|
3294
3328
|
setFocus: mt,
|
|
3295
3329
|
getFieldState: Qe
|
|
3296
3330
|
};
|
|
@@ -3299,8 +3333,8 @@ function gi(e = {}) {
|
|
|
3299
3333
|
formControl: at
|
|
3300
3334
|
};
|
|
3301
3335
|
}
|
|
3302
|
-
function
|
|
3303
|
-
const t =
|
|
3336
|
+
function At(e = {}) {
|
|
3337
|
+
const t = ie.useRef(void 0), r = ie.useRef(void 0), [s, n] = ie.useState({
|
|
3304
3338
|
isDirty: !1,
|
|
3305
3339
|
isValidating: !1,
|
|
3306
3340
|
isLoading: he(e.defaultValues),
|
|
@@ -3324,14 +3358,14 @@ function St(e = {}) {
|
|
|
3324
3358
|
formState: s
|
|
3325
3359
|
}, e.defaultValues && !he(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
3326
3360
|
else {
|
|
3327
|
-
const { formControl: a, ...o } =
|
|
3361
|
+
const { formControl: a, ...o } = xi(e);
|
|
3328
3362
|
t.current = {
|
|
3329
3363
|
...o,
|
|
3330
3364
|
formState: s
|
|
3331
3365
|
};
|
|
3332
3366
|
}
|
|
3333
3367
|
const i = t.current.control;
|
|
3334
|
-
return i._options = e,
|
|
3368
|
+
return i._options = e, ni(() => {
|
|
3335
3369
|
const a = i._subscribe({
|
|
3336
3370
|
formState: i._proxyFormState,
|
|
3337
3371
|
callback: () => n({ ...i._formState }),
|
|
@@ -3341,68 +3375,68 @@ function St(e = {}) {
|
|
|
3341
3375
|
...o,
|
|
3342
3376
|
isReady: !0
|
|
3343
3377
|
})), i._formState.isReady = !0, a;
|
|
3344
|
-
}, [i]),
|
|
3378
|
+
}, [i]), ie.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), ie.useEffect(() => {
|
|
3345
3379
|
e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
|
|
3346
|
-
}, [i, e.mode, e.reValidateMode]),
|
|
3380
|
+
}, [i, e.mode, e.reValidateMode]), ie.useEffect(() => {
|
|
3347
3381
|
e.errors && (i._setErrors(e.errors), i._focusError());
|
|
3348
|
-
}, [i, e.errors]),
|
|
3382
|
+
}, [i, e.errors]), ie.useEffect(() => {
|
|
3349
3383
|
e.shouldUnregister && i._subjects.state.next({
|
|
3350
3384
|
values: i._getWatch()
|
|
3351
3385
|
});
|
|
3352
|
-
}, [i, e.shouldUnregister]),
|
|
3386
|
+
}, [i, e.shouldUnregister]), ie.useEffect(() => {
|
|
3353
3387
|
if (i._proxyFormState.isDirty) {
|
|
3354
3388
|
const a = i._getDirty();
|
|
3355
3389
|
a !== s.isDirty && i._subjects.state.next({
|
|
3356
3390
|
isDirty: a
|
|
3357
3391
|
});
|
|
3358
3392
|
}
|
|
3359
|
-
}, [i, s.isDirty]),
|
|
3393
|
+
}, [i, s.isDirty]), ie.useEffect(() => {
|
|
3360
3394
|
var a;
|
|
3361
3395
|
e.values && !Le(e.values, r.current) ? (i._reset(e.values, {
|
|
3362
3396
|
keepFieldsRef: !0,
|
|
3363
3397
|
...i._options.resetOptions
|
|
3364
3398
|
}), !((a = i._options.resetOptions) === null || a === void 0) && a.keepIsValid || i._setValid(), r.current = e.values, n((o) => ({ ...o }))) : i._resetDefaultValues();
|
|
3365
|
-
}, [i, e.values]),
|
|
3399
|
+
}, [i, e.values]), ie.useEffect(() => {
|
|
3366
3400
|
i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
3367
|
-
}), t.current.formState =
|
|
3401
|
+
}), t.current.formState = ie.useMemo(() => si(s, i), [i, s]), t.current;
|
|
3368
3402
|
}
|
|
3369
|
-
const
|
|
3403
|
+
const Dr = (e, t, r) => {
|
|
3370
3404
|
if (e && "reportValidity" in e) {
|
|
3371
|
-
const s =
|
|
3405
|
+
const s = V(r, t);
|
|
3372
3406
|
e.setCustomValidity(s && s.message || ""), e.reportValidity();
|
|
3373
3407
|
}
|
|
3374
|
-
},
|
|
3408
|
+
}, wi = (e, t) => {
|
|
3375
3409
|
for (const r in t.fields) {
|
|
3376
3410
|
const s = t.fields[r];
|
|
3377
|
-
s && s.ref && "reportValidity" in s.ref ?
|
|
3411
|
+
s && s.ref && "reportValidity" in s.ref ? Dr(s.ref, r, e) : s.refs && s.refs.forEach((n) => Dr(n, r, e));
|
|
3378
3412
|
}
|
|
3379
|
-
},
|
|
3380
|
-
t.shouldUseNativeValidation &&
|
|
3413
|
+
}, _i = (e, t) => {
|
|
3414
|
+
t.shouldUseNativeValidation && wi(e, t);
|
|
3381
3415
|
const r = {};
|
|
3382
3416
|
for (const s in e) {
|
|
3383
|
-
const n =
|
|
3384
|
-
if (
|
|
3385
|
-
const a = Object.assign({},
|
|
3386
|
-
|
|
3387
|
-
} else
|
|
3417
|
+
const n = V(t.fields, s), i = Object.assign(e[s] || {}, { ref: n && n.ref });
|
|
3418
|
+
if (ki(t.names || Object.keys(e), s)) {
|
|
3419
|
+
const a = Object.assign({}, V(r, s));
|
|
3420
|
+
J(a, "root", i), J(r, s, a);
|
|
3421
|
+
} else J(r, s, i);
|
|
3388
3422
|
}
|
|
3389
3423
|
return r;
|
|
3390
|
-
},
|
|
3391
|
-
var
|
|
3424
|
+
}, ki = (e, t) => e.some((r) => r.startsWith(t + "."));
|
|
3425
|
+
var It = function(e, t, r) {
|
|
3392
3426
|
return r === void 0 && (r = {}), function(s, n, i) {
|
|
3393
3427
|
try {
|
|
3394
3428
|
var a = !i.shouldUseNativeValidation && i.criteriaMode === "all";
|
|
3395
|
-
return Promise.resolve(/* @__PURE__ */
|
|
3429
|
+
return Promise.resolve(/* @__PURE__ */ Ta(e, s, Object.assign({}, t, { abortPipeEarly: !a }))).then(function(o) {
|
|
3396
3430
|
if (o.issues) {
|
|
3397
3431
|
for (var l = {}; o.issues.length; ) {
|
|
3398
|
-
var f = o.issues[0], h = /* @__PURE__ */
|
|
3432
|
+
var f = o.issues[0], h = /* @__PURE__ */ Va(f);
|
|
3399
3433
|
if (h && (l[h] || (l[h] = { message: f.message, type: f.type }), a)) {
|
|
3400
3434
|
var b = l[h].types, g = b && b[f.type];
|
|
3401
3435
|
l[h] = Cs(h, a, l, f.type, g ? [].concat(g, f.message) : f.message);
|
|
3402
3436
|
}
|
|
3403
3437
|
o.issues.shift();
|
|
3404
3438
|
}
|
|
3405
|
-
return { values: {}, errors:
|
|
3439
|
+
return { values: {}, errors: _i(l, i) };
|
|
3406
3440
|
}
|
|
3407
3441
|
return { values: r.raw ? s : o.output, errors: {} };
|
|
3408
3442
|
});
|
|
@@ -3411,24 +3445,24 @@ var At = function(e, t, r) {
|
|
|
3411
3445
|
}
|
|
3412
3446
|
};
|
|
3413
3447
|
};
|
|
3414
|
-
const Nr = 27, Or = 12,
|
|
3448
|
+
const Nr = 27, Or = 12, $r = 10, Ci = Xe("enum"), Si = (e, t) => {
|
|
3415
3449
|
const r = {
|
|
3416
3450
|
min: e.minSelected ?? 0,
|
|
3417
3451
|
max: e.maxSelected ?? e.options.length
|
|
3418
3452
|
};
|
|
3419
|
-
return
|
|
3453
|
+
return It(
|
|
3420
3454
|
/* @__PURE__ */ Ae({
|
|
3421
3455
|
checked: /* @__PURE__ */ Me(
|
|
3422
|
-
/* @__PURE__ */ bs(/* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3456
|
+
/* @__PURE__ */ bs(/* @__PURE__ */ ce(), /* @__PURE__ */ ps()),
|
|
3457
|
+
/* @__PURE__ */ Xt(
|
|
3424
3458
|
(s) => Object.entries(s).filter(([n, i]) => i).map(([n, i]) => n)
|
|
3425
3459
|
),
|
|
3426
3460
|
/* @__PURE__ */ ut(r.max, t("validation_multiple_choice_max", { count: r.max })),
|
|
3427
|
-
/* @__PURE__ */
|
|
3461
|
+
/* @__PURE__ */ Ge(r.min, t("validation_multiple_choice_min", { count: r.min }))
|
|
3428
3462
|
)
|
|
3429
3463
|
})
|
|
3430
3464
|
);
|
|
3431
|
-
},
|
|
3465
|
+
}, Ai = Xr(({ option: e, ...t }, r) => /* @__PURE__ */ c(ge, { children: [
|
|
3432
3466
|
/* @__PURE__ */ c("input", { class: "peer sr-only h-full", type: "checkbox", ...t, ref: r }),
|
|
3433
3467
|
/* @__PURE__ */ c(
|
|
3434
3468
|
"label",
|
|
@@ -3438,7 +3472,7 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3438
3472
|
children: e.label
|
|
3439
3473
|
}
|
|
3440
3474
|
)
|
|
3441
|
-
] })),
|
|
3475
|
+
] })), Br = _t(
|
|
3442
3476
|
"gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4",
|
|
3443
3477
|
{
|
|
3444
3478
|
variants: {
|
|
@@ -3450,30 +3484,30 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3450
3484
|
}
|
|
3451
3485
|
}
|
|
3452
3486
|
}
|
|
3453
|
-
),
|
|
3487
|
+
), Ii = ({ input: e, onSubmitSuccess: t }) => {
|
|
3454
3488
|
var h, b;
|
|
3455
|
-
const r = e.key ? (h =
|
|
3489
|
+
const r = e.key ? (h = W.current$.value.flow) == null ? void 0 : h.data.submissions[e.key] : void 0, s = e.config.maxSelected === 1, n = s && e.config.options.length === 2, { t: i } = ne(), {
|
|
3456
3490
|
register: a,
|
|
3457
3491
|
handleSubmit: o,
|
|
3458
3492
|
formState: { errors: l }
|
|
3459
|
-
} =
|
|
3493
|
+
} = At({
|
|
3460
3494
|
defaultValues: {
|
|
3461
|
-
checked: s ? {} :
|
|
3495
|
+
checked: s ? {} : Ci(r) ? Object.fromEntries(r.value.map((g) => [g, !0])) : {}
|
|
3462
3496
|
},
|
|
3463
|
-
resolver:
|
|
3464
|
-
}), f =
|
|
3497
|
+
resolver: Si(e.config, i)
|
|
3498
|
+
}), f = Qt();
|
|
3465
3499
|
return n ? /* @__PURE__ */ c(ge, { children: [
|
|
3466
3500
|
/* @__PURE__ */ c(
|
|
3467
3501
|
"ul",
|
|
3468
3502
|
{
|
|
3469
|
-
style: { maxHeight: 6.5 * Nr + 5 * Or + 2 *
|
|
3470
|
-
class:
|
|
3503
|
+
style: { maxHeight: 6.5 * Nr + 5 * Or + 2 * $r },
|
|
3504
|
+
class: Br({ variant: "booleanLike" }),
|
|
3471
3505
|
children: e.config.options.map((g, p) => /* @__PURE__ */ c("li", { class: ws, children: /* @__PURE__ */ c(
|
|
3472
3506
|
_s,
|
|
3473
3507
|
{
|
|
3474
3508
|
type: "submit",
|
|
3475
|
-
ref: (
|
|
3476
|
-
|
|
3509
|
+
ref: (x) => {
|
|
3510
|
+
x && p === 0 && (f.current = x);
|
|
3477
3511
|
},
|
|
3478
3512
|
label: g.label,
|
|
3479
3513
|
value: "true",
|
|
@@ -3483,7 +3517,7 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3483
3517
|
}
|
|
3484
3518
|
),
|
|
3485
3519
|
e.config.minSelected === 0 && /* @__PURE__ */ c("div", { class: "px-2 pb-2", children: /* @__PURE__ */ c(
|
|
3486
|
-
|
|
3520
|
+
Ie,
|
|
3487
3521
|
{
|
|
3488
3522
|
class: "relative w-full",
|
|
3489
3523
|
type: "button",
|
|
@@ -3495,29 +3529,29 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3495
3529
|
{
|
|
3496
3530
|
noValidate: !0,
|
|
3497
3531
|
onSubmit: (g) => o((p) => {
|
|
3498
|
-
const
|
|
3499
|
-
t({ type: "enum", value:
|
|
3532
|
+
const x = p.checked;
|
|
3533
|
+
t({ type: "enum", value: x });
|
|
3500
3534
|
})(g),
|
|
3501
3535
|
children: [
|
|
3502
3536
|
/* @__PURE__ */ c("div", { class: "flex items-center gap-1", children: [
|
|
3503
3537
|
/* @__PURE__ */ c(
|
|
3504
3538
|
"ul",
|
|
3505
3539
|
{
|
|
3506
|
-
style: { maxHeight: 6.5 * Nr + 5 * Or + 2 *
|
|
3507
|
-
class:
|
|
3540
|
+
style: { maxHeight: 6.5 * Nr + 5 * Or + 2 * $r },
|
|
3541
|
+
class: Br({
|
|
3508
3542
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3509
3543
|
}),
|
|
3510
3544
|
children: e.config.options.map((g, p) => {
|
|
3511
|
-
const
|
|
3545
|
+
const x = `checked.${g.value}`, { ref: w, ...k } = a(x);
|
|
3512
3546
|
return /* @__PURE__ */ c("li", { class: "relative", children: /* @__PURE__ */ c(
|
|
3513
|
-
|
|
3547
|
+
Ai,
|
|
3514
3548
|
{
|
|
3515
3549
|
option: g,
|
|
3516
3550
|
autoFocus: p === 0,
|
|
3517
|
-
ref: (
|
|
3518
|
-
|
|
3551
|
+
ref: (A) => {
|
|
3552
|
+
A && p === 0 && (f.current = A), w(A);
|
|
3519
3553
|
},
|
|
3520
|
-
id:
|
|
3554
|
+
id: x,
|
|
3521
3555
|
...k,
|
|
3522
3556
|
onClick: s ? () => t({ type: "enum", value: [g.value] }) : void 0
|
|
3523
3557
|
}
|
|
@@ -3527,16 +3561,16 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3527
3561
|
),
|
|
3528
3562
|
/* @__PURE__ */ c("div", { class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5", children: [
|
|
3529
3563
|
s ? null : /* @__PURE__ */ c(Pe, {}),
|
|
3530
|
-
e.config.minSelected === 0 && /* @__PURE__ */ c(
|
|
3564
|
+
e.config.minSelected === 0 && /* @__PURE__ */ c(Ie, { class: "relative", type: "button", onClick: () => t({ type: "enum", value: [] }) })
|
|
3531
3565
|
] })
|
|
3532
3566
|
] }),
|
|
3533
3567
|
/* @__PURE__ */ c("div", { class: "px-1", children: /* @__PURE__ */ c(Ye, { error: (b = l.checked) == null ? void 0 : b.root }) })
|
|
3534
3568
|
]
|
|
3535
3569
|
}
|
|
3536
3570
|
);
|
|
3537
|
-
},
|
|
3571
|
+
}, Ei = Xe("number"), Fi = (e, t) => {
|
|
3538
3572
|
const r = e.min ?? Number.MIN_SAFE_INTEGER, s = e.max ?? Number.MAX_SAFE_INTEGER, n = e.decimalCases ?? 0;
|
|
3539
|
-
return
|
|
3573
|
+
return It(
|
|
3540
3574
|
/* @__PURE__ */ Ae({
|
|
3541
3575
|
number: /* @__PURE__ */ Me(
|
|
3542
3576
|
/* @__PURE__ */ ms(t("validation_number")),
|
|
@@ -3549,17 +3583,17 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3549
3583
|
)
|
|
3550
3584
|
})
|
|
3551
3585
|
);
|
|
3552
|
-
},
|
|
3586
|
+
}, Vi = ({ input: e, onSubmitSuccess: t }) => {
|
|
3553
3587
|
var b;
|
|
3554
|
-
const r = e.config.defaultValue, s = e.key ? (b =
|
|
3588
|
+
const r = e.config.defaultValue, s = e.key ? (b = W.current$.value.flow) == null ? void 0 : b.data.submissions[e.key] : void 0, { t: n } = ne(), {
|
|
3555
3589
|
register: i,
|
|
3556
3590
|
handleSubmit: a,
|
|
3557
3591
|
formState: { errors: o }
|
|
3558
|
-
} =
|
|
3592
|
+
} = At({
|
|
3559
3593
|
defaultValues: {
|
|
3560
|
-
number:
|
|
3594
|
+
number: Ei(s) ? s.value : r ? Number(r) : void 0
|
|
3561
3595
|
},
|
|
3562
|
-
resolver:
|
|
3596
|
+
resolver: Fi(e.config, n)
|
|
3563
3597
|
}), { ref: l, ...f } = i("number", { required: !e.config.optional, valueAsNumber: !0 }), h = fe();
|
|
3564
3598
|
return Re(() => {
|
|
3565
3599
|
h.current && (h.current.focus(), h.current.select());
|
|
@@ -3595,7 +3629,7 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3595
3629
|
placeholder: e.config.placeholder
|
|
3596
3630
|
}
|
|
3597
3631
|
),
|
|
3598
|
-
e.config.optional && /* @__PURE__ */ c(
|
|
3632
|
+
e.config.optional && /* @__PURE__ */ c(Ie, { class: "absolute bottom-0 right-0.5 top-0", onClick: () => t(null) })
|
|
3599
3633
|
] }),
|
|
3600
3634
|
/* @__PURE__ */ c(Pe, {})
|
|
3601
3635
|
] }),
|
|
@@ -3603,37 +3637,37 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3603
3637
|
]
|
|
3604
3638
|
}
|
|
3605
3639
|
);
|
|
3606
|
-
},
|
|
3640
|
+
}, Li = "44", Mi = /^[0-9 ]+$/, Ri = Xe("string"), Ti = Xe("phone"), Di = (e) => {
|
|
3607
3641
|
const t = /* @__PURE__ */ Me(
|
|
3608
|
-
/* @__PURE__ */
|
|
3609
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ ce(e("validation_country_code")),
|
|
3643
|
+
/* @__PURE__ */ Zt(Mi, e("validation_country_code"))
|
|
3610
3644
|
), r = /* @__PURE__ */ Me(
|
|
3611
|
-
/* @__PURE__ */
|
|
3612
|
-
/* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3645
|
+
/* @__PURE__ */ ce(e("validation_phone")),
|
|
3646
|
+
/* @__PURE__ */ Ge(1, e("validation_phone")),
|
|
3647
|
+
/* @__PURE__ */ Xt((s) => s.replace(/[^0-9]/g, ""))
|
|
3614
3648
|
);
|
|
3615
|
-
return
|
|
3649
|
+
return It(
|
|
3616
3650
|
/* @__PURE__ */ Ae({
|
|
3617
3651
|
countryCode: t,
|
|
3618
3652
|
phoneNumber: r
|
|
3619
3653
|
})
|
|
3620
3654
|
);
|
|
3621
|
-
},
|
|
3655
|
+
}, Ni = ({ input: e, onSubmitSuccess: t }) => {
|
|
3622
3656
|
var w;
|
|
3623
|
-
const r = e.key ? (w =
|
|
3657
|
+
const r = e.key ? (w = W.current$.value.flow) == null ? void 0 : w.data.submissions[e.key] : void 0, { t: s } = ne(), [n, i] = Se(), a = Ri(r) ? Da(r.value) : Ti(r) ? r.value : void 0, {
|
|
3624
3658
|
register: o,
|
|
3625
3659
|
handleSubmit: l,
|
|
3626
3660
|
formState: { errors: f },
|
|
3627
3661
|
watch: h
|
|
3628
|
-
} =
|
|
3662
|
+
} = At({
|
|
3629
3663
|
defaultValues: {
|
|
3630
|
-
countryCode: (a == null ? void 0 : a.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3664
|
+
countryCode: (a == null ? void 0 : a.countryCode) ?? e.config.defaultValue.countryCode ?? Li,
|
|
3631
3665
|
phoneNumber: (a == null ? void 0 : a.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3632
3666
|
},
|
|
3633
|
-
resolver:
|
|
3667
|
+
resolver: Di(s)
|
|
3634
3668
|
}), { ref: b, ...g } = o("phoneNumber", {
|
|
3635
3669
|
required: !e.config.optional
|
|
3636
|
-
}), p = fe(),
|
|
3670
|
+
}), p = fe(), x = h("countryCode");
|
|
3637
3671
|
return Re(() => {
|
|
3638
3672
|
p.current && (p.current.focus(), p.current.select());
|
|
3639
3673
|
}, []), /* @__PURE__ */ c(
|
|
@@ -3642,16 +3676,16 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3642
3676
|
noValidate: !0,
|
|
3643
3677
|
class: "flex flex-col gap-1 p-2.5",
|
|
3644
3678
|
onSubmit: l((k) => {
|
|
3645
|
-
const
|
|
3679
|
+
const A = k.phoneNumber.replace(/[^0-9]/g, ""), v = k.countryCode.replace(/[^0-9]/g, "");
|
|
3646
3680
|
i(void 0);
|
|
3647
|
-
const
|
|
3648
|
-
if (N <
|
|
3649
|
-
const
|
|
3650
|
-
if (
|
|
3681
|
+
const R = e.config.minChars ?? 7, N = A.length + v.length;
|
|
3682
|
+
if (N < R) return i(s("validation_phone_min_chars", { count: R }));
|
|
3683
|
+
const T = e.config.maxChars;
|
|
3684
|
+
if (T != null && N > T) return i(s("validation_max_chars", { count: T }));
|
|
3651
3685
|
e.config.submissionFormat === "phone" ? t({
|
|
3652
3686
|
type: "phone",
|
|
3653
|
-
value: { countryCode:
|
|
3654
|
-
}) : t({ type: "string", value:
|
|
3687
|
+
value: { countryCode: v, phoneNumber: A }
|
|
3688
|
+
}) : t({ type: "string", value: x + k.phoneNumber });
|
|
3655
3689
|
}),
|
|
3656
3690
|
children: [
|
|
3657
3691
|
/* @__PURE__ */ c("div", { class: "flex items-center gap-2", children: [
|
|
@@ -3664,12 +3698,12 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3664
3698
|
children: [
|
|
3665
3699
|
/* @__PURE__ */ c("span", { children: [
|
|
3666
3700
|
"+",
|
|
3667
|
-
|
|
3701
|
+
x
|
|
3668
3702
|
] }),
|
|
3669
|
-
/* @__PURE__ */ c("select", { ...o("countryCode", {}), id: `isdk_phone_${e.key}`, class: "absolute inset-0 opacity-0", children: Object.entries(
|
|
3703
|
+
/* @__PURE__ */ c("select", { ...o("countryCode", {}), id: `isdk_phone_${e.key}`, class: "absolute inset-0 opacity-0", children: Object.entries(Yt).map(([k, A]) => /* @__PURE__ */ c("option", { value: A, children: [
|
|
3670
3704
|
k,
|
|
3671
3705
|
" (+",
|
|
3672
|
-
|
|
3706
|
+
A,
|
|
3673
3707
|
")"
|
|
3674
3708
|
] }, k)) })
|
|
3675
3709
|
]
|
|
@@ -3693,7 +3727,7 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3693
3727
|
placeholder: e.config.placeholder
|
|
3694
3728
|
}
|
|
3695
3729
|
),
|
|
3696
|
-
e.config.optional && /* @__PURE__ */ c(
|
|
3730
|
+
e.config.optional && /* @__PURE__ */ c(Ie, { class: "absolute bottom-0 right-1 top-0", onClick: () => t(null) })
|
|
3697
3731
|
] }),
|
|
3698
3732
|
/* @__PURE__ */ c(Pe, {})
|
|
3699
3733
|
] }),
|
|
@@ -3701,17 +3735,17 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3701
3735
|
]
|
|
3702
3736
|
}
|
|
3703
3737
|
);
|
|
3704
|
-
},
|
|
3738
|
+
}, gt = (e) => e === void 0 ? 0 : Math.max(0, Math.ceil((e - Date.now()) / 1e3)), jr = (e, t, r, s) => r !== void 0 && s * 1e3 > Zr ? e("submission_available_at", { time: Jr(r, t) }) : e("submission_cooldown", { count: s }), Oi = (e, t) => {
|
|
3705
3739
|
const r = e == null ? void 0 : e.trim();
|
|
3706
3740
|
return r && r !== "Submit" ? r : t("submit");
|
|
3707
|
-
},
|
|
3708
|
-
const { t: r, locale: s } =
|
|
3709
|
-
|
|
3710
|
-
const h =
|
|
3741
|
+
}, $i = ({ input: e, onSubmitSuccess: t }) => {
|
|
3742
|
+
const { t: r, locale: s } = ne(), { availableAt: n } = e.config, [i, a] = Se(() => gt(n)), [o, l] = Se("");
|
|
3743
|
+
kt(() => {
|
|
3744
|
+
const h = gt(n);
|
|
3711
3745
|
if (a(h), h === 0) return;
|
|
3712
|
-
l(
|
|
3746
|
+
l(jr(r, s, n, h));
|
|
3713
3747
|
const b = setInterval(() => {
|
|
3714
|
-
const g =
|
|
3748
|
+
const g = gt(n);
|
|
3715
3749
|
a(g), !(g > 0) && (clearInterval(b), l(r("submission_cooldown_ready")));
|
|
3716
3750
|
}, 250);
|
|
3717
3751
|
return () => clearInterval(b);
|
|
@@ -3726,10 +3760,10 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3726
3760
|
"aria-disabled": f,
|
|
3727
3761
|
"aria-describedby": f ? "submit-cooldown" : void 0,
|
|
3728
3762
|
onClick: () => {
|
|
3729
|
-
|
|
3763
|
+
gt(n) > 0 || t(null);
|
|
3730
3764
|
},
|
|
3731
3765
|
children: /* @__PURE__ */ c("span", { class: "flex items-center gap-1.5", children: [
|
|
3732
|
-
/* @__PURE__ */ c("span", { class: "inline-flex items-center text-sm font-medium", children:
|
|
3766
|
+
/* @__PURE__ */ c("span", { class: "inline-flex items-center text-sm font-medium", children: Oi(e.config.label, r) }),
|
|
3733
3767
|
/* @__PURE__ */ c(
|
|
3734
3768
|
"svg",
|
|
3735
3769
|
{
|
|
@@ -3749,11 +3783,11 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3749
3783
|
] })
|
|
3750
3784
|
}
|
|
3751
3785
|
),
|
|
3752
|
-
f && /* @__PURE__ */ c("p", { id: "submit-cooldown", "aria-hidden": "true", class: "text-neutral-11 text-xs", children:
|
|
3786
|
+
f && /* @__PURE__ */ c("p", { id: "submit-cooldown", "aria-hidden": "true", class: "text-neutral-11 text-xs", children: jr(r, s, n, i) }),
|
|
3753
3787
|
/* @__PURE__ */ c("p", { role: "status", class: "sr-only", children: o })
|
|
3754
3788
|
] });
|
|
3755
|
-
},
|
|
3756
|
-
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight,
|
|
3789
|
+
}, Bi = 160, Pr = (e) => {
|
|
3790
|
+
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, Bi)}px`;
|
|
3757
3791
|
}, ji = {
|
|
3758
3792
|
date: {
|
|
3759
3793
|
type: "date",
|
|
@@ -3773,52 +3807,52 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3773
3807
|
inputMode: "url",
|
|
3774
3808
|
formNoValidate: !0
|
|
3775
3809
|
}
|
|
3776
|
-
},
|
|
3810
|
+
}, Pi = Xe("string"), Ui = (e, t) => {
|
|
3777
3811
|
const r = {
|
|
3778
3812
|
maxLength: t("validation_max_chars", { count: e.maxChars ?? 999 }),
|
|
3779
3813
|
minLength: t("validation_min_chars", { count: e.minChars ?? 1 })
|
|
3780
3814
|
};
|
|
3781
|
-
return
|
|
3815
|
+
return It(
|
|
3782
3816
|
/* @__PURE__ */ Ae({
|
|
3783
3817
|
text: {
|
|
3784
|
-
date: /* @__PURE__ */ Me(/* @__PURE__ */
|
|
3818
|
+
date: /* @__PURE__ */ Me(/* @__PURE__ */ ce(t("validation_date")), /* @__PURE__ */ Zt(/^\d{4}-\d{2}-\d{2}$/, t("validation_date"))),
|
|
3785
3819
|
email: /* @__PURE__ */ Me(
|
|
3786
|
-
/* @__PURE__ */
|
|
3820
|
+
/* @__PURE__ */ ce(t("validation_email")),
|
|
3787
3821
|
/* @__PURE__ */ ls(t("validation_email")),
|
|
3788
|
-
/* @__PURE__ */
|
|
3822
|
+
/* @__PURE__ */ Ge(e.minChars ?? 1, r.minLength),
|
|
3789
3823
|
/* @__PURE__ */ ut(e.maxChars ?? 1 / 0, r.maxLength)
|
|
3790
3824
|
),
|
|
3791
3825
|
text: /* @__PURE__ */ Me(
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
3826
|
+
/* @__PURE__ */ ce(),
|
|
3827
|
+
/* @__PURE__ */ Ge(e.minChars ?? 1, r.minLength),
|
|
3794
3828
|
/* @__PURE__ */ ut(e.maxChars ?? 1 / 0, r.maxLength)
|
|
3795
3829
|
),
|
|
3796
3830
|
url: /* @__PURE__ */ Me(
|
|
3797
|
-
/* @__PURE__ */
|
|
3831
|
+
/* @__PURE__ */ ce(t("validation_url")),
|
|
3798
3832
|
/* @__PURE__ */ ds(t("validation_url")),
|
|
3799
|
-
/* @__PURE__ */
|
|
3833
|
+
/* @__PURE__ */ Ge(e.minChars ?? 1, r.minLength),
|
|
3800
3834
|
/* @__PURE__ */ ut(e.maxChars ?? 1 / 0, r.maxLength)
|
|
3801
3835
|
)
|
|
3802
3836
|
}[e.format]
|
|
3803
3837
|
})
|
|
3804
3838
|
);
|
|
3805
|
-
},
|
|
3839
|
+
}, qi = ({ input: e, onSubmitSuccess: t }) => {
|
|
3806
3840
|
var w;
|
|
3807
|
-
const { t: r } =
|
|
3841
|
+
const { t: r } = ne(), s = e.key ? (w = W.current$.value.flow) == null ? void 0 : w.data.submissions[e.key] : void 0, n = e.config.defaultValue, i = e.config.multiline === !0 && e.config.format === "text", {
|
|
3808
3842
|
register: a,
|
|
3809
3843
|
handleSubmit: o,
|
|
3810
3844
|
watch: l,
|
|
3811
3845
|
formState: { errors: f }
|
|
3812
|
-
} =
|
|
3846
|
+
} = At({
|
|
3813
3847
|
defaultValues: {
|
|
3814
|
-
text:
|
|
3848
|
+
text: Pi(s) ? s.value : n ?? ""
|
|
3815
3849
|
},
|
|
3816
|
-
resolver:
|
|
3850
|
+
resolver: Ui(e.config, r)
|
|
3817
3851
|
}), { ref: h, ...b } = a("text", { required: !e.config.optional }), g = fe();
|
|
3818
3852
|
Re(() => {
|
|
3819
3853
|
g.current && (g.current instanceof HTMLTextAreaElement && Pr(g.current), g.current.focus(), g.current.select());
|
|
3820
3854
|
}, []);
|
|
3821
|
-
const p = e.config.maxChars,
|
|
3855
|
+
const p = e.config.maxChars, x = i && p !== void 0 ? l("text").length : void 0;
|
|
3822
3856
|
return /* @__PURE__ */ c(
|
|
3823
3857
|
"form",
|
|
3824
3858
|
{
|
|
@@ -3838,11 +3872,11 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3838
3872
|
rows: 2,
|
|
3839
3873
|
maxLength: p,
|
|
3840
3874
|
autoFocus: !0,
|
|
3841
|
-
"aria-describedby":
|
|
3875
|
+
"aria-describedby": x !== void 0 ? "chat-input-count" : void 0,
|
|
3842
3876
|
onInput: (k) => Pr(k.currentTarget),
|
|
3843
3877
|
onKeyDown: (k) => {
|
|
3844
|
-
var
|
|
3845
|
-
k.key === "Enter" && (k.ctrlKey || k.metaKey) && (k.preventDefault(), (
|
|
3878
|
+
var A;
|
|
3879
|
+
k.key === "Enter" && (k.ctrlKey || k.metaKey) && (k.preventDefault(), (A = k.currentTarget.form) == null || A.requestSubmit());
|
|
3846
3880
|
},
|
|
3847
3881
|
ref: (k) => {
|
|
3848
3882
|
k && (g.current = k), h(k);
|
|
@@ -3871,7 +3905,7 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3871
3905
|
}
|
|
3872
3906
|
),
|
|
3873
3907
|
e.config.optional && /* @__PURE__ */ c(
|
|
3874
|
-
|
|
3908
|
+
Ie,
|
|
3875
3909
|
{
|
|
3876
3910
|
class: i ? "absolute bottom-1 right-0.5" : "absolute bottom-0 right-0.5 top-0",
|
|
3877
3911
|
onClick: () => t(null)
|
|
@@ -3880,8 +3914,8 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3880
3914
|
] }),
|
|
3881
3915
|
/* @__PURE__ */ c(Pe, {})
|
|
3882
3916
|
] }),
|
|
3883
|
-
|
|
3884
|
-
|
|
3917
|
+
x !== void 0 && p !== void 0 && /* @__PURE__ */ c("p", { id: "chat-input-count", class: "text-neutral-10 px-3 text-right text-xs", children: [
|
|
3918
|
+
x,
|
|
3885
3919
|
"/",
|
|
3886
3920
|
p
|
|
3887
3921
|
] }),
|
|
@@ -3889,22 +3923,22 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3889
3923
|
]
|
|
3890
3924
|
}
|
|
3891
3925
|
);
|
|
3892
|
-
},
|
|
3893
|
-
text:
|
|
3894
|
-
phone:
|
|
3895
|
-
"multiple-choice":
|
|
3896
|
-
boolean:
|
|
3897
|
-
file:
|
|
3898
|
-
submit:
|
|
3899
|
-
address:
|
|
3900
|
-
number:
|
|
3901
|
-
},
|
|
3926
|
+
}, zi = {
|
|
3927
|
+
text: qi,
|
|
3928
|
+
phone: Ni,
|
|
3929
|
+
"multiple-choice": Ii,
|
|
3930
|
+
boolean: Wa,
|
|
3931
|
+
file: Xa,
|
|
3932
|
+
submit: $i,
|
|
3933
|
+
address: Pa,
|
|
3934
|
+
number: Vi
|
|
3935
|
+
}, Wi = ({
|
|
3902
3936
|
logger: e,
|
|
3903
3937
|
analytics: t,
|
|
3904
3938
|
rpcClient: r
|
|
3905
3939
|
}) => {
|
|
3906
3940
|
var a;
|
|
3907
|
-
const s = (a =
|
|
3941
|
+
const s = (a = W.current$.value.flow) == null ? void 0 : a.data.currentInput, n = fe(null), i = () => ue.onInteractionFn$.value();
|
|
3908
3942
|
return Re(() => {
|
|
3909
3943
|
var o;
|
|
3910
3944
|
(o = n.current) == null || o.scrollTo({ top: 0 });
|
|
@@ -3920,7 +3954,7 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3920
3954
|
onPointerDownCapture: s ? i : void 0,
|
|
3921
3955
|
onKeyDownCapture: s ? i : void 0,
|
|
3922
3956
|
children: s ? (() => {
|
|
3923
|
-
const o =
|
|
3957
|
+
const o = zi[s.type];
|
|
3924
3958
|
return /* @__PURE__ */ c(
|
|
3925
3959
|
o,
|
|
3926
3960
|
{
|
|
@@ -3948,30 +3982,30 @@ const Nr = 27, Or = 12, jr = 10, _i = Xe("enum"), ki = (e, t) => {
|
|
|
3948
3982
|
}
|
|
3949
3983
|
);
|
|
3950
3984
|
};
|
|
3951
|
-
function
|
|
3985
|
+
function Hi(e) {
|
|
3952
3986
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3953
3987
|
}
|
|
3954
|
-
var
|
|
3988
|
+
var Gi = function(e) {
|
|
3955
3989
|
return e instanceof RegExp;
|
|
3956
|
-
},
|
|
3990
|
+
}, Ki = function(t) {
|
|
3957
3991
|
var r = /[\\^$.*+?()[\]{}|]/g, s = RegExp(r.source);
|
|
3958
3992
|
return t && s.test(t) ? t.replace(r, "\\$&") : t;
|
|
3959
3993
|
}, Ls = function(e) {
|
|
3960
3994
|
return typeof e == "string";
|
|
3961
|
-
},
|
|
3995
|
+
}, Ji = function(e) {
|
|
3962
3996
|
var t = [];
|
|
3963
3997
|
return e.forEach(function(r) {
|
|
3964
3998
|
Array.isArray(r) ? t = t.concat(r) : t.push(r);
|
|
3965
3999
|
}), t;
|
|
3966
4000
|
};
|
|
3967
|
-
function
|
|
4001
|
+
function Zi(e, t, r) {
|
|
3968
4002
|
var s = 0, n = 0;
|
|
3969
4003
|
if (e === "")
|
|
3970
4004
|
return e;
|
|
3971
4005
|
if (!e || !Ls(e))
|
|
3972
4006
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
3973
4007
|
var i = t;
|
|
3974
|
-
|
|
4008
|
+
Gi(i) || (i = new RegExp("(" + Ki(i) + ")", "gi"));
|
|
3975
4009
|
for (var a = e.split(i), o = 1, l = a.length; o < l; o += 2) {
|
|
3976
4010
|
if (a[o] === void 0 || a[o - 1] === void 0) {
|
|
3977
4011
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
@@ -3981,19 +4015,19 @@ function Gi(e, t, r) {
|
|
|
3981
4015
|
}
|
|
3982
4016
|
return a;
|
|
3983
4017
|
}
|
|
3984
|
-
var
|
|
3985
|
-
return Array.isArray(t) || (t = [t]),
|
|
3986
|
-
return Ls(n) ?
|
|
4018
|
+
var Xi = function(t, r, s) {
|
|
4019
|
+
return Array.isArray(t) || (t = [t]), Ji(t.map(function(n) {
|
|
4020
|
+
return Ls(n) ? Zi(n, r, s) : n;
|
|
3987
4021
|
}));
|
|
3988
4022
|
};
|
|
3989
|
-
const ot = /* @__PURE__ */
|
|
3990
|
-
const t = ot(e,
|
|
3991
|
-
const [, f, h] = o.match(
|
|
4023
|
+
const ot = /* @__PURE__ */ Hi(Xi), Yi = /(\[[^\]]+\]\([^)]+\))/g, Qi = /\[([^\]]+)\]\(([^)]+)\)/, eo = /(https?:\/\/[^\s]+)/g, to = /_(.*?)_/g, ro = /\*\*(.*?)\*\*/g, so = /(\\n|\n)/g, Ur = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", no = (e) => {
|
|
4024
|
+
const t = ot(e, Yi, (o, l) => {
|
|
4025
|
+
const [, f, h] = o.match(Qi) ?? [];
|
|
3992
4026
|
return h ? /* @__PURE__ */ c("a", { class: Ur, href: h, children: f ?? h }, h + l) : /* @__PURE__ */ c("span", { children: "INVALID LINK" });
|
|
3993
|
-
}), r = ot(t,
|
|
4027
|
+
}), r = ot(t, eo, (o, l) => /* @__PURE__ */ c("a", { class: Ur, href: o, children: o }, o + l)), s = ot(r, to, (o, l) => /* @__PURE__ */ c("em", { children: o }, o + l)), n = ot(s, ro, (o, l) => /* @__PURE__ */ c("strong", { children: o }, o + l));
|
|
3994
4028
|
let i = 0;
|
|
3995
|
-
return ot(n,
|
|
3996
|
-
},
|
|
4029
|
+
return ot(n, so, () => /* @__PURE__ */ c("br", {}, `br-${i++}`));
|
|
4030
|
+
}, ao = _t(
|
|
3997
4031
|
"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",
|
|
3998
4032
|
{
|
|
3999
4033
|
variants: {
|
|
@@ -4010,21 +4044,21 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4010
4044
|
side: "left"
|
|
4011
4045
|
}
|
|
4012
4046
|
}
|
|
4013
|
-
),
|
|
4047
|
+
), io = ({ children: e, className: t, animate: r, side: s, ...n }) => /* @__PURE__ */ c(
|
|
4014
4048
|
"p",
|
|
4015
4049
|
{
|
|
4016
4050
|
style: { transformOrigin: s === "left" ? "0% 50%" : "100% 50%" },
|
|
4017
|
-
class:
|
|
4051
|
+
class: ao({ className: t, side: s, animate: r }),
|
|
4018
4052
|
...n,
|
|
4019
4053
|
children: e
|
|
4020
4054
|
}
|
|
4021
|
-
), qr = /* @__PURE__ */ new Map(), zr =
|
|
4055
|
+
), qr = /* @__PURE__ */ new Map(), zr = ln({ overrides: {}, locale: void 0 }), oo = (e, t) => {
|
|
4022
4056
|
const r = t == null ? void 0 : t.trim();
|
|
4023
4057
|
if (!r) return e("job_alerts_privacy");
|
|
4024
4058
|
const s = e("job_alerts_privacy_sender", { employer: r });
|
|
4025
4059
|
return e("job_alerts_privacy") !== zr("job_alerts_privacy") && s === zr("job_alerts_privacy_sender", { employer: r }) ? e("job_alerts_privacy") : s;
|
|
4026
|
-
},
|
|
4027
|
-
const { t: r } =
|
|
4060
|
+
}, lo = ({ flow: e, rpcClient: t }) => {
|
|
4061
|
+
const { t: r } = ne(), s = e.data.flowSessionId, n = qr.get(s) ?? on("offer");
|
|
4028
4062
|
qr.set(s, n);
|
|
4029
4063
|
const i = (l) => {
|
|
4030
4064
|
const f = e.data.submissions[l];
|
|
@@ -4036,7 +4070,7 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4036
4070
|
if (!(n.value !== "offer" && n.value !== "error")) {
|
|
4037
4071
|
n.value = "saving";
|
|
4038
4072
|
try {
|
|
4039
|
-
await
|
|
4073
|
+
await mn(t, {
|
|
4040
4074
|
contact: { email: a, first_name: i("first_name"), last_name: i("last_name") },
|
|
4041
4075
|
job: e.job
|
|
4042
4076
|
}), n.value = "success";
|
|
@@ -4072,9 +4106,9 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4072
4106
|
}
|
|
4073
4107
|
)
|
|
4074
4108
|
] }),
|
|
4075
|
-
/* @__PURE__ */ c("p", { class: "text-xs", children:
|
|
4109
|
+
/* @__PURE__ */ c("p", { class: "text-xs", children: oo(r, e.employer) })
|
|
4076
4110
|
] });
|
|
4077
|
-
},
|
|
4111
|
+
}, co = ({ message: e }) => /* @__PURE__ */ c("div", { class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2", children: /* @__PURE__ */ c(
|
|
4078
4112
|
"a",
|
|
4079
4113
|
{
|
|
4080
4114
|
onClick: e.onClick,
|
|
@@ -4105,16 +4139,16 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4105
4139
|
)
|
|
4106
4140
|
]
|
|
4107
4141
|
}
|
|
4108
|
-
) }),
|
|
4142
|
+
) }), uo = ({ className: e, ...t }) => /* @__PURE__ */ c("div", { "aria-hidden": !0, children: ue.isBotTyping$.value === !0 ? /* @__PURE__ */ c("div", { "data-testid": "typing-indicator", class: Ze("flex gap-1 p-4", e), ...t, children: Array.from({ length: 3 }, (r, s) => /* @__PURE__ */ c(
|
|
4109
4143
|
"div",
|
|
4110
4144
|
{
|
|
4111
4145
|
class: "bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",
|
|
4112
4146
|
style: { animationDelay: `${-s * 200}ms` }
|
|
4113
4147
|
}
|
|
4114
|
-
)) }) : void 0 }),
|
|
4148
|
+
)) }) : void 0 }), fo = {
|
|
4115
4149
|
bot: "left",
|
|
4116
4150
|
user: "right"
|
|
4117
|
-
},
|
|
4151
|
+
}, ho = _t(
|
|
4118
4152
|
"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)]",
|
|
4119
4153
|
{
|
|
4120
4154
|
variants: {
|
|
@@ -4126,14 +4160,14 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4126
4160
|
}
|
|
4127
4161
|
}
|
|
4128
4162
|
}
|
|
4129
|
-
),
|
|
4163
|
+
), po = ({
|
|
4130
4164
|
env: e,
|
|
4131
4165
|
lastSentMessageFooter: t,
|
|
4132
4166
|
rpcClient: r
|
|
4133
4167
|
}) => {
|
|
4134
|
-
const { t: s } =
|
|
4168
|
+
const { t: s } = ne(), n = W.current$.value.flow, i = (n == null ? void 0 : n.data.messages) ?? [], a = i.findIndex(
|
|
4135
4169
|
(l) => l.type === "system" && l.semantic === "submission-closed"
|
|
4136
|
-
), o = n ?
|
|
4170
|
+
), o = n ? Kt(n) : void 0;
|
|
4137
4171
|
return /* @__PURE__ */ c(
|
|
4138
4172
|
"ol",
|
|
4139
4173
|
{
|
|
@@ -4144,10 +4178,10 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4144
4178
|
i.map((l, f) => /* @__PURE__ */ c(ge, { children: [
|
|
4145
4179
|
/* @__PURE__ */ c("li", { class: "flex", tabIndex: f === i.length - 1 ? -1 : void 0, children: [
|
|
4146
4180
|
o && l.groupId === o && !i.slice(f + 1).some((h) => h.groupId === o) ? t : null,
|
|
4147
|
-
|
|
4148
|
-
const b = f === i.length - 1, g = h.author === "bot" ?
|
|
4149
|
-
return /* @__PURE__ */ c(ge, { children: /* @__PURE__ */ c(
|
|
4150
|
-
}).with({ type: "link" }, (h) => /* @__PURE__ */ c(
|
|
4181
|
+
cn(l).with({ type: "system" }, (h) => /* @__PURE__ */ c("p", { class: ho({ variant: h.variant }), children: h.text })).with({ type: "text", author: un.union("bot", "user") }, (h) => {
|
|
4182
|
+
const b = f === i.length - 1, g = h.author === "bot" ? no(h.text) : h.text;
|
|
4183
|
+
return /* @__PURE__ */ c(ge, { children: /* @__PURE__ */ c(io, { animate: b, side: fo[h.author], children: g }, f) });
|
|
4184
|
+
}).with({ type: "link" }, (h) => /* @__PURE__ */ c(co, { message: h })).with({ type: "image" }, (h) => /* @__PURE__ */ c(
|
|
4151
4185
|
"img",
|
|
4152
4186
|
{
|
|
4153
4187
|
class: "shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",
|
|
@@ -4155,7 +4189,7 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4155
4189
|
style: { aspectRatio: h.width / h.height }
|
|
4156
4190
|
}
|
|
4157
4191
|
)).with({ type: "file" }, (h) => /* @__PURE__ */ c(
|
|
4158
|
-
|
|
4192
|
+
Ga,
|
|
4159
4193
|
{
|
|
4160
4194
|
class: h.author === "bot" ? void 0 : "ml-auto",
|
|
4161
4195
|
file: { name: h.fileName, sizeKb: h.fileSizeKb }
|
|
@@ -4164,7 +4198,7 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4164
4198
|
const b = i[i.length - 1];
|
|
4165
4199
|
return !(h === b) || ue.isBotTyping$.value || n != null && n.data.isFinished ? null : /* @__PURE__ */ c("div", { class: "flex flex-grow flex-col items-center justify-center gap-2", children: [
|
|
4166
4200
|
/* @__PURE__ */ c(
|
|
4167
|
-
|
|
4201
|
+
Ht,
|
|
4168
4202
|
{
|
|
4169
4203
|
"aria-hidden": h.text ? "true" : void 0,
|
|
4170
4204
|
class: "text-neutral-6 h-8 w-8"
|
|
@@ -4174,7 +4208,7 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4174
4208
|
] });
|
|
4175
4209
|
}).exhaustive()
|
|
4176
4210
|
] }),
|
|
4177
|
-
f === a && (n != null && n.jobAlerts) && r ? /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
|
|
4211
|
+
f === a && (n != null && n.jobAlerts) && r ? /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(lo, { flow: n, rpcClient: r }, n.data.flowSessionId) }) : null
|
|
4178
4212
|
] }, f)),
|
|
4179
4213
|
e && e !== "production" && (n == null ? void 0 : n.data.isFinished) && n.data.stagingDestination && /* @__PURE__ */ c("li", { class: "text-neutral-11 text-center text-xs", children: n.data.stagingDestination }),
|
|
4180
4214
|
/* @__PURE__ */ c("li", { class: ue.captchaVisible$.value ? "flex" : "hidden", children: /* @__PURE__ */ c(
|
|
@@ -4187,30 +4221,30 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4187
4221
|
class: "w-full max-w-[min(100%,24rem)] rounded-md"
|
|
4188
4222
|
}
|
|
4189
4223
|
) }, "captcha"),
|
|
4190
|
-
/* @__PURE__ */ c(
|
|
4224
|
+
/* @__PURE__ */ c(uo, {}, "typing")
|
|
4191
4225
|
]
|
|
4192
4226
|
}
|
|
4193
4227
|
);
|
|
4194
|
-
},
|
|
4195
|
-
const { flow: a } =
|
|
4196
|
-
|
|
4197
|
-
const o =
|
|
4228
|
+
}, vo = ({ logger: e, apiClient: t, rpcClient: r, analytics: s, talentBankClient: n, env: i }) => {
|
|
4229
|
+
const { flow: a } = W.current$.value;
|
|
4230
|
+
je(a, "Flow is required to exist to show chatbot body");
|
|
4231
|
+
const o = W.viewState$.value, { chatRef: l, chatService: f } = dn(), { t: h } = ne(), [b, g] = Se();
|
|
4198
4232
|
return Re(() => {
|
|
4199
4233
|
o === "maximised" && ue.scrollToEnd();
|
|
4200
4234
|
}, [o]), Re(() => {
|
|
4201
|
-
var
|
|
4202
|
-
const { state: p, flow:
|
|
4235
|
+
var P;
|
|
4236
|
+
const { state: p, flow: x } = W.current$.peek();
|
|
4203
4237
|
if (p !== "loaded") throw new Error(h("invalid_state"));
|
|
4204
|
-
let w =
|
|
4205
|
-
if (ue.scrollToEnd(),
|
|
4238
|
+
let w = x.data.nodeHistory.at(-1);
|
|
4239
|
+
if (ue.scrollToEnd(), W.setInput(void 0), x.data.isFinished) return;
|
|
4206
4240
|
const k = () => {
|
|
4207
|
-
const
|
|
4208
|
-
!
|
|
4241
|
+
const E = W.current$.peek().flow;
|
|
4242
|
+
!E || E.data.hasInteracted || (W.markAsInteracted(), br(s, E, "FLOW_INTERACT"));
|
|
4209
4243
|
};
|
|
4210
|
-
ue.onInteractionFn$.value = k, w === void 0 ? (w = ss(a.nodes).id,
|
|
4211
|
-
const { interpret:
|
|
4244
|
+
ue.onInteractionFn$.value = k, w === void 0 ? (w = ss(a.nodes).id, W.setCurrentNodeId(w), br(s, x, "FLOW_START")) : W.removeMessagesSentByNodeIds([w, qt]);
|
|
4245
|
+
const { interpret: A, abort: v, undo: R } = Xn({
|
|
4212
4246
|
context: a.context,
|
|
4213
|
-
analytics: { service: s, customProperties: (
|
|
4247
|
+
analytics: { service: s, customProperties: (P = a.analytics) == null ? void 0 : P.customProperties },
|
|
4214
4248
|
apiClient: t,
|
|
4215
4249
|
logger: e,
|
|
4216
4250
|
talentBankClient: n,
|
|
@@ -4218,41 +4252,41 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4218
4252
|
chatService: f,
|
|
4219
4253
|
t: h,
|
|
4220
4254
|
getApplicationRecovery: () => {
|
|
4221
|
-
var
|
|
4222
|
-
return (
|
|
4255
|
+
var E;
|
|
4256
|
+
return (E = W.current$.peek().flow) == null ? void 0 : E.data.applicationRecovery;
|
|
4223
4257
|
},
|
|
4224
|
-
setApplicationRecovery:
|
|
4225
|
-
persistWriteBarrier: () =>
|
|
4258
|
+
setApplicationRecovery: W.setApplicationRecovery,
|
|
4259
|
+
persistWriteBarrier: () => W.persistWriteBarrier(x),
|
|
4226
4260
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
4227
4261
|
getSubmissions: () => {
|
|
4228
|
-
var
|
|
4229
|
-
return (
|
|
4262
|
+
var E;
|
|
4263
|
+
return (E = W.current$.peek().flow) == null ? void 0 : E.data.submissions;
|
|
4230
4264
|
},
|
|
4231
|
-
onInterpret: (
|
|
4265
|
+
onInterpret: (E) => W.setCurrentNodeId(E.id),
|
|
4232
4266
|
onFlowEnd: async () => {
|
|
4233
|
-
var
|
|
4234
|
-
|
|
4235
|
-
const
|
|
4236
|
-
|
|
4267
|
+
var M;
|
|
4268
|
+
W.markAsFinished();
|
|
4269
|
+
const E = W.current$.peek().flow;
|
|
4270
|
+
je(E), s.log({
|
|
4237
4271
|
event: "FLOW_END",
|
|
4238
4272
|
properties: {
|
|
4239
4273
|
flow_id: a.id,
|
|
4240
4274
|
flow_version: a.version,
|
|
4241
|
-
flow_session_id:
|
|
4275
|
+
flow_session_id: E.data.flowSessionId,
|
|
4242
4276
|
flow_build: a.build,
|
|
4243
4277
|
job: a.job
|
|
4244
4278
|
},
|
|
4245
|
-
customProperties: (
|
|
4279
|
+
customProperties: (M = a.analytics) == null ? void 0 : M.customProperties
|
|
4246
4280
|
});
|
|
4247
4281
|
}
|
|
4248
|
-
}), N = w,
|
|
4249
|
-
g(() =>
|
|
4250
|
-
},
|
|
4251
|
-
return
|
|
4252
|
-
|
|
4253
|
-
}) :
|
|
4254
|
-
|
|
4255
|
-
}),
|
|
4282
|
+
}), N = w, T = () => {
|
|
4283
|
+
g(() => R), A(N);
|
|
4284
|
+
}, H = new AbortController();
|
|
4285
|
+
return x.offerResume ? Ca({ chatService: f, t: h, signal: H.signal }).then((E) => (W.settleResume(x), E ? T() : (W.restart(), fn.flushStateData()))).catch((E) => {
|
|
4286
|
+
E instanceof Gr || e.error("Resume prompt failed", E);
|
|
4287
|
+
}) : T(), () => {
|
|
4288
|
+
H.abort(), ue.onInteractionFn$.value === k && (ue.onInteractionFn$.value = () => {
|
|
4289
|
+
}), v();
|
|
4256
4290
|
};
|
|
4257
4291
|
}, [s, t, f, e, a, n, h]), /* @__PURE__ */ c(ge, { children: [
|
|
4258
4292
|
/* @__PURE__ */ c("div", { class: "relative flex min-h-0 w-full max-w-full flex-grow flex-col", children: [
|
|
@@ -4266,11 +4300,11 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4266
4300
|
className: "hide-scrollbars fr flex min-h-0 w-full max-w-full flex-grow flex-col overflow-y-auto ring-inset",
|
|
4267
4301
|
style: { WebkitOverflowScrolling: "touch" },
|
|
4268
4302
|
children: /* @__PURE__ */ c(
|
|
4269
|
-
|
|
4303
|
+
po,
|
|
4270
4304
|
{
|
|
4271
4305
|
env: i,
|
|
4272
4306
|
rpcClient: r,
|
|
4273
|
-
lastSentMessageFooter: !
|
|
4307
|
+
lastSentMessageFooter: !Kt(a) || !b ? null : /* @__PURE__ */ c(mo, { undoFn: b })
|
|
4274
4308
|
}
|
|
4275
4309
|
)
|
|
4276
4310
|
}
|
|
@@ -4281,29 +4315,29 @@ const ot = /* @__PURE__ */ zi(Ji), Zi = /(\[[^\]]+\]\([^)]+\))/g, Xi = /\[([^\]]
|
|
|
4281
4315
|
class: "bg-neutral-1 ring-divider shadow-surface-md ring-1",
|
|
4282
4316
|
"aria-label": h("jump_to_current"),
|
|
4283
4317
|
onClick: () => {
|
|
4284
|
-
var
|
|
4285
|
-
ue.scrollToEnd(), (w = ((
|
|
4318
|
+
var x, w;
|
|
4319
|
+
ue.scrollToEnd(), (w = ((x = l.current) == null ? void 0 : x.querySelector('li[tabindex="-1"]')) ?? l.current) == null || w.focus({ preventScroll: !0 });
|
|
4286
4320
|
},
|
|
4287
|
-
children: /* @__PURE__ */ c(
|
|
4321
|
+
children: /* @__PURE__ */ c(hn, {})
|
|
4288
4322
|
}
|
|
4289
4323
|
) })
|
|
4290
4324
|
] }),
|
|
4291
|
-
/* @__PURE__ */ c(
|
|
4325
|
+
/* @__PURE__ */ c(Wi, { logger: e, analytics: s, rpcClient: r })
|
|
4292
4326
|
] });
|
|
4293
|
-
},
|
|
4294
|
-
const { t } =
|
|
4327
|
+
}, mo = ({ undoFn: e }) => {
|
|
4328
|
+
const { t } = ne();
|
|
4295
4329
|
return /* @__PURE__ */ c("div", { class: "flex flex-1 items-center justify-end px-1", children: /* @__PURE__ */ c(
|
|
4296
4330
|
Yr,
|
|
4297
4331
|
{
|
|
4298
4332
|
"aria-label": t("undo"),
|
|
4299
4333
|
onClick: async () => {
|
|
4300
|
-
const { flow: r } =
|
|
4301
|
-
|
|
4334
|
+
const { flow: r } = W.current$.peek();
|
|
4335
|
+
je(r), e(r.data.nodeHistory);
|
|
4302
4336
|
},
|
|
4303
4337
|
children: /* @__PURE__ */ c("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" })
|
|
4304
4338
|
}
|
|
4305
4339
|
) });
|
|
4306
4340
|
};
|
|
4307
4341
|
export {
|
|
4308
|
-
|
|
4342
|
+
vo as ChatbotBody
|
|
4309
4343
|
};
|