@verbb/formie-browser 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunks/address-finder-CQW81kY0.js +37 -0
  3. package/dist/chunks/bpoint-D8OjLmsn.js +26 -0
  4. package/dist/chunks/calculations-BqZsENCq.js +147 -0
  5. package/dist/chunks/captcha-eu-DIa6aUWz.js +34 -0
  6. package/dist/chunks/checkbox-radio-BI-UjgMF.js +136 -0
  7. package/dist/chunks/conditions-BVl6jTYo.js +433 -0
  8. package/dist/chunks/date-picker-69TgvErA.js +4994 -0
  9. package/dist/chunks/eway-1GPxH6DU.js +74 -0
  10. package/dist/chunks/file-upload-BDZZftgL.js +281 -0
  11. package/dist/chunks/friendly-captcha-v1-DA2QPKA3.js +33 -0
  12. package/dist/chunks/friendly-captcha-v2-BorOWiz_.js +38 -0
  13. package/dist/chunks/go-cardless-DwBgERcA.js +24 -0
  14. package/dist/chunks/google-address-BcTBncyS.js +162 -0
  15. package/dist/chunks/hcaptcha-BchdVCqq.js +56 -0
  16. package/dist/chunks/hidden-D8RqSPt7.js +31 -0
  17. package/dist/chunks/index-BEsfee-D.js +1839 -0
  18. package/dist/chunks/index-BP7Unm5Y.js +863 -0
  19. package/dist/chunks/index-C1ZOKiAi.js +4229 -0
  20. package/dist/chunks/loqate-nXuTX7In.js +55 -0
  21. package/dist/chunks/mollie-qdCynQCd.js +24 -0
  22. package/dist/chunks/moneris-BNEA-laO.js +101 -0
  23. package/dist/chunks/opayo-BJtXOkuK.js +122 -0
  24. package/dist/chunks/paddle-D72Pa8kr.js +60 -0
  25. package/dist/chunks/paypal-Cqt2bned.js +100 -0
  26. package/dist/chunks/payway-BjCqsc0H.js +56 -0
  27. package/dist/chunks/phone-country-K9pYAlzM.js +3765 -0
  28. package/dist/chunks/place-kit-Dg6f_UoM.js +42 -0
  29. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +1299 -0
  30. package/dist/chunks/recaptcha-enterprise--VYAeeqz.js +71 -0
  31. package/dist/chunks/recaptcha-shared-PSIEEEe1.js +15 -0
  32. package/dist/chunks/recaptcha-v2-checkbox-atBNe5ml.js +41 -0
  33. package/dist/chunks/recaptcha-v2-invisible-DnBufNPT.js +59 -0
  34. package/dist/chunks/recaptcha-v3-CF6O8rDj.js +28 -0
  35. package/dist/chunks/repeater-CB7Yojvx.js +124 -0
  36. package/dist/chunks/rich-text-nAV_SQZo.js +304 -0
  37. package/dist/chunks/scripts-BkAAux0i.js +36 -0
  38. package/dist/chunks/sdk-3SicTWby.js +1559 -0
  39. package/dist/chunks/shared-DGqeMvcJ.js +80 -0
  40. package/dist/chunks/signature-BT6CsQ6n.js +550 -0
  41. package/dist/chunks/snaptcha-C7qQo02f.js +8 -0
  42. package/dist/chunks/square-C5AH3trb.js +46 -0
  43. package/dist/chunks/stripe-EJK0RyUv.js +202 -0
  44. package/dist/chunks/styles-C3aqgtek.js +21 -0
  45. package/dist/chunks/summary-DC_ipXCU.js +126 -0
  46. package/dist/chunks/table-BEAI99qo.js +95 -0
  47. package/dist/chunks/text-limit-Blgq5G-G.js +135 -0
  48. package/dist/chunks/turnstile-_uCRwnU-.js +59 -0
  49. package/dist/chunks/utils-BntI3W4S.js +6149 -0
  50. package/dist/index.js +39 -3205
  51. package/package.json +5 -5
  52. package/src/js/modules/fields/file-upload.ts +1 -1
  53. package/src/js/modules/fields/repeater.ts +1 -1
  54. package/src/js/modules/fields/rich-text.ts +2 -2
  55. package/src/js/modules/fields/signature.ts +1 -1
  56. package/src/js/modules/fields/summary.ts +1 -1
  57. package/src/js/modules/fields/table.ts +1 -1
  58. package/src/js/modules/fields/text-limit.ts +1 -1
  59. package/src/js/modules/payments/paypal.ts +1 -1
  60. package/src/js/modules/payments/payway.ts +1 -1
  61. package/src/js/modules/payments/stripe.ts +1 -1
  62. package/dist/chunks/address-finder-DfMCiW89.js +0 -47
  63. package/dist/chunks/api-CbqEMQT5.js +0 -181
  64. package/dist/chunks/api-DE7LfK-R.js +0 -960
  65. package/dist/chunks/api-DOfDzYC_.js +0 -538
  66. package/dist/chunks/async-B3DUf1GZ.js +0 -26
  67. package/dist/chunks/bpoint-Ciy3yY9Q.js +0 -34
  68. package/dist/chunks/calculations-CkYAqO_-.js +0 -197
  69. package/dist/chunks/captcha-eu-DnOWhMwr.js +0 -43
  70. package/dist/chunks/checkbox-radio-0x7Tc0br.js +0 -197
  71. package/dist/chunks/chunk-K6L4z4UQ.js +0 -24
  72. package/dist/chunks/conditions-4fXKhEJS.js +0 -609
  73. package/dist/chunks/date-picker-B6iZkjHS.js +0 -6204
  74. package/dist/chunks/debug-KnZeKYBI.js +0 -39
  75. package/dist/chunks/dist-D09GnXMW.js +0 -2663
  76. package/dist/chunks/event-names-DamGPtXR.js +0 -51
  77. package/dist/chunks/eway-DEAYcwT0.js +0 -86
  78. package/dist/chunks/field-references.keys-BpBZ_quS.js +0 -24
  79. package/dist/chunks/field-references.resolver-Ba6xhiJC.js +0 -183
  80. package/dist/chunks/file-upload-Bh63PQSE.js +0 -430
  81. package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +0 -40
  82. package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +0 -47
  83. package/dist/chunks/friendly-challenge-Dg8XkStd.js +0 -1101
  84. package/dist/chunks/go-cardless-CuND59rR.js +0 -26
  85. package/dist/chunks/google-address--uR8WDSm.js +0 -208
  86. package/dist/chunks/hcaptcha-CmaFUesv.js +0 -72
  87. package/dist/chunks/hidden-CYnZYple.js +0 -36
  88. package/dist/chunks/http-18nn97DZ.js +0 -29
  89. package/dist/chunks/i18n-vUh-KGiH.js +0 -55
  90. package/dist/chunks/loqate-BICNJlVK.js +0 -97
  91. package/dist/chunks/mollie-DwlsgHZ1.js +0 -26
  92. package/dist/chunks/moneris-B_IFZFTx.js +0 -159
  93. package/dist/chunks/opayo-U2x_TOII.js +0 -192
  94. package/dist/chunks/paddle-BqXFrc79.js +0 -75
  95. package/dist/chunks/paypal-Cn_DYGDb.js +0 -121
  96. package/dist/chunks/payway-Rnq796eC.js +0 -75
  97. package/dist/chunks/phone-country-B6Me4lK0.js +0 -3317
  98. package/dist/chunks/place-kit-ldUl-u9w.js +0 -56
  99. package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +0 -1771
  100. package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +0 -72
  101. package/dist/chunks/recaptcha-shared-DTI4qWVR.js +0 -22
  102. package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +0 -49
  103. package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +0 -62
  104. package/dist/chunks/recaptcha-v3-EAlWhnkX.js +0 -33
  105. package/dist/chunks/repeater-CXD1eLSn.js +0 -151
  106. package/dist/chunks/rich-text-DkmZRhGj.js +0 -442
  107. package/dist/chunks/scripts-BGD_iU_6.js +0 -41
  108. package/dist/chunks/sdk-B7u9fTlP.js +0 -2103
  109. package/dist/chunks/shared-DC6_1u8X.js +0 -85
  110. package/dist/chunks/signature-E9KyYXS1.js +0 -765
  111. package/dist/chunks/snaptcha-CCDunGeb.js +0 -8
  112. package/dist/chunks/square-BLqK51rS.js +0 -61
  113. package/dist/chunks/stripe-B8gHpZNC.js +0 -273
  114. package/dist/chunks/styles-BIh6g7V_.js +0 -22
  115. package/dist/chunks/summary-EcNE0cvg.js +0 -191
  116. package/dist/chunks/table-yxEDL6kA.js +0 -124
  117. package/dist/chunks/text-limit-D0H_Ca2c.js +0 -179
  118. package/dist/chunks/theme-classes-vSHpdCUO.js +0 -59
  119. package/dist/chunks/turnstile-DP0bdR7T.js +0 -68
  120. package/dist/chunks/utils-ByrEVYrJ.js +0 -49584
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - version bump
8
+ - Updated dependencies
9
+ - @verbb/formie-core@1.0.2
10
+
11
+ ## 1.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - d25d240: Update package homepage docs URLs
16
+ - Updated dependencies [d25d240]
17
+ - @verbb/formie-core@1.0.1
18
+
3
19
  ## 1.0.0
