@verbb/formie-browser 1.0.14 → 1.0.16

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 (156) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/dist/chunks/{address-country-Dn71jroa.js → address-country-DLJF-OkC.js} +5 -9
  3. package/dist/chunks/{address-finder-O49uDRoR.js → address-finder-QK1m1eyv.js} +2 -2
  4. package/dist/chunks/{address-state-ByYatUur.js → address-state-CHKit8AW.js} +113 -112
  5. package/dist/chunks/{api-DYYsVIub.js → api-BPtH5RBA.js} +162 -130
  6. package/dist/chunks/{api-D6kJ7kXZ.js → api-BR2Gqy37.js} +313 -303
  7. package/dist/chunks/{api-ghNr2uxX.js → api-CmuOZ0i3.js} +1 -1
  8. package/dist/chunks/{async-nPFRNQ06.js → async-2GdXNFCE.js} +18 -1
  9. package/dist/chunks/{bpoint-D0RKFM4F.js → bpoint-GvYfyPjD.js} +1 -1
  10. package/dist/chunks/{calculations-YEoVCG2q.js → calculations-DeEmdUDq.js} +5 -7
  11. package/dist/chunks/{captcha-eu-DERJbXnH.js → captcha-eu-eU_M6snp.js} +2 -2
  12. package/dist/chunks/{checkbox-radio-gsm8QPJg.js → checkbox-radio-CSXo6svm.js} +4 -12
  13. package/dist/chunks/{combobox-CWNdx4Fk.js → combobox-CJh2DoSO.js} +323 -363
  14. package/dist/chunks/{conditions-DqNHLTbN.js → conditions-Dz3068K0.js} +140 -153
  15. package/dist/chunks/{country-from-ip-DDj_mFki.js → country-from-ip-BqQ-BqLH.js} +1 -1
  16. package/dist/chunks/{custom-google-maps-C4l2S3GO.js → custom-google-maps-rNm5VFbb.js} +2 -6
  17. package/dist/chunks/{custom-link-CLazgKYH.js → custom-link-CLqFCssQ.js} +1 -1
  18. package/dist/chunks/{custom-maps-DqcAlD0v.js → custom-maps-DgjYQDLj.js} +4 -8
  19. package/dist/chunks/{date-picker-RUnevF7l.js → date-picker-BVJxJVYT.js} +42 -58
  20. package/dist/chunks/{debug-BV0DvdHx.js → debug-rhzqP1j2.js} +2 -14
  21. package/dist/chunks/{dist-ZLeW0zZ3.js → dist-CJReDlDK.js} +13 -8
  22. package/dist/chunks/{eway-or6dtjoT.js → eway-BZuTBAUW.js} +3 -3
  23. package/dist/chunks/{field-references.resolver-Ca8MguFv.js → field-references.resolver-uSHf5-NP.js} +1 -1
  24. package/dist/chunks/{file-upload-Bm-TXyNB.js → file-upload-vEUr_EuP.js} +131 -113
  25. package/dist/chunks/{friendly-captcha-v1-GFqCt1Mh.js → friendly-captcha-v1-C_cF1WD2.js} +2 -2
  26. package/dist/chunks/{friendly-captcha-v2-WoW246JG.js → friendly-captcha-v2-BenESH-n.js} +2 -2
  27. package/dist/chunks/{friendly-challenge-DPG9MJb1.js → friendly-challenge-BgPBEMXx.js} +21 -35
  28. package/dist/chunks/{go-cardless-DzJ-0FKg.js → go-cardless-DWZeB0Bq.js} +2 -6
  29. package/dist/chunks/{google-address-C1P1nTDM.js → google-address-DQR6rsbh.js} +15 -10
  30. package/dist/chunks/{hcaptcha-D0T8aIHz.js → hcaptcha-COilLmRT.js} +2 -2
  31. package/dist/chunks/{hidden-BZhXnNPe.js → hidden-Bc2TpcgF.js} +1 -1
  32. package/dist/chunks/{http-C2QdHuWO.js → http-Dj_skqaa.js} +1 -1
  33. package/dist/chunks/{leaflet-src-DE6rv6M-.js → leaflet-src-Cg-LUOD8.js} +74 -122
  34. package/dist/chunks/{loqate-DD1S7PY9.js → loqate-ZZClcacr.js} +2 -2
  35. package/dist/chunks/{mollie-DG8Ju83x.js → mollie-8OMXIYa8.js} +2 -6
  36. package/dist/chunks/{moneris-C8m3Fvqu.js → moneris-qYHJ9EFy.js} +1 -1
  37. package/dist/chunks/opayo-DlWPEnla.js +159 -0
  38. package/dist/chunks/{paddle-BIYR9Um3.js → paddle-CArfWih0.js} +2 -2
  39. package/dist/chunks/{password-validation-C8_uO_c_.js → password-validation-HGOU9kf3.js} +2 -2
  40. package/dist/chunks/{paypal-B_yxIo2d.js → paypal-BcaMCMGY.js} +2 -2
  41. package/dist/chunks/{payway-CeOzS0sL.js → payway-vxC7_bfR.js} +4 -12
  42. package/dist/chunks/{phone-country-bAqje17P.js → phone-country-Bx9EG50h.js} +124 -141
  43. package/dist/chunks/{place-kit-BE5gi3vo.js → place-kit-BKk8xDXf.js} +10 -10
  44. package/dist/chunks/{placekit-autocomplete.esm-CZZERYur.js → placekit-autocomplete.esm-D2A_0iVU.js} +2 -5
  45. package/dist/chunks/{recaptcha-enterprise-CruXddZq.js → recaptcha-enterprise-Cx6HUpMa.js} +6 -12
  46. package/dist/chunks/recaptcha-shared-CcMI-r8t.js +33 -0
  47. package/dist/chunks/{recaptcha-v2-checkbox-CCnJYCnG.js → recaptcha-v2-checkbox-DQ9BJzcv.js} +2 -2
  48. package/dist/chunks/{recaptcha-v2-invisible-BuVqRRYn.js → recaptcha-v2-invisible-BP0T8Pan.js} +2 -2
  49. package/dist/chunks/recaptcha-v3-DKMGQ27K.js +38 -0
  50. package/dist/chunks/{repeater-DwE27jI1.js → repeater-BR0RUvTs.js} +50 -40
  51. package/dist/chunks/{rich-text-uV4o_pGk.js → rich-text-H2A6cm1t.js} +33 -11
  52. package/dist/chunks/{rolldown-runtime-DtPi1Y-2.js → rolldown-runtime-VHNaYcLd.js} +1 -1
  53. package/dist/chunks/{scripts-CbQ7agX3.js → scripts-DrccjrFv.js} +1 -1
  54. package/dist/chunks/{sdk-lkwSvlpM.js → sdk-_cmrRYgp.js} +4 -16
  55. package/dist/chunks/{shared-OKhSay59.js → shared-CJ1LIEh3.js} +1 -3
  56. package/dist/chunks/{signature-7cldFbqj.js → signature-CfKA_poI.js} +9 -41
  57. package/dist/chunks/skip-CEW89ExY.js +7 -0
  58. package/dist/chunks/{snaptcha-C04kNGYQ.js → snaptcha-P3EoSQud.js} +1 -1
  59. package/dist/chunks/{square-DEzxv9D9.js → square-Dyz0p_GU.js} +2 -2
  60. package/dist/chunks/{stripe-CVPQGDz3.js → stripe-Bfd_jp_k.js} +4 -7
  61. package/dist/chunks/{summary-BF_8mrXI.js → summary-B3CAebLV.js} +45 -37
  62. package/dist/chunks/{survey-likert-fk1hUPff.js → survey-likert-CEtUceag.js} +1 -1
  63. package/dist/chunks/{survey-rank-BsLGl2LX.js → survey-rank-Dtt97y6s.js} +3 -7
  64. package/dist/chunks/{survey-rating-DVS6e6fM.js → survey-rating-mlDMI0uq.js} +9 -23
  65. package/dist/chunks/{table-DnIBdeKF.js → table-0k6Md0IO.js} +2 -2
  66. package/dist/chunks/{text-limit-LGMPhFuC.js → text-limit-CTVML6s7.js} +10 -10
  67. package/dist/chunks/{turnstile-n9DNyPxi.js → turnstile-Sp4ubowK.js} +2 -2
  68. package/dist/chunks/{upload-manager-BbiUosZq.js → upload-manager-Ccg3d_4I.js} +258 -260
  69. package/dist/index.d.ts +1 -0
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +743 -734
  72. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  73. package/dist/js/core/dom-events.d.ts +5 -0
  74. package/dist/js/core/dom-events.d.ts.map +1 -1
  75. package/dist/js/core/page-client-event.d.ts.map +1 -1
  76. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  77. package/dist/js/core/submit-result-ui.d.ts +3 -1
  78. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  79. package/dist/js/core/validation-focus.d.ts.map +1 -1
  80. package/dist/js/modules/address/google-address.d.ts +10 -0
  81. package/dist/js/modules/address/google-address.d.ts.map +1 -1
  82. package/dist/js/modules/address/place-kit.d.ts.map +1 -1
  83. package/dist/js/modules/captchas/factories.d.ts.map +1 -1
  84. package/dist/js/modules/captchas/host.d.ts +4 -1
  85. package/dist/js/modules/captchas/host.d.ts.map +1 -1
  86. package/dist/js/modules/captchas/recaptcha-shared.d.ts +1 -1
  87. package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -1
  88. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
  89. package/dist/js/modules/fields/address-state.d.ts.map +1 -1
  90. package/dist/js/modules/fields/combobox.d.ts +2 -0
  91. package/dist/js/modules/fields/combobox.d.ts.map +1 -1
  92. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  93. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  94. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  95. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  96. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  97. package/dist/js/modules/fields/repeater.d.ts.map +1 -1
  98. package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
  99. package/dist/js/modules/fields/summary.d.ts.map +1 -1
  100. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  101. package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
  102. package/dist/js/modules/payments/factories.d.ts.map +1 -1
  103. package/dist/js/modules/payments/opayo.d.ts.map +1 -1
  104. package/dist/js/submit/pipeline.d.ts +2 -0
  105. package/dist/js/submit/pipeline.d.ts.map +1 -1
  106. package/dist/js/utils/async.d.ts +1 -0
  107. package/dist/js/utils/async.d.ts.map +1 -1
  108. package/dist/js/utils/form-started-at.d.ts +1 -0
  109. package/dist/js/utils/form-started-at.d.ts.map +1 -1
  110. package/dist/js/utils/unload-warning.d.ts +4 -0
  111. package/dist/js/utils/unload-warning.d.ts.map +1 -1
  112. package/dist/js/validation/rules/required.d.ts.map +1 -1
  113. package/dist/js/validation/submit-readiness.d.ts.map +1 -1
  114. package/dist/js/validation/validator.d.ts +1 -0
  115. package/dist/js/validation/validator.d.ts.map +1 -1
  116. package/package.json +3 -3
  117. package/src/index.ts +1 -0
  118. package/src/js/core/create-formie-client.ts +37 -28
  119. package/src/js/core/dom-events.ts +30 -1
  120. package/src/js/core/page-client-event.ts +5 -7
  121. package/src/js/core/submit-result-state.ts +30 -2
  122. package/src/js/core/submit-result-ui.ts +25 -3
  123. package/src/js/core/validation-focus.ts +17 -3
  124. package/src/js/modules/address/google-address.ts +95 -37
  125. package/src/js/modules/address/place-kit.ts +13 -7
  126. package/src/js/modules/captchas/factories.ts +241 -101
  127. package/src/js/modules/captchas/host.ts +16 -0
  128. package/src/js/modules/captchas/recaptcha-enterprise.ts +1 -1
  129. package/src/js/modules/captchas/recaptcha-shared.ts +23 -5
  130. package/src/js/modules/captchas/recaptcha-v3.ts +23 -14
  131. package/src/js/modules/fields/address-country.ts +5 -5
  132. package/src/js/modules/fields/address-state.ts +80 -27
  133. package/src/js/modules/fields/combobox.ts +22 -1
  134. package/src/js/modules/fields/conditions/effects.ts +4 -5
  135. package/src/js/modules/fields/conditions.ts +9 -0
  136. package/src/js/modules/fields/date-picker.ts +6 -3
  137. package/src/js/modules/fields/file-upload.ts +55 -18
  138. package/src/js/modules/fields/phone-country.ts +25 -2
  139. package/src/js/modules/fields/repeater.ts +55 -4
  140. package/src/js/modules/fields/rich-text.ts +33 -0
  141. package/src/js/modules/fields/summary.ts +63 -10
  142. package/src/js/modules/fields/text-limit.ts +11 -0
  143. package/src/js/modules/fields/upload-manager.ts +54 -18
  144. package/src/js/modules/payments/factories.ts +87 -54
  145. package/src/js/modules/payments/opayo.ts +7 -0
  146. package/src/js/submit/pipeline.ts +16 -9
  147. package/src/js/utils/async.ts +34 -0
  148. package/src/js/utils/form-started-at.ts +19 -4
  149. package/src/js/utils/unload-warning.ts +63 -7
  150. package/src/js/validation/rules/required.ts +18 -0
  151. package/src/js/validation/submit-readiness.ts +2 -0
  152. package/src/js/validation/validator.ts +29 -6
  153. package/src/vendor.d.ts +2 -0
  154. package/dist/chunks/opayo-B3EvrVxw.js +0 -188
  155. package/dist/chunks/recaptcha-shared-AQRMDMme.js +0 -27
  156. package/dist/chunks/recaptcha-v3-CloqhO2A.js +0 -28
package/dist/index.js CHANGED
@@ -1,18 +1,20 @@
1
1
  import { n as e } from "./chunks/request-profile-DhwkeCpS.js";
2
- import { i as t, m as n, t as r } from "./chunks/dist-ZLeW0zZ3.js";
2
+ import { i as t, m as n, t as r } from "./chunks/dist-CJReDlDK.js";
3
3
  import { c as i, d as a, l as o, o as s, r as c, t as l, u } from "./chunks/event-names-BCI2FLD8.js";
4
- import { a as d, c as f, d as p, f as m, i as h, l as g, n as _, o as v, p as y, r as b, s as x, t as S, u as C } from "./chunks/api-D6kJ7kXZ.js";
5
- import { a as ee, i as te, n as ne, r as w, t as T } from "./chunks/debug-BV0DvdHx.js";
6
- import { i as E, r as re, t as D } from "./chunks/theme-classes-DAQuEqdP.js";
7
- import { i as O, t as ie } from "./chunks/csrf-DxHg_ZYt.js";
8
- import { n as k, t as ae } from "./chunks/http-C2QdHuWO.js";
9
- import { a as oe, i as se, n as ce, r as le, t as ue } from "./chunks/i18n-BY1ds1BL.js";
10
- import { n as de, t as fe } from "./chunks/api-DYYsVIub.js";
11
- import { n as pe, r as me, t as he } from "./chunks/field-references.keys-58ZSTrCW.js";
12
- import { i as ge, n as _e, r as ve, t as ye } from "./chunks/field-references.resolver-Ca8MguFv.js";
13
- import { t as be } from "./chunks/api-ghNr2uxX.js";
4
+ import { _ as d, a as f, c as p, d as m, f as h, g, h as _, i as v, l as y, m as ee, o as b, p as x, r as S, s as C, t as w, u as T } from "./chunks/api-BR2Gqy37.js";
5
+ import { a as te, i as ne, n as E, r as D, t as O } from "./chunks/debug-rhzqP1j2.js";
6
+ import { i as k, r as re, t as A } from "./chunks/theme-classes-DAQuEqdP.js";
7
+ import { n as j } from "./chunks/skip-CEW89ExY.js";
8
+ import { i as ie, t as ae } from "./chunks/csrf-DxHg_ZYt.js";
9
+ import { n as M, t as oe } from "./chunks/http-Dj_skqaa.js";
10
+ import { i as se } from "./chunks/async-2GdXNFCE.js";
11
+ import { a as ce, i as le, n as ue, r as de, t as fe } from "./chunks/i18n-BY1ds1BL.js";
12
+ import { n as pe, t as me } from "./chunks/api-BPtH5RBA.js";
13
+ import { n as he, r as ge, t as _e } from "./chunks/field-references.keys-58ZSTrCW.js";
14
+ import { i as ve, n as ye, r as be, t as xe } from "./chunks/field-references.resolver-uSHf5-NP.js";
15
+ import { t as Se } from "./chunks/api-CmuOZ0i3.js";
14
16
  //#region src/js/compatibility/event-map.ts
