@inploi/plugin-chatbot 14.14.0 → 14.15.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 +8 -2
- package/cdn/index.js +6 -6
- package/dist/{chatbot-body-ae10ed7d.cjs → chatbot-body-4f5e817b.cjs} +2 -2
- package/dist/{chatbot-body-1dc31e4a.js → chatbot-body-e11d7ba9.js} +361 -348
- package/dist/chatbot.context.test.d.ts +1 -0
- package/dist/chatbot.d.ts +3 -1
- package/dist/chatbot.state.d.ts +4 -2
- package/dist/{index-10c0dfc6.js → index-8afa7a59.js} +735 -729
- package/dist/index-f26ac3c8.cjs +5 -0
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +3 -3
- package/dist/index-1b25fb45.cjs +0 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Ss = Object.defineProperty;
|
|
2
2
|
var As = (e, r, t) => r in e ? Ss(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
3
|
var Y = (e, r, t) => (As(e, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
-
import { u as
|
|
4
|
+
import { u as Br, p as vt, D as Dt, l as Ge, f as $r, T as Pr, a as Es, E as Is, N as Fs, I as qr, C as Vs, s as Ms, g as Ls, S as Rs, U as sr, $ as nr, R as Ns, w as ar, m as Ts, y as Ds, b as Ur, k as Os, x as js, h as Bs, z as $s, Z as Wr, H as Ps, v as qs, c as q, d as re, o as l, e as Qe, i as xt, j as ke, _ as ye, n as Oe, q as Le, r as be, L as Ut, F as Us, t as zr, A as Hr, B as Ws, G as zs, J as et, K as ir, M as ae, O as ce, P as Hs, Q as Ks, V as Gs, W as Js, X as Zs, Y as Kr, a0 as Xs } from "./index-8afa7a59.js";
|
|
5
5
|
import { saveClosedRoleJobAlerts as Ys } from "@inploi/sdk";
|
|
6
|
-
var Qs = "9.
|
|
6
|
+
var Qs = "9.11.0", Gr = `https://sdk.inploi.com/@inploi/flows@${Qs}/cdn/captcha/index.html`, en = new URL(Gr).origin, or = 3e4, tn = 5 * 6e4, rn = (e) => typeof e == "object" && e !== null && e.source === "inploi-captcha", Ft = /* @__PURE__ */ new WeakMap(), sn = (e) => {
|
|
7
7
|
let r = Ft.get(e);
|
|
8
8
|
return r || (r = e.fetch("/flow/captcha").then((t) => {
|
|
9
9
|
let s = t == null ? void 0 : t.site_key;
|
|
@@ -28,10 +28,10 @@ var Qs = "9.10.2", Gr = `https://sdk.inploi.com/@inploi/flows@${Qs}/cdn/captcha/
|
|
|
28
28
|
return;
|
|
29
29
|
let C = document.createElement("iframe");
|
|
30
30
|
C.src = `${Gr}?${new URLSearchParams({ sitekey: k, origin: window.location.origin, ...i && { theme: i } }).toString()}`, C.title = "Cloudflare security check", C.style.cssText = `display:block;border:0;width:${a ? "100%" : "300px"};height:0;color-scheme:normal`, a ? a.appendChild(C) : (C.style.cssText += ";position:fixed;bottom:16px;right:16px;z-index:2147483647", document.body.appendChild(C));
|
|
31
|
-
let A = !1, v = (
|
|
32
|
-
if (!C.contentWindow ||
|
|
31
|
+
let A = !1, v = (R) => {
|
|
32
|
+
if (!C.contentWindow || R.source !== C.contentWindow || R.origin !== en || !rn(R.data))
|
|
33
33
|
return;
|
|
34
|
-
let V =
|
|
34
|
+
let V = R.data;
|
|
35
35
|
switch (V.type) {
|
|
36
36
|
case "token":
|
|
37
37
|
return g(() => t(V.token));
|
|
@@ -59,7 +59,7 @@ var Qs = "9.10.2", Gr = `https://sdk.inploi.com/@inploi/flows@${Qs}/cdn/captcha/
|
|
|
59
59
|
let [n, ...a] = e.compareKey.split(".");
|
|
60
60
|
if (!n)
|
|
61
61
|
return !1;
|
|
62
|
-
let i =
|
|
62
|
+
let i = Br({ context: r, key: n, path: a, submissions: t });
|
|
63
63
|
if (!i)
|
|
64
64
|
return !1;
|
|
65
65
|
switch (i.type) {
|
|
@@ -167,7 +167,7 @@ var Qs = "9.10.2", Gr = `https://sdk.inploi.com/@inploi/flows@${Qs}/cdn/captcha/
|
|
|
167
167
|
return !0;
|
|
168
168
|
}
|
|
169
169
|
}, an = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, on = (e, { context: r, submissions: t }) => e.replace(an, (s, n, a = "") => {
|
|
170
|
-
let [i, ...o] = n.trim().split("."), c =
|
|
170
|
+
let [i, ...o] = n.trim().split("."), c = Br({ key: i, path: o, submissions: t, context: r });
|
|
171
171
|
if (!c)
|
|
172
172
|
return a;
|
|
173
173
|
switch (c.type) {
|
|
@@ -461,7 +461,7 @@ var Jr = (e) => {
|
|
|
461
461
|
var r, t;
|
|
462
462
|
if (!(e.data.isFinished || (r = e.data.startedWriteNodeIds) != null && r.length))
|
|
463
463
|
return (t = [...e.data.messages].reverse().find((s) => s.groupId && e.nodes.some((n) => n.id === s.groupId && n.type.startsWith("question-")) && (s.type === "system" || "author" in s && s.author === "user"))) == null ? void 0 : t.groupId;
|
|
464
|
-
},
|
|
464
|
+
}, jt = (e) => Array.isArray(e) ? e.map(jt) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).sort(([r], [t]) => r.localeCompare(t)).map(([r, t]) => [r, jt(t)])) : typeof e == "function" ? void 0 : e, _n = (e) => fn(wn(new TextEncoder().encode(JSON.stringify(jt(e)))));
|
|
465
465
|
function kn(e, r, t, s) {
|
|
466
466
|
var n;
|
|
467
467
|
if (s != null && s.aborted)
|
|
@@ -496,19 +496,19 @@ var Zr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {}
|
|
|
496
496
|
});
|
|
497
497
|
if (t != null && t.nextId)
|
|
498
498
|
return r.find((s) => s.id === t.nextId);
|
|
499
|
-
}, An = 3, En = ({ flow: e, analytics: r, logger: t, talentBankClient: s, context: n, apiClient: a, getSubmissions: i, getApplicationRecovery: o, setApplicationRecovery: c, chatService: d, persistWriteBarrier: g, onSubmitNetworkError: b, closedRoleBehaviour: p, settledOutcomes: m = p, dateEchoLocale: _, onFlowEnd: k, onInterpret: C, forceSubmitConfirmation: A, flowType: v, t:
|
|
499
|
+
}, An = 3, En = ({ flow: e, analytics: r, logger: t, talentBankClient: s, context: n, apiClient: a, getSubmissions: i, getApplicationRecovery: o, setApplicationRecovery: c, chatService: d, persistWriteBarrier: g, onSubmitNetworkError: b, closedRoleBehaviour: p, settledOutcomes: m = p, dateEchoLocale: _, onFlowEnd: k, onInterpret: C, forceSubmitConfirmation: A, flowType: v, t: R }) => {
|
|
500
500
|
var V;
|
|
501
501
|
let M = new AbortController(), ee = { submitAccepted: !1 };
|
|
502
502
|
(V = e.data).startedWriteNodeIds ?? (V.startedWriteNodeIds = e.nodes.flatMap((D) => {
|
|
503
|
-
var
|
|
503
|
+
var j, I;
|
|
504
504
|
if (D.type !== "integration-application-submit" || !e.data.nodeHistory.includes(D.id))
|
|
505
505
|
return [];
|
|
506
|
-
let T = D.data.key ? (
|
|
506
|
+
let T = D.data.key ? (j = i()) == null ? void 0 : j[D.data.key] : void 0;
|
|
507
507
|
return (T == null ? void 0 : T.type) === "integration" && ((I = $r(T.value)) == null ? void 0 : I.verdict) === "not_submitted" ? [] : [D.id];
|
|
508
508
|
}));
|
|
509
|
-
let
|
|
510
|
-
let
|
|
511
|
-
if (
|
|
509
|
+
let N = { ...r.service, log: (D) => r.service.log({ ...D, customProperties: { ...D.customProperties, ...r.customProperties } }) }, G = async (D, T) => {
|
|
510
|
+
let j = M.signal;
|
|
511
|
+
if (j.aborted)
|
|
512
512
|
return;
|
|
513
513
|
let I = i(), F = o(), $ = (F == null ? void 0 : F.submitNodeId) === D.id ? e.nodes.find((L) => {
|
|
514
514
|
var W;
|
|
@@ -518,22 +518,22 @@ var Zr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {}
|
|
|
518
518
|
return G($, T);
|
|
519
519
|
C == null || C(D, T);
|
|
520
520
|
try {
|
|
521
|
-
await In({ flow: e, analytics:
|
|
522
|
-
if (!
|
|
521
|
+
await In({ flow: e, analytics: N, logger: t, talentBankClient: s, apiClient: a, context: n, node: D, submissions: I, applicationRecovery: F, setApplicationRecovery: async (L) => {
|
|
522
|
+
if (!j.aborted)
|
|
523
523
|
try {
|
|
524
524
|
await c(L);
|
|
525
525
|
} catch (W) {
|
|
526
526
|
t.error("Failed to persist application recovery", W);
|
|
527
527
|
}
|
|
528
|
-
}, forceSubmitConfirmation: A || (F == null ? void 0 : F.submitNodeId) === D.id, run: ee, persistWriteBarrier: g, onSubmitNetworkError: b, settledOutcomes: m, dateEchoLocale: _, flowType: v, signal:
|
|
529
|
-
|
|
528
|
+
}, forceSubmitConfirmation: A || (F == null ? void 0 : F.submitNodeId) === D.id, run: ee, persistWriteBarrier: g, onSubmitNetworkError: b, settledOutcomes: m, dateEchoLocale: _, flowType: v, signal: j, t: R, chat: { sendMessage: async (L) => d.send({ groupId: D.id, message: L, signal: j }), userInput: async (L) => d.input({ input: L, signal: j }), setSubmission: (L, W) => {
|
|
529
|
+
j.aborted || d.setSubmission(L, W);
|
|
530
530
|
}, captcha: d.captcha }, next: (L) => {
|
|
531
|
-
if (
|
|
531
|
+
if (j.aborted)
|
|
532
532
|
return;
|
|
533
533
|
let W = (F == null ? void 0 : F.fileQuestionNodeId) === D.id ? F.submitNodeId : L, U = W ? e.nodes.find((te) => te.id === W) : Sn({ childNode: D, nodes: e.nodes });
|
|
534
534
|
return U ? G(U, D) : k == null ? void 0 : k(D);
|
|
535
535
|
}, end: () => {
|
|
536
|
-
|
|
536
|
+
j.aborted || (k == null || k(D));
|
|
537
537
|
} });
|
|
538
538
|
} catch (L) {
|
|
539
539
|
if (L instanceof Pr)
|
|
@@ -542,18 +542,18 @@ var Zr = ({ context: e, submissions: r }) => ({ context: e, submissions: r ?? {}
|
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
544
|
return { interpret: async (D) => {
|
|
545
|
-
let T = e.nodes.find((
|
|
545
|
+
let T = e.nodes.find((j) => j.id === D) ?? Jr(e.nodes);
|
|
546
546
|
return G(T);
|
|
547
547
|
}, undo: (D) => {
|
|
548
548
|
var W;
|
|
549
549
|
if (delete e.data.reviewReplay, ((W = e.data.startedWriteNodeIds) == null ? void 0 : W.length) || e.data.isFinished)
|
|
550
550
|
return { removed: 0 };
|
|
551
|
-
let T = zt(e),
|
|
552
|
-
if (
|
|
551
|
+
let T = zt(e), j = T ? D.lastIndexOf(T) : -1, I = e.nodes.find((U) => U.id === T);
|
|
552
|
+
if (j === -1 || !I)
|
|
553
553
|
return { removed: 0 };
|
|
554
554
|
let F = e.nodes.find((U) => U.id === D[D.length - 1]);
|
|
555
555
|
M.abort();
|
|
556
|
-
let $ = D.splice(
|
|
556
|
+
let $ = D.splice(j);
|
|
557
557
|
e.data.messages = e.data.messages.filter((U) => !U.groupId || !$.includes(U.groupId)), e.data.currentInput = null;
|
|
558
558
|
let L = i();
|
|
559
559
|
for (let U of $.slice(1)) {
|
|
@@ -573,35 +573,35 @@ async function In(e) {
|
|
|
573
573
|
case "flow-section":
|
|
574
574
|
return await e.chat.sendMessage({ type: "system", variant: "info", text: r.data.title }), e.next(r.nextId);
|
|
575
575
|
case "pre-apply-result":
|
|
576
|
-
return
|
|
576
|
+
return Qn({ ...e, node: r });
|
|
577
577
|
case "text":
|
|
578
|
-
return
|
|
578
|
+
return Un({ ...e, node: r });
|
|
579
579
|
case "image":
|
|
580
|
-
return
|
|
580
|
+
return Wn({ ...e, node: r });
|
|
581
581
|
case "question-text":
|
|
582
|
-
return
|
|
582
|
+
return zn({ ...e, node: r });
|
|
583
583
|
case "question-enum":
|
|
584
|
-
return
|
|
584
|
+
return Gn({ ...e, node: r });
|
|
585
585
|
case "question-number":
|
|
586
|
-
return
|
|
586
|
+
return Hn({ ...e, node: r });
|
|
587
587
|
case "question-phone":
|
|
588
|
-
return zn({ ...e, node: r });
|
|
589
|
-
case "question-boolean":
|
|
590
588
|
return Kn({ ...e, node: r });
|
|
591
|
-
case "question-
|
|
589
|
+
case "question-boolean":
|
|
592
590
|
return Jn({ ...e, node: r });
|
|
591
|
+
case "question-file":
|
|
592
|
+
return Xn({ ...e, node: r });
|
|
593
593
|
case "question-address":
|
|
594
|
-
return Gn({ ...e, node: r });
|
|
595
|
-
case "end-flow":
|
|
596
594
|
return Zn({ ...e, node: r });
|
|
595
|
+
case "end-flow":
|
|
596
|
+
return Yn({ ...e, node: r });
|
|
597
597
|
case "if-block":
|
|
598
|
-
return
|
|
598
|
+
return qn({ ...e, node: r });
|
|
599
599
|
case "jump":
|
|
600
600
|
return Mn({ ...e, node: r });
|
|
601
601
|
case "link":
|
|
602
|
-
return
|
|
602
|
+
return Pn({ ...e, node: r });
|
|
603
603
|
case "integration-application-submit":
|
|
604
|
-
return
|
|
604
|
+
return jn({ ...e, node: r });
|
|
605
605
|
case "add-submission":
|
|
606
606
|
return Ln({ ...e, node: r });
|
|
607
607
|
case "integration-workflow-get":
|
|
@@ -641,18 +641,18 @@ async function Ln({ next: e, node: r, logger: t, submissions: s, context: n }) {
|
|
|
641
641
|
}
|
|
642
642
|
s[r.data.key] = { type: "string", value: he(r.data.value, { submissions: s, context: n }) }, e(r.nextId);
|
|
643
643
|
}
|
|
644
|
-
var
|
|
644
|
+
var Rn = 5e3, Nn = (e, r) => r ? `${e}@${r.id_type}:${r.id}` : e, Tn = (e, r = Date.now()) => Math.min(e.until, r + (e.maintenance ? $s : e.throttles ? Wr : Ps)), Dn = (e, r, t) => {
|
|
645
645
|
let { waitMs: s, throttles: n, maintenance: a } = qs(r == null ? void 0 : r.throttles, t);
|
|
646
646
|
return { key: e, until: Date.now() + s, ...n !== void 0 && { throttles: n }, ...a && { maintenance: a } };
|
|
647
|
-
}, On = ["ApiError", "NotFoundError", "UnauthorisedError", "SchemaValidationError", "ParsingError"],
|
|
648
|
-
let r =
|
|
647
|
+
}, On = ["ApiError", "NotFoundError", "UnauthorisedError", "SchemaValidationError", "ParsingError"], Bt = (e) => e instanceof Error && On.includes(e.name) ? e : void 0, ur = (e) => {
|
|
648
|
+
let r = Bt(e);
|
|
649
649
|
return (r == null ? void 0 : r.name) === "ApiError" ? r : void 0;
|
|
650
650
|
};
|
|
651
|
-
async function
|
|
651
|
+
async function jn({ chat: e, next: r, end: t, node: s, logger: n, apiClient: a, submissions: i, analytics: o, flow: c, applicationRecovery: d, setApplicationRecovery: g, forceSubmitConfirmation: b, flowType: p, run: m, persistWriteBarrier: _, signal: k, onSubmitNetworkError: C, settledOutcomes: A, t: v }) {
|
|
652
652
|
var G, D;
|
|
653
|
-
let
|
|
653
|
+
let R = async ({ redirect_url: T, message: j, button_text: I }) => {
|
|
654
654
|
let { anonymous_id: F, session_id: $ } = o.getSessionInfo();
|
|
655
|
-
await e.sendMessage({ type: "text", author: "bot", text:
|
|
655
|
+
await e.sendMessage({ type: "text", author: "bot", text: j ?? v("submission_redirect_message") });
|
|
656
656
|
try {
|
|
657
657
|
let L = new URL(T);
|
|
658
658
|
F && !L.searchParams.has("anonymous_id") && L.searchParams.set("anonymous_id", F), await e.sendMessage({ type: "link", href: L.toString(), text: I ?? v("complete_submission"), onClick: () => {
|
|
@@ -668,13 +668,13 @@ async function Bn({ chat: e, next: r, end: t, node: s, logger: n, apiClient: a,
|
|
|
668
668
|
};
|
|
669
669
|
if ((G = c.data.startedWriteNodeIds) != null && G.includes(s.id) && (d == null ? void 0 : d.submitNodeId) !== s.id) {
|
|
670
670
|
let T = (D = c.data.submitRedirects) == null ? void 0 : D[s.id];
|
|
671
|
-
return T ? (await
|
|
671
|
+
return T ? (await R(T), r(s.nextId)) : (await e.sendMessage({ type: "system", variant: "warning", text: v("submission_unknown") }), t());
|
|
672
672
|
}
|
|
673
|
-
let V =
|
|
673
|
+
let V = Nn(s.id, c.job), M = 0, ee = m.submitAccepted && s.data.skipConfirmation === !0 && (d == null ? void 0 : d.submitNodeId) !== s.id, N = async (T) => {
|
|
674
674
|
var nt, pt, mt, At, at, u, f, h, w;
|
|
675
|
-
let
|
|
676
|
-
|
|
677
|
-
let I =
|
|
675
|
+
let j = ((nt = c.data.submitCooldown) == null ? void 0 : nt.key) === V ? c.data.submitCooldown : void 0;
|
|
676
|
+
j && (j.until = Tn(j));
|
|
677
|
+
let I = j == null ? void 0 : j.until;
|
|
678
678
|
(c.data.reviewRequiresSend === !0 && !ee || T !== !0 || I !== void 0 && I > Date.now()) && await e.userInput({ type: "submit", key: void 0, config: { label: s.data.submitLabel, ...I !== void 0 && { availableAt: I } } }), ee = !1;
|
|
679
679
|
let F;
|
|
680
680
|
if (s.data.captcha) {
|
|
@@ -702,83 +702,96 @@ async function Bn({ chat: e, next: r, end: t, node: s, logger: n, apiClient: a,
|
|
|
702
702
|
return;
|
|
703
703
|
let U, te = setTimeout(() => {
|
|
704
704
|
U = e.sendMessage({ type: "loading", semantic: "submission-still-working", text: v("submission_still_working") }).catch((y) => n.error("Failed to send submission progress message", y));
|
|
705
|
-
},
|
|
705
|
+
}, Rn), X, H = await a.fetch("/flow/submit", { method: "POST", body: JSON.stringify({ log_submit: !1, integration_id: s.data.integrationId, anonymous_id: $, session_id: L, job: c.job, flow_build: c.build, ...F !== void 0 && { captcha_token: F }, submissions: Vs(c.nodes, Ms(i || {}, s.data.submitKeys)), pre_apply: qr(c.nodes, i || {}, c.data.flowSessionId) }) }).catch((y) => {
|
|
706
706
|
X = y;
|
|
707
707
|
let x = ur(y);
|
|
708
708
|
return (x == null ? void 0 : x.data) !== void 0 ? x.data : y;
|
|
709
709
|
});
|
|
710
710
|
if (clearTimeout(te), await U, k.aborted)
|
|
711
711
|
return;
|
|
712
|
-
if (X !== void 0 && !
|
|
713
|
-
return await C(X, k),
|
|
712
|
+
if (X !== void 0 && !Bt(X) && C)
|
|
713
|
+
return await C(X, k), N(!0);
|
|
714
714
|
s.data.key && e.setSubmission(s.data.key, { type: "integration", value: H });
|
|
715
|
-
let rt = (mt = ur(X)) == null ? void 0 : mt.status,
|
|
716
|
-
Ae &&
|
|
717
|
-
let qe =
|
|
715
|
+
let rt = (mt = ur(X)) == null ? void 0 : mt.status, Be = typeof rt == "number" ? rt : void 0, O = $r(H, Be), $e = O === void 0 && Be === 429, Pe = A === "terminal" && ((O == null ? void 0 : O.outcome) === "closed" || (O == null ? void 0 : O.outcome) === "duplicate"), Ae = c.data.failedAttemptAt, Re = Ae == null ? void 0 : Ae[V];
|
|
716
|
+
Ae && Re !== void 0 && Re > Date.now() && (Re = Ae[V] = Date.now());
|
|
717
|
+
let qe = Re !== void 0 && Date.now() - Re < Ls || ((At = c.data.unconfirmedAttemptKeys) == null ? void 0 : At.includes(V)) === !0, st = (at = Bt(X)) == null ? void 0 : at.status, ve = Rs(H, typeof st == "number" ? st : void 0);
|
|
718
718
|
ve && o.log({ event: "FLOW_SUBMIT", properties: { flow_id: c.id, flow_version: c.version, flow_session_id: c.data.flowSessionId, flow_build: c.build, service: ve.service, response: ve.response, captured: (H == null ? void 0 : H.captured) === !0, flow_type: (p == null ? void 0 : p()) ?? "CHATBOT_DRAWER", job: c.job, ...(O == null ? void 0 : O.outcome) === "duplicate" && { outcome: qe ? "duplicate_after_own_attempt" : "duplicate" }, ...ve.outcome && { outcome: ve.outcome } } });
|
|
719
719
|
let Ue = sr(H) || (H == null ? void 0 : H.success) === !0;
|
|
720
720
|
if ((Ue || nr(H)) && (m.submitAccepted = !0), Ue && ((u = c.data.submitCooldown) == null ? void 0 : u.throttles) !== void 0 && (delete c.data.submitCooldown.throttles, await _().catch((y) => n.error("Failed to persist submit cooldown reset", y))), sr(H)) {
|
|
721
|
-
let { redirect_url: y, message: x, button_text: E } = H.integration_response.data,
|
|
722
|
-
return k.aborted ? void 0 : (c.data.submitRedirects = { ...c.data.submitRedirects, [s.id]:
|
|
721
|
+
let { redirect_url: y, message: x, button_text: E } = H.integration_response.data, B = { redirect_url: y, message: x, button_text: E };
|
|
722
|
+
return k.aborted ? void 0 : (c.data.submitRedirects = { ...c.data.submitRedirects, [s.id]: B }, await _().catch((P) => n.error("Failed to persist submit redirect", P)), await R(B), r(s.nextId));
|
|
723
723
|
}
|
|
724
724
|
let ht = nr(H);
|
|
725
725
|
if (ht)
|
|
726
726
|
return await e.sendMessage({ type: "system", variant: "success", text: ht.message ?? v("submission_pending") }), r(s.nextId);
|
|
727
727
|
if ((H == null ? void 0 : H.success) === !0)
|
|
728
728
|
return s.data.skipConfirmation !== !0 && await e.sendMessage({ type: "system", variant: "success", text: v("submission_completed") }), r(s.nextId);
|
|
729
|
-
let We =
|
|
730
|
-
if (!
|
|
731
|
-
if (n.error(X ?? O.message),
|
|
732
|
-
return e.setSubmission(ze, null), await g({ fileQuestionNodeId:
|
|
729
|
+
let We = Ns(O), ze = We !== void 0 && ((f = i == null ? void 0 : i[We]) == null ? void 0 : f.type) === "file" ? We : void 0, Ne = ze === void 0 ? void 0 : c.nodes.find((y) => y.type === "question-file" && y.data.key === ze);
|
|
730
|
+
if (!Ne && !Pe && !ar(O) && (c.data.submitCooldown = Dn(V, j, O)), (O == null ? void 0 : O.outcome) !== "duplicate" && !$e && (c.data.failedAttemptAt = { ...c.data.failedAttemptAt, [V]: Date.now() }, (h = c.data.unconfirmedAttemptKeys) != null && h.includes(V) && (c.data.unconfirmedAttemptKeys = c.data.unconfirmedAttemptKeys.filter((y) => y !== V))), (O == null ? void 0 : O.verdict) === "not_submitted" || (O == null ? void 0 : O.outcome) === "duplicate" || (O == null ? void 0 : O.outcome) === "closed" || $e || Ts(H, Be) ? (W || (c.data.startedWriteNodeIds = (w = c.data.startedWriteNodeIds) == null ? void 0 : w.filter((y) => y !== s.id)), (d == null ? void 0 : d.submitNodeId) === s.id && await g(d), await _().catch((y) => n.error("Failed to persist application write barrier release", y))) : await _().catch((y) => n.error("Failed to persist submit cooldown", y)), O) {
|
|
731
|
+
if (n.error(X ?? O.message), Ne && ze !== void 0)
|
|
732
|
+
return e.setSubmission(ze, null), await g({ fileQuestionNodeId: Ne.id, submitNodeId: s.id }), await e.sendMessage({ type: "system", variant: "error", text: v("submission_unreadable_document") }), r(Ne.id);
|
|
733
733
|
if (O.outcome === "duplicate")
|
|
734
|
-
return await e.sendMessage({ type: "system", variant: Pe ? "success" : "info", semantic: "submission-duplicate", text: v(qe ? "submission_duplicate_earlier_attempt" : "submission_duplicate") }), Pe ? (delete c.data.submitCooldown, t()) :
|
|
734
|
+
return await e.sendMessage({ type: "system", variant: Pe ? "success" : "info", semantic: "submission-duplicate", text: v(qe ? "submission_duplicate_earlier_attempt" : "submission_duplicate") }), Pe ? (delete c.data.submitCooldown, t()) : N(!1);
|
|
735
735
|
if (O.outcome === "closed")
|
|
736
|
-
return await e.sendMessage({ type: "system", variant: "info", semantic: "submission-closed", text: v("submission_closed") }), Pe ? (delete c.data.submitCooldown, t()) :
|
|
736
|
+
return await e.sendMessage({ type: "system", variant: "info", semantic: "submission-closed", text: v("submission_closed") }), Pe ? (delete c.data.submitCooldown, t()) : N(!1);
|
|
737
737
|
let y = Ds(O);
|
|
738
|
-
return y ? (await e.sendMessage({ type: "system", variant: "warning", text: y.until === void 0 ? v("submission_provider_maintenance_later") : v("submission_provider_maintenance", { time: Ur(y.until, void 0) }) }),
|
|
738
|
+
return y ? (await e.sendMessage({ type: "system", variant: "warning", text: y.until === void 0 ? v("submission_provider_maintenance_later") : v("submission_provider_maintenance", { time: Ur(y.until, void 0) }) }), N(!1)) : O.outcome === "unknown" ? (await e.sendMessage({ type: "system", variant: "warning", text: v(Os(O) ? "submission_unknown_do_not_resubmit" : "submission_unknown") }), N(!1)) : ar(O) ? js(H) ? (await e.sendMessage({ type: "text", author: "bot", text: O.message }), N(!1)) : (M === 0 && await e.sendMessage({ type: "system", variant: "warning", text: v("captcha_failed") }), M++, N(M <= An)) : Bs(O) ? (await e.sendMessage({ type: "system", variant: "error", text: v("submission_retryable") }), N(!1)) : (await e.sendMessage({ type: "system", variant: "error", text: v("submission_failed") }), t());
|
|
739
739
|
}
|
|
740
|
-
return n.error(X ?? H), $e ? (await e.sendMessage({ type: "system", variant: "error", text: v("submission_retryable") }),
|
|
740
|
+
return n.error(X ?? H), $e ? (await e.sendMessage({ type: "system", variant: "error", text: v("submission_retryable") }), N(!1)) : (await e.sendMessage({ type: "system", variant: "error", text: v("submission_failed") }), t());
|
|
741
741
|
};
|
|
742
|
-
await
|
|
742
|
+
await N(b === !0 && !ee ? !1 : s.data.skipConfirmation);
|
|
743
743
|
}
|
|
744
|
-
|
|
745
|
-
|
|
744
|
+
var Bn = /{{\s*\$context\.job\.apply_url\s*(?:\|[^}]*)?}}/, $n = (e, r) => {
|
|
745
|
+
if (!Bn.test(e))
|
|
746
|
+
return !1;
|
|
747
|
+
try {
|
|
748
|
+
let { protocol: t } = new URL(r);
|
|
749
|
+
return t === "https:" || t === "http:";
|
|
750
|
+
} catch {
|
|
751
|
+
return !1;
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
async function Pn({ chat: e, next: r, node: t, submissions: s, context: n, analytics: a, flow: i }) {
|
|
755
|
+
let o = he(t.data.href, { submissions: s, context: n }), { flowSessionId: c } = i.data;
|
|
756
|
+
await e.sendMessage({ type: "link", href: o, text: he(t.data.cta, { submissions: s, context: n }), ...$n(t.data.href, o) && { onClick: () => {
|
|
757
|
+
a.log({ event: "FLOW_REDIRECT", properties: { flow_build: i.build, flow_id: i.id, flow_session_id: c, flow_version: i.version, href: o, job: i.job } });
|
|
758
|
+
} } }), r(t.nextId);
|
|
746
759
|
}
|
|
747
|
-
async function
|
|
760
|
+
async function qn({ submissions: e, next: r, node: t, context: s }) {
|
|
748
761
|
r(Cn(t, { submissions: e, context: s }) ? t.branchId : t.nextId);
|
|
749
762
|
}
|
|
750
|
-
async function
|
|
763
|
+
async function Un({ chat: e, next: r, node: t, submissions: s, context: n }) {
|
|
751
764
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.text, { submissions: s, context: n }) }), r(t.nextId);
|
|
752
765
|
}
|
|
753
|
-
async function
|
|
766
|
+
async function Wn({ chat: e, next: r, node: t }) {
|
|
754
767
|
await e.sendMessage({ author: "bot", type: "image", url: t.data.url, height: t.data.height, width: t.data.width }), r(t.nextId);
|
|
755
768
|
}
|
|
756
|
-
async function
|
|
769
|
+
async function zn({ chat: e, next: r, node: t, submissions: s, context: n, t: a, dateEchoLocale: i }) {
|
|
757
770
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: s, context: n }) });
|
|
758
771
|
let o = t.data.format === "phone" ? await e.userInput({ key: t.data.key, type: "phone", config: { optional: t.data.optional, placeholder: t.data.placeholder, minChars: t.data.minChars, maxChars: t.data.maxChars, submissionFormat: "text", defaultValue: {} } }) : await e.userInput({ key: t.data.key, type: "text", config: { optional: t.data.optional, placeholder: t.data.placeholder, format: t.data.format, maxChars: t.data.maxChars, minChars: t.data.minChars, multiline: t.data.format === "text" && t.data.multiline === !0 } });
|
|
759
772
|
o === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: a("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: o.type === "phone" ? vt(o.value) : t.data.format === "date" && i !== void 0 ? Is(o.value, i) : o.value }), r(t.nextId);
|
|
760
773
|
}
|
|
761
|
-
async function
|
|
774
|
+
async function Hn({ chat: e, next: r, node: t, submissions: s, context: n, t: a }) {
|
|
762
775
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: s, context: n }) });
|
|
763
776
|
let i = await e.userInput({ key: t.data.key, type: "number", config: { max: t.data.max, min: t.data.min, optional: t.data.optional, placeholder: t.data.placeholder, decimalCases: t.data.decimalCases } });
|
|
764
777
|
i === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: a("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: i.value.toString() }), r(t.nextId);
|
|
765
778
|
}
|
|
766
|
-
async function
|
|
779
|
+
async function Kn({ chat: e, next: r, node: t, submissions: s, context: n, t: a }) {
|
|
767
780
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: s, context: n }) });
|
|
768
781
|
let i = await e.userInput({ key: t.data.key, type: "phone", config: { minChars: t.data.minChars, defaultValue: { countryCode: t.data.defaultCountryCode }, placeholder: t.data.placeholder, submissionFormat: "phone", optional: t.data.optional } });
|
|
769
782
|
i === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: a("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: i.type === "phone" ? vt(i.value) : i.value }), r(t.nextId);
|
|
770
783
|
}
|
|
771
|
-
async function
|
|
784
|
+
async function Gn({ chat: e, next: r, node: t, submissions: s, context: n, t: a }) {
|
|
772
785
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: s, context: n }) });
|
|
773
786
|
let i = await e.userInput({ key: t.data.key, type: "multiple-choice", config: t.data });
|
|
774
787
|
i.value.length === 0 ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: a("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: t.data.options.filter((o) => i.value.includes(o.value)).map((o) => o.label).join(", ") }), r(t.nextId);
|
|
775
788
|
}
|
|
776
|
-
async function
|
|
789
|
+
async function Jn({ chat: e, next: r, node: t, submissions: s, context: n, t: a }) {
|
|
777
790
|
await e.sendMessage({ author: "bot", type: "text", text: he(t.data.question, { submissions: s, context: n }) });
|
|
778
791
|
let i = await e.userInput({ key: t.data.key, type: "boolean", config: { optional: t.data.optional, labels: { true: t.data.trueLabel, false: t.data.falseLabel } } });
|
|
779
792
|
i === null ? await e.sendMessage({ type: "system", variant: "info", semantic: "question-skipped", text: a("skipped") }) : await e.sendMessage({ author: "user", type: "text", text: i.value === !0 ? t.data.trueLabel : t.data.falseLabel }), r(t.nextId);
|
|
780
793
|
}
|
|
781
|
-
async function
|
|
794
|
+
async function Zn({ chat: e, next: r, node: t, t: s }) {
|
|
782
795
|
await e.sendMessage({ author: "bot", type: "text", text: t.data.question });
|
|
783
796
|
let n = await e.userInput({ type: "address", key: t.data.key, config: { optional: t.data.optional, keys: t.data.keys, line2Required: t.data.line2Required, placeholder: t.data.placeholder } });
|
|
784
797
|
if (n === null)
|
|
@@ -789,7 +802,7 @@ async function Gn({ chat: e, next: r, node: t, t: s }) {
|
|
|
789
802
|
}
|
|
790
803
|
return r(t.nextId);
|
|
791
804
|
}
|
|
792
|
-
async function
|
|
805
|
+
async function Xn({ node: e, chat: r, next: t, submissions: s, context: n, t: a }) {
|
|
793
806
|
await r.sendMessage({ author: "bot", type: "text", text: he(e.data.question, { submissions: s, context: n }) });
|
|
794
807
|
let i = await r.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 } });
|
|
795
808
|
if (i === null)
|
|
@@ -799,10 +812,10 @@ async function Jn({ node: e, chat: r, next: t, submissions: s, context: n, t: a
|
|
|
799
812
|
await r.sendMessage({ author: "user", type: "file", fileName: o.name, fileSizeKb: o.sizeKb });
|
|
800
813
|
return t(e.nextId);
|
|
801
814
|
}
|
|
802
|
-
async function
|
|
815
|
+
async function Yn({ chat: e, end: r, node: t }) {
|
|
803
816
|
await e.sendMessage({ type: "system", variant: "info", text: t.data.systemMessage }), r();
|
|
804
817
|
}
|
|
805
|
-
async function
|
|
818
|
+
async function Qn({ node: e, flow: r, submissions: t, chat: s, next: n, apiClient: a, analytics: i, signal: o, context: c }) {
|
|
806
819
|
let d = Fs(r.nodes, t || {}), { answers: g, ...b } = d;
|
|
807
820
|
if (s.setSubmission(e.data.key, { type: "integration", value: b }), kn(r, a, { ...i.getSessionInfo(), job: r.job, flow_build: r.build, pre_apply: qr(r.nodes, t || {}, r.data.flowSessionId) }, o), d.status !== "skipped") {
|
|
808
821
|
let p = [d.status === "unavailable" ? "We could not prepare your pre-apply summary. You can still continue to your application." : d.hasHardConcerns ? e.data.messages.hard : d.hasAdvisoryConcerns ? e.data.messages.advisory : e.data.messages.matched];
|
|
@@ -832,7 +845,7 @@ const dr = (e, r, t) => {
|
|
|
832
845
|
},
|
|
833
846
|
customProperties: (s = r.analytics) == null ? void 0 : s.customProperties
|
|
834
847
|
});
|
|
835
|
-
}, $t = "resume-prompt",
|
|
848
|
+
}, $t = "resume-prompt", ea = async ({
|
|
836
849
|
chatService: e,
|
|
837
850
|
t: r,
|
|
838
851
|
signal: t
|
|
@@ -861,7 +874,7 @@ const dr = (e, r, t) => {
|
|
|
861
874
|
signal: t
|
|
862
875
|
});
|
|
863
876
|
return q.removeMessagesSentByNodeIds([$t]), (s == null ? void 0 : s.value) !== !1;
|
|
864
|
-
},
|
|
877
|
+
}, je = ({
|
|
865
878
|
class: e,
|
|
866
879
|
...r
|
|
867
880
|
}) => {
|
|
@@ -903,19 +916,19 @@ function wt(e) {
|
|
|
903
916
|
}
|
|
904
917
|
var Mt;
|
|
905
918
|
// @__NO_SIDE_EFFECTS__
|
|
906
|
-
function
|
|
919
|
+
function ta(e) {
|
|
907
920
|
return Mt == null ? void 0 : Mt.get(e);
|
|
908
921
|
}
|
|
909
922
|
var Lt;
|
|
910
923
|
// @__NO_SIDE_EFFECTS__
|
|
911
|
-
function
|
|
924
|
+
function ra(e) {
|
|
912
925
|
return Lt == null ? void 0 : Lt.get(e);
|
|
913
926
|
}
|
|
914
|
-
var
|
|
927
|
+
var Rt;
|
|
915
928
|
// @__NO_SIDE_EFFECTS__
|
|
916
|
-
function
|
|
929
|
+
function sa(e, r) {
|
|
917
930
|
var t;
|
|
918
|
-
return (t =
|
|
931
|
+
return (t = Rt == null ? void 0 : Rt.get(e)) == null ? void 0 : t.get(r);
|
|
919
932
|
}
|
|
920
933
|
// @__NO_SIDE_EFFECTS__
|
|
921
934
|
function Xe(e) {
|
|
@@ -937,7 +950,7 @@ function se(e, r, t, s, n) {
|
|
|
937
950
|
lang: s.lang,
|
|
938
951
|
abortEarly: s.abortEarly,
|
|
939
952
|
abortPipeEarly: s.abortPipeEarly
|
|
940
|
-
}, d = e.kind === "schema", g = (n == null ? void 0 : n.message) ?? e.message ?? /* @__PURE__ */
|
|
953
|
+
}, d = e.kind === "schema", g = (n == null ? void 0 : n.message) ?? e.message ?? /* @__PURE__ */ sa(e.reference, c.lang) ?? (d ? /* @__PURE__ */ ra(c.lang) : null) ?? s.message ?? /* @__PURE__ */ ta(c.lang);
|
|
941
954
|
g !== void 0 && (c.message = typeof g == "function" ? (
|
|
942
955
|
// @ts-expect-error
|
|
943
956
|
g(c)
|
|
@@ -954,16 +967,16 @@ function ge(e) {
|
|
|
954
967
|
};
|
|
955
968
|
}
|
|
956
969
|
// @__NO_SIDE_EFFECTS__
|
|
957
|
-
function
|
|
970
|
+
function na(e, r) {
|
|
958
971
|
return Object.hasOwn(e, r) && r !== "__proto__" && r !== "prototype" && r !== "constructor";
|
|
959
972
|
}
|
|
960
973
|
// @__NO_SIDE_EFFECTS__
|
|
961
|
-
function
|
|
974
|
+
function aa(e, r) {
|
|
962
975
|
const t = [...new Set(e)];
|
|
963
976
|
return t.length > 1 ? `(${t.join(` ${r} `)})` : t[0] ?? "never";
|
|
964
977
|
}
|
|
965
978
|
// @__NO_SIDE_EFFECTS__
|
|
966
|
-
function
|
|
979
|
+
function ia(e) {
|
|
967
980
|
if (e.path) {
|
|
968
981
|
let r = "";
|
|
969
982
|
for (const t of e.path)
|
|
@@ -975,7 +988,7 @@ function na(e) {
|
|
|
975
988
|
}
|
|
976
989
|
return null;
|
|
977
990
|
}
|
|
978
|
-
var
|
|
991
|
+
var oa = class extends Error {
|
|
979
992
|
/**
|
|
980
993
|
* Creates a Valibot error with useful information.
|
|
981
994
|
*
|
|
@@ -984,7 +997,7 @@ var aa = class extends Error {
|
|
|
984
997
|
constructor(e) {
|
|
985
998
|
super(e[0].message), this.name = "ValiError", this.issues = e;
|
|
986
999
|
}
|
|
987
|
-
},
|
|
1000
|
+
}, la = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
988
1001
|
// @__NO_SIDE_EFFECTS__
|
|
989
1002
|
function Yr(e, r) {
|
|
990
1003
|
return {
|
|
@@ -1008,7 +1021,7 @@ function Qr(e) {
|
|
|
1008
1021
|
reference: Qr,
|
|
1009
1022
|
expects: null,
|
|
1010
1023
|
async: !1,
|
|
1011
|
-
requirement:
|
|
1024
|
+
requirement: la,
|
|
1012
1025
|
message: e,
|
|
1013
1026
|
"~run"(r, t) {
|
|
1014
1027
|
return r.typed && !this.requirement.test(r.value) && se(this, "email", r, t), r;
|
|
@@ -1133,7 +1146,7 @@ function rs(e) {
|
|
|
1133
1146
|
};
|
|
1134
1147
|
}
|
|
1135
1148
|
// @__NO_SIDE_EFFECTS__
|
|
1136
|
-
function
|
|
1149
|
+
function ca(e, r, t) {
|
|
1137
1150
|
return typeof e.fallback == "function" ? (
|
|
1138
1151
|
// @ts-expect-error
|
|
1139
1152
|
e.fallback(r, t)
|
|
@@ -1272,7 +1285,7 @@ function Ce(e, r) {
|
|
|
1272
1285
|
}
|
|
1273
1286
|
d.typed || (t.typed = !1), t.value[i] = d.value;
|
|
1274
1287
|
} else if (o.fallback !== void 0)
|
|
1275
|
-
t.value[i] = /* @__PURE__ */
|
|
1288
|
+
t.value[i] = /* @__PURE__ */ ca(o);
|
|
1276
1289
|
else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (se(this, "key", t, s, {
|
|
1277
1290
|
input: void 0,
|
|
1278
1291
|
expected: `"${i}"`,
|
|
@@ -1319,7 +1332,7 @@ function os(e, r) {
|
|
|
1319
1332
|
kind: "schema",
|
|
1320
1333
|
type: "picklist",
|
|
1321
1334
|
reference: os,
|
|
1322
|
-
expects: /* @__PURE__ */
|
|
1335
|
+
expects: /* @__PURE__ */ aa(e.map(Xe), "|"),
|
|
1323
1336
|
async: !1,
|
|
1324
1337
|
options: e,
|
|
1325
1338
|
message: r,
|
|
@@ -1351,7 +1364,7 @@ function ls(e, r, t) {
|
|
|
1351
1364
|
if (a && typeof a == "object") {
|
|
1352
1365
|
s.typed = !0, s.value = {};
|
|
1353
1366
|
for (const c in a)
|
|
1354
|
-
if (/* @__PURE__ */
|
|
1367
|
+
if (/* @__PURE__ */ na(a, c)) {
|
|
1355
1368
|
const d = a[c], g = this.key["~run"]({ value: c }, n);
|
|
1356
1369
|
if (g.issues) {
|
|
1357
1370
|
const p = {
|
|
@@ -1412,14 +1425,14 @@ function le(e) {
|
|
|
1412
1425
|
}
|
|
1413
1426
|
};
|
|
1414
1427
|
}
|
|
1415
|
-
function
|
|
1428
|
+
function ua(e, r, t) {
|
|
1416
1429
|
const s = e["~run"]({ value: r }, /* @__PURE__ */ wt(t));
|
|
1417
1430
|
if (s.issues)
|
|
1418
|
-
throw new
|
|
1431
|
+
throw new oa(s.issues);
|
|
1419
1432
|
return s.value;
|
|
1420
1433
|
}
|
|
1421
1434
|
// @__NO_SIDE_EFFECTS__
|
|
1422
|
-
function
|
|
1435
|
+
function da(e, r) {
|
|
1423
1436
|
const t = {};
|
|
1424
1437
|
for (const s in e.entries)
|
|
1425
1438
|
t[s] = !r || r.includes(s) ? /* @__PURE__ */ Je(e.entries[s]) : e.entries[s];
|
|
@@ -1453,7 +1466,7 @@ function Me(...e) {
|
|
|
1453
1466
|
};
|
|
1454
1467
|
}
|
|
1455
1468
|
// @__NO_SIDE_EFFECTS__
|
|
1456
|
-
function
|
|
1469
|
+
function fa(e, r, t) {
|
|
1457
1470
|
const s = e["~run"]({ value: r }, /* @__PURE__ */ wt(t));
|
|
1458
1471
|
return {
|
|
1459
1472
|
typed: s.typed,
|
|
@@ -1463,7 +1476,7 @@ function ua(e, r, t) {
|
|
|
1463
1476
|
};
|
|
1464
1477
|
}
|
|
1465
1478
|
// @__NO_SIDE_EFFECTS__
|
|
1466
|
-
async function
|
|
1479
|
+
async function ha(e, r, t) {
|
|
1467
1480
|
const s = await e["~run"](
|
|
1468
1481
|
{ value: r },
|
|
1469
1482
|
/* @__PURE__ */ wt(t)
|
|
@@ -1539,7 +1552,7 @@ const tt = ({
|
|
|
1539
1552
|
}), t("skip")]
|
|
1540
1553
|
});
|
|
1541
1554
|
};
|
|
1542
|
-
var Gt = { 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" },
|
|
1555
|
+
var Gt = { 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" }, pa = (e) => {
|
|
1543
1556
|
if (e === "")
|
|
1544
1557
|
return { countryCode: "", phoneNumber: "" };
|
|
1545
1558
|
let r = Object.values(Gt).find((s) => e.startsWith(s)) ?? "", t = e.replace(r, "");
|
|
@@ -1555,16 +1568,16 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1555
1568
|
defaultVariants: {
|
|
1556
1569
|
optional: !1
|
|
1557
1570
|
}
|
|
1558
|
-
}),
|
|
1571
|
+
}), ma = "https://api.mapbox.com/search/searchbox/v1/suggest", ya = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", ba = (e) => atob(e).split("").reverse().join(""), we = /* @__PURE__ */ Ce({
|
|
1559
1572
|
name: /* @__PURE__ */ le()
|
|
1560
|
-
}),
|
|
1573
|
+
}), ga = /* @__PURE__ */ Ce({
|
|
1561
1574
|
suggestions: /* @__PURE__ */ ns(/* @__PURE__ */ Ce({
|
|
1562
1575
|
feature_type: /* @__PURE__ */ Je(/* @__PURE__ */ le()),
|
|
1563
1576
|
full_address: /* @__PURE__ */ Je(/* @__PURE__ */ le()),
|
|
1564
1577
|
place_formatted: /* @__PURE__ */ Je(/* @__PURE__ */ le()),
|
|
1565
1578
|
name: /* @__PURE__ */ Je(/* @__PURE__ */ le()),
|
|
1566
1579
|
mapbox_id: /* @__PURE__ */ le(),
|
|
1567
|
-
context: /* @__PURE__ */
|
|
1580
|
+
context: /* @__PURE__ */ da(/* @__PURE__ */ Ce({
|
|
1568
1581
|
address: we,
|
|
1569
1582
|
street: we,
|
|
1570
1583
|
neighborhood: we,
|
|
@@ -1576,7 +1589,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1576
1589
|
country: we
|
|
1577
1590
|
}))
|
|
1578
1591
|
}))
|
|
1579
|
-
}),
|
|
1592
|
+
}), va = ({
|
|
1580
1593
|
logger: e,
|
|
1581
1594
|
t: r
|
|
1582
1595
|
}) => Us(() => {
|
|
@@ -1586,17 +1599,17 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1586
1599
|
enabled: !0,
|
|
1587
1600
|
getPredictions: async (n) => {
|
|
1588
1601
|
var b;
|
|
1589
|
-
const a = new URL(
|
|
1602
|
+
const a = new URL(ma);
|
|
1590
1603
|
a.searchParams.set("q", n), a.searchParams.set("session_token", t);
|
|
1591
1604
|
const i = (b = q.current$.peek().flow) == null ? void 0 : b.locationOrigin;
|
|
1592
|
-
i && i.lat !== void 0 && i.lng !== void 0 && i.lat >= -90 && i.lat <= 90 && i.lng >= -180 && i.lng <= 180 && a.searchParams.set("proximity", `${i.lng},${i.lat}`), a.searchParams.set("access_token",
|
|
1605
|
+
i && i.lat !== void 0 && i.lng !== void 0 && i.lat >= -90 && i.lat <= 90 && i.lng >= -180 && i.lng <= 180 && a.searchParams.set("proximity", `${i.lng},${i.lat}`), a.searchParams.set("access_token", ba(ya));
|
|
1593
1606
|
const c = await fetch(a);
|
|
1594
1607
|
if (!c.ok)
|
|
1595
1608
|
return e.error("Failed to get address details", c), {
|
|
1596
1609
|
ok: !1,
|
|
1597
1610
|
error: r("address_error")
|
|
1598
1611
|
};
|
|
1599
|
-
const d = /* @__PURE__ */
|
|
1612
|
+
const d = /* @__PURE__ */ fa(ga, await c.json());
|
|
1600
1613
|
if (d.success === !1)
|
|
1601
1614
|
return e.error("Failed to parse address details", d.issues), {
|
|
1602
1615
|
ok: !1,
|
|
@@ -1608,7 +1621,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1608
1621
|
return {
|
|
1609
1622
|
ok: !0,
|
|
1610
1623
|
data: g.map((p) => {
|
|
1611
|
-
var m, _, k, C, A, v,
|
|
1624
|
+
var m, _, k, C, A, v, R, V, M;
|
|
1612
1625
|
return {
|
|
1613
1626
|
// A postcode result has no full address and is named by the postcode itself (PROD-7311).
|
|
1614
1627
|
label: p.full_address ?? ([p.name, p.place_formatted].filter(Boolean).join(", ") || p.mapbox_id),
|
|
@@ -1618,7 +1631,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1618
1631
|
line2: void 0,
|
|
1619
1632
|
line3: ((k = p.context.neighborhood) == null ? void 0 : k.name) ?? ((C = p.context.locality) == null ? void 0 : C.name),
|
|
1620
1633
|
city: ((A = p.context.place) == null ? void 0 : A.name) ?? ((v = p.context.district) == null ? void 0 : v.name),
|
|
1621
|
-
state: (
|
|
1634
|
+
state: (R = p.context.region) == null ? void 0 : R.name,
|
|
1622
1635
|
postcode: ((V = p.context.postcode) == null ? void 0 : V.name) ?? (p.feature_type === "postcode" ? p.name : void 0),
|
|
1623
1636
|
country: (M = p.context.country) == null ? void 0 : M.name
|
|
1624
1637
|
}
|
|
@@ -1652,7 +1665,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1652
1665
|
children: r("back")
|
|
1653
1666
|
})]
|
|
1654
1667
|
});
|
|
1655
|
-
},
|
|
1668
|
+
}, xa = ({
|
|
1656
1669
|
input: e,
|
|
1657
1670
|
onSubmitSuccess: r,
|
|
1658
1671
|
logger: t
|
|
@@ -1662,7 +1675,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1662
1675
|
} = re(), [n, a] = ke(), {
|
|
1663
1676
|
enabled: i,
|
|
1664
1677
|
getPredictions: o
|
|
1665
|
-
} =
|
|
1678
|
+
} = va({
|
|
1666
1679
|
logger: t,
|
|
1667
1680
|
t: s
|
|
1668
1681
|
}), [c, d] = ke(i ? "query" : "manual"), [g, b] = ke(""), [p, m] = ke(), _ = ye(), k = ye(), C = (v) => {
|
|
@@ -1673,14 +1686,14 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1673
1686
|
_.current = void 0, m(void 0);
|
|
1674
1687
|
return;
|
|
1675
1688
|
}
|
|
1676
|
-
const
|
|
1689
|
+
const R = _.current = {
|
|
1677
1690
|
query: v
|
|
1678
1691
|
};
|
|
1679
1692
|
m({
|
|
1680
1693
|
query: v,
|
|
1681
1694
|
status: "pending"
|
|
1682
1695
|
}), o(v).then((M) => {
|
|
1683
|
-
_.current ===
|
|
1696
|
+
_.current === R && (_.current = void 0, m(M.ok ? {
|
|
1684
1697
|
query: v,
|
|
1685
1698
|
status: "done",
|
|
1686
1699
|
items: M.data
|
|
@@ -1690,21 +1703,21 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1690
1703
|
error: M.error
|
|
1691
1704
|
}));
|
|
1692
1705
|
}, (M) => {
|
|
1693
|
-
_.current ===
|
|
1706
|
+
_.current === R && (_.current = void 0, t.error("Failed to get address details", M), m({
|
|
1694
1707
|
query: v,
|
|
1695
1708
|
status: "failed",
|
|
1696
1709
|
error: s("address_error")
|
|
1697
1710
|
}));
|
|
1698
1711
|
});
|
|
1699
|
-
}, A = (v,
|
|
1712
|
+
}, A = (v, R) => {
|
|
1700
1713
|
a((V) => ({
|
|
1701
1714
|
...V,
|
|
1702
|
-
[v]:
|
|
1715
|
+
[v]: R
|
|
1703
1716
|
}));
|
|
1704
1717
|
};
|
|
1705
1718
|
switch (c) {
|
|
1706
1719
|
case "query":
|
|
1707
|
-
return Oe(i, "Query state should not be enabled"), l(
|
|
1720
|
+
return Oe(i, "Query state should not be enabled"), l(wa, {
|
|
1708
1721
|
input: e,
|
|
1709
1722
|
onSkip: () => r(null),
|
|
1710
1723
|
onAddressSelect: (v) => {
|
|
@@ -1712,8 +1725,8 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1712
1725
|
_.current && (_.current = void 0, m(void 0)), d("manual");
|
|
1713
1726
|
return;
|
|
1714
1727
|
}
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1728
|
+
const R = (p == null ? void 0 : p.status) === "done" ? p.items.find((V) => V.id === v) : void 0;
|
|
1729
|
+
R && (k.current !== v && a(R.address), k.current = v, d("details"));
|
|
1717
1730
|
},
|
|
1718
1731
|
onAddressSearch: C,
|
|
1719
1732
|
lookup: p,
|
|
@@ -1751,7 +1764,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1751
1764
|
) : void 0
|
|
1752
1765
|
});
|
|
1753
1766
|
}
|
|
1754
|
-
},
|
|
1767
|
+
}, wa = ({
|
|
1755
1768
|
input: e,
|
|
1756
1769
|
onSkip: r,
|
|
1757
1770
|
lookup: t,
|
|
@@ -1871,7 +1884,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1871
1884
|
}, "")]
|
|
1872
1885
|
})]
|
|
1873
1886
|
});
|
|
1874
|
-
},
|
|
1887
|
+
}, Nt = ["line1", "line2", "line3", "city", "state", "postcode", "country"], hr = ({
|
|
1875
1888
|
addressFields: e,
|
|
1876
1889
|
onFieldChange: r,
|
|
1877
1890
|
onSubmitSuccess: t,
|
|
@@ -1895,7 +1908,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1895
1908
|
const d = c.currentTarget, g = [...d.querySelectorAll("input")].filter((m) => m.value !== "" && !m.value.trim());
|
|
1896
1909
|
for (const m of g) {
|
|
1897
1910
|
m.value = "";
|
|
1898
|
-
const _ =
|
|
1911
|
+
const _ = Nt.find((k) => n.config.keys[k] === m.name);
|
|
1899
1912
|
_ && r(_, "");
|
|
1900
1913
|
}
|
|
1901
1914
|
if (g.length > 0 && !d.checkValidity()) {
|
|
@@ -1911,7 +1924,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1911
1924
|
children: [l("div", {
|
|
1912
1925
|
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]",
|
|
1913
1926
|
ref: a,
|
|
1914
|
-
children:
|
|
1927
|
+
children: Nt.map((c, d) => {
|
|
1915
1928
|
const g = `isdk_${c}`, b = n.config.keys[c];
|
|
1916
1929
|
return b ? l(be, {
|
|
1917
1930
|
children: [l("label", {
|
|
@@ -1962,7 +1975,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1962
1975
|
defaultValue: e[c],
|
|
1963
1976
|
onInput: (p) => r(c, p.currentTarget.value),
|
|
1964
1977
|
required: c === "line2" ? n.config.line2Required === !0 : c !== "line3"
|
|
1965
|
-
}), d ===
|
|
1978
|
+
}), d === Nt.length - 1 ? l("hr", {
|
|
1966
1979
|
class: "m-0 w-full border-b border-b-transparent"
|
|
1967
1980
|
}) : l("hr", {
|
|
1968
1981
|
class: "border-b-neutral-5 m-0 w-full border-b border-solid"
|
|
@@ -1972,7 +1985,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1972
1985
|
})
|
|
1973
1986
|
}), l("div", {
|
|
1974
1987
|
class: "bg-neutral-1 sticky bottom-0 flex items-center py-2",
|
|
1975
|
-
children: [s, l(
|
|
1988
|
+
children: [s, l(je, {
|
|
1976
1989
|
class: "ml-auto"
|
|
1977
1990
|
})]
|
|
1978
1991
|
})]
|
|
@@ -1983,7 +1996,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1983
1996
|
var r;
|
|
1984
1997
|
(r = e.current) == null || r.focus();
|
|
1985
1998
|
}, []), e;
|
|
1986
|
-
}, cs = ["true", "false"],
|
|
1999
|
+
}, cs = ["true", "false"], _a = /* @__PURE__ */ os(cs), ka = "answer", us = "flex items-center flex-wrap gap-2 p-2.5", ds = "min-w-0 max-w-full flex-auto", fs = Hr(({
|
|
1987
2000
|
label: e,
|
|
1988
2001
|
...r
|
|
1989
2002
|
}, t) => l("button", {
|
|
@@ -1994,7 +2007,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
1994
2007
|
class: "text-center text-base",
|
|
1995
2008
|
children: e
|
|
1996
2009
|
})
|
|
1997
|
-
})),
|
|
2010
|
+
})), Ca = ({
|
|
1998
2011
|
input: e,
|
|
1999
2012
|
onSubmitSuccess: r
|
|
2000
2013
|
}) => {
|
|
@@ -2004,7 +2017,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2004
2017
|
class: "",
|
|
2005
2018
|
onSubmit: (s) => {
|
|
2006
2019
|
s.preventDefault();
|
|
2007
|
-
const n = Ws(s).value, a =
|
|
2020
|
+
const n = Ws(s).value, a = ua(_a, n);
|
|
2008
2021
|
r({
|
|
2009
2022
|
type: "boolean",
|
|
2010
2023
|
value: a === "true"
|
|
@@ -2017,7 +2030,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2017
2030
|
children: l(fs, {
|
|
2018
2031
|
ref: n === 0 ? t : null,
|
|
2019
2032
|
type: "submit",
|
|
2020
|
-
name:
|
|
2033
|
+
name: ka,
|
|
2021
2034
|
value: s,
|
|
2022
2035
|
label: e.config.labels[s]
|
|
2023
2036
|
}, s)
|
|
@@ -2031,10 +2044,10 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2031
2044
|
})
|
|
2032
2045
|
})]
|
|
2033
2046
|
});
|
|
2034
|
-
}, pr = (e) => e.reduce((r, t) => r + t.sizeKb, 0),
|
|
2047
|
+
}, pr = (e) => e.reduce((r, t) => r + t.sizeKb, 0), Sa = et("file"), mr = 3, _t = (e) => {
|
|
2035
2048
|
const r = e.lastIndexOf(".");
|
|
2036
2049
|
return r === -1 ? [e, ""] : [e.slice(0, r), e.slice(r)];
|
|
2037
|
-
},
|
|
2050
|
+
}, Aa = ({
|
|
2038
2051
|
file: e,
|
|
2039
2052
|
class: r,
|
|
2040
2053
|
...t
|
|
@@ -2070,22 +2083,22 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2070
2083
|
}) => l("li", {
|
|
2071
2084
|
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),
|
|
2072
2085
|
...r
|
|
2073
|
-
}),
|
|
2086
|
+
}), Ea = (e, r) => {
|
|
2074
2087
|
const [t, s] = _t(e);
|
|
2075
2088
|
return `${t.slice(0, r)}${s}`;
|
|
2076
2089
|
}, br = (e) => ({
|
|
2077
|
-
name:
|
|
2090
|
+
name: Ea(e.name, 42),
|
|
2078
2091
|
sizeKb: e.size / 1e3
|
|
2079
|
-
}),
|
|
2080
|
-
const s = _t(r.name)[1].toLowerCase(), n = [...t.map((i) => i.toLowerCase()), ...
|
|
2092
|
+
}), Ia = [".heic", ".heif", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".txt", ".rtf", ".odt", ".pages", ".zip"], Fa = (e, r, t) => {
|
|
2093
|
+
const s = _t(r.name)[1].toLowerCase(), n = [...t.map((i) => i.toLowerCase()), ...Ia], a = s === "" ? "none" : n.includes(s) ? s : "other";
|
|
2081
2094
|
return `chatbot-file-refused:${e}:${a}`;
|
|
2082
|
-
},
|
|
2095
|
+
}, Va = ({
|
|
2083
2096
|
input: e,
|
|
2084
2097
|
onSubmitSuccess: r,
|
|
2085
2098
|
analytics: t
|
|
2086
2099
|
}) => {
|
|
2087
2100
|
var C;
|
|
2088
|
-
const s = (C = q.current$.value.flow) == null ? void 0 : C.data.submissions[e.key], [n, a] = ke(
|
|
2101
|
+
const s = (C = q.current$.value.flow) == null ? void 0 : C.data.submissions[e.key], [n, a] = ke(Sa(s) && s.value.length ? {
|
|
2089
2102
|
status: "ready",
|
|
2090
2103
|
files: s.value
|
|
2091
2104
|
} : {
|
|
@@ -2142,13 +2155,13 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2142
2155
|
}
|
|
2143
2156
|
};
|
|
2144
2157
|
}, k = (A, v) => {
|
|
2145
|
-
var
|
|
2158
|
+
var R, V;
|
|
2146
2159
|
return t.log({
|
|
2147
2160
|
event: "INTERACTION",
|
|
2148
2161
|
properties: {
|
|
2149
|
-
tag:
|
|
2162
|
+
tag: Fa(A, v, e.config.extensions)
|
|
2150
2163
|
},
|
|
2151
|
-
customProperties: (V = (
|
|
2164
|
+
customProperties: (V = (R = q.current$.peek().flow) == null ? void 0 : R.analytics) == null ? void 0 : V.customProperties
|
|
2152
2165
|
});
|
|
2153
2166
|
};
|
|
2154
2167
|
return l("form", {
|
|
@@ -2174,14 +2187,14 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2174
2187
|
children: [c.length > 0 ? l("ul", {
|
|
2175
2188
|
class: "flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",
|
|
2176
2189
|
children: [c.slice(0, mr).map((A) => {
|
|
2177
|
-
const [v,
|
|
2190
|
+
const [v, R] = _t(A.name);
|
|
2178
2191
|
return l(yr, {
|
|
2179
2192
|
class: "flex overflow-hidden",
|
|
2180
2193
|
children: [l("span", {
|
|
2181
2194
|
class: "block truncate",
|
|
2182
2195
|
children: v
|
|
2183
2196
|
}), l("span", {
|
|
2184
|
-
children:
|
|
2197
|
+
children: R
|
|
2185
2198
|
})]
|
|
2186
2199
|
});
|
|
2187
2200
|
}), g > 0 ? l(yr, {
|
|
@@ -2261,14 +2274,14 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2261
2274
|
Oe(A.target instanceof HTMLInputElement);
|
|
2262
2275
|
const v = A.target.files ? Array.from(A.target.files) : [];
|
|
2263
2276
|
A.target.value = "";
|
|
2264
|
-
const [
|
|
2265
|
-
if (!
|
|
2277
|
+
const [R] = v;
|
|
2278
|
+
if (!R)
|
|
2266
2279
|
return;
|
|
2267
|
-
const V = ++i.current, M = n.status === "ready", ee = v.map(br),
|
|
2268
|
-
if (
|
|
2269
|
-
return k(
|
|
2280
|
+
const V = ++i.current, M = n.status === "ready", ee = v.map(br), N = _(ee);
|
|
2281
|
+
if (N)
|
|
2282
|
+
return k(N.reason, N.file ?? R), a({
|
|
2270
2283
|
status: "error",
|
|
2271
|
-
error:
|
|
2284
|
+
error: N.error
|
|
2272
2285
|
});
|
|
2273
2286
|
a({
|
|
2274
2287
|
status: "pending",
|
|
@@ -2282,8 +2295,8 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2282
2295
|
...br(T),
|
|
2283
2296
|
data: await zs(T)
|
|
2284
2297
|
};
|
|
2285
|
-
} catch (
|
|
2286
|
-
throw G ?? (G = T),
|
|
2298
|
+
} catch (j) {
|
|
2299
|
+
throw G ?? (G = T), j;
|
|
2287
2300
|
}
|
|
2288
2301
|
}));
|
|
2289
2302
|
i.current === V && a({
|
|
@@ -2293,7 +2306,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2293
2306
|
} catch {
|
|
2294
2307
|
if (i.current !== V)
|
|
2295
2308
|
return;
|
|
2296
|
-
k("unreadable", G ??
|
|
2309
|
+
k("unreadable", G ?? R), a({
|
|
2297
2310
|
status: "error",
|
|
2298
2311
|
error: {
|
|
2299
2312
|
type: "invalid",
|
|
@@ -2309,7 +2322,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2309
2322
|
})]
|
|
2310
2323
|
}), l("div", {
|
|
2311
2324
|
class: "flex h-full flex-col items-center gap-2",
|
|
2312
|
-
children: [l(
|
|
2325
|
+
children: [l(je, {
|
|
2313
2326
|
disabled: o.length === 0
|
|
2314
2327
|
}), e.config.optional && l(Se, {
|
|
2315
2328
|
class: "relative",
|
|
@@ -2323,7 +2336,7 @@ const Ye = xt("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
|
|
|
2323
2336
|
};
|
|
2324
2337
|
var ft = (e) => e.type === "checkbox", De = (e) => e instanceof Date, oe = (e) => e == null;
|
|
2325
2338
|
const hs = (e) => typeof e == "object";
|
|
2326
|
-
var Z = (e) => !oe(e) && !Array.isArray(e) && hs(e) && !De(e),
|
|
2339
|
+
var Z = (e) => !oe(e) && !Array.isArray(e) && hs(e) && !De(e), Ma = (e) => Z(e) && e.target ? ft(e.target) ? e.target.checked : e.target.value : e, La = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Ra = (e, r) => e.has(La(r)), Na = (e) => {
|
|
2327
2340
|
const r = e.constructor && e.constructor.prototype;
|
|
2328
2341
|
return Z(r) && r.hasOwnProperty("isPrototypeOf");
|
|
2329
2342
|
}, Zt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -2334,7 +2347,7 @@ function Q(e) {
|
|
|
2334
2347
|
if (Zt && (e instanceof Blob || r))
|
|
2335
2348
|
return e;
|
|
2336
2349
|
const t = Array.isArray(e);
|
|
2337
|
-
if (!t && !(Z(e) &&
|
|
2350
|
+
if (!t && !(Z(e) && Na(e)))
|
|
2338
2351
|
return e;
|
|
2339
2352
|
const s = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
2340
2353
|
for (const n in e)
|
|
@@ -2379,9 +2392,9 @@ const gr = {
|
|
|
2379
2392
|
pattern: "pattern",
|
|
2380
2393
|
required: "required",
|
|
2381
2394
|
validate: "validate"
|
|
2382
|
-
},
|
|
2383
|
-
|
|
2384
|
-
var
|
|
2395
|
+
}, Ta = ae.createContext(null);
|
|
2396
|
+
Ta.displayName = "HookFormControlContext";
|
|
2397
|
+
var Da = (e, r, t, s = !0) => {
|
|
2385
2398
|
const n = {
|
|
2386
2399
|
defaultValues: r._defaultValues
|
|
2387
2400
|
};
|
|
@@ -2394,8 +2407,8 @@ var Ra = (e, r, t, s = !0) => {
|
|
|
2394
2407
|
});
|
|
2395
2408
|
return n;
|
|
2396
2409
|
};
|
|
2397
|
-
const
|
|
2398
|
-
var ue = (e) => typeof e == "string",
|
|
2410
|
+
const Oa = typeof window < "u" ? ae.useLayoutEffect : ae.useEffect;
|
|
2411
|
+
var ue = (e) => typeof e == "string", ja = (e, r, t, s, n) => ue(e) ? (s && r.watch.add(e), S(t, e, n)) : Array.isArray(e) ? e.map((a) => (s && r.watch.add(a), S(t, a))) : (s && (r.watchAll = !0), t), Pt = (e) => oe(e) || !hs(e);
|
|
2399
2412
|
function Ve(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
2400
2413
|
if (Pt(e) || Pt(r))
|
|
2401
2414
|
return Object.is(e, r);
|
|
@@ -2419,8 +2432,8 @@ function Ve(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
2419
2432
|
}
|
|
2420
2433
|
return !0;
|
|
2421
2434
|
}
|
|
2422
|
-
const
|
|
2423
|
-
|
|
2435
|
+
const Ba = ae.createContext(null);
|
|
2436
|
+
Ba.displayName = "HookFormContext";
|
|
2424
2437
|
var ps = (e, r, t, s, n) => r ? {
|
|
2425
2438
|
...t[e],
|
|
2426
2439
|
types: {
|
|
@@ -2465,32 +2478,32 @@ var ie = (e) => Z(e) && !Object.keys(e).length, Qt = (e) => e.type === "file", b
|
|
|
2465
2478
|
return !1;
|
|
2466
2479
|
const r = e ? e.ownerDocument : 0;
|
|
2467
2480
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
2468
|
-
}, ys = (e) => e.type === "select-multiple", er = (e) => e.type === "radio",
|
|
2469
|
-
function
|
|
2481
|
+
}, ys = (e) => e.type === "select-multiple", er = (e) => e.type === "radio", $a = (e) => er(e) || ft(e), Tt = (e) => bt(e) && e.isConnected;
|
|
2482
|
+
function Pa(e, r) {
|
|
2470
2483
|
const t = r.slice(0, -1).length;
|
|
2471
2484
|
let s = 0;
|
|
2472
2485
|
for (; s < t; )
|
|
2473
2486
|
e = K(e) ? s++ : e[r[s++]];
|
|
2474
2487
|
return e;
|
|
2475
2488
|
}
|
|
2476
|
-
function
|
|
2489
|
+
function qa(e) {
|
|
2477
2490
|
for (const r in e)
|
|
2478
2491
|
if (e.hasOwnProperty(r) && !K(e[r]))
|
|
2479
2492
|
return !1;
|
|
2480
2493
|
return !0;
|
|
2481
2494
|
}
|
|
2482
2495
|
function J(e, r) {
|
|
2483
|
-
const t = Array.isArray(r) ? r : kt(r) ? [r] : Yt(r), s = t.length === 1 ? e :
|
|
2484
|
-
return s && delete s[a], n !== 0 && (Z(s) && ie(s) || Array.isArray(s) &&
|
|
2496
|
+
const t = Array.isArray(r) ? r : kt(r) ? [r] : Yt(r), s = t.length === 1 ? e : Pa(e, t), n = t.length - 1, a = t[n];
|
|
2497
|
+
return s && delete s[a], n !== 0 && (Z(s) && ie(s) || Array.isArray(s) && qa(s)) && J(e, t.slice(0, -1)), e;
|
|
2485
2498
|
}
|
|
2486
|
-
var
|
|
2499
|
+
var Ua = (e) => {
|
|
2487
2500
|
for (const r in e)
|
|
2488
2501
|
if (de(e[r]))
|
|
2489
2502
|
return !0;
|
|
2490
2503
|
return !1;
|
|
2491
2504
|
};
|
|
2492
2505
|
function bs(e) {
|
|
2493
|
-
return Array.isArray(e) || Z(e) && !
|
|
2506
|
+
return Array.isArray(e) || Z(e) && !Ua(e);
|
|
2494
2507
|
}
|
|
2495
2508
|
function qt(e, r = {}) {
|
|
2496
2509
|
for (const t in e) {
|
|
@@ -2541,7 +2554,7 @@ function kr(e) {
|
|
|
2541
2554
|
const r = e.ref;
|
|
2542
2555
|
return Qt(r) ? r.files : er(r) ? xs(e.refs).value : ys(r) ? [...r.selectedOptions].map(({ value: t }) => t) : ft(r) ? gs(e.refs).value : vs(K(r.value) ? e.ref.value : r.value, e);
|
|
2543
2556
|
}
|
|
2544
|
-
var
|
|
2557
|
+
var Wa = (e, r, t, s) => {
|
|
2545
2558
|
const n = {};
|
|
2546
2559
|
for (const a of e) {
|
|
2547
2560
|
const i = S(r, a);
|
|
@@ -2561,7 +2574,7 @@ var qa = (e, r, t, s) => {
|
|
|
2561
2574
|
isOnTouch: e === fe.onTouched
|
|
2562
2575
|
});
|
|
2563
2576
|
const Sr = "AsyncFunction";
|
|
2564
|
-
var
|
|
2577
|
+
var za = (e) => !!e && !!e.validate && !!(de(e.validate) && e.validate.constructor.name === Sr || Z(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === Sr)), Ha = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Ar = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
|
|
2565
2578
|
const dt = (e, r, t, s) => {
|
|
2566
2579
|
for (const n of t || Object.keys(e)) {
|
|
2567
2580
|
const a = S(e, n);
|
|
@@ -2607,11 +2620,11 @@ function Er(e, r, t) {
|
|
|
2607
2620
|
name: t
|
|
2608
2621
|
};
|
|
2609
2622
|
}
|
|
2610
|
-
var
|
|
2623
|
+
var Ka = (e, r, t, s) => {
|
|
2611
2624
|
t(e);
|
|
2612
2625
|
const { name: n, ...a } = e;
|
|
2613
2626
|
return ie(a) || Object.keys(a).length >= Object.keys(r).length || Object.keys(a).find((i) => r[i] === (!s || fe.all));
|
|
2614
|
-
},
|
|
2627
|
+
}, Ga = (e, r, t) => !e || !r || e === r || ut(e).some((s) => s && (t ? s === r : s.startsWith(r) || r.startsWith(s))), Ja = (e, r, t, s, n) => n.isOnAll ? !1 : !t && n.isOnTouch ? !(r || e) : (t ? s.isOnBlur : n.isOnBlur) ? !e : (t ? s.isOnChange : n.isOnChange) ? e : !0, Za = (e, r) => !Xt(S(e, r)).length && J(e, r), Xa = (e, r, t) => {
|
|
2615
2628
|
const s = ut(S(e, t));
|
|
2616
2629
|
return z(s, "root", r[t]), z(e, t, s), e;
|
|
2617
2630
|
};
|
|
@@ -2630,9 +2643,9 @@ var He = (e) => Z(e) && !gt(e) ? e : {
|
|
|
2630
2643
|
const { ref: i, refs: o, required: c, maxLength: d, minLength: g, min: b, max: p, pattern: m, validate: _, name: k, valueAsNumber: C, mount: A } = e._f, v = S(t, k);
|
|
2631
2644
|
if (!A || r.has(k))
|
|
2632
2645
|
return {};
|
|
2633
|
-
const
|
|
2634
|
-
n &&
|
|
2635
|
-
}, M = {}, ee = er(i),
|
|
2646
|
+
const R = o ? o[0] : i, V = (I) => {
|
|
2647
|
+
n && R.reportValidity && (R.setCustomValidity(me(I) ? "" : I || ""), R.reportValidity());
|
|
2648
|
+
}, M = {}, ee = er(i), N = ft(i), G = ee || N, D = (C || Qt(i)) && K(i.value) && K(v) || bt(i) && i.value === "" || v === "" || Array.isArray(v) && !v.length, T = ps.bind(null, k, s, M), j = (I, F, $, L = _e.maxLength, W = _e.minLength) => {
|
|
2636
2649
|
const U = I ? F : $;
|
|
2637
2650
|
M[k] = {
|
|
2638
2651
|
type: I ? L : W,
|
|
@@ -2641,12 +2654,12 @@ var He = (e) => Z(e) && !gt(e) ? e : {
|
|
|
2641
2654
|
...T(I ? L : W, U)
|
|
2642
2655
|
};
|
|
2643
2656
|
};
|
|
2644
|
-
if (a ? !Array.isArray(v) || !v.length : c && (!G && (D || oe(v)) || me(v) && !v ||
|
|
2657
|
+
if (a ? !Array.isArray(v) || !v.length : c && (!G && (D || oe(v)) || me(v) && !v || N && !gs(o).isValid || ee && !xs(o).isValid)) {
|
|
2645
2658
|
const { value: I, message: F } = ue(c) ? { value: !!c, message: c } : He(c);
|
|
2646
2659
|
if (I && (M[k] = {
|
|
2647
2660
|
type: _e.required,
|
|
2648
2661
|
message: F,
|
|
2649
|
-
ref:
|
|
2662
|
+
ref: R,
|
|
2650
2663
|
...T(_e.required, F)
|
|
2651
2664
|
}, !s))
|
|
2652
2665
|
return V(F), M;
|
|
@@ -2661,12 +2674,12 @@ var He = (e) => Z(e) && !gt(e) ? e : {
|
|
|
2661
2674
|
const W = i.valueAsDate || new Date(v), U = (H) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + H), te = i.type == "time", X = i.type == "week";
|
|
2662
2675
|
ue($.value) && v && (I = te ? U(v) > U($.value) : X ? v > $.value : W > new Date($.value)), ue(L.value) && v && (F = te ? U(v) < U(L.value) : X ? v < L.value : W < new Date(L.value));
|
|
2663
2676
|
}
|
|
2664
|
-
if ((I || F) && (
|
|
2677
|
+
if ((I || F) && (j(!!I, $.message, L.message, _e.max, _e.min), !s))
|
|
2665
2678
|
return V(M[k].message), M;
|
|
2666
2679
|
}
|
|
2667
2680
|
if ((d || g) && !D && (ue(v) || a && Array.isArray(v))) {
|
|
2668
2681
|
const I = He(d), F = He(g), $ = !oe(I.value) && v.length > +I.value, L = !oe(F.value) && v.length < +F.value;
|
|
2669
|
-
if (($ || L) && (
|
|
2682
|
+
if (($ || L) && (j($, I.message, F.message), !s))
|
|
2670
2683
|
return V(M[k].message), M;
|
|
2671
2684
|
}
|
|
2672
2685
|
if (m && !D && ue(v)) {
|
|
@@ -2681,7 +2694,7 @@ var He = (e) => Z(e) && !gt(e) ? e : {
|
|
|
2681
2694
|
}
|
|
2682
2695
|
if (_) {
|
|
2683
2696
|
if (de(_)) {
|
|
2684
|
-
const I = await _(v, t), F = Ir(I,
|
|
2697
|
+
const I = await _(v, t), F = Ir(I, R);
|
|
2685
2698
|
if (F && (M[k] = {
|
|
2686
2699
|
...F,
|
|
2687
2700
|
...T(_e.validate, F.message)
|
|
@@ -2692,14 +2705,14 @@ var He = (e) => Z(e) && !gt(e) ? e : {
|
|
|
2692
2705
|
for (const F in _) {
|
|
2693
2706
|
if (!ie(I) && !s)
|
|
2694
2707
|
break;
|
|
2695
|
-
const $ = Ir(await _[F](v, t),
|
|
2708
|
+
const $ = Ir(await _[F](v, t), R, F);
|
|
2696
2709
|
$ && (I = {
|
|
2697
2710
|
...$,
|
|
2698
2711
|
...T(F, $.message)
|
|
2699
2712
|
}, V($.message), s && (M[k] = I));
|
|
2700
2713
|
}
|
|
2701
2714
|
if (!ie(I) && (M[k] = {
|
|
2702
|
-
ref:
|
|
2715
|
+
ref: R,
|
|
2703
2716
|
...I
|
|
2704
2717
|
}, !s))
|
|
2705
2718
|
return M;
|
|
@@ -2707,14 +2720,14 @@ var He = (e) => Z(e) && !gt(e) ? e : {
|
|
|
2707
2720
|
}
|
|
2708
2721
|
return V(!0), M;
|
|
2709
2722
|
};
|
|
2710
|
-
const
|
|
2723
|
+
const Ya = {
|
|
2711
2724
|
mode: fe.onSubmit,
|
|
2712
2725
|
reValidateMode: fe.onChange,
|
|
2713
2726
|
shouldFocusError: !0
|
|
2714
2727
|
};
|
|
2715
|
-
function
|
|
2728
|
+
function Qa(e = {}) {
|
|
2716
2729
|
let r = {
|
|
2717
|
-
...
|
|
2730
|
+
...Ya,
|
|
2718
2731
|
...e
|
|
2719
2732
|
}, t = {
|
|
2720
2733
|
submitCount: 0,
|
|
@@ -2784,7 +2797,7 @@ function Xa(e = {}) {
|
|
|
2784
2797
|
}
|
|
2785
2798
|
if (x && Array.isArray(S(t.errors, u))) {
|
|
2786
2799
|
const E = h(S(t.errors, u), w.argA, w.argB);
|
|
2787
|
-
y && z(t.errors, u, E),
|
|
2800
|
+
y && z(t.errors, u, E), Za(t.errors, u);
|
|
2788
2801
|
}
|
|
2789
2802
|
if ((b.touchedFields || p.touchedFields) && x && Array.isArray(S(t.touchedFields, u))) {
|
|
2790
2803
|
const E = h(S(t.touchedFields, u), w.argA, w.argB);
|
|
@@ -2799,7 +2812,7 @@ function Xa(e = {}) {
|
|
|
2799
2812
|
});
|
|
2800
2813
|
} else
|
|
2801
2814
|
z(a, u, f);
|
|
2802
|
-
},
|
|
2815
|
+
}, R = (u, f) => {
|
|
2803
2816
|
z(t.errors, u, f), m.state.next({
|
|
2804
2817
|
errors: t.errors
|
|
2805
2818
|
});
|
|
@@ -2816,25 +2829,25 @@ function Xa(e = {}) {
|
|
|
2816
2829
|
}
|
|
2817
2830
|
}, ee = (u, f, h, w, y) => {
|
|
2818
2831
|
let x = !1, E = !1;
|
|
2819
|
-
const
|
|
2832
|
+
const B = {
|
|
2820
2833
|
name: u
|
|
2821
2834
|
};
|
|
2822
2835
|
if (!r.disabled) {
|
|
2823
2836
|
if (!h || w) {
|
|
2824
|
-
(b.isDirty || p.isDirty) && (E = t.isDirty, t.isDirty =
|
|
2837
|
+
(b.isDirty || p.isDirty) && (E = t.isDirty, t.isDirty = B.isDirty = I(), x = E !== B.isDirty);
|
|
2825
2838
|
const P = Ve(S(n, u), f);
|
|
2826
|
-
E = !!S(t.dirtyFields, u), P ? J(t.dirtyFields, u) : z(t.dirtyFields, u, !0),
|
|
2839
|
+
E = !!S(t.dirtyFields, u), P ? J(t.dirtyFields, u) : z(t.dirtyFields, u, !0), B.dirtyFields = t.dirtyFields, x = x || (b.dirtyFields || p.dirtyFields) && E !== !P;
|
|
2827
2840
|
}
|
|
2828
2841
|
if (h) {
|
|
2829
2842
|
const P = S(t.touchedFields, u);
|
|
2830
|
-
P || (z(t.touchedFields, u, h),
|
|
2843
|
+
P || (z(t.touchedFields, u, h), B.touchedFields = t.touchedFields, x = x || (b.touchedFields || p.touchedFields) && P !== h);
|
|
2831
2844
|
}
|
|
2832
|
-
x && y && m.state.next(
|
|
2845
|
+
x && y && m.state.next(B);
|
|
2833
2846
|
}
|
|
2834
|
-
return x ?
|
|
2835
|
-
},
|
|
2847
|
+
return x ? B : {};
|
|
2848
|
+
}, N = (u, f, h, w) => {
|
|
2836
2849
|
const y = S(t.errors, u), x = (b.isValid || p.isValid) && me(f) && t.isValid !== f;
|
|
2837
|
-
if (r.delayError && h ? (c = k(() =>
|
|
2850
|
+
if (r.delayError && h ? (c = k(() => R(u, h)), c(r.delayError)) : (clearTimeout(d), c = null, h ? z(t.errors, u, h) : J(t.errors, u)), (h ? !Ve(y, h) : y) || !ie(w) || x) {
|
|
2838
2851
|
const E = {
|
|
2839
2852
|
...w,
|
|
2840
2853
|
...x && me(f) ? { isValid: f } : {},
|
|
@@ -2846,7 +2859,7 @@ function Xa(e = {}) {
|
|
|
2846
2859
|
...E
|
|
2847
2860
|
}, m.state.next(E);
|
|
2848
2861
|
}
|
|
2849
|
-
}, G = async (u) => (A(u, !0), await r.resolver(a, r.context,
|
|
2862
|
+
}, G = async (u) => (A(u, !0), await r.resolver(a, r.context, Wa(u || o.mount, s, r.criteriaMode, r.shouldUseNativeValidation))), D = async (u) => {
|
|
2850
2863
|
const { errors: f } = await G(u);
|
|
2851
2864
|
if (A(u), u)
|
|
2852
2865
|
for (const h of u) {
|
|
@@ -2864,24 +2877,24 @@ function Xa(e = {}) {
|
|
|
2864
2877
|
if (y) {
|
|
2865
2878
|
const { _f: x, ...E } = y;
|
|
2866
2879
|
if (x) {
|
|
2867
|
-
const
|
|
2880
|
+
const B = o.array.has(x.name), P = y._f && za(y._f);
|
|
2868
2881
|
P && b.validatingFields && A([x.name], !0);
|
|
2869
|
-
const ne = await Fr(y, o.disabled, a, _, r.shouldUseNativeValidation && !f,
|
|
2882
|
+
const ne = await Fr(y, o.disabled, a, _, r.shouldUseNativeValidation && !f, B);
|
|
2870
2883
|
if (P && b.validatingFields && A([x.name]), ne[x.name] && (h.valid = !1, f || e.shouldUseNativeValidation))
|
|
2871
2884
|
break;
|
|
2872
|
-
!f && (S(ne, x.name) ?
|
|
2885
|
+
!f && (S(ne, x.name) ? B ? Xa(t.errors, ne, x.name) : z(t.errors, x.name, ne[x.name]) : J(t.errors, x.name));
|
|
2873
2886
|
}
|
|
2874
2887
|
!ie(E) && await T(E, f, h);
|
|
2875
2888
|
}
|
|
2876
2889
|
}
|
|
2877
2890
|
return h.valid;
|
|
2878
|
-
},
|
|
2891
|
+
}, j = () => {
|
|
2879
2892
|
for (const u of o.unMount) {
|
|
2880
2893
|
const f = S(s, u);
|
|
2881
2894
|
f && (f._f.refs ? f._f.refs.every((h) => !Tt(h)) : !Tt(f._f.ref)) && qe(u);
|
|
2882
2895
|
}
|
|
2883
2896
|
o.unMount = /* @__PURE__ */ new Set();
|
|
2884
|
-
}, I = (u, f) => !r.disabled && (u && f && z(a, u, f), !Ve(rt(), n)), F = (u, f, h) =>
|
|
2897
|
+
}, I = (u, f) => !r.disabled && (u && f && z(a, u, f), !Ve(rt(), n)), F = (u, f, h) => ja(u, o, {
|
|
2885
2898
|
...i.mount ? a : K(f) ? n : ue(u) ? { [u]: f } : f
|
|
2886
2899
|
}, h, f), $ = (u) => Xt(S(i.mount ? a : n, u, r.shouldUnregister ? S(n, u, []) : [])), L = (u, f, h = {}) => {
|
|
2887
2900
|
const w = S(s, u);
|
|
@@ -2889,7 +2902,7 @@ function Xa(e = {}) {
|
|
|
2889
2902
|
if (w) {
|
|
2890
2903
|
const x = w._f;
|
|
2891
2904
|
x && (!x.disabled && z(a, u, vs(f, x)), y = bt(x.ref) && oe(f) ? "" : f, ys(x.ref) ? [...x.ref.options].forEach((E) => E.selected = y.includes(E.value)) : x.refs ? ft(x.ref) ? x.refs.forEach((E) => {
|
|
2892
|
-
(!E.defaultChecked || !E.disabled) && (Array.isArray(y) ? E.checked = !!y.find((
|
|
2905
|
+
(!E.defaultChecked || !E.disabled) && (Array.isArray(y) ? E.checked = !!y.find((B) => B === E.value) : E.checked = y === E.value || !!y);
|
|
2893
2906
|
}) : x.refs.forEach((E) => E.checked = E.value === y) : Qt(x.ref) ? x.ref.value = "" : (x.ref.value = y, x.ref.type || m.state.next({
|
|
2894
2907
|
name: u,
|
|
2895
2908
|
values: Q(a)
|
|
@@ -2926,10 +2939,10 @@ function Xa(e = {}) {
|
|
|
2926
2939
|
let h = f.name, w = !0;
|
|
2927
2940
|
const y = S(s, h), x = (P) => {
|
|
2928
2941
|
w = Number.isNaN(P) || De(P) && isNaN(P.getTime()) || Ve(P, S(a, h, P));
|
|
2929
|
-
}, E = Cr(r.mode),
|
|
2942
|
+
}, E = Cr(r.mode), B = Cr(r.reValidateMode);
|
|
2930
2943
|
if (y) {
|
|
2931
2944
|
let P, ne;
|
|
2932
|
-
const Te = f.type ? kr(y._f) :
|
|
2945
|
+
const Te = f.type ? kr(y._f) : Ma(u), Ee = u.type === gr.BLUR || u.type === gr.FOCUS_OUT, _s = !Ha(y._f) && !r.resolver && !S(t.errors, h) && !y._f.deps || Ja(Ee, S(t.touchedFields, h), t.isSubmitted, B, E), Et = Ar(h, o, Ee);
|
|
2933
2946
|
z(a, h, Te), Ee ? (!f || !f.readOnly) && (y._f.onBlur && y._f.onBlur(u), c && c(0)) : y._f.onChange && y._f.onChange(u);
|
|
2934
2947
|
const It = ee(h, Te, Ee), ks = !ie(It) || Et;
|
|
2935
2948
|
if (!Ee && m.state.next({
|
|
@@ -2946,7 +2959,7 @@ function Xa(e = {}) {
|
|
|
2946
2959
|
}
|
|
2947
2960
|
} else
|
|
2948
2961
|
A([h], !0), P = (await Fr(y, o.disabled, a, _, r.shouldUseNativeValidation))[h], A([h]), x(Te), w && (P ? ne = !1 : (b.isValid || p.isValid) && (ne = await T(s, !0)));
|
|
2949
|
-
w && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) && H(y._f.deps),
|
|
2962
|
+
w && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) && H(y._f.deps), N(h, ne, P, It));
|
|
2950
2963
|
}
|
|
2951
2964
|
}, X = (u, f) => {
|
|
2952
2965
|
if (S(t.errors, f) && u.focus)
|
|
@@ -2972,7 +2985,7 @@ function Xa(e = {}) {
|
|
|
2972
2985
|
...i.mount ? a : n
|
|
2973
2986
|
};
|
|
2974
2987
|
return f && (h = ms(f.dirtyFields ? t.dirtyFields : t.touchedFields, h)), K(u) ? h : ue(u) ? S(h, u) : u.map((w) => S(h, w));
|
|
2975
|
-
},
|
|
2988
|
+
}, Be = (u, f) => ({
|
|
2976
2989
|
invalid: !!S((f || t).errors, u),
|
|
2977
2990
|
isDirty: !!S((f || t).dirtyFields, u),
|
|
2978
2991
|
error: S((f || t).errors, u),
|
|
@@ -2989,7 +3002,7 @@ function Xa(e = {}) {
|
|
|
2989
3002
|
errors: {}
|
|
2990
3003
|
});
|
|
2991
3004
|
}, $e = (u, f, h) => {
|
|
2992
|
-
const w = (S(s, u, { _f: {} })._f || {}).ref, y = S(t.errors, u) || {}, { ref: x, message: E, type:
|
|
3005
|
+
const w = (S(s, u, { _f: {} })._f || {}).ref, y = S(t.errors, u) || {}, { ref: x, message: E, type: B, ...P } = y;
|
|
2993
3006
|
z(t.errors, u, {
|
|
2994
3007
|
...P,
|
|
2995
3008
|
...f,
|
|
@@ -3003,14 +3016,14 @@ function Xa(e = {}) {
|
|
|
3003
3016
|
next: (h) => "values" in h && u(F(void 0, f), h)
|
|
3004
3017
|
}) : F(u, f, !0), Ae = (u) => m.state.subscribe({
|
|
3005
3018
|
next: (f) => {
|
|
3006
|
-
|
|
3019
|
+
Ga(u.name, f.name, u.exact) && Ka(f, u.formState || b, mt, u.reRenderRoot) && u.callback({
|
|
3007
3020
|
values: { ...a },
|
|
3008
3021
|
...t,
|
|
3009
3022
|
...f,
|
|
3010
3023
|
defaultValues: n
|
|
3011
3024
|
});
|
|
3012
3025
|
}
|
|
3013
|
-
}).unsubscribe,
|
|
3026
|
+
}).unsubscribe, Re = (u) => (i.mount = !0, p = {
|
|
3014
3027
|
...p,
|
|
3015
3028
|
...u.formState
|
|
3016
3029
|
}, Ae({
|
|
@@ -3063,15 +3076,15 @@ function Xa(e = {}) {
|
|
|
3063
3076
|
ref: (y) => {
|
|
3064
3077
|
if (y) {
|
|
3065
3078
|
ve(u, f), h = S(s, u);
|
|
3066
|
-
const x = K(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, E =
|
|
3067
|
-
if (E ?
|
|
3079
|
+
const x = K(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, E = $a(x), B = h._f.refs || [];
|
|
3080
|
+
if (E ? B.find((P) => P === x) : x === h._f.ref)
|
|
3068
3081
|
return;
|
|
3069
3082
|
z(s, u, {
|
|
3070
3083
|
_f: {
|
|
3071
3084
|
...h._f,
|
|
3072
3085
|
...E ? {
|
|
3073
3086
|
refs: [
|
|
3074
|
-
...
|
|
3087
|
+
...B.filter(Tt),
|
|
3075
3088
|
x,
|
|
3076
3089
|
...Array.isArray(S(n, u)) ? [{}] : []
|
|
3077
3090
|
],
|
|
@@ -3080,7 +3093,7 @@ function Xa(e = {}) {
|
|
|
3080
3093
|
}
|
|
3081
3094
|
}), M(u, !1, void 0, x);
|
|
3082
3095
|
} else
|
|
3083
|
-
h = S(s, u, {}), h._f && (h._f.mount = !1), (r.shouldUnregister || f.shouldUnregister) && !(
|
|
3096
|
+
h = S(s, u, {}), h._f && (h._f.mount = !1), (r.shouldUnregister || f.shouldUnregister) && !(Ra(o.array, u) && i.action) && o.unMount.add(u);
|
|
3084
3097
|
}
|
|
3085
3098
|
};
|
|
3086
3099
|
}, Ue = () => r.shouldFocusError && dt(s, X, o.mount), ht = (u) => {
|
|
@@ -3125,7 +3138,7 @@ function Xa(e = {}) {
|
|
|
3125
3138
|
throw w;
|
|
3126
3139
|
}, ze = (u, f = {}) => {
|
|
3127
3140
|
S(s, u) && (K(f.defaultValue) ? U(u, Q(S(n, u))) : (U(u, f.defaultValue), z(n, u, Q(f.defaultValue))), f.keepTouched || J(t.touchedFields, u), f.keepDirty || (J(t.dirtyFields, u), t.isDirty = f.defaultValue ? I(u, Q(S(n, u))) : I()), f.keepError || (J(t.errors, u), b.isValid && C()), m.state.next({ ...t }));
|
|
3128
|
-
},
|
|
3141
|
+
}, Ne = (u, f = {}) => {
|
|
3129
3142
|
const h = u ? Q(u) : n, w = Q(h), y = ie(u), x = y ? n : w;
|
|
3130
3143
|
if (f.keepDefaultValues || (n = h), !f.keepValues) {
|
|
3131
3144
|
if (f.keepDirtyValues) {
|
|
@@ -3133,16 +3146,16 @@ function Xa(e = {}) {
|
|
|
3133
3146
|
...o.mount,
|
|
3134
3147
|
...Object.keys(Ke(n, a))
|
|
3135
3148
|
]);
|
|
3136
|
-
for (const
|
|
3137
|
-
const P = S(t.dirtyFields,
|
|
3138
|
-
P && !K(ne) ? z(x,
|
|
3149
|
+
for (const B of Array.from(E)) {
|
|
3150
|
+
const P = S(t.dirtyFields, B), ne = S(a, B), Te = S(x, B);
|
|
3151
|
+
P && !K(ne) ? z(x, B, ne) : !P && !K(Te) && U(B, Te);
|
|
3139
3152
|
}
|
|
3140
3153
|
} else {
|
|
3141
3154
|
if (Zt && K(u))
|
|
3142
3155
|
for (const E of o.mount) {
|
|
3143
|
-
const
|
|
3144
|
-
if (
|
|
3145
|
-
const P = Array.isArray(
|
|
3156
|
+
const B = S(s, E);
|
|
3157
|
+
if (B && B._f) {
|
|
3158
|
+
const P = Array.isArray(B._f.refs) ? B._f.refs[0] : B._f.ref;
|
|
3146
3159
|
if (bt(P)) {
|
|
3147
3160
|
const ne = P.closest("form");
|
|
3148
3161
|
if (ne) {
|
|
@@ -3183,7 +3196,7 @@ function Xa(e = {}) {
|
|
|
3183
3196
|
isSubmitting: !1,
|
|
3184
3197
|
defaultValues: n
|
|
3185
3198
|
});
|
|
3186
|
-
}, nt = (u, f) =>
|
|
3199
|
+
}, nt = (u, f) => Ne(de(u) ? u(a) : u, { ...r.resetOptions, ...f }), pt = (u, f = {}) => {
|
|
3187
3200
|
const h = S(s, u), w = h && h._f;
|
|
3188
3201
|
if (w) {
|
|
3189
3202
|
const y = w.refs ? w.refs[0] : w.ref;
|
|
@@ -3200,7 +3213,7 @@ function Xa(e = {}) {
|
|
|
3200
3213
|
control: {
|
|
3201
3214
|
register: ve,
|
|
3202
3215
|
unregister: qe,
|
|
3203
|
-
getFieldState:
|
|
3216
|
+
getFieldState: Be,
|
|
3204
3217
|
handleSubmit: We,
|
|
3205
3218
|
setError: $e,
|
|
3206
3219
|
_subscribe: Ae,
|
|
@@ -3214,13 +3227,13 @@ function Xa(e = {}) {
|
|
|
3214
3227
|
_setDisabledField: st,
|
|
3215
3228
|
_setErrors: V,
|
|
3216
3229
|
_getFieldArray: $,
|
|
3217
|
-
_reset:
|
|
3230
|
+
_reset: Ne,
|
|
3218
3231
|
_resetDefaultValues: () => de(r.defaultValues) && r.defaultValues().then((u) => {
|
|
3219
3232
|
nt(u, r.resetOptions), m.state.next({
|
|
3220
3233
|
isLoading: !1
|
|
3221
3234
|
});
|
|
3222
3235
|
}),
|
|
3223
|
-
_removeUnmounted:
|
|
3236
|
+
_removeUnmounted: j,
|
|
3224
3237
|
_disableForm: ht,
|
|
3225
3238
|
_subjects: m,
|
|
3226
3239
|
_proxyFormState: b,
|
|
@@ -3258,7 +3271,7 @@ function Xa(e = {}) {
|
|
|
3258
3271
|
};
|
|
3259
3272
|
}
|
|
3260
3273
|
},
|
|
3261
|
-
subscribe:
|
|
3274
|
+
subscribe: Re,
|
|
3262
3275
|
trigger: H,
|
|
3263
3276
|
register: ve,
|
|
3264
3277
|
handleSubmit: We,
|
|
@@ -3271,7 +3284,7 @@ function Xa(e = {}) {
|
|
|
3271
3284
|
unregister: qe,
|
|
3272
3285
|
setError: $e,
|
|
3273
3286
|
setFocus: pt,
|
|
3274
|
-
getFieldState:
|
|
3287
|
+
getFieldState: Be
|
|
3275
3288
|
};
|
|
3276
3289
|
return {
|
|
3277
3290
|
...at,
|
|
@@ -3303,14 +3316,14 @@ function Ct(e = {}) {
|
|
|
3303
3316
|
formState: s
|
|
3304
3317
|
}, e.defaultValues && !de(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
3305
3318
|
else {
|
|
3306
|
-
const { formControl: i, ...o } =
|
|
3319
|
+
const { formControl: i, ...o } = Qa(e);
|
|
3307
3320
|
r.current = {
|
|
3308
3321
|
...o,
|
|
3309
3322
|
formState: s
|
|
3310
3323
|
};
|
|
3311
3324
|
}
|
|
3312
3325
|
const a = r.current.control;
|
|
3313
|
-
return a._options = e,
|
|
3326
|
+
return a._options = e, Oa(() => {
|
|
3314
3327
|
const i = a._subscribe({
|
|
3315
3328
|
formState: a._proxyFormState,
|
|
3316
3329
|
callback: () => n({ ...a._formState }),
|
|
@@ -3343,46 +3356,46 @@ function Ct(e = {}) {
|
|
|
3343
3356
|
}), !((i = a._options.resetOptions) === null || i === void 0) && i.keepIsValid || a._setValid(), t.current = e.values, n((o) => ({ ...o }))) : a._resetDefaultValues();
|
|
3344
3357
|
}, [a, e.values]), ae.useEffect(() => {
|
|
3345
3358
|
a._state.mount || (a._setValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
3346
|
-
}), r.current.formState = ae.useMemo(() =>
|
|
3359
|
+
}), r.current.formState = ae.useMemo(() => Da(s, a), [a, s]), r.current;
|
|
3347
3360
|
}
|
|
3348
3361
|
const Vr = (e, r, t) => {
|
|
3349
3362
|
if (e && "reportValidity" in e) {
|
|
3350
3363
|
const s = S(t, r);
|
|
3351
3364
|
e.setCustomValidity(s && s.message || ""), e.reportValidity();
|
|
3352
3365
|
}
|
|
3353
|
-
},
|
|
3366
|
+
}, ei = (e, r) => {
|
|
3354
3367
|
for (const t in r.fields) {
|
|
3355
3368
|
const s = r.fields[t];
|
|
3356
3369
|
s && s.ref && "reportValidity" in s.ref ? Vr(s.ref, t, e) : s.refs && s.refs.forEach((n) => Vr(n, t, e));
|
|
3357
3370
|
}
|
|
3358
|
-
},
|
|
3359
|
-
r.shouldUseNativeValidation &&
|
|
3371
|
+
}, ti = (e, r) => {
|
|
3372
|
+
r.shouldUseNativeValidation && ei(e, r);
|
|
3360
3373
|
const t = {};
|
|
3361
3374
|
for (const s in e) {
|
|
3362
3375
|
const n = S(r.fields, s), a = Object.assign(e[s] || {}, { ref: n && n.ref });
|
|
3363
|
-
if (
|
|
3376
|
+
if (ri(r.names || Object.keys(e), s)) {
|
|
3364
3377
|
const i = Object.assign({}, S(t, s));
|
|
3365
3378
|
z(i, "root", a), z(t, s, i);
|
|
3366
3379
|
} else
|
|
3367
3380
|
z(t, s, a);
|
|
3368
3381
|
}
|
|
3369
3382
|
return t;
|
|
3370
|
-
},
|
|
3383
|
+
}, ri = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
3371
3384
|
var St = function(e, r, t) {
|
|
3372
3385
|
return t === void 0 && (t = {}), function(s, n, a) {
|
|
3373
3386
|
try {
|
|
3374
3387
|
var i = !a.shouldUseNativeValidation && a.criteriaMode === "all";
|
|
3375
|
-
return Promise.resolve(/* @__PURE__ */
|
|
3388
|
+
return Promise.resolve(/* @__PURE__ */ ha(e, s, Object.assign({}, r, { abortPipeEarly: !i }))).then(function(o) {
|
|
3376
3389
|
if (o.issues) {
|
|
3377
3390
|
for (var c = {}; o.issues.length; ) {
|
|
3378
|
-
var d = o.issues[0], g = /* @__PURE__ */
|
|
3391
|
+
var d = o.issues[0], g = /* @__PURE__ */ ia(d);
|
|
3379
3392
|
if (g && (c[g] || (c[g] = { message: d.message, type: d.type }), i)) {
|
|
3380
3393
|
var b = c[g].types, p = b && b[d.type];
|
|
3381
3394
|
c[g] = ps(g, i, c, d.type, p ? [].concat(p, d.message) : d.message);
|
|
3382
3395
|
}
|
|
3383
3396
|
o.issues.shift();
|
|
3384
3397
|
}
|
|
3385
|
-
return { values: {}, errors:
|
|
3398
|
+
return { values: {}, errors: ti(c, a) };
|
|
3386
3399
|
}
|
|
3387
3400
|
return { values: t.raw ? s : o.output, errors: {} };
|
|
3388
3401
|
});
|
|
@@ -3391,7 +3404,7 @@ var St = function(e, r, t) {
|
|
|
3391
3404
|
}
|
|
3392
3405
|
};
|
|
3393
3406
|
};
|
|
3394
|
-
const Mr = 27, Lr = 12,
|
|
3407
|
+
const Mr = 27, Lr = 12, Rr = 10, si = et("enum"), ni = (e, r) => {
|
|
3395
3408
|
const t = {
|
|
3396
3409
|
min: e.minSelected ?? 0,
|
|
3397
3410
|
max: e.maxSelected ?? e.options.length
|
|
@@ -3403,7 +3416,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3403
3416
|
count: t.min
|
|
3404
3417
|
})))
|
|
3405
3418
|
}));
|
|
3406
|
-
},
|
|
3419
|
+
}, ai = Hr(({
|
|
3407
3420
|
option: e,
|
|
3408
3421
|
...r
|
|
3409
3422
|
}, t) => l(be, {
|
|
@@ -3417,7 +3430,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3417
3430
|
htmlFor: r.id,
|
|
3418
3431
|
children: e.label
|
|
3419
3432
|
})]
|
|
3420
|
-
})),
|
|
3433
|
+
})), Nr = xt("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4", {
|
|
3421
3434
|
variants: {
|
|
3422
3435
|
variant: {
|
|
3423
3436
|
// In cases where there is only one option, we want to center it
|
|
@@ -3426,7 +3439,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3426
3439
|
booleanLike: us
|
|
3427
3440
|
}
|
|
3428
3441
|
}
|
|
3429
|
-
}),
|
|
3442
|
+
}), ii = ({
|
|
3430
3443
|
input: e,
|
|
3431
3444
|
onSubmitSuccess: r
|
|
3432
3445
|
}) => {
|
|
@@ -3441,16 +3454,16 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3441
3454
|
}
|
|
3442
3455
|
} = Ct({
|
|
3443
3456
|
defaultValues: {
|
|
3444
|
-
checked: s ? {} :
|
|
3457
|
+
checked: s ? {} : si(t) ? Object.fromEntries(t.value.map((p) => [p, !0])) : {}
|
|
3445
3458
|
},
|
|
3446
|
-
resolver:
|
|
3459
|
+
resolver: ni(e.config, a)
|
|
3447
3460
|
}), d = Jt();
|
|
3448
3461
|
return n ? l(be, {
|
|
3449
3462
|
children: [l("ul", {
|
|
3450
3463
|
style: {
|
|
3451
|
-
maxHeight: 6.5 * Mr + 5 * Lr + 2 *
|
|
3464
|
+
maxHeight: 6.5 * Mr + 5 * Lr + 2 * Rr
|
|
3452
3465
|
},
|
|
3453
|
-
class:
|
|
3466
|
+
class: Nr({
|
|
3454
3467
|
variant: "booleanLike"
|
|
3455
3468
|
}),
|
|
3456
3469
|
children: e.config.options.map((p, m) => l("li", {
|
|
@@ -3492,9 +3505,9 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3492
3505
|
class: "flex items-center gap-1",
|
|
3493
3506
|
children: [l("ul", {
|
|
3494
3507
|
style: {
|
|
3495
|
-
maxHeight: 6.5 * Mr + 5 * Lr + 2 *
|
|
3508
|
+
maxHeight: 6.5 * Mr + 5 * Lr + 2 * Rr
|
|
3496
3509
|
},
|
|
3497
|
-
class:
|
|
3510
|
+
class: Nr({
|
|
3498
3511
|
variant: e.config.options.length === 1 ? "singleOption" : void 0
|
|
3499
3512
|
}),
|
|
3500
3513
|
children: e.config.options.map((p, m) => {
|
|
@@ -3504,7 +3517,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3504
3517
|
} = i(_);
|
|
3505
3518
|
return l("li", {
|
|
3506
3519
|
class: "relative",
|
|
3507
|
-
children: l(
|
|
3520
|
+
children: l(ai, {
|
|
3508
3521
|
option: p,
|
|
3509
3522
|
autoFocus: m === 0,
|
|
3510
3523
|
ref: (A) => {
|
|
@@ -3521,7 +3534,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3521
3534
|
})
|
|
3522
3535
|
}), l("div", {
|
|
3523
3536
|
class: "flex flex-col items-center gap-2 pr-2.5 pt-2.5",
|
|
3524
|
-
children: [s ? null : l(
|
|
3537
|
+
children: [s ? null : l(je, {}), e.config.minSelected === 0 && l(Se, {
|
|
3525
3538
|
class: "relative",
|
|
3526
3539
|
type: "button",
|
|
3527
3540
|
onClick: () => r({
|
|
@@ -3537,7 +3550,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3537
3550
|
})
|
|
3538
3551
|
})]
|
|
3539
3552
|
});
|
|
3540
|
-
},
|
|
3553
|
+
}, oi = et("number"), li = (e, r) => {
|
|
3541
3554
|
const t = e.min ?? Number.MIN_SAFE_INTEGER, s = e.max ?? Number.MAX_SAFE_INTEGER, n = e.decimalCases ?? 0;
|
|
3542
3555
|
return St(/* @__PURE__ */ Ce({
|
|
3543
3556
|
number: /* @__PURE__ */ Me(/* @__PURE__ */ is(r("validation_number")), /* @__PURE__ */ ts(t, r("validation_number_min", {
|
|
@@ -3548,7 +3561,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3548
3561
|
count: n
|
|
3549
3562
|
})))
|
|
3550
3563
|
}));
|
|
3551
|
-
},
|
|
3564
|
+
}, ci = ({
|
|
3552
3565
|
input: e,
|
|
3553
3566
|
onSubmitSuccess: r
|
|
3554
3567
|
}) => {
|
|
@@ -3563,9 +3576,9 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3563
3576
|
}
|
|
3564
3577
|
} = Ct({
|
|
3565
3578
|
defaultValues: {
|
|
3566
|
-
number:
|
|
3579
|
+
number: oi(s) ? s.value : t ? Number(t) : void 0
|
|
3567
3580
|
},
|
|
3568
|
-
resolver:
|
|
3581
|
+
resolver: li(e.config, n)
|
|
3569
3582
|
}), {
|
|
3570
3583
|
ref: c,
|
|
3571
3584
|
...d
|
|
@@ -3609,25 +3622,25 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3609
3622
|
class: "absolute bottom-0 right-0.5 top-0",
|
|
3610
3623
|
onClick: () => r(null)
|
|
3611
3624
|
})]
|
|
3612
|
-
}), l(
|
|
3625
|
+
}), l(je, {})]
|
|
3613
3626
|
}), l(tt, {
|
|
3614
3627
|
error: o.number
|
|
3615
3628
|
})]
|
|
3616
3629
|
});
|
|
3617
|
-
},
|
|
3618
|
-
const r = /* @__PURE__ */ Me(/* @__PURE__ */ le(e("validation_country_code")), /* @__PURE__ */ Ht(
|
|
3630
|
+
}, ui = "44", di = /^[0-9 ]+$/, fi = et("string"), hi = et("phone"), pi = (e) => {
|
|
3631
|
+
const r = /* @__PURE__ */ Me(/* @__PURE__ */ le(e("validation_country_code")), /* @__PURE__ */ Ht(di, e("validation_country_code"))), t = /* @__PURE__ */ Me(/* @__PURE__ */ le(e("validation_phone")), /* @__PURE__ */ Ze(1, e("validation_phone")), /* @__PURE__ */ Kt((s) => s.replace(/[^0-9]/g, "")));
|
|
3619
3632
|
return St(/* @__PURE__ */ Ce({
|
|
3620
3633
|
countryCode: r,
|
|
3621
3634
|
phoneNumber: t
|
|
3622
3635
|
}));
|
|
3623
|
-
},
|
|
3636
|
+
}, mi = ({
|
|
3624
3637
|
input: e,
|
|
3625
3638
|
onSubmitSuccess: r
|
|
3626
3639
|
}) => {
|
|
3627
3640
|
var k;
|
|
3628
3641
|
const t = e.key ? (k = q.current$.value.flow) == null ? void 0 : k.data.submissions[e.key] : void 0, {
|
|
3629
3642
|
t: s
|
|
3630
|
-
} = re(), [n, a] = ke(), i =
|
|
3643
|
+
} = re(), [n, a] = ke(), i = fi(t) ? pa(t.value) : hi(t) ? t.value : void 0, {
|
|
3631
3644
|
register: o,
|
|
3632
3645
|
handleSubmit: c,
|
|
3633
3646
|
formState: {
|
|
@@ -3636,10 +3649,10 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3636
3649
|
watch: g
|
|
3637
3650
|
} = Ct({
|
|
3638
3651
|
defaultValues: {
|
|
3639
|
-
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ??
|
|
3652
|
+
countryCode: (i == null ? void 0 : i.countryCode) ?? e.config.defaultValue.countryCode ?? ui,
|
|
3640
3653
|
phoneNumber: (i == null ? void 0 : i.phoneNumber) ?? e.config.defaultValue.phoneNumber ?? ""
|
|
3641
3654
|
},
|
|
3642
|
-
resolver:
|
|
3655
|
+
resolver: pi(s)
|
|
3643
3656
|
}), {
|
|
3644
3657
|
ref: b,
|
|
3645
3658
|
...p
|
|
@@ -3654,10 +3667,10 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3654
3667
|
onSubmit: c((C) => {
|
|
3655
3668
|
const A = C.phoneNumber.replace(/[^0-9]/g, ""), v = C.countryCode.replace(/[^0-9]/g, "");
|
|
3656
3669
|
a(void 0);
|
|
3657
|
-
const
|
|
3658
|
-
if (V <
|
|
3670
|
+
const R = e.config.minChars ?? 7, V = A.length + v.length;
|
|
3671
|
+
if (V < R)
|
|
3659
3672
|
return a(s("validation_phone_min_chars", {
|
|
3660
|
-
count:
|
|
3673
|
+
count: R
|
|
3661
3674
|
}));
|
|
3662
3675
|
const M = e.config.maxChars;
|
|
3663
3676
|
if (M != null && V > M)
|
|
@@ -3714,7 +3727,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3714
3727
|
class: "absolute bottom-0 right-1 top-0",
|
|
3715
3728
|
onClick: () => r(null)
|
|
3716
3729
|
})]
|
|
3717
|
-
}), l(
|
|
3730
|
+
}), l(je, {})]
|
|
3718
3731
|
}), l(tt, {
|
|
3719
3732
|
error: d.countryCode || d.phoneNumber || {
|
|
3720
3733
|
message: n
|
|
@@ -3725,10 +3738,10 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3725
3738
|
time: Ur(t, r)
|
|
3726
3739
|
}) : e("submission_cooldown", {
|
|
3727
3740
|
count: s
|
|
3728
|
-
}),
|
|
3741
|
+
}), yi = (e, r) => {
|
|
3729
3742
|
const t = e == null ? void 0 : e.trim();
|
|
3730
3743
|
return t && t !== "Submit" ? t : r("submit");
|
|
3731
|
-
},
|
|
3744
|
+
}, bi = ({
|
|
3732
3745
|
input: e,
|
|
3733
3746
|
onSubmitSuccess: r
|
|
3734
3747
|
}) => {
|
|
@@ -3764,7 +3777,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3764
3777
|
class: "flex items-center gap-1.5",
|
|
3765
3778
|
children: [l("span", {
|
|
3766
3779
|
class: "inline-flex items-center text-sm font-medium",
|
|
3767
|
-
children:
|
|
3780
|
+
children: yi(e.config.label, t)
|
|
3768
3781
|
}), l("svg", {
|
|
3769
3782
|
stroke: "currentColor",
|
|
3770
3783
|
"stroke-width": "1.5",
|
|
@@ -3791,9 +3804,9 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3791
3804
|
children: o
|
|
3792
3805
|
})]
|
|
3793
3806
|
});
|
|
3794
|
-
},
|
|
3795
|
-
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight,
|
|
3796
|
-
},
|
|
3807
|
+
}, gi = 160, Dr = (e) => {
|
|
3808
|
+
e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, gi)}px`;
|
|
3809
|
+
}, vi = {
|
|
3797
3810
|
date: {
|
|
3798
3811
|
type: "date",
|
|
3799
3812
|
inputMode: "text"
|
|
@@ -3812,7 +3825,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3812
3825
|
inputMode: "url",
|
|
3813
3826
|
formNoValidate: !0
|
|
3814
3827
|
}
|
|
3815
|
-
},
|
|
3828
|
+
}, xi = et("string"), wi = (e, r) => {
|
|
3816
3829
|
const t = {
|
|
3817
3830
|
maxLength: r("validation_max_chars", {
|
|
3818
3831
|
count: e.maxChars ?? 999
|
|
@@ -3829,7 +3842,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3829
3842
|
url: /* @__PURE__ */ Me(/* @__PURE__ */ le(r("validation_url")), /* @__PURE__ */ rs(r("validation_url")), /* @__PURE__ */ Ze(e.minChars ?? 1, t.minLength), /* @__PURE__ */ ct(e.maxChars ?? 1 / 0, t.maxLength))
|
|
3830
3843
|
}[e.format]
|
|
3831
3844
|
}));
|
|
3832
|
-
},
|
|
3845
|
+
}, _i = ({
|
|
3833
3846
|
input: e,
|
|
3834
3847
|
onSubmitSuccess: r
|
|
3835
3848
|
}) => {
|
|
@@ -3845,9 +3858,9 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3845
3858
|
}
|
|
3846
3859
|
} = Ct({
|
|
3847
3860
|
defaultValues: {
|
|
3848
|
-
text:
|
|
3861
|
+
text: xi(s) ? s.value : n ?? ""
|
|
3849
3862
|
},
|
|
3850
|
-
resolver:
|
|
3863
|
+
resolver: wi(e.config, t)
|
|
3851
3864
|
}), {
|
|
3852
3865
|
ref: g,
|
|
3853
3866
|
...b
|
|
@@ -3894,7 +3907,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3894
3907
|
}) : l("input", {
|
|
3895
3908
|
id: "chat-input",
|
|
3896
3909
|
...b,
|
|
3897
|
-
...
|
|
3910
|
+
...vi[e.config.format],
|
|
3898
3911
|
autocomplete: "off",
|
|
3899
3912
|
autoCapitalize: "off",
|
|
3900
3913
|
autoCorrect: "off",
|
|
@@ -3914,7 +3927,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3914
3927
|
onClick: () => r(null)
|
|
3915
3928
|
}
|
|
3916
3929
|
)]
|
|
3917
|
-
}), l(
|
|
3930
|
+
}), l(je, {})]
|
|
3918
3931
|
}), _ !== void 0 && m !== void 0 && l("p", {
|
|
3919
3932
|
id: "chat-input-count",
|
|
3920
3933
|
class: "text-neutral-10 px-3 text-right text-xs",
|
|
@@ -3923,16 +3936,16 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3923
3936
|
error: d.text
|
|
3924
3937
|
})]
|
|
3925
3938
|
});
|
|
3926
|
-
},
|
|
3927
|
-
text:
|
|
3928
|
-
phone:
|
|
3929
|
-
"multiple-choice":
|
|
3930
|
-
boolean:
|
|
3931
|
-
file:
|
|
3932
|
-
submit:
|
|
3933
|
-
address:
|
|
3934
|
-
number:
|
|
3935
|
-
},
|
|
3939
|
+
}, ki = {
|
|
3940
|
+
text: _i,
|
|
3941
|
+
phone: mi,
|
|
3942
|
+
"multiple-choice": ii,
|
|
3943
|
+
boolean: Ca,
|
|
3944
|
+
file: Va,
|
|
3945
|
+
submit: bi,
|
|
3946
|
+
address: xa,
|
|
3947
|
+
number: ci
|
|
3948
|
+
}, Ci = ({
|
|
3936
3949
|
logger: e,
|
|
3937
3950
|
analytics: r
|
|
3938
3951
|
}) => {
|
|
@@ -3951,7 +3964,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3951
3964
|
onPointerDownCapture: t ? n : void 0,
|
|
3952
3965
|
onKeyDownCapture: t ? n : void 0,
|
|
3953
3966
|
children: t ? (() => {
|
|
3954
|
-
const i =
|
|
3967
|
+
const i = ki[t.type];
|
|
3955
3968
|
return l(i, {
|
|
3956
3969
|
logger: e,
|
|
3957
3970
|
analytics: r,
|
|
@@ -3968,7 +3981,7 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3968
3981
|
className: "flex-grow rounded-full"
|
|
3969
3982
|
}),
|
|
3970
3983
|
disabled: !0
|
|
3971
|
-
}), l(
|
|
3984
|
+
}), l(je, {
|
|
3972
3985
|
disabled: !0,
|
|
3973
3986
|
"aria-hidden": "true",
|
|
3974
3987
|
tabIndex: -1
|
|
@@ -3977,30 +3990,30 @@ const Mr = 27, Lr = 12, Nr = 10, ti = et("enum"), ri = (e, r) => {
|
|
|
3977
3990
|
})
|
|
3978
3991
|
});
|
|
3979
3992
|
};
|
|
3980
|
-
function
|
|
3993
|
+
function Si(e) {
|
|
3981
3994
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3982
3995
|
}
|
|
3983
|
-
var
|
|
3996
|
+
var Ai = function(e) {
|
|
3984
3997
|
return e instanceof RegExp;
|
|
3985
|
-
},
|
|
3998
|
+
}, Ei = function(r) {
|
|
3986
3999
|
var t = /[\\^$.*+?()[\]{}|]/g, s = RegExp(t.source);
|
|
3987
4000
|
return r && s.test(r) ? r.replace(t, "\\$&") : r;
|
|
3988
4001
|
}, ws = function(e) {
|
|
3989
4002
|
return typeof e == "string";
|
|
3990
|
-
},
|
|
4003
|
+
}, Ii = function(e) {
|
|
3991
4004
|
var r = [];
|
|
3992
4005
|
return e.forEach(function(t) {
|
|
3993
4006
|
Array.isArray(t) ? r = r.concat(t) : r.push(t);
|
|
3994
4007
|
}), r;
|
|
3995
4008
|
};
|
|
3996
|
-
function
|
|
4009
|
+
function Fi(e, r, t) {
|
|
3997
4010
|
var s = 0, n = 0;
|
|
3998
4011
|
if (e === "")
|
|
3999
4012
|
return e;
|
|
4000
4013
|
if (!e || !ws(e))
|
|
4001
4014
|
throw new TypeError("First argument to react-string-replace#replaceString must be a string");
|
|
4002
4015
|
var a = r;
|
|
4003
|
-
|
|
4016
|
+
Ai(a) || (a = new RegExp("(" + Ei(a) + ")", "gi"));
|
|
4004
4017
|
for (var i = e.split(a), o = 1, c = i.length; o < c; o += 2) {
|
|
4005
4018
|
if (i[o] === void 0 || i[o - 1] === void 0) {
|
|
4006
4019
|
console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");
|
|
@@ -4010,14 +4023,14 @@ function Ei(e, r, t) {
|
|
|
4010
4023
|
}
|
|
4011
4024
|
return i;
|
|
4012
4025
|
}
|
|
4013
|
-
var
|
|
4014
|
-
return Array.isArray(r) || (r = [r]),
|
|
4015
|
-
return ws(n) ?
|
|
4026
|
+
var Vi = function(r, t, s) {
|
|
4027
|
+
return Array.isArray(r) || (r = [r]), Ii(r.map(function(n) {
|
|
4028
|
+
return ws(n) ? Fi(n, t, s) : n;
|
|
4016
4029
|
}));
|
|
4017
4030
|
};
|
|
4018
|
-
const ot = /* @__PURE__ */
|
|
4019
|
-
const r = ot(e,
|
|
4020
|
-
const [, d, g] = o.match(
|
|
4031
|
+
const ot = /* @__PURE__ */ Si(Vi), Mi = /(\[[^\]]+\]\([^)]+\))/g, Li = /\[([^\]]+)\]\(([^)]+)\)/, Ri = /(https?:\/\/[^\s]+)/g, Ni = /_(.*?)_/g, Ti = /\*\*(.*?)\*\*/g, Di = /(\\n|\n)/g, Or = "text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline", Oi = (e) => {
|
|
4032
|
+
const r = ot(e, Mi, (o, c) => {
|
|
4033
|
+
const [, d, g] = o.match(Li) ?? [];
|
|
4021
4034
|
return g ? l("a", {
|
|
4022
4035
|
class: Or,
|
|
4023
4036
|
href: g,
|
|
@@ -4025,18 +4038,18 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4025
4038
|
}, g + c) : l("span", {
|
|
4026
4039
|
children: "INVALID LINK"
|
|
4027
4040
|
});
|
|
4028
|
-
}), t = ot(r,
|
|
4041
|
+
}), t = ot(r, Ri, (o, c) => l("a", {
|
|
4029
4042
|
class: Or,
|
|
4030
4043
|
href: o,
|
|
4031
4044
|
children: o
|
|
4032
|
-
}, o + c)), s = ot(t,
|
|
4045
|
+
}, o + c)), s = ot(t, Ni, (o, c) => l("em", {
|
|
4033
4046
|
children: o
|
|
4034
|
-
}, o + c)), n = ot(s,
|
|
4047
|
+
}, o + c)), n = ot(s, Ti, (o, c) => l("strong", {
|
|
4035
4048
|
children: o
|
|
4036
4049
|
}, o + c));
|
|
4037
4050
|
let a = 0;
|
|
4038
|
-
return ot(n,
|
|
4039
|
-
},
|
|
4051
|
+
return ot(n, Di, () => l("br", {}, `br-${a++}`));
|
|
4052
|
+
}, ji = xt("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", {
|
|
4040
4053
|
variants: {
|
|
4041
4054
|
side: {
|
|
4042
4055
|
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
@@ -4050,7 +4063,7 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4050
4063
|
defaultVariants: {
|
|
4051
4064
|
side: "left"
|
|
4052
4065
|
}
|
|
4053
|
-
}),
|
|
4066
|
+
}), Bi = ({
|
|
4054
4067
|
children: e,
|
|
4055
4068
|
className: r,
|
|
4056
4069
|
animate: t,
|
|
@@ -4060,21 +4073,21 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4060
4073
|
style: {
|
|
4061
4074
|
transformOrigin: s === "left" ? "0% 50%" : "100% 50%"
|
|
4062
4075
|
},
|
|
4063
|
-
class:
|
|
4076
|
+
class: ji({
|
|
4064
4077
|
className: r,
|
|
4065
4078
|
side: s,
|
|
4066
4079
|
animate: t
|
|
4067
4080
|
}),
|
|
4068
4081
|
...n,
|
|
4069
4082
|
children: e
|
|
4070
|
-
}),
|
|
4083
|
+
}), jr = /* @__PURE__ */ new Map(), $i = ({
|
|
4071
4084
|
flow: e,
|
|
4072
4085
|
rpcClient: r
|
|
4073
4086
|
}) => {
|
|
4074
4087
|
const {
|
|
4075
4088
|
t
|
|
4076
|
-
} = re(), s = e.data.flowSessionId, n =
|
|
4077
|
-
|
|
4089
|
+
} = re(), s = e.data.flowSessionId, n = jr.get(s) ?? Hs("offer");
|
|
4090
|
+
jr.set(s, n);
|
|
4078
4091
|
const a = (c) => {
|
|
4079
4092
|
const d = e.data.submissions[c];
|
|
4080
4093
|
return (d == null ? void 0 : d.type) === "string" ? d.value.trim() : void 0;
|
|
@@ -4134,7 +4147,7 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4134
4147
|
children: t("job_alerts_privacy")
|
|
4135
4148
|
})]
|
|
4136
4149
|
});
|
|
4137
|
-
},
|
|
4150
|
+
}, Pi = ({
|
|
4138
4151
|
message: e
|
|
4139
4152
|
}) => l("div", {
|
|
4140
4153
|
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
@@ -4158,7 +4171,7 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4158
4171
|
})
|
|
4159
4172
|
})]
|
|
4160
4173
|
})
|
|
4161
|
-
}),
|
|
4174
|
+
}), qi = ({
|
|
4162
4175
|
className: e,
|
|
4163
4176
|
...r
|
|
4164
4177
|
}) => l("div", {
|
|
@@ -4176,10 +4189,10 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4176
4189
|
}
|
|
4177
4190
|
}))
|
|
4178
4191
|
}) : void 0
|
|
4179
|
-
}),
|
|
4192
|
+
}), Ui = {
|
|
4180
4193
|
bot: "left",
|
|
4181
4194
|
user: "right"
|
|
4182
|
-
},
|
|
4195
|
+
}, Wi = xt("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)]", {
|
|
4183
4196
|
variants: {
|
|
4184
4197
|
variant: {
|
|
4185
4198
|
info: "text-neutral-11",
|
|
@@ -4188,7 +4201,7 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4188
4201
|
success: "text-system-success"
|
|
4189
4202
|
}
|
|
4190
4203
|
}
|
|
4191
|
-
}),
|
|
4204
|
+
}), zi = ({
|
|
4192
4205
|
lastSentMessageFooter: e,
|
|
4193
4206
|
rpcClient: r
|
|
4194
4207
|
}) => {
|
|
@@ -4206,7 +4219,7 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4206
4219
|
children: [i && o.groupId === i && !n.slice(c + 1).some((d) => d.groupId === i) ? e : null, Ks(o).with({
|
|
4207
4220
|
type: "system"
|
|
4208
4221
|
}, (d) => l("p", {
|
|
4209
|
-
class:
|
|
4222
|
+
class: Wi({
|
|
4210
4223
|
variant: d.variant
|
|
4211
4224
|
}),
|
|
4212
4225
|
children: d.text
|
|
@@ -4214,17 +4227,17 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4214
4227
|
type: "text",
|
|
4215
4228
|
author: Gs.union("bot", "user")
|
|
4216
4229
|
}, (d) => {
|
|
4217
|
-
const g = c === n.length - 1, b = d.author === "bot" ?
|
|
4230
|
+
const g = c === n.length - 1, b = d.author === "bot" ? Oi(d.text) : d.text;
|
|
4218
4231
|
return l(be, {
|
|
4219
|
-
children: l(
|
|
4232
|
+
children: l(Bi, {
|
|
4220
4233
|
animate: g,
|
|
4221
|
-
side:
|
|
4234
|
+
side: Ui[d.author],
|
|
4222
4235
|
children: b
|
|
4223
4236
|
}, c)
|
|
4224
4237
|
});
|
|
4225
4238
|
}).with({
|
|
4226
4239
|
type: "link"
|
|
4227
|
-
}, (d) => l(
|
|
4240
|
+
}, (d) => l(Pi, {
|
|
4228
4241
|
message: d
|
|
4229
4242
|
})).with({
|
|
4230
4243
|
type: "image"
|
|
@@ -4236,7 +4249,7 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4236
4249
|
}
|
|
4237
4250
|
})).with({
|
|
4238
4251
|
type: "file"
|
|
4239
|
-
}, (d) => l(
|
|
4252
|
+
}, (d) => l(Aa, {
|
|
4240
4253
|
class: d.author === "bot" ? void 0 : "ml-auto",
|
|
4241
4254
|
file: {
|
|
4242
4255
|
name: d.fileName,
|
|
@@ -4259,7 +4272,7 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4259
4272
|
});
|
|
4260
4273
|
}).exhaustive()]
|
|
4261
4274
|
}), c === a && (s != null && s.jobAlerts) && r ? l("li", {
|
|
4262
|
-
children: l(
|
|
4275
|
+
children: l($i, {
|
|
4263
4276
|
flow: s,
|
|
4264
4277
|
rpcClient: r
|
|
4265
4278
|
}, s.data.flowSessionId)
|
|
@@ -4273,9 +4286,9 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4273
4286
|
"aria-label": t("captcha_check"),
|
|
4274
4287
|
class: "w-full max-w-[min(100%,24rem)] rounded-md"
|
|
4275
4288
|
})
|
|
4276
|
-
}, "captcha"), l(
|
|
4289
|
+
}, "captcha"), l(qi, {}, "typing")]
|
|
4277
4290
|
});
|
|
4278
|
-
},
|
|
4291
|
+
}, Zi = ({
|
|
4279
4292
|
logger: e,
|
|
4280
4293
|
apiClient: r,
|
|
4281
4294
|
rpcClient: t,
|
|
@@ -4306,8 +4319,8 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4306
4319
|
if (ce.scrollToEnd(), q.setInput(void 0), m.data.isFinished)
|
|
4307
4320
|
return;
|
|
4308
4321
|
const k = () => {
|
|
4309
|
-
const
|
|
4310
|
-
!
|
|
4322
|
+
const N = q.current$.peek().flow;
|
|
4323
|
+
!N || N.data.hasInteracted || (q.markAsInteracted(), dr(s, N, "FLOW_INTERACT"));
|
|
4311
4324
|
};
|
|
4312
4325
|
ce.onInteractionFn$.value = k, _ === void 0 ? (_ = Jr(a.nodes).id, q.setCurrentNodeId(_), dr(s, m, "FLOW_START")) : q.removeMessagesSentByNodeIds([_, $t]);
|
|
4313
4326
|
const {
|
|
@@ -4327,42 +4340,42 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4327
4340
|
chatService: c,
|
|
4328
4341
|
t: d,
|
|
4329
4342
|
getApplicationRecovery: () => {
|
|
4330
|
-
var
|
|
4331
|
-
return (
|
|
4343
|
+
var N;
|
|
4344
|
+
return (N = q.current$.peek().flow) == null ? void 0 : N.data.applicationRecovery;
|
|
4332
4345
|
},
|
|
4333
4346
|
setApplicationRecovery: q.setApplicationRecovery,
|
|
4334
4347
|
persistWriteBarrier: () => q.persistWriteBarrier(m),
|
|
4335
4348
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
4336
4349
|
getSubmissions: () => {
|
|
4337
|
-
var
|
|
4338
|
-
return (
|
|
4350
|
+
var N;
|
|
4351
|
+
return (N = q.current$.peek().flow) == null ? void 0 : N.data.submissions;
|
|
4339
4352
|
},
|
|
4340
|
-
onInterpret: (
|
|
4353
|
+
onInterpret: (N) => q.setCurrentNodeId(N.id),
|
|
4341
4354
|
onFlowEnd: async () => {
|
|
4342
4355
|
var G;
|
|
4343
4356
|
q.markAsFinished();
|
|
4344
|
-
const
|
|
4345
|
-
Oe(
|
|
4357
|
+
const N = q.current$.peek().flow;
|
|
4358
|
+
Oe(N), s.log({
|
|
4346
4359
|
event: "FLOW_END",
|
|
4347
4360
|
properties: {
|
|
4348
4361
|
flow_id: a.id,
|
|
4349
4362
|
flow_version: a.version,
|
|
4350
|
-
flow_session_id:
|
|
4363
|
+
flow_session_id: N.data.flowSessionId,
|
|
4351
4364
|
flow_build: a.build,
|
|
4352
4365
|
job: a.job
|
|
4353
4366
|
},
|
|
4354
4367
|
customProperties: (G = a.analytics) == null ? void 0 : G.customProperties
|
|
4355
4368
|
});
|
|
4356
4369
|
}
|
|
4357
|
-
}),
|
|
4358
|
-
b(() => v), C(
|
|
4370
|
+
}), R = _, V = () => {
|
|
4371
|
+
b(() => v), C(R);
|
|
4359
4372
|
}, M = new AbortController();
|
|
4360
|
-
return m.offerResume ?
|
|
4373
|
+
return m.offerResume ? ea({
|
|
4361
4374
|
chatService: c,
|
|
4362
4375
|
t: d,
|
|
4363
4376
|
signal: M.signal
|
|
4364
|
-
}).then((
|
|
4365
|
-
|
|
4377
|
+
}).then((N) => (q.settleResume(m), N ? V() : (q.restart(), Zs.flushStateData()))).catch((N) => {
|
|
4378
|
+
N instanceof Pr || e.error("Resume prompt failed", N);
|
|
4366
4379
|
}) : V(), () => {
|
|
4367
4380
|
M.abort(), ce.onInteractionFn$.value === k && (ce.onInteractionFn$.value = () => {
|
|
4368
4381
|
}), A();
|
|
@@ -4379,9 +4392,9 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4379
4392
|
style: {
|
|
4380
4393
|
WebkitOverflowScrolling: "touch"
|
|
4381
4394
|
},
|
|
4382
|
-
children: l(
|
|
4395
|
+
children: l(zi, {
|
|
4383
4396
|
rpcClient: t,
|
|
4384
|
-
lastSentMessageFooter: !zt(a) || !g ? null : l(
|
|
4397
|
+
lastSentMessageFooter: !zt(a) || !g ? null : l(Hi, {
|
|
4385
4398
|
undoFn: g
|
|
4386
4399
|
})
|
|
4387
4400
|
})
|
|
@@ -4399,12 +4412,12 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4399
4412
|
children: l(Xs, {})
|
|
4400
4413
|
})
|
|
4401
4414
|
})]
|
|
4402
|
-
}), l(
|
|
4415
|
+
}), l(Ci, {
|
|
4403
4416
|
logger: e,
|
|
4404
4417
|
analytics: s
|
|
4405
4418
|
})]
|
|
4406
4419
|
});
|
|
4407
|
-
},
|
|
4420
|
+
}, Hi = ({
|
|
4408
4421
|
undoFn: e
|
|
4409
4422
|
}) => {
|
|
4410
4423
|
const {
|
|
@@ -4427,5 +4440,5 @@ const ot = /* @__PURE__ */ ki(Ii), Fi = /(\[[^\]]+\]\([^)]+\))/g, Vi = /\[([^\]]
|
|
|
4427
4440
|
});
|
|
4428
4441
|
};
|
|
4429
4442
|
export {
|
|
4430
|
-
|
|
4443
|
+
Zi as ChatbotBody
|
|
4431
4444
|
};
|