@justifi/webcomponents 4.13.0 → 4.15.0

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 (263) hide show
  1. package/dist/cjs/{Api-ab34a402.js → Api-3bc6e43f.js} +7 -2
  2. package/dist/cjs/{Payment-eceed10f.js → Payment-24f22eca.js} +2 -1
  3. package/dist/cjs/{SubAccount-b3902202.js → SubAccount-f1eda5da.js} +1 -1
  4. package/dist/cjs/additional-questions-details_5.cjs.entry.js +1 -1
  5. package/dist/cjs/business-additional-questions-schema-e7dd7bc3.js +57 -0
  6. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +1 -1
  7. package/dist/cjs/{index.esm-d25bd7bf.js → index.esm-a32e1831.js} +727 -0
  8. package/dist/cjs/justifi-additional-questions-form-step_5.cjs.entry.js +20 -17
  9. package/dist/cjs/justifi-additional-questions_4.cjs.entry.js +4 -1
  10. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +1796 -0
  11. package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
  12. package/dist/cjs/justifi-business-form.cjs.entry.js +8 -8
  13. package/dist/cjs/justifi-business-list.cjs.entry.js +4 -4
  14. package/dist/cjs/justifi-checkout-core.cjs.entry.js +7 -3
  15. package/dist/cjs/justifi-checkout.cjs.entry.js +12 -6
  16. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
  17. package/dist/cjs/justifi-new-payment-method_4.cjs.entry.js +13 -11
  18. package/dist/cjs/justifi-owner-form.cjs.entry.js +12 -8
  19. package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +4 -4
  20. package/dist/cjs/justifi-payment-details.cjs.entry.js +3 -3
  21. package/dist/cjs/justifi-payment-form.cjs.entry.js +39 -5
  22. package/dist/cjs/justifi-payment-method-selector.cjs.entry.js +1 -1
  23. package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -3
  24. package/dist/cjs/justifi-payout-details.cjs.entry.js +3 -3
  25. package/dist/cjs/justifi-payouts-list.cjs.entry.js +3 -3
  26. package/dist/cjs/justifi-proceeds-list.cjs.entry.js +4 -4
  27. package/dist/cjs/justifi-refund-form.cjs.entry.js +5 -6
  28. package/dist/cjs/justifi-subaccount-details.cjs.entry.js +6 -6
  29. package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +5 -5
  30. package/dist/cjs/loader.cjs.js +1 -1
  31. package/dist/cjs/payload-parsers-c2df4b29.js +95 -0
  32. package/dist/cjs/payment-details-core.cjs.entry.js +1 -1
  33. package/dist/cjs/{payment.service-336189d3.js → payment.service-35298e95.js} +4 -4
  34. package/dist/cjs/payments-list-core.cjs.entry.js +2 -2
  35. package/dist/cjs/payout-details-core.cjs.entry.js +1 -1
  36. package/dist/cjs/{payout.service-6012d576.js → payout.service-eec372aa.js} +4 -4
  37. package/dist/cjs/payouts-list-core.cjs.entry.js +2 -2
  38. package/dist/cjs/{payload-parsers-6c4b5323.js → schema-validations-3c70335c.js} +15 -89
  39. package/dist/cjs/select-input.cjs.entry.js +31 -0
  40. package/dist/cjs/subaccount-account-details_4.cjs.entry.js +1 -1
  41. package/dist/cjs/text-input.cjs.entry.js +30 -0
  42. package/dist/cjs/{utils-6f62f7a1.js → utils-e58fe016.js} +0 -2
  43. package/dist/cjs/webcomponents.cjs.js +1 -1
  44. package/dist/collection/api/Api.js +7 -2
  45. package/dist/collection/api/Payment.js +2 -1
  46. package/dist/collection/api/services/business.service.js +1 -1
  47. package/dist/collection/api/services/checkout.service.js +5 -3
  48. package/dist/collection/api/services/payment.service.js +2 -2
  49. package/dist/collection/api/services/payout.service.js +2 -2
  50. package/dist/collection/api/services/reports.service.js +1 -1
  51. package/dist/collection/collection-manifest.json +1 -1
  52. package/dist/collection/components/billing-form/billing-form-schema.js +8 -8
  53. package/dist/collection/components/billing-form/billing-form.js +49 -89
  54. package/dist/collection/components/billing-form/test/billing-form.spec.js +2 -1
  55. package/dist/collection/components/business-forms/business-form/business-form.js +1 -1
  56. package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +4 -1
  57. package/dist/collection/components/business-forms/owner-form/owner-form.js +6 -2
  58. package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +1 -1
  59. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +1 -1
  60. package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step.js +1 -1
  61. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +5 -2
  62. package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step.js +1 -1
  63. package/dist/collection/components/business-forms/schemas/business-identity-schema.js +4 -2
  64. package/dist/collection/components/business-forms/schemas/schema-validations.js +5 -0
  65. package/dist/collection/components/business-list/business-list.js +1 -1
  66. package/dist/collection/components/checkout/checkout-core.js +74 -2
  67. package/dist/collection/components/checkout/checkout.js +73 -1
  68. package/dist/collection/components/checkout/payment-method-options.css +6 -6
  69. package/dist/collection/components/checkout/payment-method-options.js +42 -6
  70. package/dist/collection/components/checkout/{sezzel-payment-method.js → sezzle-payment-method.js} +2 -2
  71. package/dist/collection/components/checkout/test/checkout-core.spec.js +1 -1
  72. package/dist/collection/components/payment-balance-transactions/payment-balance-transactions.js +1 -1
  73. package/dist/collection/components/payment-form/payment-form.js +56 -6
  74. package/dist/collection/components/payment-form/payment-method-selector.js +1 -1
  75. package/dist/collection/components/payment-form/test/payment-form.spec.js +18 -35
  76. package/dist/collection/components/payment-method-form/payment-method-form.js +1 -1
  77. package/dist/collection/components/proceeds-list/proceeds-list.js +1 -1
  78. package/dist/collection/components/refund-form/refund-form.js +1 -1
  79. package/dist/collection/components/subaccount-details/subaccount-details.js +2 -2
  80. package/dist/collection/components/subaccounts-list/subaccounts-list.js +1 -1
  81. package/dist/docs.json +287 -81
  82. package/dist/esm/{Api-e9d568c7.js → Api-b09a2f6a.js} +7 -2
  83. package/dist/esm/{Payment-ef9fc1ae.js → Payment-3e94da9c.js} +2 -1
  84. package/dist/esm/{SubAccount-f4ae9809.js → SubAccount-80d46814.js} +1 -1
  85. package/dist/esm/additional-questions-details_5.entry.js +1 -1
  86. package/dist/esm/{business-additional-questions-schema-e96b0509.js → business-additional-questions-schema-1fdc5c40.js} +2 -2
  87. package/dist/esm/gross-payment-chart-core.entry.js +1 -1
  88. package/dist/esm/{index.esm-22b47398.js → index.esm-d98bc080.js} +727 -1
  89. package/dist/esm/justifi-additional-questions-form-step_5.entry.js +16 -13
  90. package/dist/esm/justifi-additional-questions_4.entry.js +4 -1
  91. package/dist/esm/justifi-billing-form_2.entry.js +1791 -0
  92. package/dist/esm/justifi-business-details.entry.js +2 -2
  93. package/dist/esm/justifi-business-form.entry.js +7 -7
  94. package/dist/esm/justifi-business-list.entry.js +4 -4
  95. package/dist/esm/justifi-checkout-core.entry.js +7 -3
  96. package/dist/esm/justifi-checkout.entry.js +12 -6
  97. package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
  98. package/dist/esm/justifi-new-payment-method_4.entry.js +13 -11
  99. package/dist/esm/justifi-owner-form.entry.js +11 -7
  100. package/dist/esm/justifi-payment-balance-transactions.entry.js +4 -4
  101. package/dist/esm/justifi-payment-details.entry.js +3 -3
  102. package/dist/esm/justifi-payment-form.entry.js +39 -5
  103. package/dist/esm/justifi-payment-method-selector.entry.js +1 -1
  104. package/dist/esm/justifi-payments-list.entry.js +3 -3
  105. package/dist/esm/justifi-payout-details.entry.js +3 -3
  106. package/dist/esm/justifi-payouts-list.entry.js +3 -3
  107. package/dist/esm/justifi-proceeds-list.entry.js +4 -4
  108. package/dist/esm/justifi-refund-form.entry.js +4 -5
  109. package/dist/esm/justifi-subaccount-details.entry.js +6 -6
  110. package/dist/esm/justifi-subaccounts-list.entry.js +5 -5
  111. package/dist/esm/loader.js +1 -1
  112. package/dist/esm/payload-parsers-fd35eeca.js +88 -0
  113. package/dist/esm/payment-details-core.entry.js +1 -1
  114. package/dist/esm/{payment.service-2fdc5018.js → payment.service-c62d82d3.js} +4 -4
  115. package/dist/esm/payments-list-core.entry.js +2 -2
  116. package/dist/esm/payout-details-core.entry.js +1 -1
  117. package/dist/esm/{payout.service-15064bcc.js → payout.service-28b9594f.js} +4 -4
  118. package/dist/esm/payouts-list-core.entry.js +2 -2
  119. package/dist/esm/{payload-parsers-32028700.js → schema-validations-31feaa53.js} +7 -84
  120. package/dist/{module/select-input2.js → esm/select-input.entry.js} +7 -30
  121. package/dist/esm/subaccount-account-details_4.entry.js +1 -1
  122. package/dist/{module/text-input2.js → esm/text-input.entry.js} +7 -29
  123. package/dist/esm/{utils-243abdb4.js → utils-37533368.js} +1 -2
  124. package/dist/esm/webcomponents.js +1 -1
  125. package/dist/module/Api.js +7 -2
  126. package/dist/module/Payment.js +2 -1
  127. package/dist/module/billing-form.js +41 -62
  128. package/dist/module/business-additional-questions-form-step.js +2 -2
  129. package/dist/module/business-additional-questions-schema.js +1 -1
  130. package/dist/module/business-address-schema.js +1 -1
  131. package/dist/module/business-core-info-form-step.js +2 -2
  132. package/dist/module/business-core-info-schema.js +1 -1
  133. package/dist/module/business-form-types.js +1 -154
  134. package/dist/module/business-identity-schema.js +5 -3
  135. package/dist/module/business-owners-form-step.js +1 -1
  136. package/dist/module/business-representative-form-step.js +6 -3
  137. package/dist/module/business-representative.js +4 -1
  138. package/dist/module/checkout-core.js +27 -19
  139. package/dist/module/identity-address-form.js +1 -1
  140. package/dist/module/index.esm.js +727 -1
  141. package/dist/module/justifi-business-details.js +2 -2
  142. package/dist/module/justifi-business-form.js +4 -5
  143. package/dist/module/justifi-business-list.js +1 -1
  144. package/dist/module/justifi-checkout.js +34 -24
  145. package/dist/module/justifi-gross-payment-chart.js +2 -2
  146. package/dist/module/justifi-payment-balance-transactions.js +1 -1
  147. package/dist/module/justifi-payment-details.js +1 -1
  148. package/dist/module/justifi-payment-form.js +50 -15
  149. package/dist/module/justifi-payment-provisioning.js +2 -2
  150. package/dist/module/justifi-payments-list.js +1 -1
  151. package/dist/module/justifi-payout-details.js +1 -1
  152. package/dist/module/justifi-payouts-list.js +1 -1
  153. package/dist/module/justifi-proceeds-list.js +1 -1
  154. package/dist/module/justifi-refund-form.js +2 -3
  155. package/dist/module/justifi-sezzle-payment-method.d.ts +11 -0
  156. package/dist/module/justifi-sezzle-payment-method.js +6 -0
  157. package/dist/module/justifi-subaccount-details.js +2 -2
  158. package/dist/module/justifi-subaccounts-list.js +1 -1
  159. package/dist/module/legal-address-form-step.js +3 -3
  160. package/dist/module/legal-address-form.js +1 -1
  161. package/dist/module/new-payment-method.js +9 -9
  162. package/dist/module/owner-form.js +9 -5
  163. package/dist/module/payment-method-form.js +1 -1
  164. package/dist/module/payment-method-options.js +26 -22
  165. package/dist/module/payment.service.js +2 -2
  166. package/dist/module/payout.service.js +2 -2
  167. package/dist/module/schema-validations.js +159 -0
  168. package/dist/module/select-input.js +48 -1
  169. package/dist/module/{sezzel-payment-method.js → sezzle-payment-method.js} +6 -6
  170. package/dist/module/text-input.js +46 -1
  171. package/dist/module/utils2.js +1 -2
  172. package/dist/module/utils3.js +12 -21
  173. package/dist/module/utils4.js +21 -12
  174. package/dist/types/api/Api.d.ts +5 -1
  175. package/dist/types/api/Payment.d.ts +2 -1
  176. package/dist/types/components/billing-form/billing-form.d.ts +8 -15
  177. package/dist/types/components/business-forms/business-form/business-representative/business-representative.d.ts +1 -0
  178. package/dist/types/components/business-forms/owner-form/owner-form.d.ts +1 -0
  179. package/dist/types/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.d.ts +1 -0
  180. package/dist/types/components/business-forms/schemas/business-form-schema.d.ts +3 -1
  181. package/dist/types/components/business-forms/schemas/business-identity-schema.d.ts +2 -0
  182. package/dist/types/components/checkout/checkout-core.d.ts +4 -0
  183. package/dist/types/components/checkout/checkout.d.ts +4 -0
  184. package/dist/types/components/checkout/payment-method-options.d.ts +2 -0
  185. package/dist/types/components/checkout/{sezzel-payment-method.d.ts → sezzle-payment-method.d.ts} +1 -1
  186. package/dist/types/components/payment-form/payment-form.d.ts +7 -1
  187. package/dist/types/components.d.ts +38 -29
  188. package/dist/webcomponents/p-0603a526.entry.js +1 -0
  189. package/dist/webcomponents/{p-3917edbf.entry.js → p-09a6df17.entry.js} +1 -1
  190. package/dist/webcomponents/{p-7da249b8.entry.js → p-1367c4c7.entry.js} +1 -1
  191. package/dist/webcomponents/p-1b959678.entry.js +1 -0
  192. package/dist/webcomponents/{p-a6f170ba.entry.js → p-1f23c9d5.entry.js} +1 -1
  193. package/dist/webcomponents/p-21f301a0.entry.js +1 -0
  194. package/dist/webcomponents/p-243caf7c.entry.js +1 -0
  195. package/dist/webcomponents/{p-c6e207f6.entry.js → p-27ea1f3f.entry.js} +1 -1
  196. package/dist/webcomponents/{p-13e2f667.js → p-29c0b182.js} +1 -1
  197. package/dist/webcomponents/{p-28b38699.js → p-3cd675e7.js} +1 -1
  198. package/dist/webcomponents/p-3d70b0f1.entry.js +1 -0
  199. package/dist/webcomponents/{p-41bdee27.entry.js → p-55d37253.entry.js} +1 -1
  200. package/dist/webcomponents/{p-02b18979.entry.js → p-60ea8fd1.entry.js} +1 -1
  201. package/dist/webcomponents/p-624ed594.entry.js +1 -0
  202. package/dist/webcomponents/p-62bbcdfb.entry.js +1 -0
  203. package/dist/webcomponents/p-76e74f01.js +1 -0
  204. package/dist/webcomponents/p-7ca334d6.entry.js +1 -0
  205. package/dist/webcomponents/p-7d6c67bb.js +1 -0
  206. package/dist/webcomponents/{p-78b32fb9.entry.js → p-7ea5b11c.entry.js} +1 -1
  207. package/dist/webcomponents/p-83ae34bf.js +1 -0
  208. package/dist/webcomponents/p-84aea66c.entry.js +1 -0
  209. package/dist/webcomponents/p-8960e936.entry.js +1 -0
  210. package/dist/webcomponents/p-8d53f1de.entry.js +1 -0
  211. package/dist/webcomponents/p-969572f2.entry.js +1 -0
  212. package/dist/webcomponents/{p-fce2b224.entry.js → p-9a36fca6.entry.js} +1 -1
  213. package/dist/webcomponents/p-a38fdda7.entry.js +1 -0
  214. package/dist/webcomponents/{p-1334f776.entry.js → p-adc9ae0f.entry.js} +1 -1
  215. package/dist/webcomponents/p-b53d7b7f.js +1 -0
  216. package/dist/webcomponents/p-b8d70349.entry.js +1 -0
  217. package/dist/webcomponents/p-b9db1c52.entry.js +1 -0
  218. package/dist/webcomponents/p-ca39c89f.js +1 -0
  219. package/dist/webcomponents/p-d6b980a3.entry.js +1 -0
  220. package/dist/webcomponents/p-dd609661.js +1 -0
  221. package/dist/webcomponents/{p-9ba31a6a.entry.js → p-de4ffaa1.entry.js} +1 -1
  222. package/dist/webcomponents/{p-9f529959.entry.js → p-e1a3a670.entry.js} +1 -1
  223. package/dist/webcomponents/p-e4be71ee.entry.js +1 -0
  224. package/dist/webcomponents/p-e8706cc4.js +1 -0
  225. package/dist/webcomponents/{p-65510838.js → p-f4dec164.js} +1 -1
  226. package/dist/webcomponents/p-f942f90b.entry.js +1 -0
  227. package/dist/webcomponents/p-fea93cb9.entry.js +1 -0
  228. package/dist/webcomponents/{p-f76283a5.entry.js → p-fee64d38.entry.js} +1 -1
  229. package/dist/webcomponents/webcomponents.css +1 -1
  230. package/dist/webcomponents/webcomponents.esm.js +1 -1
  231. package/package.json +1 -1
  232. package/dist/cjs/business-additional-questions-schema-0a35f597.js +0 -57
  233. package/dist/cjs/form-2ad3d374.js +0 -729
  234. package/dist/cjs/justifi-billing-form_4.cjs.entry.js +0 -1864
  235. package/dist/esm/form-5279c05a.js +0 -727
  236. package/dist/esm/justifi-billing-form_4.entry.js +0 -1857
  237. package/dist/module/form.js +0 -727
  238. package/dist/module/justifi-sezzel-payment-method.d.ts +0 -11
  239. package/dist/module/justifi-sezzel-payment-method.js +0 -6
  240. package/dist/webcomponents/p-02fa533c.js +0 -1
  241. package/dist/webcomponents/p-101b2648.entry.js +0 -1
  242. package/dist/webcomponents/p-132ba228.js +0 -1
  243. package/dist/webcomponents/p-1885c478.entry.js +0 -1
  244. package/dist/webcomponents/p-23099f1f.entry.js +0 -1
  245. package/dist/webcomponents/p-230b96df.entry.js +0 -1
  246. package/dist/webcomponents/p-3da23f21.js +0 -1
  247. package/dist/webcomponents/p-4c84952f.entry.js +0 -1
  248. package/dist/webcomponents/p-64710363.entry.js +0 -1
  249. package/dist/webcomponents/p-731085e3.js +0 -1
  250. package/dist/webcomponents/p-7e334dce.entry.js +0 -1
  251. package/dist/webcomponents/p-7faacb1e.entry.js +0 -1
  252. package/dist/webcomponents/p-9b4b91ba.js +0 -1
  253. package/dist/webcomponents/p-a9af8f40.entry.js +0 -1
  254. package/dist/webcomponents/p-ade12f56.js +0 -1
  255. package/dist/webcomponents/p-b81afd51.entry.js +0 -1
  256. package/dist/webcomponents/p-bb58e656.entry.js +0 -1
  257. package/dist/webcomponents/p-bc12b8b9.js +0 -1
  258. package/dist/webcomponents/p-bfe7c55c.entry.js +0 -1
  259. package/dist/webcomponents/p-c1be3378.entry.js +0 -1
  260. package/dist/webcomponents/p-cb31488b.entry.js +0 -1
  261. package/dist/webcomponents/p-d0a8c631.entry.js +0 -1
  262. package/dist/webcomponents/p-d7d40d26.entry.js +0 -1
  263. package/dist/webcomponents/p-efbc8ffc.entry.js +0 -1
