@verbb/formie-browser 1.0.3 → 1.0.5
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/CHANGELOG.md +65 -17
- package/dist/chunks/address-country-Rx6GQTND.js +68 -0
- package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
- package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
- package/dist/chunks/api-CmwLRq_n.js +780 -0
- package/dist/chunks/api-DMK8NSUI.js +407 -0
- package/dist/chunks/api-sPqGbOww.js +125 -0
- package/dist/chunks/async-nPFRNQ06.js +25 -0
- package/dist/chunks/bpoint-DSjqRv63.js +24 -0
- package/dist/chunks/calculations-CgVJcQ2P.js +299 -0
- package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
- package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
- package/dist/chunks/chunk-3b4jIN3o.js +13 -0
- package/dist/chunks/combobox-D-2b42wn.js +1954 -0
- package/dist/chunks/conditions-CZ3FU5QO.js +412 -0
- package/dist/chunks/constants-DVcJAvc5.js +38 -0
- package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
- package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
- package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
- package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
- package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
- package/dist/chunks/debug-BV0DvdHx.js +41 -0
- package/dist/chunks/dist-BF5GU3_9.js +2674 -0
- package/dist/chunks/event-names-BCI2FLD8.js +51 -0
- package/dist/chunks/eway-D3ctTbEk.js +70 -0
- package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
- package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
- package/dist/chunks/file-upload-D49m8-DR.js +287 -0
- package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
- package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
- package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
- package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
- package/dist/chunks/google-address-OhKilPWE.js +161 -0
- package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
- package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
- package/dist/chunks/http-D-JExro7.js +27 -0
- package/dist/chunks/i18n-BY1ds1BL.js +121 -0
- package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
- package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
- package/dist/chunks/mollie-COG-ko2D.js +23 -0
- package/dist/chunks/moneris-CMH8PlRc.js +117 -0
- package/dist/chunks/opayo-D2jsR5vh.js +113 -0
- package/dist/chunks/paddle-DxF88RfC.js +55 -0
- package/dist/chunks/paypal-b5pnwrA2.js +95 -0
- package/dist/chunks/payway-BJYu9DIR.js +55 -0
- package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
- package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
- package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
- package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
- package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
- package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
- package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
- package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
- package/dist/chunks/repeater-B5leVxZU.js +102 -0
- package/dist/chunks/rich-text-Cv8ADyk-.js +349 -0
- package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
- package/dist/chunks/sdk-BhHAYgga.js +1397 -0
- package/dist/chunks/shared-Bx9s0i0P.js +100 -0
- package/dist/chunks/signature-CpgqHCEx.js +463 -0
- package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
- package/dist/chunks/square-BP8RWAKB.js +40 -0
- package/dist/chunks/stripe-MihN63uC.js +184 -0
- package/dist/chunks/styles-BfoIZwJp.js +19 -0
- package/dist/chunks/summary-D3AjxpYN.js +114 -0
- package/dist/chunks/table-C-lkQN6I.js +78 -0
- package/dist/chunks/text-limit-B09elPDB.js +125 -0
- package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
- package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
- package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
- package/dist/css/formie-theme.css +2 -0
- package/dist/css/theme/fields/_address-state.css +94 -0
- package/dist/css/theme/fields/_combobox.css +246 -0
- package/dist/css/theme/fields/_select.css +13 -0
- package/dist/index.js +2447 -39
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/field-error-container.d.ts +4 -0
- package/dist/js/core/field-error-container.d.ts.map +1 -0
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts +4 -0
- package/dist/js/core/validation-focus.d.ts.map +1 -0
- package/dist/js/modules/address/api.d.ts +1 -0
- package/dist/js/modules/address/api.d.ts.map +1 -1
- package/dist/js/modules/address/constants.d.ts +22 -1
- package/dist/js/modules/address/constants.d.ts.map +1 -1
- package/dist/js/modules/address/host.d.ts +2 -2
- package/dist/js/modules/address/host.d.ts.map +1 -1
- package/dist/js/modules/address/loqate.d.ts.map +1 -1
- package/dist/js/modules/fields/address-country.d.ts +3 -0
- package/dist/js/modules/fields/address-country.d.ts.map +1 -0
- package/dist/js/modules/fields/address-state.d.ts +3 -0
- package/dist/js/modules/fields/address-state.d.ts.map +1 -0
- package/dist/js/modules/fields/calculations.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +17 -0
- package/dist/js/modules/fields/combobox.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-link.d.ts +3 -0
- package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-maps.d.ts +3 -0
- package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/index.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/utils/country-from-ip.d.ts +7 -0
- package/dist/js/utils/country-from-ip.d.ts.map +1 -0
- package/dist/js/utils/field-references.d.ts +1 -0
- package/dist/js/utils/field-references.d.ts.map +1 -1
- package/dist/js/utils/field-references.row-scope.d.ts +11 -0
- package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
- package/dist/js/utils/i18n.d.ts.map +1 -1
- package/dist/js/validation/rules/email.d.ts.map +1 -1
- package/dist/js/validation/rules/number.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/css/formie-theme.css +2 -0
- package/src/css/theme/fields/_address-state.css +94 -0
- package/src/css/theme/fields/_combobox.css +246 -0
- package/src/css/theme/fields/_select.css +13 -0
- package/src/js/core/create-formie-client.ts +27 -0
- package/src/js/core/field-error-container.ts +39 -0
- package/src/js/core/submit-result-state.ts +12 -2
- package/src/js/core/submit-result-ui.ts +7 -13
- package/src/js/core/validation-focus.ts +117 -0
- package/src/js/modules/address/api.ts +7 -0
- package/src/js/modules/address/constants.ts +82 -2
- package/src/js/modules/address/host.ts +16 -6
- package/src/js/modules/address/loqate.ts +3 -17
- package/src/js/modules/fields/address-country.ts +156 -0
- package/src/js/modules/fields/address-state.ts +946 -0
- package/src/js/modules/fields/calculations.ts +32 -0
- package/src/js/modules/fields/checkbox-radio.ts +21 -15
- package/src/js/modules/fields/combobox.ts +188 -0
- package/src/js/modules/fields/custom-google-maps.ts +416 -0
- package/src/js/modules/fields/custom-link.ts +95 -0
- package/src/js/modules/fields/custom-maps.ts +339 -0
- package/src/js/modules/fields/date-picker.ts +96 -3
- package/src/js/modules/fields/file-upload.ts +12 -9
- package/src/js/modules/fields/index.ts +6 -0
- package/src/js/modules/fields/phone-country.ts +6 -0
- package/src/js/modules/fields/text-limit.ts +87 -22
- package/src/js/submit/pipeline.ts +11 -1
- package/src/js/utils/country-from-ip.ts +54 -0
- package/src/js/utils/field-references.row-scope.ts +303 -0
- package/src/js/utils/field-references.ts +1 -0
- package/src/js/utils/i18n.ts +184 -5
- package/src/js/validation/rules/email.ts +3 -2
- package/src/js/validation/rules/match.ts +2 -2
- package/src/js/validation/rules/minmax.ts +4 -4
- package/src/js/validation/rules/number.ts +9 -5
- package/src/js/validation/rules/pattern.ts +4 -4
- package/src/js/validation/rules/required.ts +1 -1
- package/src/js/validation/rules/url.ts +1 -1
- package/src/js/validation/validator.ts +7 -7
- package/dist/chunks/address-finder-BjMuEiwF.js +0 -37
- package/dist/chunks/bpoint-KudsBCo2.js +0 -26
- package/dist/chunks/calculations-DlGSkQ3W.js +0 -147
- package/dist/chunks/captcha-eu-CterYFok.js +0 -34
- package/dist/chunks/checkbox-radio-CBvgk3hR.js +0 -136
- package/dist/chunks/conditions-DYy1-Hwt.js +0 -459
- package/dist/chunks/date-picker-BlD--zfe.js +0 -4994
- package/dist/chunks/eway-qwc-B5Us.js +0 -74
- package/dist/chunks/file-upload-CIgHrXfp.js +0 -316
- package/dist/chunks/friendly-captcha-v1-EDFac33c.js +0 -33
- package/dist/chunks/friendly-captcha-v2-BDpSvFGR.js +0 -38
- package/dist/chunks/go-cardless-DuDMVsnz.js +0 -24
- package/dist/chunks/google-address-Bmjp01pH.js +0 -181
- package/dist/chunks/hcaptcha-BTQ6An6g.js +0 -56
- package/dist/chunks/hidden-DbPdOxKb.js +0 -31
- package/dist/chunks/index-BEsfee-D.js +0 -1839
- package/dist/chunks/index-BP7Unm5Y.js +0 -863
- package/dist/chunks/index-BcqwpPNE.js +0 -4314
- package/dist/chunks/loqate-BdNGv93o.js +0 -55
- package/dist/chunks/mollie-DFOjTuGX.js +0 -24
- package/dist/chunks/moneris-BbFfl-EL.js +0 -101
- package/dist/chunks/opayo-CmgYa9ya.js +0 -122
- package/dist/chunks/paddle-BUi7w1_o.js +0 -60
- package/dist/chunks/paypal-A-ePfh6k.js +0 -100
- package/dist/chunks/payway-BqFCbhyo.js +0 -56
- package/dist/chunks/phone-country-DPMiqk4L.js +0 -3765
- package/dist/chunks/place-kit-CX7tamAg.js +0 -42
- package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
- package/dist/chunks/recaptcha-enterprise-DxF6cW95.js +0 -71
- package/dist/chunks/recaptcha-shared-DhGcbiaq.js +0 -15
- package/dist/chunks/recaptcha-v2-checkbox-R9EfbZ4k.js +0 -41
- package/dist/chunks/recaptcha-v2-invisible-DV9hswAp.js +0 -59
- package/dist/chunks/recaptcha-v3-V0xc-Edh.js +0 -28
- package/dist/chunks/repeater-DKUT6TGI.js +0 -124
- package/dist/chunks/rich-text-SH7KiaKH.js +0 -304
- package/dist/chunks/scripts-D9N2d5rN.js +0 -36
- package/dist/chunks/sdk-3SicTWby.js +0 -1559
- package/dist/chunks/shared-BmntPmnW.js +0 -80
- package/dist/chunks/signature-BA3tQsGT.js +0 -550
- package/dist/chunks/snaptcha-DV7p6J9k.js +0 -8
- package/dist/chunks/square-Bs-ndqYK.js +0 -46
- package/dist/chunks/stripe-DkZAHxtn.js +0 -202
- package/dist/chunks/styles-C3aqgtek.js +0 -21
- package/dist/chunks/summary-Dq2i9TQk.js +0 -126
- package/dist/chunks/table-Cu4WfVcw.js +0 -95
- package/dist/chunks/text-limit-2ycmB-Ae.js +0 -135
- package/dist/chunks/turnstile-CId90tRr.js +0 -59
- package/dist/chunks/utils-BntI3W4S.js +0 -6149
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { t as e } from "./debug-BV0DvdHx.js";
|
|
2
|
+
import { r as t, t as n } from "./field-references.keys-58ZSTrCW.js";
|
|
3
|
+
import { n as r, r as i } from "./field-references.resolver-CHwn0G0L.js";
|
|
4
|
+
import { r as a, t as o } from "./shared-Bx9s0i0P.js";
|
|
5
|
+
import { a as s, o as c, r as l, s as u, t as d } from "./dist-BF5GU3_9.js";
|
|
6
|
+
//#region src/js/utils/field-references.row-scope.ts
|
|
7
|
+
var f = new Set([
|
|
8
|
+
"first",
|
|
9
|
+
"last",
|
|
10
|
+
"index",
|
|
11
|
+
"all",
|
|
12
|
+
"count",
|
|
13
|
+
"rows"
|
|
14
|
+
]);
|
|
15
|
+
function p(e) {
|
|
16
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17
|
+
}
|
|
18
|
+
function m(e, t) {
|
|
19
|
+
let n = String(e || "").trim().toLowerCase();
|
|
20
|
+
if (!n || t <= 0) return [];
|
|
21
|
+
if (n === "even") {
|
|
22
|
+
let e = [];
|
|
23
|
+
for (let n = 1; n <= t; n++) n % 2 == 0 && e.push(n - 1);
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
if (n === "odd") {
|
|
27
|
+
let e = [];
|
|
28
|
+
for (let n = 1; n <= t; n++) n % 2 == 1 && e.push(n - 1);
|
|
29
|
+
return e;
|
|
30
|
+
}
|
|
31
|
+
let r = n.match(/^every:(\d+)$/);
|
|
32
|
+
if (r) {
|
|
33
|
+
let e = Math.max(1, Number.parseInt(r[1] || "1", 10)), n = [];
|
|
34
|
+
for (let r = 1; r <= t; r += e) n.push(r - 1);
|
|
35
|
+
return n;
|
|
36
|
+
}
|
|
37
|
+
let i = [];
|
|
38
|
+
return n.split(/\s*,\s*/).forEach((e) => {
|
|
39
|
+
let n = e.trim();
|
|
40
|
+
if (!n) return;
|
|
41
|
+
let r = n.match(/^(\d+)\s*-\s*(\d+)$/);
|
|
42
|
+
if (r) {
|
|
43
|
+
let e = Number.parseInt(r[1] || "0", 10), n = Number.parseInt(r[2] || "0", 10);
|
|
44
|
+
e > n && ([e, n] = [n, e]);
|
|
45
|
+
for (let r = e; r <= n; r++) r >= 1 && r <= t && i.push(r - 1);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let a = Number.parseInt(n, 10);
|
|
49
|
+
Number.isFinite(a) && a >= 1 && a <= t && i.push(a - 1);
|
|
50
|
+
}), [...new Set(i)].sort((e, t) => e - t);
|
|
51
|
+
}
|
|
52
|
+
function h(e) {
|
|
53
|
+
let n = t(e), r = n.split(".").filter(Boolean);
|
|
54
|
+
return r.length < 2 ? {
|
|
55
|
+
fieldKey: n,
|
|
56
|
+
columnKey: r[r.length - 1] || ""
|
|
57
|
+
} : r.length >= 3 && /^\d+$/.test(r[1] || "") ? {
|
|
58
|
+
fieldKey: r[0] || "",
|
|
59
|
+
columnKey: r.slice(2).join(".")
|
|
60
|
+
} : {
|
|
61
|
+
fieldKey: r[0] || "",
|
|
62
|
+
columnKey: r.slice(1).join(".")
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function g(e, t, n) {
|
|
66
|
+
let r = RegExp(`^${p(e)}\\.(\\d+)\\.${p(t)}$`);
|
|
67
|
+
return [...n.keys()].filter((e) => r.test(e)).sort((e, t) => Number.parseInt(e.split(".")[1] || "0", 10) - Number.parseInt(t.split(".")[1] || "0", 10));
|
|
68
|
+
}
|
|
69
|
+
function _(e, t) {
|
|
70
|
+
return r(e, t).value;
|
|
71
|
+
}
|
|
72
|
+
function v(e, t, r) {
|
|
73
|
+
let i = /* @__PURE__ */ new Set(), { fieldKey: a, columnKey: o } = h(e), s = String(t.scope || "").trim().toLowerCase();
|
|
74
|
+
if (!a || !o || !f.has(s)) {
|
|
75
|
+
let t = n(e);
|
|
76
|
+
return t && (i.add(t), i.add(`${t}[]`)), i;
|
|
77
|
+
}
|
|
78
|
+
return g(a, o, r).forEach((e) => {
|
|
79
|
+
let t = r.get(e);
|
|
80
|
+
if (t?.names?.length) {
|
|
81
|
+
t.names.forEach((e) => {
|
|
82
|
+
i.add(e);
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
let a = n(e);
|
|
87
|
+
a && (i.add(a), i.add(`${a}[]`));
|
|
88
|
+
}), i;
|
|
89
|
+
}
|
|
90
|
+
function y(e, t, n) {
|
|
91
|
+
let i = String(t.scope || "").trim().toLowerCase();
|
|
92
|
+
if (!i || !f.has(i)) return r(e, n);
|
|
93
|
+
let { fieldKey: a, columnKey: o } = h(e);
|
|
94
|
+
if (!a || !o) return r(e, n);
|
|
95
|
+
let s = g(a, o, n), c = s.map((e) => _(e, n));
|
|
96
|
+
if (i === "count") return {
|
|
97
|
+
key: `${a}.${o}`,
|
|
98
|
+
value: String(s.length),
|
|
99
|
+
found: !0
|
|
100
|
+
};
|
|
101
|
+
if (i === "first") return {
|
|
102
|
+
key: s[0] || `${a}.0.${o}`,
|
|
103
|
+
value: c[0] ?? "",
|
|
104
|
+
found: s.length > 0
|
|
105
|
+
};
|
|
106
|
+
if (i === "last") return {
|
|
107
|
+
key: s[s.length - 1] || `${a}.0.${o}`,
|
|
108
|
+
value: c[c.length - 1] ?? "",
|
|
109
|
+
found: s.length > 0
|
|
110
|
+
};
|
|
111
|
+
if (i === "index") return r(`${a}.${Number.parseInt(String(t.index ?? "0"), 10)}.${o}`, n);
|
|
112
|
+
if (i === "all") {
|
|
113
|
+
let e = c.flatMap((e) => Array.isArray(e) ? e : e === "" ? [] : [e]);
|
|
114
|
+
return {
|
|
115
|
+
key: `${a}.${o}`,
|
|
116
|
+
value: e,
|
|
117
|
+
found: e.length > 0
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (i === "rows") {
|
|
121
|
+
let e = m(String(t.rows || ""), s.length);
|
|
122
|
+
if (e.length === 0) return {
|
|
123
|
+
key: `${a}.${o}`,
|
|
124
|
+
value: "",
|
|
125
|
+
found: !1
|
|
126
|
+
};
|
|
127
|
+
if (e.length === 1) return {
|
|
128
|
+
key: s[e[0]] || `${a}.${e[0]}.${o}`,
|
|
129
|
+
value: c[e[0]] ?? "",
|
|
130
|
+
found: !0
|
|
131
|
+
};
|
|
132
|
+
let n = e.flatMap((e) => {
|
|
133
|
+
let t = c[e];
|
|
134
|
+
return Array.isArray(t) ? t : t === "" ? [] : [t];
|
|
135
|
+
});
|
|
136
|
+
return {
|
|
137
|
+
key: `${a}.${o}`,
|
|
138
|
+
value: n,
|
|
139
|
+
found: n.length > 0
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return r(e, n);
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/js/modules/fields/calculations.ts
|
|
146
|
+
var b = "input[data-formie-calculation-input]";
|
|
147
|
+
function x(e) {
|
|
148
|
+
let t = e;
|
|
149
|
+
return {
|
|
150
|
+
scope: t.scope,
|
|
151
|
+
index: t.index,
|
|
152
|
+
rows: t.rows,
|
|
153
|
+
fieldKind: t.fieldKind
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
var S = "calculations", C = e("fields", "calculations");
|
|
157
|
+
function w(e, t, n) {
|
|
158
|
+
let a = i(e), o = {};
|
|
159
|
+
return t.forEach(([e, t]) => {
|
|
160
|
+
let n = x(t);
|
|
161
|
+
if (String(n.scope || "").trim()) {
|
|
162
|
+
o[e] = s(t, y(t.sourceKey || "", n, a).value);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
o[e] = s(t, r(t.sourceKey || "", a).value);
|
|
166
|
+
}), l(o, n.formatting);
|
|
167
|
+
}
|
|
168
|
+
function T(e, r) {
|
|
169
|
+
let a = i(e), o = /* @__PURE__ */ new Set();
|
|
170
|
+
return r.forEach(([, e]) => {
|
|
171
|
+
let r = x(e);
|
|
172
|
+
if (String(r.scope || "").trim()) {
|
|
173
|
+
v(e.sourceKey || "", r, a).forEach((e) => {
|
|
174
|
+
o.add(e);
|
|
175
|
+
});
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
let i = t(e.sourceKey || ""), s = a.get(i);
|
|
179
|
+
if (s?.names?.length) {
|
|
180
|
+
s.names.forEach((e) => {
|
|
181
|
+
o.add(e);
|
|
182
|
+
});
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
let c = n(i);
|
|
186
|
+
c && (o.add(c), o.add(`${c}[]`));
|
|
187
|
+
}), o;
|
|
188
|
+
}
|
|
189
|
+
function E(e, t, n, r) {
|
|
190
|
+
let i = u(r), a = c(r), s = /* @__PURE__ */ new Map(), l = null, f = !1, p = !1, m = !1, h = () => {
|
|
191
|
+
s.forEach((e, t) => {
|
|
192
|
+
e.forEach((e, n) => {
|
|
193
|
+
t.removeEventListener(n, e);
|
|
194
|
+
});
|
|
195
|
+
}), s.clear();
|
|
196
|
+
}, g = (e) => {
|
|
197
|
+
!e || f || queueMicrotask(() => {
|
|
198
|
+
f || (n.dispatchEvent(new Event("input", { bubbles: !0 })), n.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
199
|
+
});
|
|
200
|
+
}, _ = (s = !1) => {
|
|
201
|
+
let c = w(e, a, r);
|
|
202
|
+
C.log("Evaluate requested.", {
|
|
203
|
+
fieldHandle: t.getAttribute("data-formie-field-handle") || null,
|
|
204
|
+
isInit: s
|
|
205
|
+
});
|
|
206
|
+
let l = {
|
|
207
|
+
calculations: n,
|
|
208
|
+
init: s,
|
|
209
|
+
formula: i,
|
|
210
|
+
variables: c
|
|
211
|
+
};
|
|
212
|
+
if (o(t, S, "before-evaluate", l), !l.formula) {
|
|
213
|
+
let e = n.value !== "";
|
|
214
|
+
n.value = "", g(e);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
let e = d(l.formula, l.variables, r), i = {
|
|
219
|
+
calculations: n,
|
|
220
|
+
init: s,
|
|
221
|
+
formula: l.formula,
|
|
222
|
+
variables: l.variables,
|
|
223
|
+
result: e
|
|
224
|
+
};
|
|
225
|
+
o(t, S, "after-evaluate", i);
|
|
226
|
+
let a = typeof i.result == "string" || typeof i.result == "number" ? String(i.result) : "", c = n.value !== a;
|
|
227
|
+
n.value = a, C.log("Evaluate complete.", {
|
|
228
|
+
fieldHandle: t.getAttribute("data-formie-field-handle") || null,
|
|
229
|
+
valueChanged: c,
|
|
230
|
+
nextValue: a
|
|
231
|
+
}), g(c);
|
|
232
|
+
} catch (e) {
|
|
233
|
+
let r = n.value !== "";
|
|
234
|
+
console.error("[formie] Failed to evaluate calculation.", e), C.warn("Evaluate failed.", {
|
|
235
|
+
fieldHandle: t.getAttribute("data-formie-field-handle") || null,
|
|
236
|
+
error: e instanceof Error ? e.message : e
|
|
237
|
+
}), n.value = "", g(r);
|
|
238
|
+
}
|
|
239
|
+
}, v = (e = !1) => {
|
|
240
|
+
p || f || (p = !0, queueMicrotask(() => {
|
|
241
|
+
p = !1, _(e);
|
|
242
|
+
}));
|
|
243
|
+
}, y = () => {
|
|
244
|
+
h();
|
|
245
|
+
let n = T(e, a);
|
|
246
|
+
if (C.log("Binding variable watchers.", {
|
|
247
|
+
fieldHandle: t.getAttribute("data-formie-field-handle") || null,
|
|
248
|
+
watchCount: n.size
|
|
249
|
+
}), !n.size) return;
|
|
250
|
+
let r = (e) => {
|
|
251
|
+
let r = e.target?.name || "";
|
|
252
|
+
!r || !n.has(r) || (C.log("Source change detected.", {
|
|
253
|
+
fieldHandle: t.getAttribute("data-formie-field-handle") || null,
|
|
254
|
+
sourceName: r,
|
|
255
|
+
eventType: e.type
|
|
256
|
+
}), v(!1));
|
|
257
|
+
};
|
|
258
|
+
["input", "change"].forEach((t) => {
|
|
259
|
+
e.addEventListener(t, r);
|
|
260
|
+
let n = s.get(e) || /* @__PURE__ */ new Map();
|
|
261
|
+
n.set(t, r), s.set(e, n);
|
|
262
|
+
});
|
|
263
|
+
}, b = () => {
|
|
264
|
+
m || f || (m = !0, queueMicrotask(() => {
|
|
265
|
+
m = !1, y(), v(!1);
|
|
266
|
+
}));
|
|
267
|
+
};
|
|
268
|
+
return y(), l = new MutationObserver(() => {
|
|
269
|
+
b();
|
|
270
|
+
}), l.observe(e, {
|
|
271
|
+
childList: !0,
|
|
272
|
+
subtree: !0
|
|
273
|
+
}), _(!0), () => {
|
|
274
|
+
f = !0, l?.disconnect(), h();
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
var D = {
|
|
278
|
+
id: S,
|
|
279
|
+
kind: "field",
|
|
280
|
+
match: (e) => !!e.target.querySelector(b),
|
|
281
|
+
setup: async (e) => {
|
|
282
|
+
let t = e.options || {}, n = a(e);
|
|
283
|
+
C.log("Module setup.", {
|
|
284
|
+
fieldCount: n.length,
|
|
285
|
+
formatting: t.formatting || null
|
|
286
|
+
});
|
|
287
|
+
let r = n.map((n) => {
|
|
288
|
+
let r = n.querySelector(b);
|
|
289
|
+
return r instanceof HTMLInputElement ? E(e.root, n, r, t) : () => {};
|
|
290
|
+
});
|
|
291
|
+
return await e.emit("formie:module:calculations:init", { count: r.length }), { destroy: () => {
|
|
292
|
+
C.log("Module destroy.", { fieldCount: r.length }), r.forEach((e) => {
|
|
293
|
+
e();
|
|
294
|
+
}), e.emit("formie:module:calculations:destroy", {});
|
|
295
|
+
} };
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
//#endregion
|
|
299
|
+
export { D as calculationsModule };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { a as e, t } from "./api-DMK8NSUI.js";
|
|
2
|
+
import { r as n } from "./scripts-6CYSUGKQ.js";
|
|
3
|
+
//#region src/js/modules/captchas/captcha-eu.ts
|
|
4
|
+
async function r(t) {
|
|
5
|
+
return n("KROT", {
|
|
6
|
+
id: "FORMIE_CAPTCHA_EU_SCRIPT",
|
|
7
|
+
src: `${String(t.endPoint || "https://www.captcha.eu").trim().replace(/\/+$/, "")}/sdk.js`,
|
|
8
|
+
async: !0,
|
|
9
|
+
defer: !0,
|
|
10
|
+
timeoutMs: e
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
var i = t({
|
|
14
|
+
id: "captcha-eu",
|
|
15
|
+
defaultPlaceholderSelector: "[data-captcha-eu-placeholder]",
|
|
16
|
+
defaultTokenFieldNames: ["captcha-eu-token"],
|
|
17
|
+
load: ({ options: e }) => r(e.provider),
|
|
18
|
+
mount: ({ api: e, container: t, provider: n, services: r }) => (e.init(), e.setup(String(n.publicKey || "")), e.WidgetV2.render(t), e.on("CPT_OK", (e) => {
|
|
19
|
+
r.tokens.write(JSON.stringify(e.detail || {}), { container: t }), r.errors.clear();
|
|
20
|
+
}, t), e.on("CPT_EXPIRED", () => {
|
|
21
|
+
r.tokens.clear(), r.errors.clear();
|
|
22
|
+
}, t), t),
|
|
23
|
+
screen: async ({ placeholder: e, services: t, stageCtx: n }) => {
|
|
24
|
+
if (!await t.tokens.wait()) {
|
|
25
|
+
let r = t.errors.getDefaultMessage();
|
|
26
|
+
t.errors.show(r, e), n.abort(r);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { i as captchaEuModule };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { t as e } from "./debug-BV0DvdHx.js";
|
|
2
|
+
import { c as t, l as n, n as r, t as i } from "./shared-Bx9s0i0P.js";
|
|
3
|
+
//#region src/js/modules/fields/checkbox-radio.ts
|
|
4
|
+
var a = "[data-formie-checkboxes-field-layout], [data-formie-radio-field-layout]", o = "minmaxOptions", s = "data-formie-checkbox-radio-max-disabled", c = "checkbox-radio", l = "checkbox-radio", u = e("fields", "checkbox-radio");
|
|
5
|
+
function d(e) {
|
|
6
|
+
return e.hasAttribute("data-checkbox-toggle") || e.hasAttribute("data-formie-checkbox-toggle");
|
|
7
|
+
}
|
|
8
|
+
function f(e) {
|
|
9
|
+
let t = e(o);
|
|
10
|
+
if (!t || t === !0 || typeof t != "object") return {
|
|
11
|
+
min: null,
|
|
12
|
+
max: null
|
|
13
|
+
};
|
|
14
|
+
let n = t;
|
|
15
|
+
return {
|
|
16
|
+
min: typeof n.min == "number" ? n.min : null,
|
|
17
|
+
max: typeof n.max == "number" ? n.max : null
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function p(e) {
|
|
21
|
+
return Array.from(e.querySelectorAll("input[type=\"checkbox\"]")).filter((e) => e instanceof HTMLInputElement && !d(e)).filter((e) => e.checked).length;
|
|
22
|
+
}
|
|
23
|
+
function m(e) {
|
|
24
|
+
n(e, l, (e) => {
|
|
25
|
+
e.addValidator(o, ({ field: e, getRule: t }) => {
|
|
26
|
+
if (!e || !t(o)) return !0;
|
|
27
|
+
let n = p(e), { min: r, max: i } = f(t);
|
|
28
|
+
return !(r !== null && n < r || i !== null && n > i);
|
|
29
|
+
}, ({ field: e, label: t, t: n, getRule: r }) => {
|
|
30
|
+
if (!e) return n("{label} has an invalid value.", { label: t });
|
|
31
|
+
let i = p(e), { min: a, max: o } = f(r);
|
|
32
|
+
return a !== null && i < a ? e.getAttribute("data-formie-validation-min-options-message") ?? n("{label} should contain at least {min, number} {min, plural, one{option} other{options}}.", {
|
|
33
|
+
label: t,
|
|
34
|
+
min: a
|
|
35
|
+
}) : o !== null && i > o ? e.getAttribute("data-formie-validation-max-options-message") ?? n("{label} should contain at most {max, number} {max, plural, one{option} other{options}}.", {
|
|
36
|
+
label: t,
|
|
37
|
+
max: o
|
|
38
|
+
}) : n("{label} has an invalid value.", { label: t });
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function h(e) {
|
|
43
|
+
t(e, l, [o]);
|
|
44
|
+
}
|
|
45
|
+
function g(e) {
|
|
46
|
+
e.checked ? e.setAttribute("checked", "") : e.removeAttribute("checked");
|
|
47
|
+
}
|
|
48
|
+
function _(e) {
|
|
49
|
+
let t = Array.from(e.querySelectorAll("input[type=\"checkbox\"][required][data-formie-checkbox-input]")).filter((e) => e instanceof HTMLInputElement);
|
|
50
|
+
if (!t.length) return;
|
|
51
|
+
let n = t.some((e) => e.checked);
|
|
52
|
+
t.forEach((e) => {
|
|
53
|
+
if (n) {
|
|
54
|
+
e.removeAttribute("required"), e.setAttribute("aria-required", "false");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
e.setAttribute("required", "true"), e.setAttribute("aria-required", "true");
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function v(e) {
|
|
61
|
+
let t = parseInt(e.closest("[data-formie-field-handle]")?.getAttribute("data-formie-max-options") || "", 10);
|
|
62
|
+
if (!(t > 0)) return;
|
|
63
|
+
let n = Array.from(e.querySelectorAll("input[type=\"checkbox\"]")).filter((e) => e instanceof HTMLInputElement && !d(e)), r = n.filter((e) => e.checked).length >= t;
|
|
64
|
+
n.forEach((e) => {
|
|
65
|
+
let t = r && !e.checked, n = e.hasAttribute(s);
|
|
66
|
+
if (t) {
|
|
67
|
+
e.disabled || (e.disabled = !0, e.setAttribute(s, "true"));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
n && (e.disabled = !1, e.removeAttribute(s));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function y(e, t) {
|
|
74
|
+
Array.from(e.querySelectorAll("input[type=\"checkbox\"]")).filter((e) => e instanceof HTMLInputElement && e !== t && !d(e)).forEach((e) => {
|
|
75
|
+
e.disabled && !e.checked || (e.checked = t.checked, g(e), e.dispatchEvent(new Event("change", { bubbles: !0 })), e.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function b(e, t) {
|
|
79
|
+
if (!e.checked || !e.name) {
|
|
80
|
+
g(e);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
Array.from(t.querySelectorAll(`input[type="radio"][name="${r(e.name)}"]`)).filter((e) => e instanceof HTMLInputElement).forEach((e) => {
|
|
84
|
+
g(e);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function x(e) {
|
|
88
|
+
let t = Array.from(e.querySelectorAll("input[type=\"checkbox\"], input[type=\"radio\"]")).filter((e) => e instanceof HTMLInputElement);
|
|
89
|
+
if (!t.length) return u.log("No checkbox/radio inputs found for field."), () => {};
|
|
90
|
+
let n = t.map((t) => {
|
|
91
|
+
let n = t.type === "radio" ? "change" : "click", r = () => {
|
|
92
|
+
g(t), t.type === "checkbox" && d(t) && y(e, t), t.type === "radio" && b(t, e), _(e), v(e), u.log("Input interaction processed.", {
|
|
93
|
+
inputName: t.name,
|
|
94
|
+
inputType: t.type,
|
|
95
|
+
checked: t.checked
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
return t.addEventListener(n, r), g(t), () => {
|
|
99
|
+
t.removeEventListener(n, r);
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
return _(e), v(e), i(e, c, "init", { checkboxRadio: e }), () => {
|
|
103
|
+
n.forEach((e) => {
|
|
104
|
+
e();
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
var S = {
|
|
109
|
+
id: c,
|
|
110
|
+
kind: "field",
|
|
111
|
+
match: (e) => e.target instanceof HTMLElement && (e.target.matches(a) || !!e.target.querySelector(a)),
|
|
112
|
+
setup: async (e) => {
|
|
113
|
+
if (!(e.target instanceof HTMLElement)) return;
|
|
114
|
+
let t = e.target.matches(a) ? [e.target] : Array.from(e.target.querySelectorAll(a)).filter((e) => e instanceof HTMLElement);
|
|
115
|
+
m(e.form), u.log("Module setup.", { fieldCount: t.length });
|
|
116
|
+
let n = t.map((e) => x(e));
|
|
117
|
+
return await e.emit("formie:module:checkbox-radio:init", { count: t.length }), { destroy: () => {
|
|
118
|
+
n.forEach((e) => {
|
|
119
|
+
e();
|
|
120
|
+
}), h(e.form), u.log("Module destroy.", { fieldCount: t.length }), e.emit("formie:module:checkbox-radio:destroy", {});
|
|
121
|
+
} };
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { S as checkboxRadioModule };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
|
|
3
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
4
|
+
get: ((e) => i[e]).bind(null, d),
|
|
5
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
6
|
+
});
|
|
7
|
+
return e;
|
|
8
|
+
}, c = (n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, "default", {
|
|
9
|
+
value: n,
|
|
10
|
+
enumerable: !0
|
|
11
|
+
}) : a, n));
|
|
12
|
+
//#endregion
|
|
13
|
+
export { c as n, o as t };
|