4
20
 
5
21
  - Initial public release.
@@ -0,0 +1,37 @@
1
+ import { d as p, g as a } from "./index-C1ZOKiAi.js";
2
+ import { l as _ } from "./scripts-BkAAux0i.js";
3
+ const f = "FORMIE_ADDRESS_FINDER_SCRIPT", g = p({
4
+ id: "address-finder",
5
+ load: async () => _("AddressFinder", {
6
+ id: f,
7
+ src: "https://api.addressfinder.io/assets/v3/widget.js",
8
+ async: !0,
9
+ defer: !0
10
+ }),
11
+ mount: ({ api: t, field: u, services: e, provider: s }) => {
12
+ const n = e.input.getAutocomplete();
13
+ if (!n || typeof t > "u" || !t.Widget)
14
+ throw new Error("AddressFinder API not ready");
15
+ const i = s.apiKey || "", r = s.countryCode || "au", o = new t.Widget(
16
+ n,
17
+ i,
18
+ r,
19
+ s.widgetOptions
20
+ );
21
+ return o.on("result:select", (l, d) => {
22
+ d.address_line_2 ? (e.input.setValue("address1", d.address_line_2), e.input.setValue("address2", d.address_line_1)) : (e.input.setValue("address1", d.address_line_1 || ""), e.input.setValue("address2", "")), e.input.setValue("city", d.locality_name || ""), e.input.setValue("zip", d.postcode || ""), e.input.setValue("state", d.state_territory || ""), e.input.setValue("country", r), u.dispatchEvent(
23
+ new CustomEvent(a("address-finder", "populate"), {
24
+ bubbles: !0,
25
+ detail: {
26
+ addressProvider: "address-finder",
27
+ fullAddress: l,
28
+ metaData: d
29
+ }
30
+ })
31
+ );
32
+ }), o;
33
+ }
34
+ });
35
+ export {
36
+ g as addressFinderModule
37
+ };
@@ -0,0 +1,26 @@
1
+ import { u as c } from "./index-C1ZOKiAi.js";
2
+ const p = c({
3
+ id: "bpoint",
4
+ defaultRequiredInputSuffixes: ["bpointToken"],
5
+ load: async () => null,
6
+ onBeforeAuthorize: async ({ field: e, services: t }) => {
7
+ if ((e.querySelector('input[name$="[bpointToken]"]')?.value || "").trim() !== "")
8
+ return !0;
9
+ const o = e.querySelector('[data-bpoint-card="cardholder-name"]')?.value?.trim() || "", r = e.querySelector('[data-bpoint-card="card-number"]')?.value?.replace(/\s+/g, "") || "", u = e.querySelector('[data-bpoint-card="expiry-date"]')?.value || "", a = e.querySelector('[data-bpoint-card="security-code"]')?.value?.trim() || "", n = (u.match(/\d/g) || []).join("").slice(0, 4);
10
+ if (!r || n.length !== 4 || !a)
11
+ return t.addError("Please provide valid card details to continue."), !1;
12
+ const i = {
13
+ cardholderName: o,
14
+ cardNumber: r,
15
+ expiryDate: n,
16
+ cvn: a
17
+ };
18
+ return t.updateInputs("bpointToken", JSON.stringify(i)), !0;
19
+ },
20
+ onAfterSubmit: async ({ services: e }) => {
21
+ e.updateInputs("bpointToken", "");
22
+ }
23
+ });
24
+ export {
25
+ p as bpointModule
26
+ };
@@ -0,0 +1,147 @@
1
+ import { j as H, _ as A, $ as D, U as N, F as T } from "./index-BEsfee-D.js";
2
+ import { g as K, d as L } from "./shared-DGqeMvcJ.js";
3
+ import { h as R, i as k, n as U, j as V, r as _ } from "./index-C1ZOKiAi.js";
4
+ const S = "input[data-formie-calculation-input]", y = "calculations", g = R("fields", "calculations");
5
+ function j(e, r, t) {
6
+ const a = k(e), o = {};
7
+ return r.forEach(([u, i]) => {
8
+ const d = _(i.sourceKey || "", a);
9
+ o[u] = N(i, d.value);
10
+ }), T(o, t.formatting);
11
+ }
12
+ function z(e, r) {
13
+ const t = k(e), a = /* @__PURE__ */ new Set();
14
+ return r.forEach(([, o]) => {
15
+ const u = U(o.sourceKey || ""), i = t.get(u);
16
+ if (i?.names?.length) {
17
+ i.names.forEach((f) => {
18
+ a.add(f);
19
+ });
20
+ return;
21
+ }
22
+ const d = V(u);
23
+ d && (a.add(d), a.add(`${d}[]`));
24
+ }), a;
25
+ }
26
+ function B(e, r, t, a) {
27
+ const o = H(a), u = A(a), i = /* @__PURE__ */ new Map();
28
+ let d = null, f = !1, v = !1, h = !1;
29
+ const p = () => {
30
+ i.forEach((s, m) => {
31
+ s.forEach((n, l) => {
32
+ m.removeEventListener(l, n);
33
+ });
34
+ }), i.clear();
35
+ }, b = (s) => {
36
+ !s || f || queueMicrotask(() => {
37
+ f || (t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 })));
38
+ });
39
+ }, w = (s = !1) => {
40
+ const m = j(e, u, a);
41
+ g.log("Evaluate requested.", {
42
+ fieldHandle: r.getAttribute("data-formie-field-handle") || null,
43
+ isInit: s
44
+ });
45
+ const n = {
46
+ calculations: t,
47
+ init: s,
48
+ formula: o,
49
+ variables: m
50
+ };
51
+ if (L(r, y, "before-evaluate", n), !n.formula) {
52
+ const l = t.value !== "";
53
+ t.value = "", b(l);
54
+ return;
55
+ }
56
+ try {
57
+ const l = D(n.formula, n.variables, a), c = {
58
+ calculations: t,
59
+ init: s,
60
+ formula: n.formula,
61
+ variables: n.variables,
62
+ result: l
63
+ };
64
+ L(r, y, "after-evaluate", c);
65
+ const E = typeof c.result == "string" || typeof c.result == "number" ? String(c.result) : "", F = t.value !== E;
66
+ t.value = E, g.log("Evaluate complete.", {
67
+ fieldHandle: r.getAttribute("data-formie-field-handle") || null,
68
+ valueChanged: F,
69
+ nextValue: E
70
+ }), b(F);
71
+ } catch (l) {
72
+ const c = t.value !== "";
73
+ console.error("[formie] Failed to evaluate calculation.", l), g.warn("Evaluate failed.", {
74
+ fieldHandle: r.getAttribute("data-formie-field-handle") || null,
75
+ error: l instanceof Error ? l.message : l
76
+ }), t.value = "", b(c);
77
+ }
78
+ }, M = (s = !1) => {
79
+ v || f || (v = !0, queueMicrotask(() => {
80
+ v = !1, w(s);
81
+ }));
82
+ }, C = () => {
83
+ p();
84
+ const s = z(e, u);
85
+ if (g.log("Binding variable watchers.", {
86
+ fieldHandle: r.getAttribute("data-formie-field-handle") || null,
87
+ watchCount: s.size
88
+ }), !s.size)
89
+ return;
90
+ const m = (n) => {
91
+ const c = n.target?.name || "";
92
+ !c || !s.has(c) || (g.log("Source change detected.", {
93
+ fieldHandle: r.getAttribute("data-formie-field-handle") || null,
94
+ sourceName: c,
95
+ eventType: n.type
96
+ }), M(!1));
97
+ };
98
+ ["input", "change"].forEach((n) => {
99
+ e.addEventListener(n, m);
100
+ const l = i.get(e) || /* @__PURE__ */ new Map();
101
+ l.set(n, m), i.set(e, l);
102
+ });
103
+ }, q = () => {
104
+ h || f || (h = !0, queueMicrotask(() => {
105
+ h = !1, C(), M(!1);
106
+ }));
107
+ };
108
+ return C(), d = new MutationObserver(() => {
109
+ q();
110
+ }), d.observe(e, {
111
+ childList: !0,
112
+ subtree: !0
113
+ }), w(!0), () => {
114
+ f = !0, d?.disconnect(), p();
115
+ };
116
+ }
117
+ const Q = {
118
+ id: y,
119
+ kind: "field",
120
+ match: (e) => !!e.target.querySelector(S),
121
+ setup: async (e) => {
122
+ const r = e.options || {}, t = K(e);
123
+ g.log("Module setup.", {
124
+ fieldCount: t.length,
125
+ formatting: r.formatting || null
126
+ });
127
+ const a = t.map((o) => {
128
+ const u = o.querySelector(S);
129
+ return u instanceof HTMLInputElement ? B(e.root, o, u, r) : () => {
130
+ };
131
+ });
132
+ return await e.emit("formie:module:calculations:init", {
133
+ count: a.length
134
+ }), {
135
+ destroy: () => {
136
+ g.log("Module destroy.", {
137
+ fieldCount: a.length
138
+ }), a.forEach((o) => {
139
+ o();
140
+ }), e.emit("formie:module:calculations:destroy", {});
141
+ }
142
+ };
143
+ }
144
+ };
145
+ export {
146
+ Q as calculationsModule
147
+ };
@@ -0,0 +1,34 @@
1
+ import { a as l, C as n } from "./index-C1ZOKiAi.js";
2
+ import { l as s } from "./scripts-BkAAux0i.js";
3
+ async function c(e) {
4
+ const t = String(e.endPoint || "https://www.captcha.eu").trim().replace(/\/+$/, "");
5
+ return s("KROT", {
6
+ id: "FORMIE_CAPTCHA_EU_SCRIPT",
7
+ src: `${t}/sdk.js`,
8
+ async: !0,
9
+ defer: !0,
10
+ timeoutMs: n
11
+ });
12
+ }
13
+ const h = l({
14
+ id: "captcha-eu",
15
+ defaultPlaceholderSelector: "[data-captcha-eu-placeholder]",
16
+ defaultTokenFieldNames: ["captcha-eu-token"],
17
+ load: ({ options: e }) => c(e.provider),
18
+ mount: ({ api: e, container: t, provider: o, services: a }) => (e.init(), e.setup(String(o.publicKey || "")), e.WidgetV2.render(t), e.on("CPT_OK", (r) => {
19
+ a.tokens.write(JSON.stringify(r.detail || {}), {
20
+ container: t
21
+ }), a.errors.clear();
22
+ }, t), e.on("CPT_EXPIRED", () => {
23
+ a.tokens.clear(), a.errors.clear();
24
+ }, t), t),
25
+ screen: async ({ placeholder: e, services: t, stageCtx: o }) => {
26
+ if (!await t.tokens.wait()) {
27
+ const r = t.errors.getDefaultMessage();
28
+ t.errors.show(r, e), o.abort(r);
29
+ }
30
+ }
31
+ });
32
+ export {
33
+ h as captchaEuModule
34
+ };
@@ -0,0 +1,136 @@
1
+ import { r as A, d as E, a as p, e as M } from "./shared-DGqeMvcJ.js";
2
+ import { h as L } from "./index-C1ZOKiAi.js";
3
+ const l = "[data-formie-checkboxes-field-layout], [data-formie-radio-field-layout]", d = "minmaxOptions", h = "data-formie-checkbox-radio-max-disabled", g = "checkbox-radio", x = "checkbox-radio", f = L("fields", "checkbox-radio");
4
+ function m(t) {
5
+ return t.hasAttribute("data-checkbox-toggle") || t.hasAttribute("data-formie-checkbox-toggle");
6
+ }
7
+ function b(t) {
8
+ const r = t(d);
9
+ if (!r || r === !0 || typeof r != "object")
10
+ return {
11
+ min: null,
12
+ max: null
13
+ };
14
+ const o = r;
15
+ return {
16
+ min: typeof o.min == "number" ? o.min : null,
17
+ max: typeof o.max == "number" ? o.max : null
18
+ };
19
+ }
20
+ function T(t) {
21
+ A(t, x, (r) => {
22
+ r.addValidator(
23
+ d,
24
+ ({ field: o, getRule: e }) => {
25
+ if (!o || !e(d))
26
+ return !0;
27
+ const n = Array.from(o.querySelectorAll('input[type="checkbox"]')).filter((u) => u instanceof HTMLInputElement && !m(u)).filter((u) => u.checked).length, { min: a, max: i } = b(e);
28
+ return !(a !== null && n < a || i !== null && n > i);
29
+ },
30
+ ({ field: o, label: e, t: c, getRule: n }) => {
31
+ const { min: a, max: i } = o ? b(n) : { min: null, max: null };
32
+ return a !== null && i !== null ? c("{attribute} must select between {min} and {max}.", { attribute: e, min: a, max: i }) : a !== null ? c("{attribute} must select no less than {min}.", { attribute: e, min: a }) : i !== null ? c("{attribute} must select no greater than {max}.", { attribute: e, max: i }) : c("{attribute} has an invalid value.", { attribute: e });
33
+ }
34
+ );
35
+ });
36
+ }
37
+ function q(t) {
38
+ p(t, x, [d]);
39
+ }
40
+ function s(t) {
41
+ t.checked ? t.setAttribute("checked", "") : t.removeAttribute("checked");
42
+ }
43
+ function k(t) {
44
+ const r = Array.from(t.querySelectorAll('input[type="checkbox"][required][data-formie-checkbox-input]')).filter((e) => e instanceof HTMLInputElement);
45
+ if (!r.length)
46
+ return;
47
+ const o = r.some((e) => e.checked);
48
+ r.forEach((e) => {
49
+ if (o) {
50
+ e.removeAttribute("required"), e.setAttribute("aria-required", "false");
51
+ return;
52
+ }
53
+ e.setAttribute("required", "true"), e.setAttribute("aria-required", "true");
54
+ });
55
+ }
56
+ function y(t) {
57
+ const r = parseInt(t.closest("[data-formie-field-handle]")?.getAttribute("data-formie-max-options") || "", 10);
58
+ if (!(r > 0))
59
+ return;
60
+ const o = Array.from(t.querySelectorAll('input[type="checkbox"]')).filter((n) => n instanceof HTMLInputElement && !m(n)), c = o.filter((n) => n.checked).length >= r;
61
+ o.forEach((n) => {
62
+ const a = c && !n.checked, i = n.hasAttribute(h);
63
+ if (a) {
64
+ n.disabled || (n.disabled = !0, n.setAttribute(h, "true"));
65
+ return;
66
+ }
67
+ i && (n.disabled = !1, n.removeAttribute(h));
68
+ });
69
+ }
70
+ function v(t, r) {
71
+ Array.from(t.querySelectorAll('input[type="checkbox"]')).filter((e) => e instanceof HTMLInputElement && e !== r && !m(e)).forEach((e) => {
72
+ e.disabled && !e.checked || (e.checked = r.checked, s(e), e.dispatchEvent(new Event("change", { bubbles: !0 })), e.dispatchEvent(new Event("input", { bubbles: !0 })));
73
+ });
74
+ }
75
+ function I(t, r) {
76
+ if (!t.checked || !t.name) {
77
+ s(t);
78
+ return;
79
+ }
80
+ Array.from(r.querySelectorAll(`input[type="radio"][name="${M(t.name)}"]`)).filter((e) => e instanceof HTMLInputElement).forEach((e) => {
81
+ s(e);
82
+ });
83
+ }
84
+ function C(t) {
85
+ const r = Array.from(t.querySelectorAll('input[type="checkbox"], input[type="radio"]')).filter((e) => e instanceof HTMLInputElement);
86
+ if (!r.length)
87
+ return f.log("No checkbox/radio inputs found for field."), () => {
88
+ };
89
+ const o = r.map((e) => {
90
+ const c = e.type === "radio" ? "change" : "click", n = () => {
91
+ s(e), e.type === "checkbox" && m(e) && v(t, e), e.type === "radio" && I(e, t), k(t), y(t), f.log("Input interaction processed.", {
92
+ inputName: e.name,
93
+ inputType: e.type,
94
+ checked: e.checked
95
+ });
96
+ };
97
+ return e.addEventListener(c, n), s(e), () => {
98
+ e.removeEventListener(c, n);
99
+ };
100
+ });
101
+ return k(t), y(t), E(t, g, "init", {
102
+ checkboxRadio: t
103
+ }), () => {
104
+ o.forEach((e) => {
105
+ e();
106
+ });
107
+ };
108
+ }
109
+ const H = {
110
+ id: g,
111
+ kind: "field",
112
+ match: (t) => t.target instanceof HTMLElement && (t.target.matches(l) || !!t.target.querySelector(l)),
113
+ setup: async (t) => {
114
+ if (!(t.target instanceof HTMLElement))
115
+ return;
116
+ const r = t.target.matches(l) ? [t.target] : Array.from(t.target.querySelectorAll(l)).filter((e) => e instanceof HTMLElement);
117
+ T(t.form), f.log("Module setup.", {
118
+ fieldCount: r.length
119
+ });
120
+ const o = r.map((e) => C(e));
121
+ return await t.emit("formie:module:checkbox-radio:init", {
122
+ count: r.length
123
+ }), {
124
+ destroy: () => {
125
+ o.forEach((e) => {
126
+ e();
127
+ }), q(t.form), f.log("Module destroy.", {
128
+ fieldCount: r.length
129
+ }), t.emit("formie:module:checkbox-radio:destroy", {});
130
+ }
131
+ };
132
+ }
133
+ };
134
+ export {
135
+ H as checkboxRadioModule
136
+ };