@zonos/elements 1.3.282 → 1.3.283

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 (178) hide show
  1. package/dist/cjs/{cart-dc31b242.js → cart-a1c00090.js} +1 -1
  2. package/dist/cjs/{collect-463ab3d7.js → collect-e61eafca.js} +2 -2
  3. package/dist/cjs/{getMissingRequiredShippingFields-7cd21100.js → getMissingRequiredShippingFields-a6c4f625.js} +1 -1
  4. package/dist/cjs/{hasInclusivePrice-d14b9d71.js → hasInclusivePrice-e7b57e02.js} +1 -1
  5. package/dist/cjs/index.cjs.js +7 -7
  6. package/dist/cjs/{invoice-8c995041.js → invoice-ead45797.js} +2 -2
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{localization-491121ad.js → localization-783849c8.js} +2 -0
  9. package/dist/cjs/{paypal-2a4c374c.js → paypal-e1548f40.js} +2 -2
  10. package/dist/cjs/{placeTestOrder-a940a2e9.js → placeTestOrder-d99b1fe2.js} +2 -2
  11. package/dist/cjs/{renderCheckoutCurrency-ab39875a.js → renderCheckoutCurrency-c942fcba.js} +2 -2
  12. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +94 -53
  13. package/dist/cjs/zonos-address-display_2.cjs.entry.js +12 -5
  14. package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
  15. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +3 -3
  16. package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
  17. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +7 -7
  18. package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
  19. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
  20. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
  21. package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
  22. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  23. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  24. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  25. package/dist/cjs/zonos-elements.cjs.js +1 -1
  26. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  27. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  28. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
  29. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
  30. package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
  31. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  32. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
  33. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.js +11 -4
  34. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +17 -5
  35. package/dist/collection/components/store/hello/localization.js +2 -0
  36. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +52 -48
  37. package/dist/collection/components/utils/checkout/getAddressCountryOptions.js +23 -0
  38. package/dist/esm/{cart-5282f6c1.js → cart-93c36159.js} +1 -1
  39. package/dist/esm/{collect-fdbab973.js → collect-42d4757a.js} +2 -2
  40. package/dist/esm/{getMissingRequiredShippingFields-bdeecbff.js → getMissingRequiredShippingFields-ebdccdcf.js} +1 -1
  41. package/dist/esm/{hasInclusivePrice-161e203f.js → hasInclusivePrice-4c12548f.js} +1 -1
  42. package/dist/esm/index.js +7 -7
  43. package/dist/esm/{invoice-cf6ad79e.js → invoice-71471339.js} +2 -2
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/{localization-0953a048.js → localization-754e7e8b.js} +2 -0
  46. package/dist/esm/{paypal-7c82eac4.js → paypal-b1410e02.js} +2 -2
  47. package/dist/esm/{placeTestOrder-6a746207.js → placeTestOrder-4267cafd.js} +2 -2
  48. package/dist/esm/{renderCheckoutCurrency-44f897a1.js → renderCheckoutCurrency-9a81e41c.js} +2 -2
  49. package/dist/esm/zonos-address-completion-dialog_7.entry.js +94 -53
  50. package/dist/esm/zonos-address-display_2.entry.js +12 -5
  51. package/dist/esm/zonos-address_4.entry.js +2 -2
  52. package/dist/esm/zonos-airwallex-payment.entry.js +3 -3
  53. package/dist/esm/zonos-card_5.entry.js +3 -3
  54. package/dist/esm/zonos-cart-items_12.entry.js +7 -7
  55. package/dist/esm/zonos-checkout.entry.js +3 -3
  56. package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
  57. package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
  58. package/dist/esm/zonos-collect.entry.js +4 -4
  59. package/dist/esm/zonos-controller.entry.js +2 -2
  60. package/dist/esm/zonos-country-flag.entry.js +1 -1
  61. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  62. package/dist/esm/zonos-elements.js +1 -1
  63. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  64. package/dist/esm/zonos-hello.entry.js +1 -1
  65. package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
  66. package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
  67. package/dist/esm/zonos-invoice.entry.js +4 -4
  68. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  69. package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
  70. package/dist/esm-es5/{cart-5282f6c1.js → cart-93c36159.js} +1 -1
  71. package/dist/esm-es5/{collect-fdbab973.js → collect-42d4757a.js} +1 -1
  72. package/dist/esm-es5/{getMissingRequiredShippingFields-bdeecbff.js → getMissingRequiredShippingFields-ebdccdcf.js} +1 -1
  73. package/dist/esm-es5/{hasInclusivePrice-161e203f.js → hasInclusivePrice-4c12548f.js} +1 -1
  74. package/dist/esm-es5/index.js +1 -1
  75. package/dist/esm-es5/{invoice-cf6ad79e.js → invoice-71471339.js} +1 -1
  76. package/dist/esm-es5/loader.js +1 -1
  77. package/dist/esm-es5/{localization-0953a048.js → localization-754e7e8b.js} +1 -1
  78. package/dist/esm-es5/{paypal-7c82eac4.js → paypal-b1410e02.js} +1 -1
  79. package/dist/esm-es5/{placeTestOrder-6a746207.js → placeTestOrder-4267cafd.js} +1 -1
  80. package/dist/esm-es5/{renderCheckoutCurrency-44f897a1.js → renderCheckoutCurrency-9a81e41c.js} +1 -1
  81. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
  82. package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
  83. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  84. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  85. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  86. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  87. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  88. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  89. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  90. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  91. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  92. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  93. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  94. package/dist/esm-es5/zonos-elements.js +1 -1
  95. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  96. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  97. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  98. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  99. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  100. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  101. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  102. package/dist/scripts/index.js +1 -1
  103. package/dist/scripts/loadZonos.js +1 -1
  104. package/dist/scripts/zonos.js +1 -1
  105. package/dist/types/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.d.ts +1 -0
  106. package/dist/types/components/store/hello/localization.d.ts +7 -0
  107. package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +9 -13
  108. package/dist/types/components/utils/checkout/getAddressCountryOptions.d.ts +29 -0
  109. package/dist/zonos-elements/index.esm.js +1 -1
  110. package/dist/zonos-elements/{p-dfd83cff.entry.js → p-007ff76a.entry.js} +1 -1
  111. package/dist/zonos-elements/{p-1cf5e2ce.system.entry.js → p-065f3f66.system.entry.js} +1 -1
  112. package/dist/zonos-elements/{p-543b25f9.entry.js → p-07c21940.entry.js} +1 -1
  113. package/dist/zonos-elements/{p-fb8dc23f.system.js → p-0d183f19.system.js} +1 -1
  114. package/dist/zonos-elements/{p-aa37f436.system.entry.js → p-1180a97c.system.entry.js} +1 -1
  115. package/dist/zonos-elements/{p-5953208b.js → p-19bbf4b3.js} +1 -1
  116. package/dist/zonos-elements/{p-d06486ba.system.entry.js → p-1af510ea.system.entry.js} +1 -1
  117. package/dist/zonos-elements/{p-646e6b47.system.entry.js → p-1cff471a.system.entry.js} +1 -1
  118. package/dist/zonos-elements/{p-1d31b966.system.js → p-22f7120a.system.js} +1 -1
  119. package/dist/zonos-elements/{p-71fc8a22.js → p-2837bfd2.js} +1 -1
  120. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  121. package/dist/zonos-elements/{p-f1aa60fd.system.entry.js → p-29ca1415.system.entry.js} +1 -1
  122. package/dist/zonos-elements/p-2aebcfa8.system.entry.js +1 -0
  123. package/dist/zonos-elements/p-33dd7dab.entry.js +1 -0
  124. package/dist/zonos-elements/{p-68631285.system.entry.js → p-342b062d.system.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-c8bc4ede.js → p-38881097.js} +1 -1
  126. package/dist/zonos-elements/{p-e6e3a303.entry.js → p-39399f67.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-6f874ed9.entry.js → p-3d902845.entry.js} +1 -1
  128. package/dist/zonos-elements/{p-76e36d6d.entry.js → p-3dcb3794.entry.js} +1 -1
  129. package/dist/zonos-elements/p-4a5fa892.system.entry.js +1 -0
  130. package/dist/zonos-elements/{p-5d6b018c.system.entry.js → p-4a73906a.system.entry.js} +1 -1
  131. package/dist/zonos-elements/{p-323279b8.entry.js → p-4b9c7803.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-c12ca8fe.system.entry.js → p-4dba0e9b.system.entry.js} +1 -1
  133. package/dist/zonos-elements/{p-ca9231a0.system.entry.js → p-58da55e6.system.entry.js} +1 -1
  134. package/dist/zonos-elements/p-59824ac6.entry.js +1 -0
  135. package/dist/zonos-elements/{p-c8df5eee.system.entry.js → p-59e4e0b6.system.entry.js} +1 -1
  136. package/dist/zonos-elements/{p-cd3f7fd7.system.js → p-5fceef56.system.js} +1 -1
  137. package/dist/zonos-elements/{p-e57f862d.system.js → p-602de72d.system.js} +1 -1
  138. package/dist/zonos-elements/{p-a4eddf6c.system.js → p-6325ee77.system.js} +1 -1
  139. package/dist/zonos-elements/{p-c5bfe522.system.js → p-67251274.system.js} +1 -1
  140. package/dist/zonos-elements/{p-4417475f.entry.js → p-69871ab6.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-1cf76dd3.entry.js → p-6be4c473.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-0287f9cd.system.js → p-72280783.system.js} +1 -1
  143. package/dist/zonos-elements/{p-c121b2b8.entry.js → p-73d1a554.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-c9e44c77.system.entry.js → p-76a75da9.system.entry.js} +1 -1
  145. package/dist/zonos-elements/p-76cdf517.js +1 -0
  146. package/dist/zonos-elements/p-8eaf1316.js +1 -0
  147. package/dist/zonos-elements/{p-56e9a29e.entry.js → p-944282af.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-aa1f3060.system.entry.js → p-97f15546.system.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-10584546.entry.js → p-9ceb3d1c.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-7c70e0c7.js → p-a2fe995b.js} +1 -1
  151. package/dist/zonos-elements/{p-b91a8f31.system.entry.js → p-aa7589de.system.entry.js} +1 -1
  152. package/dist/zonos-elements/{p-3642dd99.entry.js → p-b0482924.entry.js} +1 -1
  153. package/dist/zonos-elements/{p-28ee0860.system.js → p-b567448d.system.js} +1 -1
  154. package/dist/zonos-elements/{p-23eee868.entry.js → p-b7a03b08.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-e101b0de.system.entry.js → p-c43130a7.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-2394b186.system.js → p-c515bc23.system.js} +1 -1
  157. package/dist/zonos-elements/{p-30cfc9f4.entry.js → p-c8a48cce.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-d2cb99ee.system.entry.js → p-cc35d5f8.system.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-ab61ef19.system.js → p-cd5638b2.system.js} +2 -2
  160. package/dist/zonos-elements/p-d68425ad.js +1 -0
  161. package/dist/zonos-elements/{p-0fb4e032.entry.js → p-d74eda59.entry.js} +1 -1
  162. package/dist/zonos-elements/{p-95042e71.entry.js → p-d93f4837.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-d0767f88.entry.js → p-dcf8ab79.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-f1298203.system.entry.js → p-e2057ab0.system.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-1977f4b5.js → p-e2b8936a.js} +1 -1
  166. package/dist/zonos-elements/{p-8fb15a6b.system.entry.js → p-e8159288.system.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-59518657.entry.js → p-e8bb4f3b.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-fdd7ec44.system.entry.js → p-e99654c1.system.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-7ab15d20.js → p-f9f3155b.js} +1 -1
  170. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  171. package/package.json +1 -1
  172. package/dist/zonos-elements/p-193fc2da.entry.js +0 -1
  173. package/dist/zonos-elements/p-3c62acbd.js +0 -1
  174. package/dist/zonos-elements/p-5987dea1.js +0 -1
  175. package/dist/zonos-elements/p-63b462dd.system.entry.js +0 -1
  176. package/dist/zonos-elements/p-8418aa07.entry.js +0 -1
  177. package/dist/zonos-elements/p-987b5d8f.js +0 -1
  178. package/dist/zonos-elements/p-ddd0e703.system.entry.js +0 -1
