@zonos/elements 1.3.223 → 1.3.224

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/VarianceTest-bec00ea8.js +91 -0
  2. package/dist/cjs/{cart-3a2a062c.js → cart-af017ac3.js} +41 -40
  3. package/dist/cjs/{debounce-465a4328.js → debounce-2c9f3f1e.js} +1 -1
  4. package/dist/cjs/{getBorderRadius-1b5e33cf.js → getBorderRadius-c7d9f676.js} +1 -1
  5. package/dist/cjs/{handleFetch-45f35cac.js → handleFetch-954f30e1.js} +5 -82
  6. package/dist/cjs/index.cjs.js +40 -37
  7. package/dist/cjs/{isDarkColor-428965f4.js → isDarkColor-994c38e4.js} +1 -1
  8. package/dist/cjs/{localization-12e7e934.js → localization-21030292.js} +82 -24
  9. package/dist/cjs/{paypal-a1377508.js → paypal-2b22f0f5.js} +17 -16
  10. package/dist/cjs/{placeTestOrder-6fcce33e.js → placeTestOrder-9cde1ca4.js} +3 -3
  11. package/dist/cjs/{renderFallback-39ba034b.js → renderFallback-9300dbaf.js} +8 -7
  12. package/dist/cjs/{translationStore-951ed4b4.js → translationStore-ce2c700d.js} +1 -1
  13. package/dist/cjs/{updateCheckoutSessionAttributes-c0853fdd.js → updateCheckoutSessionAttributes-a4899e90.js} +2 -2
  14. package/dist/cjs/zonos-address_11.cjs.entry.js +16 -16
  15. package/dist/cjs/zonos-badge.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-banner_2.cjs.entry.js +3 -3
  17. package/dist/cjs/zonos-button_3.cjs.entry.js +4 -4
  18. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +25 -25
  19. package/dist/cjs/zonos-checkout.cjs.entry.js +68 -67
  20. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  21. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +8 -8
  22. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +19 -19
  23. package/dist/cjs/zonos-collect.cjs.entry.js +20 -20
  24. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +4 -4
  25. package/dist/cjs/zonos-controller.cjs.entry.js +40 -39
  26. package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -5
  27. package/dist/cjs/zonos-country-select_4.cjs.entry.js +6 -6
  28. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +14 -14
  29. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
  30. package/dist/cjs/zonos-hello.cjs.entry.js +12 -12
  31. package/dist/cjs/zonos-input.cjs.entry.js +3 -3
  32. package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
  33. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  34. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
  35. package/dist/cjs/zonos-stripe-input.cjs.entry.js +5 -5
  36. package/dist/cjs/zonos-text.cjs.entry.js +2 -2
  37. package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
  38. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  39. package/dist/cjs/{zonosStore-f8ee56aa.js → zonosStore-5d489c65.js} +8 -2
  40. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +4 -0
  41. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +1 -0
  42. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.css +1 -0
  43. package/dist/collection/components/main/zonos-controller.js +1 -1
  44. package/dist/collection/components/store/hello/localization.js +12 -9
  45. package/dist/collection/components/store/zonosStore.js +8 -1
  46. package/dist/collection/components/utils/api/getZonosSettings.js +2 -0
  47. package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +2 -0
  48. package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +5 -0
  49. package/dist/collection/components/utils/logging/sendLoadCheckoutFacadeLog.js +1 -1
  50. package/dist/collection/components/utils/logging/sendLoadNativeCheckoutLog.js +1 -1
  51. package/dist/collection/scripts/_zonosBase.js +3 -0
  52. package/dist/collection/types/generated/graphql.internal.types.js +3 -0
  53. package/dist/collection/utils/performBlurCurrency.js +50 -0
  54. package/dist/esm/VarianceTest-572cecf5.js +86 -0
  55. package/dist/esm/{cart-7f06662c.js → cart-11b87221.js} +7 -6
  56. package/dist/esm/{debounce-c34d1270.js → debounce-f081e4d8.js} +1 -1
  57. package/dist/esm/{getBorderRadius-87593ff4.js → getBorderRadius-6281d902.js} +1 -1
  58. package/dist/esm/{handleFetch-99218189.js → handleFetch-a844cac1.js} +2 -76
  59. package/dist/esm/index.js +13 -9
  60. package/dist/esm/{isDarkColor-1f58b6be.js → isDarkColor-83e0c27e.js} +1 -1
  61. package/dist/esm/{localization-192886e4.js → localization-9320a65d.js} +71 -13
  62. package/dist/esm/{paypal-53f1b4a1.js → paypal-338a4350.js} +7 -6
  63. package/dist/esm/{placeTestOrder-95cbb623.js → placeTestOrder-d28f33c2.js} +3 -3
  64. package/dist/esm/{renderFallback-6352363c.js → renderFallback-28ef3364.js} +5 -4
  65. package/dist/esm/{translationStore-fb98a08d.js → translationStore-7eebaa41.js} +1 -1
  66. package/dist/esm/{updateCheckoutSessionAttributes-92f42882.js → updateCheckoutSessionAttributes-160720f6.js} +2 -2
  67. package/dist/esm/zonos-address_11.entry.js +9 -9
  68. package/dist/esm/zonos-badge.entry.js +2 -2
  69. package/dist/esm/zonos-banner_2.entry.js +3 -3
  70. package/dist/esm/zonos-button_3.entry.js +4 -4
  71. package/dist/esm/zonos-cart-items_12.entry.js +12 -12
  72. package/dist/esm/zonos-checkout.entry.js +15 -14
  73. package/dist/esm/zonos-collapse.entry.js +2 -2
  74. package/dist/esm/zonos-collect-cart-items_3.entry.js +8 -8
  75. package/dist/esm/zonos-collect-finish_6.entry.js +11 -11
  76. package/dist/esm/zonos-collect.entry.js +10 -10
  77. package/dist/esm/zonos-confirm-dialog_2.entry.js +4 -4
  78. package/dist/esm/zonos-controller.entry.js +10 -9
  79. package/dist/esm/zonos-country-flag.entry.js +5 -5
  80. package/dist/esm/zonos-country-select_4.entry.js +6 -6
  81. package/dist/esm/zonos-empty-state-payment_4.entry.js +9 -9
  82. package/dist/esm/zonos-hello-dialog.entry.js +5 -5
  83. package/dist/esm/zonos-hello.entry.js +6 -6
  84. package/dist/esm/zonos-input.entry.js +3 -3
  85. package/dist/esm/zonos-language-select_2.entry.js +5 -5
  86. package/dist/esm/zonos-logo.entry.js +2 -2
  87. package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
  88. package/dist/esm/zonos-stripe-input.entry.js +5 -5
  89. package/dist/esm/zonos-text.entry.js +2 -2
  90. package/dist/esm/zonos-toggle.entry.js +2 -2
  91. package/dist/esm/zonos-v-stack.entry.js +2 -2
  92. package/dist/esm/{zonosStore-c456b933.js → zonosStore-e3d0493a.js} +8 -2
  93. package/dist/esm-es5/VarianceTest-572cecf5.js +1 -0
  94. package/dist/esm-es5/cart-11b87221.js +1 -0
  95. package/dist/esm-es5/{debounce-c34d1270.js → debounce-f081e4d8.js} +1 -1
  96. package/dist/esm-es5/{getBorderRadius-87593ff4.js → getBorderRadius-6281d902.js} +1 -1
  97. package/dist/esm-es5/handleFetch-a844cac1.js +1 -0
  98. package/dist/esm-es5/index.js +1 -1
  99. package/dist/esm-es5/{isDarkColor-1f58b6be.js → isDarkColor-83e0c27e.js} +1 -1
  100. package/dist/esm-es5/localization-9320a65d.js +1 -0
  101. package/dist/esm-es5/{paypal-53f1b4a1.js → paypal-338a4350.js} +2 -2
  102. package/dist/esm-es5/{placeTestOrder-95cbb623.js → placeTestOrder-d28f33c2.js} +1 -1
  103. package/dist/esm-es5/renderFallback-28ef3364.js +1 -0
  104. package/dist/esm-es5/{translationStore-fb98a08d.js → translationStore-7eebaa41.js} +1 -1
  105. package/dist/esm-es5/{updateCheckoutSessionAttributes-92f42882.js → updateCheckoutSessionAttributes-160720f6.js} +1 -1
  106. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  107. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  108. package/dist/esm-es5/zonos-banner_2.entry.js +1 -1
  109. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  110. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  111. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  112. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  113. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  114. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  115. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  116. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +1 -1
  117. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  118. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  119. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  120. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  121. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  122. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  123. package/dist/esm-es5/zonos-input.entry.js +1 -1
  124. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  125. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  126. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  127. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  128. package/dist/esm-es5/zonos-text.entry.js +1 -1
  129. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  130. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  131. package/dist/esm-es5/zonosStore-e3d0493a.js +1 -0
  132. package/dist/scripts/blurCurrencyOnInit.js +1 -0
  133. package/dist/scripts/index.d.ts +38 -6
  134. package/dist/scripts/index.js +1 -1
  135. package/dist/scripts/loadZonos.js +1 -1
  136. package/dist/scripts/zonos.js +1 -1
  137. package/dist/types/scripts/_zonosBase.d.ts +8 -3
  138. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +7 -3
  139. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +2 -2
  140. package/dist/types/types/generated/graphql.internal.types.d.ts +13 -2
  141. package/dist/types/types/generated/graphql.internal.types.ts +13 -2
  142. package/dist/types/types/global.d.ts +8 -0
  143. package/dist/types/types/utils/ZonosSettings.d.ts +8 -2
  144. package/dist/types/utils/performBlurCurrency.d.ts +2 -0
  145. package/dist/zonos-elements/base.css +1 -0
  146. package/dist/zonos-elements/index.esm.js +1 -1
  147. package/dist/zonos-elements/p-01174496.system.js +1 -0
  148. package/dist/zonos-elements/p-0260fd13.js +1 -0
  149. package/dist/zonos-elements/{p-e970f2aa.system.entry.js → p-04c1dc63.system.entry.js} +1 -1
  150. package/dist/zonos-elements/p-0a377722.js +1 -0
  151. package/dist/zonos-elements/p-0a92e3fd.entry.js +1 -0
  152. package/dist/zonos-elements/{p-8350937d.system.entry.js → p-0b6a3a09.system.entry.js} +1 -1
  153. package/dist/zonos-elements/p-0d82e1fd.entry.js +1 -0
  154. package/dist/zonos-elements/{p-a7485913.system.js → p-0ec82d78.system.js} +2 -2
  155. package/dist/zonos-elements/{p-2b9c124d.js → p-0ffd710e.js} +1 -1
  156. package/dist/zonos-elements/p-112c6453.system.js +1 -0
  157. package/dist/zonos-elements/{p-62fa680d.system.js → p-182da73f.system.js} +1 -1
  158. package/dist/zonos-elements/p-1868a283.entry.js +1 -0
  159. package/dist/zonos-elements/{p-ba18c5f5.system.entry.js → p-1a67ae71.system.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-520bd291.system.entry.js → p-1b9cc0e2.system.entry.js} +1 -1
  161. package/dist/zonos-elements/p-1c5ba523.js +1 -0
  162. package/dist/zonos-elements/p-1ef793d0.entry.js +1 -0
  163. package/dist/zonos-elements/{p-0ed63ce0.system.js → p-23c46dfa.system.js} +1 -1
  164. package/dist/zonos-elements/{p-e7f8595f.system.js → p-24e26a2c.system.js} +1 -1
  165. package/dist/zonos-elements/p-252fa1da.entry.js +1 -0
  166. package/dist/zonos-elements/{p-53b46925.entry.js → p-2616ba72.entry.js} +1 -1
  167. package/dist/zonos-elements/p-2657f099.system.entry.js +1 -0
  168. package/dist/zonos-elements/{p-7d2d2c94.entry.js → p-2dc38ef3.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-12ce9746.system.entry.js → p-360d7101.system.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-19f25feb.system.entry.js → p-375994d1.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-ee6f8c02.system.entry.js → p-38f42f10.system.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-4637f365.system.entry.js → p-4004c838.system.entry.js} +1 -1
  173. package/dist/zonos-elements/p-41dd1cb8.js +1 -0
  174. package/dist/zonos-elements/{p-e63b8b24.system.js → p-433d76b4.system.js} +1 -1
  175. package/dist/zonos-elements/{p-a77ed1b9.entry.js → p-4523b982.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-fc27467b.entry.js → p-4ce3489a.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-a61a9b65.system.entry.js → p-4da7b6a8.system.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-7b56e345.js → p-4dfe97ad.js} +2 -2
  179. package/dist/zonos-elements/{p-cd1ebef9.system.js → p-57413c34.system.js} +1 -1
  180. package/dist/zonos-elements/{p-4d9ad3b1.system.entry.js → p-576d76fa.system.entry.js} +1 -1
  181. package/dist/zonos-elements/p-5c43ecdf.system.entry.js +1 -0
  182. package/dist/zonos-elements/{p-9fdd3264.system.entry.js → p-5f7a9b69.system.entry.js} +1 -1
  183. package/dist/zonos-elements/p-6092af05.entry.js +1 -0
  184. package/dist/zonos-elements/{p-9b062dfb.entry.js → p-67787bd4.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-7c4e7651.entry.js → p-6bab9096.entry.js} +1 -1
  186. package/dist/zonos-elements/p-6d423364.entry.js +1 -0
  187. package/dist/zonos-elements/p-725605f6.system.js +1 -0
  188. package/dist/zonos-elements/p-7af39c98.js +1 -0
  189. package/dist/zonos-elements/{p-7f7abdf2.system.entry.js → p-7cee0e68.system.entry.js} +1 -1
  190. package/dist/zonos-elements/p-7eb8e2d4.js +1 -0
  191. package/dist/zonos-elements/p-81b357f7.system.js +1 -1
  192. package/dist/zonos-elements/p-820ad058.js +1 -0
  193. package/dist/zonos-elements/{p-5e3d2bd2.system.entry.js → p-873b6185.system.entry.js} +1 -1
  194. package/dist/zonos-elements/p-89c5164b.system.js +1 -0
  195. package/dist/zonos-elements/p-91f32c73.system.js +1 -0
  196. package/dist/zonos-elements/{p-245f6ad4.system.entry.js → p-9e03a145.system.entry.js} +1 -1
  197. package/dist/zonos-elements/{p-0ae53ff0.js → p-a199bb13.js} +1 -1
  198. package/dist/zonos-elements/p-ae3e4f2b.entry.js +1 -0
  199. package/dist/zonos-elements/{p-567f7de7.entry.js → p-b4bf2f03.entry.js} +1 -1
  200. package/dist/zonos-elements/p-b5b3f908.system.js +1 -0
  201. package/dist/zonos-elements/{p-a5b0a636.entry.js → p-b658c28a.entry.js} +1 -1
  202. package/dist/zonos-elements/{p-de626806.system.entry.js → p-b6ef4a5e.system.entry.js} +1 -1
  203. package/dist/zonos-elements/{p-4f8563ad.system.entry.js → p-b91df44b.system.entry.js} +1 -1
  204. package/dist/zonos-elements/{p-e8accbef.system.entry.js → p-ba334962.system.entry.js} +1 -1
  205. package/dist/zonos-elements/p-bccd49d7.system.entry.js +1 -0
  206. package/dist/zonos-elements/p-bdeb20cb.js +1 -0
  207. package/dist/zonos-elements/{p-a95d2034.system.entry.js → p-bfc0fc85.system.entry.js} +1 -1
  208. package/dist/zonos-elements/{p-c4b3c878.entry.js → p-c81f6387.entry.js} +1 -1
  209. package/dist/zonos-elements/{p-efa6203f.entry.js → p-c998e4ed.entry.js} +1 -1
  210. package/dist/zonos-elements/{p-9396059b.entry.js → p-cb0e6468.entry.js} +1 -1
  211. package/dist/zonos-elements/{p-421dfb66.system.entry.js → p-cb11d11b.system.entry.js} +1 -1
  212. package/dist/zonos-elements/p-cc599cd9.entry.js +1 -0
  213. package/dist/zonos-elements/p-ce4c6ae0.entry.js +1 -0
  214. package/dist/zonos-elements/{p-14f9bc8c.entry.js → p-d2f7ea09.entry.js} +1 -1
  215. package/dist/zonos-elements/{p-0c0fda23.js → p-d42b5113.js} +1 -1
  216. package/dist/zonos-elements/{p-00423fa0.system.js → p-d531b524.system.js} +1 -1
  217. package/dist/zonos-elements/p-d938f42f.system.js +1 -0
  218. package/dist/zonos-elements/{p-f4fa8720.entry.js → p-d96545ae.entry.js} +1 -1
  219. package/dist/zonos-elements/{p-eb6a35ce.system.entry.js → p-dc56b469.system.entry.js} +1 -1
  220. package/dist/zonos-elements/{p-45d288d0.system.entry.js → p-e00e5d64.system.entry.js} +1 -1
  221. package/dist/zonos-elements/{p-8194fcd8.entry.js → p-e60b988c.entry.js} +1 -1
  222. package/dist/zonos-elements/{p-56e0ed65.js → p-e688e493.js} +1 -1
  223. package/dist/zonos-elements/{p-295d9c07.system.entry.js → p-f548807d.system.entry.js} +1 -1
  224. package/dist/zonos-elements/{p-e7b05da2.entry.js → p-f912e9c3.entry.js} +1 -1
  225. package/dist/zonos-elements/zonos-elements.css +1 -1
  226. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  227. package/package.json +4 -3
  228. package/dist/cjs/VarianceTest-0cb1e118.js +0 -12
  229. package/dist/esm/VarianceTest-fef2d958.js +0 -10
  230. package/dist/esm-es5/VarianceTest-fef2d958.js +0 -1
  231. package/dist/esm-es5/cart-7f06662c.js +0 -1
  232. package/dist/esm-es5/handleFetch-99218189.js +0 -1
  233. package/dist/esm-es5/localization-192886e4.js +0 -1
  234. package/dist/esm-es5/renderFallback-6352363c.js +0 -1
  235. package/dist/esm-es5/zonosStore-c456b933.js +0 -1
  236. package/dist/zonos-elements/p-04a01cb1.js +0 -1
  237. package/dist/zonos-elements/p-062430f9.system.js +0 -1
  238. package/dist/zonos-elements/p-0e28207a.js +0 -1
  239. package/dist/zonos-elements/p-1cd1da90.system.js +0 -1
  240. package/dist/zonos-elements/p-2131fa8b.entry.js +0 -1
  241. package/dist/zonos-elements/p-30432622.system.entry.js +0 -1
  242. package/dist/zonos-elements/p-366ea017.entry.js +0 -1
  243. package/dist/zonos-elements/p-3f3c92db.system.entry.js +0 -1
  244. package/dist/zonos-elements/p-4a3abbf2.js +0 -1
  245. package/dist/zonos-elements/p-4dcbbd60.js +0 -1
  246. package/dist/zonos-elements/p-5a2dd041.system.js +0 -1
  247. package/dist/zonos-elements/p-640a6898.system.js +0 -1
  248. package/dist/zonos-elements/p-6afbbe66.entry.js +0 -1
  249. package/dist/zonos-elements/p-6cfe66fe.entry.js +0 -1
  250. package/dist/zonos-elements/p-6f6573a5.system.js +0 -1
  251. package/dist/zonos-elements/p-7ce093aa.js +0 -1
  252. package/dist/zonos-elements/p-9d863a3b.system.js +0 -1
  253. package/dist/zonos-elements/p-a435931e.system.entry.js +0 -1
  254. package/dist/zonos-elements/p-a8a312b2.js +0 -1
  255. package/dist/zonos-elements/p-a9b3cfe1.entry.js +0 -1
  256. package/dist/zonos-elements/p-abcefd25.entry.js +0 -1
  257. package/dist/zonos-elements/p-b76db2ac.js +0 -1
  258. package/dist/zonos-elements/p-bbf48b31.entry.js +0 -1
  259. package/dist/zonos-elements/p-bdf183a3.entry.js +0 -1
  260. package/dist/zonos-elements/p-d1b415cd.entry.js +0 -1
  261. package/dist/zonos-elements/p-d2098bef.entry.js +0 -1
  262. package/dist/zonos-elements/p-da200c19.system.js +0 -1
  263. package/dist/zonos-elements/p-df0cbde4.js +0 -1
