@verbb/formie-browser 1.0.6 → 1.0.8

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 (104) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/chunks/_survey-presentations-CFsgToRT.js +4 -0
  3. package/dist/chunks/{address-finder-yXU5yMjG.js → address-finder-k7_BXaRe.js} +1 -1
  4. package/dist/chunks/{api-DMK8NSUI.js → api-BUb6P-xu.js} +57 -51
  5. package/dist/chunks/{api-CmwLRq_n.js → api-C8wyLC-s.js} +235 -193
  6. package/dist/chunks/{bpoint-DSjqRv63.js → bpoint-CwSw_p7A.js} +1 -1
  7. package/dist/chunks/{captcha-eu-CWJb64_j.js → captcha-eu-CGm8Lbrj.js} +2 -2
  8. package/dist/chunks/{conditions-DjZOtHfS.js → conditions-B6_nzpeE.js} +95 -83
  9. package/dist/chunks/{eway-D3ctTbEk.js → eway-B30BMlDp.js} +2 -2
  10. package/dist/chunks/{friendly-captcha-v1-ByXzENYZ.js → friendly-captcha-v1-C_2reOXr.js} +1 -1
  11. package/dist/chunks/{friendly-captcha-v2-BPdlmhQu.js → friendly-captcha-v2-CLSAbkqx.js} +1 -1
  12. package/dist/chunks/{go-cardless-BwASSYSK.js → go-cardless-BiF3iLel.js} +1 -1
  13. package/dist/chunks/{google-address-OhKilPWE.js → google-address-BH3Zhi06.js} +1 -1
  14. package/dist/chunks/{hcaptcha-CdCd9oEi.js → hcaptcha-CGLAmgjO.js} +2 -2
  15. package/dist/chunks/{loqate-Cp2zvwpE.js → loqate-CJPzBmSm.js} +1 -1
  16. package/dist/chunks/{mollie-COG-ko2D.js → mollie-D__SwtcH.js} +1 -1
  17. package/dist/chunks/{moneris-CMH8PlRc.js → moneris-KJS1BKx7.js} +1 -1
  18. package/dist/chunks/{opayo-D2jsR5vh.js → opayo-A_LIkc-v.js} +4 -4
  19. package/dist/chunks/{paddle-DxF88RfC.js → paddle-BjbOOb0m.js} +2 -2
  20. package/dist/chunks/{paypal-b5pnwrA2.js → paypal-CyjHIV8v.js} +2 -2
  21. package/dist/chunks/{payway-BJYu9DIR.js → payway-a_cyrr3j.js} +2 -2
  22. package/dist/chunks/{recaptcha-enterprise-BSwi8IVX.js → recaptcha-enterprise-XPId5-bS.js} +19 -20
  23. package/dist/chunks/{recaptcha-shared-B4zAescW.js → recaptcha-shared-CLYJvojk.js} +15 -3
  24. package/dist/chunks/{recaptcha-v2-checkbox-CnDQmsKa.js → recaptcha-v2-checkbox-Cy-0PEPc.js} +2 -2
  25. package/dist/chunks/{recaptcha-v2-invisible-Cz5uIlp-.js → recaptcha-v2-invisible-BwRH540O.js} +2 -2
  26. package/dist/chunks/recaptcha-v3-No4Ykrhk.js +28 -0
  27. package/dist/chunks/scripts-CbQ7agX3.js +30 -0
  28. package/dist/chunks/{snaptcha-vz1RnZ15.js → snaptcha-DKx98oon.js} +1 -1
  29. package/dist/chunks/{square-BP8RWAKB.js → square-Bga6WXHV.js} +2 -2
  30. package/dist/chunks/{stripe-MihN63uC.js → stripe-BlqVocl3.js} +2 -2
  31. package/dist/chunks/{summary-D3AjxpYN.js → summary-Dks0gXS3.js} +42 -38
  32. package/dist/chunks/survey-likert-DmJ3klhP.js +20 -0
  33. package/dist/chunks/survey-rank-DeUenftw.js +127 -0
  34. package/dist/chunks/survey-rating-BPUYDgBJ.js +88 -0
  35. package/dist/chunks/{turnstile-D_Pi1CKM.js → turnstile-DJakPzQD.js} +3 -3
  36. package/dist/css/formie-theme.css +1 -0
  37. package/dist/css/theme/fields/_survey-presentations.css +396 -0
  38. package/dist/index.js +651 -597
  39. package/dist/js/contracts/schema.d.ts +5 -0
  40. package/dist/js/contracts/schema.d.ts.map +1 -1
  41. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  42. package/dist/js/core/error-aria-live.d.ts +6 -0
  43. package/dist/js/core/error-aria-live.d.ts.map +1 -0
  44. package/dist/js/core/page-client-event.d.ts +8 -4
  45. package/dist/js/core/page-client-event.d.ts.map +1 -1
  46. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  47. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  48. package/dist/js/modules/captchas/factories.d.ts.map +1 -1
  49. package/dist/js/modules/captchas/host.d.ts +1 -0
  50. package/dist/js/modules/captchas/host.d.ts.map +1 -1
  51. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -1
  52. package/dist/js/modules/captchas/recaptcha-shared.d.ts +1 -0
  53. package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -1
  54. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
  55. package/dist/js/modules/captchas/turnstile.d.ts.map +1 -1
  56. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  57. package/dist/js/modules/fields/index.d.ts.map +1 -1
  58. package/dist/js/modules/fields/summary.d.ts.map +1 -1
  59. package/dist/js/modules/fields/survey-likert.d.ts +3 -0
  60. package/dist/js/modules/fields/survey-likert.d.ts.map +1 -0
  61. package/dist/js/modules/fields/survey-rank.d.ts +3 -0
  62. package/dist/js/modules/fields/survey-rank.d.ts.map +1 -0
  63. package/dist/js/modules/fields/survey-rating.d.ts +3 -0
  64. package/dist/js/modules/fields/survey-rating.d.ts.map +1 -0
  65. package/dist/js/transport/forms-api.d.ts.map +1 -1
  66. package/dist/js/utils/form-started-at.d.ts +2 -0
  67. package/dist/js/utils/form-started-at.d.ts.map +1 -0
  68. package/dist/js/utils/scripts.d.ts.map +1 -1
  69. package/dist/js/utils/unload-warning.d.ts.map +1 -1
  70. package/dist/js/validation/enter-key-guard.d.ts +2 -0
  71. package/dist/js/validation/enter-key-guard.d.ts.map +1 -0
  72. package/dist/js/validation/types.d.ts +1 -0
  73. package/dist/js/validation/types.d.ts.map +1 -1
  74. package/dist/js/validation/validator.d.ts.map +1 -1
  75. package/package.json +2 -2
  76. package/src/css/formie-theme.css +1 -0
  77. package/src/css/theme/fields/_survey-presentations.css +396 -0
  78. package/src/js/contracts/schema.ts +6 -0
  79. package/src/js/core/create-formie-client.ts +21 -1
  80. package/src/js/core/error-aria-live.ts +45 -0
  81. package/src/js/core/page-client-event.ts +86 -18
  82. package/src/js/core/submit-result-state.ts +10 -2
  83. package/src/js/core/submit-result-ui.ts +8 -4
  84. package/src/js/modules/captchas/factories.ts +4 -0
  85. package/src/js/modules/captchas/host.ts +14 -2
  86. package/src/js/modules/captchas/recaptcha-enterprise.ts +14 -11
  87. package/src/js/modules/captchas/recaptcha-shared.ts +14 -0
  88. package/src/js/modules/captchas/recaptcha-v3.ts +7 -4
  89. package/src/js/modules/captchas/turnstile.ts +9 -3
  90. package/src/js/modules/fields/conditions/effects.ts +42 -0
  91. package/src/js/modules/fields/index.ts +3 -0
  92. package/src/js/modules/fields/summary.ts +17 -3
  93. package/src/js/modules/fields/survey-likert.ts +50 -0
  94. package/src/js/modules/fields/survey-rank.ts +385 -0
  95. package/src/js/modules/fields/survey-rating.ts +182 -0
  96. package/src/js/transport/forms-api.ts +1 -0
  97. package/src/js/utils/form-started-at.ts +25 -0
  98. package/src/js/utils/scripts.ts +16 -0
  99. package/src/js/utils/unload-warning.ts +1 -0
  100. package/src/js/validation/enter-key-guard.ts +63 -0
  101. package/src/js/validation/types.ts +1 -0
  102. package/src/js/validation/validator.ts +14 -5
  103. package/dist/chunks/recaptcha-v3-BtbbP111.js +0 -27
  104. package/dist/chunks/scripts-6CYSUGKQ.js +0 -24
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { c as e, d as t, l as n, o as r, r as i, t as a, u as o } from "./chunks/event-names-BCI2FLD8.js";
2
- import { a as s, i as c, n as l, r as u, t as d } from "./chunks/debug-BV0DvdHx.js";
3
- import { a as f, c as p, d as ee, i as m, l as h, n as g, o as _, r as v, s as y, t as b, u as x } from "./chunks/api-CmwLRq_n.js";
4
- import { n as te, r as S, t as C } from "./chunks/theme-classes-Tv7q7ToE.js";
5
- import { t as w } from "./chunks/http-D-JExro7.js";
6
- import { a as T, i as E, n as ne, r as re, t as ie } from "./chunks/i18n-BY1ds1BL.js";
7
- import { n as ae, t as oe } from "./chunks/api-DMK8NSUI.js";
2
+ import { a as s, c, d as l, f as u, i as d, l as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y } from "./chunks/api-C8wyLC-s.js";
3
+ import { a as b, i as x, n as S, r as ee, t as C } from "./chunks/debug-BV0DvdHx.js";
4
+ import { n as te, r as w, t as T } from "./chunks/theme-classes-Tv7q7ToE.js";
5
+ import { t as E } from "./chunks/http-D-JExro7.js";
6
+ import { a as D, i as O, n as ne, r as re, t as ie } from "./chunks/i18n-BY1ds1BL.js";
7
+ import { n as ae, t as oe } from "./chunks/api-BUb6P-xu.js";
8
8
  import { n as se, r as ce, t as le } from "./chunks/field-references.keys-58ZSTrCW.js";
9
9
  import { i as ue, n as de, r as fe, t as pe } from "./chunks/field-references.resolver-CHwn0G0L.js";
10
10
  import { t as me } from "./chunks/api-sPqGbOww.js";
@@ -149,30 +149,30 @@ function Se({ target: e, form: n, instance: r, options: i, unbinds: a }) {
149
149
  }
150
150
  //#endregion
151
151
  //#region src/js/compatibility/validator-adapter.ts
