@verbb/formie-browser 1.0.4 → 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.
Files changed (182) hide show
  1. package/CHANGELOG.md +62 -22
  2. package/dist/chunks/address-country-Rx6GQTND.js +68 -0
  3. package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
  4. package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
  5. package/dist/chunks/api-CmwLRq_n.js +780 -0
  6. package/dist/chunks/api-DMK8NSUI.js +407 -0
  7. package/dist/chunks/api-sPqGbOww.js +125 -0
  8. package/dist/chunks/async-nPFRNQ06.js +25 -0
  9. package/dist/chunks/bpoint-DSjqRv63.js +24 -0
  10. package/dist/chunks/calculations-CgVJcQ2P.js +299 -0
  11. package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
  12. package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
  13. package/dist/chunks/chunk-3b4jIN3o.js +13 -0
  14. package/dist/chunks/combobox-D-2b42wn.js +1954 -0
  15. package/dist/chunks/conditions-CZ3FU5QO.js +412 -0
  16. package/dist/chunks/constants-DVcJAvc5.js +38 -0
  17. package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
  18. package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
  19. package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
  20. package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
  21. package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
  22. package/dist/chunks/debug-BV0DvdHx.js +41 -0
  23. package/dist/chunks/dist-BF5GU3_9.js +2674 -0
  24. package/dist/chunks/event-names-BCI2FLD8.js +51 -0
  25. package/dist/chunks/eway-D3ctTbEk.js +70 -0
  26. package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
  27. package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
  28. package/dist/chunks/file-upload-D49m8-DR.js +287 -0
  29. package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
  30. package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
  31. package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
  32. package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
  33. package/dist/chunks/google-address-OhKilPWE.js +161 -0
  34. package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
  35. package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
  36. package/dist/chunks/http-D-JExro7.js +27 -0
  37. package/dist/chunks/i18n-BY1ds1BL.js +121 -0
  38. package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
  39. package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
  40. package/dist/chunks/mollie-COG-ko2D.js +23 -0
  41. package/dist/chunks/moneris-CMH8PlRc.js +117 -0
  42. package/dist/chunks/opayo-D2jsR5vh.js +113 -0
  43. package/dist/chunks/paddle-DxF88RfC.js +55 -0
  44. package/dist/chunks/paypal-b5pnwrA2.js +95 -0
  45. package/dist/chunks/payway-BJYu9DIR.js +55 -0
  46. package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
  47. package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
  48. package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
  49. package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
  50. package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
  51. package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
  52. package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
  53. package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
  54. package/dist/chunks/repeater-B5leVxZU.js +102 -0
  55. package/dist/chunks/rich-text-Cv8ADyk-.js +349 -0
  56. package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
  57. package/dist/chunks/sdk-BhHAYgga.js +1397 -0
  58. package/dist/chunks/shared-Bx9s0i0P.js +100 -0
  59. package/dist/chunks/signature-CpgqHCEx.js +463 -0
  60. package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
  61. package/dist/chunks/square-BP8RWAKB.js +40 -0
  62. package/dist/chunks/stripe-MihN63uC.js +184 -0
  63. package/dist/chunks/styles-BfoIZwJp.js +19 -0
  64. package/dist/chunks/summary-D3AjxpYN.js +114 -0
  65. package/dist/chunks/table-C-lkQN6I.js +78 -0
  66. package/dist/chunks/text-limit-B09elPDB.js +125 -0
  67. package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
  68. package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
  69. package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
  70. package/dist/css/formie-theme.css +2 -0
  71. package/dist/css/theme/fields/_address-state.css +94 -0
  72. package/dist/css/theme/fields/_combobox.css +246 -0
  73. package/dist/css/theme/fields/_select.css +13 -0
  74. package/dist/index.js +2447 -39
  75. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  76. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  77. package/dist/js/core/validation-focus.d.ts +4 -0
  78. package/dist/js/core/validation-focus.d.ts.map +1 -0
  79. package/dist/js/modules/address/api.d.ts +1 -0
  80. package/dist/js/modules/address/api.d.ts.map +1 -1
  81. package/dist/js/modules/address/constants.d.ts +22 -1
  82. package/dist/js/modules/address/constants.d.ts.map +1 -1
  83. package/dist/js/modules/address/host.d.ts +2 -2
  84. package/dist/js/modules/address/host.d.ts.map +1 -1
  85. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  86. package/dist/js/modules/fields/address-country.d.ts +3 -0
  87. package/dist/js/modules/fields/address-country.d.ts.map +1 -0
  88. package/dist/js/modules/fields/address-state.d.ts +3 -0
  89. package/dist/js/modules/fields/address-state.d.ts.map +1 -0
  90. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  91. package/dist/js/modules/fields/combobox.d.ts +17 -0
  92. package/dist/js/modules/fields/combobox.d.ts.map +1 -0
  93. package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
  94. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
  95. package/dist/js/modules/fields/custom-link.d.ts +3 -0
  96. package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
  97. package/dist/js/modules/fields/custom-maps.d.ts +3 -0
  98. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
  99. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  100. package/dist/js/modules/fields/index.d.ts.map +1 -1
  101. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  102. package/dist/js/submit/pipeline.d.ts.map +1 -1
  103. package/dist/js/utils/country-from-ip.d.ts +7 -0
  104. package/dist/js/utils/country-from-ip.d.ts.map +1 -0
  105. package/dist/js/utils/field-references.d.ts +1 -0
  106. package/dist/js/utils/field-references.d.ts.map +1 -1
  107. package/dist/js/utils/field-references.row-scope.d.ts +11 -0
  108. package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
  109. package/package.json +6 -3
  110. package/src/css/formie-theme.css +2 -0
  111. package/src/css/theme/fields/_address-state.css +94 -0
  112. package/src/css/theme/fields/_combobox.css +246 -0
  113. package/src/css/theme/fields/_select.css +13 -0
  114. package/src/js/core/create-formie-client.ts +27 -0
  115. package/src/js/core/submit-result-ui.ts +4 -4
  116. package/src/js/core/validation-focus.ts +117 -0
  117. package/src/js/modules/address/api.ts +7 -0
  118. package/src/js/modules/address/constants.ts +82 -2
  119. package/src/js/modules/address/host.ts +16 -6
  120. package/src/js/modules/address/loqate.ts +3 -17
  121. package/src/js/modules/fields/address-country.ts +156 -0
  122. package/src/js/modules/fields/address-state.ts +946 -0
  123. package/src/js/modules/fields/calculations.ts +32 -0
  124. package/src/js/modules/fields/combobox.ts +188 -0
  125. package/src/js/modules/fields/custom-google-maps.ts +416 -0
  126. package/src/js/modules/fields/custom-link.ts +95 -0
  127. package/src/js/modules/fields/custom-maps.ts +339 -0
  128. package/src/js/modules/fields/date-picker.ts +96 -3
  129. package/src/js/modules/fields/index.ts +6 -0
  130. package/src/js/modules/fields/phone-country.ts +6 -0
  131. package/src/js/submit/pipeline.ts +11 -1
  132. package/src/js/utils/country-from-ip.ts +54 -0
  133. package/src/js/utils/field-references.row-scope.ts +303 -0
  134. package/src/js/utils/field-references.ts +1 -0
  135. package/dist/chunks/address-finder-BU4roxT6.js +0 -37
  136. package/dist/chunks/bpoint-uNg5j6rt.js +0 -26
  137. package/dist/chunks/calculations-C9t6Zop9.js +0 -147
  138. package/dist/chunks/captcha-eu-BAPzHNts.js +0 -34
  139. package/dist/chunks/checkbox-radio-CHeLNVIK.js +0 -141
  140. package/dist/chunks/conditions-DKxVCsjD.js +0 -459
  141. package/dist/chunks/date-picker-B3iQ797Z.js +0 -4994
  142. package/dist/chunks/eway-DCielIML.js +0 -74
  143. package/dist/chunks/file-upload-DP2TOUYV.js +0 -316
  144. package/dist/chunks/friendly-captcha-v1-DdlcGiFY.js +0 -33
  145. package/dist/chunks/friendly-captcha-v2-76w-YnFm.js +0 -38
  146. package/dist/chunks/go-cardless-rwCkzbNK.js +0 -24
  147. package/dist/chunks/google-address-BD8IZ86V.js +0 -181
  148. package/dist/chunks/hcaptcha-BNNTL6uf.js +0 -56
  149. package/dist/chunks/hidden-CW6Rcf1N.js +0 -31
  150. package/dist/chunks/index-BEsfee-D.js +0 -1839
  151. package/dist/chunks/index-BP7Unm5Y.js +0 -863
  152. package/dist/chunks/index-D6npYxvr.js +0 -4423
  153. package/dist/chunks/loqate-B-ZNS65B.js +0 -55
  154. package/dist/chunks/mollie-BDAZ-1X4.js +0 -24
  155. package/dist/chunks/moneris-B1b0uEtY.js +0 -101
  156. package/dist/chunks/opayo-CC5hraHo.js +0 -122
  157. package/dist/chunks/paddle-B4GmrDsq.js +0 -60
  158. package/dist/chunks/paypal-BFS6XsIS.js +0 -100
  159. package/dist/chunks/payway-DekoJead.js +0 -56
  160. package/dist/chunks/phone-country-Cm5YUeXI.js +0 -3765
  161. package/dist/chunks/place-kit-DizZWV_e.js +0 -42
  162. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
  163. package/dist/chunks/recaptcha-enterprise-BbOvO7JZ.js +0 -71
  164. package/dist/chunks/recaptcha-shared-Dwg1eVFS.js +0 -15
  165. package/dist/chunks/recaptcha-v2-checkbox-SY3ti5iQ.js +0 -41
  166. package/dist/chunks/recaptcha-v2-invisible-DSmQnn6c.js +0 -59
  167. package/dist/chunks/recaptcha-v3-DNh7YCnR.js +0 -28
  168. package/dist/chunks/repeater-DM0vuFNQ.js +0 -124
  169. package/dist/chunks/rich-text-C8aGYp70.js +0 -304
  170. package/dist/chunks/scripts-CKTFtxPO.js +0 -36
  171. package/dist/chunks/sdk-3SicTWby.js +0 -1559
  172. package/dist/chunks/shared--BU5CFoL.js +0 -80
  173. package/dist/chunks/signature-pFhZfH7d.js +0 -550
  174. package/dist/chunks/snaptcha-VuOUOaLj.js +0 -8
  175. package/dist/chunks/square-BR9pvToy.js +0 -46
  176. package/dist/chunks/stripe-OHUwoV9g.js +0 -202
  177. package/dist/chunks/styles-C3aqgtek.js +0 -21
  178. package/dist/chunks/summary-Da7Ktg3N.js +0 -126
  179. package/dist/chunks/table-C0PmR9bI.js +0 -95
  180. package/dist/chunks/text-limit-mLEwZDIa.js +0 -144
  181. package/dist/chunks/turnstile-9tM7q_LK.js +0 -59
  182. package/dist/chunks/utils-BntI3W4S.js +0 -6149
