@verbb/formie-browser 1.0.4 → 1.0.6

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 (197) hide show
  1. package/CHANGELOG.md +76 -22
  2. package/dist/chunks/address-country-Rx6GQTND.js +68 -0
  3. package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
  4. package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
  5. package/dist/chunks/api-CmwLRq_n.js +780 -0
  6. package/dist/chunks/api-DMK8NSUI.js +407 -0
  7. package/dist/chunks/api-sPqGbOww.js +125 -0
  8. package/dist/chunks/async-nPFRNQ06.js +25 -0
  9. package/dist/chunks/bpoint-DSjqRv63.js +24 -0
  10. package/dist/chunks/calculations-CeDgB9jt.js +299 -0
  11. package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
  12. package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
  13. package/dist/chunks/chunk-3b4jIN3o.js +13 -0
  14. package/dist/chunks/combobox-D-2b42wn.js +1954 -0
  15. package/dist/chunks/conditions-DjZOtHfS.js +412 -0
  16. package/dist/chunks/constants-DVcJAvc5.js +38 -0
  17. package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
  18. package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
  19. package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
  20. package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
  21. package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
  22. package/dist/chunks/debug-BV0DvdHx.js +41 -0
  23. package/dist/chunks/dist-BQ4a9hmy.js +2659 -0
  24. package/dist/chunks/event-names-BCI2FLD8.js +51 -0
  25. package/dist/chunks/eway-D3ctTbEk.js +70 -0
  26. package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
  27. package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
  28. package/dist/chunks/file-upload-D49m8-DR.js +287 -0
  29. package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
  30. package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
  31. package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
  32. package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
  33. package/dist/chunks/google-address-OhKilPWE.js +161 -0
  34. package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
  35. package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
  36. package/dist/chunks/http-D-JExro7.js +27 -0
  37. package/dist/chunks/i18n-BY1ds1BL.js +121 -0
  38. package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
  39. package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
  40. package/dist/chunks/mollie-COG-ko2D.js +23 -0
  41. package/dist/chunks/moneris-CMH8PlRc.js +117 -0
  42. package/dist/chunks/opayo-D2jsR5vh.js +113 -0
  43. package/dist/chunks/paddle-DxF88RfC.js +55 -0
  44. package/dist/chunks/paypal-b5pnwrA2.js +95 -0
  45. package/dist/chunks/payway-BJYu9DIR.js +55 -0
  46. package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
  47. package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
  48. package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
  49. package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
  50. package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
  51. package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
  52. package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
  53. package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
  54. package/dist/chunks/repeater-B5leVxZU.js +102 -0
  55. package/dist/chunks/rich-text-D0sb8bmX.js +349 -0
  56. package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
  57. package/dist/chunks/sdk-BhHAYgga.js +1397 -0
  58. package/dist/chunks/shared-Bx9s0i0P.js +100 -0
  59. package/dist/chunks/signature-xz4QO7CR.js +536 -0
  60. package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
  61. package/dist/chunks/square-BP8RWAKB.js +40 -0
  62. package/dist/chunks/stripe-MihN63uC.js +184 -0
  63. package/dist/chunks/styles-BfoIZwJp.js +19 -0
  64. package/dist/chunks/summary-D3AjxpYN.js +114 -0
  65. package/dist/chunks/table-C-lkQN6I.js +78 -0
  66. package/dist/chunks/text-limit-DbgEFHLO.js +125 -0
  67. package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
  68. package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
  69. package/dist/chunks/upload-manager-BpqWSHmU.js +2558 -0
  70. package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
  71. package/dist/css/formie-theme.css +2 -0
  72. package/dist/css/theme/_buttons.css +16 -0
  73. package/dist/css/theme/_tokens.css +2 -0
  74. package/dist/css/theme/fields/_address-state.css +94 -0
  75. package/dist/css/theme/fields/_combobox.css +246 -0
  76. package/dist/css/theme/fields/_select.css +13 -0
  77. package/dist/css/theme/fields/_signature.css +19 -0
  78. package/dist/css/theme/fields/_upload-manager.css +279 -0
  79. package/dist/index.js +2448 -39
  80. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  81. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  82. package/dist/js/core/validation-focus.d.ts +4 -0
  83. package/dist/js/core/validation-focus.d.ts.map +1 -0
  84. package/dist/js/modules/address/api.d.ts +1 -0
  85. package/dist/js/modules/address/api.d.ts.map +1 -1
  86. package/dist/js/modules/address/constants.d.ts +22 -1
  87. package/dist/js/modules/address/constants.d.ts.map +1 -1
  88. package/dist/js/modules/address/host.d.ts +2 -2
  89. package/dist/js/modules/address/host.d.ts.map +1 -1
  90. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  91. package/dist/js/modules/fields/address-country.d.ts +3 -0
  92. package/dist/js/modules/fields/address-country.d.ts.map +1 -0
  93. package/dist/js/modules/fields/address-state.d.ts +3 -0
  94. package/dist/js/modules/fields/address-state.d.ts.map +1 -0
  95. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  96. package/dist/js/modules/fields/combobox.d.ts +17 -0
  97. package/dist/js/modules/fields/combobox.d.ts.map +1 -0
  98. package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
  99. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
  100. package/dist/js/modules/fields/custom-link.d.ts +3 -0
  101. package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
  102. package/dist/js/modules/fields/custom-maps.d.ts +3 -0
  103. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
  104. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  105. package/dist/js/modules/fields/index.d.ts.map +1 -1
  106. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  107. package/dist/js/modules/fields/signature.d.ts.map +1 -1
  108. package/dist/js/modules/fields/upload-manager.d.ts +3 -0
  109. package/dist/js/modules/fields/upload-manager.d.ts.map +1 -0
  110. package/dist/js/submit/pipeline.d.ts.map +1 -1
  111. package/dist/js/utils/country-from-ip.d.ts +7 -0
  112. package/dist/js/utils/country-from-ip.d.ts.map +1 -0
  113. package/dist/js/utils/field-references.d.ts +1 -0
  114. package/dist/js/utils/field-references.d.ts.map +1 -1
  115. package/dist/js/utils/field-references.row-scope.d.ts +11 -0
  116. package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
  117. package/package.json +8 -3
  118. package/src/css/formie-theme.css +2 -0
  119. package/src/css/theme/_buttons.css +16 -0
  120. package/src/css/theme/_tokens.css +2 -0
  121. package/src/css/theme/fields/_address-state.css +94 -0
  122. package/src/css/theme/fields/_combobox.css +246 -0
  123. package/src/css/theme/fields/_select.css +13 -0
  124. package/src/css/theme/fields/_signature.css +19 -0
  125. package/src/css/theme/fields/_upload-manager.css +279 -0
  126. package/src/js/core/create-formie-client.ts +27 -0
  127. package/src/js/core/submit-result-ui.ts +4 -4
  128. package/src/js/core/validation-focus.ts +117 -0
  129. package/src/js/modules/address/api.ts +7 -0
  130. package/src/js/modules/address/constants.ts +82 -2
  131. package/src/js/modules/address/host.ts +16 -6
  132. package/src/js/modules/address/loqate.ts +3 -17
  133. package/src/js/modules/fields/address-country.ts +156 -0
  134. package/src/js/modules/fields/address-state.ts +946 -0
  135. package/src/js/modules/fields/calculations.ts +32 -0
  136. package/src/js/modules/fields/combobox.ts +188 -0
  137. package/src/js/modules/fields/custom-google-maps.ts +416 -0
  138. package/src/js/modules/fields/custom-link.ts +95 -0
  139. package/src/js/modules/fields/custom-maps.ts +339 -0
  140. package/src/js/modules/fields/date-picker.ts +96 -3
  141. package/src/js/modules/fields/index.ts +7 -0
  142. package/src/js/modules/fields/phone-country.ts +6 -0
  143. package/src/js/modules/fields/signature.ts +199 -15
  144. package/src/js/modules/fields/upload-manager.ts +1277 -0
  145. package/src/js/submit/pipeline.ts +11 -1
  146. package/src/js/utils/country-from-ip.ts +54 -0
  147. package/src/js/utils/field-references.row-scope.ts +303 -0
  148. package/src/js/utils/field-references.ts +1 -0
  149. package/src/vendor.d.ts +1 -1
  150. package/dist/chunks/address-finder-BU4roxT6.js +0 -37
  151. package/dist/chunks/bpoint-uNg5j6rt.js +0 -26
  152. package/dist/chunks/calculations-C9t6Zop9.js +0 -147
  153. package/dist/chunks/captcha-eu-BAPzHNts.js +0 -34
  154. package/dist/chunks/checkbox-radio-CHeLNVIK.js +0 -141
  155. package/dist/chunks/conditions-DKxVCsjD.js +0 -459
  156. package/dist/chunks/date-picker-B3iQ797Z.js +0 -4994
  157. package/dist/chunks/eway-DCielIML.js +0 -74
  158. package/dist/chunks/file-upload-DP2TOUYV.js +0 -316
  159. package/dist/chunks/friendly-captcha-v1-DdlcGiFY.js +0 -33
  160. package/dist/chunks/friendly-captcha-v2-76w-YnFm.js +0 -38
  161. package/dist/chunks/go-cardless-rwCkzbNK.js +0 -24
  162. package/dist/chunks/google-address-BD8IZ86V.js +0 -181
  163. package/dist/chunks/hcaptcha-BNNTL6uf.js +0 -56
  164. package/dist/chunks/hidden-CW6Rcf1N.js +0 -31
  165. package/dist/chunks/index-BEsfee-D.js +0 -1839
  166. package/dist/chunks/index-BP7Unm5Y.js +0 -863
  167. package/dist/chunks/index-D6npYxvr.js +0 -4423
  168. package/dist/chunks/loqate-B-ZNS65B.js +0 -55
  169. package/dist/chunks/mollie-BDAZ-1X4.js +0 -24
  170. package/dist/chunks/moneris-B1b0uEtY.js +0 -101
  171. package/dist/chunks/opayo-CC5hraHo.js +0 -122
  172. package/dist/chunks/paddle-B4GmrDsq.js +0 -60
  173. package/dist/chunks/paypal-BFS6XsIS.js +0 -100
  174. package/dist/chunks/payway-DekoJead.js +0 -56
  175. package/dist/chunks/phone-country-Cm5YUeXI.js +0 -3765
  176. package/dist/chunks/place-kit-DizZWV_e.js +0 -42
  177. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
  178. package/dist/chunks/recaptcha-enterprise-BbOvO7JZ.js +0 -71
  179. package/dist/chunks/recaptcha-shared-Dwg1eVFS.js +0 -15
  180. package/dist/chunks/recaptcha-v2-checkbox-SY3ti5iQ.js +0 -41
  181. package/dist/chunks/recaptcha-v2-invisible-DSmQnn6c.js +0 -59
  182. package/dist/chunks/recaptcha-v3-DNh7YCnR.js +0 -28
  183. package/dist/chunks/repeater-DM0vuFNQ.js +0 -124
  184. package/dist/chunks/rich-text-C8aGYp70.js +0 -304
  185. package/dist/chunks/scripts-CKTFtxPO.js +0 -36
  186. package/dist/chunks/sdk-3SicTWby.js +0 -1559
  187. package/dist/chunks/shared--BU5CFoL.js +0 -80
  188. package/dist/chunks/signature-pFhZfH7d.js +0 -550
  189. package/dist/chunks/snaptcha-VuOUOaLj.js +0 -8
  190. package/dist/chunks/square-BR9pvToy.js +0 -46
  191. package/dist/chunks/stripe-OHUwoV9g.js +0 -202
  192. package/dist/chunks/styles-C3aqgtek.js +0 -21
  193. package/dist/chunks/summary-Da7Ktg3N.js +0 -126
  194. package/dist/chunks/table-C0PmR9bI.js +0 -95
  195. package/dist/chunks/text-limit-mLEwZDIa.js +0 -144
  196. package/dist/chunks/turnstile-9tM7q_LK.js +0 -59
  197. package/dist/chunks/utils-BntI3W4S.js +0 -6149