152
- function D(e, t, n) {
152
+ function k(e, t, n) {
153
153
  e.dispatchEvent(new CustomEvent(t, {
154
154
  bubbles: !0,
155
155
  detail: n
156
156
  }));
157
157
  }
158
- function Ce(e, t) {
158
+ function A(e, t) {
159
159
  return !!e && typeof e == "object" && e.validator === t;
160
160
  }
161
- function we({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
161
+ function Ce({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
162
162
  if (!r.legacyValidatorEvents || !n) return;
163
163
  let { validator: a, addValidator: o, removeValidator: s } = n, c = {
164
164
  ...n,
165
165
  form: t,
166
166
  target: e
167
167
  };
168
- D(document, "formieValidatorInitialized", c);
168
+ k(document, "formieValidatorInitialized", c);
169
169
  let l = (e) => {
170
- !(e instanceof CustomEvent) || !Ce(e.detail, a) || D(document, "formieValidatorDestroyed", {
170
+ !(e instanceof CustomEvent) || !A(e.detail, a) || k(document, "formieValidatorDestroyed", {
171
171
  ...c,
172
172
  ...e.detail
173
173
  });
174
174
  }, u = (n) => {
175
- !(n instanceof CustomEvent) || !Ce(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && D(n.target, "formieValidatorShowError", {
175
+ !(n instanceof CustomEvent) || !A(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && k(n.target, "formieValidatorShowError", {
176
176
  ...n.detail,
177
177
  addValidator: o,
178
178
  removeValidator: s,
@@ -180,7 +180,7 @@ function we({ target: e, form: t, validatorDetail: n, options: r, unbinds: i })
180
180
  target: e
181
181
  });
182
182
  }, d = (n) => {
183
- !(n instanceof CustomEvent) || !Ce(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && D(n.target, "formieValidatorClearError", {
183
+ !(n instanceof CustomEvent) || !A(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && k(n.target, "formieValidatorClearError", {
184
184
  ...n.detail,
185
185
  addValidator: o,
186
186
  removeValidator: s,
@@ -193,47 +193,58 @@ function we({ target: e, form: t, validatorDetail: n, options: r, unbinds: i })
193
193
  });
194
194
  }
195
195
  //#endregion
196
- //#region src/js/core/dom-events.ts
197
- function O(e, n, r) {
198
- e.dispatchEvent(new CustomEvent(t(n), {
199
- bubbles: !0,
200
- detail: r
201
- }));
196
+ //#region src/js/core/error-aria-live.ts
197
+ function we(e) {
198
+ let t = (e.dataset.formieErrorAriaLive || "polite").trim().toLowerCase();
199
+ return t === "assertive" || t === "off" ? t : "polite";
200
+ }
201
+ function Te(e, t) {
202
+ return e === "off" ? null : t ? e : "polite";
203
+ }
204
+ function Ee(e) {
205
+ return e === "off" ? null : e;
206
+ }
207
+ function De(e, t) {
208
+ if (t) {
209
+ e.setAttribute("aria-live", t), e.setAttribute("aria-atomic", "true");
210
+ return;
211
+ }
212
+ e.removeAttribute("aria-live"), e.removeAttribute("aria-atomic");
202
213
  }
203
214
  //#endregion
204
215
  //#region src/js/core/validation-focus.ts
205
- function Te(e, t) {
216
+ function Oe(e, t) {
206
217
  let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
207
218
  r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
208
219
  }
209
- function Ee(e) {
220
+ function ke(e) {
210
221
  return Array.from(e.querySelectorAll("[data-formie-field-handle]")).find((e) => e.getAttribute("data-formie-field-has-error") === "true" ? !0 : e.querySelector("[data-formie-field-error]") !== null) || null;
211
222
  }
212
- function De(e) {
223
+ function Ae(e) {
213
224
  return e.querySelector("[aria-invalid=\"true\"]") || e.querySelector("input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])");
214
225
  }
215
- function Oe(e) {
226
+ function je(e) {
216
227
  return e.querySelector("[data-formie-message-error], [data-formie-error-container], [data-formie-errors]");
217
228
  }
218
- function ke(e) {
229
+ function Me(e) {
219
230
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
220
231
  let n = t;
221
232
  if (!(n.getAttribute("data-formie-field-has-error") === "true" || n.querySelector("[data-formie-field-error]") !== null)) return;
222
- n.setAttribute("data-formie-field-has-error", "true"), C(n, e, "fieldLayoutError");
233
+ n.setAttribute("data-formie-field-has-error", "true"), T(n, e, "fieldLayoutError");
223
234
  let r = n.querySelector("[data-formie-field-errors]")?.id || "", i = n.querySelector("[data-formie-field-error]")?.id || "";
224
235
  n.querySelectorAll("input, select, textarea").forEach((t) => {
225
236
  let n = t;
226
- n.setAttribute("aria-invalid", "true"), C(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), r && Te(n, r), i && n.setAttribute("aria-errormessage", i);
237
+ n.setAttribute("aria-invalid", "true"), T(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), r && Oe(n, r), i && n.setAttribute("aria-errormessage", i);
227
238
  });
228
239
  });
229
240
  }
230
- function Ae(e) {
231
- return !!Ee(e) || !!Oe(e);
241
+ function Ne(e) {
242
+ return !!ke(e) || !!je(e);
232
243
  }
233
- function je(e) {
234
- let t = Ee(e);
244
+ function Pe(e) {
245
+ let t = ke(e);
235
246
  if (t) {
236
- let e = De(t);
247
+ let e = Ae(t);
237
248
  if (e) {
238
249
  if (e.scrollIntoView({
239
250
  behavior: "smooth",
@@ -250,7 +261,7 @@ function je(e) {
250
261
  block: "center"
251
262
  }), !0;
252
263
  }
253
- let n = Oe(e);
264
+ let n = je(e);
254
265
  return n ? (n.scrollIntoView({
255
266
  behavior: "smooth",
256
267
  block: "center"
@@ -258,7 +269,7 @@ function je(e) {
258
269
  }
259
270
  //#endregion
260
271
  //#region src/js/events/event-bus.ts
261
- var Me = class {
272
+ var Fe = class {
262
273
  constructor() {
263
274
  this.listeners = /* @__PURE__ */ new Map();
264
275
  }
@@ -314,8 +325,8 @@ var Me = class {
314
325
  clear() {
315
326
  this.listeners.clear();
316
327
  }
317
- }, k = d("general", "transport");
318
- function Ne(e) {
328
+ }, j = C("general", "transport");
329
+ function Ie(e) {
319
330
  let t = {};
320
331
  return [
321
332
  "theme",
@@ -326,17 +337,17 @@ function Ne(e) {
326
337
  e[n] !== void 0 && (t[n] = e[n]);
327
338
  }), t;
328
339
  }
329
- function Pe(e, t = "", n = {}) {
340
+ function Le(e, t = "", n = {}) {
330
341
  if (Array.isArray(e)) {
331
342
  let r = e.map((e) => typeof e == "string" ? e : String(e ?? "")).filter((e) => e.trim() !== "");
332
343
  return t && r.length && (n[t] = (n[t] || []).concat(r)), n;
333
344
  }
334
345
  return e && typeof e == "object" && Object.entries(e).forEach(([e, r]) => {
335
- Pe(r, t ? `${t}.${e}` : e, n);
346
+ Le(r, t ? `${t}.${e}` : e, n);
336
347
  }), n;
337
348
  }
338
- function Fe(e, t) {
339
- let n = e.success === !0, r = e.keepSubmitLoading === !0, i = e.errors, a = Pe(i || {}), o = a.form || [], s = {};
349
+ function Re(e, t) {
350
+ let n = e.success === !0, r = e.keepSubmitLoading === !0, i = e.errors, a = Le(i || {}), o = a.form || [], s = {};
340
351
  Object.entries(a).forEach(([e, t]) => {
341
352
  if (e === "form") return;
342
353
  let n = e.split(".")[0];
@@ -357,38 +368,39 @@ function Fe(e, t) {
357
368
  target: e.submitActionTab === "new-tab" ? "new-tab" : "same-tab"
358
369
  } : null,
359
370
  submitData: Array.isArray(e.submitData) ? e.submitData : void 0,
371
+ clientEvents: Array.isArray(e.clientEvents) ? e.clientEvents : void 0,
360
372
  meta: e
361
373
  };
362
374
  }
363
- async function Ie(e, t, n = {}) {
375
+ async function ze(e, t, n = {}) {
364
376
  let r = JSON.stringify({
365
377
  handle: t,
366
378
  renderOptions: n
367
379
  });
368
- k.log("requestRender start.", {
380
+ j.log("requestRender start.", {
369
381
  endpoint: e,
370
382
  handle: t
371
383
  });
372
- let i = await w(e, {
384
+ let i = await E(e, {
373
385
  method: "POST",
374
386
  body: r,
375
387
  headers: { "Content-Type": "application/json" }
376
388
  });
377
- return k.log("requestRender complete.", { hasHtml: !!i.html }), i;
389
+ return j.log("requestRender complete.", { hasHtml: !!i.html }), i;
378
390
  }
379
- async function Le(e, t, n = {}) {
391
+ async function Be(e, t, n = {}) {
380
392
  let r = JSON.stringify({
381
393
  query: "\nquery FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {\n formieHtmlForm(handle: $handle, input: $input) {\n html\n }\n}",
382
394
  variables: {
383
395
  handle: t,
384
- input: Ne(n)
396
+ input: Ie(n)
385
397
  }
386
398
  });
387
- k.log("requestGraphqlRender start.", {
399
+ j.log("requestGraphqlRender start.", {
388
400
  endpoint: e,
389
401
  handle: t
390
402
  });
391
- let i = await w(e, {
403
+ let i = await E(e, {
392
404
  method: "POST",
393
405
  body: r,
394
406
  headers: { "Content-Type": "application/json" }
@@ -396,19 +408,19 @@ async function Le(e, t, n = {}) {
396
408
  if (Array.isArray(i.errors) && i.errors.length > 0) throw Error(i.errors.map((e) => e.message || "Unknown GraphQL error").join("; "));
397
409
  if (!i.data?.formieHtmlForm) throw Error(`Form not found for handle "${t}".`);
398
410
  let a = i.data.formieHtmlForm;
399
- return k.log("requestGraphqlRender complete.", { hasHtml: !!a.html }), a;
411
+ return j.log("requestGraphqlRender complete.", { hasHtml: !!a.html }), a;
400
412
  }
401
- async function Re(e, t, n) {
413
+ async function M(e, t, n) {
402
414
  let r = new URL(e, window.location.origin);
403
- r.searchParams.set("handle", t), n && r.searchParams.set("renderId", n), k.log("requestRefreshTokens start.", {
415
+ r.searchParams.set("handle", t), n && r.searchParams.set("renderId", n), j.log("requestRefreshTokens start.", {
404
416
  endpoint: r.toString(),
405
417
  handle: t,
406
418
  hasRenderId: !!n
407
419
  });
408
- let i = await w(r.toString());
409
- return k.log("requestRefreshTokens complete.", { hasRefreshTokens: !!i.refreshTokens }), i.refreshTokens || i;
420
+ let i = await E(r.toString());
421
+ return j.log("requestRefreshTokens complete.", { hasRefreshTokens: !!i.refreshTokens }), i.refreshTokens || i;
410
422
  }
411
- async function ze(e, t, n) {
423
+ async function Ve(e, t, n) {
412
424
  let r = new URL(e, window.location.origin), i = new FormData();
413
425
  if (n && i.append("pageId", n), t) {
414
426
  [
@@ -424,17 +436,17 @@ async function ze(e, t, n) {
424
436
  let e = t.querySelector("input[name=\"CRAFT_CSRF_TOKEN\"]")?.value?.trim();
425
437
  e && i.append("CRAFT_CSRF_TOKEN", e);
426
438
  }
427
- k.log("requestSetPage start.", {
439
+ j.log("requestSetPage start.", {
428
440
  requestUrl: r.toString(),
429
441
  pageId: n || null
430
442
  });
431
- let a = await w(r.toString(), {
443
+ let a = await E(r.toString(), {
432
444
  method: "POST",
433
445
  body: i
434
446
  });
435
- return k.log("requestSetPage complete.", a), a;
447
+ return j.log("requestSetPage complete.", a), a;
436
448
  }
437
- function Be(e, t) {
449
+ function He(e, t) {
438
450
  let n = new URL(e, window.location.origin), r = new FormData();
439
451
  [
440
452
  "handle",
@@ -446,7 +458,7 @@ function Be(e, t) {
446
458
  n && r.append(e, n);
447
459
  });
448
460
  let i = t.querySelector("input[name=\"CRAFT_CSRF_TOKEN\"]")?.value?.trim();
449
- i && r.append("CRAFT_CSRF_TOKEN", i), k.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
461
+ i && r.append("CRAFT_CSRF_TOKEN", i), j.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
450
462
  try {
451
463
  if (typeof navigator.sendBeacon == "function" && navigator.sendBeacon(n.toString(), r)) return;
452
464
  } catch {}
@@ -458,9 +470,9 @@ function Be(e, t) {
458
470
  headers: { Accept: "application/json" }
459
471
  });
460
472
  }
461
- async function Ve(e, t) {
473
+ async function Ue(e, t) {
462
474
  let n = (e.getAttribute("method") || "POST").toUpperCase(), r = e.getAttribute("action") || window.location.href, i = e.dataset.formieErrorMessage?.trim() || "Submission failed.";
463
- k.log("submitForm start.", {
475
+ j.log("submitForm start.", {
464
476
  method: n,
465
477
  action: r,
466
478
  submitAction: t.get("submitAction")
@@ -471,13 +483,13 @@ async function Ve(e, t) {
471
483
  credentials: "include",
472
484
  headers: { Accept: "application/json" }
473
485
  }), o = a.headers.get("content-type") || "";
474
- if (!o.includes("application/json")) return a.ok ? (k.log("submitForm non-JSON success response.", {
486
+ if (!o.includes("application/json")) return a.ok ? (j.log("submitForm non-JSON success response.", {
475
487
  status: a.status,
476
488
  contentType: o
477
489
  }), {
478
490
  ok: !0,
479
491
  message: "Submission completed."
480
- }) : (k.warn("submitForm non-JSON HTTP error.", {
492
+ }) : (j.warn("submitForm non-JSON HTTP error.", {
481
493
  status: a.status,
482
494
  contentType: o
483
495
  }), {
@@ -486,8 +498,8 @@ async function Ve(e, t) {
486
498
  message: `Request failed (${a.status}).`,
487
499
  formErrors: [`Request failed (${a.status}).`]
488
500
  });
489
- let s = Fe(await a.json(), i);
490
- return k.log("submitForm JSON response normalized.", {
501
+ let s = Re(await a.json(), i);
502
+ return j.log("submitForm JSON response normalized.", {
491
503
  ok: s.ok,
492
504
  code: s.code,
493
505
  hasRedirect: !!s.redirect?.url,
@@ -496,7 +508,7 @@ async function Ve(e, t) {
496
508
  }
497
509
  //#endregion
498
510
  //#region src/js/submit/pipeline.ts
499
- var He = [
511
+ var We = [
500
512
  "prepare",
501
513
  "normalize",
502
514
  "validate",
@@ -504,14 +516,14 @@ var He = [
504
516
  "authorize",
505
517
  "dispatch",
506
518
  "finalize"
507
- ], Ue = [
519
+ ], Ge = [
508
520
  "prepare",
509
521
  "normalize",
510
522
  "validate",
511
523
  "screen",
512
524
  "authorize"
513
- ], A = d("general", "pipeline");
514
- function We(e, t) {
525
+ ], N = C("general", "pipeline");
526
+ function Ke(e, t) {
515
527
  return {
516
528
  ok: !1,
517
529
  stage: e,
@@ -520,13 +532,13 @@ function We(e, t) {
520
532
  formErrors: [t || "Submission aborted."]
521
533
  };
522
534
  }
523
- function Ge(e) {
535
+ function qe(e) {
524
536
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
525
537
  }
526
- function Ke(e) {
538
+ function Je(e) {
527
539
  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)));
528
540
  }
529
- function qe(e, t) {
541
+ function Ye(e, t) {
530
542
  if (t instanceof HTMLInputElement) {
531
543
  if (t.type === "file") {
532
544
  Array.from(t.files || []).forEach((n) => {
@@ -545,49 +557,49 @@ function qe(e, t) {
545
557
  }
546
558
  e.append(t.name, t.value);
547
559
  }
548
- function Je(e, t) {
560
+ function Xe(e, t) {
549
561
  t.querySelectorAll("input, select, textarea").forEach((t) => {
550
- let n = Ge(t) ? t : null;
551
- !n || n.closest("[data-formie-page]") || Ke(n) && qe(e, n);
562
+ let n = qe(t) ? t : null;
563
+ !n || n.closest("[data-formie-page]") || Je(n) && Ye(e, n);
552
564
  });
553
565
  }
554
- function Ye(e, t) {
566
+ function Ze(e, t) {
555
567
  let n = /* @__PURE__ */ new Set();
556
568
  return t.querySelectorAll("input, select, textarea").forEach((t) => {
557
- let r = Ge(t) ? t : null;
558
- !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), Ke(r) && qe(e, r));
569
+ let r = qe(t) ? t : null;
570
+ !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), Je(r) && Ye(e, r));
559
571
  }), n;
560
572
  }
561
- function Xe(e, t) {
573
+ function Qe(e, t) {
562
574
  t.forEach((t) => {
563
575
  e.has(t) || e.append(t, "");
564
576
  });
565
577
  }
566
- function Ze(e, t) {
567
- let n = p(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
578
+ function $e(e, t) {
579
+ let n = c(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
568
580
  if (!n.length || !r) {
569
581
  let n = new FormData(e);
570
582
  return n.set("submitAction", t), n;
571
583
  }
572
584
  let i = new FormData();
573
- return Je(i, e), Xe(i, Ye(i, r)), i.set("submitAction", t), i;
585
+ return Xe(i, e), Qe(i, Ze(i, r)), i.set("submitAction", t), i;
574
586
  }
575
- function Qe(e, t) {
587
+ function et(e, t) {
576
588
  if (t !== "submit") return !1;
577
- let n = p(e);
589
+ let n = c(e);
578
590
  return n.length ? (n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || n[n.length - 1]) === n[n.length - 1] : !0;
579
591
  }
580
- async function $e(e, t, n, r = {}) {
581
- A.log("Starting submit pipeline.", {
592
+ async function tt(e, t, n, r = {}) {
593
+ N.log("Starting submit pipeline.", {
582
594
  action: t,
583
595
  preflightOnly: r.preflightOnly === !0
584
596
  });
585
- let i = !1, a, o = null, s = Qe(e, t), c = {
597
+ let i = !1, a, o = null, s = et(e, t), c = {
586
598
  form: e,
587
599
  action: t,
588
- formData: Ze(e, t),
600
+ formData: $e(e, t),
589
601
  abort: (e) => {
590
- i = !0, a = e, A.warn("Pipeline aborted.", { reason: e });
602
+ i = !0, a = e, N.warn("Pipeline aborted.", { reason: e });
591
603
  },
592
604
  isAborted: () => i,
593
605
  abortReason: () => a
@@ -600,7 +612,7 @@ async function $e(e, t, n, r = {}) {
600
612
  validate: async (e) => {
601
613
  if (e.action !== "submit" || r.validateOnSubmit === !1) return null;
602
614
  if (r.validator) {
603
- let { scope: t, final: n } = h(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
615
+ let { scope: t, final: n } = f(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
604
616
  if (i.length > 0) {
605
617
  let e = i[0]?.input;
606
618
  if (e) {
@@ -636,68 +648,68 @@ async function $e(e, t, n, r = {}) {
636
648
  screen: async () => null,
637
649
  authorize: async () => null,
638
650
  dispatch: async (e) => {
639
- e.formData = Ze(e.form, e.action);
640
- let t = await Ve(e.form, e.formData);
651
+ e.formData = $e(e.form, e.action);
652
+ let t = await Ue(e.form, e.formData);
641
653
  return o = t, t;
642
654
  },
643
655
  finalize: async (e) => (o && o.ok && o.redirect?.url && (o.redirect.target === "new-tab" ? window.open(o.redirect.url, "_blank") : window.location.href = o.redirect.url), null)
644
656
  };
645
657
  {
646
658
  let e = await n.emitSafe("formie:submit:before", c);
647
- e.failed.length > 0 && A.warn("Submit before listeners failed.", {
659
+ e.failed.length > 0 && N.warn("Submit before listeners failed.", {
648
660
  eventName: e.eventName,
649
661
  failed: e.failed.length
650
662
  });
651
663
  }
652
664
  if (s) {
653
665
  let e = await n.emitSafe("formie:submit:final:before", c);
654
- e.failed.length > 0 && A.warn("Final submit before listeners failed.", {
666
+ e.failed.length > 0 && N.warn("Final submit before listeners failed.", {
655
667
  eventName: e.eventName,
656
668
  failed: e.failed.length
657
669
  });
658
670
  }
659
- let u = r.preflightOnly ? Ue : He;
671
+ let u = r.preflightOnly ? Ge : We;
660
672
  for (let e of u) {
661
- if (A.log("Stage start.", {
673
+ if (N.log("Stage start.", {
662
674
  stage: e,
663
675
  action: t
664
- }), i) return A.warn("Stage skipped due to abort.", {
676
+ }), i) return N.warn("Stage skipped due to abort.", {
665
677
  stage: e,
666
678
  reason: a
667
- }), We(e, a);
679
+ }), Ke(e, a);
668
680
  {
669
681
  let t = await n.emitSafe(`formie:stage:${e}:before`, {
670
682
  ...c,
671
683
  stage: e
672
684
  });
673
- t.failed.length > 0 && A.warn("Stage before listeners failed.", {
685
+ t.failed.length > 0 && N.warn("Stage before listeners failed.", {
674
686
  stage: e,
675
687
  failed: t.failed.length
676
688
  });
677
689
  }
678
690
  if (i) {
679
- let t = We(e, a);
691
+ let t = Ke(e, a);
680
692
  {
681
693
  let r = await n.emitSafe("formie:submit:after", t);
682
- r.failed.length > 0 && A.warn("Submit after listeners failed (abort before stage).", {
694
+ r.failed.length > 0 && N.warn("Submit after listeners failed (abort before stage).", {
683
695
  stage: e,
684
696
  failed: r.failed.length
685
697
  });
686
698
  }
687
699
  if (s) {
688
700
  let r = await n.emitSafe("formie:submit:final:after", t);
689
- r.failed.length > 0 && A.warn("Final submit after listeners failed (abort before stage).", {
701
+ r.failed.length > 0 && N.warn("Final submit after listeners failed (abort before stage).", {
690
702
  stage: e,
691
703
  failed: r.failed.length
692
704
  });
693
705
  }
694
- return A.warn("Aborted after stage before-hooks.", {
706
+ return N.warn("Aborted after stage before-hooks.", {
695
707
  stage: e,
696
708
  reason: a
697
709
  }), t;
698
710
  }
699
711
  let r = await l[e](c);
700
- A.log("Stage runner complete.", {
712
+ N.log("Stage runner complete.", {
701
713
  stage: e,
702
714
  hasResult: !!r,
703
715
  ok: r ? r.ok : void 0,
@@ -709,28 +721,28 @@ async function $e(e, t, n, r = {}) {
709
721
  stage: e,
710
722
  result: r
711
723
  });
712
- t.failed.length > 0 && A.warn("Stage after listeners failed.", {
724
+ t.failed.length > 0 && N.warn("Stage after listeners failed.", {
713
725
  stage: e,
714
726
  failed: t.failed.length
715
727
  });
716
728
  }
717
729
  if (i) {
718
- let t = We(e, a);
730
+ let t = Ke(e, a);
719
731
  {
720
732
  let r = await n.emitSafe("formie:submit:after", t);
721
- r.failed.length > 0 && A.warn("Submit after listeners failed (abort after stage).", {
733
+ r.failed.length > 0 && N.warn("Submit after listeners failed (abort after stage).", {
722
734
  stage: e,
723
735
  failed: r.failed.length
724
736
  });
725
737
  }
726
738
  if (s) {
727
739
  let r = await n.emitSafe("formie:submit:final:after", t);
728
- r.failed.length > 0 && A.warn("Final submit after listeners failed (abort after stage).", {
740
+ r.failed.length > 0 && N.warn("Final submit after listeners failed (abort after stage).", {
729
741
  stage: e,
730
742
  failed: r.failed.length
731
743
  });
732
744
  }
733
- return A.warn("Aborted after stage after-hooks.", {
745
+ return N.warn("Aborted after stage after-hooks.", {
734
746
  stage: e,
735
747
  reason: a
736
748
  }), t;
@@ -738,19 +750,19 @@ async function $e(e, t, n, r = {}) {
738
750
  if (r && !r.ok) {
739
751
  {
740
752
  let t = await n.emitSafe("formie:submit:after", r);
741
- t.failed.length > 0 && A.warn("Submit after listeners failed (failed stage).", {
753
+ t.failed.length > 0 && N.warn("Submit after listeners failed (failed stage).", {
742
754
  stage: e,
743
755
  failed: t.failed.length
744
756
  });
745
757
  }
746
758
  if (s) {
747
759
  let t = await n.emitSafe("formie:submit:final:after", r);
748
- t.failed.length > 0 && A.warn("Final submit after listeners failed (failed stage).", {
760
+ t.failed.length > 0 && N.warn("Final submit after listeners failed (failed stage).", {
749
761
  stage: e,
750
762
  failed: t.failed.length
751
763
  });
752
764
  }
753
- return A.warn("Pipeline short-circuited by failed stage.", {
765
+ return N.warn("Pipeline short-circuited by failed stage.", {
754
766
  stage: e,
755
767
  code: r.code,
756
768
  message: r.message
@@ -764,13 +776,13 @@ async function $e(e, t, n, r = {}) {
764
776
  };
765
777
  {
766
778
  let e = await n.emitSafe("formie:submit:after", d);
767
- e.failed.length > 0 && A.warn("Submit after listeners failed (success).", { failed: e.failed.length });
779
+ e.failed.length > 0 && N.warn("Submit after listeners failed (success).", { failed: e.failed.length });
768
780
  }
769
781
  if (s) {
770
782
  let e = await n.emitSafe("formie:submit:final:after", d);
771
- e.failed.length > 0 && A.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
783
+ e.failed.length > 0 && N.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
772
784
  }
773
- return A.log("Pipeline completed.", {
785
+ return N.log("Pipeline completed.", {
774
786
  ok: d.ok,
775
787
  stage: d.stage,
776
788
  code: d.code
@@ -778,27 +790,27 @@ async function $e(e, t, n, r = {}) {
778
790
  }
779
791
  //#endregion
780
792
  //#region src/js/core/field-error-container.ts
781
- function et(e) {
793
+ function nt(e) {
782
794
  return e.querySelector("[data-formie-field-layout]")?.getAttribute("data-formie-error-position")?.trim() === "above" ? "above" : "below";
783
795
  }
784
- function tt(e, t) {
796
+ function rt(e, t) {
785
797
  let n = e.querySelector("[data-formie-field-errors]");
786
798
  if (n) return n;
787
- let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = et(e), o = document.createElement("div");
799
+ let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = nt(e), o = document.createElement("div");
788
800
  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;
789
801
  }
790
802
  //#endregion
791
803
  //#region src/js/validation/rules/email.ts
792
- var nt = {
804
+ var it = {
793
805
  rule: ({ input: e, getRule: t }) => !t("email") || !e.value || e.value.length < 1 ? !0 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.value),
794
806
  message: ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-validation-email-message") ?? e.getAttribute("data-formie-pattern-email-message") ?? e.getAttribute("data-pattern-email-message") ?? n("{label} is not a valid email address.", { label: t })
795
807
  };
796
808
  //#endregion
797
809
  //#region src/js/validation/rules/shared.ts
798
- function rt(e) {
810
+ function at(e) {
799
811
  return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
800
812
  }
801
- function it(e) {
813
+ function ot(e) {
802
814
  let t = e.getRule("match");
803
815
  if (!t || t === !0 || typeof t != "object" || !e.field) return null;
804
816
  let n = typeof t.fieldHandle == "string" ? t.fieldHandle.trim() : "";
@@ -808,7 +820,7 @@ function it(e) {
808
820
  }
809
821
  //#endregion
810
822
  //#region src/js/validation/rules.ts
811
- var at = {
823
+ var st = {
812
824
  required: {
813
825
  rule: ({ input: e, getRule: t }) => {
814
826
  if (!t("required") || e.type === "hidden") return !0;
@@ -820,7 +832,7 @@ var at = {
820
832
  },
821
833
  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 })
822
834
  },
823
- email: nt,
835
+ email: it,
824
836
  url: {
825
837
  rule: ({ input: e, getRule: t }) => {
826
838
  if (!t("url") || !e.value || e.value.length < 1) return !0;
@@ -861,18 +873,18 @@ var at = {
861
873
  },
862
874
  match: {
863
875
  rule: (e) => {
864
- let t = it(e);
876
+ let t = ot(e);
865
877
  return t ? t.value === e.input.value : !0;
866
878
  },
867
879
  message: (e) => {
868
- let t = it(e)?.closest("[data-formie-field-handle]"), n = rt(t);
880
+ let t = ot(e)?.closest("[data-formie-field-handle]"), n = at(t);
869
881
  return e.t("{label} must match {value}.", {
870
882
  label: e.label,
871
883
  value: n
872
884
  });
873
885
  }
874
886
  }
875
- }, ot = {
887
+ }, ct = {
876
888
  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,})+$/,
877
889
  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*)?$/,
878
890
  number: /^(?:[-+]?[0-9]*[.,]?[0-9]+)$/,
@@ -880,11 +892,11 @@ var at = {
880
892
  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))/,
881
893
  time: /^(?:(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]))$/,
882
894
  month: /^(?:(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])))$/
883
- }, j = d("general", "validator");
884
- function M(e) {
895
+ }, P = C("general", "validator");
896
+ function F(e) {
885
897
  return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
886
898
  }
887
- function st(e, t) {
899
+ function lt(e, t) {
888
900
  let n = (e.getAttribute("aria-describedby") || "").trim();
889
901
  if (!n) return;
890
902
  let r = n.split(/\s+/).filter((e) => e !== t);
@@ -894,34 +906,35 @@ function st(e, t) {
894
906
  }
895
907
  e.removeAttribute("aria-describedby");
896
908
  }
897
- function ct(e, t) {
909
+ function ut(e, t) {
898
910
  let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
899
911
  r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
900
912
  }
901
- function lt(e, t) {
913
+ function dt(e, t) {
902
914
  e.setAttribute("aria-errormessage", t);
903
915
  }
904
- function ut(e, t) {
916
+ function ft(e, t) {
905
917
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
906
918
  }
907
- var dt = class {
919
+ var pt = class {
908
920
  constructor(e, t = {}) {
909
921
  this.errors = [], this.validators = {}, this.boundListeners = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.submitted = !1, this.initialValues = /* @__PURE__ */ new WeakMap(), this.form = e, this.onBlur = this.blurHandler.bind(this), this.onChange = this.changeHandler.bind(this), this.onInput = this.inputHandler.bind(this), this.config = {
910
922
  live: !1,
923
+ errorAriaLive: "polite",
911
924
  errorMessage: "",
912
925
  fieldContainerErrorClass: [],
913
926
  inputErrorClass: [],
914
927
  messagesClass: [],
915
928
  messageClass: [],
916
929
  fieldsSelector: "input:not([type=\"hidden\"]):not([type=\"submit\"]):not([type=\"button\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])",
917
- patterns: ot,
930
+ patterns: ct,
918
931
  ...t
919
- }, Object.entries(at).forEach(([e, t]) => {
932
+ }, Object.entries(st).forEach(([e, t]) => {
920
933
  this.addValidator(e, t.rule, t.message);
921
934
  }), this.init();
922
935
  }
923
936
  init() {
924
- j.log("Initializing validator.", {
937
+ P.log("Initializing validator.", {
925
938
  formId: this.form.id || null,
926
939
  live: this.config.live
927
940
  }), this.form.setAttribute("novalidate", "true"), this.inputs().forEach((e) => {
@@ -929,9 +942,9 @@ var dt = class {
929
942
  }), this.config.live && this.addEventListeners(), this.emitEvent(document, n("ready"), { validator: this });
930
943
  }
931
944
  inputs(e = null) {
932
- if (M(e)) return [e];
945
+ if (F(e)) return [e];
933
946
  let t = e || this.form;
934
- return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => M(e));
947
+ return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => F(e));
935
948
  }
936
949
  getInputValue(e) {
937
950
  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 ?? "";
@@ -971,7 +984,7 @@ var dt = class {
971
984
  }), r = !0;
972
985
  }
973
986
  }), !r && this.shouldShowError(e) && this.removeError(e);
974
- }), j.log("Validation pass complete.", {
987
+ }), P.log("Validation pass complete.", {
975
988
  errorCount: this.errors.length,
976
989
  includeHiddenPages: t.includeHiddenPages === !0
977
990
  }), this.errors;
@@ -992,39 +1005,39 @@ var dt = class {
992
1005
  e.remove();
993
1006
  }), r && (r.innerHTML = ""), t.querySelectorAll("input, select, textarea").forEach((e) => {
994
1007
  let n = e;
995
- n.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && n.classList.remove(...this.config.inputErrorClass), n.removeAttribute("data-formie-input-has-error"), i && st(n, i), t.querySelectorAll("[data-formie-field-error]").forEach((e) => {
1008
+ n.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && n.classList.remove(...this.config.inputErrorClass), n.removeAttribute("data-formie-input-has-error"), i && lt(n, i), t.querySelectorAll("[data-formie-field-error]").forEach((e) => {
996
1009
  let t = e.id;
997
- t && ut(n, t);
1010
+ t && ft(n, t);
998
1011
  });
999
1012
  });
1000
1013
  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");
1001
- this.emitEvent(e, n("clear-error"), { validator: this }), x(this.form);
1014
+ this.emitEvent(e, n("clear-error"), { validator: this }), y(this.form);
1002
1015
  }
1003
1016
  showError(e, t, r) {
1004
1017
  let i = e.closest("[data-formie-field-handle]");
1005
1018
  if (!i) return;
1006
1019
  let a = i.querySelector("[data-formie-field-errors]");
1007
- a ||= tt(i, (e) => {
1020
+ a ||= rt(i, (e) => {
1008
1021
  this.config.messagesClass.length && e.classList.add(...this.config.messagesClass);
1009
1022
  }), this.config.messagesClass.length && a.classList.add(...this.config.messagesClass), a.innerHTML = "";
1010
1023
  let o = i.getAttribute("data-formie-field-handle") || "field", s = `${o}-error`;
1011
- a.id = a.id || `${o}-errors`, a.setAttribute("aria-live", "polite"), a.setAttribute("aria-atomic", "true");
1024
+ a.id = a.id || `${o}-errors`, De(a, Te(this.config.errorAriaLive, this.submitted));
1012
1025
  let c = document.createElement("div");
1013
1026
  c.setAttribute("data-formie-field-error", "true"), c.setAttribute(`data-formie-field-error-${t}`, "true"), c.setAttribute("id", s), c.setAttribute("role", "alert"), this.config.messageClass.length && c.classList.add(...this.config.messageClass), c.textContent = r, a.appendChild(c), i.setAttribute("data-formie-field-has-error", "true"), i.querySelectorAll("input, select, textarea").forEach((e) => {
1014
1027
  let t = e;
1015
- t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), ct(t, a.id), lt(t, s);
1028
+ t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), ut(t, a.id), dt(t, s);
1016
1029
  });
1017
1030
  for (let e = i; 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");
1018
1031
  this.emitEvent(e, n("show-error"), {
1019
1032
  validator: this,
1020
1033
  validatorName: t,
1021
1034
  errorMessage: r
1022
- }), x(this.form);
1035
+ }), y(this.form);
1023
1036
  }
1024
1037
  getValidatorCallbackOptions(e) {
1025
1038
  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"));
1026
1039
  return {
1027
- t: E,
1040
+ t: O,
1028
1041
  input: e,
1029
1042
  label: n,
1030
1043
  field: t,
@@ -1035,7 +1048,7 @@ var dt = class {
1035
1048
  };
1036
1049
  }
1037
1050
  getErrorMessage(e, t, n, r) {
1038
- return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? E("{label} is invalid.", { label: r.label });
1051
+ return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? O("{label} is invalid.", { label: r.label });
1039
1052
  }
1040
1053
  getErrors() {
1041
1054
  return this.errors;
@@ -1058,7 +1071,7 @@ var dt = class {
1058
1071
  try {
1059
1072
  n = JSON.parse(e);
1060
1073
  } catch {
1061
- return j.warn("Invalid validation rules payload.", { formId: this.form.id || null }), t;
1074
+ return P.warn("Invalid validation rules payload.", { formId: this.form.id || null }), t;
1062
1075
  }
1063
1076
  return Array.isArray(n) && n.forEach((e) => {
1064
1077
  if (!e || typeof e != "object" || Array.isArray(e)) return;
@@ -1067,16 +1080,16 @@ var dt = class {
1067
1080
  }), t;
1068
1081
  }
1069
1082
  destroy() {
1070
- j.log("Destroying validator.", { formId: this.form.id || null }), this.removeEventListeners(), this.form.removeAttribute("novalidate"), this.emitEvent(document, n("destroy"), { validator: this });
1083
+ P.log("Destroying validator.", { formId: this.form.id || null }), this.removeEventListeners(), this.form.removeAttribute("novalidate"), this.emitEvent(document, n("destroy"), { validator: this });
1071
1084
  }
1072
1085
  isVisible(e, t = {}) {
1073
- return e.closest("[data-formie-conditionally-hidden]") ? !1 : e.closest("[data-formie-page-hidden]") ? !!t.includeHiddenPages : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
1086
+ return e.disabled || e.hasAttribute("data-formie-conditions-disabled") || e.closest("[data-formie-conditions-disabled]") || e.closest("[data-formie-conditionally-hidden]") ? !1 : e.closest("[data-formie-page-hidden]") ? !!t.includeHiddenPages : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
1074
1087
  }
1075
1088
  blurHandler(e) {
1076
- !(e.target instanceof HTMLElement) || !M(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));
1089
+ !(e.target instanceof HTMLElement) || !F(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));
1077
1090
  }
1078
1091
  changeHandler(e) {
1079
- if (!(!(e.target instanceof HTMLElement) || !M(e.target) || !e.target.form?.isSameNode(this.form)) && !(e instanceof CustomEvent)) {
1092
+ if (!(!(e.target instanceof HTMLElement) || !F(e.target) || !e.target.form?.isSameNode(this.form)) && !(e instanceof CustomEvent)) {
1080
1093
  if (e.target instanceof HTMLSelectElement) {
1081
1094
  this.activated.add(e.target), this.validate(e.target);
1082
1095
  return;
@@ -1085,19 +1098,19 @@ var dt = class {
1085
1098
  }
1086
1099
  }
1087
1100
  inputHandler(e) {
1088
- !(e.target instanceof HTMLElement) || !M(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);
1101
+ !(e.target instanceof HTMLElement) || !F(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);
1089
1102
  }
1090
1103
  submit(e = null, { final: t = !1 } = {}) {
1091
- return this.submitted = !0, j.log("Submit validation requested.", { final: t }), this.boundListeners || this.addEventListeners(), this.removeAllErrors(), this.validate(e, { includeHiddenPages: t });
1104
+ return this.submitted = !0, P.log("Submit validation requested.", { final: t }), this.boundListeners || this.addEventListeners(), this.removeAllErrors(), this.validate(e, { includeHiddenPages: t });
1092
1105
  }
1093
1106
  resetLiveState() {
1094
1107
  this.submitted = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.errors = [], this.removeAllErrors();
1095
1108
  }
1096
1109
  addEventListeners() {
1097
- this.boundListeners || (this.form.addEventListener("blur", this.onBlur, !0), this.form.addEventListener("change", this.onChange, !1), this.form.addEventListener("input", this.onInput, !1), this.boundListeners = !0, j.log("Event listeners attached."));
1110
+ this.boundListeners || (this.form.addEventListener("blur", this.onBlur, !0), this.form.addEventListener("change", this.onChange, !1), this.form.addEventListener("input", this.onInput, !1), this.boundListeners = !0, P.log("Event listeners attached."));
1098
1111
  }
1099
1112
  removeEventListeners() {
1100
- this.form.removeEventListener("blur", this.onBlur, !0), this.form.removeEventListener("change", this.onChange, !1), this.form.removeEventListener("input", this.onInput, !1), this.boundListeners = !1, j.log("Event listeners removed.");
1113
+ this.form.removeEventListener("blur", this.onBlur, !0), this.form.removeEventListener("change", this.onChange, !1), this.form.removeEventListener("input", this.onInput, !1), this.boundListeners = !1, P.log("Event listeners removed.");
1101
1114
  }
1102
1115
  emitEvent(e, t, n = {}) {
1103
1116
  e.dispatchEvent(new CustomEvent(t, {
@@ -1114,62 +1127,62 @@ var dt = class {
1114
1127
  removeValidator(e) {
1115
1128
  delete this.validators[e];
1116
1129
  }
1117
- }, N = /* @__PURE__ */ new WeakMap();
1118
- function ft(e) {
1130
+ }, I = /* @__PURE__ */ new WeakMap();
1131
+ function mt(e) {
1119
1132
  return (e.dataset.formieSubmitAction || "").trim();
1120
1133
  }
1121
- function pt(e) {
1134
+ function ht(e) {
1122
1135
  return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
1123
1136
  }
1124
- function mt(e) {
1137
+ function gt(e) {
1125
1138
  return (e.dataset.formieSubmitActionMessagePosition || "").trim();
1126
1139
  }
1127
- function ht(e) {
1140
+ function _t(e) {
1128
1141
  let t = (e.dataset.formieSubmitActionMessageTimeout || "").trim();
1129
1142
  if (!t) return null;
1130
1143
  let n = Number.parseFloat(t);
1131
1144
  return !Number.isFinite(n) || n < 0 ? null : Math.round(n * 1e3);
1132
1145
  }
1133
- function P(e) {
1146
+ function vt(e) {
1134
1147
  let t = e.dataset.formieSubmitActionFormHide;
1135
1148
  if (t === void 0) return !1;
1136
1149
  let n = t.trim().toLowerCase();
1137
1150
  return n === "true" || n === "1" || n === "";
1138
1151
  }
1139
- function gt(e) {
1140
- let t = N.get(e);
1141
- typeof t == "number" && (window.clearTimeout(t), N.delete(e));
1152
+ function yt(e) {
1153
+ let t = I.get(e);
1154
+ typeof t == "number" && (window.clearTimeout(t), I.delete(e));
1142
1155
  }
1143
- function _t(e) {
1156
+ function bt(e) {
1144
1157
  return e.querySelector("[data-formie-form-messages-top]") || e;
1145
1158
  }
1146
- function vt(e) {
1159
+ function xt(e) {
1147
1160
  return e.querySelector("[data-formie-form-messages-bottom]") || e;
1148
1161
  }
1149
- function yt(e, t) {
1150
- return t === "bottom-form" ? vt(e) : _t(e);
1162
+ function St(e, t) {
1163
+ return t === "bottom-form" ? xt(e) : bt(e);
1151
1164
  }
1152
- function bt(e, t) {
1153
- return t === "top-form" ? _t(e) : t === "bottom-form" && !P(e) ? vt(e) : e;
1165
+ function Ct(e, t) {
1166
+ return t === "top-form" ? bt(e) : t === "bottom-form" && !vt(e) ? xt(e) : e;
1154
1167
  }
1155
- function xt(e) {
1156
- let t = pt(e), n = yt(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
1157
- return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), C(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
1168
+ function wt(e) {
1169
+ let t = ht(e), n = St(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
1170
+ return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), T(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
1158
1171
  }
1159
- function St(e, t) {
1172
+ function Tt(e, t) {
1160
1173
  let n = t.querySelector("[data-formie-error-message-container], [data-formie-message][data-formie-message-error]");
1161
- 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"), C(n, e, "message", "messageError"), n.setAttribute("role", "alert"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"), n;
1174
+ 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"), T(n, e, "message", "messageError"), n.setAttribute("role", "alert"), De(n, Ee(we(e))), n;
1162
1175
  }
1163
- function Ct(e, t) {
1164
- let n = e.querySelector("[data-formie-success-container]"), r = bt(e, t);
1165
- return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), C(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
1176
+ function Et(e, t) {
1177
+ let n = e.querySelector("[data-formie-success-container]"), r = Ct(e, t);
1178
+ return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), T(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
1166
1179
  }
1167
- function wt(e) {
1168
- return tt(e, (t) => {
1169
- C(t, e, "fieldErrors");
1180
+ function Dt(e) {
1181
+ return rt(e, (t) => {
1182
+ T(t, e, "fieldErrors");
1170
1183
  });
1171
1184
  }
1172
- function Tt(e, t) {
1185
+ function Ot(e, t) {
1173
1186
  let n = (e.getAttribute("aria-describedby") || "").trim();
1174
1187
  if (!n) return;
1175
1188
  let r = n.split(/\s+/).filter((e) => e !== t).join(" ").trim();
@@ -1179,148 +1192,149 @@ function Tt(e, t) {
1179
1192
  }
1180
1193
  e.removeAttribute("aria-describedby");
1181
1194
  }
1182
- function Et(e, t) {
1195
+ function kt(e, t) {
1183
1196
  e.setAttribute("aria-errormessage", t);
1184
1197
  }
1185
- function Dt(e, t) {
1198
+ function At(e, t) {
1186
1199
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
1187
1200
  }
1188
- function Ot(e) {
1201
+ function jt(e) {
1189
1202
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
1190
1203
  let n = t, r = n.querySelector("[data-formie-field-errors]"), i = r?.id || "", a = Array.from(n.querySelectorAll("[data-formie-field-error]")).map((e) => e.id).filter(Boolean);
1191
- S(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
1204
+ w(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
1192
1205
  e.remove();
1193
1206
  }), r && !r.querySelector("[data-formie-field-error]") && (r.innerHTML = ""), n.querySelectorAll("input, select, textarea").forEach((t) => {
1194
1207
  let n = t;
1195
- n.removeAttribute("aria-invalid"), S(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), i && Tt(n, i), a.forEach((e) => {
1196
- Dt(n, e);
1208
+ n.removeAttribute("aria-invalid"), w(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), i && Ot(n, i), a.forEach((e) => {
1209
+ At(n, e);
1197
1210
  });
1198
1211
  });
1199
- }), x(e);
1212
+ }), y(e);
1200
1213
  }
1201
- function kt(e) {
1214
+ function Mt(e) {
1202
1215
  e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
1203
1216
  let n = t;
1204
1217
  n.querySelectorAll("[data-formie-error]").forEach((e) => {
1205
1218
  e.remove();
1206
- }), S(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 = "");
1219
+ }), w(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 = "");
1207
1220
  });
1208
1221
  }
1209
- function F(e) {
1210
- gt(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
1222
+ function Nt(e) {
1223
+ yt(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
1211
1224
  e.remove();
1212
1225
  }), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
1213
1226
  let n = t;
1214
1227
  n.querySelectorAll("[data-formie-success]").forEach((e) => {
1215
1228
  e.remove();
1216
- }), S(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 = "");
1217
- }), ft(e) === "message" && P(e) || f(e, !1);
1229
+ }), w(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 = "");
1230
+ }), mt(e) === "message" && vt(e) || s(e, !1);
1218
1231
  }
1219
- function At(e) {
1232
+ function Pt(e) {
1220
1233
  e.querySelectorAll("[aria-invalid=\"true\"]").forEach((e) => {
1221
1234
  e.removeAttribute("aria-invalid");
1222
1235
  });
1223
1236
  }
1224
- function jt(e, t) {
1237
+ function Ft(e, t) {
1225
1238
  let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
1226
1239
  r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
1227
1240
  }
1228
- function Mt(e, t) {
1229
- Object.entries(t).forEach(([t, n]) => {
1230
- let r = e.querySelector(`[data-formie-field-handle="${t}"]`);
1231
- if (!r) return;
1232
- let i = wt(r), a = i.id && i.id.trim() ? i.id : `${t}-errors`;
1233
- i.id = a, i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), C(r, e, "fieldLayoutError"), r.setAttribute("data-formie-field-has-error", "true"), n.forEach((t, n) => {
1241
+ function It(e, t) {
1242
+ let n = Ee(we(e));
1243
+ Object.entries(t).forEach(([t, r]) => {
1244
+ let i = e.querySelector(`[data-formie-field-handle="${t}"]`);
1245
+ if (!i) return;
1246
+ let a = Dt(i), o = a.id && a.id.trim() ? a.id : `${t}-errors`;
1247
+ a.id = o, De(a, n), T(i, e, "fieldLayoutError"), i.setAttribute("data-formie-field-has-error", "true"), r.forEach((t, n) => {
1234
1248
  let r = document.createElement("div");
1235
- r.setAttribute("data-formie-field-error", "true"), r.setAttribute("role", "alert"), r.id = `${a}-${n + 1}`, C(r, e, "fieldError"), r.textContent = t, i.appendChild(r);
1249
+ r.setAttribute("data-formie-field-error", "true"), r.setAttribute("role", "alert"), r.id = `${o}-${n + 1}`, T(r, e, "fieldError"), r.textContent = t, a.appendChild(r);
1236
1250
  });
1237
- let o = i.querySelector("[data-formie-field-error]")?.id;
1238
- r.querySelectorAll("input, select, textarea").forEach((t) => {
1251
+ let s = a.querySelector("[data-formie-field-error]")?.id;
1252
+ i.querySelectorAll("input, select, textarea").forEach((t) => {
1239
1253
  let n = t;
1240
- n.setAttribute("aria-invalid", "true"), C(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), jt(n, a), o && Et(n, o);
1241
- let i = r.querySelector("[data-formie-instructions]");
1242
- i?.id && jt(n, i.id);
1254
+ n.setAttribute("aria-invalid", "true"), T(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), Ft(n, o), s && kt(n, s);
1255
+ let r = i.querySelector("[data-formie-instructions]");
1256
+ r?.id && Ft(n, r.id);
1243
1257
  });
1244
- }), x(e);
1258
+ }), y(e);
1245
1259
  }
1246
- function Nt(e, t) {
1247
- let n = xt(e), r = St(e, n);
1248
- C(n, e, "errors"), t.forEach((t) => {
1260
+ function Lt(e, t) {
1261
+ let n = wt(e), r = Tt(e, n);
1262
+ T(n, e, "errors"), t.forEach((t) => {
1249
1263
  let n = document.createElement("div");
1250
- n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), C(n, e, "error"), n.innerHTML = t, r.appendChild(n);
1264
+ n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), T(n, e, "error"), n.innerHTML = t, r.appendChild(n);
1251
1265
  });
1252
1266
  }
1253
- function Pt(e, t) {
1254
- return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : ft(e) === "message" && mt(e) !== "";
1267
+ function Rt(e, t) {
1268
+ return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : mt(e) === "message" && gt(e) !== "";
1255
1269
  }
1256
- function Ft(e, t) {
1257
- let n = mt(e);
1270
+ function zt(e, t) {
1271
+ let n = gt(e);
1258
1272
  if (!n) return;
1259
- let r = Ct(e, n);
1260
- C(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");
1273
+ let r = Et(e, n);
1274
+ T(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");
1261
1275
  let i = document.createElement("div");
1262
- i.setAttribute("data-formie-success", "true"), C(i, e, "success"), i.innerHTML = t, r.appendChild(i), P(e) && f(e, !0);
1263
- let a = ht(e);
1276
+ i.setAttribute("data-formie-success", "true"), T(i, e, "success"), i.innerHTML = t, r.appendChild(i), vt(e) && s(e, !0);
1277
+ let a = _t(e);
1264
1278
  if (a !== null) {
1265
1279
  let t = window.setTimeout(() => {
1266
- N.delete(e), F(e);
1280
+ I.delete(e), Nt(e);
1267
1281
  }, a);
1268
- N.set(e, t);
1282
+ I.set(e, t);
1269
1283
  }
1270
1284
  }
1271
- function I(e, t) {
1272
- if (Ot(e), kt(e), F(e), At(e), t.ok) {
1273
- Pt(e, t) && Ft(e, t.message || "");
1285
+ function L(e, t) {
1286
+ if (jt(e), Mt(e), Nt(e), Pt(e), t.ok) {
1287
+ Rt(e, t) && zt(e, t.message || "");
1274
1288
  return;
1275
1289
  }
1276
- t.fieldErrors && Mt(e, t.fieldErrors), t.formErrors?.length ? Nt(e, t.formErrors) : !t.fieldErrors && t.message && Nt(e, [t.message]), je(e);
1290
+ t.fieldErrors && It(e, t.fieldErrors), t.formErrors?.length ? Lt(e, t.formErrors) : !t.fieldErrors && t.message && Lt(e, [t.message]), Pe(e);
1277
1291
  }
1278
1292
  //#endregion
1279
1293
  //#region src/js/core/submit-flow.ts
1280
- var It = d("general", "submit-flow");
1281
- function Lt(e) {
1294
+ var Bt = C("general", "submit-flow");
1295
+ function Vt(e) {
1282
1296
  return !(!e.ok && e.stage === "validate");
1283
1297
  }
1284
- function Rt(e) {
1298
+ function Ht(e) {
1285
1299
  return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
1286
1300
  }
1287
- function zt(e) {
1288
- Ot(e), kt(e), F(e), At(e);
1301
+ function Ut(e) {
1302
+ jt(e), Mt(e), Nt(e), Pt(e);
1289
1303
  }
1290
- async function Bt(e) {
1291
- let { id: t, target: n, form: r, bus: i, validator: a, validateOnSubmit: o, action: s, submitter: c, waitForSubmitDelay: l, onRefreshTokensAfterSubmit: u, dispatchSubmitResult: d } = e;
1292
- zt(r), _(r, c || null);
1293
- let f = {
1304
+ async function Wt(e) {
1305
+ let { id: t, target: n, form: r, bus: i, validator: a, validateOnSubmit: o, action: s, submitter: c, waitForSubmitDelay: l, onRefreshTokensAfterSubmit: u, dispatchSubmitResult: f } = e;
1306
+ Ut(r), m(r, c || null);
1307
+ let p = {
1294
1308
  ok: !1,
1295
1309
  code: "SUBMIT_ERROR",
1296
1310
  message: "Submission failed.",
1297
1311
  formErrors: ["Submission failed."]
1298
1312
  };
1299
1313
  try {
1300
- await l(r), f = await $e(r, s, i, {
1314
+ await l(r), p = await tt(r, s, i, {
1301
1315
  validator: a,
1302
1316
  validateOnSubmit: o
1303
- }), I(r, f), v(r, f, s), Lt(f) && await u(f), d(f);
1317
+ }), L(r, p), g(r, p, s), Vt(p) && await u(p), f(p);
1304
1318
  } catch (e) {
1305
- f = {
1319
+ p = {
1306
1320
  ok: !1,
1307
1321
  code: "SUBMIT_ERROR",
1308
1322
  message: e instanceof Error ? e.message : "Submission failed.",
1309
1323
  formErrors: [e instanceof Error ? e.message : "Submission failed."]
1310
- }, I(r, f), d(f), It.warn("Submit failed with exception.", {
1324
+ }, L(r, p), f(p), Bt.warn("Submit failed with exception.", {
1311
1325
  id: t,
1312
1326
  action: s,
1313
1327
  target: n,
1314
1328
  error: e instanceof Error ? e.message : e
1315
1329
  });
1316
1330
  } finally {
1317
- Rt(f) || m(r);
1331
+ Ht(p) || d(r);
1318
1332
  }
1319
- return f;
1333
+ return p;
1320
1334
  }
1321
1335
  //#endregion
1322
1336
  //#region src/js/modules/registry.ts
1323
- var Vt = class {
1337
+ var R = class {
1324
1338
  constructor() {
1325
1339
  this.modules = /* @__PURE__ */ new Map();
1326
1340
  }
@@ -1337,27 +1351,27 @@ var Vt = class {
1337
1351
  getAll() {
1338
1352
  return Array.from(this.modules.values());
1339
1353
  }
1340
- }, Ht = {
1341
- "address-finder": () => import("./chunks/address-finder-yXU5yMjG.js").then((e) => e.addressFinderModule),
1342
- "google-address": () => import("./chunks/google-address-OhKilPWE.js").then((e) => e.googleAddressModule),
1343
- loqate: () => import("./chunks/loqate-Cp2zvwpE.js").then((e) => e.loqateModule),
1354
+ }, Gt = {
1355
+ "address-finder": () => import("./chunks/address-finder-k7_BXaRe.js").then((e) => e.addressFinderModule),
1356
+ "google-address": () => import("./chunks/google-address-BH3Zhi06.js").then((e) => e.googleAddressModule),
1357
+ loqate: () => import("./chunks/loqate-CJPzBmSm.js").then((e) => e.loqateModule),
1344
1358
  "place-kit": () => import("./chunks/place-kit-BGHklIZ-.js").then((e) => e.placeKitModule)
1345
- }, Ut = {
1346
- "captcha-eu": () => import("./chunks/captcha-eu-CWJb64_j.js").then((e) => e.captchaEuModule),
1347
- "friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-ByXzENYZ.js").then((e) => e.friendlyCaptchaV1Module),
1348
- "friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-BPdlmhQu.js").then((e) => e.friendlyCaptchaV2Module),
1349
- hcaptcha: () => import("./chunks/hcaptcha-CdCd9oEi.js").then((e) => e.hcaptchaModule),
1350
- "recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-BSwi8IVX.js").then((e) => e.recaptchaEnterpriseModule),
1351
- "recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-CnDQmsKa.js").then((e) => e.recaptchaV2CheckboxModule),
1352
- "recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-Cz5uIlp-.js").then((e) => e.recaptchaV2InvisibleModule),
1353
- "recaptcha-v3": () => import("./chunks/recaptcha-v3-BtbbP111.js").then((e) => e.recaptchaV3Module),
1354
- snaptcha: () => import("./chunks/snaptcha-vz1RnZ15.js").then((e) => e.snaptchaModule),
1355
- turnstile: () => import("./chunks/turnstile-D_Pi1CKM.js").then((e) => e.turnstileModule)
1356
- }, Wt = {
1359
+ }, Kt = {
1360
+ "captcha-eu": () => import("./chunks/captcha-eu-CGm8Lbrj.js").then((e) => e.captchaEuModule),
1361
+ "friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-C_2reOXr.js").then((e) => e.friendlyCaptchaV1Module),
1362
+ "friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-CLSAbkqx.js").then((e) => e.friendlyCaptchaV2Module),
1363
+ hcaptcha: () => import("./chunks/hcaptcha-CGLAmgjO.js").then((e) => e.hcaptchaModule),
1364
+ "recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-XPId5-bS.js").then((e) => e.recaptchaEnterpriseModule),
1365
+ "recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-Cy-0PEPc.js").then((e) => e.recaptchaV2CheckboxModule),
1366
+ "recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-BwRH540O.js").then((e) => e.recaptchaV2InvisibleModule),
1367
+ "recaptcha-v3": () => import("./chunks/recaptcha-v3-No4Ykrhk.js").then((e) => e.recaptchaV3Module),
1368
+ snaptcha: () => import("./chunks/snaptcha-DKx98oon.js").then((e) => e.snaptchaModule),
1369
+ turnstile: () => import("./chunks/turnstile-DJakPzQD.js").then((e) => e.turnstileModule)
1370
+ }, qt = {
1357
1371
  calculations: () => import("./chunks/calculations-CeDgB9jt.js").then((e) => e.calculationsModule),
1358
1372
  "checkbox-radio": () => import("./chunks/checkbox-radio-DQ0H67Tj.js").then((e) => e.checkboxRadioModule),
1359
1373
  combobox: () => import("./chunks/combobox-D-2b42wn.js").then((e) => e.comboboxModule),
1360
- conditions: () => import("./chunks/conditions-DjZOtHfS.js").then((e) => e.conditionsModule),
1374
+ conditions: () => import("./chunks/conditions-B6_nzpeE.js").then((e) => e.conditionsModule),
1361
1375
  "custom-google-maps": () => import("./chunks/custom-google-maps-BsaSirEZ.js").then((e) => e.customGoogleMapsModule),
1362
1376
  "custom-link": () => import("./chunks/custom-link-CJ1-FjEM.js").then((e) => e.customLinkModule),
1363
1377
  "custom-maps": () => import("./chunks/custom-maps-DYW_pBid.js").then((e) => e.customMapsModule),
@@ -1371,87 +1385,90 @@ var Vt = class {
1371
1385
  repeater: () => import("./chunks/repeater-B5leVxZU.js").then((e) => e.repeaterModule),
1372
1386
  "rich-text": () => import("./chunks/rich-text-D0sb8bmX.js").then((e) => e.richTextModule),
1373
1387
  signature: () => import("./chunks/signature-xz4QO7CR.js").then((e) => e.signatureModule),
1374
- summary: () => import("./chunks/summary-D3AjxpYN.js").then((e) => e.summaryModule),
1388
+ summary: () => import("./chunks/summary-Dks0gXS3.js").then((e) => e.summaryModule),
1389
+ "survey-likert": () => import("./chunks/survey-likert-DmJ3klhP.js").then((e) => e.surveyLikertModule),
1390
+ "survey-rank": () => import("./chunks/survey-rank-DeUenftw.js").then((e) => e.surveyRankModule),
1391
+ "survey-rating": () => import("./chunks/survey-rating-BPUYDgBJ.js").then((e) => e.surveyRatingModule),
1375
1392
  table: () => import("./chunks/table-C-lkQN6I.js").then((e) => e.tableModule),
1376
1393
  "text-limit": () => import("./chunks/text-limit-DbgEFHLO.js").then((e) => e.textLimitModule)
1377
- }, Gt = {
1378
- bpoint: () => import("./chunks/bpoint-DSjqRv63.js").then((e) => e.bpointModule),
1379
- eway: () => import("./chunks/eway-D3ctTbEk.js").then((e) => e.ewayModule),
1380
- "go-cardless": () => import("./chunks/go-cardless-BwASSYSK.js").then((e) => e.goCardlessModule),
1381
- mollie: () => import("./chunks/mollie-COG-ko2D.js").then((e) => e.mollieModule),
1382
- moneris: () => import("./chunks/moneris-CMH8PlRc.js").then((e) => e.monerisModule),
1383
- opayo: () => import("./chunks/opayo-D2jsR5vh.js").then((e) => e.opayoModule),
1384
- paddle: () => import("./chunks/paddle-DxF88RfC.js").then((e) => e.paddleModule),
1385
- paypal: () => import("./chunks/paypal-b5pnwrA2.js").then((e) => e.paypalModule),
1386
- payway: () => import("./chunks/payway-BJYu9DIR.js").then((e) => e.paywayModule),
1387
- square: () => import("./chunks/square-BP8RWAKB.js").then((e) => e.squareModule),
1388
- stripe: () => import("./chunks/stripe-MihN63uC.js").then((e) => e.stripeModule)
1389
- }, Kt = {
1390
- ...Wt,
1391
- ...Ht,
1392
- ...Ut,
1393
- ...Gt
1394
- }, L = /* @__PURE__ */ new Map(), R = d("general", "loader"), qt = Function("src", "return import(src);");
1395
- async function z(t, n, i, a) {
1394
+ }, Jt = {
1395
+ bpoint: () => import("./chunks/bpoint-CwSw_p7A.js").then((e) => e.bpointModule),
1396
+ eway: () => import("./chunks/eway-B30BMlDp.js").then((e) => e.ewayModule),
1397
+ "go-cardless": () => import("./chunks/go-cardless-BiF3iLel.js").then((e) => e.goCardlessModule),
1398
+ mollie: () => import("./chunks/mollie-D__SwtcH.js").then((e) => e.mollieModule),
1399
+ moneris: () => import("./chunks/moneris-KJS1BKx7.js").then((e) => e.monerisModule),
1400
+ opayo: () => import("./chunks/opayo-A_LIkc-v.js").then((e) => e.opayoModule),
1401
+ paddle: () => import("./chunks/paddle-BjbOOb0m.js").then((e) => e.paddleModule),
1402
+ paypal: () => import("./chunks/paypal-CyjHIV8v.js").then((e) => e.paypalModule),
1403
+ payway: () => import("./chunks/payway-a_cyrr3j.js").then((e) => e.paywayModule),
1404
+ square: () => import("./chunks/square-Bga6WXHV.js").then((e) => e.squareModule),
1405
+ stripe: () => import("./chunks/stripe-BlqVocl3.js").then((e) => e.stripeModule)
1406
+ }, Yt = {
1407
+ ...qt,
1408
+ ...Gt,
1409
+ ...Kt,
1410
+ ...Jt
1411
+ }, z = /* @__PURE__ */ new Map(), B = C("general", "loader"), Xt = Function("src", "return import(src);");
1412
+ async function V(t, n, i, a) {
1396
1413
  await t(r(i), a), await t(e(n, i), a);
1397
1414
  }
1398
- function Jt(e) {
1415
+ function Zt(e) {
1399
1416
  return !!e && typeof e == "object" && typeof e.id == "string" && typeof e.setup == "function" && typeof e.match == "function";
1400
1417
  }
1401
- async function Yt(e, t) {
1402
- let n = Kt[e];
1403
- return n ? (L.has(e) || L.set(e, (async () => {
1418
+ async function Qt(e, t) {
1419
+ let n = Yt[e];
1420
+ return n ? (z.has(e) || z.set(e, (async () => {
1404
1421
  try {
1405
1422
  let e = await n();
1406
- return Jt(e) ? (t.registry.register(e), e) : null;
1423
+ return Zt(e) ? (t.registry.register(e), e) : null;
1407
1424
  } catch (t) {
1408
- return console.error("[formie] Failed to load builtin module:", e, t), R.warn("Failed loading builtin module.", {
1425
+ return console.error("[formie] Failed to load builtin module:", e, t), B.warn("Failed loading builtin module.", {
1409
1426
  moduleId: e,
1410
1427
  error: t
1411
1428
  }), null;
1412
1429
  }
1413
- })()), L.get(e) || null) : null;
1430
+ })()), z.get(e) || null) : null;
1414
1431
  }
1415
- async function Xt(e) {
1432
+ async function $t(e) {
1416
1433
  try {
1417
- let t = await qt(e), n = t?.default || t?.formieModule || null;
1418
- return Jt(n) ? n : null;
1434
+ let t = await Xt(e), n = t?.default || t?.formieModule || null;
1435
+ return Zt(n) ? n : null;
1419
1436
  } catch (t) {
1420
- return console.error("[formie] Failed to load module from src:", e, t), R.warn("Failed loading module from src.", {
1437
+ return console.error("[formie] Failed to load module from src:", e, t), B.warn("Failed loading module from src.", {
1421
1438
  src: e,
1422
1439
  error: t
1423
1440
  }), null;
1424
1441
  }
1425
1442
  }
1426
- async function Zt(e, t) {
1443
+ async function en(e, t) {
1427
1444
  let n = t.registry.get(e.id);
1428
1445
  if (n) return n;
1429
- let r = await Yt(e.id, t);
1446
+ let r = await Qt(e.id, t);
1430
1447
  if (r) return r;
1431
1448
  if (e.src) {
1432
- let n = await Xt(e.src);
1449
+ let n = await $t(e.src);
1433
1450
  if (n) return t.registry.register(n), n;
1434
1451
  }
1435
1452
  return null;
1436
1453
  }
1437
- function B(e) {
1454
+ function tn(e) {
1438
1455
  return typeof window.CSS?.escape == "function" ? window.CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
1439
1456
  }
1440
- function V(e, t) {
1457
+ function H(e, t) {
1441
1458
  return e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
1442
1459
  }
1443
- function Qt(e, t) {
1460
+ function nn(e, t) {
1444
1461
  let n = t.setupContext.root, r = t.setupContext.form, i = e.targetType, a = e.targetId;
1445
- return i === "selector" ? V(n, a).map((e) => ({
1462
+ return i === "selector" ? H(n, a).map((e) => ({
1446
1463
  scope: i,
1447
1464
  element: e
1448
- })) : i === "field" ? V(n, `[data-formie-field-handle="${B(a)}"]`).map((e) => ({
1465
+ })) : i === "field" ? H(n, `[data-formie-field-handle="${tn(a)}"]`).map((e) => ({
1449
1466
  scope: i,
1450
1467
  element: e
1451
- })) : i === "page" ? V(n, `[data-formie-page-id="${B(a)}"]`).map((e) => ({
1468
+ })) : i === "page" ? H(n, `[data-formie-page-id="${tn(a)}"]`).map((e) => ({
1452
1469
  scope: i,
1453
1470
  element: e
1454
- })) : i === "button" ? V(n, `[data-formie-action="${B(a)}"]`).map((e) => ({
1471
+ })) : i === "button" ? H(n, `[data-formie-action="${tn(a)}"]`).map((e) => ({
1455
1472
  scope: i,
1456
1473
  element: e
1457
1474
  })) : [{
@@ -1459,26 +1476,26 @@ function Qt(e, t) {
1459
1476
  element: r || n
1460
1477
  }];
1461
1478
  }
1462
- function $t(e, t) {
1479
+ function rn(e, t) {
1463
1480
  return (e.targets && e.targets.length > 0 ? e.targets : [{
1464
1481
  targetType: "form",
1465
1482
  targetId: "form"
1466
- }]).flatMap((e) => Qt(e, t));
1483
+ }]).flatMap((e) => nn(e, t));
1467
1484
  }
1468
- async function en(e, t) {
1485
+ async function an(e, t) {
1469
1486
  let n = [];
1470
- R.log("Loading module manifest.", { manifestCount: e.length });
1487
+ B.log("Loading module manifest.", { manifestCount: e.length });
1471
1488
  for (let r of e) {
1472
- let e = await Zt(r, t);
1489
+ let e = await en(r, t);
1473
1490
  if (!e) {
1474
- R.warn("Skipping manifest item (definition not resolved).", {
1491
+ B.warn("Skipping manifest item (definition not resolved).", {
1475
1492
  moduleId: r.id,
1476
1493
  src: r.src
1477
1494
  });
1478
1495
  continue;
1479
1496
  }
1480
- let i = $t(r, t);
1481
- R.log("Resolved module targets.", {
1497
+ let i = rn(r, t);
1498
+ B.log("Resolved module targets.", {
1482
1499
  moduleId: e.id,
1483
1500
  targets: r.targets || [],
1484
1501
  targetCount: i.length
@@ -1491,7 +1508,7 @@ async function en(e, t) {
1491
1508
  manifestItem: r
1492
1509
  };
1493
1510
  if (!e.match(i)) {
1494
- e.kind === "address" && console.warn(`[formie] Address module "${e.id}" skipped: target element does not contain [data-formie-address-autocomplete-input]. Enable the Auto-Complete subfield.`), R.log("Module target did not match predicate.", {
1511
+ e.kind === "address" && console.warn(`[formie] Address module "${e.id}" skipped: target element does not contain [data-formie-address-autocomplete-input]. Enable the Auto-Complete subfield.`), B.log("Module target did not match predicate.", {
1495
1512
  moduleId: e.id,
1496
1513
  scope: a.scope
1497
1514
  });
@@ -1505,7 +1522,7 @@ async function en(e, t) {
1505
1522
  options: o,
1506
1523
  manifestItem: r
1507
1524
  };
1508
- await z(t.setupContext.emit, s, "before-setup", c);
1525
+ await V(t.setupContext.emit, s, "before-setup", c);
1509
1526
  let l = null;
1510
1527
  try {
1511
1528
  let n = await e.setup({
@@ -1516,25 +1533,25 @@ async function en(e, t) {
1516
1533
  });
1517
1534
  n && (l = n);
1518
1535
  } catch (t) {
1519
- console.error(`[formie] Module "${e.id}" setup failed:`, t), R.warn("Module setup failed.", {
1536
+ console.error(`[formie] Module "${e.id}" setup failed:`, t), B.warn("Module setup failed.", {
1520
1537
  moduleId: e.id,
1521
1538
  scope: a.scope,
1522
1539
  error: t
1523
1540
  });
1524
1541
  }
1525
- await z(t.setupContext.emit, s, "after-setup", {
1542
+ await V(t.setupContext.emit, s, "after-setup", {
1526
1543
  ...c,
1527
1544
  instanceCreated: !!l
1528
- }), l && (R.log("Module instance created.", {
1545
+ }), l && (B.log("Module instance created.", {
1529
1546
  moduleId: e.id,
1530
1547
  scope: a.scope
1531
1548
  }), n.push({
1532
1549
  ...l,
1533
1550
  destroy: async () => {
1534
- R.log("Destroying module instance.", {
1551
+ B.log("Destroying module instance.", {
1535
1552
  moduleId: e.id,
1536
1553
  scope: a.scope
1537
- }), await z(t.setupContext.emit, s, "before-destroy", c), await l.destroy(), await z(t.setupContext.emit, s, "after-destroy", c), R.log("Module instance destroyed.", {
1554
+ }), await V(t.setupContext.emit, s, "before-destroy", c), await l.destroy(), await V(t.setupContext.emit, s, "after-destroy", c), B.log("Module instance destroyed.", {
1538
1555
  moduleId: e.id,
1539
1556
  scope: a.scope
1540
1557
  });
@@ -1542,54 +1559,64 @@ async function en(e, t) {
1542
1559
  }));
1543
1560
  }
1544
1561
  }
1545
- return R.log("Module manifest processing complete.", { instanceCount: n.length }), n;
1562
+ return B.log("Module manifest processing complete.", { instanceCount: n.length }), n;
1563
+ }
1564
+ //#endregion
1565
+ //#region src/js/utils/form-started-at.ts
1566
+ var on = "formie:formStartedAt:";
1567
+ function sn(e) {
1568
+ let t = e.querySelector("input[name=\"formStartedAt\"]");
1569
+ if (!t) return;
1570
+ let n = e.querySelector("input[name=\"renderId\"]")?.value?.trim() ?? "", r = n ? `${on}${n}` : null, i = r ? sessionStorage.getItem(r) : null;
1571
+ i || (i = String(Date.now()), r && sessionStorage.setItem(r, i)), t.value = i;
1546
1572
  }
1547
1573
  //#endregion
1548
1574
  //#region src/js/utils/unload-warning.ts
1549
- var tn = new Set([
1575
+ var cn = new Set([
1550
1576
  "CRAFT_CSRF_TOKEN",
1551
1577
  "action",
1552
1578
  "redirect",
1553
1579
  "requestToken",
1554
1580
  "renderId",
1581
+ "formStartedAt",
1555
1582
  "submitAction",
1556
1583
  "pageId",
1557
1584
  "draftContextToken",
1558
1585
  "draftContext",
1559
1586
  "continuationToken"
1560
1587
  ]);
1561
- function nn(e, t) {
1588
+ function ln(e, t) {
1562
1589
  if (e == null) return String(e);
1563
1590
  if (typeof e == "string") return JSON.stringify(e);
1564
1591
  if (typeof e == "number" || typeof e == "boolean") return String(e);
1565
1592
  if (typeof e == "function") return "[function]";
1566
1593
  if (typeof File < "u" && e instanceof File) return `[file:${e.name}:${e.size}:${e.type}]`;
1567
1594
  if (typeof Blob < "u" && e instanceof Blob) return `[blob:${e.size}:${e.type}]`;
1568
- if (Array.isArray(e)) return `[${e.map((e) => nn(e, t)).join(",")}]`;
1595
+ if (Array.isArray(e)) return `[${e.map((e) => ln(e, t)).join(",")}]`;
1569
1596
  if (typeof e == "object") {
1570
1597
  if (t.has(e)) return "[circular]";
1571
1598
  t.add(e);
1572
- let n = Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => `${JSON.stringify(e)}:${nn(n, t)}`);
1599
+ let n = Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => `${JSON.stringify(e)}:${ln(n, t)}`);
1573
1600
  return t.delete(e), `{${n.join(",")}}`;
1574
1601
  }
1575
1602
  return JSON.stringify(String(e));
1576
1603
  }
1577
- function rn(e) {
1578
- return nn(e, /* @__PURE__ */ new WeakSet());
1604
+ function un(e) {
1605
+ return ln(e, /* @__PURE__ */ new WeakSet());
1579
1606
  }
1580
- function an(e) {
1607
+ function dn(e) {
1581
1608
  if (!e) return !1;
1582
1609
  let t = e.endsWith("[]") ? e.slice(0, -2) : e;
1583
- return !tn.has(t);
1610
+ return !cn.has(t);
1584
1611
  }
1585
- function on(e) {
1586
- return rn(Array.from(new FormData(e).entries()).filter(([e]) => an(String(e || ""))));
1612
+ function fn(e) {
1613
+ return un(Array.from(new FormData(e).entries()).filter(([e]) => dn(String(e || ""))));
1587
1614
  }
1588
- function sn(e, t = {}) {
1615
+ function pn(e, t = {}) {
1589
1616
  let n = null, r = !1, i = !1, a = null, o = null, s = null, c = () => {
1590
1617
  a !== null && (window.cancelAnimationFrame(a), a = null), o !== null && (window.clearTimeout(o), o = null), s !== null && (window.clearTimeout(s), s = null);
1591
- }, l = () => r ? (i = on(e) !== n, i) : !1, u = () => {
1592
- n = on(e), r = !0, i = !1;
1618
+ }, l = () => r ? (i = fn(e) !== n, i) : !1, u = () => {
1619
+ n = fn(e), r = !0, i = !1;
1593
1620
  }, d = () => {
1594
1621
  c(), r = !1, a = window.requestAnimationFrame(() => {
1595
1622
  a = null, s = window.setTimeout(() => {
@@ -1613,41 +1640,67 @@ function sn(e, t = {}) {
1613
1640
  };
1614
1641
  }
1615
1642
  //#endregion
1643
+ //#region src/js/validation/enter-key-guard.ts
1644
+ function mn(e) {
1645
+ 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]");
1646
+ }
1647
+ function hn(e, t) {
1648
+ let n = e.querySelectorAll(`[data-formie-action="${t}"]`);
1649
+ return Array.from(n).some((e) => !mn(e));
1650
+ }
1651
+ function gn(e) {
1652
+ let { final: t } = f(e);
1653
+ return "submit";
1654
+ }
1655
+ function _n(e) {
1656
+ return !hn(e, gn(e));
1657
+ }
1658
+ function vn(e) {
1659
+ let t = (t) => {
1660
+ if (t.key !== "Enter" || t.defaultPrevented) return;
1661
+ let n = t.target;
1662
+ (n instanceof HTMLInputElement || n instanceof HTMLSelectElement) && (n instanceof HTMLInputElement && (n.type === "button" || n.type === "submit" || n.type === "reset" || n.type === "file") || _n(e) && t.preventDefault());
1663
+ };
1664
+ return e.addEventListener("keydown", t, !0), () => {
1665
+ e.removeEventListener("keydown", t, !0);
1666
+ };
1667
+ }
1668
+ //#endregion
1616
1669
  //#region src/js/core/create-formie-client.ts
1617
- var H = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", cn = 300, ln = "/actions/formie/server/forms/render", un = "/api", dn = "/actions/formie/server/forms/refresh-tokens", fn = "/actions/formie/server/submissions/submit", pn = "/actions/formie/server/submissions/set-page", mn = "/actions/formie/server/submissions/clear-submission", hn = "/actions/formie/file-upload/hydrate", U = d("general", "client"), gn = /* @__PURE__ */ new Set();
1618
- function W(e, t) {
1670
+ var U = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", yn = 300, bn = "/actions/formie/server/forms/render", xn = "/api", Sn = "/actions/formie/server/forms/refresh-tokens", Cn = "/actions/formie/server/submissions/submit", wn = "/actions/formie/server/submissions/set-page", Tn = "/actions/formie/server/submissions/clear-submission", En = "/actions/formie/file-upload/hydrate", W = C("general", "client"), Dn = /* @__PURE__ */ new Set();
1671
+ function G(e, t) {
1619
1672
  if (e == null || e === "") return t;
1620
1673
  let n = e.toLowerCase();
1621
1674
  return !(n === "false" || n === "0" || n === "off");
1622
1675
  }
1623
- function _n(e) {
1624
- return e.formieRefreshTokens != null && e.formieRefreshTokens !== "" ? W(e.formieRefreshTokens, !1) : e.formieStaticCache != null && e.formieStaticCache !== "" ? W(e.formieStaticCache, !1) : !1;
1676
+ function On(e) {
1677
+ return e.formieRefreshTokens != null && e.formieRefreshTokens !== "" ? G(e.formieRefreshTokens, !1) : e.formieStaticCache != null && e.formieStaticCache !== "" ? G(e.formieStaticCache, !1) : !1;
1625
1678
  }
1626
- function G(e) {
1679
+ function K(e) {
1627
1680
  let t = e instanceof HTMLElement ? e.dataset : {};
1628
1681
  return {
1629
1682
  mode: "server-rendered",
1630
1683
  transport: t.formieTransport || "rest",
1631
1684
  formHandle: t.formieHandle,
1632
1685
  endpoint: t.formieEndpoint,
1633
- staticCache: _n(t),
1634
- autoVisible: W(t.formieAutoVisible, !0),
1635
- compatibility: W(t.formieCompatibility, !1)
1686
+ staticCache: On(t),
1687
+ autoVisible: G(t.formieAutoVisible, !0),
1688
+ compatibility: G(t.formieCompatibility, !1)
1636
1689
  };
1637
1690
  }
1638
- function K(e) {
1691
+ function q(e) {
1639
1692
  return e || "server-rendered";
1640
1693
  }
1641
- function q(e) {
1694
+ function J(e) {
1642
1695
  return e || "rest";
1643
1696
  }
1644
- function J(e) {
1697
+ function Y(e) {
1645
1698
  return e instanceof HTMLFormElement ? e : e.querySelector("form");
1646
1699
  }
1647
- function vn(e, t) {
1648
- gn.has(e) || (gn.add(e), U.warn(t));
1700
+ function kn(e, t) {
1701
+ Dn.has(e) || (Dn.add(e), W.warn(t));
1649
1702
  }
1650
- function yn(e, t) {
1703
+ function An(e, t) {
1651
1704
  if (!e) return e;
1652
1705
  try {
1653
1706
  return new URL(e).toString();
@@ -1659,21 +1712,21 @@ function yn(e, t) {
1659
1712
  return e;
1660
1713
  }
1661
1714
  }
1662
- function Y(e, t) {
1715
+ function X(e, t) {
1663
1716
  let n = (e || "").trim();
1664
- return n ? n.includes("/actions/") ? n : yn(t, n) : t;
1717
+ return n ? n.includes("/actions/") ? n : An(t, n) : t;
1665
1718
  }
1666
- function bn(e, t) {
1667
- return Y(e.endpoint || t.dataset.formieEndpoint, ln);
1719
+ function jn(e, t) {
1720
+ return X(e.endpoint || t.dataset.formieEndpoint, bn);
1668
1721
  }
1669
- function xn(e, t) {
1722
+ function Mn(e, t) {
1670
1723
  let n = (e.endpoint || t.dataset.formieEndpoint || "").trim();
1671
- return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : yn(un, n) : un;
1724
+ return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : An(xn, n) : xn;
1672
1725
  }
1673
- function Sn(e, t) {
1674
- return Y(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, dn);
1726
+ function Nn(e, t) {
1727
+ return X(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, Sn);
1675
1728
  }
1676
- function Cn(e, t) {
1729
+ function Pn(e, t) {
1677
1730
  if (!e) return t;
1678
1731
  try {
1679
1732
  let n = new URL(e, window.location.origin), r = new URL(t, window.location.origin);
@@ -1684,42 +1737,42 @@ function Cn(e, t) {
1684
1737
  return t;
1685
1738
  }
1686
1739
  }
1687
- function wn(e, t, n) {
1688
- let r = n.endpoint || e.dataset.formieEndpoint, i = Y(r, fn), a = t.getAttribute("action");
1689
- t.setAttribute("action", Cn(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
1690
- let t = e.getAttribute("href"), n = Y(r, pn);
1691
- e.setAttribute("href", Cn(t, n));
1740
+ function Fn(e, t, n) {
1741
+ let r = n.endpoint || e.dataset.formieEndpoint, i = X(r, Cn), a = t.getAttribute("action");
1742
+ t.setAttribute("action", Pn(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
1743
+ let t = e.getAttribute("href"), n = X(r, wn);
1744
+ e.setAttribute("href", Pn(t, n));
1692
1745
  }), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((e) => {
1693
- e.setAttribute("data-formie-file-upload-hydrate-endpoint", Y(r, hn));
1746
+ e.setAttribute("data-formie-file-upload-hydrate-endpoint", X(r, En));
1694
1747
  });
1695
1748
  }
1696
- function Tn(e, t) {
1749
+ function In(e, t) {
1697
1750
  if (e === "graphql" && t !== "server-rendered") throw Error(`Formie ${t} mode does not support GraphQL transport yet.`);
1698
1751
  }
1699
- function En(e) {
1752
+ function Ln(e) {
1700
1753
  if (e == null) return !1;
1701
1754
  let t = e.trim().toLowerCase();
1702
1755
  return t === "true" || t === "1" || t === "";
1703
1756
  }
1704
- function Dn(e) {
1705
- return W(e.dataset.formieAutomaticSubmissionState, !0);
1757
+ function Rn(e) {
1758
+ return G(e.dataset.formieAutomaticSubmissionState, !0);
1706
1759
  }
1707
- function On(e, t, n) {
1708
- return Y(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, mn);
1760
+ function zn(e, t, n) {
1761
+ return X(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, Tn);
1709
1762
  }
1710
- function kn(e) {
1711
- return En(e.dataset.formieUnloadWarning);
1763
+ function Bn(e) {
1764
+ return Ln(e.dataset.formieUnloadWarning);
1712
1765
  }
1713
- function An(e, t) {
1766
+ function Vn(e, t) {
1714
1767
  e.setAttribute("data-formie-internal-navigation", t);
1715
1768
  }
1716
- function jn(e) {
1769
+ function Hn(e) {
1717
1770
  e.removeAttribute("data-formie-internal-navigation");
1718
1771
  }
1719
- function Mn(e) {
1772
+ function Un(e) {
1720
1773
  return e.getAttribute("data-formie-internal-navigation") !== null;
1721
1774
  }
1722
- function Nn(e, t) {
1775
+ function Wn(e, t) {
1723
1776
  if (!e) return !1;
1724
1777
  try {
1725
1778
  return new URL(e, window.location.origin).searchParams.has(t);
@@ -1727,30 +1780,30 @@ function Nn(e, t) {
1727
1780
  return !1;
1728
1781
  }
1729
1782
  }
1730
- function Pn(e) {
1731
- return Nn(window.location.href, "resumeToken") || Nn(e.getAttribute("action"), "resumeToken");
1783
+ function Gn(e) {
1784
+ return Wn(window.location.href, "resumeToken") || Wn(e.getAttribute("action"), "resumeToken");
1732
1785
  }
1733
- function Fn(e) {
1786
+ function Kn(e) {
1734
1787
  return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
1735
1788
  }
1736
- function In(e, t = 0) {
1789
+ function qn(e, t = 0) {
1737
1790
  if (!e) return t;
1738
1791
  let n = Number.parseInt(e, 10);
1739
1792
  return Number.isFinite(n) ? n : t;
1740
1793
  }
1741
- function Ln(e) {
1742
- return Math.max(0, In(e.dataset.formieSubmitDelay, cn));
1794
+ function Jn(e) {
1795
+ return Math.max(0, qn(e.dataset.formieSubmitDelay, yn));
1743
1796
  }
1744
- function X(e) {
1745
- return En(e.dataset.formieValidationOnSubmit);
1797
+ function Z(e) {
1798
+ return Ln(e.dataset.formieValidationOnSubmit);
1746
1799
  }
1747
- async function Z(e) {
1748
- let t = Ln(e);
1800
+ async function Yn(e) {
1801
+ let t = Jn(e);
1749
1802
  t < 1 || await new Promise((e) => {
1750
1803
  window.setTimeout(e, t);
1751
1804
  });
1752
1805
  }
1753
- function Rn(e, t) {
1806
+ function Xn(e, t) {
1754
1807
  let n = e?.getAttribute(t)?.trim();
1755
1808
  if (!n) return null;
1756
1809
  try {
@@ -1759,29 +1812,29 @@ function Rn(e, t) {
1759
1812
  return console.error(`[formie] Failed to parse ${t}.`, e), null;
1760
1813
  }
1761
1814
  }
1762
- function zn(e, t) {
1815
+ function Zn(e, t) {
1763
1816
  let n = t || (e instanceof HTMLFormElement ? e : null);
1764
1817
  if (!n) return null;
1765
- let r = Rn(n, "data-formie-modules"), i = Rn(n, "data-formie-theme");
1818
+ let r = Xn(n, "data-formie-modules"), i = Xn(n, "data-formie-theme");
1766
1819
  return !r && !i ? null : {
1767
1820
  modules: r || void 0,
1768
1821
  theme: i || void 0
1769
1822
  };
1770
1823
  }
1771
- function Bn(e) {
1824
+ function Qn(e) {
1772
1825
  if (!(e instanceof HTMLElement)) return !0;
1773
1826
  if (!e.isConnected || e.hidden || e.closest("[hidden]")) return !1;
1774
1827
  let t = window.getComputedStyle(e);
1775
1828
  return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
1776
1829
  }
1777
- function Vn(e, t) {
1830
+ function $n(e, t) {
1778
1831
  return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
1779
1832
  }
1780
1833
  function Q(e) {
1781
1834
  let t = e, n = t.id ? `#${t.id}` : "", r = t.dataset?.formieHandle ? `[handle="${t.dataset.formieHandle}"]` : "";
1782
1835
  return `${t.tagName ? t.tagName.toLowerCase() : "element"}${n}${r}`;
1783
1836
  }
1784
- function Hn(e, t) {
1837
+ function er(e, t) {
1785
1838
  if (t) {
1786
1839
  if (t.csrf?.param && t.csrf?.token) {
1787
1840
  let n = e.querySelector(`input[name="${t.csrf.param}"]`);
@@ -1804,12 +1857,12 @@ function Hn(e, t) {
1804
1857
  });
1805
1858
  }
1806
1859
  }
1807
- async function Un(e, t) {
1808
- let n = K(t.mode), r = q(t.transport);
1860
+ async function tr(e, t) {
1861
+ let n = q(t.mode), r = J(t.transport);
1809
1862
  if (n !== "server-rendered") return null;
1810
1863
  if (t.payload) return t.payload.html && (e.innerHTML = t.payload.html), t.payload;
1811
- Tn(r, n);
1812
- let i = !!J(e), a = t.formHandle || e.dataset.formieHandle;
1864
+ In(r, n);
1865
+ let i = !!Y(e), a = t.formHandle || e.dataset.formieHandle;
1813
1866
  if (i || !a) return null;
1814
1867
  let o = {
1815
1868
  mode: n,
@@ -1818,30 +1871,30 @@ async function Un(e, t) {
1818
1871
  siteId: t.siteId,
1819
1872
  theme: t.theme,
1820
1873
  themeConfig: t.themeConfig
1821
- }, s = r === "graphql" ? xn(t, e) : bn(t, e), c = r === "graphql" ? await Le(s, a, o) : await Ie(s, a, {
1874
+ }, s = r === "graphql" ? Mn(t, e) : jn(t, e), c = r === "graphql" ? await Be(s, a, o) : await ze(s, a, {
1822
1875
  ...o,
1823
1876
  endpoint: s
1824
1877
  });
1825
1878
  return c?.html && (e.innerHTML = c.html), c;
1826
1879
  }
1827
- async function Wn(e, t, n) {
1880
+ async function nr(e, t, n) {
1828
1881
  if (t.refreshTokens === !1) return;
1829
- Tn(q(t.transport), K(t.mode));
1882
+ In(J(t.transport), q(t.mode));
1830
1883
  let r = t.formHandle || e.dataset.formieHandle;
1831
1884
  if (!r) return;
1832
- let i = await Re(Sn(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0);
1833
- Hn(n, i), O(e, "formie:refresh-tokens:refreshed", i);
1885
+ let i = await M(Nn(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0);
1886
+ er(n, i), h(e, "formie:refresh-tokens:refreshed", i);
1834
1887
  }
1835
- function Gn(e, t, n, r, i, a) {
1836
- let o = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), s = On(n, e, t), c = !1, l = t.querySelectorAll("[data-formie-action]"), u = (e) => {
1888
+ function rr(e, t, n, r, i, a) {
1889
+ let o = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), s = zn(n, e, t), c = !1, u = t.querySelectorAll("[data-formie-action]"), g = (e) => {
1837
1890
  if (e) {
1838
1891
  t.setAttribute("data-formie-pending-action", e);
1839
1892
  return;
1840
1893
  }
1841
1894
  t.removeAttribute("data-formie-pending-action");
1842
1895
  };
1843
- if (kn(t)) {
1844
- let n = sn(t, { shouldWarn: () => !Mn(t) }), r = (e) => {
1896
+ if (Bn(t)) {
1897
+ let n = pn(t, { shouldWarn: () => !Un(t) }), r = (e) => {
1845
1898
  if (!(e instanceof CustomEvent)) return;
1846
1899
  let t = e.detail;
1847
1900
  t?.ok && t.action === "save" && n.scheduleBaselineCapture();
@@ -1852,10 +1905,10 @@ function Gn(e, t, n, r, i, a) {
1852
1905
  e.removeEventListener("formie:submit:result", r), t.removeEventListener("formie:state:reset", i), n.destroy();
1853
1906
  });
1854
1907
  }
1855
- if (l.forEach((e) => {
1908
+ if (u.forEach((e) => {
1856
1909
  let n = (e) => {
1857
1910
  let n = e.currentTarget.getAttribute("data-formie-action"), r = t.querySelector("input[name=\"submitAction\"]");
1858
- u(n), n && r && (r.value = n);
1911
+ g(n), n && r && (r.value = n);
1859
1912
  };
1860
1913
  e.addEventListener("click", n), a.push(() => {
1861
1914
  e.removeEventListener("click", n);
@@ -1863,24 +1916,24 @@ function Gn(e, t, n, r, i, a) {
1863
1916
  }), t.querySelectorAll("[data-formie-tab-link]").forEach((n) => {
1864
1917
  let r = async (n) => {
1865
1918
  if (o !== "ajax") {
1866
- Fn(n) && An(t, "set-page");
1919
+ Kn(n) && Vn(t, "set-page");
1867
1920
  return;
1868
1921
  }
1869
1922
  n.preventDefault();
1870
1923
  let r = n.currentTarget, i = r?.getAttribute("data-formie-page-id"), a = r?.getAttribute("href");
1871
1924
  if (!(!i || !a)) {
1872
- g(t, i), O(e, "formie:page:navigate", {
1925
+ p(t, i), h(e, "formie:page:navigate", {
1873
1926
  pageId: i,
1874
1927
  href: a
1875
1928
  });
1876
1929
  try {
1877
- O(e, "formie:page:navigate:after", {
1930
+ h(e, "formie:page:navigate:after", {
1878
1931
  pageId: i,
1879
1932
  href: a,
1880
- response: await ze(a, t, i)
1933
+ response: await Ve(a, t, i)
1881
1934
  });
1882
1935
  } catch (t) {
1883
- console.error("[formie] Failed to persist page navigation state.", t), O(e, "formie:page:navigate:error", {
1936
+ console.error("[formie] Failed to persist page navigation state.", t), h(e, "formie:page:navigate:error", {
1884
1937
  pageId: i,
1885
1938
  href: a,
1886
1939
  error: t
@@ -1891,50 +1944,50 @@ function Gn(e, t, n, r, i, a) {
1891
1944
  n.addEventListener("click", r), a.push(() => {
1892
1945
  n.removeEventListener("click", r);
1893
1946
  });
1894
- }), !Dn(t)) {
1947
+ }), !Rn(t)) {
1895
1948
  let e = !1, n = () => {
1896
- e || Mn(t) || Pn(t) || (e = !0, Be(s, t));
1949
+ e || Un(t) || Gn(t) || (e = !0, He(s, t));
1897
1950
  };
1898
1951
  window.addEventListener("pagehide", n), window.addEventListener("beforeunload", n), a.push(() => {
1899
1952
  window.removeEventListener("pagehide", n), window.removeEventListener("beforeunload", n);
1900
1953
  });
1901
1954
  }
1902
- let d = async (a) => {
1955
+ let _ = async (a) => {
1903
1956
  if (c) return;
1904
1957
  let s = o === "ajax";
1905
1958
  if (a.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
1906
1959
  if (t.getAttribute("data-formie-internal-resubmit") !== "true") return;
1907
1960
  t.removeAttribute("data-formie-internal-resubmit");
1908
1961
  } else t.removeAttribute("data-formie-internal-resubmit");
1909
- let l = a.submitter, d = l?.getAttribute("data-formie-action"), f = t.getAttribute("data-formie-pending-action"), p = t.querySelector("input[name=\"submitAction\"]"), g = d || f || p?.value || "submit", v = null, y = !1;
1962
+ let u = a.submitter, p = u?.getAttribute("data-formie-action"), _ = t.getAttribute("data-formie-pending-action"), v = t.querySelector("input[name=\"submitAction\"]"), y = p || _ || v?.value || "submit", b = null, x = !1;
1910
1963
  try {
1911
- if (s) v = await Bt({
1964
+ if (s) b = await Wt({
1912
1965
  target: e,
1913
1966
  form: t,
1914
1967
  bus: r,
1915
1968
  validator: i,
1916
- validateOnSubmit: X(t),
1917
- action: g,
1918
- submitter: l,
1919
- waitForSubmitDelay: Z,
1969
+ validateOnSubmit: Z(t),
1970
+ action: y,
1971
+ submitter: u,
1972
+ waitForSubmitDelay: Yn,
1920
1973
  onRefreshTokensAfterSubmit: async () => {
1921
- await Wn(e, n, t);
1974
+ await nr(e, n, t);
1922
1975
  },
1923
1976
  dispatchSubmitResult: (t) => {
1924
- O(e, "formie:submit:result", t);
1977
+ h(e, "formie:submit:result", t);
1925
1978
  }
1926
1979
  });
1927
1980
  else {
1928
- if (zt(t), _(t, l), await Z(t), v = await $e(t, g, r, {
1981
+ if (Ut(t), m(t, u), await Yn(t), b = await tt(t, y, r, {
1929
1982
  validator: i,
1930
- validateOnSubmit: X(t),
1983
+ validateOnSubmit: Z(t),
1931
1984
  preflightOnly: !0
1932
- }), v.ok) {
1933
- ee(t, g), c = !0, An(t, "submit"), u(null);
1985
+ }), b.ok) {
1986
+ l(t, y), c = !0, Vn(t, "submit"), g(null);
1934
1987
  let e = !1, n = () => {
1935
- if (e = !0, c = !1, jn(t), m(t), i && X(t)) {
1936
- let { scope: e, final: n } = h(t), r = i.submit(n ? t : e, { final: n });
1937
- r.length > 0 && I(t, {
1988
+ if (e = !0, c = !1, Hn(t), d(t), i && Z(t)) {
1989
+ let { scope: e, final: n } = f(t), r = i.submit(n ? t : e, { final: n });
1990
+ r.length > 0 && L(t, {
1938
1991
  ok: !1,
1939
1992
  stage: "validate",
1940
1993
  code: "VALIDATION_FAILED",
@@ -1953,36 +2006,36 @@ function Gn(e, t, n, r, i, a) {
1953
2006
  }
1954
2007
  } else t.submit();
1955
2008
  if (e) return;
1956
- y = !0;
2009
+ x = !0;
1957
2010
  return;
1958
2011
  }
1959
- I(t, v), O(e, "formie:submit:result", v), jn(t);
2012
+ L(t, b), h(e, "formie:submit:result", b), Hn(t);
1960
2013
  }
1961
2014
  } catch (n) {
1962
- c = !1, v = {
2015
+ c = !1, b = {
1963
2016
  ok: !1,
1964
2017
  code: "SUBMIT_ERROR",
1965
2018
  message: n instanceof Error ? n.message : "Submission failed.",
1966
2019
  formErrors: [n instanceof Error ? n.message : "Submission failed."]
1967
- }, I(t, v), O(e, "formie:submit:result", v), jn(t);
2020
+ }, L(t, b), h(e, "formie:submit:result", b), Hn(t);
1968
2021
  } finally {
1969
- u(null), !s && !y && !Rt(v) && m(t);
2022
+ g(null), !s && !x && !Ht(b) && d(t);
1970
2023
  }
1971
2024
  };
1972
- t.addEventListener("submit", d), a.push(() => {
1973
- t.removeEventListener("submit", d);
2025
+ t.addEventListener("submit", _), a.push(() => {
2026
+ t.removeEventListener("submit", _);
1974
2027
  });
1975
2028
  }
1976
- async function Kn(e, t, n) {
2029
+ async function ir(e, t, n) {
1977
2030
  if (t.refreshTokens === !1 || !t.staticCache) return;
1978
- Tn(q(t.transport), K(t.mode));
1979
- let r = t.formHandle || e.dataset.formieHandle, i = Sn(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
2031
+ In(J(t.transport), q(t.mode));
2032
+ let r = t.formHandle || e.dataset.formieHandle, i = Nn(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
1980
2033
  if (!r) return;
1981
- let o = await Re(i, r, a);
1982
- !o || !n || (Hn(n, o), O(e, "formie:refresh-tokens:after", o));
2034
+ let o = await M(i, r, a);
2035
+ !o || !n || (er(n, o), h(e, "formie:refresh-tokens:after", o));
1983
2036
  }
1984
- function qn() {
1985
- let e = /* @__PURE__ */ new Map(), t = new Vt(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = [
2037
+ function ar() {
2038
+ let e = /* @__PURE__ */ new Map(), t = new R(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = [
1986
2039
  "prepare",
1987
2040
  "normalize",
1988
2041
  "validate",
@@ -1997,19 +2050,19 @@ function qn() {
1997
2050
  return;
1998
2051
  }
1999
2052
  let a = (async () => {
2000
- U.log("Unmount requested.", { target: Q(t) });
2053
+ W.log("Unmount requested.", { target: Q(t) });
2001
2054
  let r = n.get(t);
2002
2055
  r && (r(), n.delete(t));
2003
2056
  let i = e.get(t);
2004
2057
  if (!i) {
2005
- U.log("Unmount skipped (no mounted state).", { target: Q(t) });
2058
+ W.log("Unmount skipped (no mounted state).", { target: Q(t) });
2006
2059
  return;
2007
2060
  }
2008
- O(t, "formie:unmount:before", { id: i.instance.id }), i.unbinds.forEach((e) => {
2061
+ h(t, "formie:unmount:before", { id: i.instance.id }), i.unbinds.forEach((e) => {
2009
2062
  e();
2010
2063
  }), i.unbinds = [], i.validator?.destroy(), i.validator = null;
2011
2064
  for (let e of i.modules) await e.destroy();
2012
- i.modules = [], i.bus.clear(), e.delete(t), O(t, "formie:unmount:after", { id: i.instance.id }), U.log("Unmount complete.", {
2065
+ i.modules = [], i.bus.clear(), e.delete(t), h(t, "formie:unmount:after", { id: i.instance.id }), W.log("Unmount complete.", {
2013
2066
  id: i.instance.id,
2014
2067
  target: Q(t)
2015
2068
  });
@@ -2018,7 +2071,7 @@ function qn() {
2018
2071
  });
2019
2072
  r.set(t, a), await a;
2020
2073
  }, o = async (r, o) => {
2021
- U.log("Mount requested.", {
2074
+ W.log("Mount requested.", {
2022
2075
  target: Q(r),
2023
2076
  mode: o.mode,
2024
2077
  autoVisible: o.autoVisible
@@ -2026,115 +2079,116 @@ function qn() {
2026
2079
  let s = n.get(r);
2027
2080
  s && (s(), n.delete(r));
2028
2081
  let c = e.get(r);
2029
- if (c) return U.log("Mount skipped (already mounted).", {
2082
+ if (c) return W.log("Mount skipped (already mounted).", {
2030
2083
  id: c.instance.id,
2031
2084
  target: Q(r)
2032
2085
  }), c.instance;
2033
- let l = new Me(), u = [], d = r?.id || `formie-${e.size + 1}`, f = G(r), p = {
2034
- ...f,
2086
+ let l = new Fe(), d = [], f = r?.id || `formie-${e.size + 1}`, p = K(r), m = {
2087
+ ...p,
2035
2088
  ...o,
2036
- mode: K(o.mode ?? f.mode),
2037
- transport: q(o.transport ?? f.transport)
2038
- }, ee = _e(p.compatibility);
2039
- if (p.mode !== "server-rendered" && !J(r)) throw Error(`Formie ${p.mode} mode is not implemented yet in the browser client.`);
2040
- let m = await Un(r, p), h = J(r);
2041
- p.staticCache = o.staticCache ?? _n(h ? h.dataset : r.dataset);
2042
- let g = zn(r, h), _ = m || g ? {
2043
- ...m || {},
2044
- ...g || {}
2045
- } : null, v = _?.theme, b = {}, S = (_?.modules || []).filter((e) => !!e?.id && !!e?.type);
2046
- U.log("Resolved mount payload.", {
2089
+ mode: q(o.mode ?? p.mode),
2090
+ transport: J(o.transport ?? p.transport)
2091
+ }, g = _e(m.compatibility);
2092
+ if (m.mode !== "server-rendered" && !Y(r)) throw Error(`Formie ${m.mode} mode is not implemented yet in the browser client.`);
2093
+ let v = await tr(r, m), b = Y(r);
2094
+ m.staticCache = o.staticCache ?? On(b ? b.dataset : r.dataset);
2095
+ let x = Zn(r, b), S = v || x ? {
2096
+ ...v || {},
2097
+ ...x || {}
2098
+ } : null, ee = S?.theme, C = {}, w = (S?.modules || []).filter((e) => !!e?.id && !!e?.type);
2099
+ W.log("Resolved mount payload.", {
2047
2100
  target: Q(r),
2048
- hasRenderPayload: !!m,
2049
- hasEmbeddedPayload: !!g,
2050
- moduleCount: S.length
2101
+ hasRenderPayload: !!v,
2102
+ hasEmbeddedPayload: !!x,
2103
+ moduleCount: w.length
2051
2104
  });
2052
- let C = te(r, v, h), w = h ? new dt(h, {
2053
- live: En(h.dataset.formieValidationOnFocus),
2054
- errorMessage: h.dataset.formieErrorMessage || "",
2055
- fieldContainerErrorClass: C.fieldLayoutError || [],
2056
- inputErrorClass: C.fieldControlError || [],
2057
- messagesClass: C.fieldErrors || [],
2058
- messageClass: C.fieldError || []
2105
+ let T = te(r, ee, b), E = b ? new pt(b, {
2106
+ live: Ln(b.dataset.formieValidationOnFocus),
2107
+ errorAriaLive: we(b),
2108
+ errorMessage: b.dataset.formieErrorMessage || "",
2109
+ fieldContainerErrorClass: T.fieldLayoutError || [],
2110
+ inputErrorClass: T.fieldControlError || [],
2111
+ messagesClass: T.fieldErrors || [],
2112
+ messageClass: T.fieldError || []
2059
2113
  }) : null;
2060
- if (h && w) {
2061
- let e = h;
2062
- e.formieValidation = w, b.validation = w;
2114
+ if (b && E) {
2115
+ let e = b;
2116
+ e.formieValidation = E, C.validation = E;
2063
2117
  let t = {
2064
- validator: w,
2065
- addValidator: w.addValidator.bind(w),
2066
- removeValidator: w.removeValidator.bind(w)
2118
+ validator: E,
2119
+ addValidator: E.addValidator.bind(E),
2120
+ removeValidator: E.removeValidator.bind(E)
2067
2121
  };
2068
- O(h, "formie:validator:ready", t), O(r, "formie:validator:ready", t);
2122
+ h(b, "formie:validator:ready", t), h(r, "formie:validator:ready", t);
2069
2123
  }
2070
- h && ((m || p.endpoint || r.dataset.formieEndpoint) && wn(r, h, p), p.mode === "server-rendered" && Ae(h) && (ke(h), je(h)), x(h)), Object.keys(C).length && O(r, "formie:theme:applied", { hasClasses: !0 });
2071
- let T = await en(S, {
2124
+ b && (sn(b), m.themeConfig && typeof m.themeConfig == "object" && b.setAttribute("data-formie-theme-config", JSON.stringify(m.themeConfig)), m.theme && m.theme !== "formie" && b.setAttribute("data-formie-frontend-theme", m.theme), (v || m.endpoint || r.dataset.formieEndpoint) && Fn(r, b, m), m.mode === "server-rendered" && Ne(b) && (Me(b), Pe(b)), y(b)), Object.keys(T).length && h(r, "formie:theme:applied", { hasClasses: !0 });
2125
+ let D = await an(w, {
2072
2126
  registry: t,
2073
2127
  matchContext: {
2074
2128
  root: r,
2075
- form: h,
2076
- mode: p.mode
2129
+ form: b,
2130
+ mode: m.mode
2077
2131
  },
2078
2132
  setupContext: {
2079
- formId: d,
2133
+ formId: f,
2080
2134
  root: r,
2081
- form: h,
2135
+ form: b,
2082
2136
  target: r,
2083
2137
  scope: "form",
2084
- state: b,
2138
+ state: C,
2085
2139
  on: (e, t) => l.on(e, t),
2086
- emit: (e, t) => (O(r, e, t), l.emitSafe(e, t).then((t) => {
2087
- t.failed.length > 0 && U.warn("Lifecycle listeners failed.", {
2140
+ emit: (e, t) => (h(r, e, t), l.emitSafe(e, t).then((t) => {
2141
+ t.failed.length > 0 && W.warn("Lifecycle listeners failed.", {
2088
2142
  eventName: e,
2089
2143
  failed: t.failed.length
2090
2144
  });
2091
2145
  }))
2092
2146
  }
2093
2147
  });
2094
- U.log("Module setup complete.", {
2148
+ W.log("Module setup complete.", {
2095
2149
  target: Q(r),
2096
- moduleInstances: T.length
2150
+ moduleInstances: D.length
2097
2151
  });
2098
- let E = {
2099
- id: d,
2152
+ let O = {
2153
+ id: f,
2100
2154
  root: r,
2101
2155
  submit: async (e = "submit") => {
2102
- if (U.log("Submit requested.", {
2103
- id: d,
2156
+ if (W.log("Submit requested.", {
2157
+ id: f,
2104
2158
  target: Q(r),
2105
2159
  action: e
2106
- }), !h) return {
2160
+ }), !b) return {
2107
2161
  ok: !1,
2108
2162
  code: "FORM_NOT_FOUND",
2109
2163
  message: "No form element found for mount target.",
2110
2164
  formErrors: ["No form element found for mount target."]
2111
2165
  };
2112
- let t = h.querySelector("input[name=\"submitAction\"]");
2113
- if (t && (t.value = e), h.getAttribute("data-formie-loading") === "true") return {
2166
+ let t = b.querySelector("input[name=\"submitAction\"]");
2167
+ if (t && (t.value = e), b.getAttribute("data-formie-loading") === "true") return {
2114
2168
  ok: !1,
2115
2169
  code: "SUBMIT_IN_PROGRESS",
2116
2170
  message: "Submission already in progress.",
2117
2171
  formErrors: []
2118
2172
  };
2119
- let n = h.querySelector(`[data-formie-action="${e}"]`), i = await Bt({
2120
- id: d,
2173
+ let n = b.querySelector(`[data-formie-action="${e}"]`), i = await Wt({
2174
+ id: f,
2121
2175
  target: r,
2122
- form: h,
2176
+ form: b,
2123
2177
  bus: l,
2124
- validator: w,
2125
- validateOnSubmit: X(h),
2178
+ validator: E,
2179
+ validateOnSubmit: Z(b),
2126
2180
  action: e,
2127
2181
  submitter: n,
2128
- waitForSubmitDelay: Z,
2182
+ waitForSubmitDelay: Yn,
2129
2183
  onRefreshTokensAfterSubmit: async () => {
2130
- await Wn(r, p, h);
2184
+ await nr(r, m, b);
2131
2185
  },
2132
2186
  dispatchSubmitResult: (e) => {
2133
- O(r, "formie:submit:result", e);
2187
+ h(r, "formie:submit:result", e);
2134
2188
  }
2135
2189
  });
2136
- return U.log("Submit completed.", {
2137
- id: d,
2190
+ return W.log("Submit completed.", {
2191
+ id: f,
2138
2192
  action: e,
2139
2193
  ok: i.ok,
2140
2194
  code: i.code,
@@ -2146,73 +2200,73 @@ function qn() {
2146
2200
  },
2147
2201
  on: (e, t) => l.on(e, t)
2148
2202
  };
2149
- h && (we({
2203
+ b && (Ce({
2150
2204
  target: r,
2151
- form: h,
2152
- validatorDetail: w ? {
2153
- validator: w,
2154
- addValidator: w.addValidator.bind(w),
2155
- removeValidator: w.removeValidator.bind(w)
2205
+ form: b,
2206
+ validatorDetail: E ? {
2207
+ validator: E,
2208
+ addValidator: E.addValidator.bind(E),
2209
+ removeValidator: E.removeValidator.bind(E)
2156
2210
  } : null,
2157
- options: ee,
2158
- unbinds: u
2211
+ options: g,
2212
+ unbinds: d
2159
2213
  }), Se({
2160
2214
  target: r,
2161
- form: h,
2162
- instance: E,
2163
- options: ee,
2164
- unbinds: u
2165
- })), h && (Gn(r, h, p, l, w, u), w && u.push(y(h, w, r)), await Kn(r, p, h)), i.forEach((e) => {
2215
+ form: b,
2216
+ instance: O,
2217
+ options: g,
2218
+ unbinds: d
2219
+ })), b && (rr(r, b, m, l, E, d), E && (d.push(_(b, E, r)), d.push(vn(b))), await ir(r, m, b)), i.forEach((e) => {
2166
2220
  let t = l.on(`formie:stage:${e}:before`, async (t) => {
2167
- O(r, `formie:stage:${e}:before`, t);
2221
+ h(r, `formie:stage:${e}:before`, t);
2168
2222
  }), n = l.on(`formie:stage:${e}:before`, async (e) => {
2169
- for (let t of T) t.onBeforeStage && await t.onBeforeStage(e);
2223
+ for (let t of D) t.onBeforeStage && await t.onBeforeStage(e);
2170
2224
  }), i = l.on(`formie:stage:${e}:after`, async (t) => {
2171
- O(r, `formie:stage:${e}:after`, t);
2225
+ h(r, `formie:stage:${e}:after`, t);
2172
2226
  }), a = l.on(`formie:stage:${e}:after`, async (e) => {
2173
2227
  let t = e;
2174
- for (let e of T) e.onAfterStage && await e.onAfterStage(t, t.result);
2228
+ for (let e of D) e.onAfterStage && await e.onAfterStage(t, t.result);
2175
2229
  });
2176
- u.push(t, n, i, a);
2230
+ d.push(t, n, i, a);
2177
2231
  });
2178
2232
  let ne = l.on("formie:submit:before", async (e) => {
2179
- O(r, "formie:submit:before", e);
2233
+ h(r, "formie:submit:before", e);
2180
2234
  }), re = l.on("formie:submit:after", async (e) => {
2181
- O(r, "formie:submit:after", e);
2235
+ h(r, "formie:submit:after", e);
2182
2236
  }), ie = l.on("formie:submit:final:before", async (e) => {
2183
- O(r, "formie:submit:final:before", e);
2237
+ h(r, "formie:submit:final:before", e);
2184
2238
  }), ae = l.on("formie:submit:final:after", async (e) => {
2185
- O(r, "formie:submit:final:after", e);
2239
+ h(r, "formie:submit:final:after", e);
2186
2240
  });
2187
- return u.push(ne, re, ie, ae), e.set(r, {
2188
- options: p,
2241
+ return d.push(ne, re, ie, ae), e.set(r, {
2242
+ options: m,
2189
2243
  bus: l,
2190
- form: h,
2191
- validator: w,
2192
- modules: T,
2193
- unbinds: u,
2194
- instance: E
2195
- }), O(r, "formie:mount:after", {
2196
- id: d,
2197
- mode: p.mode
2198
- }), U.log("Mount complete.", {
2199
- id: d,
2244
+ form: b,
2245
+ validator: E,
2246
+ modules: D,
2247
+ unbinds: d,
2248
+ instance: O
2249
+ }), h(r, "formie:mount:after", {
2250
+ id: f,
2251
+ mode: m.mode
2252
+ }), b instanceof HTMLFormElement && u(b), W.log("Mount complete.", {
2253
+ id: f,
2200
2254
  target: Q(r),
2201
- mode: p.mode
2202
- }), E;
2255
+ mode: m.mode
2256
+ }), O;
2203
2257
  }, s = (t, r) => {
2204
- if (!r.autoVisible || Bn(t) || typeof IntersectionObserver > "u") return o(t, r);
2258
+ if (!r.autoVisible || Qn(t) || typeof IntersectionObserver > "u") return o(t, r);
2205
2259
  if (e.has(t)) return Promise.resolve(e.get(t)?.instance || null);
2206
- if (n.has(t)) return U.log("Mount deferred (already waiting visibility).", { target: Q(t) }), Promise.resolve(null);
2260
+ if (n.has(t)) return W.log("Mount deferred (already waiting visibility).", { target: Q(t) }), Promise.resolve(null);
2207
2261
  let i = new IntersectionObserver((e) => {
2208
- e.some((e) => e.target === t && e.isIntersecting) && (i.disconnect(), n.delete(t), U.log("Visibility reached, proceeding mount.", { target: Q(t) }), o(t, {
2262
+ e.some((e) => e.target === t && e.isIntersecting) && (i.disconnect(), n.delete(t), W.log("Visibility reached, proceeding mount.", { target: Q(t) }), o(t, {
2209
2263
  ...r,
2210
2264
  autoVisible: !1
2211
2265
  }));
2212
2266
  }, { threshold: .01 });
2213
2267
  return i.observe(t), n.set(t, () => {
2214
2268
  i.disconnect();
2215
- }), U.log("Mount deferred until visible.", { target: Q(t) }), Promise.resolve(null);
2269
+ }), W.log("Mount deferred until visible.", { target: Q(t) }), Promise.resolve(null);
2216
2270
  };
2217
2271
  return {
2218
2272
  mount: o,
@@ -2220,7 +2274,7 @@ function qn() {
2220
2274
  update: async (t, n) => {
2221
2275
  let r = e.get(t);
2222
2276
  if (!r) return o(t, {
2223
- ...G(t),
2277
+ ...K(t),
2224
2278
  ...n,
2225
2279
  mode: n.mode || "server-rendered"
2226
2280
  });
@@ -2228,32 +2282,32 @@ function qn() {
2228
2282
  ...r.options,
2229
2283
  ...n
2230
2284
  };
2231
- let i = te(t, n.payload?.theme || r.options.payload?.theme || zn(t, r.form)?.theme, r.form);
2232
- return r.validator && (r.validator.config.fieldContainerErrorClass = i.fieldLayoutError || [], r.validator.config.inputErrorClass = i.fieldControlError || [], r.validator.config.messagesClass = i.fieldErrors || [], r.validator.config.messageClass = i.fieldError || []), Object.keys(i).length && O(t, "formie:theme:applied", {
2285
+ let i = te(t, n.payload?.theme || r.options.payload?.theme || Zn(t, r.form)?.theme, r.form);
2286
+ return r.validator && (r.validator.config.fieldContainerErrorClass = i.fieldLayoutError || [], r.validator.config.inputErrorClass = i.fieldControlError || [], r.validator.config.messagesClass = i.fieldErrors || [], r.validator.config.messageClass = i.fieldError || []), Object.keys(i).length && h(t, "formie:theme:applied", {
2233
2287
  hasClasses: !0,
2234
2288
  reason: "update"
2235
2289
  }), r.instance;
2236
2290
  },
2237
2291
  getInstance: (t) => e.get(t)?.instance || null,
2238
2292
  refreshForCache: async (t) => {
2239
- vn("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
2293
+ kn("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
2240
2294
  let n = null;
2241
2295
  if (n = typeof t == "string" ? document.getElementById(t) || document.querySelector(`[data-formie-form-id="${t}"]`) : t, !n) {
2242
- U.warn("refreshForCache target not found.", { targetOrId: t });
2296
+ W.warn("refreshForCache target not found.", { targetOrId: t });
2243
2297
  return;
2244
2298
  }
2245
- let r = e.get(n), i = J(n), a = r?.options || G(n);
2299
+ let r = e.get(n), i = Y(n), a = r?.options || K(n);
2246
2300
  if (!i) {
2247
- U.warn("refreshForCache found no form element for target.", { target: Q(n) });
2301
+ W.warn("refreshForCache found no form element for target.", { target: Q(n) });
2248
2302
  return;
2249
2303
  }
2250
- let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = Sn(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
2304
+ let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = Nn(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
2251
2305
  if (!o) {
2252
- U.warn("refreshForCache found no form handle for target.", { target: Q(n) });
2306
+ W.warn("refreshForCache found no form handle for target.", { target: Q(n) });
2253
2307
  return;
2254
2308
  }
2255
- let l = await Re(s, o, c);
2256
- l && (Hn(i, l), O(n, "formie:refresh-tokens:after", l));
2309
+ let l = await M(s, o, c);
2310
+ l && (er(i, l), h(n, "formie:refresh-tokens:after", l));
2257
2311
  },
2258
2312
  registerModule: (e, n) => t.register(e, n),
2259
2313
  unregisterModule: (e) => {
@@ -2261,13 +2315,13 @@ function qn() {
2261
2315
  },
2262
2316
  getRegisteredModules: () => t.getAll(),
2263
2317
  scan: async (e) => {
2264
- let t = e || document, n = Array.from(t.querySelectorAll(H));
2265
- U.log("Scan started.", {
2318
+ let t = e || document, n = Array.from(t.querySelectorAll(U));
2319
+ W.log("Scan started.", {
2266
2320
  scope: t === document ? "document" : t,
2267
2321
  targetCount: n.length
2268
2322
  });
2269
- let r = (await Promise.all(n.map((e) => s(e, G(e))))).filter((e) => !!e);
2270
- return U.log("Scan finished.", {
2323
+ let r = (await Promise.all(n.map((e) => s(e, K(e))))).filter((e) => !!e);
2324
+ return W.log("Scan finished.", {
2271
2325
  mountedCount: r.length,
2272
2326
  deferredCount: n.length - r.length
2273
2327
  }), r;
@@ -2275,16 +2329,16 @@ function qn() {
2275
2329
  observe: (t) => {
2276
2330
  if (typeof MutationObserver > "u") return () => {};
2277
2331
  let r = t || document;
2278
- U.log("Observer started.", { scope: r === document ? "document" : r });
2332
+ W.log("Observer started.", { scope: r === document ? "document" : r });
2279
2333
  let i = new MutationObserver((t) => {
2280
2334
  t.forEach((t) => {
2281
2335
  t.addedNodes.forEach((e) => {
2282
- e instanceof Element && (e.matches(H) && (U.log("Observer detected new root.", { target: Q(e) }), s(e, G(e))), e.querySelectorAll(H).forEach((e) => {
2283
- U.log("Observer detected new nested root.", { target: Q(e) }), s(e, G(e));
2336
+ e instanceof Element && (e.matches(U) && (W.log("Observer detected new root.", { target: Q(e) }), s(e, K(e))), e.querySelectorAll(U).forEach((e) => {
2337
+ W.log("Observer detected new nested root.", { target: Q(e) }), s(e, K(e));
2284
2338
  }));
2285
2339
  }), t.removedNodes.forEach((t) => {
2286
- t instanceof Element && (e.has(t) && (U.log("Observer detected removed root.", { target: Q(t) }), a(t)), t.querySelectorAll(H).forEach((t) => {
2287
- e.has(t) && (U.log("Observer detected removed nested root.", { target: Q(t) }), a(t));
2340
+ t instanceof Element && (e.has(t) && (W.log("Observer detected removed root.", { target: Q(t) }), a(t)), t.querySelectorAll(U).forEach((t) => {
2341
+ e.has(t) && (W.log("Observer detected removed nested root.", { target: Q(t) }), a(t));
2288
2342
  }));
2289
2343
  });
2290
2344
  });
@@ -2293,11 +2347,11 @@ function qn() {
2293
2347
  childList: !0,
2294
2348
  subtree: !0
2295
2349
  }), () => {
2296
- i.disconnect(), U.log("Observer stopped."), n.forEach((e, t) => {
2297
- Vn(t, r) && (e(), n.delete(t));
2350
+ i.disconnect(), W.log("Observer stopped."), n.forEach((e, t) => {
2351
+ $n(t, r) && (e(), n.delete(t));
2298
2352
  });
2299
2353
  let t = [];
2300
- r instanceof Element && r.matches(H) && t.push(r), r.querySelectorAll(H).forEach((e) => {
2354
+ r instanceof Element && r.matches(U) && t.push(r), r.querySelectorAll(U).forEach((e) => {
2301
2355
  t.push(e);
2302
2356
  }), t.forEach((t) => {
2303
2357
  e.has(t) && a(t);
@@ -2308,9 +2362,9 @@ function qn() {
2308
2362
  }
2309
2363
  //#endregion
2310
2364
  //#region src/js/core/hydrate-modules.ts
2311
- var Jn = d("general", "module-hydrator");
2312
- async function Yn(e) {
2313
- let t = e.root, n = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), r = e.modules ?? [], i = e.mode ?? "server-rendered", a = e.registry ?? new Vt(), o = new Me(), s = await en(r, {
2365
+ var or = C("general", "module-hydrator");
2366
+ async function sr(e) {
2367
+ let t = e.root, n = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), r = e.modules ?? [], i = e.mode ?? "server-rendered", a = e.registry ?? new R(), o = new Fe(), s = await an(r, {
2314
2368
  registry: a,
2315
2369
  setupContext: {
2316
2370
  formId: n?.id || t.id || "formie-modules",
@@ -2331,13 +2385,13 @@ async function Yn(e) {
2331
2385
  mode: i
2332
2386
  }
2333
2387
  });
2334
- return Jn.log("Hydrated module manifest.", {
2388
+ return or.log("Hydrated module manifest.", {
2335
2389
  moduleCount: r.length,
2336
2390
  instanceCount: s.length,
2337
2391
  mode: i
2338
2392
  }), {
2339
2393
  destroy: async () => {
2340
- await Xn(s), o.clear();
2394
+ await cr(s), o.clear();
2341
2395
  },
2342
2396
  on: (e, t) => o.on(e, t),
2343
2397
  emit: async (e, t) => {
@@ -2350,11 +2404,11 @@ async function Yn(e) {
2350
2404
  getRegisteredModules: () => a.getAll()
2351
2405
  };
2352
2406
  }
2353
- async function Xn(e) {
2407
+ async function cr(e) {
2354
2408
  for (let t of e) try {
2355
2409
  await t.destroy();
2356
2410
  } catch (e) {
2357
- console.error("[formie] Failed to destroy module instance.", e), Jn.warn("Failed destroying module instance.", { error: e });
2411
+ console.error("[formie] Failed to destroy module instance.", e), or.warn("Failed destroying module instance.", { error: e });
2358
2412
  }
2359
2413
  }
2360
2414
  //#endregion
@@ -2362,41 +2416,41 @@ async function Xn(e) {
2362
2416
  function $(e) {
2363
2417
  return e instanceof Element;
2364
2418
  }
2365
- function Zn(e) {
2419
+ function lr(e) {
2366
2420
  return e.ok;
2367
2421
  }
2368
- function Qn(e) {
2422
+ function ur(e) {
2369
2423
  return typeof e == "string" ? `selector "${e}"` : $(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
2370
2424
  }
2371
- function $n(e) {
2425
+ function dr(e) {
2372
2426
  let t = /* @__PURE__ */ new Set(), n = [];
2373
2427
  for (let r of e) !$(r) || t.has(r) || (t.add(r), n.push(r));
2374
2428
  return n;
2375
2429
  }
2376
- function er(e) {
2377
- return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : $(e) ? [e] : $n(e);
2430
+ function fr(e) {
2431
+ return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : $(e) ? [e] : dr(e);
2378
2432
  }
2379
- function tr() {
2433
+ function pr() {
2380
2434
  return document.readyState === "loading" ? new Promise((e) => {
2381
2435
  document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
2382
2436
  }) : Promise.resolve();
2383
2437
  }
2384
- async function nr(e) {
2385
- let t = er(e);
2386
- return t.length > 0 || typeof e != "string" ? t : (await tr(), er(e));
2438
+ async function mr(e) {
2439
+ let t = fr(e);
2440
+ return t.length > 0 || typeof e != "string" ? t : (await pr(), fr(e));
2387
2441
  }
2388
- function rr(e) {
2442
+ function hr(e) {
2389
2443
  return typeof e == "string" ? document : $(e) ? e.getRootNode() : document;
2390
2444
  }
2391
- function ir(e) {
2445
+ function gr(e) {
2392
2446
  let { element: t, observe: n, allowEmpty: r, client: i, onReady: a, onResult: o, onSuccess: s, onError: c, onEvent: l, ...u } = e;
2393
2447
  return {
2394
2448
  mode: "server-rendered",
2395
2449
  ...u
2396
2450
  };
2397
2451
  }
2398
- async function ar(e, t, n, r) {
2399
- let i = [], o = ir(e);
2452
+ async function _r(e, t, n, r) {
2453
+ let i = [], o = gr(e);
2400
2454
  for (let s of r) {
2401
2455
  let r = n.get(s);
2402
2456
  if (r) {
@@ -2406,7 +2460,7 @@ async function ar(e, t, n, r) {
2406
2460
  let c = await t.mount(s, o), l = [];
2407
2461
  if (e.onReady?.(c), l.push(c.on("formie:submit:result", (t) => {
2408
2462
  let n = t;
2409
- e.onResult?.(n, c), Zn(n) ? e.onSuccess?.(n, c) : e.onError?.(n, c);
2463
+ e.onResult?.(n, c), lr(n) ? e.onSuccess?.(n, c) : e.onError?.(n, c);
2410
2464
  })), e.onEvent) for (let t of a) l.push(c.on(t, (n) => {
2411
2465
  e.onEvent?.({
2412
2466
  name: t,
@@ -2420,11 +2474,11 @@ async function ar(e, t, n, r) {
2420
2474
  }
2421
2475
  return i;
2422
2476
  }
2423
- async function or(e) {
2424
- let t = e.client ?? qn(), n = /* @__PURE__ */ new Map(), r = await nr(e.element);
2425
- if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${Qn(e.element)}.`);
2426
- await ar(e, t, n, r);
2427
- let i = e.observe ? t.observe(rr(e.element)) : null;
2477
+ async function vr(e) {
2478
+ let t = e.client ?? ar(), n = /* @__PURE__ */ new Map(), r = await mr(e.element);
2479
+ if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${ur(e.element)}.`);
2480
+ await _r(e, t, n, r);
2481
+ let i = e.observe ? t.observe(hr(e.element)) : null;
2428
2482
  return {
2429
2483
  client: t,
2430
2484
  get instances() {
@@ -2435,8 +2489,8 @@ async function or(e) {
2435
2489
  return r ? n.get(r)?.instance ?? t.getInstance(r) : null;
2436
2490
  },
2437
2491
  async rescan() {
2438
- let r = er(e.element);
2439
- return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : ar(e, t, n, r);
2492
+ let r = fr(e.element);
2493
+ return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : _r(e, t, n, r);
2440
2494
  },
2441
2495
  async destroy() {
2442
2496
  i?.();
@@ -2446,4 +2500,4 @@ async function or(e) {
2446
2500
  };
2447
2501
  }
2448
2502
  //#endregion
2449
- export { a as FORMIE_HTML_EVENT_NAMES, dt as FormieValidator, he as LEGACY_FORMIE_DOM_EVENT_BRIDGES, ge as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, Vt as ModuleRegistry, Se as bindLegacyDomEventCompatibility, we as bindLegacyValidatorCompatibility, fe as buildFieldValueRegistry, d as createDebug, qn as createFormieClient, l as debugLog, u as debugWarn, me as defineAddressModule, oe as defineCaptchaModule, ae as definePassiveCaptchaModule, b as definePaymentModule, le as fieldKeyToInputName, or as formie, i as getFieldModuleEventName, ie as getFormieTranslations, r as getGlobalModuleLifecycleEventName, e as getScopedModuleLifecycleEventName, Yn as hydrateFormieModules, se as inputNameToFieldKey, c as isFormieDebugEnabled, ne as mergeFormieTranslations, ce as normalizeFieldKey, o as normalizeFormieEventName, ue as parseFieldReference, pe as resolveFieldReferenceFromFormData, de as resolveFieldReferenceLive, _e as resolveLegacyCompatibilityOptions, s as setFormieDebugEnabled, re as setFormieTranslations, E as t, t as toDomEventName, T as translate };
2503
+ export { a as FORMIE_HTML_EVENT_NAMES, pt as FormieValidator, he as LEGACY_FORMIE_DOM_EVENT_BRIDGES, ge as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, R as ModuleRegistry, Se as bindLegacyDomEventCompatibility, Ce as bindLegacyValidatorCompatibility, fe as buildFieldValueRegistry, C as createDebug, ar as createFormieClient, S as debugLog, ee as debugWarn, me as defineAddressModule, oe as defineCaptchaModule, ae as definePassiveCaptchaModule, v as definePaymentModule, le as fieldKeyToInputName, vr as formie, i as getFieldModuleEventName, ie as getFormieTranslations, r as getGlobalModuleLifecycleEventName, e as getScopedModuleLifecycleEventName, sr as hydrateFormieModules, se as inputNameToFieldKey, x as isFormieDebugEnabled, ne as mergeFormieTranslations, ce as normalizeFieldKey, o as normalizeFormieEventName, ue as parseFieldReference, pe as resolveFieldReferenceFromFormData, de as resolveFieldReferenceLive, _e as resolveLegacyCompatibilityOptions, b as setFormieDebugEnabled, re as setFormieTranslations, O as t, t as toDomEventName, D as translate };