@@ -1 +1 @@
1
- import{_ as _root,b as _baseGetTag,i as isObjectLike_1,d as isObject_1}from"./zonosStore-c456b933.js";var root=_root;var now$1=function(){return root.Date.now()};var now_1=now$1;var reWhitespace=/\s/;function trimmedEndIndex$1(e){var r=e.length;while(r--&&reWhitespace.test(e.charAt(r))){}return r}var _trimmedEndIndex=trimmedEndIndex$1;var trimmedEndIndex=_trimmedEndIndex;var reTrimStart=/^\s+/;function baseTrim$1(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,""):e}var _baseTrim=baseTrim$1;var baseGetTag=_baseGetTag,isObjectLike=isObjectLike_1;var symbolTag="[object Symbol]";function isSymbol$1(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==symbolTag}var isSymbol_1=isSymbol$1;var baseTrim=_baseTrim,isObject$1=isObject_1,isSymbol=isSymbol_1;var NAN=0/0;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsOctal=/^0o[0-7]+$/i;var freeParseInt=parseInt;function toNumber$1(e){if(typeof e=="number"){return e}if(isSymbol(e)){return NAN}if(isObject$1(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=isObject$1(r)?r+"":r}if(typeof e!="string"){return e===0?e:+e}e=baseTrim(e);var n=reIsBinary.test(e);return n||reIsOctal.test(e)?freeParseInt(e.slice(2),n?2:8):reIsBadHex.test(e)?NAN:+e}var toNumber_1=toNumber$1;var isObject=isObject_1,now=now_1,toNumber=toNumber_1;var FUNC_ERROR_TEXT="Expected a function";var nativeMax=Math.max,nativeMin=Math.min;function debounce(e,r,n){var t,i,a,o,u,s,f=0,b=false,m=false,d=true;if(typeof e!="function"){throw new TypeError(FUNC_ERROR_TEXT)}r=toNumber(r)||0;if(isObject(n)){b=!!n.leading;m="maxWait"in n;a=m?nativeMax(toNumber(n.maxWait)||0,r):a;d="trailing"in n?!!n.trailing:d}function c(r){var n=t,a=i;t=i=undefined;f=r;o=e.apply(a,n);return o}function v(e){f=e;u=setTimeout(l,r);return b?c(e):o}function _(e){var n=e-s,t=e-f,i=r-n;return m?nativeMin(i,a-t):i}function T(e){var n=e-s,t=e-f;return s===undefined||n>=r||n<0||m&&t>=a}function l(){var e=now();if(T(e)){return y(e)}u=setTimeout(l,_(e))}function y(e){u=undefined;if(d&&t){return c(e)}t=i=undefined;return o}function O(){if(u!==undefined){clearTimeout(u)}f=0;t=s=i=u=undefined}function $(){return u===undefined?o:y(now())}function I(){var e=now(),n=T(e);t=arguments;i=this;s=e;if(n){if(u===undefined){return v(s)}if(m){clearTimeout(u);u=setTimeout(l,r);return c(s)}}if(u===undefined){u=setTimeout(l,r)}return o}I.cancel=O;I.flush=$;return I}var debounce_1=debounce;export{debounce_1 as d};
1
+ import{_ as _root,b as _baseGetTag,i as isObjectLike_1,d as isObject_1}from"./zonosStore-e3d0493a.js";var root=_root;var now$1=function(){return root.Date.now()};var now_1=now$1;var reWhitespace=/\s/;function trimmedEndIndex$1(e){var r=e.length;while(r--&&reWhitespace.test(e.charAt(r))){}return r}var _trimmedEndIndex=trimmedEndIndex$1;var trimmedEndIndex=_trimmedEndIndex;var reTrimStart=/^\s+/;function baseTrim$1(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,""):e}var _baseTrim=baseTrim$1;var baseGetTag=_baseGetTag,isObjectLike=isObjectLike_1;var symbolTag="[object Symbol]";function isSymbol$1(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==symbolTag}var isSymbol_1=isSymbol$1;var baseTrim=_baseTrim,isObject$1=isObject_1,isSymbol=isSymbol_1;var NAN=0/0;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsOctal=/^0o[0-7]+$/i;var freeParseInt=parseInt;function toNumber$1(e){if(typeof e=="number"){return e}if(isSymbol(e)){return NAN}if(isObject$1(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=isObject$1(r)?r+"":r}if(typeof e!="string"){return e===0?e:+e}e=baseTrim(e);var n=reIsBinary.test(e);return n||reIsOctal.test(e)?freeParseInt(e.slice(2),n?2:8):reIsBadHex.test(e)?NAN:+e}var toNumber_1=toNumber$1;var isObject=isObject_1,now=now_1,toNumber=toNumber_1;var FUNC_ERROR_TEXT="Expected a function";var nativeMax=Math.max,nativeMin=Math.min;function debounce(e,r,n){var t,i,a,o,u,s,f=0,b=false,m=false,d=true;if(typeof e!="function"){throw new TypeError(FUNC_ERROR_TEXT)}r=toNumber(r)||0;if(isObject(n)){b=!!n.leading;m="maxWait"in n;a=m?nativeMax(toNumber(n.maxWait)||0,r):a;d="trailing"in n?!!n.trailing:d}function c(r){var n=t,a=i;t=i=undefined;f=r;o=e.apply(a,n);return o}function v(e){f=e;u=setTimeout(l,r);return b?c(e):o}function _(e){var n=e-s,t=e-f,i=r-n;return m?nativeMin(i,a-t):i}function T(e){var n=e-s,t=e-f;return s===undefined||n>=r||n<0||m&&t>=a}function l(){var e=now();if(T(e)){return y(e)}u=setTimeout(l,_(e))}function y(e){u=undefined;if(d&&t){return c(e)}t=i=undefined;return o}function O(){if(u!==undefined){clearTimeout(u)}f=0;t=s=i=u=undefined}function $(){return u===undefined?o:y(now())}function I(){var e=now(),n=T(e);t=arguments;i=this;s=e;if(n){if(u===undefined){return v(s)}if(m){clearTimeout(u);u=setTimeout(l,r);return c(s)}}if(u===undefined){u=setTimeout(l,r)}return o}I.cancel=O;I.flush=$;return I}var debounce_1=debounce;export{debounce_1 as d};
@@ -1 +1 @@
1
- import{z as zonosStore}from"./zonosStore-c456b933.js";var getBorderRadius=function(o){var r=(o===null||o===void 0?void 0:o.customRoundRadius)||"10px";var e=o===null||o===void 0?void 0:o.overrideBorderStyle;if(e){return e==="SHARP"?"0px":r}return zonosStore.appearance.style==="SHARP"?"0px":r};export{getBorderRadius as g};
1
+ import{z as zonosStore}from"./zonosStore-e3d0493a.js";var getBorderRadius=function(o){var r=(o===null||o===void 0?void 0:o.customRoundRadius)||"10px";var e=o===null||o===void 0?void 0:o.overrideBorderStyle;if(e){return e==="SHARP"?"0px":r}return zonosStore.appearance.style==="SHARP"?"0px":r};export{getBorderRadius as g};
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,n,r,o){function t(e){return e instanceof r?e:new r((function(n){n(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o["throw"](e))}catch(e){i(e)}}function u(e){e.done?r(e.value):t(e.value).then(a,s)}u((o=o.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,t,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return u([e,n])}}function u(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,t&&(i=s[0]&2?t["return"]:s[0]?t["throw"]||((i=t["return"])&&i.call(t),0):t.next)&&!(i=i.call(t,s[1])).done)return i;if(t=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;t=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e];t=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,r){if(r||arguments.length===2)for(var o=0,t=n.length,i;o<t;o++){if(i||!(o in n)){if(!i)i=Array.prototype.slice.call(n,0,o);i[o]=n[o]}}return e.concat(i||Array.prototype.slice.call(n))};import{l as log}from"./VarianceTest-572cecf5.js";var logError=function(e){var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}log.apply(void 0,__spreadArray([e,"error"],n,false))};var getIsStagingMode=function(){return window.location.search.includes("zonosStagingMode=1")};var getIsTestMode=function(){var e;return((e=window.Zonos.zonosApiKey)===null||e===void 0?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};var fallbackApiType=["cloudflare","vercel"];var MAIN_BASE_API_TYPE=fallbackApiType[0];var fallbackApiList={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"};var MAIN_BASE_API=fallbackApiList[MAIN_BASE_API_TYPE];var getNextFallbackApiType=function(e){if(e===void 0){e=MAIN_BASE_API_TYPE}var n=fallbackApiType.indexOf(e);var r=fallbackApiType[n+1];if(!r){return null}return r};var jsonParse=function(e){if(typeof e==="string"){try{var n=JSON.parse(e);return n}catch(e){return null}}return null};var checkoutBreakpoint=890;var isCheckoutMobile=function(e){return e||window.innerWidth<checkoutBreakpoint};var getNavigatorConnection=function(){var e="connection"in window.navigator?window.navigator.connection:null;var n="mozConnection"in window.navigator?window.navigator.mozConnection:null;var r="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;var o=e||n||r;return o};var getAdditionalLogMetadata=function(){var e="userAgentData"in window.navigator?window.navigator.userAgentData:null;var n=getNavigatorConnection();return{connectionDownlink:n===null||n===void 0?void 0:n.downlink,connectionEffectiveType:n===null||n===void 0?void 0:n.effectiveType,connectionRtt:n===null||n===void 0?void 0:n.rtt,connectionSaveData:n===null||n===void 0?void 0:n.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}};var blackListPaths=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"];var prepLoadTimeApiLog=function(e){var n=e.apiPath,r=e.apiType,o=e.loadTimeInternal,t=e.loadTimeTotal;if(blackListPaths.includes(n)){return}var i=t-o;if(i<0){return}var a=n.split("?")[0]||n;var s=getAdditionalLogMetadata();var u=typeof s.userAgent==="object"&&s.userAgent.mobile;var l={apiType:r,connectionType:s.connectionEffectiveType,href:a,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:isCheckoutMobile(u),loadTimeBrowserApi:i,loadTimeInternal:o,loadTimeTotal:t,metadata:Object.assign({},s),screenHeight:s.screenHeight,screenWidth:s.screenWidth,userAgent:typeof s.userAgent==="string"?s.userAgent:s.userAgent["brands"].map((function(e){return e.brand})).filter((function(e){return!/Not.*A.*Brand.*/.test(e)})).join(",")};window.Zonos.loadTimeApiInfoList.push(l)};var postReleaseReportingDuration=1*3600*1e3;var sendErrorLog=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,r,o,t,i;var a=e.endpoint,s=e.errors,u=e.metadata,l=e.shouldPostReleaseErrorReporting;return __generator(this,(function(e){log("sendErrorLog","warn",a,u,s);if(l){n=Number(window.Zonos.releaseDate);r=(new Date).getTime();if(r-n>postReleaseReportingDuration){return[2]}}o="userAgentData"in window.navigator?window.navigator.userAgentData:null;t={endpoint:a,errors:s,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:o&&o.brands.length>0?o:window.navigator.userAgent},u)};try{void fetch("".concat(MAIN_BASE_API,"/api/zonos-elements/log-error"),{body:JSON.stringify(t),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){i=getNextFallbackApiType();if(!i){return[2]}void fetch("".concat(fallbackApiList[i],"/api/zonos-elements/log-error"),{body:JSON.stringify(t),method:"POST"})}return[2]}))}))};var __rest=undefined&&undefined.__rest||function(e,n){var r={};for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0)r[o]=e[o];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var t=0,o=Object.getOwnPropertySymbols(e);t<o.length;t++){if(n.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(e,o[t]))r[o[t]]=e[o[t]]}return r};var getResponseBody=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,r,o;var t=e.response,i=e.shouldLog,a=i===void 0?true:i,s=e.shouldThrow,u=s===void 0?false:s;return __generator(this,(function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,t.text()];case 1:n=e.sent();r=jsonParse(n);if(!r){throw new Error("Failed to parse content: ".concat(n))}return[2,r];case 2:o=e.sent();if(u){throw o}if(a){console.error(o)}return[2,null];case 3:return[2]}}))}))};var encodeString=function(e){try{var n=btoa(e).replace(/=/g,"");return n}catch(n){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}};var handleRequest=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,r,o,t,i,a,s,u,l,d,c,d,f,v,s,w,s;var p=e.basePathType,g=e.options,h=e.path;return __generator(this,(function(e){switch(e.label){case 0:r=window.Zonos.zonosQaUrlApi||fallbackApiList[p]||MAIN_BASE_API_TYPE;o=r+h;t=new URL(o);i=window.Zonos.cartId?"".concat(window.location.hostname,"-").concat(window.Zonos.cartId):window.location.hostname;t.searchParams.set("zToken",encodeString(i));e.label=1;case 1:e.trys.push([1,3,,4]);return[4,fetch(t.toString(),g)];case 2:n=e.sent();return[3,4];case 3:a=e.sent();if(a instanceof Error){return[2,{baseUrl:r,errors:[{message:a.message,type:"unknown"}],json:null,response:null,zonosMode:null}]}s="Failed to fetch";return[2,{baseUrl:r,errors:[{message:s,type:"unknown"}],json:null,response:null,zonosMode:null}];case 4:u=n.headers.get("Zonos-Mode");l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&u&&l){window.Zonos.modeAlerted=true}if(!n.ok)return[3,6];return[4,getResponseBody({response:n})];case 5:d=e.sent();return[2,{baseUrl:r,errors:[],json:d,response:n,zonosMode:u}];case 6:c=n.status.toString();e.label=7;case 7:e.trys.push([7,9,,10]);return[4,getResponseBody({response:n,shouldThrow:true})];case 8:d=e.sent();if(d&&"errors"in d&&Array.isArray(d.errors)){f=d.errors;v=f.map((function(e){if(typeof e==="string"){return{message:e,type:c}}return e}));return[2,{baseUrl:r,errors:v,json:null,response:n,zonosMode:u}]}s=JSON.stringify(d);return[2,{baseUrl:r,errors:[{message:s,type:c}],json:null,response:n,zonosMode:u}];case 9:w=e.sent();s="Unknown error";return[2,{baseUrl:r,errors:[{message:"".concat(c,": ").concat(s),type:c}],json:null,response:null,zonosMode:u}];case 10:return[2]}}))}))};var handleRequestWithFallback=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,r,o,t,i,a,s,u,l,d,c,f,v,w,p,g,h;var b=e.basePathType,A=e.options,y=e.path;return __generator(this,(function(e){switch(e.label){case 0:o=y.startsWith("/api/bigcommerce");t=o?"vercel":b;i=performance.now();return[4,handleRequest({basePathType:t,options:A,path:y})];case 1:a=e.sent(),s=a.errors,u=a.response,l=__rest(a,["errors","response"]);d=performance.now();c=d-i;log("".concat(y," (").concat(c.toFixed(2),"ms)"),"info");f=u===null||u===void 0?void 0:u.headers.get("Zonos-Duration");if((u===null||u===void 0?void 0:u.status)===200){prepLoadTimeApiLog({apiPath:y,apiType:t,loadTimeInternal:f?Number(f):0,loadTimeTotal:c})}v=getNextFallbackApiType(t);w=s.find((function(e){var n=e.type;return n==="unknown"}));p=s.find((function(e){var n=e.message;return typeof n==="string"&&(n.includes("signal is aborted")||n.includes("The operation was aborted")||n.includes("Fetch is aborted"))}));g=!!w||(u===null||u===void 0?void 0:u.status)===404||(u===null||u===void 0?void 0:u.status)===500;h=v&&g;if(g&&!p){void sendErrorLog({endpoint:fallbackApiList[t]+y,errors:s.map((function(e){var n=e.message;return"API: ".concat(n)})),metadata:{currentBasePath:t,nextFallbackApiType:v,requestHeaders:A===null||A===void 0?void 0:A.headers,requestPayload:jsonParse((n=A===null||A===void 0?void 0:A.body)===null||n===void 0?void 0:n.toString())||((r=A===null||A===void 0?void 0:A.body)===null||r===void 0?void 0:r.toString()),shouldCallFallback:h,status:u===null||u===void 0?void 0:u.status,statusText:u===null||u===void 0?void 0:u.statusText},shouldPostReleaseErrorReporting:true})}if(h){log('=== "'.concat(y,'" failed to fetch, trying next fallback ').concat(v));return[2,handleRequestWithFallback({basePathType:v,options:A,path:y})]}return[2,Object.assign({errors:s,response:u},l)]}}))}))};var handleFetch=function(e,n){return __awaiter(void 0,void 0,void 0,(function(){var r,o,t,i,a,s;return __generator(this,(function(u){r=__rest(n||{},[]);o=r.body?JSON.stringify(r.body):undefined;t=r.method||"GET";i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":getIsStagingMode()?"1":undefined,"Zonos-Test-Mode":getIsTestMode()?"1":undefined,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},r.headers);Object.keys(i).forEach((function(e){return i[e]===undefined&&delete i[e]}));a=Object.assign(Object.assign({},r),{body:t==="GET"?undefined:o,headers:i,method:t});s=new URLSearchParams(window.location.search).get("useFallbackApi");return[2,handleRequestWithFallback({basePathType:s||MAIN_BASE_API_TYPE,options:a,path:e})]}))}))};export{getIsStagingMode as a,getAdditionalLogMetadata as b,fallbackApiList as f,getIsTestMode as g,handleFetch as h,isCheckoutMobile as i,jsonParse as j,logError as l,sendErrorLog as s};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,o,t){function r(e){return e instanceof o?e:new o((function(n){n(e)}))}return new(o||(o=Promise))((function(o,i){function a(e){try{c(t.next(e))}catch(e){i(e)}}function s(e){try{c(t["throw"](e))}catch(e){i(e)}}function c(e){e.done?o(e.value):r(e.value).then(a,s)}c((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,r,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return c([e,n])}}function c(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(t=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1];i=s;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(s);break}if(i[2])o.ops.pop();o.trys.pop();continue}s=n.call(e,o)}catch(e){s=[6,e];r=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,o){if(o||arguments.length===2)for(var t=0,r=n.length,i;t<r;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getGenericSettingsOverride,I as IframeService}from"./getGenericSettingsOverride-0bc3e118.js";import{g as getIsTestMode,a as getIsStagingMode,l as log,h as handleFetch,b as logError}from"./handleFetch-99218189.js";import{g as getAbandonedCartRenewTokenValue,_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-724d7bae.js";export{a as availableTestKeys}from"./VarianceTest-fef2d958.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./TaxId-50d72254.js";var checkIfLoadVersionDomain=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var t=["qa.js.zonos.com"];var r=new URL(n).origin;var i=o.some((function(e){return r.includes(e)}));var a=t.some((function(e){return r.includes(e)}));return{currentLoadScriptUrl:r,isForceLoadVersionDomain:a,isWhiteListed:i}};var fallbackList=["jsdelivr","cdnjs","unpkg","vercel"];var MAIN_LOAD_CDN_TYPE="jsdelivr";var getNextFallbackUrl=function(e){var n=fallbackList.indexOf(e);var o=fallbackList[n+1];return o||null};var getWithTestPublicCredential=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,n,o,t,r,i;return __generator(this,(function(a){switch(a.label){case 0:e=getIsTestMode();n=getIsStagingMode();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}log("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){log("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,handleFetch("/api/get-test-public-credential")];case 1:o=a.sent(),t=o.errors,r=o.json;if(t.length||!r){logError("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t);return[2,null]}i=r.publicCredential;if(!i){logError("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}log("[ZONOS - loadZonos] Retrieve new test public token ".concat(i),"info");return[2,i]}}))}))};var extractZonosQaUrl=function(e){if(!e){return null}var n=new URL(e).searchParams;var o=n.get("zonosQaUrl");if(!o){return null}var t=/[^a-zA-Z0-9-_]+/.test(o);if(!!t){return null}return o};var getZonosQaUrl=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var o="https://v1.3.223.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-"))){return o}if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var t="preview.js.zonos.com";var r="https://".concat(n,".").concat(t);log("[ZONOS-WARNING] using '".concat(r,"' for loading elements script"),"warn");void fetch(r).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var o="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",o);window.location.reload();return null}));return r};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var e=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var n=0;n<e.length;n++){var o=e[n];if(!o){continue}if(!V3_URL_REGEX.test(o.src)){continue}return o}return null};var stripePromise$1=null;var injectScript=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var o=document.createElement("script");o.src="".concat(V3_URL).concat(n);var t=document.head||document.body;if(!t){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}t.appendChild(o);return o};var zonosStripeLoadScript=function(e){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(n,o){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){n(window.Stripe);return}try{var t=zonosStripeFindScript();if(t&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!t){t=injectScript(e)}t===null||t===void 0?void 0:t.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{o(new Error("Stripe.js not available"))}}));t===null||t===void 0?void 0:t.addEventListener("error",(function(){o(new Error("Failed to load Stripe.js"))}))}catch(e){o(e);return}}));return stripePromise$1};var registerWrapper=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var initStripe=function(e,n,o){if(e===null){return null}var t=e.apply(undefined,n);registerWrapper(t,o);return t};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(e){if(!loadCalled){console.warn(e)}}));var zonosLoadStripe=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(void 0,void 0,void 0,(function(){var n;return __generator(this,(function(o){loadCalled=true;n=Date.now();return[2,stripePromise.then((function(o){return initStripe(o,e,n)}))]}))}))};var TEMP_CART_ID_QUERY_PARAM="tempCartUUID";var getCartIdFromQueryParam=function(){var e=new URLSearchParams(window.location.search);var n=e.get(TEMP_CART_ID_QUERY_PARAM);return n};var getCartInfoById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,o,t,r,i,a,s,c,u;var d=e.cartId,l=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=getIsTestMode();o=getGenericSettingsOverride();t=getAbandonedCartRenewTokenValue()||undefined;r=new URLSearchParams;if(o.overrideShouldEnabledCustomAddress){r.set("overrideShouldEnabledCustomAddress",o.overrideShouldEnabledCustomAddress)}return[4,handleFetch("/api/zonos-elements/get-cart?".concat(r.toString()),{body:{isTestMode:n,renewCartExpirationToken:t,tempCartUUID:d},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:i=e.sent(),a=i.errors,s=i.json,c=i.zonosMode;u=!s||a.length;if(!(u&&l))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:l});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getCartInfoById({cartId:d,retries:l-1})];case 3:if(u){return[2,null]}return[2,Object.assign(Object.assign({},s),{zonosMode:c})]}}))}))};var setupCartDataWithSettings=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r;return __generator(this,(function(i){switch(i.label){case 0:n=_getIsValidCartId(e),o=n.isDgsCartId,t=n.isLegacyCartId;if(!t&&!o){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,getCartInfoById({cartId:e,retries:5})];case 1:r=i.sent();log("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;window.Zonos.zonosMode=r.zonosMode;return[2,{cartData:r.cartData,settings:r.settings,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var _a;var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=checkIfLoadVersionDomain({loadScriptSrc:e===null||e===void 0?void 0:e.src}),o=n.currentLoadScriptUrl,t=n.isWhiteListed;if(t){return o}return null}();var ZONOS_URL="https://v1.3.223.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.223";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.223";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.223";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var GOOGLE_FONT_REGEX=/^https:\/\/fonts\.googleapis\.com/;var Zonos=function(){function e(){}return e}();_a=Zonos;Zonos.doneInit=false;Zonos.cartSettings=null;Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;Zonos.isBigCommerce=false;Zonos.releaseDate="1752091697360";Zonos.isLegacyCheckout=false;Zonos.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.overrideUseCustomAddressForm=false;Zonos.isCollect=false;Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.3.223");Zonos.modeAlerted=false;Zonos.cartData=null;Zonos.paypal=null;Zonos.zonosMode=null;Zonos.IframeService=IframeService;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.loadTimeApiInfoList=[];Zonos.logIntervalId=null;Zonos.init=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r,i,a,s,c,u,d,l,f,v,m,_;return __generator(this,(function(p){switch(p.label){case 0:n=e.appearance,o=e.checkoutSettings,t=e.currencyConverter,r=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,s=e.storeId,c=e.zonosApiKey;_a.cartId=getCartIdFromQueryParam();if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));_a.zonosApiKey=c;_a.storeId=s;if(!_a.isNpm)return[3,4];log("====== ZONOS LOADING FROM NPM ======");u=getZonosQaUrl();if(u&&!window.isZonosPreview){log('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(u," ======"),"info");d=document.createElement("script");d.src="".concat(u,"/dist/scripts/zonos.js");document.head.appendChild(d);d.addEventListener("load",(function(){window.Zonos.isNpm=_a.isNpm;window.Zonos.isBigCommerce=_a.isBigCommerce;window.Zonos.isLegacyCheckout=_a.isLegacyCheckout;void window.Zonos.init(e)}));d.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(u))}));window.isZonosPreview=true;return[2]}if(!c&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!_a.cartData&&_a.cartId))return[3,2];log("Initialize cart data");return[4,setupCartDataWithSettings(_a.cartId)];case 1:l=p.sent();if(!l){logError("Failed to get cart data");return[2]}_a.cartData=l.cartData;_a.zonosApiKey=l.zonosApiKey;_a.cartSettings=l.settings;p.label=2;case 2:return[4,getWithTestPublicCredential()];case 3:f=p.sent();if(f){_a.zonosApiKey=f}p.label=4;case 4:v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");m=_a.cartId&&_a.cartData||!!v;if(m){log("Cart data or stripe client secret is available, inject hidden button and trigger checkout");_=document.createElement("button");_.style.display="none";_.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(_)}log("init zonos");_a.restoreNativeBrowserFunctions();_a.injectCustomScriptForHostedCheckout();_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectCheckoutInternationalButton();_a.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:a}});_a.doneInit=true;return[2]}}))}))};Zonos.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector))){var e=document.createElement("button");e.id=checkoutHiddenInternationalBtnSelector;e.style.display="none";document.body.appendChild(e)}};Zonos.injectCustomScriptForHostedCheckout=function(){var e=_a.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var o=n.find((function(e){return e.key==="customHeaderScript"}));var t=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!o&&!t){log("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(o){log("Injecting custom header script");var r=document.createElement("script");r.textContent=o.value;document.head.appendChild(r)}if(t){log("Injecting custom footer script");var r=document.createElement("script");r.textContent=t.value;document.body.appendChild(r)}};Zonos.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};Zonos.triggerCheckoutInternational=function(){return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector));setTimeout((function(){if(e){e.dispatchEvent(createCustomEvent("click"))}}),10);return[2]}))}))};Zonos.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};Zonos.showNotification=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.showNotification(e))};Zonos.updateOrganizationName=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};Zonos.disablePlaceOrderButtons=function(e){var n=e.autoEnable,o=n===void 0?true:n,t=e.config,r=e.disable,i=e.placeOrderButtonSelector;var a;if((a=t.checkoutSettings)===null||a===void 0?void 0:a.disablePlaceOrderButtonActivation){return}if(i){var s=document.querySelectorAll(i);var c=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};s.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(r){e.setAttribute("disabled","true");e.addEventListener("click",c)}else{e.removeAttribute("disabled");e.removeEventListener("click",c)}}));if(o&&r){setTimeout((function(){s.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",c)}))}),5e3)}}};Zonos.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var o="zonos---native-browser";var t=document.querySelector("iframe#".concat(o));if(!t){t=document.createElement("iframe");t.id=o;t.style.display="none";t.style.opacity="0";t.style.position="absolute";t.style.top="-9999px";t.style.left="-9999px";t.style.width="1px";t.style.height="1px";t.style.border="none";t.style.overflow="hidden";t.style.visibility="hidden";document.body.appendChild(t)}var r=((e=t.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=r;document.body.removeChild(t)};Zonos.injectController=function(e){var n=e.config;var o,t;if(document.querySelector("zonos-controller")){return}if((o=n.checkoutSettings)===null||o===void 0?void 0:o.placeOrderButtonSelector){var r=n.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r})}));i.observe(document.body,{childList:true,subtree:true})}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=n;s.zonosApiKey=_a.zonosApiKey||"";s.addEventListener("stripeInitEvent",(function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o;return __generator(this,(function(t){switch(t.label){case 0:n=e.detail;log("loading Stripe");return[4,zonosLoadStripe(n.publishableKey)];case 1:o=t.sent();if(!o){logError("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=o;if(window.Zonos.isCollect){void s.initCollectElement(o)}else{void s.initCheckoutElement(o)}return[2]}}))}))}));document.body.appendChild(s);_a.zonosController=s;log("Zonos controller injected!")};Zonos.injectScript=function(e){var n=e.cdnType,o=e.isModule,t=e.theRestUrl;var r=_a.getZonosUrl(n);var i="".concat(r,"/").concat(t);var a=function(){var e=document.querySelector('script[src="'.concat(i,'"]'));return!!e};if(a()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var s=document.head||document.body;var c=document.createElement("script");if(!!o){c.type="module"}else{c.noModule=true}c.src=i;c.crossOrigin="anonymous";c.onerror=function(){logError("Failed to load ".concat(c.src));var e=getNextFallbackUrl(n);if(!e){return}_a.injectScript({cdnType:e,isModule:o,theRestUrl:t})};s.appendChild(c)};Zonos.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;case"cdnjs":return CDNJS_ZONOS_URL;case"vercel":return ZONOS_URL}};if(_a.isNpm){var o=getZonosQaUrl();return o||n()}return n()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(e){var n=e.cdnType,o=e.theRestUrl;var t=_a.getZonosUrl(n);var r=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");r.appendChild(i);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(t,"/").concat(o);a.onerror=function(){logError("Failed to load ".concat(a.href));var e=getNextFallbackUrl(n);if(!e){return}_a.injectStylesheet({cdnType:e,theRestUrl:o})};r.appendChild(a)};Zonos.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){log("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(GOOGLE_FONT_URL,'"]'));for(var o=0;o<n.length;o++){var t=n[o];if(!t){continue}if(GOOGLE_FONT_REGEX.test(t.href)){continue}return t}return null};if(e()){log("Inter font already injected","warn");return}var n=document.head||document.body;var o=document.createElement("link");o.rel="preconnect";o.href=GOOGLE_FONT_URL;n.appendChild(o);var t=document.createElement("link");t.rel="stylesheet";t.href="".concat(GOOGLE_FONT_URL,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(t);log("Zonos font injected!")};Zonos.setupGoogleFont=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};Zonos.injectSupportGoogleFont=function(e){var n;log("[FONT] injecting ".concat(e));var o=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var t=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var r=document.createElement("link");r.rel="preconnect";r.href=GOOGLE_FONT_URL;t.appendChild(r)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){log("[FONT] ".concat(o," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=e;t.appendChild(i);log("[FONT] ".concat(o," font injected!"))};var checkoutSessionMutableAttributeKeys=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"];var checkoutSessionImmutableAttributeKeys=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"];var checkoutSessionAttributeKeys=__spreadArray(__spreadArray([],checkoutSessionMutableAttributeKeys,true),checkoutSessionImmutableAttributeKeys,true);export{Zonos,checkoutSessionAttributeKeys,checkoutSessionImmutableAttributeKeys,checkoutSessionMutableAttributeKeys};
1
+ var __awaiter=this&&this.__awaiter||function(e,n,o,t){function r(e){return e instanceof o?e:new o((function(n){n(e)}))}return new(o||(o=Promise))((function(o,i){function a(e){try{c(t.next(e))}catch(e){i(e)}}function s(e){try{c(t["throw"](e))}catch(e){i(e)}}function c(e){e.done?o(e.value):r(e.value).then(a,s)}c((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,r,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return c([e,n])}}function c(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(t=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1];i=s;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(s);break}if(i[2])o.ops.pop();o.trys.pop();continue}s=n.call(e,o)}catch(e){s=[6,e];r=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,o){if(o||arguments.length===2)for(var t=0,r=n.length,i;t<r;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getGenericSettingsOverride,I as IframeService}from"./getGenericSettingsOverride-0bc3e118.js";import{l as log}from"./VarianceTest-572cecf5.js";export{a as availableTestKeys}from"./VarianceTest-572cecf5.js";import{g as getIsTestMode,a as getIsStagingMode,h as handleFetch,l as logError}from"./handleFetch-a844cac1.js";import{g as getAbandonedCartRenewTokenValue,_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./TaxId-50d72254.js";var checkIfLoadVersionDomain=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var t=["qa.js.zonos.com"];var r=new URL(n).origin;var i=o.some((function(e){return r.includes(e)}));var a=t.some((function(e){return r.includes(e)}));return{currentLoadScriptUrl:r,isForceLoadVersionDomain:a,isWhiteListed:i}};var fallbackList=["jsdelivr","cdnjs","unpkg","vercel"];var MAIN_LOAD_CDN_TYPE="jsdelivr";var getNextFallbackUrl=function(e){var n=fallbackList.indexOf(e);var o=fallbackList[n+1];return o||null};var getWithTestPublicCredential=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,n,o,t,r,i;return __generator(this,(function(a){switch(a.label){case 0:e=getIsTestMode();n=getIsStagingMode();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}log("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){log("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,handleFetch("/api/get-test-public-credential")];case 1:o=a.sent(),t=o.errors,r=o.json;if(t.length||!r){logError("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t);return[2,null]}i=r.publicCredential;if(!i){logError("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}log("[ZONOS - loadZonos] Retrieve new test public token ".concat(i),"info");return[2,i]}}))}))};var extractZonosQaUrl=function(e){if(!e){return null}var n=new URL(e).searchParams;var o=n.get("zonosQaUrl");if(!o){return null}var t=/[^a-zA-Z0-9-_]+/.test(o);if(!!t){return null}return o};var getZonosQaUrl=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var o="https://v1.3.224.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-"))){return o}if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var t="preview.js.zonos.com";var r="https://".concat(n,".").concat(t);log("[ZONOS-WARNING] using '".concat(r,"' for loading elements script"),"warn");void fetch(r).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var o="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",o);window.location.reload();return null}));return r};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var e=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var n=0;n<e.length;n++){var o=e[n];if(!o){continue}if(!V3_URL_REGEX.test(o.src)){continue}return o}return null};var stripePromise$1=null;var injectScript=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var o=document.createElement("script");o.src="".concat(V3_URL).concat(n);var t=document.head||document.body;if(!t){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}t.appendChild(o);return o};var zonosStripeLoadScript=function(e){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(n,o){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){n(window.Stripe);return}try{var t=zonosStripeFindScript();if(t&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!t){t=injectScript(e)}t===null||t===void 0?void 0:t.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{o(new Error("Stripe.js not available"))}}));t===null||t===void 0?void 0:t.addEventListener("error",(function(){o(new Error("Failed to load Stripe.js"))}))}catch(e){o(e);return}}));return stripePromise$1};var registerWrapper=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var initStripe=function(e,n,o){if(e===null){return null}var t=e.apply(undefined,n);registerWrapper(t,o);return t};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(e){if(!loadCalled){console.warn(e)}}));var zonosLoadStripe=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(void 0,void 0,void 0,(function(){var n;return __generator(this,(function(o){loadCalled=true;n=Date.now();return[2,stripePromise.then((function(o){return initStripe(o,e,n)}))]}))}))};var TEMP_CART_ID_QUERY_PARAM="tempCartUUID";var getCartIdFromQueryParam=function(){var e=new URLSearchParams(window.location.search);var n=e.get(TEMP_CART_ID_QUERY_PARAM);return n};var getCartInfoById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,o,t,r,i,a,s,c,u;var d=e.cartId,l=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=getIsTestMode();o=getGenericSettingsOverride();t=getAbandonedCartRenewTokenValue()||undefined;r=new URLSearchParams;if(o.overrideShouldEnabledCustomAddress){r.set("overrideShouldEnabledCustomAddress",o.overrideShouldEnabledCustomAddress)}return[4,handleFetch("/api/zonos-elements/get-cart?".concat(r.toString()),{body:{isTestMode:n,renewCartExpirationToken:t,tempCartUUID:d},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:i=e.sent(),a=i.errors,s=i.json,c=i.zonosMode;u=!s||a.length;if(!(u&&l))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:l});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getCartInfoById({cartId:d,retries:l-1})];case 3:if(u){return[2,null]}return[2,Object.assign(Object.assign({},s),{zonosMode:c})]}}))}))};var setupCartDataWithSettings=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r;return __generator(this,(function(i){switch(i.label){case 0:n=_getIsValidCartId(e),o=n.isDgsCartId,t=n.isLegacyCartId;if(!t&&!o){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,getCartInfoById({cartId:e,retries:5})];case 1:r=i.sent();log("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;window.Zonos.zonosMode=r.zonosMode;return[2,{cartData:r.cartData,settings:r.settings,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var _a;var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=checkIfLoadVersionDomain({loadScriptSrc:e===null||e===void 0?void 0:e.src}),o=n.currentLoadScriptUrl,t=n.isWhiteListed;if(t){return o}return null}();var startLoadTime=Date.now();var ZONOS_URL="https://v1.3.224.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.224";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.224";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.224";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var GOOGLE_FONT_REGEX=/^https:\/\/fonts\.googleapis\.com/;var Zonos=function(){function e(){}return e}();_a=Zonos;Zonos.doneInit=false;Zonos.cartSettings=null;Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;Zonos.isBigCommerce=false;Zonos.releaseDate="1752786758525";Zonos.isLegacyCheckout=false;Zonos.startLoadTime=startLoadTime;Zonos.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.overrideUseCustomAddressForm=false;Zonos.isCollect=false;Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.3.224");Zonos.modeAlerted=false;Zonos.cartData=null;Zonos.paypal=null;Zonos.zonosMode=null;Zonos.IframeService=IframeService;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.loadTimeApiInfoList=[];Zonos.logIntervalId=null;Zonos.init=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r,i,a,s,c,u,d,l,f,v,m,_;return __generator(this,(function(p){switch(p.label){case 0:n=e.appearance,o=e.checkoutSettings,t=e.currencyConverter,r=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,s=e.storeId,c=e.zonosApiKey;_a.cartId=getCartIdFromQueryParam();if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));_a.zonosApiKey=c;_a.storeId=s;if(!_a.isNpm)return[3,4];log("====== ZONOS LOADING FROM NPM ======");u=getZonosQaUrl();if(u&&!window.isZonosPreview){log('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(u," ======"),"info");d=document.createElement("script");d.src="".concat(u,"/dist/scripts/zonos.js");document.head.appendChild(d);d.addEventListener("load",(function(){window.Zonos.isNpm=_a.isNpm;window.Zonos.isBigCommerce=_a.isBigCommerce;window.Zonos.isLegacyCheckout=_a.isLegacyCheckout;window.Zonos.zonosMode=_a.zonosMode;void window.Zonos.init(e)}));d.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(u))}));window.isZonosPreview=true;return[2]}if(!c&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!_a.cartData&&_a.cartId))return[3,2];log("Initialize cart data");return[4,setupCartDataWithSettings(_a.cartId)];case 1:l=p.sent();if(!l){logError("Failed to get cart data");return[2]}_a.cartData=l.cartData;_a.zonosApiKey=l.zonosApiKey;_a.cartSettings=l.settings;p.label=2;case 2:return[4,getWithTestPublicCredential()];case 3:f=p.sent();if(f){_a.zonosApiKey=f}p.label=4;case 4:v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");m=_a.cartId&&_a.cartData||!!v;if(m){log("Cart data or stripe client secret is available, inject hidden button and trigger checkout");_=document.createElement("button");_.style.display="none";_.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(_)}log("init zonos");_a.restoreNativeBrowserFunctions();_a.injectCustomScriptForHostedCheckout();_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectCheckoutInternationalButton();_a.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:a}});_a.doneInit=true;return[2]}}))}))};Zonos.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector))){var e=document.createElement("button");e.id=checkoutHiddenInternationalBtnSelector;e.style.display="none";document.body.appendChild(e)}};Zonos.injectCustomScriptForHostedCheckout=function(){var e=_a.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var o=n.find((function(e){return e.key==="customHeaderScript"}));var t=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!o&&!t){log("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(o){log("Injecting custom header script");var r=document.createElement("script");r.textContent=o.value;document.head.appendChild(r)}if(t){log("Injecting custom footer script");var r=document.createElement("script");r.textContent=t.value;document.body.appendChild(r)}};Zonos.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};Zonos.triggerCheckoutInternational=function(){return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector));setTimeout((function(){if(e){e.dispatchEvent(createCustomEvent("click"))}}),10);return[2]}))}))};Zonos.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};Zonos.showNotification=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.showNotification(e))};Zonos.updateOrganizationName=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};Zonos.disablePlaceOrderButtons=function(e){var n=e.autoEnable,o=n===void 0?true:n,t=e.config,r=e.disable,i=e.placeOrderButtonSelector;var a;if((a=t.checkoutSettings)===null||a===void 0?void 0:a.disablePlaceOrderButtonActivation){return}if(i){var s=document.querySelectorAll(i);var c=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};s.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(r){e.setAttribute("disabled","true");e.addEventListener("click",c)}else{e.removeAttribute("disabled");e.removeEventListener("click",c)}}));if(o&&r){setTimeout((function(){s.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",c)}))}),5e3)}}};Zonos.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var o="zonos---native-browser";var t=document.querySelector("iframe#".concat(o));if(!t){t=document.createElement("iframe");t.id=o;t.style.display="none";t.style.opacity="0";t.style.position="absolute";t.style.top="-9999px";t.style.left="-9999px";t.style.width="1px";t.style.height="1px";t.style.border="none";t.style.overflow="hidden";t.style.visibility="hidden";document.body.appendChild(t)}var r=((e=t.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=r;document.body.removeChild(t)};Zonos.injectController=function(e){var n=e.config;var o,t;if(document.querySelector("zonos-controller")){return}if((o=n.checkoutSettings)===null||o===void 0?void 0:o.placeOrderButtonSelector){var r=n.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r})}));i.observe(document.body,{childList:true,subtree:true})}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=n;s.zonosApiKey=_a.zonosApiKey||"";s.addEventListener("stripeInitEvent",(function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o;return __generator(this,(function(t){switch(t.label){case 0:n=e.detail;log("loading Stripe");return[4,zonosLoadStripe(n.publishableKey)];case 1:o=t.sent();if(!o){logError("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=o;if(window.Zonos.isCollect){void s.initCollectElement(o)}else{void s.initCheckoutElement(o)}return[2]}}))}))}));document.body.appendChild(s);_a.zonosController=s;log("Zonos controller injected!")};Zonos.injectScript=function(e){var n=e.cdnType,o=e.isModule,t=e.theRestUrl;var r=_a.getZonosUrl(n);var i="".concat(r,"/").concat(t);var a=function(){var e=document.querySelector('script[src="'.concat(i,'"]'));return!!e};if(a()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var s=document.head||document.body;var c=document.createElement("script");if(!!o){c.type="module"}else{c.noModule=true}c.src=i;c.crossOrigin="anonymous";c.onerror=function(){logError("Failed to load ".concat(c.src));var e=getNextFallbackUrl(n);if(!e){return}_a.injectScript({cdnType:e,isModule:o,theRestUrl:t})};s.appendChild(c)};Zonos.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;case"cdnjs":return CDNJS_ZONOS_URL;case"vercel":return ZONOS_URL}};if(_a.isNpm){var o=getZonosQaUrl();return o||n()}return n()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(e){var n=e.cdnType,o=e.theRestUrl;var t=_a.getZonosUrl(n);var r=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");r.appendChild(i);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(t,"/").concat(o);a.onerror=function(){logError("Failed to load ".concat(a.href));var e=getNextFallbackUrl(n);if(!e){return}_a.injectStylesheet({cdnType:e,theRestUrl:o})};r.appendChild(a)};Zonos.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){log("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(GOOGLE_FONT_URL,'"]'));for(var o=0;o<n.length;o++){var t=n[o];if(!t){continue}if(GOOGLE_FONT_REGEX.test(t.href)){continue}return t}return null};if(e()){log("Inter font already injected","warn");return}var n=document.head||document.body;var o=document.createElement("link");o.rel="preconnect";o.href=GOOGLE_FONT_URL;n.appendChild(o);var t=document.createElement("link");t.rel="stylesheet";t.href="".concat(GOOGLE_FONT_URL,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(t);log("Zonos font injected!")};Zonos.setupGoogleFont=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};Zonos.injectSupportGoogleFont=function(e){var n;log("[FONT] injecting ".concat(e));var o=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var t=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var r=document.createElement("link");r.rel="preconnect";r.href=GOOGLE_FONT_URL;t.appendChild(r)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){log("[FONT] ".concat(o," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=e;t.appendChild(i);log("[FONT] ".concat(o," font injected!"))};var checkoutSessionMutableAttributeKeys=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"];var checkoutSessionImmutableAttributeKeys=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"];var checkoutSessionAttributeKeys=__spreadArray(__spreadArray([],checkoutSessionMutableAttributeKeys,true),checkoutSessionImmutableAttributeKeys,true);export{Zonos,checkoutSessionAttributeKeys,checkoutSessionImmutableAttributeKeys,checkoutSessionMutableAttributeKeys};
@@ -1 +1 @@
1
- import{a as commonjsGlobal}from"./zonosStore-c456b933.js";var tinycolor$1={exports:{}};(function(t,r){(function(r,e){t.exports=e()})(commonjsGlobal,(function(){function t(r){"@babel/helpers - typeof";return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/;var e=/\s+$/;function a(t,r){t=t?t:"";r=r||{};if(t instanceof a){return t}if(!(this instanceof a)){return new a(t,r)}var e=n(t);this._originalInput=t,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=r.format||e.format;this._gradientType=r.gradientType;if(this._r<1)this._r=Math.round(this._r);if(this._g<1)this._g=Math.round(this._g);if(this._b<1)this._b=Math.round(this._b);this._ok=e.ok}a.prototype={isDark:function t(){return this.getBrightness()<128},isLight:function t(){return!this.isDark()},isValid:function t(){return this._ok},getOriginalInput:function t(){return this._originalInput},getFormat:function t(){return this._format},getAlpha:function t(){return this._a},getBrightness:function t(){var r=this.toRgb();return(r.r*299+r.g*587+r.b*114)/1e3},getLuminance:function t(){var r=this.toRgb();var e,a,n,i,f,s;e=r.r/255;a=r.g/255;n=r.b/255;if(e<=.03928)i=e/12.92;else i=Math.pow((e+.055)/1.055,2.4);if(a<=.03928)f=a/12.92;else f=Math.pow((a+.055)/1.055,2.4);if(n<=.03928)s=n/12.92;else s=Math.pow((n+.055)/1.055,2.4);return.2126*i+.7152*f+.0722*s},setAlpha:function t(r){this._a=q(r);this._roundA=Math.round(100*this._a)/100;return this},toHsv:function t(){var r=h(this._r,this._g,this._b);return{h:r.h*360,s:r.s,v:r.v,a:this._a}},toHsvString:function t(){var r=h(this._r,this._g,this._b);var e=Math.round(r.h*360),a=Math.round(r.s*100),n=Math.round(r.v*100);return this._a==1?"hsv("+e+", "+a+"%, "+n+"%)":"hsva("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHsl:function t(){var r=f(this._r,this._g,this._b);return{h:r.h*360,s:r.s,l:r.l,a:this._a}},toHslString:function t(){var r=f(this._r,this._g,this._b);var e=Math.round(r.h*360),a=Math.round(r.s*100),n=Math.round(r.l*100);return this._a==1?"hsl("+e+", "+a+"%, "+n+"%)":"hsla("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHex:function t(r){return o(this._r,this._g,this._b,r)},toHexString:function t(r){return"#"+this.toHex(r)},toHex8:function t(r){return l(this._r,this._g,this._b,this._a,r)},toHex8String:function t(r){return"#"+this.toHex8(r)},toRgb:function t(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function t(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function t(){return{r:Math.round(E(this._r,255)*100)+"%",g:Math.round(E(this._g,255)*100)+"%",b:Math.round(E(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function t(){return this._a==1?"rgb("+Math.round(E(this._r,255)*100)+"%, "+Math.round(E(this._g,255)*100)+"%, "+Math.round(E(this._b,255)*100)+"%)":"rgba("+Math.round(E(this._r,255)*100)+"%, "+Math.round(E(this._g,255)*100)+"%, "+Math.round(E(this._b,255)*100)+"%, "+this._roundA+")"},toName:function t(){if(this._a===0){return"transparent"}if(this._a<1){return false}return S[o(this._r,this._g,this._b,true)]||false},toFilter:function t(r){var e="#"+c(this._r,this._g,this._b,this._a);var n=e;var i=this._gradientType?"GradientType = 1, ":"";if(r){var f=a(r);n="#"+c(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function t(r){var e=!!r;r=r||this._format;var a=false;var n=this._a<1&&this._a>=0;var i=!e&&n&&(r==="hex"||r==="hex6"||r==="hex3"||r==="hex4"||r==="hex8"||r==="name");if(i){if(r==="name"&&this._a===0){return this.toName()}return this.toRgbString()}if(r==="rgb"){a=this.toRgbString()}if(r==="prgb"){a=this.toPercentageRgbString()}if(r==="hex"||r==="hex6"){a=this.toHexString()}if(r==="hex3"){a=this.toHexString(true)}if(r==="hex4"){a=this.toHex8String(true)}if(r==="hex8"){a=this.toHex8String()}if(r==="name"){a=this.toName()}if(r==="hsl"){a=this.toHslString()}if(r==="hsv"){a=this.toHsvString()}return a||this.toHexString()},clone:function t(){return a(this.toString())},_applyModification:function t(r,e){var a=r.apply(null,[this].concat([].slice.call(e)));this._r=a._r;this._g=a._g;this._b=a._b;this.setAlpha(a._a);return this},lighten:function t(){return this._applyModification(v,arguments)},brighten:function t(){return this._applyModification(m,arguments)},darken:function t(){return this._applyModification(M,arguments)},desaturate:function t(){return this._applyModification(d,arguments)},saturate:function t(){return this._applyModification(b,arguments)},greyscale:function t(){return this._applyModification(g,arguments)},spin:function t(){return this._applyModification(p,arguments)},_applyCombination:function t(r,e){return r.apply(null,[this].concat([].slice.call(e)))},analogous:function t(){return this._applyCombination(w,arguments)},complement:function t(){return this._applyCombination(y,arguments)},monochromatic:function t(){return this._applyCombination(x,arguments)},splitcomplement:function t(){return this._applyCombination(A,arguments)},triad:function t(){return this._applyCombination(k,[3])},tetrad:function t(){return this._applyCombination(k,[4])}};a.fromRatio=function(r,e){if(t(r)=="object"){var n={};for(var i in r){if(r.hasOwnProperty(i)){if(i==="a"){n[i]=r[i]}else{n[i]=z(r[i])}}}r=n}return a(r,e)};function n(r){var e={r:0,g:0,b:0};var a=1;var n=null;var f=null;var h=null;var o=false;var l=false;if(typeof r=="string"){r=_(r)}if(t(r)=="object"){if(T(r.r)&&T(r.g)&&T(r.b)){e=i(r.r,r.g,r.b);o=true;l=String(r.r).substr(-1)==="%"?"prgb":"rgb"}else if(T(r.h)&&T(r.s)&&T(r.v)){n=z(r.s);f=z(r.v);e=u(r.h,n,f);o=true;l="hsv"}else if(T(r.h)&&T(r.s)&&T(r.l)){n=z(r.s);h=z(r.l);e=s(r.h,n,h);o=true;l="hsl"}if(r.hasOwnProperty("a")){a=r.a}}a=q(a);return{ok:o,format:r.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:a}}function i(t,r,e){return{r:E(t,255)*255,g:E(r,255)*255,b:E(e,255)*255}}function f(t,r,e){t=E(t,255);r=E(r,255);e=E(e,255);var a=Math.max(t,r,e),n=Math.min(t,r,e);var i,f,s=(a+n)/2;if(a==n){i=f=0}else{var h=a-n;f=s>.5?h/(2-a-n):h/(a+n);switch(a){case t:i=(r-e)/h+(r<e?6:0);break;case r:i=(e-t)/h+2;break;case e:i=(t-r)/h+4;break}i/=6}return{h:i,s:f,l:s}}function s(t,r,e){var a,n,i;t=E(t,360);r=E(r,100);e=E(e,100);function f(t,r,e){if(e<0)e+=1;if(e>1)e-=1;if(e<1/6)return t+(r-t)*6*e;if(e<1/2)return r;if(e<2/3)return t+(r-t)*(2/3-e)*6;return t}if(r===0){a=n=i=e}else{var s=e<.5?e*(1+r):e+r-e*r;var h=2*e-s;a=f(h,s,t+1/3);n=f(h,s,t);i=f(h,s,t-1/3)}return{r:a*255,g:n*255,b:i*255}}function h(t,r,e){t=E(t,255);r=E(r,255);e=E(e,255);var a=Math.max(t,r,e),n=Math.min(t,r,e);var i,f,s=a;var h=a-n;f=a===0?0:h/a;if(a==n){i=0}else{switch(a){case t:i=(r-e)/h+(r<e?6:0);break;case r:i=(e-t)/h+2;break;case e:i=(t-r)/h+4;break}i/=6}return{h:i,s:f,v:s}}function u(t,r,e){t=E(t,360)*6;r=E(r,100);e=E(e,100);var a=Math.floor(t),n=t-a,i=e*(1-r),f=e*(1-n*r),s=e*(1-(1-n)*r),h=a%6,u=[e,f,i,i,s,e][h],o=[s,e,e,f,i,i][h],l=[i,i,s,e,e,f][h];return{r:u*255,g:o*255,b:l*255}}function o(t,r,e,a){var n=[N(Math.round(t).toString(16)),N(Math.round(r).toString(16)),N(Math.round(e).toString(16))];if(a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)){return n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)}return n.join("")}function l(t,r,e,a,n){var i=[N(Math.round(t).toString(16)),N(Math.round(r).toString(16)),N(Math.round(e).toString(16)),N(I(a))];if(n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)){return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0)}return i.join("")}function c(t,r,e,a){var n=[N(I(a)),N(Math.round(t).toString(16)),N(Math.round(r).toString(16)),N(Math.round(e).toString(16))];return n.join("")}a.equals=function(t,r){if(!t||!r)return false;return a(t).toRgbString()==a(r).toRgbString()};a.random=function(){return a.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function d(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.s-=r/100;e.s=H(e.s);return a(e)}function b(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.s+=r/100;e.s=H(e.s);return a(e)}function g(t){return a(t).desaturate(100)}function v(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.l+=r/100;e.l=H(e.l);return a(e)}function m(t,r){r=r===0?0:r||10;var e=a(t).toRgb();e.r=Math.max(0,Math.min(255,e.r-Math.round(255*-(r/100))));e.g=Math.max(0,Math.min(255,e.g-Math.round(255*-(r/100))));e.b=Math.max(0,Math.min(255,e.b-Math.round(255*-(r/100))));return a(e)}function M(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.l-=r/100;e.l=H(e.l);return a(e)}function p(t,r){var e=a(t).toHsl();var n=(e.h+r)%360;e.h=n<0?360+n:n;return a(e)}function y(t){var r=a(t).toHsl();r.h=(r.h+180)%360;return a(r)}function k(t,r){if(isNaN(r)||r<=0){throw new Error("Argument to polyad must be a positive number")}var e=a(t).toHsl();var n=[a(t)];var i=360/r;for(var f=1;f<r;f++){n.push(a({h:(e.h+f*i)%360,s:e.s,l:e.l}))}return n}function A(t){var r=a(t).toHsl();var e=r.h;return[a(t),a({h:(e+72)%360,s:r.s,l:r.l}),a({h:(e+216)%360,s:r.s,l:r.l})]}function w(t,r,e){r=r||6;e=e||30;var n=a(t).toHsl();var i=360/e;var f=[a(t)];for(n.h=(n.h-(i*r>>1)+720)%360;--r;){n.h=(n.h+i)%360;f.push(a(n))}return f}function x(t,r){r=r||6;var e=a(t).toHsv();var n=e.h,i=e.s,f=e.v;var s=[];var h=1/r;while(r--){s.push(a({h:n,s:i,v:f}));f=(f+h)%1}return s}a.mix=function(t,r,e){e=e===0?0:e||50;var n=a(t).toRgb();var i=a(r).toRgb();var f=e/100;var s={r:(i.r-n.r)*f+n.r,g:(i.g-n.g)*f+n.g,b:(i.b-n.b)*f+n.b,a:(i.a-n.a)*f+n.a};return a(s)};a.readability=function(t,r){var e=a(t);var n=a(r);return(Math.max(e.getLuminance(),n.getLuminance())+.05)/(Math.min(e.getLuminance(),n.getLuminance())+.05)};a.isReadable=function(t,r,e){var n=a.readability(t,r);var i,f;f=false;i=L(e);switch(i.level+i.size){case"AAsmall":case"AAAlarge":f=n>=4.5;break;case"AAlarge":f=n>=3;break;case"AAAsmall":f=n>=7;break}return f};a.mostReadable=function(t,r,e){var n=null;var i=0;var f;var s,h,u;e=e||{};s=e.includeFallbackColors;h=e.level;u=e.size;for(var o=0;o<r.length;o++){f=a.readability(t,r[o]);if(f>i){i=f;n=a(r[o])}}if(a.isReadable(t,n,{level:h,size:u})||!s){return n}else{e.includeFallbackColors=false;return a.mostReadable(t,["#fff","#000"],e)}};var F=a.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var S=a.hexNames=R(F);function R(t){var r={};for(var e in t){if(t.hasOwnProperty(e)){r[t[e]]=e}}return r}function q(t){t=parseFloat(t);if(isNaN(t)||t<0||t>1){t=1}return t}function E(t,r){if(j(t))t="100%";var e=C(t);t=Math.min(r,Math.max(0,parseFloat(t)));if(e){t=parseInt(t*r,10)/100}if(Math.abs(t-r)<1e-6){return 1}return t%r/parseFloat(r)}function H(t){return Math.min(1,Math.max(0,t))}function $(t){return parseInt(t,16)}function j(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function C(t){return typeof t==="string"&&t.indexOf("%")!=-1}function N(t){return t.length==1?"0"+t:""+t}function z(t){if(t<=1){t=t*100+"%"}return t}function I(t){return Math.round(parseFloat(t)*255).toString(16)}function D(t){return $(t)/255}var G=function(){var t="[-\\+]?\\d+%?";var r="[-\\+]?\\d*\\.\\d+%?";var e="(?:"+r+")|(?:"+t+")";var a="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";var n="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+a),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+a),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+a),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function T(t){return!!G.CSS_UNIT.exec(t)}function _(t){t=t.replace(r,"").replace(e,"").toLowerCase();var a=false;if(F[t]){t=F[t];a=true}else if(t=="transparent"){return{r:0,g:0,b:0,a:0,format:"name"}}var n;if(n=G.rgb.exec(t)){return{r:n[1],g:n[2],b:n[3]}}if(n=G.rgba.exec(t)){return{r:n[1],g:n[2],b:n[3],a:n[4]}}if(n=G.hsl.exec(t)){return{h:n[1],s:n[2],l:n[3]}}if(n=G.hsla.exec(t)){return{h:n[1],s:n[2],l:n[3],a:n[4]}}if(n=G.hsv.exec(t)){return{h:n[1],s:n[2],v:n[3]}}if(n=G.hsva.exec(t)){return{h:n[1],s:n[2],v:n[3],a:n[4]}}if(n=G.hex8.exec(t)){return{r:$(n[1]),g:$(n[2]),b:$(n[3]),a:D(n[4]),format:a?"name":"hex8"}}if(n=G.hex6.exec(t)){return{r:$(n[1]),g:$(n[2]),b:$(n[3]),format:a?"name":"hex"}}if(n=G.hex4.exec(t)){return{r:$(n[1]+""+n[1]),g:$(n[2]+""+n[2]),b:$(n[3]+""+n[3]),a:D(n[4]+""+n[4]),format:a?"name":"hex8"}}if(n=G.hex3.exec(t)){return{r:$(n[1]+""+n[1]),g:$(n[2]+""+n[2]),b:$(n[3]+""+n[3]),format:a?"name":"hex"}}return false}function L(t){var r,e;t=t||{level:"AA",size:"small"};r=(t.level||"AA").toUpperCase();e=(t.size||"small").toLowerCase();if(r!=="AA"&&r!=="AAA"){r="AA"}if(e!=="small"&&e!=="large"){e="small"}return{level:r,size:e}}return a}))})(tinycolor$1);var tinycolor=tinycolor$1.exports;var isDarkColor=function(t){return tinycolor(t).isDark()};export{isDarkColor as i,tinycolor as t};
1
+ import{a as commonjsGlobal}from"./zonosStore-e3d0493a.js";var tinycolor$1={exports:{}};(function(t,r){(function(r,e){t.exports=e()})(commonjsGlobal,(function(){function t(r){"@babel/helpers - typeof";return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/;var e=/\s+$/;function a(t,r){t=t?t:"";r=r||{};if(t instanceof a){return t}if(!(this instanceof a)){return new a(t,r)}var e=n(t);this._originalInput=t,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=r.format||e.format;this._gradientType=r.gradientType;if(this._r<1)this._r=Math.round(this._r);if(this._g<1)this._g=Math.round(this._g);if(this._b<1)this._b=Math.round(this._b);this._ok=e.ok}a.prototype={isDark:function t(){return this.getBrightness()<128},isLight:function t(){return!this.isDark()},isValid:function t(){return this._ok},getOriginalInput:function t(){return this._originalInput},getFormat:function t(){return this._format},getAlpha:function t(){return this._a},getBrightness:function t(){var r=this.toRgb();return(r.r*299+r.g*587+r.b*114)/1e3},getLuminance:function t(){var r=this.toRgb();var e,a,n,i,f,s;e=r.r/255;a=r.g/255;n=r.b/255;if(e<=.03928)i=e/12.92;else i=Math.pow((e+.055)/1.055,2.4);if(a<=.03928)f=a/12.92;else f=Math.pow((a+.055)/1.055,2.4);if(n<=.03928)s=n/12.92;else s=Math.pow((n+.055)/1.055,2.4);return.2126*i+.7152*f+.0722*s},setAlpha:function t(r){this._a=q(r);this._roundA=Math.round(100*this._a)/100;return this},toHsv:function t(){var r=h(this._r,this._g,this._b);return{h:r.h*360,s:r.s,v:r.v,a:this._a}},toHsvString:function t(){var r=h(this._r,this._g,this._b);var e=Math.round(r.h*360),a=Math.round(r.s*100),n=Math.round(r.v*100);return this._a==1?"hsv("+e+", "+a+"%, "+n+"%)":"hsva("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHsl:function t(){var r=f(this._r,this._g,this._b);return{h:r.h*360,s:r.s,l:r.l,a:this._a}},toHslString:function t(){var r=f(this._r,this._g,this._b);var e=Math.round(r.h*360),a=Math.round(r.s*100),n=Math.round(r.l*100);return this._a==1?"hsl("+e+", "+a+"%, "+n+"%)":"hsla("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHex:function t(r){return o(this._r,this._g,this._b,r)},toHexString:function t(r){return"#"+this.toHex(r)},toHex8:function t(r){return l(this._r,this._g,this._b,this._a,r)},toHex8String:function t(r){return"#"+this.toHex8(r)},toRgb:function t(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function t(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function t(){return{r:Math.round(E(this._r,255)*100)+"%",g:Math.round(E(this._g,255)*100)+"%",b:Math.round(E(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function t(){return this._a==1?"rgb("+Math.round(E(this._r,255)*100)+"%, "+Math.round(E(this._g,255)*100)+"%, "+Math.round(E(this._b,255)*100)+"%)":"rgba("+Math.round(E(this._r,255)*100)+"%, "+Math.round(E(this._g,255)*100)+"%, "+Math.round(E(this._b,255)*100)+"%, "+this._roundA+")"},toName:function t(){if(this._a===0){return"transparent"}if(this._a<1){return false}return S[o(this._r,this._g,this._b,true)]||false},toFilter:function t(r){var e="#"+c(this._r,this._g,this._b,this._a);var n=e;var i=this._gradientType?"GradientType = 1, ":"";if(r){var f=a(r);n="#"+c(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function t(r){var e=!!r;r=r||this._format;var a=false;var n=this._a<1&&this._a>=0;var i=!e&&n&&(r==="hex"||r==="hex6"||r==="hex3"||r==="hex4"||r==="hex8"||r==="name");if(i){if(r==="name"&&this._a===0){return this.toName()}return this.toRgbString()}if(r==="rgb"){a=this.toRgbString()}if(r==="prgb"){a=this.toPercentageRgbString()}if(r==="hex"||r==="hex6"){a=this.toHexString()}if(r==="hex3"){a=this.toHexString(true)}if(r==="hex4"){a=this.toHex8String(true)}if(r==="hex8"){a=this.toHex8String()}if(r==="name"){a=this.toName()}if(r==="hsl"){a=this.toHslString()}if(r==="hsv"){a=this.toHsvString()}return a||this.toHexString()},clone:function t(){return a(this.toString())},_applyModification:function t(r,e){var a=r.apply(null,[this].concat([].slice.call(e)));this._r=a._r;this._g=a._g;this._b=a._b;this.setAlpha(a._a);return this},lighten:function t(){return this._applyModification(v,arguments)},brighten:function t(){return this._applyModification(m,arguments)},darken:function t(){return this._applyModification(M,arguments)},desaturate:function t(){return this._applyModification(d,arguments)},saturate:function t(){return this._applyModification(b,arguments)},greyscale:function t(){return this._applyModification(g,arguments)},spin:function t(){return this._applyModification(p,arguments)},_applyCombination:function t(r,e){return r.apply(null,[this].concat([].slice.call(e)))},analogous:function t(){return this._applyCombination(w,arguments)},complement:function t(){return this._applyCombination(y,arguments)},monochromatic:function t(){return this._applyCombination(x,arguments)},splitcomplement:function t(){return this._applyCombination(A,arguments)},triad:function t(){return this._applyCombination(k,[3])},tetrad:function t(){return this._applyCombination(k,[4])}};a.fromRatio=function(r,e){if(t(r)=="object"){var n={};for(var i in r){if(r.hasOwnProperty(i)){if(i==="a"){n[i]=r[i]}else{n[i]=z(r[i])}}}r=n}return a(r,e)};function n(r){var e={r:0,g:0,b:0};var a=1;var n=null;var f=null;var h=null;var o=false;var l=false;if(typeof r=="string"){r=_(r)}if(t(r)=="object"){if(T(r.r)&&T(r.g)&&T(r.b)){e=i(r.r,r.g,r.b);o=true;l=String(r.r).substr(-1)==="%"?"prgb":"rgb"}else if(T(r.h)&&T(r.s)&&T(r.v)){n=z(r.s);f=z(r.v);e=u(r.h,n,f);o=true;l="hsv"}else if(T(r.h)&&T(r.s)&&T(r.l)){n=z(r.s);h=z(r.l);e=s(r.h,n,h);o=true;l="hsl"}if(r.hasOwnProperty("a")){a=r.a}}a=q(a);return{ok:o,format:r.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:a}}function i(t,r,e){return{r:E(t,255)*255,g:E(r,255)*255,b:E(e,255)*255}}function f(t,r,e){t=E(t,255);r=E(r,255);e=E(e,255);var a=Math.max(t,r,e),n=Math.min(t,r,e);var i,f,s=(a+n)/2;if(a==n){i=f=0}else{var h=a-n;f=s>.5?h/(2-a-n):h/(a+n);switch(a){case t:i=(r-e)/h+(r<e?6:0);break;case r:i=(e-t)/h+2;break;case e:i=(t-r)/h+4;break}i/=6}return{h:i,s:f,l:s}}function s(t,r,e){var a,n,i;t=E(t,360);r=E(r,100);e=E(e,100);function f(t,r,e){if(e<0)e+=1;if(e>1)e-=1;if(e<1/6)return t+(r-t)*6*e;if(e<1/2)return r;if(e<2/3)return t+(r-t)*(2/3-e)*6;return t}if(r===0){a=n=i=e}else{var s=e<.5?e*(1+r):e+r-e*r;var h=2*e-s;a=f(h,s,t+1/3);n=f(h,s,t);i=f(h,s,t-1/3)}return{r:a*255,g:n*255,b:i*255}}function h(t,r,e){t=E(t,255);r=E(r,255);e=E(e,255);var a=Math.max(t,r,e),n=Math.min(t,r,e);var i,f,s=a;var h=a-n;f=a===0?0:h/a;if(a==n){i=0}else{switch(a){case t:i=(r-e)/h+(r<e?6:0);break;case r:i=(e-t)/h+2;break;case e:i=(t-r)/h+4;break}i/=6}return{h:i,s:f,v:s}}function u(t,r,e){t=E(t,360)*6;r=E(r,100);e=E(e,100);var a=Math.floor(t),n=t-a,i=e*(1-r),f=e*(1-n*r),s=e*(1-(1-n)*r),h=a%6,u=[e,f,i,i,s,e][h],o=[s,e,e,f,i,i][h],l=[i,i,s,e,e,f][h];return{r:u*255,g:o*255,b:l*255}}function o(t,r,e,a){var n=[N(Math.round(t).toString(16)),N(Math.round(r).toString(16)),N(Math.round(e).toString(16))];if(a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)){return n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)}return n.join("")}function l(t,r,e,a,n){var i=[N(Math.round(t).toString(16)),N(Math.round(r).toString(16)),N(Math.round(e).toString(16)),N(I(a))];if(n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)){return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0)}return i.join("")}function c(t,r,e,a){var n=[N(I(a)),N(Math.round(t).toString(16)),N(Math.round(r).toString(16)),N(Math.round(e).toString(16))];return n.join("")}a.equals=function(t,r){if(!t||!r)return false;return a(t).toRgbString()==a(r).toRgbString()};a.random=function(){return a.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function d(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.s-=r/100;e.s=H(e.s);return a(e)}function b(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.s+=r/100;e.s=H(e.s);return a(e)}function g(t){return a(t).desaturate(100)}function v(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.l+=r/100;e.l=H(e.l);return a(e)}function m(t,r){r=r===0?0:r||10;var e=a(t).toRgb();e.r=Math.max(0,Math.min(255,e.r-Math.round(255*-(r/100))));e.g=Math.max(0,Math.min(255,e.g-Math.round(255*-(r/100))));e.b=Math.max(0,Math.min(255,e.b-Math.round(255*-(r/100))));return a(e)}function M(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.l-=r/100;e.l=H(e.l);return a(e)}function p(t,r){var e=a(t).toHsl();var n=(e.h+r)%360;e.h=n<0?360+n:n;return a(e)}function y(t){var r=a(t).toHsl();r.h=(r.h+180)%360;return a(r)}function k(t,r){if(isNaN(r)||r<=0){throw new Error("Argument to polyad must be a positive number")}var e=a(t).toHsl();var n=[a(t)];var i=360/r;for(var f=1;f<r;f++){n.push(a({h:(e.h+f*i)%360,s:e.s,l:e.l}))}return n}function A(t){var r=a(t).toHsl();var e=r.h;return[a(t),a({h:(e+72)%360,s:r.s,l:r.l}),a({h:(e+216)%360,s:r.s,l:r.l})]}function w(t,r,e){r=r||6;e=e||30;var n=a(t).toHsl();var i=360/e;var f=[a(t)];for(n.h=(n.h-(i*r>>1)+720)%360;--r;){n.h=(n.h+i)%360;f.push(a(n))}return f}function x(t,r){r=r||6;var e=a(t).toHsv();var n=e.h,i=e.s,f=e.v;var s=[];var h=1/r;while(r--){s.push(a({h:n,s:i,v:f}));f=(f+h)%1}return s}a.mix=function(t,r,e){e=e===0?0:e||50;var n=a(t).toRgb();var i=a(r).toRgb();var f=e/100;var s={r:(i.r-n.r)*f+n.r,g:(i.g-n.g)*f+n.g,b:(i.b-n.b)*f+n.b,a:(i.a-n.a)*f+n.a};return a(s)};a.readability=function(t,r){var e=a(t);var n=a(r);return(Math.max(e.getLuminance(),n.getLuminance())+.05)/(Math.min(e.getLuminance(),n.getLuminance())+.05)};a.isReadable=function(t,r,e){var n=a.readability(t,r);var i,f;f=false;i=L(e);switch(i.level+i.size){case"AAsmall":case"AAAlarge":f=n>=4.5;break;case"AAlarge":f=n>=3;break;case"AAAsmall":f=n>=7;break}return f};a.mostReadable=function(t,r,e){var n=null;var i=0;var f;var s,h,u;e=e||{};s=e.includeFallbackColors;h=e.level;u=e.size;for(var o=0;o<r.length;o++){f=a.readability(t,r[o]);if(f>i){i=f;n=a(r[o])}}if(a.isReadable(t,n,{level:h,size:u})||!s){return n}else{e.includeFallbackColors=false;return a.mostReadable(t,["#fff","#000"],e)}};var F=a.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var S=a.hexNames=R(F);function R(t){var r={};for(var e in t){if(t.hasOwnProperty(e)){r[t[e]]=e}}return r}function q(t){t=parseFloat(t);if(isNaN(t)||t<0||t>1){t=1}return t}function E(t,r){if(j(t))t="100%";var e=C(t);t=Math.min(r,Math.max(0,parseFloat(t)));if(e){t=parseInt(t*r,10)/100}if(Math.abs(t-r)<1e-6){return 1}return t%r/parseFloat(r)}function H(t){return Math.min(1,Math.max(0,t))}function $(t){return parseInt(t,16)}function j(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function C(t){return typeof t==="string"&&t.indexOf("%")!=-1}function N(t){return t.length==1?"0"+t:""+t}function z(t){if(t<=1){t=t*100+"%"}return t}function I(t){return Math.round(parseFloat(t)*255).toString(16)}function D(t){return $(t)/255}var G=function(){var t="[-\\+]?\\d+%?";var r="[-\\+]?\\d*\\.\\d+%?";var e="(?:"+r+")|(?:"+t+")";var a="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";var n="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+a),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+a),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+a),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function T(t){return!!G.CSS_UNIT.exec(t)}function _(t){t=t.replace(r,"").replace(e,"").toLowerCase();var a=false;if(F[t]){t=F[t];a=true}else if(t=="transparent"){return{r:0,g:0,b:0,a:0,format:"name"}}var n;if(n=G.rgb.exec(t)){return{r:n[1],g:n[2],b:n[3]}}if(n=G.rgba.exec(t)){return{r:n[1],g:n[2],b:n[3],a:n[4]}}if(n=G.hsl.exec(t)){return{h:n[1],s:n[2],l:n[3]}}if(n=G.hsla.exec(t)){return{h:n[1],s:n[2],l:n[3],a:n[4]}}if(n=G.hsv.exec(t)){return{h:n[1],s:n[2],v:n[3]}}if(n=G.hsva.exec(t)){return{h:n[1],s:n[2],v:n[3],a:n[4]}}if(n=G.hex8.exec(t)){return{r:$(n[1]),g:$(n[2]),b:$(n[3]),a:D(n[4]),format:a?"name":"hex8"}}if(n=G.hex6.exec(t)){return{r:$(n[1]),g:$(n[2]),b:$(n[3]),format:a?"name":"hex"}}if(n=G.hex4.exec(t)){return{r:$(n[1]+""+n[1]),g:$(n[2]+""+n[2]),b:$(n[3]+""+n[3]),a:D(n[4]+""+n[4]),format:a?"name":"hex8"}}if(n=G.hex3.exec(t)){return{r:$(n[1]+""+n[1]),g:$(n[2]+""+n[2]),b:$(n[3]+""+n[3]),format:a?"name":"hex"}}return false}function L(t){var r,e;t=t||{level:"AA",size:"small"};r=(t.level||"AA").toUpperCase();e=(t.size||"small").toLowerCase();if(r!=="AA"&&r!=="AAA"){r="AA"}if(e!=="small"&&e!=="large"){e="small"}return{level:r,size:e}}return a}))})(tinycolor$1);var tinycolor=tinycolor$1.exports;var isDarkColor=function(t){return tinycolor(t).isDark()};export{isDarkColor as i,tinycolor as t};
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,r,t,o){function n(e){return e instanceof t?e:new t((function(r){r(e)}))}return new(t||(t=Promise))((function(t,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function l(e){try{u(o["throw"](e))}catch(e){a(e)}}function u(e){e.done?t(e.value):n(e.value).then(i,l)}u((o=o.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,n,a,i;return i={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(e){return function(r){return u([e,r])}}function u(l){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,l[0]&&(t=0)),t)try{if(o=1,n&&(a=l[0]&2?n["return"]:l[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;if(n=0,a)l=[l[0]&2,a.value];switch(l[0]){case 0:case 1:a=l;break;case 4:t.label++;return{value:l[1],done:false};case 5:t.label++;n=l[1];l=[0];continue;case 7:l=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){t.label=l[1];break}if(l[0]===6&&t.label<a[1]){t.label=a[1];a=l;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(l);break}if(a[2])t.ops.pop();t.trys.pop();continue}l=r.call(e,t)}catch(e){l=[6,e];n=0}finally{o=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-e3d0493a.js";import{j as jsonParse,h as handleFetch,l as logError}from"./handleFetch-a844cac1.js";import{a as availableTestKeys,l as log}from"./VarianceTest-572cecf5.js";import{a as translationStoreUpdateLanguage}from"./translationStore-7eebaa41.js";var hasAtLeastOneAvailableTestKey=function(e){var r=!!e.find((function(e){return e.testKey in availableTestKeys}));if(!r){log("No available test key found in response","info",{response:e})}return!!e.find((function(e){return e.testKey in availableTestKeys}))};var filterValidTests=function(e){if(!hasAtLeastOneAvailableTestKey(e)){return[]}return e.filter((function(e){var r;var t=availableTestKeys[e.testKey]&&!e.selectedVariantKey;var o=e.selectedVariantKey&&!!((r=availableTestKeys[e.testKey])===null||r===void 0?void 0:r["availableVariants"].includes(e.selectedVariantKey));return t||o})).map((function(e){return Object.assign(Object.assign({},e),{expiresAt:e.expiresAt||Date.now()+VARIANT_TEST_KEY_EXPIRATION,selectedVariantKey:e.selectedVariantKey||null})}))};var VARIANT_TEST_KEY_EXPIRATION=60*60*24*1e3;var _d=createStore({checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id"),enabledVariantTestKeys:jsonParse(localStorage.getItem("zonos--enabled-variant-test-keys"))}),storageStoreOnChange=_d.onChange,storageStore=_d.state;storageStoreOnChange("enabledVariantTestKeys",(function(){var e;if(!((e=storageStore.enabledVariantTestKeys)===null||e===void 0?void 0:e.length)){localStorage.removeItem("zonos--enabled-variant-test-keys");return}localStorage.setItem("zonos--enabled-variant-test-keys",JSON.stringify(storageStore.enabledVariantTestKeys))}));storageStoreOnChange("checkoutSessionId",(function(){if(!storageStore.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",storageStore.checkoutSessionId)}));var storageStoreSetEnabledVariantTestKeys=function(e){storageStore.enabledVariantTestKeys=filterValidTests(e)};var getCountries=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,o;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,handleFetch("/api/zonos-elements/get-countries",{method:"GET"})];case 1:e=n.sent(),r=e.errors,t=e.json;if(r.length||!t){return[2,null]}return[2,t];case 2:o=n.sent();return[2,null];case 3:return[2]}}))}))};var getCountryLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var r,t,o,n,a;return __generator(this,(function(i){switch(i.label){case 0:if(!e){return[2,null]}t="/api/zonos-elements/country-landed-cost/".concat(e);return[4,handleFetch(t)];case 1:o=i.sent(),n=o.errors,a=o.json;if(n.length||!a){logError("Error fetching country landed cost: ".concat((r=n.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,a||null]}}))}))};var defaultUsExchangeRate={exchangeRate:{rate:1,targetFormat:{currencyCode:"USD",decimalDelimiter:".",scale:2,symbol:"$",symbolLocation:"before",thousandsDelimiter:","}},maxAge:null};var getExchangeRate=function(e){return __awaiter(void 0,[e],void 0,(function(e){var r,t,o,n,a,i,l,u,c,s;var d=e.country,v=e.isGuaranteed,f=e.sourceCurrency,g=e.targetCurrency;return __generator(this,(function(e){switch(e.label){case 0:if(f===g&&!v){return[2,defaultUsExchangeRate]}t=new URLSearchParams;t.set("sourceCurrency",f);t.set("targetCurrency",g);t.set("isGuaranteed",String(v));t.set("country",d||"");return[4,handleFetch("/api/zonos-elements/exchange-rates?".concat(t.toString()))];case 1:o=e.sent(),n=o.errors,a=o.json;if(n.length||!a){logError("Error fetching country landed cost: ".concat((r=n.find(Boolean))===null||r===void 0?void 0:r.message));return[2,defaultUsExchangeRate]}i=a.exchangeRateCreate,l=i.rate,u=i.targetFormat;c=a.maxAge;if(l){sessionStorage.setItem(d+"_rate",JSON.stringify(l));s={rate:l,targetFormat:u};return[2,{exchangeRate:s,maxAge:c}]}return[2,defaultUsExchangeRate]}}))}))};var getInclusivePricing=function(e){return __awaiter(void 0,void 0,void 0,(function(){var r,t,o,n;return __generator(this,(function(a){switch(a.label){case 0:if(!e){return[2,null]}return[4,handleFetch("/api/zonos-elements/inclusive-prices/".concat(e))];case 1:t=a.sent(),o=t.errors,n=t.json;if(o.length||!n){logError("Error fetching country inclusive price setting: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,n||null]}}))}))};var getLocaleMessages=function(e){return __awaiter(void 0,[e],void 0,(function(e){var r,t,o,n,a;var i=e.countryCode,l=e.localeTo,u=e.storeId;return __generator(this,(function(e){switch(e.label){case 0:t=new URLSearchParams;t.set("countryCode",i);t.set("storeId",u.toString());if(l){t.set("localeTo",l)}return[4,handleFetch("/api/zonos-elements/locale-messages?".concat(t.toString()))];case 1:o=e.sent(),n=o.errors,a=o.json;if(n.length||!a){logError("Error fetching exchange rate",(r=n.find(Boolean))===null||r===void 0?void 0:r.message);return[2,[]]}return[2,a.locale_countryCodesPage]}}))}))};var validateCountryCode=function(e){if(e&&/^[A-Z]{2}$/.test(e)){return e}return null};var getZCountryUrlParam=function(e){var r=new URLSearchParams(e||window.location.search);var t=function(e){var t=r.get(e);return validateCountryCode(t)};var o=t("zCountry");var n=t("country");var a=t("customerCountry");return o||n||a};var getLocalization=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,o,n,a,i,l;return __generator(this,(function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);e=new URL(window.location.href);r=window.sessionStorage.getItem("zonos--country");t=getZCountryUrlParam(e.searchParams)||r;o=new URLSearchParams;if(t){o.set("zCountry",t)}return[4,handleFetch("/api/zonos-elements/localization?".concat(o.toString()))];case 1:n=u.sent(),a=n.errors,i=n.json;if(a.length||!i){return[2,{country:null,locale:null}]}return[2,{country:i.country,locale:i.locale}];case 2:l=u.sent();return[2,{country:null,locale:null}];case 3:return[2]}}))}))};var getShippingZones=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,o,n,a,i;return __generator(this,(function(l){switch(l.label){case 0:if((e=window.Zonos.cartSettings)===null||e===void 0?void 0:e.shippingZones){return[2,window.Zonos.cartSettings.shippingZones.flatMap((function(e){return e===null||e===void 0?void 0:e.countryCodes})).filter(Boolean)]}return[4,handleFetch("/api/zonos-elements/shipping-zones")];case 1:o=l.sent(),n=o.errors,a=o.json;if(n.length||!a){logError("Error fetching shipping zones: ".concat((r=n.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}i=(t=a===null||a===void 0?void 0:a.shippingZones)===null||t===void 0?void 0:t.flatMap((function(e){return e===null||e===void 0?void 0:e.countryCodes})).filter(Boolean);return[2,i||null]}}))}))};var currencyConvert=function(e){var r=localizationStore.exchangeRate;if(!r||!e||isNaN(e)){return e}var t=(r===null||r===void 0?void 0:r.targetFormat.scale)||2;var o=e*r.rate;var n=o.toFixed(t);return Number(n)};var numberFormat=function(e){var r=e.amount,t=e.currency,o=e.targetFormat;var n=t||localizationStore.targetCurrency;var a=(o===null||o===void 0?void 0:o.scale)||2;var i=window.navigator.userAgent.indexOf("MSIE ")!==-1;var l=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(i||!l){var u=Number(r).toFixed(a).replace(".","|dec|").replace(",",(o===null||o===void 0?void 0:o.thousandsDelimiter)||"").replace("|dec|",(o===null||o===void 0?void 0:o.decimalDelimiter)||"");return u}var c=new Intl.NumberFormat(window.navigator.language,{currency:n,currencyDisplay:"code",minimumFractionDigits:a,style:"currency"}).format(r);return c.replace(new RegExp("".concat(n,"\\s+")),"")};var currencyFormat=function(e){var r=e.amount,t=e.currency;if(isNaN(r)||r!==0&&!r){return""}var o=zonosStore.overrideCurrencyFormat;var n=localizationStore.exchangeRate;var a=t||localizationStore.targetCurrency;if(typeof o==="function"){return o({amount:r,currencyCode:a,numberFormat:function(e){var r=e.amount;return numberFormat({amount:r,currency:a,targetFormat:(n===null||n===void 0?void 0:n.targetFormat)||null})}})}var i=(n||{}).targetFormat;if(!i||!n){return"".concat(r.toFixed(2)," ").concat(a)}var l=i.scale||2;var u=window.navigator.userAgent.indexOf("MSIE ")!==-1;var c=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(u||!c){var s=Number(r).toFixed(l).replace(".","|dec|").replace(",",i.thousandsDelimiter||"").replace("|dec|",i.decimalDelimiter||"");var d="".concat(s).concat(i.currencyCode!=="USD"?" ".concat(i.currencyCode):"");return d}var v=(o===null||o===void 0?void 0:o.currencyDisplay)||"symbol";var f=new Intl.NumberFormat(window.navigator.language,{currency:a,currencyDisplay:v,minimumFractionDigits:l,style:"currency"}).format(r);var g=v==="code"?"".concat(f.replace(new RegExp("".concat(a,"\\s+")),"")," ").concat(a):f;return g};var currencyConvertAndFormat=function(e){var r=currencyConvert(e);var t=currencyFormat({amount:r});return t};var isValidSelector=function(e){try{document.createDocumentFragment().querySelector(e)}catch(e){return false}return true};var getCurrencyElements=function(e){var r=e||".money";if(!isValidSelector(r)){logError('Currency element selector "'.concat(r,'" is not valid.'));return null}var t=document.querySelectorAll(r);if(!t.length){log('No currency elements found with selector "'.concat(r,'"'),"warn");return null}return Array.from(t)};var getInitialElementAmount=function(e){var r;var t=e.getAttribute("data-domestic");var o=e.getAttribute("data-zintl");var n=(r=e.textContent)===null||r===void 0?void 0:r.replace(/[^\d.-]/g,"");if(!n){return null}if(!t||e.textContent!==o&&o){e.setAttribute("data-domestic",n);return parseFloat(n)}return parseFloat(t)};var BLUR_CURRENCY_DURATION=7e3;var BLUR_CURRENCY_CLASSNAME="z--blur";var removeBlurCurrency=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r;return __generator(this,(function(t){switch(t.label){case 0:e=window.zonosBlurCurrencyOnInitIntervalId;if(!e){return[2]}return[4,new Promise((function(e){return setTimeout(e,500)}))];case 1:t.sent();clearInterval(e);r=document.querySelectorAll(".".concat(BLUR_CURRENCY_CLASSNAME));r.forEach((function(e){e.classList.remove(BLUR_CURRENCY_CLASSNAME)}));window.zonosBlurCurrencyOnInitIntervalId=undefined;return[2]}}))}))};var blurCurrencyElements=function(e){var r=e.currencySelector;if(!r){return}var t=document.querySelectorAll([r].filter(Boolean).join(","));t.forEach((function(e){e.classList.add(BLUR_CURRENCY_CLASSNAME)}))};var performBlurCurrency=function(){if(typeof window==="undefined"){return}if(window.zonosBlurCurrencyOnInitIntervalId){return}blurCurrencyElements({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});var e=setInterval((function(){blurCurrencyElements({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})}),10);window.zonosBlurCurrencyOnInitIntervalId=e;setTimeout((function(){void removeBlurCurrency()}),BLUR_CURRENCY_DURATION)};var convertCurrency=function(e){var r;var t=getInitialElementAmount(e);if(!t||isNaN(t)){return}var o=e.getAttribute("data-zintl");var n=parseFloat(e.getAttribute("data-zrate")||"1");var a=e.getAttribute("data-zcountry-code");var i=localizationStore.exchangeRate&&localizationStore.targetCurrency===localizationStore.exchangeRate.targetFormat.currencyCode;var l=((r=localizationStore.exchangeRate)===null||r===void 0?void 0:r.rate)||1;if(i&&(e.textContent!==o||l!==n||a!==localizationStore.selectedCountryCode)){performBlurCurrency();var u=typeof zonosStore.currencyConverter==="function"&&zonosStore.currencyConverter({convert:currencyConvert,convertAndFormat:currencyConvertAndFormat,currencyCode:localizationStore.targetCurrency,format:function(e){return currencyFormat({amount:e})},originalAmount:t,selector:e});var c=u||currencyConvertAndFormat(t);if(c!==e.textContent){e.textContent=c}e.setAttribute("data-zrate",l.toString());e.setAttribute("data-zintl",c);e.setAttribute("data-zcountry-code",localizationStore.selectedCountryCode||"")}void removeBlurCurrency()};var defaultCurrencyConverter=function(){var e=zonosStore.helloSettings.currencyElementSelector;var r=getCurrencyElements(e);if(!(r===null||r===void 0?void 0:r.length)){return}if(!localizationStore.exchangeRate){logError("Could not display currency. Exchange rate and format data is not available.");return}r.forEach((function(e){convertCurrency(e)}))};var currencyDisplay=function(){if(zonosStore.helloSettings.currencyBehavior==="DISABLED"||window.Zonos.isLegacyCheckout){void removeBlurCurrency();return}defaultCurrencyConverter()};var getCurrencyCode=function(e){var r;var t=(r=localizationStore.shippingZoneCountries)===null||r===void 0?void 0:r[e];if(t){return t.currencyCode}return null};var setZCountryUrlParam=function(e){if(!e){return}var r=new URLSearchParams(window.location.search);var t=r.has("zCountry")||zonosStore.helloSettings.countryOverrideBehavior==="URL_PARAM";if(t){r.set("zCountry",e);var o="".concat(window.location.pathname,"?").concat(r.toString());window.history.replaceState(window.history.state,document.title,o)}};var _e=createStore({countryLandedCost:null,customMessages:[],exchangeRate:null,helloCountryList:null,inclusivePricing:null,isDisabledCountry:true,isShippableCountry:false,localizationLoaded:false,selectedCountryCode:null,selectedLocale:"en",shippingZoneCountries:null,targetCurrency:"USD"}),localizationDispose=_e.dispose,localizationStoreOnChange=_e.onChange,localizationStore=_e.state;var triggerGetExchangeRate=function(e){return __awaiter(void 0,void 0,void 0,(function(){var r,t,o;return __generator(this,(function(n){switch(n.label){case 0:return[4,getExchangeRate({country:localizationStore.selectedCountryCode,isGuaranteed:e,sourceCurrency:zonosStore.sourceCurrency,targetCurrency:localizationStore.targetCurrency})];case 1:r=n.sent(),t=r.exchangeRate,o=r.maxAge;if(t){localizationStore.exchangeRate=t;currencyDisplay()}return[2,{maxAge:o}]}}))}))};var DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT="CA";var getFallbackDefaultCountryCode=function(e){if(localizationStore.selectedCountryCode&&e.includes(localizationStore.selectedCountryCode)){return localizationStore.selectedCountryCode}return DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT};var startExchangeRateTimeout=function(e){var r=e.isGuaranteed,t=e.maxAge;if(localizationStore.exchangeRateTimeout){clearTimeout(localizationStore.exchangeRateTimeout)}var o=5*60;var n=t||o;localizationStore.exchangeRateTimeout=setTimeout((function(){return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,triggerGetExchangeRate(r)];case 1:e=t.sent().maxAge;startExchangeRateTimeout({isGuaranteed:r,maxAge:e});return[2]}}))}))}),n*1e3)};var getNewLocalization=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,o,n,a,i,l;return __generator(this,(function(u){switch(u.label){case 0:log("get new localization store");r=localizationStore.isDisabledCountry,t=localizationStore.isShippableCountry,o=localizationStore.selectedCountryCode;if(zonosStore.helloSettings.currencyBehavior==="DISABLED"||!t||r||!o){return[2]}n=zonosStore.checkoutSettings.visibilityStatus==="ENABLED";performBlurCurrency();return[4,triggerGetExchangeRate(n)];case 1:a=u.sent().maxAge;startExchangeRateTimeout({isGuaranteed:n,maxAge:a});if(!!window.Zonos.isLegacyCheckout)return[3,4];i=localizationStore;return[4,getCountryLandedCost(localizationStore.selectedCountryCode)];case 2:i.countryLandedCost=u.sent();l=localizationStore;return[4,getInclusivePricing(o)];case 3:l.inclusivePricing=((e=u.sent())===null||e===void 0?void 0:e.setting)||null;if(localizationStore.inclusivePricing){log("Inclusive price setting found for this country (".concat(o,") ").concat(JSON.stringify(localizationStore.inclusivePricing,null,2)))}return[3,5];case 4:log("Skipping country landed cost and inclusive pricing requests, because this is a legacy checkout");u.label=5;case 5:return[2]}}))}))};var getCustomMessages=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r;return __generator(this,(function(t){switch(t.label){case 0:log("Getting custom messages for ".concat(localizationStore.selectedCountryCode));if(!localizationStore.selectedCountryCode||!zonosStore.storeId){return[2]}return[4,getLocaleMessages({countryCode:localizationStore.selectedCountryCode,localeTo:localizationStore.selectedLocale,storeId:zonosStore.storeId})];case 1:e=t.sent();r=e.flatMap((function(e){var r;return{countryCode:localizationStore.selectedCountryCode,message:(r=e.countryCodesPageMessageLinks.find(Boolean))===null||r===void 0?void 0:r.message.textTo,pageName:e.pageName}}));localizationStore.customMessages=r;return[2]}}))}))};var getOverrideLocale=function(){var e=new URL(window.location.href);var r=e.searchParams.get("zonosLocale");return r};var addInternationalHideClass=function(){if(localizationStore.isShippableCountry){document.body.classList.add("z-intl")}else{document.body.classList.remove("z-intl")}};var getValidCountryCode=function(e){if(e==="UK"){return"GB"}return e};var localizationStoreUpdateSelectedCountryCode=function(e){var r,t;log("Updating selected country code to ".concat(e));var o=!localizationStore.selectedCountryCode;localizationStore.selectedCountryCode=getValidCountryCode(e);var n=localizationStore.selectedCountryCode,a=localizationStore.shippingZoneCountries;var i=!!a&&!!n&&!!a[n]&&!zonosStore.disabledCountries.includes(n);localizationStore.isShippableCountry=i;log("".concat(localizationStore.selectedCountryCode," is a shippable country: ").concat(localizationStore.isShippableCountry));var l=!!n&&zonosStore.disabledCountries.includes(n);localizationStore.isDisabledCountry=l;log("".concat(localizationStore.selectedCountryCode," is a disabled country: ").concat(localizationStore.isDisabledCountry));addInternationalHideClass();if(!n){return}var u=getCurrencyCode(n);if(!o){(r=zonosStore.onCountryChange)===null||r===void 0?void 0:r.call(zonosStore,{countryCode:n,currencyCode:u,isShippableCountry:i})}if(!u){return}localizationStore.targetCurrency=u;void getNewLocalization();window.sessionStorage.setItem("zonos--country",n);setZCountryUrlParam(n);(t=document.querySelector("zonos-hello"))===null||t===void 0?void 0:t.setAttribute("z-country",n)};var initHelloCountryList=function(e){var r=zonosStore.helloSettings.showCountryList;var t=localizationStore.shippingZoneCountries;if(!r||r==="ONLY_SHIPPABLE"){localizationStore.helloCountryList=t;return}if(r==="ALL"){localizationStore.helloCountryList=e;return}localizationStore.helloCountryList=r.reduce((function(r,t){var o;var n=e===null||e===void 0?void 0:e[t];return n?Object.assign(Object.assign({},r),(o={},o[t]=n,o)):r}),{})};var updateCheckoutSessionLanguage=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t;return __generator(this,(function(o){switch(o.label){case 0:if(!storageStore.checkoutSessionId){return[2,null]}return[4,handleFetch("/api/zonos-elements/update-checkout-session-metadata",{body:{id:storageStore.checkoutSessionId,metadata:[{key:"language",value:localizationStore.selectedLocale}]},method:"POST"})];case 1:e=o.sent(),r=e.errors,t=e.json;if(r.length||!t){logError("Error occurs when updating checkout session",JSON.stringify(r,null,2));return[2,{errors:r,json:t}]}return[2,{errors:[],json:t}]}}))}))};var localizationStoreUpdateSelectedLocale=function(e){localizationStore.selectedLocale=e;translationStoreUpdateLanguage(e);void updateCheckoutSessionLanguage();void getCustomMessages()};var initLocalizationStore=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,o,n,a,i,l,u;return __generator(this,(function(c){switch(c.label){case 0:return[4,Promise.all([getCountries(),getShippingZones(),getLocalization()])];case 1:e=c.sent(),r=e[0],t=e[1],o=e[2];n=t===null||t===void 0?void 0:t.reduce((function(e,t){var o;var n=r===null||r===void 0?void 0:r[t];return n?Object.assign(Object.assign({},e),(o={},o[t]=n,o)):e}),{});localizationStore.shippingZoneCountries=n||null;initHelloCountryList(r||{});a=o.country,i=o.locale;log("Country code from localization: ".concat(a));log("Locale from localization: ".concat(i));localizationStoreUpdateSelectedCountryCode(a);l=getOverrideLocale();localizationStoreUpdateSelectedLocale(l||i||"en");u=["dev.storybook.elements","dev.elements","dev.demo.elements","dev.dashboard"];if(!localizationStore.selectedCountryCode&&u.some((function(e){return window.location.origin.includes(e)}))){localizationStoreUpdateSelectedCountryCode("CA")}localizationStore.localizationLoaded=true;return[2]}}))}))};export{VARIANT_TEST_KEY_EXPIRATION as V,localizationStoreUpdateSelectedCountryCode as a,storageStoreSetEnabledVariantTestKeys as b,localizationStoreOnChange as c,currencyFormat as d,initLocalizationStore as e,filterValidTests as f,getZCountryUrlParam as g,setZCountryUrlParam as h,isValidSelector as i,currencyDisplay as j,currencyConvertAndFormat as k,localizationStore as l,currencyConvert as m,getFallbackDefaultCountryCode as n,storageStoreOnChange as o,localizationStoreUpdateSelectedLocale as p,storageStore as s};
@@ -1,4 +1,4 @@
1
- var __awaiter=this&&this.__awaiter||function(r,e,t,o){function n(r){return r instanceof t?r:new t((function(e){e(r)}))}return new(t||(t=Promise))((function(t,a){function i(r){try{l(o.next(r))}catch(r){a(r)}}function u(r){try{l(o["throw"](r))}catch(r){a(r)}}function l(r){r.done?t(r.value):n(r.value).then(i,u)}l((o=o.apply(r,e||[])).next())}))};var __generator=this&&this.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,n,a,i;return i={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(r){return function(e){return l([r,e])}}function l(u){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(t=0)),t)try{if(o=1,n&&(a=u[0]&2?n["return"]:u[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;if(n=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;n=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=e.call(r,t)}catch(r){u=[6,r];n=0}finally{o=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};import{z as zonosStore,c as createStore}from"./zonosStore-c456b933.js";import{t as trackConversionEvent,z as validateCheckoutSession,c as stripeStore,e as cartStore,v as stripeStoreHandleInventoryCheck,r as cartStoreNextStep,j as cartStoreClearCheckoutInterval}from"./cart-7f06662c.js";import{s as storageStore}from"./localization-192886e4.js";import{t as translate}from"./translationStore-fb98a08d.js";import{h as handleFetch,l as log,b as logError,j as jsonParse}from"./handleFetch-99218189.js";import{t as tinycolor}from"./isDarkColor-1f58b6be.js";
1
+ var __awaiter=this&&this.__awaiter||function(r,e,t,o){function n(r){return r instanceof t?r:new t((function(e){e(r)}))}return new(t||(t=Promise))((function(t,a){function i(r){try{c(o.next(r))}catch(r){a(r)}}function u(r){try{c(o["throw"](r))}catch(r){a(r)}}function c(r){r.done?t(r.value):n(r.value).then(i,u)}c((o=o.apply(r,e||[])).next())}))};var __generator=this&&this.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,n,a,i;return i={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(r){return function(e){return c([r,e])}}function c(u){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(t=0)),t)try{if(o=1,n&&(a=u[0]&2?n["return"]:u[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;if(n=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;n=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=e.call(r,t)}catch(r){u=[6,r];n=0}finally{o=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};import{z as zonosStore,c as createStore}from"./zonosStore-e3d0493a.js";import{t as trackConversionEvent,z as validateCheckoutSession,c as stripeStore,e as cartStore,v as stripeStoreHandleInventoryCheck,r as cartStoreNextStep,j as cartStoreClearCheckoutInterval}from"./cart-11b87221.js";import{s as storageStore}from"./localization-9320a65d.js";import{t as translate}from"./translationStore-7eebaa41.js";import{h as handleFetch,l as logError,j as jsonParse}from"./handleFetch-a844cac1.js";import{t as tinycolor}from"./isDarkColor-83e0c27e.js";import{l as log}from"./VarianceTest-572cecf5.js";
2
2
  /*!
3
3
  * paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
4
4
  * Copyright 2020-present, PayPal, Inc. All rights reserved.
@@ -14,4 +14,4 @@ var __awaiter=this&&this.__awaiter||function(r,e,t,o){function n(r){return r ins
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */function findScript(r,e){var t=document.querySelector('script[src="'.concat(r,'"]'));if(t===null)return null;var o=createScriptElement(r,e);var n=t.cloneNode();delete n.dataset.uidAuto;if(Object.keys(n.dataset).length!==Object.keys(o.dataset).length){return null}var a=true;Object.keys(n.dataset).forEach((function(r){if(n.dataset[r]!==o.dataset[r]){a=false}}));return a?t:null}function insertScriptElement(r){var e=r.url,t=r.attributes,o=r.onSuccess,n=r.onError;var a=createScriptElement(e,t);a.onerror=n;a.onload=o;document.head.insertBefore(a,document.head.firstElementChild)}function processOptions(r){var e=r.environment;var t=e==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete r.environment;if(r.sdkBaseUrl){t=r.sdkBaseUrl;delete r.sdkBaseUrl}var o=r;var n=Object.keys(o).filter((function(r){return typeof o[r]!=="undefined"&&o[r]!==null&&o[r]!==""})).reduce((function(r,e){var t=o[e].toString();e=camelCaseToKebabCase(e);if(e.substring(0,4)==="data"||e==="crossorigin"){r.attributes[e]=t}else{r.queryParams[e]=t}return r}),{queryParams:{},attributes:{}}),a=n.queryParams,i=n.attributes;if(a["merchant-id"]&&a["merchant-id"].indexOf(",")!==-1){i["data-merchant-id"]=a["merchant-id"];a["merchant-id"]="*"}return{url:"".concat(t,"?").concat(objectToQueryString(a)),attributes:i}}function camelCaseToKebabCase(r){var e=function(r,e){return(e?"-":"")+r.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,e)}function objectToQueryString(r){var e="";Object.keys(r).forEach((function(t){if(e.length!==0)e+="&";e+=t+"="+r[t]}));return e}function createScriptElement(r,e){if(e===void 0){e={}}var t=document.createElement("script");t.src=r;Object.keys(e).forEach((function(r){t.setAttribute(r,e[r]);if(r==="data-csp-nonce"){t.setAttribute("nonce",e["data-csp-nonce"])}}));return t}function loadScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);if(typeof document==="undefined")return e.resolve(null);var t=processOptions(r),o=t.url,n=t.attributes;var a=n["data-namespace"]||"paypal";var i=getPayPalWindowNamespace(a);if(!n["data-js-sdk-library"]){n["data-js-sdk-library"]="paypal-js"}if(findScript(o,n)&&i){return e.resolve(i)}return loadCustomScript({url:o,attributes:n},e).then((function(){var r=getPayPalWindowNamespace(a);if(r){return r}throw new Error("The window.".concat(a," global variable is not available."))}))}function loadCustomScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);var t=r.url,o=r.attributes;if(typeof t!=="string"||t.length===0){throw new Error("Invalid url.")}if(typeof o!=="undefined"&&typeof o!=="object"){throw new Error("Expected attributes to be an object.")}return new e((function(r,e){if(typeof document==="undefined")return r();insertScriptElement({url:t,attributes:o,onSuccess:function(){return r()},onError:function(){var r=new Error('The script "'.concat(t,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(r)}})}))}function getPayPalWindowNamespace(r){return window[r]}function validateArguments(r,e){if(typeof r!=="object"||r===null){throw new Error("Expected an options object.")}var t=r.environment;if(t&&t!=="production"&&t!=="sandbox"){throw new Error('The `environment` option must be either "production" or "sandbox".')}if(typeof e!=="undefined"&&typeof e!=="function"){throw new Error("Expected PromisePonyfill to be a function.")}}var paypalCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:n,paypalMockResponse:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var paypalCreateOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.intent;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:n,intent:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var isContrastColor=function(r){var e=r.backgroundColor1,t=r.backgroundColor2;var o=tinycolor.readability(e,t);return o>2.5};var submitGtag=function(r){var e=zonosStore.checkoutSettings.analyticsProviders.find((function(r){return r.type==="GOOGLE_ANALYTICS"}));if(!e||(e===null||e===void 0?void 0:e.status)==="DISABLED"){return}if(typeof window.gtag==="function"){log("Zonos submits gtag event","log",r);window.gtag("event",r,{})}};var _c=createStore((function(){return{intent:"capture",orderIdCreated:null,paypal:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}})),paypalStoreOnChange=_c.onChange,paypalStoreReset=_c.reset,paypalStore=_c.state;var paypalStoreCreaterOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i,u;var l=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:o=paypalStore.intent.toUpperCase();return[4,paypalCreateOrder({checkoutSessionId:l,intent:o})];case 1:n=r.sent(),a=n.errors,i=n.json;u=(e=i===null||i===void 0?void 0:i.paypalOrderCreate)===null||e===void 0?void 0:e.paypalOrderId;if(a.length||!u){throw new Error(((t=a.find(Boolean))===null||t===void 0?void 0:t.message)||"An unexpected error occurred when creating paypal order.")}return[2,u]}}))}))};var paypalStoreCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.checkoutSessionId,l=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,paypalCaptureOrder({checkoutSessionId:u,paypalMockResponse:l})];case 1:o=r.sent(),n=o.errors,a=o.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCapture.order)===null||e===void 0?void 0:e.id;if(n.length||!i){throw new Error(((t=n.find(Boolean))===null||t===void 0?void 0:t.message)||translate("An unexpected error occurred when processing PayPal order."))}return[2,i]}}))}))};var paypalErrorHandler=function(r){var e=r.error;var t;var o=jsonParse(e.message);var n=(t=o===null||o===void 0?void 0:o.errors.find(Boolean))===null||t===void 0?void 0:t.message;var a=(n===null||n===void 0?void 0:n.match(/\[(.*?)\] (.*)/i))||[];if(!a){paypalStore.paypalErrorMessage=translate("An unexpected error occurred when processing PayPal order.")}var i=a[2]||translate("An unexpected error occurred when processing PayPal order.");paypalStore.paypalErrorMessage=i};var paypalButtonOptions=function(r){var e=r.checkoutSessionId,t=r.onPaypalFail,o=r.onPaypalSessionDone,n=r.overrideBorderRaidus,a=r.overridePrimaryColor;var i=a||zonosStore.appearance.colorPrimary;var u="#ffc33a";var l=isContrastColor({backgroundColor1:u,backgroundColor2:i||""});return{createOrder:function(){return __awaiter(void 0,void 0,void 0,(function(){var r,o,n,a,i;return __generator(this,(function(u){switch(u.label){case 0:void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_paymentInfoCompleted",metadata:{paymentMethod:"paypal"}});return[4,validateCheckoutSession()];case 1:r=u.sent();if(!r.valid){paypalStore.paypalErrorMessage=r.errorMessage;stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;t===null||t===void 0?void 0:t();return[2,""]}u.label=2;case 2:u.trys.push([2,8,,9]);paypalStore.paypalErrorMessage=null;cartStore.inventoryCheckErrorMessage=null;u.label=3;case 3:u.trys.push([3,5,,6]);o=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 4:o.inventoryCheckErrorMessage=u.sent();return[3,6];case 5:n=u.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,6];case 6:if(cartStore.inventoryCheckErrorMessage){return[2,""]}return[4,paypalStoreCreaterOrder({checkoutSessionId:e})];case 7:a=u.sent();return[2,a];case 8:i=u.sent();logError("Failed to create paypal order",i);paypalStore.paypalErrorMessage=translate("Failed to create PayPal order. Please try again, or consider using an alternative method.");stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;t===null||t===void 0?void 0:t();return[2,""];case 9:return[2]}}))}))},onApprove:function(r,n){return __awaiter(void 0,void 0,void 0,(function(){var r,n;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);paypalStore.paypalErrorMessage=null;submitGtag("zonos-checkout-payment-info");return[4,paypalStoreCaptureOrder({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse})];case 1:r=a.sent();paypalStore.orderIdCreated=r;o===null||o===void 0?void 0:o({orderId:r});cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,3];case 2:n=a.sent();logError("==== Failed to capture paypal order",n);if(n instanceof Error){return[2,paypalErrorHandler({error:n})]}t===null||t===void 0?void 0:t();return[3,3];case 3:return[2]}}))}))},style:{borderRadius:n==="SHARP"?0:10,color:l?"gold":"blue",shape:"rect"}}};var paypalStoreResetButtons=function(){if(!paypalStore.paypalButtons.length){return}paypalStore.paypalButtons.forEach((function(r){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,r.close()];case 1:e.sent();return[2]}}))}))}));paypalStore.paypalButtons=[]};var paypalInitScript=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.currency;return __generator(this,(function(r){switch(r.label){case 0:t=!!((e=zonosStore.checkoutSettings.externalPaymentMethods)===null||e===void 0?void 0:e.find((function(r){return r.type==="PAYPAL"&&r.status==="ENABLED"})));if(!t){log("=== Paypal is disabled for this store","warn");return[2]}o=zonosStore.checkoutSettings.externalServiceTokens.find((function(r){return r.type==="PAYPAL_CLIENT_ID"}));if(!o){log("Failed to load paypal -- missing paypal publishable key","warn");return[2]}n=(!zonosStore.zonosMode||zonosStore.zonosMode==="production")&&zonosStore.checkoutSettings.mode==="LIVE"?"production":"sandbox";a=zonosStore.checkoutSettings.captureDelay&&zonosStore.checkoutSettings.captureDelay>0;paypalStore.intent=a?"authorize":"capture";log("==== Paypal order intent","info",paypalStore.intent);i=window.Zonos;return[4,loadScript({clientId:o.token,currency:u,environment:n,intent:paypalStore.intent})];case 1:i.paypal=r.sent();paypalStore.paypal=window.Zonos.paypal;log("==== Paypal script loaded");return[2]}}))}))};var paypalStoreInitButtons=function(r){var e;var t=window.Zonos.paypal;if(!t){log("Paypal is not available");return null}var o=storageStore.checkoutSessionId;if(!o){log("Paypal is not available due to checkoutSessionId is not available");return null}log("==== Loading Paypal buttons");paypalStoreResetButtons();var n=[(e=t.FUNDING)===null||e===void 0?void 0:e.PAYPAL].filter(Boolean);paypalStore.paypalButtons=n.map((function(e){var n;var a=null;try{a=((n=t.Buttons)===null||n===void 0?void 0:n.call(t,Object.assign(Object.assign({},paypalButtonOptions(Object.assign({checkoutSessionId:o,fundingSource:e},r))),{fundingSource:e})))||null}catch(r){log("===== Failed to load paypal's \"".concat(e,'" button'),"warn",r)}if(a===null||a===void 0?void 0:a.isEligible()){log("==== Paypal button ".concat(e," loaded"));return a}return null})).filter(Boolean);return paypalStore.paypalButtons};var paypalStoreHasPaypalEnabled=function(){var r,e;var t=((e=(r=zonosStore.checkoutSettings.externalPaymentMethods)===null||r===void 0?void 0:r.find((function(r){return r.type==="PAYPAL"})))===null||e===void 0?void 0:e.status)==="ENABLED";return t||!!paypalStore.paypalButtons.length};export{paypalStore as a,paypalInitScript as b,paypalStoreReset as c,paypalStoreInitButtons as d,paypalStoreOnChange as e,isContrastColor as i,paypalStoreHasPaypalEnabled as p,submitGtag as s};
17
+ */function findScript(r,e){var t=document.querySelector('script[src="'.concat(r,'"]'));if(t===null)return null;var o=createScriptElement(r,e);var n=t.cloneNode();delete n.dataset.uidAuto;if(Object.keys(n.dataset).length!==Object.keys(o.dataset).length){return null}var a=true;Object.keys(n.dataset).forEach((function(r){if(n.dataset[r]!==o.dataset[r]){a=false}}));return a?t:null}function insertScriptElement(r){var e=r.url,t=r.attributes,o=r.onSuccess,n=r.onError;var a=createScriptElement(e,t);a.onerror=n;a.onload=o;document.head.insertBefore(a,document.head.firstElementChild)}function processOptions(r){var e=r.environment;var t=e==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete r.environment;if(r.sdkBaseUrl){t=r.sdkBaseUrl;delete r.sdkBaseUrl}var o=r;var n=Object.keys(o).filter((function(r){return typeof o[r]!=="undefined"&&o[r]!==null&&o[r]!==""})).reduce((function(r,e){var t=o[e].toString();e=camelCaseToKebabCase(e);if(e.substring(0,4)==="data"||e==="crossorigin"){r.attributes[e]=t}else{r.queryParams[e]=t}return r}),{queryParams:{},attributes:{}}),a=n.queryParams,i=n.attributes;if(a["merchant-id"]&&a["merchant-id"].indexOf(",")!==-1){i["data-merchant-id"]=a["merchant-id"];a["merchant-id"]="*"}return{url:"".concat(t,"?").concat(objectToQueryString(a)),attributes:i}}function camelCaseToKebabCase(r){var e=function(r,e){return(e?"-":"")+r.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,e)}function objectToQueryString(r){var e="";Object.keys(r).forEach((function(t){if(e.length!==0)e+="&";e+=t+"="+r[t]}));return e}function createScriptElement(r,e){if(e===void 0){e={}}var t=document.createElement("script");t.src=r;Object.keys(e).forEach((function(r){t.setAttribute(r,e[r]);if(r==="data-csp-nonce"){t.setAttribute("nonce",e["data-csp-nonce"])}}));return t}function loadScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);if(typeof document==="undefined")return e.resolve(null);var t=processOptions(r),o=t.url,n=t.attributes;var a=n["data-namespace"]||"paypal";var i=getPayPalWindowNamespace(a);if(!n["data-js-sdk-library"]){n["data-js-sdk-library"]="paypal-js"}if(findScript(o,n)&&i){return e.resolve(i)}return loadCustomScript({url:o,attributes:n},e).then((function(){var r=getPayPalWindowNamespace(a);if(r){return r}throw new Error("The window.".concat(a," global variable is not available."))}))}function loadCustomScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);var t=r.url,o=r.attributes;if(typeof t!=="string"||t.length===0){throw new Error("Invalid url.")}if(typeof o!=="undefined"&&typeof o!=="object"){throw new Error("Expected attributes to be an object.")}return new e((function(r,e){if(typeof document==="undefined")return r();insertScriptElement({url:t,attributes:o,onSuccess:function(){return r()},onError:function(){var r=new Error('The script "'.concat(t,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(r)}})}))}function getPayPalWindowNamespace(r){return window[r]}function validateArguments(r,e){if(typeof r!=="object"||r===null){throw new Error("Expected an options object.")}var t=r.environment;if(t&&t!=="production"&&t!=="sandbox"){throw new Error('The `environment` option must be either "production" or "sandbox".')}if(typeof e!=="undefined"&&typeof e!=="function"){throw new Error("Expected PromisePonyfill to be a function.")}}var paypalCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:n,paypalMockResponse:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var paypalCreateOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o;var n=r.checkoutSessionId,a=r.intent;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:n,intent:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,o=e.json;return[2,{errors:t,json:o}]}}))}))};var isContrastColor=function(r){var e=r.backgroundColor1,t=r.backgroundColor2;var o=tinycolor.readability(e,t);return o>2.5};var submitGtag=function(r){var e=zonosStore.checkoutSettings.analyticsProviders.find((function(r){return r.type==="GOOGLE_ANALYTICS"}));if(!e||(e===null||e===void 0?void 0:e.status)==="DISABLED"){return}if(typeof window.gtag==="function"){log("Zonos submits gtag event","log",r);window.gtag("event",r,{})}};var _c=createStore((function(){return{intent:"capture",orderIdCreated:null,paypal:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}})),paypalStoreOnChange=_c.onChange,paypalStoreReset=_c.reset,paypalStore=_c.state;var paypalStoreCreaterOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i,u;var c=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:o=paypalStore.intent.toUpperCase();return[4,paypalCreateOrder({checkoutSessionId:c,intent:o})];case 1:n=r.sent(),a=n.errors,i=n.json;u=(e=i===null||i===void 0?void 0:i.paypalOrderCreate)===null||e===void 0?void 0:e.paypalOrderId;if(a.length||!u){throw new Error(((t=a.find(Boolean))===null||t===void 0?void 0:t.message)||"An unexpected error occurred when creating paypal order.")}return[2,u]}}))}))};var paypalStoreCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.checkoutSessionId,c=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,paypalCaptureOrder({checkoutSessionId:u,paypalMockResponse:c})];case 1:o=r.sent(),n=o.errors,a=o.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCapture.order)===null||e===void 0?void 0:e.id;if(n.length||!i){throw new Error(((t=n.find(Boolean))===null||t===void 0?void 0:t.message)||translate("An unexpected error occurred when processing PayPal order."))}return[2,i]}}))}))};var paypalErrorHandler=function(r){var e=r.error;var t;var o=jsonParse(e.message);var n=(t=o===null||o===void 0?void 0:o.errors.find(Boolean))===null||t===void 0?void 0:t.message;var a=(n===null||n===void 0?void 0:n.match(/\[(.*?)\] (.*)/i))||[];if(!a){paypalStore.paypalErrorMessage=translate("An unexpected error occurred when processing PayPal order.")}var i=a[2]||translate("An unexpected error occurred when processing PayPal order.");paypalStore.paypalErrorMessage=i};var paypalButtonOptions=function(r){var e=r.checkoutSessionId,t=r.onPaypalFail,o=r.onPaypalSessionDone,n=r.overrideBorderRaidus,a=r.overridePrimaryColor;var i=a||zonosStore.appearance.colorPrimary;var u="#ffc33a";var c=isContrastColor({backgroundColor1:u,backgroundColor2:i||""});return{createOrder:function(){return __awaiter(void 0,void 0,void 0,(function(){var r,o,n,a,i;return __generator(this,(function(u){switch(u.label){case 0:void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_paymentInfoCompleted",metadata:{paymentMethod:"paypal"}});return[4,validateCheckoutSession()];case 1:r=u.sent();if(!r.valid){paypalStore.paypalErrorMessage=r.errorMessage;stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;t===null||t===void 0?void 0:t();return[2,""]}u.label=2;case 2:u.trys.push([2,8,,9]);paypalStore.paypalErrorMessage=null;cartStore.inventoryCheckErrorMessage=null;u.label=3;case 3:u.trys.push([3,5,,6]);o=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 4:o.inventoryCheckErrorMessage=u.sent();return[3,6];case 5:n=u.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,6];case 6:if(cartStore.inventoryCheckErrorMessage){return[2,""]}return[4,paypalStoreCreaterOrder({checkoutSessionId:e})];case 7:a=u.sent();return[2,a];case 8:i=u.sent();logError("Failed to create paypal order",i);paypalStore.paypalErrorMessage=translate("Failed to create PayPal order. Please try again, or consider using an alternative method.");stripeStore.hasPaymentError=false;stripeStore.customErrorMessage=null;t===null||t===void 0?void 0:t();return[2,""];case 9:return[2]}}))}))},onApprove:function(r,n){return __awaiter(void 0,void 0,void 0,(function(){var r,n;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);paypalStore.paypalErrorMessage=null;submitGtag("zonos-checkout-payment-info");return[4,paypalStoreCaptureOrder({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse})];case 1:r=a.sent();paypalStore.orderIdCreated=r;o===null||o===void 0?void 0:o({orderId:r});cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,3];case 2:n=a.sent();logError("==== Failed to capture paypal order",n);if(n instanceof Error){return[2,paypalErrorHandler({error:n})]}t===null||t===void 0?void 0:t();return[3,3];case 3:return[2]}}))}))},style:{borderRadius:n==="SHARP"?0:10,color:c?"gold":"blue",shape:"rect"}}};var paypalStoreResetButtons=function(){if(!paypalStore.paypalButtons.length){return}paypalStore.paypalButtons.forEach((function(r){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,r.close()];case 1:e.sent();return[2]}}))}))}));paypalStore.paypalButtons=[]};var paypalInitScript=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,o,n,a,i;var u=r.currency;return __generator(this,(function(r){switch(r.label){case 0:t=!!((e=zonosStore.checkoutSettings.externalPaymentMethods)===null||e===void 0?void 0:e.find((function(r){return r.type==="PAYPAL"&&r.status==="ENABLED"})));if(!t){log("=== Paypal is disabled for this store","warn");return[2]}o=zonosStore.checkoutSettings.externalServiceTokens.find((function(r){return r.type==="PAYPAL_CLIENT_ID"}));if(!o){log("Failed to load paypal -- missing paypal publishable key","warn");return[2]}n=(!zonosStore.zonosMode||zonosStore.zonosMode==="production")&&zonosStore.checkoutSettings.mode==="LIVE"?"production":"sandbox";a=zonosStore.checkoutSettings.captureDelay&&zonosStore.checkoutSettings.captureDelay>0;paypalStore.intent=a?"authorize":"capture";log("==== Paypal order intent","info",paypalStore.intent);i=window.Zonos;return[4,loadScript({clientId:o.token,currency:u,environment:n,intent:paypalStore.intent})];case 1:i.paypal=r.sent();paypalStore.paypal=window.Zonos.paypal;log("==== Paypal script loaded");return[2]}}))}))};var paypalStoreInitButtons=function(r){var e;var t=window.Zonos.paypal;if(!t){log("Paypal is not available");return null}var o=storageStore.checkoutSessionId;if(!o){log("Paypal is not available due to checkoutSessionId is not available");return null}log("==== Loading Paypal buttons");paypalStoreResetButtons();var n=[(e=t.FUNDING)===null||e===void 0?void 0:e.PAYPAL].filter(Boolean);paypalStore.paypalButtons=n.map((function(e){var n;var a=null;try{a=((n=t.Buttons)===null||n===void 0?void 0:n.call(t,Object.assign(Object.assign({},paypalButtonOptions(Object.assign({checkoutSessionId:o,fundingSource:e},r))),{fundingSource:e})))||null}catch(r){log("===== Failed to load paypal's \"".concat(e,'" button'),"warn",r)}if(a===null||a===void 0?void 0:a.isEligible()){log("==== Paypal button ".concat(e," loaded"));return a}return null})).filter(Boolean);return paypalStore.paypalButtons};var paypalStoreHasPaypalEnabled=function(){var r,e;var t=((e=(r=zonosStore.checkoutSettings.externalPaymentMethods)===null||r===void 0?void 0:r.find((function(r){return r.type==="PAYPAL"})))===null||e===void 0?void 0:e.status)==="ENABLED";return t||!!paypalStore.paypalButtons.length};export{paypalStore as a,paypalInitScript as b,paypalStoreReset as c,paypalStoreInitButtons as d,paypalStoreOnChange as e,isContrastColor as i,paypalStoreHasPaypalEnabled as p,submitGtag as s};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(r,t,e,n){function o(r){return r instanceof e?r:new e((function(t){t(r)}))}return new(e||(e=Promise))((function(e,a){function i(r){try{u(n.next(r))}catch(r){a(r)}}function c(r){try{u(n["throw"](r))}catch(r){a(r)}}function u(r){r.done?e(r.value):o(r.value).then(i,c)}u((n=n.apply(r,t||[])).next())}))};var __generator=this&&this.__generator||function(r,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(r){return function(t){return u([r,t])}}function u(c){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,c[0]&&(e=0)),e)try{if(n=1,o&&(a=c[0]&2?o["return"]:c[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;if(o=0,a)c=[c[0]&2,a.value];switch(c[0]){case 0:case 1:a=c;break;case 4:e.label++;return{value:c[1],done:false};case 5:e.label++;o=c[1];c=[0];continue;case 7:c=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){e.label=c[1];break}if(c[0]===6&&e.label<a[1]){e.label=a[1];a=c;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(c);break}if(a[2])e.ops.pop();e.trys.pop();continue}c=t.call(r,e)}catch(r){c=[6,r];o=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};import{e as cartStore}from"./cart-7f06662c.js";import{d as currencyFormat,s as storageStore}from"./localization-192886e4.js";import{b as logError,h as handleFetch}from"./handleFetch-99218189.js";var getDisplayCurrency=function(){var r,t;var e=cartStore.displayBaseCurrency;var n=e&&((r=cartStore.exchangeRate)===null||r===void 0?void 0:r.sourceCurrencyCode)?(t=cartStore.exchangeRate)===null||t===void 0?void 0:t.sourceCurrencyCode:cartStore.currency;return n};var renderCheckoutCurrency=function(r){var t=r.amount,e=r.isForeign;var n,o;var a=((n=cartStore.exchangeRate)===null||n===void 0?void 0:n.rate)||1;var i=cartStore.currency;var c=(o=cartStore.items[0])===null||o===void 0?void 0:o.currencyCode;if(c===i){return currencyFormat({amount:t,currency:i})}var u=cartStore.displayBaseCurrency;var s=getDisplayCurrency();if(e){var l=u?t/a:t;return currencyFormat({amount:l,currency:s})}var f=u?t:t*a;return currencyFormat({amount:f,currency:s})};var placeTestOrder=function(){return __awaiter(void 0,void 0,void 0,(function(){var r,t,e,n,o,a,i,c,u;return __generator(this,(function(s){switch(s.label){case 0:e=(r=cartStore.partiesData.find((function(r){return r.type==="DESTINATION"})))===null||r===void 0?void 0:r.id;n=(t=cartStore.partiesData.find((function(r){return r.type==="PAYOR"})))===null||t===void 0?void 0:t.id;o=storageStore.checkoutSessionId;if(!o||!n||!e){logError("Missing required data",{billToPartyId:n,checkoutSessionId:o,shipToPartyId:e});return[2,{errors:["Missing required data"],json:null}]}a={billToPartyId:n,checkoutSessionId:o,shipToPartyId:e};return[4,handleFetch("/api/zonos-elements/place-test-order",{body:a,method:"POST"})];case 1:i=s.sent(),c=i.errors,u=i.json;if(c.length||!u){logError("Error occurs when placing test order",c);return[2,{errors:c.map((function(r){return r.message})),json:null}]}return[2,{errors:[],json:u}]}}))}))};export{placeTestOrder as p,renderCheckoutCurrency as r};
1
+ var __awaiter=this&&this.__awaiter||function(r,t,e,n){function o(r){return r instanceof e?r:new e((function(t){t(r)}))}return new(e||(e=Promise))((function(e,a){function i(r){try{u(n.next(r))}catch(r){a(r)}}function c(r){try{u(n["throw"](r))}catch(r){a(r)}}function u(r){r.done?e(r.value):o(r.value).then(i,c)}u((n=n.apply(r,t||[])).next())}))};var __generator=this&&this.__generator||function(r,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(r){return function(t){return u([r,t])}}function u(c){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,c[0]&&(e=0)),e)try{if(n=1,o&&(a=c[0]&2?o["return"]:c[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;if(o=0,a)c=[c[0]&2,a.value];switch(c[0]){case 0:case 1:a=c;break;case 4:e.label++;return{value:c[1],done:false};case 5:e.label++;o=c[1];c=[0];continue;case 7:c=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){e.label=c[1];break}if(c[0]===6&&e.label<a[1]){e.label=a[1];a=c;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(c);break}if(a[2])e.ops.pop();e.trys.pop();continue}c=t.call(r,e)}catch(r){c=[6,r];o=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};import{e as cartStore}from"./cart-11b87221.js";import{d as currencyFormat,s as storageStore}from"./localization-9320a65d.js";import{l as logError,h as handleFetch}from"./handleFetch-a844cac1.js";var getDisplayCurrency=function(){var r,t;var e=cartStore.displayBaseCurrency;var n=e&&((r=cartStore.exchangeRate)===null||r===void 0?void 0:r.sourceCurrencyCode)?(t=cartStore.exchangeRate)===null||t===void 0?void 0:t.sourceCurrencyCode:cartStore.currency;return n};var renderCheckoutCurrency=function(r){var t=r.amount,e=r.isForeign;var n,o;var a=((n=cartStore.exchangeRate)===null||n===void 0?void 0:n.rate)||1;var i=cartStore.currency;var c=(o=cartStore.items[0])===null||o===void 0?void 0:o.currencyCode;if(c===i){return currencyFormat({amount:t,currency:i})}var u=cartStore.displayBaseCurrency;var s=getDisplayCurrency();if(e){var l=u?t/a:t;return currencyFormat({amount:l,currency:s})}var f=u?t:t*a;return currencyFormat({amount:f,currency:s})};var placeTestOrder=function(){return __awaiter(void 0,void 0,void 0,(function(){var r,t,e,n,o,a,i,c,u;return __generator(this,(function(s){switch(s.label){case 0:e=(r=cartStore.partiesData.find((function(r){return r.type==="DESTINATION"})))===null||r===void 0?void 0:r.id;n=(t=cartStore.partiesData.find((function(r){return r.type==="PAYOR"})))===null||t===void 0?void 0:t.id;o=storageStore.checkoutSessionId;if(!o||!n||!e){logError("Missing required data",{billToPartyId:n,checkoutSessionId:o,shipToPartyId:e});return[2,{errors:["Missing required data"],json:null}]}a={billToPartyId:n,checkoutSessionId:o,shipToPartyId:e};return[4,handleFetch("/api/zonos-elements/place-test-order",{body:a,method:"POST"})];case 1:i=s.sent(),c=i.errors,u=i.json;if(c.length||!u){logError("Error occurs when placing test order",c);return[2,{errors:c.map((function(r){return r.message})),json:null}]}return[2,{errors:[],json:u}]}}))}))};export{placeTestOrder as p,renderCheckoutCurrency as r};
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,t,o,r){function n(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,i){function l(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r["throw"](e))}catch(e){i(e)}}function s(e){e.done?o(e.value):n(e.value).then(l,a)}s((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return s([e,t])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(l&&(l=0,a[0]&&(o=0)),o)try{if(r=1,n&&(i=a[0]&2?n["return"]:a[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;if(n=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1];i=a;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(a);break}if(i[2])o.ops.pop();o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e];n=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-e3d0493a.js";import{c as stripeStore,B as stripeStoreBuildAddressForPartyCreate,e as cartStore,C as cartStoreUpdateSelectedShippingOption}from"./cart-11b87221.js";import{s as storageStore}from"./localization-9320a65d.js";import{h as handleFetch,s as sendErrorLog,l as logError}from"./handleFetch-a844cac1.js";import{b as allLogs}from"./VarianceTest-572cecf5.js";import{h}from"./index-55a03023.js";var _k=createStore((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,shippingAddress:null}})),collectStoreReset=_k.reset,collectStore=_k.state;var collectStoreInitShippingInfo=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,o,r,n,i,l,a,s,c,d,u,p,S;var f=e.landedCostId,v=e.retries,h=v===void 0?5:v;return __generator(this,(function(e){switch(e.label){case 0:collectStore.isFetchingShippingInfo=true;return[4,handleFetch("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:f},method:"POST"})];case 1:d=e.sent();if(!d.errors.length)return[3,4];if(!(h>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,collectStoreInitShippingInfo({landedCostId:f,retries:h-1})];case 3:return[2,null];case 4:collectStore.landedCostShortId=((t=d.json)===null||t===void 0?void 0:t.landedCostShortId)||null;collectStore.isFetchingShippingInfo=false;collectStore.shippingAddress=((o=d.json)===null||o===void 0?void 0:o.shipping)||null;u=(r=cartStore.checkoutSession)===null||r===void 0?void 0:r.landedCost;p=(n=cartStore.checkoutSession)===null||n===void 0?void 0:n.subtotals;S=(((i=u===null||u===void 0?void 0:u.amountSubtotals)===null||i===void 0?void 0:i.shipping)||0)+(((l=u===null||u===void 0?void 0:u.amountSubtotals)===null||l===void 0?void 0:l.items)||0);collectStore.amountTotalPaid=S*(((a=p===null||p===void 0?void 0:p.exchangeRate)===null||a===void 0?void 0:a.rate)||1);collectStore.amountDutyTaxFeeTotal=((p===null||p===void 0?void 0:p.duties)||0)+((p===null||p===void 0?void 0:p.taxes)||0)+((p===null||p===void 0?void 0:p.fees)||0);collectStore.originCompanyName=((c=(s=d.json)===null||s===void 0?void 0:s.origin)===null||c===void 0?void 0:c.companyName)||null;if(collectStore.amountTotalPaid===0){void sendErrorLog({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:f,organizationId:zonosStore.organizationId}})}return[2]}}))}))};var collectStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,o,r,n,i,l,a,s,c;return __generator(this,(function(d){switch(d.label){case 0:if(!((e=stripeStore.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}n=(o=(t=cartStore.checkoutSession)===null||t===void 0?void 0:t.landedCost)===null||o===void 0?void 0:o.rootId;if(!n){void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!storageStore.checkoutSessionId){void sendErrorLog({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,landedCostRootId:n}});return[2,{partiesCreated:false}]}i=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});l=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,handleFetch("/api/zonos-elements/create-billing-party",{body:{billingAddress:i,checkoutSessionId:storageStore.checkoutSessionId,companyName:stripeStore.companyName,email:((r=stripeStore.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:l,rootId:n},method:"POST"})];case 1:a=d.sent(),s=a.errors,c=a.json;if(s.length||!c){logError("Error occurs when creating billing party",JSON.stringify(s,null,2));void sendErrorLog({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:s,json:c}});return[2,{partiesCreated:false}]}collectStore.partyBillingId=c.billToPartyId;return[2,{partiesCreated:true}]}}))}))};var collectStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t;return __generator(this,(function(o){t=e.landedCost;if(!t){return[2,false]}cartStore.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},t),landedCostId:t.id})];return[2,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:true,landedCostId:t.id,selectedShippingOption:t.shipmentRating})]}))}))};var collectTabletBreakpoint=1024;var collectMobileBreakpoint=768;var isCollectTablet=function(e){return e||window.innerWidth<collectTabletBreakpoint&&window.innerWidth>=collectMobileBreakpoint};var isCollectMobile=function(e){return e||window.innerWidth<collectMobileBreakpoint};var renderFallback=function(e){var t=e.content,o=e.isLoading,r=e.skeletonHeight,n=e.skeletonWidth;if(o){return h("zonos-skeleton",{skeletonHeight:r,skeletonWidth:n})}return t};export{isCollectTablet as a,collectStoreInitShippingInfo as b,collectStoreUpdateSelectedShippingOption as c,collectStoreAsyncAddressUpdate as d,collectStore as e,isCollectMobile as i,renderFallback as r};