@verbb/formie-browser 1.0.6 → 1.0.7

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