@@ -0,0 +1,1796 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-5d5f2219.js');
6
+ const index_esm = require('./index.esm-a32e1831.js');
7
+ const schemaValidations = require('./schema-validations-3c70335c.js');
8
+ const stateOptions = require('./state-options-4fbcb48a.js');
9
+ const utils = require('./utils-fc72268d.js');
10
+ const utils$1 = require('./utils-e58fe016.js');
11
+ require('./business-form-options-43366c9a.js');
12
+ require('./Business-32a53780.js');
13
+
14
+ const BillingFormSchema = index_esm.create$3({
15
+ name: schemaValidations.identityNameValidation.required('Enter full name'),
16
+ address_line1: schemaValidations.lineOneValidation.required('Enter street address'),
17
+ address_line2: schemaValidations.lineTwoValidation.nullable(),
18
+ address_city: schemaValidations.cityValidation.required('Enter city'),
19
+ address_state: schemaValidations.stateValidation.required('Select state'),
20
+ address_postal_code: schemaValidations.postalValidation.required('Enter postal code'),
21
+ });
22
+
23
+ const billingFormCss = ":root,[data-bs-theme=light]{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-black:#000;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-primary-text-emphasis:#052c65;--bs-secondary-text-emphasis:#2b2f32;--bs-success-text-emphasis:#0a3622;--bs-info-text-emphasis:#055160;--bs-warning-text-emphasis:#664d03;--bs-danger-text-emphasis:#58151c;--bs-light-text-emphasis:#495057;--bs-dark-text-emphasis:#495057;--bs-primary-bg-subtle:#cfe2ff;--bs-secondary-bg-subtle:#e2e3e5;--bs-success-bg-subtle:#d1e7dd;--bs-info-bg-subtle:#cff4fc;--bs-warning-bg-subtle:#fff3cd;--bs-danger-bg-subtle:#f8d7da;--bs-light-bg-subtle:#fcfcfd;--bs-dark-bg-subtle:#ced4da;--bs-primary-border-subtle:#9ec5fe;--bs-secondary-border-subtle:#c4c8cb;--bs-success-border-subtle:#a3cfbb;--bs-info-border-subtle:#9eeaf9;--bs-warning-border-subtle:#ffe69c;--bs-danger-border-subtle:#f1aeb5;--bs-light-border-subtle:#e9ecef;--bs-dark-border-subtle:#adb5bd;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-color-rgb:33, 37, 41;--bs-body-bg:#fff;--bs-body-bg-rgb:255, 255, 255;--bs-emphasis-color:#000;--bs-emphasis-color-rgb:0, 0, 0;--bs-secondary-color:rgba(33, 37, 41, 0.75);--bs-secondary-color-rgb:33, 37, 41;--bs-secondary-bg:#e9ecef;--bs-secondary-bg-rgb:233, 236, 239;--bs-tertiary-color:rgba(33, 37, 41, 0.5);--bs-tertiary-color-rgb:33, 37, 41;--bs-tertiary-bg:#f8f9fa;--bs-tertiary-bg-rgb:248, 249, 250;--bs-heading-color:inherit;--bs-link-color:#0d6efd;--bs-link-color-rgb:13, 110, 253;--bs-link-decoration:underline;--bs-link-hover-color:#0a58ca;--bs-link-hover-color-rgb:10, 88, 202;--bs-code-color:#d63384;--bs-highlight-color:#212529;--bs-highlight-bg:#fff3cd;--bs-border-width:1px;--bs-border-style:solid;--bs-border-color:#dee2e6;--bs-border-color-translucent:rgba(0, 0, 0, 0.175);--bs-border-radius:0.375rem;--bs-border-radius-sm:0.25rem;--bs-border-radius-lg:0.5rem;--bs-border-radius-xl:1rem;--bs-border-radius-xxl:2rem;--bs-border-radius-2xl:var(--bs-border-radius-xxl);--bs-border-radius-pill:50rem;--bs-box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15);--bs-box-shadow-sm:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);--bs-box-shadow-lg:0 1rem 3rem rgba(0, 0, 0, 0.175);--bs-box-shadow-inset:inset 0 1px 2px rgba(0, 0, 0, 0.075);--bs-focus-ring-width:0.25rem;--bs-focus-ring-opacity:0.25;--bs-focus-ring-color:rgba(13, 110, 253, 0.25);--bs-form-valid-color:#198754;--bs-form-valid-border-color:#198754;--bs-form-invalid-color:#dc3545;--bs-form-invalid-border-color:#dc3545}[data-bs-theme=dark]{color-scheme:dark;--bs-body-color:#dee2e6;--bs-body-color-rgb:222, 226, 230;--bs-body-bg:#212529;--bs-body-bg-rgb:33, 37, 41;--bs-emphasis-color:#fff;--bs-emphasis-color-rgb:255, 255, 255;--bs-secondary-color:rgba(222, 226, 230, 0.75);--bs-secondary-color-rgb:222, 226, 230;--bs-secondary-bg:#343a40;--bs-secondary-bg-rgb:52, 58, 64;--bs-tertiary-color:rgba(222, 226, 230, 0.5);--bs-tertiary-color-rgb:222, 226, 230;--bs-tertiary-bg:#2b3035;--bs-tertiary-bg-rgb:43, 48, 53;--bs-primary-text-emphasis:#6ea8fe;--bs-secondary-text-emphasis:#a7acb1;--bs-success-text-emphasis:#75b798;--bs-info-text-emphasis:#6edff6;--bs-warning-text-emphasis:#ffda6a;--bs-danger-text-emphasis:#ea868f;--bs-light-text-emphasis:#f8f9fa;--bs-dark-text-emphasis:#dee2e6;--bs-primary-bg-subtle:#031633;--bs-secondary-bg-subtle:#161719;--bs-success-bg-subtle:#051b11;--bs-info-bg-subtle:#032830;--bs-warning-bg-subtle:#332701;--bs-danger-bg-subtle:#2c0b0e;--bs-light-bg-subtle:#343a40;--bs-dark-bg-subtle:#1a1d20;--bs-primary-border-subtle:#084298;--bs-secondary-border-subtle:#41464b;--bs-success-border-subtle:#0f5132;--bs-info-border-subtle:#087990;--bs-warning-border-subtle:#997404;--bs-danger-border-subtle:#842029;--bs-light-border-subtle:#495057;--bs-dark-border-subtle:#343a40;--bs-heading-color:inherit;--bs-link-color:#6ea8fe;--bs-link-hover-color:#8bb9fe;--bs-link-color-rgb:110, 168, 254;--bs-link-hover-color-rgb:139, 185, 254;--bs-code-color:#e685b5;--bs-highlight-color:#dee2e6;--bs-highlight-bg:#664d03;--bs-border-color:#495057;--bs-border-color-translucent:rgba(255, 255, 255, 0.15);--bs-form-valid-color:#75b798;--bs-form-valid-border-color:#75b798;--bs-form-invalid-color:#ea868f;--bs-form-invalid-border-color:#ea868f}.spinner-grow,.spinner-border{display:inline-block;width:var(--bs-spinner-width);height:var(--bs-spinner-height);vertical-align:var(--bs-spinner-vertical-align);border-radius:50%;animation:var(--bs-spinner-animation-speed) linear infinite var(--bs-spinner-animation-name)}@keyframes spinner-border{to{transform:rotate(360deg) }}.spinner-border{--bs-spinner-width:2rem;--bs-spinner-height:2rem;--bs-spinner-vertical-align:-0.125em;--bs-spinner-border-width:0.25em;--bs-spinner-animation-speed:0.75s;--bs-spinner-animation-name:spinner-border;border:var(--bs-spinner-border-width) solid currentcolor;border-right-color:transparent}.spinner-border-sm{--bs-spinner-width:1rem;--bs-spinner-height:1rem;--bs-spinner-border-width:0.2em}@keyframes spinner-grow{0%{transform:scale(0)}50%{opacity:1;transform:none}}.spinner-grow{--bs-spinner-width:2rem;--bs-spinner-height:2rem;--bs-spinner-vertical-align:-0.125em;--bs-spinner-animation-speed:0.75s;--bs-spinner-animation-name:spinner-grow;background-color:currentcolor;opacity:0}.spinner-grow-sm{--bs-spinner-width:1rem;--bs-spinner-height:1rem}@media (prefers-reduced-motion: reduce){.spinner-border,.spinner-grow{--bs-spinner-animation-speed:1.5s}}.clearfix::after{display:block;clear:both;content:\"\"}.text-bg-primary{color:#fff !important;background-color:RGBA(var(--bs-primary-rgb), var(--bs-bg-opacity, 1)) !important}.text-bg-secondary{color:#fff !important;background-color:RGBA(var(--bs-secondary-rgb), var(--bs-bg-opacity, 1)) !important}.text-bg-success{color:#fff !important;background-color:RGBA(var(--bs-success-rgb), var(--bs-bg-opacity, 1)) !important}.text-bg-info{color:#000 !important;background-color:RGBA(var(--bs-info-rgb), var(--bs-bg-opacity, 1)) !important}.text-bg-warning{color:#000 !important;background-color:RGBA(var(--bs-warning-rgb), var(--bs-bg-opacity, 1)) !important}.text-bg-danger{color:#fff !important;background-color:RGBA(var(--bs-danger-rgb), var(--bs-bg-opacity, 1)) !important}.text-bg-light{color:#000 !important;background-color:RGBA(var(--bs-light-rgb), var(--bs-bg-opacity, 1)) !important}.text-bg-dark{color:#fff !important;background-color:RGBA(var(--bs-dark-rgb), var(--bs-bg-opacity, 1)) !important}.link-primary{color:RGBA(var(--bs-primary-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-primary-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-primary:hover,.link-primary:focus{color:RGBA(10, 88, 202, var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(10, 88, 202, var(--bs-link-underline-opacity, 1)) !important}.link-secondary{color:RGBA(var(--bs-secondary-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-secondary-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-secondary:hover,.link-secondary:focus{color:RGBA(86, 94, 100, var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(86, 94, 100, var(--bs-link-underline-opacity, 1)) !important}.link-success{color:RGBA(var(--bs-success-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-success-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-success:hover,.link-success:focus{color:RGBA(20, 108, 67, var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(20, 108, 67, var(--bs-link-underline-opacity, 1)) !important}.link-info{color:RGBA(var(--bs-info-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-info-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-info:hover,.link-info:focus{color:RGBA(61, 213, 243, var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(61, 213, 243, var(--bs-link-underline-opacity, 1)) !important}.link-warning{color:RGBA(var(--bs-warning-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-warning-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-warning:hover,.link-warning:focus{color:RGBA(255, 205, 57, var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(255, 205, 57, var(--bs-link-underline-opacity, 1)) !important}.link-danger{color:RGBA(var(--bs-danger-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-danger-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-danger:hover,.link-danger:focus{color:RGBA(176, 42, 55, var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(176, 42, 55, var(--bs-link-underline-opacity, 1)) !important}.link-light{color:RGBA(var(--bs-light-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-light-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-light:hover,.link-light:focus{color:RGBA(249, 250, 251, var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(249, 250, 251, var(--bs-link-underline-opacity, 1)) !important}.link-dark{color:RGBA(var(--bs-dark-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-dark-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-dark:hover,.link-dark:focus{color:RGBA(26, 30, 33, var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(26, 30, 33, var(--bs-link-underline-opacity, 1)) !important}.link-body-emphasis{color:RGBA(var(--bs-emphasis-color-rgb), var(--bs-link-opacity, 1)) !important;text-decoration-color:RGBA(var(--bs-emphasis-color-rgb), var(--bs-link-underline-opacity, 1)) !important}.link-body-emphasis:hover,.link-body-emphasis:focus{color:RGBA(var(--bs-emphasis-color-rgb), var(--bs-link-opacity, 0.75)) !important;text-decoration-color:RGBA(var(--bs-emphasis-color-rgb), var(--bs-link-underline-opacity, 0.75)) !important}.focus-ring:focus{outline:0;box-shadow:var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}.icon-link{display:inline-flex;gap:0.375rem;align-items:center;text-decoration-color:rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 0.5));text-underline-offset:0.25em;backface-visibility:hidden}.icon-link>.bi{flex-shrink:0;width:1em;height:1em;fill:currentcolor;transition:0.2s ease-in-out transform}@media (prefers-reduced-motion: reduce){.icon-link>.bi{transition:none}}.icon-link-hover:hover>.bi,.icon-link-hover:focus-visible>.bi{transform:var(--bs-icon-link-transform, translate3d(0.25em, 0, 0))}.ratio{position:relative;width:100%}.ratio::before{display:block;padding-top:var(--bs-aspect-ratio);content:\"\"}.ratio>*{position:absolute;top:0;left:0;width:100%;height:100%}.ratio-1x1{--bs-aspect-ratio:100%}.ratio-4x3{--bs-aspect-ratio:75%}.ratio-16x9{--bs-aspect-ratio:56.25%}.ratio-21x9{--bs-aspect-ratio:42.8571428571%}.fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030}.fixed-bottom{position:fixed;right:0;bottom:0;left:0;z-index:1030}.sticky-top{position:sticky;top:0;z-index:1020}.sticky-bottom{position:sticky;bottom:0;z-index:1020}@media (min-width: 576px){.sticky-sm-top{position:sticky;top:0;z-index:1020}.sticky-sm-bottom{position:sticky;bottom:0;z-index:1020}}@media (min-width: 768px){.sticky-md-top{position:sticky;top:0;z-index:1020}.sticky-md-bottom{position:sticky;bottom:0;z-index:1020}}@media (min-width: 992px){.sticky-lg-top{position:sticky;top:0;z-index:1020}.sticky-lg-bottom{position:sticky;bottom:0;z-index:1020}}@media (min-width: 1200px){.sticky-xl-top{position:sticky;top:0;z-index:1020}.sticky-xl-bottom{position:sticky;bottom:0;z-index:1020}}@media (min-width: 1400px){.sticky-xxl-top{position:sticky;top:0;z-index:1020}.sticky-xxl-bottom{position:sticky;bottom:0;z-index:1020}}.hstack{display:flex;flex-direction:row;align-items:center;align-self:stretch}.vstack{display:flex;flex:1 1 auto;flex-direction:column;align-self:stretch}.visually-hidden,.visually-hidden-focusable:not(:focus):not(:focus-within){width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.visually-hidden:not(caption),.visually-hidden-focusable:not(:focus):not(:focus-within):not(caption){position:absolute !important}.stretched-link::after{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;content:\"\"}.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vr{display:inline-block;align-self:stretch;width:var(--bs-border-width);min-height:1em;background-color:currentcolor;opacity:0.25}*,*::before,*::after{box-sizing:border-box}@media (prefers-reduced-motion: no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}hr{margin:1rem 0;color:inherit;border:0;border-top:var(--bs-border-width) solid;opacity:0.25}h6,h5,h4,h3,h2,h1{margin-top:0;margin-bottom:0.5rem;font-weight:500;line-height:1.2;color:var(--bs-heading-color)}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width: 1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + 0.9vw)}@media (min-width: 1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + 0.6vw)}@media (min-width: 1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + 0.3vw)}@media (min-width: 1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[title]{text-decoration:underline dotted;cursor:help;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}ol,ul,dl{margin-top:0;margin-bottom:1rem}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:0.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:0.875em}mark{padding:0.1875em;color:var(--bs-highlight-color);background-color:var(--bs-highlight-bg)}sub,sup{position:relative;font-size:0.75em;line-height:0;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}a{color:rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));text-decoration:underline}a:hover{--bs-link-color-rgb:var(--bs-link-hover-color-rgb)}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}pre,code,kbd,samp{font-family:var(--bs-font-monospace);font-size:1em}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:0.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:0.875em;color:var(--bs-code-color);word-wrap:break-word}a>code{color:inherit}kbd{padding:0.1875rem 0.375rem;font-size:0.875em;color:var(--bs-body-bg);background-color:var(--bs-body-color);border-radius:0.25rem}kbd kbd{padding:0;font-size:1em}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:0.5rem;padding-bottom:0.5rem;color:var(--bs-secondary-color);text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}thead,tbody,tfoot,tr,td,th{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}input,button,select,optgroup,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator{display:none !important}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button:not(:disabled),[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:0.5rem;font-size:calc(1.275rem + 0.3vw);line-height:inherit}@media (min-width: 1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none !important}:root{--bs-breakpoint-xs:0;--bs-breakpoint-sm:576px;--bs-breakpoint-md:768px;--bs-breakpoint-lg:992px;--bs-breakpoint-xl:1200px;--bs-breakpoint-xxl:1400px}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-0.5 * var(--bs-gutter-x));margin-left:calc(-0.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * 0.5);padding-left:calc(var(--bs-gutter-x) * 0.5);margin-top:var(--bs-gutter-y)}.col{flex:1 0 0%}.row-cols-auto>*{flex:0 0 auto;width:auto}.row-cols-1>*{flex:0 0 auto;width:100%}.row-cols-2>*{flex:0 0 auto;width:50%}.row-cols-3>*{flex:0 0 auto;width:33.33333333%}.row-cols-4>*{flex:0 0 auto;width:25%}.row-cols-5>*{flex:0 0 auto;width:20%}.row-cols-6>*{flex:0 0 auto;width:16.66666667%}.col-auto{flex:0 0 auto;width:auto}.col-1{flex:0 0 auto;width:8.33333333%}.col-2{flex:0 0 auto;width:16.66666667%}.col-3{flex:0 0 auto;width:25%}.col-4{flex:0 0 auto;width:33.33333333%}.col-5{flex:0 0 auto;width:41.66666667%}.col-6{flex:0 0 auto;width:50%}.col-7{flex:0 0 auto;width:58.33333333%}.col-8{flex:0 0 auto;width:66.66666667%}.col-9{flex:0 0 auto;width:75%}.col-10{flex:0 0 auto;width:83.33333333%}.col-11{flex:0 0 auto;width:91.66666667%}.col-12{flex:0 0 auto;width:100%}.offset-1{margin-left:8.33333333%}.offset-2{margin-left:16.66666667%}.offset-3{margin-left:25%}.offset-4{margin-left:33.33333333%}.offset-5{margin-left:41.66666667%}.offset-6{margin-left:50%}.offset-7{margin-left:58.33333333%}.offset-8{margin-left:66.66666667%}.offset-9{margin-left:75%}.offset-10{margin-left:83.33333333%}.offset-11{margin-left:91.66666667%}.g-0,.gx-0{--bs-gutter-x:0}.g-0,.gy-0{--bs-gutter-y:0}.g-1,.gx-1{--bs-gutter-x:0.25rem}.g-1,.gy-1{--bs-gutter-y:0.25rem}.g-2,.gx-2{--bs-gutter-x:0.5rem}.g-2,.gy-2{--bs-gutter-y:0.5rem}.g-3,.gx-3{--bs-gutter-x:1rem}.g-3,.gy-3{--bs-gutter-y:1rem}.g-4,.gx-4{--bs-gutter-x:1.5rem}.g-4,.gy-4{--bs-gutter-y:1.5rem}.g-5,.gx-5{--bs-gutter-x:3rem}.g-5,.gy-5{--bs-gutter-y:3rem}@media (min-width: 576px){.col-sm{flex:1 0 0%}.row-cols-sm-auto>*{flex:0 0 auto;width:auto}.row-cols-sm-1>*{flex:0 0 auto;width:100%}.row-cols-sm-2>*{flex:0 0 auto;width:50%}.row-cols-sm-3>*{flex:0 0 auto;width:33.33333333%}.row-cols-sm-4>*{flex:0 0 auto;width:25%}.row-cols-sm-5>*{flex:0 0 auto;width:20%}.row-cols-sm-6>*{flex:0 0 auto;width:16.66666667%}.col-sm-auto{flex:0 0 auto;width:auto}.col-sm-1{flex:0 0 auto;width:8.33333333%}.col-sm-2{flex:0 0 auto;width:16.66666667%}.col-sm-3{flex:0 0 auto;width:25%}.col-sm-4{flex:0 0 auto;width:33.33333333%}.col-sm-5{flex:0 0 auto;width:41.66666667%}.col-sm-6{flex:0 0 auto;width:50%}.col-sm-7{flex:0 0 auto;width:58.33333333%}.col-sm-8{flex:0 0 auto;width:66.66666667%}.col-sm-9{flex:0 0 auto;width:75%}.col-sm-10{flex:0 0 auto;width:83.33333333%}.col-sm-11{flex:0 0 auto;width:91.66666667%}.col-sm-12{flex:0 0 auto;width:100%}.offset-sm-0{margin-left:0}.offset-sm-1{margin-left:8.33333333%}.offset-sm-2{margin-left:16.66666667%}.offset-sm-3{margin-left:25%}.offset-sm-4{margin-left:33.33333333%}.offset-sm-5{margin-left:41.66666667%}.offset-sm-6{margin-left:50%}.offset-sm-7{margin-left:58.33333333%}.offset-sm-8{margin-left:66.66666667%}.offset-sm-9{margin-left:75%}.offset-sm-10{margin-left:83.33333333%}.offset-sm-11{margin-left:91.66666667%}.g-sm-0,.gx-sm-0{--bs-gutter-x:0}.g-sm-0,.gy-sm-0{--bs-gutter-y:0}.g-sm-1,.gx-sm-1{--bs-gutter-x:0.25rem}.g-sm-1,.gy-sm-1{--bs-gutter-y:0.25rem}.g-sm-2,.gx-sm-2{--bs-gutter-x:0.5rem}.g-sm-2,.gy-sm-2{--bs-gutter-y:0.5rem}.g-sm-3,.gx-sm-3{--bs-gutter-x:1rem}.g-sm-3,.gy-sm-3{--bs-gutter-y:1rem}.g-sm-4,.gx-sm-4{--bs-gutter-x:1.5rem}.g-sm-4,.gy-sm-4{--bs-gutter-y:1.5rem}.g-sm-5,.gx-sm-5{--bs-gutter-x:3rem}.g-sm-5,.gy-sm-5{--bs-gutter-y:3rem}}@media (min-width: 768px){.col-md{flex:1 0 0%}.row-cols-md-auto>*{flex:0 0 auto;width:auto}.row-cols-md-1>*{flex:0 0 auto;width:100%}.row-cols-md-2>*{flex:0 0 auto;width:50%}.row-cols-md-3>*{flex:0 0 auto;width:33.33333333%}.row-cols-md-4>*{flex:0 0 auto;width:25%}.row-cols-md-5>*{flex:0 0 auto;width:20%}.row-cols-md-6>*{flex:0 0 auto;width:16.66666667%}.col-md-auto{flex:0 0 auto;width:auto}.col-md-1{flex:0 0 auto;width:8.33333333%}.col-md-2{flex:0 0 auto;width:16.66666667%}.col-md-3{flex:0 0 auto;width:25%}.col-md-4{flex:0 0 auto;width:33.33333333%}.col-md-5{flex:0 0 auto;width:41.66666667%}.col-md-6{flex:0 0 auto;width:50%}.col-md-7{flex:0 0 auto;width:58.33333333%}.col-md-8{flex:0 0 auto;width:66.66666667%}.col-md-9{flex:0 0 auto;width:75%}.col-md-10{flex:0 0 auto;width:83.33333333%}.col-md-11{flex:0 0 auto;width:91.66666667%}.col-md-12{flex:0 0 auto;width:100%}.offset-md-0{margin-left:0}.offset-md-1{margin-left:8.33333333%}.offset-md-2{margin-left:16.66666667%}.offset-md-3{margin-left:25%}.offset-md-4{margin-left:33.33333333%}.offset-md-5{margin-left:41.66666667%}.offset-md-6{margin-left:50%}.offset-md-7{margin-left:58.33333333%}.offset-md-8{margin-left:66.66666667%}.offset-md-9{margin-left:75%}.offset-md-10{margin-left:83.33333333%}.offset-md-11{margin-left:91.66666667%}.g-md-0,.gx-md-0{--bs-gutter-x:0}.g-md-0,.gy-md-0{--bs-gutter-y:0}.g-md-1,.gx-md-1{--bs-gutter-x:0.25rem}.g-md-1,.gy-md-1{--bs-gutter-y:0.25rem}.g-md-2,.gx-md-2{--bs-gutter-x:0.5rem}.g-md-2,.gy-md-2{--bs-gutter-y:0.5rem}.g-md-3,.gx-md-3{--bs-gutter-x:1rem}.g-md-3,.gy-md-3{--bs-gutter-y:1rem}.g-md-4,.gx-md-4{--bs-gutter-x:1.5rem}.g-md-4,.gy-md-4{--bs-gutter-y:1.5rem}.g-md-5,.gx-md-5{--bs-gutter-x:3rem}.g-md-5,.gy-md-5{--bs-gutter-y:3rem}}@media (min-width: 992px){.col-lg{flex:1 0 0%}.row-cols-lg-auto>*{flex:0 0 auto;width:auto}.row-cols-lg-1>*{flex:0 0 auto;width:100%}.row-cols-lg-2>*{flex:0 0 auto;width:50%}.row-cols-lg-3>*{flex:0 0 auto;width:33.33333333%}.row-cols-lg-4>*{flex:0 0 auto;width:25%}.row-cols-lg-5>*{flex:0 0 auto;width:20%}.row-cols-lg-6>*{flex:0 0 auto;width:16.66666667%}.col-lg-auto{flex:0 0 auto;width:auto}.col-lg-1{flex:0 0 auto;width:8.33333333%}.col-lg-2{flex:0 0 auto;width:16.66666667%}.col-lg-3{flex:0 0 auto;width:25%}.col-lg-4{flex:0 0 auto;width:33.33333333%}.col-lg-5{flex:0 0 auto;width:41.66666667%}.col-lg-6{flex:0 0 auto;width:50%}.col-lg-7{flex:0 0 auto;width:58.33333333%}.col-lg-8{flex:0 0 auto;width:66.66666667%}.col-lg-9{flex:0 0 auto;width:75%}.col-lg-10{flex:0 0 auto;width:83.33333333%}.col-lg-11{flex:0 0 auto;width:91.66666667%}.col-lg-12{flex:0 0 auto;width:100%}.offset-lg-0{margin-left:0}.offset-lg-1{margin-left:8.33333333%}.offset-lg-2{margin-left:16.66666667%}.offset-lg-3{margin-left:25%}.offset-lg-4{margin-left:33.33333333%}.offset-lg-5{margin-left:41.66666667%}.offset-lg-6{margin-left:50%}.offset-lg-7{margin-left:58.33333333%}.offset-lg-8{margin-left:66.66666667%}.offset-lg-9{margin-left:75%}.offset-lg-10{margin-left:83.33333333%}.offset-lg-11{margin-left:91.66666667%}.g-lg-0,.gx-lg-0{--bs-gutter-x:0}.g-lg-0,.gy-lg-0{--bs-gutter-y:0}.g-lg-1,.gx-lg-1{--bs-gutter-x:0.25rem}.g-lg-1,.gy-lg-1{--bs-gutter-y:0.25rem}.g-lg-2,.gx-lg-2{--bs-gutter-x:0.5rem}.g-lg-2,.gy-lg-2{--bs-gutter-y:0.5rem}.g-lg-3,.gx-lg-3{--bs-gutter-x:1rem}.g-lg-3,.gy-lg-3{--bs-gutter-y:1rem}.g-lg-4,.gx-lg-4{--bs-gutter-x:1.5rem}.g-lg-4,.gy-lg-4{--bs-gutter-y:1.5rem}.g-lg-5,.gx-lg-5{--bs-gutter-x:3rem}.g-lg-5,.gy-lg-5{--bs-gutter-y:3rem}}@media (min-width: 1200px){.col-xl{flex:1 0 0%}.row-cols-xl-auto>*{flex:0 0 auto;width:auto}.row-cols-xl-1>*{flex:0 0 auto;width:100%}.row-cols-xl-2>*{flex:0 0 auto;width:50%}.row-cols-xl-3>*{flex:0 0 auto;width:33.33333333%}.row-cols-xl-4>*{flex:0 0 auto;width:25%}.row-cols-xl-5>*{flex:0 0 auto;width:20%}.row-cols-xl-6>*{flex:0 0 auto;width:16.66666667%}.col-xl-auto{flex:0 0 auto;width:auto}.col-xl-1{flex:0 0 auto;width:8.33333333%}.col-xl-2{flex:0 0 auto;width:16.66666667%}.col-xl-3{flex:0 0 auto;width:25%}.col-xl-4{flex:0 0 auto;width:33.33333333%}.col-xl-5{flex:0 0 auto;width:41.66666667%}.col-xl-6{flex:0 0 auto;width:50%}.col-xl-7{flex:0 0 auto;width:58.33333333%}.col-xl-8{flex:0 0 auto;width:66.66666667%}.col-xl-9{flex:0 0 auto;width:75%}.col-xl-10{flex:0 0 auto;width:83.33333333%}.col-xl-11{flex:0 0 auto;width:91.66666667%}.col-xl-12{flex:0 0 auto;width:100%}.offset-xl-0{margin-left:0}.offset-xl-1{margin-left:8.33333333%}.offset-xl-2{margin-left:16.66666667%}.offset-xl-3{margin-left:25%}.offset-xl-4{margin-left:33.33333333%}.offset-xl-5{margin-left:41.66666667%}.offset-xl-6{margin-left:50%}.offset-xl-7{margin-left:58.33333333%}.offset-xl-8{margin-left:66.66666667%}.offset-xl-9{margin-left:75%}.offset-xl-10{margin-left:83.33333333%}.offset-xl-11{margin-left:91.66666667%}.g-xl-0,.gx-xl-0{--bs-gutter-x:0}.g-xl-0,.gy-xl-0{--bs-gutter-y:0}.g-xl-1,.gx-xl-1{--bs-gutter-x:0.25rem}.g-xl-1,.gy-xl-1{--bs-gutter-y:0.25rem}.g-xl-2,.gx-xl-2{--bs-gutter-x:0.5rem}.g-xl-2,.gy-xl-2{--bs-gutter-y:0.5rem}.g-xl-3,.gx-xl-3{--bs-gutter-x:1rem}.g-xl-3,.gy-xl-3{--bs-gutter-y:1rem}.g-xl-4,.gx-xl-4{--bs-gutter-x:1.5rem}.g-xl-4,.gy-xl-4{--bs-gutter-y:1.5rem}.g-xl-5,.gx-xl-5{--bs-gutter-x:3rem}.g-xl-5,.gy-xl-5{--bs-gutter-y:3rem}}@media (min-width: 1400px){.col-xxl{flex:1 0 0%}.row-cols-xxl-auto>*{flex:0 0 auto;width:auto}.row-cols-xxl-1>*{flex:0 0 auto;width:100%}.row-cols-xxl-2>*{flex:0 0 auto;width:50%}.row-cols-xxl-3>*{flex:0 0 auto;width:33.33333333%}.row-cols-xxl-4>*{flex:0 0 auto;width:25%}.row-cols-xxl-5>*{flex:0 0 auto;width:20%}.row-cols-xxl-6>*{flex:0 0 auto;width:16.66666667%}.col-xxl-auto{flex:0 0 auto;width:auto}.col-xxl-1{flex:0 0 auto;width:8.33333333%}.col-xxl-2{flex:0 0 auto;width:16.66666667%}.col-xxl-3{flex:0 0 auto;width:25%}.col-xxl-4{flex:0 0 auto;width:33.33333333%}.col-xxl-5{flex:0 0 auto;width:41.66666667%}.col-xxl-6{flex:0 0 auto;width:50%}.col-xxl-7{flex:0 0 auto;width:58.33333333%}.col-xxl-8{flex:0 0 auto;width:66.66666667%}.col-xxl-9{flex:0 0 auto;width:75%}.col-xxl-10{flex:0 0 auto;width:83.33333333%}.col-xxl-11{flex:0 0 auto;width:91.66666667%}.col-xxl-12{flex:0 0 auto;width:100%}.offset-xxl-0{margin-left:0}.offset-xxl-1{margin-left:8.33333333%}.offset-xxl-2{margin-left:16.66666667%}.offset-xxl-3{margin-left:25%}.offset-xxl-4{margin-left:33.33333333%}.offset-xxl-5{margin-left:41.66666667%}.offset-xxl-6{margin-left:50%}.offset-xxl-7{margin-left:58.33333333%}.offset-xxl-8{margin-left:66.66666667%}.offset-xxl-9{margin-left:75%}.offset-xxl-10{margin-left:83.33333333%}.offset-xxl-11{margin-left:91.66666667%}.g-xxl-0,.gx-xxl-0{--bs-gutter-x:0}.g-xxl-0,.gy-xxl-0{--bs-gutter-y:0}.g-xxl-1,.gx-xxl-1{--bs-gutter-x:0.25rem}.g-xxl-1,.gy-xxl-1{--bs-gutter-y:0.25rem}.g-xxl-2,.gx-xxl-2{--bs-gutter-x:0.5rem}.g-xxl-2,.gy-xxl-2{--bs-gutter-y:0.5rem}.g-xxl-3,.gx-xxl-3{--bs-gutter-x:1rem}.g-xxl-3,.gy-xxl-3{--bs-gutter-y:1rem}.g-xxl-4,.gx-xxl-4{--bs-gutter-x:1.5rem}.g-xxl-4,.gy-xxl-4{--bs-gutter-y:1.5rem}.g-xxl-5,.gx-xxl-5{--bs-gutter-x:3rem}.g-xxl-5,.gy-xxl-5{--bs-gutter-y:3rem}}:host{font-family:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;display:block}justifi-billing-form{margin-left:calc(var(--jfi-layout-padding) * -1);margin-right:calc(var(--jfi-layout-padding) * -1)}*::part(label){color:var(--jfi-form-label-color);font-family:var(--jfi-form-label-font-family);font-weight:var(--jfi-form-label-font-weight);font-size:var(--jfi-form-label-font-size);margin:var(--jfi-form-label-margin)}*::part(input){background-color:var(--jfi-form-control-background-color);border-color:var(--jfi-form-control-border-color);border-width:var(--jfi-form-control-border-width);border-bottom-width:var(--jfi-form-control-border-bottom-width);border-left-width:var(--jfi-form-control-border-left-width);border-right-width:var(--jfi-form-control-border-right-width);border-top-width:var(--jfi-form-control-border-top-width);border-radius:var(--jfi-form-control-border-radius);border-style:var(--jfi-form-control-border-style);box-shadow:var(--jfi-form-control-box-shadow);color:var(--jfi-form-control-color);font-size:var(--jfi-form-control-font-size);font-weight:var(--jfi-form-control-font-weight);line-height:var(--jfi-form-control-line-height);margin:var(--jfi-form-control-margin);padding:var(--jfi-form-control-padding)}*::part(input):focus{color:var(--jfi-form-control-color-focus);border-color:var(--jfi-form-control-border-color-focus);box-shadow:var(--jfi-form-control-box-shadow-focus)}*::part(input-invalid){border-color:var(--jfi-form-control-border-color-error);box-shadow:var(--jfi-form-control-box-shadow-error)}*::part(input-invalid):focus{border-color:var(--jfi-form-control-border-color-error);box-shadow:var(--jfi-form-control-box-shadow-error-focus)}";
24
+
25
+ const BillingForm = class {
26
+ constructor(hostRef) {
27
+ index.registerInstance(this, hostRef);
28
+ this.inputHandler = (name, value) => {
29
+ this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { [name]: value }));
30
+ };
31
+ this.legend = undefined;
32
+ this.formController = undefined;
33
+ this.billingInfo = undefined;
34
+ this.errors = {};
35
+ }
36
+ componentWillLoad() {
37
+ this.formController = new index_esm.FormController(BillingFormSchema);
38
+ }
39
+ componentDidLoad() {
40
+ this.formController.values.subscribe(values => this.billingInfo = Object.assign({}, values));
41
+ this.formController.errors.subscribe(errors => {
42
+ this.errors = Object.assign({}, errors);
43
+ });
44
+ }
45
+ async getValues() {
46
+ return this.formController.values.getValue();
47
+ }
48
+ async fill(fields) {
49
+ this.formController.setValues(fields);
50
+ }
51
+ async validate() {
52
+ let isValid = await this.formController.validate();
53
+ return { isValid: isValid };
54
+ }
55
+ render() {
56
+ const billingFormDefaultValue = this.formController.getInitialValues();
57
+ return (index.h(index.Host, { exportparts: "label,input,input-invalid" }, index.h("form", null, index.h("fieldset", null, this.legend && index.h("legend", null, this.legend), index.h("div", { class: "row gy-3" }, index.h("div", { class: "col-12" }, index.h("form-control-text", { name: 'name', label: 'Full Name', defaultValue: billingFormDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), index.h("div", { class: "col-12" }, index.h("form-control-text", { name: 'address_line1', label: 'Street Address', defaultValue: billingFormDefaultValue.address_line1, error: this.errors.address_line1, inputHandler: this.inputHandler })), index.h("div", { class: "col-12" }, index.h("form-control-text", { name: 'address_line2', label: "Apartment, Suite, etc. (optional)", defaultValue: billingFormDefaultValue.address_line2, error: this.errors.address_line2, inputHandler: this.inputHandler })), index.h("div", { class: "col-12" }, index.h("form-control-text", { name: 'address_city', label: "City", defaultValue: billingFormDefaultValue.address_city, error: this.errors.address_city, inputHandler: this.inputHandler })), index.h("div", { class: "col-12" }, index.h("form-control-select", { name: 'address_state', label: 'State', options: stateOptions.StateOptions, defaultValue: billingFormDefaultValue.address_state, error: this.errors.address_state, inputHandler: this.inputHandler })), index.h("div", { class: "col-12" }, index.h("form-control-text", { name: 'address_postal_code', label: "ZIP", defaultValue: billingFormDefaultValue.address_postal_code, error: this.errors.address_postal_code, inputHandler: this.inputHandler, maxLength: 5, keyDownHandler: utils.filterPostalInput })))))));
58
+ }
59
+ };
60
+ BillingForm.style = billingFormCss;
61
+
62
+ function createCommonjsModule(fn, basedir, module) {
63
+ return module = {
64
+ path: basedir,
65
+ exports: {},
66
+ require: function (path, base) {
67
+ return commonjsRequire();
68
+ }
69
+ }, fn(module, module.exports), module.exports;
70
+ }
71
+
72
+ function commonjsRequire () {
73
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
74
+ }
75
+
76
+ var iframeResizer = createCommonjsModule(function (module) {
77
+ (function (undefined$1) {
78
+ if (typeof window === 'undefined') return // don't run for server side render
79
+
80
+ var count = 0,
81
+ logEnabled = false,
82
+ hiddenCheckEnabled = false,
83
+ msgHeader = 'message',
84
+ msgHeaderLen = msgHeader.length,
85
+ msgId = '[iFrameSizer]', // Must match iframe msg ID
86
+ msgIdLen = msgId.length,
87
+ pagePosition = null,
88
+ requestAnimationFrame = window.requestAnimationFrame,
89
+ resetRequiredMethods = Object.freeze({
90
+ max: 1,
91
+ scroll: 1,
92
+ bodyScroll: 1,
93
+ documentElementScroll: 1
94
+ }),
95
+ settings = {},
96
+ timer = null,
97
+ defaults = Object.freeze({
98
+ autoResize: true,
99
+ bodyBackground: null,
100
+ bodyMargin: null,
101
+ bodyMarginV1: 8,
102
+ bodyPadding: null,
103
+ checkOrigin: true,
104
+ inPageLinks: false,
105
+ enablePublicMethods: true,
106
+ heightCalculationMethod: 'bodyOffset',
107
+ id: 'iFrameResizer',
108
+ interval: 32,
109
+ log: false,
110
+ maxHeight: Infinity,
111
+ maxWidth: Infinity,
112
+ minHeight: 0,
113
+ minWidth: 0,
114
+ mouseEvents: true,
115
+ resizeFrom: 'parent',
116
+ scrolling: false,
117
+ sizeHeight: true,
118
+ sizeWidth: false,
119
+ warningTimeout: 5000,
120
+ tolerance: 0,
121
+ widthCalculationMethod: 'scroll',
122
+ onClose: function () {
123
+ return true
124
+ },
125
+ onClosed: function () {},
126
+ onInit: function () {},
127
+ onMessage: function () {
128
+ warn('onMessage function not defined');
129
+ },
130
+ onMouseEnter: function () {},
131
+ onMouseLeave: function () {},
132
+ onResized: function () {},
133
+ onScroll: function () {
134
+ return true
135
+ }
136
+ });
137
+
138
+ function getMutationObserver() {
139
+ return (
140
+ window.MutationObserver ||
141
+ window.WebKitMutationObserver ||
142
+ window.MozMutationObserver
143
+ )
144
+ }
145
+
146
+ function addEventListener(el, evt, func) {
147
+ el.addEventListener(evt, func, false);
148
+ }
149
+
150
+ function removeEventListener(el, evt, func) {
151
+ el.removeEventListener(evt, func, false);
152
+ }
153
+
154
+ function setupRequestAnimationFrame() {
155
+ var vendors = ['moz', 'webkit', 'o', 'ms'];
156
+ var x;
157
+
158
+ // Remove vendor prefixing if prefixed and break early if not
159
+ for (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {
160
+ requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
161
+ }
162
+
163
+ if (requestAnimationFrame) {
164
+ // Firefox extension content-scripts have a globalThis object that is not the same as window.
165
+ // Binding `requestAnimationFrame` to window allows the function to work and prevents errors
166
+ // being thrown when run in that context, and should be a no-op in every other context.
167
+ requestAnimationFrame = requestAnimationFrame.bind(window);
168
+ } else {
169
+ log('setup', 'RequestAnimationFrame not supported');
170
+ }
171
+ }
172
+
173
+ function getMyID(iframeId) {
174
+ var retStr = 'Host page: ' + iframeId;
175
+
176
+ if (window.top !== window.self) {
177
+ retStr =
178
+ window.parentIFrame && window.parentIFrame.getId
179
+ ? window.parentIFrame.getId() + ': ' + iframeId
180
+ : 'Nested host page: ' + iframeId;
181
+ }
182
+
183
+ return retStr
184
+ }
185
+
186
+ function formatLogHeader(iframeId) {
187
+ return msgId + '[' + getMyID(iframeId) + ']'
188
+ }
189
+
190
+ function isLogEnabled(iframeId) {
191
+ return settings[iframeId] ? settings[iframeId].log : logEnabled
192
+ }
193
+
194
+ function log(iframeId, msg) {
195
+ output('log', iframeId, msg, isLogEnabled(iframeId));
196
+ }
197
+
198
+ function info(iframeId, msg) {
199
+ output('info', iframeId, msg, isLogEnabled(iframeId));
200
+ }
201
+
202
+ function warn(iframeId, msg) {
203
+ output('warn', iframeId, msg, true);
204
+ }
205
+
206
+ function output(type, iframeId, msg, enabled) {
207
+ if (true === enabled && 'object' === typeof window.console) {
208
+ // eslint-disable-next-line no-console
209
+ console[type](formatLogHeader(iframeId), msg);
210
+ }
211
+ }
212
+
213
+ function iFrameListener(event) {
214
+ function resizeIFrame() {
215
+ function resize() {
216
+ setSize(messageData);
217
+ setPagePosition(iframeId);
218
+ on('onResized', messageData);
219
+ }
220
+
221
+ ensureInRange('Height');
222
+ ensureInRange('Width');
223
+
224
+ syncResize(resize, messageData, 'init');
225
+ }
226
+
227
+ function processMsg() {
228
+ var data = msg.slice(msgIdLen).split(':');
229
+ var height = data[1] ? parseInt(data[1], 10) : 0;
230
+ var iframe = settings[data[0]] && settings[data[0]].iframe;
231
+ var compStyle = getComputedStyle(iframe);
232
+
233
+ return {
234
+ iframe: iframe,
235
+ id: data[0],
236
+ height: height + getPaddingEnds(compStyle) + getBorderEnds(compStyle),
237
+ width: data[2],
238
+ type: data[3]
239
+ }
240
+ }
241
+
242
+ function getPaddingEnds(compStyle) {
243
+ if (compStyle.boxSizing !== 'border-box') {
244
+ return 0
245
+ }
246
+ var top = compStyle.paddingTop ? parseInt(compStyle.paddingTop, 10) : 0;
247
+ var bot = compStyle.paddingBottom
248
+ ? parseInt(compStyle.paddingBottom, 10)
249
+ : 0;
250
+ return top + bot
251
+ }
252
+
253
+ function getBorderEnds(compStyle) {
254
+ if (compStyle.boxSizing !== 'border-box') {
255
+ return 0
256
+ }
257
+ var top = compStyle.borderTopWidth
258
+ ? parseInt(compStyle.borderTopWidth, 10)
259
+ : 0;
260
+ var bot = compStyle.borderBottomWidth
261
+ ? parseInt(compStyle.borderBottomWidth, 10)
262
+ : 0;
263
+ return top + bot
264
+ }
265
+
266
+ function ensureInRange(Dimension) {
267
+ var max = Number(settings[iframeId]['max' + Dimension]),
268
+ min = Number(settings[iframeId]['min' + Dimension]),
269
+ dimension = Dimension.toLowerCase(),
270
+ size = Number(messageData[dimension]);
271
+
272
+ log(iframeId, 'Checking ' + dimension + ' is in range ' + min + '-' + max);
273
+
274
+ if (size < min) {
275
+ size = min;
276
+ log(iframeId, 'Set ' + dimension + ' to min value');
277
+ }
278
+
279
+ if (size > max) {
280
+ size = max;
281
+ log(iframeId, 'Set ' + dimension + ' to max value');
282
+ }
283
+
284
+ messageData[dimension] = '' + size;
285
+ }
286
+
287
+ function isMessageFromIFrame() {
288
+ function checkAllowedOrigin() {
289
+ function checkList() {
290
+ var i = 0,
291
+ retCode = false;
292
+
293
+ log(
294
+ iframeId,
295
+ 'Checking connection is from allowed list of origins: ' +
296
+ checkOrigin
297
+ );
298
+
299
+ for (; i < checkOrigin.length; i++) {
300
+ if (checkOrigin[i] === origin) {
301
+ retCode = true;
302
+ break
303
+ }
304
+ }
305
+ return retCode
306
+ }
307
+
308
+ function checkSingle() {
309
+ var remoteHost = settings[iframeId] && settings[iframeId].remoteHost;
310
+ log(iframeId, 'Checking connection is from: ' + remoteHost);
311
+ return origin === remoteHost
312
+ }
313
+
314
+ return checkOrigin.constructor === Array ? checkList() : checkSingle()
315
+ }
316
+
317
+ var origin = event.origin,
318
+ checkOrigin = settings[iframeId] && settings[iframeId].checkOrigin;
319
+
320
+ if (checkOrigin && '' + origin !== 'null' && !checkAllowedOrigin()) {
321
+ throw new Error(
322
+ 'Unexpected message received from: ' +
323
+ origin +
324
+ ' for ' +
325
+ messageData.iframe.id +
326
+ '. Message was: ' +
327
+ event.data +
328
+ '. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.'
329
+ )
330
+ }
331
+
332
+ return true
333
+ }
334
+
335
+ function isMessageForUs() {
336
+ return (
337
+ msgId === ('' + msg).slice(0, msgIdLen) &&
338
+ msg.slice(msgIdLen).split(':')[0] in settings
339
+ ) // ''+Protects against non-string msg
340
+ }
341
+
342
+ function isMessageFromMetaParent() {
343
+ // Test if this message is from a parent above us. This is an ugly test, however, updating
344
+ // the message format would break backwards compatibility.
345
+ var retCode = messageData.type in { true: 1, false: 1, undefined: 1 };
346
+
347
+ if (retCode) {
348
+ log(iframeId, 'Ignoring init message from meta parent page');
349
+ }
350
+
351
+ return retCode
352
+ }
353
+
354
+ function getMsgBody(offset) {
355
+ return msg.slice(msg.indexOf(':') + msgHeaderLen + offset)
356
+ }
357
+
358
+ function forwardMsgFromIFrame(msgBody) {
359
+ log(
360
+ iframeId,
361
+ 'onMessage passed: {iframe: ' +
362
+ messageData.iframe.id +
363
+ ', message: ' +
364
+ msgBody +
365
+ '}'
366
+ );
367
+
368
+ on('onMessage', {
369
+ iframe: messageData.iframe,
370
+ message: JSON.parse(msgBody)
371
+ });
372
+
373
+ log(iframeId, '--');
374
+ }
375
+
376
+ function getPageInfo() {
377
+ var bodyPosition = document.body.getBoundingClientRect(),
378
+ iFramePosition = messageData.iframe.getBoundingClientRect();
379
+
380
+ return JSON.stringify({
381
+ iframeHeight: iFramePosition.height,
382
+ iframeWidth: iFramePosition.width,
383
+ clientHeight: Math.max(
384
+ document.documentElement.clientHeight,
385
+ window.innerHeight || 0
386
+ ),
387
+ clientWidth: Math.max(
388
+ document.documentElement.clientWidth,
389
+ window.innerWidth || 0
390
+ ),
391
+ offsetTop: parseInt(iFramePosition.top - bodyPosition.top, 10),
392
+ offsetLeft: parseInt(iFramePosition.left - bodyPosition.left, 10),
393
+ scrollTop: window.pageYOffset,
394
+ scrollLeft: window.pageXOffset,
395
+ documentHeight: document.documentElement.clientHeight,
396
+ documentWidth: document.documentElement.clientWidth,
397
+ windowHeight: window.innerHeight,
398
+ windowWidth: window.innerWidth
399
+ })
400
+ }
401
+
402
+ function sendPageInfoToIframe(iframe, iframeId) {
403
+ function debouncedTrigger() {
404
+ trigger('Send Page Info', 'pageInfo:' + getPageInfo(), iframe, iframeId);
405
+ }
406
+ debounceFrameEvents(debouncedTrigger, 32, iframeId);
407
+ }
408
+
409
+ function startPageInfoMonitor() {
410
+ function setListener(type, func) {
411
+ function sendPageInfo() {
412
+ if (settings[id]) {
413
+ sendPageInfoToIframe(settings[id].iframe, id);
414
+ } else {
415
+ stop();
416
+ }
417
+ }
418
+ ['scroll', 'resize'].forEach(function (evt) {
419
+ log(id, type + evt + ' listener for sendPageInfo');
420
+ func(window, evt, sendPageInfo);
421
+ });
422
+ }
423
+
424
+ function stop() {
425
+ setListener('Remove ', removeEventListener);
426
+ }
427
+
428
+ function start() {
429
+ setListener('Add ', addEventListener);
430
+ }
431
+
432
+ var id = iframeId; // Create locally scoped copy of iFrame ID
433
+
434
+ start();
435
+
436
+ if (settings[id]) {
437
+ settings[id].stopPageInfo = stop;
438
+ }
439
+ }
440
+
441
+ function stopPageInfoMonitor() {
442
+ if (settings[iframeId] && settings[iframeId].stopPageInfo) {
443
+ settings[iframeId].stopPageInfo();
444
+ delete settings[iframeId].stopPageInfo;
445
+ }
446
+ }
447
+
448
+ function checkIFrameExists() {
449
+ var retBool = true;
450
+
451
+ if (null === messageData.iframe) {
452
+ warn(iframeId, 'IFrame (' + messageData.id + ') not found');
453
+ retBool = false;
454
+ }
455
+ return retBool
456
+ }
457
+
458
+ function getElementPosition(target) {
459
+ var iFramePosition = target.getBoundingClientRect();
460
+
461
+ getPagePosition(iframeId);
462
+
463
+ return {
464
+ x: Math.floor(Number(iFramePosition.left) + Number(pagePosition.x)),
465
+ y: Math.floor(Number(iFramePosition.top) + Number(pagePosition.y))
466
+ }
467
+ }
468
+
469
+ function scrollRequestFromChild(addOffset) {
470
+ /* istanbul ignore next */ // Not testable in Karma
471
+ function reposition() {
472
+ pagePosition = newPosition;
473
+ scrollTo();
474
+ log(iframeId, '--');
475
+ }
476
+
477
+ function calcOffset() {
478
+ return {
479
+ x: Number(messageData.width) + offset.x,
480
+ y: Number(messageData.height) + offset.y
481
+ }
482
+ }
483
+
484
+ function scrollParent() {
485
+ if (window.parentIFrame) {
486
+ window.parentIFrame['scrollTo' + (addOffset ? 'Offset' : '')](
487
+ newPosition.x,
488
+ newPosition.y
489
+ );
490
+ } else {
491
+ warn(
492
+ iframeId,
493
+ 'Unable to scroll to requested position, window.parentIFrame not found'
494
+ );
495
+ }
496
+ }
497
+
498
+ var offset = addOffset
499
+ ? getElementPosition(messageData.iframe)
500
+ : { x: 0, y: 0 },
501
+ newPosition = calcOffset();
502
+
503
+ log(
504
+ iframeId,
505
+ 'Reposition requested from iFrame (offset x:' +
506
+ offset.x +
507
+ ' y:' +
508
+ offset.y +
509
+ ')'
510
+ );
511
+
512
+ if (window.top === window.self) {
513
+ reposition();
514
+ } else {
515
+ scrollParent();
516
+ }
517
+ }
518
+
519
+ function scrollTo() {
520
+ if (false === on('onScroll', pagePosition)) {
521
+ unsetPagePosition();
522
+ } else {
523
+ setPagePosition(iframeId);
524
+ }
525
+ }
526
+
527
+ function findTarget(location) {
528
+ function jumpToTarget() {
529
+ var jumpPosition = getElementPosition(target);
530
+
531
+ log(
532
+ iframeId,
533
+ 'Moving to in page link (#' +
534
+ hash +
535
+ ') at x: ' +
536
+ jumpPosition.x +
537
+ ' y: ' +
538
+ jumpPosition.y
539
+ );
540
+ pagePosition = {
541
+ x: jumpPosition.x,
542
+ y: jumpPosition.y
543
+ };
544
+
545
+ scrollTo();
546
+ log(iframeId, '--');
547
+ }
548
+
549
+ function jumpToParent() {
550
+ if (window.parentIFrame) {
551
+ window.parentIFrame.moveToAnchor(hash);
552
+ } else {
553
+ log(
554
+ iframeId,
555
+ 'In page link #' +
556
+ hash +
557
+ ' not found and window.parentIFrame not found'
558
+ );
559
+ }
560
+ }
561
+
562
+ var hash = location.split('#')[1] || '',
563
+ hashData = decodeURIComponent(hash),
564
+ target =
565
+ document.getElementById(hashData) ||
566
+ document.getElementsByName(hashData)[0];
567
+
568
+ if (target) {
569
+ jumpToTarget();
570
+ } else if (window.top === window.self) {
571
+ log(iframeId, 'In page link #' + hash + ' not found');
572
+ } else {
573
+ jumpToParent();
574
+ }
575
+ }
576
+
577
+ function onMouse(event) {
578
+ var mousePos = {};
579
+
580
+ if (Number(messageData.width) === 0 && Number(messageData.height) === 0) {
581
+ var data = getMsgBody(9).split(':');
582
+ mousePos = {
583
+ x: data[1],
584
+ y: data[0]
585
+ };
586
+ } else {
587
+ mousePos = {
588
+ x: messageData.width,
589
+ y: messageData.height
590
+ };
591
+ }
592
+
593
+ on(event, {
594
+ iframe: messageData.iframe,
595
+ screenX: Number(mousePos.x),
596
+ screenY: Number(mousePos.y),
597
+ type: messageData.type
598
+ });
599
+ }
600
+
601
+ function on(funcName, val) {
602
+ return chkEvent(iframeId, funcName, val)
603
+ }
604
+
605
+ function actionMsg() {
606
+ if (settings[iframeId] && settings[iframeId].firstRun) firstRun();
607
+
608
+ switch (messageData.type) {
609
+ case 'close': {
610
+ closeIFrame(messageData.iframe);
611
+ break
612
+ }
613
+
614
+ case 'message': {
615
+ forwardMsgFromIFrame(getMsgBody(6));
616
+ break
617
+ }
618
+
619
+ case 'mouseenter': {
620
+ onMouse('onMouseEnter');
621
+ break
622
+ }
623
+
624
+ case 'mouseleave': {
625
+ onMouse('onMouseLeave');
626
+ break
627
+ }
628
+
629
+ case 'autoResize': {
630
+ settings[iframeId].autoResize = JSON.parse(getMsgBody(9));
631
+ break
632
+ }
633
+
634
+ case 'scrollTo': {
635
+ scrollRequestFromChild(false);
636
+ break
637
+ }
638
+
639
+ case 'scrollToOffset': {
640
+ scrollRequestFromChild(true);
641
+ break
642
+ }
643
+
644
+ case 'pageInfo': {
645
+ sendPageInfoToIframe(
646
+ settings[iframeId] && settings[iframeId].iframe,
647
+ iframeId
648
+ );
649
+ startPageInfoMonitor();
650
+ break
651
+ }
652
+
653
+ case 'pageInfoStop': {
654
+ stopPageInfoMonitor();
655
+ break
656
+ }
657
+
658
+ case 'inPageLink': {
659
+ findTarget(getMsgBody(9));
660
+ break
661
+ }
662
+
663
+ case 'reset': {
664
+ resetIFrame(messageData);
665
+ break
666
+ }
667
+
668
+ case 'init': {
669
+ resizeIFrame();
670
+ on('onInit', messageData.iframe);
671
+ break
672
+ }
673
+
674
+ default: {
675
+ if (
676
+ Number(messageData.width) === 0 &&
677
+ Number(messageData.height) === 0
678
+ ) {
679
+ warn(
680
+ 'Unsupported message received (' +
681
+ messageData.type +
682
+ '), this is likely due to the iframe containing a later ' +
683
+ 'version of iframe-resizer than the parent page'
684
+ );
685
+ } else {
686
+ resizeIFrame();
687
+ }
688
+ }
689
+ }
690
+ }
691
+
692
+ function hasSettings(iframeId) {
693
+ var retBool = true;
694
+
695
+ if (!settings[iframeId]) {
696
+ retBool = false;
697
+ warn(
698
+ messageData.type +
699
+ ' No settings for ' +
700
+ iframeId +
701
+ '. Message was: ' +
702
+ msg
703
+ );
704
+ }
705
+
706
+ return retBool
707
+ }
708
+
709
+ function iFrameReadyMsgReceived() {
710
+ // eslint-disable-next-line no-restricted-syntax, guard-for-in
711
+ for (var iframeId in settings) {
712
+ trigger(
713
+ 'iFrame requested init',
714
+ createOutgoingMsg(iframeId),
715
+ settings[iframeId].iframe,
716
+ iframeId
717
+ );
718
+ }
719
+ }
720
+
721
+ function firstRun() {
722
+ if (settings[iframeId]) {
723
+ settings[iframeId].firstRun = false;
724
+ }
725
+ }
726
+
727
+ var msg = event.data,
728
+ messageData = {},
729
+ iframeId = null;
730
+
731
+ if ('[iFrameResizerChild]Ready' === msg) {
732
+ iFrameReadyMsgReceived();
733
+ } else if (isMessageForUs()) {
734
+ messageData = processMsg();
735
+ iframeId = messageData.id;
736
+ if (settings[iframeId]) {
737
+ settings[iframeId].loaded = true;
738
+ }
739
+
740
+ if (!isMessageFromMetaParent() && hasSettings(iframeId)) {
741
+ log(iframeId, 'Received: ' + msg);
742
+
743
+ if (checkIFrameExists() && isMessageFromIFrame()) {
744
+ actionMsg();
745
+ }
746
+ }
747
+ } else {
748
+ info(iframeId, 'Ignored: ' + msg);
749
+ }
750
+ }
751
+
752
+ function chkEvent(iframeId, funcName, val) {
753
+ var func = null,
754
+ retVal = null;
755
+
756
+ if (settings[iframeId]) {
757
+ func = settings[iframeId][funcName];
758
+
759
+ if ('function' === typeof func) {
760
+ retVal = func(val);
761
+ } else {
762
+ throw new TypeError(
763
+ funcName + ' on iFrame[' + iframeId + '] is not a function'
764
+ )
765
+ }
766
+ }
767
+
768
+ return retVal
769
+ }
770
+
771
+ function removeIframeListeners(iframe) {
772
+ var iframeId = iframe.id;
773
+ delete settings[iframeId];
774
+ }
775
+
776
+ function closeIFrame(iframe) {
777
+ var iframeId = iframe.id;
778
+ if (chkEvent(iframeId, 'onClose', iframeId) === false) {
779
+ log(iframeId, 'Close iframe cancelled by onClose event');
780
+ return
781
+ }
782
+ log(iframeId, 'Removing iFrame: ' + iframeId);
783
+
784
+ try {
785
+ // Catch race condition error with React
786
+ if (iframe.parentNode) {
787
+ iframe.parentNode.removeChild(iframe);
788
+ }
789
+ } catch (error) {
790
+ warn(error);
791
+ }
792
+
793
+ chkEvent(iframeId, 'onClosed', iframeId);
794
+ log(iframeId, '--');
795
+ removeIframeListeners(iframe);
796
+ }
797
+
798
+ function getPagePosition(iframeId) {
799
+ if (null === pagePosition) {
800
+ pagePosition = {
801
+ x:
802
+ window.pageXOffset === undefined$1
803
+ ? document.documentElement.scrollLeft
804
+ : window.pageXOffset,
805
+ y:
806
+ window.pageYOffset === undefined$1
807
+ ? document.documentElement.scrollTop
808
+ : window.pageYOffset
809
+ };
810
+ log(
811
+ iframeId,
812
+ 'Get page position: ' + pagePosition.x + ',' + pagePosition.y
813
+ );
814
+ }
815
+ }
816
+
817
+ function setPagePosition(iframeId) {
818
+ if (null !== pagePosition) {
819
+ window.scrollTo(pagePosition.x, pagePosition.y);
820
+ log(
821
+ iframeId,
822
+ 'Set page position: ' + pagePosition.x + ',' + pagePosition.y
823
+ );
824
+ unsetPagePosition();
825
+ }
826
+ }
827
+
828
+ function unsetPagePosition() {
829
+ pagePosition = null;
830
+ }
831
+
832
+ function resetIFrame(messageData) {
833
+ function reset() {
834
+ setSize(messageData);
835
+ trigger('reset', 'reset', messageData.iframe, messageData.id);
836
+ }
837
+
838
+ log(
839
+ messageData.id,
840
+ 'Size reset requested by ' +
841
+ ('init' === messageData.type ? 'host page' : 'iFrame')
842
+ );
843
+ getPagePosition(messageData.id);
844
+ syncResize(reset, messageData, 'reset');
845
+ }
846
+
847
+ function setSize(messageData) {
848
+ function setDimension(dimension) {
849
+ if (!messageData.id) {
850
+ log('undefined', 'messageData id not set');
851
+ return
852
+ }
853
+ messageData.iframe.style[dimension] = messageData[dimension] + 'px';
854
+ log(
855
+ messageData.id,
856
+ 'IFrame (' +
857
+ iframeId +
858
+ ') ' +
859
+ dimension +
860
+ ' set to ' +
861
+ messageData[dimension] +
862
+ 'px'
863
+ );
864
+ }
865
+
866
+ function chkZero(dimension) {
867
+ // FireFox sets dimension of hidden iFrames to zero.
868
+ // So if we detect that set up an event to check for
869
+ // when iFrame becomes visible.
870
+
871
+ /* istanbul ignore next */ // Not testable in PhantomJS
872
+ if (!hiddenCheckEnabled && '0' === messageData[dimension]) {
873
+ hiddenCheckEnabled = true;
874
+ log(iframeId, 'Hidden iFrame detected, creating visibility listener');
875
+ fixHiddenIFrames();
876
+ }
877
+ }
878
+
879
+ function processDimension(dimension) {
880
+ setDimension(dimension);
881
+ chkZero(dimension);
882
+ }
883
+
884
+ var iframeId = messageData.iframe.id;
885
+
886
+ if (settings[iframeId]) {
887
+ if (settings[iframeId].sizeHeight) {
888
+ processDimension('height');
889
+ }
890
+ if (settings[iframeId].sizeWidth) {
891
+ processDimension('width');
892
+ }
893
+ }
894
+ }
895
+
896
+ function syncResize(func, messageData, doNotSync) {
897
+ /* istanbul ignore if */ // Not testable in PhantomJS
898
+ if (
899
+ doNotSync !== messageData.type &&
900
+ requestAnimationFrame &&
901
+ // including check for jasmine because had trouble getting spy to work in unit test using requestAnimationFrame
902
+ !window.jasmine
903
+ ) {
904
+ log(messageData.id, 'Requesting animation frame');
905
+ requestAnimationFrame(func);
906
+ } else {
907
+ func();
908
+ }
909
+ }
910
+
911
+ function trigger(calleeMsg, msg, iframe, id, noResponseWarning) {
912
+ function postMessageToIFrame() {
913
+ var target = settings[id] && settings[id].targetOrigin;
914
+ log(
915
+ id,
916
+ '[' +
917
+ calleeMsg +
918
+ '] Sending msg to iframe[' +
919
+ id +
920
+ '] (' +
921
+ msg +
922
+ ') targetOrigin: ' +
923
+ target
924
+ );
925
+ iframe.contentWindow.postMessage(msgId + msg, target);
926
+ }
927
+
928
+ function iFrameNotFound() {
929
+ warn(id, '[' + calleeMsg + '] IFrame(' + id + ') not found');
930
+ }
931
+
932
+ function chkAndSend() {
933
+ if (
934
+ iframe &&
935
+ 'contentWindow' in iframe &&
936
+ null !== iframe.contentWindow
937
+ ) {
938
+ // Null test for PhantomJS
939
+ postMessageToIFrame();
940
+ } else {
941
+ iFrameNotFound();
942
+ }
943
+ }
944
+
945
+ function warnOnNoResponse() {
946
+ function warning() {
947
+ if (settings[id] && !settings[id].loaded && !errorShown) {
948
+ errorShown = true;
949
+ warn(
950
+ id,
951
+ 'IFrame has not responded within ' +
952
+ settings[id].warningTimeout / 1000 +
953
+ ' seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning.'
954
+ );
955
+ }
956
+ }
957
+
958
+ if (
959
+ !!noResponseWarning &&
960
+ settings[id] &&
961
+ !!settings[id].warningTimeout
962
+ ) {
963
+ settings[id].msgTimeout = setTimeout(
964
+ warning,
965
+ settings[id].warningTimeout
966
+ );
967
+ }
968
+ }
969
+
970
+ var errorShown = false;
971
+
972
+ id = id || iframe.id;
973
+
974
+ if (settings[id]) {
975
+ chkAndSend();
976
+ warnOnNoResponse();
977
+ }
978
+ }
979
+
980
+ function createOutgoingMsg(iframeId) {
981
+ return (
982
+ iframeId +
983
+ ':' +
984
+ settings[iframeId].bodyMarginV1 +
985
+ ':' +
986
+ settings[iframeId].sizeWidth +
987
+ ':' +
988
+ settings[iframeId].log +
989
+ ':' +
990
+ settings[iframeId].interval +
991
+ ':' +
992
+ settings[iframeId].enablePublicMethods +
993
+ ':' +
994
+ settings[iframeId].autoResize +
995
+ ':' +
996
+ settings[iframeId].bodyMargin +
997
+ ':' +
998
+ settings[iframeId].heightCalculationMethod +
999
+ ':' +
1000
+ settings[iframeId].bodyBackground +
1001
+ ':' +
1002
+ settings[iframeId].bodyPadding +
1003
+ ':' +
1004
+ settings[iframeId].tolerance +
1005
+ ':' +
1006
+ settings[iframeId].inPageLinks +
1007
+ ':' +
1008
+ settings[iframeId].resizeFrom +
1009
+ ':' +
1010
+ settings[iframeId].widthCalculationMethod +
1011
+ ':' +
1012
+ settings[iframeId].mouseEvents
1013
+ )
1014
+ }
1015
+
1016
+ function isNumber(value) {
1017
+ return typeof value === 'number'
1018
+ }
1019
+
1020
+ function setupIFrame(iframe, options) {
1021
+ function setLimits() {
1022
+ function addStyle(style) {
1023
+ var styleValue = settings[iframeId][style];
1024
+ if (Infinity !== styleValue && 0 !== styleValue) {
1025
+ iframe.style[style] = isNumber(styleValue)
1026
+ ? styleValue + 'px'
1027
+ : styleValue;
1028
+ log(iframeId, 'Set ' + style + ' = ' + iframe.style[style]);
1029
+ }
1030
+ }
1031
+
1032
+ function chkMinMax(dimension) {
1033
+ if (
1034
+ settings[iframeId]['min' + dimension] >
1035
+ settings[iframeId]['max' + dimension]
1036
+ ) {
1037
+ throw new Error(
1038
+ 'Value for min' +
1039
+ dimension +
1040
+ ' can not be greater than max' +
1041
+ dimension
1042
+ )
1043
+ }
1044
+ }
1045
+
1046
+ chkMinMax('Height');
1047
+ chkMinMax('Width');
1048
+
1049
+ addStyle('maxHeight');
1050
+ addStyle('minHeight');
1051
+ addStyle('maxWidth');
1052
+ addStyle('minWidth');
1053
+ }
1054
+
1055
+ function newId() {
1056
+ var id = (options && options.id) || defaults.id + count++;
1057
+ if (null !== document.getElementById(id)) {
1058
+ id += count++;
1059
+ }
1060
+ return id
1061
+ }
1062
+
1063
+ function ensureHasId(iframeId) {
1064
+ if (typeof iframeId !== 'string') {
1065
+ throw new TypeError('Invaild id for iFrame. Expected String')
1066
+ }
1067
+
1068
+ if ('' === iframeId) {
1069
+ // eslint-disable-next-line no-multi-assign
1070
+ iframe.id = iframeId = newId();
1071
+ logEnabled = (options || {}).log;
1072
+ log(
1073
+ iframeId,
1074
+ 'Added missing iframe ID: ' + iframeId + ' (' + iframe.src + ')'
1075
+ );
1076
+ }
1077
+
1078
+ return iframeId
1079
+ }
1080
+
1081
+ function setScrolling() {
1082
+ log(
1083
+ iframeId,
1084
+ 'IFrame scrolling ' +
1085
+ (settings[iframeId] && settings[iframeId].scrolling
1086
+ ? 'enabled'
1087
+ : 'disabled') +
1088
+ ' for ' +
1089
+ iframeId
1090
+ );
1091
+ iframe.style.overflow =
1092
+ false === (settings[iframeId] && settings[iframeId].scrolling)
1093
+ ? 'hidden'
1094
+ : 'auto';
1095
+ switch (settings[iframeId] && settings[iframeId].scrolling) {
1096
+ case 'omit': {
1097
+ break
1098
+ }
1099
+
1100
+ case true: {
1101
+ iframe.scrolling = 'yes';
1102
+ break
1103
+ }
1104
+
1105
+ case false: {
1106
+ iframe.scrolling = 'no';
1107
+ break
1108
+ }
1109
+
1110
+ default: {
1111
+ iframe.scrolling = settings[iframeId]
1112
+ ? settings[iframeId].scrolling
1113
+ : 'no';
1114
+ }
1115
+ }
1116
+ }
1117
+
1118
+ // The V1 iFrame script expects an int, where as in V2 expects a CSS
1119
+ // string value such as '1px 3em', so if we have an int for V2, set V1=V2
1120
+ // and then convert V2 to a string PX value.
1121
+ function setupBodyMarginValues() {
1122
+ if (
1123
+ 'number' ===
1124
+ typeof (settings[iframeId] && settings[iframeId].bodyMargin) ||
1125
+ '0' === (settings[iframeId] && settings[iframeId].bodyMargin)
1126
+ ) {
1127
+ settings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin;
1128
+ settings[iframeId].bodyMargin =
1129
+ '' + settings[iframeId].bodyMargin + 'px';
1130
+ }
1131
+ }
1132
+
1133
+ function checkReset() {
1134
+ // Reduce scope of firstRun to function, because IE8's JS execution
1135
+ // context stack is borked and this value gets externally
1136
+ // changed midway through running this function!!!
1137
+ var firstRun = settings[iframeId] && settings[iframeId].firstRun,
1138
+ resetRequertMethod =
1139
+ settings[iframeId] &&
1140
+ settings[iframeId].heightCalculationMethod in resetRequiredMethods;
1141
+
1142
+ if (!firstRun && resetRequertMethod) {
1143
+ resetIFrame({ iframe: iframe, height: 0, width: 0, type: 'init' });
1144
+ }
1145
+ }
1146
+
1147
+ function setupIFrameObject() {
1148
+ if (settings[iframeId]) {
1149
+ settings[iframeId].iframe.iFrameResizer = {
1150
+ close: closeIFrame.bind(null, settings[iframeId].iframe),
1151
+
1152
+ removeListeners: removeIframeListeners.bind(
1153
+ null,
1154
+ settings[iframeId].iframe
1155
+ ),
1156
+
1157
+ resize: trigger.bind(
1158
+ null,
1159
+ 'Window resize',
1160
+ 'resize',
1161
+ settings[iframeId].iframe
1162
+ ),
1163
+
1164
+ moveToAnchor: function (anchor) {
1165
+ trigger(
1166
+ 'Move to anchor',
1167
+ 'moveToAnchor:' + anchor,
1168
+ settings[iframeId].iframe,
1169
+ iframeId
1170
+ );
1171
+ },
1172
+
1173
+ sendMessage: function (message) {
1174
+ message = JSON.stringify(message);
1175
+ trigger(
1176
+ 'Send Message',
1177
+ 'message:' + message,
1178
+ settings[iframeId].iframe,
1179
+ iframeId
1180
+ );
1181
+ }
1182
+ };
1183
+ }
1184
+ }
1185
+
1186
+ // We have to call trigger twice, as we can not be sure if all
1187
+ // iframes have completed loading when this code runs. The
1188
+ // event listener also catches the page changing in the iFrame.
1189
+ function init(msg) {
1190
+ function iFrameLoaded() {
1191
+ trigger('iFrame.onload', msg, iframe, undefined$1, true);
1192
+ checkReset();
1193
+ }
1194
+
1195
+ function createDestroyObserver(MutationObserver) {
1196
+ if (!iframe.parentNode) {
1197
+ return
1198
+ }
1199
+
1200
+ var destroyObserver = new MutationObserver(function (mutations) {
1201
+ mutations.forEach(function (mutation) {
1202
+ var removedNodes = Array.prototype.slice.call(mutation.removedNodes); // Transform NodeList into an Array
1203
+ removedNodes.forEach(function (removedNode) {
1204
+ if (removedNode === iframe) {
1205
+ closeIFrame(iframe);
1206
+ }
1207
+ });
1208
+ });
1209
+ });
1210
+ destroyObserver.observe(iframe.parentNode, {
1211
+ childList: true
1212
+ });
1213
+ }
1214
+
1215
+ var MutationObserver = getMutationObserver();
1216
+ if (MutationObserver) {
1217
+ createDestroyObserver(MutationObserver);
1218
+ }
1219
+
1220
+ addEventListener(iframe, 'load', iFrameLoaded);
1221
+ trigger('init', msg, iframe, undefined$1, true);
1222
+ }
1223
+
1224
+ function checkOptions(options) {
1225
+ if ('object' !== typeof options) {
1226
+ throw new TypeError('Options is not an object')
1227
+ }
1228
+ }
1229
+
1230
+ function copyOptions(options) {
1231
+ // eslint-disable-next-line no-restricted-syntax
1232
+ for (var option in defaults) {
1233
+ if (Object.prototype.hasOwnProperty.call(defaults, option)) {
1234
+ settings[iframeId][option] = Object.prototype.hasOwnProperty.call(
1235
+ options,
1236
+ option
1237
+ )
1238
+ ? options[option]
1239
+ : defaults[option];
1240
+ }
1241
+ }
1242
+ }
1243
+
1244
+ function getTargetOrigin(remoteHost) {
1245
+ return '' === remoteHost ||
1246
+ null !== remoteHost.match(/^(about:blank|javascript:|file:\/\/)/)
1247
+ ? '*'
1248
+ : remoteHost
1249
+ }
1250
+
1251
+ function depricate(key) {
1252
+ var splitName = key.split('Callback');
1253
+
1254
+ if (splitName.length === 2) {
1255
+ var name =
1256
+ 'on' + splitName[0].charAt(0).toUpperCase() + splitName[0].slice(1);
1257
+ this[name] = this[key];
1258
+ delete this[key];
1259
+ warn(
1260
+ iframeId,
1261
+ "Deprecated: '" +
1262
+ key +
1263
+ "' has been renamed '" +
1264
+ name +
1265
+ "'. The old method will be removed in the next major version."
1266
+ );
1267
+ }
1268
+ }
1269
+
1270
+ function processOptions(options) {
1271
+ options = options || {};
1272
+
1273
+ settings[iframeId] = Object.create(null); // Protect against prototype attacks
1274
+ settings[iframeId].iframe = iframe;
1275
+ settings[iframeId].firstRun = true;
1276
+ settings[iframeId].remoteHost =
1277
+ iframe.src && iframe.src.split('/').slice(0, 3).join('/');
1278
+
1279
+ checkOptions(options);
1280
+ Object.keys(options).forEach(depricate, options);
1281
+ copyOptions(options);
1282
+
1283
+ if (settings[iframeId]) {
1284
+ settings[iframeId].targetOrigin =
1285
+ true === settings[iframeId].checkOrigin
1286
+ ? getTargetOrigin(settings[iframeId].remoteHost)
1287
+ : '*';
1288
+ }
1289
+ }
1290
+
1291
+ function beenHere() {
1292
+ return iframeId in settings && 'iFrameResizer' in iframe
1293
+ }
1294
+
1295
+ var iframeId = ensureHasId(iframe.id);
1296
+
1297
+ if (beenHere()) {
1298
+ warn(iframeId, 'Ignored iFrame, already setup.');
1299
+ } else {
1300
+ processOptions(options);
1301
+ setScrolling();
1302
+ setLimits();
1303
+ setupBodyMarginValues();
1304
+ init(createOutgoingMsg(iframeId));
1305
+ setupIFrameObject();
1306
+ }
1307
+ }
1308
+
1309
+ function debouce(fn, time) {
1310
+ if (null === timer) {
1311
+ timer = setTimeout(function () {
1312
+ timer = null;
1313
+ fn();
1314
+ }, time);
1315
+ }
1316
+ }
1317
+
1318
+ var frameTimer = {};
1319
+ function debounceFrameEvents(fn, time, frameId) {
1320
+ if (!frameTimer[frameId]) {
1321
+ frameTimer[frameId] = setTimeout(function () {
1322
+ frameTimer[frameId] = null;
1323
+ fn();
1324
+ }, time);
1325
+ }
1326
+ }
1327
+
1328
+ // Not testable in PhantomJS
1329
+ /* istanbul ignore next */
1330
+
1331
+ function fixHiddenIFrames() {
1332
+ function checkIFrames() {
1333
+ function checkIFrame(settingId) {
1334
+ function chkDimension(dimension) {
1335
+ return (
1336
+ '0px' ===
1337
+ (settings[settingId] && settings[settingId].iframe.style[dimension])
1338
+ )
1339
+ }
1340
+
1341
+ function isVisible(el) {
1342
+ return null !== el.offsetParent
1343
+ }
1344
+
1345
+ if (
1346
+ settings[settingId] &&
1347
+ isVisible(settings[settingId].iframe) &&
1348
+ (chkDimension('height') || chkDimension('width'))
1349
+ ) {
1350
+ trigger(
1351
+ 'Visibility change',
1352
+ 'resize',
1353
+ settings[settingId].iframe,
1354
+ settingId
1355
+ );
1356
+ }
1357
+ }
1358
+
1359
+ Object.keys(settings).forEach(function (key) {
1360
+ checkIFrame(key);
1361
+ });
1362
+ }
1363
+
1364
+ function mutationObserved(mutations) {
1365
+ log(
1366
+ 'window',
1367
+ 'Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type
1368
+ );
1369
+ debouce(checkIFrames, 16);
1370
+ }
1371
+
1372
+ function createMutationObserver() {
1373
+ var target = document.querySelector('body'),
1374
+ config = {
1375
+ attributes: true,
1376
+ attributeOldValue: false,
1377
+ characterData: true,
1378
+ characterDataOldValue: false,
1379
+ childList: true,
1380
+ subtree: true
1381
+ },
1382
+ observer = new MutationObserver(mutationObserved);
1383
+
1384
+ observer.observe(target, config);
1385
+ }
1386
+
1387
+ var MutationObserver = getMutationObserver();
1388
+ if (MutationObserver) {
1389
+ createMutationObserver();
1390
+ }
1391
+ }
1392
+
1393
+ function resizeIFrames(event) {
1394
+ function resize() {
1395
+ sendTriggerMsg('Window ' + event, 'resize');
1396
+ }
1397
+
1398
+ log('window', 'Trigger event: ' + event);
1399
+ debouce(resize, 16);
1400
+ }
1401
+
1402
+ // Not testable in PhantomJS
1403
+ /* istanbul ignore next */
1404
+ function tabVisible() {
1405
+ function resize() {
1406
+ sendTriggerMsg('Tab Visible', 'resize');
1407
+ }
1408
+
1409
+ if ('hidden' !== document.visibilityState) {
1410
+ log('document', 'Trigger event: Visibility change');
1411
+ debouce(resize, 16);
1412
+ }
1413
+ }
1414
+
1415
+ function sendTriggerMsg(eventName, event) {
1416
+ function isIFrameResizeEnabled(iframeId) {
1417
+ return (
1418
+ settings[iframeId] &&
1419
+ 'parent' === settings[iframeId].resizeFrom &&
1420
+ settings[iframeId].autoResize &&
1421
+ !settings[iframeId].firstRun
1422
+ )
1423
+ }
1424
+
1425
+ Object.keys(settings).forEach(function (iframeId) {
1426
+ if (isIFrameResizeEnabled(iframeId)) {
1427
+ trigger(eventName, event, settings[iframeId].iframe, iframeId);
1428
+ }
1429
+ });
1430
+ }
1431
+
1432
+ function setupEventListeners() {
1433
+ addEventListener(window, 'message', iFrameListener);
1434
+
1435
+ addEventListener(window, 'resize', function () {
1436
+ resizeIFrames('resize');
1437
+ });
1438
+
1439
+ addEventListener(document, 'visibilitychange', tabVisible);
1440
+
1441
+ addEventListener(document, '-webkit-visibilitychange', tabVisible);
1442
+ }
1443
+
1444
+ function factory() {
1445
+ function init(options, element) {
1446
+ function chkType() {
1447
+ if (!element.tagName) {
1448
+ throw new TypeError('Object is not a valid DOM element')
1449
+ } else if ('IFRAME' !== element.tagName.toUpperCase()) {
1450
+ throw new TypeError(
1451
+ 'Expected <IFRAME> tag, found <' + element.tagName + '>'
1452
+ )
1453
+ }
1454
+ }
1455
+
1456
+ if (element) {
1457
+ chkType();
1458
+ setupIFrame(element, options);
1459
+ iFrames.push(element);
1460
+ }
1461
+ }
1462
+
1463
+ function warnDeprecatedOptions(options) {
1464
+ if (options && options.enablePublicMethods) {
1465
+ warn(
1466
+ 'enablePublicMethods option has been removed, public methods are now always available in the iFrame'
1467
+ );
1468
+ }
1469
+ }
1470
+
1471
+ var iFrames;
1472
+
1473
+ setupRequestAnimationFrame();
1474
+ setupEventListeners();
1475
+
1476
+ return function iFrameResizeF(options, target) {
1477
+ iFrames = []; // Only return iFrames past in on this call
1478
+
1479
+ warnDeprecatedOptions(options);
1480
+
1481
+ switch (typeof target) {
1482
+ case 'undefined':
1483
+ case 'string': {
1484
+ Array.prototype.forEach.call(
1485
+ document.querySelectorAll(target || 'iframe'),
1486
+ init.bind(undefined$1, options)
1487
+ );
1488
+ break
1489
+ }
1490
+
1491
+ case 'object': {
1492
+ init(options, target);
1493
+ break
1494
+ }
1495
+
1496
+ default: {
1497
+ throw new TypeError('Unexpected data type (' + typeof target + ')')
1498
+ }
1499
+ }
1500
+
1501
+ return iFrames
1502
+ }
1503
+ }
1504
+
1505
+ function createJQueryPublicMethod($) {
1506
+ if (!$.fn) {
1507
+ info('', 'Unable to bind to jQuery, it is not fully loaded.');
1508
+ } else if (!$.fn.iFrameResize) {
1509
+ $.fn.iFrameResize = function $iFrameResizeF(options) {
1510
+ function init(index, element) {
1511
+ setupIFrame(element, options);
1512
+ }
1513
+
1514
+ return this.filter('iframe').each(init).end()
1515
+ };
1516
+ }
1517
+ }
1518
+
1519
+ if (window.jQuery !== undefined$1) {
1520
+ createJQueryPublicMethod(window.jQuery);
1521
+ }
1522
+
1523
+ if (typeof undefined$1 === 'function' && undefined$1.amd) {
1524
+ undefined$1([], factory);
1525
+ } else {
1526
+ // Node for browserfy
1527
+ module.exports = factory();
1528
+ }
1529
+ window.iFrameResize = window.iFrameResize || factory();
1530
+ })();
1531
+ });
1532
+
1533
+ const MessageEventType = {
1534
+ card: {
1535
+ ready: 'justifi.card.ready',
1536
+ tokenize: 'justifi.card.tokenize',
1537
+ validate: 'justifi.card.validate',
1538
+ resize: 'justifi.card.resize',
1539
+ styleOverrides: 'justifi.card.styleOverrides',
1540
+ },
1541
+ bankAccount: {
1542
+ ready: 'justifi.bankAccount.ready',
1543
+ tokenize: 'justifi.bankAccount.tokenize',
1544
+ validate: 'justifi.bankAccount.validate',
1545
+ resize: 'justifi.bankAccount.resize',
1546
+ styleOverrides: 'justifi.bankAccount.styleOverrides',
1547
+ },
1548
+ };
1549
+
1550
+ const name = "@justifi/webcomponents";
1551
+ const version = "4.15.0";
1552
+ const description = "JustiFi Web Components";
1553
+ const main = "dist/module/index.js";
1554
+ const module$1 = "dist/module/index.js";
1555
+ const types = "./dist/types/index.d.ts";
1556
+ const repository = {
1557
+ type: "git",
1558
+ url: "git+https://github.com/justifi-tech/web-component-library.git"
1559
+ };
1560
+ const homepage = "https://storybook.justifi.ai/?path=/docs/introduction--docs";
1561
+ const publishConfig = {
1562
+ registry: "https://registry.npmjs.org"
1563
+ };
1564
+ const files = [
1565
+ "dist/"
1566
+ ];
1567
+ const scripts = {
1568
+ build: "stencil build --docs",
1569
+ dev: "stencil build --watch",
1570
+ lint: "eslint . --max-warnings 0",
1571
+ clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
1572
+ generate: "stencil generate",
1573
+ test: "TZ=utc stencil test --spec",
1574
+ "test:watch": "TZ=utc stencil test --spec --watchAll",
1575
+ "test:e2e": "stencil test --e2e",
1576
+ "test:file": "stencil test --spec --watch --"
1577
+ };
1578
+ const dependencies = {
1579
+ "@stencil/core": "^4.0.5",
1580
+ bootstrap: "^5.2.3",
1581
+ "chart.js": "^4.4.1",
1582
+ "date-fns": "^2.29.3",
1583
+ "dinero.js": "^1.9.1",
1584
+ "iframe-resizer": "^4.3.7",
1585
+ imask: "^7.6.0",
1586
+ rxjs: "^7.8.1",
1587
+ "ts-dedent": "^2.2.0",
1588
+ uuid: "^9.0.0",
1589
+ yup: "^1.0.0"
1590
+ };
1591
+ const devDependencies = {
1592
+ "@babel/preset-env": "^7.21.5",
1593
+ "@babel/preset-react": "^7.18.6",
1594
+ "@babel/preset-typescript": "^7.21.5",
1595
+ "@stencil/sass": "^3.0.1",
1596
+ "@stencil/store": "^2.0.8",
1597
+ "@types/jest": "27.0.3",
1598
+ "@types/node": "^20.1.4",
1599
+ "@types/react": "^18.0.37",
1600
+ "@types/react-dom": "^18.0.11",
1601
+ dotenv: "^16.3.1",
1602
+ jest: "^29.7.0",
1603
+ "jest-cli": "^29.7.0",
1604
+ "jest-environment-node": "^29.7.0",
1605
+ puppeteer: "^21.0.0",
1606
+ "ts-jest": "^29.1.2"
1607
+ };
1608
+ const license = "MIT";
1609
+ const gitHead = "507bac1d941eae6e1f56e185ecd9bc9d22637783";
1610
+ const packageJson = {
1611
+ name: name,
1612
+ version: version,
1613
+ description: description,
1614
+ main: main,
1615
+ module: module$1,
1616
+ types: types,
1617
+ repository: repository,
1618
+ homepage: homepage,
1619
+ publishConfig: publishConfig,
1620
+ files: files,
1621
+ scripts: scripts,
1622
+ dependencies: dependencies,
1623
+ devDependencies: devDependencies,
1624
+ license: license,
1625
+ gitHead: gitHead
1626
+ };
1627
+
1628
+ const getComputedTheme = () => {
1629
+ const computedStyles = getComputedStyle(document.body);
1630
+ const computedTheme = {
1631
+ loadGoogleFont: computedStyles.getPropertyValue('--jfi-load-google-font'),
1632
+ layout: {
1633
+ fontFamily: computedStyles.getPropertyValue('--jfi-layout-font-family'),
1634
+ padding: computedStyles.getPropertyValue('--jfi-layout-padding'),
1635
+ formControlSpacingHorizontal: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-x'),
1636
+ formControlSpacingVertical: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-y'),
1637
+ },
1638
+ formControl: {
1639
+ backgroundColor: computedStyles.getPropertyValue('--jfi-form-control-background-color'),
1640
+ borderColor: computedStyles.getPropertyValue('--jfi-form-control-border-color'),
1641
+ borderColorFocus: computedStyles.getPropertyValue('--jfi-form-control-border-color-focus'),
1642
+ borderColorError: computedStyles.getPropertyValue('--jfi-form-control-border-color-error'),
1643
+ borderWidth: computedStyles.getPropertyValue('--jfi-form-control-border-width'),
1644
+ borderBottomWidth: computedStyles.getPropertyValue('--jfi-form-control-border-bottom-width'),
1645
+ borderLeftWidth: computedStyles.getPropertyValue('--jfi-form-control-border-left-width'),
1646
+ borderRightWidth: computedStyles.getPropertyValue('--jfi-form-control-border-right-width'),
1647
+ borderTopWidth: computedStyles.getPropertyValue('--jfi-form-control-border-top-width'),
1648
+ borderRadius: computedStyles.getPropertyValue('--jfi-form-control-border-radius'),
1649
+ borderStyle: computedStyles.getPropertyValue('--jfi-form-control-border-style'),
1650
+ boxShadow: computedStyles.getPropertyValue('--jfi-form-control-box-shadow'),
1651
+ boxShadowError: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error'),
1652
+ boxShadowErrorFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error-focus'),
1653
+ boxShadowFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-focus'),
1654
+ color: computedStyles.getPropertyValue('--jfi-form-control-color'),
1655
+ colorFocus: computedStyles.getPropertyValue('--jfi-form-control-color-focus'),
1656
+ fontSize: computedStyles.getPropertyValue('--jfi-form-control-font-size'),
1657
+ fontWeight: computedStyles.getPropertyValue('--jfi-form-control-font-weight'),
1658
+ lineHeight: computedStyles.getPropertyValue('--jfi-form-control-line-height'),
1659
+ margin: computedStyles.getPropertyValue('--jfi-form-control-margin'),
1660
+ padding: computedStyles.getPropertyValue('--jfi-form-control-padding'),
1661
+ },
1662
+ formLabel: {
1663
+ color: computedStyles.getPropertyValue('--jfi-form-label-color'),
1664
+ fontFamily: computedStyles.getPropertyValue('--jfi-form-label-font-family'),
1665
+ fontSize: computedStyles.getPropertyValue('--jfi-form-label-font-size'),
1666
+ fontWeight: computedStyles.getPropertyValue('--jfi-form-label-font-weight'),
1667
+ margin: computedStyles.getPropertyValue('--jfi-form-label-margin'),
1668
+ },
1669
+ errorMessage: {
1670
+ color: computedStyles.getPropertyValue('--jfi-error-message-color'),
1671
+ margin: computedStyles.getPropertyValue('--jfi-error-message-margin'),
1672
+ fontSize: computedStyles.getPropertyValue('--jfi-error-message-font-size'),
1673
+ },
1674
+ };
1675
+ return computedTheme;
1676
+ };
1677
+
1678
+ /**
1679
+ * This approach decouples the communication logic from PaymentMethodForm component,
1680
+ * making it cleaner, more maintainable, and easier to test
1681
+ */
1682
+ class FrameCommunicationService {
1683
+ constructor(iframe, iframeOrigin) {
1684
+ this.iframe = iframe;
1685
+ this.iframeOrigin = iframeOrigin;
1686
+ }
1687
+ postMessage(eventType, payload) {
1688
+ const message = Object.assign({ eventType }, payload);
1689
+ this.iframe.contentWindow.postMessage(message, this.iframeOrigin);
1690
+ }
1691
+ addMessageListener(callback) {
1692
+ window.addEventListener('message', callback);
1693
+ }
1694
+ removeMessageListener(callback) {
1695
+ window.removeEventListener('message', callback);
1696
+ }
1697
+ postMessageWithResponseListener(eventType, payload) {
1698
+ return new Promise((resolve) => {
1699
+ const responseListener = (event) => {
1700
+ if (event.data.eventType !== eventType)
1701
+ return;
1702
+ window.removeEventListener('message', responseListener);
1703
+ resolve(event.data.data);
1704
+ };
1705
+ window.addEventListener('message', responseListener);
1706
+ this.postMessage(eventType, payload);
1707
+ });
1708
+ }
1709
+ }
1710
+
1711
+ const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}iframe{width:1px;min-width:100%}";
1712
+
1713
+ const PaymentMethodForm = class {
1714
+ constructor(hostRef) {
1715
+ index.registerInstance(this, hostRef);
1716
+ this.paymentMethodFormReady = index.createEvent(this, "paymentMethodFormReady", 7);
1717
+ this.paymentMethodFormValidated = index.createEvent(this, "paymentMethodFormValidated", 7);
1718
+ this.paymentMethodFormTokenized = index.createEvent(this, "paymentMethodFormTokenized", 7);
1719
+ this.computedTheme = getComputedTheme();
1720
+ this.dispatchMessageEvent = (messageEvent) => {
1721
+ const { eventType, data } = messageEvent.data;
1722
+ const eventTypeMessage = MessageEventType[this.paymentMethodFormType];
1723
+ if (eventType === eventTypeMessage.ready) {
1724
+ this.paymentMethodFormReady.emit(data);
1725
+ }
1726
+ else if (eventType === eventTypeMessage.tokenize) {
1727
+ this.paymentMethodFormTokenized.emit(data);
1728
+ }
1729
+ else if (eventType === eventTypeMessage.validate) {
1730
+ this.paymentMethodFormValidated.emit(data);
1731
+ }
1732
+ };
1733
+ this.postMessage = (eventType, payload) => {
1734
+ this.frameService.postMessage(eventType, payload);
1735
+ };
1736
+ this.paymentMethodFormType = undefined;
1737
+ this.paymentMethodFormValidationMode = undefined;
1738
+ this.iframeOrigin = undefined;
1739
+ this.singleLine = undefined;
1740
+ }
1741
+ disconnectedCallback() {
1742
+ this.frameService.removeMessageListener(this.dispatchMessageEvent);
1743
+ }
1744
+ async resize() {
1745
+ this.postMessage(MessageEventType[this.paymentMethodFormType].resize);
1746
+ }
1747
+ async tokenize(clientId, paymentMethodMetadata, account) {
1748
+ const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
1749
+ return this.frameService.postMessageWithResponseListener(eventType, {
1750
+ clientId,
1751
+ paymentMethodMetadata,
1752
+ account,
1753
+ componentVersion: packageJson.version,
1754
+ });
1755
+ }
1756
+ async validate() {
1757
+ const eventType = MessageEventType[this.paymentMethodFormType].validate;
1758
+ return this.frameService.postMessageWithResponseListener(eventType);
1759
+ }
1760
+ sendStyleOverrides() {
1761
+ if (this.computedTheme) {
1762
+ this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.computedTheme });
1763
+ }
1764
+ }
1765
+ getIframeSrc() {
1766
+ let paramsList = [];
1767
+ if (this.paymentMethodFormValidationMode) {
1768
+ paramsList.push(`validationMode=${this.paymentMethodFormValidationMode}`);
1769
+ }
1770
+ if (this.singleLine) {
1771
+ paramsList.push(`singleLine=${this.singleLine}`);
1772
+ }
1773
+ let iframeSrc = `${this.iframeOrigin}/${this.paymentMethodFormType}${utils$1.composeQueryParams(paramsList)}`;
1774
+ return iframeSrc;
1775
+ }
1776
+ initializeFrameCommunicationService() {
1777
+ var _a;
1778
+ this.frameService = new FrameCommunicationService(this.iframeElement, this.iframeOrigin);
1779
+ (_a = this.frameService) === null || _a === void 0 ? void 0 : _a.addMessageListener(this.dispatchMessageEvent);
1780
+ }
1781
+ render() {
1782
+ return (index.h(index.Host, null, index.h("iframe", { id: `justifi-payment-method-form-${this.paymentMethodFormType}`, src: this.getIframeSrc(), ref: el => {
1783
+ this.iframeElement = el;
1784
+ this.initializeFrameCommunicationService();
1785
+ }, onLoad: () => {
1786
+ iframeResizer({
1787
+ scrollbars: false,
1788
+ }, this.iframeElement);
1789
+ this.sendStyleOverrides();
1790
+ } })));
1791
+ }
1792
+ };
1793
+ PaymentMethodForm.style = paymentMethodFormCss;
1794
+
1795
+ exports.justifi_billing_form = BillingForm;
1796
+ exports.justifi_payment_method_form = PaymentMethodForm;