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