@@ -0,0 +1,780 @@
1
+ import { a as e, u as t } from "./event-names-BCI2FLD8.js";
2
+ import { t as n } from "./debug-BV0DvdHx.js";
3
+ import { i as r, r as i, t as a } from "./theme-classes-Tv7q7ToE.js";
4
+ import { i as o } from "./i18n-BY1ds1BL.js";
5
+ import { n as s, t as c } from "./async-nPFRNQ06.js";
6
+ import { r as l, t as u } from "./field-references.keys-58ZSTrCW.js";
7
+ import { n as d, r as f } from "./field-references.resolver-CHwn0G0L.js";
8
+ //#region src/js/core/page-client-event.ts
9
+ var p = n("general", "page-client-event"), m = "data-formie-client-event";
10
+ function h(e) {
11
+ return typeof window < "u" && window.CSS?.escape ? window.CSS.escape(e) : e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
12
+ }
13
+ function g(e) {
14
+ return e.querySelector("input[name=\"pageId\"]")?.value?.trim() || e.querySelector("[data-formie-page]:not([data-formie-page-hidden])")?.getAttribute("data-formie-page-id")?.trim() || e.querySelector("[data-formie-page]")?.getAttribute("data-formie-page-id")?.trim() || null;
15
+ }
16
+ function ee(e) {
17
+ if (!e?.trim()) return null;
18
+ try {
19
+ let t = JSON.parse(e);
20
+ return t && typeof t == "object" ? t : null;
21
+ } catch {
22
+ return p.warn("Invalid data-formie-client-event JSON.", { rawPreview: e.slice(0, 80) }), null;
23
+ }
24
+ }
25
+ function te(e) {
26
+ let t = {};
27
+ return e.forEach((e) => {
28
+ let n = typeof e.label == "string" ? e.label.trim() : "";
29
+ n && (t[n] = typeof e.value == "string" ? e.value : "");
30
+ }), t;
31
+ }
32
+ function _(e, t) {
33
+ if (t !== "submit") return;
34
+ let n = g(e);
35
+ if (!n) {
36
+ p.log("No submitted page id; skipping client event.");
37
+ return;
38
+ }
39
+ let r = e.querySelector(`[data-formie-page][data-formie-page-id="${h(n)}"]`);
40
+ if (!r) {
41
+ p.log("No page section for id; skipping client event.", { pageId: n });
42
+ return;
43
+ }
44
+ let i = r.getAttribute(m);
45
+ if (i === null) return;
46
+ let a = ee(i);
47
+ if (!a || !Array.isArray(a.fields)) return;
48
+ let o = te(a.fields), s = window;
49
+ s.dataLayer = s.dataLayer || [], s.dataLayer.push(o), e.dispatchEvent(new CustomEvent("formie:client-event", {
50
+ bubbles: !0,
51
+ detail: { payload: o }
52
+ })), p.log("Dispatched page client event.", {
53
+ pageId: n,
54
+ keys: Object.keys(o)
55
+ });
56
+ }
57
+ //#endregion
58
+ //#region src/js/core/page-tab-errors.ts
59
+ function ne(e, t) {
60
+ if (r(e, e, "tabError", t), t) {
61
+ e.setAttribute("data-formie-tab-error", "true");
62
+ return;
63
+ }
64
+ e.removeAttribute("data-formie-tab-error");
65
+ }
66
+ function v(e) {
67
+ let t = /* @__PURE__ */ new Set();
68
+ e.querySelectorAll("[data-formie-page]").forEach((e) => {
69
+ let n = e, r = n.getAttribute("data-formie-page-id");
70
+ r && n.querySelector("[data-formie-field-has-error]") && t.add(r);
71
+ }), e.querySelectorAll("[data-formie-tab]").forEach((e) => {
72
+ let n = e, r = n.getAttribute("data-formie-page-id");
73
+ ne(n, !!r && t.has(r));
74
+ });
75
+ }
76
+ //#endregion
77
+ //#region src/js/validation/scope.ts
78
+ function y(e) {
79
+ return Array.from(e.querySelectorAll("[data-formie-page]"));
80
+ }
81
+ function b(e) {
82
+ let t = y(e);
83
+ if (!t.length) return {
84
+ scope: e,
85
+ final: !0
86
+ };
87
+ let n = t.find((e) => !e.hasAttribute("data-formie-page-hidden")) || t[t.length - 1];
88
+ return {
89
+ scope: n,
90
+ final: n === t[t.length - 1]
91
+ };
92
+ }
93
+ //#endregion
94
+ //#region src/js/validation/submit-readiness.ts
95
+ var x = "data-formie-submit-validation-disabled", S = "data-formie-preserve-disabled", re = "data-formie-submit-ready";
96
+ function C(e) {
97
+ return e.dataset.formieDisableSubmitUntilValid === "true";
98
+ }
99
+ function ie(e) {
100
+ return Array.from(e.querySelectorAll("button[data-formie-action=\"submit\"]")).filter((e) => e instanceof HTMLButtonElement);
101
+ }
102
+ function ae(e) {
103
+ return !e.hasAttribute("data-formie-conditionally-hidden") && !e.closest("[data-formie-conditionally-hidden]");
104
+ }
105
+ function w(e, t) {
106
+ if (!C(e) || e.getAttribute("data-formie-loading") === "true") return;
107
+ let { scope: n, final: r } = b(e), i = t.isValid(n, { includeHiddenPages: r });
108
+ e.setAttribute(re, i ? "true" : "false"), ie(e).forEach((e) => {
109
+ if (ae(e)) {
110
+ if (i) {
111
+ if (!e.hasAttribute(x)) return;
112
+ e.hasAttribute(S) ? (e.disabled = !0, e.removeAttribute(S)) : e.disabled = !1, e.removeAttribute(x);
113
+ return;
114
+ }
115
+ e.hasAttribute(x) || (e.disabled && e.setAttribute(S, "true"), e.setAttribute(x, "true")), e.disabled = !0;
116
+ }
117
+ });
118
+ }
119
+ function oe(e, t, n) {
120
+ if (!C(e)) return () => {};
121
+ let r = !1, i = () => {
122
+ r || (r = !0, queueMicrotask(() => {
123
+ r = !1, w(e, t);
124
+ }));
125
+ };
126
+ i();
127
+ let a = () => {
128
+ i();
129
+ };
130
+ e.addEventListener("input", a, !0), e.addEventListener("change", a, !0);
131
+ let o = () => {
132
+ window.setTimeout(() => {
133
+ i();
134
+ }, 0);
135
+ };
136
+ e.addEventListener("reset", o);
137
+ let s = () => {
138
+ i();
139
+ };
140
+ n.addEventListener("formie:conditions:evaluated", s);
141
+ let c = new MutationObserver((e) => {
142
+ e.some((e) => {
143
+ if (e.type === "attributes") {
144
+ let t = e.attributeName || "";
145
+ return t === "data-formie-page-hidden" || t === "data-formie-conditionally-hidden" || t === "data-formie-loading" || t === "disabled";
146
+ }
147
+ return e.type === "childList";
148
+ }) && i();
149
+ });
150
+ return c.observe(e, {
151
+ childList: !0,
152
+ subtree: !0,
153
+ attributes: !0,
154
+ attributeFilter: [
155
+ "data-formie-page-hidden",
156
+ "data-formie-conditionally-hidden",
157
+ "data-formie-loading",
158
+ "disabled"
159
+ ]
160
+ }), () => {
161
+ e.removeEventListener("input", a, !0), e.removeEventListener("change", a, !0), e.removeEventListener("reset", o), n.removeEventListener("formie:conditions:evaluated", s), c.disconnect();
162
+ };
163
+ }
164
+ //#endregion
165
+ //#region src/js/core/submit-result-state.ts
166
+ var se = "STALE_SUBMISSION_STATE", T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D = n("general", "submit-result");
167
+ function O(e, t, n) {
168
+ let r = e.querySelector(`input[name="${t}"]`);
169
+ r || (r = document.createElement("input"), r.type = "hidden", r.name = t, e.appendChild(r)), r.value = n;
170
+ }
171
+ function k(e, t) {
172
+ e.setAttribute("data-formie-internal-navigation", t);
173
+ }
174
+ function A(e, t) {
175
+ e.querySelector(`input[name="${t}"]`)?.remove();
176
+ }
177
+ function ce(e, t) {
178
+ try {
179
+ let n = new URL(e, window.location.href);
180
+ return n.searchParams.delete(t), n.toString();
181
+ } catch {
182
+ return e;
183
+ }
184
+ }
185
+ function le(e) {
186
+ try {
187
+ return new URL(e, window.location.href).origin === window.location.origin;
188
+ } catch {
189
+ return !1;
190
+ }
191
+ }
192
+ function j(e) {
193
+ return Array.from(e.querySelectorAll("[data-formie-page]"));
194
+ }
195
+ function ue(e) {
196
+ return Array.from(e.querySelectorAll("[data-formie-tab]"));
197
+ }
198
+ function M(e, t, n) {
199
+ return t < 0 || n < 1 ? 0 : (e.dataset.formieProgressCalculation === "page-position" ? "page-position" : "completion") == "page-position" ? Math.round((t + 1) / n * 100) : Math.round(t / n * 100);
200
+ }
201
+ function de(e) {
202
+ return e <= 0 ? "start" : e >= 100 ? "end" : "middle";
203
+ }
204
+ function fe(e) {
205
+ return (e.dataset.formieSubmitAction || "").trim();
206
+ }
207
+ function N(e, t) {
208
+ let n = t.meta?.effectiveSubmitAction;
209
+ return typeof n == "string" && n.trim() !== "" ? n.trim() : fe(e);
210
+ }
211
+ function P(e) {
212
+ let t = e.dataset.formieSubmitActionFormHide;
213
+ if (t === void 0) return !1;
214
+ let n = t.trim().toLowerCase();
215
+ return n === "true" || n === "1" || n === "";
216
+ }
217
+ function F(e, t) {
218
+ e.toggleAttribute("data-formie-form-hidden", t), [
219
+ "[data-formie-form-header]",
220
+ "[data-formie-form-navigation]",
221
+ "[data-formie-form-body]",
222
+ "[data-formie-form-footer]"
223
+ ].forEach((n) => {
224
+ e.querySelectorAll(n).forEach((e) => {
225
+ let n = e;
226
+ t ? n.hidden = !0 : n.hidden = !1;
227
+ });
228
+ });
229
+ }
230
+ function I(e) {
231
+ let t = T.get(e);
232
+ typeof t == "number" && (window.clearTimeout(t), T.delete(e));
233
+ }
234
+ function pe(e, t) {
235
+ E.has(e) || E.set(e, e.innerHTML), e.textContent = t;
236
+ }
237
+ function L(e) {
238
+ let t = E.get(e);
239
+ t !== void 0 && (e.innerHTML = t, E.delete(e));
240
+ }
241
+ function me(e, t) {
242
+ let n = e.querySelector("[data-formie-progress-bar]"), r = e.querySelector("[data-formie-progress-value]");
243
+ n && (n.style.width = `${t}%`, n.setAttribute("aria-valuenow", `${t}`), n.setAttribute("data-formie-progress-state", de(t)), r && (r.textContent = `${t}%`, r.setAttribute("data-formie-progress-value", `${t}`)));
244
+ }
245
+ function R(e, t) {
246
+ if (!t) return;
247
+ let n = (e.dataset.formieLoadingIndicator || "").trim();
248
+ if (n) {
249
+ if (t.setAttribute("data-formie-loading-indicator", n), n === "spinner") {
250
+ r(t, e, "loading", !0), L(t), t.removeAttribute("data-formie-loading-text");
251
+ return;
252
+ }
253
+ if (n === "text") {
254
+ let n = (e.dataset.formieLoadingIndicatorText || "").trim(), r = t.textContent?.trim() || "", i = n || r;
255
+ t.setAttribute("data-formie-loading-text", i), pe(t, i);
256
+ return;
257
+ }
258
+ L(t), t.removeAttribute("data-formie-loading-text");
259
+ }
260
+ }
261
+ function z(e) {
262
+ return Array.from(e.querySelectorAll("[data-formie-action]"));
263
+ }
264
+ function he(e, t) {
265
+ e.getAttribute("data-formie-loading") !== "true" && (e.setAttribute("data-formie-loading", "true"), z(e).forEach((e) => {
266
+ "disabled" in e && (e.disabled ? e.setAttribute("data-formie-was-disabled", "true") : e.removeAttribute("data-formie-was-disabled"), e.disabled = !0);
267
+ }), t && (t.setAttribute("data-formie-loading", "true"), R(e, t)));
268
+ }
269
+ function B(e) {
270
+ if (e.removeAttribute("data-formie-loading"), z(e).forEach((t) => {
271
+ if ("disabled" in t) {
272
+ let e = t;
273
+ e.disabled = e.getAttribute("data-formie-was-disabled") === "true";
274
+ }
275
+ L(t), t.removeAttribute("data-formie-was-disabled"), t.removeAttribute("data-formie-loading"), r(t, e, "loading", !1), t.removeAttribute("data-formie-loading-indicator"), t.removeAttribute("data-formie-loading-text");
276
+ }), e.dataset.formieDisableSubmitUntilValid === "true") {
277
+ let t = e;
278
+ t.formieValidation && w(e, t.formieValidation);
279
+ }
280
+ }
281
+ function V(e, t) {
282
+ let n = j(e), o = ue(e), s = n.findIndex((e) => e.getAttribute("data-formie-page-id") === t);
283
+ if (n.forEach((n) => {
284
+ n.getAttribute("data-formie-page-id") === t ? (n.removeAttribute("data-formie-page-hidden"), i(n, e, "pageHidden")) : (n.setAttribute("data-formie-page-hidden", "true"), a(n, e, "pageHidden"));
285
+ }), o.forEach((n, i) => {
286
+ let a = n.getAttribute("data-formie-page-id") === t, o = s > -1 && i < s;
287
+ r(n, e, "tabCurrent", a), r(n, e, "tabComplete", o), a ? n.setAttribute("aria-current", "page") : n.removeAttribute("aria-current"), o ? n.setAttribute("data-formie-tab-complete", "true") : n.removeAttribute("data-formie-tab-complete");
288
+ }), s > -1 && n.length > 0 && me(e, M(e, s, n.length)), O(e, "pageId", t), v(e), e.dataset.formieDisableSubmitUntilValid === "true") {
289
+ let t = e;
290
+ t.formieValidation && w(e, t.formieValidation);
291
+ }
292
+ }
293
+ function ge(e, t) {
294
+ let n = t.meta?.submissionUid;
295
+ typeof n == "string" && n.trim() !== "" && O(e, "submissionUid", n);
296
+ let r = (t.meta?.session)?.continuation?.continuationToken;
297
+ typeof r == "string" && r.trim() !== "" ? O(e, "continuationToken", r) : A(e, "continuationToken");
298
+ }
299
+ function _e(e) {
300
+ let t = e.getAttribute("action");
301
+ t && e.setAttribute("action", ce(t, "resumeToken"));
302
+ try {
303
+ let e = new URL(window.location.href);
304
+ if (!e.searchParams.has("resumeToken")) return;
305
+ e.searchParams.delete("resumeToken"), window.history.replaceState({}, document.title, `${e.pathname}${e.search}${e.hash}`);
306
+ } catch {}
307
+ }
308
+ function ve(e, t) {
309
+ let n = t.meta?.resumeUrl;
310
+ if (typeof n != "string" || n.trim() === "") return;
311
+ let r = n.trim();
312
+ if (le(r)) {
313
+ e.getAttribute("action") && e.setAttribute("action", r);
314
+ try {
315
+ let e = new URL(r, window.location.href);
316
+ window.history.replaceState({}, document.title, `${e.pathname}${e.search}${e.hash}`);
317
+ } catch {}
318
+ }
319
+ }
320
+ function H(t, n = {}) {
321
+ let r = t.formieValidation, i = j(t)[0]?.getAttribute("data-formie-page-id");
322
+ if (I(t), t.reset(), n.preserveHiddenState || F(t, !1), A(t, "submissionId"), A(t, "submissionUid"), A(t, "continuationToken"), A(t, "pageId"), _e(t), r?.resetLiveState(), i) {
323
+ V(t, i), t.dispatchEvent(new CustomEvent(e("reset"), { bubbles: !0 }));
324
+ return;
325
+ }
326
+ v(t), t.dispatchEvent(new CustomEvent(e("reset"), { bubbles: !0 }));
327
+ }
328
+ function ye(e) {
329
+ return e.code === se || e.meta?.resetState === !0;
330
+ }
331
+ function be(e, n) {
332
+ let r = n.submitData, i = /* @__PURE__ */ new Set(), a = !1;
333
+ if (Array.isArray(r) && r.length > 0) {
334
+ let n = r.filter((e) => typeof e == "object" && !!e && "event" in e && typeof e.event == "string");
335
+ for (let r of n) {
336
+ let n = t(r.event);
337
+ i.add(n), D.log("Dispatching submitData event.", { eventName: n }), n.startsWith("formie:payment:") && (a = !0), e.dispatchEvent(new CustomEvent(n, {
338
+ bubbles: !0,
339
+ detail: { data: r.data }
340
+ }));
341
+ }
342
+ }
343
+ let o = n.meta || {}, s = (o.paymentAction && typeof o.paymentAction == "object" ? o.paymentAction : null) || (o.paymentDecision && typeof o.paymentDecision == "object" ? o.paymentDecision.action : null), c = s ? String(s.event || "") : "", l = s ? s.payload : void 0, u = t(c);
344
+ return u && !i.has(u) && (u.startsWith("formie:payment:") && (a = !0), e.dispatchEvent(new CustomEvent(u, {
345
+ bubbles: !0,
346
+ detail: { data: l }
347
+ })), D.log("Dispatching fallback payment action event.", { eventName: u })), { hasPaymentFollowUpEvent: a };
348
+ }
349
+ function xe(e, t, n) {
350
+ if (D.log("Applying submit result state.", {
351
+ ok: t.ok,
352
+ action: n,
353
+ code: t.code,
354
+ hasRedirect: !!t.redirect?.url,
355
+ hasSubmitData: Array.isArray(t.submitData) && t.submitData.length > 0
356
+ }), ye(t)) {
357
+ H(e), D.log("Resetting state due to stale/reset marker.");
358
+ return;
359
+ }
360
+ let r = be(e, t);
361
+ if (!t.ok && t.redirect?.url && !r.hasPaymentFollowUpEvent) {
362
+ D.log("Applying redirect fallback for failed result.", {
363
+ url: t.redirect.url,
364
+ target: t.redirect.target
365
+ }), I(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank") : (k(e, "redirect"), window.location.href = t.redirect.url);
366
+ return;
367
+ }
368
+ if (ge(e, t), !t.ok) {
369
+ D.log("Non-redirect failure; keeping current form state."), I(e);
370
+ return;
371
+ }
372
+ if (_(e, n), t.nextPage?.id) {
373
+ I(e), e.formieValidation?.resetLiveState(), V(e, t.nextPage.id), D.log("Advanced to next page.", { nextPageId: t.nextPage.id });
374
+ return;
375
+ }
376
+ if (n === "save") {
377
+ I(e), ve(e, t), D.log("Applied save/resume token state.");
378
+ return;
379
+ }
380
+ if (n === "submit" && !t.redirect?.url) {
381
+ let n = N(e, t), r = n === "message" && P(e);
382
+ if (n === "reload") {
383
+ I(e), k(e, "reload"), window.location.reload();
384
+ return;
385
+ }
386
+ if (n === "reset") {
387
+ H(e);
388
+ return;
389
+ }
390
+ I(e), H(e, { preserveHiddenState: r });
391
+ return;
392
+ }
393
+ if (n === "submit" && t.redirect?.url && t.redirect.target === "new-tab") {
394
+ let n = N(e, t) === "message" && P(e);
395
+ I(e), H(e, { preserveHiddenState: n });
396
+ return;
397
+ }
398
+ I(e);
399
+ }
400
+ //#endregion
401
+ //#region src/js/modules/payments/constants.ts
402
+ var Se = 2500, Ce = {
403
+ bpoint: ["bpointToken"],
404
+ stripe: ["stripePaymentIntentId"],
405
+ paypal: ["paypalOrderId", "paypalAuthId"],
406
+ payway: ["paywayTokenId"],
407
+ opayo: ["opayoTokenId"],
408
+ eway: ["ewayTokenData"],
409
+ "go-cardless": ["goCardlessRedirectId"],
410
+ mollie: ["molliePaymentId"],
411
+ moneris: ["monerisTokenId"],
412
+ paddle: ["paddleTransactionId"],
413
+ square: ["squarePaymentId"]
414
+ };
415
+ //#endregion
416
+ //#region src/js/utils/fields.ts
417
+ function U(e) {
418
+ return e.replace("{field:", "").replace("{", "").replace("}", "").replace("]", "").split("[").join("][");
419
+ }
420
+ function we(e) {
421
+ return `fields[${U(e)}]`;
422
+ }
423
+ function Te(e, t) {
424
+ let n = we(t), r = Array.from(e.querySelectorAll(`[name="${n}"]`)), i = Array.from(e.querySelectorAll(`[name="${n}[]"]`));
425
+ return (i.length ? i : r).filter((e) => e instanceof HTMLElement);
426
+ }
427
+ function W(e, t) {
428
+ let n = Te(e, t);
429
+ for (let e of n) {
430
+ let t = e.closest("[data-formie-field-handle]")?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim();
431
+ if (t) return t;
432
+ }
433
+ return "";
434
+ }
435
+ function G(e) {
436
+ let t = e.replace(/[^\d.,-]/g, ""), n = t.includes(","), r = t.includes(".");
437
+ return t = n && r ? t.replace(/\./g, "").replace(/,/, ".") : n && !r ? t.replace(/,/, ".") : t.replace(/,/g, ""), parseFloat(t);
438
+ }
439
+ //#endregion
440
+ //#region src/js/modules/payments/utils.ts
441
+ function K(e, t) {
442
+ let n = t.replace(/"/g, "\\\"");
443
+ return e.querySelector(`input[name$="[${n}]"]`) || e.querySelector(`input[name$="${n}"]`);
444
+ }
445
+ function q(e, t) {
446
+ let n = t.find((t) => {
447
+ let n = K(e, t);
448
+ return !n || String(n.value || "").trim() === "";
449
+ });
450
+ return {
451
+ ok: !n,
452
+ missingSuffix: n
453
+ };
454
+ }
455
+ async function J(e, t, n) {
456
+ let r = q(e, t);
457
+ if (r.ok) return r;
458
+ let i = Date.now() + Math.max(n, 0);
459
+ for (; Date.now() < i;) {
460
+ await s(120);
461
+ let n = q(e, t);
462
+ if (n.ok) return n;
463
+ }
464
+ return q(e, t);
465
+ }
466
+ //#endregion
467
+ //#region src/js/modules/payments/host.ts
468
+ var Ee = new Set([
469
+ "handle",
470
+ "requiredInputSuffixes",
471
+ "waitForValueMs",
472
+ "errorMessage"
473
+ ]), Y = "[data-payment-success]", X = "[data-payment-error]";
474
+ function De(e, t) {
475
+ return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
476
+ }
477
+ function Oe(e, t, n) {
478
+ let r = t || {}, i = Object.entries(r).reduce((e, [t, n]) => (Ee.has(t) || (e[t] = n), e), {}), a = Array.isArray(r.requiredInputSuffixes) ? r.requiredInputSuffixes.map(String).filter(Boolean) : n.defaultRequiredInputSuffixes || [], o = Number(r.waitForValueMs ?? n.defaultWaitForValueMs ?? 2500), s = typeof r.errorMessage == "string" && r.errorMessage.trim() !== "" ? r.errorMessage.trim() : "Payment authorization is incomplete.";
479
+ return {
480
+ handle: De(e, r),
481
+ transport: {
482
+ requiredInputSuffixes: a,
483
+ waitForValueMs: Number.isFinite(o) ? o : Se,
484
+ errorMessage: s
485
+ },
486
+ provider: i
487
+ };
488
+ }
489
+ function Z(e, t, n) {
490
+ return e.addEventListener(t, n), () => {
491
+ e.removeEventListener(t, n);
492
+ };
493
+ }
494
+ function ke(e, t) {
495
+ let n = e.target, r = e.form, i = e.root, s = r || i, p = t.transport.requiredInputSuffixes, m = () => f(r || i), h = (e) => {
496
+ let t = d(e, m()).value;
497
+ return Array.isArray(t) ? t[0] || "" : String(t || "");
498
+ };
499
+ return {
500
+ root: i,
501
+ form: r,
502
+ field: n,
503
+ updateInputs: (e, t) => {
504
+ let r = Array.isArray(e) ? e : [e];
505
+ for (let e of r) {
506
+ let r = K(s, e) ?? n.querySelector(`input[name*="${e}"]`);
507
+ r && (r.value = t);
508
+ }
509
+ },
510
+ addError: (e) => {
511
+ let t = n.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || n, o = t.querySelector(X);
512
+ o && o.remove();
513
+ let s = document.createElement("div");
514
+ s.setAttribute("data-payment-error", ""), s.textContent = e, a(s, r || i, "fieldError"), t.appendChild(s);
515
+ },
516
+ removeError: () => {
517
+ n.querySelector(X)?.remove();
518
+ },
519
+ addSuccess: (e) => {
520
+ let t = n.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || n, o = t.querySelector(Y);
521
+ o && o.remove();
522
+ let s = document.createElement("div");
523
+ s.setAttribute("data-payment-success", ""), s.textContent = e, a(s, r || i, "successMessage"), t.appendChild(s);
524
+ },
525
+ removeSuccess: () => {
526
+ n.querySelector(Y)?.remove();
527
+ },
528
+ hasToken: () => q(s, p).ok,
529
+ waitForToken: (e = t.transport.waitForValueMs) => J(s, p, e).then((e) => e.ok),
530
+ getFieldValue: (e, t = "string") => {
531
+ let n = h(e);
532
+ return t === "float" || t === "int" || t === "number" ? G(n) : n;
533
+ },
534
+ resolveAmount: (e) => {
535
+ let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed), s = String(a ?? "").trim(), c = typeof a == "number" ? a : G(s);
536
+ if (Number.isFinite(c) && c > 0) return {
537
+ ok: !0,
538
+ value: c
539
+ };
540
+ if (s !== "") {
541
+ let e = h(s), n = G(e);
542
+ if (Number.isFinite(n) && n > 0) return {
543
+ ok: !0,
544
+ value: n
545
+ };
546
+ let r = W(t, s);
547
+ if (!e) return {
548
+ ok: !1,
549
+ error: r ? o("Provide a value for \"{label}\" to proceed.", { label: r }) : o("Provide a payment amount to proceed.")
550
+ };
551
+ }
552
+ return {
553
+ ok: !1,
554
+ error: o("Payment amount must be greater than 0.")
555
+ };
556
+ },
557
+ resolveCurrency: (e) => {
558
+ let t = r || i, n = String(e.type || "").toLowerCase() === "dynamic" && typeof e.variable == "string" && e.variable.trim() !== "", a = e.value ?? (n ? e.variable : e.fixed ?? e.defaultCurrency ?? ""), s = String(a ?? "").trim(), c = s.toUpperCase();
559
+ if (/^[A-Z]{3}$/.test(c) && !n) return {
560
+ ok: !0,
561
+ value: c
562
+ };
563
+ if (s !== "") {
564
+ let e = String(h(s) || "").trim(), n = e.toUpperCase();
565
+ if (/^[A-Z]{3}$/.test(n)) return {
566
+ ok: !0,
567
+ value: n
568
+ };
569
+ let r = W(t, s);
570
+ if (!e) return {
571
+ ok: !1,
572
+ error: r ? o("Provide a value for \"{label}\" to proceed.", { label: r }) : o("Provide a payment currency to proceed.")
573
+ };
574
+ }
575
+ return {
576
+ ok: !1,
577
+ error: o("Payment currency must be a valid 3-letter code.")
578
+ };
579
+ },
580
+ watchFieldValueChanges: (e, t, n = 600) => {
581
+ let a = r || i, o = e.map((e) => String(e || "").trim()).filter(Boolean);
582
+ if (o.length === 0) return () => {};
583
+ let s = m(), d = /* @__PURE__ */ new Set();
584
+ o.forEach((e) => {
585
+ let t = l(e), n = s.get(t);
586
+ if (n?.names?.length) {
587
+ n.names.forEach((e) => {
588
+ d.add(e);
589
+ });
590
+ return;
591
+ }
592
+ let r = u(t);
593
+ r && (d.add(r), d.add(`${r}[]`));
594
+ });
595
+ let f = c(() => {
596
+ t();
597
+ }, n), p = (e) => {
598
+ let t = e.target?.name || "";
599
+ !t || !d.has(t) || f();
600
+ };
601
+ return a.addEventListener("input", p), a.addEventListener("change", p), () => {
602
+ a.removeEventListener("input", p), a.removeEventListener("change", p);
603
+ };
604
+ },
605
+ triggerSubmit: () => {
606
+ r && r.setAttribute("data-formie-internal-resubmit", "true"), r && typeof r.requestSubmit == "function" ? r.requestSubmit() : r && r.submit();
607
+ },
608
+ releaseSubmitLoading: () => {
609
+ r && (r.removeAttribute("data-formie-internal-resubmit"), B(r));
610
+ },
611
+ getBillingData: (e) => {
612
+ let t = {};
613
+ if (!e || typeof e != "object") return { billing_details: t };
614
+ if (e.billingName) {
615
+ let n = h(e.billingName);
616
+ n && (t.name = n);
617
+ }
618
+ if (e.billingEmail) {
619
+ let n = h(e.billingEmail);
620
+ n && (t.email = n);
621
+ }
622
+ if (e.billingAddress) {
623
+ let n = e.billingAddress, r = {}, i = h(`${n}.address1`), a = h(`${n}.address2`), o = h(`${n}.address3`), s = h(`${n}.city`), c = h(`${n}.zip`), l = h(`${n}.state`), u = h(`${n}.country`);
624
+ i && (r.line1 = i), a && (r.line2 = a), o && (r.line3 = o), s && (r.city = s), c && (r.postal_code = c), l && (r.state = l), u && (r.country = u), Object.keys(r).length && (t.address = r);
625
+ }
626
+ return { billing_details: t };
627
+ },
628
+ events: {
629
+ onForm: (e, t) => r ? Z(r, e, t) : () => {},
630
+ onRoot: (e, t) => Z(i, e, t)
631
+ }
632
+ };
633
+ }
634
+ //#endregion
635
+ //#region src/js/modules/payments/factories.ts
636
+ var Q = n("payments");
637
+ function $(e) {
638
+ let t = e;
639
+ return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
640
+ }
641
+ function Ae(e) {
642
+ let t = e.defaultRequiredInputSuffixes ?? Ce[e.id] ?? [];
643
+ return {
644
+ id: e.id,
645
+ kind: "payment",
646
+ match: (e) => !!(e.target.querySelector("[data-formie-field-type=\"payment\"]") || e.target.closest("[data-formie-field-type=\"payment\"]") || e.target.getAttribute?.("data-formie-field-type") === "payment"),
647
+ setup: async (n) => {
648
+ let r = n.target, i = r.__formiePaymentModuleRegistry || {};
649
+ r.__formiePaymentModuleRegistry = i;
650
+ let a = i[e.id];
651
+ if (a?.destroy) {
652
+ Q.warn("Found stale payment module instance; destroying previous.", { moduleId: e.id });
653
+ try {
654
+ await a.destroy();
655
+ } catch {}
656
+ }
657
+ let o = Oe(e.id, n.options || {}, { defaultRequiredInputSuffixes: t }), s = ke(n, o), c = {
658
+ ...n,
659
+ options: o,
660
+ services: s
661
+ }, l = [], u = null, d = null, f = null, p = null, m = async () => (u ||= (Q.log("Loading payment provider API.", { moduleId: e.id }), e.load(c)), u), h = async () => {
662
+ if (!e.mount || d || !$(n.target)) return;
663
+ let t = await m();
664
+ try {
665
+ d = await e.mount({
666
+ api: t,
667
+ field: n.target,
668
+ services: s,
669
+ options: o,
670
+ provider: o.provider
671
+ }), Q.log("Payment widget mounted.", {
672
+ moduleId: e.id,
673
+ handle: o.handle
674
+ });
675
+ } catch {
676
+ Q.warn("Payment widget mount failed.", {
677
+ moduleId: e.id,
678
+ handle: o.handle
679
+ });
680
+ }
681
+ };
682
+ if (l.push(n.on("formie:submit:before", () => {
683
+ s.removeError(), s.removeSuccess();
684
+ })), e.setup) {
685
+ let t = n.root || n.form || n.target;
686
+ f = await e.setup({
687
+ ...c,
688
+ root: t
689
+ }), f.destroy && l.push(f.destroy);
690
+ }
691
+ e.mount && $(n.target) && await h(), ["formie:page:navigate:after", "formie:submit:result"].forEach((e) => {
692
+ let t = () => {
693
+ h();
694
+ };
695
+ n.root.addEventListener(e, t), l.push(() => {
696
+ n.root.removeEventListener(e, t);
697
+ });
698
+ });
699
+ let g = async () => {
700
+ if (Q.log("Destroying payment module.", {
701
+ moduleId: e.id,
702
+ handle: o.handle
703
+ }), l.forEach((e) => e()), d && e.unmount) {
704
+ let t = await m();
705
+ await e.unmount({
706
+ api: t,
707
+ widget: d,
708
+ field: n.target,
709
+ services: s,
710
+ options: o,
711
+ provider: o.provider
712
+ }), Q.log("Payment widget unmounted.", {
713
+ moduleId: e.id,
714
+ handle: o.handle
715
+ });
716
+ }
717
+ i[e.id]?.destroy === g && delete i[e.id], Q.log("Payment module destroy complete.", {
718
+ moduleId: e.id,
719
+ handle: o.handle
720
+ });
721
+ };
722
+ return i[e.id] = { destroy: g }, {
723
+ destroy: g,
724
+ onBeforeStage: async (t) => {
725
+ if (f?.onBeforeStage) {
726
+ await f.onBeforeStage(t);
727
+ return;
728
+ }
729
+ if (t.stage !== "authorize" || t.action !== "submit" || n.target.closest("[data-formie-page]")?.hasAttribute("data-formie-page-hidden")) return;
730
+ await h();
731
+ let r = await m();
732
+ if (e.onBeforeAuthorize) {
733
+ p ||= (async () => e.onBeforeAuthorize({
734
+ api: r,
735
+ widget: d,
736
+ field: n.target,
737
+ services: s,
738
+ options: o,
739
+ provider: o.provider,
740
+ stageCtx: t
741
+ }))().finally(() => {
742
+ p = null;
743
+ });
744
+ let i = await p;
745
+ if (Q.log("onBeforeAuthorize resolved.", {
746
+ moduleId: e.id,
747
+ handle: o.handle,
748
+ ok: i
749
+ }), !i) {
750
+ t.abort(o.transport.errorMessage);
751
+ return;
752
+ }
753
+ return;
754
+ }
755
+ if (o.transport.requiredInputSuffixes.length === 0) return;
756
+ let i = await J(n.form || n.root, o.transport.requiredInputSuffixes, o.transport.waitForValueMs);
757
+ i.ok || (Q.warn("Required payment input(s) missing.", {
758
+ moduleId: e.id,
759
+ handle: o.handle,
760
+ missingSuffix: i.missingSuffix
761
+ }), t.abort(o.transport.errorMessage));
762
+ },
763
+ onAfterStage: async (t, r) => {
764
+ t.stage !== "dispatch" || !e.onAfterSubmit || await e.onAfterSubmit({
765
+ field: n.target,
766
+ services: s,
767
+ options: o,
768
+ provider: o.provider,
769
+ result: r
770
+ });
771
+ }
772
+ };
773
+ }
774
+ };
775
+ }
776
+ //#endregion
777
+ //#region src/js/modules/payments/api.ts
778
+ var je = Ae;
779
+ //#endregion
780
+ export { F as a, y as c, _ as d, B as i, b as l, V as n, he as o, xe as r, oe as s, je as t, v as u };