@@ -1 +1 @@
1
- System.register(["./p-7261e245.system.js","./p-1d31b966.system.js","./p-47a1d469.system.js","./p-23e7c655.system.js","./p-01174496.system.js","./p-d938f42f.system.js"],(function(t){"use strict";var s,o,n,e,i,a,h;return{setters:[function(t){s=t.r;o=t.h;n=t.a;e=t.g},function(t){i=t.l},function(t){a=t.f},function(t){h=t.c},function(){},function(){}],execute:function(){var r=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";var f=r;var l="https://zonos-store-assets.s3.amazonaws.com/images/elements-flags";var c=t("zonos_country_flag",function(){function t(t){s(this,t);this.countryCode=i.selectedCountryCode}t.prototype.render=function(){if(!this.el.shadowRoot||!this.countryCode){return null}var t="".concat(l,"/").concat(this.countryCode,".svg");var s=a();return o(n,{class:"zonos--elements",style:this.size?{"--zonos--font-family":s,height:"".concat(this.size,"px"),width:"".concat(this.size,"px")}:{"--zonos--font-family":s}},o("div",{class:h(["flag-container"])},o("div",{class:"flag-icon",style:{backgroundImage:"url(".concat(t,")")}})))};Object.defineProperty(t.prototype,"el",{get:function(){return e(this)},enumerable:false,configurable:true});return t}());c.style=f}}}));
1
+ System.register(["./p-7261e245.system.js","./p-22f7120a.system.js","./p-47a1d469.system.js","./p-23e7c655.system.js","./p-01174496.system.js","./p-d938f42f.system.js"],(function(t){"use strict";var s,o,n,e,i,a,h;return{setters:[function(t){s=t.r;o=t.h;n=t.a;e=t.g},function(t){i=t.l},function(t){a=t.f},function(t){h=t.c},function(){},function(){}],execute:function(){var r=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";var f=r;var l="https://zonos-store-assets.s3.amazonaws.com/images/elements-flags";var c=t("zonos_country_flag",function(){function t(t){s(this,t);this.countryCode=i.selectedCountryCode}t.prototype.render=function(){if(!this.el.shadowRoot||!this.countryCode){return null}var t="".concat(l,"/").concat(this.countryCode,".svg");var s=a();return o(n,{class:"zonos--elements",style:this.size?{"--zonos--font-family":s,height:"".concat(this.size,"px"),width:"".concat(this.size,"px")}:{"--zonos--font-family":s}},o("div",{class:h(["flag-container"])},o("div",{class:"flag-icon",style:{backgroundImage:"url(".concat(t,")")}})))};Object.defineProperty(t.prototype,"el",{get:function(){return e(this)},enumerable:false,configurable:true});return t}());c.style=f}}}));
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-47a1d469.system.js","./p-1d31b966.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-fb8dc23f.system.js"],(function(e){"use strict";var n,t,r,i,o,a,u,s,c,f,l,d,v,p;return{setters:[function(e){n=e.c;t=e.z},function(e){r=e.t;i=e.l;o=e.s},function(e){a=e.l;u=e.h;s=e.s},function(e){c=e.l;f=e.b},function(e){l=e.b;d=e.K;v=e.d;p=e.L}],execute:function(){var m=this;function h(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function y(e){if(Array.isArray(e))return e}function w(e){if(Array.isArray(e))return h(e)}function g(e,n,t,r,i,o,a){try{var u=e[o](a);var s=u.value}catch(e){t(e);return}if(u.done){n(s)}else{Promise.resolve(s).then(r,i)}}function b(e){return function(){var n=this,t=arguments;return new Promise((function(r,i){var o=e.apply(n,t);function a(e){g(o,r,i,a,u,"next",e)}function u(e){g(o,r,i,a,u,"throw",e)}a(undefined)}))}}function k(e,n){if(!(e instanceof n)){throw new TypeError("Cannot call a class as a function")}}function x(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function E(e,n,t){if(n)x(e.prototype,n);if(t)x(e,t);return e}function I(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function S(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function C(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function N(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var i=true;var o=false;var a,u;try{for(t=t.call(e);!(i=(a=t.next()).done);i=true){r.push(a.value);if(n&&r.length===n)break}}catch(e){o=true;u=e}finally{try{if(!i&&t["return"]!=null)t["return"]()}finally{if(o)throw u}}return r}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))}r.forEach((function(n){I(e,n,t[n])}))}return e}function P(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(n){r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))}t.push.apply(t,r)}return t}function R(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function O(e,n){return y(e)||N(e,n)||L(e,n)||T()}function _(e){return w(e)||C(e)||L(e)||D()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function L(e,n){if(!e)return;if(typeof e==="string")return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}function U(e,n){var t,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(n){return s([e,n])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,r&&(i=o[0]&2?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;if(r=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;r=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(o[0]===6&&a.label<i[1]){a.label=i[1];i=o;break}if(i&&a.label<i[2]){a.label=i[2];a.ops.push(o);break}if(i[2])a.ops.pop();a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e];r=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var M=function(e){e["production"]="prod";e["demo"]="demo";e["staging"]="staging";return e}(M||{});var F="airTracker_unknown";var K={appName:F,appVersion:F,env:"staging",isWebappContainer:false,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:false,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:false,enableRecordPageRetention:false,hideSearchParams:false,useSessionStorageForSessionId:false,assetSpeedMonitoringWhiteListByMFE:{}};var q={appName:F,env:"staging",sessionId:F,deviceId:F};var H=function(e){if(!e){return false}if(/^\s*$/.test(e))return false;e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return/^[\],:{}\s]*$/.test(e)};var z=function(){var e=new WeakSet;return function(n,t){if(S(t,Error)){return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack)}if((typeof t==="undefined"?"undefined":A(t))==="object"&&t!==null){if(e.has(t)){return"[Circular ".concat(n||"root","]")}e.add(t)}if(typeof t==="function"){return"function"}if((typeof t==="undefined"?"undefined":A(t))==="symbol"){return"symbol"}if(typeof t==="undefined"){return null}return t}};var B=function(e){if(typeof e==="string"){return e}try{if(S(e,Error)){return(JSON.stringify(e,z())||"undefined").replace(/"/gim,"")}return JSON.stringify(e,z())}catch(e){return'{"error":"error happen when airTracker stringify"}'}};var W=function(e){var n=e.method,t=n===void 0?"post":n,r=e.url,i=e.data,o=e.success,a=e.fail;if(!H(i)){return}var u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){if(u.readyState===4){if(u.status>=400||u.status===0){a===null||a===void 0?void 0:a(u.response)}else{o===null||o===void 0?void 0:o(u.response)}}}));u.open(t,r);u.setRequestHeader("Content-Type","application/json");u.send(i)};var X={onInit:"onInit",onConfigInit:"onConfigInit",onConfigUpdated:"onConfigUpdated",onCommonDataInit:"onCommonDataInit",onCommonUpdated:"onCommonUpdated",onPageChange:"onPageChange",onDestroy:"onDestroy,"};var G="AIR_ANALYTICS_DEVICE_ID";var V="AIR_ANALYTICS_SESSION_ID";var $="AWX_RISK_ID";var J=function(e){if(e=="prod"){return"https://o11y.airwallex.com/airtracker/logs"}if(e=="demo"){return"https://o11y-demo.airwallex.com/airtracker/logs"}return"https://o11y-staging.airwallex.com/airtracker/logs"};var Q=function(e){if(e=="prod"){return"https://o11y.airwallex.com/airtracker/metrics"}if(e=="demo"){return"https://o11y-demo.airwallex.com/airtracker/metrics"}return"https://o11y-staging.airwallex.com/airtracker/metrics"};var Y=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=Math.random()*16|0;var t=e==="x"?n:n&3|8;return t.toString(16)}));return e};var Z=function(e){var n,t,r;if(e.config.getMFEName){return e.config.getMFEName()}return((r=location)===null||r===void 0?void 0:(t=r.pathname)===null||t===void 0?void 0:(n=t.split("/"))===null||n===void 0?void 0:n[2])||"unknown"};var ee=function(){try{var e=window.sessionStorage.getItem(V);if(!e){e=Y();window.sessionStorage.setItem(V,e)}return e}catch(e){return Y()}};var ne=function(){try{var e=window.localStorage.getItem(G);if(!e){e=Y();window.localStorage.setItem(G,e)}return e}catch(e){}};var te=function(){try{var e=window.localStorage.getItem($);return e||void 0}catch(e){}};var re=function(){var e;var n="";var t=navigator.userAgent.match(/NetType\/(\w+)/);if(t){var r;r=O(t,2),n=r[1]}else if((e=navigator)===null||e===void 0?void 0:e.connection){var i,o,a,u;n=((o=navigator)===null||o===void 0?void 0:(i=o.connection)===null||i===void 0?void 0:i.effectiveType)||((u=navigator)===null||u===void 0?void 0:(a=u.connection)===null||a===void 0?void 0:a.type)}if(!n){n="unknown"}return ie(n)};var ie=function(e){e=String(e).toLowerCase();if(e.indexOf("4g")>=0)return"net4g";if(e.indexOf("wifi")>=0)return"wifi";if(e.indexOf("5g")>=0)return"net5g";if(e.indexOf("3g")>=0)return"net3g";if(e.indexOf("2g")>=0)return"net2g";return"unknown"};var oe=function e(){return typeof window.performance!=="undefined"&&typeof window.performance.clearResourceTimings==="function"&&typeof window.performance.getEntriesByType==="function"&&typeof window.performance.now==="function"};var ae=function(e){if(typeof e==="string"){var n=e.split("?")[0]||"";return n.slice(0,200)}return e};var ue=function(e){if(typeof e==="string"){return e.split("?")[1]||""}return e};var se=function(e){var n=typeof e==="string"&&e.startsWith("//");return n?typeof location!=="undefined"&&location.protocol==="https:":/^https/.test(e)};var ce=function(e,n){if(typeof e==="number"){return e}if(typeof e==="string"){return e}return n?"":-1};var fe=function(e,n){var t;var r=false;if(!n.config.isWebappContainer){r=le(e,n.config.assetSpeedMonitoringWhiteList);return r}var i=Z(n);return r||le(e,(t=n.config.assetSpeedMonitoringWhiteListByMFE)===null||t===void 0?void 0:t[i])};var le=function(e,n){if(!(n===null||n===void 0?void 0:n.length)){return false}for(var t=0;t<n.length;t++){var r=n[t];if(S(r,RegExp)&&r.test(e)){return true}if(typeof r=="string"&&e.includes(r)){return true}}return false};var de=function(e,n){var t=100;return Math.round((e-n)*t)/t};var ve=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?j({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a=Array.isArray(n)?n:[n];if(a.length===0){return}var u={commonData:o,data:a};var s=B(u);var c={method:"post",url:J(e.commonData.env),data:s};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var f=navigator.sendBeacon(c.url,s);if(!f){W(c)}}else{W(c)}}};var pe=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?j({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a={commonData:o,data:Array.isArray(n)?n:[n]};var u=B(a);var s={method:"post",url:Q(e.commonData.env),data:u};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var c=navigator.sendBeacon(s.url,u);if(!c){W(s)}}else{W(s)}}};var me=function(e,n){var t;var r=[];var i=e.config;window.addEventListener("beforeunload",(function(){if(r.length>0){e.immediateSendPipe(r.splice(0,r.length));t&&clearTimeout(t)}}));return function(o,a){r.push(o);e.lifeCycle.on(X.onCommonUpdated,(function(){if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(X.onCommonUpdated);t&&clearTimeout(t)}}));if(n&&r.length>=n){a===null||a===void 0?void 0:a(r.splice(0,r.length));t&&clearTimeout(t);return}t&&clearTimeout(t);t=setTimeout((function(){t=null;if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(X.onCommonUpdated)}}),i.delay)}};var he=function(e){var n={};return function(t,r){var i=typeof e.config.errorRepeatTime==="number"?e.config.errorRepeatTime:5;if(i===0){return r===null||r===void 0?void 0:r(t)}r===null||r===void 0?void 0:r(t.filter((function(e){if(e.severity=="autoDetectError"){n[e.error]=n[e.error]||0;n[e.error]+=1;if(n[e.error]>i){return false}return true}return true})))}};var ye=function(){};var we=function(e){if(!e||!e.reduce||!e.length){throw new TypeError("createPipeline need at least one function param")}if(e.length===1){return function(n,t){e[0](n,t||ye)}}return e.reduce((function(e,n){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ye;return e(t,(function(e){return n===null||n===void 0?void 0:n(e,r)}))}}))};var ge=function(){function e(){var n=this;k(this,e);this.emit=function(e,t){if(!n)return;var r=n.eventsList[e];var i;if(r===null||r===void 0?void 0:r.length){r=r.slice();for(var o=0;o<r.length;o++){i=r[o];try{var a=i.callback.apply(n,[t]);if(1===i.type){n.remove(e,i.callback)}if(false===a){break}}catch(e){throw e}}}return n};this.eventsList={}}E(e,[{key:"indexOf",value:function e(n,t){for(var r=0;r<n.length;r++){if(n[r].callback===t){return r}}return-1}},{key:"on",value:function e(n,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!this)return;var i=this.eventsList[n];if(!i){this.eventsList[n]=[];i=this.eventsList[n]}if(this.indexOf(i,t)===-1){var o={name:n,type:r||0,callback:t};i.push(o);return this}return this}},{key:"one",value:function e(n,t){this.on(n,t,1)}},{key:"remove",value:function e(n,t){if(!this)return;var r=this.eventsList[n];if(!r){return null}if(!t){try{delete this.eventsList[n]}catch(e){}return null}if(r.length){var i=this.indexOf(r,t);r.splice(i,1)}return this}},{key:"clear",value:function e(){this.eventsList={}}}]);return e}();var be=function(){function e(n){k(this,e);this.name="";this.isInit=false;this.name=n.name;this.option=n}E(e,[{key:"patch",value:function e(n){if(!this.isInit){var t,r;this.isInit=true;(r=this.option)===null||r===void 0?void 0:(t=r.setUp)===null||t===void 0?void 0:t.call(this.option,n)}}},{key:"uninstall",value:function e(){var n,t;(t=this.option)===null||t===void 0?void 0:(n=t.destroy)===null||n===void 0?void 0:n.apply(this);this.isInit=false}}]);return e}();var ke;var xe=function(e){var n="".concat(B(e.message)||""," @ (").concat(B(e.filename)||"",":").concat(e.lineno||0,":").concat(e.colno||0,")\n").concat(B(e.error||""));ke.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:n}})};var Ee=function(e){var n=e&&B(e.reason);ke.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:n}})};var Ie=function(e){var n=(e===null||e===void 0?void 0:e.target)||(e===null||e===void 0?void 0:e.srcElement);if(!n){return}var t=(n===null||n===void 0?void 0:n.src)||(n===null||n===void 0?void 0:n.href);var r=n.tagName;var i="unknown";if(typeof t==="string"&&r){if(window.location.href.indexOf(t)>-1){return}if(/\.js$/.test(t)){i="script"}else if(/\.css$/.test(t)){i="css"}else{switch(r.toLowerCase()){case"script":i="script";break;case"link":i="css";break;case"img":i="image";break;case"audio":case"video":i="media";break;default:return}}ke.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}};var Se=new be({name:"errorDetectionPlugin",setUp:function(e){ke=e;window.addEventListener("error",xe);window.addEventListener("unhandledrejection",Ee);window.document.addEventListener("error",Ie,true)},destroy:function(){window.removeEventListener("unhandledrejection",Ee);window.document.removeEventListener("error",Ie,true);window.removeEventListener("error",xe)}});var Ce=["img","css","script","link","audio","video","iframe"];var Ne="resource";var Te=function(e){var n=e.name;return{url:ae(n),method:"get",duration:Number(e.duration.toFixed(2)),type:"static",isHttps:se(n),urlQuery:ue(n),domainLookup:ce(e.domainLookupEnd-e.domainLookupStart),connectTime:ce(e.connectEnd-e.connectStart)}};var De=function(e,n){for(var t=0,r=e.length;t<r;t++){var i=e[t];if(Ce.indexOf(i.initiatorType)!==-1&&fe(i.name,n)){n.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:Te(i)}})}}};var je;var Pe;var Re=new be({name:"assetsSpeedPlugin",setUp:function(e){if(!oe())return;var n=0;window.performance.onresourcetimingbufferfull=function(){n=0;window.performance.clearResourceTimings()};if(typeof window.PerformanceObserver==="function"){De(window.performance.getEntriesByType(Ne),e);Pe=new window.PerformanceObserver((function(n){De(n.getEntries(),e)}));Pe.observe({entryTypes:[Ne]})}else{je=setInterval((function(){var t=window.performance.getEntriesByType(Ne);var r=t.slice(n);n=t.length;De(r,e)}),3e3)}},destroy:function(){Pe===null||Pe===void 0?void 0:Pe.disconnect();je&&clearInterval(je)}});var Oe;var _e=new be({name:"onPageChangePlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o;return U(this,(function(a){t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");i=function(n){var t=n.prevHref;var r,i,o,a,u;e.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:t,href:((r=location)===null||r===void 0?void 0:r.href)||"",hostname:(i=location)===null||i===void 0?void 0:i.hostname,pathName:(o=location)===null||o===void 0?void 0:o.pathname,protocol:(a=location)===null||a===void 0?void 0:a.protocol,search:(u=location)===null||u===void 0?void 0:u.search}})};i({prevHref:""});Oe=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;i({prevHref:e})}}));o={subtree:true,childList:true};Oe.observe(r||document,o);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Oe===null||Oe===void 0?void 0:Oe.disconnect()}});var Ae;var Le=new be({name:"onPageRetentionPlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o,a,u;return U(this,(function(s){if(typeof document.visibilityState==="undefined"){return[2]}t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");o=function(){i=Date.now()};o();document.addEventListener("visibilitychange",(function(){if(document.visibilityState==="hidden"){a({href:location.href,leftReason:"visibilityChange"})}else if(document.visibilityState==="visible"){o()}}));window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:true,leftReason:"pageClose"})}));a=function(n){var t=n.href,r=n.sendImmediate,o=n.leftReason;if(!i){return}var a=Date.now()-i;if(a===0){return}i=void 0;var u={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:t,duration:a,leftReason:o}};if(r){e.ImmediatePipeline(u);return}e.normalLogPipeLine(u)};Ae=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;a({href:e,leftReason:"nextPage"});o()}}));u={subtree:true,childList:true};Ae.observe(r||document,u);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Ae===null||Ae===void 0?void 0:Ae.disconnect()}});var Ue=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)};var Me=function(e,n){var t=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/];var r=[/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i];if(r.some((function(n){return n.test(e)}))){return false}return le(e,n||t)};var Fe=function(e){var n=e.startTime,t=e.endTime,r=e.entries;if(r.length===0){return void 0}if(r.length===1){return r[0]}var i=r.filter((function(e){return e.startTime>=n&&t&&e.responseEnd<=t})).sort((function(e,n){return e.startTime-n.startTime}));return i===null||i===void 0?void 0:i[0]};var Ke=function(e){return Math.round(e*100)/100};var qe=function(e){var n=e.startTime,t=e.duration,r=e.responseStart,i=e.connectEnd,o=e.connectStart,a=e.domainLookupEnd,u=e.domainLookupStart,s=e.requestStart,c=e.secureConnectionStart,f=e.redirectEnd,l=e.redirectStart,d=e.responseStatus,v=e.responseEnd,p=e.encodedBodySize,m=e.decodedBodySize,h=e.transferSize,y=e.deliveryType,w=e.initiatorType;return{startTime:Ke(n),totalDuration:Ke(t),timeToFirstByte:de(r,n),tcpDuration:de(i,o),dnsDuration:de(a,u),tlsDuration:de(s,c),redirectDuration:de(f,l),responseDuration:de(v,r),encodeResponseSize:p,decodeResponseSize:m,transferSize:h,deliveryType:y,statusCode:d,initiatorType:w}};var He=function(e,n){var t=e.url,r=e.method,i=e.errorType,o=e.errorDetail;var a=Fe(e);var u=new URL(t,window.location.href),s=u.href,c=u.protocol;var f=a?qe(a):{};var l={severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:j(R(j({httpUrl:s,method:r,scheme:c},i&&{errorType:i},o&&{errorDetail:o},f),{statusCode:(f===null||f===void 0?void 0:f.statusCode)||(e===null||e===void 0?void 0:e.responseStatus),startTime:(f===null||f===void 0?void 0:f.startTime)||(e===null||e===void 0?void 0:e.startTime),initiatorType:(f===null||f===void 0?void 0:f.initiatorType)||(e===null||e===void 0?void 0:e.initiatorType)}),n)};return l};var ze=function(e){return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"errors"in e&&Array.isArray(e.errors)&&e.errors.every((function(e){return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"message"in e}))};var Be="awx_airtracker_api_performance_queue";var We="awx_airtracker_api_performance_plugin_loaded";var Xe=300;var Ge=1e4;var Ve=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};Ve[Be]=Ve[Be]||[];var $e=function(e,n,t){setTimeout((function(){var r=He(e,t);n.observerPipeline(r);Ve[Be]=Ve[Be].filter((function(n){return n.id!==e.id}))}),Xe)};var Je=function(e,n){setTimeout((function(){var t=Ve[Be].find((function(n){return n.id===e}));if(!t){return}var r=He(t,{exceptionType:"timeout-without-response"});n.observerPipeline(r);Ve[Be]=Ve[Be].filter((function(n){return n.id!==e}))}),Ge)};var Qe=function(e){var n=XMLHttpRequest.prototype.open;var t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function t(r,i,o,a,u){try{var s;var c=Ue();this.__requestId=c;var f=S(i,URL)?i.href:new URL(i,window.location.href).href;if(!Me(f,(s=e.config)===null||s===void 0?void 0:s.enableRecordAPIPerformanceWhitelist)){return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}var l={id:c,startTime:performance.now(),method:r,url:f,entries:[],initiatorType:"xmlhttprequest"};Ve[Be].push(l);Je(c,e);return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}catch(t){e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:t}});return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}};XMLHttpRequest.prototype.send=function n(){var r=this;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++){o[a]=arguments[a]}try{var u=Ve[Be].find((function(e){return e.id===r.__requestId}));if(!u){return t.apply(this,o)}var s=this;this.addEventListener("loadend",b((function(){var n,t,r,i,o,a,c;return U(this,(function(f){switch(f.label){case 0:n=performance.now();t=n-u.startTime;r=s.status;if(r===0){return[2]}u.endTime=n;u.duration=t;u.responseStatus=r;f.label=1;case 1:f.trys.push([1,6,,7]);if(!(s.responseType===""||s.responseType==="text"))return[3,2];i=s.responseText;return[3,5];case 2:if(!(s.responseType==="json"))return[3,3];i=s.response;return[3,5];case 3:if(!(s.responseType==="blob"))return[3,5];o=s.response;if(!((o===null||o===void 0?void 0:o.type)==="application/json"))return[3,5];return[4,o.text()];case 4:i=f.sent();f.label=5;case 5:a=i&&typeof i==="string"?JSON.parse(i):i;if(a&&ze(a)){u.errorType="graphqlError";u.errorDetail=a.errors}return[3,7];case 6:c=f.sent();e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:u===null||u===void 0?void 0:u.url,error:c}});return[3,7];case 7:$e(u,e);return[2]}}))})));this.addEventListener("error",(function(){$e(u,e,{exceptionType:"network-error"})}));this.addEventListener("abort",(function(){$e(u,e,{exceptionType:"abort-error"})}));this.addEventListener("timeout",(function(){$e(u,e,{exceptionType:"timeout-error"})}));return t.apply(this,o)}catch(n){e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:n}});throw n}}};var Ye=function(e){var n=window.fetch;window.fetch=b((function(){var t,r,i,o,a,u,s,c,f,l,d,v,p,m,h,y;var w=arguments;return U(this,(function(g){switch(g.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++){r[i]=w[i]}u=new URL(S(r[0],Request)?r[0].url:String(r[0]),window.location.href).href;if(!!Me(u,(o=e.config)===null||o===void 0?void 0:o.enableRecordAPIPerformanceWhitelist))return[3,2];return[4,n.apply(this,r)];case 1:return[2,g.sent()];case 2:g.trys.push([2,9,,10]);c=performance.now();f=Ue();a={id:f,startTime:c,method:((s=S(r[0],Request)?r[0]:r[1])===null||s===void 0?void 0:s.method)||"GET",url:u,entries:[],initiatorType:"fetch"};Ve[Be].push(a);Je(f,e);return[4,n.apply(this,r)];case 3:l=g.sent();d=performance.now();a.endTime=d;a.duration=d-c;a.responseStatus=l.status;v=l.clone();g.label=4;case 4:g.trys.push([4,7,,8]);if(!v.ok)return[3,6];return[4,v.json()];case 5:p=g.sent();if(p&&ze(p)){a.errorType="graphqlError";a.errorDetail=p.errors}g.label=6;case 6:return[3,8];case 7:m=g.sent();e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a===null||a===void 0?void 0:a.url,error:m}});return[3,8];case 8:$e(a,e);return[2,l];case 9:h=g.sent();if(a&&a.id&&Ve[Be].find((function(e){return e.id===(a===null||a===void 0?void 0:a.id)}))){y="fetch-error";if(S(h,TypeError)){y="network-error"}else if(S(h,DOMException)&&h.name==="AbortError"){y="abort-error"}$e(a,e,{exceptionType:y})}else{e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}})}throw h;case 10:return[2]}}))}))};var Ze=function(e){var n;Qe(e);Ye(e);if((n=window)===null||n===void 0?void 0:n.PerformanceObserver){var t=new window.PerformanceObserver((function(e){var n=e.getEntries();n.forEach((function(e){var n=e;if(n.initiatorType==="fetch"||n.initiatorType==="xmlhttprequest"){var t=Ve[Be].filter((function(e){return e.url===n.name}));t.forEach((function(e){e.entries.push(n)}))}}))}));t.observe({entryTypes:["resource"],buffered:true})}else{e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}};var en=new be({name:"apiPerformancePlugin",setUp:function(){var e=b((function(e){var n,t;return U(this,(function(r){if(Ve[We]){return[2]}if(((n=e.config)===null||n===void 0?void 0:n.enableRecordAPIPerformance)&&Math.random()<(((t=e.config)===null||t===void 0?void 0:t.enableRecordAPIPerformancePercentage)||0)){Ve[We]=true;Ze(e)}return[2]}))}));return function(n){return e.apply(this,arguments)}}()});var nn="3.1.0";var tn=function(){function e(n){var t=this;var r=n.config,i=n.plugins,o=i===void 0?[]:i;k(this,e);this.config=K;this.lifeCycle=new ge;this.plugins=[];this._commonData=q;this._MFECommonDataMap={};this.timeMap={};this.packedDataConvert=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o,a;var u=j({severity:n,eventName:r,currentHref:t.config.hideSearchParams?(((o=location)===null||o===void 0?void 0:o.href)||"").split("?")[0]||"":((a=location)===null||a===void 0?void 0:a.href)||""},i);if(t.config.isWebappContainer){u.MFEName=Z(t)}return u};this.normalPipelineObj=we([me(this,8),he(this),ve(this)]);this.observerPipelineObj=we([me(this,8),pe(this)]);this.immediateSendPipe=ve(this);this.observerPipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.observerPipelineObj(o)};this.normalLogPipeLine=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});if(t.config.disableThrottle){return t.immediateSendPipe(o)}else{return t.normalPipelineObj(o)}};this.ImmediatePipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.immediateSendPipe(o)};this.plugins=_(o);this.setConfig(r);this.initCommonData(r);this.lifeCycle.emit(X.onInit);if(r.enableErrorMonitoring){this.plugins.push(Se)}if((r===null||r===void 0?void 0:r.assetSpeedMonitoringWhiteList)&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer){this.plugins.push(Re)}if(r===null||r===void 0?void 0:r.enableDetectPageChange){this.plugins.push(_e)}if(r===null||r===void 0?void 0:r.enableRecordPageRetention){this.plugins.push(Le)}if((r===null||r===void 0?void 0:r.enableRecordAPIPerformance)&&(r===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1){this.plugins.push(en)}this.installPlugins()}E(e,[{key:"installPlugins",value:function e(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function e(){return this._commonData}},{key:"MFECommonDataMap",get:function e(){return this._MFECommonDataMap}},{key:"initCommonData",value:function e(n){this._commonData.sessionId=n.useSessionStorageForSessionId?ee():Y();this._commonData.deviceId=ne()||F;this._commonData.riskDeviceId=te();this._commonData.networkType=re()||"unknown";this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||F;this._commonData.appVersion=n.appVersion;this._commonData.appName=n.appName;this._commonData.sdkVersion=nn;this.lifeCycle.emit(X.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function e(n){this.lifeCycle.emit(X.onCommonUpdated,this._commonData);this._commonData.env=n.env||this._commonData.env;this._commonData.appName=n.appName||this._commonData.appName;this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||this._commonData.accountId;this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{key:"updateCommonData",value:function e(n){this.lifeCycle.emit(X.onCommonUpdated,this._commonData);this._commonData=j({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function e(n){var t=this;this.lifeCycle.emit(X.onCommonUpdated,this._commonData);setTimeout((function(){n.forEach((function(e){delete t._commonData[e]}))}),1e3)}},{key:"addToMFECommonData",value:function e(n){var t=n.MFEName,r=n.MFECommonData;var i;if(!this.config.isWebappContainer){return}if(!t||!r){return}this._MFECommonDataMap=R(j({},this._MFECommonDataMap||{}),I({},t,j({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[t])||{},r)))}},{key:"setConfig",value:function e(n){var t=this;if(this.config.isWebappContainer){return}var r=function(e,n){t.config[e]=n};Object.entries(n).forEach((function(e){var n=O(e,2),t=n[0],i=n[1];if((typeof i==="undefined"?"undefined":A(i))!==void 0){r(t,i)}}));this.lifeCycle.emit(X.onConfigInit,this.config);this.updateCommonDataBasedOnConfig(n)}},{key:"verbose",value:function e(n,t){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:t})}},{key:"httpLog",value:function e(n,t){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:t})}},{key:"info",value:function e(n,t){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:t})}},{key:"warn",value:function e(n,t){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:t})}},{key:"error",value:function e(n,t){console.error("error",n);this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:t})}},{key:"businessLog",value:function e(n,t){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:R(j({},t),{isBusinessLog:true})})}},{key:"reportDuration",value:function e(n,t,r){if(typeof n!=="string"){console.warn("reportDuration: eventName (first param) must be a string");return}if(typeof t!=="number"){console.warn("reportDuration: duration (second param) must be number");return}if(t<0||t>6e4){console.warn("reportDuration: duration (second param) must between 0 and 60000");return}this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:j({duration:t},r)})}},{key:"getTimerKey",value:function e(n){var t=Z(this);return this.config.isWebappContainer?"".concat(t,"_").concat(n):n}},{key:"timeStart",value:function e(n){if(typeof n!=="string"){console.warn("time: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){console.warn("Timer ".concat(n," already exists"))}this.timeMap[this.getTimerKey(n)]=Date.now()}},{key:"timeEnd",value:function e(n,t){if(typeof n!=="string"){console.warn("timeEnd: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){var r=Date.now()-this.timeMap[this.getTimerKey(n)]+(t||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:r}});delete this.timeMap[this.getTimerKey(n)]}else{console.warn("Timer key :".concat(n," does not exist"))}}},{key:"addToAssetSpeedWhiteListByMFE",value:function e(n){var t=n.MFEName,r=n.whiteList;var i;if(!this.config.isWebappContainer){return}if(!t||!(r===null||r===void 0?void 0:r.length)){return}if(!this.config.assetSpeedMonitoringWhiteListByMFE){this.config.assetSpeedMonitoringWhiteListByMFE={}}if(!((i=this.config.assetSpeedMonitoringWhiteListByMFE)===null||i===void 0?void 0:i[t])){this.config.assetSpeedMonitoringWhiteListByMFE=R(j({},this.config.assetSpeedMonitoringWhiteListByMFE),I({},t,r))}else{var o;var a,u;(u=this.config.assetSpeedMonitoringWhiteListByMFE)===null||u===void 0?void 0:(a=u[t])===null||a===void 0?void 0:(o=a).push.apply(o,_(r))}}},{key:"destroy",value:function e(){if(this.config.isWebappContainer){return}this.plugins.forEach((function(e){e.uninstall()}))}}]);return e}();var rn=tn;var on=function(e,n){on=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t))e[t]=n[t]};return on(e,n)};function an(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");on(e,n);function t(){this.constructor=e}e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var un=function(){un=Object.assign||function e(n){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))n[o]=t[o]}return n};return un.apply(this,arguments)};function sn(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))}function cn(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}function fn(e,n,t){if(t||arguments.length===2)for(var r=0,i=n.length,o;r<i;r++){if(o||!(r in n)){if(!o)o=Array.prototype.slice.call(n,0,r);o[r]=n[r]}}return e.concat(o||Array.prototype.slice.call(n))}typeof SuppressedError==="function"?SuppressedError:function(e,n,t){var r=new Error(t);return r.name="SuppressedError",r.error=e,r.suppressed=n,r};var ln="@airwallex/components-sdk";var dn="1.30.2";var vn="./lib/index.js";var pn="./lib/index.mjs";var mn="./lib/index.d.ts";var hn=["lib/**"];var yn="MIT";var wn={"load-types":"node ./load-types.js && yarn prettier -w src/types/*d.ts",prebuild:"yarn clean",build:"yarn rollup --config",postbuild:"yarn bundle-types","bundle-types":"dts-bundle-generator -o ./lib/index.d.ts ./src/index.ts",clean:"rm -rf dist lib",lint:'eslint "src/**/*.ts*"',test:"jest",sonar:"sonar-scanner",release:"semantic-release","lint-stage":"lint-staged",prepare:"husky"};var gn={semi:true,singleQuote:true,printWidth:80,trailingComma:"all"};var bn={access:"public"};var kn={"@babel/preset-typescript":"^7.18.6","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@semantic-release/changelog":"^5.0.1","@semantic-release/commit-analyzer":"^8.0.1","@semantic-release/git":"^9.0.0","@semantic-release/gitlab":"^6.1.0","@semantic-release/release-notes-generator":"^9.0.0","@swc/core":"^1.3.46","@types/jest":"^29.5.0","@typescript-eslint/eslint-plugin":"^5.57.0","@typescript-eslint/parser":"^5.57.0","dts-bundle-generator":"^9.0.0",eslint:"^7.23.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^5.1.3",husky:"^9.0.11",jest:"^29.5.0","jest-environment-jsdom":"^29.5.0","lint-staged":"^15.2.7",prettier:"^3.3.2",rollup:"^4.9.6","semantic-release":"^17.3.8","sonarqube-scanner":"^3.0.1","ts-jest":"^29.0.5","ts-loader":"^9.5.1",tslib:"^2.6.2",typescript:"^4.5.2"};var xn={"@airwallex/airtracker":"^3.0.0"};var En={name:ln,version:dn,main:vn,module:pn,types:mn,files:hn,license:yn,scripts:wn,prettier:gn,"lint-staged":{"src/**/*.{ts,tsx}":["yarn lint"],"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}":"prettier --write"},publishConfig:bn,devDependencies:kn,dependencies:xn};var In={dev:M.staging,staging:M.staging,demo:M.demo,prod:M.production};var Sn=function(e,n){if(e===void 0){e=M.production}if(!window._AirwallexSDKs.airTracker){window._AirwallexSDKs.airTracker=new rn({config:{appName:"components-sdk",appVersion:En.version,env:In[e]||M.production}});window._AirwallexSDKs.airTracker.updateCommonData({clientId:n})}return window._AirwallexSDKs.airTracker};var Cn=function(e){if(typeof e!=="object"){return e}try{var n=JSON.parse(JSON.stringify(e));Object.keys(n).forEach((function(e){if(typeof e==="string"&&["auth","code"].some((function(n){return e.includes(n)}))){n[e]="***"}}));return n}catch(n){return e}};var Nn=function(e,n){var t,r;(r=(t=window._AirwallexSDKs)===null||t===void 0?void 0:t.airTracker)===null||r===void 0?void 0:r.error(e,un(un({},n),{context:"components-sdk"}))};var Tn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.warn(e,un(un({},n),{context:"components-sdk"}))};var Dn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.info(e,un(un({},n),{context:"components-sdk"}))};var jn=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="LOAD_SCRIPT_ERROR";return t}return n}(Error);var Pn,Rn;var On;(function(e){e["dev"]="dev";e["staging"]="staging";e["demo"]="demo";e["prod"]="prod";e["sandbox"]="sandbox"})(On||(On={}));var _n=(Pn={},Pn[On.dev]="https://checkout-staging.airwallex.com",Pn[On.staging]="https://checkout-staging.airwallex.com",Pn[On.demo]="https://checkout-demo.airwallex.com",Pn[On.prod]="https://checkout.airwallex.com",Pn[On.sandbox]="https://checkout.sandbox.airwallex.com",Pn);var An=(Rn={},Rn[On.dev]="https://static-staging.airwallex.com",Rn[On.staging]="https://static-staging.airwallex.com",Rn[On.demo]="https://static-demo.airwallex.com",Rn[On.prod]="https://static.airwallex.com",Rn[On.sandbox]="https://static.sandbox.airwallex.com",Rn);var Ln="sdkController";var Un="payments";var Mn={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js"};var Fn={kyc:"kyc",paymentsKyb:"paymentsKyb",kycRfi:"rfi",transactionRfi:"rfi",paymentEnablementRfi:"rfi",lendingRfi:"rfi",mrmRfi:"rfi",payoutForm:"payouts",beneficiaryForm:"payouts",hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments",cardNumber:"payments",applePayButton:"payments",googlePayButton:"payments",krCardNumber:"payments",krCardIdentifier:"payments",krCardExpiry:"payments",krCardPswFirstTwo:"payments",scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",embeddedCheckout:"billing"};var Kn={payments:["hpp","cvc","card","expiry","dropIn","cardNumber","applePayButton","googlePayButton","krCardNumber","krCardIdentifier","krCardExpiry","krCardPswFirstTwo"],payouts:["payoutForm","beneficiaryForm"],onboarding:["kyc","paymentsKyb"],risk:["scaSetup","scaVerify","scaManagement","transactionRfi","kycRfi","paymentEnablementRfi","lendingRfi","mrmRfi"],billing:["embeddedCheckout"]};var qn={billing:["payments"]};var Hn=["payments","sca"];var zn=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INVALID_STATIC_RESOURCE_ERROR";return t}return n}(Error);var Bn=Date.now();var Wn=function(e){return Object.keys(Kn).includes(e)};var Xn=function(e){if(e===void 0){e=500}return new Promise((function(n){return window.setTimeout(n,e)}))};var Gn=function(e){return Fn[e]};var Vn=function(e,n){var t=e===Un?_n:An;return t[n]||t.prod};var $n=function(e){var n=e.reduce((function(e,n){return e.concat(Wn(n)?Kn[n]:n)}),[]);return Array.from(new Set(n)).map((function(e){return{elementName:e,sdkName:Gn(e)}}))};var Jn=function(e){return Array.from(new Set($n(e).map((function(e){var n=e.sdkName;return n})).filter((function(e){return Hn.includes(e)}))))};var Qn=function(e){return e==="payments"?"payment":e};var Yn=function(e){var n=e.name,t=e.env,r=t===void 0?On.prod:t;var i=Vn(n,r);var o=Mn[n];if(!o){Nn("[components-sdk] Element static resource not found",{sdkName:n});throw new zn("Element ".concat(n," static resource URL is invalid."))}return"".concat(i).concat(o,"?ts=").concat(Bn)};var Zn=function(){return Hn.reduce((function(e,n){var t;return un(un({},e),(t={},t[n]=window._AirwallexSDKs.__controller__.internalSDKs[n],t))}),{})};var et=function(e){return qn[e]||[]};var nt=function(){return Math.floor(performance.now())};var tt=function(e){var n=document.createElement("script");n.src=e;n.type="module";var t=document.head||document.body;t.appendChild(n);return n};var rt=3;var it=function(e){return sn(void 0,void 0,void 0,(function(){var n,t;return cn(this,(function(r){switch(r.label){case 0:if(typeof window==="undefined"){throw new Error("Please load script in browser environment")}n=0;t=function(){return sn(void 0,void 0,void 0,(function(){var t,r,i;return cn(this,(function(o){t=nt();if(n>0&&e.includes("?ts=")){r=new URL(e,window.location.href);r.searchParams.set("ts","".concat(Date.now()));e=r.toString()}i=tt(e);return[2,new Promise((function(r,o){i.addEventListener("load",(function(){var i=nt();Dn("[components-sdk] SDK script loaded",{scriptUrl:e,start:t,latency:i-t,end:i,retryCount:n});r(true)}));i.addEventListener("error",(function(r){i.remove();console.error(r);var a=nt();Nn("[components-sdk] Failed to load script",{scriptUrl:e,error:r,start:t,latency:a-t,end:a,retryCount:n});o(new jn("Failed to load Airwallex SDK scripts: ".concat(e)))}))}))]}))}))};r.label=1;case 1:if(!(n<rt))return[3,7];r.label=2;case 2:r.trys.push([2,4,,6]);return[4,t()];case 3:return[2,r.sent()];case 4:r.sent();n++;return[4,Xn()];case 5:r.sent();return[3,6];case 6:return[3,1];case 7:Nn("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:n});throw new jn("Failed to load Airwallex SDK scripts: ".concat(e))}}))}))};var ot=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INSTANCE_NOT_FOUND_ERROR";return t}return n}(Error);var at;var ut=new Map;var st=function(e){var n=e.env,t=e.scriptName;var r=Yn({name:t,env:n});var i=ut.get(t);if(i){return i}var o=it(r);ut.set(t,o);return o};var ct=function(e){var n=e.env,t=e.scriptName;return sn(void 0,void 0,void 0,(function(){var e;return cn(this,(function(r){switch(r.label){case 0:e=et(t);if(!(e.length>0))return[3,2];return[4,Promise.all(e.map((function(e){return st({env:n,scriptName:e})})))];case 1:r.sent();r.label=2;case 2:return[2,st({env:n,scriptName:t})]}}))}))};var ft=function(e){return sn(void 0,void 0,void 0,(function(){return cn(this,(function(n){if(typeof window==="undefined"){throw new Error("Please call the `init()` function in a browser environment.")}Sn(e.env,e.clientId);Dn("[components-sdk] SDK init start",{options:Cn(e),start:nt()});at=new Promise((function(n,t){var r;var i=un(un({},e),{env:e.env&&On[e.env]?e.env:On.prod});window.AirwallexComponentsSDK.__env__=i.env;var o=st({env:i.env,scriptName:Ln}).then((function(){return window._AirwallexSDKs.__controller__.init(i)}));var a=(r=e.enabledElements)!==null&&r!==void 0?r:[];var u=Jn(a);var s=u.map((function(e){return st({env:i.env,scriptName:e}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[Qn(e)];if(!n){Nn("[components-sdk] SDK instance not found",{functionsNamespace:e,windowSDKInstanceName:Qn(e)});throw new ot("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:e,instance:n})}))}));var c=$n(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return ct({scriptName:n,env:i.env}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[Qn(n)];if(!e){Nn("[components-sdk] SDK instance not found",{sdkName:n,windowSDKInstanceName:Qn(n)});throw new ot("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:t,instance:e})}))}));Promise.all(fn(fn([o],s,true),f,true)).then((function(){Dn("[components-sdk] SDK initialized",{options:Cn(e),start:nt()});n(Zn())}))["catch"]((function(e){if(!e.code){Nn("[components-sdk] Unexpected errors when init",{error:e})}t(e)}))}));return[2,at]}))}))};var lt=e("l",(function(e,n){return sn(void 0,void 0,void 0,(function(){var t,r,i,o,a;return cn(this,(function(u){switch(u.label){case 0:if(!e){throw new Error("Element type is missing. Please specify a valid element.")}Dn("[components-sdk] SDK createElement start",{elementName:e,options:Cn(n),timestamp:nt()});if(!at){Tn("[components-sdk] Did not call init before createElement");throw new Error("Please initialize the Element before creating it.")}return[4,at];case 1:u.sent();t=Gn(e);if(!t){throw new Error("`createElement()` with type `".concat(e,"` is not supported. Please specify a valid Element type."))}r=nt();u.label=2;case 2:u.trys.push([2,6,,7]);return[4,ct({scriptName:t,env:window.AirwallexComponentsSDK.__env__||On.prod})];case 3:u.sent();return[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:e,instance:window._AirwallexSDKs[Qn(t)]})];case 4:u.sent();return[4,window._AirwallexSDKs.__controller__.createElement(e,n)];case 5:i=u.sent();o=nt();Dn("[components-sdk] SDK createElement being called",{elementName:e,options:Cn(n),start:r,latency:o-r,end:o});return[3,7];case 6:a=u.sent();if(!a.code){Nn("[components-sdk] Unexpected errors when createElement",{error:a})}else{throw a}return[3,7];case 7:return[2,i]}}))}))}));var dt=[Ln,Un];var vt=function(){dt.forEach((function(e){var n=Yn({name:e,env:On.prod});var t=document.createElement("link");t.href=n;t.rel="modulepreload";t.as="script";var r=document.head||document.body;r.appendChild(t)}))};var pt=typeof document==="undefined"||typeof window==="undefined";if(!pt){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",vt)}else{vt()}}if(typeof window!=="undefined"){if(!window.AirwallexComponentsSDK){Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:false},_AirwallexSDKs:{value:{},writable:false}})}window.AirwallexComponentsSDK.init=ft;window.AirwallexComponentsSDK.createElement=lt}var mt=n((function(){return{clientSecret:null,currency:null,hasPaymentError:false,isReady:false,paymentConfirmed:false,paymentIntentId:null}})),ht=mt.onChange,yt=mt.reset,wt=mt.state;e({n:ht,k:yt,b:wt});var gt=e("a",(function(e){if(e.paymentProcessor!=="AIRWALLEX"){return false}if(e.clientSecret){wt.clientSecret=e.clientSecret}if(e.paymentIntentId){wt.paymentIntentId=e.paymentIntentId}if(!wt.clientSecret){a("Airwallex checkout session is missing the client secret");return false}return true}));var bt={ar:"ar",da:"da",de:"de",en:"en",es:"es",fr:"fr",id:"id",it:"it",ja:"ja",ko:"ko",nl:"nl",pl:"pl",pt:"pt",ru:"ru",sv:"sv",zh:"zh"};var kt=e("m",(function(e){return bt[e]||"en"}));var xt=null;var Et=e("f",(function(){return sn(m,void 0,void 0,(function(){var e;return cn(this,(function(n){if(wt.isReady){return[2,true]}if(!xt){e=(!t.zonosMode||t.zonosMode==="production")&&t.checkoutSettings.mode==="LIVE";xt=ft({enabledElements:["payments"],env:e?"prod":"demo",locale:kt(i.selectedLocale)}).then((function(){wt.isReady=true;c("Airwallex SDK initialized");return true})).catch((function(e){a(e);xt=null;return false}))}return[2,xt]}))}))}));var It=["SUCCEEDED","REQUIRES_CAPTURE","PENDING_REVIEW","PENDING"];var St=e("e",(function(e){return!!e&&It.includes(e)}));var Ct=e("j",(function(e){switch(e){case"SUCCEEDED":{return{isError:false,messages:[r("Thank you for submitting your payment. We appreciate your prompt attention."),"",r("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}}case"PENDING":case"PENDING_REVIEW":case"REQUIRES_CAPTURE":{return{isError:false,messages:[r("Payment processing. We'll update you when payment is received.")]}}case"REQUIRES_CUSTOMER_ACTION":{return{isError:false,messages:[r("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}}case"CANCELLED":case"REQUIRES_PAYMENT_METHOD":{return{isError:true,messages:[r("Payment failed. Please reload the page and try another payment method.")]}}default:{return{isError:true,messages:[r("Something went wrong.")]}}}}));var Nt=e("d",(function(e){return sn(m,void 0,void 0,(function(){var n,t,r;return cn(this,(function(i){switch(i.label){case 0:return[4,u("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:e},method:"POST"})];case 1:n=i.sent(),t=n.errors,r=n.json;if(t.length||!r){a("Failed to retrieve Airwallex payment intent",t);return[2,{status:null}]}return[2,{status:r.airwallexPaymentIntent.status}]}}))}))}));var Tt=n((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}})),Dt=Tt.reset,jt=Tt.state;e("c",jt);var Pt=e("h",(function(e){return sn(m,[e],void 0,(function(e){var n,r,i,o,a,c,f,l,d,p,m,h,y,w;var g=e.landedCostId,b=e.retries,k=b===void 0?5:b;return cn(this,(function(e){switch(e.label){case 0:jt.isFetchingShippingInfo=true;return[4,u("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:g},method:"POST"})];case 1:m=e.sent();if(!m.errors.length)return[3,4];if(!(k>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,Pt({landedCostId:g,retries:k-1})];case 3:return[2,null];case 4:jt.landedCostShortId=((n=m.json)===null||n===void 0?void 0:n.landedCostShortId)||null;jt.isFetchingShippingInfo=false;jt.shippingAddress=((r=m.json)===null||r===void 0?void 0:r.shipping)||null;h=(i=v.checkoutSession)===null||i===void 0?void 0:i.landedCost;y=(o=v.checkoutSession)===null||o===void 0?void 0:o.subtotals;w=(((a=h===null||h===void 0?void 0:h.amountSubtotals)===null||a===void 0?void 0:a.shipping)||0)+(((c=h===null||h===void 0?void 0:h.amountSubtotals)===null||c===void 0?void 0:c.items)||0);jt.amountTotalPaid=w*(((f=y===null||y===void 0?void 0:y.exchangeRate)===null||f===void 0?void 0:f.rate)||1);jt.amountDutyTaxFeeTotal=((y===null||y===void 0?void 0:y.duties)||0)+((y===null||y===void 0?void 0:y.taxes)||0)+((y===null||y===void 0?void 0:y.fees)||0);jt.originCompanyName=((d=(l=m.json)===null||l===void 0?void 0:l.origin)===null||d===void 0?void 0:d.companyName)||null;jt.collectLogoUrl=((p=m.json)===null||p===void 0?void 0:p.collectLogoUrl)||null;if(jt.amountTotalPaid===0){void s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:g,organizationId:t.organizationId}})}return[2]}}))}))}));var Rt=e("i",(function(){return sn(m,void 0,void 0,(function(){var e,n,t,r,i,c,p,m,h,y;return cn(this,(function(w){switch(w.label){case 0:if(!((e=l.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}i=(t=(n=v.checkoutSession)===null||n===void 0?void 0:n.landedCost)===null||t===void 0?void 0:t.rootId;if(!i){void s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!o.checkoutSessionId){void s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:f,cartId:window.Zonos.cartId,landedCostRootId:i}});return[2,{partiesCreated:false}]}c=d({address:l.stripeBillingAddressEventData.value.address,firstName:l.stripeBillingAddressEventData.value.firstName,lastName:l.stripeBillingAddressEventData.value.lastName,name:l.stripeBillingAddressEventData.value.name,phone:l.stripeBillingAddressEventData.value.phone});p=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,u("/api/zonos-elements/create-billing-party",{body:{billingAddress:c,checkoutSessionId:o.checkoutSessionId,companyName:l.companyName,email:((r=l.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:p,rootId:i},method:"POST"})];case 1:m=w.sent(),h=m.errors,y=m.json;if(h.length||!y){a("Error occurs when creating billing party",JSON.stringify(h,null,2));void s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:h,json:y}});return[2,{partiesCreated:false}]}jt.partyBillingId=y.billToPartyId;return[2,{partiesCreated:true}]}}))}))}));var Ot=e("g",(function(e){return sn(m,void 0,void 0,(function(){var n;return cn(this,(function(t){n=e.landedCost;if(!n){return[2,false]}v.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},n),landedCostId:n.id})];return[2,p({applySubtotalsOnly:true,landedCostId:n.id,selectedShippingOption:n.shipmentRating})]}))}))}))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-47a1d469.system.js","./p-22f7120a.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-0d183f19.system.js"],(function(e){"use strict";var n,t,r,i,o,a,u,s,c,f,l,d,v,p;return{setters:[function(e){n=e.c;t=e.z},function(e){r=e.t;i=e.l;o=e.s},function(e){a=e.l;u=e.h;s=e.s},function(e){c=e.l;f=e.b},function(e){l=e.b;d=e.K;v=e.d;p=e.L}],execute:function(){var m=this;function h(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function y(e){if(Array.isArray(e))return e}function w(e){if(Array.isArray(e))return h(e)}function g(e,n,t,r,i,o,a){try{var u=e[o](a);var s=u.value}catch(e){t(e);return}if(u.done){n(s)}else{Promise.resolve(s).then(r,i)}}function b(e){return function(){var n=this,t=arguments;return new Promise((function(r,i){var o=e.apply(n,t);function a(e){g(o,r,i,a,u,"next",e)}function u(e){g(o,r,i,a,u,"throw",e)}a(undefined)}))}}function k(e,n){if(!(e instanceof n)){throw new TypeError("Cannot call a class as a function")}}function x(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function E(e,n,t){if(n)x(e.prototype,n);if(t)x(e,t);return e}function I(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function S(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function C(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function N(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var i=true;var o=false;var a,u;try{for(t=t.call(e);!(i=(a=t.next()).done);i=true){r.push(a.value);if(n&&r.length===n)break}}catch(e){o=true;u=e}finally{try{if(!i&&t["return"]!=null)t["return"]()}finally{if(o)throw u}}return r}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))}r.forEach((function(n){I(e,n,t[n])}))}return e}function P(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(n){r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))}t.push.apply(t,r)}return t}function R(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function O(e,n){return y(e)||N(e,n)||L(e,n)||T()}function _(e){return w(e)||C(e)||L(e)||D()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function L(e,n){if(!e)return;if(typeof e==="string")return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}function U(e,n){var t,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(n){return s([e,n])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,r&&(i=o[0]&2?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;if(r=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;r=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(o[0]===6&&a.label<i[1]){a.label=i[1];i=o;break}if(i&&a.label<i[2]){a.label=i[2];a.ops.push(o);break}if(i[2])a.ops.pop();a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e];r=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var M=function(e){e["production"]="prod";e["demo"]="demo";e["staging"]="staging";return e}(M||{});var F="airTracker_unknown";var K={appName:F,appVersion:F,env:"staging",isWebappContainer:false,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:false,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:false,enableRecordPageRetention:false,hideSearchParams:false,useSessionStorageForSessionId:false,assetSpeedMonitoringWhiteListByMFE:{}};var q={appName:F,env:"staging",sessionId:F,deviceId:F};var H=function(e){if(!e){return false}if(/^\s*$/.test(e))return false;e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return/^[\],:{}\s]*$/.test(e)};var z=function(){var e=new WeakSet;return function(n,t){if(S(t,Error)){return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack)}if((typeof t==="undefined"?"undefined":A(t))==="object"&&t!==null){if(e.has(t)){return"[Circular ".concat(n||"root","]")}e.add(t)}if(typeof t==="function"){return"function"}if((typeof t==="undefined"?"undefined":A(t))==="symbol"){return"symbol"}if(typeof t==="undefined"){return null}return t}};var B=function(e){if(typeof e==="string"){return e}try{if(S(e,Error)){return(JSON.stringify(e,z())||"undefined").replace(/"/gim,"")}return JSON.stringify(e,z())}catch(e){return'{"error":"error happen when airTracker stringify"}'}};var W=function(e){var n=e.method,t=n===void 0?"post":n,r=e.url,i=e.data,o=e.success,a=e.fail;if(!H(i)){return}var u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){if(u.readyState===4){if(u.status>=400||u.status===0){a===null||a===void 0?void 0:a(u.response)}else{o===null||o===void 0?void 0:o(u.response)}}}));u.open(t,r);u.setRequestHeader("Content-Type","application/json");u.send(i)};var X={onInit:"onInit",onConfigInit:"onConfigInit",onConfigUpdated:"onConfigUpdated",onCommonDataInit:"onCommonDataInit",onCommonUpdated:"onCommonUpdated",onPageChange:"onPageChange",onDestroy:"onDestroy,"};var G="AIR_ANALYTICS_DEVICE_ID";var V="AIR_ANALYTICS_SESSION_ID";var $="AWX_RISK_ID";var J=function(e){if(e=="prod"){return"https://o11y.airwallex.com/airtracker/logs"}if(e=="demo"){return"https://o11y-demo.airwallex.com/airtracker/logs"}return"https://o11y-staging.airwallex.com/airtracker/logs"};var Q=function(e){if(e=="prod"){return"https://o11y.airwallex.com/airtracker/metrics"}if(e=="demo"){return"https://o11y-demo.airwallex.com/airtracker/metrics"}return"https://o11y-staging.airwallex.com/airtracker/metrics"};var Y=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=Math.random()*16|0;var t=e==="x"?n:n&3|8;return t.toString(16)}));return e};var Z=function(e){var n,t,r;if(e.config.getMFEName){return e.config.getMFEName()}return((r=location)===null||r===void 0?void 0:(t=r.pathname)===null||t===void 0?void 0:(n=t.split("/"))===null||n===void 0?void 0:n[2])||"unknown"};var ee=function(){try{var e=window.sessionStorage.getItem(V);if(!e){e=Y();window.sessionStorage.setItem(V,e)}return e}catch(e){return Y()}};var ne=function(){try{var e=window.localStorage.getItem(G);if(!e){e=Y();window.localStorage.setItem(G,e)}return e}catch(e){}};var te=function(){try{var e=window.localStorage.getItem($);return e||void 0}catch(e){}};var re=function(){var e;var n="";var t=navigator.userAgent.match(/NetType\/(\w+)/);if(t){var r;r=O(t,2),n=r[1]}else if((e=navigator)===null||e===void 0?void 0:e.connection){var i,o,a,u;n=((o=navigator)===null||o===void 0?void 0:(i=o.connection)===null||i===void 0?void 0:i.effectiveType)||((u=navigator)===null||u===void 0?void 0:(a=u.connection)===null||a===void 0?void 0:a.type)}if(!n){n="unknown"}return ie(n)};var ie=function(e){e=String(e).toLowerCase();if(e.indexOf("4g")>=0)return"net4g";if(e.indexOf("wifi")>=0)return"wifi";if(e.indexOf("5g")>=0)return"net5g";if(e.indexOf("3g")>=0)return"net3g";if(e.indexOf("2g")>=0)return"net2g";return"unknown"};var oe=function e(){return typeof window.performance!=="undefined"&&typeof window.performance.clearResourceTimings==="function"&&typeof window.performance.getEntriesByType==="function"&&typeof window.performance.now==="function"};var ae=function(e){if(typeof e==="string"){var n=e.split("?")[0]||"";return n.slice(0,200)}return e};var ue=function(e){if(typeof e==="string"){return e.split("?")[1]||""}return e};var se=function(e){var n=typeof e==="string"&&e.startsWith("//");return n?typeof location!=="undefined"&&location.protocol==="https:":/^https/.test(e)};var ce=function(e,n){if(typeof e==="number"){return e}if(typeof e==="string"){return e}return n?"":-1};var fe=function(e,n){var t;var r=false;if(!n.config.isWebappContainer){r=le(e,n.config.assetSpeedMonitoringWhiteList);return r}var i=Z(n);return r||le(e,(t=n.config.assetSpeedMonitoringWhiteListByMFE)===null||t===void 0?void 0:t[i])};var le=function(e,n){if(!(n===null||n===void 0?void 0:n.length)){return false}for(var t=0;t<n.length;t++){var r=n[t];if(S(r,RegExp)&&r.test(e)){return true}if(typeof r=="string"&&e.includes(r)){return true}}return false};var de=function(e,n){var t=100;return Math.round((e-n)*t)/t};var ve=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?j({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a=Array.isArray(n)?n:[n];if(a.length===0){return}var u={commonData:o,data:a};var s=B(u);var c={method:"post",url:J(e.commonData.env),data:s};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var f=navigator.sendBeacon(c.url,s);if(!f){W(c)}}else{W(c)}}};var pe=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?j({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a={commonData:o,data:Array.isArray(n)?n:[n]};var u=B(a);var s={method:"post",url:Q(e.commonData.env),data:u};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var c=navigator.sendBeacon(s.url,u);if(!c){W(s)}}else{W(s)}}};var me=function(e,n){var t;var r=[];var i=e.config;window.addEventListener("beforeunload",(function(){if(r.length>0){e.immediateSendPipe(r.splice(0,r.length));t&&clearTimeout(t)}}));return function(o,a){r.push(o);e.lifeCycle.on(X.onCommonUpdated,(function(){if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(X.onCommonUpdated);t&&clearTimeout(t)}}));if(n&&r.length>=n){a===null||a===void 0?void 0:a(r.splice(0,r.length));t&&clearTimeout(t);return}t&&clearTimeout(t);t=setTimeout((function(){t=null;if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(X.onCommonUpdated)}}),i.delay)}};var he=function(e){var n={};return function(t,r){var i=typeof e.config.errorRepeatTime==="number"?e.config.errorRepeatTime:5;if(i===0){return r===null||r===void 0?void 0:r(t)}r===null||r===void 0?void 0:r(t.filter((function(e){if(e.severity=="autoDetectError"){n[e.error]=n[e.error]||0;n[e.error]+=1;if(n[e.error]>i){return false}return true}return true})))}};var ye=function(){};var we=function(e){if(!e||!e.reduce||!e.length){throw new TypeError("createPipeline need at least one function param")}if(e.length===1){return function(n,t){e[0](n,t||ye)}}return e.reduce((function(e,n){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ye;return e(t,(function(e){return n===null||n===void 0?void 0:n(e,r)}))}}))};var ge=function(){function e(){var n=this;k(this,e);this.emit=function(e,t){if(!n)return;var r=n.eventsList[e];var i;if(r===null||r===void 0?void 0:r.length){r=r.slice();for(var o=0;o<r.length;o++){i=r[o];try{var a=i.callback.apply(n,[t]);if(1===i.type){n.remove(e,i.callback)}if(false===a){break}}catch(e){throw e}}}return n};this.eventsList={}}E(e,[{key:"indexOf",value:function e(n,t){for(var r=0;r<n.length;r++){if(n[r].callback===t){return r}}return-1}},{key:"on",value:function e(n,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!this)return;var i=this.eventsList[n];if(!i){this.eventsList[n]=[];i=this.eventsList[n]}if(this.indexOf(i,t)===-1){var o={name:n,type:r||0,callback:t};i.push(o);return this}return this}},{key:"one",value:function e(n,t){this.on(n,t,1)}},{key:"remove",value:function e(n,t){if(!this)return;var r=this.eventsList[n];if(!r){return null}if(!t){try{delete this.eventsList[n]}catch(e){}return null}if(r.length){var i=this.indexOf(r,t);r.splice(i,1)}return this}},{key:"clear",value:function e(){this.eventsList={}}}]);return e}();var be=function(){function e(n){k(this,e);this.name="";this.isInit=false;this.name=n.name;this.option=n}E(e,[{key:"patch",value:function e(n){if(!this.isInit){var t,r;this.isInit=true;(r=this.option)===null||r===void 0?void 0:(t=r.setUp)===null||t===void 0?void 0:t.call(this.option,n)}}},{key:"uninstall",value:function e(){var n,t;(t=this.option)===null||t===void 0?void 0:(n=t.destroy)===null||n===void 0?void 0:n.apply(this);this.isInit=false}}]);return e}();var ke;var xe=function(e){var n="".concat(B(e.message)||""," @ (").concat(B(e.filename)||"",":").concat(e.lineno||0,":").concat(e.colno||0,")\n").concat(B(e.error||""));ke.normalLogPipeLine({severity:"autoDetectError",eventName:"windowOnError",extraInfo:{error:n}})};var Ee=function(e){var n=e&&B(e.reason);ke.normalLogPipeLine({severity:"autoDetectError",eventName:"promiseError",extraInfo:{error:n}})};var Ie=function(e){var n=(e===null||e===void 0?void 0:e.target)||(e===null||e===void 0?void 0:e.srcElement);if(!n){return}var t=(n===null||n===void 0?void 0:n.src)||(n===null||n===void 0?void 0:n.href);var r=n.tagName;var i="unknown";if(typeof t==="string"&&r){if(window.location.href.indexOf(t)>-1){return}if(/\.js$/.test(t)){i="script"}else if(/\.css$/.test(t)){i="css"}else{switch(r.toLowerCase()){case"script":i="script";break;case"link":i="css";break;case"img":i="image";break;case"audio":case"video":i="media";break;default:return}}ke.normalLogPipeLine({severity:"autoDetectError",eventName:"staticFileLoadError",extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}};var Se=new be({name:"errorDetectionPlugin",setUp:function(e){ke=e;window.addEventListener("error",xe);window.addEventListener("unhandledrejection",Ee);window.document.addEventListener("error",Ie,true)},destroy:function(){window.removeEventListener("unhandledrejection",Ee);window.document.removeEventListener("error",Ie,true);window.removeEventListener("error",xe)}});var Ce=["img","css","script","link","audio","video","iframe"];var Ne="resource";var Te=function(e){var n=e.name;return{url:ae(n),method:"get",duration:Number(e.duration.toFixed(2)),type:"static",isHttps:se(n),urlQuery:ue(n),domainLookup:ce(e.domainLookupEnd-e.domainLookupStart),connectTime:ce(e.connectEnd-e.connectStart)}};var De=function(e,n){for(var t=0,r=e.length;t<r;t++){var i=e[t];if(Ce.indexOf(i.initiatorType)!==-1&&fe(i.name,n)){n.normalLogPipeLine({severity:"performance",eventName:"assets_speed",extraInfo:{log:Te(i)}})}}};var je;var Pe;var Re=new be({name:"assetsSpeedPlugin",setUp:function(e){if(!oe())return;var n=0;window.performance.onresourcetimingbufferfull=function(){n=0;window.performance.clearResourceTimings()};if(typeof window.PerformanceObserver==="function"){De(window.performance.getEntriesByType(Ne),e);Pe=new window.PerformanceObserver((function(n){De(n.getEntries(),e)}));Pe.observe({entryTypes:[Ne]})}else{je=setInterval((function(){var t=window.performance.getEntriesByType(Ne);var r=t.slice(n);n=t.length;De(r,e)}),3e3)}},destroy:function(){Pe===null||Pe===void 0?void 0:Pe.disconnect();je&&clearInterval(je)}});var Oe;var _e=new be({name:"onPageChangePlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o;return U(this,(function(a){t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");i=function(n){var t=n.prevHref;var r,i,o,a,u;e.normalLogPipeLine({severity:"autoDetectEvent",eventName:"onPageChange",extraInfo:{prevHref:t,href:((r=location)===null||r===void 0?void 0:r.href)||"",hostname:(i=location)===null||i===void 0?void 0:i.hostname,pathName:(o=location)===null||o===void 0?void 0:o.pathname,protocol:(a=location)===null||a===void 0?void 0:a.protocol,search:(u=location)===null||u===void 0?void 0:u.search}})};i({prevHref:""});Oe=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;i({prevHref:e})}}));o={subtree:true,childList:true};Oe.observe(r||document,o);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Oe===null||Oe===void 0?void 0:Oe.disconnect()}});var Ae;var Le=new be({name:"onPageRetentionPlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o,a,u;return U(this,(function(s){if(typeof document.visibilityState==="undefined"){return[2]}t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");o=function(){i=Date.now()};o();document.addEventListener("visibilitychange",(function(){if(document.visibilityState==="hidden"){a({href:location.href,leftReason:"visibilityChange"})}else if(document.visibilityState==="visible"){o()}}));window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:true,leftReason:"pageClose"})}));a=function(n){var t=n.href,r=n.sendImmediate,o=n.leftReason;if(!i){return}var a=Date.now()-i;if(a===0){return}i=void 0;var u={severity:"autoDetectEvent",eventName:"onPageRetention",extraInfo:{href:t,duration:a,leftReason:o}};if(r){e.ImmediatePipeline(u);return}e.normalLogPipeLine(u)};Ae=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;a({href:e,leftReason:"nextPage"});o()}}));u={subtree:true,childList:true};Ae.observe(r||document,u);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Ae===null||Ae===void 0?void 0:Ae.disconnect()}});var Ue=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)};var Me=function(e,n){var t=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/];var r=[/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i];if(r.some((function(n){return n.test(e)}))){return false}return le(e,n||t)};var Fe=function(e){var n=e.startTime,t=e.endTime,r=e.entries;if(r.length===0){return void 0}if(r.length===1){return r[0]}var i=r.filter((function(e){return e.startTime>=n&&t&&e.responseEnd<=t})).sort((function(e,n){return e.startTime-n.startTime}));return i===null||i===void 0?void 0:i[0]};var Ke=function(e){return Math.round(e*100)/100};var qe=function(e){var n=e.startTime,t=e.duration,r=e.responseStart,i=e.connectEnd,o=e.connectStart,a=e.domainLookupEnd,u=e.domainLookupStart,s=e.requestStart,c=e.secureConnectionStart,f=e.redirectEnd,l=e.redirectStart,d=e.responseStatus,v=e.responseEnd,p=e.encodedBodySize,m=e.decodedBodySize,h=e.transferSize,y=e.deliveryType,w=e.initiatorType;return{startTime:Ke(n),totalDuration:Ke(t),timeToFirstByte:de(r,n),tcpDuration:de(i,o),dnsDuration:de(a,u),tlsDuration:de(s,c),redirectDuration:de(f,l),responseDuration:de(v,r),encodeResponseSize:p,decodeResponseSize:m,transferSize:h,deliveryType:y,statusCode:d,initiatorType:w}};var He=function(e,n){var t=e.url,r=e.method,i=e.errorType,o=e.errorDetail;var a=Fe(e);var u=new URL(t,window.location.href),s=u.href,c=u.protocol;var f=a?qe(a):{};var l={severity:"autoDetectEvent",eventName:"httpClientMetrics",extraInfo:j(R(j({httpUrl:s,method:r,scheme:c},i&&{errorType:i},o&&{errorDetail:o},f),{statusCode:(f===null||f===void 0?void 0:f.statusCode)||(e===null||e===void 0?void 0:e.responseStatus),startTime:(f===null||f===void 0?void 0:f.startTime)||(e===null||e===void 0?void 0:e.startTime),initiatorType:(f===null||f===void 0?void 0:f.initiatorType)||(e===null||e===void 0?void 0:e.initiatorType)}),n)};return l};var ze=function(e){return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"errors"in e&&Array.isArray(e.errors)&&e.errors.every((function(e){return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"message"in e}))};var Be="awx_airtracker_api_performance_queue";var We="awx_airtracker_api_performance_plugin_loaded";var Xe=300;var Ge=1e4;var Ve=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};Ve[Be]=Ve[Be]||[];var $e=function(e,n,t){setTimeout((function(){var r=He(e,t);n.observerPipeline(r);Ve[Be]=Ve[Be].filter((function(n){return n.id!==e.id}))}),Xe)};var Je=function(e,n){setTimeout((function(){var t=Ve[Be].find((function(n){return n.id===e}));if(!t){return}var r=He(t,{exceptionType:"timeout-without-response"});n.observerPipeline(r);Ve[Be]=Ve[Be].filter((function(n){return n.id!==e}))}),Ge)};var Qe=function(e){var n=XMLHttpRequest.prototype.open;var t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function t(r,i,o,a,u){try{var s;var c=Ue();this.__requestId=c;var f=S(i,URL)?i.href:new URL(i,window.location.href).href;if(!Me(f,(s=e.config)===null||s===void 0?void 0:s.enableRecordAPIPerformanceWhitelist)){return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}var l={id:c,startTime:performance.now(),method:r,url:f,entries:[],initiatorType:"xmlhttprequest"};Ve[Be].push(l);Je(c,e);return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}catch(t){e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:t}});return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}};XMLHttpRequest.prototype.send=function n(){var r=this;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++){o[a]=arguments[a]}try{var u=Ve[Be].find((function(e){return e.id===r.__requestId}));if(!u){return t.apply(this,o)}var s=this;this.addEventListener("loadend",b((function(){var n,t,r,i,o,a,c;return U(this,(function(f){switch(f.label){case 0:n=performance.now();t=n-u.startTime;r=s.status;if(r===0){return[2]}u.endTime=n;u.duration=t;u.responseStatus=r;f.label=1;case 1:f.trys.push([1,6,,7]);if(!(s.responseType===""||s.responseType==="text"))return[3,2];i=s.responseText;return[3,5];case 2:if(!(s.responseType==="json"))return[3,3];i=s.response;return[3,5];case 3:if(!(s.responseType==="blob"))return[3,5];o=s.response;if(!((o===null||o===void 0?void 0:o.type)==="application/json"))return[3,5];return[4,o.text()];case 4:i=f.sent();f.label=5;case 5:a=i&&typeof i==="string"?JSON.parse(i):i;if(a&&ze(a)){u.errorType="graphqlError";u.errorDetail=a.errors}return[3,7];case 6:c=f.sent();e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:u===null||u===void 0?void 0:u.url,error:c}});return[3,7];case 7:$e(u,e);return[2]}}))})));this.addEventListener("error",(function(){$e(u,e,{exceptionType:"network-error"})}));this.addEventListener("abort",(function(){$e(u,e,{exceptionType:"abort-error"})}));this.addEventListener("timeout",(function(){$e(u,e,{exceptionType:"timeout-error"})}));return t.apply(this,o)}catch(n){e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:n}});throw n}}};var Ye=function(e){var n=window.fetch;window.fetch=b((function(){var t,r,i,o,a,u,s,c,f,l,d,v,p,m,h,y;var w=arguments;return U(this,(function(g){switch(g.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++){r[i]=w[i]}u=new URL(S(r[0],Request)?r[0].url:String(r[0]),window.location.href).href;if(!!Me(u,(o=e.config)===null||o===void 0?void 0:o.enableRecordAPIPerformanceWhitelist))return[3,2];return[4,n.apply(this,r)];case 1:return[2,g.sent()];case 2:g.trys.push([2,9,,10]);c=performance.now();f=Ue();a={id:f,startTime:c,method:((s=S(r[0],Request)?r[0]:r[1])===null||s===void 0?void 0:s.method)||"GET",url:u,entries:[],initiatorType:"fetch"};Ve[Be].push(a);Je(f,e);return[4,n.apply(this,r)];case 3:l=g.sent();d=performance.now();a.endTime=d;a.duration=d-c;a.responseStatus=l.status;v=l.clone();g.label=4;case 4:g.trys.push([4,7,,8]);if(!v.ok)return[3,6];return[4,v.json()];case 5:p=g.sent();if(p&&ze(p)){a.errorType="graphqlError";a.errorDetail=p.errors}g.label=6;case 6:return[3,8];case 7:m=g.sent();e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a===null||a===void 0?void 0:a.url,error:m}});return[3,8];case 8:$e(a,e);return[2,l];case 9:h=g.sent();if(a&&a.id&&Ve[Be].find((function(e){return e.id===(a===null||a===void 0?void 0:a.id)}))){y="fetch-error";if(S(h,TypeError)){y="network-error"}else if(S(h,DOMException)&&h.name==="AbortError"){y="abort-error"}$e(a,e,{exceptionType:y})}else{e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}})}throw h;case 10:return[2]}}))}))};var Ze=function(e){var n;Qe(e);Ye(e);if((n=window)===null||n===void 0?void 0:n.PerformanceObserver){var t=new window.PerformanceObserver((function(e){var n=e.getEntries();n.forEach((function(e){var n=e;if(n.initiatorType==="fetch"||n.initiatorType==="xmlhttprequest"){var t=Ve[Be].filter((function(e){return e.url===n.name}));t.forEach((function(e){e.entries.push(n)}))}}))}));t.observe({entryTypes:["resource"],buffered:true})}else{e.normalLogPipeLine({severity:"warn",eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}};var en=new be({name:"apiPerformancePlugin",setUp:function(){var e=b((function(e){var n,t;return U(this,(function(r){if(Ve[We]){return[2]}if(((n=e.config)===null||n===void 0?void 0:n.enableRecordAPIPerformance)&&Math.random()<(((t=e.config)===null||t===void 0?void 0:t.enableRecordAPIPerformancePercentage)||0)){Ve[We]=true;Ze(e)}return[2]}))}));return function(n){return e.apply(this,arguments)}}()});var nn="3.1.0";var tn=function(){function e(n){var t=this;var r=n.config,i=n.plugins,o=i===void 0?[]:i;k(this,e);this.config=K;this.lifeCycle=new ge;this.plugins=[];this._commonData=q;this._MFECommonDataMap={};this.timeMap={};this.packedDataConvert=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o,a;var u=j({severity:n,eventName:r,currentHref:t.config.hideSearchParams?(((o=location)===null||o===void 0?void 0:o.href)||"").split("?")[0]||"":((a=location)===null||a===void 0?void 0:a.href)||""},i);if(t.config.isWebappContainer){u.MFEName=Z(t)}return u};this.normalPipelineObj=we([me(this,8),he(this),ve(this)]);this.observerPipelineObj=we([me(this,8),pe(this)]);this.immediateSendPipe=ve(this);this.observerPipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.observerPipelineObj(o)};this.normalLogPipeLine=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});if(t.config.disableThrottle){return t.immediateSendPipe(o)}else{return t.normalPipelineObj(o)}};this.ImmediatePipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.immediateSendPipe(o)};this.plugins=_(o);this.setConfig(r);this.initCommonData(r);this.lifeCycle.emit(X.onInit);if(r.enableErrorMonitoring){this.plugins.push(Se)}if((r===null||r===void 0?void 0:r.assetSpeedMonitoringWhiteList)&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer){this.plugins.push(Re)}if(r===null||r===void 0?void 0:r.enableDetectPageChange){this.plugins.push(_e)}if(r===null||r===void 0?void 0:r.enableRecordPageRetention){this.plugins.push(Le)}if((r===null||r===void 0?void 0:r.enableRecordAPIPerformance)&&(r===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1){this.plugins.push(en)}this.installPlugins()}E(e,[{key:"installPlugins",value:function e(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function e(){return this._commonData}},{key:"MFECommonDataMap",get:function e(){return this._MFECommonDataMap}},{key:"initCommonData",value:function e(n){this._commonData.sessionId=n.useSessionStorageForSessionId?ee():Y();this._commonData.deviceId=ne()||F;this._commonData.riskDeviceId=te();this._commonData.networkType=re()||"unknown";this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||F;this._commonData.appVersion=n.appVersion;this._commonData.appName=n.appName;this._commonData.sdkVersion=nn;this.lifeCycle.emit(X.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function e(n){this.lifeCycle.emit(X.onCommonUpdated,this._commonData);this._commonData.env=n.env||this._commonData.env;this._commonData.appName=n.appName||this._commonData.appName;this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||this._commonData.accountId;this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{key:"updateCommonData",value:function e(n){this.lifeCycle.emit(X.onCommonUpdated,this._commonData);this._commonData=j({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function e(n){var t=this;this.lifeCycle.emit(X.onCommonUpdated,this._commonData);setTimeout((function(){n.forEach((function(e){delete t._commonData[e]}))}),1e3)}},{key:"addToMFECommonData",value:function e(n){var t=n.MFEName,r=n.MFECommonData;var i;if(!this.config.isWebappContainer){return}if(!t||!r){return}this._MFECommonDataMap=R(j({},this._MFECommonDataMap||{}),I({},t,j({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[t])||{},r)))}},{key:"setConfig",value:function e(n){var t=this;if(this.config.isWebappContainer){return}var r=function(e,n){t.config[e]=n};Object.entries(n).forEach((function(e){var n=O(e,2),t=n[0],i=n[1];if((typeof i==="undefined"?"undefined":A(i))!==void 0){r(t,i)}}));this.lifeCycle.emit(X.onConfigInit,this.config);this.updateCommonDataBasedOnConfig(n)}},{key:"verbose",value:function e(n,t){this.normalLogPipeLine({severity:"verbose",eventName:n,extraInfo:t})}},{key:"httpLog",value:function e(n,t){this.normalLogPipeLine({severity:"http",eventName:n,extraInfo:t})}},{key:"info",value:function e(n,t){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:t})}},{key:"warn",value:function e(n,t){this.normalLogPipeLine({severity:"warn",eventName:n,extraInfo:t})}},{key:"error",value:function e(n,t){console.error("error",n);this.normalLogPipeLine({severity:"error",eventName:n,extraInfo:t})}},{key:"businessLog",value:function e(n,t){this.normalLogPipeLine({severity:"info",eventName:n,extraInfo:R(j({},t),{isBusinessLog:true})})}},{key:"reportDuration",value:function e(n,t,r){if(typeof n!=="string"){console.warn("reportDuration: eventName (first param) must be a string");return}if(typeof t!=="number"){console.warn("reportDuration: duration (second param) must be number");return}if(t<0||t>6e4){console.warn("reportDuration: duration (second param) must between 0 and 60000");return}this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:j({duration:t},r)})}},{key:"getTimerKey",value:function e(n){var t=Z(this);return this.config.isWebappContainer?"".concat(t,"_").concat(n):n}},{key:"timeStart",value:function e(n){if(typeof n!=="string"){console.warn("time: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){console.warn("Timer ".concat(n," already exists"))}this.timeMap[this.getTimerKey(n)]=Date.now()}},{key:"timeEnd",value:function e(n,t){if(typeof n!=="string"){console.warn("timeEnd: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){var r=Date.now()-this.timeMap[this.getTimerKey(n)]+(t||0);this.normalLogPipeLine({severity:"speed",eventName:n,extraInfo:{duration:r}});delete this.timeMap[this.getTimerKey(n)]}else{console.warn("Timer key :".concat(n," does not exist"))}}},{key:"addToAssetSpeedWhiteListByMFE",value:function e(n){var t=n.MFEName,r=n.whiteList;var i;if(!this.config.isWebappContainer){return}if(!t||!(r===null||r===void 0?void 0:r.length)){return}if(!this.config.assetSpeedMonitoringWhiteListByMFE){this.config.assetSpeedMonitoringWhiteListByMFE={}}if(!((i=this.config.assetSpeedMonitoringWhiteListByMFE)===null||i===void 0?void 0:i[t])){this.config.assetSpeedMonitoringWhiteListByMFE=R(j({},this.config.assetSpeedMonitoringWhiteListByMFE),I({},t,r))}else{var o;var a,u;(u=this.config.assetSpeedMonitoringWhiteListByMFE)===null||u===void 0?void 0:(a=u[t])===null||a===void 0?void 0:(o=a).push.apply(o,_(r))}}},{key:"destroy",value:function e(){if(this.config.isWebappContainer){return}this.plugins.forEach((function(e){e.uninstall()}))}}]);return e}();var rn=tn;var on=function(e,n){on=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t))e[t]=n[t]};return on(e,n)};function an(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");on(e,n);function t(){this.constructor=e}e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var un=function(){un=Object.assign||function e(n){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))n[o]=t[o]}return n};return un.apply(this,arguments)};function sn(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))}function cn(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}function fn(e,n,t){if(t||arguments.length===2)for(var r=0,i=n.length,o;r<i;r++){if(o||!(r in n)){if(!o)o=Array.prototype.slice.call(n,0,r);o[r]=n[r]}}return e.concat(o||Array.prototype.slice.call(n))}typeof SuppressedError==="function"?SuppressedError:function(e,n,t){var r=new Error(t);return r.name="SuppressedError",r.error=e,r.suppressed=n,r};var ln="@airwallex/components-sdk";var dn="1.30.2";var vn="./lib/index.js";var pn="./lib/index.mjs";var mn="./lib/index.d.ts";var hn=["lib/**"];var yn="MIT";var wn={"load-types":"node ./load-types.js && yarn prettier -w src/types/*d.ts",prebuild:"yarn clean",build:"yarn rollup --config",postbuild:"yarn bundle-types","bundle-types":"dts-bundle-generator -o ./lib/index.d.ts ./src/index.ts",clean:"rm -rf dist lib",lint:'eslint "src/**/*.ts*"',test:"jest",sonar:"sonar-scanner",release:"semantic-release","lint-stage":"lint-staged",prepare:"husky"};var gn={semi:true,singleQuote:true,printWidth:80,trailingComma:"all"};var bn={access:"public"};var kn={"@babel/preset-typescript":"^7.18.6","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@semantic-release/changelog":"^5.0.1","@semantic-release/commit-analyzer":"^8.0.1","@semantic-release/git":"^9.0.0","@semantic-release/gitlab":"^6.1.0","@semantic-release/release-notes-generator":"^9.0.0","@swc/core":"^1.3.46","@types/jest":"^29.5.0","@typescript-eslint/eslint-plugin":"^5.57.0","@typescript-eslint/parser":"^5.57.0","dts-bundle-generator":"^9.0.0",eslint:"^7.23.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^5.1.3",husky:"^9.0.11",jest:"^29.5.0","jest-environment-jsdom":"^29.5.0","lint-staged":"^15.2.7",prettier:"^3.3.2",rollup:"^4.9.6","semantic-release":"^17.3.8","sonarqube-scanner":"^3.0.1","ts-jest":"^29.0.5","ts-loader":"^9.5.1",tslib:"^2.6.2",typescript:"^4.5.2"};var xn={"@airwallex/airtracker":"^3.0.0"};var En={name:ln,version:dn,main:vn,module:pn,types:mn,files:hn,license:yn,scripts:wn,prettier:gn,"lint-staged":{"src/**/*.{ts,tsx}":["yarn lint"],"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}":"prettier --write"},publishConfig:bn,devDependencies:kn,dependencies:xn};var In={dev:M.staging,staging:M.staging,demo:M.demo,prod:M.production};var Sn=function(e,n){if(e===void 0){e=M.production}if(!window._AirwallexSDKs.airTracker){window._AirwallexSDKs.airTracker=new rn({config:{appName:"components-sdk",appVersion:En.version,env:In[e]||M.production}});window._AirwallexSDKs.airTracker.updateCommonData({clientId:n})}return window._AirwallexSDKs.airTracker};var Cn=function(e){if(typeof e!=="object"){return e}try{var n=JSON.parse(JSON.stringify(e));Object.keys(n).forEach((function(e){if(typeof e==="string"&&["auth","code"].some((function(n){return e.includes(n)}))){n[e]="***"}}));return n}catch(n){return e}};var Nn=function(e,n){var t,r;(r=(t=window._AirwallexSDKs)===null||t===void 0?void 0:t.airTracker)===null||r===void 0?void 0:r.error(e,un(un({},n),{context:"components-sdk"}))};var Tn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.warn(e,un(un({},n),{context:"components-sdk"}))};var Dn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.info(e,un(un({},n),{context:"components-sdk"}))};var jn=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="LOAD_SCRIPT_ERROR";return t}return n}(Error);var Pn,Rn;var On;(function(e){e["dev"]="dev";e["staging"]="staging";e["demo"]="demo";e["prod"]="prod";e["sandbox"]="sandbox"})(On||(On={}));var _n=(Pn={},Pn[On.dev]="https://checkout-staging.airwallex.com",Pn[On.staging]="https://checkout-staging.airwallex.com",Pn[On.demo]="https://checkout-demo.airwallex.com",Pn[On.prod]="https://checkout.airwallex.com",Pn[On.sandbox]="https://checkout.sandbox.airwallex.com",Pn);var An=(Rn={},Rn[On.dev]="https://static-staging.airwallex.com",Rn[On.staging]="https://static-staging.airwallex.com",Rn[On.demo]="https://static-demo.airwallex.com",Rn[On.prod]="https://static.airwallex.com",Rn[On.sandbox]="https://static.sandbox.airwallex.com",Rn);var Ln="sdkController";var Un="payments";var Mn={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js"};var Fn={kyc:"kyc",paymentsKyb:"paymentsKyb",kycRfi:"rfi",transactionRfi:"rfi",paymentEnablementRfi:"rfi",lendingRfi:"rfi",mrmRfi:"rfi",payoutForm:"payouts",beneficiaryForm:"payouts",hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments",cardNumber:"payments",applePayButton:"payments",googlePayButton:"payments",krCardNumber:"payments",krCardIdentifier:"payments",krCardExpiry:"payments",krCardPswFirstTwo:"payments",scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",embeddedCheckout:"billing"};var Kn={payments:["hpp","cvc","card","expiry","dropIn","cardNumber","applePayButton","googlePayButton","krCardNumber","krCardIdentifier","krCardExpiry","krCardPswFirstTwo"],payouts:["payoutForm","beneficiaryForm"],onboarding:["kyc","paymentsKyb"],risk:["scaSetup","scaVerify","scaManagement","transactionRfi","kycRfi","paymentEnablementRfi","lendingRfi","mrmRfi"],billing:["embeddedCheckout"]};var qn={billing:["payments"]};var Hn=["payments","sca"];var zn=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INVALID_STATIC_RESOURCE_ERROR";return t}return n}(Error);var Bn=Date.now();var Wn=function(e){return Object.keys(Kn).includes(e)};var Xn=function(e){if(e===void 0){e=500}return new Promise((function(n){return window.setTimeout(n,e)}))};var Gn=function(e){return Fn[e]};var Vn=function(e,n){var t=e===Un?_n:An;return t[n]||t.prod};var $n=function(e){var n=e.reduce((function(e,n){return e.concat(Wn(n)?Kn[n]:n)}),[]);return Array.from(new Set(n)).map((function(e){return{elementName:e,sdkName:Gn(e)}}))};var Jn=function(e){return Array.from(new Set($n(e).map((function(e){var n=e.sdkName;return n})).filter((function(e){return Hn.includes(e)}))))};var Qn=function(e){return e==="payments"?"payment":e};var Yn=function(e){var n=e.name,t=e.env,r=t===void 0?On.prod:t;var i=Vn(n,r);var o=Mn[n];if(!o){Nn("[components-sdk] Element static resource not found",{sdkName:n});throw new zn("Element ".concat(n," static resource URL is invalid."))}return"".concat(i).concat(o,"?ts=").concat(Bn)};var Zn=function(){return Hn.reduce((function(e,n){var t;return un(un({},e),(t={},t[n]=window._AirwallexSDKs.__controller__.internalSDKs[n],t))}),{})};var et=function(e){return qn[e]||[]};var nt=function(){return Math.floor(performance.now())};var tt=function(e){var n=document.createElement("script");n.src=e;n.type="module";var t=document.head||document.body;t.appendChild(n);return n};var rt=3;var it=function(e){return sn(void 0,void 0,void 0,(function(){var n,t;return cn(this,(function(r){switch(r.label){case 0:if(typeof window==="undefined"){throw new Error("Please load script in browser environment")}n=0;t=function(){return sn(void 0,void 0,void 0,(function(){var t,r,i;return cn(this,(function(o){t=nt();if(n>0&&e.includes("?ts=")){r=new URL(e,window.location.href);r.searchParams.set("ts","".concat(Date.now()));e=r.toString()}i=tt(e);return[2,new Promise((function(r,o){i.addEventListener("load",(function(){var i=nt();Dn("[components-sdk] SDK script loaded",{scriptUrl:e,start:t,latency:i-t,end:i,retryCount:n});r(true)}));i.addEventListener("error",(function(r){i.remove();console.error(r);var a=nt();Nn("[components-sdk] Failed to load script",{scriptUrl:e,error:r,start:t,latency:a-t,end:a,retryCount:n});o(new jn("Failed to load Airwallex SDK scripts: ".concat(e)))}))}))]}))}))};r.label=1;case 1:if(!(n<rt))return[3,7];r.label=2;case 2:r.trys.push([2,4,,6]);return[4,t()];case 3:return[2,r.sent()];case 4:r.sent();n++;return[4,Xn()];case 5:r.sent();return[3,6];case 6:return[3,1];case 7:Nn("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:n});throw new jn("Failed to load Airwallex SDK scripts: ".concat(e))}}))}))};var ot=function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INSTANCE_NOT_FOUND_ERROR";return t}return n}(Error);var at;var ut=new Map;var st=function(e){var n=e.env,t=e.scriptName;var r=Yn({name:t,env:n});var i=ut.get(t);if(i){return i}var o=it(r);ut.set(t,o);return o};var ct=function(e){var n=e.env,t=e.scriptName;return sn(void 0,void 0,void 0,(function(){var e;return cn(this,(function(r){switch(r.label){case 0:e=et(t);if(!(e.length>0))return[3,2];return[4,Promise.all(e.map((function(e){return st({env:n,scriptName:e})})))];case 1:r.sent();r.label=2;case 2:return[2,st({env:n,scriptName:t})]}}))}))};var ft=function(e){return sn(void 0,void 0,void 0,(function(){return cn(this,(function(n){if(typeof window==="undefined"){throw new Error("Please call the `init()` function in a browser environment.")}Sn(e.env,e.clientId);Dn("[components-sdk] SDK init start",{options:Cn(e),start:nt()});at=new Promise((function(n,t){var r;var i=un(un({},e),{env:e.env&&On[e.env]?e.env:On.prod});window.AirwallexComponentsSDK.__env__=i.env;var o=st({env:i.env,scriptName:Ln}).then((function(){return window._AirwallexSDKs.__controller__.init(i)}));var a=(r=e.enabledElements)!==null&&r!==void 0?r:[];var u=Jn(a);var s=u.map((function(e){return st({env:i.env,scriptName:e}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[Qn(e)];if(!n){Nn("[components-sdk] SDK instance not found",{functionsNamespace:e,windowSDKInstanceName:Qn(e)});throw new ot("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:e,instance:n})}))}));var c=$n(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return ct({scriptName:n,env:i.env}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[Qn(n)];if(!e){Nn("[components-sdk] SDK instance not found",{sdkName:n,windowSDKInstanceName:Qn(n)});throw new ot("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:t,instance:e})}))}));Promise.all(fn(fn([o],s,true),f,true)).then((function(){Dn("[components-sdk] SDK initialized",{options:Cn(e),start:nt()});n(Zn())}))["catch"]((function(e){if(!e.code){Nn("[components-sdk] Unexpected errors when init",{error:e})}t(e)}))}));return[2,at]}))}))};var lt=e("l",(function(e,n){return sn(void 0,void 0,void 0,(function(){var t,r,i,o,a;return cn(this,(function(u){switch(u.label){case 0:if(!e){throw new Error("Element type is missing. Please specify a valid element.")}Dn("[components-sdk] SDK createElement start",{elementName:e,options:Cn(n),timestamp:nt()});if(!at){Tn("[components-sdk] Did not call init before createElement");throw new Error("Please initialize the Element before creating it.")}return[4,at];case 1:u.sent();t=Gn(e);if(!t){throw new Error("`createElement()` with type `".concat(e,"` is not supported. Please specify a valid Element type."))}r=nt();u.label=2;case 2:u.trys.push([2,6,,7]);return[4,ct({scriptName:t,env:window.AirwallexComponentsSDK.__env__||On.prod})];case 3:u.sent();return[4,window._AirwallexSDKs.__controller__.registerElement({sdkName:t,elementName:e,instance:window._AirwallexSDKs[Qn(t)]})];case 4:u.sent();return[4,window._AirwallexSDKs.__controller__.createElement(e,n)];case 5:i=u.sent();o=nt();Dn("[components-sdk] SDK createElement being called",{elementName:e,options:Cn(n),start:r,latency:o-r,end:o});return[3,7];case 6:a=u.sent();if(!a.code){Nn("[components-sdk] Unexpected errors when createElement",{error:a})}else{throw a}return[3,7];case 7:return[2,i]}}))}))}));var dt=[Ln,Un];var vt=function(){dt.forEach((function(e){var n=Yn({name:e,env:On.prod});var t=document.createElement("link");t.href=n;t.rel="modulepreload";t.as="script";var r=document.head||document.body;r.appendChild(t)}))};var pt=typeof document==="undefined"||typeof window==="undefined";if(!pt){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",vt)}else{vt()}}if(typeof window!=="undefined"){if(!window.AirwallexComponentsSDK){Object.defineProperties(window,{AirwallexComponentsSDK:{value:{},writable:false},_AirwallexSDKs:{value:{},writable:false}})}window.AirwallexComponentsSDK.init=ft;window.AirwallexComponentsSDK.createElement=lt}var mt=n((function(){return{clientSecret:null,currency:null,hasPaymentError:false,isReady:false,paymentConfirmed:false,paymentIntentId:null}})),ht=mt.onChange,yt=mt.reset,wt=mt.state;e({n:ht,k:yt,b:wt});var gt=e("a",(function(e){if(e.paymentProcessor!=="AIRWALLEX"){return false}if(e.clientSecret){wt.clientSecret=e.clientSecret}if(e.paymentIntentId){wt.paymentIntentId=e.paymentIntentId}if(!wt.clientSecret){a("Airwallex checkout session is missing the client secret");return false}return true}));var bt={ar:"ar",da:"da",de:"de",en:"en",es:"es",fr:"fr",id:"id",it:"it",ja:"ja",ko:"ko",nl:"nl",pl:"pl",pt:"pt",ru:"ru",sv:"sv",zh:"zh"};var kt=e("m",(function(e){return bt[e]||"en"}));var xt=null;var Et=e("f",(function(){return sn(m,void 0,void 0,(function(){var e;return cn(this,(function(n){if(wt.isReady){return[2,true]}if(!xt){e=(!t.zonosMode||t.zonosMode==="production")&&t.checkoutSettings.mode==="LIVE";xt=ft({enabledElements:["payments"],env:e?"prod":"demo",locale:kt(i.selectedLocale)}).then((function(){wt.isReady=true;c("Airwallex SDK initialized");return true})).catch((function(e){a(e);xt=null;return false}))}return[2,xt]}))}))}));var It=["SUCCEEDED","REQUIRES_CAPTURE","PENDING_REVIEW","PENDING"];var St=e("e",(function(e){return!!e&&It.includes(e)}));var Ct=e("j",(function(e){switch(e){case"SUCCEEDED":{return{isError:false,messages:[r("Thank you for submitting your payment. We appreciate your prompt attention."),"",r("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}}case"PENDING":case"PENDING_REVIEW":case"REQUIRES_CAPTURE":{return{isError:false,messages:[r("Payment processing. We'll update you when payment is received.")]}}case"REQUIRES_CUSTOMER_ACTION":{return{isError:false,messages:[r("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}}case"CANCELLED":case"REQUIRES_PAYMENT_METHOD":{return{isError:true,messages:[r("Payment failed. Please reload the page and try another payment method.")]}}default:{return{isError:true,messages:[r("Something went wrong.")]}}}}));var Nt=e("d",(function(e){return sn(m,void 0,void 0,(function(){var n,t,r;return cn(this,(function(i){switch(i.label){case 0:return[4,u("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:e},method:"POST"})];case 1:n=i.sent(),t=n.errors,r=n.json;if(t.length||!r){a("Failed to retrieve Airwallex payment intent",t);return[2,{status:null}]}return[2,{status:r.airwallexPaymentIntent.status}]}}))}))}));var Tt=n((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}})),Dt=Tt.reset,jt=Tt.state;e("c",jt);var Pt=e("h",(function(e){return sn(m,[e],void 0,(function(e){var n,r,i,o,a,c,f,l,d,p,m,h,y,w;var g=e.landedCostId,b=e.retries,k=b===void 0?5:b;return cn(this,(function(e){switch(e.label){case 0:jt.isFetchingShippingInfo=true;return[4,u("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:g},method:"POST"})];case 1:m=e.sent();if(!m.errors.length)return[3,4];if(!(k>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,Pt({landedCostId:g,retries:k-1})];case 3:return[2,null];case 4:jt.landedCostShortId=((n=m.json)===null||n===void 0?void 0:n.landedCostShortId)||null;jt.isFetchingShippingInfo=false;jt.shippingAddress=((r=m.json)===null||r===void 0?void 0:r.shipping)||null;h=(i=v.checkoutSession)===null||i===void 0?void 0:i.landedCost;y=(o=v.checkoutSession)===null||o===void 0?void 0:o.subtotals;w=(((a=h===null||h===void 0?void 0:h.amountSubtotals)===null||a===void 0?void 0:a.shipping)||0)+(((c=h===null||h===void 0?void 0:h.amountSubtotals)===null||c===void 0?void 0:c.items)||0);jt.amountTotalPaid=w*(((f=y===null||y===void 0?void 0:y.exchangeRate)===null||f===void 0?void 0:f.rate)||1);jt.amountDutyTaxFeeTotal=((y===null||y===void 0?void 0:y.duties)||0)+((y===null||y===void 0?void 0:y.taxes)||0)+((y===null||y===void 0?void 0:y.fees)||0);jt.originCompanyName=((d=(l=m.json)===null||l===void 0?void 0:l.origin)===null||d===void 0?void 0:d.companyName)||null;jt.collectLogoUrl=((p=m.json)===null||p===void 0?void 0:p.collectLogoUrl)||null;if(jt.amountTotalPaid===0){void s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:g,organizationId:t.organizationId}})}return[2]}}))}))}));var Rt=e("i",(function(){return sn(m,void 0,void 0,(function(){var e,n,t,r,i,c,p,m,h,y;return cn(this,(function(w){switch(w.label){case 0:if(!((e=l.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}i=(t=(n=v.checkoutSession)===null||n===void 0?void 0:n.landedCost)===null||t===void 0?void 0:t.rootId;if(!i){void s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!o.checkoutSessionId){void s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:f,cartId:window.Zonos.cartId,landedCostRootId:i}});return[2,{partiesCreated:false}]}c=d({address:l.stripeBillingAddressEventData.value.address,firstName:l.stripeBillingAddressEventData.value.firstName,lastName:l.stripeBillingAddressEventData.value.lastName,name:l.stripeBillingAddressEventData.value.name,phone:l.stripeBillingAddressEventData.value.phone});p=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,u("/api/zonos-elements/create-billing-party",{body:{billingAddress:c,checkoutSessionId:o.checkoutSessionId,companyName:l.companyName,email:((r=l.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:p,rootId:i},method:"POST"})];case 1:m=w.sent(),h=m.errors,y=m.json;if(h.length||!y){a("Error occurs when creating billing party",JSON.stringify(h,null,2));void s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:h,json:y}});return[2,{partiesCreated:false}]}jt.partyBillingId=y.billToPartyId;return[2,{partiesCreated:true}]}}))}))}));var Ot=e("g",(function(e){return sn(m,void 0,void 0,(function(){var n;return cn(this,(function(t){n=e.landedCost;if(!n){return[2,false]}v.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},n),landedCostId:n.id})];return[2,p({applySubtotalsOnly:true,landedCostId:n.id,selectedShippingOption:n.shipmentRating})]}))}))}))}}}));
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r["throw"](e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,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(t){return u([e,t])}}function u(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-47a1d469.system.js","./p-fb8dc23f.system.js","./p-1d31b966.system.js","./p-01174496.system.js","./p-d938f42f.system.js"],(function(e){"use strict";var t,n,r,i,o,a,s,u,d,c,l;return{setters:[function(e){t=e.c;n=e.z},function(e){r=e.b;i=e.K;o=e.d;a=e.L},function(e){s=e.s},function(e){u=e.h;d=e.s;c=e.l},function(e){l=e.b}],execute:function(){var f=this;var v=t((function(){return{amountTotalDue:null,isFetchingPayorInfo:true,landedCostShortId:null,partyBillingId:null,payorAddress:null}})),h=v.reset,p=v.state;e("c",p);var _=e("a",(function(e){return __awaiter(f,[e],void 0,(function(e){var t,r,i,a,s;var c=e.landedCostId,l=e.retries,f=l===void 0?5:l;return __generator(this,(function(e){switch(e.label){case 0:p.isFetchingPayorInfo=true;return[4,u("/api/zonos-elements/invoice/get-payor-info-by-lc-id",{body:{landedCostId:c},method:"POST"})];case 1:a=e.sent();if(!a.errors.length)return[3,4];if(!(f>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,_({landedCostId:c,retries:f-1})];case 3:return[2,null];case 4:p.landedCostShortId=((t=a.json)===null||t===void 0?void 0:t.landedCostShortId)||null;p.isFetchingPayorInfo=false;p.payorAddress=((r=a.json)===null||r===void 0?void 0:r.payor)||null;s=(i=o.checkoutSession)===null||i===void 0?void 0:i.subtotals;p.amountTotalDue=(s===null||s===void 0?void 0:s.items)||0;if(p.amountTotalDue===0){void d({endpoint:"INVOICE_NO_TOTAL_DUE",errors:[],metadata:{landedCostId:c,organizationId:n.organizationId}})}return[2]}}))}))}));var I=e("b",(function(){return __awaiter(f,void 0,void 0,(function(){var e,t,n,a,f,v,h,_,I,y;return __generator(this,(function(m){switch(m.label){case 0:if(!((e=r.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}f=(n=(t=o.checkoutSession)===null||t===void 0?void 0:t.landedCost)===null||n===void 0?void 0:n.rootId;if(!f){void d({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:s.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!s.checkoutSessionId){void d({endpoint:"INVOICE_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:l,cartId:window.Zonos.cartId,landedCostRootId:f}});return[2,{partiesCreated:false}]}v=i({address:r.stripeBillingAddressEventData.value.address,firstName:r.stripeBillingAddressEventData.value.firstName,lastName:r.stripeBillingAddressEventData.value.lastName,name:r.stripeBillingAddressEventData.value.name,phone:r.stripeBillingAddressEventData.value.phone});h=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,u("/api/zonos-elements/create-billing-party",{body:{billingAddress:v,checkoutSessionId:s.checkoutSessionId,companyName:r.companyName,email:((a=r.stripeLinkEventData)===null||a===void 0?void 0:a.value.email)||"",isTest:h,rootId:f},method:"POST"})];case 1:_=m.sent(),I=_.errors,y=_.json;if(I.length||!y){c("Error occurs when creating billing party",JSON.stringify(I,null,2));void d({endpoint:"INVOICE_BILLING_PARTY_CREATE_FAILED",errors:["[INVOICE] Failed to create billing party"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:s.checkoutSessionId,errors:I,json:y}});return[2,{partiesCreated:false}]}p.partyBillingId=y.billToPartyId;return[2,{partiesCreated:true}]}}))}))}));var y=e("i",(function(e){return __awaiter(f,void 0,void 0,(function(){var t;return __generator(this,(function(n){t=e.landedCost;if(!t){return[2,false]}o.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},t),landedCostId:t.id})];return[2,a({applySubtotalsOnly:true,landedCostId:t.id,selectedShippingOption:t.shipmentRating})]}))}))}))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r["throw"](e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,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(t){return u([e,t])}}function u(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-47a1d469.system.js","./p-0d183f19.system.js","./p-22f7120a.system.js","./p-01174496.system.js","./p-d938f42f.system.js"],(function(e){"use strict";var t,n,r,i,o,a,s,u,d,c,l;return{setters:[function(e){t=e.c;n=e.z},function(e){r=e.b;i=e.K;o=e.d;a=e.L},function(e){s=e.s},function(e){u=e.h;d=e.s;c=e.l},function(e){l=e.b}],execute:function(){var f=this;var v=t((function(){return{amountTotalDue:null,isFetchingPayorInfo:true,landedCostShortId:null,partyBillingId:null,payorAddress:null}})),h=v.reset,p=v.state;e("c",p);var _=e("a",(function(e){return __awaiter(f,[e],void 0,(function(e){var t,r,i,a,s;var c=e.landedCostId,l=e.retries,f=l===void 0?5:l;return __generator(this,(function(e){switch(e.label){case 0:p.isFetchingPayorInfo=true;return[4,u("/api/zonos-elements/invoice/get-payor-info-by-lc-id",{body:{landedCostId:c},method:"POST"})];case 1:a=e.sent();if(!a.errors.length)return[3,4];if(!(f>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,_({landedCostId:c,retries:f-1})];case 3:return[2,null];case 4:p.landedCostShortId=((t=a.json)===null||t===void 0?void 0:t.landedCostShortId)||null;p.isFetchingPayorInfo=false;p.payorAddress=((r=a.json)===null||r===void 0?void 0:r.payor)||null;s=(i=o.checkoutSession)===null||i===void 0?void 0:i.subtotals;p.amountTotalDue=(s===null||s===void 0?void 0:s.items)||0;if(p.amountTotalDue===0){void d({endpoint:"INVOICE_NO_TOTAL_DUE",errors:[],metadata:{landedCostId:c,organizationId:n.organizationId}})}return[2]}}))}))}));var I=e("b",(function(){return __awaiter(f,void 0,void 0,(function(){var e,t,n,a,f,v,h,_,I,y;return __generator(this,(function(m){switch(m.label){case 0:if(!((e=r.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}f=(n=(t=o.checkoutSession)===null||t===void 0?void 0:t.landedCost)===null||n===void 0?void 0:n.rootId;if(!f){void d({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:s.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!s.checkoutSessionId){void d({endpoint:"INVOICE_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:l,cartId:window.Zonos.cartId,landedCostRootId:f}});return[2,{partiesCreated:false}]}v=i({address:r.stripeBillingAddressEventData.value.address,firstName:r.stripeBillingAddressEventData.value.firstName,lastName:r.stripeBillingAddressEventData.value.lastName,name:r.stripeBillingAddressEventData.value.name,phone:r.stripeBillingAddressEventData.value.phone});h=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,u("/api/zonos-elements/create-billing-party",{body:{billingAddress:v,checkoutSessionId:s.checkoutSessionId,companyName:r.companyName,email:((a=r.stripeLinkEventData)===null||a===void 0?void 0:a.value.email)||"",isTest:h,rootId:f},method:"POST"})];case 1:_=m.sent(),I=_.errors,y=_.json;if(I.length||!y){c("Error occurs when creating billing party",JSON.stringify(I,null,2));void d({endpoint:"INVOICE_BILLING_PARTY_CREATE_FAILED",errors:["[INVOICE] Failed to create billing party"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:s.checkoutSessionId,errors:I,json:y}});return[2,{partiesCreated:false}]}p.partyBillingId=y.billToPartyId;return[2,{partiesCreated:true}]}}))}))}));var y=e("i",(function(e){return __awaiter(f,void 0,void 0,(function(){var t;return __generator(this,(function(n){t=e.landedCost;if(!t){return[2,false]}o.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},t),landedCostId:t.id})];return[2,a({applySubtotalsOnly:true,landedCostId:t.id,selectedShippingOption:t.shipmentRating})]}))}))}))}}}));
@@ -1 +1 @@
1
- System.register(["./p-1d31b966.system.js"],(function(n){"use strict";var t;return{setters:[function(n){t=n.l}],execute:function(){var r=n("D","gkjqw123");var u=n("T","Kq93wqw3");var i=n("h",(function(){var n;return(n=t.inclusivePricingConfigurations)===null||n===void 0?void 0:n.some((function(n){var t,i;return((t=n.configurations[r])===null||t===void 0?void 0:t.status)==="ENABLED"||((i=n.configurations[u])===null||i===void 0?void 0:i.status)==="ENABLED"}))}))}}}));
1
+ System.register(["./p-22f7120a.system.js"],(function(n){"use strict";var t;return{setters:[function(n){t=n.l}],execute:function(){var r=n("D","gkjqw123");var u=n("T","Kq93wqw3");var i=n("h",(function(){var n;return(n=t.inclusivePricingConfigurations)===null||n===void 0?void 0:n.some((function(n){var t,i;return((t=n.configurations[r])===null||t===void 0?void 0:t.status)==="ENABLED"||((i=n.configurations[u])===null||i===void 0?void 0:i.status)==="ENABLED"}))}))}}}));
@@ -1 +1 @@
1
- System.register(["./p-fb8dc23f.system.js"],(function(e){"use strict";var t;return{setters:[function(e){t=e.U}],execute:function(){var i=e("M",3);var n=e("g",(function(e){var n=e.countryField,r=e.event;var v,a,o;if(!r){return[]}var u=r.value;var l=[];var s=t({firstName:u.firstName,lastName:u.lastName,name:u.name}).lastName;if(!s.trim()){l.push({key:"lastName"})}if((n===null||n===void 0?void 0:n.stateRequired)&&!((v=u.address.state)===null||v===void 0?void 0:v.trim())){l.push({key:"state"})}if((n===null||n===void 0?void 0:n.zipRequired)&&((o=(a=u.address.postal_code)===null||a===void 0?void 0:a.trim().length)!==null&&o!==void 0?o:0)<i){l.push({key:"postal_code"})}return l}))}}}));
1
+ System.register(["./p-0d183f19.system.js"],(function(e){"use strict";var t;return{setters:[function(e){t=e.U}],execute:function(){var i=e("M",3);var n=e("g",(function(e){var n=e.countryField,r=e.event;var v,a,o;if(!r){return[]}var u=r.value;var l=[];var s=t({firstName:u.firstName,lastName:u.lastName,name:u.name}).lastName;if(!s.trim()){l.push({key:"lastName"})}if((n===null||n===void 0?void 0:n.stateRequired)&&!((v=u.address.state)===null||v===void 0?void 0:v.trim())){l.push({key:"state"})}if((n===null||n===void 0?void 0:n.zipRequired)&&((o=(a=u.address.postal_code)===null||a===void 0?void 0:a.trim().length)!==null&&o!==void 0?o:0)<i){l.push({key:"postal_code"})}return l}))}}}));
@@ -1 +1 @@
1
- import{r as a,d as e,h as s,a as t,g as n}from"./p-ce75b047.js";import{b as o,c as i,f as l,l as r,m as c,n as m}from"./p-c8bc4ede.js";import{d as h}from"./p-5953208b.js";import{e as p,t as y,l as w}from"./p-71fc8a22.js";import{z as x}from"./p-9a417eeb.js";import{l as z}from"./p-0a377722.js";import{l as d}from"./p-41dd1cb8.js";import"./p-34d6eb83.js";import"./p-f1aea919.js";import"./p-bcf5cffb.js";const f=class{constructor(s){a(this,s),this.airwallexPaymentSuccess=e(this,"airwallexPaymentSuccess",7),this.airwallexPaymentError=e(this,"airwallexPaymentError",7),this.element=null,this.storeUnsubscribeList=[],this.mountingClientSecret=null,this.hasError=!1,this.clientSecret=o.clientSecret,this.getDropInOptions=a=>{var e;return{autoCapture:!(x.checkoutSettings.captureDelay&&x.checkoutSettings.captureDelay>0),client_secret:a,country_code:(null===(e=i.shippingAddress)||void 0===e?void 0:e.location.countryCode)||void 0,currency:o.currency||h.currency,intent_id:o.paymentIntentId||void 0}},this.mountPaymentElement=async()=>{var a;const e=this.clientSecret;if(!e)return;if(this.mountingClientSecret===e)return;if(this.mountingClientSecret=e,!await l())return this.hasError=!0,void(this.mountingClientSecret=null);const s=this.el.querySelector(".zonos--airwallex-payment-component");if(!s)return d("Cannot find container element for Airwallex payment element"),this.hasError=!0,void(this.mountingClientSecret=null);try{null===(a=this.element)||void 0===a||a.destroy(),this.element=null;const t=await r("dropIn",this.getDropInOptions(e));if(!t)return d("Failed to create Airwallex payment element"),this.hasError=!0,void(this.mountingClientSecret=null);t.mount(s),t.on("success",(()=>{z("Airwallex payment succeeded"),o.hasPaymentError=!1,o.paymentConfirmed=!0,this.airwallexPaymentSuccess.emit()})),t.on("error",(a=>{d(a),o.hasPaymentError=!0,this.airwallexPaymentError.emit()})),this.element=t,this.hasError=!1}catch(a){d(a),this.hasError=!0,this.mountingClientSecret=null}},this.localeChangeHandler=()=>{this.element&&this.clientSecret&&this.element.update(this.getDropInOptions(this.clientSecret),{locale:c(w.selectedLocale)})}}clientSecretWatcher(){this.mountPaymentElement()}componentWillLoad(){this.storeUnsubscribeList=[m("clientSecret",(a=>{this.clientSecret=a})),p("selectedLocale",this.localeChangeHandler)]}componentDidLoad(){this.mountPaymentElement()}disconnectedCallback(){var a;this.storeUnsubscribeList.forEach((a=>a())),null===(a=this.element)||void 0===a||a.destroy(),this.element=null}render(){return s(t,{key:"3d5f4aaea91533348ae6273757b8af6f17a7ab59",class:"zonos--airwallex-payment zonos--elements"},this.hasError&&s("zonos-banner",{key:"27fe7775145b9ff4f9b572ee592eb0cdc5f2ef13",class:"zonos--payment-error-banner",intent:"error"},y("We couldn't complete your payment. Please verify the payment details and try again.")),s("div",{key:"48a50ebcc6ad1e3b3cbf807ef5d466030995a171",class:"zonos--airwallex-payment-component"}))}get el(){return n(this)}static get watchers(){return{clientSecret:["clientSecretWatcher"]}}};f.style=".sc-zonos-airwallex-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-airwallex-payment-h *.sc-zonos-airwallex-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-airwallex-payment-h img.sc-zonos-airwallex-payment{max-width:100%}.sc-zonos-airwallex-payment-h dl.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h dd.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h1.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h2.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h3.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h4.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h5.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h6.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h hr.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h figure.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h p.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h pre.sc-zonos-airwallex-payment{margin:0}.sc-zonos-airwallex-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-airwallex-payment-h{display:block}.sc-zonos-airwallex-payment-h .zonos--payment-error-banner.sc-zonos-airwallex-payment{margin-bottom:16px}.sc-zonos-airwallex-payment-h .zonos--airwallex-payment-component.sc-zonos-airwallex-payment{margin-bottom:4px;min-height:40px}";export{f as zonos_airwallex_payment}
1
+ import{r as a,d as e,h as s,a as t,g as n}from"./p-ce75b047.js";import{b as o,c as i,f as l,l as r,m as c,n as m}from"./p-38881097.js";import{d as h}from"./p-19bbf4b3.js";import{e as p,t as y,l as w}from"./p-2837bfd2.js";import{z as x}from"./p-9a417eeb.js";import{l as z}from"./p-0a377722.js";import{l as d}from"./p-41dd1cb8.js";import"./p-34d6eb83.js";import"./p-f1aea919.js";import"./p-bcf5cffb.js";const f=class{constructor(s){a(this,s),this.airwallexPaymentSuccess=e(this,"airwallexPaymentSuccess",7),this.airwallexPaymentError=e(this,"airwallexPaymentError",7),this.element=null,this.storeUnsubscribeList=[],this.mountingClientSecret=null,this.hasError=!1,this.clientSecret=o.clientSecret,this.getDropInOptions=a=>{var e;return{autoCapture:!(x.checkoutSettings.captureDelay&&x.checkoutSettings.captureDelay>0),client_secret:a,country_code:(null===(e=i.shippingAddress)||void 0===e?void 0:e.location.countryCode)||void 0,currency:o.currency||h.currency,intent_id:o.paymentIntentId||void 0}},this.mountPaymentElement=async()=>{var a;const e=this.clientSecret;if(!e)return;if(this.mountingClientSecret===e)return;if(this.mountingClientSecret=e,!await l())return this.hasError=!0,void(this.mountingClientSecret=null);const s=this.el.querySelector(".zonos--airwallex-payment-component");if(!s)return d("Cannot find container element for Airwallex payment element"),this.hasError=!0,void(this.mountingClientSecret=null);try{null===(a=this.element)||void 0===a||a.destroy(),this.element=null;const t=await r("dropIn",this.getDropInOptions(e));if(!t)return d("Failed to create Airwallex payment element"),this.hasError=!0,void(this.mountingClientSecret=null);t.mount(s),t.on("success",(()=>{z("Airwallex payment succeeded"),o.hasPaymentError=!1,o.paymentConfirmed=!0,this.airwallexPaymentSuccess.emit()})),t.on("error",(a=>{d(a),o.hasPaymentError=!0,this.airwallexPaymentError.emit()})),this.element=t,this.hasError=!1}catch(a){d(a),this.hasError=!0,this.mountingClientSecret=null}},this.localeChangeHandler=()=>{this.element&&this.clientSecret&&this.element.update(this.getDropInOptions(this.clientSecret),{locale:c(w.selectedLocale)})}}clientSecretWatcher(){this.mountPaymentElement()}componentWillLoad(){this.storeUnsubscribeList=[m("clientSecret",(a=>{this.clientSecret=a})),p("selectedLocale",this.localeChangeHandler)]}componentDidLoad(){this.mountPaymentElement()}disconnectedCallback(){var a;this.storeUnsubscribeList.forEach((a=>a())),null===(a=this.element)||void 0===a||a.destroy(),this.element=null}render(){return s(t,{key:"3d5f4aaea91533348ae6273757b8af6f17a7ab59",class:"zonos--airwallex-payment zonos--elements"},this.hasError&&s("zonos-banner",{key:"27fe7775145b9ff4f9b572ee592eb0cdc5f2ef13",class:"zonos--payment-error-banner",intent:"error"},y("We couldn't complete your payment. Please verify the payment details and try again.")),s("div",{key:"48a50ebcc6ad1e3b3cbf807ef5d466030995a171",class:"zonos--airwallex-payment-component"}))}get el(){return n(this)}static get watchers(){return{clientSecret:["clientSecretWatcher"]}}};f.style=".sc-zonos-airwallex-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-airwallex-payment-h *.sc-zonos-airwallex-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-airwallex-payment-h img.sc-zonos-airwallex-payment{max-width:100%}.sc-zonos-airwallex-payment-h dl.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h dd.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h1.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h2.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h3.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h4.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h5.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h h6.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h hr.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h figure.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h p.sc-zonos-airwallex-payment,.sc-zonos-airwallex-payment-h pre.sc-zonos-airwallex-payment{margin:0}.sc-zonos-airwallex-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-airwallex-payment-h{display:block}.sc-zonos-airwallex-payment-h .zonos--payment-error-banner.sc-zonos-airwallex-payment{margin-bottom:16px}.sc-zonos-airwallex-payment-h .zonos--airwallex-payment-component.sc-zonos-airwallex-payment{margin-bottom:4px;min-height:40px}";export{f as zonos_airwallex_payment}
@@ -1 +1 @@
1
- import{r as s,d as t,h as o,a as e,g as n}from"./p-ce75b047.js";import{t as i}from"./p-3b479012.js";import{U as a,b as r,t as l,H as d,u as h,d as c}from"./p-5953208b.js";import{s as p,z as u,t as f,y as m,l as z}from"./p-71fc8a22.js";import{z as b,g as v,f as g}from"./p-9a417eeb.js";import{l as y,i as k,s as x}from"./p-41dd1cb8.js";import{a as w,s as C}from"./p-a553e132.js";import{c as I}from"./p-b4b7f705.js";import{l as A}from"./p-0a377722.js";import{c as E,s as j}from"./p-bcf5cffb.js";import{g as S}from"./p-f1aea919.js";import"./p-7bdce9d4.js";import"./p-34d6eb83.js";import"./p-1d42cd20.js";const D=s=>{var t,o,e;return[s.name,null===(t=s.address)||void 0===t?void 0:t.line1,null===(o=s.address)||void 0===o?void 0:o.postal_code,null===(e=s.address)||void 0===e?void 0:e.country].map((s=>(s||"").trim().toLowerCase())).join("|")},N=({currentEvent:s,defaultAddress:t})=>{if(!s)return t;const o=(s=>{const{firstName:t,lastName:o}=a({firstName:s.firstName,lastName:s.lastName,name:s.name});return{address:{city:s.address.city,country:s.address.country,line1:s.address.line1,line2:s.address.line2||void 0,postal_code:s.address.postal_code,state:s.address.state},name:(s.name||`${t} ${o}`).trim(),phone:s.phone||void 0}})(s.value),e=D(o);return t.some((s=>D(s)===e))?t:[o,...t]},L=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=i(h,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:r.stripeBillingAddressElement,stripeAddressEventData:r.stripeBillingAddressEventData,stripeElements:r.stripeElementsForBillingAddress}:{stripeAddressElement:r.stripeAddressElement,stripeAddressEventData:r.stripeAddressEventData,stripeElements:r.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?r.stripeBillingAddressEventData=s:r.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,l({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?r.stripeBillingAddressElement=s:r.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void y("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=z.shippingZoneCountries,n=e?Object.values(e).map((s=>s.code)):[],i=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),r="shipping"===this.type?n:[],l=(null==s?void 0:s.value.address.country)||u(r);A(`Stripe country code: ${l}`,"info");const d=t.create("address",{allowedCountries:i?[]:r,contacts:N({currentEvent:s,defaultAddress:o}),defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:l}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=a({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?r.stripeAddressEventData=null:r.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:r.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:f(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:r.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{r.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:f("Short address code"),inputPlaceholder:"RRRD2929",inputValue:r.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{r.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===b.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:f("Company name (optional)"),inputValue:r.companyName,onInputChange:s=>{r.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[m("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),d("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),d("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"195940efdd29696d99b1ab6524a53e6a03776c6a",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"968d5990fce9c1eb22cd10b58744e6d00f2e622d",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"ae6dd70dcaa5ecd3465c065736e0f31fb40e72d3",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"0bf3075670d3fcd945f9ddcbe096399e2dc213ed",class:"zonos--address-component"}))}get el(){return n(this)}static get watchers(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};L.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const Z=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=f("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=v(b.appearance.theme);return o(e,{key:"dc074c5b88b642e06edd8942408a3aeed05e5cdb",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":g()}},o("div",{key:"119a9c201e44a670fb1df61f6663d96f7148ecc6",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"9534a92f69dd3d692c1a2fd86fa1cf148f68cdfa",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"e79aaf3a80b57634f78575b15a75d7b549ed20ee",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"44367b178f46c66dfb236485e05f6832ae63a63b",class:"wrapper"},o("div",{key:"42d10d17180ec7364710682c27d6cd4fef0b8abe",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"b5f7563fb43e1b147db669e1df71f4fafb5284df",class:"content"},o("div",{key:"38b78e383833b5e49908c8e95c35b9ad23c0f956",class:"title"},o("zonos-text",{key:"726f5308881671e7e17bd0591521485bd7142c1e",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"58d663842d51a512b3c8799a907bd1ed58e4fb31",class:"subtitle"},o("zonos-text",{key:"4411400d8906a22fd5f31652a1eeb314cae8ad68",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"df0452b2af633dd558858db824336fd5925aef50",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"50f88e85e18129ef4ee209615b951683c5ff6fa8",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||f("Cancel")),o("zonos-button",{key:"314b8be8954241b8c261c62d5a4bbe8155cc6914",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return n(this)}};Z.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const B=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),O=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=r.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=r.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=B(s);r.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!r.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=r.stripeLinkElement||r.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void y("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;r.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),r.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(r.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=r.stripeLinkElement)||void 0===o||o.clear(),null===(e=r.stripeLinkElement)||void 0===e||e.destroy(),r.stripeLinkElement=null,r.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[d("stripeElements",(async()=>{this.watchInitStripe()})),d("clientSecret",(async()=>{this.clientSecret=r.clientSecret})),d("stripe",(async()=>{this.stripe=r.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=r.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:f("Email"),inputValue:this.defaultEmail||(null===(s=r.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=r.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=B(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},f("Please enter a valid email address.")))}get el(){return n(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};O.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const M=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"e284a5ada0945f1895dbd9b40039e9d2ef600111",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"fb68155fe133ba8cd1d923a0fbb37a382ecabc34",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"50dc3d4b1f53173240d23ffeac966f7463546fde",size:this.size,spinnerColor:this.spinnerColor})))}};M.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{L as zonos_address,Z as zonos_confirm_dialog,O as zonos_link_authentication,M as zonos_loading_overlay}
1
+ import{r as s,d as t,h as o,a as e,g as n}from"./p-ce75b047.js";import{t as i}from"./p-3b479012.js";import{U as a,b as r,t as l,H as d,u as h,d as c}from"./p-19bbf4b3.js";import{s as p,z as u,t as f,y as m,l as z}from"./p-2837bfd2.js";import{z as b,g as v,f as g}from"./p-9a417eeb.js";import{l as y,i as k,s as x}from"./p-41dd1cb8.js";import{a as w,s as C}from"./p-a553e132.js";import{c as I}from"./p-b4b7f705.js";import{l as A}from"./p-0a377722.js";import{c as E,s as j}from"./p-bcf5cffb.js";import{g as S}from"./p-f1aea919.js";import"./p-7bdce9d4.js";import"./p-34d6eb83.js";import"./p-1d42cd20.js";const D=s=>{var t,o,e;return[s.name,null===(t=s.address)||void 0===t?void 0:t.line1,null===(o=s.address)||void 0===o?void 0:o.postal_code,null===(e=s.address)||void 0===e?void 0:e.country].map((s=>(s||"").trim().toLowerCase())).join("|")},N=({currentEvent:s,defaultAddress:t})=>{if(!s)return t;const o=(s=>{const{firstName:t,lastName:o}=a({firstName:s.firstName,lastName:s.lastName,name:s.name});return{address:{city:s.address.city,country:s.address.country,line1:s.address.line1,line2:s.address.line2||void 0,postal_code:s.address.postal_code,state:s.address.state},name:(s.name||`${t} ${o}`).trim(),phone:s.phone||void 0}})(s.value),e=D(o);return t.some((s=>D(s)===e))?t:[o,...t]},L=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=i(h,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:r.stripeBillingAddressElement,stripeAddressEventData:r.stripeBillingAddressEventData,stripeElements:r.stripeElementsForBillingAddress}:{stripeAddressElement:r.stripeAddressElement,stripeAddressEventData:r.stripeAddressEventData,stripeElements:r.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?r.stripeBillingAddressEventData=s:r.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,l({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?r.stripeBillingAddressElement=s:r.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void y("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=z.shippingZoneCountries,n=e?Object.values(e).map((s=>s.code)):[],i=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),r="shipping"===this.type?n:[],l=(null==s?void 0:s.value.address.country)||u(r);A(`Stripe country code: ${l}`,"info");const d=t.create("address",{allowedCountries:i?[]:r,contacts:N({currentEvent:s,defaultAddress:o}),defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:l}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=a({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?r.stripeAddressEventData=null:r.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:r.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:f(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:r.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{r.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:f("Short address code"),inputPlaceholder:"RRRD2929",inputValue:r.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{r.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===b.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:f("Company name (optional)"),inputValue:r.companyName,onInputChange:s=>{r.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[m("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),d("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),d("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"195940efdd29696d99b1ab6524a53e6a03776c6a",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"968d5990fce9c1eb22cd10b58744e6d00f2e622d",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"ae6dd70dcaa5ecd3465c065736e0f31fb40e72d3",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"0bf3075670d3fcd945f9ddcbe096399e2dc213ed",class:"zonos--address-component"}))}get el(){return n(this)}static get watchers(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};L.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const Z=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=f("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=v(b.appearance.theme);return o(e,{key:"dc074c5b88b642e06edd8942408a3aeed05e5cdb",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":g()}},o("div",{key:"119a9c201e44a670fb1df61f6663d96f7148ecc6",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"9534a92f69dd3d692c1a2fd86fa1cf148f68cdfa",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"e79aaf3a80b57634f78575b15a75d7b549ed20ee",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"44367b178f46c66dfb236485e05f6832ae63a63b",class:"wrapper"},o("div",{key:"42d10d17180ec7364710682c27d6cd4fef0b8abe",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"b5f7563fb43e1b147db669e1df71f4fafb5284df",class:"content"},o("div",{key:"38b78e383833b5e49908c8e95c35b9ad23c0f956",class:"title"},o("zonos-text",{key:"726f5308881671e7e17bd0591521485bd7142c1e",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"58d663842d51a512b3c8799a907bd1ed58e4fb31",class:"subtitle"},o("zonos-text",{key:"4411400d8906a22fd5f31652a1eeb314cae8ad68",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"df0452b2af633dd558858db824336fd5925aef50",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"50f88e85e18129ef4ee209615b951683c5ff6fa8",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||f("Cancel")),o("zonos-button",{key:"314b8be8954241b8c261c62d5a4bbe8155cc6914",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return n(this)}};Z.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const B=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),O=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=r.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=r.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=B(s);r.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!r.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=r.stripeLinkElement||r.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void y("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;r.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),r.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(r.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=r.stripeLinkElement)||void 0===o||o.clear(),null===(e=r.stripeLinkElement)||void 0===e||e.destroy(),r.stripeLinkElement=null,r.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[d("stripeElements",(async()=>{this.watchInitStripe()})),d("clientSecret",(async()=>{this.clientSecret=r.clientSecret})),d("stripe",(async()=>{this.stripe=r.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=r.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:f("Email"),inputValue:this.defaultEmail||(null===(s=r.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=r.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=B(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},f("Please enter a valid email address.")))}get el(){return n(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};O.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const M=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"e284a5ada0945f1895dbd9b40039e9d2ef600111",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"fb68155fe133ba8cd1d923a0fbb37a382ecabc34",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"50dc3d4b1f53173240d23ffeac966f7463546fde",size:this.size,spinnerColor:this.spinnerColor})))}};M.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{L as zonos_address,Z as zonos_confirm_dialog,O as zonos_link_authentication,M as zonos_loading_overlay}
@@ -1 +1 @@
1
- System.register(["./p-fb8dc23f.system.js","./p-1d31b966.system.js"],(function(r){"use strict";var n,v,u;return{setters:[function(r){n=r.d},function(r){v=r.w;u=r.h}],execute:function(){var t=function(){var r,v;var u=n.displayBaseCurrency;var t=u&&((r=n.exchangeRate)===null||r===void 0?void 0:r.sourceCurrencyCode)?(v=n.exchangeRate)===null||v===void 0?void 0:v.sourceCurrencyCode:n.currency;return t};var a=r("r",(function(r){var a=r.amount,e=r.isForeign;var i,o;var c=((i=n.exchangeRate)===null||i===void 0?void 0:i.rate)||1;var s=e?a:v(a);var d=n.currency;var f=(o=n.items[0])===null||o===void 0?void 0:o.currencyCode;if(f===d){return u({amount:s,currency:d})}var l=n.displayBaseCurrency;var m=t();if(e){var y=l?s/c:s;return u({amount:y,currency:m})}var b=l?s:s*c;return u({amount:b,currency:m})}))}}}));
1
+ System.register(["./p-0d183f19.system.js","./p-22f7120a.system.js"],(function(r){"use strict";var n,v,u;return{setters:[function(r){n=r.d},function(r){v=r.w;u=r.h}],execute:function(){var t=function(){var r,v;var u=n.displayBaseCurrency;var t=u&&((r=n.exchangeRate)===null||r===void 0?void 0:r.sourceCurrencyCode)?(v=n.exchangeRate)===null||v===void 0?void 0:v.sourceCurrencyCode:n.currency;return t};var a=r("r",(function(r){var a=r.amount,e=r.isForeign;var i,o;var c=((i=n.exchangeRate)===null||i===void 0?void 0:i.rate)||1;var s=e?a:v(a);var f=n.currency;var d=(o=n.items[0])===null||o===void 0?void 0:o.currencyCode;if(d===f){return u({amount:s,currency:f})}var l=n.displayBaseCurrency;var m=t();if(e){var y=l?s/c:s;return u({amount:y,currency:m})}var j=l?s:s*c;return u({amount:j,currency:m})}))}}}));