@@ -0,0 +1,65 @@
1
+ import { t as e } from "./api-DMK8NSUI.js";
2
+ import { t } from "./recaptcha-shared-B4zAescW.js";
3
+ //#region src/js/modules/captchas/recaptcha-enterprise.ts
4
+ var n = e({
5
+ id: "recaptcha-enterprise",
6
+ defaultPlaceholderSelector: "[data-recaptcha-placeholder]",
7
+ defaultTokenFieldNames: ["g-recaptcha-response"],
8
+ load: ({ options: e }) => t(e.provider, !0, (e.provider.enterpriseType === "score" || e.provider.enterpriseType === "policy") && e.provider.siteKey || void 0),
9
+ mount: ({ api: e, container: t, provider: n, services: r }) => {
10
+ let i = e.enterprise || e;
11
+ return new Promise((e) => {
12
+ i.ready(() => {
13
+ if (n.enterpriseType !== "checkbox") {
14
+ e(n.siteKey || `recaptcha-enterprise-${n.enterpriseType || "score"}`);
15
+ return;
16
+ }
17
+ e(i.render(t, {
18
+ sitekey: n.siteKey || "",
19
+ theme: n.theme || "light",
20
+ badge: n.badge || "bottomright",
21
+ size: n.size || "normal",
22
+ action: n.action || "submit",
23
+ callback: (e) => {
24
+ typeof e == "string" && e.trim() !== "" && r.tokens.write(e.trim()), r.errors.clear();
25
+ },
26
+ "expired-callback": () => {
27
+ r.tokens.clear(), r.errors.clear();
28
+ },
29
+ "error-callback": () => {
30
+ r.tokens.clear();
31
+ }
32
+ }));
33
+ });
34
+ });
35
+ },
36
+ screen: async ({ api: e, widget: t, provider: n, placeholder: r, services: i, stageCtx: a }) => {
37
+ let o = e.enterprise || e;
38
+ if (n.enterpriseType === "checkbox") {
39
+ if (i.tokens.has()) return;
40
+ let e = i.errors.getDefaultMessage();
41
+ i.errors.show(e, r), a.abort(e);
42
+ return;
43
+ }
44
+ if (!i.tokens.has()) {
45
+ if (n.enterpriseType === "score" || n.enterpriseType === "policy") {
46
+ let e = await o.execute(n.siteKey || "", { action: n.action || "submit" });
47
+ typeof e == "string" && e.trim() !== "" && i.tokens.write(e.trim());
48
+ } else o.execute(t);
49
+ if (!await i.tokens.wait(12e4)) {
50
+ let e = i.errors.getDefaultMessage();
51
+ i.errors.show(e, r), a.abort(e);
52
+ }
53
+ }
54
+ },
55
+ reset: ({ api: e, widget: t, provider: n, services: r }) => {
56
+ let i = e.enterprise || e;
57
+ n.enterpriseType === "checkbox" && i.reset(t), r.tokens.clear();
58
+ },
59
+ unmount: ({ api: e, widget: t, provider: n, services: r }) => {
60
+ let i = e.enterprise || e;
61
+ n.enterpriseType === "checkbox" && i.reset(t), r.tokens.clear();
62
+ }
63
+ });
64
+ //#endregion
65
+ export { n as recaptchaEnterpriseModule };
@@ -0,0 +1,15 @@
1
+ import { a as e, r as t } from "./api-DMK8NSUI.js";
2
+ import { r as n } from "./scripts-6CYSUGKQ.js";
3
+ //#region src/js/modules/captchas/recaptcha-shared.ts
4
+ async function r(r, i = !1, a) {
5
+ let o = typeof r.language == "string" && r.language.trim() !== "" ? r.language.trim() : "en", { async: s, defer: c } = t(r.loadingMethod), l = i ? "https://www.google.com/recaptcha/enterprise.js" : "https://www.recaptcha.net/recaptcha/api.js", u = typeof a == "string" && a.trim() !== "" ? a.trim() : "explicit", d = new URL(l);
6
+ return d.searchParams.set("render", u), d.searchParams.set("hl", o), u !== "explicit" && typeof r.badge == "string" && r.badge.trim() !== "" && d.searchParams.set("badge", r.badge.trim()), n("grecaptcha", {
7
+ id: i ? "FORMIE_RECAPTCHA_ENTERPRISE_SCRIPT" : "FORMIE_RECAPTCHA_SCRIPT",
8
+ src: d.toString(),
9
+ async: s,
10
+ defer: c,
11
+ timeoutMs: e
12
+ });
13
+ }
14
+ //#endregion
15
+ export { r as t };
@@ -0,0 +1,40 @@
1
+ import { t as e } from "./api-DMK8NSUI.js";
2
+ import { t } from "./recaptcha-shared-B4zAescW.js";
3
+ //#region src/js/modules/captchas/recaptcha-v2-checkbox.ts
4
+ var n = e({
5
+ id: "recaptcha-v2-checkbox",
6
+ defaultPlaceholderSelector: "[data-recaptcha-placeholder]",
7
+ defaultTokenFieldNames: ["g-recaptcha-response"],
8
+ load: ({ options: e }) => t(e.provider),
9
+ mount: ({ api: e, container: t, provider: n, services: r }) => new Promise((i) => {
10
+ e.ready(() => {
11
+ i(e.render(t, {
12
+ sitekey: n.siteKey || "",
13
+ theme: n.theme || "light",
14
+ size: n.size || "normal",
15
+ callback: (e) => {
16
+ typeof e == "string" && e.trim() !== "" && r.tokens.write(e.trim()), r.errors.clear();
17
+ },
18
+ "expired-callback": () => {
19
+ r.tokens.clear(), r.errors.clear();
20
+ },
21
+ "error-callback": () => {
22
+ r.tokens.clear();
23
+ }
24
+ }));
25
+ });
26
+ }),
27
+ screen: ({ placeholder: e, services: t, stageCtx: n }) => {
28
+ if (t.tokens.has()) return;
29
+ let r = t.errors.getDefaultMessage();
30
+ t.errors.show(r, e), n.abort(r);
31
+ },
32
+ reset: ({ api: e, widget: t, services: n }) => {
33
+ e.reset(t), n.tokens.clear();
34
+ },
35
+ unmount: ({ api: e, widget: t, services: n }) => {
36
+ e.reset(t), n.tokens.clear();
37
+ }
38
+ });
39
+ //#endregion
40
+ export { n as recaptchaV2CheckboxModule };
@@ -0,0 +1,53 @@
1
+ import { t as e } from "./api-DMK8NSUI.js";
2
+ import { t } from "./recaptcha-shared-B4zAescW.js";
3
+ //#region src/js/modules/captchas/recaptcha-v2-invisible.ts
4
+ async function n(e, t, n = 1e3) {
5
+ let r = Date.now() + n;
6
+ for (; Date.now() < r;) {
7
+ let n = typeof e.getResponse == "function" ? e.getResponse(t) : "";
8
+ if (typeof n == "string" && n.trim() !== "") return n.trim();
9
+ await new Promise((e) => {
10
+ window.setTimeout(e, 100);
11
+ });
12
+ }
13
+ }
14
+ var r = e({
15
+ id: "recaptcha-v2-invisible",
16
+ defaultPlaceholderSelector: "[data-recaptcha-placeholder]",
17
+ defaultTokenFieldNames: ["g-recaptcha-response"],
18
+ load: ({ options: e }) => t(e.provider),
19
+ mount: ({ api: e, container: t, provider: n, services: r }) => new Promise((i) => {
20
+ e.ready(() => {
21
+ let a = e.render(t, {
22
+ sitekey: n.siteKey || "",
23
+ badge: n.badge || "bottomright",
24
+ size: "invisible",
25
+ callback: (t) => {
26
+ let n = typeof t == "string" && t.trim() !== "" ? t.trim() : typeof e.getResponse == "function" ? e.getResponse(a) : "";
27
+ n && r.tokens.write(n), r.errors.clear();
28
+ },
29
+ "expired-callback": () => {
30
+ r.tokens.clear(), r.errors.clear();
31
+ },
32
+ "error-callback": () => {
33
+ r.tokens.clear();
34
+ }
35
+ });
36
+ i({ id: a });
37
+ });
38
+ }),
39
+ screen: async ({ api: e, widget: t, placeholder: r, services: i, stageCtx: a }) => {
40
+ if (i.tokens.has()) return;
41
+ e.execute(t.id);
42
+ let o = await n(e, t.id);
43
+ if (typeof o == "string" && o.trim() !== "" && i.tokens.write(o.trim()), !await i.tokens.wait(12e4)) {
44
+ let e = i.errors.getDefaultMessage();
45
+ i.errors.show(e, r), a.abort(e);
46
+ }
47
+ },
48
+ unmount: ({ api: e, widget: t, services: n }) => {
49
+ e.reset(t.id), n.tokens.clear();
50
+ }
51
+ });
52
+ //#endregion
53
+ export { r as recaptchaV2InvisibleModule };
@@ -0,0 +1,27 @@
1
+ import { t as e } from "./api-DMK8NSUI.js";
2
+ import { t } from "./recaptcha-shared-B4zAescW.js";
3
+ //#region src/js/modules/captchas/recaptcha-v3.ts
4
+ var n = e({
5
+ id: "recaptcha-v3",
6
+ defaultPlaceholderSelector: "[data-recaptcha-placeholder]",
7
+ defaultTokenFieldNames: ["g-recaptcha-response"],
8
+ load: ({ options: e }) => t(e.provider, !1, e.provider.siteKey || void 0),
9
+ mount: ({ api: e, provider: t }) => new Promise((n) => {
10
+ e.ready(() => {
11
+ n(t.siteKey || "recaptcha-v3");
12
+ });
13
+ }),
14
+ screen: async ({ api: e, provider: t, placeholder: n, services: r, stageCtx: i }) => {
15
+ if (r.tokens.has()) return;
16
+ let a = await e.execute(t.siteKey || "", { action: t.action || "submit" });
17
+ if (typeof a == "string" && a.trim() !== "" && r.tokens.write(a.trim()), !await r.tokens.wait(12e4)) {
18
+ let e = r.errors.getDefaultMessage();
19
+ r.errors.show(e, n), i.abort(e);
20
+ }
21
+ },
22
+ unmount: ({ services: e }) => {
23
+ e.tokens.clear();
24
+ }
25
+ });
26
+ //#endregion
27
+ export { n as recaptchaV3Module };
@@ -0,0 +1,102 @@
1
+ import { t as e } from "./debug-BV0DvdHx.js";
2
+ import { n as t } from "./async-nPFRNQ06.js";
3
+ import { t as n } from "./styles-BfoIZwJp.js";
4
+ import { a as r, o as i, t as a } from "./shared-Bx9s0i0P.js";
5
+ //#region src/css/theme/fields/_repeater.css?inline
6
+ var o = "@layer formie-theme{.formie-repeater-container{gap:var(--formie-space-4);display:grid}.formie-repeater-item-wrapper{gap:var(--formie-space-4);padding:var(--formie-space-4);border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-md);transition:border-color .15s,box-shadow .15s,background-color .15s;display:grid;position:relative}.formie-repeater-item-wrapper:focus-within{border-color:var(--formie-focus-ring-border-color);box-shadow:var(--formie-shadow-focus)}.formie-field-has-error .formie-repeater-item-wrapper{border-color:var(--formie-color-danger)}.formie-field-has-error .formie-repeater-item-wrapper:focus-within{box-shadow:var(--formie-shadow-danger-focus)}.formie-repeater-item-wrapper>.formie-repeater-remove-button{top:var(--formie-repeater-remove-button-top);right:var(--formie-repeater-remove-button-right);transform:var(--formie-repeater-remove-button-transform);font-size:0;line-height:0;position:absolute}.formie-button.formie-repeater-add-button{width:auto;max-width:100%;padding-left:var(--formie-repeater-add-button-padding-left);justify-content:center;justify-self:start;align-items:center;display:inline-flex;position:relative}.formie-button.formie-repeater-add-button:before{content:\"\";width:var(--formie-repeater-add-button-width);height:var(--formie-repeater-add-button-height);left:var(--formie-repeater-add-button-left);-webkit-mask-image:var(--formie-repeater-add-button-icon-mask);-webkit-mask-image:var(--formie-repeater-add-button-icon-mask);mask-image:var(--formie-repeater-add-button-icon-mask);background-color:currentColor;display:block;position:absolute;top:50%;transform:translateY(-50%);-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}}", s = "[data-formie-repeater-field-layout]", c = "[data-formie-repeater-container]", l = "[data-formie-repeater-item]", u = "[data-formie-repeater-add]", d = "[data-formie-repeater-remove]", f = "data-formie-template-id", p = "repeater", m = e("fields", "repeater");
7
+ n(p, [o]);
8
+ function h(e, t) {
9
+ return r(e, t);
10
+ }
11
+ function g(e, t) {
12
+ let n = document.createElement("div");
13
+ return n.innerHTML = e.replaceAll("__ROW__", String(t)).trim(), n.firstElementChild instanceof HTMLElement ? n.firstElementChild : null;
14
+ }
15
+ function _(e) {
16
+ return e.querySelectorAll(l).length;
17
+ }
18
+ function v(e, t) {
19
+ if (!e) return;
20
+ let n = parseInt(e.getAttribute("data-formie-max-rows") || "", 10);
21
+ if (n > 0 && t >= n) {
22
+ e.disabled = !0;
23
+ return;
24
+ }
25
+ e.disabled = !1;
26
+ }
27
+ function y(e) {
28
+ let n = e.matches(c) ? e : e.querySelector(c), r = e.querySelector(u);
29
+ if (!(n instanceof HTMLElement)) return m.warn("Missing repeater container; skipping field."), () => {};
30
+ let o = /* @__PURE__ */ new Map(), s = Array.from(e.querySelectorAll(l)).reduce((e, t) => {
31
+ let n = parseInt(t.getAttribute("data-formie-repeater-item-id") || "", 10);
32
+ return Number.isNaN(n) ? e : Math.max(e, n + 1);
33
+ }, 0), y = () => {
34
+ e.querySelectorAll(d).forEach((t) => {
35
+ if (!(t instanceof HTMLElement) || o.has(t)) return;
36
+ let n = (n) => {
37
+ n.preventDefault();
38
+ let i = t.closest(l);
39
+ if (!(i instanceof HTMLElement)) return;
40
+ let o = parseInt((r instanceof HTMLButtonElement ? r.getAttribute("data-formie-min-rows") : "") || "", 10);
41
+ o > 0 && _(e) <= o || (i.remove(), v(r instanceof HTMLButtonElement ? r : null, _(e)), m.log("Row removed.", { rowCount: _(e) }), a(e, p, "remove", {
42
+ repeater: e,
43
+ row: i
44
+ }));
45
+ };
46
+ t.addEventListener("click", n), o.set(t, n);
47
+ });
48
+ }, b = async () => {
49
+ if (!(r instanceof HTMLButtonElement)) return;
50
+ let o = r.getAttribute("data-formie-repeater-add");
51
+ if (!o) {
52
+ m.warn("Add handle missing.");
53
+ return;
54
+ }
55
+ let c = r.getAttribute(f) || e.getAttribute(f), l = parseInt(r.getAttribute("data-formie-max-rows") || "", 10);
56
+ if (l > 0 && _(e) >= l) return;
57
+ let u = h(e, c);
58
+ if (!u) {
59
+ m.warn("Template not found for add action.", { handle: o });
60
+ return;
61
+ }
62
+ let d = g(i(u), s++);
63
+ if (!d) {
64
+ m.warn("Failed to build row from template.");
65
+ return;
66
+ }
67
+ n.appendChild(d), await t(50), y(), v(r, _(e)), m.log("Row appended.", { rowCount: _(e) }), a(e, p, "append", {
68
+ repeater: e,
69
+ row: d
70
+ }), a(e, p, "init-row", {
71
+ repeater: e,
72
+ row: d
73
+ });
74
+ }, x = (e) => {
75
+ e.preventDefault(), b();
76
+ };
77
+ if (r instanceof HTMLButtonElement && r.addEventListener("click", x), y(), v(r instanceof HTMLButtonElement ? r : null, _(e)), r instanceof HTMLButtonElement && _(e) === 0) {
78
+ let e = parseInt(r.getAttribute("data-formie-min-rows") || "", 10);
79
+ for (let t = 0; t < e; t += 1) b();
80
+ }
81
+ return a(e, p, "init", { repeater: e }), m.log("Field initialized.", { rowCount: _(e) }), () => {
82
+ r instanceof HTMLButtonElement && r.removeEventListener("click", x), o.forEach((e, t) => {
83
+ t.removeEventListener("click", e);
84
+ });
85
+ };
86
+ }
87
+ var b = {
88
+ id: p,
89
+ kind: "field",
90
+ match: (e) => e.target instanceof HTMLElement && (e.target.matches(s) || !!e.target.querySelector(s)),
91
+ setup: async (e) => {
92
+ if (!(e.target instanceof HTMLElement)) return;
93
+ let t = e.target.matches(s) ? [e.target] : Array.from(e.target.querySelectorAll(s)).filter((e) => e instanceof HTMLElement), n = t.map((e) => y(e));
94
+ return m.log("Module setup.", { fieldCount: t.length }), await e.emit("formie:module:repeater:init", { count: t.length }), { destroy: () => {
95
+ n.forEach((e) => {
96
+ e();
97
+ }), m.log("Module destroy.", { fieldCount: t.length }), e.emit("formie:module:repeater:destroy", {});
98
+ } };
99
+ }
100
+ };
101
+ //#endregion
102
+ export { b as repeaterModule };