15
- var xe = [
17
+ var Ce = [
16
18
  {
17
19
  legacyEvent: "onFormieLoaded",
18
20
  canonicalEvent: "formie:mount:after",
@@ -65,7 +67,7 @@ var xe = [
65
67
  canonicalEvent: "formie:submit:after",
66
68
  disposition: "approximate"
67
69
  }
68
- ], Se = [
70
+ ], we = [
69
71
  {
70
72
  legacyEvent: "formieValidatorInitialized",
71
73
  canonicalEvent: "formie:validator:ready",
@@ -87,7 +89,7 @@ var xe = [
87
89
  disposition: "safe"
88
90
  }
89
91
  ];
90
- function Ce(e) {
92
+ function Te(e) {
91
93
  if (!e) return {
92
94
  enabled: !1,
93
95
  legacyDomEvents: !1,
@@ -107,18 +109,18 @@ function Ce(e) {
107
109
  }
108
110
  //#endregion
109
111
  //#region src/js/compatibility/dom-adapter.ts
110
- function we(e, t, n) {
112
+ function Ee(e, t, n) {
111
113
  e.dispatchEvent(new CustomEvent(t, {
112
114
  bubbles: !0,
113
115
  detail: n
114
116
  }));
115
117
  }
116
- function Te(e, t) {
118
+ function De(e, t) {
117
119
  if (e.canonicalEvent !== "formie:submit:result") return !0;
118
120
  let n = t;
119
121
  return e.legacyEvent === "onAfterFormieSubmit" ? !!n?.ok : e.legacyEvent !== "onFormieSubmitError" || n?.ok === !1;
120
122
  }
121
- function Ee(e, t) {
123
+ function Oe(e, t) {
122
124
  let n = t && typeof t == "object" ? t : {}, r = typeof n.pageId == "string" ? n.pageId : "", i = Array.from(e.querySelectorAll("[data-formie-page-id]"));
123
125
  return { data: {
124
126
  nextPageId: r,
@@ -126,7 +128,7 @@ function Ee(e, t) {
126
128
  totalPages: i.length
127
129
  } };
128
130
  }
129
- function De(e, t, n, r, i) {
131
+ function ke(e, t, n, r, i) {
130
132
  let a = globalThis.Formie || i;
131
133
  return e.legacyEvent === "onFormieLoaded" ? { formie: a } : e.legacyEvent === "onFormieInit" ? {
132
134
  formie: a,
@@ -138,12 +140,12 @@ function De(e, t, n, r, i) {
138
140
  form: r,
139
141
  target: n,
140
142
  instance: i
141
- } : e.legacyEvent === "onFormiePageToggle" ? Ee(r, t) : t;
143
+ } : e.legacyEvent === "onFormiePageToggle" ? Oe(r, t) : t;
142
144
  }
143
- function Oe({ target: e, form: t, instance: n, options: r, unbinds: i }) {
144
- r.legacyDomEvents && xe.forEach((r) => {
145
+ function Ae({ target: e, form: t, instance: n, options: r, unbinds: i }) {
146
+ r.legacyDomEvents && Ce.forEach((r) => {
145
147
  let o = (i) => {
146
- i instanceof CustomEvent && Te(r, i.detail) && we(r.target === "document" ? document : t, r.legacyEvent, De(r, i.detail, e, t, n));
148
+ i instanceof CustomEvent && De(r, i.detail) && Ee(r.target === "document" ? document : t, r.legacyEvent, ke(r, i.detail, e, t, n));
147
149
  };
148
150
  e.addEventListener(a(r.canonicalEvent), o), i.push(() => {
149
151
  e.removeEventListener(a(r.canonicalEvent), o);
@@ -152,30 +154,30 @@ function Oe({ target: e, form: t, instance: n, options: r, unbinds: i }) {
152
154
  }
153
155
  //#endregion
154
156
  //#region src/js/compatibility/validator-adapter.ts
155
- function A(e, t, n) {
157
+ function N(e, t, n) {
156
158
  e.dispatchEvent(new CustomEvent(t, {
157
159
  bubbles: !0,
158
160
  detail: n
159
161
  }));
160
162
  }
161
- function j(e, t) {
163
+ function je(e, t) {
162
164
  return !!e && typeof e == "object" && e.validator === t;
163
165
  }
164
- function ke({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
166
+ function Me({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
165
167
  if (!r.legacyValidatorEvents || !n) return;
166
168
  let { validator: a, addValidator: o, removeValidator: s } = n, c = {
167
169
  ...n,
168
170
  form: t,
169
171
  target: e
170
172
  };
171
- A(document, "formieValidatorInitialized", c);
173
+ N(document, "formieValidatorInitialized", c);
172
174
  let l = (e) => {
173
- e instanceof CustomEvent && j(e.detail, a) && A(document, "formieValidatorDestroyed", {
175
+ e instanceof CustomEvent && je(e.detail, a) && N(document, "formieValidatorDestroyed", {
174
176
  ...c,
175
177
  ...e.detail
176
178
  });
177
179
  }, u = (n) => {
178
- n instanceof CustomEvent && j(n.detail, a) && n.target instanceof Element && t.contains(n.target) && A(n.target, "formieValidatorShowError", {
180
+ n instanceof CustomEvent && je(n.detail, a) && n.target instanceof Element && t.contains(n.target) && N(n.target, "formieValidatorShowError", {
179
181
  ...n.detail,
180
182
  addValidator: o,
181
183
  removeValidator: s,
@@ -183,7 +185,7 @@ function ke({ target: e, form: t, validatorDetail: n, options: r, unbinds: i })
183
185
  target: e
184
186
  });
185
187
  }, d = (n) => {
186
- n instanceof CustomEvent && j(n.detail, a) && n.target instanceof Element && t.contains(n.target) && A(n.target, "formieValidatorClearError", {
188
+ n instanceof CustomEvent && je(n.detail, a) && n.target instanceof Element && t.contains(n.target) && N(n.target, "formieValidatorClearError", {
187
189
  ...n.detail,
188
190
  addValidator: o,
189
191
  removeValidator: s,
@@ -197,83 +199,82 @@ function ke({ target: e, form: t, validatorDetail: n, options: r, unbinds: i })
197
199
  }
198
200
  //#endregion
199
201
  //#region src/js/core/error-aria-live.ts
200
- function M(e) {
202
+ function Ne(e) {
201
203
  let t = (e.dataset.formieErrorAriaLive || "polite").trim().toLowerCase();
202
204
  return t === "assertive" || t === "off" ? t : "polite";
203
205
  }
204
- function Ae(e, t) {
206
+ function Pe(e, t) {
205
207
  return e === "off" ? null : t ? e : "polite";
206
208
  }
207
- function je(e) {
209
+ function Fe(e) {
208
210
  return e === "off" ? null : e;
209
211
  }
210
- function N(e, t) {
211
- if (t) {
212
- e.setAttribute("aria-live", t), e.setAttribute("aria-atomic", "true");
213
- return;
214
- }
215
- e.removeAttribute("aria-live"), e.removeAttribute("aria-atomic");
212
+ function Ie(e, t) {
213
+ t ? (e.setAttribute("aria-live", t), e.setAttribute("aria-atomic", "true")) : (e.removeAttribute("aria-live"), e.removeAttribute("aria-atomic"));
216
214
  }
217
215
  //#endregion
218
216
  //#region src/js/core/field-error-aria.ts
219
- function Me(e, t) {
217
+ function Le(e, t) {
220
218
  let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
221
219
  r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
222
220
  }
223
- function Ne(e, t = document) {
221
+ function Re(e, t = document) {
224
222
  let n = (e.getAttribute("aria-describedby") || "").trim();
225
223
  if (!n) return;
226
224
  let r = n.split(/\s+/).filter((e) => !!e && !!t.getElementById(e));
227
- if (r.length) {
228
- e.setAttribute("aria-describedby", r.join(" "));
229
- return;
230
- }
231
- e.removeAttribute("aria-describedby");
225
+ r.length ? e.setAttribute("aria-describedby", r.join(" ")) : e.removeAttribute("aria-describedby");
232
226
  }
233
- function Pe(e, t) {
234
- e.setAttribute("aria-errormessage", t), Me(e, t);
227
+ function P(e, t) {
228
+ e.setAttribute("aria-errormessage", t), Le(e, t);
235
229
  }
236
- function Fe(e, t = []) {
230
+ function ze(e, t = []) {
237
231
  t.forEach((t) => {
238
232
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
239
- }), !t.length && e.hasAttribute("aria-errormessage") && e.removeAttribute("aria-errormessage"), Ne(e);
240
- }
241
- function P(e) {
242
- return !!e && e.hasAttribute("data-formie-validation-skip");
233
+ }), !t.length && e.hasAttribute("aria-errormessage") && e.removeAttribute("aria-errormessage"), Re(e);
243
234
  }
244
235
  //#endregion
245
236
  //#region src/js/core/validation-focus.ts
246
- function Ie(e) {
237
+ function Be(e) {
247
238
  return Array.from(e.querySelectorAll("[data-formie-field-handle]")).find((e) => e.getAttribute("data-formie-field-has-error") === "true" || e.querySelector("[data-formie-field-error]") !== null) || null;
248
239
  }
249
- function Le(e) {
250
- return Array.from(e.querySelectorAll("[aria-invalid=\"true\"]")).find((e) => !P(e)) || (Array.from(e.querySelectorAll("input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])")).find((e) => !P(e)) ?? null);
240
+ function Ve(e) {
241
+ if (e instanceof HTMLTextAreaElement) {
242
+ let t = e.richText;
243
+ if (t) return t.content;
244
+ }
245
+ return e;
246
+ }
247
+ function He(e) {
248
+ let t = Array.from(e.querySelectorAll("[aria-invalid=\"true\"]")).find((e) => !j(e));
249
+ if (t) return Ve(t);
250
+ let n = Array.from(e.querySelectorAll("input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])")).find((e) => !j(e));
251
+ return n ? Ve(n) : null;
251
252
  }
252
- function Re(e) {
253
+ function Ue(e) {
253
254
  return e.querySelector("[data-formie-message-error], [data-formie-error-container], [data-formie-errors]");
254
255
  }
255
- function ze(e) {
256
+ function We(e) {
256
257
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
257
258
  let n = t;
258
259
  if (n.getAttribute("data-formie-field-has-error") !== "true" && n.querySelector("[data-formie-field-error]") === null) return;
259
- n.setAttribute("data-formie-field-has-error", "true"), D(n, e, "fieldLayoutError");
260
+ n.setAttribute("data-formie-field-has-error", "true"), A(n, e, "fieldLayoutError");
260
261
  let r = n.querySelector("[data-formie-field-error]")?.id || "";
261
262
  n.querySelectorAll("input, select, textarea").forEach((t) => {
262
263
  let i = t;
263
- if (P(i)) return;
264
- i.setAttribute("aria-invalid", "true"), D(i, e, "fieldControlError"), i.setAttribute("data-formie-input-has-error", "true"), r && Pe(i, r);
264
+ if (j(i)) return;
265
+ i.setAttribute("aria-invalid", "true"), A(i, e, "fieldControlError"), i.setAttribute("data-formie-input-has-error", "true"), r && P(i, r);
265
266
  let a = n.querySelector("[data-formie-instructions]");
266
- a?.id && Me(i, a.id);
267
+ a?.id && Le(i, a.id);
267
268
  });
268
269
  });
269
270
  }
270
- function Be(e) {
271
- return !!Ie(e) || !!Re(e);
271
+ function Ge(e) {
272
+ return !!Be(e) || !!Ue(e);
272
273
  }
273
- function Ve(e) {
274
- let t = Ie(e);
274
+ function F(e) {
275
+ let t = Be(e);
275
276
  if (t) {
276
- let e = Le(t);
277
+ let e = He(t);
277
278
  if (e) {
278
279
  if (e.scrollIntoView({
279
280
  behavior: "smooth",
@@ -290,7 +291,7 @@ function Ve(e) {
290
291
  block: "center"
291
292
  }), !0;
292
293
  }
293
- let n = Re(e);
294
+ let n = Ue(e);
294
295
  return n ? (n.scrollIntoView({
295
296
  behavior: "smooth",
296
297
  block: "center"
@@ -298,8 +299,8 @@ function Ve(e) {
298
299
  }
299
300
  //#endregion
300
301
  //#region src/js/transport/forms-api.ts
301
- var F = T("general", "transport");
302
- function He(e) {
302
+ var I = O("general", "transport");
303
+ function Ke(e) {
303
304
  let t = {};
304
305
  return [
305
306
  "theme",
@@ -310,7 +311,7 @@ function He(e) {
310
311
  e[n] !== void 0 && (t[n] = e[n]);
311
312
  }), t;
312
313
  }
313
- function Ue(e, t) {
314
+ function qe(e, t) {
314
315
  let n = e.success === !0, r = e.completion && typeof e.completion == "object" ? e.completion : null, i = e.payment && typeof e.payment == "object" ? e.payment : null, a = [
315
316
  "requiresAction",
316
317
  "pending",
@@ -351,36 +352,36 @@ function Ue(e, t) {
351
352
  meta: e
352
353
  };
353
354
  }
354
- async function We(e, t, n = {}, r = {}) {
355
+ async function Je(e, t, n = {}, r = {}) {
355
356
  let i = JSON.stringify({
356
357
  handle: t,
357
358
  renderOptions: n
358
359
  });
359
- F.log("requestRender start.", {
360
+ I.log("requestRender start.", {
360
361
  endpoint: e,
361
362
  handle: t
362
363
  });
363
- let a = await k(e, {
364
+ let a = await M(e, {
364
365
  ...r,
365
366
  method: "POST",
366
367
  body: i,
367
368
  headers: { "Content-Type": "application/json" }
368
369
  });
369
- return F.log("requestRender complete.", { hasHtml: !!a.html }), a;
370
+ return I.log("requestRender complete.", { hasHtml: !!a.html }), a;
370
371
  }
371
- async function Ge(e, t, n = {}, r = {}) {
372
+ async function Ye(e, t, n = {}, r = {}) {
372
373
  let i = JSON.stringify({
373
374
  query: "\nquery FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {\n formieHtmlForm(handle: $handle, input: $input) {\n html\n }\n}",
374
375
  variables: {
375
376
  handle: t,
376
- input: He(n)
377
+ input: Ke(n)
377
378
  }
378
379
  });
379
- F.log("requestGraphqlRender start.", {
380
+ I.log("requestGraphqlRender start.", {
380
381
  endpoint: e,
381
382
  handle: t
382
383
  });
383
- let a = await k(e, {
384
+ let a = await M(e, {
384
385
  ...r,
385
386
  method: "POST",
386
387
  body: i,
@@ -389,19 +390,19 @@ async function Ge(e, t, n = {}, r = {}) {
389
390
  if (Array.isArray(a.errors) && a.errors.length > 0) throw Error(a.errors.map((e) => e.message || "Unknown GraphQL error").join("; "));
390
391
  if (!a.data?.formieHtmlForm) throw Error(`Form not found for handle "${t}".`);
391
392
  let o = a.data.formieHtmlForm;
392
- return F.log("requestGraphqlRender complete.", { hasHtml: !!o.html }), o;
393
+ return I.log("requestGraphqlRender complete.", { hasHtml: !!o.html }), o;
393
394
  }
394
- async function Ke(e, t, n, r = {}, i) {
395
+ async function Xe(e, t, n, r = {}, i) {
395
396
  let a = new URL(e, window.location.origin);
396
- a.searchParams.set("handle", t), n && a.searchParams.set("renderId", n), i && a.searchParams.set("requestToken", i), F.log("requestRefreshTokens start.", {
397
+ a.searchParams.set("handle", t), n && a.searchParams.set("renderId", n), i && a.searchParams.set("requestToken", i), I.log("requestRefreshTokens start.", {
397
398
  endpoint: a.toString(),
398
399
  handle: t,
399
400
  hasRenderId: !!n
400
401
  });
401
- let o = await k(a.toString(), r);
402
- return F.log("requestRefreshTokens complete.", { hasRefreshTokens: !!o.refreshTokens }), o.refreshTokens || o;
402
+ let o = await M(a.toString(), r);
403
+ return I.log("requestRefreshTokens complete.", { hasRefreshTokens: !!o.refreshTokens }), o.refreshTokens || o;
403
404
  }
404
- async function qe(e, t, n) {
405
+ async function Ze(e, t, n) {
405
406
  let r = new URL(e, window.location.origin), i = new FormData();
406
407
  if (n && i.append("pageId", n), t) {
407
408
  [
@@ -415,14 +416,14 @@ async function qe(e, t, n) {
415
416
  ].forEach((e) => {
416
417
  let n = t.querySelector(`input[name="${e}"]`)?.value?.trim();
417
418
  n && i.append(e, n);
418
- }), ie(i, t);
419
+ }), ae(i, t);
419
420
  for (let [e, n] of new FormData(t)) e.startsWith("fields[") && i.append(e, n);
420
421
  }
421
- F.log("requestSetPage start.", {
422
+ I.log("requestSetPage start.", {
422
423
  requestUrl: r.toString(),
423
424
  pageId: n || null
424
425
  });
425
- let a = await (await ae(r.toString(), {
426
+ let a = await (await oe(r.toString(), {
426
427
  method: "POST",
427
428
  body: i,
428
429
  profile: t?.dataset.formieRequestProfile
@@ -431,9 +432,9 @@ async function qe(e, t, n) {
431
432
  let e = a.session, n = t.querySelector("input[name=\"expectedVersion\"]"), r = t.querySelector("input[name=\"requestToken\"]");
432
433
  n && (n.value = String(e.version)), r && e.tokens?.request && (r.value = e.tokens.request);
433
434
  }
434
- return F.log("requestSetPage complete.", a), a;
435
+ return I.log("requestSetPage complete.", a), a;
435
436
  }
436
- function Je(e, t) {
437
+ function Qe(e, t) {
437
438
  let n = new URL(e, window.location.origin), i = new FormData();
438
439
  [
439
440
  "handle",
@@ -443,7 +444,7 @@ function Je(e, t) {
443
444
  ].forEach((e) => {
444
445
  let n = t.querySelector(`input[name="${e}"]`)?.value?.trim();
445
446
  n && i.append(e, n);
446
- }), ie(i, t), F.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
447
+ }), ae(i, t), I.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
447
448
  try {
448
449
  if (t.dataset.formieRequestProfile !== "cross-origin-public" && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(n.toString(), i)) return;
449
450
  } catch {}
@@ -454,9 +455,9 @@ function Je(e, t) {
454
455
  headers: { Accept: "application/json" }
455
456
  }, { profile: t.dataset.formieRequestProfile });
456
457
  }
457
- async function Ye(e, t) {
458
+ async function $e(e, t) {
458
459
  let n = (e.getAttribute("method") || "POST").toUpperCase(), i = e.getAttribute("action") || window.location.href, a = e.dataset.formieErrorMessage?.trim() || "Submission failed.";
459
- F.log("submitForm start.", {
460
+ I.log("submitForm start.", {
460
461
  method: n,
461
462
  action: i,
462
463
  submitAction: t.get("submitAction")
@@ -466,13 +467,13 @@ async function Ye(e, t) {
466
467
  body: t,
467
468
  headers: { Accept: "application/json" }
468
469
  }, { profile: e.dataset.formieRequestProfile }), s = o.headers.get("content-type") || "";
469
- if (!s.includes("application/json")) return o.ok ? (F.log("submitForm non-JSON success response.", {
470
+ if (!s.includes("application/json")) return o.ok ? (I.log("submitForm non-JSON success response.", {
470
471
  status: o.status,
471
472
  contentType: s
472
473
  }), {
473
474
  ok: !0,
474
475
  message: "Submission completed."
475
- }) : (F.warn("submitForm non-JSON HTTP error.", {
476
+ }) : (I.warn("submitForm non-JSON HTTP error.", {
476
477
  status: o.status,
477
478
  contentType: s
478
479
  }), {
@@ -481,8 +482,8 @@ async function Ye(e, t) {
481
482
  message: `Request failed (${o.status}).`,
482
483
  formErrors: [`Request failed (${o.status}).`]
483
484
  });
484
- let c = Ue(await o.json(), a);
485
- return F.log("submitForm JSON response normalized.", {
485
+ let c = qe(await o.json(), a);
486
+ return I.log("submitForm JSON response normalized.", {
486
487
  ok: c.ok,
487
488
  code: c.code,
488
489
  hasRedirect: !!c.redirect?.url,
@@ -491,20 +492,20 @@ async function Ye(e, t) {
491
492
  }
492
493
  //#endregion
493
494
  //#region src/js/submit/pipeline.ts
494
- var Xe = [
495
+ var et = [
495
496
  "prepare",
496
497
  "validate",
497
498
  "challenge",
498
499
  "payment",
499
500
  "send",
500
501
  "result"
501
- ], Ze = [
502
+ ], tt = [
502
503
  "prepare",
503
504
  "validate",
504
505
  "challenge",
505
506
  "payment"
506
- ], I = T("general", "pipeline");
507
- function Qe(e, t) {
507
+ ], L = O("general", "pipeline");
508
+ function nt(e, t) {
508
509
  return {
509
510
  ok: !1,
510
511
  stage: e,
@@ -513,13 +514,13 @@ function Qe(e, t) {
513
514
  formErrors: [t || "Submission aborted."]
514
515
  };
515
516
  }
516
- function $e(e) {
517
+ function rt(e) {
517
518
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
518
519
  }
519
- function et(e) {
520
+ function it(e) {
520
521
  return !(!e.name || e.disabled || e instanceof HTMLInputElement && (e.type === "submit" || e.type === "button" || e.type === "reset" || e.type === "image" || (e.type === "checkbox" || e.type === "radio") && !e.checked || e.type === "file" && (!e.files || e.files.length === 0)));
521
522
  }
522
- function tt(e, t) {
523
+ function at(e, t) {
523
524
  if (t instanceof HTMLInputElement) {
524
525
  if (t.type === "file") {
525
526
  Array.from(t.files || []).forEach((n) => {
@@ -528,63 +529,57 @@ function tt(e, t) {
528
529
  return;
529
530
  }
530
531
  e.append(t.name, t.value);
531
- return;
532
- }
533
- if (t instanceof HTMLSelectElement && t.multiple) {
534
- Array.from(t.selectedOptions).forEach((n) => {
535
- e.append(t.name, n.value);
536
- });
537
- return;
538
- }
539
- e.append(t.name, t.value);
532
+ } else t instanceof HTMLSelectElement && t.multiple ? Array.from(t.selectedOptions).forEach((n) => {
533
+ e.append(t.name, n.value);
534
+ }) : e.append(t.name, t.value);
540
535
  }
541
- function nt(e, t) {
536
+ function ot(e, t) {
542
537
  t.querySelectorAll("input, select, textarea").forEach((t) => {
543
- let n = $e(t) ? t : null;
544
- n && !n.closest("[data-formie-page]") && et(n) && tt(e, n);
538
+ let n = rt(t) ? t : null;
539
+ n && !n.closest("[data-formie-page]") && it(n) && at(e, n);
545
540
  });
546
541
  }
547
- function rt(e, t) {
542
+ function st(e, t) {
548
543
  let n = /* @__PURE__ */ new Set();
549
544
  return t.querySelectorAll("input, select, textarea").forEach((t) => {
550
- let r = $e(t) ? t : null;
551
- r && r.name && !r.disabled && (r instanceof HTMLInputElement && (r.type === "submit" || r.type === "button" || r.type === "reset" || r.type === "image") || (r.name.startsWith("fields[") && n.add(r.name), et(r) && tt(e, r)));
545
+ let r = rt(t) ? t : null;
546
+ r && r.name && !r.disabled && (r instanceof HTMLInputElement && (r.type === "submit" || r.type === "button" || r.type === "reset" || r.type === "image") || (r.name.startsWith("fields[") && n.add(r.name), it(r) && at(e, r)));
552
547
  }), n;
553
548
  }
554
- function it(e, t) {
549
+ function ct(e, t) {
555
550
  t.forEach((t) => {
556
551
  e.has(t) || e.append(t, "");
557
552
  });
558
553
  }
559
- function at(e, t) {
560
- let n = f(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
554
+ function lt(e, t) {
555
+ let n = T(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
561
556
  if (!n.length || !r) {
562
557
  let n = new FormData(e);
563
558
  return n.set("submitAction", t), n;
564
559
  }
565
560
  let i = new FormData();
566
- return nt(i, e), it(i, rt(i, r)), i.set("submitAction", t), i;
561
+ return ot(i, e), ct(i, st(i, r)), i.set("submitAction", t), i;
567
562
  }
568
- function ot(e, t) {
563
+ function ut(e, t) {
569
564
  if (t !== "submit") return !1;
570
- let n = f(e);
565
+ let n = T(e);
571
566
  return !n.length || (n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || n[n.length - 1]) === n[n.length - 1];
572
567
  }
573
- async function st(e, t, n, r = {}) {
574
- I.log("Starting submit pipeline.", {
568
+ async function dt(e, t, n, r = {}) {
569
+ L.log("Starting submit pipeline.", {
575
570
  action: t,
576
571
  preflightOnly: r.preflightOnly === !0
577
572
  });
578
- let i = !1, a, o = null, s = ot(e, t), c = {
573
+ let i = !1, a, o = null, s = ut(e, t), c = d(e, {
579
574
  form: e,
580
575
  action: t,
581
- formData: at(e, t),
576
+ formData: lt(e, t),
582
577
  abort: (e) => {
583
- i = !0, a = e, I.warn("Pipeline aborted.", { reason: e });
578
+ i = !0, a = e, L.warn("Pipeline aborted.", { reason: e });
584
579
  },
585
580
  isAborted: () => i,
586
581
  abortReason: () => a
587
- }, l = {
582
+ }), l = (t, r) => n.emitSafe(t, d(e, r)), u = {
588
583
  prepare: async (e) => {
589
584
  let t = e.form.querySelector("input[name=\"submitAction\"]");
590
585
  return t && (t.value = e.action), e.formData.set("submitAction", e.action), null;
@@ -592,7 +587,7 @@ async function st(e, t, n, r = {}) {
592
587
  validate: async (e) => {
593
588
  if (e.action !== "submit" || r.validateOnSubmit === !1) return null;
594
589
  if (r.validator) {
595
- let { scope: t, final: n } = g(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
590
+ let { scope: t, final: n } = m(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
596
591
  if (i.length > 0) {
597
592
  let e = i[0]?.input;
598
593
  if (e) {
@@ -628,68 +623,68 @@ async function st(e, t, n, r = {}) {
628
623
  challenge: async () => null,
629
624
  payment: async () => null,
630
625
  send: async (e) => {
631
- e.formData = at(e.form, e.action);
632
- let t = await Ye(e.form, e.formData);
626
+ e.formData = lt(e.form, e.action);
627
+ let t = await $e(e.form, e.formData);
633
628
  return o = t, t;
634
629
  },
635
630
  result: async (e) => (o && o.ok && o.redirect?.url && (o.redirect.target === "new-tab" ? window.open(o.redirect.url, "_blank", "noopener,noreferrer") : (e.form.setAttribute("data-formie-internal-navigation", "redirect"), window.location.href = o.redirect.url)), null)
636
631
  };
637
632
  {
638
633
  let e = await n.emitSafe("formie:submit:before", c);
639
- e.failed.length > 0 && I.warn("Submit before listeners failed.", {
634
+ e.failed.length > 0 && L.warn("Submit before listeners failed.", {
640
635
  eventName: e.eventName,
641
636
  failed: e.failed.length
642
637
  });
643
638
  }
644
639
  if (s) {
645
640
  let e = await n.emitSafe("formie:submit:final:before", c);
646
- e.failed.length > 0 && I.warn("Final submit before listeners failed.", {
641
+ e.failed.length > 0 && L.warn("Final submit before listeners failed.", {
647
642
  eventName: e.eventName,
648
643
  failed: e.failed.length
649
644
  });
650
645
  }
651
- let u = r.preflightOnly ? Ze : Xe;
652
- for (let e of u) {
653
- if (I.log("Stage start.", {
646
+ let f = r.preflightOnly ? tt : et;
647
+ for (let e of f) {
648
+ if (L.log("Stage start.", {
654
649
  stage: e,
655
650
  action: t
656
- }), i) return I.warn("Stage skipped due to abort.", {
651
+ }), i) return L.warn("Stage skipped due to abort.", {
657
652
  stage: e,
658
653
  reason: a
659
- }), Qe(e, a);
654
+ }), nt(e, a);
660
655
  {
661
656
  let t = await n.emitSafe(`formie:stage:${e}:before`, {
662
657
  ...c,
663
658
  stage: e
664
659
  });
665
- t.failed.length > 0 && I.warn("Stage before listeners failed.", {
660
+ t.failed.length > 0 && L.warn("Stage before listeners failed.", {
666
661
  stage: e,
667
662
  failed: t.failed.length
668
663
  });
669
664
  }
670
665
  if (i) {
671
- let t = Qe(e, a);
666
+ let t = nt(e, a);
672
667
  {
673
- let r = await n.emitSafe("formie:submit:after", t);
674
- r.failed.length > 0 && I.warn("Submit after listeners failed (abort before stage).", {
668
+ let n = await l("formie:submit:after", t);
669
+ n.failed.length > 0 && L.warn("Submit after listeners failed (abort before stage).", {
675
670
  stage: e,
676
- failed: r.failed.length
671
+ failed: n.failed.length
677
672
  });
678
673
  }
679
674
  if (s) {
680
- let r = await n.emitSafe("formie:submit:final:after", t);
681
- r.failed.length > 0 && I.warn("Final submit after listeners failed (abort before stage).", {
675
+ let n = await l("formie:submit:final:after", t);
676
+ n.failed.length > 0 && L.warn("Final submit after listeners failed (abort before stage).", {
682
677
  stage: e,
683
- failed: r.failed.length
678
+ failed: n.failed.length
684
679
  });
685
680
  }
686
- return I.warn("Aborted after stage before-hooks.", {
681
+ return L.warn("Aborted after stage before-hooks.", {
687
682
  stage: e,
688
683
  reason: a
689
684
  }), t;
690
685
  }
691
- let r = await l[e](c);
692
- I.log("Stage runner complete.", {
686
+ let r = await u[e](c);
687
+ L.log("Stage runner complete.", {
693
688
  stage: e,
694
689
  hasResult: !!r,
695
690
  ok: r ? r.ok : void 0,
@@ -701,291 +696,302 @@ async function st(e, t, n, r = {}) {
701
696
  stage: e,
702
697
  result: r
703
698
  });
704
- t.failed.length > 0 && I.warn("Stage after listeners failed.", {
699
+ t.failed.length > 0 && L.warn("Stage after listeners failed.", {
705
700
  stage: e,
706
701
  failed: t.failed.length
707
702
  });
708
703
  }
709
704
  if (i) {
710
- let t = Qe(e, a);
705
+ let t = nt(e, a);
711
706
  {
712
- let r = await n.emitSafe("formie:submit:after", t);
713
- r.failed.length > 0 && I.warn("Submit after listeners failed (abort after stage).", {
707
+ let n = await l("formie:submit:after", t);
708
+ n.failed.length > 0 && L.warn("Submit after listeners failed (abort after stage).", {
714
709
  stage: e,
715
- failed: r.failed.length
710
+ failed: n.failed.length
716
711
  });
717
712
  }
718
713
  if (s) {
719
- let r = await n.emitSafe("formie:submit:final:after", t);
720
- r.failed.length > 0 && I.warn("Final submit after listeners failed (abort after stage).", {
714
+ let n = await l("formie:submit:final:after", t);
715
+ n.failed.length > 0 && L.warn("Final submit after listeners failed (abort after stage).", {
721
716
  stage: e,
722
- failed: r.failed.length
717
+ failed: n.failed.length
723
718
  });
724
719
  }
725
- return I.warn("Aborted after stage after-hooks.", {
720
+ return L.warn("Aborted after stage after-hooks.", {
726
721
  stage: e,
727
722
  reason: a
728
723
  }), t;
729
724
  }
730
725
  if (r && !r.ok) {
731
726
  {
732
- let t = await n.emitSafe("formie:submit:after", r);
733
- t.failed.length > 0 && I.warn("Submit after listeners failed (failed stage).", {
727
+ let t = await l("formie:submit:after", r);
728
+ t.failed.length > 0 && L.warn("Submit after listeners failed (failed stage).", {
734
729
  stage: e,
735
730
  failed: t.failed.length
736
731
  });
737
732
  }
738
733
  if (s) {
739
- let t = await n.emitSafe("formie:submit:final:after", r);
740
- t.failed.length > 0 && I.warn("Final submit after listeners failed (failed stage).", {
734
+ let t = await l("formie:submit:final:after", r);
735
+ t.failed.length > 0 && L.warn("Final submit after listeners failed (failed stage).", {
741
736
  stage: e,
742
737
  failed: t.failed.length
743
738
  });
744
739
  }
745
- return I.warn("Pipeline short-circuited by failed stage.", {
740
+ return L.warn("Pipeline short-circuited by failed stage.", {
746
741
  stage: e,
747
742
  code: r.code,
748
743
  message: r.message
749
744
  }), r;
750
745
  }
751
746
  }
752
- let d = o || {
747
+ let p = o || {
753
748
  ok: !0,
754
749
  stage: r.preflightOnly ? "payment" : "result",
755
750
  code: r.preflightOnly ? "PREFLIGHT_COMPLETE" : void 0,
756
751
  message: r.preflightOnly ? "Submission preflight completed." : "Submission completed."
757
752
  };
758
753
  {
759
- let e = await n.emitSafe("formie:submit:after", d);
760
- e.failed.length > 0 && I.warn("Submit after listeners failed (success).", { failed: e.failed.length });
754
+ let e = await l("formie:submit:after", p);
755
+ e.failed.length > 0 && L.warn("Submit after listeners failed (success).", { failed: e.failed.length });
761
756
  }
762
757
  if (s) {
763
- let e = await n.emitSafe("formie:submit:final:after", d);
764
- e.failed.length > 0 && I.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
758
+ let e = await l("formie:submit:final:after", p);
759
+ e.failed.length > 0 && L.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
765
760
  }
766
- return I.log("Pipeline completed.", {
767
- ok: d.ok,
768
- stage: d.stage,
769
- code: d.code
770
- }), d;
761
+ return L.log("Pipeline completed.", {
762
+ ok: p.ok,
763
+ stage: p.stage,
764
+ code: p.code
765
+ }), p;
771
766
  }
772
767
  //#endregion
773
768
  //#region src/js/core/field-error-container.ts
774
- function ct(e) {
769
+ function ft(e) {
775
770
  return e.querySelector("[data-formie-field-layout]")?.getAttribute("data-formie-error-position")?.trim() === "above" ? "above" : "below";
776
771
  }
777
- function lt(e, t) {
772
+ function pt(e, t) {
778
773
  let n = e.querySelector("[data-formie-field-errors]");
779
774
  if (n) return n;
780
- let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = ct(e), o = document.createElement("div");
775
+ let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = ft(e), o = document.createElement("div");
781
776
  return o.setAttribute("data-formie-field-errors", "true"), t?.(o), r && i ? a === "above" ? r.insertBefore(o, i) : r.appendChild(o) : e.appendChild(o), o;
782
777
  }
783
778
  //#endregion
784
779
  //#region src/js/core/submit-result-ui.ts
785
- var L = /* @__PURE__ */ new WeakMap();
786
- function ut(e) {
780
+ var R = /* @__PURE__ */ new WeakMap();
781
+ function mt(e) {
787
782
  return (e.dataset.formieCompletionBehavior || e.dataset.formieSubmitAction || "").trim();
788
783
  }
789
- function dt(e) {
784
+ function ht(e) {
790
785
  return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
791
786
  }
792
- function ft(e) {
787
+ function gt(e) {
793
788
  return (e.dataset.formieSuccessMessagePosition || e.dataset.formieSubmitActionMessagePosition || "").trim();
794
789
  }
795
- function pt(e) {
790
+ function _t(e) {
796
791
  let t = (e.dataset.formieSuccessMessageTimeout || e.dataset.formieSubmitActionMessageTimeout || "").trim();
797
792
  if (!t) return null;
798
793
  let n = Number.parseFloat(t);
799
794
  return !Number.isFinite(n) || n < 0 ? null : Math.round(n * 1e3);
800
795
  }
801
- function mt(e) {
796
+ function vt(e) {
802
797
  let t = e.dataset.formieHideFormAfterSubmit ?? e.dataset.formieSubmitActionFormHide;
803
798
  if (t === void 0) return !1;
804
799
  let n = t.trim().toLowerCase();
805
800
  return n === "true" || n === "1" || n === "";
806
801
  }
807
- function ht(e) {
808
- let t = L.get(e);
809
- typeof t == "number" && (window.clearTimeout(t), L.delete(e));
802
+ function yt(e) {
803
+ let t = R.get(e);
804
+ typeof t == "number" && (window.clearTimeout(t), R.delete(e));
810
805
  }
811
- function gt(e) {
806
+ function bt(e) {
812
807
  return e.querySelector("[data-formie-form-messages-top]") || e;
813
808
  }
814
- function _t(e) {
809
+ function xt(e) {
815
810
  return e.querySelector("[data-formie-form-messages-bottom]") || e;
816
811
  }
817
- function vt(e, t) {
818
- return t === "bottom-form" ? _t(e) : gt(e);
812
+ function St(e, t) {
813
+ return t === "bottom-form" ? xt(e) : bt(e);
819
814
  }
820
- function yt(e, t) {
821
- return t === "top-form" ? gt(e) : t === "bottom-form" && !mt(e) ? _t(e) : e;
815
+ function Ct(e, t) {
816
+ return t === "top-form" ? bt(e) : t === "bottom-form" && !vt(e) ? xt(e) : e;
822
817
  }
823
- function bt(e) {
824
- let t = dt(e), n = vt(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
825
- return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), D(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
818
+ function wt(e) {
819
+ let t = ht(e), n = St(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
820
+ return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), A(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
826
821
  }
827
- function xt(e, t) {
822
+ function Tt(e, t) {
828
823
  let n = t.querySelector("[data-formie-error-message-container], [data-formie-message][data-formie-message-error]");
829
- return n || (n = document.createElement("div"), n.setAttribute("data-formie-error-message-container", "true"), t.appendChild(n)), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-error", "true"), D(n, e, "message", "messageError"), n.setAttribute("role", "alert"), N(n, je(M(e))), n;
824
+ return n || (n = document.createElement("div"), n.setAttribute("data-formie-error-message-container", "true"), t.appendChild(n)), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-error", "true"), A(n, e, "message", "messageError"), n.setAttribute("role", "alert"), Ie(n, Fe(Ne(e))), n;
830
825
  }
831
- function St(e, t) {
832
- let n = e.querySelector("[data-formie-success-container]"), r = yt(e, t);
833
- return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), D(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
826
+ function Et(e, t) {
827
+ let n = e.querySelector("[data-formie-success-container]"), r = Ct(e, t);
828
+ return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), A(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
834
829
  }
835
- function Ct(e) {
836
- return lt(e, (t) => {
837
- D(t, e, "fieldErrors");
830
+ function Dt(e) {
831
+ return pt(e, (t) => {
832
+ A(t, e, "fieldErrors");
838
833
  });
839
834
  }
840
- function wt(e) {
835
+ function Ot(e) {
841
836
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
842
837
  let n = t, r = n.querySelector("[data-formie-field-errors]"), i = Array.from(n.querySelectorAll("[data-formie-field-error]")).map((e) => e.id).filter(Boolean);
843
- E(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
838
+ k(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
844
839
  e.remove();
845
840
  }), r && !r.querySelector("[data-formie-field-error]") && (r.innerHTML = ""), n.querySelectorAll("input, select, textarea").forEach((t) => {
846
841
  let n = t;
847
- n.removeAttribute("aria-invalid"), E(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), Fe(n, i);
842
+ n.removeAttribute("aria-invalid"), k(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), ze(n, i);
848
843
  });
849
- }), C(e);
844
+ }), h(e);
850
845
  }
851
- function Tt(e) {
846
+ function kt(e) {
852
847
  e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
853
848
  let n = t;
854
849
  n.querySelectorAll("[data-formie-error]").forEach((e) => {
855
850
  e.remove();
856
- }), E(n, e, "message", "messageError"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-error"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-error]") || (n.innerHTML = "");
851
+ }), k(n, e, "message", "messageError"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-error"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-error]") || (n.innerHTML = "");
857
852
  });
858
853
  }
859
- function Et(e) {
860
- ht(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
854
+ function At(e) {
855
+ yt(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
861
856
  e.remove();
862
857
  }), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
863
858
  let n = t;
864
859
  n.querySelectorAll("[data-formie-success]").forEach((e) => {
865
860
  e.remove();
866
- }), E(n, e, "message", "messageSuccess"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-success"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-success]") || (n.innerHTML = "");
867
- }), ut(e) === "message" && mt(e) || d(e, !1);
861
+ }), k(n, e, "message", "messageSuccess"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-success"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-success]") || (n.innerHTML = "");
862
+ }), mt(e) === "message" && vt(e) || b(e, !1);
868
863
  }
869
- function Dt(e) {
864
+ function jt(e) {
870
865
  e.querySelectorAll("[aria-invalid=\"true\"]").forEach((e) => {
871
866
  e.removeAttribute("aria-invalid");
872
867
  });
873
868
  }
874
- function Ot(e, t) {
875
- let n = je(M(e));
869
+ function Mt(e, t) {
870
+ let n = Fe(Ne(e));
876
871
  Object.entries(t).forEach(([t, r]) => {
877
872
  let i = `fields[${t.split(".").join("][")}]`, a = e.querySelector(`[name="${CSS.escape(i)}"], [name="${CSS.escape(i + "[]")}"]`)?.closest("[data-formie-field-handle]") || e.querySelector(`[data-formie-field-handle="${CSS.escape(t)}"]`);
878
873
  if (!a) return;
879
- let o = Ct(a), s = o.id && o.id.trim() ? o.id : `${t}-errors`;
880
- o.id = s, N(o, n), D(a, e, "fieldLayoutError"), a.setAttribute("data-formie-field-has-error", "true"), r.forEach((t, n) => {
874
+ let o = Dt(a), s = o.id && o.id.trim() ? o.id : `${t}-errors`;
875
+ o.id = s, Ie(o, n), A(a, e, "fieldLayoutError"), a.setAttribute("data-formie-field-has-error", "true"), r.forEach((t, n) => {
881
876
  let r = document.createElement("div");
882
- r.setAttribute("data-formie-field-error", "true"), r.id = `${s}-${n + 1}`, D(r, e, "fieldError"), r.textContent = t, o.appendChild(r);
877
+ r.setAttribute("data-formie-field-error", "true"), r.id = `${s}-${n + 1}`, A(r, e, "fieldError"), r.textContent = t, o.appendChild(r);
883
878
  });
884
879
  let c = o.querySelector("[data-formie-field-error]")?.id;
885
880
  a.querySelectorAll("input, select, textarea").forEach((t) => {
886
881
  let n = t;
887
- n.setAttribute("aria-invalid", "true"), D(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), c && Pe(n, c);
882
+ n.setAttribute("aria-invalid", "true"), A(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), c && P(n, c);
888
883
  let r = a.querySelector("[data-formie-instructions]");
889
- r?.id && Me(n, r.id);
884
+ r?.id && Le(n, r.id);
890
885
  });
891
- }), C(e);
886
+ }), h(e);
892
887
  }
893
- function kt(e, t) {
894
- let n = bt(e), r = xt(e, n);
895
- D(n, e, "errors"), t.forEach((t) => {
888
+ function Nt(e, t) {
889
+ let n = wt(e), r = Tt(e, n);
890
+ A(n, e, "errors"), t.forEach((t) => {
896
891
  let n = document.createElement("div");
897
- n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), D(n, e, "error"), n.innerHTML = t, r.appendChild(n);
892
+ n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), A(n, e, "error"), n.innerHTML = t, r.appendChild(n);
898
893
  });
899
894
  }
900
- function At(e) {
895
+ function Pt(e) {
901
896
  if (e.ok || e.keepSubmitLoading !== !0) return !1;
902
897
  let t = e.payment?.status;
903
898
  return t === "requiresAction" || t === "pending" || t === "unknown";
904
899
  }
905
- function jt(e, t) {
906
- let n = bt(e), r = xt(e, n);
907
- D(n, e, "errors");
900
+ function Ft(e, t) {
901
+ let n = wt(e), r = Tt(e, n);
902
+ A(n, e, "errors");
908
903
  let i = document.createElement("div");
909
- i.setAttribute("data-formie-notice", "true"), i.setAttribute("role", "status"), D(i, e, "message"), i.textContent = t, r.appendChild(i);
904
+ i.setAttribute("data-formie-notice", "true"), i.setAttribute("role", "status"), A(i, e, "message"), i.textContent = t, r.appendChild(i);
910
905
  }
911
- function Mt(e, t) {
912
- return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" || ut(e) === "message" && ft(e) !== "";
906
+ function It(e, t) {
907
+ return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" || mt(e) === "message" && gt(e) !== "";
913
908
  }
914
- function Nt(e, t) {
915
- let n = ft(e);
916
- if (!n) return;
917
- let r = St(e, n);
918
- D(r, e, "message", "messageSuccess"), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-success", "true"), r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true");
919
- let i = document.createElement("div");
920
- i.setAttribute("data-formie-success", "true"), D(i, e, "success"), i.innerHTML = t, r.appendChild(i), mt(e) && d(e, !0);
921
- let a = pt(e);
922
- if (a !== null) {
909
+ function Lt(e, t, n = {}) {
910
+ let r = gt(e);
911
+ if (!r) return;
912
+ let i = Et(e, r);
913
+ A(i, e, "message", "messageSuccess"), i.setAttribute("data-formie-message", "true"), i.setAttribute("data-formie-message-success", "true"), i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true");
914
+ let a = document.createElement("div");
915
+ a.setAttribute("data-formie-success", "true"), A(a, e, "success"), a.innerHTML = t, i.appendChild(a), n.hideForm !== !1 && vt(e) && b(e, !0);
916
+ let o = e.dataset.formieScrollToTop?.trim().toLowerCase();
917
+ o !== void 0 && [
918
+ "",
919
+ "true",
920
+ "1"
921
+ ].includes(o) && i.scrollIntoView({
922
+ behavior: "smooth",
923
+ block: "start"
924
+ });
925
+ let s = _t(e);
926
+ if (s !== null) {
923
927
  let t = window.setTimeout(() => {
924
- L.delete(e), Et(e);
925
- }, a);
926
- L.set(e, t);
927
- }
928
- }
929
- function R(e, t) {
930
- if (wt(e), Tt(e), Et(e), Dt(e), t.ok) {
931
- Mt(e, t) && Nt(e, t.message || "");
932
- return;
933
- }
934
- if (!t.ok) {
935
- if (At(t)) {
928
+ R.delete(e), At(e);
929
+ }, s);
930
+ R.set(e, t);
931
+ }
932
+ }
933
+ function z(e, t) {
934
+ if (Ot(e), kt(e), At(e), jt(e), t.ok) {
935
+ let n = t.meta?.summaryTokens;
936
+ n && typeof n == "object" && e.querySelectorAll("[data-formie-field-uid]").forEach((e) => {
937
+ let t = n[e.dataset.formieFieldUid || ""];
938
+ typeof t == "string" && t && e.querySelector("[data-formie-summary-container]")?.setAttribute("data-formie-summary-token", t);
939
+ }), It(e, t) && Lt(e, t.message || "", { hideForm: t.action !== "save" });
940
+ } else if (!t.ok) {
941
+ if (Pt(t)) {
936
942
  let n = String(t.payment?.message || "").trim();
937
- n && jt(e, n);
943
+ n && Ft(e, n);
938
944
  return;
939
945
  }
940
- t.fieldErrors && Ot(e, t.fieldErrors), t.formErrors?.length ? kt(e, t.formErrors) : !t.fieldErrors && t.message && kt(e, [t.message]), Ve(e);
946
+ t.fieldErrors && Mt(e, t.fieldErrors), t.formErrors?.length ? Nt(e, t.formErrors) : !t.fieldErrors && t.message && Nt(e, [t.message]), F(e);
941
947
  }
942
948
  }
943
949
  //#endregion
944
950
  //#region src/js/core/submit-flow.ts
945
- var Pt = T("general", "submit-flow");
946
- function Ft(e) {
951
+ var Rt = O("general", "submit-flow");
952
+ function zt(e) {
947
953
  return !(!e.ok && e.stage === "validate");
948
954
  }
949
- function It(e) {
955
+ function Bt(e) {
950
956
  return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
951
957
  }
952
- function z(e) {
953
- wt(e), Tt(e), Et(e), Dt(e);
958
+ function Vt(e) {
959
+ Ot(e), kt(e), At(e), jt(e);
954
960
  }
955
- async function Lt(e) {
961
+ async function Ht(e) {
956
962
  let { id: t, target: n, form: r, bus: i, validator: a, validateOnSubmit: o, action: s, submitter: c, waitForSubmitDelay: l, onRefreshTokensAfterSubmit: u, dispatchSubmitResult: d } = e;
957
- z(r), v(r, c || null);
958
- let f = {
963
+ Vt(r), C(r, c || null);
964
+ let p = {
959
965
  ok: !1,
960
966
  code: "SUBMIT_ERROR",
961
967
  message: "Submission failed.",
962
968
  formErrors: ["Submission failed."]
963
969
  };
964
970
  try {
965
- await l(r), f = await st(r, s, i, {
971
+ await l(r), p = await dt(r, s, i, {
966
972
  validator: a,
967
973
  validateOnSubmit: o
968
- }), R(r, f), d(f), b(r, f, s), Ft(f) && await u(f);
974
+ }), z(r, p), d(p), v(r, p, s), zt(p) && await u(p);
969
975
  } catch (e) {
970
- f = {
976
+ p = {
971
977
  ok: !1,
972
978
  code: "SUBMIT_ERROR",
973
979
  message: e instanceof Error ? e.message : "Submission failed.",
974
980
  formErrors: [e instanceof Error ? e.message : "Submission failed."]
975
- }, R(r, f), d(f), Pt.warn("Submit failed with exception.", {
981
+ }, z(r, p), d(p), Rt.warn("Submit failed with exception.", {
976
982
  id: t,
977
983
  action: s,
978
984
  target: n,
979
985
  error: e instanceof Error ? e.message : e
980
986
  });
981
987
  } finally {
982
- It(f) || h(r);
988
+ Bt(p) || f(r);
983
989
  }
984
- return f;
990
+ return p;
985
991
  }
986
992
  //#endregion
987
993
  //#region src/js/events/event-bus.ts
988
- var Rt = class {
994
+ var Ut = class {
989
995
  listeners = /* @__PURE__ */ new Map();
990
996
  on(e, t) {
991
997
  return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e)?.add(t), () => {
@@ -1026,11 +1032,7 @@ var Rt = class {
1026
1032
  failed: []
1027
1033
  };
1028
1034
  return !n || n.size === 0 || (await Promise.allSettled(Array.from(n).map(async (e) => e(t)))).forEach((e, t) => {
1029
- if (e.status === "fulfilled") {
1030
- r.succeeded += 1;
1031
- return;
1032
- }
1033
- r.failed.push({
1035
+ e.status === "fulfilled" ? r.succeeded += 1 : r.failed.push({
1034
1036
  index: t,
1035
1037
  error: e.reason
1036
1038
  });
@@ -1065,66 +1067,66 @@ var Rt = class {
1065
1067
  getAll() {
1066
1068
  return Array.from(this.modules.values());
1067
1069
  }
1068
- }, zt = new B(), Bt = {
1069
- "address-finder": () => import("./chunks/address-finder-O49uDRoR.js").then((e) => e.addressFinderModule),
1070
- "google-address": () => import("./chunks/google-address-C1P1nTDM.js").then((e) => e.googleAddressModule),
1071
- loqate: () => import("./chunks/loqate-DD1S7PY9.js").then((e) => e.loqateModule),
1072
- "place-kit": () => import("./chunks/place-kit-BE5gi3vo.js").then((e) => e.placeKitModule)
1073
- }, Vt = {
1074
- "captcha-eu": () => import("./chunks/captcha-eu-DERJbXnH.js").then((e) => e.captchaEuModule),
1075
- "friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-GFqCt1Mh.js").then((e) => e.friendlyCaptchaV1Module),
1076
- "friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-WoW246JG.js").then((e) => e.friendlyCaptchaV2Module),
1077
- hcaptcha: () => import("./chunks/hcaptcha-D0T8aIHz.js").then((e) => e.hcaptchaModule),
1078
- "recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-CruXddZq.js").then((e) => e.recaptchaEnterpriseModule),
1079
- "recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-CCnJYCnG.js").then((e) => e.recaptchaV2CheckboxModule),
1080
- "recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-BuVqRRYn.js").then((e) => e.recaptchaV2InvisibleModule),
1081
- "recaptcha-v3": () => import("./chunks/recaptcha-v3-CloqhO2A.js").then((e) => e.recaptchaV3Module),
1082
- snaptcha: () => import("./chunks/snaptcha-C04kNGYQ.js").then((e) => e.snaptchaModule),
1083
- turnstile: () => import("./chunks/turnstile-n9DNyPxi.js").then((e) => e.turnstileModule)
1084
- }, Ht = {
1085
- calculations: () => import("./chunks/calculations-YEoVCG2q.js").then((e) => e.calculationsModule),
1086
- "checkbox-radio": () => import("./chunks/checkbox-radio-gsm8QPJg.js").then((e) => e.checkboxRadioModule),
1087
- combobox: () => import("./chunks/combobox-CWNdx4Fk.js").then((e) => e.comboboxModule),
1088
- conditions: () => import("./chunks/conditions-DqNHLTbN.js").then((e) => e.conditionsModule),
1089
- "custom-google-maps": () => import("./chunks/custom-google-maps-C4l2S3GO.js").then((e) => e.customGoogleMapsModule),
1090
- "custom-link": () => import("./chunks/custom-link-CLazgKYH.js").then((e) => e.customLinkModule),
1091
- "custom-maps": () => import("./chunks/custom-maps-DqcAlD0v.js").then((e) => e.customMapsModule),
1092
- "date-picker": () => import("./chunks/date-picker-RUnevF7l.js").then((e) => e.datePickerModule),
1093
- "file-upload": () => import("./chunks/file-upload-Bm-TXyNB.js").then((e) => e.fileUploadModule),
1094
- "upload-manager": () => import("./chunks/upload-manager-BbiUosZq.js").then((e) => e.uploadManagerModule),
1095
- hidden: () => import("./chunks/hidden-BZhXnNPe.js").then((e) => e.hiddenModule),
1096
- "phone-country": () => import("./chunks/phone-country-bAqje17P.js").then((e) => e.phoneCountryModule),
1097
- "password-validation": () => import("./chunks/password-validation-C8_uO_c_.js").then((e) => e.passwordValidationModule),
1098
- "address-country": () => import("./chunks/address-country-Dn71jroa.js").then((e) => e.addressCountryModule),
1099
- "address-state": () => import("./chunks/address-state-ByYatUur.js").then((e) => e.addressStateModule),
1100
- repeater: () => import("./chunks/repeater-DwE27jI1.js").then((e) => e.repeaterModule),
1101
- "rich-text": () => import("./chunks/rich-text-uV4o_pGk.js").then((e) => e.richTextModule),
1102
- signature: () => import("./chunks/signature-7cldFbqj.js").then((e) => e.signatureModule),
1103
- summary: () => import("./chunks/summary-BF_8mrXI.js").then((e) => e.summaryModule),
1104
- "survey-likert": () => import("./chunks/survey-likert-fk1hUPff.js").then((e) => e.surveyLikertModule),
1105
- "survey-rank": () => import("./chunks/survey-rank-BsLGl2LX.js").then((e) => e.surveyRankModule),
1106
- "survey-rating": () => import("./chunks/survey-rating-DVS6e6fM.js").then((e) => e.surveyRatingModule),
1107
- table: () => import("./chunks/table-DnIBdeKF.js").then((e) => e.tableModule),
1108
- "text-limit": () => import("./chunks/text-limit-LGMPhFuC.js").then((e) => e.textLimitModule)
1109
- }, Ut = {
1110
- bpoint: () => import("./chunks/bpoint-D0RKFM4F.js").then((e) => e.bpointModule),
1111
- eway: () => import("./chunks/eway-or6dtjoT.js").then((e) => e.ewayModule),
1112
- "go-cardless": () => import("./chunks/go-cardless-DzJ-0FKg.js").then((e) => e.goCardlessModule),
1113
- mollie: () => import("./chunks/mollie-DG8Ju83x.js").then((e) => e.mollieModule),
1114
- moneris: () => import("./chunks/moneris-C8m3Fvqu.js").then((e) => e.monerisModule),
1115
- opayo: () => import("./chunks/opayo-B3EvrVxw.js").then((e) => e.opayoModule),
1116
- paddle: () => import("./chunks/paddle-BIYR9Um3.js").then((e) => e.paddleModule),
1117
- paypal: () => import("./chunks/paypal-B_yxIo2d.js").then((e) => e.paypalModule),
1118
- payway: () => import("./chunks/payway-CeOzS0sL.js").then((e) => e.paywayModule),
1119
- square: () => import("./chunks/square-DEzxv9D9.js").then((e) => e.squareModule),
1120
- stripe: () => import("./chunks/stripe-CVPQGDz3.js").then((e) => e.stripeModule)
1121
- }, Wt = {
1122
- ...Ht,
1123
- ...Bt,
1124
- ...Vt,
1125
- ...Ut
1070
+ }, Wt = new B(), Gt = {
1071
+ "address-finder": () => import("./chunks/address-finder-QK1m1eyv.js").then((e) => e.addressFinderModule),
1072
+ "google-address": () => import("./chunks/google-address-DQR6rsbh.js").then((e) => e.googleAddressModule),
1073
+ loqate: () => import("./chunks/loqate-ZZClcacr.js").then((e) => e.loqateModule),
1074
+ "place-kit": () => import("./chunks/place-kit-BKk8xDXf.js").then((e) => e.placeKitModule)
1075
+ }, Kt = {
1076
+ "captcha-eu": () => import("./chunks/captcha-eu-eU_M6snp.js").then((e) => e.captchaEuModule),
1077
+ "friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-C_cF1WD2.js").then((e) => e.friendlyCaptchaV1Module),
1078
+ "friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-BenESH-n.js").then((e) => e.friendlyCaptchaV2Module),
1079
+ hcaptcha: () => import("./chunks/hcaptcha-COilLmRT.js").then((e) => e.hcaptchaModule),
1080
+ "recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-Cx6HUpMa.js").then((e) => e.recaptchaEnterpriseModule),
1081
+ "recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-DQ9BJzcv.js").then((e) => e.recaptchaV2CheckboxModule),
1082
+ "recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-BP0T8Pan.js").then((e) => e.recaptchaV2InvisibleModule),
1083
+ "recaptcha-v3": () => import("./chunks/recaptcha-v3-DKMGQ27K.js").then((e) => e.recaptchaV3Module),
1084
+ snaptcha: () => import("./chunks/snaptcha-P3EoSQud.js").then((e) => e.snaptchaModule),
1085
+ turnstile: () => import("./chunks/turnstile-Sp4ubowK.js").then((e) => e.turnstileModule)
1086
+ }, qt = {
1087
+ calculations: () => import("./chunks/calculations-DeEmdUDq.js").then((e) => e.calculationsModule),
1088
+ "checkbox-radio": () => import("./chunks/checkbox-radio-CSXo6svm.js").then((e) => e.checkboxRadioModule),
1089
+ combobox: () => import("./chunks/combobox-CJh2DoSO.js").then((e) => e.comboboxModule),
1090
+ conditions: () => import("./chunks/conditions-Dz3068K0.js").then((e) => e.conditionsModule),
1091
+ "custom-google-maps": () => import("./chunks/custom-google-maps-rNm5VFbb.js").then((e) => e.customGoogleMapsModule),
1092
+ "custom-link": () => import("./chunks/custom-link-CLqFCssQ.js").then((e) => e.customLinkModule),
1093
+ "custom-maps": () => import("./chunks/custom-maps-DgjYQDLj.js").then((e) => e.customMapsModule),
1094
+ "date-picker": () => import("./chunks/date-picker-BVJxJVYT.js").then((e) => e.datePickerModule),
1095
+ "file-upload": () => import("./chunks/file-upload-vEUr_EuP.js").then((e) => e.fileUploadModule),
1096
+ "upload-manager": () => import("./chunks/upload-manager-Ccg3d_4I.js").then((e) => e.uploadManagerModule),
1097
+ hidden: () => import("./chunks/hidden-Bc2TpcgF.js").then((e) => e.hiddenModule),
1098
+ "phone-country": () => import("./chunks/phone-country-Bx9EG50h.js").then((e) => e.phoneCountryModule),
1099
+ "password-validation": () => import("./chunks/password-validation-HGOU9kf3.js").then((e) => e.passwordValidationModule),
1100
+ "address-country": () => import("./chunks/address-country-DLJF-OkC.js").then((e) => e.addressCountryModule),
1101
+ "address-state": () => import("./chunks/address-state-CHKit8AW.js").then((e) => e.addressStateModule),
1102
+ repeater: () => import("./chunks/repeater-BR0RUvTs.js").then((e) => e.repeaterModule),
1103
+ "rich-text": () => import("./chunks/rich-text-H2A6cm1t.js").then((e) => e.richTextModule),
1104
+ signature: () => import("./chunks/signature-CfKA_poI.js").then((e) => e.signatureModule),
1105
+ summary: () => import("./chunks/summary-B3CAebLV.js").then((e) => e.summaryModule),
1106
+ "survey-likert": () => import("./chunks/survey-likert-CEtUceag.js").then((e) => e.surveyLikertModule),
1107
+ "survey-rank": () => import("./chunks/survey-rank-Dtt97y6s.js").then((e) => e.surveyRankModule),
1108
+ "survey-rating": () => import("./chunks/survey-rating-mlDMI0uq.js").then((e) => e.surveyRatingModule),
1109
+ table: () => import("./chunks/table-0k6Md0IO.js").then((e) => e.tableModule),
1110
+ "text-limit": () => import("./chunks/text-limit-CTVML6s7.js").then((e) => e.textLimitModule)
1111
+ }, Jt = {
1112
+ bpoint: () => import("./chunks/bpoint-GvYfyPjD.js").then((e) => e.bpointModule),
1113
+ eway: () => import("./chunks/eway-BZuTBAUW.js").then((e) => e.ewayModule),
1114
+ "go-cardless": () => import("./chunks/go-cardless-DWZeB0Bq.js").then((e) => e.goCardlessModule),
1115
+ mollie: () => import("./chunks/mollie-8OMXIYa8.js").then((e) => e.mollieModule),
1116
+ moneris: () => import("./chunks/moneris-qYHJ9EFy.js").then((e) => e.monerisModule),
1117
+ opayo: () => import("./chunks/opayo-DlWPEnla.js").then((e) => e.opayoModule),
1118
+ paddle: () => import("./chunks/paddle-CArfWih0.js").then((e) => e.paddleModule),
1119
+ paypal: () => import("./chunks/paypal-BcaMCMGY.js").then((e) => e.paypalModule),
1120
+ payway: () => import("./chunks/payway-vxC7_bfR.js").then((e) => e.paywayModule),
1121
+ square: () => import("./chunks/square-Dyz0p_GU.js").then((e) => e.squareModule),
1122
+ stripe: () => import("./chunks/stripe-Bfd_jp_k.js").then((e) => e.stripeModule)
1123
+ }, Yt = {
1124
+ ...qt,
1125
+ ...Gt,
1126
+ ...Kt,
1127
+ ...Jt
1126
1128
  }, V = /* @__PURE__ */ new Map();
1127
- function Gt(e) {
1129
+ function Xt(e) {
1128
1130
  if (e instanceof Error) return {
1129
1131
  name: e.name || "Error",
1130
1132
  message: e.message || "No error message was provided.",
@@ -1146,7 +1148,7 @@ function Gt(e) {
1146
1148
  };
1147
1149
  }
1148
1150
  }
1149
- function Kt(e, t, n) {
1151
+ function Zt(e, t, n) {
1150
1152
  let r = [...t].filter((e) => e.required), i = [
1151
1153
  "Formie browser module diagnostics",
1152
1154
  `Surface: ${e}`,
@@ -1157,7 +1159,7 @@ function Kt(e, t, n) {
1157
1159
  i.push("", `Failure ${r + 1}`, `Module: ${t.moduleId}`, `Key: ${t.key}`, `Code: ${t.code}`), e === "cp-edit" && a && (i.push(`Error: ${a.name}: ${a.message}`), a.stack && i.push("Stack:", a.stack));
1158
1160
  }), i.join("\n");
1159
1161
  }
1160
- async function qt(e) {
1162
+ async function Qt(e) {
1161
1163
  if (navigator.clipboard?.writeText) {
1162
1164
  await navigator.clipboard.writeText(e);
1163
1165
  return;
@@ -1170,10 +1172,10 @@ async function qt(e) {
1170
1172
  t.remove();
1171
1173
  }
1172
1174
  }
1173
- async function Jt(e, t) {
1175
+ async function $t(e, t) {
1174
1176
  let n = t.get(e);
1175
1177
  if (n) return n;
1176
- let r = e.startsWith("formie:") && Object.prototype.hasOwnProperty.call(Wt, e.slice(7)) ? Wt[e.slice(7)] : void 0;
1178
+ let r = e.startsWith("formie:") && Object.prototype.hasOwnProperty.call(Yt, e.slice(7)) ? Yt[e.slice(7)] : void 0;
1177
1179
  if (!r) throw Error(`Browser module ${e} is not registered.`);
1178
1180
  V.has(e) || V.set(e, r().catch((t) => {
1179
1181
  throw V.delete(e), t;
@@ -1182,14 +1184,14 @@ async function Jt(e, t) {
1182
1184
  if (i.moduleId !== e) throw Error(`Module definition does not match ${e}.`);
1183
1185
  return t.register(i), i;
1184
1186
  }
1185
- function Yt(e, t, n) {
1187
+ function en(e, t, n) {
1186
1188
  return [...new Set(e.targets.flatMap((e) => {
1187
1189
  if (e.type === "form") return [n || t];
1188
1190
  let r = e.type === "selector" ? e.selector : e.type === "field" ? `[data-formie-field-uid="${CSS.escape(e.uid)}"]` : e.type === "page" ? `[data-formie-page-id="${CSS.escape(e.id)}"]` : `[data-formie-action="${CSS.escape(e.action)}"]`;
1189
1191
  return [...t.matches(r) ? [t] : [], ...t.querySelectorAll(r)];
1190
1192
  }))].filter((e) => !e.closest("[hidden], [data-formie-hidden=\"true\"], [data-formie-conditionally-hidden], [data-formie-page-hidden]"));
1191
1193
  }
1192
- async function Xt(e, t) {
1194
+ async function tn(e, t) {
1193
1195
  n(e);
1194
1196
  let r = e.surface;
1195
1197
  if (t.matchContext.surface !== r || t.setupContext.surface !== r) throw Error(`Browser module manifest surface ${r} cannot mount as ${t.matchContext.surface}.`);
@@ -1202,7 +1204,7 @@ async function Xt(e, t) {
1202
1204
  code: "MODULE_UNAVAILABLE",
1203
1205
  message: "A form feature could not start. Reload the page or contact the site administrator."
1204
1206
  };
1205
- s.set(e.key, i), c.set(e.key, Gt(n)), console.error("[formie] Browser module failure", i, n), await t.setupContext.emit("formie:browser:module:error", i);
1207
+ s.set(e.key, i), c.set(e.key, Xt(n)), console.error("[formie] Browser module failure", i, n), await t.setupContext.emit("formie:browser:module:error", i);
1206
1208
  }, m = async (e) => {
1207
1209
  try {
1208
1210
  await e.destroy();
@@ -1244,7 +1246,7 @@ async function Xt(e, t) {
1244
1246
  let d = document.createElement("span");
1245
1247
  d.className = "formie-module-error__copy-status", d.setAttribute("role", "status"), d.setAttribute("aria-live", "polite"), u.addEventListener("click", async () => {
1246
1248
  try {
1247
- await qt(n.textContent || ""), d.textContent = "Details copied.";
1249
+ await Qt(n.textContent || ""), d.textContent = "Details copied.";
1248
1250
  } catch {
1249
1251
  d.textContent = "Copy failed. Select the details above and copy them manually.";
1250
1252
  let e = document.createRange();
@@ -1254,7 +1256,7 @@ async function Xt(e, t) {
1254
1256
  }
1255
1257
  e.dataset.formieModuleError = "true", i !== a && a.contains(i) ? i.before(e) : a.prepend(e);
1256
1258
  }
1257
- let t = e.querySelector("[data-formie-module-error-details]"), n = Kt(r, s.values(), c);
1259
+ let t = e.querySelector("[data-formie-module-error-details]"), n = Zt(r, s.values(), c);
1258
1260
  t && t.textContent !== n && (t.textContent = n);
1259
1261
  }, _ = (e) => {
1260
1262
  h() && (e.preventDefault(), e.stopImmediatePropagation(), g());
@@ -1273,7 +1275,7 @@ async function Xt(e, t) {
1273
1275
  });
1274
1276
  let d;
1275
1277
  try {
1276
- d = Yt(n, i, a);
1278
+ d = en(n, i, a);
1277
1279
  } catch (e) {
1278
1280
  s.has(n.key) || await p(n, e);
1279
1281
  continue;
@@ -1283,7 +1285,7 @@ async function Xt(e, t) {
1283
1285
  for (let [e, t] of Array.from(f.entries()).reverse()) d.includes(e) || (await m(t.instance), f.delete(e), l.splice(l.indexOf(t.instance), 1));
1284
1286
  let h;
1285
1287
  try {
1286
- h = await Jt(n.moduleId, t.registry);
1288
+ h = await $t(n.moduleId, t.registry);
1287
1289
  } catch (e) {
1288
1290
  s.has(n.key) || await p(n, e);
1289
1291
  continue;
@@ -1406,17 +1408,8 @@ async function Xt(e, t) {
1406
1408
  };
1407
1409
  }
1408
1410
  //#endregion
1409
- //#region src/js/utils/form-started-at.ts
1410
- var Zt = "formie:formStartedAt:";
1411
- function Qt(e) {
1412
- let t = e.querySelector("input[name=\"formStartedAt\"]");
1413
- if (!t) return;
1414
- let n = e.querySelector("input[name=\"renderId\"]")?.value?.trim() ?? "", r = n ? `${Zt}${n}` : null, i = r ? sessionStorage.getItem(r) : null;
1415
- i || (i = String(Date.now()), r && sessionStorage.setItem(r, i)), t.value = i;
1416
- }
1417
- //#endregion
1418
1411
  //#region src/js/utils/unload-warning.ts
1419
- var $t = /* @__PURE__ */ new Set([
1412
+ var nn = /* @__PURE__ */ new Set([
1420
1413
  "action",
1421
1414
  "redirect",
1422
1415
  "requestToken",
@@ -1429,6 +1422,17 @@ var $t = /* @__PURE__ */ new Set([
1429
1422
  "draftContext",
1430
1423
  "progressId"
1431
1424
  ]);
1425
+ function rn(e) {
1426
+ let t = /* @__PURE__ */ new Set(), n = !0;
1427
+ return g(e, "formie:unload-warning:collect-exclusions", {
1428
+ form: e,
1429
+ exclude: (...e) => {
1430
+ n && e.forEach((e) => {
1431
+ typeof e == "string" && e !== "" && t.add(e);
1432
+ });
1433
+ }
1434
+ }), n = !1, t;
1435
+ }
1432
1436
  function H(e, t) {
1433
1437
  if (e == null) return String(e);
1434
1438
  if (typeof e == "string") return JSON.stringify(e);
@@ -1445,47 +1449,51 @@ function H(e, t) {
1445
1449
  }
1446
1450
  return JSON.stringify(String(e));
1447
1451
  }
1448
- function en(e) {
1452
+ function an(e) {
1449
1453
  return H(e, /* @__PURE__ */ new WeakSet());
1450
1454
  }
1451
- function tn(e, t) {
1455
+ function on(e, t) {
1452
1456
  if (!e) return !1;
1453
1457
  let n = e.endsWith("[]") ? e.slice(0, -2) : e;
1454
- return !O(n, t) && !$t.has(n);
1455
- }
1456
- function nn(e) {
1457
- return en(Array.from(new FormData(e).entries()).filter(([t]) => tn(String(t || ""), e)));
1458
- }
1459
- function rn(e, t = {}) {
1460
- let n = null, r = !1, i = !1, a = null, o = null, s = null, c = () => {
1461
- a !== null && (window.cancelAnimationFrame(a), a = null), o !== null && (window.clearTimeout(o), o = null), s !== null && (window.clearTimeout(s), s = null);
1462
- }, l = () => r ? (i = nn(e) !== n, i) : !1, u = () => {
1463
- n = nn(e), r = !0, i = !1;
1458
+ return !ie(n, t) && !nn.has(n);
1459
+ }
1460
+ function sn(e, t, n) {
1461
+ return an(e.filter(([e]) => !n.has(e) && on(String(e || ""), t)));
1462
+ }
1463
+ function cn(e, t = {}) {
1464
+ let n = [], r = !1, i = !1, a = !1, o = null, s = null, c = null, l = () => {
1465
+ o !== null && (window.cancelAnimationFrame(o), o = null), s !== null && (window.clearTimeout(s), s = null), c !== null && (window.clearTimeout(c), c = null);
1466
+ }, u = () => {
1467
+ if (!r) return !1;
1468
+ let t = rn(e);
1469
+ return a = sn(Array.from(new FormData(e).entries()), e, t) !== sn(n, e, t), a;
1464
1470
  }, d = () => {
1465
- c(), r = !1, a = window.requestAnimationFrame(() => {
1466
- a = null, s = window.setTimeout(() => {
1467
- s = null, u();
1468
- }, 0);
1469
- });
1471
+ i || (l(), n = Array.from(new FormData(e).entries()), r = !0, a = !1);
1470
1472
  }, f = () => {
1471
- o !== null && window.clearTimeout(o), o = window.setTimeout(() => {
1472
- o = null, l();
1473
+ i || (l(), r = !1, o = window.requestAnimationFrame(() => {
1474
+ o = null, c = window.setTimeout(() => {
1475
+ c = null, d();
1476
+ }, 0);
1477
+ }));
1478
+ }, p = () => {
1479
+ s !== null && window.clearTimeout(s), s = window.setTimeout(() => {
1480
+ s = null, u();
1473
1481
  }, 120);
1474
- }, p = (e) => {
1475
- (!t.shouldWarn || t.shouldWarn()) && l() && (e.preventDefault(), e.returnValue = "");
1482
+ }, m = (e) => {
1483
+ (!t.shouldWarn || t.shouldWarn()) && u() && (e.preventDefault(), e.returnValue = "");
1476
1484
  };
1477
- return e.addEventListener("input", f), e.addEventListener("change", f), window.addEventListener("beforeunload", p), d(), {
1478
- captureBaseline: u,
1479
- scheduleBaselineCapture: d,
1480
- refreshDirtyState: l,
1485
+ return e.addEventListener("input", p), e.addEventListener("change", p), window.addEventListener("beforeunload", m), d(), {
1486
+ captureBaseline: d,
1487
+ scheduleBaselineCapture: f,
1488
+ refreshDirtyState: u,
1481
1489
  destroy: () => {
1482
- c(), e.removeEventListener("input", f), e.removeEventListener("change", f), window.removeEventListener("beforeunload", p);
1490
+ i = !0, r = !1, n = [], l(), e.removeEventListener("input", p), e.removeEventListener("change", p), window.removeEventListener("beforeunload", m);
1483
1491
  }
1484
1492
  };
1485
1493
  }
1486
1494
  //#endregion
1487
1495
  //#region src/js/validation/rules/email.ts
1488
- var an = {
1496
+ var ln = {
1489
1497
  rule: ({ input: e, getRule: n }) => {
1490
1498
  let r = n("email");
1491
1499
  return !r || t(e.value, {
@@ -1497,23 +1505,28 @@ var an = {
1497
1505
  };
1498
1506
  //#endregion
1499
1507
  //#region src/js/validation/rules/shared.ts
1500
- function on(e) {
1508
+ function un(e) {
1501
1509
  return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
1502
1510
  }
1503
- function sn(e) {
1511
+ function dn(e) {
1504
1512
  let t = e.getRule("match");
1505
1513
  if (!t || t === !0 || typeof t != "object" || !e.field) return null;
1506
1514
  let n = typeof t.fieldHandle == "string" ? t.fieldHandle.trim() : "";
1507
1515
  if (!n) return null;
1508
1516
  let r = e.form.querySelector(`[data-formie-field-handle="${n}"]`);
1509
- return r ? Array.from(r.querySelectorAll(e.config.fieldsSelector)).find((e) => (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && !P(e)) ?? null : null;
1517
+ return r ? Array.from(r.querySelectorAll(e.config.fieldsSelector)).find((e) => (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && !j(e)) ?? null : null;
1510
1518
  }
1511
1519
  //#endregion
1512
1520
  //#region src/js/validation/rules.ts
1513
- var cn = {
1521
+ var fn = {
1514
1522
  required: {
1515
1523
  rule: ({ input: e, getRule: n }) => {
1516
- if (!n("required") || e.type === "hidden") return !0;
1524
+ if (!n("required") || e.type === "hidden" || e.closest("[data-formie-field-handle]")?.getAttribute("data-formie-field-type") === "table") return !0;
1525
+ if (e instanceof HTMLInputElement && e.type === "file") {
1526
+ if (e.files?.length) return !0;
1527
+ let t = e.closest("[data-formie-field-handle]"), n = e.name.replace(/\[\]$/, "");
1528
+ return Array.from(t?.querySelectorAll("input[type=\"hidden\"][data-formie-file-upload-asset-id]") || []).some((e) => !e.disabled && e.name.startsWith(`${n}[`) && Number(e.getAttribute("data-formie-file-upload-asset-id")) > 0);
1529
+ }
1517
1530
  if (e.type === "checkbox" || e.type === "radio") {
1518
1531
  let t = e.form?.querySelectorAll(`[name="${e.name}"]:not([type="hidden"]):not([disabled])`) || [];
1519
1532
  return t.length ? Array.from(t).some((e) => e instanceof HTMLInputElement && e.checked) : e instanceof HTMLInputElement ? e.checked : !0;
@@ -1522,7 +1535,7 @@ var cn = {
1522
1535
  },
1523
1536
  message: ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-required-message") ?? e.getAttribute("data-required-message") ?? n("{label} cannot be blank.", { label: t })
1524
1537
  },
1525
- email: an,
1538
+ email: ln,
1526
1539
  url: {
1527
1540
  rule: ({ input: e, getRule: n }) => {
1528
1541
  let r = n("url");
@@ -1551,18 +1564,18 @@ var cn = {
1551
1564
  },
1552
1565
  match: {
1553
1566
  rule: (e) => {
1554
- let n = sn(e);
1567
+ let n = dn(e);
1555
1568
  return !n || t(e.input.value, { type: "match" }, { comparison: n.value }) === null;
1556
1569
  },
1557
1570
  message: (e) => {
1558
- let t = sn(e)?.closest("[data-formie-field-handle]"), n = on(t);
1571
+ let t = dn(e)?.closest("[data-formie-field-handle]"), n = un(t);
1559
1572
  return e.input.getAttribute("data-formie-validation-match-message") ?? e.t("{label} must match {value}.", {
1560
1573
  label: e.label,
1561
1574
  value: n
1562
1575
  });
1563
1576
  }
1564
1577
  }
1565
- }, ln = {
1578
+ }, pn = {
1566
1579
  email: /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*(\.\w{2,})+$/,
1567
1580
  url: /^(?:(?:https?|HTTPS?|ftp|FTP):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)(?:\.(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)*(?:\.(?:[a-zA-Z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/,
1568
1581
  number: /^(?:[-+]?[0-9]*[.,]?[0-9]+)$/,
@@ -1570,14 +1583,14 @@ var cn = {
1570
1583
  date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))/,
1571
1584
  time: /^(?:(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]))$/,
1572
1585
  month: /^(?:(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])))$/
1573
- }, U = T("general", "validator");
1586
+ }, U = O("general", "validator");
1574
1587
  function W(e) {
1575
- return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
1588
+ return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && !!e.name;
1576
1589
  }
1577
- function un(e) {
1590
+ function G(e) {
1578
1591
  return !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
1579
1592
  }
1580
- var dn = class {
1593
+ var mn = class {
1581
1594
  form;
1582
1595
  errors = [];
1583
1596
  validators = {};
@@ -1599,9 +1612,9 @@ var dn = class {
1599
1612
  messagesClass: [],
1600
1613
  messageClass: [],
1601
1614
  fieldsSelector: "input:not([type=\"hidden\"]):not([type=\"submit\"]):not([type=\"button\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])",
1602
- patterns: ln,
1615
+ patterns: pn,
1603
1616
  ...t
1604
- }, Object.entries(cn).forEach(([e, t]) => {
1617
+ }, Object.entries(fn).forEach(([e, t]) => {
1605
1618
  this.addValidator(e, t.rule, t.message);
1606
1619
  }), this.init();
1607
1620
  }
@@ -1614,9 +1627,9 @@ var dn = class {
1614
1627
  }), this.config.live && this.addEventListeners(), this.emitEvent(document, o("ready"), { validator: this });
1615
1628
  }
1616
1629
  inputs(e = null) {
1617
- if (W(e)) return P(e) ? [] : [e];
1630
+ if (W(e)) return j(e) ? [] : [e];
1618
1631
  let t = e || this.form;
1619
- return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => W(e) && !P(e));
1632
+ return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => W(e) && !j(e));
1620
1633
  }
1621
1634
  getInputValue(e) {
1622
1635
  return e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? e.checked : e instanceof HTMLInputElement && e.type === "file" ? e.files?.length ? Array.from(e.files).map((e) => e.name).join("|") : "" : e.value ?? "";
@@ -1634,28 +1647,28 @@ var dn = class {
1634
1647
  this.errors = [];
1635
1648
  let n = /* @__PURE__ */ new Set();
1636
1649
  return this.inputs(e).forEach((e) => {
1637
- let r = !1;
1650
+ let r = !1, i = t.renderErrors !== !1 && this.shouldShowError(e);
1638
1651
  if (!this.isVisible(e, t)) return;
1639
- let i = e.closest("[data-formie-field-handle]"), a = e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? `${i?.getAttribute("data-formie-field-handle") || ""}:${e.name}` : null;
1640
- if (a) {
1641
- if (n.has(a)) return;
1642
- n.add(a);
1652
+ let a = e.closest("[data-formie-field-handle]"), o = e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? `${a?.getAttribute("data-formie-field-handle") || ""}:${e.name}` : null;
1653
+ if (o) {
1654
+ if (n.has(o)) return;
1655
+ n.add(o);
1643
1656
  }
1644
- this.shouldShowError(e) && this.removeError(e);
1645
- let o = this.getValidatorCallbackOptions(e);
1657
+ i && this.removeError(e);
1658
+ let s = this.getValidatorCallbackOptions(e);
1646
1659
  Object.entries(this.validators).forEach(([t, n]) => {
1647
- if (!n.validate(o)) {
1648
- let i = this.getErrorMessage(e, t, n, o);
1649
- this.shouldShowError(e) && !r && this.showError(e, t, i), this.errors.push({
1660
+ if (!n.validate(s)) {
1661
+ let a = this.getErrorMessage(e, t, n, s);
1662
+ i && !r && this.showError(e, t, a), this.errors.push({
1650
1663
  input: e,
1651
- field: o.field,
1664
+ field: s.field,
1652
1665
  validator: t,
1653
- message: i,
1654
- handle: o.field?.getAttribute("data-formie-field-handle") || null,
1666
+ message: a,
1667
+ handle: s.field?.getAttribute("data-formie-field-handle") || null,
1655
1668
  result: !1
1656
1669
  }), r = !0;
1657
1670
  }
1658
- }), !r && this.shouldShowError(e) && this.removeError(e);
1671
+ }), !r && i && this.removeError(e);
1659
1672
  }), U.log("Validation pass complete.", {
1660
1673
  errorCount: this.errors.length,
1661
1674
  includeHiddenPages: t.includeHiddenPages === !0
@@ -1677,36 +1690,38 @@ var dn = class {
1677
1690
  e.remove();
1678
1691
  }), n && (n.innerHTML = ""), t.querySelectorAll("input, select, textarea").forEach((e) => {
1679
1692
  let t = e;
1680
- t.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && t.classList.remove(...this.config.inputErrorClass), t.removeAttribute("data-formie-input-has-error"), Fe(t, r);
1693
+ t.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && t.classList.remove(...this.config.inputErrorClass), t.removeAttribute("data-formie-input-has-error"), ze(t, r);
1681
1694
  });
1682
1695
  for (let e = t; e; e = e.parentElement?.closest("[data-formie-field-handle]")) this.config.fieldContainerErrorClass.length && e.classList.remove(...this.config.fieldContainerErrorClass), e.removeAttribute("data-formie-field-has-error");
1683
- this.emitEvent(e, o("clear-error"), { validator: this }), C(this.form);
1696
+ this.emitEvent(e, o("clear-error"), { validator: this }), h(this.form);
1684
1697
  }
1685
1698
  showError(e, t, n) {
1686
1699
  let r = e.closest("[data-formie-field-handle]");
1687
1700
  if (!r) return;
1688
1701
  let i = r.querySelector("[data-formie-field-errors]");
1689
- i ||= lt(r, (e) => {
1702
+ i ||= pt(r, (e) => {
1690
1703
  this.config.messagesClass.length && e.classList.add(...this.config.messagesClass);
1691
1704
  }), this.config.messagesClass.length && i.classList.add(...this.config.messagesClass), i.innerHTML = "";
1692
- let a = r.getAttribute("data-formie-field-handle") || "field", s = `${a}-error`;
1693
- i.id = i.id || `${a}-errors`, N(i, Ae(this.config.errorAriaLive, this.submitted));
1705
+ let a = r.getAttribute("data-formie-field-handle") || "field";
1706
+ i.id = i.id || `${e.id || `${this.form.id}-${a}`}-errors`;
1707
+ let s = `${i.id}-1`;
1708
+ Ie(i, Pe(this.config.errorAriaLive, this.submitted));
1694
1709
  let c = document.createElement("div");
1695
1710
  c.setAttribute("data-formie-field-error", "true"), c.setAttribute(`data-formie-field-error-${t}`, "true"), c.setAttribute("id", s), this.config.messageClass.length && c.classList.add(...this.config.messageClass), c.textContent = n, i.appendChild(c), r.setAttribute("data-formie-field-has-error", "true"), r.querySelectorAll("input, select, textarea").forEach((e) => {
1696
1711
  let t = e;
1697
- P(t) || (t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), Pe(t, s));
1712
+ j(t) || (t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), P(t, s));
1698
1713
  });
1699
1714
  for (let e = r; e; e = e.parentElement?.closest("[data-formie-field-handle]")) this.config.fieldContainerErrorClass.length && e.classList.add(...this.config.fieldContainerErrorClass), e.setAttribute("data-formie-field-has-error", "true");
1700
1715
  this.emitEvent(e, o("show-error"), {
1701
1716
  validator: this,
1702
1717
  validatorName: t,
1703
1718
  errorMessage: n
1704
- }), C(this.form);
1719
+ }), h(this.form);
1705
1720
  }
1706
1721
  getValidatorCallbackOptions(e) {
1707
1722
  let t = e.closest("[data-formie-field-handle]"), n = t?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() ?? "", r = this.parseValidationRules(t?.getAttribute("data-formie-validation"));
1708
1723
  return {
1709
- t: se,
1724
+ t: le,
1710
1725
  input: e,
1711
1726
  label: n,
1712
1727
  field: t,
@@ -1717,7 +1732,7 @@ var dn = class {
1717
1732
  };
1718
1733
  }
1719
1734
  getErrorMessage(e, t, n, r) {
1720
- return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? se("{label} is invalid.", { label: r.label });
1735
+ return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? le("{label} is invalid.", { label: r.label });
1721
1736
  }
1722
1737
  getErrors() {
1723
1738
  return this.errors;
@@ -1754,23 +1769,22 @@ var dn = class {
1754
1769
  isVisible(e, t = {}) {
1755
1770
  if (e.disabled || e.hasAttribute("data-formie-conditions-disabled") || e.closest("[data-formie-conditions-disabled]") || e.closest("[data-formie-conditionally-hidden]")) return !1;
1756
1771
  if (e.closest("[data-formie-page-hidden]")) return !!t.includeHiddenPages;
1757
- let n = e.closest("[data-formie-field-handle]")?.querySelector("[data-formie-rich-text]");
1758
- return n instanceof HTMLElement ? un(n) : un(e);
1772
+ let n = e.closest("[data-formie-field-handle]"), r = n?.querySelector("[data-formie-rich-text]");
1773
+ if (r instanceof HTMLElement) return G(r);
1774
+ if (e instanceof HTMLSelectElement && e.hasAttribute("data-formie-combobox-input")) {
1775
+ let t = e.nextElementSibling;
1776
+ if (t instanceof HTMLElement && t.classList.contains("formie-combobox")) return G(t);
1777
+ }
1778
+ return e instanceof HTMLSelectElement && n instanceof HTMLElement ? G(e) || G(n) : G(e);
1759
1779
  }
1760
1780
  blurHandler(e) {
1761
- e.target instanceof HTMLElement && W(e.target) && !P(e.target) && e.target.form?.isSameNode(this.form) && (e instanceof CustomEvent || e.target instanceof HTMLInputElement && e.target.type === "file" || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || (this.isDirty(e.target) && this.activated.add(e.target), this.shouldShowError(e.target) && this.validate(e.target)));
1781
+ e.target instanceof HTMLElement && W(e.target) && !j(e.target) && e.target.form?.isSameNode(this.form) && (e instanceof CustomEvent || e.target instanceof HTMLInputElement && e.target.type === "file" || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || (this.isDirty(e.target) && this.activated.add(e.target), this.shouldShowError(e.target) && this.validate(e.target)));
1762
1782
  }
1763
1783
  changeHandler(e) {
1764
- if (e.target instanceof HTMLElement && W(e.target) && !P(e.target) && e.target.form?.isSameNode(this.form) && !(e instanceof CustomEvent)) {
1765
- if (e.target instanceof HTMLSelectElement) {
1766
- this.activated.add(e.target), this.validate(e.target);
1767
- return;
1768
- }
1769
- e.target instanceof HTMLInputElement && (e.target.type === "file" || e.target.type === "checkbox" || e.target.type === "radio") && (this.activated.add(e.target), this.validate(e.target));
1770
- }
1784
+ e.target instanceof HTMLElement && W(e.target) && !j(e.target) && e.target.form?.isSameNode(this.form) && (e instanceof CustomEvent || (e.target instanceof HTMLSelectElement || e.target instanceof HTMLInputElement && (e.target.type === "file" || e.target.type === "checkbox" || e.target.type === "radio")) && (this.activated.add(e.target), this.validate(e.target)));
1771
1785
  }
1772
1786
  inputHandler(e) {
1773
- e.target instanceof HTMLElement && W(e.target) && !P(e.target) && e.target.form?.isSameNode(this.form) && (e instanceof CustomEvent || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || this.shouldShowError(e.target) && this.validate(e.target));
1787
+ e.target instanceof HTMLElement && W(e.target) && !j(e.target) && e.target.form?.isSameNode(this.form) && (e instanceof CustomEvent || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || this.shouldShowError(e.target) && this.validate(e.target));
1774
1788
  }
1775
1789
  submit(e = null, { final: t = !1 } = {}) {
1776
1790
  return this.submitted = !0, U.log("Submit validation requested.", { final: t }), this.boundListeners || this.addEventListeners(), this.removeAllErrors(), this.validate(e, { includeHiddenPages: t });
@@ -1802,25 +1816,25 @@ var dn = class {
1802
1816
  };
1803
1817
  //#endregion
1804
1818
  //#region src/js/validation/enter-key-guard.ts
1805
- function fn(e) {
1819
+ function hn(e) {
1806
1820
  return e.hasAttribute("data-formie-conditionally-hidden") || !!e.closest("[data-formie-conditionally-hidden]") || e.hasAttribute("data-formie-page-hidden") || !!e.closest("[data-formie-page-hidden]");
1807
1821
  }
1808
- function pn(e, t) {
1822
+ function gn(e, t) {
1809
1823
  let n = e.querySelectorAll(`[data-formie-action="${t}"]`);
1810
- return Array.from(n).some((e) => !fn(e));
1824
+ return Array.from(n).some((e) => !hn(e));
1811
1825
  }
1812
- function mn(e) {
1813
- let { final: t } = g(e);
1826
+ function _n(e) {
1827
+ let { final: t } = m(e);
1814
1828
  return "submit";
1815
1829
  }
1816
- function hn(e) {
1817
- return !pn(e, mn(e));
1830
+ function vn(e) {
1831
+ return !gn(e, _n(e));
1818
1832
  }
1819
- function gn(e) {
1833
+ function yn(e) {
1820
1834
  let t = (t) => {
1821
1835
  if (t.key !== "Enter" || t.defaultPrevented) return;
1822
1836
  let n = t.target;
1823
- (n instanceof HTMLInputElement || n instanceof HTMLSelectElement) && (n instanceof HTMLInputElement && (n.type === "button" || n.type === "submit" || n.type === "reset" || n.type === "file") || hn(e) && t.preventDefault());
1837
+ (n instanceof HTMLInputElement || n instanceof HTMLSelectElement) && (n instanceof HTMLInputElement && (n.type === "button" || n.type === "submit" || n.type === "reset" || n.type === "file") || vn(e) && t.preventDefault());
1824
1838
  };
1825
1839
  return e.addEventListener("keydown", t, !0), () => {
1826
1840
  e.removeEventListener("keydown", t, !0);
@@ -1828,16 +1842,16 @@ function gn(e) {
1828
1842
  }
1829
1843
  //#endregion
1830
1844
  //#region src/js/core/create-formie-client.ts
1831
- var G = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", _n = 300, vn = "/actions/formie/server/forms/render", yn = "/api", bn = "/actions/formie/server/forms/refresh-tokens", xn = "/actions/formie/server/submissions/submit", Sn = "/actions/formie/server/submissions/set-page", Cn = "/actions/formie/server/submissions/clear-submission", wn = "/actions/formie/file-upload/hydrate", K = T("general", "client"), Tn = /* @__PURE__ */ new Set();
1832
- function q(e, t) {
1845
+ var K = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", bn = 300, xn = "/actions/formie/server/forms/render", Sn = "/api", Cn = "/actions/formie/server/forms/refresh-tokens", wn = "/actions/formie/server/submissions/submit", Tn = "/actions/formie/server/submissions/set-page", En = "/actions/formie/server/submissions/clear-submission", Dn = "/actions/formie/file-upload/hydrate", q = O("general", "client"), On = /* @__PURE__ */ new Set();
1846
+ function J(e, t) {
1833
1847
  if (e == null || e === "") return t;
1834
1848
  let n = e.toLowerCase();
1835
1849
  return n !== "false" && n !== "0" && n !== "off";
1836
1850
  }
1837
- function En(e) {
1838
- return e.formieRefreshTokens == null ? e.formieStaticCache != null && q(e.formieStaticCache, !0) : q(e.formieRefreshTokens, !0);
1851
+ function kn(e) {
1852
+ return e.formieRefreshTokens == null ? e.formieStaticCache != null && J(e.formieStaticCache, !0) : J(e.formieRefreshTokens, !0);
1839
1853
  }
1840
- function J(e) {
1854
+ function Y(e) {
1841
1855
  let t = e instanceof HTMLElement ? e.dataset : {};
1842
1856
  return {
1843
1857
  mode: "server-rendered",
@@ -1845,25 +1859,25 @@ function J(e) {
1845
1859
  profile: t.formieRequestProfile,
1846
1860
  formHandle: t.formieHandle,
1847
1861
  endpoint: t.formieEndpoint,
1848
- staticCache: En(t),
1849
- autoVisible: q(t.formieAutoVisible, !0),
1850
- compatibility: q(t.formieCompatibility, !1)
1862
+ staticCache: kn(t),
1863
+ autoVisible: J(t.formieAutoVisible, !0),
1864
+ compatibility: J(t.formieCompatibility, !1)
1851
1865
  };
1852
1866
  }
1853
- function Dn(e) {
1867
+ function An(e) {
1854
1868
  if (e && e !== "server-rendered") throw Error("@verbb/formie-browser enhances server-rendered HTML only. Use @verbb/formie-core for client-rendered forms.");
1855
1869
  return "server-rendered";
1856
1870
  }
1857
- function On(e) {
1871
+ function jn(e) {
1858
1872
  return e || "rest";
1859
1873
  }
1860
- function kn(e) {
1874
+ function Mn(e) {
1861
1875
  return e instanceof HTMLFormElement ? e : e.querySelector("form");
1862
1876
  }
1863
- function An(e, t) {
1864
- Tn.has(e) || (Tn.add(e), K.warn(t));
1877
+ function Nn(e, t) {
1878
+ On.has(e) || (On.add(e), q.warn(t));
1865
1879
  }
1866
- function jn(e, t) {
1880
+ function Pn(e, t) {
1867
1881
  if (!e) return e;
1868
1882
  try {
1869
1883
  return new URL(e).toString();
@@ -1875,21 +1889,21 @@ function jn(e, t) {
1875
1889
  return e;
1876
1890
  }
1877
1891
  }
1878
- function Y(e, t) {
1892
+ function X(e, t) {
1879
1893
  let n = (e || "").trim();
1880
- return n ? n.includes(t) ? n : jn(t, n) : t;
1894
+ return n ? n.includes(t) ? n : Pn(t, n) : t;
1881
1895
  }
1882
- function Mn(e, t) {
1883
- return Y(e.endpoint || t.dataset.formieEndpoint, vn);
1896
+ function Fn(e, t) {
1897
+ return X(e.endpoint || t.dataset.formieEndpoint, xn);
1884
1898
  }
1885
- function Nn(e, t) {
1899
+ function In(e, t) {
1886
1900
  let n = (e.endpoint || t.dataset.formieEndpoint || "").trim();
1887
- return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : jn(yn, n) : yn;
1901
+ return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : Pn(Sn, n) : Sn;
1888
1902
  }
1889
- function Pn(e, t) {
1890
- return Y(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, bn);
1903
+ function Ln(e, t) {
1904
+ return X(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, Cn);
1891
1905
  }
1892
- function Fn(e, t) {
1906
+ function Rn(e, t) {
1893
1907
  if (!e) return t;
1894
1908
  try {
1895
1909
  let n = new URL(e, window.location.origin), r = new URL(t, window.location.origin);
@@ -1900,39 +1914,39 @@ function Fn(e, t) {
1900
1914
  return t;
1901
1915
  }
1902
1916
  }
1903
- function In(e, t, n) {
1904
- let r = n.endpoint || e.dataset.formieEndpoint, i = Y(r, xn), a = t.getAttribute("action");
1905
- t.setAttribute("action", Fn(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
1906
- let t = e.getAttribute("href"), n = Y(r, Sn);
1907
- e.setAttribute("href", Fn(t, n));
1917
+ function zn(e, t, n) {
1918
+ let r = n.endpoint || e.dataset.formieEndpoint, i = X(r, wn), a = t.getAttribute("action");
1919
+ t.setAttribute("action", Rn(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
1920
+ let t = e.getAttribute("href"), n = X(r, Tn);
1921
+ e.setAttribute("href", Rn(t, n));
1908
1922
  }), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((e) => {
1909
- e.setAttribute("data-formie-file-upload-hydrate-endpoint", Y(r, wn));
1923
+ e.setAttribute("data-formie-file-upload-hydrate-endpoint", X(r, Dn));
1910
1924
  });
1911
1925
  }
1912
- function Ln(e) {
1926
+ function Bn(e) {
1913
1927
  if (e == null) return !1;
1914
1928
  let t = e.trim().toLowerCase();
1915
1929
  return t === "true" || t === "1" || t === "";
1916
1930
  }
1917
- function Rn(e) {
1918
- return q(e.dataset.formieAutomaticSubmissionState, !0);
1931
+ function Vn(e) {
1932
+ return J(e.dataset.formieAutomaticSubmissionState, !0);
1919
1933
  }
1920
- function zn(e, t, n) {
1921
- return Y(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, Cn);
1934
+ function Hn(e, t, n) {
1935
+ return X(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, En);
1922
1936
  }
1923
- function Bn(e) {
1924
- return Ln(e.dataset.formieUnloadWarning);
1937
+ function Un(e) {
1938
+ return Bn(e.dataset.formieUnloadWarning);
1925
1939
  }
1926
- function Vn(e, t) {
1940
+ function Wn(e, t) {
1927
1941
  e.setAttribute("data-formie-internal-navigation", t);
1928
1942
  }
1929
- function Hn(e) {
1943
+ function Gn(e) {
1930
1944
  e.removeAttribute("data-formie-internal-navigation");
1931
1945
  }
1932
- function Un(e) {
1946
+ function Kn(e) {
1933
1947
  return e.getAttribute("data-formie-internal-navigation") !== null;
1934
1948
  }
1935
- function Wn(e, t) {
1949
+ function qn(e, t) {
1936
1950
  if (!e) return !1;
1937
1951
  try {
1938
1952
  return new URL(e, window.location.origin).searchParams.has(t);
@@ -1940,30 +1954,30 @@ function Wn(e, t) {
1940
1954
  return !1;
1941
1955
  }
1942
1956
  }
1943
- function Gn(e) {
1944
- return Wn(window.location.href, "resumeToken") || Wn(e.getAttribute("action"), "resumeToken");
1957
+ function Jn(e) {
1958
+ return qn(window.location.href, "resumeToken") || qn(e.getAttribute("action"), "resumeToken");
1945
1959
  }
1946
- function Kn(e) {
1960
+ function Yn(e) {
1947
1961
  return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
1948
1962
  }
1949
- function qn(e, t = 0) {
1963
+ function Xn(e, t = 0) {
1950
1964
  if (!e) return t;
1951
1965
  let n = Number.parseInt(e, 10);
1952
1966
  return Number.isFinite(n) ? n : t;
1953
1967
  }
1954
- function Jn(e) {
1955
- return Math.max(0, qn(e.dataset.formieSubmitDelay, _n));
1968
+ function Zn(e) {
1969
+ return Math.max(0, Xn(e.dataset.formieSubmitDelay, bn));
1956
1970
  }
1957
- function X(e) {
1958
- return Ln(e.dataset.formieValidationOnSubmit);
1971
+ function Z(e) {
1972
+ return Bn(e.dataset.formieValidationOnSubmit);
1959
1973
  }
1960
- async function Yn(e) {
1961
- let t = Jn(e);
1962
- t < 1 || await new Promise((e) => {
1974
+ async function Qn(e) {
1975
+ let t = Zn(e);
1976
+ await new Promise((e) => {
1963
1977
  window.setTimeout(e, t);
1964
1978
  });
1965
1979
  }
1966
- function Z(e, t) {
1980
+ function $n(e, t) {
1967
1981
  let n = e?.getAttribute(t)?.trim();
1968
1982
  if (!n) return null;
1969
1983
  try {
@@ -1973,29 +1987,29 @@ function Z(e, t) {
1973
1987
  return console.error(`[formie] Failed to parse ${t}.`, e), null;
1974
1988
  }
1975
1989
  }
1976
- function Xn(e, t) {
1990
+ function er(e, t) {
1977
1991
  let n = t || (e instanceof HTMLFormElement ? e : null);
1978
1992
  if (!n) return null;
1979
- let r = Z(n, "data-formie-modules"), i = Z(n, "data-formie-theme-classes") || Z(n, "data-formie-theme");
1993
+ let r = $n(n, "data-formie-modules"), i = $n(n, "data-formie-theme-classes") || $n(n, "data-formie-theme");
1980
1994
  return !r && !i ? null : {
1981
1995
  modules: r || void 0,
1982
1996
  theme: i || void 0
1983
1997
  };
1984
1998
  }
1985
- function Zn(e) {
1999
+ function tr(e) {
1986
2000
  if (!(e instanceof HTMLElement)) return !0;
1987
2001
  if (!e.isConnected || e.hidden || e.closest("[hidden]")) return !1;
1988
2002
  let t = window.getComputedStyle(e);
1989
2003
  return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
1990
2004
  }
1991
- function Qn(e, t) {
2005
+ function nr(e, t) {
1992
2006
  return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
1993
2007
  }
1994
2008
  function Q(e) {
1995
2009
  let t = e, n = t.id ? `#${t.id}` : "", r = t.dataset?.formieHandle ? `[handle="${t.dataset.formieHandle}"]` : "";
1996
2010
  return `${t.tagName ? t.tagName.toLowerCase() : "element"}${n}${r}`;
1997
2011
  }
1998
- function $n(e, t) {
2012
+ function rr(e, t) {
1999
2013
  if (t) {
2000
2014
  if (t.csrf?.param && t.csrf?.token) {
2001
2015
  let n = e.querySelector(`input[name="${t.csrf.param}"]`);
@@ -2022,11 +2036,11 @@ function $n(e, t) {
2022
2036
  });
2023
2037
  }
2024
2038
  }
2025
- async function er(e, t) {
2026
- let n = Dn(t.mode), r = On(t.transport);
2039
+ async function ir(e, t) {
2040
+ let n = An(t.mode), r = jn(t.transport);
2027
2041
  if (n !== "server-rendered") return null;
2028
2042
  if (t.payload) return t.payload.html && (e.innerHTML = t.payload.html), t.payload;
2029
- let i = !!kn(e), a = t.formHandle || e.dataset.formieHandle;
2043
+ let i = !!Mn(e), a = t.formHandle || e.dataset.formieHandle;
2030
2044
  if (i || !a) return null;
2031
2045
  let o = {
2032
2046
  mode: n,
@@ -2035,33 +2049,26 @@ async function er(e, t) {
2035
2049
  siteId: t.siteId,
2036
2050
  theme: t.theme,
2037
2051
  themeConfig: t.themeConfig
2038
- }, s = r === "graphql" ? Nn(t, e) : Mn(t, e), c = r === "graphql" ? await Ge(s, a, o, t) : await We(s, a, {
2052
+ }, s = r === "graphql" ? In(t, e) : Fn(t, e), c = r === "graphql" ? await Ye(s, a, o, t) : await Je(s, a, {
2039
2053
  ...o,
2040
2054
  endpoint: s
2041
2055
  }, t);
2042
2056
  return c?.html && (e.innerHTML = c.html), c;
2043
2057
  }
2044
- async function tr(e, t, n) {
2058
+ async function ar(e, t, n) {
2045
2059
  if (t.refreshTokens === !1) return;
2046
2060
  let r = t.formHandle || e.dataset.formieHandle;
2047
2061
  if (!r) return;
2048
- let i = await Ke(Pn(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0, t, n?.querySelector("input[name=\"requestToken\"]")?.value);
2049
- $n(n, i), y(e, "formie:refresh-tokens:refreshed", i);
2062
+ let i = await Xe(Ln(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0, t, n?.querySelector("input[name=\"requestToken\"]")?.value);
2063
+ rr(n, i), g(e, "formie:refresh-tokens:refreshed", i);
2050
2064
  }
2051
- function nr(e, t, n, r, i, a) {
2052
- let o = () => {};
2065
+ function or(e, t, n, r, i, a) {
2053
2066
  t.dataset.formieRequestProfile = n.profile ?? "same-origin-browser", n.profile === "cross-origin-public" && (t.dataset.formieSubmitMethod = "ajax");
2054
- let s = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), c = zn(n, e, t), l = !1, u = t.querySelectorAll("[data-formie-action]"), d = (e) => {
2055
- if (e) {
2056
- t.setAttribute("data-formie-pending-action", e);
2057
- return;
2058
- }
2059
- t.removeAttribute("data-formie-pending-action");
2067
+ let o = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), s = Hn(n, e, t), c = !1, l = t.querySelectorAll("[data-formie-action]"), u = (e) => {
2068
+ e ? t.setAttribute("data-formie-pending-action", e) : t.removeAttribute("data-formie-pending-action");
2060
2069
  };
2061
- if (Bn(t)) {
2062
- let n = rn(t, { shouldWarn: () => !Un(t) });
2063
- o = n.scheduleBaselineCapture;
2064
- let r = (e) => {
2070
+ if (Un(t)) {
2071
+ let n = cn(t, { shouldWarn: () => !Kn(t) }), r = (e) => {
2065
2072
  if (!(e instanceof CustomEvent)) return;
2066
2073
  let t = e.detail;
2067
2074
  t?.ok && (t.action === "save" || t.outcome === "revised") && n.scheduleBaselineCapture();
@@ -2072,41 +2079,41 @@ function nr(e, t, n, r, i, a) {
2072
2079
  e.removeEventListener("formie:submit:result", r), t.removeEventListener("formie:state:reset", i), n.destroy();
2073
2080
  });
2074
2081
  }
2075
- if (u.forEach((e) => {
2082
+ if (l.forEach((e) => {
2076
2083
  let n = (e) => {
2077
2084
  let n = e.currentTarget.getAttribute("data-formie-action"), r = t.querySelector("input[name=\"submitAction\"]");
2078
- d(n), n && r && (r.value = n);
2085
+ u(n), n && r && (r.value = n);
2079
2086
  };
2080
2087
  e.addEventListener("click", n), a.push(() => {
2081
2088
  e.removeEventListener("click", n);
2082
2089
  });
2083
2090
  }), t.querySelectorAll("[data-formie-tab-link]").forEach((n) => {
2084
2091
  let r = async (n) => {
2085
- if (s !== "ajax") {
2086
- Kn(n) && Vn(t, "set-page");
2092
+ if (o !== "ajax") {
2093
+ Yn(n) && Wn(t, "set-page");
2087
2094
  return;
2088
2095
  }
2089
2096
  n.preventDefault();
2090
2097
  let r = n.currentTarget, i = r?.getAttribute("data-formie-page-id"), a = r?.getAttribute("href");
2091
2098
  if (i && a) {
2092
- y(e, "formie:page:navigate", {
2099
+ g(e, "formie:page:navigate", {
2093
2100
  pageId: i,
2094
2101
  href: a
2095
2102
  });
2096
2103
  try {
2097
- let n = await qe(a, t, i);
2098
- if (n.pageId && _(t, String(n.pageId)), !n.success) {
2104
+ let n = await Ze(a, t, i);
2105
+ if (n.pageId && S(t, String(n.pageId)), !n.success) {
2099
2106
  let { form: e = [], ...r } = n.errors ?? {};
2100
- z(t), Ot(t, r), kt(t, e), Ve(t);
2107
+ Vt(t), Mt(t, r), Nt(t, e), F(t);
2101
2108
  return;
2102
2109
  }
2103
- y(e, "formie:page:navigate:after", {
2110
+ g(e, "formie:page:navigate:after", {
2104
2111
  pageId: i,
2105
2112
  href: a,
2106
2113
  response: n
2107
2114
  });
2108
2115
  } catch (t) {
2109
- console.error("[formie] Failed to persist page navigation state.", t), y(e, "formie:page:navigate:error", {
2116
+ console.error("[formie] Failed to persist page navigation state.", t), g(e, "formie:page:navigate:error", {
2110
2117
  pageId: i,
2111
2118
  href: a,
2112
2119
  error: t
@@ -2117,50 +2124,50 @@ function nr(e, t, n, r, i, a) {
2117
2124
  n.addEventListener("click", r), a.push(() => {
2118
2125
  n.removeEventListener("click", r);
2119
2126
  });
2120
- }), !Rn(t)) {
2127
+ }), !Vn(t)) {
2121
2128
  let e = !1, n = () => {
2122
- e || Un(t) || Gn(t) || (e = !0, Je(c, t));
2129
+ e || Kn(t) || Jn(t) || (e = !0, Qe(s, t));
2123
2130
  };
2124
2131
  window.addEventListener("pagehide", n), window.addEventListener("beforeunload", n), a.push(() => {
2125
2132
  window.removeEventListener("pagehide", n), window.removeEventListener("beforeunload", n);
2126
2133
  });
2127
2134
  }
2128
- let f = async (a) => {
2129
- if (l) return;
2130
- let o = s === "ajax";
2135
+ let d = async (a) => {
2136
+ if (c) return;
2137
+ let s = o === "ajax";
2131
2138
  if (a.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
2132
2139
  if (t.getAttribute("data-formie-internal-resubmit") !== "true") return;
2133
2140
  t.removeAttribute("data-formie-internal-resubmit");
2134
2141
  } else t.removeAttribute("data-formie-internal-resubmit");
2135
- let c = a.submitter, u = c?.getAttribute("data-formie-action"), f = t.getAttribute("data-formie-pending-action"), m = t.querySelector("input[name=\"submitAction\"]"), _ = u || f || m?.value || "submit", b = null, x = !1;
2142
+ let l = a.submitter, d = l?.getAttribute("data-formie-action"), p = t.getAttribute("data-formie-pending-action"), h = t.querySelector("input[name=\"submitAction\"]"), _ = d || p || h?.value || "submit", v = null, y = !1;
2136
2143
  try {
2137
- if (o) b = await Lt({
2144
+ if (s) v = await Ht({
2138
2145
  target: e,
2139
2146
  form: t,
2140
2147
  bus: r,
2141
2148
  validator: i,
2142
- validateOnSubmit: X(t),
2149
+ validateOnSubmit: Z(t),
2143
2150
  action: _,
2144
- submitter: c,
2145
- waitForSubmitDelay: Yn,
2151
+ submitter: l,
2152
+ waitForSubmitDelay: Qn,
2146
2153
  onRefreshTokensAfterSubmit: async () => {
2147
- await tr(e, n, t);
2154
+ await ar(e, n, t);
2148
2155
  },
2149
2156
  dispatchSubmitResult: (t) => {
2150
- y(e, "formie:submit:result", t);
2157
+ g(e, "formie:submit:result", t);
2151
2158
  }
2152
2159
  });
2153
2160
  else {
2154
- if (z(t), v(t, c), await Yn(t), b = await st(t, _, r, {
2161
+ if (Vt(t), C(t, l), await Qn(t), v = await dt(t, _, r, {
2155
2162
  validator: i,
2156
- validateOnSubmit: X(t),
2163
+ validateOnSubmit: Z(t),
2157
2164
  preflightOnly: !0
2158
- }), b.ok) {
2159
- p(t, _), l = !0, Vn(t, "submit"), d(null);
2165
+ }), v.ok) {
2166
+ x(t, _), c = !0, Wn(t, "submit"), u(null);
2160
2167
  let e = !1, n = () => {
2161
- if (e = !0, l = !1, Hn(t), h(t), i && X(t)) {
2162
- let { scope: e, final: n } = g(t), r = i.submit(n ? t : e, { final: n });
2163
- r.length > 0 && R(t, {
2168
+ if (e = !0, c = !1, Gn(t), f(t), i && Z(t)) {
2169
+ let { scope: e, final: n } = m(t), r = i.submit(n ? t : e, { final: n });
2170
+ r.length > 0 && z(t, {
2164
2171
  ok: !1,
2165
2172
  stage: "validate",
2166
2173
  code: "VALIDATION_FAILED",
@@ -2179,34 +2186,34 @@ function nr(e, t, n, r, i, a) {
2179
2186
  }
2180
2187
  } else t.submit();
2181
2188
  if (e) return;
2182
- x = !0;
2189
+ y = !0;
2183
2190
  return;
2184
2191
  }
2185
- R(t, b), y(e, "formie:submit:result", b), Hn(t);
2192
+ z(t, v), g(e, "formie:submit:result", v), Gn(t);
2186
2193
  }
2187
2194
  } catch (n) {
2188
- l = !1, b = {
2195
+ c = !1, v = {
2189
2196
  ok: !1,
2190
2197
  code: "SUBMIT_ERROR",
2191
2198
  message: n instanceof Error ? n.message : "Submission failed.",
2192
2199
  formErrors: [n instanceof Error ? n.message : "Submission failed."]
2193
- }, R(t, b), y(e, "formie:submit:result", b), Hn(t);
2200
+ }, z(t, v), g(e, "formie:submit:result", v), Gn(t);
2194
2201
  } finally {
2195
- d(null), !o && !x && !It(b) && h(t);
2202
+ u(null), !s && !y && !Bt(v) && f(t);
2196
2203
  }
2197
2204
  };
2198
- return t.addEventListener("submit", f), a.push(() => {
2199
- t.removeEventListener("submit", f);
2200
- }), o;
2205
+ t.addEventListener("submit", d), a.push(() => {
2206
+ t.removeEventListener("submit", d);
2207
+ });
2201
2208
  }
2202
- async function rr(e, t, n) {
2209
+ async function sr(e, t, n) {
2203
2210
  if (t.refreshTokens === !1 || !t.staticCache) return;
2204
- let r = t.formHandle || e.dataset.formieHandle, i = Pn(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
2211
+ let r = t.formHandle || e.dataset.formieHandle, i = Ln(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
2205
2212
  if (!r) return;
2206
- let o = await Ke(i, r, a, t, n?.querySelector("input[name=\"requestToken\"]")?.value);
2207
- o && n && ($n(n, o), y(e, "formie:refresh-tokens:after", o));
2213
+ let o = await Xe(i, r, a, t, n?.querySelector("input[name=\"requestToken\"]")?.value);
2214
+ o && n && (rr(n, o), g(e, "formie:refresh-tokens:after", o));
2208
2215
  }
2209
- function ir() {
2216
+ function cr() {
2210
2217
  let t = /* @__PURE__ */ new Map(), r = new B(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = [
2211
2218
  "prepare",
2212
2219
  "normalize",
@@ -2222,26 +2229,22 @@ function ir() {
2222
2229
  return;
2223
2230
  }
2224
2231
  let r = (async () => {
2225
- K.log("Unmount requested.", { target: Q(e) });
2232
+ q.log("Unmount requested.", { target: Q(e) });
2226
2233
  let n = i.get(e);
2227
2234
  n && (n(), i.delete(e));
2228
2235
  let r = t.get(e);
2229
- if (!r) {
2230
- K.log("Unmount skipped (no mounted state).", { target: Q(e) });
2231
- return;
2232
- }
2233
- y(e, "formie:unmount:before", { id: r.instance.id }), r.unbinds.forEach((e) => {
2236
+ r ? (g(e, "formie:unmount:before", { id: r.instance.id }), r.unbinds.forEach((e) => {
2234
2237
  e();
2235
- }), r.unbinds = [], r.validator?.destroy(), r.validator = null, await r.modules.destroy(), r.bus.clear(), t.delete(e), y(e, "formie:unmount:after", { id: r.instance.id }), K.log("Unmount complete.", {
2238
+ }), r.unbinds = [], r.validator?.destroy(), r.validator = null, await r.modules.destroy(), r.bus.clear(), t.delete(e), g(e, "formie:unmount:after", { id: r.instance.id }), r.unbindEventContext(), q.log("Unmount complete.", {
2236
2239
  id: r.instance.id,
2237
2240
  target: Q(e)
2238
- });
2241
+ })) : q.log("Unmount skipped (no mounted state).", { target: Q(e) });
2239
2242
  })().finally(() => {
2240
2243
  a.delete(e);
2241
2244
  });
2242
2245
  a.set(e, r), await r;
2243
2246
  }, c = async (a, c) => {
2244
- K.log("Mount requested.", {
2247
+ q.log("Mount requested.", {
2245
2248
  target: Q(a),
2246
2249
  mode: c.mode,
2247
2250
  autoVisible: c.autoVisible
@@ -2249,132 +2252,134 @@ function ir() {
2249
2252
  let l = i.get(a);
2250
2253
  l && (l(), i.delete(a));
2251
2254
  let u = t.get(a);
2252
- if (u) return K.log("Mount skipped (already mounted).", {
2255
+ if (u) return q.log("Mount skipped (already mounted).", {
2253
2256
  id: u.instance.id,
2254
2257
  target: Q(a)
2255
2258
  }), u.instance;
2256
- let d = new Rt(), f = [], p = a?.id || `formie-${t.size + 1}`, h = J(a), g = {
2257
- ...h,
2259
+ let d = new Ut(), f = [], m = a?.id || `formie-${t.size + 1}`, v = Y(a), b = {
2260
+ ...v,
2258
2261
  ...c,
2259
- mode: Dn(c.mode ?? h.mode),
2260
- transport: On(c.transport ?? h.transport)
2261
- }, _ = Ce(g.compatibility), v = await er(a, g), b = kn(a);
2262
- b && e(b, g), g.staticCache = c.staticCache ?? En(b ? b.dataset : a.dataset);
2263
- let S;
2262
+ mode: An(c.mode ?? v.mode),
2263
+ transport: jn(c.transport ?? v.transport)
2264
+ }, x = await ir(a, b), S = Mn(a);
2265
+ c.compatibility === void 0 && S?.hasAttribute("data-formie-compatibility") && (b.compatibility = Y(S).compatibility);
2266
+ let C = Te(b.compatibility);
2267
+ S && e(S, b), b.staticCache = c.staticCache ?? kn(S ? S.dataset : a.dataset);
2268
+ let w;
2264
2269
  try {
2265
- S = Xn(a, b), v?.modules && n(v.modules), S?.modules && n(S.modules);
2270
+ w = er(a, S), x?.modules && n(x.modules), w?.modules && n(w.modules);
2266
2271
  } catch (e) {
2267
- if (b) {
2268
- b.addEventListener("submit", (e) => {
2272
+ if (S) {
2273
+ S.addEventListener("submit", (e) => {
2269
2274
  e.preventDefault(), e.stopImmediatePropagation();
2270
2275
  }, !0);
2271
2276
  let e = document.createElement("div");
2272
- e.setAttribute("role", "alert"), e.textContent = "This form requires a compatible Formie browser package. Update Formie and its browser packages together.", b.prepend(e);
2277
+ e.setAttribute("role", "alert"), e.textContent = "This form requires a compatible Formie browser package. Update Formie and its browser packages together.", S.prepend(e);
2273
2278
  }
2274
2279
  throw e;
2275
2280
  }
2276
- let ee = v || S ? {
2277
- ...v || {},
2278
- ...S || {}
2279
- } : null, te = ee?.theme, ne = {}, w = ee?.modules ?? {
2281
+ let T = x || w ? {
2282
+ ...x || {},
2283
+ ...w || {}
2284
+ } : null, te = T?.theme, ne = {}, E = T?.modules ?? {
2280
2285
  contractVersion: 2,
2281
2286
  surface: "server-rendered",
2282
2287
  entries: []
2283
2288
  };
2284
- n(w), K.log("Resolved mount payload.", {
2289
+ n(E), q.log("Resolved mount payload.", {
2285
2290
  target: Q(a),
2286
- hasRenderPayload: !!v,
2287
- hasEmbeddedPayload: !!S,
2288
- moduleCount: w.entries.length
2291
+ hasRenderPayload: !!x,
2292
+ hasEmbeddedPayload: !!w,
2293
+ moduleCount: E.entries.length
2289
2294
  });
2290
- let T = re(a, te, b), E = b ? new dn(b, {
2291
- live: Ln(b.dataset.formieValidationOnFocus),
2292
- errorAriaLive: M(b),
2293
- errorMessage: b.dataset.formieErrorMessage || "",
2294
- fieldContainerErrorClass: T.fieldLayoutError || [],
2295
- inputErrorClass: T.fieldControlError || [],
2296
- messagesClass: T.fieldErrors || [],
2297
- messageClass: T.fieldError || []
2295
+ let D = re(a, te, S), O = S ? new mn(S, {
2296
+ live: Bn(S.dataset.formieValidationOnFocus),
2297
+ errorAriaLive: Ne(S),
2298
+ errorMessage: S.dataset.formieErrorMessage || "",
2299
+ fieldContainerErrorClass: D.fieldLayoutError || [],
2300
+ inputErrorClass: D.fieldControlError || [],
2301
+ messagesClass: D.fieldErrors || [],
2302
+ messageClass: D.fieldError || []
2298
2303
  }) : null;
2299
- if (b && E) {
2300
- let e = b;
2301
- e.formieValidation = E, ne.validation = E;
2304
+ if (S && O) {
2305
+ let e = S;
2306
+ e.formieValidation = O, ne.validation = O;
2302
2307
  let t = {
2303
- validator: E,
2304
- addValidator: E.addValidator.bind(E),
2305
- removeValidator: E.removeValidator.bind(E)
2308
+ validator: O,
2309
+ addValidator: O.addValidator.bind(O),
2310
+ removeValidator: O.removeValidator.bind(O)
2306
2311
  };
2307
- y(b, "formie:validator:ready", t), y(a, "formie:validator:ready", t);
2312
+ g(S, "formie:validator:ready", t), g(a, "formie:validator:ready", t);
2308
2313
  }
2309
- b && (Qt(b), g.theme && g.theme !== "formie" && b.setAttribute("data-formie-frontend-theme", g.theme), (v || g.endpoint || a.dataset.formieEndpoint) && In(a, b, g), g.mode === "server-rendered" && Be(b) && (ze(b), Ve(b)), C(b)), Object.keys(T).length && y(a, "formie:theme:applied", { hasClasses: !0 });
2310
- let D = await Xt(w, {
2314
+ S && (y(S), (x || b.endpoint || a.dataset.formieEndpoint) && zn(a, S, b), b.mode === "server-rendered" && Ge(S) && (We(S), F(S)), h(S)), Object.keys(D).length && g(a, "formie:theme:applied", { hasClasses: !0 }), S?.querySelector("craft-csrf-input") && await se("craft-csrf-input", S);
2315
+ let k = await tn(E, {
2311
2316
  registry: r,
2312
2317
  matchContext: {
2313
2318
  root: a,
2314
- form: b,
2315
- surface: w.surface
2319
+ form: S,
2320
+ surface: E.surface
2316
2321
  },
2317
2322
  setupContext: {
2318
- formId: p,
2323
+ formId: m,
2319
2324
  root: a,
2320
- form: b,
2325
+ form: S,
2321
2326
  target: a,
2322
2327
  scope: "form",
2323
- surface: w.surface,
2328
+ surface: E.surface,
2324
2329
  state: ne,
2325
2330
  on: (e, t) => d.on(e, t),
2326
- emit: (e, t) => (y(a, e, t), d.emitSafe(e, t).then((t) => {
2327
- t.failed.length > 0 && K.warn("Lifecycle listeners failed.", {
2331
+ emit: (e, t) => (g(a, e, t), d.emitSafe(e, t).then((t) => {
2332
+ t.failed.length > 0 && q.warn("Lifecycle listeners failed.", {
2328
2333
  eventName: e,
2329
2334
  failed: t.failed.length
2330
2335
  });
2331
2336
  }))
2332
2337
  }
2333
2338
  });
2334
- K.log("Module setup complete.", {
2339
+ q.log("Module setup complete.", {
2335
2340
  target: Q(a),
2336
- moduleInstances: D.instances.length
2341
+ moduleInstances: k.instances.length
2337
2342
  });
2338
- let O = {
2339
- id: p,
2343
+ let A = {
2344
+ id: m,
2340
2345
  root: a,
2341
2346
  submit: async (e = "submit") => {
2342
- if (K.log("Submit requested.", {
2343
- id: p,
2347
+ if (q.log("Submit requested.", {
2348
+ id: m,
2344
2349
  target: Q(a),
2345
2350
  action: e
2346
- }), !b) return {
2351
+ }), !S) return {
2347
2352
  ok: !1,
2348
2353
  code: "FORM_NOT_FOUND",
2349
2354
  message: "No form element found for mount target.",
2350
2355
  formErrors: ["No form element found for mount target."]
2351
2356
  };
2352
- let t = b.querySelector("input[name=\"submitAction\"]");
2353
- if (t && (t.value = e), b.getAttribute("data-formie-loading") === "true") return {
2357
+ let t = S.querySelector("input[name=\"submitAction\"]");
2358
+ if (t && (t.value = e), S.getAttribute("data-formie-loading") === "true") return {
2354
2359
  ok: !1,
2355
2360
  code: "SUBMIT_IN_PROGRESS",
2356
2361
  message: "Submission already in progress.",
2357
2362
  formErrors: []
2358
2363
  };
2359
- let n = b.querySelector(`[data-formie-action="${e}"]`), r = await Lt({
2360
- id: p,
2364
+ let n = S.querySelector(`[data-formie-action="${e}"]`), r = await Ht({
2365
+ id: m,
2361
2366
  target: a,
2362
- form: b,
2367
+ form: S,
2363
2368
  bus: d,
2364
- validator: E,
2365
- validateOnSubmit: X(b),
2369
+ validator: O,
2370
+ validateOnSubmit: Z(S),
2366
2371
  action: e,
2367
2372
  submitter: n,
2368
- waitForSubmitDelay: Yn,
2373
+ waitForSubmitDelay: Qn,
2369
2374
  onRefreshTokensAfterSubmit: async () => {
2370
- await tr(a, g, b);
2375
+ await ar(a, b, S);
2371
2376
  },
2372
2377
  dispatchSubmitResult: (e) => {
2373
- y(a, "formie:submit:result", e);
2378
+ g(a, "formie:submit:result", e);
2374
2379
  }
2375
2380
  });
2376
- return K.log("Submit completed.", {
2377
- id: p,
2381
+ return q.log("Submit completed.", {
2382
+ id: m,
2378
2383
  action: e,
2379
2384
  ok: r.ok,
2380
2385
  code: r.code,
@@ -2385,32 +2390,34 @@ function ir() {
2385
2390
  await s(a);
2386
2391
  },
2387
2392
  on: (e, t) => d.on(e, t)
2388
- };
2389
- if (b && (ke({
2393
+ }, j = _(a, S, A);
2394
+ if (S && (Me({
2390
2395
  target: a,
2391
- form: b,
2392
- validatorDetail: E ? {
2393
- validator: E,
2394
- addValidator: E.addValidator.bind(E),
2395
- removeValidator: E.removeValidator.bind(E)
2396
+ form: S,
2397
+ validatorDetail: O ? {
2398
+ validator: O,
2399
+ addValidator: O.addValidator.bind(O),
2400
+ removeValidator: O.removeValidator.bind(O)
2396
2401
  } : null,
2397
- options: _,
2402
+ options: C,
2398
2403
  unbinds: f
2399
- }), Oe({
2404
+ }), Ae({
2400
2405
  target: a,
2401
- form: b,
2402
- instance: O,
2403
- options: _,
2406
+ form: S,
2407
+ instance: A,
2408
+ options: C,
2404
2409
  unbinds: f
2405
- })), b) {
2406
- let e = nr(a, b, g, d, E, f);
2407
- E && (f.push(x(b, E, a)), f.push(gn(b))), await rr(a, g, b), e();
2408
- let t = window.setTimeout(e, 350);
2409
- f.push(() => window.clearTimeout(t));
2410
+ })), S) {
2411
+ or(a, S, b, d, O, f), O && (f.push(p(S, O, a)), f.push(yn(S)));
2412
+ try {
2413
+ await sr(a, b, S);
2414
+ } catch (e) {
2415
+ throw j(), e;
2416
+ }
2410
2417
  }
2411
2418
  o.forEach((e) => {
2412
2419
  let t = d.on(`formie:stage:${e}:before`, async (t) => {
2413
- y(a, `formie:stage:${e}:before`, t);
2420
+ g(a, `formie:stage:${e}:before`, t);
2414
2421
  }), n = d.on(`formie:stage:${e}:before`, async (t) => {
2415
2422
  let n = {
2416
2423
  core: "prepare",
@@ -2420,12 +2427,12 @@ function ir() {
2420
2427
  payment: "payment"
2421
2428
  }, r = t;
2422
2429
  if (e === "prepare") try {
2423
- D.assertReady();
2430
+ k.assertReady();
2424
2431
  } catch {
2425
2432
  r.abort("A required form feature could not start. Reload the page or contact the site administrator.");
2426
2433
  return;
2427
2434
  }
2428
- for (let t of D.instances) if (t.beforeSubmit && n[t.kind ?? "core"] === e) {
2435
+ for (let t of k.instances) if (t.beforeSubmit && n[t.kind ?? "core"] === e) {
2429
2436
  let { form: e, action: n, formData: i, abort: a, isAborted: o, abortReason: s } = r;
2430
2437
  await t.beforeSubmit({
2431
2438
  form: e,
@@ -2437,56 +2444,58 @@ function ir() {
2437
2444
  });
2438
2445
  }
2439
2446
  }), r = d.on(`formie:stage:${e}:after`, async (t) => {
2440
- y(a, `formie:stage:${e}:after`, t);
2447
+ g(a, `formie:stage:${e}:after`, t);
2441
2448
  });
2442
2449
  f.push(t, n, r);
2443
2450
  });
2444
2451
  let ie = d.on("formie:submit:before", async (e) => {
2445
- y(a, "formie:submit:before", e);
2446
- }), k = d.on("formie:submit:after", async (e) => {
2447
- if (y(a, "formie:submit:after", e), !b) return;
2452
+ g(a, "formie:submit:before", e);
2453
+ }), ae = d.on("formie:submit:after", async (e) => {
2454
+ if (g(a, "formie:submit:after", e), !S) return;
2448
2455
  let t = e;
2449
2456
  if (t.code === "PREFLIGHT_COMPLETE") return;
2450
2457
  let n = {
2451
- form: b,
2458
+ form: S,
2452
2459
  action: t.action ?? "submit",
2453
- formData: new FormData(b)
2460
+ formData: new FormData(S)
2454
2461
  };
2455
- for (let e of D.instances) await e.afterSubmit?.(n, t);
2456
- }), ae = d.on("formie:submit:final:before", async (e) => {
2457
- y(a, "formie:submit:final:before", e);
2462
+ for (let e of k.instances) await e.afterSubmit?.(n, t);
2463
+ }), M = d.on("formie:submit:final:before", async (e) => {
2464
+ g(a, "formie:submit:final:before", e);
2458
2465
  }), oe = d.on("formie:submit:final:after", async (e) => {
2459
- y(a, "formie:submit:final:after", e);
2466
+ g(a, "formie:submit:final:after", e);
2460
2467
  });
2461
- return f.push(ie, k, ae, oe), t.set(a, {
2462
- options: g,
2468
+ return f.push(ie, ae, M, oe), t.set(a, {
2469
+ options: b,
2463
2470
  bus: d,
2464
- form: b,
2465
- validator: E,
2466
- modules: D,
2471
+ form: S,
2472
+ validator: O,
2473
+ modules: k,
2467
2474
  unbinds: f,
2468
- instance: O
2469
- }), y(a, "formie:mount:after", {
2470
- id: p,
2471
- mode: g.mode
2472
- }), b instanceof HTMLFormElement && m(b), K.log("Mount complete.", {
2473
- id: p,
2475
+ instance: A,
2476
+ unbindEventContext: j
2477
+ }), g(a, "formie:mount:after", {
2478
+ id: m,
2479
+ mode: b.mode,
2480
+ instance: A
2481
+ }), S instanceof HTMLFormElement && ee(S), q.log("Mount complete.", {
2482
+ id: m,
2474
2483
  target: Q(a),
2475
- mode: g.mode
2476
- }), O;
2484
+ mode: b.mode
2485
+ }), A;
2477
2486
  }, l = (e, n) => {
2478
- if (!n.autoVisible || Zn(e) || typeof IntersectionObserver > "u") return c(e, n);
2487
+ if (!n.autoVisible || tr(e) || typeof IntersectionObserver > "u") return c(e, n);
2479
2488
  if (t.has(e)) return Promise.resolve(t.get(e)?.instance || null);
2480
- if (i.has(e)) return K.log("Mount deferred (already waiting visibility).", { target: Q(e) }), Promise.resolve(null);
2489
+ if (i.has(e)) return q.log("Mount deferred (already waiting visibility).", { target: Q(e) }), Promise.resolve(null);
2481
2490
  let r = new IntersectionObserver((t) => {
2482
- t.some((t) => t.target === e && t.isIntersecting) && (r.disconnect(), i.delete(e), K.log("Visibility reached, proceeding mount.", { target: Q(e) }), c(e, {
2491
+ t.some((t) => t.target === e && t.isIntersecting) && (r.disconnect(), i.delete(e), q.log("Visibility reached, proceeding mount.", { target: Q(e) }), c(e, {
2483
2492
  ...n,
2484
2493
  autoVisible: !1
2485
2494
  }));
2486
2495
  }, { threshold: .01 });
2487
2496
  return r.observe(e), i.set(e, () => {
2488
2497
  r.disconnect();
2489
- }), K.log("Mount deferred until visible.", { target: Q(e) }), Promise.resolve(null);
2498
+ }), q.log("Mount deferred until visible.", { target: Q(e) }), Promise.resolve(null);
2490
2499
  };
2491
2500
  return {
2492
2501
  mount: c,
@@ -2494,7 +2503,7 @@ function ir() {
2494
2503
  update: async (e, n) => {
2495
2504
  let r = t.get(e);
2496
2505
  if (!r) return c(e, {
2497
- ...J(e),
2506
+ ...Y(e),
2498
2507
  ...n,
2499
2508
  mode: n.mode || "server-rendered"
2500
2509
  });
@@ -2502,32 +2511,32 @@ function ir() {
2502
2511
  ...r.options,
2503
2512
  ...n
2504
2513
  };
2505
- let i = n.payload?.theme || r.options.payload?.theme || Xn(e, r.form)?.theme, a = re(e, i, r.form);
2506
- return r.validator && (r.validator.config.fieldContainerErrorClass = a.fieldLayoutError || [], r.validator.config.inputErrorClass = a.fieldControlError || [], r.validator.config.messagesClass = a.fieldErrors || [], r.validator.config.messageClass = a.fieldError || []), Object.keys(a).length && y(e, "formie:theme:applied", {
2514
+ let i = n.payload?.theme || r.options.payload?.theme || er(e, r.form)?.theme, a = re(e, i, r.form);
2515
+ return r.validator && (r.validator.config.fieldContainerErrorClass = a.fieldLayoutError || [], r.validator.config.inputErrorClass = a.fieldControlError || [], r.validator.config.messagesClass = a.fieldErrors || [], r.validator.config.messageClass = a.fieldError || []), Object.keys(a).length && g(e, "formie:theme:applied", {
2507
2516
  hasClasses: !0,
2508
2517
  reason: "update"
2509
2518
  }), r.instance;
2510
2519
  },
2511
2520
  getInstance: (e) => t.get(e)?.instance || null,
2512
2521
  refreshForCache: async (e) => {
2513
- An("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
2522
+ Nn("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
2514
2523
  let n = null;
2515
2524
  if (n = typeof e == "string" ? document.getElementById(e) || document.querySelector(`[data-formie-form-id="${e}"]`) : e, !n) {
2516
- K.warn("refreshForCache target not found.", { targetOrId: e });
2525
+ q.warn("refreshForCache target not found.", { targetOrId: e });
2517
2526
  return;
2518
2527
  }
2519
- let r = t.get(n), i = kn(n), a = r?.options || J(n);
2528
+ let r = t.get(n), i = Mn(n), a = r?.options || Y(n);
2520
2529
  if (!i) {
2521
- K.warn("refreshForCache found no form element for target.", { target: Q(n) });
2530
+ q.warn("refreshForCache found no form element for target.", { target: Q(n) });
2522
2531
  return;
2523
2532
  }
2524
- let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = Pn(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
2533
+ let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = Ln(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
2525
2534
  if (!o) {
2526
- K.warn("refreshForCache found no form handle for target.", { target: Q(n) });
2535
+ q.warn("refreshForCache found no form handle for target.", { target: Q(n) });
2527
2536
  return;
2528
2537
  }
2529
- let l = await Ke(s, o, c, a, i?.querySelector("input[name=\"requestToken\"]")?.value);
2530
- l && ($n(i, l), y(n, "formie:refresh-tokens:after", l));
2538
+ let l = await Xe(s, o, c, a, i?.querySelector("input[name=\"requestToken\"]")?.value);
2539
+ l && (rr(i, l), g(n, "formie:refresh-tokens:after", l));
2531
2540
  },
2532
2541
  registerModule: (e, t) => r.register(e, t),
2533
2542
  unregisterModule: (e) => {
@@ -2535,16 +2544,16 @@ function ir() {
2535
2544
  },
2536
2545
  getRegisteredModules: () => r.getAll(),
2537
2546
  scan: async (e) => {
2538
- let t = e || document, n = Array.from(t.querySelectorAll(G));
2539
- K.log("Scan started.", {
2547
+ let t = e || document, n = Array.from(t.querySelectorAll(K));
2548
+ q.log("Scan started.", {
2540
2549
  scope: t === document ? "document" : t,
2541
2550
  targetCount: n.length
2542
2551
  });
2543
2552
  let r = (await Promise.all(n.map((e) => {
2544
- let t = J(e);
2553
+ let t = Y(e);
2545
2554
  return l(e, t);
2546
2555
  }))).filter((e) => !!e);
2547
- return K.log("Scan finished.", {
2556
+ return q.log("Scan finished.", {
2548
2557
  mountedCount: r.length,
2549
2558
  deferredCount: n.length - r.length
2550
2559
  }), r;
@@ -2552,16 +2561,16 @@ function ir() {
2552
2561
  observe: (e) => {
2553
2562
  if (typeof MutationObserver > "u") return () => {};
2554
2563
  let n = e || document;
2555
- K.log("Observer started.", { scope: n === document ? "document" : n });
2564
+ q.log("Observer started.", { scope: n === document ? "document" : n });
2556
2565
  let r = new MutationObserver((e) => {
2557
2566
  e.forEach((e) => {
2558
2567
  e.addedNodes.forEach((e) => {
2559
- e instanceof Element && (e.matches(G) && (K.log("Observer detected new root.", { target: Q(e) }), l(e, J(e))), e.querySelectorAll(G).forEach((e) => {
2560
- K.log("Observer detected new nested root.", { target: Q(e) }), l(e, J(e));
2568
+ e instanceof Element && (e.matches(K) && (q.log("Observer detected new root.", { target: Q(e) }), l(e, Y(e))), e.querySelectorAll(K).forEach((e) => {
2569
+ q.log("Observer detected new nested root.", { target: Q(e) }), l(e, Y(e));
2561
2570
  }));
2562
2571
  }), e.removedNodes.forEach((e) => {
2563
- e instanceof Element && (t.has(e) && (K.log("Observer detected removed root.", { target: Q(e) }), s(e)), e.querySelectorAll(G).forEach((e) => {
2564
- t.has(e) && (K.log("Observer detected removed nested root.", { target: Q(e) }), s(e));
2572
+ e instanceof Element && (t.has(e) && (q.log("Observer detected removed root.", { target: Q(e) }), s(e)), e.querySelectorAll(K).forEach((e) => {
2573
+ t.has(e) && (q.log("Observer detected removed nested root.", { target: Q(e) }), s(e));
2565
2574
  }));
2566
2575
  });
2567
2576
  });
@@ -2570,11 +2579,11 @@ function ir() {
2570
2579
  childList: !0,
2571
2580
  subtree: !0
2572
2581
  }), () => {
2573
- r.disconnect(), K.log("Observer stopped."), i.forEach((e, t) => {
2574
- Qn(t, n) && (e(), i.delete(t));
2582
+ r.disconnect(), q.log("Observer stopped."), i.forEach((e, t) => {
2583
+ nr(t, n) && (e(), i.delete(t));
2575
2584
  });
2576
2585
  let e = [];
2577
- n instanceof Element && n.matches(G) && e.push(n), n.querySelectorAll(G).forEach((t) => {
2586
+ n instanceof Element && n.matches(K) && e.push(n), n.querySelectorAll(K).forEach((t) => {
2578
2587
  e.push(t);
2579
2588
  }), e.forEach((e) => {
2580
2589
  t.has(e) && s(e);
@@ -2585,13 +2594,13 @@ function ir() {
2585
2594
  }
2586
2595
  //#endregion
2587
2596
  //#region src/js/core/hydrate-modules.ts
2588
- var ar = T("general", "module-hydrator");
2589
- async function or(e) {
2597
+ var lr = O("general", "module-hydrator");
2598
+ async function ur(e) {
2590
2599
  let t = e.root, n = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form") ?? t.querySelector("form")), r = e.surface ?? "cp-edit", i = e.modules ?? {
2591
2600
  contractVersion: 2,
2592
2601
  surface: r,
2593
2602
  entries: []
2594
- }, a = e.registry ?? new B(), o = new Rt(), s = await Xt(i, {
2603
+ }, a = e.registry ?? new B(), o = new Ut(), s = await tn(i, {
2595
2604
  registry: a,
2596
2605
  setupContext: {
2597
2606
  formId: n?.id || t.id || "formie-modules",
@@ -2616,7 +2625,7 @@ async function or(e) {
2616
2625
  surface: r
2617
2626
  }
2618
2627
  });
2619
- return ar.log("Hydrated module manifest.", {
2628
+ return lr.log("Hydrated module manifest.", {
2620
2629
  moduleCount: i.entries.length,
2621
2630
  instanceCount: s.instances.length,
2622
2631
  surface: r
@@ -2686,41 +2695,41 @@ async function or(e) {
2686
2695
  function $(e) {
2687
2696
  return e instanceof Element;
2688
2697
  }
2689
- function sr(e) {
2698
+ function dr(e) {
2690
2699
  return e.ok;
2691
2700
  }
2692
- function cr(e) {
2701
+ function fr(e) {
2693
2702
  return typeof e == "string" ? `selector "${e}"` : $(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
2694
2703
  }
2695
- function lr(e) {
2704
+ function pr(e) {
2696
2705
  let t = /* @__PURE__ */ new Set(), n = [];
2697
2706
  for (let r of e) $(r) && !t.has(r) && (t.add(r), n.push(r));
2698
2707
  return n;
2699
2708
  }
2700
- function ur(e) {
2701
- return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : $(e) ? [e] : lr(e);
2709
+ function mr(e) {
2710
+ return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : $(e) ? [e] : pr(e);
2702
2711
  }
2703
- function dr() {
2712
+ function hr() {
2704
2713
  return document.readyState === "loading" ? new Promise((e) => {
2705
2714
  document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
2706
2715
  }) : Promise.resolve();
2707
2716
  }
2708
- async function fr(e) {
2709
- let t = ur(e);
2710
- return t.length > 0 || typeof e != "string" ? t : (await dr(), ur(e));
2717
+ async function gr(e) {
2718
+ let t = mr(e);
2719
+ return t.length > 0 || typeof e != "string" ? t : (await hr(), mr(e));
2711
2720
  }
2712
- function pr(e) {
2721
+ function _r(e) {
2713
2722
  return typeof e == "string" ? document : $(e) ? e.getRootNode() : document;
2714
2723
  }
2715
- function mr(e) {
2724
+ function vr(e) {
2716
2725
  let { element: t, observe: n, allowEmpty: r, client: i, onReady: a, onResult: o, onSuccess: s, onError: c, onEvent: l, ...u } = e;
2717
2726
  return {
2718
2727
  mode: "server-rendered",
2719
2728
  ...u
2720
2729
  };
2721
2730
  }
2722
- async function hr(e, t, n, r) {
2723
- let i = [], a = mr(e);
2731
+ async function yr(e, t, n, r) {
2732
+ let i = [], a = vr(e);
2724
2733
  for (let o of r) {
2725
2734
  let r = n.get(o);
2726
2735
  if (r) {
@@ -2730,7 +2739,7 @@ async function hr(e, t, n, r) {
2730
2739
  let s = await t.mount(o, a), c = [];
2731
2740
  if (e.onReady?.(s), c.push(s.on("formie:submit:result", (t) => {
2732
2741
  let n = t;
2733
- e.onResult?.(n, s), sr(n) ? e.onSuccess?.(n, s) : e.onError?.(n, s);
2742
+ e.onResult?.(n, s), dr(n) ? e.onSuccess?.(n, s) : e.onError?.(n, s);
2734
2743
  })), e.onEvent) for (let t of l) c.push(s.on(t, (n) => {
2735
2744
  e.onEvent?.({
2736
2745
  name: t,
@@ -2744,11 +2753,11 @@ async function hr(e, t, n, r) {
2744
2753
  }
2745
2754
  return i;
2746
2755
  }
2747
- async function gr(e) {
2748
- let t = e.client ?? ir(), n = /* @__PURE__ */ new Map(), r = await fr(e.element);
2749
- if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${cr(e.element)}.`);
2750
- await hr(e, t, n, r);
2751
- let i = e.observe ? t.observe(pr(e.element)) : null;
2756
+ async function br(e) {
2757
+ let t = e.client ?? cr(), n = /* @__PURE__ */ new Map(), r = await gr(e.element);
2758
+ if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${fr(e.element)}.`);
2759
+ await yr(e, t, n, r);
2760
+ let i = e.observe ? t.observe(_r(e.element)) : null;
2752
2761
  return {
2753
2762
  client: t,
2754
2763
  get instances() {
@@ -2759,8 +2768,8 @@ async function gr(e) {
2759
2768
  return r ? n.get(r)?.instance ?? t.getInstance(r) : null;
2760
2769
  },
2761
2770
  async rescan() {
2762
- let r = ur(e.element);
2763
- return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : hr(e, t, n, r);
2771
+ let r = mr(e.element);
2772
+ return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : yr(e, t, n, r);
2764
2773
  },
2765
2774
  async destroy() {
2766
2775
  i?.();
@@ -2771,7 +2780,7 @@ async function gr(e) {
2771
2780
  }
2772
2781
  //#endregion
2773
2782
  //#region src/js/core/client-rendered-modules.ts
2774
- var _r = {
2783
+ var xr = {
2775
2784
  conditions: {
2776
2785
  kind: "core",
2777
2786
  reason: "Core evaluates structured conditions and the adapter renders visibility."
@@ -2805,8 +2814,8 @@ var _r = {
2805
2814
  reason: "The adapter renders the structured date input contract."
2806
2815
  }
2807
2816
  };
2808
- async function vr(t, n, r = zt) {
2809
- for (let [e, t] of Object.entries(_r)) {
2817
+ async function Sr(t, n, r = Wt) {
2818
+ for (let [e, t] of Object.entries(xr)) {
2810
2819
  let n = `formie:${e}`;
2811
2820
  r.get(n) || r.register({
2812
2821
  moduleId: n,
@@ -2834,7 +2843,7 @@ async function vr(t, n, r = zt) {
2834
2843
  }
2835
2844
  };
2836
2845
  a();
2837
- let o = n.subscribe(a), s = await or({
2846
+ let o = n.subscribe(a), s = await ur({
2838
2847
  root: t,
2839
2848
  modules: n.getState().definition.modules,
2840
2849
  surface: "client-rendered",
@@ -2868,4 +2877,4 @@ async function vr(t, n, r = zt) {
2868
2877
  };
2869
2878
  }
2870
2879
  //#endregion
2871
- export { l as FORMIE_HTML_EVENT_NAMES, dn as FormieValidator, xe as LEGACY_FORMIE_DOM_EVENT_BRIDGES, Se as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, B as ModuleRegistry, Oe as bindLegacyDomEventCompatibility, ke as bindLegacyValidatorCompatibility, ve as buildFieldValueRegistry, zt as clientRenderedModuleRegistry, T as createDebug, ir as createFormieClient, ne as debugLog, w as debugWarn, be as defineAddressModule, fe as defineCaptchaModule, de as definePassiveCaptchaModule, S as definePaymentModule, he as fieldKeyToInputName, gr as formie, c as getFieldModuleEventName, ue as getFormieTranslations, s as getGlobalModuleLifecycleEventName, i as getScopedModuleLifecycleEventName, or as hydrateFormieModules, pe as inputNameToFieldKey, te as isFormieDebugEnabled, ce as mergeFormieTranslations, vr as mountClientRenderedModules, me as normalizeFieldKey, u as normalizeFormieEventName, ge as parseFieldReference, ye as resolveFieldReferenceFromFormData, _e as resolveFieldReferenceLive, Ce as resolveLegacyCompatibilityOptions, ee as setFormieDebugEnabled, le as setFormieTranslations, se as t, a as toDomEventName, oe as translate };
2880
+ export { l as FORMIE_HTML_EVENT_NAMES, mn as FormieValidator, Ce as LEGACY_FORMIE_DOM_EVENT_BRIDGES, we as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, B as ModuleRegistry, Ae as bindLegacyDomEventCompatibility, Me as bindLegacyValidatorCompatibility, be as buildFieldValueRegistry, Wt as clientRenderedModuleRegistry, O as createDebug, cr as createFormieClient, E as debugLog, D as debugWarn, Se as defineAddressModule, me as defineCaptchaModule, pe as definePassiveCaptchaModule, w as definePaymentModule, _e as fieldKeyToInputName, br as formie, c as getFieldModuleEventName, fe as getFormieTranslations, s as getGlobalModuleLifecycleEventName, i as getScopedModuleLifecycleEventName, ur as hydrateFormieModules, he as inputNameToFieldKey, ne as isFormieDebugEnabled, ue as mergeFormieTranslations, Sr as mountClientRenderedModules, ge as normalizeFieldKey, u as normalizeFormieEventName, ve as parseFieldReference, xe as resolveFieldReferenceFromFormData, ye as resolveFieldReferenceLive, Te as resolveLegacyCompatibilityOptions, te as setFormieDebugEnabled, de as setFormieTranslations, le as t, a as toDomEventName, ce as translate };