@zonos/elements 1.3.286 → 1.3.288
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.
- package/README.md +9 -1
- package/dist/cjs/RemoveIcon-CuM1YmjP.js +5 -0
- package/dist/cjs/{cart-0cf8897b.js → cart-CV4buPlT.js} +17 -27
- package/dist/cjs/{collect-79131e52.js → collect-jzWKzrV7.js} +17 -113
- package/dist/cjs/debounce-5sZmmlCI.js +9 -0
- package/dist/cjs/debounce-Nu2lJW4A.js +405 -0
- package/dist/cjs/{formatStringWithLinks-c25b4018.js → formatStringWithLinks-vOVkAjlu.js} +1 -1
- package/dist/cjs/{getBorderRadius-97fd5e02.js → getBorderRadius-DGZiQu09.js} +1 -1
- package/dist/cjs/{getContrastColor-956dfaf7.js → getContrastColor-B2Kn8XHA.js} +2 -2
- package/dist/cjs/{getMissingRequiredShippingFields-a8f04267.js → getMissingRequiredShippingFields-r5vYIqoX.js} +1 -1
- package/dist/cjs/{handleFetch-954f30e1.js → handleFetch-DQLhurnE.js} +4 -3
- package/dist/cjs/{hasInclusivePrice-d0cd2007.js → hasInclusivePrice-BZMQohG9.js} +1 -1
- package/dist/cjs/{helpers-5bdbb68c.js → helpers-ClOZ11A9.js} +0 -3
- package/dist/cjs/{index-b1f95d96.js → index-DAAr465v.js} +1252 -580
- package/dist/cjs/index.cjs.js +17 -21
- package/dist/cjs/{invoice-254ae23b.js → invoice-CHw-mJdS.js} +6 -6
- package/dist/cjs/{isContrastColor-30f84a91.js → isContrastColor-B9ldIdpa.js} +1 -1
- package/dist/cjs/isDarkColor-f-fD9c2l.js +1187 -0
- package/dist/cjs/loader.cjs.js +3 -5
- package/dist/cjs/{localization-fb2ece37.js → localization-CxXsmxs5.js} +4 -4
- package/dist/cjs/{paypal-8ca67278.js → paypal-BLuHeOJH.js} +10 -9
- package/dist/cjs/{placeTestOrder-12b63822.js → placeTestOrder-VK_CMeq0.js} +3 -3
- package/dist/cjs/{renderCheckoutCurrency-a1f71587.js → renderCheckoutCurrency-CC4CAy-a.js} +2 -2
- package/dist/cjs/{renderFallback-bc20ee20.js → renderFallback-Bme86uk8.js} +1 -1
- package/dist/cjs/{shouldRenderTaxIdInput-7d19556c.js → shouldRenderTaxIdInput-TxekHCp7.js} +2 -2
- package/dist/cjs/{shouldShowLanguageSelect-82985128.js → shouldShowLanguageSelect-Bj_jKWPK.js} +1 -1
- package/dist/cjs/{submitGtag-8a25f001.js → submitGtag-CcEL-w5D.js} +3 -3
- package/dist/cjs/throttle-BcxGntLr.js +87 -0
- package/dist/cjs/{updateCheckoutSessionAttributes-de7b1466.js → updateCheckoutSessionAttributes-Dltl5RBx.js} +3 -3
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +644 -692
- package/dist/cjs/zonos-address-display_2.cjs.entry.js +13 -17
- package/dist/cjs/zonos-address_4.cjs.entry.js +50 -40
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +15 -16
- package/dist/cjs/zonos-badge.cjs.entry.js +7 -10
- package/dist/cjs/zonos-banner.cjs.entry.js +6 -9
- package/dist/cjs/zonos-button_3.cjs.entry.js +18 -21
- package/dist/cjs/zonos-card_5.cjs.entry.js +34 -35
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +85 -83
- package/dist/cjs/zonos-checkbox_2.cjs.entry.js +10 -14
- package/dist/cjs/zonos-checkout.cjs.entry.js +50 -34
- package/dist/cjs/zonos-collapse.cjs.entry.js +5 -8
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +18 -23
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +59 -55
- package/dist/cjs/zonos-collect.cjs.entry.js +20 -23
- package/dist/cjs/zonos-component.cjs.entry.js +3 -6
- package/dist/cjs/zonos-controller.cjs.entry.js +13 -16
- package/dist/cjs/zonos-country-flag.cjs.entry.js +8 -11
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +68 -57
- package/dist/cjs/zonos-elements.cjs.js +7 -7
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +22 -23
- package/dist/cjs/zonos-hello.cjs.entry.js +19 -17
- package/dist/cjs/zonos-input.cjs.entry.js +10 -11
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +17 -21
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +57 -52
- package/dist/cjs/zonos-invoice.cjs.entry.js +19 -22
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +11 -15
- package/dist/cjs/zonos-link.cjs.entry.js +3 -6
- package/dist/cjs/zonos-logo.cjs.entry.js +6 -9
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +15 -19
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +11 -14
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +15 -14
- package/dist/cjs/zonos-text.cjs.entry.js +8 -11
- package/dist/cjs/zonos-tooltip.cjs.entry.js +4 -7
- package/dist/cjs/zonos-v-stack.cjs.entry.js +6 -9
- package/dist/cjs/zonosStore-BCNYr6Tk.js +3808 -0
- package/dist/collection/__tests__/jsxWithChildren.types.js +13 -0
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-completion-dialog/zonos-address-completion-dialog.js +13 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.js +4 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +8 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +17 -13
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +4 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +7 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +5 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +8 -8
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-empty-state-payment/zonos-empty-state-payment.js +5 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +18 -14
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +13 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +7 -7
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +8 -6
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.js +6 -5
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.js +4 -4
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +7 -7
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +3 -3
- package/dist/collection/components/checkout/zonos-collect/zonos-collect.css +7 -4
- package/dist/collection/components/checkout/zonos-collect/zonos-collect.js +2 -2
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +1 -1
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +8 -6
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +6 -5
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.js +4 -4
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +7 -7
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +3 -3
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +1 -1
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.js +2 -2
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +8 -7
- package/dist/collection/components/common/zonos-banner/zonos-banner.js +4 -4
- package/dist/collection/components/common/zonos-button/zonos-button.js +29 -25
- package/dist/collection/components/common/zonos-card/zonos-card.js +9 -8
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +15 -12
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +9 -6
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
- package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +15 -15
- package/dist/collection/components/common/zonos-country-flag/zonos-country-flag.js +6 -5
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +22 -21
- package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +3 -2
- package/dist/collection/components/common/zonos-icon/zonos-icon.js +8 -7
- package/dist/collection/components/common/zonos-input/zonos-input.js +7 -7
- package/dist/collection/components/common/zonos-link/zonos-link.js +7 -7
- package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +4 -4
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +4 -3
- package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +8 -7
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +1 -1
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +15 -12
- package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +2 -2
- package/dist/collection/components/common/zonos-spinner/zonos-spinner.js +3 -3
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +17 -17
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +23 -20
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +19 -19
- package/dist/collection/components/common/zonos-text/zonos-text.js +15 -11
- package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +4 -3
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +3 -2
- package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +7 -6
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +3 -3
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +16 -12
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +3 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +14 -11
- package/dist/collection/components/main/zonos-controller.js +18 -10
- package/dist/collection/components/store/checkout/stripe.js +1 -1
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +9 -8
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +6 -4
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +13 -10
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +4 -4
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +2 -2
- package/dist/collection/components/utils/checkout/isEuDapRemittance.js +1 -1
- package/dist/collection/components/utils/checkout/shouldRenderTaxIdInput.js +1 -1
- package/dist/collection/scripts/cart/_setupCartData.js +2 -2
- package/dist/collection/scripts/cart/_setupCartDataWithSettings.js +2 -2
- package/dist/collection/types/generated/graphql.internal.types.js +5 -0
- package/dist/esm/RemoveIcon-C2QMVeWW.js +3 -0
- package/dist/esm/{cart-d04742f5.js → cart-ekBk_gxV.js} +18 -28
- package/dist/esm/{collect-4c310a16.js → collect-33rMINDo.js} +17 -113
- package/dist/esm/debounce-D4ko2kvZ.js +403 -0
- package/dist/esm/debounce-DWPsxJsW.js +7 -0
- package/dist/esm/{formatStringWithLinks-0d48f183.js → formatStringWithLinks-BcMPqGl0.js} +1 -1
- package/dist/esm/{getBorderRadius-1f7be586.js → getBorderRadius-HwG64EKM.js} +1 -1
- package/dist/esm/{getContrastColor-4c0ae8c1.js → getContrastColor-CfCPlW9U.js} +2 -2
- package/dist/esm/{getMissingRequiredShippingFields-f0878e32.js → getMissingRequiredShippingFields-u1nhQzJ1.js} +1 -1
- package/dist/esm/{handleFetch-a844cac1.js → handleFetch-D5GYDF-O.js} +4 -3
- package/dist/esm/{hasInclusivePrice-d801be22.js → hasInclusivePrice-CAVXi310.js} +1 -1
- package/dist/esm/{helpers-2f6955b1.js → helpers-DJIdCwJ5.js} +0 -3
- package/dist/esm/{index-cfd394c8.js → index-_lt63o7c.js} +1253 -561
- package/dist/esm/index.js +20 -22
- package/dist/esm/{invoice-86487dac.js → invoice-BNDWuVsD.js} +6 -6
- package/dist/esm/{isContrastColor-9fa0d013.js → isContrastColor-CWLU13s9.js} +1 -1
- package/dist/esm/isDarkColor-YdrG78th.js +1184 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{localization-36a4dc22.js → localization-AOqYXGdP.js} +5 -5
- package/dist/esm/{paypal-997935ab.js → paypal-CW1D2XqZ.js} +10 -9
- package/dist/esm/{placeTestOrder-a53f2056.js → placeTestOrder-nhmsLLOA.js} +3 -3
- package/dist/esm/{renderCheckoutCurrency-e0e16eb7.js → renderCheckoutCurrency-BQANmZyM.js} +2 -2
- package/dist/esm/{renderFallback-b250f4e9.js → renderFallback-Cy03ZcWE.js} +1 -1
- package/dist/esm/{shouldRenderTaxIdInput-ef7b5860.js → shouldRenderTaxIdInput-CKyZ6Zni.js} +2 -2
- package/dist/esm/{shouldShowLanguageSelect-328f50e2.js → shouldShowLanguageSelect-BQFCXouB.js} +1 -1
- package/dist/esm/{submitGtag-71c450b6.js → submitGtag-CCGQS060.js} +4 -4
- package/dist/esm/throttle-D5GyA3yr.js +85 -0
- package/dist/esm/{updateCheckoutSessionAttributes-23b222de.js → updateCheckoutSessionAttributes-eRSqdC74.js} +3 -3
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +644 -690
- package/dist/esm/zonos-address-display_2.entry.js +13 -15
- package/dist/esm/zonos-address_4.entry.js +50 -38
- package/dist/esm/zonos-airwallex-payment.entry.js +15 -14
- package/dist/esm/zonos-badge.entry.js +7 -8
- package/dist/esm/zonos-banner.entry.js +6 -7
- package/dist/esm/zonos-button_3.entry.js +18 -19
- package/dist/esm/zonos-card_5.entry.js +34 -33
- package/dist/esm/zonos-cart-items_12.entry.js +85 -81
- package/dist/esm/zonos-checkbox_2.entry.js +10 -12
- package/dist/esm/zonos-checkout.entry.js +50 -32
- package/dist/esm/zonos-collapse.entry.js +5 -6
- package/dist/esm/zonos-collect-cart-items_3.entry.js +18 -21
- package/dist/esm/zonos-collect-finish_6.entry.js +59 -53
- package/dist/esm/zonos-collect.entry.js +20 -21
- package/dist/esm/zonos-component.entry.js +3 -4
- package/dist/esm/zonos-controller.entry.js +13 -14
- package/dist/esm/zonos-country-flag.entry.js +8 -9
- package/dist/esm/zonos-country-select_4.entry.js +68 -55
- package/dist/esm/zonos-elements.js +6 -5
- package/dist/esm/zonos-hello-dialog.entry.js +22 -21
- package/dist/esm/zonos-hello.entry.js +19 -15
- package/dist/esm/zonos-input.entry.js +10 -9
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +17 -19
- package/dist/esm/zonos-invoice-finish_5.entry.js +57 -50
- package/dist/esm/zonos-invoice.entry.js +19 -20
- package/dist/esm/zonos-language-select_2.entry.js +11 -13
- package/dist/esm/zonos-link.entry.js +3 -4
- package/dist/esm/zonos-logo.entry.js +6 -7
- package/dist/esm/zonos-policy-consent_2.entry.js +15 -17
- package/dist/esm/zonos-shipping-rich-radio.entry.js +11 -12
- package/dist/esm/zonos-stripe-input.entry.js +15 -12
- package/dist/esm/zonos-text.entry.js +8 -9
- package/dist/esm/zonos-tooltip.entry.js +4 -5
- package/dist/esm/zonos-v-stack.entry.js +6 -7
- package/dist/esm/zonosStore-DrIOAz4M.js +3795 -0
- package/dist/esm-es5/{CheckoutConfig-724d7bae.js → CheckoutConfig-D5SpFsQJ.js} +5 -1
- package/dist/esm-es5/VarianceTest-BJmZPrZl.js +9 -0
- package/dist/esm-es5/{buildCartItemsByTempCart-a117f75d.js → buildCartItemsByTempCart-BycjkdlE.js} +4 -0
- package/dist/esm-es5/cart-ekBk_gxV.js +517 -0
- package/dist/esm-es5/classes-BJHSB96f.js +10 -0
- package/dist/esm-es5/cleanHtmlMarkdown-ByGDytaN.js +191 -0
- package/dist/esm-es5/collect-33rMINDo.js +241 -0
- package/dist/esm-es5/containsNonLatinChars-C04AWRC2.js +11 -0
- package/dist/esm-es5/createCustomEvent-XQfWgQLB.js +6 -0
- package/dist/esm-es5/debounce-D4ko2kvZ.js +153 -0
- package/dist/esm-es5/debounce-DWPsxJsW.js +1 -0
- package/dist/esm-es5/formatStringWithLinks-BcMPqGl0.js +8 -0
- package/dist/esm-es5/getBorderRadius-HwG64EKM.js +8 -0
- package/dist/esm-es5/getContrastColor-CfCPlW9U.js +14 -0
- package/dist/esm-es5/getGenericSettingsOverride-HeAZDwVW.js +4 -0
- package/dist/esm-es5/getMissingRequiredShippingFields-u1nhQzJ1.js +20 -0
- package/dist/esm-es5/handleFetch-D5GYDF-O.js +60 -0
- package/dist/esm-es5/hasInclusivePrice-CAVXi310.js +6 -0
- package/dist/esm-es5/helpers-DJIdCwJ5.js +23 -0
- package/dist/esm-es5/index-_lt63o7c.js +162 -0
- package/dist/esm-es5/index.js +227 -1
- package/dist/esm-es5/invoice-BNDWuVsD.js +13 -0
- package/dist/esm-es5/isColorVariable-DXXUq2Lv.js +11 -0
- package/dist/esm-es5/isContrastColor-CWLU13s9.js +5 -0
- package/dist/esm-es5/isDarkColor-YdrG78th.js +204 -0
- package/dist/esm-es5/isSameHostCheckoutLink-BxAHnL5J.js +16 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/localization-AOqYXGdP.js +332 -0
- package/dist/esm-es5/paypal-CW1D2XqZ.js +192 -0
- package/dist/esm-es5/placeTestOrder-nhmsLLOA.js +1 -0
- package/dist/esm-es5/renderCheckoutCurrency-BQANmZyM.js +13 -0
- package/dist/esm-es5/{renderFallback-b250f4e9.js → renderFallback-Cy03ZcWE.js} +1 -1
- package/dist/esm-es5/shouldRenderTaxIdInput-CKyZ6Zni.js +17 -0
- package/dist/esm-es5/shouldShowLanguageSelect-BQFCXouB.js +7 -0
- package/dist/esm-es5/styles-BTIeCf3T.js +6 -0
- package/dist/esm-es5/submitGtag-CCGQS060.js +45 -0
- package/dist/esm-es5/throttle-D5GyA3yr.js +46 -0
- package/dist/esm-es5/updateCheckoutSessionAttributes-eRSqdC74.js +8 -0
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +2966 -1
- package/dist/esm-es5/zonos-address-display_2.entry.js +46 -1
- package/dist/esm-es5/zonos-address_4.entry.js +179 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +49 -1
- package/dist/esm-es5/zonos-badge.entry.js +25 -1
- package/dist/esm-es5/zonos-banner.entry.js +7 -1
- package/dist/esm-es5/zonos-button_3.entry.js +116 -1
- package/dist/esm-es5/zonos-card_5.entry.js +33 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +666 -1
- package/dist/esm-es5/zonos-checkbox_2.entry.js +21 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1043 -1
- package/dist/esm-es5/zonos-collapse.entry.js +15 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +13 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +157 -1
- package/dist/esm-es5/zonos-collect.entry.js +171 -1
- package/dist/esm-es5/zonos-component.entry.js +10 -1
- package/dist/esm-es5/zonos-controller.entry.js +198 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +6 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +152 -1
- package/dist/esm-es5/zonos-elements.js +4 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +63 -1
- package/dist/esm-es5/zonos-hello.entry.js +121 -1
- package/dist/esm-es5/zonos-input.entry.js +16 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +7 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +133 -1
- package/dist/esm-es5/zonos-invoice.entry.js +115 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +14 -1
- package/dist/esm-es5/zonos-link.entry.js +4 -1
- package/dist/esm-es5/zonos-logo.entry.js +7 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +31 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +5 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +27 -1
- package/dist/esm-es5/zonos-text.entry.js +24 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +7 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +5 -1
- package/dist/esm-es5/zonosStore-DrIOAz4M.js +1153 -0
- package/dist/scripts/index.d.ts +1171 -521
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/__tests__/jsxWithChildren.types.d.ts +14 -0
- package/dist/types/__tests__/vitest-globals.d.ts +1 -0
- package/dist/types/components/store/checkout/cart.d.ts +9 -9
- package/dist/types/components/utils/api/checkItemRestrictions.d.ts +2 -2
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +5 -5
- package/dist/types/components/utils/checkout/isShippableCountry.d.ts +5 -1
- package/dist/types/components/utils/hello/detectItemRestrictions.d.ts +2 -2
- package/dist/types/components.d.ts +797 -147
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +127 -127
- package/dist/types/stencil-public-runtime.d.ts +205 -12
- package/dist/types/types/generated/graphql.frontend.types.d.ts +60 -60
- package/dist/types/types/generated/graphql.frontend.types.ts +55 -55
- package/dist/types/types/generated/graphql.internal.types.d.ts +1290 -1285
- package/dist/types/types/generated/graphql.internal.types.ts +1113 -1108
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-02ef0f99.system.entry.js +6 -0
- package/dist/zonos-elements/{p-1be53c82.entry.js → p-0466650f.entry.js} +1 -1
- package/dist/zonos-elements/p-04bfcd72.system.entry.js +152 -0
- package/dist/zonos-elements/p-04cc0dac.system.entry.js +198 -0
- package/dist/zonos-elements/p-058f07aa.system.entry.js +7 -0
- package/dist/zonos-elements/p-0f603278.system.entry.js +5 -0
- package/dist/zonos-elements/{p-bb09ee50.entry.js → p-128485dc.entry.js} +1 -1
- package/dist/zonos-elements/p-1568ab06.system.entry.js +117 -0
- package/dist/zonos-elements/p-2ba738ec.entry.js +1 -0
- package/dist/zonos-elements/{p-6afd5fab.entry.js → p-31ac495f.entry.js} +1 -1
- package/dist/zonos-elements/p-34d1545a.entry.js +1 -0
- package/dist/zonos-elements/p-39c8a898.entry.js +1 -0
- package/dist/zonos-elements/p-3ERbuo5a.js +1 -0
- package/dist/zonos-elements/p-450ed170.system.entry.js +46 -0
- package/dist/zonos-elements/p-4973f8d8.system.entry.js +180 -0
- package/dist/zonos-elements/p-49e7bb1e.system.entry.js +7 -0
- package/dist/zonos-elements/p-4a54f664.entry.js +1 -0
- package/dist/zonos-elements/p-4ab1c533.system.entry.js +4 -0
- package/dist/zonos-elements/p-5024df2d.system.entry.js +666 -0
- package/dist/zonos-elements/p-5562a955.system.entry.js +7 -0
- package/dist/zonos-elements/p-5836d426.system.entry.js +49 -0
- package/dist/zonos-elements/p-5a631080.system.entry.js +13 -0
- package/dist/zonos-elements/{p-2ce039e5.entry.js → p-5c08d36b.entry.js} +1 -1
- package/dist/zonos-elements/{p-aed4ffb2.entry.js → p-5d3079e8.entry.js} +1 -1
- package/dist/zonos-elements/p-64e7bc5b.entry.js +1 -0
- package/dist/zonos-elements/p-6b0afaa7.entry.js +1 -0
- package/dist/zonos-elements/p-6f742021.entry.js +1 -0
- package/dist/zonos-elements/p-7681798d.entry.js +1 -0
- package/dist/zonos-elements/p-7a5d2211.system.entry.js +115 -0
- package/dist/zonos-elements/{p-6de2f9c9.entry.js → p-7ae48e31.entry.js} +1 -1
- package/dist/zonos-elements/{p-f37150e8.entry.js → p-8328f44d.entry.js} +1 -1
- package/dist/zonos-elements/{p-171a7e1e.entry.js → p-844a743a.entry.js} +1 -1
- package/dist/zonos-elements/p-891b47d7.entry.js +1 -0
- package/dist/zonos-elements/p-89ddab88.entry.js +1 -0
- package/dist/zonos-elements/p-8cd3f1e2.entry.js +1 -0
- package/dist/zonos-elements/p-9818f823.entry.js +1 -0
- package/dist/zonos-elements/p-9b399685.system.entry.js +10 -0
- package/dist/zonos-elements/p-9b6482ef.entry.js +1 -0
- package/dist/zonos-elements/{p-2c44e013.entry.js → p-9ebe9a36.entry.js} +1 -1
- package/dist/zonos-elements/p-B2EZRfoq.system.js +193 -0
- package/dist/zonos-elements/p-B3GRrRtL.system.js +5 -0
- package/dist/zonos-elements/p-BANhKkF2.system.js +1 -0
- package/dist/zonos-elements/p-BDopxBpR.system.js +6 -0
- package/dist/zonos-elements/p-BJufDgh3.js +1 -0
- package/dist/zonos-elements/p-BLQFeIez.system.js +191 -0
- package/dist/zonos-elements/p-BNtWsPPP.system.js +7 -0
- package/dist/zonos-elements/p-BSgVcCxT.system.js +9 -0
- package/dist/zonos-elements/p-BXjdMMUy.js +1 -0
- package/dist/zonos-elements/p-BbgqQIHv.system.js +9 -0
- package/dist/zonos-elements/p-BgSx82zO.system.js +11 -0
- package/dist/zonos-elements/p-Bi-s0fp_.system.js +17 -0
- package/dist/zonos-elements/p-BtMauqj_.system.js +227 -0
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +5 -0
- package/dist/zonos-elements/p-C19J2XSh.js +1 -0
- package/dist/zonos-elements/p-C2QMVeWW.js +1 -0
- package/dist/zonos-elements/p-C2j7R11h.system.js +11 -0
- package/dist/zonos-elements/p-CEl4pzNq.js +1 -0
- package/dist/zonos-elements/p-CICjAi70.js +1 -0
- package/dist/zonos-elements/p-CIevpRv_.system.js +162 -0
- package/dist/zonos-elements/{p-344a6278.js → p-CJCoACvU.js} +2 -2
- package/dist/zonos-elements/p-CKBbIU4b.system.js +14 -0
- package/dist/zonos-elements/p-CKTIJ2Gr.js +1 -0
- package/dist/zonos-elements/p-CKhl__Kc.system.js +4 -0
- package/dist/zonos-elements/p-CPnR_T0a.system.js +1153 -0
- package/dist/zonos-elements/p-CQqNJo0D.system.js +13 -0
- package/dist/zonos-elements/p-CYdt69j5.system.js +241 -0
- package/dist/zonos-elements/p-CZl1nwqv.system.js +46 -0
- package/dist/zonos-elements/p-CaAod213.system.js +8 -0
- package/dist/zonos-elements/p-CaUXHglQ.system.js +153 -0
- package/dist/zonos-elements/{p-45bd8072.system.js → p-CeLaK0Ff.system.js} +1 -1
- package/dist/zonos-elements/p-CtEsvWI6.js +1 -0
- package/dist/zonos-elements/p-D-DawUYF.system.js +1 -0
- package/dist/zonos-elements/p-D0erXw7p.js +1 -0
- package/dist/zonos-elements/p-D31lQiWo.system.js +21 -0
- package/dist/zonos-elements/p-D5AtAlJx.system.js +13 -0
- package/dist/zonos-elements/p-DBOI98r5.system.js +7 -0
- package/dist/zonos-elements/{p-41dd1cb8.js → p-DE4a-QD5.js} +1 -1
- package/dist/zonos-elements/p-DGsEWFDU.system.js +8 -0
- package/dist/zonos-elements/{p-a4c7ee17.js → p-DHwpNxG9.js} +1 -1
- package/dist/zonos-elements/p-DIJaXkiE.system.js +332 -0
- package/dist/zonos-elements/{p-eef5b0cc.js → p-DJIdCwJ5.js} +1 -1
- package/dist/zonos-elements/p-DPW1yXt9.system.js +517 -0
- package/dist/zonos-elements/{p-6bdc5c96.js → p-DTgv0QpG.js} +1 -1
- package/dist/zonos-elements/p-DW-fW8yR.system.js +205 -0
- package/dist/zonos-elements/p-Dj-O6VfM.system.js +7 -0
- package/dist/zonos-elements/p-DjuFsKLG.js +1 -0
- package/dist/zonos-elements/p-DkpYo2Fs.js +1 -0
- package/dist/zonos-elements/p-DnjGkbEy.js +1 -0
- package/dist/zonos-elements/p-LypTHRUC.js +1 -0
- package/dist/zonos-elements/p-MfsSJh_D.system.js +8 -0
- package/dist/zonos-elements/p-YdrG78th.js +1 -0
- package/dist/zonos-elements/p-_lt63o7c.js +3 -0
- package/dist/zonos-elements/p-a38e62cc.entry.js +1 -0
- package/dist/zonos-elements/p-a6faab6a.entry.js +1 -0
- package/dist/zonos-elements/p-adfee3a3.entry.js +1 -0
- package/dist/zonos-elements/p-b14819ab.system.entry.js +14 -0
- package/dist/zonos-elements/{p-0c972ddf.entry.js → p-b68ca96f.entry.js} +1 -1
- package/dist/zonos-elements/p-b6deae2b.system.entry.js +5 -0
- package/dist/zonos-elements/p-bdba7d9e.system.entry.js +25 -0
- package/dist/zonos-elements/p-be64d823.system.entry.js +16 -0
- package/dist/zonos-elements/p-beeb9d36.system.entry.js +21 -0
- package/dist/zonos-elements/p-cadf6b63.system.entry.js +33 -0
- package/dist/zonos-elements/p-cc5306fe.system.entry.js +24 -0
- package/dist/zonos-elements/p-cc949df1.system.entry.js +7 -0
- package/dist/zonos-elements/p-cf5688f7.entry.js +1 -0
- package/dist/zonos-elements/p-d05Ku7gM.system.js +24 -0
- package/dist/zonos-elements/p-d33dfc78.system.entry.js +2966 -0
- package/dist/zonos-elements/{p-5d110c2b.entry.js → p-d4c4a00e.entry.js} +1 -1
- package/dist/zonos-elements/p-d55b9664.system.entry.js +157 -0
- package/dist/zonos-elements/p-daf9fa07.system.entry.js +133 -0
- package/dist/zonos-elements/p-dcdbc610.system.entry.js +27 -0
- package/dist/zonos-elements/p-e101d722.system.entry.js +63 -0
- package/dist/zonos-elements/{p-9639a8ed.entry.js → p-e284d329.entry.js} +1 -1
- package/dist/zonos-elements/{p-5227aa69.entry.js → p-e9320825.entry.js} +1 -1
- package/dist/zonos-elements/p-ea8790aa.entry.js +1 -0
- package/dist/zonos-elements/{p-6ee4e027.entry.js → p-eadaefdc.entry.js} +1 -1
- package/dist/zonos-elements/p-f27317d3.system.entry.js +31 -0
- package/dist/zonos-elements/p-f2cedbcd.system.entry.js +121 -0
- package/dist/zonos-elements/p-f57495dc.entry.js +1 -0
- package/dist/zonos-elements/p-f6ba59f6.system.entry.js +171 -0
- package/dist/zonos-elements/p-f6e0aeba.system.entry.js +1043 -0
- package/dist/zonos-elements/p-f8fd756a.system.entry.js +15 -0
- package/dist/zonos-elements/{p-7ada039e.entry.js → p-fe778437.entry.js} +1 -1
- package/dist/zonos-elements/{p-adfbf57b.js → p-i1iCWKdv.js} +1 -1
- package/dist/zonos-elements/p-lGLcGvEA.js +1 -0
- package/dist/zonos-elements/p-nOb4xPLF.system.js +17 -0
- package/dist/zonos-elements/p-nU86HJ5w.js +1 -0
- package/dist/zonos-elements/p-pfIceXbY.js +1 -0
- package/dist/zonos-elements/p-smUku7Ku.system.js +5 -0
- package/dist/zonos-elements/p-t_ClFAJR.js +1 -0
- package/dist/zonos-elements/p-uV7m6KrY.system.js +46 -0
- package/dist/zonos-elements/p-vN6p_rO1.system.js +11 -0
- package/dist/zonos-elements/p-zRjRcLMp.js +1 -0
- package/dist/zonos-elements/p-zVLAvre1.system.js +60 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/dist/zonos-elements/zonos-elements.js +1 -1
- package/loader/index.d.ts +1 -1
- package/package.json +28 -32
- package/dist/cjs/RemoveIcon-081ac073.js +0 -5
- package/dist/cjs/debounce-7ca3c878.js +0 -357
- package/dist/cjs/isDarkColor-a6e6fd5e.js +0 -1202
- package/dist/cjs/throttle-366c204b.js +0 -76
- package/dist/cjs/zonosStore-0af0b937.js +0 -3030
- package/dist/esm/RemoveIcon-9dc5dd1a.js +0 -3
- package/dist/esm/debounce-84ade9c2.js +0 -355
- package/dist/esm/isDarkColor-939d8e9c.js +0 -1199
- package/dist/esm/throttle-c4c24e86.js +0 -74
- package/dist/esm/zonosStore-eca1e364.js +0 -3017
- package/dist/esm-es5/VarianceTest-572cecf5.js +0 -1
- package/dist/esm-es5/cart-d04742f5.js +0 -1
- package/dist/esm-es5/classes-0d95c529.js +0 -1
- package/dist/esm-es5/cleanHtmlMarkdown-87d195f6.js +0 -1
- package/dist/esm-es5/collect-4c310a16.js +0 -1
- package/dist/esm-es5/containsNonLatinChars-2d8810c3.js +0 -1
- package/dist/esm-es5/createCustomEvent-58159025.js +0 -1
- package/dist/esm-es5/debounce-84ade9c2.js +0 -1
- package/dist/esm-es5/formatStringWithLinks-0d48f183.js +0 -1
- package/dist/esm-es5/getBorderRadius-1f7be586.js +0 -1
- package/dist/esm-es5/getContrastColor-4c0ae8c1.js +0 -1
- package/dist/esm-es5/getGenericSettingsOverride-0bc3e118.js +0 -1
- package/dist/esm-es5/getMissingRequiredShippingFields-f0878e32.js +0 -1
- package/dist/esm-es5/handleFetch-a844cac1.js +0 -1
- package/dist/esm-es5/hasInclusivePrice-d801be22.js +0 -1
- package/dist/esm-es5/helpers-2f6955b1.js +0 -1
- package/dist/esm-es5/index-cfd394c8.js +0 -13
- package/dist/esm-es5/invoice-86487dac.js +0 -1
- package/dist/esm-es5/isColorVariable-0a94004f.js +0 -1
- package/dist/esm-es5/isContrastColor-9fa0d013.js +0 -1
- package/dist/esm-es5/isDarkColor-939d8e9c.js +0 -1
- package/dist/esm-es5/isSameHostCheckoutLink-c1b88ab7.js +0 -1
- package/dist/esm-es5/localization-36a4dc22.js +0 -1
- package/dist/esm-es5/paypal-997935ab.js +0 -17
- package/dist/esm-es5/placeTestOrder-a53f2056.js +0 -1
- package/dist/esm-es5/renderCheckoutCurrency-e0e16eb7.js +0 -1
- package/dist/esm-es5/shouldRenderTaxIdInput-ef7b5860.js +0 -1
- package/dist/esm-es5/shouldShowLanguageSelect-328f50e2.js +0 -1
- package/dist/esm-es5/styles-6fc2fad9.js +0 -1
- package/dist/esm-es5/submitGtag-71c450b6.js +0 -1
- package/dist/esm-es5/throttle-c4c24e86.js +0 -1
- package/dist/esm-es5/updateCheckoutSessionAttributes-23b222de.js +0 -1
- package/dist/esm-es5/zonosStore-eca1e364.js +0 -1
- package/dist/zonos-elements/p-01174496.system.js +0 -1
- package/dist/zonos-elements/p-06f798ee.system.js +0 -1
- package/dist/zonos-elements/p-083a11cd.system.entry.js +0 -1
- package/dist/zonos-elements/p-08e7107d.js +0 -1
- package/dist/zonos-elements/p-0b29169b.js +0 -1
- package/dist/zonos-elements/p-0c327a57.system.entry.js +0 -1
- package/dist/zonos-elements/p-0d2f81ce.system.js +0 -1
- package/dist/zonos-elements/p-0e199a6c.system.entry.js +0 -1
- package/dist/zonos-elements/p-0ff845ec.js +0 -1
- package/dist/zonos-elements/p-117953db.system.entry.js +0 -1
- package/dist/zonos-elements/p-14afffa8.system.js +0 -1
- package/dist/zonos-elements/p-1834f486.js +0 -1
- package/dist/zonos-elements/p-1aa93d1e.system.js +0 -1
- package/dist/zonos-elements/p-1ac0c631.system.js +0 -1
- package/dist/zonos-elements/p-1b8771bb.js +0 -1
- package/dist/zonos-elements/p-1cdd27ec.js +0 -1
- package/dist/zonos-elements/p-1cfb5c2a.system.entry.js +0 -1
- package/dist/zonos-elements/p-1f8648c8.system.entry.js +0 -1
- package/dist/zonos-elements/p-23e7c655.system.js +0 -1
- package/dist/zonos-elements/p-2670438c.system.js +0 -1
- package/dist/zonos-elements/p-27660512.js +0 -1
- package/dist/zonos-elements/p-277b77e3.js +0 -1
- package/dist/zonos-elements/p-278abdcf.entry.js +0 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +0 -1
- package/dist/zonos-elements/p-2b97f7ed.js +0 -1
- package/dist/zonos-elements/p-2bbe9d91.js +0 -1
- package/dist/zonos-elements/p-2c7a425d.entry.js +0 -1
- package/dist/zonos-elements/p-2cab1746.system.entry.js +0 -1
- package/dist/zonos-elements/p-3490b6d0.entry.js +0 -1
- package/dist/zonos-elements/p-398d9022.system.js +0 -1
- package/dist/zonos-elements/p-3a26e5e7.system.entry.js +0 -1
- package/dist/zonos-elements/p-40a4c8a2.system.js +0 -1
- package/dist/zonos-elements/p-40af92a1.system.entry.js +0 -1
- package/dist/zonos-elements/p-4160bbc2.system.js +0 -1
- package/dist/zonos-elements/p-41f1697a.system.entry.js +0 -1
- package/dist/zonos-elements/p-4671fde7.entry.js +0 -1
- package/dist/zonos-elements/p-490d7fec.system.entry.js +0 -1
- package/dist/zonos-elements/p-4941c096.system.entry.js +0 -1
- package/dist/zonos-elements/p-4b159ff3.system.js +0 -1
- package/dist/zonos-elements/p-502d6eeb.js +0 -1
- package/dist/zonos-elements/p-50d088f7.system.entry.js +0 -1
- package/dist/zonos-elements/p-51e4e61a.system.entry.js +0 -1
- package/dist/zonos-elements/p-551fa762.system.js +0 -1
- package/dist/zonos-elements/p-5b990c91.entry.js +0 -1
- package/dist/zonos-elements/p-60832726.system.js +0 -1
- package/dist/zonos-elements/p-67426156.system.js +0 -1
- package/dist/zonos-elements/p-6890e060.system.js +0 -1
- package/dist/zonos-elements/p-6eaf7c9e.system.entry.js +0 -1
- package/dist/zonos-elements/p-7176f582.entry.js +0 -1
- package/dist/zonos-elements/p-7261e245.system.js +0 -13
- package/dist/zonos-elements/p-7352abe9.js +0 -1
- package/dist/zonos-elements/p-74230da8.system.js +0 -1
- package/dist/zonos-elements/p-76834a0a.system.entry.js +0 -1
- package/dist/zonos-elements/p-77993ba1.entry.js +0 -1
- package/dist/zonos-elements/p-78f8e594.entry.js +0 -1
- package/dist/zonos-elements/p-7ac8846c.system.js +0 -1
- package/dist/zonos-elements/p-7b525c75.system.js +0 -1
- package/dist/zonos-elements/p-7f688485.system.entry.js +0 -1
- package/dist/zonos-elements/p-7fbbdb0f.system.js +0 -1
- package/dist/zonos-elements/p-8861d47e.js +0 -1
- package/dist/zonos-elements/p-8a0b8175.system.entry.js +0 -1
- package/dist/zonos-elements/p-8a6c4017.js +0 -1
- package/dist/zonos-elements/p-8be02f3a.system.js +0 -1
- package/dist/zonos-elements/p-8d14cb66.entry.js +0 -1
- package/dist/zonos-elements/p-8e6338b9.entry.js +0 -1
- package/dist/zonos-elements/p-916228fb.system.js +0 -1
- package/dist/zonos-elements/p-944c1fb3.entry.js +0 -1
- package/dist/zonos-elements/p-947e4402.system.entry.js +0 -1
- package/dist/zonos-elements/p-96ab529e.entry.js +0 -1
- package/dist/zonos-elements/p-998975a3.system.js +0 -18
- package/dist/zonos-elements/p-9ad640b2.system.entry.js +0 -1
- package/dist/zonos-elements/p-9ecb9afc.system.entry.js +0 -1
- package/dist/zonos-elements/p-a04e2750.system.entry.js +0 -1
- package/dist/zonos-elements/p-a1bd3a53.system.js +0 -1
- package/dist/zonos-elements/p-a553e132.js +0 -1
- package/dist/zonos-elements/p-acb7dee1.system.entry.js +0 -1
- package/dist/zonos-elements/p-af19722c.system.js +0 -1
- package/dist/zonos-elements/p-b4ae66cb.system.entry.js +0 -1
- package/dist/zonos-elements/p-bcaffb85.system.entry.js +0 -1
- package/dist/zonos-elements/p-be6cd28c.system.entry.js +0 -1
- package/dist/zonos-elements/p-bf37ccc7.system.js +0 -1
- package/dist/zonos-elements/p-c0af11fe.system.js +0 -1
- package/dist/zonos-elements/p-c112fa12.system.entry.js +0 -1
- package/dist/zonos-elements/p-c4321a1a.system.js +0 -1
- package/dist/zonos-elements/p-c5d1217f.system.js +0 -1
- package/dist/zonos-elements/p-c7329333.entry.js +0 -1
- package/dist/zonos-elements/p-c756a59d.system.js +0 -1
- package/dist/zonos-elements/p-c77b049c.entry.js +0 -1
- package/dist/zonos-elements/p-ca87ada5.system.entry.js +0 -1
- package/dist/zonos-elements/p-ce75b047.js +0 -2
- package/dist/zonos-elements/p-d1a51fac.js +0 -1
- package/dist/zonos-elements/p-d6a73125.system.entry.js +0 -1
- package/dist/zonos-elements/p-d75726e5.system.entry.js +0 -1
- package/dist/zonos-elements/p-d938f42f.system.js +0 -1
- package/dist/zonos-elements/p-dd866ca3.system.entry.js +0 -1
- package/dist/zonos-elements/p-dd8a7bf4.entry.js +0 -1
- package/dist/zonos-elements/p-de58684b.system.js +0 -1
- package/dist/zonos-elements/p-e160b75f.js +0 -1
- package/dist/zonos-elements/p-e1ef3984.system.entry.js +0 -1
- package/dist/zonos-elements/p-e27b8e18.entry.js +0 -1
- package/dist/zonos-elements/p-e4b07f7d.system.entry.js +0 -1
- package/dist/zonos-elements/p-e4dc24e1.system.js +0 -1
- package/dist/zonos-elements/p-e5865ad9.system.js +0 -1
- package/dist/zonos-elements/p-e7d7afda.entry.js +0 -1
- package/dist/zonos-elements/p-ebbda085.system.js +0 -1
- package/dist/zonos-elements/p-f4720b0a.js +0 -1
- package/dist/zonos-elements/p-f8356934.system.entry.js +0 -1
- package/dist/zonos-elements/p-f9346f1c.entry.js +0 -1
- package/dist/zonos-elements/p-fc5f6113.js +0 -1
- package/dist/zonos-elements/p-fe28dbe6.entry.js +0 -1
- package/loader/package.json +0 -11
- /package/dist/cjs/{CheckoutConfig-27c82f94.js → CheckoutConfig-B7JRM7yr.js} +0 -0
- /package/dist/cjs/{ShortAddressCode-bec338b0.js → ShortAddressCode-C5l520-F.js} +0 -0
- /package/dist/cjs/{TaxId-cd9d490e.js → TaxId-Q6aDqqWv.js} +0 -0
- /package/dist/cjs/{VarianceTest-bec00ea8.js → VarianceTest-C98whVgO.js} +0 -0
- /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
- /package/dist/cjs/{buildCartItemsByTempCart-edddbf4b.js → buildCartItemsByTempCart-ILzonEjb.js} +0 -0
- /package/dist/cjs/{classes-b7918f56.js → classes-D_DL168u.js} +0 -0
- /package/dist/cjs/{cleanHtmlMarkdown-57147de7.js → cleanHtmlMarkdown-DpT-nZLH.js} +0 -0
- /package/dist/cjs/{containsNonLatinChars-2be5129b.js → containsNonLatinChars-D_OggJN6.js} +0 -0
- /package/dist/cjs/{createCustomEvent-7b6fad95.js → createCustomEvent-Cs5zGImL.js} +0 -0
- /package/dist/cjs/{getGenericSettingsOverride-c0ca32b9.js → getGenericSettingsOverride-CL6l6wvX.js} +0 -0
- /package/dist/cjs/{getHasMoreSpaceOnRight-4c94667f.js → getHasMoreSpaceOnRight-Cl50u1mb.js} +0 -0
- /package/dist/cjs/{isCollectMobileTablet-884d4280.js → isCollectMobileTablet-Cx2nZ15_.js} +0 -0
- /package/dist/cjs/{isColorVariable-525dbfa7.js → isColorVariable-CKoJdu9G.js} +0 -0
- /package/dist/cjs/{isInvoiceMobileTablet-dde41e4e.js → isInvoiceMobileTablet-CCqFYV6m.js} +0 -0
- /package/dist/cjs/{isSameHostCheckoutLink-6148cabb.js → isSameHostCheckoutLink-DbmQ7Ha4.js} +0 -0
- /package/dist/cjs/{styles-d1e64fb9.js → styles-nowYls3K.js} +0 -0
- /package/dist/esm/{CheckoutConfig-724d7bae.js → CheckoutConfig-D5SpFsQJ.js} +0 -0
- /package/dist/esm/{ShortAddressCode-7620e622.js → ShortAddressCode-nJ6oI8-n.js} +0 -0
- /package/dist/esm/{TaxId-63a14057.js → TaxId-Cye-evFK.js} +0 -0
- /package/dist/esm/{VarianceTest-572cecf5.js → VarianceTest-BJmZPrZl.js} +0 -0
- /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
- /package/dist/esm/{buildCartItemsByTempCart-a117f75d.js → buildCartItemsByTempCart-BycjkdlE.js} +0 -0
- /package/dist/esm/{classes-0d95c529.js → classes-BJHSB96f.js} +0 -0
- /package/dist/esm/{cleanHtmlMarkdown-87d195f6.js → cleanHtmlMarkdown-ByGDytaN.js} +0 -0
- /package/dist/esm/{containsNonLatinChars-2d8810c3.js → containsNonLatinChars-C04AWRC2.js} +0 -0
- /package/dist/esm/{createCustomEvent-58159025.js → createCustomEvent-XQfWgQLB.js} +0 -0
- /package/dist/esm/{getGenericSettingsOverride-0bc3e118.js → getGenericSettingsOverride-HeAZDwVW.js} +0 -0
- /package/dist/esm/{getHasMoreSpaceOnRight-70eb913a.js → getHasMoreSpaceOnRight-DAscqB23.js} +0 -0
- /package/dist/esm/{isCollectMobileTablet-111b0dd7.js → isCollectMobileTablet-DGlnuxEX.js} +0 -0
- /package/dist/esm/{isColorVariable-0a94004f.js → isColorVariable-DXXUq2Lv.js} +0 -0
- /package/dist/esm/{isInvoiceMobileTablet-1f7b614e.js → isInvoiceMobileTablet-Clej0Ffe.js} +0 -0
- /package/dist/esm/{isSameHostCheckoutLink-c1b88ab7.js → isSameHostCheckoutLink-BxAHnL5J.js} +0 -0
- /package/dist/esm/{styles-6fc2fad9.js → styles-BTIeCf3T.js} +0 -0
- /package/dist/esm-es5/{RemoveIcon-9dc5dd1a.js → RemoveIcon-C2QMVeWW.js} +0 -0
- /package/dist/esm-es5/{ShortAddressCode-7620e622.js → ShortAddressCode-nJ6oI8-n.js} +0 -0
- /package/dist/esm-es5/{TaxId-63a14057.js → TaxId-Cye-evFK.js} +0 -0
- /package/dist/esm-es5/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
- /package/dist/esm-es5/{getHasMoreSpaceOnRight-70eb913a.js → getHasMoreSpaceOnRight-DAscqB23.js} +0 -0
- /package/dist/esm-es5/{isCollectMobileTablet-111b0dd7.js → isCollectMobileTablet-DGlnuxEX.js} +0 -0
- /package/dist/esm-es5/{isInvoiceMobileTablet-1f7b614e.js → isInvoiceMobileTablet-Clej0Ffe.js} +0 -0
- /package/dist/zonos-elements/{p-2770ba48.system.js → p-0D0aCMu6.system.js} +0 -0
- /package/dist/zonos-elements/{p-b4b7f705.js → p-BJHSB96f.js} +0 -0
- /package/dist/zonos-elements/{p-0a377722.js → p-BJmZPrZl.js} +0 -0
- /package/dist/zonos-elements/{p-96d77739.js → p-BTIeCf3T.js} +0 -0
- /package/dist/zonos-elements/{p-56ba5cbf.system.js → p-BbPAtVJG.system.js} +0 -0
- /package/dist/zonos-elements/{p-11206fe2.js → p-BxAHnL5J.js} +0 -0
- /package/dist/zonos-elements/{p-cc6ad18a.js → p-ByGDytaN.js} +0 -0
- /package/dist/zonos-elements/{p-83666056.js → p-BycjkdlE.js} +0 -0
- /package/dist/zonos-elements/{p-0c64dbbb.js → p-C04AWRC2.js} +0 -0
- /package/dist/zonos-elements/{p-655ec440.system.js → p-C29tlYn0.system.js} +0 -0
- /package/dist/zonos-elements/{p-2adbbce7.system.js → p-CLDnjFm5.system.js} +0 -0
- /package/dist/zonos-elements/{p-989cb22b.system.js → p-Cby4EkFu.system.js} +0 -0
- /package/dist/zonos-elements/{p-1f3549c6.js → p-Clej0Ffe.js} +0 -0
- /package/dist/zonos-elements/{p-bcf5cffb.js → p-Cye-evFK.js} +0 -0
- /package/dist/zonos-elements/{p-b2d81c98.js → p-D5SpFsQJ.js} +0 -0
- /package/dist/zonos-elements/{p-5883217a.js → p-DAscqB23.js} +0 -0
- /package/dist/zonos-elements/{p-579932a7.js → p-DGlnuxEX.js} +0 -0
- /package/dist/zonos-elements/{p-e1255160.js → p-DQuL1Twl.js} +0 -0
- /package/dist/zonos-elements/{p-ae393255.js → p-DXXUq2Lv.js} +0 -0
- /package/dist/zonos-elements/{p-e7b0c156.js → p-HeAZDwVW.js} +0 -0
- /package/dist/zonos-elements/{p-595f5dd2.js → p-XQfWgQLB.js} +0 -0
- /package/dist/zonos-elements/{p-bc7bf53e.system.js → p-Z99tSPFR.system.js} +0 -0
- /package/dist/zonos-elements/{p-6f23a26a.system.js → p-_GDmY2H7.system.js} +0 -0
- /package/dist/zonos-elements/{p-1d42cd20.js → p-nJ6oI8-n.js} +0 -0
|
@@ -1 +1,2966 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function d(e){try{a(o.next(e))}catch(e){i(e)}}function s(e){try{a(o["throw"](e))}catch(e){i(e)}}function a(e){e.done?r(e.value):n(e.value).then(d,s)}a((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,d;return d={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(d[Symbol.iterator]=function(){return this}),d;function s(e){return function(t){return a([e,t])}}function a(s){if(o)throw new TypeError("Generator is already executing.");while(d&&(d=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++){if(i||!(o in t)){if(!i)i=Array.prototype.slice.call(t,0,o);i[o]=t[o]}}return e.concat(i||Array.prototype.slice.call(t))};import{r as registerInstance,d as createEvent,h,a as Host,g as getElement}from"./index-cfd394c8.js";import{t as translate,s as storageStore,A as storageStoreOnChange,l as localizationStore}from"./localization-36a4dc22.js";import{z as zonosStore,f as zonosStoreFontFamily}from"./zonosStore-eca1e364.js";import{M as MIN_POSTAL_CODE_LENGTH}from"./getMissingRequiredShippingFields-f0878e32.js";import{c as classes}from"./classes-0d95c529.js";import{W as extractName,b as stripeStore,w as stripeStorePrefetchLandedCost,t as trackConversionEvent}from"./cart-d04742f5.js";import{R as RemoveIcon$1}from"./RemoveIcon-9dc5dd1a.js";import{i as isTextContainsNonLatinChars,c as containsNonLatinChars}from"./containsNonLatinChars-2d8810c3.js";import{g as getBorderRadius}from"./getBorderRadius-1f7be586.js";import{t as throttle_1}from"./throttle-c4c24e86.js";import{i as isCheckoutMobile}from"./handleFetch-a844cac1.js";import{a as shouldRenderTaxIdInput,s as shouldRenderShortAddressCodeInput}from"./shouldRenderTaxIdInput-ef7b5860.js";import{l as log}from"./VarianceTest-572cecf5.js";import{c as countryRequireTaxId,s as shipToTaxIdLabels}from"./TaxId-63a14057.js";import{i as inheritAriaAttributes,a as inheritAttributes}from"./helpers-2f6955b1.js";import{i as isDarkColor}from"./isDarkColor-939d8e9c.js";import"./debounce-84ade9c2.js";import"./ShortAddressCode-7620e622.js";var zonosAddressCompletionDialogCss=":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--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:24px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding-bottom:5px;gap:20px;-ms-scroll-chaining:chained;overscroll-behavior:auto}:host .zonos--selected-address{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px}:host .zonos--completion-fields{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:16px}:host .zonos--completion-name-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--completion-name-row zonos-input{-ms-flex:1;flex:1}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--completion-name-row{-ms-flex-direction:column;flex-direction:column}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--submit-btn{-ms-flex-order:1;order:1}";var ZonosAddressCompletionDialogStyle0=zonosAddressCompletionDialogCss;var ZonosAddressCompletionDialog=function(){function e(e){var t=this;registerInstance(this,e);this.closeCompletionDialog=createEvent(this,"closeCompletionDialog",7);this.completionSubmit=createEvent(this,"completionSubmit",7);this.continueLoading=false;this.dialogOpen=false;this.isMobile=false;this.missingFields=[];this.values={};this.showError=false;this.isFieldMissing=function(e){return t.missingFields.some((function(t){return t.key===e}))};this.isFieldValid=function(e){var r,o,n;if(e==="postal_code"){return((o=(r=t.values.postal_code)===null||r===void 0?void 0:r.trim().length)!==null&&o!==void 0?o:0)>=MIN_POSTAL_CODE_LENGTH}return!!((n=t.values[e])===null||n===void 0?void 0:n.trim())};this.getFieldError=function(e){return t.showError&&!t.isFieldValid(e)};this.updateValue=function(e,r){var o;t.values=Object.assign(Object.assign({},t.values),(o={},o[e]=r,o));if(t.showError){t.showError=!t.isComplete()}};this.isComplete=function(){return t.missingFields.every((function(e){if(e.key==="lastName"){return t.isFieldValid("firstName")&&t.isFieldValid("lastName")}return t.isFieldValid(e.key)}))};this.submitHandler=function(){if(!t.isComplete()){t.showError=true;return}t.completionSubmit.emit(t.values)};this.renderInput=function(e){var r=e.key,o=e.label;return h("zonos-input",{class:"zonos--completion-input zonos--completion-".concat(r),inputLabel:o,inputValue:t.values[r]||"",isError:t.getFieldError(r),onInputChange:function(e){return t.updateValue(r,e.detail)}})};this.renderField=function(e,r){if(!t.isFieldMissing(e)){return null}return t.renderInput({key:e,label:r})};this.renderNameFields=function(){if(!t.isFieldMissing("lastName")){return null}return h("div",{class:"zonos--completion-name-row"},t.renderInput({key:"firstName",label:translate("First name")}),t.renderInput({key:"lastName",label:translate("Last name")}))}}e.prototype.watchDialogOpen=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(o){switch(o.label){case 0:if(!e)return[3,2];return[4,new Promise((function(e){return setTimeout(e,100)}))];case 1:o.sent();r=extractName({name:(t=this.shippingAddress)===null||t===void 0?void 0:t.name}).firstName;this.values=this.isFieldMissing("lastName")?{firstName:r}:{};this.showError=false;o.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e=this;var t=this.submitBtnColor||zonosStore.appearance.colorSecondary;var r=t==="#ffffff"?"outline":this.submitBtnType||"standard";return h(Host,{key:"9a89376022ebd8f5793882fb13a3502deca001f8",class:classes(["zonos--address-completion-dialog zonos--elements",this.isMobile&&"mobile"])},h("zonos-dialog",{key:"00ff3912a7bf8d021441440f0de2825b49f7b78e",isLoading:false,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeCompletionDialog.emit()},open:this.dialogOpen,width:"568px"},h("div",{key:"1ba1cd333bd1f362a77f1f114ac50c309ed5ccd6",class:"zonos--body"},h("div",{key:"ccf9f54ff4b26e5443ff5c8276e5c5d36aac332b",class:"zonos--dialog-header"},h("div",{key:"01e073aa559c4040a6599aefb3bf8cb967928929",class:"zonos--dialog-title"},h("zonos-text",{key:"8472a72f6274646bb87d150c82722f93c861ae72",type:"title"},translate("Complete your shipping address")),h("zonos-button",{key:"e9a6c2cbc3d64bf87e94850c1126119687f75e7d",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon$1}),noBackground:true,onClick:function(){return e.closeCompletionDialog.emit()},title:"Close checkout dialog"})),h("zonos-text",{key:"c9ff785b746810f0c266071ee9a3f433ad645a2b"},translate("This saved address is missing information required to ship internationally. Please add the details below."))),h("div",{key:"86e2b0da7dbcd1370b80fc8c53e8a7de4c11ed74",class:"zonos--group"},h("div",{key:"1542bb7f0b9df16f5ce36d38dc9408a1b3e836a7",class:"zonos--selected-address"},h("zonos-text",{key:"2572e3e44a9c81f6694e4939de39951ec659c8fa",class:"zonos--selected-label",type:"semiBoldLabel"},translate("Selected address")),h("zonos-address-display",{key:"8781622b3d057cfbdba59e13d5fabf76f3a7a7dd",addressType:"shipping",currentAddress:this.shippingAddress})),h("div",{key:"ac3a5f6566c2179045a784b661b7e82c7b371a3f",class:"zonos--completion-fields"},this.renderNameFields(),this.renderField("state",translate("State/Province")),this.renderField("postal_code",translate("Postal code")))),h("div",{key:"1007d7f6c671fbd94dd3027332d2d7ac1edeef6e",class:"zonos--group-btn"},h("div",{key:"22fe2c8d03d7b3c680eea2b4afebf1868b5b6c0b",class:"zonos--button-wrapper"},h("zonos-button",{key:"dbcf1aa175992bff762ecc36108bf94090b7df0e",class:"zonos--cancel-btn",onClick:function(){return e.closeCompletionDialog.emit()},variant:"subtle"},translate("Cancel")),h("zonos-button",{key:"63b0f966565e86ea9bac640b2fa690287c94b11f",backgroundColor:this.submitBtnColor,class:"zonos--submit-btn",loading:this.continueLoading,onClick:function(){return e.submitHandler()},size:"sm",variant:r},translate("Save and continue")))))))};Object.defineProperty(e,"watchers",{get:function(){return{dialogOpen:["watchDialogOpen"]}},enumerable:false,configurable:true});return e}();ZonosAddressCompletionDialog.style=ZonosAddressCompletionDialogStyle0;var zonosAddressFormCss=":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--title{margin-bottom:20px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:1px}:host .zonos--contact{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--address-row>*{-ms-flex:1;flex:1}:host .zonos--address{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}";var ZonosAddressFormStyle0=zonosAddressFormCss;var ZonosAddressForm=function(){function e(e){var t=this;registerInstance(this,e);this.addressChange=createEvent(this,"addressChange",7);this.localAddress=this.currentAddress;this.onInputChange=function(e){var r;var o=e.key,n=e.value;t.addressChange.emit(Object.assign(Object.assign({},t.localAddress),(r={},r[o]=n,r)))}}e.prototype.watchCurrentAddress=function(){var e,t,r,o,n,i;var d=this.currentAddress,s=d.city,a=d.line1,u=d.line2,l=d.name,$=d.postal_code,c=d.state;this.localAddress=Object.assign(Object.assign({},this.currentAddress),{city:((e=this.translatedAddress.city)===null||e===void 0?void 0:e[s])||s,line1:((t=this.translatedAddress.line1)===null||t===void 0?void 0:t[a])||a,line2:((r=this.translatedAddress.line2)===null||r===void 0?void 0:r[u])||u,name:((o=this.translatedAddress.name)===null||o===void 0?void 0:o[l])||l,postal_code:((n=this.translatedAddress.postal_code)===null||n===void 0?void 0:n[$])||$,state:((i=this.translatedAddress.state)===null||i===void 0?void 0:i[c])||c})};e.prototype.componentWillLoad=function(){this.watchCurrentAddress()};e.prototype.render=function(){var e=this;var t=this.localAddress,r=t.city,o=t.country,n=t.line1,i=t.line2,d=t.name,s=t.phone,a=t.postal_code,u=t.state;var l=extractName({name:d}),$=l.firstName,c=l.lastName;return h(Host,{key:"44edb799473e427b08e17d6d20f08a028a3cc688",class:"zonos--address-form zonos--elements"},h("div",{key:"99c2d5b58464bebd7bb3e5c2a4ac3aa04d80b47f",class:"zonos--title"},h("zonos-text",{key:"5a86048c7d768b795db1416182e2b22458924601",textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{key:"a907058d970cb6674b403f79c0946e36a0e61f69",class:"zonos--address-group"},h("div",{key:"fad2f71614c6963015f95e74e297c58a4adee95b",class:"zonos--contact"},h("zonos-text",{key:"0c661050b1b95da56af1046fac39c7fa6de18685",type:"label"},translate("Contact")),h("zonos-input",{key:"3e35a5f9d4bca373ef9403da0de53ea895aca61f",class:"zonos--form-email",inputLabel:translate("Email"),inputValue:this.currentAddress.email,isDisabled:true}),h("div",{key:"093cdcc771b4ade381a392a1023d9d037d4e3e35",class:"zonos--name zonos--address-row"},h("zonos-input",{key:"e9d957551070a855179b78da655beaf3b4e731e2",class:"zonos--form-first-name",inputLabel:translate("First name"),inputValue:$,isError:isTextContainsNonLatinChars($),onInputChange:function(t){return e.onInputChange({key:"name",value:"".concat(t.detail," ").concat(c)})}}),h("zonos-input",{key:"0b86805e872607d367446f5e6ef074974f9840c2",class:"zonos--form-last-name",inputLabel:translate("Last name"),inputValue:c,isError:isTextContainsNonLatinChars(c),onInputChange:function(t){return e.onInputChange({key:"name",value:"".concat($," ").concat(t.detail)})}}))),h("div",{key:"6447f55e8d173d18cd46cba829527c4d487631a2",class:"zonos--address"},h("zonos-text",{key:"18ef146cc44f658524c6535e851281b62249fa26",type:"label"},translate("Address")),h("zonos-input",{key:"95cfb115c4304e8a142ab2e952fc8c4bfbe39e43",class:"zonos--form-country",inputLabel:translate("Country"),inputValue:o,isDisabled:true}),h("zonos-input",{key:"e3774713ec0b0e861981aa9f2c62f6749125e174",class:"zonos--form-line1",inputLabel:translate("Address line 1"),inputValue:n,isError:isTextContainsNonLatinChars(n),onInputChange:function(t){return e.onInputChange({key:"line1",value:t.detail})}}),h("zonos-input",{key:"0d1fce85ad42e42b266ad411d4e3a96e4b8b8bf3",class:"zonos--form-line2",inputLabel:translate("Address line 2"),inputValue:i,isError:isTextContainsNonLatinChars(i),onInputChange:function(t){return e.onInputChange({key:"line2",value:t.detail})}}),h("div",{key:"5d5e740b711ff65a0366a6c4891f22684f32c74b",class:"zonos--address-row"},h("zonos-input",{key:"8f124a91865c59096ba5c624ec229a3d1545c985",class:"zonos--form-city",inputLabel:translate("City"),inputValue:r,isError:isTextContainsNonLatinChars(r),onInputChange:function(t){return e.onInputChange({key:"city",value:t.detail})}}),this.currentAddress.state&&h("zonos-input",{key:"50e852953ba88573929a200bce4c67fab2146245",class:"zonos--form-state",inputLabel:translate("State/Province"),inputValue:u,isError:isTextContainsNonLatinChars(u),onInputChange:function(t){return e.onInputChange({key:"state",value:t.detail})}})),h("zonos-input",{key:"74c17f1d1a77af3f90100a6832b2c8fe7bdca24e",class:"zonos--form-postal-code",inputLabel:translate("Postal code"),inputValue:a,isError:isTextContainsNonLatinChars(a),onInputChange:function(t){return e.onInputChange({key:"postal_code",value:t.detail})}}),h("zonos-input",{key:"20775c4a944fe9305446898109637e5b38229a1d",class:"zonos--form-phone",inputLabel:translate("Phone number"),inputValue:s,onInputChange:function(t){return e.onInputChange({key:"phone",value:t.detail})}}))))};Object.defineProperty(e,"watchers",{get:function(){return{translatedAddress:["watchCurrentAddress"]}},enumerable:false,configurable:true});return e}();ZonosAddressForm.style=ZonosAddressFormStyle0;var RemoveIcon='<svg color="var(--zonos-elements-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-gray-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosAddressSuggestionsCss=":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:relative}:host .wrapper{position:absolute;margin-top:4px;top:100%;left:0;right:0;z-index:3;max-height:300px;overflow-y:auto;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));-webkit-box-shadow:var(--zonos-elements-shadow-select-active);box-shadow:var(--zonos-elements-shadow-select-active);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;list-style:none;padding:0;background-color:var(--zonos-elements-surface-color)}:host .wrapper .option{padding:8px;background-color:var(--zonos-elements-surface-color);outline:none;border:none;text-align:left}:host .wrapper .option.last-hovered{background-color:var(--zonos-elements-gray-100)}:host .wrapper .option .highlight{font-weight:600;color:var(--zonos-elements-gray-1000)}:host .wrapper>.powered-by{padding:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}:host .wrapper>.powered-by .powered-by-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;gap:5px;-ms-flex:1;flex:1}:host .wrapper>.suggestion{cursor:pointer}:host .wrapper>.suggestion:hover{background-color:var(--zonos-elements-gray-100)}";var ZonosAddressSuggestionsStyle0=zonosAddressSuggestionsCss;var ZonosAddressSuggestions=function(){function e(e){var t=this;registerInstance(this,e);this.suggestionSelected=createEvent(this,"suggestionSelected",7);this.suggestions=[];this.selectedSuggestionId=null;this.localSuggestions=[];this.lastHoveredSuggestionId=null;this.handleClickOutside=function(e){if(!t.el.contains(e.target)){t.localSuggestions=[]}}}e.prototype.suggestionsChanged=function(){var e,t;this.localSuggestions=this.suggestions;this.lastHoveredSuggestionId=(t=(e=this.suggestions[0])===null||e===void 0?void 0:e.id)!==null&&t!==void 0?t:null};e.prototype.componentDidLoad=function(){document.addEventListener("click",this.handleClickOutside)};e.prototype.disconnectedCallback=function(){document.removeEventListener("click",this.handleClickOutside)};e.prototype.getHighlightedText=function(e,t){if(!(t===null||t===void 0?void 0:t.length))return[{isMatch:false,text:e}];var r=[];var o=0;var n=__spreadArray([],t,true).sort((function(e,t){return e.startOffset-t.startOffset}));n.forEach((function(t){if(t.startOffset>o){r.push({isMatch:false,text:e.slice(o,t.startOffset)})}r.push({isMatch:true,text:e.slice(t.startOffset,t.endOffset)});o=t.endOffset}));if(o<e.length){r.push({isMatch:false,text:e.slice(o)})}return r};e.prototype.render=function(){var e=this;return h(Host,{key:"9de4179f1bd0057ac71d6b9ed646c034035382f7",class:"zonos--address-suggestions",role:"group",style:{"--zonos--border-radius":getBorderRadius()}},h("ul",{key:"62fa5ed92fafcdd641f9a7eb36e36e62309c9f52","aria-label":"Suggestions",class:"wrapper",role:"listbox"},!!this.localSuggestions.length&&h("li",{key:"27c61b5693720d0b33a75385841476787f92b884","aria-selected":false,class:"powered-by option",role:"option"},h("div",{key:"fea9f2e8f65cd50fdf28fc45e18beb8976320f0d",class:"powered-by-container"},h("zonos-text",{key:"1fec46f543e3673433b6924f7dca1cbd84e0ef16",type:"caption"},"Suggestions powered by"),h("zonos-text",{key:"7b3fd93c18d4320522d61e07278f5388d14c8bbb",type:"semiBoldLabel"},"Google")),h("zonos-button",{key:"61a8362ab0514a78dd71eaa9bd638dc8b50e2a9c","aria-label":"Clear suggestions",icon:h("zonos-icon",{content:RemoveIcon}),noBackground:true,onClick:function(){e.localSuggestions=[]}})),this.localSuggestions.map((function(t){return h("li",{"aria-selected":e.selectedSuggestionId===t.id,class:classes(["suggestion","option",e.lastHoveredSuggestionId===t.id&&"last-hovered"]),key:t.id,onClick:function(){e.selectedSuggestionId=t.id;e.suggestionSelected.emit({placeId:t.id,type:e.type})},onMouseEnter:function(){e.lastHoveredSuggestionId=t.id},role:"option",tabIndex:0},h("zonos-text",null,e.getHighlightedText(t.place,t.matches).map((function(e,t){return h("span",{class:e.isMatch?"highlight":undefined,key:"".concat(t,"-").concat(e.text)},e.text)}))))}))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{suggestions:["suggestionsChanged"]}},enumerable:false,configurable:true});return e}();ZonosAddressSuggestions.style=ZonosAddressSuggestionsStyle0;var zonosAddressUpdateDialogCss=":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--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--group{-ms-scroll-chaining:chained;overscroll-behavior:auto}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";var ZonosAddressUpdateDialogStyle0=zonosAddressUpdateDialogCss;var ZonosAddressUpdateDialog=function(){function e(e){var t=this;registerInstance(this,e);this.closeUpdateDialog=createEvent(this,"closeUpdateDialog",7);this.continueClicked=createEvent(this,"continueClicked",7);this.continueLoading=false;this.dialogOpen=false;this.isMobile=false;this.showErrorBanner=false;this.translatedShippingAddressState={};this.translatedBillingAddressState={};this.closeUpdateDialogHandler=function(){t.closeUpdateDialog.emit()};this.getTranslatedAddress=function(e){var t=e.currentAddress,r=e.translatedAddress;var o,n,i,d,s,a;var u=t.city,l=t.line1,$=t.line2,c=t.name,f=t.postal_code,h=t.state;return{city:((o=r.city)===null||o===void 0?void 0:o[u])||u,line1:((n=r.line1)===null||n===void 0?void 0:n[l])||l,line2:((i=r.line2)===null||i===void 0?void 0:i[$])||$,name:((d=r.name)===null||d===void 0?void 0:d[c])||c,postal_code:((s=r.postal_code)===null||s===void 0?void 0:s[f])||f,state:((a=r.state)===null||a===void 0?void 0:a[h])||h}};this.continueClickHandler=function(){return __awaiter(t,void 0,void 0,(function(){var e,t,r,o,n,i,d,s,a,u,l,$,c;return __generator(this,(function(f){this.continueLoading=true;o=this.billingAddress?this.getTranslatedAddress({currentAddress:this.billingAddress,translatedAddress:this.translatedBillingAddressState}):null;n=this.getTranslatedAddress({currentAddress:this.shippingAddress,translatedAddress:this.translatedShippingAddressState});i=containsNonLatinChars(Object.assign(Object.assign({},n),{country:this.shippingAddress.country}));d=o&&this.billingAddress&&containsNonLatinChars(Object.assign(Object.assign({},o),{country:this.billingAddress.country}));s=!!Object.keys(i).length;a=!!d&&!!Object.keys(d).length;if(s||a){u=(e=this.el.shadowRoot)===null||e===void 0?void 0:e.querySelectorAll("zonos-address-form");l=u===null||u===void 0?void 0:u[0];$=u===null||u===void 0?void 0:u[1];c=((t=l===null||l===void 0?void 0:l.shadowRoot)===null||t===void 0?void 0:t.querySelector(".has-error"))||((r=$===null||$===void 0?void 0:$.shadowRoot)===null||r===void 0?void 0:r.querySelector(".has-error"));if(c){c.scrollIntoView({behavior:"smooth",block:"center"})}this.continueLoading=false;return[2]}this.continueClicked.emit({billingAddress:o,shippingAddress:n});return[2]}))}))};this.buildTranslateAddressState=function(e){var t,r,o,n,i,d;var s=e.currentAddress,a=e.translatedAddress;var u=s.city,l=s.line1,$=s.line2,c=s.name,f=s.postal_code,h=s.state;return{city:(t={},t[u]=a.city,t),line1:(r={},r[l]=a.line1,r),line2:(o={},o[$]=a.line2,o),name:(n={},n[c]=a.name,n),postal_code:(i={},i[f]=a.postal_code,i),state:(d={},d[h]=a.state,d)}}}e.prototype.watchTranslatedShippingAddress=function(){this.translatedShippingAddressState=this.translatedShippingAddress};e.prototype.watchTranslatedBillingAddress=function(){this.translatedBillingAddressState=this.translatedBillingAddress};e.prototype.componentWillLoad=function(){this.watchTranslatedBillingAddress();this.watchTranslatedShippingAddress()};e.prototype.render=function(){var e=this;var t=this.submitBtnColor||zonosStore.appearance.colorSecondary;var r=t==="#ffffff"?"outline":this.submitBtnType||"standard";var o=this.billingAddress;var n=this.shippingAddress;return h(Host,{key:"655845cef04f4af526b1a1c4e49243c4f2b4c7f6",class:classes(["zonos--address-update-dialog zonos--elements",this.isMobile&&"mobile"])},h("zonos-dialog",{key:"eab429bb78ce6f05ba463d8748d7edd5499402fa",isLoading:this.dialogLoading,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeUpdateDialog.emit()},open:this.dialogOpen,width:"568px"},h("div",{key:"08f0400e62addfcaffd91bf5200999d29bbd2da9",class:"zonos--body"},h("div",{key:"8699df5e2f823e19066fbb552ba2a66c127c05e9",class:"zonos--dialog-header"},h("div",{key:"92e0ff932dcdb0e5b59ea34b688d1ef8e31bfeb3",class:"zonos--dialog-title"},h("zonos-text",{key:"aaac3375526bddb319ce7c8f49bde30da7210264",type:"title"},translate("Update your address")),h("zonos-button",{key:"474cc2421cd3150daa46bfe215da6ae7df9c6087",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon$1}),noBackground:true,onClick:function(){return e.closeUpdateDialogHandler()},title:"Close checkout dialog"})),h("zonos-text",{key:"6d019250cce57e8b30dd790a184df7273bdb234f"},translate("To ensure delivery all address details must be in Latin characters."))),h("div",{key:"80ee681844f4f4f43fce69d977b634b1fbc3d5f5",class:"zonos--group"},h("zonos-text",{key:"940e510eceec156a74f32de84cf58ffebd796435",class:"zonos--what-you-entered",type:"semiBoldLabel"},translate("What you entered")),h("div",{key:"f626127f5c399c29ab1022deb66aaee8f8a49601",class:"zonos--address-display-group"},h("zonos-address-display",{key:"9dfcba1037325c3a1f9e82b8e4797e7872dd7e3f",addressType:"shipping",currentAddress:n}),o&&h("zonos-address-display",{key:"fee8ae2c6786d735133c2a0a42f3e3d40d7f9ea9",addressType:"billing",currentAddress:o})),h("div",{key:"5a82195018ff8cdfd1126f4424062a26c25ee757",class:"zonos--address-form-section"},h("zonos-text",{key:"f694dfad166697e4c034cea51057133b69b1c144",type:"semiBoldLabel"},translate("Translated address")),h("zonos-address-form",{key:"4a99c841cf4800de43c612cce3d56d956d02c22f",addressType:"shipping",class:"zonos--shipping-address-form",currentAddress:n,onAddressChange:function(t){var r=t.detail;e.translatedShippingAddressState=e.buildTranslateAddressState({currentAddress:n,translatedAddress:r})},translatedAddress:this.translatedShippingAddressState}),o&&h("zonos-address-form",{key:"311fd702d29a9517203597890bd46bd268dfc6d3",addressType:"billing",class:"zonos--billing-address-form",currentAddress:o,onAddressChange:function(t){var r=t.detail;e.translatedBillingAddressState=e.buildTranslateAddressState({currentAddress:o,translatedAddress:r})},translatedAddress:this.translatedBillingAddressState}))),h("div",{key:"918c3271579c3fc7a7efff0473b0ccf48fb575a2",class:"zonos--group-btn"},h("div",{key:"f73be0c1124d3a4d340bc6e8512f6be8356c655d",class:"zonos--button-wrapper"},h("zonos-button",{key:"172a6cc0a7b75afb400802ef6b87faae6e7e2483",class:"zonos--cancel-btn",onClick:function(){return e.closeUpdateDialogHandler()},variant:"subtle"},translate("Cancel")),h("zonos-button",{key:"8fd08bc79b60eb9a0064c06ff9d840b1ecb09123",backgroundColor:this.submitBtnColor,class:"zonos--update-btn",loading:this.continueLoading,onClick:function(){return e.continueClickHandler()},size:"sm",variant:r},translate("Update address")))))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{translatedShippingAddress:["watchTranslatedShippingAddress"],translatedBillingAddress:["watchTranslatedBillingAddress"]}},enumerable:false,configurable:true});return e}();ZonosAddressUpdateDialog.style=ZonosAddressUpdateDialogStyle0;var isValidZip=function(e){var t=e.countryFields,r=e.zip;if(!t){return true}if(!t.zipShow){return true}if(!t.zipRequired){return true}if(t.zipRegex){return new RegExp(t.zipRegex).test(r)}return t.zipRequired&&!!r};var hasCountries=function(e){return!!e&&Object.keys(e).length>0};var getAddressCountryOptions=function(e){var t=e.allCountries,r=e.shippingZoneCountries,o=e.type;var n=o==="billing"&&hasCountries(t)?t:r;return Object.values(n||{}).map((function(e){return{label:e.displayName,value:e.code}})).sort((function(e,t){return e.label.localeCompare(t.label)}))};var mergeAddress=function(e){var t=e.addresses,r=e.delimiter,o=r===void 0?" ":r;var n=new Set(t.filter(Boolean));return Array.from(n).join(o)};var zonosCustomAddressCss=".sc-zonos-custom-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-custom-address-h *.sc-zonos-custom-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-custom-address-h img.sc-zonos-custom-address{max-width:100%}.sc-zonos-custom-address-h dl.sc-zonos-custom-address,.sc-zonos-custom-address-h dd.sc-zonos-custom-address,.sc-zonos-custom-address-h h1.sc-zonos-custom-address,.sc-zonos-custom-address-h h2.sc-zonos-custom-address,.sc-zonos-custom-address-h h3.sc-zonos-custom-address,.sc-zonos-custom-address-h h4.sc-zonos-custom-address,.sc-zonos-custom-address-h h5.sc-zonos-custom-address,.sc-zonos-custom-address-h h6.sc-zonos-custom-address,.sc-zonos-custom-address-h hr.sc-zonos-custom-address,.sc-zonos-custom-address-h figure.sc-zonos-custom-address,.sc-zonos-custom-address-h p.sc-zonos-custom-address,.sc-zonos-custom-address-h pre.sc-zonos-custom-address{margin:0}.sc-zonos-custom-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-custom-address-h .zonos--title.sc-zonos-custom-address{margin-bottom:16px}.sc-zonos-custom-address-h .zonos--company-name-input.sc-zonos-custom-address,.sc-zonos-custom-address-h .zonos--tax-id-input.sc-zonos-custom-address{margin-bottom:8px}.sc-zonos-custom-address-h zonos-banner.sc-zonos-custom-address{margin-top:8px}.sc-zonos-custom-address-h .zonos--custom-address-form.sc-zonos-custom-address,.sc-zonos-custom-address-h .zonos--custom-address-form-additional-fields.sc-zonos-custom-address{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px}.sc-zonos-custom-address-h .zonos--custom-address-form-state-zip-wrapper.sc-zonos-custom-address{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}.sc-zonos-custom-address-h .zonos--custom-address-form-state-zip-wrapper.sc-zonos-custom-address>*.sc-zonos-custom-address{-ms-flex:1 1 200px;flex:1 1 200px}.sc-zonos-custom-address-h .zonos--custom-address-form-additional-fields.sc-zonos-custom-address{opacity:0;height:0;overflow:hidden;-webkit-transition:opacity 0.3s ease-in-out, height 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, height 0.3s ease-in-out}.sc-zonos-custom-address-h .zonos--custom-address-form-additional-fields.zonos--show.sc-zonos-custom-address{opacity:1;height:auto}";var ZonosCustomAddressStyle0=zonosCustomAddressCss;var __rest=undefined&&undefined.__rest||function(e,t){var r={};for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0)r[o]=e[o];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++){if(t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n]))r[o[n]]=e[o[n]]}return r};var ZonosAddress=function(){function e(e){var t=this;registerInstance(this,e);this.invalidCharacters=createEvent(this,"invalidCharacters",7);this.addressChange=createEvent(this,"addressChange",7);this.onStoreCheckoutSessionIdChangedSubscription=function(){};this.defaultAddress=[];this.taxIdErrorMessage="";this.shortAddressCodeErrorMessage="";this.stripe=window.Zonos.stripe;this.isDirtyAddress=false;this.isAddressFilled=false;this.isAddressLine1Entered=false;this.addressSuggestions=[];this.countryField=null;this.startGooglePlaceSuggestions=false;this.city="";this.country="";this.firstName="";this.lastName="";this.line1="";this.line2=null;this.phone="";this.postalCode="";this.state="";this.cityError="";this.stateError="";this.postalCodeError="";this.phoneError="";this.firstNameError="";this.lastNameError="";this.isFirstInitialization=true;this.addressService=null;this.checkoutSessionId=storageStore.checkoutSessionId;this.suggestionClicked=false;this.trackingSent=false;this.isAutoCompleteAdjusted=false;this.countryOptionsCache=null;this.throttledGetAddressSuggestions=throttle_1((function(){if(zonosStore.checkoutAddressService){zonosStore.checkoutAddressService.getAddressSuggestions({country:t.country,query:[t.line1,t.state,t.postalCode].filter(Boolean).join(", "),type:t.type})}}),1e3);this.setCustomAddressFormToStripeAddressEventData=function(){var e=!t.countryField||t.countryField.cityShow?t.city:"";var r=!t.countryField||t.countryField.stateShow?t.state:"";var o=!t.countryField||t.countryField.zipShow?t.postalCode:"";var n={complete:t.getIsComplete(),elementMode:t.type,elementType:"address",empty:!t.getIsComplete(),isNewAddress:true,value:{address:{city:e,country:t.country,line1:t.line1,line2:t.line2,postal_code:o,state:r},firstName:t.firstName,lastName:t.lastName,name:"".concat(t.firstName," ").concat(t.lastName),phone:t.phone}};t.updateAddressEventData({event:n,type:t.type});t.addressChange.emit({errors:t.getCustomAddressErrors(),type:t.type,value:n})};this.getCustomAddressErrors=function(){return t.type==="shipping"?stripeStore.customAddressErrors:stripeStore.customBillingAddressErrors};this.validate=function(e){var r=e.phoneValidateInfo,o=e.type,n=e.value,i=e.valueType;var d,s,a,u,l;var $=Object.assign({},t.getCustomAddressErrors());switch(i){case"city":{var c=!((d=t.countryField)===null||d===void 0?void 0:d.cityRequired)||((s=t.countryField)===null||s===void 0?void 0:s.cityRequired)&&!!(n===null||n===void 0?void 0:n.trim());$.city="";if(!c){$.city=translate("The field is incomplete")}break}case"state":{var c=!((a=t.countryField)===null||a===void 0?void 0:a.stateRequired)||((u=t.countryField)===null||u===void 0?void 0:u.stateRequired)&&!!(n===null||n===void 0?void 0:n.trim());$.state="";if(!c){$.state=translate("The field is incomplete")}break}case"postalCode":{var c=isValidZip({countryFields:t.countryField,zip:n||""});$.postalCode="";if(!c){$.postalCode=translate("Your [zipLabel] is invalid",{zipLabel:((l=t.countryField)===null||l===void 0?void 0:l.zipLabel)||"ZIP"})}break}case"firstName":{var c=!!(n===null||n===void 0?void 0:n.trim());$.firstName="";if(!c){$.firstName=translate("Please provide your first name.")}break}case"lastName":{var c=!!(n===null||n===void 0?void 0:n.trim());$.lastName="";if(!c){$.lastName=translate("Please provide your last name.")}break}case"line1":{var c=!!(n===null||n===void 0?void 0:n.trim());$.line1="";if(!c){$.line1=translate("The field is incomplete")}break}case"phone":{if(!r){var c=!!(n===null||n===void 0?void 0:n.trim());$.phone="";if(!c){$.phone=translate("Please provide a mobile phone number.")}}else{$.phone="";if(r.isEmpty){$.phone=translate("Please provide a mobile phone number.")}else if(r.wrongFormat){$.phone=translate("Your mobile phone number is incomplete.")}}break}}if(o==="shipping"){stripeStore.customAddressErrors=$}else{stripeStore.customBillingAddressErrors=$}};this.onStoreCheckoutSessionIdChanged=function(){var e=function(){t.checkoutSessionId=storageStore.checkoutSessionId};e();t.onStoreCheckoutSessionIdChangedSubscription=storageStoreOnChange("checkoutSessionId",e)}}e.prototype.getCountryOptions=function(){var e=localizationStore.allCountries,t=localizationStore.shippingZoneCountries;var r=this.countryOptionsCache;if(r&&r.allCountries===e&&r.shippingZoneCountries===t&&r.type===this.type){return r.options}var o=getAddressCountryOptions({allCountries:e,shippingZoneCountries:t,type:this.type});this.countryOptionsCache={allCountries:e,options:o,shippingZoneCountries:t,type:this.type};return o};e.prototype.getStripeAddressInstance=function(){if(this.type==="billing"){return{stripeAddressElement:stripeStore.stripeBillingAddressElement,stripeAddressEventData:stripeStore.stripeBillingAddressEventData,stripeElements:stripeStore.stripeElementsForBillingAddress}}return{stripeAddressElement:stripeStore.stripeAddressElement,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeElements:stripeStore.stripeElements}};e.prototype.updateAddressEventData=function(e){var t=e.event,r=e.type;switch(r){case"billing":stripeStore.stripeBillingAddressEventData=t;break;default:{stripeStore.stripeAddressEventData=t;void stripeStorePrefetchLandedCost();break}}};e.prototype.isAddressFilledChanged=function(){if(!storageStore.checkoutSessionId){return}if(this.isAddressFilled&&!this.trackingSent&&this.type==="shipping"){this.trackingSent=true;var e=storageStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_customerInfoFilled"})}};e.prototype.defaultAddressChanged=function(e,t){var r=JSON.stringify(t);var o=JSON.stringify(e);if(r===o){return}log("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});if(this.type==="shipping"){stripeStore.stripeAddressEventData=null}else{stripeStore.stripeBillingAddressEventData=null}this.initDefaultCustomAddressForm()};e.prototype.getIsComplete=function(){var e=this.getCustomAddressErrors(),t=e.city,r=e.firstName,o=e.lastName,n=e.line1,i=e.phone,d=e.postalCode,s=e.state;if(!this.line1||!this.firstName||!this.lastName||!this.phone){return false}var a=n||d||s||t||r||o||i;return!a};e.prototype.isInTaxIdCountry=function(e){return countryRequireTaxId.includes(e)};e.prototype.renderTaxIdInput=function(){var e;if(this.type==="billing"){return null}var t=(e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.value.address.country;if(!t){return null}if(!this.isInTaxIdCountry(t)){return null}var r=shouldRenderTaxIdInput({companyName:stripeStore.companyName,countryCode:t});if(!r){return null}var o=shipToTaxIdLabels[t];return h("div",{class:"zonos--tax-id-input"},h("zonos-stripe-input",{error:this.taxIdErrorMessage,inputLabel:translate(o.friendlyName),inputPlaceholder:o.placeholder,inputValue:stripeStore.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:function(e){stripeStore.taxId=e.detail}}))};e.prototype.renderShortAddressCodeInput=function(){var e;if(this.type==="billing"){return null}var t=(e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.value.address.country;if(!t){return null}var r=shouldRenderShortAddressCodeInput({countryCode:t});if(!r){return null}return h("div",{class:"zonos--short-address-code-input"},h("zonos-stripe-input",{inputLabel:translate("Short address code"),inputPlaceholder:"RRRD2929",inputValue:stripeStore.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:function(e){stripeStore.shortAddressCode=e.detail}}),this.shortAddressCodeErrorMessage&&h("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage))};e.prototype.renderCompanyNameInput=function(){if(this.type==="billing"){return null}var e=zonosStore.checkoutSettings.companyFieldsStatus==="ENABLED";if(!e){return null}return h("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:translate("Company name (optional)"),inputValue:stripeStore.companyName,onInputChange:function(e){stripeStore.companyName=e.detail}})};e.prototype.initCountryField=function(e){var t,r,o;this.countryField=((t=zonosStore.genericSettings)===null||t===void 0?void 0:t.countryFields)&&e?(o=(r=zonosStore.genericSettings)===null||r===void 0?void 0:r.countryFields)===null||o===void 0?void 0:o[e]:null};e.prototype.initDefaultCustomAddressForm=function(){log("initDefaultCustomAddressForm","info",this.type);var e=this.getStripeAddressInstance().stripeAddressEventData;if(e){var t=e.value.address.country||localizationStore.selectedCountryCode||"US";this.setFormValues({city:e.value.address.city,country:t,firstName:e.value.firstName||"",lastName:e.value.lastName||"",line1:e.value.address.line1,line2:e.value.address.line2||"",phone:e.value.phone||"",postal_code:e.value.address.postal_code,state:e.value.address.state});this.initCountryField(t);return}var r=this.defaultAddress[0];if(r){var o=extractName({name:r.name}),n=o.firstName,i=o.lastName;var d=r.address.country||localizationStore.selectedCountryCode||"US";this.setFormValues({city:r.address.city,country:d,firstName:n,lastName:i,line1:r.address.line1,line2:r.address.line2||"",phone:r.phone||"",postal_code:r.address.postal_code,state:r.address.state});this.initCountryField(d);return}var s=localizationStore.selectedCountryCode||"US";this.setFormValues({city:"",country:s,firstName:"",lastName:"",line1:"",line2:"",phone:"",postal_code:"",state:""});this.initCountryField(s);this.isFirstInitialization=false};e.prototype.line1Changed=function(){var e=this;var t=this.getStripeAddressInstance().stripeAddressEventData;var r=!t||this.line1!==(t===null||t===void 0?void 0:t.value.address.line1);if(r&&this.line1.length>3){this.startGooglePlaceSuggestions=true;this.isAddressLine1Entered=true;if(this.suggestionClicked){this.suggestionClicked=false;this.startGooglePlaceSuggestions=false}if(!this.isDirtyAddress){this.isDirtyAddress=true;setTimeout((function(){if(!e.isAutoCompleteAdjusted){if(isCheckoutMobile()){e.el.scrollIntoView({behavior:"smooth",block:"end"})}else{var t=e.type==="shipping"?100:600;var r=e.el.closest(".zonos--group");var o=e.el.getBoundingClientRect().top+t;r===null||r===void 0?void 0:r.scrollTo({behavior:"smooth",top:o})}}}),600)}}this.setCustomAddressFormToStripeAddressEventData();if(this.startGooglePlaceSuggestions&&zonosStore.checkoutAddressService&&!this.isFirstInitialization){this.throttledGetAddressSuggestions()}};e.prototype.formFieldsChanged=function(){this.setCustomAddressFormToStripeAddressEventData()};e.prototype.addressSuggestionSelected=function(e){var t=e.placeDetails;var r,o,n,i,d,s,a,u,l,$,c,f,h,p,v;this.suggestionClicked=true;this.startGooglePlaceSuggestions=false;var y=t.addressComponents;var b=mergeAddress({addresses:[(r=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("street_number")})))===null||r===void 0?void 0:r.longText,(o=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("route")})))===null||o===void 0?void 0:o.longText]});var m=mergeAddress({addresses:[(n=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("premise")})))===null||n===void 0?void 0:n.longText,((i=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("sublocality_level_2")})))===null||i===void 0?void 0:i.longText)||((d=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("sublocality_level_3")})))===null||d===void 0?void 0:d.longText)||((s=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("sublocality_level_4")})))===null||s===void 0?void 0:s.longText)||((a=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("sublocality_level_5")})))===null||a===void 0?void 0:a.longText)]});var g=mergeAddress({addresses:[(u=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("subpremise")})))===null||u===void 0?void 0:u.longText,(l=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("neighborhood")})))===null||l===void 0?void 0:l.longText],delimiter:", "});var _=mergeAddress({addresses:[(($=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("locality")})))===null||$===void 0?void 0:$.longText)||((c=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("sublocality_level_1")})))===null||c===void 0?void 0:c.longText)||((f=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("administrative_area_level_1")})))===null||f===void 0?void 0:f.longText)]});var z=mergeAddress({addresses:[(h=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("administrative_area_level_1")})))===null||h===void 0?void 0:h.shortText]});var N=mergeAddress({addresses:[(p=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("postal_code")})))===null||p===void 0?void 0:p.longText]});var C=mergeAddress({addresses:[(v=y===null||y===void 0?void 0:y.find((function(e){return e.types.includes("country")})))===null||v===void 0?void 0:v.shortText]});this.setFormValues({city:_,country:C,line1:b||m||this.line1,line2:g,postal_code:N,state:z})};e.prototype.setFormValues=function(e){if(e.city!==undefined)this.city=e.city;if(e.country!==undefined)this.country=e.country;if(e.firstName!==undefined)this.firstName=e.firstName;if(e.lastName!==undefined)this.lastName=e.lastName;if(e.line1!==undefined)this.line1=e.line1;if(e.line2!==undefined)this.line2=e.line2;if(e.phone!==undefined)this.phone=e.phone;if(e.postal_code!==undefined)this.postalCode=e.postal_code;if(e.state!==undefined)this.state=e.state};e.prototype.initAddressSuggestions=function(){var e=this;if(!zonosStore.checkoutAddressService||!!this.onAddressSuggestionsUnsubscribe&&!!this.onAddressSelectedUnsubscribe){return}log("on initAddressSuggestions","info");this.onAddressSuggestionsUnsubscribe=zonosStore.checkoutAddressService.onAddressSuggestions((function(t){var r=t.suggestions,o=t.type;if(o!==e.type){return}e.addressSuggestions=r}));this.onAddressSelectedUnsubscribe=zonosStore.checkoutAddressService.onAddressSelected((function(t){if(t.type!==e.type){return}e.addressSuggestions=[];e.addressSuggestionSelected(t)}));this.validate({type:this.type,value:this.firstName,valueType:"firstName"});this.validate({type:this.type,value:this.lastName,valueType:"lastName"});this.validate({type:this.type,value:this.line1,valueType:"line1"});this.validate({type:this.type,value:this.phone,valueType:"phone"});this.validate({type:this.type,value:this.postalCode,valueType:"postalCode"});this.validate({type:this.type,value:this.state,valueType:"state"});this.validate({type:this.type,value:this.city,valueType:"city"});this.validate({type:this.type,value:this.phone,valueType:"phone"})};e.prototype.countryChanged=function(e){var t,r;var o=(t=zonosStore.genericSettings)===null||t===void 0?void 0:t.countryFields;var n=o===null||o===void 0?void 0:o[e];if(((r=this.countryField)===null||r===void 0?void 0:r.countryCode)===this.country){return}if(o&&n){this.countryField=n;return}this.countryField=null};e.prototype.shouldEnabledCustomAddressChanged=function(){this.initAddressSuggestions();this.initDefaultCustomAddressForm()};e.prototype.renderCustomAddressForm=function(){var e=this;var t,r,o,n,i,d,s,a,u,l,$,c,f,p,v,y;var b=this.getCustomAddressErrors(),m=b.showError,g=__rest(b,["showError"]);var _=this.getStripeAddressInstance().stripeAddressEventData;var z=_===null||_===void 0?void 0:_.value.address.country;var N=this.getCountryOptions();var C=N[0];var E=Object.entries(((t=this.countryField)===null||t===void 0?void 0:t.regions)||{}).map((function(e){var t=e[0],r=e[1];return{label:t,value:r.interpayCode}})).sort((function(e,t){return e.label.localeCompare(t.label)}));return h("div",{"aria-label":"".concat(this.type," address form"),class:"zonos--custom-address-form",role:"form"},h("zonos-stripe-input",{"aria-required":"true",class:"zonos--custom-address-form-input",error:m?g.firstName:undefined,inputLabel:translate("First name"),inputValue:_===null||_===void 0?void 0:_.value.firstName,onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"firstName"});e.firstName=t.detail},required:true}),h("zonos-stripe-input",{"aria-required":"true",class:"zonos--custom-address-form-input",error:m?g.lastName:undefined,inputLabel:translate("Last name"),inputValue:_===null||_===void 0?void 0:_.value.lastName,onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"lastName"});e.lastName=t.detail},required:true}),h("zonos-stripe-select",{"aria-required":"true",autoComplete:"".concat(this.type," country"),class:"zonos--custom-address-form-input",name:"".concat(this.type,"-country"),onSelectChange:function(t){e.countryChanged(t.detail);e.validate({type:e.type,value:"",valueType:"postalCode"});e.validate({type:e.type,value:"",valueType:"city"});e.validate({type:e.type,value:"",valueType:"state"});e.country=t.detail;e.city="";e.state="";e.postalCode=""},options:N,required:true,selectLabel:translate("Country"),selectedValue:(_===null||_===void 0?void 0:_.value.address.country)||localizationStore.selectedCountryCode||(C===null||C===void 0?void 0:C.value),title:"".concat(this.type," country")}),h("div",{class:"zonos--custom-address-form-line1-wrapper"},h("zonos-stripe-input",{"aria-autocomplete":"list","aria-controls":"autocomplete-search","aria-required":"true",autoComplete:"".concat(this.type," address-line1"),class:"zonos--custom-address-form-input",error:m?g.line1:undefined,inputLabel:translate("Address line 1"),inputValue:_===null||_===void 0?void 0:_.value.address.line1,name:"address-line1",onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"line1"});e.line1=t.detail},onKeyDown:function(t){if(t.key==="Escape"){t.preventDefault();t.stopPropagation();e.addressSuggestions=[]}},required:true}),h("zonos-address-suggestions",{onSuggestionSelected:function(t){var r;var o=t.detail.placeId;(r=zonosStore.checkoutAddressService)===null||r===void 0?void 0:r.selectAddress({placeId:o,type:e.type})},suggestions:this.addressSuggestions,type:this.type})),h("div",{"aria-label":"Additional address details",class:classes(["zonos--custom-address-form-additional-fields",z&&this.isAddressLine1Entered?"zonos--show":""]),role:"group"},h("zonos-stripe-input",{"aria-required":"false",autoComplete:"".concat(this.type," address-line2"),class:"zonos--custom-address-form-input",inputLabel:translate(((r=this.countryField)===null||r===void 0?void 0:r.address2Label)||"Address line 2"),inputValue:(_===null||_===void 0?void 0:_.value.address.line2)||"",onInputChange:function(t){e.line2=t.detail}}),((o=this.countryField)===null||o===void 0?void 0:o.cityShow)&&h("zonos-stripe-input",{"aria-required":((n=this.countryField)===null||n===void 0?void 0:n.cityRequired)?"true":"false",autoComplete:"".concat(this.type," address-level2"),class:"zonos--custom-address-form-input",error:m?g.city:undefined,inputLabel:translate(((i=this.countryField)===null||i===void 0?void 0:i.cityLabel)||"City"),inputValue:(_===null||_===void 0?void 0:_.value.address.city)||"",name:"locality",onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"city"});e.city=t.detail},required:(d=this.countryField)===null||d===void 0?void 0:d.cityRequired}),h("div",{class:"zonos--custom-address-form-state-zip-wrapper"},((s=this.countryField)===null||s===void 0?void 0:s.stateShow)&&h("zonos-stripe-select",{"aria-required":((a=this.countryField)===null||a===void 0?void 0:a.stateRequired)?"true":"false",autoComplete:"".concat(this.type," address-level1"),class:"zonos--custom-address-form-input",error:m?g.state:undefined,isError:m&&!!g.state,name:"".concat(this.type,"-state"),onSelectChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"state"});e.state=t.detail},options:E,required:(u=this.countryField)===null||u===void 0?void 0:u.stateRequired,selectLabel:translate(((l=this.countryField)===null||l===void 0?void 0:l.stateLabel)||"State"),selectedValue:_===null||_===void 0?void 0:_.value.address.state,title:"".concat(this.type," state")}),(($=this.countryField)===null||$===void 0?void 0:$.zipShow)&&h("zonos-stripe-input",{"aria-describedby":((c=this.countryField)===null||c===void 0?void 0:c.zipFormat)?"zip-format-".concat(this.type):undefined,"aria-required":((f=this.countryField)===null||f===void 0?void 0:f.zipRequired)?"true":"false",autoComplete:"".concat(this.type," postal-code"),class:"zonos--custom-address-form-input",error:m?g.postalCode:undefined,inputLabel:translate(((p=this.countryField)===null||p===void 0?void 0:p.zipLabel)||"Zip"),inputValue:(_===null||_===void 0?void 0:_.value.address.postal_code)||"",name:"postalCode",onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"postalCode"});e.postalCode=t.detail},required:(v=this.countryField)===null||v===void 0?void 0:v.zipRequired,title:"".concat(this.type," zip code")})),h("zonos-stripe-phone-input",{autoComplete:"".concat(this.type," tel"),class:"zonos--custom-address-form-input",countryCode:_===null||_===void 0?void 0:_.value.address.country,countryOptions:(y=zonosStore.genericSettings)===null||y===void 0?void 0:y.countryFields,error:m?g.phone:undefined,inputLabel:translate("Phone number"),inputValue:(_===null||_===void 0?void 0:_.value.phone)||"",onInputValueChange:function(t){var r=t.detail,o=r.isEmpty,n=r.phoneNumber,i=r.valid,d=r.wrongFormat;e.validate({phoneValidateInfo:{isEmpty:o,isValid:i,wrongFormat:d},type:e.type,value:n,valueType:"phone"});e.phone=n}})))};e.prototype.disconnectedCallback=function(){var e,t;var r=this.getStripeAddressInstance().stripeAddressElement;r===null||r===void 0?void 0:r.destroy();(e=this.onAddressSuggestionsUnsubscribe)===null||e===void 0?void 0:e.call(this);(t=this.onAddressSelectedUnsubscribe)===null||t===void 0?void 0:t.call(this);this.onStoreCheckoutSessionIdChangedSubscription()};e.prototype.componentWillLoad=function(){if(zonosStore.checkoutAddressService){this.initDefaultCustomAddressForm()}};e.prototype.componentDidLoad=function(){var e=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!e&&e.value.address.line1.length>0;this.initAddressSuggestions();this.isFirstInitialization=false;this.onStoreCheckoutSessionIdChanged();this.countryChanged((e===null||e===void 0?void 0:e.value.address.country)||"US")};e.prototype.render=function(){var e;this.addressService=zonosStore.checkoutAddressService;if((e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.complete){this.isAddressFilled=true}if(!this.country&&localizationStore.selectedCountryCode){this.country=localizationStore.selectedCountryCode}return h(Host,{key:"b4e39a6e92e646f98c0061bf3de8e028c9285556",class:classes(["zonos--address zonos--elements","zonos--".concat(this.type,"-address")])},h("zonos-text",{key:"28d21737c78a1b8125c5170c67f214e3f39939ff",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("slot",{key:"97357f001b27197b8648d6158b786b153c31a7ba",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),this.renderCustomAddressForm())};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],defaultAddress:["defaultAddressChanged"],line1:["line1Changed"],city:["formFieldsChanged"],country:["formFieldsChanged","countryChanged"],firstName:["formFieldsChanged"],lastName:["formFieldsChanged"],line2:["formFieldsChanged"],phone:["formFieldsChanged"],postalCode:["formFieldsChanged"],state:["formFieldsChanged"],addressService:["shouldEnabledCustomAddressChanged"]}},enumerable:false,configurable:true});return e}();ZonosAddress.style=ZonosCustomAddressStyle0;var metadata={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]","(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:241|349)0\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|91(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79]))))\\d{3}|(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8])|8(?:55|6[0-8]|[78]\\d|9[02-9]))\\d{6}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|2[23]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[024-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[024-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","(?:01\\d|8)\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-7]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]|50"]],["(\\d{8})","$1",["[5-7]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","[1-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37|86)","300|4(?:0(?:0|20)|370|864)"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[178]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-6]|7[246]|8[2-4]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|[78]"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","[2-9]\\d{9}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"0$1"]],"0"],CF:["236","00","8776\\d{4}|(?:[27]\\d|61)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-8]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["60|809"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9(?:10|[2-9])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-8]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|9[14]"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9,10,11,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|3[13])"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,0,[["528[89]\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[016-8]\\d|2[0-8]|5[0-5]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-57-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-57-9]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,"0|180020",0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","(?:694\\d|7093)\\d{5}|(?:59|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|80[6-9]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0|180020","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","[235]\\d{8}|800\\d{5,6}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2358]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|80[6-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",[7,8,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","[2-589]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0|180020","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31)|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:3171|5[15][2-6]|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|8(?:16|2[014]|3[126]|6[136]|7[78]|83)(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|3[129]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7(?:[23569]|8[0-57-9])|8[1-6])|7(?:1(?:[013-8]|9[6-9])|3(?:17|2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|8(?:28[235-7]|3))|73179|807(?:1|9[1-3])|(?:1552|6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578])\\d|7(?:[23569]\\d|8[0-57-9])|8(?:[14-6]\\d|2[0-79]))|7(?:1(?:[013-8]\\d|9[6-9])|3(?:2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["16|[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["18[06]","18[06]0"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11,12],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[03]"]]],0,0,0,0,0,0,[["0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],["3[2-8]\\d{9,10}",[11,12]],0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0|180020","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|427|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[47]"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[25-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["3|4(?:2[09]|7[01])|6[1-9]","3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[25-9]"],"0$1"]],"0",0,"(000[2569]\\d{4,6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[36]0|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","8\\d{13}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["3"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-6]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[2457]\\d|33|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["20"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["20"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|78|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2679]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{4})(\\d{5})","$1-$2",["892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8(?:0[0-7]|9)"],"0$1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[5-8]"],"0$1"]],"0",0,0,0,0,"[5-8]"],MC:["377","00","(?:[3489]|[67]\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[67]"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["11|2[16]"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","7091\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-37-9]"],"0$1"]],"0"],MX:["52","0[09]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:20|9\\d)\\d{8}|[78]\\d{9,13}",[10,11,12,13,14],[["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[24-9]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[78]\\d{8}|[2-9]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","[36-8]\\d{5,8}|4\\d{6,8}|59\\d{6}|9\\d{5,10}|(?:2\\d|5[0-8])\\d{6,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["3[289]|4[246-8]|61|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[136]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"0$1"]],"0",0,0,0,0,0,[["2631[0-6]\\d{4}|26(?:2\\d|30|88)\\d{5}"],["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"[3489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","(?:[15]\\d|800|92)\\d{7}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","(?:[2489]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10,12],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[013]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|9[2-9]"]],["(\\d)(\\d{7})","$1 $2",["[267]|904"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[346-9]"]]],"0"],SR:["597","00","(?:[2-5]|[6-9]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-9]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[25-7]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[25-7]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-359]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-4]|5[1-3]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[59]"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[3689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[236-9]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","(?:[0-57-9]\\d|66)\\d{7}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3(?:[1245]|3[12])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["\\d"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[0-79]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["826"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["83"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["82"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[25]0|37|49|8[09]"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-478])|7[1-9]","[23568]|4(?:0[2-48]|[1-478])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:274[27]|(?:472|983)[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|2\\d{3,4}|(?:[49]\\d|80)\\d{5}",[4,5,6,7,8,9,10,11,12,13],[["(\\d{4,5})","$1",["21"]],["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11,12],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{6,7}|7\\d{6}",[7,8,9,10],[["(\\d{4})(\\d{4,6})","$1 $2",["1(?:2[02]|[89])"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[26]|6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:639\\d|7093)\\d{5}|(?:26|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["26(?:89\\d|9(?:0[0-467]|15|5[0-4]|6\\d|[78]0))\\d{4}"],["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|[579]\\d|63)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[579]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|5[12]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|5(?:0\\d{3}|2[0-2]))\\d{7}",[7,8,9,10,12]],0,0,0,["348[57]\\d{7}",[11]],0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function withMetadataArgument(e,t){var r=Array.prototype.slice.call(t);r.push(metadata);return e.apply(this,r)}function compare(e,t){e=e.split("-");t=t.split("-");var r=e[0].split(".");var o=t[0].split(".");for(var n=0;n<3;n++){var i=Number(r[n]);var d=Number(o[n]);if(i>d)return 1;if(d>i)return-1;if(!isNaN(i)&&isNaN(d))return 1;if(isNaN(i)&&!isNaN(d))return-1}if(e[1]&&t[1]){return e[1]>t[1]?1:e[1]<t[1]?-1:0}return!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}var objectConstructor={}.constructor;function isObject(e){return e!==undefined&&e!==null&&e.constructor===objectConstructor}var CALLING_CODE_REG_EXP=/^\d+$/;function isCallingCode(e){return CALLING_CODE_REG_EXP.test(e)}function _typeof$b(e){"@babel/helpers - typeof";return _typeof$b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$b(e)}function _classCallCheck$8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$8(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey$b(o.key),o)}}function _createClass$8(e,t,r){return t&&_defineProperties$8(e.prototype,t),r&&_defineProperties$8(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey$b(e){var t=_toPrimitive$b(e,"string");return"symbol"==_typeof$b(t)?t:t+""}function _toPrimitive$b(e,t){if("object"!=_typeof$b(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$b(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var V3="1.2.0";var V4="1.7.35";var DEFAULT_EXT_PREFIX=" ext. ";var Metadata=function(){function e(t){_classCallCheck$8(this,e);validateMetadata(t);this.metadata=t;setVersion.call(this,t)}return _createClass$8(e,[{key:"getCountries",value:function e(){return Object.keys(this.metadata.countries).filter((function(e){return e!=="001"}))}},{key:"getCountryMetadata",value:function e(t){return this.metadata.countries[t]}},{key:"nonGeographic",value:function e(){if(this.v1||this.v2||this.v3)return;return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function e(t){return this.getCountryMetadata(t)!==undefined}},{key:"hasCallingCode",value:function e(t){if(this.getCountryCodesForCallingCode(t)){return true}if(this.nonGeographic()){if(this.nonGeographic()[t]){return true}}else{var r=this.countryCallingCodes()[t];if(r&&r.length===1&&r[0]==="001"){return true}}}},{key:"isNonGeographicCallingCode",value:function e(t){if(this.nonGeographic()){return this.nonGeographic()[t]?true:false}else{return this.getCountryCodesForCallingCode(t)?false:true}}},{key:"country",value:function e(t){return this.selectNumberingPlan(t)}},{key:"selectNumberingPlan",value:function e(t,r){var o;var n;if(t){if(isCallingCode(t)){n=t}else{o=t}}if(r){n=r}if(o&&o!=="001"){var i=this.getCountryMetadata(o);if(!i){throw new Error("Unknown country: ".concat(o))}this.numberingPlan=new NumberingPlan(i,this)}else if(n){if(!this.hasCallingCode(n)){throw new Error("Unknown calling code: ".concat(n))}this.numberingPlan=new NumberingPlan(this.getNumberingPlanMetadata(n),this)}else{this.numberingPlan=undefined}return this}},{key:"getCountryCodesForCallingCode",value:function e(t){var r=this.countryCallingCodes()[t];if(r){if(r.length===1&&r[0].length===3){return}return r}}},{key:"getCountryCodeForCallingCode",value:function e(t){var r=this.getCountryCodesForCallingCode(t);if(r){return r[0]}}},{key:"getNumberingPlanMetadata",value:function e(t){var r=this.getCountryCodeForCallingCode(t);if(r){return this.getCountryMetadata(r)}if(this.nonGeographic()){var o=this.nonGeographic()[t];if(o){return o}}else{var n=this.countryCallingCodes()[t];if(n&&n.length===1&&n[0]==="001"){return this.metadata.countries["001"]}}}},{key:"countryCallingCode",value:function e(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function e(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function e(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function e(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function e(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function e(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function e(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function e(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function e(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function e(){return this.numberingPlan.hasTypes()}},{key:"type",value:function e(t){return this.numberingPlan.type(t)}},{key:"ext",value:function e(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function e(){if(this.v1)return this.metadata.country_phone_code_to_countries;return this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function e(t){return this.selectNumberingPlan(t)}},{key:"hasSelectedNumberingPlan",value:function e(){return this.numberingPlan!==undefined}}])}();var NumberingPlan=function(){function e(t,r){_classCallCheck$8(this,e);this.globalMetadataObject=r;this.metadata=t;setVersion.call(this,r.metadata)}return _createClass$8(e,[{key:"callingCode",value:function e(){return this.metadata[0]}},{key:"_getDefaultCountryMetadataForThisCallingCode",value:function e(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"getDefaultCountryMetadataForRegion",value:function e(){return this._getDefaultCountryMetadataForThisCallingCode()}},{key:"IDDPrefix",value:function e(){if(this.v1||this.v2)return;return this.metadata[1]}},{key:"defaultIDDPrefix",value:function e(){if(this.v1||this.v2)return;return this.metadata[12]}},{key:"nationalNumberPattern",value:function e(){if(this.v1||this.v2)return this.metadata[1];return this.metadata[2]}},{key:"possibleLengths",value:function e(){if(this.v1)return;return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function e(t){return t[this.v1?2:this.v2?3:4]}},{key:"formats",value:function e(){var t=this;var e=this._getFormats(this.metadata)||this._getFormats(this._getDefaultCountryMetadataForThisCallingCode())||[];return e.map((function(e){return new Format(e,t)}))}},{key:"nationalPrefix",value:function e(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function e(t){return t[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function e(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this._getDefaultCountryMetadataForThisCallingCode())}},{key:"_nationalPrefixForParsing",value:function e(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function e(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function e(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function e(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function e(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this._getDefaultCountryMetadataForThisCallingCode())}},{key:"leadingDigits",value:function e(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function e(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function e(){if(this.types()&&this.types().length===0){return false}return!!this.types()}},{key:"type",value:function e(t){if(this.hasTypes()&&getType(this.types(),t)){return new Type(getType(this.types(),t),this)}}},{key:"ext",value:function e(){if(this.v1||this.v2)return DEFAULT_EXT_PREFIX;return this.metadata[13]||DEFAULT_EXT_PREFIX}}])}();var Format=function(){function e(t,r){_classCallCheck$8(this,e);this._format=t;this.metadata=r}return _createClass$8(e,[{key:"pattern",value:function e(){return this._format[0]}},{key:"format",value:function e(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function e(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function e(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function e(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function e(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function e(){return this.nationalPrefixFormattingRule()&&!FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule())?true:false}},{key:"internationalFormat",value:function e(){return this._format[5]||this.format()}}])}();var FIRST_GROUP_ONLY_PREFIX_PATTERN=/^\(?\$1\)?$/;var Type=function(){function e(t,r){_classCallCheck$8(this,e);this.type=t;this.metadata=r}return _createClass$8(e,[{key:"pattern",value:function e(){if(this.metadata.v1)return this.type;return this.type[0]}},{key:"possibleLengths",value:function e(){if(this.metadata.v1)return;return this.type[1]||this.metadata.possibleLengths()}}])}();function getType(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}function validateMetadata(e){if(!e){throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.")}if(!isObject(e)||!isObject(e.countries)){throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(isObject(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+typeOf(e)+": "+e,"."))}}var typeOf=function e(t){return _typeof$b(t)};function getCountryCallingCode(e,t){var r=new Metadata(t);if(r.hasCountry(e)){return r.selectNumberingPlan(e).countryCallingCode()}throw new Error("Unknown country: ".concat(e))}function isSupportedCountry(e,t){return t.countries.hasOwnProperty(e)}function setVersion(e){var t=e.version;if(typeof t==="number"){this.v1=t===1;this.v2=t===2;this.v3=t===3;this.v4=t===4}else{if(!t){this.v1=true}else if(compare(t,V3)===-1){this.v2=true}else if(compare(t,V4)===-1){this.v3=true}else{this.v4=true}}}function _createForOfIteratorHelperLoose$7(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$a(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$a(e,t):void 0}}function _arrayLikeToArray$a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function mergeArrays(e,t){var r=e.slice();for(var o=_createForOfIteratorHelperLoose$7(t),n;!(n=o()).done;){var i=n.value;if(e.indexOf(i)<0){r.push(i)}}return r.sort((function(e,t){return e-t}))}function checkNumberLength(e,t,r){return checkNumberLengthForType(e,undefined,t,r)}function checkNumberLengthForType(e,t,r,o){if(r){o=new Metadata(o.metadata);o.selectNumberingPlan(r)}var n=o.type(t);var i=n&&n.possibleLengths()||o.possibleLengths();if(!i){return"IS_POSSIBLE"}if(t==="FIXED_LINE_OR_MOBILE"){if(!o.type("FIXED_LINE")){return checkNumberLengthForType(e,"MOBILE",r,o)}var d=o.type("MOBILE");if(d){i=mergeArrays(i,d.possibleLengths())}}else if(t&&!n){return"INVALID_LENGTH"}var s=e.length;var a=i[0];if(a===s){return"IS_POSSIBLE"}if(a>s){return"TOO_SHORT"}if(i[i.length-1]<s){return"TOO_LONG"}return i.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function isPossiblePhoneNumber(e,t,r){if(t===undefined){t={}}var o=new Metadata(r);if(t.v2){if(!e.countryCallingCode){throw new Error("Invalid phone number object passed")}o.selectNumberingPlan(e.country||e.countryCallingCode)}else{if(!e.phone){return false}if(e.country){if(!o.hasCountry(e.country)){throw new Error("Unknown country: ".concat(e.country))}o.selectNumberingPlan(e.country)}else{if(!e.countryCallingCode){throw new Error("Invalid phone number object passed")}o.selectNumberingPlan(e.countryCallingCode)}}if(o.possibleLengths()){return isPossibleNumber$2(e.phone||e.nationalNumber,o)}if(e.countryCallingCode&&o.isNonGeographicCallingCode(e.countryCallingCode)){return true}throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function isPossibleNumber$2(e,t){switch(checkNumberLength(e,undefined,t)){case"IS_POSSIBLE":return true;default:return false}}function matchesEntirely(e,t){e=e||"";return new RegExp("^(?:"+t+")$").test(e)}function _createForOfIteratorHelperLoose$6(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$9(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$9(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$9(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$9(e,t):void 0}}function _arrayLikeToArray$9(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}var NON_FIXED_LINE_PHONE_TYPES=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function getNumberType(e,t,r){t=t||{};if(!e.country&&!e.countryCallingCode){return}var o=new Metadata(r);o.selectNumberingPlan(e.country||e.countryCallingCode);var n=t.v2?e.nationalNumber:e.phone;if(!matchesEntirely(n,o.nationalNumberPattern())){return}if(isNumberTypeEqualTo(n,"FIXED_LINE",o)){if(o.type("MOBILE")&&o.type("MOBILE").pattern()===""){return"FIXED_LINE_OR_MOBILE"}if(!o.type("MOBILE")){return"FIXED_LINE_OR_MOBILE"}if(isNumberTypeEqualTo(n,"MOBILE",o)){return"FIXED_LINE_OR_MOBILE"}return"FIXED_LINE"}for(var i=_createForOfIteratorHelperLoose$6(NON_FIXED_LINE_PHONE_TYPES),d;!(d=i()).done;){var s=d.value;if(isNumberTypeEqualTo(n,s,o)){return s}}}function isNumberTypeEqualTo(e,t,r){var o=r.type(t);if(!o||!o.pattern()){return false}if(o.possibleLengths()&&o.possibleLengths().indexOf(e.length)<0){return false}return matchesEntirely(e,o.pattern())}function isValidNumber(e,t,r){t=t||{};var o=new Metadata(r);o.selectNumberingPlan(e.country||e.countryCallingCode);if(o.hasTypes()){return getNumberType(e,t,o.metadata)!==undefined}var n=t.v2?e.nationalNumber:e.phone;return matchesEntirely(n,o.nationalNumberPattern())}var COUNTRY_CODE_REG_EXP=/^[A-Z]{2}$/;function isCountryCode(e){return COUNTRY_CODE_REG_EXP.test(e)}var USE_NON_GEOGRAPHIC_COUNTRY_CODE$1=false;function getCountryAndCallingCodeFromOneOfThem(e,t){var r;var o;var n=new Metadata(t);if(isCountryCode(e)){r=e;n.selectNumberingPlan(r);o=n.countryCallingCode()}else{o=e;if(USE_NON_GEOGRAPHIC_COUNTRY_CODE$1){if(n.isNonGeographicCallingCode(o)){r="001"}}}return{country:r,callingCode:o}}function getPossibleCountriesForNumber(e,t,r){var o=new Metadata(r);var n=o.getCountryCodesForCallingCode(e);if(!n){return[]}return n.filter((function(e){return couldNationalNumberBelongToCountry(t,e,r)}))}function couldNationalNumberBelongToCountry(e,t,r){var o=new Metadata(r);o.selectNumberingPlan(t);return o.numberingPlan.possibleLengths().indexOf(e.length)>=0}var MIN_LENGTH_FOR_NSN=2;var MAX_LENGTH_FOR_NSN=17;var MAX_LENGTH_COUNTRY_CODE=3;var VALID_DIGITS="0-90-9٠-٩۰-۹";var DASHES="-‐-―−ー-";var SLASHES="//";var DOTS="..";var WHITESPACE=" ";var BRACKETS="()()[]\\[\\]";var TILDES="~⁓∼~";var VALID_PUNCTUATION="".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);var PLUS_CHARS="++";var CAPTURING_DIGIT_PATTERN=new RegExp("(["+VALID_DIGITS+"])");function stripIddPrefix(e,t,r,o){if(!t){return}var n=new Metadata(o);n.selectNumberingPlan(t||r);var i=new RegExp(n.IDDPrefix());if(e.search(i)!==0){return}e=e.slice(e.match(i)[0].length);var d=e.match(CAPTURING_DIGIT_PATTERN);if(d&&d[1]!=null&&d[1].length>0){if(d[1]==="0"){return}}return e}function extractNationalNumberFromPossiblyIncompleteNumber(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var r=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")");var o=r.exec(e);if(o){var n;var i;var d=o.length-1;var s=d>0&&o[d];if(t.nationalPrefixTransformRule()&&s){n=e.replace(r,t.nationalPrefixTransformRule());if(d>1){i=o[1]}}else{var a=o[0];n=e.slice(a.length);if(s){i=o[1]}}var u;if(s){var l=e.indexOf(o[1]);var $=e.slice(0,l);if($===t.numberingPlan.nationalPrefix()){u=t.numberingPlan.nationalPrefix()}}else{u=o[0]}return{nationalNumber:n,nationalPrefix:u,carrierCode:i}}}return{nationalNumber:e}}function _createForOfIteratorHelperLoose$5(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$8(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$8(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$8(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$8(e,t):void 0}}function _arrayLikeToArray$8(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function getCountryByNationalNumber(e,t,r){var o=new Metadata(r);for(var n=_createForOfIteratorHelperLoose$5(t),i;!(i=n()).done;){var d=i.value;o.selectNumberingPlan(d);if(o.leadingDigits()){if(e&&e.search(o.leadingDigits())===0){return d}}else if(getNumberType({phone:e,country:d},undefined,o.metadata)){return d}}}var USE_NON_GEOGRAPHIC_COUNTRY_CODE=false;function getCountryByCallingCode(e,t){var r=t.nationalNumber,o=t.metadata;if(USE_NON_GEOGRAPHIC_COUNTRY_CODE){if(o.isNonGeographicCallingCode(e)){return"001"}}var n=o.getCountryCodesForCallingCode(e);if(!n){return}if(n.length===1){return n[0]}return getCountryByNationalNumber(r,n,o.metadata)}function extractNationalNumber(e,t,r){var o=extractNationalNumberFromPossiblyIncompleteNumber(e,r),n=o.carrierCode,i=o.nationalNumber;if(i!==e){if(!shouldHaveExtractedNationalPrefix(e,i,r)){return{nationalNumber:e}}if(r.numberingPlan.possibleLengths()){if(!t){t=getCountryByCallingCode(r.numberingPlan.callingCode(),{nationalNumber:i,metadata:r})}if(!isPossibleIncompleteNationalNumber(i,t,r)){return{nationalNumber:e}}}}return{nationalNumber:i,carrierCode:n}}function shouldHaveExtractedNationalPrefix(e,t,r){if(matchesEntirely(e,r.nationalNumberPattern())&&!matchesEntirely(t,r.nationalNumberPattern())){return false}return true}function isPossibleIncompleteNationalNumber(e,t,r){switch(checkNumberLength(e,t,r)){case"TOO_SHORT":case"INVALID_LENGTH":return false;default:return true}}function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(e,t,r,o,n){if(!(t||r||o)){return{number:e}}var i=t||r?getCountryCallingCode(t||r,n):o;if(e.indexOf(i)===0){var d=new Metadata(n);d.selectNumberingPlan(t||r||o);var s=e.slice(i.length);var a=extractNationalNumber(s,undefined,d),u=a.nationalNumber;var l=extractNationalNumber(e,undefined,d),$=l.nationalNumber;if(!matchesEntirely($,d.nationalNumberPattern())&&matchesEntirely(u,d.nationalNumberPattern())||checkNumberLength($,undefined,d)==="TOO_LONG"){return{countryCallingCode:i,number:s}}}return{number:e}}function extractCountryCallingCode(e,t,r,o,n){if(!e){return{}}var i;if(e[0]!=="+"){var d=stripIddPrefix(e,t||r,o,n);if(d&&d!==e){i=true;e="+"+d}else{if(t||r||o){var s=extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(e,t,r,o,n),a=s.countryCallingCode,u=s.number;if(a){return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:a,number:u}}}return{number:e}}}if(e[1]==="0"){return{}}var l=new Metadata(n);var $=2;while($-1<=MAX_LENGTH_COUNTRY_CODE&&$<=e.length){var c=e.slice(1,$);if(l.hasCallingCode(c)){l.selectNumberingPlan(c);return{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice($)}}$++}return{}}function applyInternationalSeparatorStyle(e){return e.replace(new RegExp("[".concat(VALID_PUNCTUATION,"]+"),"g")," ").trim()}var FIRST_GROUP_PATTERN=/(\$\d)/;function formatNationalNumberUsingFormat(e,t,r){var o=r.useInternationalFormat,n=r.withNationalPrefix;var i=e.replace(new RegExp(t.pattern()),o?t.internationalFormat():n&&t.nationalPrefixFormattingRule()?t.format().replace(FIRST_GROUP_PATTERN,t.nationalPrefixFormattingRule()):t.format());if(o){return applyInternationalSeparatorStyle(i)}return i}var SINGLE_IDD_PREFIX_REG_EXP=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function getIddPrefix(e,t,r){var o=new Metadata(r);o.selectNumberingPlan(e||t);if(o.defaultIDDPrefix()){return o.defaultIDDPrefix()}if(SINGLE_IDD_PREFIX_REG_EXP.test(o.IDDPrefix())){return o.IDDPrefix()}}var RFC3966_EXTN_PREFIX=";ext=";var getExtensionDigitsPattern=function e(t){return"([".concat(VALID_DIGITS,"]{1,").concat(t,"})")};function createExtensionPattern(e){var t="20";var r="15";var o="9";var n="6";var i="[ \\t,]*";var d="[:\\..]?[ \\t,-]*";var s="#?";var a="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)";var u="(?:[xx##~~]|int|int)";var l="[- ]+";var $="[ \\t]*";var c="(?:,{2}|;)";var f=RFC3966_EXTN_PREFIX+getExtensionDigitsPattern(t);var h=i+a+d+getExtensionDigitsPattern(t)+s;var p=i+u+d+getExtensionDigitsPattern(o)+s;var v=l+getExtensionDigitsPattern(n)+"#";var y=$+c+d+getExtensionDigitsPattern(r)+s;var b=$+"(?:,)+"+d+getExtensionDigitsPattern(o)+s;return f+"|"+h+"|"+p+"|"+v+"|"+y+"|"+b}var MIN_LENGTH_PHONE_NUMBER_PATTERN="["+VALID_DIGITS+"]{"+MIN_LENGTH_FOR_NSN+"}";var VALID_PHONE_NUMBER="["+PLUS_CHARS+"]{0,1}"+"(?:"+"["+VALID_PUNCTUATION+"]*"+"["+VALID_DIGITS+"]"+"){3,}"+"["+VALID_PUNCTUATION+VALID_DIGITS+"]*";var VALID_PHONE_NUMBER_START_REG_EXP=new RegExp("^"+"["+PLUS_CHARS+"]{0,1}"+"(?:"+"["+VALID_PUNCTUATION+"]*"+"["+VALID_DIGITS+"]"+"){1,2}"+"$","i");var VALID_PHONE_NUMBER_WITH_EXTENSION=VALID_PHONE_NUMBER+"(?:"+createExtensionPattern()+")?";var VALID_PHONE_NUMBER_PATTERN=new RegExp("^"+MIN_LENGTH_PHONE_NUMBER_PATTERN+"$"+"|"+"^"+VALID_PHONE_NUMBER_WITH_EXTENSION+"$","i");function isViablePhoneNumber(e){return e.length>=MIN_LENGTH_FOR_NSN&&VALID_PHONE_NUMBER_PATTERN.test(e)}function isViablePhoneNumberStart(e){return VALID_PHONE_NUMBER_START_REG_EXP.test(e)}function formatRFC3966(e){var t=e.number,r=e.ext;if(!t){return""}if(t[0]!=="+"){throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.')}return"tel:".concat(t).concat(r?";ext="+r:"")}var DEFAULT_OPTIONS={formatExtension:function e(t,r,o){return"".concat(t).concat(o.ext()).concat(r)}};function formatNumber(e,t,r,o){if(r){r=merge({},DEFAULT_OPTIONS,r)}else{r=DEFAULT_OPTIONS}var n=new Metadata(o);if(e.country&&e.country!=="001"){if(!n.hasCountry(e.country)){throw new Error("Unknown country: ".concat(e.country))}n.selectNumberingPlan(e.country)}else if(e.countryCallingCode){n.selectNumberingPlan(e.countryCallingCode)}else return e.phone||"";var i=n.countryCallingCode();var d=r.v2?e.nationalNumber:e.phone;var s;switch(t){case"NATIONAL":if(!d){return""}s=formatNationalNumber$1(d,e.carrierCode,"NATIONAL",n,r);return addExtension(s,e.ext,n,r.formatExtension);case"INTERNATIONAL":if(!d){return"+".concat(i)}s=formatNationalNumber$1(d,null,"INTERNATIONAL",n,r);s="+".concat(i," ").concat(s);return addExtension(s,e.ext,n,r.formatExtension);case"E.164":return"+".concat(i).concat(d);case"RFC3966":return formatRFC3966({number:"+".concat(i).concat(d),ext:e.ext});case"IDD":if(!r.fromCountry){return}var a=formatIDD(d,e.carrierCode,i,r.fromCountry,n);if(!a){return}return addExtension(a,e.ext,n,r.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function formatNationalNumber$1(e,t,r,o,n){var i=chooseFormatForNumber(o.formats(),e);if(!i){return e}return formatNationalNumberUsingFormat(e,i,{useInternationalFormat:r==="INTERNATIONAL",withNationalPrefix:i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&n&&n.nationalPrefix===false?false:true,carrierCode:t,metadata:o})}function chooseFormatForNumber(e,t){return pickFirstMatchingElement(e,(function(e){if(e.leadingDigitsPatterns().length>0){var r=e.leadingDigitsPatterns()[e.leadingDigitsPatterns().length-1];if(t.search(r)!==0){return false}}return matchesEntirely(t,e.pattern())}))}function addExtension(e,t,r,o){return t?o(e,t,r):e}function formatIDD(e,t,r,o,n){var i=getCountryCallingCode(o,n.metadata);if(i===r){var d=formatNationalNumber$1(e,t,"NATIONAL",n);if(r==="1"){return r+" "+d}return d}var s=getIddPrefix(o,undefined,n.metadata);if(s){return"".concat(s," ").concat(r," ").concat(formatNationalNumber$1(e,null,"INTERNATIONAL",n))}}function merge(){var e=1;for(var t=arguments.length,r=new Array(t),o=0;o<t;o++){r[o]=arguments[o]}while(e<r.length){if(r[e]){for(var n in r[e]){r[0][n]=r[e][n]}}e++}return r[0]}function pickFirstMatchingElement(e,t){var r=0;while(r<e.length){if(t(e[r])){return e[r]}r++}}function _typeof$a(e){"@babel/helpers - typeof";return _typeof$a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$a(e)}function ownKeys$3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function _objectSpread$3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$3(Object(r),!0).forEach((function(t){_defineProperty$3(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$3(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty$3(e,t,r){return(t=_toPropertyKey$a(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _classCallCheck$7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$7(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey$a(o.key),o)}}function _createClass$7(e,t,r){return t&&_defineProperties$7(e.prototype,t),r&&_defineProperties$7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey$a(e){var t=_toPrimitive$a(e,"string");return"symbol"==_typeof$a(t)?t:t+""}function _toPrimitive$a(e,t){if("object"!=_typeof$a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$a(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var PhoneNumber=function(){function e(t,r,o){_classCallCheck$7(this,e);if(!t){throw new TypeError("First argument is required")}if(typeof t!=="string"){throw new TypeError("First argument must be a string")}if(t[0]==="+"&&!r){throw new TypeError("`metadata` argument not passed")}if(isObject(r)&&isObject(r.countries)){o=r;var n=t;if(!E164_NUMBER_REGEXP.test(n)){throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits')}var i=extractCountryCallingCode(n,undefined,undefined,undefined,o),d=i.countryCallingCode,s=i.number;r=s;t=d;if(!r){throw new Error("Invalid `number` argument passed: too short")}}if(!r){throw new TypeError("`nationalNumber` argument is required")}if(typeof r!=="string"){throw new TypeError("`nationalNumber` argument must be a string")}validateMetadata(o);var a=getCountryAndCallingCodeFromOneOfThem(t,o),u=a.country,l=a.callingCode;this.country=u;this.countryCallingCode=l;this.nationalNumber=r;this.number="+"+this.countryCallingCode+this.nationalNumber;this.getMetadata=function(){return o}}return _createClass$7(e,[{key:"setExt",value:function e(t){this.ext=t}},{key:"getPossibleCountries",value:function e(){if(this.country){return[this.country]}return getPossibleCountriesForNumber(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function e(){return isPossiblePhoneNumber(this,{v2:true},this.getMetadata())}},{key:"isValid",value:function e(){return isValidNumber(this,{v2:true},this.getMetadata())}},{key:"isNonGeographic",value:function e(){var t=new Metadata(this.getMetadata());return t.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function e(t){return this.number===t.number&&this.ext===t.ext}},{key:"getType",value:function e(){return getNumberType(this,{v2:true},this.getMetadata())}},{key:"format",value:function e(t,r){return formatNumber(this,t,r?_objectSpread$3(_objectSpread$3({},r),{},{v2:true}):{v2:true},this.getMetadata())}},{key:"formatNational",value:function e(t){return this.format("NATIONAL",t)}},{key:"formatInternational",value:function e(t){return this.format("INTERNATIONAL",t)}},{key:"getURI",value:function e(t){return this.format("RFC3966",t)}}])}();var E164_NUMBER_REGEXP=/^\+\d+$/;function _typeof$9(e){"@babel/helpers - typeof";return _typeof$9="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$9(e)}function _defineProperties$6(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey$9(o.key),o)}}function _createClass$6(e,t,r){return t&&_defineProperties$6(e.prototype,t),r&&_defineProperties$6(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey$9(e){var t=_toPrimitive$9(e,"string");return"symbol"==_typeof$9(t)?t:t+""}function _toPrimitive$9(e,t){if("object"!=_typeof$9(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$9(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _classCallCheck$6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _callSuper(e,t,r){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,r||[],_getPrototypeOf(e).constructor):t.apply(e,r))}function _possibleConstructorReturn(e,t){if(t&&("object"==_typeof$9(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function e(r){if(null===r||!_isNativeFunction(r))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(r))return t.get(r);t.set(r,o)}function o(){return _construct(r,arguments,_getPrototypeOf(this).constructor)}return o.prototype=Object.create(r.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(o,r)},_wrapNativeSuper(e)}function _construct(e,t,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,t);var n=new(e.bind.apply(e,o));return r&&_setPrototypeOf(n,r.prototype),n}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_isNativeReflectConstruct=function t(){return!!e})()}function _isNativeFunction(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}var ParseError=function(e){function t(e){var r;_classCallCheck$6(this,t);r=_callSuper(this,t,[e]);Object.setPrototypeOf(r,t.prototype);r.name=r.constructor.name;return r}_inherits(t,e);return _createClass$6(t)}(_wrapNativeSuper(Error));var EXTN_PATTERN=new RegExp("(?:"+createExtensionPattern()+")$","i");function extractExtension(e){var t=e.search(EXTN_PATTERN);if(t<0){return{}}var r=e.slice(0,t);var o=e.match(EXTN_PATTERN);var n=1;while(n<o.length){if(o[n]){return{number:r,ext:o[n]}}n++}}function _createForOfIteratorHelperLoose$4(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$7(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$7(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$7(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$7(e,t):void 0}}function _arrayLikeToArray$7(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}var DIGITS={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function parseDigit(e){return DIGITS[e]}function parseDigits(e){var t="";for(var r=_createForOfIteratorHelperLoose$4(e.split("")),o;!(o=r()).done;){var n=o.value;var i=parseDigit(n);if(i){t+=i}}return t}function _createForOfIteratorHelperLoose$3(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$6(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$6(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$6(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$6(e,t):void 0}}function _arrayLikeToArray$6(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function parseIncompletePhoneNumber(e){var t="";for(var r=_createForOfIteratorHelperLoose$3(e.split("")),o;!(o=r()).done;){var n=o.value;t+=parsePhoneNumberCharacter(n,t)||""}return t}function parsePhoneNumberCharacter(e,t,r){if(e==="+"){if(t){if(typeof r==="function"){r("end")}return}return"+"}return parseDigit(e)}var PLUS_SIGN="+";var RFC3966_VISUAL_SEPARATOR_="[\\-\\.\\(\\)]?";var RFC3966_PHONE_DIGIT_="("+"["+VALID_DIGITS+"]"+"|"+RFC3966_VISUAL_SEPARATOR_+")";var RFC3966_GLOBAL_NUMBER_DIGITS_="^"+"\\"+PLUS_SIGN+RFC3966_PHONE_DIGIT_+"*"+"["+VALID_DIGITS+"]"+RFC3966_PHONE_DIGIT_+"*"+"$";var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_=new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_,"g");var ALPHANUM_=VALID_DIGITS;var RFC3966_DOMAINLABEL_="["+ALPHANUM_+"]+((\\-)*["+ALPHANUM_+"])*";var VALID_ALPHA_="a-zA-Z";var RFC3966_TOPLABEL_="["+VALID_ALPHA_+"]+((\\-)*["+ALPHANUM_+"])*";var RFC3966_DOMAINNAME_="^("+RFC3966_DOMAINLABEL_+"\\.)*"+RFC3966_TOPLABEL_+"\\.?$";var RFC3966_DOMAINNAME_PATTERN_=new RegExp(RFC3966_DOMAINNAME_,"g");var RFC3966_PREFIX_="tel:";var RFC3966_PHONE_CONTEXT_=";phone-context=";var RFC3966_ISDN_SUBADDRESS_=";isub=";function extractPhoneContext(e){var t=e.indexOf(RFC3966_PHONE_CONTEXT_);if(t<0){return null}var r=t+RFC3966_PHONE_CONTEXT_.length;if(r>=e.length){return""}var o=e.indexOf(";",r);if(o>=0){return e.substring(r,o)}else{return e.substring(r)}}function isPhoneContextValid(e){if(e===null){return true}if(e.length===0){return false}return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(e)||RFC3966_DOMAINNAME_PATTERN_.test(e)}function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(e,t){var r=t.extractFormattedPhoneNumber;var o=extractPhoneContext(e);if(!isPhoneContextValid(o)){throw new ParseError("NOT_A_NUMBER")}var n;if(o===null){n=r(e)||""}else{n="";if(o.charAt(0)===PLUS_SIGN){n+=o}var i=e.indexOf(RFC3966_PREFIX_);var d;if(i>=0){d=i+RFC3966_PREFIX_.length}else{d=0}var s=e.indexOf(RFC3966_PHONE_CONTEXT_);n+=e.substring(d,s)}var a=n.indexOf(RFC3966_ISDN_SUBADDRESS_);if(a>0){n=n.substring(0,a)}if(n!==""){return n}}var MAX_INPUT_STRING_LENGTH=250;var PHONE_NUMBER_START_PATTERN=new RegExp("["+PLUS_CHARS+VALID_DIGITS+"]");var AFTER_PHONE_NUMBER_END_PATTERN=new RegExp("[^"+VALID_DIGITS+"#"+"]+$");function parse(e,t,r){t=t||{};var o=new Metadata(r);if(t.defaultCountry&&!o.hasCountry(t.defaultCountry)){if(t.v2){throw new ParseError("INVALID_COUNTRY")}throw new Error("Unknown country: ".concat(t.defaultCountry))}var n=parseInput(e,t.v2,t.extract),i=n.number,d=n.ext,s=n.error;if(!i){if(t.v2){if(s==="TOO_SHORT"){throw new ParseError("TOO_SHORT")}throw new ParseError("NOT_A_NUMBER")}return{}}var a=parsePhoneNumber$3(i,t.defaultCountry,t.defaultCallingCode,o),u=a.country,l=a.nationalNumber,$=a.countryCallingCode,c=a.countryCallingCodeSource,f=a.carrierCode;if(!o.hasSelectedNumberingPlan()){if(t.v2){throw new ParseError("INVALID_COUNTRY")}return{}}if(!l||l.length<MIN_LENGTH_FOR_NSN){if(t.v2){throw new ParseError("TOO_SHORT")}return{}}if(l.length>MAX_LENGTH_FOR_NSN){if(t.v2){throw new ParseError("TOO_LONG")}return{}}if(t.v2){var h=new PhoneNumber($,l,o.metadata);if(u){h.country=u}if(f){h.carrierCode=f}if(d){h.ext=d}h.__countryCallingCodeSource=c;return h}var p=(t.extended?o.hasSelectedNumberingPlan():u)?matchesEntirely(l,o.nationalNumberPattern()):false;if(!t.extended){return p?result(u,l,d):{}}return{country:u,countryCallingCode:$,carrierCode:f,valid:p,possible:p?true:t.extended===true&&o.possibleLengths()&&isPossibleNumber$2(l,o)?true:false,phone:l,ext:d}}function _extractFormattedPhoneNumber(e,t,r){if(!e){return}if(e.length>MAX_INPUT_STRING_LENGTH){if(r){throw new ParseError("TOO_LONG")}return}if(t===false){return e}var o=e.search(PHONE_NUMBER_START_PATTERN);if(o<0){return}return e.slice(o).replace(AFTER_PHONE_NUMBER_END_PATTERN,"")}function parseInput(e,t,r){var o=extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(e,{extractFormattedPhoneNumber:function e(o){return _extractFormattedPhoneNumber(o,r,t)}});if(!o){return{}}if(!isViablePhoneNumber(o)){if(isViablePhoneNumberStart(o)){return{error:"TOO_SHORT"}}return{}}var n=extractExtension(o);if(n.ext){return n}return{number:o}}function result(e,t,r){var o={country:e,phone:t};if(r){o.ext=r}return o}function parsePhoneNumber$3(e,t,r,o){var n=extractCountryCallingCode(parseIncompletePhoneNumber(e),undefined,t,r,o.metadata),i=n.countryCallingCodeSource,d=n.countryCallingCode,s=n.number;var a;if(d){o.selectNumberingPlan(d)}else if(s&&(t||r)){if(t){a=t;o.selectNumberingPlan(t);d=o.numberingPlan.callingCode()}else{o.selectNumberingPlan(r);d=r}}else return{};if(!s){return{countryCallingCodeSource:i,countryCallingCode:d}}var u=extractNationalNumber(parseIncompletePhoneNumber(s),undefined,o),l=u.nationalNumber,$=u.carrierCode;var c=getCountryByCallingCode(d,{nationalNumber:l,metadata:o});if(c){a=c;if(c==="001");else{o.selectNumberingPlan(a)}}return{country:a,countryCallingCode:d,countryCallingCodeSource:i,nationalNumber:l,carrierCode:$}}function _typeof$8(e){"@babel/helpers - typeof";return _typeof$8="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$8(e)}function ownKeys$2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function _objectSpread$2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$2(Object(r),!0).forEach((function(t){_defineProperty$2(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$2(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty$2(e,t,r){return(t=_toPropertyKey$8(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey$8(e){var t=_toPrimitive$8(e,"string");return"symbol"==_typeof$8(t)?t:t+""}function _toPrimitive$8(e,t){if("object"!=_typeof$8(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$8(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function parsePhoneNumberWithError(e,t,r){return parse(e,_objectSpread$2(_objectSpread$2({},t),{},{v2:true}),r)}function _typeof$7(e){"@babel/helpers - typeof";return _typeof$7="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$7(e)}function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function _objectSpread$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$1(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty$1(e,t,r){return(t=_toPropertyKey$7(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey$7(e){var t=_toPrimitive$7(e,"string");return"symbol"==_typeof$7(t)?t:t+""}function _toPrimitive$7(e,t){if("object"!=_typeof$7(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$7(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _slicedToArray$2(e,t){return _arrayWithHoles$2(e)||_iterableToArrayLimit$2(e,t)||_unsupportedIterableToArray$5(e,t)||_nonIterableRest$2()}function _nonIterableRest$2(){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 _unsupportedIterableToArray$5(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$5(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$5(e,t):void 0}}function _arrayLikeToArray$5(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function _iterableToArrayLimit$2(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,i,d,s=[],a=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(o=i.call(r)).done)&&(s.push(o.value),s.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{if(!a&&null!=r["return"]&&(d=r["return"](),Object(d)!==d))return}finally{if(u)throw n}}return s}}function _arrayWithHoles$2(e){if(Array.isArray(e))return e}function normalizeArguments$1(e){var t=Array.prototype.slice.call(e),r=_slicedToArray$2(t,4),o=r[0],n=r[1],i=r[2],d=r[3];var s;var a;var u;if(typeof o==="string"){s=o}else throw new TypeError("A text for parsing must be a string.");if(!n||typeof n==="string"){if(d){a=i;u=d}else{a=undefined;u=i}if(n){a=_objectSpread$1({defaultCountry:n},a)}}else if(isObject(n)){if(i){a=n;u=i}else{u=n}}else throw new Error("Invalid second argument: ".concat(n));return{text:s,options:a,metadata:u}}function _typeof$6(e){"@babel/helpers - typeof";return _typeof$6="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$6(e)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return(t=_toPropertyKey$6(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey$6(e){var t=_toPrimitive$6(e,"string");return"symbol"==_typeof$6(t)?t:t+""}function _toPrimitive$6(e,t){if("object"!=_typeof$6(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$6(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function parsePhoneNumber$2(e,t,r){if(t&&t.defaultCountry&&!isSupportedCountry(t.defaultCountry,r)){t=_objectSpread(_objectSpread({},t),{},{defaultCountry:undefined})}try{return parsePhoneNumberWithError(e,t,r)}catch(e){if(e instanceof ParseError);else{throw e}}}function parsePhoneNumber$1(){var e=normalizeArguments$1(arguments),t=e.text,r=e.options,o=e.metadata;return parsePhoneNumber$2(t,r,o)}function _typeof$5(e){"@babel/helpers - typeof";return _typeof$5="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$5(e)}function _classCallCheck$5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$5(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey$5(o.key),o)}}function _createClass$5(e,t,r){return t&&_defineProperties$5(e.prototype,t),r&&_defineProperties$5(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey$5(e){var t=_toPrimitive$5(e,"string");return"symbol"==_typeof$5(t)?t:t+""}function _toPrimitive$5(e,t){if("object"!=_typeof$5(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$5(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var AsYouTypeState=function(){function e(t){var r=t.onCountryChange,o=t.onCallingCodeChange;_classCallCheck$5(this,e);this.onCountryChange=r;this.onCallingCodeChange=o}return _createClass$5(e,[{key:"reset",value:function e(t){var r=t.country,o=t.callingCode;this.international=false;this.missingPlus=false;this.IDDPrefix=undefined;this.callingCode=undefined;this.digits="";this.resetNationalSignificantNumber();this.initCountryAndCallingCode(r,o)}},{key:"resetNationalSignificantNumber",value:function e(){this.nationalSignificantNumber=this.getNationalDigits();this.nationalSignificantNumberIsModified=false;this.nationalPrefix=undefined;this.carrierCode=undefined;this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix=undefined}},{key:"update",value:function e(t){for(var r=0,o=Object.keys(t);r<o.length;r++){var n=o[r];this[n]=t[n]}}},{key:"initCountryAndCallingCode",value:function e(t,r){this.setCountry(t);this.setCallingCode(r)}},{key:"setCountry",value:function e(t){this.country=t;this.onCountryChange(t)}},{key:"setCallingCode",value:function e(t){this.callingCode=t;this.onCallingCodeChange(t,this.country)}},{key:"startInternationalNumber",value:function e(t,r){this.international=true;this.initCountryAndCallingCode(t,r)}},{key:"appendDigits",value:function e(t){this.digits+=t}},{key:"appendNationalSignificantNumberDigits",value:function e(t){this.nationalSignificantNumber+=t}},{key:"getNationalDigits",value:function e(){if(this.international){return this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0))}return this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function e(){if(this.international){if(this.IDDPrefix){return this.digits.slice(this.IDDPrefix.length)}}return this.digits}}])}();function _createForOfIteratorHelperLoose$2(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$4(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$4(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$4(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$4(e,t):void 0}}function _arrayLikeToArray$4(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}var DIGIT_PLACEHOLDER="x";var DIGIT_PLACEHOLDER_MATCHER=new RegExp(DIGIT_PLACEHOLDER);function repeat(e,t){if(t<1){return""}var r="";while(t>1){if(t&1){r+=e}t>>=1;e+=e}return r+e}function cutAndStripNonPairedParens(e,t){if(e[t]===")"){t++}return stripNonPairedParens(e.slice(0,t))}function stripNonPairedParens(e){var t=[];var r=0;while(r<e.length){if(e[r]==="("){t.push(r)}else if(e[r]===")"){t.pop()}r++}var o=0;var n="";t.push(e.length);for(var i=0,d=t;i<d.length;i++){var s=d[i];n+=e.slice(o,s);o=s+1}return n}function populateTemplateWithDigits(e,t,r){for(var o=_createForOfIteratorHelperLoose$2(r.split("")),n;!(n=o()).done;){var i=n.value;if(e.slice(t+1).search(DIGIT_PLACEHOLDER_MATCHER)<0){return}t=e.search(DIGIT_PLACEHOLDER_MATCHER);e=e.replace(DIGIT_PLACEHOLDER_MATCHER,i)}return[e,t]}function formatCompleteNumber(e,t,r){var o=r.metadata,n=r.shouldTryNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix;var d=new RegExp("^(?:".concat(t.pattern(),")$"));if(d.test(e.nationalSignificantNumber)){return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(e,t,{metadata:o,shouldTryNationalPrefixFormattingRule:n,getSeparatorAfterNationalPrefix:i})}}function canFormatCompleteNumber(e,t){return checkNumberLength(e,undefined,t)==="IS_POSSIBLE"}function formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(e,t,r){var o=r.metadata,n=r.shouldTryNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix;if(n(t)){var d=formatNationalNumber(e,t,{useNationalPrefixFormattingRule:true,getSeparatorAfterNationalPrefix:i,metadata:o});if(d){return d}}return formatNationalNumber(e,t,{useNationalPrefixFormattingRule:false,getSeparatorAfterNationalPrefix:i,metadata:o})}function formatNationalNumber(e,t,r){var o=r.metadata,n=r.useNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix;var d=formatNationalNumberUsingFormat(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:n,metadata:o});if(!n){if(e.nationalPrefix){d=e.nationalPrefix+i(t)+d}else if(e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix){d=e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix+" "+d}}if(isValidFormattedNationalNumber(d,e)){return d}}function isValidFormattedNationalNumber(e,t){return parseDigits(e)===t.getNationalDigits()}function _typeof$4(e){"@babel/helpers - typeof";return _typeof$4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$4(e)}function _classCallCheck$4(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey$4(o.key),o)}}function _createClass$4(e,t,r){return t&&_defineProperties$4(e.prototype,t),r&&_defineProperties$4(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey$4(e){var t=_toPrimitive$4(e,"string");return"symbol"==_typeof$4(t)?t:t+""}function _toPrimitive$4(e,t){if("object"!=_typeof$4(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$4(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var PatternParser=function(){function e(){_classCallCheck$4(this,e)}return _createClass$4(e,[{key:"parse",value:function e(t){this.context=[{or:true,instructions:[]}];this.parsePattern(t);if(this.context.length!==1){throw new Error("Non-finalized contexts left when pattern parse ended")}var r=this.context[0],o=r.branches,n=r.instructions;if(o){return{op:"|",args:o.concat([expandSingleElementArray(n)])}}if(n.length===0){throw new Error("Pattern is required")}if(n.length===1){return n[0]}return n}},{key:"startContext",value:function e(t){this.context.push(t)}},{key:"endContext",value:function e(){this.context.pop()}},{key:"getContext",value:function e(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function e(t){if(!t){throw new Error("Pattern is required")}var r=t.match(OPERATOR);if(!r){if(ILLEGAL_CHARACTER_REGEXP.test(t)){throw new Error("Illegal characters found in a pattern: ".concat(t))}this.getContext().instructions=this.getContext().instructions.concat(t.split(""));return}var o=r[1];var n=t.slice(0,r.index);var i=t.slice(r.index+o.length);switch(o){case"(?:":if(n){this.parsePattern(n)}this.startContext({or:true,instructions:[],branches:[]});break;case")":if(!this.getContext().or){throw new Error('")" operator must be preceded by "(?:" operator')}if(n){this.parsePattern(n)}if(this.getContext().instructions.length===0){throw new Error('No instructions found after "|" operator in an "or" group')}var d=this.getContext(),s=d.branches;s.push(expandSingleElementArray(this.getContext().instructions));this.endContext();this.getContext().instructions.push({op:"|",args:s});break;case"|":if(!this.getContext().or){throw new Error('"|" operator can only be used inside "or" groups')}if(n){this.parsePattern(n)}if(!this.getContext().branches){if(this.context.length===1){this.getContext().branches=[]}else{throw new Error('"branches" not found in an "or" group context')}}this.getContext().branches.push(expandSingleElementArray(this.getContext().instructions));this.getContext().instructions=[];break;case"[":if(n){this.parsePattern(n)}this.startContext({oneOfSet:true});break;case"]":if(!this.getContext().oneOfSet){throw new Error('"]" operator must be preceded by "[" operator')}this.endContext();this.getContext().instructions.push({op:"[]",args:parseOneOfSet(n)});break;default:throw new Error("Unknown operator: ".concat(o))}if(i){this.parsePattern(i)}}}])}();function parseOneOfSet(e){var t=[];var r=0;while(r<e.length){if(e[r]==="-"){if(r===0||r===e.length-1){throw new Error("Couldn't parse a one-of set pattern: ".concat(e))}var o=e[r-1].charCodeAt(0)+1;var n=e[r+1].charCodeAt(0)-1;var i=o;while(i<=n){t.push(String.fromCharCode(i));i++}}else{t.push(e[r])}r++}return t}var ILLEGAL_CHARACTER_REGEXP=/[\(\)\[\]\?\:\|]/;var OPERATOR=new RegExp("("+"\\|"+"|"+"\\(\\?\\:"+"|"+"\\)"+"|"+"\\["+"|"+"\\]"+")");function expandSingleElementArray(e){if(e.length===1){return e[0]}return e}function _createForOfIteratorHelperLoose$1(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$3(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$3(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$3(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$3(e,t):void 0}}function _arrayLikeToArray$3(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function _typeof$3(e){"@babel/helpers - typeof";return _typeof$3="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$3(e)}function _classCallCheck$3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey$3(o.key),o)}}function _createClass$3(e,t,r){return t&&_defineProperties$3(e.prototype,t),r&&_defineProperties$3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey$3(e){var t=_toPrimitive$3(e,"string");return"symbol"==_typeof$3(t)?t:t+""}function _toPrimitive$3(e,t){if("object"!=_typeof$3(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$3(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var PatternMatcher=function(){function e(t){_classCallCheck$3(this,e);this.matchTree=(new PatternParser).parse(t)}return _createClass$3(e,[{key:"match",value:function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},o=r.allowOverflow;if(!t){throw new Error("String is required")}var n=_match(t.split(""),this.matchTree,true);if(n&&n.match){delete n.matchedChars}if(n&&n.overflow){if(!o){return}}return n}}])}();function _match(e,t,r){if(typeof t==="string"){var o=e.join("");if(t.indexOf(o)===0){if(e.length===t.length){return{match:true,matchedChars:e}}return{partialMatch:true}}if(o.indexOf(t)===0){if(r){if(e.length>t.length){return{overflow:true}}}return{match:true,matchedChars:e.slice(0,t.length)}}return}if(Array.isArray(t)){var n=e.slice();var i=0;while(i<t.length){var d=t[i];var s=_match(n,d,r&&i===t.length-1);if(!s){return}else if(s.overflow){return s}else if(s.match){n=n.slice(s.matchedChars.length);if(n.length===0){if(i===t.length-1){return{match:true,matchedChars:e}}else{return{partialMatch:true}}}}else{if(s.partialMatch){return{partialMatch:true}}else{throw new Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}}i++}if(r){return{overflow:true}}return{match:true,matchedChars:e.slice(0,e.length-n.length)}}switch(t.op){case"|":var a;for(var u=_createForOfIteratorHelperLoose$1(t.args),l;!(l=u()).done;){var $=l.value;var c=_match(e,$,r);if(c){if(c.overflow){return c}else if(c.match){return{match:true,matchedChars:c.matchedChars}}else{if(c.partialMatch){a=true}else{throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)))}}}}if(a){return{partialMatch:true}}return;case"[]":for(var f=_createForOfIteratorHelperLoose$1(t.args),h;!(h=f()).done;){var p=h.value;if(e[0]===p){if(e.length===1){return{match:true,matchedChars:e}}if(r){return{overflow:true}}return{match:true,matchedChars:[p]}}}return;default:throw new Error("Unsupported instruction tree: ".concat(t))}}function _typeof$2(e){"@babel/helpers - typeof";return _typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$2(e)}function _createForOfIteratorHelperLoose(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$2(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$2(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$2(e,t):void 0}}function _arrayLikeToArray$2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function _classCallCheck$2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey$2(o.key),o)}}function _createClass$2(e,t,r){return t&&_defineProperties$2(e.prototype,t),r&&_defineProperties$2(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey$2(e){var t=_toPrimitive$2(e,"string");return"symbol"==_typeof$2(t)?t:t+""}function _toPrimitive$2(e,t){if("object"!=_typeof$2(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$2(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var DUMMY_DIGIT="9";var LONGEST_NATIONAL_PHONE_NUMBER_LENGTH=15;var LONGEST_DUMMY_PHONE_NUMBER=repeat(DUMMY_DIGIT,LONGEST_NATIONAL_PHONE_NUMBER_LENGTH);var NATIONAL_PREFIX_SEPARATORS_PATTERN=/[- ]/;var CREATE_CHARACTER_CLASS_PATTERN=function(){return/\[([^\[\]])*\]/g};var CREATE_STANDALONE_DIGIT_PATTERN=function(){return/\d(?=[^,}][^,}])/g};var NON_ALTERING_FORMAT_REG_EXP=new RegExp("["+VALID_PUNCTUATION+"]*"+"\\$1"+"["+VALID_PUNCTUATION+"]*"+"(\\$\\d["+VALID_PUNCTUATION+"]*)*"+"$");var MIN_LEADING_DIGITS_LENGTH=3;var AsYouTypeFormatter=function(){function e(t){var r=t.metadata;_classCallCheck$2(this,e);this.metadata=r;this.resetFormat()}return _createClass$2(e,[{key:"resetFormat",value:function e(){this.chosenFormat=undefined;this.template=undefined;this.nationalNumberTemplate=undefined;this.populatedNationalNumberTemplate=undefined;this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function e(t,r){this.resetFormat();if(t){this.isNANP=t.callingCode()==="1";this.matchingFormats=t.formats();if(r.nationalSignificantNumber){this.narrowDownMatchingFormats(r)}}else{this.isNANP=undefined;this.matchingFormats=[]}}},{key:"format",value:function e(t,r){var o=this;if(canFormatCompleteNumber(r.nationalSignificantNumber,this.metadata)){for(var n=_createForOfIteratorHelperLoose(this.matchingFormats),i;!(i=n()).done;){var d=i.value;var s=formatCompleteNumber(r,d,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function e(t){return o.shouldTryNationalPrefixFormattingRule(t,{international:r.international,nationalPrefix:r.nationalPrefix})},getSeparatorAfterNationalPrefix:function e(t){return o.getSeparatorAfterNationalPrefix(t)}});if(s){this.resetFormat();this.chosenFormat=d;this.setNationalNumberTemplate(s.replace(/\d/g,DIGIT_PLACEHOLDER),r);this.populatedNationalNumberTemplate=s;this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(DIGIT_PLACEHOLDER);return s}}}return this.formatNationalNumberWithNextDigits(t,r)}},{key:"formatNationalNumberWithNextDigits",value:function e(t,r){var o=this.chosenFormat;var n=this.chooseFormat(r);if(n){if(n===o){return this.formatNextNationalNumberDigits(t)}else{return this.formatNextNationalNumberDigits(r.getNationalDigits())}}}},{key:"narrowDownMatchingFormats",value:function e(t){var r=this;var o=t.nationalSignificantNumber,n=t.nationalPrefix,i=t.international;var d=o;var s=d.length-MIN_LEADING_DIGITS_LENGTH;if(s<0){s=0}this.matchingFormats=this.matchingFormats.filter((function(e){return r.formatSuits(e,i,n)&&r.formatMatches(e,d,s)}));if(this.chosenFormat&&this.matchingFormats.indexOf(this.chosenFormat)===-1){this.resetFormat()}}},{key:"formatSuits",value:function e(t,r,o){if(o&&!t.usesNationalPrefix()&&!t.nationalPrefixIsOptionalWhenFormattingInNationalFormat()){return false}if(!r&&!o&&t.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()){return false}return true}},{key:"formatMatches",value:function e(t,r,o){var n=t.leadingDigitsPatterns().length;if(n===0){return true}o=Math.min(o,n-1);var i=t.leadingDigitsPatterns()[o];if(r.length<MIN_LEADING_DIGITS_LENGTH){try{return new PatternMatcher(i).match(r,{allowOverflow:true})!==undefined}catch(e){console.error(e);return true}}return new RegExp("^(".concat(i,")")).test(r)}},{key:"getFormatFormat",value:function e(t,r){return r?t.internationalFormat():t.format()}},{key:"chooseFormat",value:function e(t){var r=this;var o=function e(){var o=d.value;if(r.chosenFormat===o){return 0}if(!NON_ALTERING_FORMAT_REG_EXP.test(r.getFormatFormat(o,t.international))){return 1}if(!r.createTemplateForFormat(o,t)){r.matchingFormats=r.matchingFormats.filter((function(e){return e!==o}));return 1}r.chosenFormat=o;return 0},n;for(var i=_createForOfIteratorHelperLoose(this.matchingFormats.slice()),d;!(d=i()).done;){n=o();if(n===0)break;if(n===1)continue}if(!this.chosenFormat){this.resetFormat()}return this.chosenFormat}},{key:"createTemplateForFormat",value:function e(t,r){if(t.pattern().indexOf("|")>=0){return}var o=this.getTemplateForFormat(t,r);if(o){this.setNationalNumberTemplate(o,r);return true}}},{key:"getSeparatorAfterNationalPrefix",value:function e(t){if(this.isNANP){return" "}if(t&&t.nationalPrefixFormattingRule()&&NATIONAL_PREFIX_SEPARATORS_PATTERN.test(t.nationalPrefixFormattingRule())){return" "}return""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function e(t,r){var o=t.IDDPrefix,n=t.missingPlus;if(o){return r&&r.spacing===false?o:o+" "}if(n){return""}return"+"}},{key:"getTemplate",value:function e(t){if(!this.template){return}var r=-1;var o=0;var n=t.international?this.getInternationalPrefixBeforeCountryCallingCode(t,{spacing:false}):"";while(o<n.length+t.getDigitsWithoutInternationalPrefix().length){r=this.template.indexOf(DIGIT_PLACEHOLDER,r+1);o++}return cutAndStripNonPairedParens(this.template,r+1)}},{key:"setNationalNumberTemplate",value:function e(t,r){this.nationalNumberTemplate=t;this.populatedNationalNumberTemplate=t;this.populatedNationalNumberTemplatePosition=-1;if(r.international){this.template=this.getInternationalPrefixBeforeCountryCallingCode(r).replace(/[\d\+]/g,DIGIT_PLACEHOLDER)+repeat(DIGIT_PLACEHOLDER,r.callingCode.length)+" "+t}else{this.template=t}}},{key:"getTemplateForFormat",value:function e(t,r){var o=r.nationalSignificantNumber,n=r.international,i=r.nationalPrefix,d=r.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix;var s=t.pattern();{s=s.replace(CREATE_CHARACTER_CLASS_PATTERN(),"\\d").replace(CREATE_STANDALONE_DIGIT_PATTERN(),"\\d")}var a=LONGEST_DUMMY_PHONE_NUMBER.match(s)[0];if(o.length>a.length){return}var u=new RegExp("^"+s+"$");var l=o.replace(/\d/g,DUMMY_DIGIT);if(u.test(l)){a=l}var $=this.getFormatFormat(t,n);var c;if(this.shouldTryNationalPrefixFormattingRule(t,{international:n,nationalPrefix:i})){var f=$.replace(FIRST_GROUP_PATTERN,t.nationalPrefixFormattingRule());if(parseDigits(t.nationalPrefixFormattingRule())===(i||"")+parseDigits("$1")){$=f;c=true;if(i){var h=i.length;while(h>0){$=$.replace(/\d/,DIGIT_PLACEHOLDER);h--}}}}var p=a.replace(new RegExp(s),$).replace(new RegExp(DUMMY_DIGIT,"g"),DIGIT_PLACEHOLDER);if(!c){if(d){p=repeat(DIGIT_PLACEHOLDER,d.length)+" "+p}else if(i){p=repeat(DIGIT_PLACEHOLDER,i.length)+this.getSeparatorAfterNationalPrefix(t)+p}}if(n){p=applyInternationalSeparatorStyle(p)}return p}},{key:"formatNextNationalNumberDigits",value:function e(t){var r=populateTemplateWithDigits(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,t);if(!r){this.resetFormat();return}this.populatedNationalNumberTemplate=r[0];this.populatedNationalNumberTemplatePosition=r[1];return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1)}},{key:"shouldTryNationalPrefixFormattingRule",value:function e(t,r){var o=r.international,n=r.nationalPrefix;if(t.nationalPrefixFormattingRule()){var i=t.usesNationalPrefix();if(i&&n||!i&&!o){return true}}}}])}();function _typeof$1(e){"@babel/helpers - typeof";return _typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$1(e)}function _slicedToArray$1(e,t){return _arrayWithHoles$1(e)||_iterableToArrayLimit$1(e,t)||_unsupportedIterableToArray$1(e,t)||_nonIterableRest$1()}function _nonIterableRest$1(){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 _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function _iterableToArrayLimit$1(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,i,d,s=[],a=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(o=i.call(r)).done)&&(s.push(o.value),s.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{if(!a&&null!=r["return"]&&(d=r["return"](),Object(d)!==d))return}finally{if(u)throw n}}return s}}function _arrayWithHoles$1(e){if(Array.isArray(e))return e}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey$1(o.key),o)}}function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey$1(e){var t=_toPrimitive$1(e,"string");return"symbol"==_typeof$1(t)?t:t+""}function _toPrimitive$1(e,t){if("object"!=_typeof$1(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof$1(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART="["+VALID_PUNCTUATION+VALID_DIGITS+"]+";var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN=new RegExp("^"+VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART+"$","i");var VALID_FORMATTED_PHONE_NUMBER_PART="(?:"+"["+PLUS_CHARS+"]"+"["+VALID_PUNCTUATION+VALID_DIGITS+"]*"+"|"+"["+VALID_PUNCTUATION+VALID_DIGITS+"]+"+")";var AFTER_PHONE_NUMBER_DIGITS_END_PATTERN=new RegExp("[^"+VALID_PUNCTUATION+VALID_DIGITS+"]+"+".*"+"$");var COMPLEX_NATIONAL_PREFIX=/[^\d\[\]]/;var AsYouTypeParser=function(){function e(t){var r=t.defaultCountry,o=t.defaultCallingCode,n=t.metadata,i=t.onNationalSignificantNumberChange;_classCallCheck$1(this,e);this.defaultCountry=r;this.defaultCallingCode=o;this.metadata=n;this.onNationalSignificantNumberChange=i}return _createClass$1(e,[{key:"input",value:function e(t,r){var o=extractFormattedDigitsAndPlus(t),n=_slicedToArray$1(o,2),i=n[0],d=n[1];var s=parseDigits(i);var a;if(d){if(!r.digits){r.startInternationalNumber(undefined,undefined);if(!s){a=true}}}if(s){this.inputDigits(s,r)}return{digits:s,justLeadingPlus:a}}},{key:"inputDigits",value:function e(t,r){var o=r.digits;var n=o.length<3&&o.length+t.length>=3;r.appendDigits(t);if(n){this.extractIddPrefix(r)}if(this.isWaitingForCountryCallingCode(r)){if(!this.extractCountryCallingCode(r)){return}}else{r.appendNationalSignificantNumberDigits(t)}if(!r.international){if(!this.hasExtractedNationalSignificantNumber){this.extractNationalSignificantNumber(r.getNationalDigits(),(function(e){return r.update(e)}))}}}},{key:"isWaitingForCountryCallingCode",value:function e(t){var r=t.international,o=t.callingCode;return r&&!o}},{key:"extractCountryCallingCode",value:function e(t){var r=extractCountryCallingCode("+"+t.getDigitsWithoutInternationalPrefix(),t.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),o=r.countryCallingCode,n=r.number;if(o){t.setCallingCode(o);t.update({nationalSignificantNumber:n});return true}}},{key:"reset",value:function e(t){if(t){this.hasSelectedNumberingPlan=true;var r=t._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=r&&COMPLEX_NATIONAL_PREFIX.test(r)}else{this.hasSelectedNumberingPlan=undefined;this.couldPossiblyExtractAnotherNationalSignificantNumber=undefined}}},{key:"extractNationalSignificantNumber",value:function e(t,r){if(!this.hasSelectedNumberingPlan){return}var o=extractNationalNumberFromPossiblyIncompleteNumber(t,this.metadata),n=o.nationalPrefix,i=o.nationalNumber,d=o.carrierCode;if(i===t){return}this.onExtractedNationalNumber(n,d,i,t,r);return true}},{key:"extractAnotherNationalSignificantNumber",value:function e(t,r,o){if(!this.hasExtractedNationalSignificantNumber){return this.extractNationalSignificantNumber(t,o)}if(!this.couldPossiblyExtractAnotherNationalSignificantNumber){return}var n=extractNationalNumberFromPossiblyIncompleteNumber(t,this.metadata),i=n.nationalPrefix,d=n.nationalNumber,s=n.carrierCode;if(d===r){return}this.onExtractedNationalNumber(i,s,d,t,o);return true}},{key:"onExtractedNationalNumber",value:function e(t,r,o,n,i){var d=false;var s;var a=n.lastIndexOf(o);if(a<0||a!==n.length-o.length){d=true}else{var u=n.slice(0,a);if(u){if(u!==t){s=u}}}i({nationalPrefix:t,carrierCode:r,nationalSignificantNumber:o,nationalSignificantNumberIsModified:d,prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix:s});this.hasExtractedNationalSignificantNumber=true;this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function e(t){if(this.extractAnotherNationalSignificantNumber(t.getNationalDigits(),t.nationalSignificantNumber,(function(e){return t.update(e)}))){return true}if(this.extractIddPrefix(t)){this.extractCallingCodeAndNationalSignificantNumber(t);return true}if(this.fixMissingPlus(t)){this.extractCallingCodeAndNationalSignificantNumber(t);return true}}},{key:"extractIddPrefix",value:function e(t){var r=t.international,o=t.IDDPrefix,n=t.digits;if(r||o){return}var i=stripIddPrefix(n,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);if(i!==undefined&&i!==n){t.update({IDDPrefix:n.slice(0,n.length-i.length)});this.startInternationalNumber(t,{country:undefined,callingCode:undefined});return true}}},{key:"fixMissingPlus",value:function e(t){if(!t.international){var r=extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(t.digits,t.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),o=r.countryCallingCode;if(o){t.update({missingPlus:true});this.startInternationalNumber(t,{country:t.country,callingCode:o});return true}}}},{key:"startInternationalNumber",value:function e(t,r){var o=r.country,n=r.callingCode;t.startInternationalNumber(o,n);if(t.nationalSignificantNumber){t.resetNationalSignificantNumber();this.onNationalSignificantNumberChange();this.hasExtractedNationalSignificantNumber=undefined}}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function e(t){if(this.extractCountryCallingCode(t)){this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}}}])}();function extractFormattedPhoneNumber(e){var t=e.search(VALID_FORMATTED_PHONE_NUMBER_PART);if(t<0){return}e=e.slice(t);var r;if(e[0]==="+"){r=true;e=e.slice("+".length)}e=e.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN,"");if(r){e="+"+e}return e}function _extractFormattedDigitsAndPlus(e){var t=extractFormattedPhoneNumber(e)||"";if(t[0]==="+"){return[t.slice("+".length),true]}return[t]}function extractFormattedDigitsAndPlus(e){var t=_extractFormattedDigitsAndPlus(e),r=_slicedToArray$1(t,2),o=r[0],n=r[1];if(!VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN.test(o)){o=""}return[o,n]}function _typeof(e){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,i,d,s=[],a=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(o=i.call(r)).done)&&(s.push(o.value),s.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{if(!a&&null!=r["return"]&&(d=r["return"](),Object(d)!==d))return}finally{if(u)throw n}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var AsYouType$1=function(){function e(t,r){_classCallCheck(this,e);this.metadata=new Metadata(r);var o=this.getCountryAndCallingCode(t),n=_slicedToArray(o,2),i=n[0],d=n[1];this.defaultCountry=i;this.defaultCallingCode=d;this.reset()}return _createClass(e,[{key:"getCountryAndCallingCode",value:function e(t){var r;var o;if(t){if(isObject(t)){r=t.defaultCountry;o=t.defaultCallingCode}else{r=t}}if(r&&!this.metadata.hasCountry(r)){r=undefined}return[r,o]}},{key:"input",value:function e(t){var r=this.parser.input(t,this.state),o=r.digits,n=r.justLeadingPlus;if(n){this.formattedOutput="+"}else if(o){this.determineTheCountryIfNeeded();if(this.state.nationalSignificantNumber){this.formatter.narrowDownMatchingFormats(this.state)}var i;if(this.metadata.hasSelectedNumberingPlan()){i=this.formatter.format(o,this.state)}if(i===undefined){if(this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var d=this.state.getNationalDigits();if(d){i=this.formatter.format(d,this.state)}}}this.formattedOutput=i?this.getFullNumber(i):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function e(){var t=this;this.state=new AsYouTypeState({onCountryChange:function e(r){t.country=r},onCallingCodeChange:function e(r,o){t.metadata.selectNumberingPlan(o||r);t.formatter.reset(t.metadata.numberingPlan,t.state);t.parser.reset(t.metadata.numberingPlan)}});this.formatter=new AsYouTypeFormatter({state:this.state,metadata:this.metadata});this.parser=new AsYouTypeParser({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function e(){t.determineTheCountryIfNeeded();t.formatter.reset(t.metadata.numberingPlan,t.state)}});this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode});this.formattedOutput="";return this}},{key:"isInternational",value:function e(){return this.state.international}},{key:"getCallingCode",value:function e(){if(this.isInternational()){return this.state.callingCode}}},{key:"getCountryCallingCode",value:function e(){return this.getCallingCode()}},{key:"getCountry",value:function e(){var t=this.state.digits;if(t){return this._getCountry()}}},{key:"_getCountry",value:function e(){var t=this.state.country;return t}},{key:"determineTheCountryIfNeeded",value:function e(){if(!this.state.country||this.isCountryCallingCodeAmbiguous()){this.determineTheCountry()}}},{key:"getFullNumber",value:function e(t){var r=this;if(this.isInternational()){var o=function e(t){return r.formatter.getInternationalPrefixBeforeCountryCallingCode(r.state,{spacing:t?true:false})+t};var n=this.state.callingCode;if(!n){return o("".concat(this.state.getDigitsWithoutInternationalPrefix()))}if(!t){return o(n)}return o("".concat(n," ").concat(t))}return t}},{key:"getNonFormattedNationalNumberWithPrefix",value:function e(){var t=this.state,r=t.nationalSignificantNumber,o=t.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,n=t.nationalPrefix;var i=r;var d=o||n;if(d){i=d+i}return i}},{key:"getNonFormattedNumber",value:function e(){var t=this.state.nationalSignificantNumberIsModified;return this.getFullNumber(t?this.state.getNationalDigits():this.getNonFormattedNationalNumberWithPrefix())}},{key:"getNonFormattedTemplate",value:function e(){var t=this.getNonFormattedNumber();if(t){return t.replace(/[\+\d]/g,DIGIT_PLACEHOLDER)}}},{key:"isCountryCallingCodeAmbiguous",value:function e(){var t=this.state.callingCode;var r=this.metadata.getCountryCodesForCallingCode(t);return r&&r.length>1}},{key:"determineTheCountry",value:function e(){var t=getCountryByCallingCode(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,metadata:this.metadata});if(t!==this.state.country){this.state.setCountry(t);if(t){this.metadata.selectNumberingPlan(t)}}}},{key:"getNumberValue",value:function e(){var t=this.state,r=t.digits,o=t.callingCode,n=t.country,i=t.nationalSignificantNumber;if(!r){return}if(this.isInternational()){if(o){return"+"+o+i}else{return"+"+r}}else{if(n||o){var d=n?this.metadata.countryCallingCode():o;return"+"+d+i}}}},{key:"getNumber",value:function e(){var t=this.state,r=t.nationalSignificantNumber,o=t.carrierCode,n=t.callingCode;if(!r){return}var i=this._getCountry();if(!i&&!n){return}if(i){if(i===this.defaultCountry){var d=this.metadata.numberingPlan.callingCode();var s=getExactCountryForMultiCountryCallingCode(d,r,this.metadata);if(s){i=s}}}var a=new PhoneNumber(i||n,r,this.metadata.metadata);if(o){a.carrierCode=o}return a}},{key:"isPossible",value:function e(){var t=this.getNumber();if(!t){return false}return t.isPossible()}},{key:"isValid",value:function e(){var t=this.getNumber();if(!t){return false}return t.isValid()}},{key:"validateLength",value:function e(){var t=this.state,r=t.digits,o=t.nationalSignificantNumber;if(!r){return"NOT_A_NUMBER"}if(!this.metadata.numberingPlan){return"INVALID_COUNTRY"}if(!o){return"TOO_SHORT"}var n=checkNumberLength(o,undefined,this.metadata);if(n!=="IS_POSSIBLE"){return n}}},{key:"getNationalNumber",value:function e(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function e(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function e(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}])}();function getExactCountryForMultiCountryCallingCode(e,t,r){var o=r.getCountryCodesForCallingCode(e);if(o.length>1){return getCountryByNationalNumber(t,o,r.metadata)}}function parsePhoneNumber(){return withMetadataArgument(parsePhoneNumber$1,arguments)}function AsYouType(e){return AsYouType$1.call(this,e,metadata)}AsYouType.prototype=Object.create(AsYouType$1.prototype,{});AsYouType.prototype.constructor=AsYouType;function normalizeArguments(e){var t=e[0];var r=e[1];var o=e[2];var n=e[3];var i;var d={};var s;if(typeof t==="string"){if(!isObject(r)){if(n){d=o;s=n}else{s=o}if(isViablePhoneNumber(t)){i=parse(t,{defaultCountry:r},s)}else{i={}}}else{if(o){d=r;s=o}else{s=r}if(isViablePhoneNumber(t)){i=parse(t,undefined,s)}else{i={}}}}else if(isObject(t)){i=t;if(o){d=r;s=o}else{s=r}}else throw new TypeError("A phone number must either be a string or an object of shape { phone, [country] }.");return{input:i,options:d,metadata:s}}function isPossibleNumber$1(){var e=normalizeArguments(arguments),t=e.input,r=e.options,o=e.metadata;if(!t.phone&&!(r&&r.v2)){return false}return isPossiblePhoneNumber(t,r,o)}function isPossibleNumber(){return withMetadataArgument(isPossibleNumber$1,arguments)}var ChevronDownIcon$1='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosStripePhoneInputCss='.sc-zonos-stripe-phone-input-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-stripe-phone-input-h *.sc-zonos-stripe-phone-input{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-stripe-phone-input-h img.sc-zonos-stripe-phone-input{max-width:100%}.sc-zonos-stripe-phone-input-h dl.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h dd.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h1.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h2.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h3.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h4.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h5.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h6.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h hr.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h figure.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h p.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h pre.sc-zonos-stripe-phone-input{margin:0}.sc-zonos-stripe-phone-input-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-stripe-phone-input-h{--zonos--background-color:#f1f1f1;--zonos--local-glowing-color:0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 0 0 1px var(--zonos--primary-color);--zonos--border:1px solid #e8e8e8;margin:1px;position:relative;display:block}.dark.sc-zonos-stripe-phone-input-h,[data-theme=DARK].sc-zonos-stripe-phone-input-h{color-scheme:dark;--zonos--background-color:#30313d;--zonos--local-glowing-color:0px 2px 4px rgba(0, 0, 0, 0.5),\n 0px 1px 6px rgba(0, 0, 0, 0.25), 0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 1px 1px 0 rgba(255, 255, 255, 0.12);--zonos--border:1px solid var(--zonos--primary-color)}.sc-zonos-stripe-phone-input-h{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:4px;position:relative;width:100%}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.sc-zonos-stripe-phone-input{position:relative;width:100%;display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch;height:calc(var(--zonos-elements-size-xl) - 2px);background:var(--zonos--background-color);border-radius:var(--zonos--border-radius);border:var(--zonos--border);outline-offset:0;outline-width:2px;overflow:visible}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.sc-zonos-stripe-phone-input .zonos--select.sc-zonos-stripe-phone-input{position:absolute;opacity:0;inset:0;width:100%;cursor:pointer}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.sc-zonos-stripe-phone-input .zonos--input-group.sc-zonos-stripe-phone-input{display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch;width:100%;height:100%;pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.focused.sc-zonos-stripe-phone-input::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius);-webkit-box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.has-error.sc-zonos-stripe-phone-input::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius);-webkit-box-shadow:0 0 0 2px #df1b41;box-shadow:0 0 0 2px #df1b41;pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.disabled.sc-zonos-stripe-phone-input{opacity:var(--zonos-elements-opacity-disabled);cursor:not-allowed;pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--select-wrapper.sc-zonos-stripe-phone-input{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer}.sc-zonos-stripe-phone-input-h .zonos--select-wrapper.sc-zonos-stripe-phone-input:hover{background-color:rgba(0, 0, 0, 0.02)}.sc-zonos-stripe-phone-input-h .zonos--input-container.sc-zonos-stripe-phone-input{-ms-flex:1;flex:1;position:relative;z-index:2;pointer-events:all}.sc-zonos-stripe-phone-input-h .zonos--input-container.has-label.sc-zonos-stripe-phone-input .zonos--floated-input.sc-zonos-stripe-phone-input{padding:24px 12px 2px}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input{background:transparent;border:none;width:100%;height:100%;padding:0 12px;font-size:var(--zonos--font-size);color:var(--zonos-elements-text-color);outline:none;-webkit-box-sizing:border-box;box-sizing:border-box}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:disabled{cursor:not-allowed}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input::-webkit-input-placeholder{opacity:0;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input::-moz-placeholder{opacity:0;-moz-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:-ms-input-placeholder{opacity:0;-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input::-ms-input-placeholder{opacity:0;-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input::placeholder{opacity:0;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus:-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus::placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-label.sc-zonos-stripe-phone-input{display:block;max-height:0;pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--floated-label.sc-zonos-stripe-phone-input label.sc-zonos-stripe-phone-input{color:var(--zonos-elements-gray-800);position:absolute;font-size:16px;line-height:16px;display:inline-block;-webkit-filter:blur(0);filter:blur(0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);left:12px;top:calc(50% - 8px);z-index:1}.sc-zonos-stripe-phone-input-h .has-content.sc-zonos-stripe-phone-input .zonos--input-container.sc-zonos-stripe-phone-input .zonos--floated-label.sc-zonos-stripe-phone-input label.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h .focused.sc-zonos-stripe-phone-input .zonos--input-container.sc-zonos-stripe-phone-input .zonos--floated-label.sc-zonos-stripe-phone-input label.sc-zonos-stripe-phone-input{top:11px;-webkit-transform:scale(0.8);transform:scale(0.8)}.zonos--country-select.sc-zonos-stripe-phone-input{position:relative;height:100%}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-select-content.sc-zonos-stripe-phone-input{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-left:12px;height:100%;z-index:1}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-select-selected.sc-zonos-stripe-phone-input{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--select-chevron-wrapper.sc-zonos-stripe-phone-input{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-left:4px}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--select-chevron-wrapper.sc-zonos-stripe-phone-input .zonos--select-chevron.sc-zonos-stripe-phone-input{pointer-events:none;color:var(--zonos-elements-gray-800);padding-left:4px}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-flag-wrapper.sc-zonos-stripe-phone-input{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-flag.sc-zonos-stripe-phone-input{border-radius:var(--zonos-elements-radius-4);width:20px;height:16px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium)}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-code.sc-zonos-stripe-phone-input{font-size:var(--zonos--font-size);color:var(--zonos-elements-text-color)}';var ZonosStripePhoneInputStyle0=zonosStripePhoneInputCss;var inputId=0;var ZonosStripePhoneInput=function(){function e(e){var t=this;registerInstance(this,e);this.inputValueChange=createEvent(this,"inputValueChange",7);this.inputId="zonos--phone-input-".concat(++inputId);this.inheritedAttributes={};this.autoComplete="";this.countryOptions=null;this.disabled=false;this.countryCode=null;this.phoneNumber="";this.isFocused=false;this.isSelectOpen=false;this.handleCountryChange=function(e){var r;var o=e.target;var n=(r=t.countryOptions)===null||r===void 0?void 0:r[o.value];t.selectedCountry=n;t.updatePhoneFormatter();var i=t.validatePhoneNumber(),d=i.isEmpty,s=i.valid,a=i.wrongFormat;t.inputValueChange.emit({countryCode:(n===null||n===void 0?void 0:n.countryCode)||null,isEmpty:d,phoneNumber:t.phoneNumber,valid:s,wrongFormat:a})};this.handlePhoneChange=function(e){var r,o;var n=e.target;var i=n.value.replace(/[^0-9]/g,"");if(t.asYouType){t.asYouType.reset();var d=t.asYouType.input(i);t.phoneNumber=((r=t.asYouType.getNumber())===null||r===void 0?void 0:r.number)||"";n.value=d}else{t.phoneNumber=i}var s=t.validatePhoneNumber(),a=s.isEmpty,u=s.valid,l=s.wrongFormat;t.inputValueChange.emit({countryCode:((o=t.selectedCountry)===null||o===void 0?void 0:o.countryCode)||null,isEmpty:a,phoneNumber:t.phoneNumber,valid:u,wrongFormat:l})};this.handleFocus=function(){t.isFocused=true};this.handleBlur=function(){t.isFocused=false};this.isCountryCode=function(e){var r;return((r=t.countryOptions)===null||r===void 0?void 0:r[e])!==undefined};this.initPhoneNumberValue=function(){var e;if(!t.countryOptions){return}var r=(e=parsePhoneNumber(t.inputValue||"",{defaultCountry:t.countryCode}))===null||e===void 0?void 0:e.country;var o=r&&t.isCountryCode(r)?r:t.countryCode;var n=Object.values(t.countryOptions).find(Boolean);if(!o){t.selectedCountry=n;var i=t.validatePhoneNumber(),d=i.isEmpty,s=i.valid,a=i.wrongFormat;t.inputValueChange.emit({countryCode:(n===null||n===void 0?void 0:n.countryCode)||null,isEmpty:d,phoneNumber:t.phoneNumber,valid:s,wrongFormat:a});return}t.selectedCountry=t.countryOptions[o]||n;t.phoneNumber=t.inputValue||"";t.updatePhoneFormatter()}}e.prototype.onCountryCodeChange=function(){this.initPhoneNumberValue()};e.prototype.onCountryOptionsChange=function(){this.initPhoneNumberValue()};e.prototype.onSelectedCountryChange=function(){this.updatePhoneFormatter()};e.prototype.onPhoneNumberChange=function(){this.phoneNumber=this.inputValue||"";this.updatePhoneFormatter()};e.prototype.validatePhoneNumber=function(){var e;if(!this.phoneNumber){return{isEmpty:true,valid:false,wrongFormat:false}}var t=((e=this.asYouType.getNumber())===null||e===void 0?void 0:e.number)||"";var r=isPossibleNumber(t);return{isEmpty:false,valid:r,wrongFormat:!r}};e.prototype.updatePhoneFormatter=function(){var e,t,r,o;var n=Object.values(this.countryOptions||[]).find(Boolean);var i=((e=this.selectedCountry)===null||e===void 0?void 0:e.countryCode)||(n===null||n===void 0?void 0:n.countryCode)||"US";this.asYouType=new AsYouType(i);if(this.phoneNumber){this.asYouType.input(this.phoneNumber);if(this.inputRef){this.inputRef.value=((t=this.asYouType.getNumber())===null||t===void 0?void 0:t.formatNational())||"";var d=this.validatePhoneNumber(),s=d.isEmpty,a=d.valid,u=d.wrongFormat;this.inputValueChange.emit({countryCode:((r=this.selectedCountry)===null||r===void 0?void 0:r.countryCode)||null,isEmpty:s,phoneNumber:((o=this.asYouType.getNumber())===null||o===void 0?void 0:o.number)||"",valid:a,wrongFormat:u})}}};e.prototype.componentWillLoad=function(){this.inheritedAttributes=Object.assign(Object.assign({},inheritAriaAttributes(this.el)),inheritAttributes(this.el,["tabindex","title","data-form-type","dir"]));this.initPhoneNumberValue()};e.prototype.componentDidLoad=function(){this.initPhoneNumberValue()};e.prototype.render=function(){var e=this;var t;var r=this.overridePrimaryColor||zonosStore.appearance.colorPrimary;var o=this.overrideSecondaryColor||zonosStore.appearance.colorSecondary;var n=r&&isDarkColor(r);var i=zonosStore.appearance.fontSizeInputValue||16;var d=!!this.phoneNumber;var s=this.countryOptions?Object.values(this.countryOptions).filter(Boolean).sort((function(e,t){return e.displayName.localeCompare(t.displayName)})):[];return h(Host,{key:"e2a1fc4c2e5f57dc1ae904b70b5f7f421297ae0c",class:classes(["zonos--phone-input zonos--elements",n&&"dark"]),"data-theme":n?"DARK":"LIGHT",style:Object.assign({"--zonos--border-radius":getBorderRadius(),"--zonos--font-family":zonosStoreFontFamily(),"--zonos--font-size":"".concat(i,"px"),"--zonos--primary-color":o},this.minWidth?{"--zonos--min-width":this.minWidth}:{})},h("div",{key:"61a2ee1f566234692a80fe68fbc4d171f36263dc",class:classes(["zonos--label-wrapper",this.disabled&&"disabled",this.isFocused&&"focused",d&&"has-content",this.error&&"has-error",this.inputLabel&&"has-label"])},h("select",{key:"32602cf340a06a26c483f049595cdd812826275e",class:"zonos--select",disabled:this.disabled,onBlur:this.handleBlur,onChange:this.handleCountryChange,onFocus:this.handleFocus},s.map((function(t){var r;return h("option",{key:t.countryCode,selected:t.countryCode===((r=e.selectedCountry)===null||r===void 0?void 0:r.countryCode),value:t.countryCode},t.displayName," (+",t.phoneCode,")")}))),h("div",{key:"1a36aa363a853c420303241e75d89e5aa298dee9",class:"zonos--input-group"},h("div",{key:"7f4d30619c8f69b98422bfcab964113d598d45fa",class:"zonos--select-wrapper"},h("div",{key:"44d0f28dde38fc09ce612ad4cb78f9d1fbdbe951",class:"zonos--country-select"},h("div",{key:"c438e242374e303688150aec2c8eae51b6e1427d",class:"zonos--country-select-content"},this.selectedCountry&&h("div",{key:"2aaec2a6315d2ee84244c4458efce6d27c8598ad",class:"zonos--country-select-selected"},h("div",{key:"819a8b6fd270e43992c19a4b96a4ce5335ae166f",class:"zonos--country-flag-wrapper"},h("zonos-country-flag",{key:"090e6ce55541db022a55497b1b3a6fa7ff2b5406",class:"zonos--country-flag",countryCode:this.selectedCountry.countryCode})),h("div",{key:"021bc4bf590fb6dca736478cc8f9914ce764c1ab",class:"zonos--country-code"},"+",this.selectedCountry.phoneCode)),h("div",{key:"f7256f51c803d1b5aedb3b5d646a777cb553aa9d",class:"zonos--select-chevron-wrapper"},h("zonos-icon",{key:"a018c3fffc1c029df874d9be3c938307b4609d82","aria-label":"Expand collapsed section",class:"zonos--select-chevron",content:ChevronDownIcon$1,iconColor:"gray-800"}))))),h("div",{key:"dd20516acf7d5cab10fe91ff4a6f59cc91600732",class:classes(["zonos--input-container",this.inputLabel&&"has-label",d&&"has-content"])},h("input",Object.assign({key:"ed8b536ba7aac9bae8012692ceb9f8573640c5d6"},this.inheritedAttributes,{autoComplete:this.autoComplete,class:"zonos--floated-input",disabled:this.disabled,id:this.inputId,onBlur:this.handleBlur,onFocus:this.handleFocus,onInput:this.handlePhoneChange,placeholder:((t=this.selectedCountry)===null||t===void 0?void 0:t.phonePlaceholder)||"",ref:function(t){return e.inputRef=t},type:"tel"})),this.inputLabel&&h("div",{key:"be2ae82b335dd291d53f48a73f9b23744392daf6",class:"zonos--floated-label"},h("label",{key:"1894a34c3a5ea09b2b45e8dfc9103d944ac69118",htmlFor:this.inputId},this.inputLabel||translate("Phone number")))))),this.error&&h("zonos-text",{key:"ae0ab1f97abbecf8dda4eced5aa139d8c51decaf",textColor:"red-600"},this.error))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{countryCode:["onCountryCodeChange"],countryOptions:["onCountryOptionsChange"],selectedCountry:["onSelectedCountryChange"],inputValue:["onPhoneNumberChange"]}},enumerable:false,configurable:true});return e}();ZonosStripePhoneInput.style=ZonosStripePhoneInputStyle0;var ChevronDownIcon='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var RemoveLineIcon='<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M14.475 10.586a.75.75 0 1 0-1.06-1.06L12 10.938l-1.414-1.414a.75.75 0 0 0-1.06 1.06L10.938 12l-1.414 1.414a.75.75 0 1 0 1.06 1.06L12 13.062l1.414 1.414a.75.75 0 0 0 1.06-1.06L13.062 12l1.414-1.414Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>';var zonosStripeSelectCss=':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--background-color:#f1f1f1;--zonos--local-glowing-color:0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 0 0 1px var(--zonos--primary-color);--zonos--border:1px solid #e8e8e8}:host(.dark){color-scheme:dark;--zonos--background-color:#30313d;--zonos--local-glowing-color:0px 2px 4px rgba(0, 0, 0, 0.5),\n 0px 1px 6px rgba(0, 0, 0, 0.25), 0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 1px 1px 0 rgba(255, 255, 255, 0.12);--zonos--border:1px solid var(--zonos--primary-color)}:host{margin:1px;position:relative;min-width:var(--zonos--min-width, unset)}:host .zonos--label-wrapper{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:calc(var(--zonos-elements-size-xl) - 4px);width:100%;background:var(--zonos--background-color);border-radius:var(--zonos--border-radius);border:var(--zonos--border);outline-offset:0;outline-width:2px}:host .zonos--floated-select{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;padding:0 36px 0 16px;outline:none;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);width:100%;border-radius:var(--zonos--border-radius);background:var(--zonos--background-color);border:var(--zonos--border);-ms-flex-order:2;order:2;font-weight:400;font-size:var(--zonos--font-size);color:var(--zonos--background-color);-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}:host .zonos--floated-select.has-label{padding:24px 36px 2px 16px}:host .zonos--floated-select:focus{outline:none;border:var(--zonos--border)}:host .zonos--floated-select:focus~.zonos--floated-label::after{-webkit-box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color))}:host .zonos--floated-select.has-error+.zonos--floated-label::after{-webkit-box-shadow:0 0 0 2px #df1b41;box-shadow:0 0 0 2px #df1b41}:host .zonos--floated-select.has-content,:host .zonos--floated-select:focus{color:var(--zonos-elements-text-color)}:host .zonos--floated-select.has-content~.zonos--floated-label label,:host .zonos--floated-select:focus~.zonos--floated-label label{top:11px;-webkit-transform:scale(0.8);transform:scale(0.8)}:host .zonos--floated-select:-webkit-autofill,:host .zonos--floated-select:-moz-autofill{background-color:var(--zonos-elements-input-background);color:var(--zonos-elements-text-color)}:host .zonos--floated-select option{background-color:var(--zonos--background-color);color:inherit}:host .zonos--floated-label{display:block;max-height:0;pointer-events:none;-ms-flex-order:1;order:1}:host .zonos--floated-label label{color:var(--zonos-elements-gray-800);position:absolute;font-size:16px;line-height:16px;display:inline-block;-webkit-filter:blur(0);filter:blur(0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);margin-left:16px;top:calc(50% - 8px);z-index:1}:host .zonos--floated-label::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius)}:host .zonos--actions-wrapper{position:absolute;right:8px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);z-index:1;pointer-events:none;display:-ms-flexbox;display:flex}:host .zonos--select-chevron{cursor:pointer;color:var(--zonos-elements-gray-800);z-index:1}:host{}:host .disabled .zonos--floated-label{pointer-events:inherit}:host .disabled .zonos--floated-label::after{cursor:not-allowed;z-index:1}:host .disabled .zonos--select-chevron{opacity:0.5}.zonos--clear-button{background:none;border:none;pointer-events:auto;cursor:pointer}.zonos--clear-button:hover{-webkit-filter:brightness(0.8);filter:brightness(0.8)}:host(.dark) .zonos--label-wrapper{background:#30313d}';var ZonosStripeSelectStyle0=zonosStripeSelectCss;var selectId=0;var ZonosStripeSelect=function(){function e(e){var t=this;registerInstance(this,e);this.selectChange=createEvent(this,"selectChange",7);this.inheritedAttributes={};this.selectId="zonos--select-".concat(++selectId);this.selectedValue="";this.isDisabled=false;this.isError=false;this.error="";this.selectPlaceholder="";this.options=[];this.autoComplete="";this.value="";this.required=false;this.isClearable=false;this.internalValue=this.selectedValue;this.internalOptions=this.options;this.handleClear=function(e){e.stopPropagation();t.internalValue="";t.selectChange.emit("");t.el.selectedValue="";t.el.dispatchEvent(new Event("change"))}}e.prototype.onOptionsChange=function(e){this.internalOptions=e};e.prototype.onSelectedValueChange=function(e){this.internalValue=e;this.selectChange.emit(e);this.value=e;this.handleNotFoundOption(e)};e.prototype.onValueChange=function(e){this.internalValue=e;this.handleNotFoundOption(e)};e.prototype.handleNotFoundOption=function(e){var t=this.internalOptions.find((function(t){return t.value===e||t.label===e}));if(!t){this.internalValue="";this.selectChange.emit("")}};e.prototype.componentWillLoad=function(){this.inheritedAttributes=Object.assign(Object.assign({},inheritAriaAttributes(this.el)),inheritAttributes(this.el,["tabindex","title","data-form-type","dir"]))};e.prototype.render=function(){var e=this;var t=this.overridePrimaryColor||zonosStore.appearance.colorPrimary;var r=this.overrideSecondaryColor||zonosStore.appearance.colorSecondary;var o=t&&isDarkColor(t);var n=zonosStore.appearance.fontSizeInputValue||16;var i=this.internalValue||this.selectPlaceholder;var d=this.isClearable&&this.internalValue&&!this.isDisabled;return h(Host,{key:"c6bf5ed45fd7756985bd97b542933d25a472aa2c",class:classes(["zonos--select zonos--elements",o&&"dark",this.isError&&"has-error"]),"data-theme":o?"DARK":"LIGHT",style:Object.assign({"--zonos--border-radius":getBorderRadius(),"--zonos--font-family":zonosStoreFontFamily(),"--zonos--font-size":"".concat(n,"px"),"--zonos--primary-color":r},this.minWidth?{"--zonos--min-width":this.minWidth}:{})},h("div",{key:"7ff61460b6ac3c5b3e6e35000f3713609a26ebe2",class:classes(["zonos--label-wrapper",this.isDisabled&&"disabled"])},h("select",Object.assign({key:"9d644b04d7b46621245581c5143d7310e1d5396d"},this.inheritedAttributes,{autoComplete:this.autoComplete,class:classes(["zonos--floated-select",!!this.selectLabel&&"has-label",i&&"has-content",this.isError&&"has-error"]),disabled:this.isDisabled,id:this.selectId,name:this.name,onChange:function(t){var r=t.target;e.selectChange.emit(r.value);e.selectedValue=r.value;e.el.dispatchEvent(new Event("change"))},required:this.required}),h("option",{key:"b448bc3c2a083334108afad566feff22bf89547a",disabled:true,selected:!this.internalValue,value:""},this.selectPlaceholder||translate("Select")),this.internalOptions.map((function(t){return h("option",{key:t.value,selected:e.internalValue===t.value||e.internalValue===t.label,value:t.value},t.label)}))),h("div",{key:"14b3c9dad1202d432ba2a30d03e8335aebaafa89",class:"zonos--floated-label"},h("label",{key:"4e7870ce3eeaf4ea6fd116e3a486537bebb88c87",htmlFor:this.selectId},this.selectLabel)),h("div",{key:"4567ca19c1e018d483105c23ca781e0bbd1d2c3a",class:"zonos--actions-wrapper"},d&&h("button",{key:"cdceea7255fdd19177b82c42878a6c4a20690a1a","aria-label":"Clear selection",class:"zonos--clear-button",onClick:this.handleClear,tabIndex:0,type:"button"},h("zonos-icon",{key:"099b2f1a4fb475bfa76b0f4aeee9e66f27d473f3",class:"zonos--clear-icon",content:RemoveLineIcon,iconColor:"gray-1200"})),h("zonos-icon",{key:"8c7fdaf2de40a14e4fa0f8f3598851edac1c1ae6","aria-label":"Expand collapsed section",class:"zonos--select-chevron",content:ChevronDownIcon,iconColor:"gray-800"}))),this.error&&h("zonos-text",{key:"1cb569a7feeea85874c852a1c69cf88076fd6856",textColor:"red-600"},this.error))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{options:["onOptionsChange"],selectedValue:["onSelectedValueChange"],value:["onValueChange"]}},enumerable:false,configurable:true});return e}();ZonosStripeSelect.style=ZonosStripeSelectStyle0;export{ZonosAddressCompletionDialog as zonos_address_completion_dialog,ZonosAddressForm as zonos_address_form,ZonosAddressSuggestions as zonos_address_suggestions,ZonosAddressUpdateDialog as zonos_address_update_dialog,ZonosAddress as zonos_custom_address,ZonosStripePhoneInput as zonos_stripe_phone_input,ZonosStripeSelect as zonos_stripe_select};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,r,n){function o(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function d(e){try{a(n.next(e))}catch(e){i(e)}}function s(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?r(e.value):o(e.value).then(d,s)}a((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,d=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return d.next=s(0),d["throw"]=s(1),d["return"]=s(2),typeof Symbol==="function"&&(d[Symbol.iterator]=function(){return this}),d;function s(e){return function(t){return a([e,t])}}function a(s){if(n)throw new TypeError("Generator is already executing.");while(d&&(d=0,s[0]&&(r=0)),r)try{if(n=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;o=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];o=0}finally{n=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++){if(i||!(n in t)){if(!i)i=Array.prototype.slice.call(t,0,n);i[n]=t[n]}}return e.concat(i||Array.prototype.slice.call(t))};import{r as registerInstance,d as createEvent,h,a as Host,g as getElement}from"./index-_lt63o7c.js";import{t as translate,s as storageStore,y as storageStoreOnChange,l as localizationStore}from"./localization-AOqYXGdP.js";import{z as zonosStore,a as zonosStoreFontFamily}from"./zonosStore-DrIOAz4M.js";import{M as MIN_POSTAL_CODE_LENGTH}from"./getMissingRequiredShippingFields-u1nhQzJ1.js";import{c as classes}from"./classes-BJHSB96f.js";import{U as extractName,b as stripeStore,w as stripeStorePrefetchLandedCost,t as trackConversionEvent}from"./cart-ekBk_gxV.js";import{R as RemoveIcon$1}from"./RemoveIcon-C2QMVeWW.js";import{i as isTextContainsNonLatinChars,c as containsNonLatinChars}from"./containsNonLatinChars-C04AWRC2.js";import{g as getBorderRadius}from"./getBorderRadius-HwG64EKM.js";import{t as throttle}from"./throttle-D5GyA3yr.js";import{i as isCheckoutMobile}from"./handleFetch-D5GYDF-O.js";import{a as shouldRenderTaxIdInput,s as shouldRenderShortAddressCodeInput}from"./shouldRenderTaxIdInput-CKyZ6Zni.js";import{l as log}from"./VarianceTest-BJmZPrZl.js";import{c as countryRequireTaxId,s as shipToTaxIdLabels}from"./TaxId-Cye-evFK.js";import{i as inheritAriaAttributes,a as inheritAttributes}from"./helpers-DJIdCwJ5.js";import{i as isDarkColor}from"./isDarkColor-YdrG78th.js";import"./debounce-D4ko2kvZ.js";import"./ShortAddressCode-nJ6oI8-n.js";var zonosAddressCompletionDialogCss=function(){return":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--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:24px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding-bottom:5px;gap:20px;-ms-scroll-chaining:chained;overscroll-behavior:auto}:host .zonos--selected-address{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px}:host .zonos--completion-fields{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:16px}:host .zonos--completion-name-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--completion-name-row zonos-input{-ms-flex:1;flex:1}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--completion-name-row{-ms-flex-direction:column;flex-direction:column}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--submit-btn{-ms-flex-order:1;order:1}"};var ZonosAddressCompletionDialog=/** @class */function(){function e(e){var t=this;registerInstance(this,e);this.closeCompletionDialog=createEvent(this,"closeCompletionDialog",7);this.completionSubmit=createEvent(this,"completionSubmit",7);
|
|
2
|
+
/**
|
|
3
|
+
* Whether or not the continue button is loading
|
|
4
|
+
*/this.continueLoading=false;
|
|
5
|
+
/**
|
|
6
|
+
* Whether or not the dialog is open
|
|
7
|
+
*/this.dialogOpen=false;
|
|
8
|
+
/**
|
|
9
|
+
* Whether or not the dialog is rendered in mobile mode
|
|
10
|
+
*/this.isMobile=false;
|
|
11
|
+
/**
|
|
12
|
+
* The Zonos-required fields still missing from the selected address
|
|
13
|
+
*/this.missingFields=[];
|
|
14
|
+
/**
|
|
15
|
+
* Local values for the captured fields, keyed by the missing field key
|
|
16
|
+
*/this.values={};
|
|
17
|
+
/**
|
|
18
|
+
* Whether to show validation errors (after a submit attempt with empty fields)
|
|
19
|
+
*/this.showError=false;this.isFieldMissing=function(e){return t.missingFields.some((function(t){return t.key===e}))};
|
|
20
|
+
/**
|
|
21
|
+
* A captured field is valid when it has a value. Postal code additionally enforces the same
|
|
22
|
+
* minimum length as the landed-cost readiness / detection check, so the dialog can't emit a
|
|
23
|
+
* too-short postal code that would still be considered "missing" downstream.
|
|
24
|
+
*/this.isFieldValid=function(e){var r,n,o;if(e==="postal_code"){return((n=(r=t.values.postal_code)===null||r===void 0?void 0:r.trim().length)!==null&&n!==void 0?n:0)>=MIN_POSTAL_CODE_LENGTH}return!!((o=t.values[e])===null||o===void 0?void 0:o.trim())};this.getFieldError=function(e){return t.showError&&!t.isFieldValid(e)};this.updateValue=function(e,r){var n;t.values=Object.assign(Object.assign({},t.values),(n={},n[e]=r,n));
|
|
25
|
+
// Once the customer starts fixing the fields, re-evaluate whether errors remain
|
|
26
|
+
if(t.showError){t.showError=!t.isComplete()}};this.isComplete=function(){return t.missingFields.every((function(e){
|
|
27
|
+
// A missing last name also requires a first name (both are edited together).
|
|
28
|
+
if(e.key==="lastName"){return t.isFieldValid("firstName")&&t.isFieldValid("lastName")}return t.isFieldValid(e.key)}))};this.submitHandler=function(){if(!t.isComplete()){t.showError=true;return}t.completionSubmit.emit(t.values)};this.renderInput=function(e){var r=e.key,n=e.label;return h("zonos-input",{class:"zonos--completion-input zonos--completion-".concat(r),inputLabel:n,inputValue:t.values[r]||"",isError:t.getFieldError(r),onInputChange:function(e){return t.updateValue(r,e.detail)}})};this.renderField=function(e,r){if(!t.isFieldMissing(e)){return null}return t.renderInput({key:e,label:r})};
|
|
29
|
+
/**
|
|
30
|
+
* When the last name is missing, render both first and last name inputs so the customer can
|
|
31
|
+
* correct the full name together (Link's single name input often yields only a first name).
|
|
32
|
+
*/this.renderNameFields=function(){if(!t.isFieldMissing("lastName")){return null}return h("div",{class:"zonos--completion-name-row"},t.renderInput({key:"firstName",label:translate("First name")}),t.renderInput({key:"lastName",label:translate("Last name")}))}}
|
|
33
|
+
/**
|
|
34
|
+
* The dialog stays mounted, so clear any previously-entered values whenever it opens.
|
|
35
|
+
* Without this, values typed for one address could be reapplied to a different address
|
|
36
|
+
* the next time the dialog opens.
|
|
37
|
+
*/
|
|
38
|
+
// Only reset on open, not on `shippingAddress`: the parent rebuilds that prop object on
|
|
39
|
+
// every render, and watching it would wipe in-progress input while the dialog is open.
|
|
40
|
+
e.prototype.watchDialogOpen=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(n){switch(n.label){case 0:if(!e)return[3/*break*/,2];
|
|
41
|
+
// Wait for shippingAddress prop to be updated before resetting the values
|
|
42
|
+
return[4/*yield*/,new Promise((function(e){return setTimeout(e,100)}))];case 1:
|
|
43
|
+
// Wait for shippingAddress prop to be updated before resetting the values
|
|
44
|
+
n.sent();r=extractName({name:(t=this.shippingAddress)===null||t===void 0?void 0:t.name}).firstName;this.values=this.isFieldMissing("lastName")?{firstName:r}:{};this.showError=false;n.label=2;case 2:return[2/*return*/]}}))}))};e.prototype.render=function(){var e=this;var t=this.submitBtnColor||zonosStore.appearance.colorSecondary;
|
|
45
|
+
// dialog background is white, so a white button needs an outline to stay visible
|
|
46
|
+
var r=t==="#ffffff"?"outline":this.submitBtnType||"standard";return h(Host,{key:"9a89376022ebd8f5793882fb13a3502deca001f8",class:classes(["zonos--address-completion-dialog zonos--elements",this.isMobile&&"mobile"])},h("zonos-dialog",{key:"00ff3912a7bf8d021441440f0de2825b49f7b78e",isLoading:false,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeCompletionDialog.emit()},open:this.dialogOpen,width:"568px"},h("div",{key:"1ba1cd333bd1f362a77f1f114ac50c309ed5ccd6",class:"zonos--body"},h("div",{key:"ccf9f54ff4b26e5443ff5c8276e5c5d36aac332b",class:"zonos--dialog-header"},h("div",{key:"01e073aa559c4040a6599aefb3bf8cb967928929",class:"zonos--dialog-title"},h("zonos-text",{key:"8472a72f6274646bb87d150c82722f93c861ae72",type:"title"},translate("Complete your shipping address")),h("zonos-button",{key:"e9a6c2cbc3d64bf87e94850c1126119687f75e7d",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon$1}),noBackground:true,onClick:function(){return e.closeCompletionDialog.emit()},title:"Close checkout dialog"})),h("zonos-text",{key:"c9ff785b746810f0c266071ee9a3f433ad645a2b"},translate("This saved address is missing information required to ship internationally. Please add the details below."))),h("div",{key:"86e2b0da7dbcd1370b80fc8c53e8a7de4c11ed74",class:"zonos--group"},h("div",{key:"1542bb7f0b9df16f5ce36d38dc9408a1b3e836a7",class:"zonos--selected-address"},h("zonos-text",{key:"2572e3e44a9c81f6694e4939de39951ec659c8fa",class:"zonos--selected-label",type:"semiBoldLabel"},translate("Selected address")),h("zonos-address-display",{key:"8781622b3d057cfbdba59e13d5fabf76f3a7a7dd",addressType:"shipping",currentAddress:this.shippingAddress})),h("div",{key:"ac3a5f6566c2179045a784b661b7e82c7b371a3f",class:"zonos--completion-fields"},this.renderNameFields(),this.renderField("state",translate("State/Province")),this.renderField("postal_code",translate("Postal code")))),h("div",{key:"1007d7f6c671fbd94dd3027332d2d7ac1edeef6e",class:"zonos--group-btn"},h("div",{key:"22fe2c8d03d7b3c680eea2b4afebf1868b5b6c0b",class:"zonos--button-wrapper"},h("zonos-button",{key:"dbcf1aa175992bff762ecc36108bf94090b7df0e",class:"zonos--cancel-btn",onClick:function(){return e.closeCompletionDialog.emit()},variant:"subtle"},translate("Cancel")),h("zonos-button",{key:"63b0f966565e86ea9bac640b2fa690287c94b11f",backgroundColor:this.submitBtnColor,class:"zonos--submit-btn",loading:this.continueLoading,onClick:function(){return e.submitHandler()},size:"sm",variant:r},translate("Save and continue")))))))};Object.defineProperty(e,"watchers",{get:function(){return{dialogOpen:[{watchDialogOpen:0}]}},enumerable:false,configurable:true});return e}();ZonosAddressCompletionDialog.style=zonosAddressCompletionDialogCss();var zonosAddressFormCss=function(){return":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--title{margin-bottom:20px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:1px}:host .zonos--contact{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--address-row>*{-ms-flex:1;flex:1}:host .zonos--address{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}"};var ZonosAddressForm=/** @class */function(){function e(e){var t=this;registerInstance(this,e);this.addressChange=createEvent(this,"addressChange",7);
|
|
47
|
+
/**
|
|
48
|
+
* Local address to update
|
|
49
|
+
*/this.localAddress=this.currentAddress;this.onInputChange=function(e){var r;var n=e.key,o=e.value;t.addressChange.emit(Object.assign(Object.assign({},t.localAddress),(r={},r[n]=o,r)))}}e.prototype.watchCurrentAddress=function(){var e,t,r,n,o,i;var d=this.currentAddress,s=d.city,a=d.line1,u=d.line2,l=d.name,$=d.postal_code,c=d.state;
|
|
50
|
+
// Update the local address when the current address changes
|
|
51
|
+
// If translated address is available, use that instead
|
|
52
|
+
this.localAddress=Object.assign(Object.assign({},this.currentAddress),{city:((e=this.translatedAddress.city)===null||e===void 0?void 0:e[s])||s,line1:((t=this.translatedAddress.line1)===null||t===void 0?void 0:t[a])||a,line2:((r=this.translatedAddress.line2)===null||r===void 0?void 0:r[u])||u,name:((n=this.translatedAddress.name)===null||n===void 0?void 0:n[l])||l,postal_code:((o=this.translatedAddress.postal_code)===null||o===void 0?void 0:o[$])||$,state:((i=this.translatedAddress.state)===null||i===void 0?void 0:i[c])||c})};e.prototype.componentWillLoad=function(){this.watchCurrentAddress()};e.prototype.render=function(){var e=this;var t=this.localAddress,r=t.city,n=t.country,o=t.line1,i=t.line2,d=t.name,s=t.phone,a=t.postal_code,u=t.state;var l=extractName({name:d}),$=l.firstName,c=l.lastName;return h(Host,{key:"44edb799473e427b08e17d6d20f08a028a3cc688",class:"zonos--address-form zonos--elements"},h("div",{key:"99c2d5b58464bebd7bb3e5c2a4ac3aa04d80b47f",class:"zonos--title"},h("zonos-text",{key:"5a86048c7d768b795db1416182e2b22458924601",textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{key:"a907058d970cb6674b403f79c0946e36a0e61f69",class:"zonos--address-group"},h("div",{key:"fad2f71614c6963015f95e74e297c58a4adee95b",class:"zonos--contact"},h("zonos-text",{key:"0c661050b1b95da56af1046fac39c7fa6de18685",type:"label"},translate("Contact")),h("zonos-input",{key:"3e35a5f9d4bca373ef9403da0de53ea895aca61f",class:"zonos--form-email",inputLabel:translate("Email"),inputValue:this.currentAddress.email,isDisabled:true}),h("div",{key:"093cdcc771b4ade381a392a1023d9d037d4e3e35",class:"zonos--name zonos--address-row"},h("zonos-input",{key:"e9d957551070a855179b78da655beaf3b4e731e2",class:"zonos--form-first-name",inputLabel:translate("First name"),inputValue:$,isError:isTextContainsNonLatinChars($),onInputChange:function(t){return e.onInputChange({key:"name",value:"".concat(t.detail," ").concat(c)})}}),h("zonos-input",{key:"0b86805e872607d367446f5e6ef074974f9840c2",class:"zonos--form-last-name",inputLabel:translate("Last name"),inputValue:c,isError:isTextContainsNonLatinChars(c),onInputChange:function(t){return e.onInputChange({key:"name",value:"".concat($," ").concat(t.detail)})}}))),h("div",{key:"6447f55e8d173d18cd46cba829527c4d487631a2",class:"zonos--address"},h("zonos-text",{key:"18ef146cc44f658524c6535e851281b62249fa26",type:"label"},translate("Address")),h("zonos-input",{key:"95cfb115c4304e8a142ab2e952fc8c4bfbe39e43",class:"zonos--form-country",inputLabel:translate("Country"),inputValue:n,isDisabled:true}),h("zonos-input",{key:"e3774713ec0b0e861981aa9f2c62f6749125e174",class:"zonos--form-line1",inputLabel:translate("Address line 1"),inputValue:o,isError:isTextContainsNonLatinChars(o),onInputChange:function(t){return e.onInputChange({key:"line1",value:t.detail})}}),h("zonos-input",{key:"0d1fce85ad42e42b266ad411d4e3a96e4b8b8bf3",class:"zonos--form-line2",inputLabel:translate("Address line 2"),inputValue:i,isError:isTextContainsNonLatinChars(i),onInputChange:function(t){return e.onInputChange({key:"line2",value:t.detail})}}),h("div",{key:"5d5e740b711ff65a0366a6c4891f22684f32c74b",class:"zonos--address-row"},h("zonos-input",{key:"8f124a91865c59096ba5c624ec229a3d1545c985",class:"zonos--form-city",inputLabel:translate("City"),inputValue:r,isError:isTextContainsNonLatinChars(r),onInputChange:function(t){return e.onInputChange({key:"city",value:t.detail})}}),this.currentAddress.state&&h("zonos-input",{key:"50e852953ba88573929a200bce4c67fab2146245",class:"zonos--form-state",inputLabel:translate("State/Province"),inputValue:u,isError:isTextContainsNonLatinChars(u),onInputChange:function(t){return e.onInputChange({key:"state",value:t.detail})}})),h("zonos-input",{key:"74c17f1d1a77af3f90100a6832b2c8fe7bdca24e",class:"zonos--form-postal-code",inputLabel:translate("Postal code"),inputValue:a,isError:isTextContainsNonLatinChars(a),onInputChange:function(t){return e.onInputChange({key:"postal_code",value:t.detail})}}),h("zonos-input",{key:"20775c4a944fe9305446898109637e5b38229a1d",class:"zonos--form-phone",inputLabel:translate("Phone number"),inputValue:s,onInputChange:function(t){return e.onInputChange({key:"phone",value:t.detail})}}))))};Object.defineProperty(e,"watchers",{get:function(){return{translatedAddress:[{watchCurrentAddress:0}]}},enumerable:false,configurable:true});return e}();ZonosAddressForm.style=zonosAddressFormCss();var RemoveIcon='<svg color="var(--zonos-elements-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-gray-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosAddressSuggestionsCss=function(){return":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:relative}:host .wrapper{position:absolute;margin-top:4px;top:100%;left:0;right:0;z-index:3;max-height:300px;overflow-y:auto;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));-webkit-box-shadow:var(--zonos-elements-shadow-select-active);box-shadow:var(--zonos-elements-shadow-select-active);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;list-style:none;padding:0;background-color:var(--zonos-elements-surface-color)}:host .wrapper .option{padding:8px;background-color:var(--zonos-elements-surface-color);outline:none;border:none;text-align:left}:host .wrapper .option.last-hovered{background-color:var(--zonos-elements-gray-100)}:host .wrapper .option .highlight{font-weight:600;color:var(--zonos-elements-gray-1000)}:host .wrapper>.powered-by{padding:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}:host .wrapper>.powered-by .powered-by-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;gap:5px;-ms-flex:1;flex:1}:host .wrapper>.suggestion{cursor:pointer}:host .wrapper>.suggestion:hover{background-color:var(--zonos-elements-gray-100)}"};var ZonosAddressSuggestions=/** @class */function(){function e(e){var t=this;registerInstance(this,e);this.suggestionSelected=createEvent(this,"suggestionSelected",7);
|
|
53
|
+
/**
|
|
54
|
+
* Suggestions to display
|
|
55
|
+
*/this.suggestions=[];
|
|
56
|
+
/**
|
|
57
|
+
* Selected suggestion id
|
|
58
|
+
*/this.selectedSuggestionId=null;
|
|
59
|
+
/**
|
|
60
|
+
* Local suggestions to display
|
|
61
|
+
*/this.localSuggestions=[];this.lastHoveredSuggestionId=null;
|
|
62
|
+
/**
|
|
63
|
+
* Handle clicks outside of the suggestions component
|
|
64
|
+
*/this.handleClickOutside=function(e){if(!t.el.contains(e.target)){t.localSuggestions=[]}}}e.prototype.suggestionsChanged=function(){var e,t;this.localSuggestions=this.suggestions;
|
|
65
|
+
// set last hovered suggestion id to the first suggestion id
|
|
66
|
+
this.lastHoveredSuggestionId=(t=(e=this.suggestions[0])===null||e===void 0?void 0:e.id)!==null&&t!==void 0?t:null};e.prototype.componentDidLoad=function(){document.addEventListener("click",this.handleClickOutside)};e.prototype.disconnectedCallback=function(){document.removeEventListener("click",this.handleClickOutside)};
|
|
67
|
+
/**
|
|
68
|
+
* Split text into segments based on matches array for highlighting
|
|
69
|
+
*/e.prototype.getHighlightedText=function(e,t){if(!(t===null||t===void 0?void 0:t.length))return[{isMatch:false,text:e}];var r=[];var n=0;
|
|
70
|
+
// Sort matches by startOffset to process in order
|
|
71
|
+
var o=__spreadArray([],t,true).sort((function(e,t){return e.startOffset-t.startOffset}));o.forEach((function(t){
|
|
72
|
+
// Add non-matching segment before match if exists
|
|
73
|
+
if(t.startOffset>n){r.push({isMatch:false,text:e.slice(n,t.startOffset)})}
|
|
74
|
+
// Add matching segment
|
|
75
|
+
r.push({isMatch:true,text:e.slice(t.startOffset,t.endOffset)});n=t.endOffset}));
|
|
76
|
+
// Add remaining non-matching text if exists
|
|
77
|
+
if(n<e.length){r.push({isMatch:false,text:e.slice(n)})}return r};e.prototype.render=function(){var e=this;return h(Host,{key:"9de4179f1bd0057ac71d6b9ed646c034035382f7",class:"zonos--address-suggestions",role:"group",style:{"--zonos--border-radius":getBorderRadius()}},h("ul",{key:"62fa5ed92fafcdd641f9a7eb36e36e62309c9f52","aria-label":"Suggestions",class:"wrapper",role:"listbox"},!!this.localSuggestions.length&&h("li",{key:"27c61b5693720d0b33a75385841476787f92b884","aria-selected":false,class:"powered-by option",role:"option"},h("div",{key:"fea9f2e8f65cd50fdf28fc45e18beb8976320f0d",class:"powered-by-container"},h("zonos-text",{key:"1fec46f543e3673433b6924f7dca1cbd84e0ef16",type:"caption"},"Suggestions powered by"),h("zonos-text",{key:"7b3fd93c18d4320522d61e07278f5388d14c8bbb",type:"semiBoldLabel"},"Google")),h("zonos-button",{key:"61a8362ab0514a78dd71eaa9bd638dc8b50e2a9c","aria-label":"Clear suggestions",icon:h("zonos-icon",{content:RemoveIcon}),noBackground:true,onClick:function(){e.localSuggestions=[]}})),this.localSuggestions.map((function(t){
|
|
78
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
79
|
+
return h("li",{"aria-selected":e.selectedSuggestionId===t.id,class:classes(["suggestion","option",e.lastHoveredSuggestionId===t.id&&"last-hovered"]),key:t.id,onClick:function(){e.selectedSuggestionId=t.id;e.suggestionSelected.emit({placeId:t.id,type:e.type})},onMouseEnter:function(){e.lastHoveredSuggestionId=t.id},role:"option",tabIndex:0},h("zonos-text",null,e.getHighlightedText(t.place,t.matches).map((function(e,t){return h("span",{class:e.isMatch?"highlight":undefined,key:"".concat(t,"-").concat(e.text)},e.text)}))))}))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{suggestions:[{suggestionsChanged:0}]}},enumerable:false,configurable:true});return e}();ZonosAddressSuggestions.style=zonosAddressSuggestionsCss();var zonosAddressUpdateDialogCss=function(){return":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--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--group{-ms-scroll-chaining:chained;overscroll-behavior:auto}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}"};var ZonosAddressUpdateDialog=/** @class */function(){function e(e){var t=this;registerInstance(this,e);this.closeUpdateDialog=createEvent(this,"closeUpdateDialog",7);this.continueClicked=createEvent(this,"continueClicked",7);
|
|
80
|
+
/**
|
|
81
|
+
* Whether or not the continue button is loading
|
|
82
|
+
*/this.continueLoading=false;
|
|
83
|
+
/**
|
|
84
|
+
* Whether or not the dialog is open
|
|
85
|
+
*/this.dialogOpen=false;
|
|
86
|
+
/**
|
|
87
|
+
* Whether or not the dialog is open
|
|
88
|
+
*/this.isMobile=false;
|
|
89
|
+
/**
|
|
90
|
+
* Due to Stripe's validation difficulties, we need to show a banner when users hasn't filled out the form correctly but clicked continue
|
|
91
|
+
*/this.showErrorBanner=false;
|
|
92
|
+
/**
|
|
93
|
+
* State of shipping address input fields
|
|
94
|
+
*/this.translatedShippingAddressState={};
|
|
95
|
+
/**
|
|
96
|
+
* State of billing address input fields
|
|
97
|
+
*/this.translatedBillingAddressState={};
|
|
98
|
+
/**
|
|
99
|
+
* handler for close button click
|
|
100
|
+
*/this.closeUpdateDialogHandler=function(){t.closeUpdateDialog.emit()};
|
|
101
|
+
/**
|
|
102
|
+
* Extract value from translated object
|
|
103
|
+
*/this.getTranslatedAddress=function(e){var t=e.currentAddress,r=e.translatedAddress;var n,o,i,d,s,a;var u=t.city,l=t.line1,$=t.line2,c=t.name,f=t.postal_code,h=t.state;return{city:((n=r.city)===null||n===void 0?void 0:n[u])||u,line1:((o=r.line1)===null||o===void 0?void 0:o[l])||l,line2:((i=r.line2)===null||i===void 0?void 0:i[$])||$,name:((d=r.name)===null||d===void 0?void 0:d[c])||c,postal_code:((s=r.postal_code)===null||s===void 0?void 0:s[f])||f,state:((a=r.state)===null||a===void 0?void 0:a[h])||h}};
|
|
104
|
+
/**
|
|
105
|
+
* handler for continue button click
|
|
106
|
+
*/this.continueClickHandler=function(){return __awaiter(t,void 0,void 0,(function(){var e,t,r,n,o,i,d,s,a,u,l,$,c;return __generator(this,(function(f){
|
|
107
|
+
// set spinner for the continue button
|
|
108
|
+
this.continueLoading=true;n=this.billingAddress?this.getTranslatedAddress({currentAddress:this.billingAddress,translatedAddress:this.translatedBillingAddressState}):null;o=this.getTranslatedAddress({currentAddress:this.shippingAddress,translatedAddress:this.translatedShippingAddressState});i=containsNonLatinChars(Object.assign(Object.assign({},o),{country:this.shippingAddress.country}));d=n&&this.billingAddress&&containsNonLatinChars(Object.assign(Object.assign({},n),{country:this.billingAddress.country}));s=!!Object.keys(i).length;a=!!d&&!!Object.keys(d).length;
|
|
109
|
+
// if there are non-latin characters in the translated address, scroll to the error input so user can see and fix it
|
|
110
|
+
if(s||a){u=(e=this.el.shadowRoot)===null||e===void 0?void 0:e.querySelectorAll("zonos-address-form");l=u===null||u===void 0?void 0:u[0];$=u===null||u===void 0?void 0:u[1];c=((t=l===null||l===void 0?void 0:l.shadowRoot)===null||t===void 0?void 0:t.querySelector(".has-error"))||((r=$===null||$===void 0?void 0:$.shadowRoot)===null||r===void 0?void 0:r.querySelector(".has-error"));
|
|
111
|
+
// scroll to the first error input
|
|
112
|
+
if(c){c.scrollIntoView({behavior:"smooth",block:"center"})}this.continueLoading=false;return[2/*return*/]}
|
|
113
|
+
// Submit the translated address to the parent component
|
|
114
|
+
this.continueClicked.emit({billingAddress:n,shippingAddress:o});return[2/*return*/]}))}))};
|
|
115
|
+
/**
|
|
116
|
+
* This function builds a state object for a translated address.
|
|
117
|
+
* It takes the current and translated address as input and returns an object where each field is an object itself.
|
|
118
|
+
* The key of each field's object is the current address's field value and the value is the corresponding translated address's field value.
|
|
119
|
+
*
|
|
120
|
+
* @param {Object} params - The parameters for the function.
|
|
121
|
+
* @param {EnteredInfo} params.currentAddress - The current address information.
|
|
122
|
+
* @param {EnteredInfo} params.translatedAddress - The translated address information.
|
|
123
|
+
*
|
|
124
|
+
*/this.buildTranslateAddressState=function(e){var t,r,n,o,i,d;var s=e.currentAddress,a=e.translatedAddress;var u=s.city,l=s.line1,$=s.line2,c=s.name,f=s.postal_code,h=s.state;return{city:(t={},t[u]=a.city,t),line1:(r={},r[l]=a.line1,r),line2:(n={},n[$]=a.line2,n),name:(o={},o[c]=a.name,o),postal_code:(i={},i[f]=a.postal_code,i),state:(d={},d[h]=a.state,d)}}}e.prototype.watchTranslatedShippingAddress=function(){this.translatedShippingAddressState=this.translatedShippingAddress};e.prototype.watchTranslatedBillingAddress=function(){this.translatedBillingAddressState=this.translatedBillingAddress};e.prototype.componentWillLoad=function(){
|
|
125
|
+
// update the state with the initial props
|
|
126
|
+
this.watchTranslatedBillingAddress();this.watchTranslatedShippingAddress()};e.prototype.render=function(){var e=this;
|
|
127
|
+
// dialog background white, so when the button background is also white, we need to change the button type to outline so it's visible
|
|
128
|
+
var t=this.submitBtnColor||zonosStore.appearance.colorSecondary;var r=t==="#ffffff"?"outline":this.submitBtnType||"standard";var n=this.billingAddress;var o=this.shippingAddress;return h(Host,{key:"655845cef04f4af526b1a1c4e49243c4f2b4c7f6",class:classes(["zonos--address-update-dialog zonos--elements",this.isMobile&&"mobile"])},h("zonos-dialog",{key:"eab429bb78ce6f05ba463d8748d7edd5499402fa",isLoading:this.dialogLoading,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeUpdateDialog.emit()},open:this.dialogOpen,width:"568px"},h("div",{key:"08f0400e62addfcaffd91bf5200999d29bbd2da9",class:"zonos--body"},h("div",{key:"8699df5e2f823e19066fbb552ba2a66c127c05e9",class:"zonos--dialog-header"},h("div",{key:"92e0ff932dcdb0e5b59ea34b688d1ef8e31bfeb3",class:"zonos--dialog-title"},h("zonos-text",{key:"aaac3375526bddb319ce7c8f49bde30da7210264",type:"title"},translate("Update your address")),h("zonos-button",{key:"474cc2421cd3150daa46bfe215da6ae7df9c6087",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon$1}),noBackground:true,onClick:function(){return e.closeUpdateDialogHandler()},title:"Close checkout dialog"})),h("zonos-text",{key:"6d019250cce57e8b30dd790a184df7273bdb234f"},translate("To ensure delivery all address details must be in Latin characters."))),h("div",{key:"80ee681844f4f4f43fce69d977b634b1fbc3d5f5",class:"zonos--group"},h("zonos-text",{key:"940e510eceec156a74f32de84cf58ffebd796435",class:"zonos--what-you-entered",type:"semiBoldLabel"},translate("What you entered")),h("div",{key:"f626127f5c399c29ab1022deb66aaee8f8a49601",class:"zonos--address-display-group"},h("zonos-address-display",{key:"9dfcba1037325c3a1f9e82b8e4797e7872dd7e3f",addressType:"shipping",currentAddress:o}),n&&h("zonos-address-display",{key:"fee8ae2c6786d735133c2a0a42f3e3d40d7f9ea9",addressType:"billing",currentAddress:n})),h("div",{key:"5a82195018ff8cdfd1126f4424062a26c25ee757",class:"zonos--address-form-section"},h("zonos-text",{key:"f694dfad166697e4c034cea51057133b69b1c144",type:"semiBoldLabel"},translate("Translated address")),h("zonos-address-form",{key:"4a99c841cf4800de43c612cce3d56d956d02c22f",addressType:"shipping",class:"zonos--shipping-address-form",currentAddress:o,onAddressChange:function(t){var r=t.detail;e.translatedShippingAddressState=e.buildTranslateAddressState({currentAddress:o,translatedAddress:r})},translatedAddress:this.translatedShippingAddressState}),n&&h("zonos-address-form",{key:"311fd702d29a9517203597890bd46bd268dfc6d3",addressType:"billing",class:"zonos--billing-address-form",currentAddress:n,onAddressChange:function(t){var r=t.detail;e.translatedBillingAddressState=e.buildTranslateAddressState({currentAddress:n,translatedAddress:r})},translatedAddress:this.translatedBillingAddressState}))),h("div",{key:"918c3271579c3fc7a7efff0473b0ccf48fb575a2",class:"zonos--group-btn"},h("div",{key:"f73be0c1124d3a4d340bc6e8512f6be8356c655d",class:"zonos--button-wrapper"},h("zonos-button",{key:"172a6cc0a7b75afb400802ef6b87faae6e7e2483",class:"zonos--cancel-btn",onClick:function(){return e.closeUpdateDialogHandler()},variant:"subtle"},translate("Cancel")),h("zonos-button",{key:"8fd08bc79b60eb9a0064c06ff9d840b1ecb09123",backgroundColor:this.submitBtnColor,class:"zonos--update-btn",loading:this.continueLoading,onClick:function(){return e.continueClickHandler()},size:"sm",variant:r},translate("Update address")))))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{translatedShippingAddress:[{watchTranslatedShippingAddress:0}],translatedBillingAddress:[{watchTranslatedBillingAddress:0}]}},enumerable:false,configurable:true});return e}();ZonosAddressUpdateDialog.style=zonosAddressUpdateDialogCss();var isValidZip=function(e){var t=e.countryFields,r=e.zip;if(!t){return true}if(!t.zipShow){return true}
|
|
129
|
+
// If zip is not required, zip value can be empty
|
|
130
|
+
if(!t.zipRequired){return true}
|
|
131
|
+
// If zip regex is set, it's always required and must be validated
|
|
132
|
+
if(t.zipRegex){return new RegExp(t.zipRegex).test(r)}
|
|
133
|
+
// If zip is required, zip value must be non-empty
|
|
134
|
+
return t.zipRequired&&!!r};var hasCountries=function(e){return!!e&&Object.keys(e).length>0};
|
|
135
|
+
/**
|
|
136
|
+
* Builds the country options for an address form's country dropdown.
|
|
137
|
+
*
|
|
138
|
+
* Shipping addresses are restricted to the merchant's shipping zone, since we
|
|
139
|
+
* can only fulfill orders to those countries. Billing addresses are not — a
|
|
140
|
+
* shopper's card can be billed to any country, so restricting the billing
|
|
141
|
+
* country prevents them from checking out at all (05CHECK-915).
|
|
142
|
+
*
|
|
143
|
+
* When the full country list is unavailable we fall back to the shipping zone
|
|
144
|
+
* so the dropdown is never empty.
|
|
145
|
+
*/var getAddressCountryOptions=function(e){var t=e.allCountries,r=e.shippingZoneCountries,n=e.type;var o=n==="billing"&&hasCountries(t)?t:r;return Object.values(o||{}).map((function(e){return{label:e.displayName,value:e.code}})).sort((function(e,t){return e.label.localeCompare(t.label)}))};var mergeAddress=function(e){var t=e.addresses,r=e.delimiter,n=r===void 0?" ":r;
|
|
146
|
+
// Remove duplicate addresses
|
|
147
|
+
var o=new Set(t.filter(Boolean));return Array.from(o).join(n)};var zonosCustomAddressCss=function(){return".sc-zonos-custom-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-custom-address-h *.sc-zonos-custom-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-custom-address-h img.sc-zonos-custom-address{max-width:100%}.sc-zonos-custom-address-h dl.sc-zonos-custom-address,.sc-zonos-custom-address-h dd.sc-zonos-custom-address,.sc-zonos-custom-address-h h1.sc-zonos-custom-address,.sc-zonos-custom-address-h h2.sc-zonos-custom-address,.sc-zonos-custom-address-h h3.sc-zonos-custom-address,.sc-zonos-custom-address-h h4.sc-zonos-custom-address,.sc-zonos-custom-address-h h5.sc-zonos-custom-address,.sc-zonos-custom-address-h h6.sc-zonos-custom-address,.sc-zonos-custom-address-h hr.sc-zonos-custom-address,.sc-zonos-custom-address-h figure.sc-zonos-custom-address,.sc-zonos-custom-address-h p.sc-zonos-custom-address,.sc-zonos-custom-address-h pre.sc-zonos-custom-address{margin:0}.sc-zonos-custom-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-custom-address-h .zonos--title.sc-zonos-custom-address{margin-bottom:16px}.sc-zonos-custom-address-h .zonos--company-name-input.sc-zonos-custom-address,.sc-zonos-custom-address-h .zonos--tax-id-input.sc-zonos-custom-address{margin-bottom:8px}.sc-zonos-custom-address-h zonos-banner.sc-zonos-custom-address{margin-top:8px}.sc-zonos-custom-address-h .zonos--custom-address-form.sc-zonos-custom-address,.sc-zonos-custom-address-h .zonos--custom-address-form-additional-fields.sc-zonos-custom-address{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px}.sc-zonos-custom-address-h .zonos--custom-address-form-state-zip-wrapper.sc-zonos-custom-address{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}.sc-zonos-custom-address-h .zonos--custom-address-form-state-zip-wrapper.sc-zonos-custom-address>*.sc-zonos-custom-address{-ms-flex:1 1 200px;flex:1 1 200px}.sc-zonos-custom-address-h .zonos--custom-address-form-additional-fields.sc-zonos-custom-address{opacity:0;height:0;overflow:hidden;-webkit-transition:opacity 0.3s ease-in-out, height 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, height 0.3s ease-in-out}.sc-zonos-custom-address-h .zonos--custom-address-form-additional-fields.zonos--show.sc-zonos-custom-address{opacity:1;height:auto}"};var __rest=undefined&&undefined.__rest||function(e,t){var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0)r[n]=e[n];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++){if(t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o]))r[n[o]]=e[n[o]]}return r};var ZonosAddress=/** @class */function(){function e(e){var t=this;registerInstance(this,e);this.invalidCharacters=createEvent(this,"invalidCharacters",7);this.addressChange=createEvent(this,"addressChange",7);this.onStoreCheckoutSessionIdChangedSubscription=function(){};
|
|
148
|
+
/**
|
|
149
|
+
* Default address for stripe
|
|
150
|
+
*/this.defaultAddress=[];
|
|
151
|
+
/**
|
|
152
|
+
* Error message for tax id input
|
|
153
|
+
*/this.taxIdErrorMessage="";
|
|
154
|
+
/**
|
|
155
|
+
* Error message for short address code input
|
|
156
|
+
*/this.shortAddressCodeErrorMessage="";this.stripe=window.Zonos.stripe;
|
|
157
|
+
/**
|
|
158
|
+
* Check if the address is dirty or not to scroll into view. When the component is mounted, if the data is filled with address line 1, it's considered dirty
|
|
159
|
+
*/this.isDirtyAddress=false;
|
|
160
|
+
/**
|
|
161
|
+
* Local address event for stripe address element
|
|
162
|
+
*/this.isAddressFilled=false;
|
|
163
|
+
/**
|
|
164
|
+
* Whether the address line 1 is already entered greater than 3 characters once
|
|
165
|
+
*/this.isAddressLine1Entered=false;
|
|
166
|
+
/**
|
|
167
|
+
* Address suggestions from google place api
|
|
168
|
+
*/this.addressSuggestions=[];
|
|
169
|
+
/**
|
|
170
|
+
* Country fields for the current country
|
|
171
|
+
*/this.countryField=null;
|
|
172
|
+
/**
|
|
173
|
+
* Whether to start google place suggestions
|
|
174
|
+
*/this.startGooglePlaceSuggestions=false;this.city="";this.country="";this.firstName="";this.lastName="";this.line1="";this.line2=null;this.phone="";this.postalCode="";this.state="";this.cityError="";this.stateError="";this.postalCodeError="";this.phoneError="";this.firstNameError="";this.lastNameError="";
|
|
175
|
+
/**
|
|
176
|
+
* Whether the address element is loaded
|
|
177
|
+
*/this.isFirstInitialization=true;
|
|
178
|
+
/**
|
|
179
|
+
* Address service instance
|
|
180
|
+
*/this.addressService=null;
|
|
181
|
+
/**
|
|
182
|
+
* Local checkout session id to check if the address is filled after checkout is loaded
|
|
183
|
+
*/this.checkoutSessionId=storageStore.checkoutSessionId;
|
|
184
|
+
/**
|
|
185
|
+
* Whether the suggestion is clicked
|
|
186
|
+
*/this.suggestionClicked=false;
|
|
187
|
+
/**
|
|
188
|
+
* Check if the tracking event is sent
|
|
189
|
+
*/this.trackingSent=false;
|
|
190
|
+
/**
|
|
191
|
+
* Google autocomplete overlay is conflict with our button, this is to adjust z index of the autocomplete
|
|
192
|
+
*/this.isAutoCompleteAdjusted=false;
|
|
193
|
+
/**
|
|
194
|
+
* Memoized country options, keyed on the store references they derive from.
|
|
195
|
+
* `render()` runs on every keystroke, and rebuilding the list each time would
|
|
196
|
+
* re-sort ~244 countries and hand `zonos-stripe-select` a new array identity,
|
|
197
|
+
* re-rendering it needlessly. `@stencil/store` replaces these references
|
|
198
|
+
* wholesale rather than mutating them, so reference equality is a safe key.
|
|
199
|
+
*/this.countryOptionsCache=null;
|
|
200
|
+
// Create a single throttled instance that persists
|
|
201
|
+
this.throttledGetAddressSuggestions=throttle((function(){if(zonosStore.checkoutAddressService){zonosStore.checkoutAddressService.getAddressSuggestions({country:t.country,query:[t.line1,t.state,t.postalCode].filter(Boolean).join(", "),type:t.type})}}),1e3);
|
|
202
|
+
// Map the custom address form to stripe address event data
|
|
203
|
+
this.setCustomAddressFormToStripeAddressEventData=function(){
|
|
204
|
+
// If the field is not shown, set it to an empty string
|
|
205
|
+
var e=!t.countryField||t.countryField.cityShow?t.city:"";var r=!t.countryField||t.countryField.stateShow?t.state:"";var n=!t.countryField||t.countryField.zipShow?t.postalCode:"";var o={complete:t.getIsComplete(),elementMode:t.type,elementType:"address",empty:!t.getIsComplete(),isNewAddress:true,value:{address:{city:e,country:t.country,line1:t.line1,line2:t.line2,postal_code:n,state:r},firstName:t.firstName,lastName:t.lastName,name:"".concat(t.firstName," ").concat(t.lastName),phone:t.phone}};t.updateAddressEventData({event:o,type:t.type});t.addressChange.emit({errors:t.getCustomAddressErrors(),type:t.type,value:o})};this.getCustomAddressErrors=function(){return t.type==="shipping"?stripeStore.customAddressErrors:stripeStore.customBillingAddressErrors};this.validate=function(e){var r=e.phoneValidateInfo,n=e.type,o=e.value,i=e.valueType;var d,s,a,u,l;var $=Object.assign({},t.getCustomAddressErrors());switch(i){case"city":{var c=!((d=t.countryField)===null||d===void 0?void 0:d.cityRequired)||((s=t.countryField)===null||s===void 0?void 0:s.cityRequired)&&!!(o===null||o===void 0?void 0:o.trim());$.city="";if(!c){$.city=translate("The field is incomplete")}break}case"state":{var c=!((a=t.countryField)===null||a===void 0?void 0:a.stateRequired)||((u=t.countryField)===null||u===void 0?void 0:u.stateRequired)&&!!(o===null||o===void 0?void 0:o.trim());$.state="";if(!c){$.state=translate("The field is incomplete")}break}case"postalCode":{var c=isValidZip({countryFields:t.countryField,zip:o||""});$.postalCode="";if(!c){$.postalCode=translate("Your [zipLabel] is invalid",{zipLabel:((l=t.countryField)===null||l===void 0?void 0:l.zipLabel)||"ZIP"})}break}case"firstName":{var c=!!(o===null||o===void 0?void 0:o.trim());$.firstName="";if(!c){$.firstName=translate("Please provide your first name.")}break}case"lastName":{var c=!!(o===null||o===void 0?void 0:o.trim());$.lastName="";if(!c){$.lastName=translate("Please provide your last name.")}break}case"line1":{var c=!!(o===null||o===void 0?void 0:o.trim());$.line1="";if(!c){$.line1=translate("The field is incomplete")}break}case"phone":{
|
|
206
|
+
// If the phone validate info is not provided, we need to validate the phone number
|
|
207
|
+
if(!r){var c=!!(o===null||o===void 0?void 0:o.trim());$.phone="";if(!c){$.phone=translate("Please provide a mobile phone number.")}}else{$.phone="";
|
|
208
|
+
// If the phone number is empty, set the error message
|
|
209
|
+
if(r.isEmpty){$.phone=translate("Please provide a mobile phone number.")}else if(r.wrongFormat){$.phone=translate("Your mobile phone number is incomplete.")}}break}}if(n==="shipping"){stripeStore.customAddressErrors=$}else{stripeStore.customBillingAddressErrors=$}};this.onStoreCheckoutSessionIdChanged=function(){var e=function(){t.checkoutSessionId=storageStore.checkoutSessionId};
|
|
210
|
+
// Trigger it once on init because onChange doesn't get triggered on initial load
|
|
211
|
+
e();t.onStoreCheckoutSessionIdChangedSubscription=storageStoreOnChange("checkoutSessionId",e)}}e.prototype.getCountryOptions=function(){var e=localizationStore.allCountries,t=localizationStore.shippingZoneCountries;var r=this.countryOptionsCache;if(r&&r.allCountries===e&&r.shippingZoneCountries===t&&r.type===this.type){return r.options}var n=getAddressCountryOptions({allCountries:e,shippingZoneCountries:t,type:this.type});this.countryOptionsCache={allCountries:e,options:n,shippingZoneCountries:t,type:this.type};return n};e.prototype.getStripeAddressInstance=function(){if(this.type==="billing"){return{stripeAddressElement:stripeStore.stripeBillingAddressElement,stripeAddressEventData:stripeStore.stripeBillingAddressEventData,stripeElements:stripeStore.stripeElementsForBillingAddress}}return{stripeAddressElement:stripeStore.stripeAddressElement,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeElements:stripeStore.stripeElements}};e.prototype.updateAddressEventData=function(e){var t=e.event,r=e.type;switch(r){case"billing":stripeStore.stripeBillingAddressEventData=t;break;default:{stripeStore.stripeAddressEventData=t;
|
|
212
|
+
// send request to prefetch landed cost
|
|
213
|
+
void stripeStorePrefetchLandedCost();break}}};e.prototype.isAddressFilledChanged=function(){
|
|
214
|
+
// Sometimes address elements is loaded with prefilled data before checkout is loaded, need to not send the event if checkout session id is not available, and send the event after checkout is loaded
|
|
215
|
+
if(!storageStore.checkoutSessionId){return}
|
|
216
|
+
// Only need to track the event if the shipping address is filled
|
|
217
|
+
if(this.isAddressFilled&&!this.trackingSent&&this.type==="shipping"){this.trackingSent=true;var e=storageStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_customerInfoFilled"})}};e.prototype.defaultAddressChanged=function(e,t){
|
|
218
|
+
// check if stringified json of oldAddress is different from newAddress
|
|
219
|
+
var r=JSON.stringify(t);var n=JSON.stringify(e);
|
|
220
|
+
// No need to reset address element if the default address is the same
|
|
221
|
+
if(r===n){return}log("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});
|
|
222
|
+
// Reset stripe address event data
|
|
223
|
+
if(this.type==="shipping"){stripeStore.stripeAddressEventData=null}else{stripeStore.stripeBillingAddressEventData=null}this.initDefaultCustomAddressForm()};e.prototype.getIsComplete=function(){var e=this.getCustomAddressErrors(),t=e.city,r=e.firstName,n=e.lastName,o=e.line1,i=e.phone,d=e.postalCode,s=e.state;if(!this.line1||!this.firstName||!this.lastName||!this.phone){return false}
|
|
224
|
+
// has any errors from any of the fields
|
|
225
|
+
var a=o||d||s||t||r||n||i;return!a};e.prototype.isInTaxIdCountry=function(e){return countryRequireTaxId.includes(e)};
|
|
226
|
+
/**
|
|
227
|
+
* Render tax id input based on ship to country code
|
|
228
|
+
*/e.prototype.renderTaxIdInput=function(){var e;
|
|
229
|
+
// No need to render tax id input for billing address
|
|
230
|
+
if(this.type==="billing"){return null}var t=(e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.value.address.country;
|
|
231
|
+
// Don't render tax id input if the country is not provided
|
|
232
|
+
if(!t){return null}
|
|
233
|
+
// This just to type guard the countryCode, if it's able to get to this point it should already be in country that has tax id input
|
|
234
|
+
if(!this.isInTaxIdCountry(t)){return null}var r=shouldRenderTaxIdInput({companyName:stripeStore.companyName,countryCode:t});
|
|
235
|
+
// Don't render tax id input if the country doesn't require tax id
|
|
236
|
+
if(!r){return null}var n=shipToTaxIdLabels[t];return h("div",{class:"zonos--tax-id-input"},h("zonos-stripe-input",{error:this.taxIdErrorMessage,inputLabel:translate(n.friendlyName),inputPlaceholder:n.placeholder,inputValue:stripeStore.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:function(e){stripeStore.taxId=e.detail}}))};
|
|
237
|
+
/**
|
|
238
|
+
* Render short address code input based on ship to country code
|
|
239
|
+
*/e.prototype.renderShortAddressCodeInput=function(){var e;
|
|
240
|
+
// No need to render short address code input for billing address
|
|
241
|
+
if(this.type==="billing"){return null}var t=(e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.value.address.country;
|
|
242
|
+
// Don't render short address code input if the country is not provided
|
|
243
|
+
if(!t){return null}var r=shouldRenderShortAddressCodeInput({countryCode:t});
|
|
244
|
+
// Don't render short address code input if the country doesn't require short address code
|
|
245
|
+
if(!r){return null}return h("div",{class:"zonos--short-address-code-input"},h("zonos-stripe-input",{inputLabel:translate("Short address code"),inputPlaceholder:"RRRD2929",inputValue:stripeStore.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:function(e){stripeStore.shortAddressCode=e.detail}}),this.shortAddressCodeErrorMessage&&h("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage))};e.prototype.renderCompanyNameInput=function(){
|
|
246
|
+
// No need to render company name for billing address
|
|
247
|
+
if(this.type==="billing"){return null}
|
|
248
|
+
// only render the company input if the setting is enabled
|
|
249
|
+
var e=zonosStore.checkoutSettings.companyFieldsStatus==="ENABLED";if(!e){return null}return h("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:translate("Company name (optional)"),inputValue:stripeStore.companyName,onInputChange:function(e){stripeStore.companyName=e.detail}})};e.prototype.initCountryField=function(e){var t,r,n;this.countryField=((t=zonosStore.genericSettings)===null||t===void 0?void 0:t.countryFields)&&e?(n=(r=zonosStore.genericSettings)===null||r===void 0?void 0:r.countryFields)===null||n===void 0?void 0:n[e]:null};e.prototype.initDefaultCustomAddressForm=function(){log("initDefaultCustomAddressForm","info",this.type);var e=this.getStripeAddressInstance().stripeAddressEventData;
|
|
250
|
+
// Use data from Stripe address element if it's available (This may happen when user has already at shipping selection page but go back to customer page)
|
|
251
|
+
if(e){var t=e.value.address.country||localizationStore.selectedCountryCode||"US";this.setFormValues({city:e.value.address.city,country:t,firstName:e.value.firstName||"",lastName:e.value.lastName||"",line1:e.value.address.line1,line2:e.value.address.line2||"",phone:e.value.phone||"",postal_code:e.value.address.postal_code,state:e.value.address.state});this.initCountryField(t);return}
|
|
252
|
+
// Use data from default address if it's available
|
|
253
|
+
var r=this.defaultAddress[0];if(r){var n=extractName({name:r.name}),o=n.firstName,i=n.lastName;var d=r.address.country||localizationStore.selectedCountryCode||"US";this.setFormValues({city:r.address.city,country:d,firstName:o,lastName:i,line1:r.address.line1,line2:r.address.line2||"",phone:r.phone||"",postal_code:r.address.postal_code,state:r.address.state});this.initCountryField(d);return}var s=localizationStore.selectedCountryCode||"US";
|
|
254
|
+
// Set default values
|
|
255
|
+
this.setFormValues({city:"",country:s,firstName:"",lastName:"",line1:"",line2:"",phone:"",postal_code:"",state:""});this.initCountryField(s);
|
|
256
|
+
// Set the first initialization to false when the address element is initialized
|
|
257
|
+
this.isFirstInitialization=false};e.prototype.line1Changed=function(){var e=this;var t=this.getStripeAddressInstance().stripeAddressEventData;var r=!t||this.line1!==(t===null||t===void 0?void 0:t.value.address.line1);
|
|
258
|
+
// Start requesting google place suggestions when address line 1 is more than 3 characters
|
|
259
|
+
if(r&&this.line1.length>3){
|
|
260
|
+
// Turn on the suggestion when the address line 1 is changed
|
|
261
|
+
this.startGooglePlaceSuggestions=true;this.isAddressLine1Entered=true;
|
|
262
|
+
// Turn off the suggestion when the address suggestion is clicked, but next time the address line 1 is changed, the suggestion will be turned on again
|
|
263
|
+
if(this.suggestionClicked){this.suggestionClicked=false;this.startGooglePlaceSuggestions=false}if(!this.isDirtyAddress){this.isDirtyAddress=true;
|
|
264
|
+
// stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
|
|
265
|
+
setTimeout((function(){if(!e.isAutoCompleteAdjusted){if(isCheckoutMobile()){e.el.scrollIntoView({behavior:"smooth",block:"end"})}else{
|
|
266
|
+
// scroll into the end of the page so the address placeholder won't be hidden
|
|
267
|
+
var t=e.type==="shipping"?100:600;var r=e.el.closest(".zonos--group");var n=e.el.getBoundingClientRect().top+t;r===null||r===void 0?void 0:r.scrollTo({behavior:"smooth",top:n})}}}),600)}}this.setCustomAddressFormToStripeAddressEventData();
|
|
268
|
+
// Start requesting google place suggestions when address line 1 is more than 3 characters (No need to request suggestions on first initialization if address is pre-filled)
|
|
269
|
+
if(this.startGooglePlaceSuggestions&&zonosStore.checkoutAddressService&&!this.isFirstInitialization){this.throttledGetAddressSuggestions()}};e.prototype.formFieldsChanged=function(){this.setCustomAddressFormToStripeAddressEventData()};e.prototype.addressSuggestionSelected=function(e){var t=e.placeDetails;var r,n,o,i,d,s,a,u,l,$,c,f,h,p,v;
|
|
270
|
+
// Set the trigger to true when the address suggestion is selected so we won't trigger the suggestion again
|
|
271
|
+
this.suggestionClicked=true;this.startGooglePlaceSuggestions=false;var b=t.addressComponents;var y=mergeAddress({addresses:[(r=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("street_number")})))===null||r===void 0?void 0:r.longText,(n=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("route")})))===null||n===void 0?void 0:n.longText]});var m=mergeAddress({addresses:[(o=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("premise")})))===null||o===void 0?void 0:o.longText,((i=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("sublocality_level_2")})))===null||i===void 0?void 0:i.longText)||((d=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("sublocality_level_3")})))===null||d===void 0?void 0:d.longText)||((s=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("sublocality_level_4")})))===null||s===void 0?void 0:s.longText)||((a=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("sublocality_level_5")})))===null||a===void 0?void 0:a.longText)]});var g=mergeAddress({addresses:[(u=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("subpremise")})))===null||u===void 0?void 0:u.longText,(l=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("neighborhood")})))===null||l===void 0?void 0:l.longText],delimiter:", "});var _=mergeAddress({addresses:[(($=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("locality")})))===null||$===void 0?void 0:$.longText)||((c=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("sublocality_level_1")})))===null||c===void 0?void 0:c.longText)||((f=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("administrative_area_level_1")})))===null||f===void 0?void 0:f.longText)]});var z=mergeAddress({addresses:[(h=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("administrative_area_level_1")})))===null||h===void 0?void 0:h.shortText]});var N=mergeAddress({addresses:[(p=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("postal_code")})))===null||p===void 0?void 0:p.longText]});var C=mergeAddress({addresses:[(v=b===null||b===void 0?void 0:b.find((function(e){return e.types.includes("country")})))===null||v===void 0?void 0:v.shortText]});this.setFormValues({city:_,country:C,
|
|
272
|
+
// Use the address line 1 from the address suggestion if it's available, otherwise use the address line 1 from the custom address form that the user has entered
|
|
273
|
+
line1:y||m||this.line1,line2:g,postal_code:N,state:z})};e.prototype.setFormValues=function(e){if(e.city!==undefined)this.city=e.city;if(e.country!==undefined)this.country=e.country;if(e.firstName!==undefined)this.firstName=e.firstName;if(e.lastName!==undefined)this.lastName=e.lastName;if(e.line1!==undefined)this.line1=e.line1;if(e.line2!==undefined)this.line2=e.line2;if(e.phone!==undefined)this.phone=e.phone;if(e.postal_code!==undefined)this.postalCode=e.postal_code;if(e.state!==undefined)this.state=e.state};
|
|
274
|
+
/**
|
|
275
|
+
* Initialize the address suggestions
|
|
276
|
+
*/e.prototype.initAddressSuggestions=function(){var e=this;
|
|
277
|
+
// Only initialize the address suggestions if the address service is not already initialized
|
|
278
|
+
if(!zonosStore.checkoutAddressService||!!this.onAddressSuggestionsUnsubscribe&&!!this.onAddressSelectedUnsubscribe){return}log("on initAddressSuggestions","info");this.onAddressSuggestionsUnsubscribe=zonosStore.checkoutAddressService.onAddressSuggestions((function(t){var r=t.suggestions,n=t.type;
|
|
279
|
+
// Only update the address suggestions if the type matches the current type
|
|
280
|
+
if(n!==e.type){return}e.addressSuggestions=r}));this.onAddressSelectedUnsubscribe=zonosStore.checkoutAddressService.onAddressSelected((function(t){if(t.type!==e.type){return}e.addressSuggestions=[];e.addressSuggestionSelected(t)}));this.validate({type:this.type,value:this.firstName,valueType:"firstName"});this.validate({type:this.type,value:this.lastName,valueType:"lastName"});this.validate({type:this.type,value:this.line1,valueType:"line1"});this.validate({type:this.type,value:this.phone,valueType:"phone"});this.validate({type:this.type,value:this.postalCode,valueType:"postalCode"});this.validate({type:this.type,value:this.state,valueType:"state"});this.validate({type:this.type,value:this.city,valueType:"city"});this.validate({type:this.type,value:this.phone,valueType:"phone"})};e.prototype.countryChanged=function(e){var t,r;var n=(t=zonosStore.genericSettings)===null||t===void 0?void 0:t.countryFields;var o=n===null||n===void 0?void 0:n[e];
|
|
281
|
+
// If the country code of countryFields are the same as current selected country code, do nothing
|
|
282
|
+
if(((r=this.countryField)===null||r===void 0?void 0:r.countryCode)===this.country){return}if(n&&o){this.countryField=o;return}this.countryField=null};e.prototype.shouldEnabledCustomAddressChanged=function(){
|
|
283
|
+
// Only initialize the address suggestions if the address service is not already initialized
|
|
284
|
+
this.initAddressSuggestions();this.initDefaultCustomAddressForm()};e.prototype.renderCustomAddressForm=function(){var e=this;var t,r,n,o,i,d,s,a,u,l,$,c,f,p,v,b;var y=this.getCustomAddressErrors(),m=y.showError,g=__rest(y,["showError"]);var _=this.getStripeAddressInstance().stripeAddressEventData;var z=_===null||_===void 0?void 0:_.value.address.country;
|
|
285
|
+
/**
|
|
286
|
+
* Billing addresses are not limited to the shipping zone: a shopper's card
|
|
287
|
+
* can be billed to any country, so restricting it would block them from
|
|
288
|
+
* checking out entirely (05CHECK-915).
|
|
289
|
+
*/var N=this.getCountryOptions();var C=N[0];var E=Object.entries(((t=this.countryField)===null||t===void 0?void 0:t.regions)||{}).map((function(e){var t=e[0],r=e[1];return{label:t,value:r.interpayCode}})).sort((function(e,t){return e.label.localeCompare(t.label)}));return h("div",{"aria-label":"".concat(this.type," address form"),class:"zonos--custom-address-form",role:"form"},h("zonos-stripe-input",{"aria-required":"true",class:"zonos--custom-address-form-input",error:m?g.firstName:undefined,inputLabel:translate("First name"),inputValue:_===null||_===void 0?void 0:_.value.firstName,onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"firstName"});
|
|
290
|
+
/**
|
|
291
|
+
* Order of operations is important here:
|
|
292
|
+
* 1. validate() updates all input error states
|
|
293
|
+
* 2. Setting postalCode triggers @Watch('postalCode')
|
|
294
|
+
* 3. getIsComplete() checks customAddressErrors state
|
|
295
|
+
* Therefore, we must update the value after validation to ensure correct error state
|
|
296
|
+
*/e.firstName=t.detail},required:true}),h("zonos-stripe-input",{"aria-required":"true",class:"zonos--custom-address-form-input",error:m?g.lastName:undefined,inputLabel:translate("Last name"),inputValue:_===null||_===void 0?void 0:_.value.lastName,onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"lastName"});
|
|
297
|
+
/**
|
|
298
|
+
* Order of operations is important here:
|
|
299
|
+
* 1. validate() updates all input error states
|
|
300
|
+
* 2. Setting postalCode triggers @Watch('postalCode')
|
|
301
|
+
* 3. getIsComplete() checks customAddressErrors state
|
|
302
|
+
* Therefore, we must update the value after validation to ensure correct error state
|
|
303
|
+
*/e.lastName=t.detail},required:true}),h("zonos-stripe-select",{"aria-required":"true",autoComplete:"".concat(this.type," country"),class:"zonos--custom-address-form-input",name:"".concat(this.type,"-country"),onSelectChange:function(t){e.countryChanged(t.detail);
|
|
304
|
+
// revalidate the postal code since with empty value so it would reset the customAddressErrors
|
|
305
|
+
e.validate({type:e.type,value:"",valueType:"postalCode"});e.validate({type:e.type,value:"",valueType:"city"});e.validate({type:e.type,value:"",valueType:"state"});
|
|
306
|
+
/**
|
|
307
|
+
* Order of operations is important here:
|
|
308
|
+
* 1. validate() updates all input error states
|
|
309
|
+
* 2. Setting postalCode triggers @Watch('postalCode')
|
|
310
|
+
* 3. getIsComplete() checks customAddressErrors state
|
|
311
|
+
* Therefore, we must update the value after validation to ensure correct error state
|
|
312
|
+
*/e.country=t.detail;e.city="";e.state="";e.postalCode=""},options:N,required:true,selectLabel:translate("Country"),selectedValue:(_===null||_===void 0?void 0:_.value.address.country)||localizationStore.selectedCountryCode||(C===null||C===void 0?void 0:C.value),title:"".concat(this.type," country")}),h("div",{class:"zonos--custom-address-form-line1-wrapper"},h("zonos-stripe-input",{"aria-autocomplete":"list","aria-controls":"autocomplete-search","aria-required":"true",autoComplete:"".concat(this.type," address-line1"),class:"zonos--custom-address-form-input",error:m?g.line1:undefined,inputLabel:translate("Address line 1"),inputValue:_===null||_===void 0?void 0:_.value.address.line1,name:"address-line1",onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"line1"});
|
|
313
|
+
/**
|
|
314
|
+
* Order of operations is important here:
|
|
315
|
+
* 1. validate() updates all input error states
|
|
316
|
+
* 2. Setting postalCode triggers @Watch('postalCode')
|
|
317
|
+
* 3. getIsComplete() checks customAddressErrors state
|
|
318
|
+
* Therefore, we must update the value after validation to ensure correct error state
|
|
319
|
+
*/e.line1=t.detail},onKeyDown:function(t){
|
|
320
|
+
// Clear the address suggestions when the user presses the escape key
|
|
321
|
+
if(t.key==="Escape"){t.preventDefault();t.stopPropagation();e.addressSuggestions=[]}},required:true}),h("zonos-address-suggestions",{onSuggestionSelected:function(t){var r;var n=t.detail.placeId;(r=zonosStore.checkoutAddressService)===null||r===void 0?void 0:r.selectAddress({placeId:n,type:e.type})},suggestions:this.addressSuggestions,type:this.type})),h("div",{"aria-label":"Additional address details",class:classes(["zonos--custom-address-form-additional-fields",z&&this.isAddressLine1Entered?"zonos--show":""]),role:"group"},h("zonos-stripe-input",{"aria-required":"false",autoComplete:"".concat(this.type," address-line2"),class:"zonos--custom-address-form-input",inputLabel:translate(((r=this.countryField)===null||r===void 0?void 0:r.address2Label)||"Address line 2"),inputValue:(_===null||_===void 0?void 0:_.value.address.line2)||"",onInputChange:function(t){e.line2=t.detail}}),((n=this.countryField)===null||n===void 0?void 0:n.cityShow)&&h("zonos-stripe-input",{"aria-required":((o=this.countryField)===null||o===void 0?void 0:o.cityRequired)?"true":"false",autoComplete:"".concat(this.type," address-level2"),class:"zonos--custom-address-form-input",error:m?g.city:undefined,inputLabel:translate(((i=this.countryField)===null||i===void 0?void 0:i.cityLabel)||"City"),inputValue:(_===null||_===void 0?void 0:_.value.address.city)||"",name:"locality",onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"city"});
|
|
322
|
+
/**
|
|
323
|
+
* Order of operations is important here:
|
|
324
|
+
* 1. validate() updates all input error states
|
|
325
|
+
* 2. Setting postalCode triggers @Watch('postalCode')
|
|
326
|
+
* 3. getIsComplete() checks customAddressErrors state
|
|
327
|
+
* Therefore, we must update the value after validation to ensure correct error state
|
|
328
|
+
*/e.city=t.detail},required:(d=this.countryField)===null||d===void 0?void 0:d.cityRequired}),h("div",{class:"zonos--custom-address-form-state-zip-wrapper"},((s=this.countryField)===null||s===void 0?void 0:s.stateShow)&&h("zonos-stripe-select",{"aria-required":((a=this.countryField)===null||a===void 0?void 0:a.stateRequired)?"true":"false",autoComplete:"".concat(this.type," address-level1"),class:"zonos--custom-address-form-input",error:m?g.state:undefined,isError:m&&!!g.state,name:"".concat(this.type,"-state"),onSelectChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"state"});
|
|
329
|
+
/**
|
|
330
|
+
* Order of operations is important here:
|
|
331
|
+
* 1. validate() updates all input error states
|
|
332
|
+
* 2. Setting postalCode triggers @Watch('postalCode')
|
|
333
|
+
* 3. getIsComplete() checks customAddressErrors state
|
|
334
|
+
* Therefore, we must update the value after validation to ensure correct error state
|
|
335
|
+
*/e.state=t.detail},options:E,required:(u=this.countryField)===null||u===void 0?void 0:u.stateRequired,selectLabel:translate(((l=this.countryField)===null||l===void 0?void 0:l.stateLabel)||"State"),selectedValue:_===null||_===void 0?void 0:_.value.address.state,title:"".concat(this.type," state")}),(($=this.countryField)===null||$===void 0?void 0:$.zipShow)&&h("zonos-stripe-input",{"aria-describedby":((c=this.countryField)===null||c===void 0?void 0:c.zipFormat)?"zip-format-".concat(this.type):undefined,"aria-required":((f=this.countryField)===null||f===void 0?void 0:f.zipRequired)?"true":"false",autoComplete:"".concat(this.type," postal-code"),class:"zonos--custom-address-form-input",error:m?g.postalCode:undefined,inputLabel:translate(((p=this.countryField)===null||p===void 0?void 0:p.zipLabel)||"Zip"),inputValue:(_===null||_===void 0?void 0:_.value.address.postal_code)||"",name:"postalCode",onInputChange:function(t){e.validate({type:e.type,value:t.detail,valueType:"postalCode"});
|
|
336
|
+
/**
|
|
337
|
+
* Order of operations is important here:
|
|
338
|
+
* 1. validate() updates all input error states
|
|
339
|
+
* 2. Setting postalCode triggers @Watch('postalCode')
|
|
340
|
+
* 3. getIsComplete() checks customAddressErrors state
|
|
341
|
+
* Therefore, we must update the value after validation to ensure correct error state
|
|
342
|
+
*/e.postalCode=t.detail},required:(v=this.countryField)===null||v===void 0?void 0:v.zipRequired,title:"".concat(this.type," zip code")})),h("zonos-stripe-phone-input",{autoComplete:"".concat(this.type," tel"),class:"zonos--custom-address-form-input",countryCode:_===null||_===void 0?void 0:_.value.address.country,countryOptions:(b=zonosStore.genericSettings)===null||b===void 0?void 0:b.countryFields,error:m?g.phone:undefined,inputLabel:translate("Phone number"),inputValue:(_===null||_===void 0?void 0:_.value.phone)||"",onInputValueChange:function(t){var r=t.detail,n=r.isEmpty,o=r.phoneNumber,i=r.valid,d=r.wrongFormat;
|
|
343
|
+
// Validate the phone number
|
|
344
|
+
e.validate({phoneValidateInfo:{isEmpty:n,isValid:i,wrongFormat:d},type:e.type,value:o,valueType:"phone"});
|
|
345
|
+
/**
|
|
346
|
+
* Order of operations is important here:
|
|
347
|
+
* 1. validate() updates all input error states
|
|
348
|
+
* 2. Setting postalCode triggers @Watch('postalCode')
|
|
349
|
+
* 3. getIsComplete() checks customAddressErrors state
|
|
350
|
+
* Therefore, we must update the value after validation to ensure correct error state
|
|
351
|
+
*/e.phone=o}})))};e.prototype.disconnectedCallback=function(){var e,t;
|
|
352
|
+
// destroy the stripe element when this component is removed from the DOM, so that we can re-create the new one with previous value
|
|
353
|
+
var r=this.getStripeAddressInstance().stripeAddressElement;r===null||r===void 0?void 0:r.destroy();
|
|
354
|
+
// unsubscribe from address suggestions when this component is removed from the DOM
|
|
355
|
+
(e=this.onAddressSuggestionsUnsubscribe)===null||e===void 0?void 0:e.call(this);(t=this.onAddressSelectedUnsubscribe)===null||t===void 0?void 0:t.call(this);
|
|
356
|
+
// cleanup checkout session id subscription
|
|
357
|
+
this.onStoreCheckoutSessionIdChangedSubscription()};e.prototype.componentWillLoad=function(){if(zonosStore.checkoutAddressService){this.initDefaultCustomAddressForm()}};e.prototype.componentDidLoad=function(){var e=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!e&&e.value.address.line1.length>0;
|
|
358
|
+
// @Watch doesn't get trigger on initial load
|
|
359
|
+
this.initAddressSuggestions();this.isFirstInitialization=false;
|
|
360
|
+
// subscribe to checkout session id changes from storage store
|
|
361
|
+
this.onStoreCheckoutSessionIdChanged();this.countryChanged((e===null||e===void 0?void 0:e.value.address.country)||"US")};e.prototype.render=function(){var e;this.addressService=zonosStore.checkoutAddressService;if((e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.complete){this.isAddressFilled=true}
|
|
362
|
+
// Only set country if custom address form is enabled
|
|
363
|
+
if(!this.country&&localizationStore.selectedCountryCode){this.country=localizationStore.selectedCountryCode}
|
|
364
|
+
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
365
|
+
return h(Host,{key:"b4e39a6e92e646f98c0061bf3de8e028c9285556",class:classes(["zonos--address zonos--elements","zonos--".concat(this.type,"-address")])},h("zonos-text",{key:"28d21737c78a1b8125c5170c67f214e3f39939ff",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("slot",{key:"97357f001b27197b8648d6158b786b153c31a7ba",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),this.renderCustomAddressForm())};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{checkoutSessionId:[{isAddressFilledChanged:0}],isAddressFilled:[{isAddressFilledChanged:0}],defaultAddress:[{defaultAddressChanged:0}],line1:[{line1Changed:0}],city:[{formFieldsChanged:0}],country:[{formFieldsChanged:0},{countryChanged:0}],firstName:[{formFieldsChanged:0}],lastName:[{formFieldsChanged:0}],line2:[{formFieldsChanged:0}],phone:[{formFieldsChanged:0}],postalCode:[{formFieldsChanged:0}],state:[{formFieldsChanged:0}],addressService:[{shouldEnabledCustomAddressChanged:0}]}},enumerable:false,configurable:true});return e}();ZonosAddress.style=zonosCustomAddressCss();
|
|
366
|
+
// This file is a workaround for a bug in web browsers' "native"
|
|
367
|
+
// ES6 importing system which is uncapable of importing "*.json" files.
|
|
368
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/239
|
|
369
|
+
var metadata={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[2-467])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]","(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:241|349)0\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|91(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79]))))\\d{3}|(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8])|8(?:55|6[0-8]|[78]\\d|9[02-9]))\\d{6}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|2[23]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[024-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[024-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","(?:01\\d|8)\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-7]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]|50"]],["(\\d{8})","$1",["[5-7]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","[1-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37|86)","300|4(?:0(?:0|20)|370|864)"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[178]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-6]|7[246]|8[2-4]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|[78]"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","[2-9]\\d{9}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"0$1"]],"0"],CF:["236","00","8776\\d{4}|(?:[27]\\d|61)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-8]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["60|809"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9(?:10|[2-9])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-8]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|9[14]"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9,10,11,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|3[13])"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,0,[["528[89]\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[016-8]\\d|2[0-8]|3[01]|5[0-5]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","(?:400|[5-9]\\d\\d)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[4-9]"]]]],ET:["251","00","(?:11|[2-57-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-57-9]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,"0|180020",0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","(?:694\\d|7093)\\d{5}|(?:59|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|80[6-9]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0|180020","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","[235]\\d{8}|800\\d{5,6}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2358]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[48]\\d{8}|[2-9]\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|4(?:[0-35]|4[16-9])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[48]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|80[6-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",[7,8,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","[2-589]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1(?:05|[2-9]))","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0|180020","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31)|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:3171|5[15][2-6]|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|8(?:16|2[014]|3[126]|6[136]|7[78]|83)(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|3[129]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7(?:[23569]|8[0-57-9])|8[1-6])|7(?:1(?:[013-8]|9[6-9])|3(?:17|2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|8(?:28[235-7]|3))|73179|807(?:1|9[1-3])|(?:1552|6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578])\\d|7(?:[23569]\\d|8[0-57-9])|8(?:[14-6]\\d|2[0-79]))|7(?:1(?:[013-8]\\d|9[6-9])|3(?:2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["16|[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["18[06]","18[06]0"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11,12],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[03]"]]],0,0,0,0,0,0,[["0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],["3[2-8]\\d{9,10}",[11,12]],0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0|180020","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|427|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[47]"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[25-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["3|4(?:2[09]|7[01])|6[1-9]","3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[25-9]"],"0$1"]],"0",0,"(000[2569]\\d{4,6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[36]0|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","8\\d{13}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["3"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-6]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[2457]\\d|33|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["20"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["20"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|78|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2679]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{4})(\\d{5})","$1-$2",["892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8(?:0[0-7]|9)"],"0$1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[5-8]"],"0$1"]],"0",0,0,0,0,"[5-8]"],MC:["377","00","(?:[3489]|[67]\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[67]"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["11|2[16]"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","7091\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-37-9]"],"0$1"]],"0"],MX:["52","0[09]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:20|9\\d)\\d{8}|[78]\\d{9,13}",[10,11,12,13,14],[["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[24-9]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85[02-46-9]"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[78]\\d{8}|[2-9]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","[36-8]\\d{5,8}|4\\d{6,8}|59\\d{6}|9\\d{5,10}|(?:2\\d|5[0-8])\\d{6,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["3[289]|4[246-8]|61|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[136]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"0$1"]],"0",0,0,0,0,0,[["2631[0-6]\\d{4}|26(?:2\\d|30|88)\\d{5}"],["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"[3489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","(?:[15]\\d|800|92)\\d{7}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","(?:[2489]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10,12],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[013]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|9[2-9]"]],["(\\d)(\\d{7})","$1 $2",["[267]|904"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[346-9]"]]],"0"],SR:["597","00","(?:[2-5]|[6-9]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-9]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[25-7]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[25-7]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-359]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-4]|5[1-3]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[59]"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[3689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[236-9]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","(?:[0-57-9]\\d|66)\\d{7}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3(?:[1245]|3[12])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["\\d"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","[1-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["826"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["83"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["82"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[25]0|37|49|8[09]"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-478])|7[1-9]","[23568]|4(?:0[2-48]|[1-478])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024","20240"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["20[0-35-7]|4(?:6[45]|[7-9])|[7-9]","20(?:[0135-7]|2[5-9])|4(?:6[45]|[7-9])|[7-9]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[2-4]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:472[2-47-9]|983[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[02469]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|2\\d{3,4}|(?:[49]\\d|80)\\d{5}",[4,5,6,7,8,9,10,11,12,13],[["(\\d{4,5})","$1",["21"]],["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11,12],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{6,7}|7\\d{6}",[7,8,9,10],[["(\\d{4})(\\d{4,6})","$1 $2",["1(?:2[02]|[89])"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[26]|6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:639\\d|7093)\\d{5}|(?:26|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["26(?:89\\d|9(?:0[0-467]|15|5[0-4]|6\\d|[78]0))\\d{4}"],["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|[579]\\d|63)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[579]"],"0$1"]],"0"],ZW:["263","00","(?:13|8\\d{4})\\d{5}|[235-8]\\d{8}|[2-689]\\d{6}",[7,9,10],[["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|29|58)|67[0-46-9]|(?:55|68)[0-69]"],"0$1"],["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|[27]|48)|37|675|(?:55|68)[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["548"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[256]|39|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["3"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|5[12]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|5(?:0\\d{3}|2[0-2]))\\d{7}",[7,8,9,10,12]],0,0,0,["348[57]\\d{7}",[11]],0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};
|
|
370
|
+
// Importing from a ".js" file is a workaround for Node.js "ES Modules"
|
|
371
|
+
// importing system which is even uncapable of importing "*.json" files.
|
|
372
|
+
function withMetadataArgument(e,t){var r=Array.prototype.slice.call(t);r.push(metadata);return e.apply(this,r)}
|
|
373
|
+
// Copy-pasted from:
|
|
374
|
+
// https://github.com/substack/semver-compare/blob/master/index.js
|
|
375
|
+
|
|
376
|
+
// Inlining this function because some users reported issues with
|
|
377
|
+
// importing from `semver-compare` in a browser with ES6 "native" modules.
|
|
378
|
+
|
|
379
|
+
// Fixes `semver-compare` not being able to compare versions with alpha/beta/etc "tags".
|
|
380
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/381
|
|
381
|
+
function compare(e,t){e=e.split("-");t=t.split("-");var r=e[0].split(".");var n=t[0].split(".");for(var o=0;o<3;o++){var i=Number(r[o]);var d=Number(n[o]);if(i>d)return 1;if(d>i)return-1;if(!isNaN(i)&&isNaN(d))return 1;if(isNaN(i)&&!isNaN(d))return-1}if(e[1]&&t[1]){return e[1]>t[1]?1:e[1]<t[1]?-1:0}return!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}var objectConstructor={}.constructor;function isObject(e){return e!==undefined&&e!==null&&e.constructor===objectConstructor}var CALLING_CODE_REG_EXP=/^\d+$/;function isCallingCode(e){return CALLING_CODE_REG_EXP.test(e)}function _typeof$b(e){"@babel/helpers - typeof";return _typeof$b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$b(e)}function _classCallCheck$8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,_toPropertyKey$a(n.key),n)}}function _createClass$8(e,t,r){return t&&_defineProperties$7(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function _toPropertyKey$a(e){var t=_toPrimitive$a(e,"string");return"symbol"==_typeof$b(t)?t:t+""}function _toPrimitive$a(e,t){if("object"!=_typeof$b(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}
|
|
382
|
+
// Added "idd_prefix" and "default_idd_prefix".
|
|
383
|
+
var V3="1.2.0";
|
|
384
|
+
// Moved `001` country code to "nonGeographic" section of metadata.
|
|
385
|
+
var V4="1.7.35";var DEFAULT_EXT_PREFIX=" ext. ";
|
|
386
|
+
/**
|
|
387
|
+
* See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md
|
|
388
|
+
*/var Metadata=function(){
|
|
389
|
+
/**
|
|
390
|
+
* @param {object} metadata — Metadata JSON.
|
|
391
|
+
*/
|
|
392
|
+
function e(t){_classCallCheck$8(this,e);validateMetadata(t);this.metadata=t;setVersion.call(this,t)}return _createClass$8(e,[{key:"getCountries",value:function e(){return Object.keys(this.metadata.countries).filter((function(e){return e!=="001"}))}},{key:"getCountryMetadata",value:function e(t){return this.metadata.countries[t]}},{key:"nonGeographic",value:function e(){if(this.v1||this.v2||this.v3)return;
|
|
393
|
+
// `nonGeographical` was a typo.
|
|
394
|
+
// It's present in metadata generated from `1.7.35` to `1.7.37`.
|
|
395
|
+
// The test case could be found by searching for "nonGeographical".
|
|
396
|
+
return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function e(t){return this.getCountryMetadata(t)!==undefined}},{key:"hasCallingCode",value:function e(t){if(this.getCountryCodesForCallingCode(t)){return true}if(this.nonGeographic()){if(this.nonGeographic()[t]){return true}}else{
|
|
397
|
+
// A hacky workaround for old custom metadata (generated before V4).
|
|
398
|
+
var r=this.countryCallingCodes()[t];if(r&&r.length===1&&r[0]==="001"){return true}}}},{key:"isNonGeographicCallingCode",value:function e(t){if(this.nonGeographic()){return this.nonGeographic()[t]?true:false}else{return this.getCountryCodesForCallingCode(t)?false:true}}
|
|
399
|
+
// Deprecated.
|
|
400
|
+
},{key:"country",value:function e(t){return this.selectNumberingPlan(t)}
|
|
401
|
+
/**
|
|
402
|
+
* Selects a telephone numbering plan based on either a country code or a calling code.
|
|
403
|
+
* @param {string} argument — Country code or calling code.
|
|
404
|
+
* @param {string} legacyArgumentCallingCode — Legacy argument: calling code, if the first argument is not passed.
|
|
405
|
+
*/},{key:"selectNumberingPlan",value:function e(t,r){var n;var o;if(t){if(isCallingCode(t)){o=t}else{n=t}}
|
|
406
|
+
// Previously, the signature of this method was: `.selectNumberingPlan(country, callingCode)`.
|
|
407
|
+
// And if `country` argument wasn't passed, it looked into the second argument `callingCode`.
|
|
408
|
+
// Now it's preferred to only pass either `country` or `callingCode` as the first argument.
|
|
409
|
+
if(r){o=r}
|
|
410
|
+
// Select a telephone numbering plan.
|
|
411
|
+
if(n&&n!=="001"){var i=this.getCountryMetadata(n);if(!i){throw new Error("Unknown country: ".concat(n))}this.numberingPlan=new NumberingPlan(i,this)}else if(o){if(!this.hasCallingCode(o)){throw new Error("Unknown calling code: ".concat(o))}this.numberingPlan=new NumberingPlan(this.getNumberingPlanMetadata(o),this)}else{this.numberingPlan=undefined}return this}},{key:"getCountryCodesForCallingCode",value:function e(t){var r=this.countryCallingCodes()[t];if(r){
|
|
412
|
+
// Metadata before V4 included "non-geographic entity" calling codes
|
|
413
|
+
// inside `country_calling_codes` (for example, `"881":["001"]`).
|
|
414
|
+
// Now the semantics of `country_calling_codes` has changed:
|
|
415
|
+
// it's specifically for "countries" now.
|
|
416
|
+
// Older versions of custom metadata will simply skip parsing
|
|
417
|
+
// "non-geographic entity" phone numbers with new versions
|
|
418
|
+
// of this library: it's not considered a bug,
|
|
419
|
+
// because such numbers are extremely rare,
|
|
420
|
+
// and developers extremely rarely use custom metadata.
|
|
421
|
+
if(r.length===1&&r[0].length===3){return}return r}}},{key:"getCountryCodeForCallingCode",value:function e(t){var r=this.getCountryCodesForCallingCode(t);if(r){return r[0]}}},{key:"getNumberingPlanMetadata",value:function e(t){
|
|
422
|
+
// If a calling code is specified, choose the telephone numbering plan
|
|
423
|
+
// of the "default" country for this calling code.
|
|
424
|
+
// For example, if calling code `1` is passed,
|
|
425
|
+
// the telephone numbering plan of `US` will be selected.
|
|
426
|
+
var r=this.getCountryCodeForCallingCode(t);if(r){return this.getCountryMetadata(r)}if(this.nonGeographic()){var n=this.nonGeographic()[t];if(n){return n}}else{
|
|
427
|
+
// A hacky workaround for old custom metadata (generated before V4).
|
|
428
|
+
// In that metadata, there was no concept of "non-geographic" metadata
|
|
429
|
+
// so metadata for `001` country code was stored along with other countries.
|
|
430
|
+
// The test case can be found by searching for:
|
|
431
|
+
// "should work around `nonGeographic` metadata not existing".
|
|
432
|
+
var o=this.countryCallingCodes()[t];if(o&&o.length===1&&o[0]==="001"){return this.metadata.countries["001"]}}}
|
|
433
|
+
// Deprecated.
|
|
434
|
+
},{key:"countryCallingCode",value:function e(){return this.numberingPlan.callingCode()}
|
|
435
|
+
// Deprecated.
|
|
436
|
+
},{key:"IDDPrefix",value:function e(){return this.numberingPlan.IDDPrefix()}
|
|
437
|
+
// Deprecated.
|
|
438
|
+
},{key:"defaultIDDPrefix",value:function e(){return this.numberingPlan.defaultIDDPrefix()}
|
|
439
|
+
// Deprecated.
|
|
440
|
+
},{key:"nationalNumberPattern",value:function e(){return this.numberingPlan.nationalNumberPattern()}
|
|
441
|
+
// Deprecated.
|
|
442
|
+
},{key:"possibleLengths",value:function e(){return this.numberingPlan.possibleLengths()}
|
|
443
|
+
// Deprecated.
|
|
444
|
+
},{key:"formats",value:function e(){return this.numberingPlan.formats()}
|
|
445
|
+
// Deprecated.
|
|
446
|
+
},{key:"nationalPrefixForParsing",value:function e(){return this.numberingPlan.nationalPrefixForParsing()}
|
|
447
|
+
// Deprecated.
|
|
448
|
+
},{key:"nationalPrefixTransformRule",value:function e(){return this.numberingPlan.nationalPrefixTransformRule()}
|
|
449
|
+
// Deprecated.
|
|
450
|
+
},{key:"leadingDigits",value:function e(){return this.numberingPlan.leadingDigits()}
|
|
451
|
+
// Deprecated.
|
|
452
|
+
},{key:"hasTypes",value:function e(){return this.numberingPlan.hasTypes()}
|
|
453
|
+
// Deprecated.
|
|
454
|
+
},{key:"type",value:function e(t){return this.numberingPlan.type(t)}
|
|
455
|
+
// Deprecated.
|
|
456
|
+
},{key:"ext",value:function e(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function e(){if(this.v1)return this.metadata.country_phone_code_to_countries;return this.metadata.country_calling_codes}
|
|
457
|
+
// Deprecated.
|
|
458
|
+
},{key:"chooseCountryByCountryCallingCode",value:function e(t){return this.selectNumberingPlan(t)}},{key:"hasSelectedNumberingPlan",value:function e(){return this.numberingPlan!==undefined}}])}();var NumberingPlan=function(){function e(t,r){_classCallCheck$8(this,e);this.globalMetadataObject=r;this.metadata=t;setVersion.call(this,r.metadata)}return _createClass$8(e,[{key:"callingCode",value:function e(){return this.metadata[0]}
|
|
459
|
+
// When multiple countries share the same calling code,
|
|
460
|
+
// all phone number formatting rules are included in the metadata
|
|
461
|
+
// of the "default" country for that calling code.
|
|
462
|
+
// Any other countries' metdata doesn't include any formatting rules.
|
|
463
|
+
// Google developers said that such storage architecture was chosen for performance reasons.
|
|
464
|
+
|
|
465
|
+
// For example, for NANPA region ("North American Numbering Plan Administration",
|
|
466
|
+
// which includes USA, Canada, Cayman Islands, Bahamas, etc) all formatting rules
|
|
467
|
+
// are contained in the metadata of `US` country.
|
|
468
|
+
|
|
469
|
+
// This is not public API.
|
|
470
|
+
|
|
471
|
+
},{key:"_getDefaultCountryMetadataForThisCallingCode",value:function e(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}
|
|
472
|
+
// Deprecated.
|
|
473
|
+
},{key:"getDefaultCountryMetadataForRegion",value:function e(){return this._getDefaultCountryMetadataForThisCallingCode()}
|
|
474
|
+
// Is always present.
|
|
475
|
+
},{key:"IDDPrefix",value:function e(){if(this.v1||this.v2)return;return this.metadata[1]}
|
|
476
|
+
// Is only present when a country supports multiple IDD prefixes.
|
|
477
|
+
},{key:"defaultIDDPrefix",value:function e(){if(this.v1||this.v2)return;return this.metadata[12]}},{key:"nationalNumberPattern",value:function e(){if(this.v1||this.v2)return this.metadata[1];return this.metadata[2]}
|
|
478
|
+
// "possible length" data is always present in Google's metadata.
|
|
479
|
+
},{key:"possibleLengths",value:function e(){if(this.v1)return;return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function e(t){return t[this.v1?2:this.v2?3:4]}
|
|
480
|
+
// For countries of the same region (e.g. NANPA)
|
|
481
|
+
// formats are all stored in the "main" country for that region.
|
|
482
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
483
|
+
},{key:"formats",value:function e(){var t=this;var e=this._getFormats(this.metadata)||this._getFormats(this._getDefaultCountryMetadataForThisCallingCode())||[];return e.map((function(e){return new Format(e,t)}))}},{key:"nationalPrefix",value:function e(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function e(t){return t[this.v1?4:this.v2?5:6]}
|
|
484
|
+
// For countries of the same region (e.g. NANPA)
|
|
485
|
+
// national prefix formatting rule is stored in the "main" country for that region.
|
|
486
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
487
|
+
},{key:"nationalPrefixFormattingRule",value:function e(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this._getDefaultCountryMetadataForThisCallingCode())}},{key:"_nationalPrefixForParsing",value:function e(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function e(){
|
|
488
|
+
// If `national_prefix_for_parsing` is not set explicitly,
|
|
489
|
+
// then infer it from `national_prefix` (if any)
|
|
490
|
+
return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function e(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function e(){return!!this.metadata[this.v1?7:this.v2?8:9]}
|
|
491
|
+
// For countries of the same region (e.g. NANPA)
|
|
492
|
+
// "national prefix is optional when formatting" flag is
|
|
493
|
+
// stored in the "main" country for that region.
|
|
494
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
495
|
+
},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function e(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this._getDefaultCountryMetadataForThisCallingCode())}},{key:"leadingDigits",value:function e(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function e(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function e(){
|
|
496
|
+
// Versions 1.2.0 - 1.2.4: can be `[]`.
|
|
497
|
+
/* istanbul ignore next */
|
|
498
|
+
if(this.types()&&this.types().length===0){return false}
|
|
499
|
+
// Versions <= 1.2.4: can be `undefined`.
|
|
500
|
+
// Version >= 1.2.5: can be `0`.
|
|
501
|
+
return!!this.types()}},{key:"type",value:function e(t){if(this.hasTypes()&&getType(this.types(),t)){return new Type(getType(this.types(),t),this)}}},{key:"ext",value:function e(){if(this.v1||this.v2)return DEFAULT_EXT_PREFIX;return this.metadata[13]||DEFAULT_EXT_PREFIX}}])}();var Format=function(){function e(t,r){_classCallCheck$8(this,e);this._format=t;this.metadata=r}return _createClass$8(e,[{key:"pattern",value:function e(){return this._format[0]}},{key:"format",value:function e(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function e(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function e(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function e(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function e(){
|
|
502
|
+
// National prefix is omitted if there's no national prefix formatting rule
|
|
503
|
+
// set for this country, or when the national prefix formatting rule
|
|
504
|
+
// contains no national prefix itself, or when this rule is set but
|
|
505
|
+
// national prefix is optional for this phone number format
|
|
506
|
+
// (and it is not enforced explicitly)
|
|
507
|
+
return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}
|
|
508
|
+
// Checks whether national prefix formatting rule contains national prefix.
|
|
509
|
+
},{key:"usesNationalPrefix",value:function e(){return this.nationalPrefixFormattingRule()&&
|
|
510
|
+
// Check that national prefix formatting rule is not a "dummy" one.
|
|
511
|
+
!FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule())?true:false}},{key:"internationalFormat",value:function e(){return this._format[5]||this.format()}}])}();
|
|
512
|
+
/**
|
|
513
|
+
* A pattern that is used to determine if the national prefix formatting rule
|
|
514
|
+
* has the first group only, i.e., does not start with the national prefix.
|
|
515
|
+
* Note that the pattern explicitly allows for unbalanced parentheses.
|
|
516
|
+
*/var FIRST_GROUP_ONLY_PREFIX_PATTERN=/^\(?\$1\)?$/;var Type=function(){function e(t,r){_classCallCheck$8(this,e);this.type=t;this.metadata=r}return _createClass$8(e,[{key:"pattern",value:function e(){if(this.metadata.v1)return this.type;return this.type[0]}},{key:"possibleLengths",value:function e(){if(this.metadata.v1)return;return this.type[1]||this.metadata.possibleLengths()}}])}();function getType(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}function validateMetadata(e){if(!e){throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.")}
|
|
517
|
+
// `country_phone_code_to_countries` was renamed to `country_calling_codes` in `1.0.18`.
|
|
518
|
+
// For that reason, it's not used in this detection algorithm.
|
|
519
|
+
// Instead, it detects by `countries: {}` property existence.
|
|
520
|
+
if(!isObject(e)||!isObject(e.countries)){throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(isObject(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+typeOf(e)+": "+e,"."))}}
|
|
521
|
+
// Babel transforms `typeof` into some "branches"
|
|
522
|
+
// so istanbul will show this as "branch not covered".
|
|
523
|
+
/* istanbul ignore next */var typeOf=function e(t){return _typeof$b(t)};
|
|
524
|
+
/**
|
|
525
|
+
* Returns "country calling code" for a country.
|
|
526
|
+
* Throws an error if the country doesn't exist or isn't supported by this library.
|
|
527
|
+
* @param {string} country
|
|
528
|
+
* @param {object} metadataJson
|
|
529
|
+
* @return {string}
|
|
530
|
+
* @example
|
|
531
|
+
* // Returns "44"
|
|
532
|
+
* getCountryCallingCode("GB")
|
|
533
|
+
*/function getCountryCallingCode(e,t){var r=new Metadata(t);if(r.hasCountry(e)){return r.selectNumberingPlan(e).countryCallingCode()}throw new Error("Unknown country: ".concat(e))}
|
|
534
|
+
/**
|
|
535
|
+
* Tells if a country code is supported.
|
|
536
|
+
* @param {string} country
|
|
537
|
+
* @param {object} metadataJson
|
|
538
|
+
* @return {boolean}
|
|
539
|
+
* @example
|
|
540
|
+
* // Returns `true`
|
|
541
|
+
* isSupportedCountry("GB")
|
|
542
|
+
*/function isSupportedCountry(e,t){
|
|
543
|
+
// const metadata = new Metadata(metadataJson)
|
|
544
|
+
// return metadata.hasCountry(country)
|
|
545
|
+
return t.countries.hasOwnProperty(e)}
|
|
546
|
+
/**
|
|
547
|
+
* Sets `v1`/`v2`/`v3`/`v4` properties on `this` object.
|
|
548
|
+
* @param {object} metadata — Metadata JSON
|
|
549
|
+
*/function setVersion(e){var t=e.version;if(typeof t==="number"){this.v1=t===1;this.v2=t===2;this.v3=t===3;this.v4=t===4}else{if(!t){this.v1=true}else if(compare(t,V3)===-1){this.v2=true}else if(compare(t,V4)===-1){this.v3=true}else{this.v4=true}}}
|
|
550
|
+
/**
|
|
551
|
+
* Checks phone number length against the phone numbering plan selected in metadata.
|
|
552
|
+
* Optionally, it could be restrained by a specific country.
|
|
553
|
+
* @param {string} nationalNumber
|
|
554
|
+
* @param {string?} country — Specific country to use rather than the one that is pre-selected in the metadata instance.
|
|
555
|
+
* @param {Metadata} metadata — Metadata instance with a selected numbering plan.
|
|
556
|
+
* @returns {string}
|
|
557
|
+
*/function checkNumberLength(e,t,r){return checkNumberLengthForType(e,undefined,t,r)}
|
|
558
|
+
/**
|
|
559
|
+
* Checks phone number length against the phone numbering plan selected in metadata.
|
|
560
|
+
* Optionally, it could be restrained by a specific phone number type or a specific country.
|
|
561
|
+
* @param {string} nationalNumber
|
|
562
|
+
* @param {string?} type — Specific phone number type.
|
|
563
|
+
* @param {string?} country — Specific country to use instead of the one that is pre-selected in the metadata instance.
|
|
564
|
+
* @param {Metadata} metadata — Metadata instance with a selected numbering plan.
|
|
565
|
+
* @returns {string} See the README on `validatePhoneNumberLength()` function, with an addition of a special case: when phone numbers of type `type` aren't possible in the telephone numbering plan, it will return "INVALID_LENGTH".
|
|
566
|
+
*/
|
|
567
|
+
// Checks whether a number is possible for a certain `country` based on the number length.
|
|
568
|
+
|
|
569
|
+
// This function is not supported by metadata generated with ancient versions of
|
|
570
|
+
// `libphonenumber-js` (before version `1.0.18`) which didn't include "possible lengths".
|
|
571
|
+
|
|
572
|
+
// There was also a known issue with `checkNumberLength()` function:
|
|
573
|
+
// if a number is possible only in a certain `country` among several `countries`
|
|
574
|
+
// that share the same "country calling code", that function would check
|
|
575
|
+
// the possibility of the phone number only in the "main" `country` for the "country calling code"
|
|
576
|
+
// and would not check if it's actually be possible in the speciifc `country`.
|
|
577
|
+
|
|
578
|
+
// For example, "+1310xxxx" numbers are valid in Canada.
|
|
579
|
+
// However, they are not possible in the US due to being too short.
|
|
580
|
+
// Since Canada and the US share the same country calling code — "+1" —
|
|
581
|
+
// `checkNumberLength()` function used to return not "IS_POSSIBLE" for "+1310xxxx" numbers.
|
|
582
|
+
|
|
583
|
+
// In such cases, when using "/max" metadata, `isValid()` could output `true`
|
|
584
|
+
// but at the same time `isPossible()` could output `false`, which was contradictory.
|
|
585
|
+
|
|
586
|
+
// See https://issuetracker.google.com/issues/335892662 for the discusson in Google's issues.
|
|
587
|
+
|
|
588
|
+
// The solution suggested by Google was implemented: an optional `country` argument
|
|
589
|
+
// was added to `checkNumberLength()` function. If present, that `country` will be used
|
|
590
|
+
// to check phone number length for that specific `country` rather than the "main" country
|
|
591
|
+
// for the shared "country calling code".
|
|
592
|
+
|
|
593
|
+
function checkNumberLengthForType(e,t,r,n){if(r){
|
|
594
|
+
// If a specific `country` is specified, re-create a metadata instance with it.
|
|
595
|
+
n=new Metadata(n.metadata);n.selectNumberingPlan(r)}var o=n.type(t);
|
|
596
|
+
// There should always be "<possiblePengths/>" set for every type element.
|
|
597
|
+
// This is declared in the XML schema.
|
|
598
|
+
// For size efficiency, where a sub-description (e.g. fixed-line)
|
|
599
|
+
// has the same "<possiblePengths/>" as the "general description", this is missing,
|
|
600
|
+
// so we fall back to the "general description". Where no numbers of the type
|
|
601
|
+
// exist at all, there is one possible length (-1) which is guaranteed
|
|
602
|
+
// not to match the length of any real phone number.
|
|
603
|
+
var i=o&&o.possibleLengths()||n.possibleLengths();
|
|
604
|
+
// let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()
|
|
605
|
+
// Metadata before version `1.0.18` didn't contain `possible_lengths`.
|
|
606
|
+
if(!i){return"IS_POSSIBLE"}var d=e.length;
|
|
607
|
+
// In `libphonenumber-js` all "local-only" formats are dropped for simplicity.
|
|
608
|
+
// // This is safe because there is never an overlap beween the possible lengths
|
|
609
|
+
// // and the local-only lengths; this is checked at build time.
|
|
610
|
+
// if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)
|
|
611
|
+
// {
|
|
612
|
+
// return 'IS_POSSIBLE_LOCAL_ONLY'
|
|
613
|
+
// }
|
|
614
|
+
var s=i[0];if(s===d){return"IS_POSSIBLE"}if(s>d){return"TOO_SHORT"}if(i[i.length-1]<d){return"TOO_LONG"}
|
|
615
|
+
// We skip the first element since we've already checked it.
|
|
616
|
+
return i.indexOf(d,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}
|
|
617
|
+
/**
|
|
618
|
+
* Checks if a phone number is "possible" (basically just checks its length).
|
|
619
|
+
*
|
|
620
|
+
* isPossible(phoneNumberInstance, { ..., v2: true }, metadata)
|
|
621
|
+
*
|
|
622
|
+
* isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)
|
|
623
|
+
* isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)
|
|
624
|
+
*
|
|
625
|
+
* @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.
|
|
626
|
+
* @param {object} [options]
|
|
627
|
+
* @param {object} metadataJson
|
|
628
|
+
* @return {string}
|
|
629
|
+
*/function isPossiblePhoneNumber(e,t,r){
|
|
630
|
+
/* istanbul ignore if */
|
|
631
|
+
if(t===undefined){t={}}var n=new Metadata(r);if(t.v2){if(!e.countryCallingCode){throw new Error("Invalid phone number object passed")}n.selectNumberingPlan(e.country||e.countryCallingCode)}else{if(!e.phone){return false}if(e.country){if(!n.hasCountry(e.country)){throw new Error("Unknown country: ".concat(e.country))}n.selectNumberingPlan(e.country)}else{if(!e.countryCallingCode){throw new Error("Invalid phone number object passed")}n.selectNumberingPlan(e.countryCallingCode)}}
|
|
632
|
+
// Old (legacy) metadata (< 1.0.18) had no "possible length" data.
|
|
633
|
+
// So `isPossibleNumber()` function is supported only for non-legacy metadata.
|
|
634
|
+
if(n.possibleLengths()){return isPossibleNumber$2(e.phone||e.nationalNumber,n)}
|
|
635
|
+
// There was a bug in versions from `1.7.35` to `1.7.37` of `libphonenumber-js`
|
|
636
|
+
// where "possible_lengths" property was missing from "non-geographical" numbering plans' metadata.
|
|
637
|
+
// After that, the bug was noticed and fixed.
|
|
638
|
+
// So for versions from `1.7.35` to `1.7.37`, just assume that all "non=geotraphical" numbers are possible.
|
|
639
|
+
// The reason is that the bug was noticed relatively quickly (within a day or so)
|
|
640
|
+
// and it's unlikely that anyone generated their custom metadata in that short time span.
|
|
641
|
+
// And if they didn't generate any custom metadata then a follow-up package update would've silently fixed the bug.
|
|
642
|
+
if(e.countryCallingCode&&n.isNonGeographicCallingCode(e.countryCallingCode)){return true}
|
|
643
|
+
// `isPossibleNumber()` function is not supported.
|
|
644
|
+
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}
|
|
645
|
+
/**
|
|
646
|
+
* Tells if a given national (significant) number is possible
|
|
647
|
+
* @param {string} nationalNumber
|
|
648
|
+
* @param {Metadata} metadata = Metadata instance with a pre-selected telephone numbering plan.
|
|
649
|
+
* @returns {boolean}
|
|
650
|
+
*/function isPossibleNumber$2(e,t){switch(checkNumberLength(e,undefined,t)){case"IS_POSSIBLE":return true;
|
|
651
|
+
// This library ignores "local-only" phone numbers (for simplicity).
|
|
652
|
+
// See the readme for more info on what are "local-only" phone numbers.
|
|
653
|
+
// case 'IS_POSSIBLE_LOCAL_ONLY':
|
|
654
|
+
// return !isInternational
|
|
655
|
+
default:return false}}
|
|
656
|
+
/**
|
|
657
|
+
* Checks whether the entire input sequence can be matched
|
|
658
|
+
* against the regular expression.
|
|
659
|
+
* @return {boolean}
|
|
660
|
+
*/function matchesEntirely(e,t){
|
|
661
|
+
// If the assigning of the `''` default value is moved to the arguments above,
|
|
662
|
+
// the code coverage would decrease for some weird reason.
|
|
663
|
+
e=e||"";return new RegExp("^(?:"+t+")$").test(e)}function _createForOfIteratorHelperLoose$6(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$9(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$9(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$9(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$9(e,t):void 0}}function _arrayLikeToArray$9(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var NON_FIXED_LINE_PHONE_TYPES=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];
|
|
664
|
+
// Finds out national phone number type (fixed line, mobile, etc)
|
|
665
|
+
function getNumberType(e,t,r){
|
|
666
|
+
// If assigning the `{}` default value is moved to the arguments above,
|
|
667
|
+
// code coverage would decrease for some weird reason.
|
|
668
|
+
t=t||{};
|
|
669
|
+
// When `parse()` returns an empty object — `{}` —
|
|
670
|
+
// that means that the phone number is malformed,
|
|
671
|
+
// so it can't possibly be valid.
|
|
672
|
+
if(!e.country&&!e.countryCallingCode){return}var n=new Metadata(r);n.selectNumberingPlan(e.country||e.countryCallingCode);var o=t.v2?e.nationalNumber:e.phone;
|
|
673
|
+
// The following is copy-pasted from the original function:
|
|
674
|
+
// https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835
|
|
675
|
+
// Is this national number even valid for this country
|
|
676
|
+
if(!matchesEntirely(o,n.nationalNumberPattern())){return}
|
|
677
|
+
// Is it fixed line number
|
|
678
|
+
if(isNumberTypeEqualTo(o,"FIXED_LINE",n)){
|
|
679
|
+
// Because duplicate regular expressions are removed
|
|
680
|
+
// to reduce metadata size, if "mobile" pattern is ""
|
|
681
|
+
// then it means it was removed due to being a duplicate of the fixed-line pattern.
|
|
682
|
+
if(n.type("MOBILE")&&n.type("MOBILE").pattern()===""){return"FIXED_LINE_OR_MOBILE"}
|
|
683
|
+
// `MOBILE` type pattern isn't included if it matched `FIXED_LINE` one.
|
|
684
|
+
// For example, for "US" country.
|
|
685
|
+
// Old metadata (< `1.0.18`) had a specific "types" data structure
|
|
686
|
+
// that happened to be `undefined` for `MOBILE` in that case.
|
|
687
|
+
// Newer metadata (>= `1.0.18`) has another data structure that is
|
|
688
|
+
// not `undefined` for `MOBILE` in that case (it's just an empty array).
|
|
689
|
+
// So this `if` is just for backwards compatibility with old metadata.
|
|
690
|
+
if(!n.type("MOBILE")){return"FIXED_LINE_OR_MOBILE"}
|
|
691
|
+
// Check if the number happens to qualify as both fixed line and mobile.
|
|
692
|
+
// (no such country in the minimal metadata set)
|
|
693
|
+
/* istanbul ignore if */if(isNumberTypeEqualTo(o,"MOBILE",n)){return"FIXED_LINE_OR_MOBILE"}return"FIXED_LINE"}for(var i=_createForOfIteratorHelperLoose$6(NON_FIXED_LINE_PHONE_TYPES),d;!(d=i()).done;){var s=d.value;if(isNumberTypeEqualTo(o,s,n)){return s}}}function isNumberTypeEqualTo(e,t,r){var n=r.type(t);if(!n||!n.pattern()){return false}
|
|
694
|
+
// Check if any possible number lengths are present;
|
|
695
|
+
// if so, we use them to avoid checking
|
|
696
|
+
// the validation pattern if they don't match.
|
|
697
|
+
// If they are absent, this means they match
|
|
698
|
+
// the general description, which we have
|
|
699
|
+
// already checked before a specific number type.
|
|
700
|
+
if(n.possibleLengths()&&n.possibleLengths().indexOf(e.length)<0){return false}return matchesEntirely(e,n.pattern())}
|
|
701
|
+
/**
|
|
702
|
+
* Checks if a given phone number is valid.
|
|
703
|
+
*
|
|
704
|
+
* isValid(phoneNumberInstance, { ..., v2: true }, metadata)
|
|
705
|
+
*
|
|
706
|
+
* isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)
|
|
707
|
+
* isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)
|
|
708
|
+
*
|
|
709
|
+
* If the `number` is a string, it will be parsed to an object,
|
|
710
|
+
* but only if it contains only valid phone number characters (including punctuation).
|
|
711
|
+
* If the `number` is an object, it is used as is.
|
|
712
|
+
*
|
|
713
|
+
* The optional `defaultCountry` argument is the default country.
|
|
714
|
+
* I.e. it does not restrict to just that country,
|
|
715
|
+
* e.g. in those cases where several countries share
|
|
716
|
+
* the same phone numbering rules (NANPA, Britain, etc).
|
|
717
|
+
* For example, even though the number `07624 369230`
|
|
718
|
+
* belongs to the Isle of Man ("IM" country code)
|
|
719
|
+
* calling `isValidNumber('07624369230', 'GB', metadata)`
|
|
720
|
+
* still returns `true` because the country is not restricted to `GB`,
|
|
721
|
+
* it's just that `GB` is the default one for the phone numbering rules.
|
|
722
|
+
* For restricting the country see `isValidNumberForRegion()`
|
|
723
|
+
* though restricting a country might not be a good idea.
|
|
724
|
+
* https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
|
|
725
|
+
*
|
|
726
|
+
* Examples:
|
|
727
|
+
*
|
|
728
|
+
* ```js
|
|
729
|
+
* isValidNumber('+78005553535', metadata)
|
|
730
|
+
* isValidNumber('8005553535', 'RU', metadata)
|
|
731
|
+
* isValidNumber('88005553535', 'RU', metadata)
|
|
732
|
+
* isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)
|
|
733
|
+
* ```
|
|
734
|
+
*/function isValidNumber(e,t,r){
|
|
735
|
+
// If assigning the `{}` default value is moved to the arguments above,
|
|
736
|
+
// code coverage would decrease for some weird reason.
|
|
737
|
+
t=t||{};var n=new Metadata(r);n.selectNumberingPlan(e.country||e.countryCallingCode);
|
|
738
|
+
// By default, countries only have type regexps when it's required for
|
|
739
|
+
// distinguishing different countries having the same `countryCallingCode`.
|
|
740
|
+
if(n.hasTypes()){return getNumberType(e,t,n.metadata)!==undefined}
|
|
741
|
+
// If there are no type regexps for this country in metadata then use
|
|
742
|
+
// `nationalNumberPattern` as a "better than nothing" replacement.
|
|
743
|
+
var o=t.v2?e.nationalNumber:e.phone;return matchesEntirely(o,n.nationalNumberPattern())}var COUNTRY_CODE_REG_EXP=/^[A-Z]{2}$/;function isCountryCode(e){return COUNTRY_CODE_REG_EXP.test(e)}function getCountryAndCallingCodeFromOneOfThem(e,t){var r;var n;var o=new Metadata(t);
|
|
744
|
+
// If country code is passed then derive `countryCallingCode` from it.
|
|
745
|
+
// Also store the country code as `.country`.
|
|
746
|
+
if(isCountryCode(e)){r=e;o.selectNumberingPlan(r);n=o.countryCallingCode()}else{n=e}return{country:r,callingCode:n}}
|
|
747
|
+
/**
|
|
748
|
+
* Returns a list of countries that the phone number could potentially belong to.
|
|
749
|
+
* @param {string} callingCode — Calling code.
|
|
750
|
+
* @param {string} nationalNumber — National (significant) number.
|
|
751
|
+
* @param {object} metadata — Metadata.
|
|
752
|
+
* @return {string[]} A list of possible countries.
|
|
753
|
+
*/function getPossibleCountriesForNumber(e,t,r){var n=new Metadata(r);var o=n.getCountryCodesForCallingCode(e);if(!o){return[]}return o.filter((function(e){return couldNationalNumberBelongToCountry(t,e,r)}))}function couldNationalNumberBelongToCountry(e,t,r){var n=new Metadata(r);n.selectNumberingPlan(t);return n.numberingPlan.possibleLengths().indexOf(e.length)>=0}
|
|
754
|
+
// The minimum length of the national significant number.
|
|
755
|
+
var MIN_LENGTH_FOR_NSN=2;
|
|
756
|
+
// The ITU says the maximum length should be 15,
|
|
757
|
+
// but one can find longer numbers in Germany.
|
|
758
|
+
var MAX_LENGTH_FOR_NSN=17;
|
|
759
|
+
// The maximum length of the country calling code.
|
|
760
|
+
var MAX_LENGTH_COUNTRY_CODE=3;
|
|
761
|
+
// Digits accepted in phone numbers
|
|
762
|
+
// (ascii, fullwidth, arabic-indic, and eastern arabic digits).
|
|
763
|
+
var VALID_DIGITS="0-90-9٠-٩۰-۹";
|
|
764
|
+
// `DASHES` will be right after the opening square bracket of the "character class"
|
|
765
|
+
var DASHES="-‐-―−ー-";var SLASHES="//";var DOTS="..";var WHITESPACE=" ";var BRACKETS="()()[]\\[\\]";
|
|
766
|
+
// export const OPENING_BRACKETS = '(\uFF08\uFF3B\\\['
|
|
767
|
+
var TILDES="~⁓∼~";
|
|
768
|
+
// Regular expression of acceptable punctuation found in phone numbers. This
|
|
769
|
+
// excludes punctuation found as a leading character only. This consists of dash
|
|
770
|
+
// characters, white space characters, full stops, slashes, square brackets,
|
|
771
|
+
// parentheses and tildes. Full-width variants are also present.
|
|
772
|
+
var VALID_PUNCTUATION="".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);var PLUS_CHARS="++";
|
|
773
|
+
// const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')
|
|
774
|
+
var CAPTURING_DIGIT_PATTERN=new RegExp("(["+VALID_DIGITS+"])");function stripIddPrefix(e,t,r,n){if(!t){return}
|
|
775
|
+
// Get the IDD prefix pattern.
|
|
776
|
+
var o=new Metadata(n);o.selectNumberingPlan(t||r);var i=new RegExp(o.IDDPrefix());
|
|
777
|
+
// Check if the number is IDD-prefixed.
|
|
778
|
+
if(e.search(i)!==0){return}
|
|
779
|
+
// Strip IDD prefix.
|
|
780
|
+
e=e.slice(e.match(i)[0].length);
|
|
781
|
+
// If there're any digits after an IDD prefix,
|
|
782
|
+
// then those digits are a country calling code.
|
|
783
|
+
// Since no country code starts with a `0`,
|
|
784
|
+
// the code below validates that the next digit (if present) is not `0`.
|
|
785
|
+
var d=e.match(CAPTURING_DIGIT_PATTERN);if(d&&d[1]!=null&&d[1].length>0){if(d[1]==="0"){return}}return e}
|
|
786
|
+
/**
|
|
787
|
+
* Strips any national prefix (such as 0, 1) present in a
|
|
788
|
+
* (possibly incomplete) number provided.
|
|
789
|
+
* "Carrier codes" are only used in Colombia and Brazil,
|
|
790
|
+
* and only when dialing within those countries from a mobile phone to a fixed line number.
|
|
791
|
+
* Sometimes it won't actually strip national prefix
|
|
792
|
+
* and will instead prepend some digits to the `number`:
|
|
793
|
+
* for example, when number `2345678` is passed with `VI` country selected,
|
|
794
|
+
* it will return `{ number: "3402345678" }`, because `340` area code is prepended.
|
|
795
|
+
* @param {string} number — National number digits.
|
|
796
|
+
* @param {object} metadata — Metadata with country selected.
|
|
797
|
+
* @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not.
|
|
798
|
+
*/function extractNationalNumberFromPossiblyIncompleteNumber(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){
|
|
799
|
+
// See METADATA.md for the description of
|
|
800
|
+
// `national_prefix_for_parsing` and `national_prefix_transform_rule`.
|
|
801
|
+
// Attempt to parse the first digits as a national prefix.
|
|
802
|
+
var r=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")");var n=r.exec(e);if(n){var o;var i;
|
|
803
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
804
|
+
// If a `national_prefix_for_parsing` has any "capturing groups"
|
|
805
|
+
// then it means that the national (significant) number is equal to
|
|
806
|
+
// those "capturing groups" transformed via `national_prefix_transform_rule`,
|
|
807
|
+
// and nothing could be said about the actual national prefix:
|
|
808
|
+
// what is it and was it even there.
|
|
809
|
+
// If a `national_prefix_for_parsing` doesn't have any "capturing groups",
|
|
810
|
+
// then everything it matches is a national prefix.
|
|
811
|
+
// To determine whether `national_prefix_for_parsing` matched any
|
|
812
|
+
// "capturing groups", the value of the result of calling `.exec()`
|
|
813
|
+
// is looked at, and if it has non-undefined values where there're
|
|
814
|
+
// "capturing groups" in the regular expression, then it means
|
|
815
|
+
// that "capturing groups" have been matched.
|
|
816
|
+
// It's not possible to tell whether there'll be any "capturing gropus"
|
|
817
|
+
// before the matching process, because a `national_prefix_for_parsing`
|
|
818
|
+
// could exhibit both behaviors.
|
|
819
|
+
var d=n.length-1;var s=d>0&&n[d];if(t.nationalPrefixTransformRule()&&s){o=e.replace(r,t.nationalPrefixTransformRule());
|
|
820
|
+
// If there's more than one captured group,
|
|
821
|
+
// then carrier code is the second one.
|
|
822
|
+
if(d>1){i=n[1]}}
|
|
823
|
+
// If there're no "capturing groups",
|
|
824
|
+
// or if there're "capturing groups" but no
|
|
825
|
+
// `national_prefix_transform_rule`,
|
|
826
|
+
// then just strip the national prefix from the number,
|
|
827
|
+
// and possibly a carrier code.
|
|
828
|
+
// Seems like there could be more.
|
|
829
|
+
else{
|
|
830
|
+
// `prefixBeforeNationalNumber` is the whole substring matched by
|
|
831
|
+
// the `national_prefix_for_parsing` regular expression.
|
|
832
|
+
// There seem to be no guarantees that it's just a national prefix.
|
|
833
|
+
// For example, if there's a carrier code, it's gonna be a
|
|
834
|
+
// part of `prefixBeforeNationalNumber` too.
|
|
835
|
+
var a=n[0];o=e.slice(a.length);
|
|
836
|
+
// If there's at least one captured group,
|
|
837
|
+
// then carrier code is the first one.
|
|
838
|
+
if(s){i=n[1]}}
|
|
839
|
+
// Tries to guess whether a national prefix was present in the input.
|
|
840
|
+
// This is not something copy-pasted from Google's library:
|
|
841
|
+
// they don't seem to have an equivalent for that.
|
|
842
|
+
// So this isn't an "officially approved" way of doing something like that.
|
|
843
|
+
// But since there seems no other existing method, this library uses it.
|
|
844
|
+
var u;if(s){var l=e.indexOf(n[1]);var $=e.slice(0,l);
|
|
845
|
+
// Example: an Argentinian (AR) phone number `0111523456789`.
|
|
846
|
+
// `prefixMatch[0]` is `01115`, and `$1` is `11`,
|
|
847
|
+
// and the rest of the phone number is `23456789`.
|
|
848
|
+
// The national number is transformed via `9$1` to `91123456789`.
|
|
849
|
+
// National prefix `0` is detected being present at the start.
|
|
850
|
+
// if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {
|
|
851
|
+
if($===t.numberingPlan.nationalPrefix()){u=t.numberingPlan.nationalPrefix()}}else{u=n[0]}return{nationalNumber:o,nationalPrefix:u,carrierCode:i}}}return{nationalNumber:e}}function _createForOfIteratorHelperLoose$5(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$8(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$8(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$8(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$8(e,t):void 0}}function _arrayLikeToArray$8(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}
|
|
852
|
+
/**
|
|
853
|
+
* Returns the exact country that a given national (significant) number belongs to
|
|
854
|
+
* in case of ambiguity, i.e. when multiple countries share the same "country calling code".
|
|
855
|
+
* @param {string} [nationalNumber]
|
|
856
|
+
* @param {string[]} countries — A list of countries that share the same calling code.
|
|
857
|
+
* @param {object} metadata — Metadata JSON.
|
|
858
|
+
* @returns {string?} Returns the exact country this number belongs to, or `undefined` if the exact country couldn't be determined.
|
|
859
|
+
*/function getCountryByNationalNumber(e,t,r){
|
|
860
|
+
// Create a new `metadata` instance because it will be selecting a `country`.
|
|
861
|
+
var n=new Metadata(r);
|
|
862
|
+
// const matchingCountries = []
|
|
863
|
+
for(var o=_createForOfIteratorHelperLoose$5(t),i;!(i=o()).done;){var d=i.value;n.selectNumberingPlan(d);
|
|
864
|
+
// "Leading digits" patterns are only defined for about 20% of all countries.
|
|
865
|
+
// By definition, matching "leading digits" is a sufficient but not a necessary
|
|
866
|
+
// condition for a phone number to belong to a country.
|
|
867
|
+
// The point of "leading digits" check is that it's the fastest one to get a match.
|
|
868
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits
|
|
869
|
+
// I'd suppose that "leading digits" patterns are mutually exclusive for different countries
|
|
870
|
+
// because of the intended use of that feature.
|
|
871
|
+
if(n.leadingDigits()){if(e&&e.search(n.leadingDigits())===0){return d}}
|
|
872
|
+
// Else perform full validation with all of those
|
|
873
|
+
// fixed-line/mobile/etc regular expressions.
|
|
874
|
+
else if(getNumberType({phone:e,country:d},undefined,n.metadata)){
|
|
875
|
+
// When multiple countries share the same "country calling code",
|
|
876
|
+
// type patterns aren't guaranteed to be unique among them.
|
|
877
|
+
// For example, both `US` and `CA` have the same pattern for `toll_free` numbers.
|
|
878
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417147572
|
|
879
|
+
// That means that this `if` condition could be `true` for multiple countries from the list.
|
|
880
|
+
// Currently, it just returns the first one, which is also the "main" country for the "country calling code".
|
|
881
|
+
// In an example with `toll_free` numbers above, `"US"` would be returned even though
|
|
882
|
+
// it could as well be `"CA"`.
|
|
883
|
+
// There was also a time when this attempted to be overly smart
|
|
884
|
+
// and kept track of all such multiple matching countries
|
|
885
|
+
// and then picked the one that matched the `defaultCountry`, if provided.
|
|
886
|
+
// For example, with `toll_free` numbers above, and with `defaultCountry: "CA"`,
|
|
887
|
+
// it would've returned `"CA"` instead of `"US"`.
|
|
888
|
+
// Later it turned out that such "overly smart" behavior turned out to be just confusing,
|
|
889
|
+
// so this "overly smart" country detection was reverted to returning the "main" country
|
|
890
|
+
// for the "country calling code".
|
|
891
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/154
|
|
892
|
+
return d;
|
|
893
|
+
|
|
894
|
+
// The "overly smart" behavior code:
|
|
895
|
+
|
|
896
|
+
// if (defaultCountry) {
|
|
897
|
+
// if (country === defaultCountry) {
|
|
898
|
+
// return country
|
|
899
|
+
// } else {
|
|
900
|
+
// matchingCountries.push(country)
|
|
901
|
+
// }
|
|
902
|
+
// } else {
|
|
903
|
+
// return country
|
|
904
|
+
// }
|
|
905
|
+
}}
|
|
906
|
+
// // Return the first ("main") one of the `matchingCountries`.
|
|
907
|
+
// if (matchingCountries.length > 0) {
|
|
908
|
+
// return matchingCountries[0]
|
|
909
|
+
// }
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Returns the exact country that a given national (significant) number belongs to
|
|
913
|
+
* in case of ambiguity, i.e. when multiple countries share the same "country calling code".
|
|
914
|
+
* @param {string} [callingCode]
|
|
915
|
+
* @param {string} [options.nationalNumber] — National (significant) number.
|
|
916
|
+
* @param {Metadata} options.metadata — Metadata instance.
|
|
917
|
+
* @returns {string?} Returns the most suitable country for this calling code and national (significant) number.
|
|
918
|
+
*/function getCountryByCallingCode(e,t){var r=t.nationalNumber,n=t.metadata;var o=n.getCountryCodesForCallingCode(e);if(!o){return}
|
|
919
|
+
// If there's just one country corresponding to the country code,
|
|
920
|
+
// then just return it, without further phone number digits validation.
|
|
921
|
+
if(o.length===1){return o[0]}return getCountryByNationalNumber(r,o,n.metadata)}
|
|
922
|
+
/**
|
|
923
|
+
* Strips national prefix and carrier code from a complete phone number.
|
|
924
|
+
* The difference from the non-"FromCompleteNumber" function is that
|
|
925
|
+
* it won't extract national prefix if the resultant number is too short
|
|
926
|
+
* to be a complete number for the selected phone numbering plan.
|
|
927
|
+
* @param {string} number — Complete phone number digits.
|
|
928
|
+
* @param {string?} country — Specific country to use instead of the one that is pre-selected in the metadata instance.
|
|
929
|
+
* @param {Metadata} metadata — Metadata instance with a selected numbering plan.
|
|
930
|
+
* @return {object} `{ nationalNumber: string, carrierCode: string? }`.
|
|
931
|
+
*/function extractNationalNumber(e,t,r){
|
|
932
|
+
// Parsing national prefixes and carrier codes
|
|
933
|
+
// is only required for local phone numbers
|
|
934
|
+
// but some people don't understand that
|
|
935
|
+
// and sometimes write international phone numbers
|
|
936
|
+
// with national prefixes (or maybe even carrier codes).
|
|
937
|
+
// http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html
|
|
938
|
+
// Google's original library forgives such mistakes
|
|
939
|
+
// and so does this library, because it has been requested:
|
|
940
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/127
|
|
941
|
+
var n=extractNationalNumberFromPossiblyIncompleteNumber(e,r),o=n.carrierCode,i=n.nationalNumber;if(i!==e){if(!shouldHaveExtractedNationalPrefix(e,i,r)){
|
|
942
|
+
// Don't strip the national prefix.
|
|
943
|
+
return{nationalNumber:e}}
|
|
944
|
+
// Check the national (significant) number length after extracting national prefix and carrier code.
|
|
945
|
+
// Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature,
|
|
946
|
+
// so this `if` will only be executed with newer metadata.
|
|
947
|
+
if(r.numberingPlan.possibleLengths()){
|
|
948
|
+
// If an exact `country` is not specified, attempt to detect it from the assumed national number.
|
|
949
|
+
if(!t){t=getCountryByCallingCode(r.numberingPlan.callingCode(),{nationalNumber:i,metadata:r})}
|
|
950
|
+
// The number remaining after stripping the national prefix and carrier code
|
|
951
|
+
// should be long enough to have a possible length for the country.
|
|
952
|
+
// Otherwise, don't strip the national prefix and carrier code,
|
|
953
|
+
// since the original number could be a valid number.
|
|
954
|
+
// This check has been copy-pasted "as is" from Google's original library:
|
|
955
|
+
// https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250
|
|
956
|
+
// It doesn't check for the "possibility" of the original `number`.
|
|
957
|
+
// I guess it's fine not checking that one. It works as is anyway.
|
|
958
|
+
if(!isPossibleIncompleteNationalNumber(i,t,r)){
|
|
959
|
+
// Don't strip the national prefix.
|
|
960
|
+
return{nationalNumber:e}}}}return{nationalNumber:i,carrierCode:o}}
|
|
961
|
+
// In some countries, the same digit could be a national prefix
|
|
962
|
+
// or a leading digit of a valid phone number.
|
|
963
|
+
// For example, in Russia, national prefix is `8`,
|
|
964
|
+
// and also `800 555 35 35` is a valid number
|
|
965
|
+
// in which `8` is not a national prefix, but the first digit
|
|
966
|
+
// of a national (significant) number.
|
|
967
|
+
// Same's with Belarus:
|
|
968
|
+
// `82004910060` is a valid national (significant) number,
|
|
969
|
+
// but `2004910060` is not.
|
|
970
|
+
// To support such cases (to prevent the code from always stripping
|
|
971
|
+
// national prefix), a condition is imposed: a national prefix
|
|
972
|
+
// is not extracted when the original number is "viable" and the
|
|
973
|
+
// resultant number is not, a "viable" national number being the one
|
|
974
|
+
// that matches `national_number_pattern`.
|
|
975
|
+
function shouldHaveExtractedNationalPrefix(e,t,r){
|
|
976
|
+
// The equivalent in Google's code is:
|
|
977
|
+
// https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004
|
|
978
|
+
if(matchesEntirely(e,r.nationalNumberPattern())&&!matchesEntirely(t,r.nationalNumberPattern())){return false}
|
|
979
|
+
// This "is possible" national number (length) check has been commented out
|
|
980
|
+
// because it's superceded by the (effectively) same check done in the
|
|
981
|
+
// `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.
|
|
982
|
+
// In other words, why run the same check twice if it could only be run once.
|
|
983
|
+
// // Check the national (significant) number length after extracting national prefix and carrier code.
|
|
984
|
+
// // Fixes a minor "weird behavior" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57
|
|
985
|
+
// // (Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature).
|
|
986
|
+
// if (metadata.possibleLengths()) {
|
|
987
|
+
// if (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) &&
|
|
988
|
+
// !isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) {
|
|
989
|
+
// return false
|
|
990
|
+
// }
|
|
991
|
+
// }
|
|
992
|
+
return true}
|
|
993
|
+
/**
|
|
994
|
+
* Tells if a given incomplete national number is possible or not.
|
|
995
|
+
* @param {string} nationalNumber
|
|
996
|
+
* @param {string?} country — Specific country rather than the one that is pre-selected in the metadata instance.
|
|
997
|
+
* @param {Metadata} metadata — Metadata instance with a selected numbering plan.
|
|
998
|
+
* @returns {boolean}
|
|
999
|
+
*/function isPossibleIncompleteNationalNumber(e,t,r){switch(checkNumberLength(e,t,r)){case"TOO_SHORT":case"INVALID_LENGTH":
|
|
1000
|
+
// This library ignores "local-only" phone numbers (for simplicity).
|
|
1001
|
+
// See the readme for more info on what are "local-only" phone numbers.
|
|
1002
|
+
// case 'IS_POSSIBLE_LOCAL_ONLY':
|
|
1003
|
+
return false;default:return true}}
|
|
1004
|
+
/**
|
|
1005
|
+
* Sometimes some people incorrectly input international phone numbers
|
|
1006
|
+
* without the leading `+`. This function corrects such input.
|
|
1007
|
+
* @param {string} number — Phone number digits (only digits, no `+`).
|
|
1008
|
+
* @param {string} [country] — Exact country of the phone number.
|
|
1009
|
+
* @param {string} [defaultCountry]
|
|
1010
|
+
* @param {string} [defaultCallingCode]
|
|
1011
|
+
* @param {object} metadataJson
|
|
1012
|
+
* @return {object} `{ countryCallingCode: string?, number: string }`, where `countryCallingCode` is the calling code that was extracted from the input `number` string, and `number` is the originally passed `number` without the extracted calling code.
|
|
1013
|
+
*/function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(e,t,r,n,o){
|
|
1014
|
+
// Validate arguments.
|
|
1015
|
+
// The `number` is known to be in a non-international form
|
|
1016
|
+
// because there's no leading "+" character.
|
|
1017
|
+
// Therefore, there must be either `country` or `defaultCountry` or `defaultCallingCode`.
|
|
1018
|
+
// Otherwise, there'd be no source for the calling code to search for in the `number`.
|
|
1019
|
+
if(!(t||r||n)){
|
|
1020
|
+
// There's no source for the calling code to search for in the `number`.
|
|
1021
|
+
return{number:e}}var i=t||r?getCountryCallingCode(t||r,o):n;if(e.indexOf(i)===0){var d=new Metadata(o);d.selectNumberingPlan(t||r||n);var s=e.slice(i.length);var a=extractNationalNumber(s,undefined,d),u=a.nationalNumber;var l=extractNationalNumber(e,undefined,d),$=l.nationalNumber;
|
|
1022
|
+
// If the number was not valid before but is valid now,
|
|
1023
|
+
// or if it was too long before, we consider the number
|
|
1024
|
+
// with the country calling code stripped to be a better result
|
|
1025
|
+
// and keep that instead.
|
|
1026
|
+
// For example, in Germany (+49), `49` is a valid area code,
|
|
1027
|
+
// so if a number starts with `49`, it could be both a valid
|
|
1028
|
+
// national German number or an international number without
|
|
1029
|
+
// a leading `+`.
|
|
1030
|
+
if(!matchesEntirely($,d.nationalNumberPattern())&&matchesEntirely(u,d.nationalNumberPattern())||checkNumberLength($,undefined,d)==="TOO_LONG"){return{countryCallingCode:i,number:s}}}return{number:e}}
|
|
1031
|
+
/**
|
|
1032
|
+
* Attempts to extract a calling code from a phone number.
|
|
1033
|
+
* * If the phone number is found to be "international":
|
|
1034
|
+
* * It will attempt to identify the calling code part of it and whether that part is complete and valid.
|
|
1035
|
+
* * If the calling code part is complete and valid, it will return two properties:
|
|
1036
|
+
* that calling code part (without `+`) and the rest of the digits.
|
|
1037
|
+
* * Otherwise, i.e. if the calling code part is incomplete or invalid,
|
|
1038
|
+
* it will return an empty object.
|
|
1039
|
+
* * Otherwise, i.e. if the phone number is national, there's no callind code to extract
|
|
1040
|
+
* so it will just return the originally-passed `number` string as the only property.
|
|
1041
|
+
* @param {string} number — Phone number digits (possibly with a `+`).
|
|
1042
|
+
* @param {string} [country] — Country.
|
|
1043
|
+
* @param {string} [defaultCountry] — Default country.
|
|
1044
|
+
* @param {string} [defaultCallingCode] — Default calling code (some phone numbering plans are non-geographic).
|
|
1045
|
+
* @param {object} metadataJson
|
|
1046
|
+
* @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }`, where `countryCallingCodeSource` tells how the returned calling code was extracted (if it was extracted), `countryCallingCode` is the calling code that was extracted from the input `number` string, and `number` is the originally passed `number` without the extracted calling code (and without a `+`). If the calling code is present but incomplete or invalid, it will return an empty object.
|
|
1047
|
+
* @example
|
|
1048
|
+
* // Returns `{ countryCallingCode: "1", number: "2133734253" }`.
|
|
1049
|
+
* extractCountryCallingCode('2133734253', 'US', null, null, metadata)
|
|
1050
|
+
* extractCountryCallingCode('2133734253', null, 'US', null, metadata)
|
|
1051
|
+
* extractCountryCallingCode('2133734253', null, null, '1', metadata)
|
|
1052
|
+
* extractCountryCallingCode('+12133734253', null, null, null, metadata)
|
|
1053
|
+
* extractCountryCallingCode('+12133734253', null, 'RU', null, metadata)
|
|
1054
|
+
*/function extractCountryCallingCode(e,t,r,n,o){if(!e){return{}}var i;
|
|
1055
|
+
// If this is not an international phone number,
|
|
1056
|
+
// then either extract an "IDD" prefix, or extract a
|
|
1057
|
+
// country calling code from a number by autocorrecting it
|
|
1058
|
+
// by prepending a leading `+` in cases when it starts
|
|
1059
|
+
// with the country calling code.
|
|
1060
|
+
// https://wikitravel.org/en/International_dialling_prefix
|
|
1061
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
1062
|
+
if(e[0]!=="+"){
|
|
1063
|
+
// Convert an "out-of-country" dialing phone number
|
|
1064
|
+
// to a proper international phone number.
|
|
1065
|
+
var d=stripIddPrefix(e,t||r,n,o);
|
|
1066
|
+
// If an IDD prefix was stripped then
|
|
1067
|
+
// convert the number to international one
|
|
1068
|
+
// for subsequent parsing.
|
|
1069
|
+
if(d&&d!==e){i=true;e="+"+d}else{
|
|
1070
|
+
// Check to see if the number starts with the country calling code
|
|
1071
|
+
// for the default country. If so, we remove the country calling code,
|
|
1072
|
+
// and do some checks on the validity of the number before and after.
|
|
1073
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
1074
|
+
if(t||r||n){var s=extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(e,t,r,n,o),a=s.countryCallingCode,u=s.number;if(a){return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:a,number:u}}}return{
|
|
1075
|
+
// No need to set it to `UNSPECIFIED`. It can be just `undefined`.
|
|
1076
|
+
// countryCallingCodeSource: 'UNSPECIFIED',
|
|
1077
|
+
number:e}}}
|
|
1078
|
+
// `number` can only be international at this point.
|
|
1079
|
+
// Fast abortion: country codes do not begin with a '0'
|
|
1080
|
+
if(e[1]==="0"){return{}}var l=new Metadata(o);
|
|
1081
|
+
// The thing with country phone codes
|
|
1082
|
+
// is that they are orthogonal to each other
|
|
1083
|
+
// i.e. there's no such country phone code A
|
|
1084
|
+
// for which country phone code B exists
|
|
1085
|
+
// where B starts with A.
|
|
1086
|
+
// Therefore, while scanning digits,
|
|
1087
|
+
// if a valid country code is found,
|
|
1088
|
+
// that means that it is the country code.
|
|
1089
|
+
|
|
1090
|
+
var $=2;while($-1<=MAX_LENGTH_COUNTRY_CODE&&$<=e.length){var c=e.slice(1,$);if(l.hasCallingCode(c)){l.selectNumberingPlan(c);return{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice($)}}$++}return{}}
|
|
1091
|
+
// The possible values for the returned `countryCallingCodeSource` are:
|
|
1092
|
+
|
|
1093
|
+
// Copy-pasted from:
|
|
1094
|
+
// https://github.com/google/libphonenumber/blob/master/resources/phonenumber.proto
|
|
1095
|
+
|
|
1096
|
+
// // The source from which the country_code is derived. This is not set in the
|
|
1097
|
+
// // general parsing method, but in the method that parses and keeps raw_input.
|
|
1098
|
+
// // New fields could be added upon request.
|
|
1099
|
+
// enum CountryCodeSource {
|
|
1100
|
+
// // Default value returned if this is not set, because the phone number was
|
|
1101
|
+
// // created using parse, not parseAndKeepRawInput. hasCountryCodeSource will
|
|
1102
|
+
// // return false if this is the case.
|
|
1103
|
+
// UNSPECIFIED = 0;
|
|
1104
|
+
|
|
1105
|
+
// // The country_code is derived based on a phone number with a leading "+",
|
|
1106
|
+
// // e.g. the French number "+33 1 42 68 53 00".
|
|
1107
|
+
// FROM_NUMBER_WITH_PLUS_SIGN = 1;
|
|
1108
|
+
|
|
1109
|
+
// // The country_code is derived based on a phone number with a leading IDD,
|
|
1110
|
+
// // e.g. the French number "011 33 1 42 68 53 00", as it is dialled from US.
|
|
1111
|
+
// FROM_NUMBER_WITH_IDD = 5;
|
|
1112
|
+
|
|
1113
|
+
// // The country_code is derived based on a phone number without a leading
|
|
1114
|
+
// // "+", e.g. the French number "33 1 42 68 53 00" when defaultCountry is
|
|
1115
|
+
// // supplied as France.
|
|
1116
|
+
// FROM_NUMBER_WITHOUT_PLUS_SIGN = 10;
|
|
1117
|
+
|
|
1118
|
+
// // The country_code is derived NOT based on the phone number itself, but
|
|
1119
|
+
// // from the defaultCountry parameter provided in the parsing function by the
|
|
1120
|
+
// // clients. This happens mostly for numbers written in the national format
|
|
1121
|
+
// // (without country code). For example, this would be set when parsing the
|
|
1122
|
+
// // French number "01 42 68 53 00", when defaultCountry is supplied as
|
|
1123
|
+
// // France.
|
|
1124
|
+
// FROM_DEFAULT_COUNTRY = 20;
|
|
1125
|
+
// }
|
|
1126
|
+
// Removes brackets and replaces dashes with spaces.
|
|
1127
|
+
|
|
1128
|
+
// E.g. "(999) 111-22-33" -> "999 111 22 33"
|
|
1129
|
+
|
|
1130
|
+
// For some reason Google's metadata contains `<intlFormat/>`s with brackets and dashes.
|
|
1131
|
+
// Meanwhile, there's no single opinion about using punctuation in international phone numbers.
|
|
1132
|
+
|
|
1133
|
+
// For example, Google's `<intlFormat/>` for USA is `+1 213-373-4253`.
|
|
1134
|
+
// And here's a quote from WikiPedia's "North American Numbering Plan" page:
|
|
1135
|
+
// https://en.wikipedia.org/wiki/North_American_Numbering_Plan
|
|
1136
|
+
|
|
1137
|
+
// "The country calling code for all countries participating in the NANP is 1.
|
|
1138
|
+
// In international format, an NANP number should be listed as +1 301 555 01 00,
|
|
1139
|
+
// where 301 is an area code (Maryland)."
|
|
1140
|
+
|
|
1141
|
+
// I personally prefer the international format without any punctuation.
|
|
1142
|
+
// For example, brackets are remnants of the old age, meaning that the
|
|
1143
|
+
// phone number part in brackets (so called "area code") can be omitted
|
|
1144
|
+
// if dialing within the same "area".
|
|
1145
|
+
// And hyphens were clearly introduced for splitting local numbers into memorizable groups.
|
|
1146
|
+
// For example, remembering "5553535" is difficult but "555-35-35" is much simpler.
|
|
1147
|
+
// Imagine a man taking a bus from home to work and seeing an ad with a phone number.
|
|
1148
|
+
// He has a couple of seconds to memorize that number until it passes by.
|
|
1149
|
+
// If it were spaces instead of hyphens the man wouldn't necessarily get it,
|
|
1150
|
+
// but with hyphens instead of spaces the grouping is more explicit.
|
|
1151
|
+
// I personally think that hyphens introduce visual clutter,
|
|
1152
|
+
// so I prefer replacing them with spaces in international numbers.
|
|
1153
|
+
// In the modern age all output is done on displays where spaces are clearly distinguishable
|
|
1154
|
+
// so hyphens can be safely replaced with spaces without losing any legibility.
|
|
1155
|
+
|
|
1156
|
+
function applyInternationalSeparatorStyle(e){return e.replace(new RegExp("[".concat(VALID_PUNCTUATION,"]+"),"g")," ").trim()}
|
|
1157
|
+
// This was originally set to $1 but there are some countries for which the
|
|
1158
|
+
// first group is not used in the national pattern (e.g. Argentina) so the $1
|
|
1159
|
+
// group does not match correctly. Therefore, we use `\d`, so that the first
|
|
1160
|
+
// group actually used in the pattern will be matched.
|
|
1161
|
+
var FIRST_GROUP_PATTERN=/(\$\d)/;function formatNationalNumberUsingFormat(e,t,r){var n=r.useInternationalFormat,o=r.withNationalPrefix;var i=e.replace(new RegExp(t.pattern()),n?t.internationalFormat():
|
|
1162
|
+
// This library doesn't use `domestic_carrier_code_formatting_rule`,
|
|
1163
|
+
// because that one is only used when formatting phone numbers
|
|
1164
|
+
// for dialing from a mobile phone, and this is not a dialing library.
|
|
1165
|
+
// carrierCode && format.domesticCarrierCodeFormattingRule()
|
|
1166
|
+
// // First, replace the $CC in the formatting rule with the desired carrier code.
|
|
1167
|
+
// // Then, replace the $FG in the formatting rule with the first group
|
|
1168
|
+
// // and the carrier code combined in the appropriate way.
|
|
1169
|
+
// ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
|
|
1170
|
+
// : (
|
|
1171
|
+
// withNationalPrefix && format.nationalPrefixFormattingRule()
|
|
1172
|
+
// ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
|
|
1173
|
+
// : format.format()
|
|
1174
|
+
// )
|
|
1175
|
+
o&&t.nationalPrefixFormattingRule()?t.format().replace(FIRST_GROUP_PATTERN,t.nationalPrefixFormattingRule()):t.format());if(n){return applyInternationalSeparatorStyle(i)}return i}
|
|
1176
|
+
/**
|
|
1177
|
+
* Pattern that makes it easy to distinguish whether a region has a single
|
|
1178
|
+
* international dialing prefix or not. If a region has a single international
|
|
1179
|
+
* prefix (e.g. 011 in USA), it will be represented as a string that contains
|
|
1180
|
+
* a sequence of ASCII digits, and possibly a tilde, which signals waiting for
|
|
1181
|
+
* the tone. If there are multiple available international prefixes in a
|
|
1182
|
+
* region, they will be represented as a regex string that always contains one
|
|
1183
|
+
* or more characters that are not ASCII digits or a tilde.
|
|
1184
|
+
*/var SINGLE_IDD_PREFIX_REG_EXP=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
|
|
1185
|
+
// If the `country` supports IDD calling, it returns a preferred IDD prefix.
|
|
1186
|
+
// If the `country` doesn't support IDD calling, it returns `undefined`.
|
|
1187
|
+
function getIddPrefix(e,t,r){var n=new Metadata(r);n.selectNumberingPlan(e||t);if(n.defaultIDDPrefix()){return n.defaultIDDPrefix()}if(SINGLE_IDD_PREFIX_REG_EXP.test(n.IDDPrefix())){return n.IDDPrefix()}}
|
|
1188
|
+
// The RFC 3966 format for extensions.
|
|
1189
|
+
var RFC3966_EXTN_PREFIX=";ext=";
|
|
1190
|
+
/**
|
|
1191
|
+
* Helper method for constructing regular expressions for parsing. Creates
|
|
1192
|
+
* an expression that captures up to max_length digits.
|
|
1193
|
+
* @return {string} RegEx pattern to capture extension digits.
|
|
1194
|
+
*/var getExtensionDigitsPattern=function e(t){return"([".concat(VALID_DIGITS,"]{1,").concat(t,"})")};
|
|
1195
|
+
/**
|
|
1196
|
+
* Helper initialiser method to create the regular-expression pattern to match
|
|
1197
|
+
* extensions.
|
|
1198
|
+
* Copy-pasted from Google's `libphonenumber`:
|
|
1199
|
+
* https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766
|
|
1200
|
+
* @return {string} RegEx pattern to capture extensions.
|
|
1201
|
+
*/function createExtensionPattern(e){
|
|
1202
|
+
// We cap the maximum length of an extension based on the ambiguity of the way
|
|
1203
|
+
// the extension is prefixed. As per ITU, the officially allowed length for
|
|
1204
|
+
// extensions is actually 40, but we don't support this since we haven't seen real
|
|
1205
|
+
// examples and this introduces many false interpretations as the extension labels
|
|
1206
|
+
// are not standardized.
|
|
1207
|
+
/** @type {string} */
|
|
1208
|
+
var t="20";
|
|
1209
|
+
/** @type {string} */var r="15";
|
|
1210
|
+
/** @type {string} */var n="9";
|
|
1211
|
+
/** @type {string} */var o="6";
|
|
1212
|
+
/** @type {string} */var i="[ \\t,]*";
|
|
1213
|
+
// Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas.
|
|
1214
|
+
/** @type {string} */var d="[:\\..]?[ \\t,-]*";
|
|
1215
|
+
/** @type {string} */var s="#?";
|
|
1216
|
+
// Here the extension is called out in more explicit way, i.e mentioning it obvious
|
|
1217
|
+
// patterns like "ext.".
|
|
1218
|
+
/** @type {string} */var a="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)";
|
|
1219
|
+
// One-character symbols that can be used to indicate an extension, and less
|
|
1220
|
+
// commonly used or more ambiguous extension labels.
|
|
1221
|
+
/** @type {string} */var u="(?:[xx##~~]|int|int)";
|
|
1222
|
+
// When extension is not separated clearly.
|
|
1223
|
+
/** @type {string} */var l="[- ]+";
|
|
1224
|
+
// This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching
|
|
1225
|
+
// comma as extension label may have it.
|
|
1226
|
+
/** @type {string} */var $="[ \\t]*";
|
|
1227
|
+
// ",," is commonly used for auto dialling the extension when connected. First
|
|
1228
|
+
// comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do
|
|
1229
|
+
// not repeat it here. Semi-colon works in Iphone and Android also to pop up a
|
|
1230
|
+
// button with the extension number following.
|
|
1231
|
+
/** @type {string} */var c="(?:,{2}|;)";
|
|
1232
|
+
/** @type {string} */var f=RFC3966_EXTN_PREFIX+getExtensionDigitsPattern(t);
|
|
1233
|
+
/** @type {string} */var h=i+a+d+getExtensionDigitsPattern(t)+s;
|
|
1234
|
+
/** @type {string} */var p=i+u+d+getExtensionDigitsPattern(n)+s;
|
|
1235
|
+
/** @type {string} */var v=l+getExtensionDigitsPattern(o)+"#";
|
|
1236
|
+
/** @type {string} */var b=$+c+d+getExtensionDigitsPattern(r)+s;
|
|
1237
|
+
/** @type {string} */var y=$+"(?:,)+"+d+getExtensionDigitsPattern(n)+s;
|
|
1238
|
+
// The first regular expression covers RFC 3966 format, where the extension is added
|
|
1239
|
+
// using ";ext=". The second more generic where extension is mentioned with explicit
|
|
1240
|
+
// labels like "ext:". In both the above cases we allow more numbers in extension than
|
|
1241
|
+
// any other extension labels. The third one captures when single character extension
|
|
1242
|
+
// labels or less commonly used labels are used. In such cases we capture fewer
|
|
1243
|
+
// extension digits in order to reduce the chance of falsely interpreting two
|
|
1244
|
+
// numbers beside each other as a number + extension. The fourth one covers the
|
|
1245
|
+
// special case of American numbers where the extension is written with a hash
|
|
1246
|
+
// at the end, such as "- 503#". The fifth one is exclusively for extension
|
|
1247
|
+
// autodialling formats which are used when dialling and in this case we accept longer
|
|
1248
|
+
// extensions. The last one is more liberal on the number of commas that acts as
|
|
1249
|
+
// extension labels, so we have a strict cap on the number of digits in such extensions.
|
|
1250
|
+
return f+"|"+h+"|"+p+"|"+v+"|"+b+"|"+y}
|
|
1251
|
+
// Regular expression of viable phone numbers. This is location independent.
|
|
1252
|
+
// Checks we have at least three leading digits, and only valid punctuation,
|
|
1253
|
+
// alpha characters and digits in the phone number. Does not include extension
|
|
1254
|
+
// data. The symbol 'x' is allowed here as valid punctuation since it is often
|
|
1255
|
+
// used as a placeholder for carrier codes, for example in Brazilian phone
|
|
1256
|
+
// numbers. We also allow multiple '+' characters at the start.
|
|
1257
|
+
|
|
1258
|
+
// Corresponds to the following:
|
|
1259
|
+
// [digits]{minLengthNsn}|
|
|
1260
|
+
// plus_sign*
|
|
1261
|
+
// (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*
|
|
1262
|
+
|
|
1263
|
+
// The first reg-ex is to allow short numbers (two digits long) to be parsed if
|
|
1264
|
+
// they are entered as "15" etc, but only if there is no punctuation in them.
|
|
1265
|
+
// The second expression restricts the number of digits to three or more, but
|
|
1266
|
+
// then allows them to be in international form, and to have alpha-characters
|
|
1267
|
+
// and punctuation. We split up the two reg-exes here and combine them when
|
|
1268
|
+
// creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it
|
|
1269
|
+
// with ^ and append $ to each branch.
|
|
1270
|
+
|
|
1271
|
+
// "Note VALID_PUNCTUATION starts with a -,
|
|
1272
|
+
// so must be the first in the range" (c) Google devs.
|
|
1273
|
+
// (wtf did they mean by saying that; probably nothing)
|
|
1274
|
+
|
|
1275
|
+
var MIN_LENGTH_PHONE_NUMBER_PATTERN="["+VALID_DIGITS+"]{"+MIN_LENGTH_FOR_NSN+"}";
|
|
1276
|
+
|
|
1277
|
+
// And this is the second reg-exp:
|
|
1278
|
+
// (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp)
|
|
1279
|
+
|
|
1280
|
+
var VALID_PHONE_NUMBER="["+PLUS_CHARS+"]{0,1}"+"(?:"+"["+VALID_PUNCTUATION+"]*"+"["+VALID_DIGITS+"]"+"){3,}"+"["+VALID_PUNCTUATION+VALID_DIGITS+"]*";
|
|
1281
|
+
// This regular expression isn't present in Google's `libphonenumber`
|
|
1282
|
+
// and is only used to determine whether the phone number being input
|
|
1283
|
+
// is too short for it to even consider it a "valid" number.
|
|
1284
|
+
// This is just a way to differentiate between a really invalid phone
|
|
1285
|
+
// number like "abcde" and a valid phone number that a user has just
|
|
1286
|
+
// started inputting, like "+1" or "1": both these cases would be
|
|
1287
|
+
// considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this
|
|
1288
|
+
// library can provide a more detailed error message — whether it's
|
|
1289
|
+
// really "not a number", or is it just a start of a valid phone number.
|
|
1290
|
+
var VALID_PHONE_NUMBER_START_REG_EXP=new RegExp("^"+"["+PLUS_CHARS+"]{0,1}"+"(?:"+"["+VALID_PUNCTUATION+"]*"+"["+VALID_DIGITS+"]"+"){1,2}"+"$","i");var VALID_PHONE_NUMBER_WITH_EXTENSION=VALID_PHONE_NUMBER+
|
|
1291
|
+
// Phone number extensions
|
|
1292
|
+
"(?:"+createExtensionPattern()+")?";
|
|
1293
|
+
// The combined regular expression for valid phone numbers:
|
|
1294
|
+
|
|
1295
|
+
var VALID_PHONE_NUMBER_PATTERN=new RegExp(
|
|
1296
|
+
// Either a short two-digit-only phone number
|
|
1297
|
+
"^"+MIN_LENGTH_PHONE_NUMBER_PATTERN+"$"+"|"+
|
|
1298
|
+
// Or a longer fully parsed phone number (min 3 characters)
|
|
1299
|
+
"^"+VALID_PHONE_NUMBER_WITH_EXTENSION+"$","i");
|
|
1300
|
+
// Checks to see if the string of characters could possibly be a phone number at
|
|
1301
|
+
// all. At the moment, checks to see that the string begins with at least 2
|
|
1302
|
+
// digits, ignoring any punctuation commonly found in phone numbers. This method
|
|
1303
|
+
// does not require the number to be normalized in advance - but does assume
|
|
1304
|
+
// that leading non-number symbols have been removed, such as by the method
|
|
1305
|
+
// `extract_possible_number`.
|
|
1306
|
+
|
|
1307
|
+
function isViablePhoneNumber(e){return e.length>=MIN_LENGTH_FOR_NSN&&VALID_PHONE_NUMBER_PATTERN.test(e)}
|
|
1308
|
+
// This is just a way to differentiate between a really invalid phone
|
|
1309
|
+
// number like "abcde" and a valid phone number that a user has just
|
|
1310
|
+
// started inputting, like "+1" or "1": both these cases would be
|
|
1311
|
+
// considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this
|
|
1312
|
+
// library can provide a more detailed error message — whether it's
|
|
1313
|
+
// really "not a number", or is it just a start of a valid phone number.
|
|
1314
|
+
function isViablePhoneNumberStart(e){return VALID_PHONE_NUMBER_START_REG_EXP.test(e)}
|
|
1315
|
+
/**
|
|
1316
|
+
* @param {object} - `{ ?number, ?extension }`.
|
|
1317
|
+
* @return {string} Phone URI (RFC 3966).
|
|
1318
|
+
*/function formatRFC3966(e){var t=e.number,r=e.ext;if(!t){return""}if(t[0]!=="+"){throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.')}return"tel:".concat(t).concat(r?";ext="+r:"")}
|
|
1319
|
+
// This is a port of Google Android `libphonenumber`'s
|
|
1320
|
+
// `phonenumberutil.js` of December 31th, 2018.
|
|
1321
|
+
|
|
1322
|
+
// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js
|
|
1323
|
+
var DEFAULT_OPTIONS={formatExtension:function e(t,r,n){return"".concat(t).concat(n.ext()).concat(r)}};
|
|
1324
|
+
/**
|
|
1325
|
+
* Formats a phone number.
|
|
1326
|
+
*
|
|
1327
|
+
* format(phoneNumberInstance, 'INTERNATIONAL', { ..., v2: true }, metadata)
|
|
1328
|
+
* format(phoneNumberInstance, 'NATIONAL', { ..., v2: true }, metadata)
|
|
1329
|
+
*
|
|
1330
|
+
* format({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', { ... }, metadata)
|
|
1331
|
+
* format({ phone: '8005553535', country: 'RU' }, 'NATIONAL', undefined, metadata)
|
|
1332
|
+
*
|
|
1333
|
+
* @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.
|
|
1334
|
+
* @param {string} format
|
|
1335
|
+
* @param {object} [options]
|
|
1336
|
+
* @param {object} metadataJson
|
|
1337
|
+
* @return {string}
|
|
1338
|
+
*/function formatNumber(e,t,r,n){
|
|
1339
|
+
// Apply default options.
|
|
1340
|
+
if(r){
|
|
1341
|
+
// Using ES6 "rest spread" syntax here didn't work with `babel`/`istanbul`
|
|
1342
|
+
// for some weird reason: this line of code would cause the code coverage
|
|
1343
|
+
// to show as not 100%. That's because `babel`/`istanbul`, for some weird reason,
|
|
1344
|
+
// apparently doesn't know how to properly exclude Babel polyfills from code coverage.
|
|
1345
|
+
// options = { ...DEFAULT_OPTIONS, ...options }
|
|
1346
|
+
r=merge({},DEFAULT_OPTIONS,r)}else{r=DEFAULT_OPTIONS}var o=new Metadata(n);
|
|
1347
|
+
// Normally, the `input` object is supposed to be a `PhoneNumber` class instance.
|
|
1348
|
+
// Also, according to the `PhoneNumber` class source code, `country` can't be "001".
|
|
1349
|
+
// It means that normally `input.country` or `input.countryCallingCode` is supposed
|
|
1350
|
+
// to be present because either of the two is always required to exist in a `PhoneNumber` instance.
|
|
1351
|
+
// This means that realistically, it's gonna step into either the first `if`
|
|
1352
|
+
// or the following `else if`, and normally it won't even reach the legacy-compatibility
|
|
1353
|
+
// `else return input.phone || ''` part.
|
|
1354
|
+
// So normally, it won't ever return an empty string here.
|
|
1355
|
+
if(e.country&&e.country!=="001"){
|
|
1356
|
+
// Validate `input.country`.
|
|
1357
|
+
if(!o.hasCountry(e.country)){throw new Error("Unknown country: ".concat(e.country))}o.selectNumberingPlan(e.country)}else if(e.countryCallingCode){o.selectNumberingPlan(e.countryCallingCode)}else return e.phone||"";var i=o.countryCallingCode();var d=r.v2?e.nationalNumber:e.phone;
|
|
1358
|
+
// This variable should have been declared inside `case`s
|
|
1359
|
+
// but Babel has a bug and it says "duplicate variable declaration".
|
|
1360
|
+
var s;switch(t){case"NATIONAL":
|
|
1361
|
+
// Normally, the `input` object is supposed to be a `PhoneNumber` class instance,
|
|
1362
|
+
// and a `PhoneNumber` class instance is always required to have a `nationalNumber`.
|
|
1363
|
+
// This means that the `if (!nationalNumber)` below is just for legacy-compatibility
|
|
1364
|
+
// and it normally can't really happen, so normally it won't ever return an empty string here.
|
|
1365
|
+
if(!d){return""}s=formatNationalNumber$1(d,e.carrierCode,"NATIONAL",o,r);return addExtension(s,e.ext,o,r.formatExtension);case"INTERNATIONAL":
|
|
1366
|
+
// Legacy argument support.
|
|
1367
|
+
// (`{ country: ..., phone: '' }`)
|
|
1368
|
+
if(!d){return"+".concat(i)}s=formatNationalNumber$1(d,null,"INTERNATIONAL",o,r);s="+".concat(i," ").concat(s);return addExtension(s,e.ext,o,r.formatExtension);case"E.164":
|
|
1369
|
+
// `E.164` doesn't define "phone number extensions".
|
|
1370
|
+
return"+".concat(i).concat(d);case"RFC3966":return formatRFC3966({number:"+".concat(i).concat(d),ext:e.ext});
|
|
1371
|
+
// For reference, here's Google's IDD formatter:
|
|
1372
|
+
// https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546
|
|
1373
|
+
// Not saying that this IDD formatter replicates it 1:1, but it seems to work.
|
|
1374
|
+
// Who would even need to format phone numbers in IDD format anyway?
|
|
1375
|
+
case"IDD":
|
|
1376
|
+
// If the required `fromCountry` parameter is not passed, it will return `undefined`.
|
|
1377
|
+
if(!r.fromCountry){return;
|
|
1378
|
+
// throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')
|
|
1379
|
+
}var a=formatIDD(d,e.carrierCode,i,r.fromCountry,o);
|
|
1380
|
+
// If the country of the phone number doesn't support IDD calling, it will return `undefined`.
|
|
1381
|
+
if(!a){return}return addExtension(a,e.ext,o,r.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function formatNationalNumber$1(e,t,r,n,o){var i=chooseFormatForNumber(n.formats(),e);if(!i){return e}return formatNationalNumberUsingFormat(e,i,{useInternationalFormat:r==="INTERNATIONAL",withNationalPrefix:i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&o&&o.nationalPrefix===false?false:true})}function chooseFormatForNumber(e,t){
|
|
1382
|
+
// Using a `for ... of` loop here didn't work with `babel`/`istanbul`:
|
|
1383
|
+
// for some weird reason, it showed code coverage less than 100%.
|
|
1384
|
+
// That's because `babel`/`istanbul`, for some weird reason,
|
|
1385
|
+
// apparently doesn't know how to properly exclude Babel polyfills from code coverage.
|
|
1386
|
+
// for (const format of availableFormats) { ... }
|
|
1387
|
+
return pickFirstMatchingElement(e,(function(e){
|
|
1388
|
+
// Validate leading digits.
|
|
1389
|
+
// The test case for "else path" could be found by searching for
|
|
1390
|
+
// "format.leadingDigitsPatterns().length === 0".
|
|
1391
|
+
if(e.leadingDigitsPatterns().length>0){
|
|
1392
|
+
// The last leading_digits_pattern is used here, as it is the most detailed
|
|
1393
|
+
var r=e.leadingDigitsPatterns()[e.leadingDigitsPatterns().length-1];
|
|
1394
|
+
// If leading digits don't match then move on to the next phone number format
|
|
1395
|
+
if(t.search(r)!==0){return false}}
|
|
1396
|
+
// Check that the national number matches the phone number format regular expression
|
|
1397
|
+
return matchesEntirely(t,e.pattern())}))}function addExtension(e,t,r,n){return t?n(e,t,r):e}function formatIDD(e,t,r,n,o){var i=getCountryCallingCode(n,o.metadata);
|
|
1398
|
+
// When calling within the same country calling code.
|
|
1399
|
+
if(i===r){var d=formatNationalNumber$1(e,t,"NATIONAL",o);
|
|
1400
|
+
// For NANPA regions, return the national format for these regions
|
|
1401
|
+
// but prefix it with the country calling code.
|
|
1402
|
+
if(r==="1"){return r+" "+d}
|
|
1403
|
+
// If regions share a country calling code, the country calling code need
|
|
1404
|
+
// not be dialled. This also applies when dialling within a region, so this
|
|
1405
|
+
// if clause covers both these cases. Technically this is the case for
|
|
1406
|
+
// dialling from La Reunion to other overseas departments of France (French
|
|
1407
|
+
// Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover
|
|
1408
|
+
// this edge case for now and for those cases return the version including
|
|
1409
|
+
// country calling code. Details here:
|
|
1410
|
+
// http://www.petitfute.com/voyage/225-info-pratiques-reunion
|
|
1411
|
+
|
|
1412
|
+
return d}var s=getIddPrefix(n,undefined,o.metadata);if(s){return"".concat(s," ").concat(r," ").concat(formatNationalNumber$1(e,null,"INTERNATIONAL",o))}}function merge(){var e=1;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++){r[n]=arguments[n]}while(e<r.length){if(r[e]){for(var o in r[e]){r[0][o]=r[e][o]}}e++}return r[0]}function pickFirstMatchingElement(e,t){var r=0;while(r<e.length){if(t(e[r])){return e[r]}r++}}function _typeof$a(e){"@babel/helpers - typeof";return _typeof$a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$a(e)}function ownKeys$3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$3(Object(r),true).forEach((function(t){_defineProperty$3(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$3(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty$3(e,t,r){return(t=_toPropertyKey$9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function _classCallCheck$7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$6(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,_toPropertyKey$9(n.key),n)}}function _createClass$7(e,t,r){return t&&_defineProperties$6(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function _toPropertyKey$9(e){var t=_toPrimitive$9(e,"string");return"symbol"==_typeof$a(t)?t:t+""}function _toPrimitive$9(e,t){if("object"!=_typeof$a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var PhoneNumber=function(){
|
|
1413
|
+
/**
|
|
1414
|
+
* @param {string} countryOrCountryCallingCode
|
|
1415
|
+
* @param {string} nationalNumber
|
|
1416
|
+
* @param {object} metadata — Metadata JSON
|
|
1417
|
+
* @return {PhoneNumber}
|
|
1418
|
+
*/
|
|
1419
|
+
function e(t,r,n){_classCallCheck$7(this,e);
|
|
1420
|
+
// Validate `countryOrCountryCallingCode` argument.
|
|
1421
|
+
if(!t){throw new TypeError("First argument is required")}if(typeof t!=="string"){throw new TypeError("First argument must be a string")}
|
|
1422
|
+
// In case of public API use: `constructor(number, metadata)`.
|
|
1423
|
+
// Transform the arguments from `constructor(number, metadata)` to
|
|
1424
|
+
// `constructor(countryOrCountryCallingCode, nationalNumber, metadata)`.
|
|
1425
|
+
if(t[0]==="+"&&!r){throw new TypeError("`metadata` argument not passed")}if(isObject(r)&&isObject(r.countries)){n=r;var o=t;if(!E164_NUMBER_REGEXP.test(o)){throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits')}var i=extractCountryCallingCode(o,undefined,undefined,undefined,n),d=i.countryCallingCode,s=i.number;r=s;t=d;if(!r){throw new Error("Invalid `number` argument passed: too short")}}
|
|
1426
|
+
// Validate `nationalNumber` argument.
|
|
1427
|
+
if(!r){throw new TypeError("`nationalNumber` argument is required")}if(typeof r!=="string"){throw new TypeError("`nationalNumber` argument must be a string")}
|
|
1428
|
+
// Validate `metadata` argument.
|
|
1429
|
+
validateMetadata(n);
|
|
1430
|
+
// Initialize properties.
|
|
1431
|
+
var a=getCountryAndCallingCodeFromOneOfThem(t,n),u=a.country,l=a.callingCode;this.country=u;this.countryCallingCode=l;this.nationalNumber=r;this.number="+"+this.countryCallingCode+this.nationalNumber;
|
|
1432
|
+
// Exclude `metadata` property output from `PhoneNumber.toString()`
|
|
1433
|
+
// so that it doesn't clutter the console output of Node.js.
|
|
1434
|
+
// Previously, when Node.js did `console.log(new PhoneNumber(...))`,
|
|
1435
|
+
// it would output the whole internal structure of the `metadata` object.
|
|
1436
|
+
this.getMetadata=function(){return n}}return _createClass$7(e,[{key:"setExt",value:function e(t){this.ext=t}},{key:"getPossibleCountries",value:function e(){if(this.country){return[this.country]}return getPossibleCountriesForNumber(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function e(){return isPossiblePhoneNumber(this,{v2:true},this.getMetadata())}},{key:"isValid",value:function e(){return isValidNumber(this,{v2:true},this.getMetadata())}},{key:"isNonGeographic",value:function e(){var t=new Metadata(this.getMetadata());return t.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function e(t){return this.number===t.number&&this.ext===t.ext}
|
|
1437
|
+
// `validateLength()` method was originally meant to be an equivalent for `validatePhoneNumberLength()`.
|
|
1438
|
+
|
|
1439
|
+
// Later, it became apparent that it's not really a true equivalent.
|
|
1440
|
+
// The reason is that a `PhoneNumber` instance is not created
|
|
1441
|
+
// when the phone number string is too short for it to be considered a valid phone number:
|
|
1442
|
+
// * When there must be at least 2 national (significant) number digits: `"1"`.
|
|
1443
|
+
// * When the country calling code part of an international number is incomplete: `"+12"`.
|
|
1444
|
+
|
|
1445
|
+
// So leaving this `validateLength()` method here would suggest a hidden anti-pattern
|
|
1446
|
+
// of using it instead of `validatePhoneNumberLength()` while ignoring
|
|
1447
|
+
// the "too short to be even possible" case from phone number length validation.
|
|
1448
|
+
// And ignoring that case wouldn't make any sense in a real-world application
|
|
1449
|
+
// because it would still be a valid case that should be handled.
|
|
1450
|
+
|
|
1451
|
+
// Because of that, this method was eventually commented out in order to not introduce
|
|
1452
|
+
// that kind of an anti-pattern.
|
|
1453
|
+
|
|
1454
|
+
// validateLength() {
|
|
1455
|
+
// const result = checkNumberLength(
|
|
1456
|
+
// this.nationalNumber,
|
|
1457
|
+
// undefined,
|
|
1458
|
+
// this.getMetadata()
|
|
1459
|
+
// )
|
|
1460
|
+
// if (result !== 'IS_POSSIBLE') {
|
|
1461
|
+
// return result
|
|
1462
|
+
// }
|
|
1463
|
+
// }
|
|
1464
|
+
},{key:"getType",value:function e(){return getNumberType(this,{v2:true},this.getMetadata())}},{key:"format",value:function e(t,r){return formatNumber(this,t,r?_objectSpread$3(_objectSpread$3({},r),{},{v2:true}):{v2:true},this.getMetadata())}},{key:"formatNational",value:function e(t){return this.format("NATIONAL",t)}},{key:"formatInternational",value:function e(t){return this.format("INTERNATIONAL",t)}},{key:"getURI",value:function e(t){return this.format("RFC3966",t)}}])}();var E164_NUMBER_REGEXP=/^\+\d+$/;function _typeof$9(e){"@babel/helpers - typeof";return _typeof$9="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$9(e)}function _createClass$6(e,t,r){return Object.defineProperty(e,"prototype",{writable:false}),e}function _classCallCheck$6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _callSuper(e,t,r){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,r||[],_getPrototypeOf(e).constructor):t.apply(e,r))}function _possibleConstructorReturn(e,t){if(t&&("object"==_typeof$9(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&_setPrototypeOf(e,t)}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function e(r){if(null===r||!_isNativeFunction(r))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(r))return t.get(r);t.set(r,n)}function n(){return _construct(r,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:false,writable:true,configurable:true}}),_setPrototypeOf(n,r)},_wrapNativeSuper(e)}function _construct(e,t,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var o=new(e.bind.apply(e,n));return r&&_setPrototypeOf(o,r.prototype),o}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_isNativeReflectConstruct=function t(){return!!e})()}function _isNativeFunction(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}
|
|
1465
|
+
// https://stackoverflow.com/a/46971044/970769
|
|
1466
|
+
// "Breaking changes in Typescript 2.1"
|
|
1467
|
+
// "Extending built-ins like Error, Array, and Map may no longer work."
|
|
1468
|
+
// "As a recommendation, you can manually adjust the prototype immediately after any super(...) calls."
|
|
1469
|
+
// https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
1470
|
+
var ParseError=function(e){function t(e){var r;_classCallCheck$6(this,t);r=_callSuper(this,t,[e]);
|
|
1471
|
+
// Set the prototype explicitly.
|
|
1472
|
+
// Any subclass of FooError will have to manually set the prototype as well.
|
|
1473
|
+
Object.setPrototypeOf(r,t.prototype);r.name=r.constructor.name;return r}_inherits(t,e);return _createClass$6(t)}(_wrapNativeSuper(Error));
|
|
1474
|
+
// Regexp of all known extension prefixes used by different regions followed by
|
|
1475
|
+
// 1 or more valid digits, for use when parsing.
|
|
1476
|
+
var EXTN_PATTERN=new RegExp("(?:"+createExtensionPattern()+")$","i");
|
|
1477
|
+
// Strips any extension (as in, the part of the number dialled after the call is
|
|
1478
|
+
// connected, usually indicated with extn, ext, x or similar) from the end of
|
|
1479
|
+
// the number, and returns it.
|
|
1480
|
+
function extractExtension(e){var t=e.search(EXTN_PATTERN);if(t<0){return{}}
|
|
1481
|
+
// If we find a potential extension, and the number preceding this is a viable
|
|
1482
|
+
// number, we assume it is an extension.
|
|
1483
|
+
var r=e.slice(0,t);var n=e.match(EXTN_PATTERN);var o=1;while(o<n.length){if(n[o]){return{number:r,ext:n[o]}}o++}}function _createForOfIteratorHelperLoose$4(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$7(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$7(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$7(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$7(e,t):void 0}}function _arrayLikeToArray$7(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}
|
|
1484
|
+
// These mappings map a character (key) to a specific digit that should
|
|
1485
|
+
// replace it for normalization purposes. Non-European digits that
|
|
1486
|
+
// may be used in phone numbers are mapped to a European equivalent.
|
|
1487
|
+
|
|
1488
|
+
// E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
1489
|
+
|
|
1490
|
+
var DIGITS={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0",
|
|
1491
|
+
// Fullwidth digit 0
|
|
1492
|
+
"1":"1",
|
|
1493
|
+
// Fullwidth digit 1
|
|
1494
|
+
"2":"2",
|
|
1495
|
+
// Fullwidth digit 2
|
|
1496
|
+
"3":"3",
|
|
1497
|
+
// Fullwidth digit 3
|
|
1498
|
+
"4":"4",
|
|
1499
|
+
// Fullwidth digit 4
|
|
1500
|
+
"5":"5",
|
|
1501
|
+
// Fullwidth digit 5
|
|
1502
|
+
"6":"6",
|
|
1503
|
+
// Fullwidth digit 6
|
|
1504
|
+
"7":"7",
|
|
1505
|
+
// Fullwidth digit 7
|
|
1506
|
+
"8":"8",
|
|
1507
|
+
// Fullwidth digit 8
|
|
1508
|
+
"9":"9",
|
|
1509
|
+
// Fullwidth digit 9
|
|
1510
|
+
"٠":"0",
|
|
1511
|
+
// Arabic-indic digit 0
|
|
1512
|
+
"١":"1",
|
|
1513
|
+
// Arabic-indic digit 1
|
|
1514
|
+
"٢":"2",
|
|
1515
|
+
// Arabic-indic digit 2
|
|
1516
|
+
"٣":"3",
|
|
1517
|
+
// Arabic-indic digit 3
|
|
1518
|
+
"٤":"4",
|
|
1519
|
+
// Arabic-indic digit 4
|
|
1520
|
+
"٥":"5",
|
|
1521
|
+
// Arabic-indic digit 5
|
|
1522
|
+
"٦":"6",
|
|
1523
|
+
// Arabic-indic digit 6
|
|
1524
|
+
"٧":"7",
|
|
1525
|
+
// Arabic-indic digit 7
|
|
1526
|
+
"٨":"8",
|
|
1527
|
+
// Arabic-indic digit 8
|
|
1528
|
+
"٩":"9",
|
|
1529
|
+
// Arabic-indic digit 9
|
|
1530
|
+
"۰":"0",
|
|
1531
|
+
// Eastern-Arabic digit 0
|
|
1532
|
+
"۱":"1",
|
|
1533
|
+
// Eastern-Arabic digit 1
|
|
1534
|
+
"۲":"2",
|
|
1535
|
+
// Eastern-Arabic digit 2
|
|
1536
|
+
"۳":"3",
|
|
1537
|
+
// Eastern-Arabic digit 3
|
|
1538
|
+
"۴":"4",
|
|
1539
|
+
// Eastern-Arabic digit 4
|
|
1540
|
+
"۵":"5",
|
|
1541
|
+
// Eastern-Arabic digit 5
|
|
1542
|
+
"۶":"6",
|
|
1543
|
+
// Eastern-Arabic digit 6
|
|
1544
|
+
"۷":"7",
|
|
1545
|
+
// Eastern-Arabic digit 7
|
|
1546
|
+
"۸":"8",
|
|
1547
|
+
// Eastern-Arabic digit 8
|
|
1548
|
+
"۹":"9"};function parseDigit(e){return DIGITS[e]}
|
|
1549
|
+
/**
|
|
1550
|
+
* Parses phone number digits from a string.
|
|
1551
|
+
* Drops all punctuation leaving only digits.
|
|
1552
|
+
* Also converts wide-ascii and arabic-indic numerals to conventional numerals.
|
|
1553
|
+
* E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
1554
|
+
* @param {string} string
|
|
1555
|
+
* @return {string}
|
|
1556
|
+
* @example
|
|
1557
|
+
* ```js
|
|
1558
|
+
* parseDigits('8 (800) 555')
|
|
1559
|
+
* // Outputs '8800555'.
|
|
1560
|
+
* ```
|
|
1561
|
+
*/function parseDigits(e){var t="";
|
|
1562
|
+
// Using `.split('')` here instead of normal `for ... of`
|
|
1563
|
+
// because the importing application doesn't neccessarily include an ES6 polyfill.
|
|
1564
|
+
// The `.split('')` approach discards "exotic" UTF-8 characters
|
|
1565
|
+
// (the ones consisting of four bytes) but digits
|
|
1566
|
+
// (including non-European ones) don't fall into that range
|
|
1567
|
+
// so such "exotic" characters would be discarded anyway.
|
|
1568
|
+
for(var r=_createForOfIteratorHelperLoose$4(e.split("")),n;!(n=r()).done;){var o=n.value;var i=parseDigit(o);if(i){t+=i}}return t}function _createForOfIteratorHelperLoose$3(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$6(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$6(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$6(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$6(e,t):void 0}}function _arrayLikeToArray$6(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}
|
|
1569
|
+
/**
|
|
1570
|
+
* Parses phone number characters from a string.
|
|
1571
|
+
* Drops all punctuation leaving only digits and the leading `+` sign (if any).
|
|
1572
|
+
* Also converts wide-ascii and arabic-indic numerals to conventional numerals.
|
|
1573
|
+
* E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
1574
|
+
* @param {string} string
|
|
1575
|
+
* @return {string}
|
|
1576
|
+
* @example
|
|
1577
|
+
* ```js
|
|
1578
|
+
* // Outputs '8800555'.
|
|
1579
|
+
* parseIncompletePhoneNumber('8 (800) 555')
|
|
1580
|
+
* // Outputs '+7800555'.
|
|
1581
|
+
* parseIncompletePhoneNumber('+7 800 555')
|
|
1582
|
+
* ```
|
|
1583
|
+
*/function parseIncompletePhoneNumber(e){var t="";
|
|
1584
|
+
// Using `.split('')` here instead of normal `for ... of`
|
|
1585
|
+
// because the importing application doesn't neccessarily include an ES6 polyfill.
|
|
1586
|
+
// The `.split('')` approach discards "exotic" UTF-8 characters
|
|
1587
|
+
// (the ones consisting of four bytes) but digits
|
|
1588
|
+
// (including non-European ones) don't fall into that range
|
|
1589
|
+
// so such "exotic" characters would be discarded anyway.
|
|
1590
|
+
for(var r=_createForOfIteratorHelperLoose$3(e.split("")),n;!(n=r()).done;){var o=n.value;t+=parsePhoneNumberCharacter(o,t)||""}return t}
|
|
1591
|
+
/**
|
|
1592
|
+
* Parses next character while parsing phone number digits (including a `+`)
|
|
1593
|
+
* from text: discards everything except `+` and digits, and `+` is only allowed
|
|
1594
|
+
* at the start of a phone number.
|
|
1595
|
+
* For example, is used in `react-phone-number-input` where it uses
|
|
1596
|
+
* [`input-format`](https://gitlab.com/catamphetamine/input-format).
|
|
1597
|
+
* @param {string} character - Yet another character from raw input string.
|
|
1598
|
+
* @param {string?} prevParsedCharacters - Previous parsed characters.
|
|
1599
|
+
* @param {function?} eventListener - An optional "on event" function.
|
|
1600
|
+
* @return {string?} The parsed character.
|
|
1601
|
+
*/function parsePhoneNumberCharacter(e,t,r){
|
|
1602
|
+
// Only allow a leading `+`.
|
|
1603
|
+
if(e==="+"){
|
|
1604
|
+
// If this `+` is not the first parsed character
|
|
1605
|
+
// then discard it.
|
|
1606
|
+
if(t){return}return"+"}
|
|
1607
|
+
// Allow digits.
|
|
1608
|
+
return parseDigit(e)}
|
|
1609
|
+
// When phone numbers are written in `RFC3966` format — `"tel:+12133734253"` —
|
|
1610
|
+
// they can have their "calling code" part written separately in a `phone-context` parameter.
|
|
1611
|
+
// Example: `"tel:12133734253;phone-context=+1"`.
|
|
1612
|
+
// This function parses the full phone number from the local number and the `phone-context`
|
|
1613
|
+
// when the `phone-context` contains a `+` sign.
|
|
1614
|
+
var PLUS_SIGN="+";var RFC3966_VISUAL_SEPARATOR_="[\\-\\.\\(\\)]?";var RFC3966_PHONE_DIGIT_="("+"["+VALID_DIGITS+"]"+"|"+RFC3966_VISUAL_SEPARATOR_+")";var RFC3966_GLOBAL_NUMBER_DIGITS_="^"+"\\"+PLUS_SIGN+RFC3966_PHONE_DIGIT_+"*"+"["+VALID_DIGITS+"]"+RFC3966_PHONE_DIGIT_+"*"+"$";
|
|
1615
|
+
/**
|
|
1616
|
+
* Regular expression of valid global-number-digits for the phone-context
|
|
1617
|
+
* parameter, following the syntax defined in RFC3966.
|
|
1618
|
+
*/var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_=new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_,"g");
|
|
1619
|
+
// In this port of Google's library, we don't accept alpha characters in phone numbers.
|
|
1620
|
+
// const ALPHANUM_ = VALID_ALPHA_ + VALID_DIGITS
|
|
1621
|
+
var ALPHANUM_=VALID_DIGITS;var RFC3966_DOMAINLABEL_="["+ALPHANUM_+"]+((\\-)*["+ALPHANUM_+"])*";var VALID_ALPHA_="a-zA-Z";var RFC3966_TOPLABEL_="["+VALID_ALPHA_+"]+((\\-)*["+ALPHANUM_+"])*";var RFC3966_DOMAINNAME_="^("+RFC3966_DOMAINLABEL_+"\\.)*"+RFC3966_TOPLABEL_+"\\.?$";
|
|
1622
|
+
/**
|
|
1623
|
+
* Regular expression of valid domainname for the phone-context parameter,
|
|
1624
|
+
* following the syntax defined in RFC3966.
|
|
1625
|
+
*/var RFC3966_DOMAINNAME_PATTERN_=new RegExp(RFC3966_DOMAINNAME_,"g");var RFC3966_PREFIX_="tel:";var RFC3966_PHONE_CONTEXT_=";phone-context=";var RFC3966_ISDN_SUBADDRESS_=";isub=";
|
|
1626
|
+
/**
|
|
1627
|
+
* Extracts the value of the phone-context parameter of `numberToExtractFrom`,
|
|
1628
|
+
* following the syntax defined in RFC3966.
|
|
1629
|
+
*
|
|
1630
|
+
* @param {string} numberToExtractFrom
|
|
1631
|
+
* @return {string|null} the extracted string (possibly empty), or `null` if no phone-context parameter is found.
|
|
1632
|
+
*/function extractPhoneContext(e){var t=e.indexOf(RFC3966_PHONE_CONTEXT_);
|
|
1633
|
+
// If no phone-context parameter is present
|
|
1634
|
+
if(t<0){return null}var r=t+RFC3966_PHONE_CONTEXT_.length;
|
|
1635
|
+
// If phone-context parameter is empty
|
|
1636
|
+
if(r>=e.length){return""}var n=e.indexOf(";",r);
|
|
1637
|
+
// If phone-context is not the last parameter
|
|
1638
|
+
if(n>=0){return e.substring(r,n)}else{return e.substring(r)}}
|
|
1639
|
+
/**
|
|
1640
|
+
* Returns whether the value of phoneContext follows the syntax defined in RFC3966.
|
|
1641
|
+
*
|
|
1642
|
+
* @param {string|null} phoneContext
|
|
1643
|
+
* @return {boolean}
|
|
1644
|
+
*/function isPhoneContextValid(e){if(e===null){return true}if(e.length===0){return false}
|
|
1645
|
+
// Does phone-context value match pattern of global-number-digits or domainname.
|
|
1646
|
+
return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(e)||RFC3966_DOMAINNAME_PATTERN_.test(e)}
|
|
1647
|
+
/**
|
|
1648
|
+
* @param {string} numberToParse
|
|
1649
|
+
* @param {string} nationalNumber
|
|
1650
|
+
* @return {}
|
|
1651
|
+
*/function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(e,t){var r=t.extractFormattedPhoneNumber;var n=extractPhoneContext(e);if(!isPhoneContextValid(n)){throw new ParseError("NOT_A_NUMBER")}var o;if(n===null){
|
|
1652
|
+
// Extract a possible number from the string passed in.
|
|
1653
|
+
// (this strips leading characters that could not be the start of a phone number)
|
|
1654
|
+
o=r(e)||""}else{o="";
|
|
1655
|
+
// If the phone context contains a phone number prefix, we need to capture
|
|
1656
|
+
// it, whereas domains will be ignored.
|
|
1657
|
+
if(n.charAt(0)===PLUS_SIGN){o+=n}
|
|
1658
|
+
// Now append everything between the "tel:" prefix and the phone-context.
|
|
1659
|
+
// This should include the national number, an optional extension or
|
|
1660
|
+
// isdn-subaddress component. Note we also handle the case when "tel:" is
|
|
1661
|
+
// missing, as we have seen in some of the phone number inputs.
|
|
1662
|
+
// In that case, we append everything from the beginning.
|
|
1663
|
+
var i=e.indexOf(RFC3966_PREFIX_);var d;
|
|
1664
|
+
// RFC 3966 "tel:" prefix is preset at this stage because
|
|
1665
|
+
// `isPhoneContextValid()` requires it to be present.
|
|
1666
|
+
/* istanbul ignore else */if(i>=0){d=i+RFC3966_PREFIX_.length}else{d=0}var s=e.indexOf(RFC3966_PHONE_CONTEXT_);o+=e.substring(d,s)}
|
|
1667
|
+
// Delete the isdn-subaddress and everything after it if it is present.
|
|
1668
|
+
// Note extension won't appear at the same time with isdn-subaddress
|
|
1669
|
+
// according to paragraph 5.3 of the RFC3966 spec.
|
|
1670
|
+
var a=o.indexOf(RFC3966_ISDN_SUBADDRESS_);if(a>0){o=o.substring(0,a)}
|
|
1671
|
+
// If both phone context and isdn-subaddress are absent but other
|
|
1672
|
+
// parameters are present, the parameters are left in nationalNumber.
|
|
1673
|
+
// This is because we are concerned about deleting content from a potential
|
|
1674
|
+
// number string when there is no strong evidence that the number is
|
|
1675
|
+
// actually written in RFC3966.
|
|
1676
|
+
if(o!==""){return o}}
|
|
1677
|
+
// This is a port of Google Android `libphonenumber`'s
|
|
1678
|
+
// `phonenumberutil.js` of December 31th, 2018.
|
|
1679
|
+
|
|
1680
|
+
// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js
|
|
1681
|
+
// We don't allow input strings for parsing to be longer than 250 chars.
|
|
1682
|
+
// This prevents malicious input from consuming CPU.
|
|
1683
|
+
var MAX_INPUT_STRING_LENGTH=250;
|
|
1684
|
+
// This consists of the plus symbol, digits, and arabic-indic digits.
|
|
1685
|
+
var PHONE_NUMBER_START_PATTERN=new RegExp("["+PLUS_CHARS+VALID_DIGITS+"]");
|
|
1686
|
+
// Regular expression of trailing characters that we want to remove.
|
|
1687
|
+
// A trailing `#` is sometimes used when writing phone numbers with extensions in US.
|
|
1688
|
+
// Example: "+1 (645) 123 1234-910#" number has extension "910".
|
|
1689
|
+
var AFTER_PHONE_NUMBER_END_PATTERN=new RegExp("[^"+VALID_DIGITS+"#"+"]+$");
|
|
1690
|
+
// Examples:
|
|
1691
|
+
|
|
1692
|
+
// ```js
|
|
1693
|
+
// parse('8 (800) 555-35-35', 'RU')
|
|
1694
|
+
// parse('8 (800) 555-35-35', 'RU', metadata)
|
|
1695
|
+
// parse('8 (800) 555-35-35', { country: { default: 'RU' } })
|
|
1696
|
+
// parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)
|
|
1697
|
+
// parse('+7 800 555 35 35')
|
|
1698
|
+
// parse('+7 800 555 35 35', metadata)
|
|
1699
|
+
// ```
|
|
1700
|
+
|
|
1701
|
+
/**
|
|
1702
|
+
* Parses a phone number.
|
|
1703
|
+
*
|
|
1704
|
+
* parse('123456789', { defaultCountry: 'RU', v2: true }, metadata)
|
|
1705
|
+
* parse('123456789', { defaultCountry: 'RU' }, metadata)
|
|
1706
|
+
* parse('123456789', undefined, metadata)
|
|
1707
|
+
*
|
|
1708
|
+
* @param {string} input
|
|
1709
|
+
* @param {object} [options]
|
|
1710
|
+
* @param {object} metadataJson
|
|
1711
|
+
* @return {object|PhoneNumber?} If `options.v2: true` flag is passed, it returns a `PhoneNumber?` instance. Otherwise, returns an object of shape `{ phone: '...', country: '...' }` (or just `{}` if no phone number was parsed).
|
|
1712
|
+
*/function parse(e,t,r){
|
|
1713
|
+
// If assigning the `{}` default value is moved to the arguments above,
|
|
1714
|
+
// code coverage would decrease for some weird reason.
|
|
1715
|
+
t=t||{};var n=new Metadata(r);
|
|
1716
|
+
// Validate `defaultCountry`.
|
|
1717
|
+
if(t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2){throw new ParseError("INVALID_COUNTRY")}throw new Error("Unknown country: ".concat(t.defaultCountry))}
|
|
1718
|
+
// Parse the phone number.
|
|
1719
|
+
var o=parseInput(e,t.v2,t.extract),i=o.number,d=o.ext,s=o.error;
|
|
1720
|
+
// If the phone number is not viable then return nothing.
|
|
1721
|
+
if(!i){if(t.v2){if(s==="TOO_SHORT"){throw new ParseError("TOO_SHORT")}throw new ParseError("NOT_A_NUMBER")}return{}}var a=parsePhoneNumber$3(i,t.defaultCountry,t.defaultCallingCode,
|
|
1722
|
+
// If `country` is returned, its numbering plan will also be selected in `metadata`.
|
|
1723
|
+
// Otherwise, if `countryCallingCode` is returned, its numbering plan will also be selected in `metadata`.
|
|
1724
|
+
// Otherwise, if neither `country` nor `countryCallingCode` are returned, no numbering plan will be selected in `metadata`.
|
|
1725
|
+
n),u=a.country,l=a.nationalNumber,$=a.countryCallingCode,c=a.countryCallingCodeSource,f=a.carrierCode;if(!n.hasSelectedNumberingPlan()){if(t.v2){throw new ParseError("INVALID_COUNTRY")}return{}}
|
|
1726
|
+
// Validate national (significant) number length.
|
|
1727
|
+
if(!l||l.length<MIN_LENGTH_FOR_NSN){
|
|
1728
|
+
// Won't throw here because the regexp already demands length > 1.
|
|
1729
|
+
/* istanbul ignore if */
|
|
1730
|
+
if(t.v2){throw new ParseError("TOO_SHORT")}
|
|
1731
|
+
// Google's demo just throws an error in this case.
|
|
1732
|
+
return{}}
|
|
1733
|
+
// Validate national (significant) number length.
|
|
1734
|
+
|
|
1735
|
+
// A sidenote:
|
|
1736
|
+
|
|
1737
|
+
// They say that sometimes national (significant) numbers
|
|
1738
|
+
// can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).
|
|
1739
|
+
// https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36
|
|
1740
|
+
// Such numbers will just be discarded.
|
|
1741
|
+
|
|
1742
|
+
if(l.length>MAX_LENGTH_FOR_NSN){if(t.v2){throw new ParseError("TOO_LONG")}
|
|
1743
|
+
// Google's demo just throws an error in this case.
|
|
1744
|
+
return{}}if(t.v2){var h=new PhoneNumber($,l,n.metadata);if(u){h.country=u}if(f){h.carrierCode=f}if(d){h.ext=d}h.__countryCallingCodeSource=c;return h}
|
|
1745
|
+
// Check if national phone number pattern matches the number.
|
|
1746
|
+
// National number pattern is different for each country,
|
|
1747
|
+
// even for those ones which are part of the "NANPA" group.
|
|
1748
|
+
var p=(t.extended?n.hasSelectedNumberingPlan():u)?matchesEntirely(l,n.nationalNumberPattern()):false;if(!t.extended){return p?result(u,l,d):{}}
|
|
1749
|
+
// isInternational: countryCallingCode !== undefined
|
|
1750
|
+
return{country:u,countryCallingCode:$,carrierCode:f,valid:p,possible:p?true:t.extended===true&&n.possibleLengths()&&isPossibleNumber$2(l,n)?true:false,phone:l,ext:d}}
|
|
1751
|
+
/**
|
|
1752
|
+
* Extracts a formatted phone number from text.
|
|
1753
|
+
* Doesn't guarantee that the extracted phone number
|
|
1754
|
+
* is a valid phone number (for example, doesn't validate its length).
|
|
1755
|
+
* @param {string} text
|
|
1756
|
+
* @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number.
|
|
1757
|
+
* @param {boolean} [throwOnError] — By default, it won't throw if the text is too long.
|
|
1758
|
+
* @return {string}
|
|
1759
|
+
* @example
|
|
1760
|
+
* // Returns "(213) 373-4253".
|
|
1761
|
+
* extractFormattedPhoneNumber("Call (213) 373-4253 for assistance.")
|
|
1762
|
+
*/function _extractFormattedPhoneNumber(e,t,r){if(!e){return}if(e.length>MAX_INPUT_STRING_LENGTH){if(r){throw new ParseError("TOO_LONG")}return}if(t===false){return e}
|
|
1763
|
+
// Attempt to extract a possible number from the string passed in
|
|
1764
|
+
var n=e.search(PHONE_NUMBER_START_PATTERN);if(n<0){return}return e.slice(n).replace(AFTER_PHONE_NUMBER_END_PATTERN,"")}
|
|
1765
|
+
/**
|
|
1766
|
+
* @param {string} text - Input.
|
|
1767
|
+
* @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag.
|
|
1768
|
+
* @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number.
|
|
1769
|
+
* @return {object} `{ ?number, ?ext }`.
|
|
1770
|
+
*/function parseInput(e,t,r){
|
|
1771
|
+
// // Parse RFC 3966 phone number URI.
|
|
1772
|
+
// if (text && text.indexOf('tel:') === 0) {
|
|
1773
|
+
// return parseRFC3966(text)
|
|
1774
|
+
// }
|
|
1775
|
+
// let number = extractFormattedPhoneNumber(text, extract, v2)
|
|
1776
|
+
var n=extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(e,{extractFormattedPhoneNumber:function e(n){return _extractFormattedPhoneNumber(n,r,t)}});
|
|
1777
|
+
// If the phone number is not viable, then abort.
|
|
1778
|
+
if(!n){return{}}if(!isViablePhoneNumber(n)){if(isViablePhoneNumberStart(n)){return{error:"TOO_SHORT"}}return{}}
|
|
1779
|
+
// Attempt to parse extension first, since it doesn't require region-specific
|
|
1780
|
+
// data and we want to have the non-normalised number here.
|
|
1781
|
+
var o=extractExtension(n);if(o.ext){return o}return{number:n}}
|
|
1782
|
+
/**
|
|
1783
|
+
* Creates `parse()` result object.
|
|
1784
|
+
*/function result(e,t,r){var n={country:e,phone:t};if(r){n.ext=r}return n}
|
|
1785
|
+
/**
|
|
1786
|
+
* Parses a viable phone number.
|
|
1787
|
+
* @param {string} formattedPhoneNumber — Example: "(213) 373-4253".
|
|
1788
|
+
* @param {string} [defaultCountry]
|
|
1789
|
+
* @param {string} [defaultCallingCode]
|
|
1790
|
+
* @param {Metadata} metadata — Metadata instance with no pre-selected numbering plan. If `country` is returned, its numbering plan will also be selected in `metadata`. Otherwise, if `countryCallingCode` is returned, its numbering plan will also be selected in `metadata`. Otherwise, if neither `country` nor `countryCallingCode` are returned, no numbering plan will be selected in `metadata`.
|
|
1791
|
+
* @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.
|
|
1792
|
+
*/function parsePhoneNumber$3(e,t,r,n){
|
|
1793
|
+
// Attempt to extract a calling code from a phone number.
|
|
1794
|
+
// * If the phone number is found to be "international":
|
|
1795
|
+
// * It will attempt to identify the calling code part of it and whether that part is complete and valid.
|
|
1796
|
+
// * If the calling code part is complete and valid, it will return two properties:
|
|
1797
|
+
// that calling code part (without `+`) and the rest of the digits.
|
|
1798
|
+
// * Otherwise, i.e. if the calling code part is incomplete or invalid,
|
|
1799
|
+
// it will return an empty object.
|
|
1800
|
+
// * Otherwise, i.e. if the phone number is national, there's no callind code to extract
|
|
1801
|
+
// so it will just return the originally-passed `number` string as the only property.
|
|
1802
|
+
var o=extractCountryCallingCode(parseIncompletePhoneNumber(e),undefined,
|
|
1803
|
+
// `defaultCountry` and `defaultCallingCode` are only used to detect
|
|
1804
|
+
// if it's an "international" phone number or not. They won't be used
|
|
1805
|
+
// to derive the resulting `countryCallingCode` from them, or anything like that.
|
|
1806
|
+
t,r,n.metadata),i=o.countryCallingCodeSource,d=o.countryCallingCode,s=o.number;
|
|
1807
|
+
// The exact country of the phone number
|
|
1808
|
+
var a;
|
|
1809
|
+
// If `formattedPhoneNumber` is passed in "international" format,
|
|
1810
|
+
// choose a country by `countryCallingCode`.
|
|
1811
|
+
if(d){n.selectNumberingPlan(d)}
|
|
1812
|
+
// Else, if `formattedPhoneNumber` is passed in "national" format,
|
|
1813
|
+
// then `number` is defined and `countryCallingCode` is `undefined`.
|
|
1814
|
+
else if(s&&(t||r)){if(t){a=t;n.selectNumberingPlan(t);d=n.numberingPlan.callingCode()}else{n.selectNumberingPlan(r);d=r}}else return{};
|
|
1815
|
+
// At this point, `country` could be `undefined` but `countryCallingCode` is always defined.
|
|
1816
|
+
|
|
1817
|
+
// Also, if `country` is defined, its numbering plan is selected in `metadata`.
|
|
1818
|
+
// Otherwise, the numering plan for the `countryCallingCode` is selected in `metadata`.
|
|
1819
|
+
if(!s){return{countryCallingCodeSource:i,countryCallingCode:d}}var u=extractNationalNumber(parseIncompletePhoneNumber(s),undefined,n),l=u.nationalNumber,$=u.carrierCode;
|
|
1820
|
+
// Sometimes there are several countries
|
|
1821
|
+
// corresponding to the same country phone code
|
|
1822
|
+
// (e.g. NANPA countries all having `1` country phone code).
|
|
1823
|
+
// Therefore, to reliably determine the exact country,
|
|
1824
|
+
// national (significant) number should have been parsed first.
|
|
1825
|
+
|
|
1826
|
+
// When `metadata.json` is generated, all "ambiguous" country phone codes
|
|
1827
|
+
// get their countries populated with the full set of
|
|
1828
|
+
// "phone number type" regular expressions.
|
|
1829
|
+
|
|
1830
|
+
var c=getCountryByCallingCode(d,{nationalNumber:l,metadata:n});if(c){a=c;
|
|
1831
|
+
/* istanbul ignore if */if(c==="001");else{n.selectNumberingPlan(a)}}return{country:a,countryCallingCode:d,countryCallingCodeSource:i,nationalNumber:l,carrierCode:$}}function _typeof$8(e){"@babel/helpers - typeof";return _typeof$8="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$8(e)}function ownKeys$2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$2(Object(r),true).forEach((function(t){_defineProperty$2(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$2(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty$2(e,t,r){return(t=_toPropertyKey$8(t))in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function _toPropertyKey$8(e){var t=_toPrimitive$8(e,"string");return"symbol"==_typeof$8(t)?t:t+""}function _toPrimitive$8(e,t){if("object"!=_typeof$8(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$8(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function parsePhoneNumberWithError(e,t,r){return parse(e,_objectSpread$2(_objectSpread$2({},t),{},{v2:true}),r)}function _typeof$7(e){"@babel/helpers - typeof";return _typeof$7="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$7(e)}function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),true).forEach((function(t){_defineProperty$1(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty$1(e,t,r){return(t=_toPropertyKey$7(t))in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function _toPropertyKey$7(e){var t=_toPrimitive$7(e,"string");return"symbol"==_typeof$7(t)?t:t+""}function _toPrimitive$7(e,t){if("object"!=_typeof$7(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$7(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _slicedToArray$2(e,t){return _arrayWithHoles$2(e)||_iterableToArrayLimit$2(e,t)||_unsupportedIterableToArray$5(e,t)||_nonIterableRest$2()}function _nonIterableRest$2(){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 _unsupportedIterableToArray$5(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$5(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$5(e,t):void 0}}function _arrayLikeToArray$5(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit$2(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,d,s=[],a=true,u=false;try{if(i=(r=r.call(e)).next,0===t);else for(;!(a=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);a=true);}catch(e){u=true,o=e}finally{try{if(!a&&null!=r["return"]&&(d=r["return"](),Object(d)!==d))return}finally{if(u)throw o}}return s}}function _arrayWithHoles$2(e){if(Array.isArray(e))return e}
|
|
1832
|
+
// Extracts the following properties from function arguments:
|
|
1833
|
+
// * input `text`
|
|
1834
|
+
// * `options` object
|
|
1835
|
+
// * `metadata` JSON
|
|
1836
|
+
function normalizeArguments$1(e){var t=Array.prototype.slice.call(e),r=_slicedToArray$2(t,4),n=r[0],o=r[1],i=r[2],d=r[3];var s;var a;var u;
|
|
1837
|
+
// If the phone number is passed as a string.
|
|
1838
|
+
// `parsePhoneNumber('88005553535', ...)`.
|
|
1839
|
+
if(typeof n==="string"){s=n}else throw new TypeError("A text for parsing must be a string.");
|
|
1840
|
+
// If "default country" argument is being passed then move it to `options`.
|
|
1841
|
+
// `parsePhoneNumber('88005553535', 'RU', [options], metadata)`.
|
|
1842
|
+
if(!o||typeof o==="string"){if(d){a=i;u=d}else{a=undefined;u=i}if(o){a=_objectSpread$1({defaultCountry:o},a)}}
|
|
1843
|
+
// `defaultCountry` is not passed.
|
|
1844
|
+
// Example: `parsePhoneNumber('+78005553535', [options], metadata)`.
|
|
1845
|
+
else if(isObject(o)){if(i){a=o;u=i}else{u=o}}else throw new Error("Invalid second argument: ".concat(o));return{text:s,options:a,metadata:u}}function _typeof$6(e){"@babel/helpers - typeof";return _typeof$6="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$6(e)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),true).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return(t=_toPropertyKey$6(t))in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function _toPropertyKey$6(e){var t=_toPrimitive$6(e,"string");return"symbol"==_typeof$6(t)?t:t+""}function _toPrimitive$6(e,t){if("object"!=_typeof$6(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$6(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function parsePhoneNumber$2(e,t,r){
|
|
1846
|
+
// Validate `defaultCountry`.
|
|
1847
|
+
if(t&&t.defaultCountry&&!isSupportedCountry(t.defaultCountry,r)){t=_objectSpread(_objectSpread({},t),{},{defaultCountry:undefined})}
|
|
1848
|
+
// Parse phone number.
|
|
1849
|
+
try{return parsePhoneNumberWithError(e,t,r)}catch(e){
|
|
1850
|
+
/* istanbul ignore else */
|
|
1851
|
+
if(e instanceof ParseError);else{throw e}}}function parsePhoneNumber$1(){var e=normalizeArguments$1(arguments),t=e.text,r=e.options,n=e.metadata;return parsePhoneNumber$2(t,r,n)}function _typeof$5(e){"@babel/helpers - typeof";return _typeof$5="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$5(e)}function _classCallCheck$5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$5(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,_toPropertyKey$5(n.key),n)}}function _createClass$5(e,t,r){return t&&_defineProperties$5(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function _toPropertyKey$5(e){var t=_toPrimitive$5(e,"string");return"symbol"==_typeof$5(t)?t:t+""}function _toPrimitive$5(e,t){if("object"!=_typeof$5(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$5(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}
|
|
1852
|
+
// This "state" object simply holds the state of the "AsYouType" parser:
|
|
1853
|
+
|
|
1854
|
+
// Sidenote:
|
|
1855
|
+
// `state.callingCode` and `state.country` are somewhat independent from one another
|
|
1856
|
+
// and there could be situations when one is defined but the other is not.
|
|
1857
|
+
// * Situations when `state.country` would be defined but `state.callingCode` would be `undefined`:
|
|
1858
|
+
// * When `defaultCountry` is specified and inputting a phone number not in "international" format.
|
|
1859
|
+
// * When `defaultCountry` is specified and inputting a phone number in "international" format,
|
|
1860
|
+
// but before the `+` character has been input.
|
|
1861
|
+
// * Situations when `state.country` would be `undefined` but `state.callingCode` would be defined:
|
|
1862
|
+
// * When `defaultCountry` is not specified and inputting a phone number in "international" format,
|
|
1863
|
+
// and the "calling code" part is already complete, but multiple countries share this "calling code"
|
|
1864
|
+
// and there's not enough national (significant) number digits yet to determine the exact country.
|
|
1865
|
+
// * In any other sigutations, `state.country` and `state.callingCode` are either both defined or both `undefined`.
|
|
1866
|
+
// * When they're both defined, `state.callingCode` always corresponds to `state.country`.
|
|
1867
|
+
// So both are always consistent in this case.
|
|
1868
|
+
|
|
1869
|
+
// * `country?: string` — The exact country of the phone number, if it could be determined.
|
|
1870
|
+
// When inputting a phone number in "international" format, it will derive the `country` from "country calling code" and the phone number digits.
|
|
1871
|
+
// When inputting a phone number in "national" format, it will derive the `country` from `defaultCountry` that was specified when creating the `AsYouType` formatter.
|
|
1872
|
+
// Sidenote: If `USE_NON_GEOGRAPHIC_COUNTRY_CODE` flag was `true`, then for "non-geographic phone numbers" `state.country` would've been "001".
|
|
1873
|
+
// * `callingCode?: string` — "Country calling code" that has been extracted from the input phone number.
|
|
1874
|
+
// When inputting a phone number in "international" format, it will extract the "country calling code" from the digits that follow the "+" character.
|
|
1875
|
+
// When inputting a phone number in "national" format, `callingCode` will be `undefined`.
|
|
1876
|
+
// * `digits: string` — Phone number digits that have been input so far, including the "+" character, if present. In case of inputting non-arabic digits, those will be converted to arabic ones.
|
|
1877
|
+
// * `international: boolean` — Whether the phone number is being input in "international" format, i.e. with a "+" character.
|
|
1878
|
+
// * `missingPlus: boolean` — Whether it's a phone number in "international" format that is missing the leading "+" character for some reason — apparently, Google thinks that it's a common mistake when inputting a phone number.
|
|
1879
|
+
// * `IDDPrefix?: string` — An "IDD prefix", when the phone number is being input in an "out-of-country dialing" format. https://wikitravel.org/en/International_dialling_prefix
|
|
1880
|
+
// * `carrierCode?: string` — A "carrier code", if the phone number contains it. Normally, those can only be present in Colombia or Brazil, and only when calling from mobile phones to fixed-line numbers.
|
|
1881
|
+
// * `nationalPrefix?: string` — "National prefix", if present in the phone number input.
|
|
1882
|
+
// * `nationalSignificantNumber?: string` — National (significant) number digits that have been input so far.
|
|
1883
|
+
// * `nationalSignificantNumberIsModified: boolean` — Tells if the parsed national (significant) number is present as-is in the input string. For example, when inputting "0343515551212999" Argentinian mobile number, the parsed national (significant) number is "93435551212999". There, one can see how it stripped "0" national prefix and prepended a "9", because that's how it is instructed to do in Argentina's metadata. So in the described example, the parsed national (significant) number is not present as-is in the input string. Instead, it's "modified" in the input string. https://gitlab.com/caamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
1884
|
+
// * `prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix?: string` — In some countries, a phone number could have a prefix that is not a "national prefix" but rather some other type of "utility" prefix.
|
|
1885
|
+
// For example, when calling within Australia, one could prepend `1831` prefix to hide caller's phone number.
|
|
1886
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
1887
|
+
|
|
1888
|
+
var AsYouTypeState=function(){function e(t){var r=t.onCountryChange,n=t.onCallingCodeChange;_classCallCheck$5(this,e);this.onCountryChange=r;this.onCallingCodeChange=n}return _createClass$5(e,[{key:"reset",value:function e(t){var r=t.country,n=t.callingCode;this.international=false;this.missingPlus=false;this.IDDPrefix=undefined;this.callingCode=undefined;this.digits="";this.resetNationalSignificantNumber();this.initCountryAndCallingCode(r,n)}},{key:"resetNationalSignificantNumber",value:function e(){this.nationalSignificantNumber=this.getNationalDigits();this.nationalSignificantNumberIsModified=false;this.nationalPrefix=undefined;this.carrierCode=undefined;this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix=undefined}},{key:"update",value:function e(t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];this[o]=t[o]}}},{key:"initCountryAndCallingCode",value:function e(t,r){this.setCountry(t);this.setCallingCode(r)}},{key:"setCountry",value:function e(t){this.country=t;this.onCountryChange(t)}},{key:"setCallingCode",value:function e(t){this.callingCode=t;this.onCallingCodeChange(t,this.country)}},{key:"startInternationalNumber",value:function e(t,r){
|
|
1889
|
+
// Prepend the `+` to parsed input.
|
|
1890
|
+
this.international=true;
|
|
1891
|
+
// If a default country was set then reset it
|
|
1892
|
+
// because an explicitly international phone
|
|
1893
|
+
// number is being entered.
|
|
1894
|
+
this.initCountryAndCallingCode(t,r)}},{key:"appendDigits",value:function e(t){this.digits+=t}},{key:"appendNationalSignificantNumberDigits",value:function e(t){this.nationalSignificantNumber+=t}
|
|
1895
|
+
/**
|
|
1896
|
+
* Returns the part of `this.digits` that corresponds to the national number.
|
|
1897
|
+
* Basically, all digits that have been input by the user, except for the
|
|
1898
|
+
* international prefix and the country calling code part
|
|
1899
|
+
* (if the number is an international one).
|
|
1900
|
+
* @return {string}
|
|
1901
|
+
*/},{key:"getNationalDigits",value:function e(){if(this.international){return this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0))}return this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function e(){if(this.international){if(this.IDDPrefix){return this.digits.slice(this.IDDPrefix.length)}}return this.digits}}])}();function _createForOfIteratorHelperLoose$2(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$4(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$4(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$4(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$4(e,t):void 0}}function _arrayLikeToArray$4(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}
|
|
1902
|
+
// Should be the same as `DIGIT_PLACEHOLDER` in `libphonenumber-metadata-generator`.
|
|
1903
|
+
var DIGIT_PLACEHOLDER="x";// '\u2008' (punctuation space)
|
|
1904
|
+
var DIGIT_PLACEHOLDER_MATCHER=new RegExp(DIGIT_PLACEHOLDER);
|
|
1905
|
+
// Repeats a string (or a symbol) N times.
|
|
1906
|
+
// http://stackoverflow.com/questions/202605/repeat-string-javascript
|
|
1907
|
+
function repeat(e,t){if(t<1){return""}var r="";while(t>1){if(t&1){r+=e}t>>=1;e+=e}return r+e}function cutAndStripNonPairedParens(e,t){if(e[t]===")"){t++}return stripNonPairedParens(e.slice(0,t))}function stripNonPairedParens(e){var t=[];var r=0;while(r<e.length){if(e[r]==="("){t.push(r)}else if(e[r]===")"){t.pop()}r++}var n=0;var o="";t.push(e.length);for(var i=0,d=t;i<d.length;i++){var s=d[i];o+=e.slice(n,s);n=s+1}return o}function populateTemplateWithDigits(e,t,r){
|
|
1908
|
+
// Using `.split('')` to iterate through a string here
|
|
1909
|
+
// to avoid requiring `Symbol.iterator` polyfill.
|
|
1910
|
+
// `.split('')` is generally not safe for Unicode,
|
|
1911
|
+
// but in this particular case for `digits` it is safe.
|
|
1912
|
+
// for (const digit of digits)
|
|
1913
|
+
for(var n=_createForOfIteratorHelperLoose$2(r.split("")),o;!(o=n()).done;){var i=o.value;
|
|
1914
|
+
// If there is room for more digits in current `template`,
|
|
1915
|
+
// then set the next digit in the `template`,
|
|
1916
|
+
// and return the formatted digits so far.
|
|
1917
|
+
// If more digits are entered than the current format could handle.
|
|
1918
|
+
if(e.slice(t+1).search(DIGIT_PLACEHOLDER_MATCHER)<0){return}t=e.search(DIGIT_PLACEHOLDER_MATCHER);e=e.replace(DIGIT_PLACEHOLDER_MATCHER,i)}return[e,t]}function formatCompleteNumber(e,t,r){var n=r.shouldTryNationalPrefixFormattingRule,o=r.getSeparatorAfterNationalPrefix;var i=new RegExp("^(?:".concat(t.pattern(),")$"));if(i.test(e.nationalSignificantNumber)){return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(e,t,{shouldTryNationalPrefixFormattingRule:n,getSeparatorAfterNationalPrefix:o})}}function canFormatCompleteNumber(e,t){return checkNumberLength(e,undefined,t)==="IS_POSSIBLE"}function formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(e,t,r){var n=r.shouldTryNationalPrefixFormattingRule,o=r.getSeparatorAfterNationalPrefix;
|
|
1919
|
+
// Format the number with using `national_prefix_formatting_rule`.
|
|
1920
|
+
// If the resulting formatted number is a valid formatted number, then return it.
|
|
1921
|
+
|
|
1922
|
+
// Google's AsYouType formatter is different in a way that it doesn't try
|
|
1923
|
+
// to format using the "national prefix formatting rule", and instead it
|
|
1924
|
+
// simply prepends a national prefix followed by a " " character.
|
|
1925
|
+
// This code does that too, but as a fallback.
|
|
1926
|
+
// The reason is that "national prefix formatting rule" may use parentheses,
|
|
1927
|
+
// which wouldn't be included has it used the simpler Google's way.
|
|
1928
|
+
|
|
1929
|
+
if(n(t)){var i=formatNationalNumber(e,t,{useNationalPrefixFormattingRule:true,getSeparatorAfterNationalPrefix:o});if(i){return i}}
|
|
1930
|
+
// Format the number without using `national_prefix_formatting_rule`.
|
|
1931
|
+
return formatNationalNumber(e,t,{useNationalPrefixFormattingRule:false,getSeparatorAfterNationalPrefix:o})}function formatNationalNumber(e,t,r){var n=r.useNationalPrefixFormattingRule,o=r.getSeparatorAfterNationalPrefix;var i=formatNationalNumberUsingFormat(e.nationalSignificantNumber,t,{useInternationalFormat:e.international,withNationalPrefix:n});if(!n){if(e.nationalPrefix){
|
|
1932
|
+
// If a national prefix was extracted, then just prepend it,
|
|
1933
|
+
// followed by a " " character.
|
|
1934
|
+
i=e.nationalPrefix+o(t)+i}else if(e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix){i=e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix+" "+i}}if(isValidFormattedNationalNumber(i,e)){return i}}
|
|
1935
|
+
// Check that the formatted phone number contains exactly
|
|
1936
|
+
// the same digits that have been input by the user.
|
|
1937
|
+
// For example, when "0111523456789" is input for `AR` country,
|
|
1938
|
+
// the extracted `this.nationalSignificantNumber` is "91123456789",
|
|
1939
|
+
// which means that the national part of `this.digits` isn't simply equal to
|
|
1940
|
+
// `this.nationalPrefix` + `this.nationalSignificantNumber`.
|
|
1941
|
+
|
|
1942
|
+
// Also, a `format` can add extra digits to the `this.nationalSignificantNumber`
|
|
1943
|
+
// being formatted via `metadata[country].national_prefix_transform_rule`.
|
|
1944
|
+
// For example, for `VI` country, it prepends `340` to the national number,
|
|
1945
|
+
// and if this check hasn't been implemented, then there would be a bug
|
|
1946
|
+
// when `340` "area coude" is "duplicated" during input for `VI` country:
|
|
1947
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/318
|
|
1948
|
+
|
|
1949
|
+
// So, all these "gotchas" are filtered out.
|
|
1950
|
+
|
|
1951
|
+
// In the original Google's code, the comments say:
|
|
1952
|
+
// "Check that we didn't remove nor add any extra digits when we matched
|
|
1953
|
+
// this formatting pattern. This usually happens after we entered the last
|
|
1954
|
+
// digit during AYTF. Eg: In case of MX, we swallow mobile token (1) when
|
|
1955
|
+
// formatted but AYTF should retain all the number entered and not change
|
|
1956
|
+
// in order to match a format (of same leading digits and length) display
|
|
1957
|
+
// in that way."
|
|
1958
|
+
// "If it's the same (i.e entered number and format is same), then it's
|
|
1959
|
+
// safe to return this in formatted number as nothing is lost / added."
|
|
1960
|
+
// Otherwise, don't use this format.
|
|
1961
|
+
// https://github.com/google/libphonenumber/commit/3e7c1f04f5e7200f87fb131e6f85c6e99d60f510#diff-9149457fa9f5d608a11bb975c6ef4bc5
|
|
1962
|
+
// https://github.com/google/libphonenumber/commit/3ac88c7106e7dcb553bcc794b15f19185928a1c6#diff-2dcb77e833422ee304da348b905cde0b
|
|
1963
|
+
|
|
1964
|
+
function isValidFormattedNationalNumber(e,t){return parseDigits(e)===t.getNationalDigits()}function _typeof$4(e){"@babel/helpers - typeof";return _typeof$4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$4(e)}function _classCallCheck$4(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,_toPropertyKey$4(n.key),n)}}function _createClass$4(e,t,r){return t&&_defineProperties$4(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function _toPropertyKey$4(e){var t=_toPrimitive$4(e,"string");return"symbol"==_typeof$4(t)?t:t+""}function _toPrimitive$4(e,t){if("object"!=_typeof$4(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$4(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var PatternParser=function(){function e(){_classCallCheck$4(this,e)}return _createClass$4(e,[{key:"parse",value:function e(t){this.context=[{or:true,instructions:[]}];this.parsePattern(t);if(this.context.length!==1){throw new Error("Non-finalized contexts left when pattern parse ended")}var r=this.context[0],n=r.branches,o=r.instructions;if(n){return{op:"|",args:n.concat([expandSingleElementArray(o)])}}
|
|
1965
|
+
/* istanbul ignore if */if(o.length===0){throw new Error("Pattern is required")}if(o.length===1){return o[0]}return o}},{key:"startContext",value:function e(t){this.context.push(t)}},{key:"endContext",value:function e(){this.context.pop()}},{key:"getContext",value:function e(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function e(t){if(!t){throw new Error("Pattern is required")}var r=t.match(OPERATOR);if(!r){if(ILLEGAL_CHARACTER_REGEXP.test(t)){throw new Error("Illegal characters found in a pattern: ".concat(t))}this.getContext().instructions=this.getContext().instructions.concat(t.split(""));return}var n=r[1];var o=t.slice(0,r.index);var i=t.slice(r.index+n.length);switch(n){case"(?:":if(o){this.parsePattern(o)}this.startContext({or:true,instructions:[],branches:[]});break;case")":if(!this.getContext().or){throw new Error('")" operator must be preceded by "(?:" operator')}if(o){this.parsePattern(o)}if(this.getContext().instructions.length===0){throw new Error('No instructions found after "|" operator in an "or" group')}var d=this.getContext(),s=d.branches;s.push(expandSingleElementArray(this.getContext().instructions));this.endContext();this.getContext().instructions.push({op:"|",args:s});break;case"|":if(!this.getContext().or){throw new Error('"|" operator can only be used inside "or" groups')}if(o){this.parsePattern(o)}
|
|
1966
|
+
// The top-level is an implicit "or" group, if required.
|
|
1967
|
+
if(!this.getContext().branches){
|
|
1968
|
+
// `branches` are not defined only for the root implicit "or" operator.
|
|
1969
|
+
/* istanbul ignore else */
|
|
1970
|
+
if(this.context.length===1){this.getContext().branches=[]}else{throw new Error('"branches" not found in an "or" group context')}}this.getContext().branches.push(expandSingleElementArray(this.getContext().instructions));this.getContext().instructions=[];break;case"[":if(o){this.parsePattern(o)}this.startContext({oneOfSet:true});break;case"]":if(!this.getContext().oneOfSet){throw new Error('"]" operator must be preceded by "[" operator')}this.endContext();this.getContext().instructions.push({op:"[]",args:parseOneOfSet(o)});break;
|
|
1971
|
+
/* istanbul ignore next */default:throw new Error("Unknown operator: ".concat(n))}if(i){this.parsePattern(i)}}}])}();function parseOneOfSet(e){var t=[];var r=0;while(r<e.length){if(e[r]==="-"){if(r===0||r===e.length-1){throw new Error("Couldn't parse a one-of set pattern: ".concat(e))}var n=e[r-1].charCodeAt(0)+1;var o=e[r+1].charCodeAt(0)-1;var i=n;while(i<=o){t.push(String.fromCharCode(i));i++}}else{t.push(e[r])}r++}return t}var ILLEGAL_CHARACTER_REGEXP=/[\(\)\[\]\?\:\|]/;var OPERATOR=new RegExp(
|
|
1972
|
+
// any of:
|
|
1973
|
+
"("+
|
|
1974
|
+
// or operator
|
|
1975
|
+
"\\|"+
|
|
1976
|
+
// or
|
|
1977
|
+
"|"+
|
|
1978
|
+
// or group start
|
|
1979
|
+
"\\(\\?\\:"+
|
|
1980
|
+
// or
|
|
1981
|
+
"|"+
|
|
1982
|
+
// or group end
|
|
1983
|
+
"\\)"+
|
|
1984
|
+
// or
|
|
1985
|
+
"|"+
|
|
1986
|
+
// one-of set start
|
|
1987
|
+
"\\["+
|
|
1988
|
+
// or
|
|
1989
|
+
"|"+
|
|
1990
|
+
// one-of set end
|
|
1991
|
+
"\\]"+")");function expandSingleElementArray(e){if(e.length===1){return e[0]}return e}function _createForOfIteratorHelperLoose$1(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$3(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$3(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$3(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$3(e,t):void 0}}function _arrayLikeToArray$3(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _typeof$3(e){"@babel/helpers - typeof";return _typeof$3="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$3(e)}function _classCallCheck$3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,_toPropertyKey$3(n.key),n)}}function _createClass$3(e,t,r){return t&&_defineProperties$3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function _toPropertyKey$3(e){var t=_toPrimitive$3(e,"string");return"symbol"==_typeof$3(t)?t:t+""}function _toPrimitive$3(e,t){if("object"!=_typeof$3(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$3(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var PatternMatcher=function(){function e(t){_classCallCheck$3(this,e);this.matchTree=(new PatternParser).parse(t)}return _createClass$3(e,[{key:"match",value:function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=r.allowOverflow;if(!t){throw new Error("String is required")}var o=_match(t.split(""),this.matchTree,true);if(o&&o.match){delete o.matchedChars}if(o&&o.overflow){if(!n){return}}return o}}])}();function _match(e,t,r){
|
|
1992
|
+
// If `tree` is a string, then `tree` is a single character.
|
|
1993
|
+
// That's because when a pattern is parsed, multi-character-string parts
|
|
1994
|
+
// of a pattern are compiled into arrays of single characters.
|
|
1995
|
+
// I still wrote this piece of code for a "general" hypothetical case
|
|
1996
|
+
// when `tree` could be a string of several characters, even though
|
|
1997
|
+
// such case is not possible with the current implementation.
|
|
1998
|
+
if(typeof t==="string"){var n=e.join("");if(t.indexOf(n)===0){
|
|
1999
|
+
// `tree` is always a single character.
|
|
2000
|
+
// If `tree.indexOf(characterString) === 0`
|
|
2001
|
+
// then `characters.length === tree.length`.
|
|
2002
|
+
/* istanbul ignore else */
|
|
2003
|
+
if(e.length===t.length){return{match:true,matchedChars:e}}
|
|
2004
|
+
// `tree` is always a single character.
|
|
2005
|
+
// If `tree.indexOf(characterString) === 0`
|
|
2006
|
+
// then `characters.length === tree.length`.
|
|
2007
|
+
/* istanbul ignore next */return{partialMatch:true}}if(n.indexOf(t)===0){if(r){
|
|
2008
|
+
// The `else` path is not possible because `tree` is always a single character.
|
|
2009
|
+
// The `else` case for `characters.length > tree.length` would be
|
|
2010
|
+
// `characters.length <= tree.length` which means `characters.length <= 1`.
|
|
2011
|
+
// `characters` array can't be empty, so that means `characters === [tree]`,
|
|
2012
|
+
// which would also mean `tree.indexOf(characterString) === 0` and that'd mean
|
|
2013
|
+
// that the `if (tree.indexOf(characterString) === 0)` condition before this
|
|
2014
|
+
// `if` condition would be entered, and returned from there, not reaching this code.
|
|
2015
|
+
/* istanbul ignore else */
|
|
2016
|
+
if(e.length>t.length){return{overflow:true}}}return{match:true,matchedChars:e.slice(0,t.length)}}return}if(Array.isArray(t)){var o=e.slice();var i=0;while(i<t.length){var d=t[i];var s=_match(o,d,r&&i===t.length-1);if(!s){return}else if(s.overflow){return s}else if(s.match){
|
|
2017
|
+
// Continue with the next subtree with the rest of the characters.
|
|
2018
|
+
o=o.slice(s.matchedChars.length);if(o.length===0){if(i===t.length-1){return{match:true,matchedChars:e}}else{return{partialMatch:true}}}}else{
|
|
2019
|
+
/* istanbul ignore else */
|
|
2020
|
+
if(s.partialMatch){return{partialMatch:true}}else{throw new Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}}i++}
|
|
2021
|
+
// If `last` then overflow has already been checked
|
|
2022
|
+
// by the last element of the `tree` array.
|
|
2023
|
+
/* istanbul ignore if */if(r){return{overflow:true}}return{match:true,matchedChars:e.slice(0,e.length-o.length)}}switch(t.op){case"|":var a;for(var u=_createForOfIteratorHelperLoose$1(t.args),l;!(l=u()).done;){var $=l.value;var c=_match(e,$,r);if(c){if(c.overflow){return c}else if(c.match){return{match:true,matchedChars:c.matchedChars}}else{
|
|
2024
|
+
/* istanbul ignore else */
|
|
2025
|
+
if(c.partialMatch){a=true}else{throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)))}}}}if(a){return{partialMatch:true}}
|
|
2026
|
+
// Not even a partial match.
|
|
2027
|
+
return;case"[]":for(var f=_createForOfIteratorHelperLoose$1(t.args),h;!(h=f()).done;){var p=h.value;if(e[0]===p){if(e.length===1){return{match:true,matchedChars:e}}if(r){return{overflow:true}}return{match:true,matchedChars:[p]}}}
|
|
2028
|
+
// No character matches.
|
|
2029
|
+
return;
|
|
2030
|
+
/* istanbul ignore next */default:throw new Error("Unsupported instruction tree: ".concat(t))}}function _typeof$2(e){"@babel/helpers - typeof";return _typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$2(e)}function _createForOfIteratorHelperLoose(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray$2(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray$2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$2(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$2(e,t):void 0}}function _arrayLikeToArray$2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _classCallCheck$2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,_toPropertyKey$2(n.key),n)}}function _createClass$2(e,t,r){return t&&_defineProperties$2(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function _toPropertyKey$2(e){var t=_toPrimitive$2(e,"string");return"symbol"==_typeof$2(t)?t:t+""}function _toPrimitive$2(e,t){if("object"!=_typeof$2(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$2(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}
|
|
2031
|
+
// Used in phone number format template creation.
|
|
2032
|
+
// Could be any digit, I guess.
|
|
2033
|
+
var DUMMY_DIGIT="9";
|
|
2034
|
+
// I don't know why is it exactly `15`
|
|
2035
|
+
var LONGEST_NATIONAL_PHONE_NUMBER_LENGTH=15;
|
|
2036
|
+
// Create a phone number consisting only of the digit 9 that matches the
|
|
2037
|
+
// `number_pattern` by applying the pattern to the "longest phone number" string.
|
|
2038
|
+
var LONGEST_DUMMY_PHONE_NUMBER=repeat(DUMMY_DIGIT,LONGEST_NATIONAL_PHONE_NUMBER_LENGTH);
|
|
2039
|
+
// A set of characters that, if found in a national prefix formatting rules, are an indicator to
|
|
2040
|
+
// us that we should separate the national prefix from the number when formatting.
|
|
2041
|
+
var NATIONAL_PREFIX_SEPARATORS_PATTERN=/[- ]/;
|
|
2042
|
+
// A pattern that is used to match character classes in regular expressions.
|
|
2043
|
+
// An example of a character class is "[1-4]".
|
|
2044
|
+
var CREATE_CHARACTER_CLASS_PATTERN=function(){return/\[([^\[\]])*\]/g};
|
|
2045
|
+
// Any digit in a regular expression that actually denotes a digit. For
|
|
2046
|
+
// example, in the regular expression "80[0-2]\d{6,10}", the first 2 digits
|
|
2047
|
+
// (8 and 0) are standalone digits, but the rest are not.
|
|
2048
|
+
// Two look-aheads are needed because the number following \\d could be a
|
|
2049
|
+
// two-digit number, since the phone number can be as long as 15 digits.
|
|
2050
|
+
var CREATE_STANDALONE_DIGIT_PATTERN=function(){return/\d(?=[^,}][^,}])/g};
|
|
2051
|
+
// A regular expression that is used to determine if a `format` is
|
|
2052
|
+
// suitable to be used in the "as you type formatter".
|
|
2053
|
+
// A `format` is suitable when the resulting formatted number has
|
|
2054
|
+
// the same digits as the user has entered.
|
|
2055
|
+
|
|
2056
|
+
// In the simplest case, that would mean that the format
|
|
2057
|
+
// doesn't add any additional digits when formatting a number.
|
|
2058
|
+
// Google says that it also shouldn't add "star" (`*`) characters,
|
|
2059
|
+
// like it does in some Israeli formats.
|
|
2060
|
+
// Such basic format would only contain "valid punctuation"
|
|
2061
|
+
// and "captured group" identifiers ($1, $2, etc).
|
|
2062
|
+
|
|
2063
|
+
// An example of a format that adds additional digits:
|
|
2064
|
+
|
|
2065
|
+
// Country: `AR` (Argentina).
|
|
2066
|
+
// Format:
|
|
2067
|
+
// {
|
|
2068
|
+
// "pattern": "(\\d)(\\d{2})(\\d{4})(\\d{4})",
|
|
2069
|
+
// "leading_digits_patterns": ["91"],
|
|
2070
|
+
// "national_prefix_formatting_rule": "0$1",
|
|
2071
|
+
// "format": "$2 15-$3-$4",
|
|
2072
|
+
// "international_format": "$1 $2 $3-$4"
|
|
2073
|
+
// }
|
|
2074
|
+
|
|
2075
|
+
// In the format above, the `format` adds `15` to the digits when formatting a number.
|
|
2076
|
+
// A sidenote: this format actually is suitable because `national_prefix_for_parsing`
|
|
2077
|
+
// has previously removed `15` from a national number, so re-adding `15` in `format`
|
|
2078
|
+
// doesn't actually result in any extra digits added to user's input.
|
|
2079
|
+
// But verifying that would be a complex procedure, so the code chooses a simpler path:
|
|
2080
|
+
// it simply filters out all `format`s that contain anything but "captured group" ids.
|
|
2081
|
+
|
|
2082
|
+
// This regular expression is called `ELIGIBLE_FORMAT_PATTERN` in Google's
|
|
2083
|
+
// `libphonenumber` code.
|
|
2084
|
+
|
|
2085
|
+
var NON_ALTERING_FORMAT_REG_EXP=new RegExp("["+VALID_PUNCTUATION+"]*"+
|
|
2086
|
+
// Google developers say:
|
|
2087
|
+
// "We require that the first matching group is present in the
|
|
2088
|
+
// output pattern to ensure no data is lost while formatting."
|
|
2089
|
+
"\\$1"+"["+VALID_PUNCTUATION+"]*"+"(\\$\\d["+VALID_PUNCTUATION+"]*)*"+"$");
|
|
2090
|
+
// This is the minimum length of the leading digits of a phone number
|
|
2091
|
+
// to guarantee the first "leading digits pattern" for a phone number format
|
|
2092
|
+
// to be preemptive.
|
|
2093
|
+
var MIN_LEADING_DIGITS_LENGTH=3;var AsYouTypeFormatter=function(){function e(t){var r=t.metadata;_classCallCheck$2(this,e);this.metadata=r;this.resetFormat()}return _createClass$2(e,[{key:"resetFormat",value:function e(){this.chosenFormat=undefined;this.template=undefined;this.nationalNumberTemplate=undefined;this.populatedNationalNumberTemplate=undefined;this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function e(t,r){this.resetFormat();if(t){this.isNANP=t.callingCode()==="1";this.matchingFormats=t.formats();if(r.nationalSignificantNumber){this.narrowDownMatchingFormats(r)}}else{this.isNANP=undefined;this.matchingFormats=[]}}
|
|
2094
|
+
/**
|
|
2095
|
+
* Formats an updated phone number.
|
|
2096
|
+
* @param {string} nextDigits — Additional phone number digits.
|
|
2097
|
+
* @param {object} state — `AsYouType` state.
|
|
2098
|
+
* @return {[string]} Returns undefined if the updated phone number can't be formatted using any of the available formats.
|
|
2099
|
+
*/},{key:"format",value:function e(t,r){var n=this;
|
|
2100
|
+
// See if the phone number digits can be formatted as a complete phone number.
|
|
2101
|
+
// If not, use the results from `formatNationalNumberWithNextDigits()`,
|
|
2102
|
+
// which formats based on the chosen formatting pattern.
|
|
2103
|
+
|
|
2104
|
+
// Attempting to format complete phone number first is how it's done
|
|
2105
|
+
// in Google's `libphonenumber`, so this library just follows it.
|
|
2106
|
+
// Google's `libphonenumber` code doesn't explain in detail why does it
|
|
2107
|
+
// attempt to format digits as a complete phone number
|
|
2108
|
+
// instead of just going with a previoulsy (or newly) chosen `format`:
|
|
2109
|
+
|
|
2110
|
+
// "Checks to see if there is an exact pattern match for these digits.
|
|
2111
|
+
// If so, we should use this instead of any other formatting template
|
|
2112
|
+
// whose leadingDigitsPattern also matches the input."
|
|
2113
|
+
|
|
2114
|
+
if(canFormatCompleteNumber(r.nationalSignificantNumber,this.metadata)){for(var o=_createForOfIteratorHelperLoose(this.matchingFormats),i;!(i=o()).done;){var d=i.value;var s=formatCompleteNumber(r,d,{shouldTryNationalPrefixFormattingRule:function e(t){return n.shouldTryNationalPrefixFormattingRule(t,{international:r.international,nationalPrefix:r.nationalPrefix})},getSeparatorAfterNationalPrefix:function e(t){return n.getSeparatorAfterNationalPrefix(t)}});if(s){this.resetFormat();this.chosenFormat=d;this.setNationalNumberTemplate(s.replace(/\d/g,DIGIT_PLACEHOLDER),r);this.populatedNationalNumberTemplate=s;
|
|
2115
|
+
// With a new formatting template, the matched position
|
|
2116
|
+
// using the old template needs to be reset.
|
|
2117
|
+
this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(DIGIT_PLACEHOLDER);return s}}}
|
|
2118
|
+
// Format the digits as a partial (incomplete) phone number
|
|
2119
|
+
// using the previously chosen formatting pattern (or a newly chosen one).
|
|
2120
|
+
return this.formatNationalNumberWithNextDigits(t,r)}
|
|
2121
|
+
// Formats the next phone number digits.
|
|
2122
|
+
},{key:"formatNationalNumberWithNextDigits",value:function e(t,r){var n=this.chosenFormat;
|
|
2123
|
+
// Choose a format from the list of matching ones.
|
|
2124
|
+
var o=this.chooseFormat(r);if(o){if(o===n){
|
|
2125
|
+
// If it can format the next (current) digits
|
|
2126
|
+
// using the previously chosen phone number format
|
|
2127
|
+
// then return the updated formatted number.
|
|
2128
|
+
return this.formatNextNationalNumberDigits(t)}else{
|
|
2129
|
+
// If a more appropriate phone number format
|
|
2130
|
+
// has been chosen for these "leading digits",
|
|
2131
|
+
// then re-format the national phone number part
|
|
2132
|
+
// using the newly selected format.
|
|
2133
|
+
return this.formatNextNationalNumberDigits(r.getNationalDigits())}}}},{key:"narrowDownMatchingFormats",value:function e(t){var r=this;var n=t.nationalSignificantNumber,o=t.nationalPrefix,i=t.international;var d=n;
|
|
2134
|
+
// "leading digits" pattern list starts with a
|
|
2135
|
+
// "leading digits" pattern fitting a maximum of 3 leading digits.
|
|
2136
|
+
// So, after a user inputs 3 digits of a national (significant) phone number
|
|
2137
|
+
// this national (significant) number can already be formatted.
|
|
2138
|
+
// The next "leading digits" pattern is for 4 leading digits max,
|
|
2139
|
+
// and the "leading digits" pattern after it is for 5 leading digits max, etc.
|
|
2140
|
+
// This implementation is different from Google's
|
|
2141
|
+
// in that it searches for a fitting format
|
|
2142
|
+
// even if the user has entered less than
|
|
2143
|
+
// `MIN_LEADING_DIGITS_LENGTH` digits of a national number.
|
|
2144
|
+
// Because some leading digit patterns already match for a single first digit.
|
|
2145
|
+
var s=d.length-MIN_LEADING_DIGITS_LENGTH;if(s<0){s=0}this.matchingFormats=this.matchingFormats.filter((function(e){return r.formatSuits(e,i,o)&&r.formatMatches(e,d,s)}));
|
|
2146
|
+
// If there was a phone number format chosen
|
|
2147
|
+
// and it no longer holds given the new leading digits then reset it.
|
|
2148
|
+
// The test for this `if` condition is marked as:
|
|
2149
|
+
// "Reset a chosen format when it no longer holds given the new leading digits".
|
|
2150
|
+
// To construct a valid test case for this one can find a country
|
|
2151
|
+
// in `PhoneNumberMetadata.xml` yielding one format for 3 `<leadingDigits>`
|
|
2152
|
+
// and yielding another format for 4 `<leadingDigits>` (Australia in this case).
|
|
2153
|
+
if(this.chosenFormat&&this.matchingFormats.indexOf(this.chosenFormat)===-1){this.resetFormat()}}},{key:"formatSuits",value:function e(t,r,n){
|
|
2154
|
+
// When a prefix before a national (significant) number is
|
|
2155
|
+
// simply a national prefix, then it's parsed as `this.nationalPrefix`.
|
|
2156
|
+
// In more complex cases, a prefix before national (significant) number
|
|
2157
|
+
// could include a national prefix as well as some "capturing groups",
|
|
2158
|
+
// and in that case there's no info whether a national prefix has been parsed.
|
|
2159
|
+
// If national prefix is not used when formatting a phone number
|
|
2160
|
+
// using this format, but a national prefix has been entered by the user,
|
|
2161
|
+
// and was extracted, then discard such phone number format.
|
|
2162
|
+
// In Google's "AsYouType" formatter code, the equivalent would be this part:
|
|
2163
|
+
// https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L175-L184
|
|
2164
|
+
if(n&&!t.usesNationalPrefix()&&
|
|
2165
|
+
// !format.domesticCarrierCodeFormattingRule() &&
|
|
2166
|
+
!t.nationalPrefixIsOptionalWhenFormattingInNationalFormat()){return false}
|
|
2167
|
+
// If national prefix is mandatory for this phone number format
|
|
2168
|
+
// and there're no guarantees that a national prefix is present in user input
|
|
2169
|
+
// then discard this phone number format as not suitable.
|
|
2170
|
+
// In Google's "AsYouType" formatter code, the equivalent would be this part:
|
|
2171
|
+
// https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L185-L193
|
|
2172
|
+
if(!r&&!n&&t.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()){return false}return true}},{key:"formatMatches",value:function e(t,r,n){var o=t.leadingDigitsPatterns().length;
|
|
2173
|
+
// If this format is not restricted to a certain
|
|
2174
|
+
// leading digits pattern then it fits.
|
|
2175
|
+
// The test case could be found by searching for "leadingDigitsPatternsCount === 0".
|
|
2176
|
+
if(o===0){return true}
|
|
2177
|
+
// Start narrowing down the list of possible formats based on the leading digits.
|
|
2178
|
+
// (only previously matched formats take part in the narrowing down process)
|
|
2179
|
+
// `leading_digits_patterns` start with 3 digits min
|
|
2180
|
+
// and then go up from there one digit at a time.
|
|
2181
|
+
n=Math.min(n,o-1);var i=t.leadingDigitsPatterns()[n];
|
|
2182
|
+
// Google imposes a requirement on the leading digits
|
|
2183
|
+
// to be minimum 3 digits long in order to be eligible
|
|
2184
|
+
// for checking those with a leading digits pattern.
|
|
2185
|
+
|
|
2186
|
+
// Since `leading_digits_patterns` start with 3 digits min,
|
|
2187
|
+
// Google's original `libphonenumber` library only starts
|
|
2188
|
+
// excluding any non-matching formats only when the
|
|
2189
|
+
// national number entered so far is at least 3 digits long,
|
|
2190
|
+
// otherwise format matching would give false negatives.
|
|
2191
|
+
|
|
2192
|
+
// For example, when the digits entered so far are `2`
|
|
2193
|
+
// and the leading digits pattern is `21` –
|
|
2194
|
+
// it's quite obvious in this case that the format could be the one
|
|
2195
|
+
// but due to the absence of further digits it would give false negative.
|
|
2196
|
+
|
|
2197
|
+
// Also, `leading_digits_patterns` doesn't always correspond to a single
|
|
2198
|
+
// digits count. For example, `60|8` pattern would already match `8`
|
|
2199
|
+
// but the `60` part would require having at least two leading digits,
|
|
2200
|
+
// so the whole pattern would require inputting two digits first in order to
|
|
2201
|
+
// decide on whether it matches the input, even when the input is "80".
|
|
2202
|
+
|
|
2203
|
+
// This library — `libphonenumber-js` — allows filtering by `leading_digits_patterns`
|
|
2204
|
+
// even when there's only 1 or 2 digits of the national (significant) number.
|
|
2205
|
+
// To do that, it uses a non-strict pattern matcher written specifically for that.
|
|
2206
|
+
|
|
2207
|
+
if(r.length<MIN_LEADING_DIGITS_LENGTH){
|
|
2208
|
+
// Before leading digits < 3 matching was implemented:
|
|
2209
|
+
// return true
|
|
2210
|
+
// After leading digits < 3 matching was implemented:
|
|
2211
|
+
try{return new PatternMatcher(i).match(r,{allowOverflow:true})!==undefined}catch(e){
|
|
2212
|
+
// There's a slight possibility that there could be some undiscovered bug
|
|
2213
|
+
// in the pattern matcher code. Since the "leading digits < 3 matching"
|
|
2214
|
+
// feature is not "essential" for operation, it can fall back to the old way
|
|
2215
|
+
// in case of any issues rather than halting the application's execution.
|
|
2216
|
+
console.error(e);return true}}
|
|
2217
|
+
// If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are
|
|
2218
|
+
// available then use the usual regular expression matching.
|
|
2219
|
+
|
|
2220
|
+
// The whole pattern is wrapped in round brackets (`()`) because
|
|
2221
|
+
// the pattern can use "or" operator (`|`) at the top level of the pattern.
|
|
2222
|
+
|
|
2223
|
+
return new RegExp("^(".concat(i,")")).test(r)}},{key:"getFormatFormat",value:function e(t,r){return r?t.internationalFormat():t.format()}},{key:"chooseFormat",value:function e(t){var r=this;var n=function e(){var n=d.value;
|
|
2224
|
+
// If this format is currently being used
|
|
2225
|
+
// and is still suitable, then stick to it.
|
|
2226
|
+
if(r.chosenFormat===n){return 0;// break
|
|
2227
|
+
}
|
|
2228
|
+
// Sometimes, a formatting rule inserts additional digits in a phone number,
|
|
2229
|
+
// and "as you type" formatter can't do that: it should only use the digits
|
|
2230
|
+
// that the user has input.
|
|
2231
|
+
|
|
2232
|
+
// For example, in Argentina, there's a format for mobile phone numbers:
|
|
2233
|
+
|
|
2234
|
+
// {
|
|
2235
|
+
// "pattern": "(\\d)(\\d{2})(\\d{4})(\\d{4})",
|
|
2236
|
+
// "leading_digits_patterns": ["91"],
|
|
2237
|
+
// "national_prefix_formatting_rule": "0$1",
|
|
2238
|
+
// "format": "$2 15-$3-$4",
|
|
2239
|
+
// "international_format": "$1 $2 $3-$4"
|
|
2240
|
+
// }
|
|
2241
|
+
|
|
2242
|
+
// In that format, `international_format` is used instead of `format`
|
|
2243
|
+
// because `format` inserts `15` in the formatted number,
|
|
2244
|
+
// and `AsYouType` formatter should only use the digits
|
|
2245
|
+
// the user has actually input, without adding any extra digits.
|
|
2246
|
+
// In this case, it wouldn't make a difference, because the `15`
|
|
2247
|
+
// is first stripped when applying `national_prefix_for_parsing`
|
|
2248
|
+
// and then re-added when using `format`, so in reality it doesn't
|
|
2249
|
+
// add any new digits to the number, but to detect that, the code
|
|
2250
|
+
// would have to be more complex: it would have to try formatting
|
|
2251
|
+
// the digits using the format and then see if any digits have
|
|
2252
|
+
// actually been added or removed, and then, every time a new digit
|
|
2253
|
+
// is input, it should re-check whether the chosen format doesn't
|
|
2254
|
+
// alter the digits.
|
|
2255
|
+
|
|
2256
|
+
// Google's code doesn't go that far, and so does this library:
|
|
2257
|
+
// it simply requires that a `format` doesn't add any additonal
|
|
2258
|
+
// digits to user's input.
|
|
2259
|
+
|
|
2260
|
+
// Also, people in general should move from inputting phone numbers
|
|
2261
|
+
// in national format (possibly with national prefixes)
|
|
2262
|
+
// and use international phone number format instead:
|
|
2263
|
+
// it's a logical thing in the modern age of mobile phones,
|
|
2264
|
+
// globalization and the internet.
|
|
2265
|
+
|
|
2266
|
+
/* istanbul ignore if */if(!NON_ALTERING_FORMAT_REG_EXP.test(r.getFormatFormat(n,t.international))){return 1;// continue
|
|
2267
|
+
}if(!r.createTemplateForFormat(n,t)){
|
|
2268
|
+
// Remove the format if it can't generate a template.
|
|
2269
|
+
r.matchingFormats=r.matchingFormats.filter((function(e){return e!==n}));return 1;// continue
|
|
2270
|
+
}r.chosenFormat=n;return 0;// break
|
|
2271
|
+
},o;
|
|
2272
|
+
// When there are multiple available formats, the formatter uses the first
|
|
2273
|
+
// format where a formatting template could be created.
|
|
2274
|
+
|
|
2275
|
+
// For some weird reason, `istanbul` says "else path not taken"
|
|
2276
|
+
// for the `for of` line below. Supposedly that means that
|
|
2277
|
+
// the loop doesn't ever go over the last element in the list.
|
|
2278
|
+
// That's true because there always is `this.chosenFormat`
|
|
2279
|
+
// when `this.matchingFormats` is non-empty.
|
|
2280
|
+
// And, for some weird reason, it doesn't think that the case
|
|
2281
|
+
// with empty `this.matchingFormats` qualifies for a valid "else" path.
|
|
2282
|
+
// So simply muting this `istanbul` warning.
|
|
2283
|
+
// It doesn't skip the contents of the `for of` loop,
|
|
2284
|
+
// it just skips the `for of` line.
|
|
2285
|
+
|
|
2286
|
+
/* istanbul ignore next */for(var i=_createForOfIteratorHelperLoose(this.matchingFormats.slice()),d;!(d=i()).done;){o=n();if(o===0)break;if(o===1)continue}if(!this.chosenFormat){
|
|
2287
|
+
// No format matches the national (significant) phone number.
|
|
2288
|
+
this.resetFormat()}return this.chosenFormat}},{key:"createTemplateForFormat",value:function e(t,r){
|
|
2289
|
+
// The formatter doesn't format numbers when numberPattern contains '|', e.g.
|
|
2290
|
+
// (20|3)\d{4}. In those cases we quickly return.
|
|
2291
|
+
// (Though there's no such format in current metadata)
|
|
2292
|
+
/* istanbul ignore if */
|
|
2293
|
+
if(t.pattern().indexOf("|")>=0){return}
|
|
2294
|
+
// Get formatting template for this phone number format
|
|
2295
|
+
var n=this.getTemplateForFormat(t,r);
|
|
2296
|
+
// If the national number entered is too long
|
|
2297
|
+
// for any phone number format, then abort.
|
|
2298
|
+
if(n){this.setNationalNumberTemplate(n,r);return true}}},{key:"getSeparatorAfterNationalPrefix",value:function e(t){
|
|
2299
|
+
// `US` metadata doesn't have a `national_prefix_formatting_rule`,
|
|
2300
|
+
// so the `if` condition below doesn't apply to `US`,
|
|
2301
|
+
// but in reality there shoudl be a separator
|
|
2302
|
+
// between a national prefix and a national (significant) number.
|
|
2303
|
+
// So `US` national prefix separator is a "special" "hardcoded" case.
|
|
2304
|
+
if(this.isNANP){return" "}
|
|
2305
|
+
// If a `format` has a `national_prefix_formatting_rule`
|
|
2306
|
+
// and that rule has a separator after a national prefix,
|
|
2307
|
+
// then it means that there should be a separator
|
|
2308
|
+
// between a national prefix and a national (significant) number.
|
|
2309
|
+
if(t&&t.nationalPrefixFormattingRule()&&NATIONAL_PREFIX_SEPARATORS_PATTERN.test(t.nationalPrefixFormattingRule())){return" "}
|
|
2310
|
+
// At this point, there seems to be no clear evidence that
|
|
2311
|
+
// there should be a separator between a national prefix
|
|
2312
|
+
// and a national (significant) number. So don't insert one.
|
|
2313
|
+
return""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function e(t,r){var n=t.IDDPrefix,o=t.missingPlus;if(n){return r&&r.spacing===false?n:n+" "}if(o){return""}return"+"}},{key:"getTemplate",value:function e(t){if(!this.template){return}
|
|
2314
|
+
// `this.template` holds the template for a "complete" phone number.
|
|
2315
|
+
// The currently entered phone number is most likely not "complete",
|
|
2316
|
+
// so trim all non-populated digits.
|
|
2317
|
+
var r=-1;var n=0;var o=t.international?this.getInternationalPrefixBeforeCountryCallingCode(t,{spacing:false}):"";while(n<o.length+t.getDigitsWithoutInternationalPrefix().length){r=this.template.indexOf(DIGIT_PLACEHOLDER,r+1);n++}return cutAndStripNonPairedParens(this.template,r+1)}},{key:"setNationalNumberTemplate",value:function e(t,r){this.nationalNumberTemplate=t;this.populatedNationalNumberTemplate=t;
|
|
2318
|
+
// With a new formatting template, the matched position
|
|
2319
|
+
// using the old template needs to be reset.
|
|
2320
|
+
this.populatedNationalNumberTemplatePosition=-1;
|
|
2321
|
+
// For convenience, the public `.template` property
|
|
2322
|
+
// contains the whole international number
|
|
2323
|
+
// if the phone number being input is international:
|
|
2324
|
+
// 'x' for the '+' sign, 'x'es for the country phone code,
|
|
2325
|
+
// a spacebar and then the template for the formatted national number.
|
|
2326
|
+
if(r.international){this.template=this.getInternationalPrefixBeforeCountryCallingCode(r).replace(/[\d\+]/g,DIGIT_PLACEHOLDER)+repeat(DIGIT_PLACEHOLDER,r.callingCode.length)+" "+t}else{this.template=t}}
|
|
2327
|
+
/**
|
|
2328
|
+
* Generates formatting template for a national phone number,
|
|
2329
|
+
* optionally containing a national prefix, for a format.
|
|
2330
|
+
* @param {Format} format
|
|
2331
|
+
* @param {string} nationalPrefix
|
|
2332
|
+
* @return {string}
|
|
2333
|
+
*/},{key:"getTemplateForFormat",value:function e(t,r){var n=r.nationalSignificantNumber,o=r.international,i=r.nationalPrefix,d=r.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix;var s=t.pattern();
|
|
2334
|
+
/* istanbul ignore else */{s=s.replace(CREATE_CHARACTER_CLASS_PATTERN(),"\\d").replace(CREATE_STANDALONE_DIGIT_PATTERN(),"\\d")}
|
|
2335
|
+
// Generate a dummy national number (consisting of `9`s)
|
|
2336
|
+
// that fits this format's `pattern`.
|
|
2337
|
+
|
|
2338
|
+
// This match will always succeed,
|
|
2339
|
+
// because the "longest dummy phone number"
|
|
2340
|
+
// has enough length to accomodate any possible
|
|
2341
|
+
// national phone number format pattern.
|
|
2342
|
+
|
|
2343
|
+
var a=LONGEST_DUMMY_PHONE_NUMBER.match(s)[0];
|
|
2344
|
+
// If the national number entered is too long
|
|
2345
|
+
// for any phone number format, then abort.
|
|
2346
|
+
if(n.length>a.length){return}
|
|
2347
|
+
// Get a formatting template which can be used to efficiently format
|
|
2348
|
+
// a partial number where digits are added one by one.
|
|
2349
|
+
// Below `strictPattern` is used for the
|
|
2350
|
+
// regular expression (with `^` and `$`).
|
|
2351
|
+
// This wasn't originally in Google's `libphonenumber`
|
|
2352
|
+
// and I guess they don't really need it
|
|
2353
|
+
// because they're not using "templates" to format phone numbers
|
|
2354
|
+
// but I added `strictPattern` after encountering
|
|
2355
|
+
// South Korean phone number formatting bug.
|
|
2356
|
+
|
|
2357
|
+
// Non-strict regular expression bug demonstration:
|
|
2358
|
+
|
|
2359
|
+
// this.nationalSignificantNumber : `111111111` (9 digits)
|
|
2360
|
+
|
|
2361
|
+
// pattern : (\d{2})(\d{3,4})(\d{4})
|
|
2362
|
+
// format : `$1 $2 $3`
|
|
2363
|
+
// digits : `9999999999` (10 digits)
|
|
2364
|
+
|
|
2365
|
+
// '9999999999'.replace(new RegExp(/(\d{2})(\d{3,4})(\d{4})/g), '$1 $2 $3') = "99 9999 9999"
|
|
2366
|
+
|
|
2367
|
+
// template : xx xxxx xxxx
|
|
2368
|
+
|
|
2369
|
+
// But the correct template in this case is `xx xxx xxxx`.
|
|
2370
|
+
// The template was generated incorrectly because of the
|
|
2371
|
+
// `{3,4}` variability in the `pattern`.
|
|
2372
|
+
|
|
2373
|
+
// The fix is, if `this.nationalSignificantNumber` has already sufficient length
|
|
2374
|
+
// to satisfy the `pattern` completely then `this.nationalSignificantNumber`
|
|
2375
|
+
// is used instead of `digits`.
|
|
2376
|
+
var u=new RegExp("^"+s+"$");var l=n.replace(/\d/g,DUMMY_DIGIT);
|
|
2377
|
+
// If `this.nationalSignificantNumber` has already sufficient length
|
|
2378
|
+
// to satisfy the `pattern` completely then use it
|
|
2379
|
+
// instead of `digits`.
|
|
2380
|
+
if(u.test(l)){a=l}var $=this.getFormatFormat(t,o);var c;
|
|
2381
|
+
// If a user did input a national prefix (and that's guaranteed),
|
|
2382
|
+
// and if a `format` does have a national prefix formatting rule,
|
|
2383
|
+
// then see if that national prefix formatting rule
|
|
2384
|
+
// prepends exactly the same national prefix the user has input.
|
|
2385
|
+
// If that's the case, then use the `format` with the national prefix formatting rule.
|
|
2386
|
+
// Otherwise, use the `format` without the national prefix formatting rule,
|
|
2387
|
+
// and prepend a national prefix manually to it.
|
|
2388
|
+
if(this.shouldTryNationalPrefixFormattingRule(t,{international:o,nationalPrefix:i})){var f=$.replace(FIRST_GROUP_PATTERN,t.nationalPrefixFormattingRule());
|
|
2389
|
+
// If `national_prefix_formatting_rule` of a `format` simply prepends
|
|
2390
|
+
// national prefix at the start of a national (significant) number,
|
|
2391
|
+
// then such formatting can be used with `AsYouType` formatter.
|
|
2392
|
+
// There seems to be no `else` case: everywhere in metadata,
|
|
2393
|
+
// national prefix formatting rule is national prefix + $1,
|
|
2394
|
+
// or `($1)`, in which case such format isn't even considered
|
|
2395
|
+
// when the user has input a national prefix.
|
|
2396
|
+
/* istanbul ignore else */if(parseDigits(t.nationalPrefixFormattingRule())===(i||"")+parseDigits("$1")){$=f;c=true;
|
|
2397
|
+
// Replace all digits of the national prefix in the formatting template
|
|
2398
|
+
// with `DIGIT_PLACEHOLDER`s.
|
|
2399
|
+
if(i){var h=i.length;while(h>0){$=$.replace(/\d/,DIGIT_PLACEHOLDER);h--}}}}
|
|
2400
|
+
// Generate formatting template for this phone number format.
|
|
2401
|
+
var p=a.replace(new RegExp(s),$).replace(new RegExp(DUMMY_DIGIT,"g"),DIGIT_PLACEHOLDER);
|
|
2402
|
+
// If a prefix of a national (significant) number is not as simple
|
|
2403
|
+
// as just a basic national prefix, then just prepend such prefix
|
|
2404
|
+
// before the national (significant) number, optionally spacing
|
|
2405
|
+
// the two with a whitespace.
|
|
2406
|
+
if(!c){if(d){
|
|
2407
|
+
// Prepend the prefix to the template manually.
|
|
2408
|
+
p=repeat(DIGIT_PLACEHOLDER,d.length)+" "+p}else if(i){
|
|
2409
|
+
// Prepend national prefix to the template manually.
|
|
2410
|
+
p=repeat(DIGIT_PLACEHOLDER,i.length)+this.getSeparatorAfterNationalPrefix(t)+p}}if(o){p=applyInternationalSeparatorStyle(p)}return p}},{key:"formatNextNationalNumberDigits",value:function e(t){var r=populateTemplateWithDigits(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,t);if(!r){
|
|
2411
|
+
// Reset the format.
|
|
2412
|
+
this.resetFormat();return}this.populatedNationalNumberTemplate=r[0];this.populatedNationalNumberTemplatePosition=r[1];
|
|
2413
|
+
// Return the formatted phone number so far.
|
|
2414
|
+
return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);
|
|
2415
|
+
// The old way which was good for `input-format` but is not so good
|
|
2416
|
+
// for `react-phone-number-input`'s default input (`InputBasic`).
|
|
2417
|
+
// return closeNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1)
|
|
2418
|
+
// .replace(new RegExp(DIGIT_PLACEHOLDER, 'g'), ' ')
|
|
2419
|
+
}},{key:"shouldTryNationalPrefixFormattingRule",value:function e(t,r){var n=r.international,o=r.nationalPrefix;if(t.nationalPrefixFormattingRule()){
|
|
2420
|
+
// In some countries, `national_prefix_formatting_rule` is `($1)`,
|
|
2421
|
+
// so it applies even if the user hasn't input a national prefix.
|
|
2422
|
+
// `format.usesNationalPrefix()` detects such cases.
|
|
2423
|
+
var i=t.usesNationalPrefix();if(i&&o||!i&&!n){return true}}}}])}();function _typeof$1(e){"@babel/helpers - typeof";return _typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof$1(e)}function _slicedToArray$1(e,t){return _arrayWithHoles$1(e)||_iterableToArrayLimit$1(e,t)||_unsupportedIterableToArray$1(e,t)||_nonIterableRest$1()}function _nonIterableRest$1(){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 _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit$1(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,d,s=[],a=true,u=false;try{if(i=(r=r.call(e)).next,0===t);else for(;!(a=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);a=true);}catch(e){u=true,o=e}finally{try{if(!a&&null!=r["return"]&&(d=r["return"](),Object(d)!==d))return}finally{if(u)throw o}}return s}}function _arrayWithHoles$1(e){if(Array.isArray(e))return e}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function _toPropertyKey$1(e){var t=_toPrimitive$1(e,"string");return"symbol"==_typeof$1(t)?t:t+""}function _toPrimitive$1(e,t){if("object"!=_typeof$1(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART="["+VALID_PUNCTUATION+VALID_DIGITS+"]+";var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN=new RegExp("^"+VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART+"$","i");var VALID_FORMATTED_PHONE_NUMBER_PART="(?:"+"["+PLUS_CHARS+"]"+"["+VALID_PUNCTUATION+VALID_DIGITS+"]*"+"|"+"["+VALID_PUNCTUATION+VALID_DIGITS+"]+"+")";var AFTER_PHONE_NUMBER_DIGITS_END_PATTERN=new RegExp("[^"+VALID_PUNCTUATION+VALID_DIGITS+"]+"+".*"+"$");
|
|
2424
|
+
// Tests whether `national_prefix_for_parsing` could match
|
|
2425
|
+
// different national prefixes.
|
|
2426
|
+
// Matches anything that's not a digit or a square bracket.
|
|
2427
|
+
var COMPLEX_NATIONAL_PREFIX=/[^\d\[\]]/;var AsYouTypeParser=function(){function e(t){var r=t.defaultCountry,n=t.defaultCallingCode,o=t.metadata,i=t.onNationalSignificantNumberChange;_classCallCheck$1(this,e);this.defaultCountry=r;this.defaultCallingCode=n;this.metadata=o;this.onNationalSignificantNumberChange=i}return _createClass$1(e,[{key:"input",value:function e(t,r){var n=extractFormattedDigitsAndPlus(t),o=_slicedToArray$1(n,2),i=o[0],d=o[1];var s=parseDigits(i);
|
|
2428
|
+
// Checks for a special case: just a leading `+` has been entered.
|
|
2429
|
+
var a;if(d){if(!r.digits){r.startInternationalNumber(undefined,undefined);if(!s){a=true}}}if(s){this.inputDigits(s,r)}return{digits:s,justLeadingPlus:a}}
|
|
2430
|
+
/**
|
|
2431
|
+
* Inputs "next" phone number digits.
|
|
2432
|
+
* @param {string} digits
|
|
2433
|
+
* @return {string} [formattedNumber] Formatted national phone number (if it can be formatted at this stage). Returning `undefined` means "don't format the national phone number at this stage".
|
|
2434
|
+
*/},{key:"inputDigits",value:function e(t,r){var n=r.digits;var o=n.length<3&&n.length+t.length>=3;
|
|
2435
|
+
// Append phone number digits.
|
|
2436
|
+
r.appendDigits(t);
|
|
2437
|
+
// Attempt to extract IDD prefix:
|
|
2438
|
+
// Some users input their phone number in international format,
|
|
2439
|
+
// but in an "out-of-country" dialing format instead of using the leading `+`.
|
|
2440
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/185
|
|
2441
|
+
// Detect such numbers as soon as there're at least 3 digits.
|
|
2442
|
+
// Google's library attempts to extract IDD prefix at 3 digits,
|
|
2443
|
+
// so this library just copies that behavior.
|
|
2444
|
+
// I guess that's because the most commot IDD prefixes are
|
|
2445
|
+
// `00` (Europe) and `011` (US).
|
|
2446
|
+
// There exist really long IDD prefixes too:
|
|
2447
|
+
// for example, in Australia the default IDD prefix is `0011`,
|
|
2448
|
+
// and it could even be as long as `14880011`.
|
|
2449
|
+
// An IDD prefix is extracted here, and then every time when
|
|
2450
|
+
// there's a new digit and the number couldn't be formatted.
|
|
2451
|
+
if(o){this.extractIddPrefix(r)}if(this.isWaitingForCountryCallingCode(r)){if(!this.extractCountryCallingCode(r)){return}}else{r.appendNationalSignificantNumberDigits(t)}
|
|
2452
|
+
// If a phone number is being input in international format,
|
|
2453
|
+
// then it's not valid for it to have a national prefix.
|
|
2454
|
+
// Still, some people incorrectly input such numbers with a national prefix.
|
|
2455
|
+
// In such cases, only attempt to strip a national prefix if the number becomes too long.
|
|
2456
|
+
// (but that is done later, not here)
|
|
2457
|
+
if(!r.international){if(!this.hasExtractedNationalSignificantNumber){this.extractNationalSignificantNumber(r.getNationalDigits(),(function(e){return r.update(e)}))}}}},{key:"isWaitingForCountryCallingCode",value:function e(t){var r=t.international,n=t.callingCode;return r&&!n}
|
|
2458
|
+
// Extracts a country calling code from a number
|
|
2459
|
+
// being entered in internatonal format.
|
|
2460
|
+
},{key:"extractCountryCallingCode",value:function e(t){var r=extractCountryCallingCode("+"+t.getDigitsWithoutInternationalPrefix(),t.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=r.countryCallingCode,o=r.number;if(n){t.setCallingCode(n);t.update({nationalSignificantNumber:o});return true}}},{key:"reset",value:function e(t){if(t){this.hasSelectedNumberingPlan=true;var r=t._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=r&&COMPLEX_NATIONAL_PREFIX.test(r)}else{this.hasSelectedNumberingPlan=undefined;this.couldPossiblyExtractAnotherNationalSignificantNumber=undefined}}
|
|
2461
|
+
/**
|
|
2462
|
+
* Extracts a national (significant) number from user input.
|
|
2463
|
+
* Google's library is different in that it only applies `national_prefix_for_parsing`
|
|
2464
|
+
* and doesn't apply `national_prefix_transform_rule` after that.
|
|
2465
|
+
* https://github.com/google/libphonenumber/blob/a3d70b0487875475e6ad659af404943211d26456/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L539
|
|
2466
|
+
* @return {boolean} [extracted]
|
|
2467
|
+
*/},{key:"extractNationalSignificantNumber",value:function e(t,r){if(!this.hasSelectedNumberingPlan){return}var n=extractNationalNumberFromPossiblyIncompleteNumber(t,this.metadata),o=n.nationalPrefix,i=n.nationalNumber,d=n.carrierCode;if(i===t){return}this.onExtractedNationalNumber(o,d,i,t,r);return true}
|
|
2468
|
+
/**
|
|
2469
|
+
* In Google's code this function is called "attempt to extract longer NDD".
|
|
2470
|
+
* "Some national prefixes are a substring of others", they say.
|
|
2471
|
+
* @return {boolean} [result] — Returns `true` if extracting a national prefix produced different results from what they were.
|
|
2472
|
+
*/},{key:"extractAnotherNationalSignificantNumber",value:function e(t,r,n){if(!this.hasExtractedNationalSignificantNumber){return this.extractNationalSignificantNumber(t,n)}if(!this.couldPossiblyExtractAnotherNationalSignificantNumber){return}var o=extractNationalNumberFromPossiblyIncompleteNumber(t,this.metadata),i=o.nationalPrefix,d=o.nationalNumber,s=o.carrierCode;
|
|
2473
|
+
// If a national prefix has been extracted previously,
|
|
2474
|
+
// then it's always extracted as additional digits are added.
|
|
2475
|
+
// That's assuming `extractNationalNumberFromPossiblyIncompleteNumber()`
|
|
2476
|
+
// doesn't do anything different from what it currently does.
|
|
2477
|
+
// So, just in case, here's this check, though it doesn't occur.
|
|
2478
|
+
/* istanbul ignore if */if(d===r){return}this.onExtractedNationalNumber(i,s,d,t,n);return true}},{key:"onExtractedNationalNumber",value:function e(t,r,n,o,i){
|
|
2479
|
+
// Tells if the parsed national (significant) number is present as-is in the input string.
|
|
2480
|
+
// For example, when inputting "0343515551212999" Argentinian mobile number,
|
|
2481
|
+
// the parsed national (significant) number is "93435551212999".
|
|
2482
|
+
// There, one can see how it stripped "0" national prefix and prepended a "9",
|
|
2483
|
+
// because that's how it is instructed to do in Argentina's metadata.
|
|
2484
|
+
// So in the described example, the parsed national (significant) number is not present
|
|
2485
|
+
// as-is in the input string. Instead, it's "modified" in the input string.
|
|
2486
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
2487
|
+
var d=false;
|
|
2488
|
+
// In some countries, a phone number could have a prefix that is not a "national prefix"
|
|
2489
|
+
// but rather some other type of "utility" prefix.
|
|
2490
|
+
// For example, when calling within Australia, one could prepend `1831` prefix to hide
|
|
2491
|
+
// caller's phone number.
|
|
2492
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
2493
|
+
var s;
|
|
2494
|
+
// `nationalSignificantNumber` could be empty. In that case, `.lastIndexOf()` still works correctly.
|
|
2495
|
+
var a=o.lastIndexOf(n);
|
|
2496
|
+
// If the parsed national (significant) number is the last substring of the `nationalDigits`,
|
|
2497
|
+
// then it means that it's present as-is in the input string.
|
|
2498
|
+
// In any other case, the parsed national (significant) number is "modified" in the input string.
|
|
2499
|
+
if(a<0||a!==o.length-n.length){d=true}else{var u=o.slice(0,a);
|
|
2500
|
+
// When national (significant) number is equal to the `nationalDigits`,
|
|
2501
|
+
// this `onExtractedNationalNumber()` function simply doesn't get called.
|
|
2502
|
+
// This means that at this point, `prefixBeforeNationalNumber` is always non-empty.
|
|
2503
|
+
// Still, added this `if` check just to prevent potential silly bugs.
|
|
2504
|
+
// The `!prefixBeforeNationalNumber` case is not really testable
|
|
2505
|
+
// so this line is exluded from the code coverage.
|
|
2506
|
+
/* istanbul ignore if */if(u){if(u!==t){s=u}}}i({nationalPrefix:t,carrierCode:r,nationalSignificantNumber:n,nationalSignificantNumberIsModified:d,prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix:s});
|
|
2507
|
+
// `onExtractedNationalNumber()` is only called when
|
|
2508
|
+
// the national (significant) number actually did change.
|
|
2509
|
+
this.hasExtractedNationalSignificantNumber=true;this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function e(t){
|
|
2510
|
+
// Attempt to extract a national prefix.
|
|
2511
|
+
// Some people incorrectly input national prefix
|
|
2512
|
+
// in an international phone number.
|
|
2513
|
+
// For example, some people write British phone numbers as `+44(0)...`.
|
|
2514
|
+
// Also, in some rare cases, it is valid for a national prefix
|
|
2515
|
+
// to be a part of an international phone number.
|
|
2516
|
+
// For example, mobile phone numbers in Mexico are supposed to be
|
|
2517
|
+
// dialled internationally using a `1` national prefix,
|
|
2518
|
+
// so the national prefix will be part of an international number.
|
|
2519
|
+
// Quote from:
|
|
2520
|
+
// https://www.mexperience.com/dialing-cell-phones-in-mexico/
|
|
2521
|
+
// "Dialing a Mexican cell phone from abroad
|
|
2522
|
+
// When you are calling a cell phone number in Mexico from outside Mexico,
|
|
2523
|
+
// it’s necessary to dial an additional “1” after Mexico’s country code
|
|
2524
|
+
// (which is “52”) and before the area code.
|
|
2525
|
+
// You also ignore the 045, and simply dial the area code and the
|
|
2526
|
+
// cell phone’s number.
|
|
2527
|
+
// If you don’t add the “1”, you’ll receive a recorded announcement
|
|
2528
|
+
// asking you to redial using it.
|
|
2529
|
+
// For example, if you are calling from the USA to a cell phone
|
|
2530
|
+
// in Mexico City, you would dial +52 – 1 – 55 – 1234 5678.
|
|
2531
|
+
// (Note that this is different to calling a land line in Mexico City
|
|
2532
|
+
// from abroad, where the number dialed would be +52 – 55 – 1234 5678)".
|
|
2533
|
+
// Google's demo output:
|
|
2534
|
+
// https://libphonenumber.appspot.com/phonenumberparser?number=%2b5215512345678&country=MX
|
|
2535
|
+
if(this.extractAnotherNationalSignificantNumber(t.getNationalDigits(),t.nationalSignificantNumber,(function(e){return t.update(e)}))){return true}
|
|
2536
|
+
// If no format matches the phone number, then it could be
|
|
2537
|
+
// "a really long IDD" (quote from a comment in Google's library).
|
|
2538
|
+
// An IDD prefix is first extracted when the user has entered at least 3 digits,
|
|
2539
|
+
// and then here — every time when there's a new digit and the number
|
|
2540
|
+
// couldn't be formatted.
|
|
2541
|
+
// For example, in Australia the default IDD prefix is `0011`,
|
|
2542
|
+
// and it could even be as long as `14880011`.
|
|
2543
|
+
|
|
2544
|
+
// Could also check `!hasReceivedThreeLeadingDigits` here
|
|
2545
|
+
// to filter out the case when this check duplicates the one
|
|
2546
|
+
// already performed when there're 3 leading digits,
|
|
2547
|
+
// but it's not a big deal, and in most cases there
|
|
2548
|
+
// will be a suitable `format` when there're 3 leading digits.
|
|
2549
|
+
|
|
2550
|
+
if(this.extractIddPrefix(t)){this.extractCallingCodeAndNationalSignificantNumber(t);return true}
|
|
2551
|
+
// Google's AsYouType formatter supports sort of an "autocorrection" feature
|
|
2552
|
+
// when it "autocorrects" numbers that have been input for a country
|
|
2553
|
+
// with that country's calling code.
|
|
2554
|
+
// Such "autocorrection" feature looks weird, but different people have been requesting it:
|
|
2555
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
2556
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/375
|
|
2557
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/316
|
|
2558
|
+
if(this.fixMissingPlus(t)){this.extractCallingCodeAndNationalSignificantNumber(t);return true}}},{key:"extractIddPrefix",value:function e(t){
|
|
2559
|
+
// An IDD prefix can't be present in a number written with a `+`.
|
|
2560
|
+
// Also, don't re-extract an IDD prefix if has already been extracted.
|
|
2561
|
+
var r=t.international,n=t.IDDPrefix,o=t.digits;if(r||n){return}
|
|
2562
|
+
// Some users input their phone number in "out-of-country"
|
|
2563
|
+
// dialing format instead of using the leading `+`.
|
|
2564
|
+
// https://github.com/catamphetamine/libphonenumber-js/issues/185
|
|
2565
|
+
// Detect such numbers.
|
|
2566
|
+
var i=stripIddPrefix(o,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);if(i!==undefined&&i!==o){
|
|
2567
|
+
// If an IDD prefix was stripped then convert the IDD-prefixed number
|
|
2568
|
+
// to international number for subsequent parsing.
|
|
2569
|
+
t.update({IDDPrefix:o.slice(0,o.length-i.length)});this.startInternationalNumber(t,{country:undefined,callingCode:undefined});return true}}},{key:"fixMissingPlus",value:function e(t){if(!t.international){var r=extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(t.digits,t.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=r.countryCallingCode;if(n){t.update({missingPlus:true});this.startInternationalNumber(t,{country:t.country,callingCode:n});return true}}}},{key:"startInternationalNumber",value:function e(t,r){var n=r.country,o=r.callingCode;t.startInternationalNumber(n,o);
|
|
2570
|
+
// If a national (significant) number has been extracted before, reset it.
|
|
2571
|
+
if(t.nationalSignificantNumber){t.resetNationalSignificantNumber();this.onNationalSignificantNumberChange();this.hasExtractedNationalSignificantNumber=undefined}}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function e(t){if(this.extractCountryCallingCode(t)){
|
|
2572
|
+
// `this.extractCallingCode()` is currently called when the number
|
|
2573
|
+
// couldn't be formatted during the standard procedure.
|
|
2574
|
+
// Normally, the national prefix would be re-extracted
|
|
2575
|
+
// for an international number if such number couldn't be formatted,
|
|
2576
|
+
// but since it's already not able to be formatted,
|
|
2577
|
+
// there won't be yet another retry, so also extract national prefix here.
|
|
2578
|
+
this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}}}])}();function extractFormattedPhoneNumber(e){
|
|
2579
|
+
// Attempt to extract a possible number from the string passed in.
|
|
2580
|
+
var t=e.search(VALID_FORMATTED_PHONE_NUMBER_PART);if(t<0){return}
|
|
2581
|
+
// Trim everything to the left of the phone number.
|
|
2582
|
+
e=e.slice(t);
|
|
2583
|
+
// Trim the `+`.
|
|
2584
|
+
var r;if(e[0]==="+"){r=true;e=e.slice("+".length)}
|
|
2585
|
+
// Trim everything to the right of the phone number.
|
|
2586
|
+
e=e.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN,"");
|
|
2587
|
+
// Re-add the previously trimmed `+`.
|
|
2588
|
+
if(r){e="+"+e}return e}
|
|
2589
|
+
/**
|
|
2590
|
+
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
2591
|
+
* @param {string} text
|
|
2592
|
+
* @return {any[]}
|
|
2593
|
+
*/function _extractFormattedDigitsAndPlus(e){
|
|
2594
|
+
// Extract a formatted phone number part from text.
|
|
2595
|
+
var t=extractFormattedPhoneNumber(e)||"";
|
|
2596
|
+
// Trim a `+`.
|
|
2597
|
+
if(t[0]==="+"){return[t.slice("+".length),true]}return[t]}
|
|
2598
|
+
/**
|
|
2599
|
+
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
2600
|
+
* @param {string} text
|
|
2601
|
+
* @return {any[]}
|
|
2602
|
+
*/function extractFormattedDigitsAndPlus(e){var t=_extractFormattedDigitsAndPlus(e),r=_slicedToArray$1(t,2),n=r[0],o=r[1];
|
|
2603
|
+
// If the extracted phone number part
|
|
2604
|
+
// can possibly be a part of some valid phone number
|
|
2605
|
+
// then parse phone number characters from a formatted phone number.
|
|
2606
|
+
if(!VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN.test(n)){n=""}return[n,o]}function _typeof(e){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,d,s=[],a=true,u=false;try{if(i=(r=r.call(e)).next,0===t);else for(;!(a=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);a=true);}catch(e){u=true,o=e}finally{try{if(!a&&null!=r["return"]&&(d=r["return"](),Object(d)!==d))return}finally{if(u)throw o}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var AsYouType$1=function(){
|
|
2607
|
+
/**
|
|
2608
|
+
* @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.
|
|
2609
|
+
* @param {Object} metadata
|
|
2610
|
+
*/
|
|
2611
|
+
function e(t,r){_classCallCheck(this,e);
|
|
2612
|
+
// Metadata instance is created once and stays constant.
|
|
2613
|
+
// This is required because other utility classes such as `AsYouTypeFormatter`
|
|
2614
|
+
// will use this metadata instance "reference" and will assume that it stays constant.
|
|
2615
|
+
this.metadata=new Metadata(r);var n=this.getCountryAndCallingCode(t),o=_slicedToArray(n,2),i=o[0],d=o[1];
|
|
2616
|
+
// `this.defaultCountry` and `this.defaultCallingCode` aren't required to be in sync.
|
|
2617
|
+
// For example, `this.defaultCountry` could be `"AR"` and `this.defaultCallingCode` could be `undefined`.
|
|
2618
|
+
// So `this.defaultCountry` and `this.defaultCallingCode` are totally independent.
|
|
2619
|
+
this.defaultCountry=i;this.defaultCallingCode=d;this.reset()}return _createClass(e,[{key:"getCountryAndCallingCode",value:function e(t){
|
|
2620
|
+
// Set `defaultCountry` and `defaultCallingCode` options.
|
|
2621
|
+
var r;var n;
|
|
2622
|
+
// Turns out `null` also has type "object". Weird.
|
|
2623
|
+
if(t){if(isObject(t)){r=t.defaultCountry;n=t.defaultCallingCode}else{r=t}}if(r&&!this.metadata.hasCountry(r)){r=undefined}return[r,n]}
|
|
2624
|
+
/**
|
|
2625
|
+
* Inputs "next" phone number characters.
|
|
2626
|
+
* @param {string} text
|
|
2627
|
+
* @return {string} Formatted phone number characters that have been input so far.
|
|
2628
|
+
*/},{key:"input",value:function e(t){var r=this.parser.input(t,this.state),n=r.digits,o=r.justLeadingPlus;if(o){this.formattedOutput="+"}else if(n){this.determineTheCountryIfNeeded();
|
|
2629
|
+
// Match the available formats by the currently available leading digits.
|
|
2630
|
+
if(this.state.nationalSignificantNumber){this.formatter.narrowDownMatchingFormats(this.state)}var i;if(this.metadata.hasSelectedNumberingPlan()){i=this.formatter.format(n,this.state)}if(i===undefined){
|
|
2631
|
+
// See if another national (significant) number could be re-extracted.
|
|
2632
|
+
if(this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();
|
|
2633
|
+
// If it could, then re-try formatting the new national (significant) number.
|
|
2634
|
+
var d=this.state.getNationalDigits();if(d){i=this.formatter.format(d,this.state)}}}this.formattedOutput=i?this.getFullNumber(i):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function e(){var t=this;this.state=new AsYouTypeState({onCountryChange:function e(r){
|
|
2635
|
+
// Before version `1.6.0`, the official `AsYouType` formatter API
|
|
2636
|
+
// included a `.country` property on an `AsYouType` instance.
|
|
2637
|
+
// Since that property (along with the others) have been moved to
|
|
2638
|
+
// `this.state`, `this.country` property is emulated for compatibility
|
|
2639
|
+
// with the old versions.
|
|
2640
|
+
t.country=r},onCallingCodeChange:function e(r,n){t.metadata.selectNumberingPlan(n||r);t.formatter.reset(t.metadata.numberingPlan,t.state);t.parser.reset(t.metadata.numberingPlan)}});this.formatter=new AsYouTypeFormatter({state:this.state,metadata:this.metadata});this.parser=new AsYouTypeParser({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function e(){t.determineTheCountryIfNeeded();t.formatter.reset(t.metadata.numberingPlan,t.state)}});this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode});this.formattedOutput="";return this}
|
|
2641
|
+
/**
|
|
2642
|
+
* Returns `true` if the phone number is being input in international format.
|
|
2643
|
+
* In other words, returns `true` if and only if the parsed phone number starts with a `"+"`.
|
|
2644
|
+
* @return {boolean}
|
|
2645
|
+
*/},{key:"isInternational",value:function e(){return this.state.international}
|
|
2646
|
+
/**
|
|
2647
|
+
* Returns the "calling code" part of the phone number when it's being input
|
|
2648
|
+
* in an international format.
|
|
2649
|
+
* If no valid calling code has been entered so far, returns `undefined`.
|
|
2650
|
+
* @return {string} [callingCode]
|
|
2651
|
+
*/},{key:"getCallingCode",value:function e(){
|
|
2652
|
+
// If the number is being input in national format and some "default calling code"
|
|
2653
|
+
// has been passed to `AsYouType` constructor, then `this.state.callingCode`
|
|
2654
|
+
// is equal to that "default calling code".
|
|
2655
|
+
// If the number is being input in national format and no "default calling code"
|
|
2656
|
+
// has been passed to `AsYouType` constructor, then returns `undefined`,
|
|
2657
|
+
// even if a "default country" has been passed to `AsYouType` constructor.
|
|
2658
|
+
if(this.isInternational()){return this.state.callingCode}}
|
|
2659
|
+
// A legacy alias.
|
|
2660
|
+
},{key:"getCountryCallingCode",value:function e(){return this.getCallingCode()}
|
|
2661
|
+
/**
|
|
2662
|
+
* Returns a two-letter country code of the phone number.
|
|
2663
|
+
* Returns `undefined` for "non-geographic" phone numbering plans.
|
|
2664
|
+
* Returns `undefined` if no phone number has been input yet.
|
|
2665
|
+
* @return {string} [country]
|
|
2666
|
+
*/},{key:"getCountry",value:function e(){var t=this.state.digits;
|
|
2667
|
+
// Return `undefined` if no digits have been input yet.
|
|
2668
|
+
if(t){return this._getCountry()}}
|
|
2669
|
+
/**
|
|
2670
|
+
* Returns a two-letter country code of the phone number.
|
|
2671
|
+
* Returns `undefined` for "non-geographic" phone numbering plans.
|
|
2672
|
+
* @return {string} [country]
|
|
2673
|
+
*/},{key:"_getCountry",value:function e(){var t=this.state.country;return t}},{key:"determineTheCountryIfNeeded",value:function e(){
|
|
2674
|
+
// Suppose a user enters a phone number in international format,
|
|
2675
|
+
// and there're several countries corresponding to that country calling code,
|
|
2676
|
+
// and a country has been derived from the number, and then
|
|
2677
|
+
// a user enters one more digit and the number is no longer
|
|
2678
|
+
// valid for the derived country, so the country should be re-derived
|
|
2679
|
+
// on every new digit in those cases.
|
|
2680
|
+
// If the phone number is being input in national format,
|
|
2681
|
+
// then it could be a case when `defaultCountry` wasn't specified
|
|
2682
|
+
// when creating `AsYouType` instance, and just `defaultCallingCode` was specified,
|
|
2683
|
+
// and that "calling code" could correspond to a "non-geographic entity",
|
|
2684
|
+
// or there could be several countries corresponding to that country calling code.
|
|
2685
|
+
// In those cases, `this.country` is `undefined` and should be derived
|
|
2686
|
+
// from the number. Again, if country calling code is ambiguous, then
|
|
2687
|
+
// `this.country` should be re-derived with each new digit.
|
|
2688
|
+
if(!this.state.country||this.isCountryCallingCodeAmbiguous()){this.determineTheCountry()}}
|
|
2689
|
+
// Prepends `+CountryCode ` in case of an international phone number
|
|
2690
|
+
},{key:"getFullNumber",value:function e(t){var r=this;if(this.isInternational()){var n=function e(t){return r.formatter.getInternationalPrefixBeforeCountryCallingCode(r.state,{spacing:t?true:false})+t};var o=this.state.callingCode;if(!o){return n("".concat(this.state.getDigitsWithoutInternationalPrefix()))}if(!t){return n(o)}return n("".concat(o," ").concat(t))}return t}},{key:"getNonFormattedNationalNumberWithPrefix",value:function e(){var t=this.state,r=t.nationalSignificantNumber,n=t.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,o=t.nationalPrefix;var i=r;var d=n||o;if(d){i=d+i}return i}},{key:"getNonFormattedNumber",value:function e(){var t=this.state.nationalSignificantNumberIsModified;return this.getFullNumber(t?this.state.getNationalDigits():this.getNonFormattedNationalNumberWithPrefix())}},{key:"getNonFormattedTemplate",value:function e(){var t=this.getNonFormattedNumber();if(t){return t.replace(/[\+\d]/g,DIGIT_PLACEHOLDER)}}},{key:"isCountryCallingCodeAmbiguous",value:function e(){var t=this.state.callingCode;var r=this.metadata.getCountryCodesForCallingCode(t);return r&&r.length>1}
|
|
2691
|
+
// Determines the exact country of the phone number
|
|
2692
|
+
// entered so far based on the country phone code
|
|
2693
|
+
// and the national phone number.
|
|
2694
|
+
},{key:"determineTheCountry",value:function e(){
|
|
2695
|
+
// Get a more precise country code for this national number.
|
|
2696
|
+
// It is possible that the precise country couldn't be determined
|
|
2697
|
+
// in cases when there're multiple countries sharing the same calling code.
|
|
2698
|
+
// In that case, `country` will be `undefined`.
|
|
2699
|
+
var t=getCountryByCallingCode(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,metadata:this.metadata});
|
|
2700
|
+
// If the derived country is indeed more precise,
|
|
2701
|
+
// or if no country could be derived for the updated phone number.
|
|
2702
|
+
if(t!==this.state.country){
|
|
2703
|
+
// Set (or reset) the more precise country.
|
|
2704
|
+
this.state.setCountry(t);
|
|
2705
|
+
// If a more precise country could be derived.
|
|
2706
|
+
if(t){
|
|
2707
|
+
// Select a more precise telephone numbering plan.
|
|
2708
|
+
// For example, consider that `AsYouType` instance was created with `defaultCountry: "US"` argument.
|
|
2709
|
+
// In that case, the metadata instance will be using "US" metadata.
|
|
2710
|
+
// But then the user could input a Canadian phone number, in which case
|
|
2711
|
+
// the metadata instance should be switched to Canadian telephone numbering plan.
|
|
2712
|
+
// It is required to do that because later `canFormatCompleteNumber()` function will be called,
|
|
2713
|
+
// and that function relies on the precise country being pre-selected in the metadata instance.
|
|
2714
|
+
// Or, for example, `checkNumberLength()` function also relies on same thing.
|
|
2715
|
+
this.metadata.selectNumberingPlan(t)}}}
|
|
2716
|
+
/**
|
|
2717
|
+
* Returns a E.164 phone number value for the user's input.
|
|
2718
|
+
*
|
|
2719
|
+
* For example, for country `"US"` and input `"(222) 333-4444"`
|
|
2720
|
+
* it will return `"+12223334444"`.
|
|
2721
|
+
*
|
|
2722
|
+
* For international phone number input, it will also auto-correct
|
|
2723
|
+
* some minor errors such as using a national prefix when writing
|
|
2724
|
+
* an international phone number. For example, if the user inputs
|
|
2725
|
+
* `"+44 0 7400 000000"` then it will return an auto-corrected
|
|
2726
|
+
* `"+447400000000"` phone number value.
|
|
2727
|
+
*
|
|
2728
|
+
* Will return `undefined` if no digits have been input,
|
|
2729
|
+
* or when inputting a phone number in national format and no
|
|
2730
|
+
* default country or default "country calling code" have been set.
|
|
2731
|
+
*
|
|
2732
|
+
* @return {string} [value]
|
|
2733
|
+
*/},{key:"getNumberValue",value:function e(){var t=this.state,r=t.digits,n=t.callingCode,o=t.country,i=t.nationalSignificantNumber;
|
|
2734
|
+
// Will return `undefined` if no digits have been input.
|
|
2735
|
+
if(!r){return}if(this.isInternational()){if(n){return"+"+n+i}else{return"+"+r}}else{if(o||n){var d=o?this.metadata.countryCallingCode():n;return"+"+d+i}}}
|
|
2736
|
+
/**
|
|
2737
|
+
* Returns an instance of `PhoneNumber` class.
|
|
2738
|
+
* Will return `undefined` if no national (significant) number
|
|
2739
|
+
* digits have been entered so far, or if no `defaultCountry` has been
|
|
2740
|
+
* set and the user enters a phone number not in international format.
|
|
2741
|
+
*/},{key:"getNumber",value:function e(){var t=this.state,r=t.nationalSignificantNumber,n=t.carrierCode,o=t.callingCode;if(!r){return}
|
|
2742
|
+
// `this._getCountry()` is basically same as `this.state.country`
|
|
2743
|
+
// with the only change that it returns `undefined` in case of a
|
|
2744
|
+
// "non-geographic" numbering plan instead of `"001"` "internal use" value.
|
|
2745
|
+
var i=this._getCountry();
|
|
2746
|
+
// Sidenote:
|
|
2747
|
+
// `state.callingCode` and `state.country` are somewhat independent from one another
|
|
2748
|
+
// and there could be situations when one is defined but the other is not.
|
|
2749
|
+
// See the comment in `AsYouTypeState.js` for more info on when that is possible.
|
|
2750
|
+
if(!i&&!o){return}
|
|
2751
|
+
// By default, if `defaultCountry` parameter was passed when
|
|
2752
|
+
// creating `AsYouType` instance, `state.country` is gonna be
|
|
2753
|
+
// that `defaultCountry`, which doesn't entirely conform with
|
|
2754
|
+
// `parsePhoneNumber()`'s behavior where it attempts to determine
|
|
2755
|
+
// the country more precisely in cases when multiple countries
|
|
2756
|
+
// could correspond to the same `countryCallingCode`.
|
|
2757
|
+
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417192969
|
|
2758
|
+
|
|
2759
|
+
// Because `AsYouType.getNumber()` method is supposed to be a 1:1
|
|
2760
|
+
// equivalent for `parsePhoneNumber(AsYouType.getNumberValue())`,
|
|
2761
|
+
// it means that it should also behave accordingly in such cases of `country` ambiguity.
|
|
2762
|
+
// That's how users of this library would expect it to behave anyway.
|
|
2763
|
+
|
|
2764
|
+
// So here it checks if `state.country` is same as the `defaultCountry`,
|
|
2765
|
+
// and if it is, it attempts to get rid of any potential ambiguity.
|
|
2766
|
+
|
|
2767
|
+
if(i){if(i===this.defaultCountry){
|
|
2768
|
+
// // Create a `Metadata` instance just to get the calling code of the `country`.
|
|
2769
|
+
// const metadata = new Metadata(this.metadata.metadata)
|
|
2770
|
+
// // `state.callingCode` and `state.country` are somewhat independent from one another
|
|
2771
|
+
// // and there could be situations when one is defined but the other is not.
|
|
2772
|
+
// // See the comment in `AsYouTypeState.js` for more info on when that is possible.
|
|
2773
|
+
// // Here, it only passes `state.country` because there's no need to pass `state.callingCode`
|
|
2774
|
+
// // because `state.country` is known to be defined.
|
|
2775
|
+
// metadata.selectNumberingPlan(country)
|
|
2776
|
+
// const countryCallingCode = metadata.numberingPlan.callingCode()
|
|
2777
|
+
// Instead of getting `countryCallingCode` value above,
|
|
2778
|
+
// it could simply read it from the existing metadata instance.
|
|
2779
|
+
var d=this.metadata.numberingPlan.callingCode();
|
|
2780
|
+
// Attempt to rule out any potential country code ambiguity, if present.
|
|
2781
|
+
var s=getExactCountryForMultiCountryCallingCode(d,r,this.metadata);if(s){i=s}}}var a=new PhoneNumber(i||o,r,this.metadata.metadata);if(n){a.carrierCode=n}
|
|
2782
|
+
// Phone number extensions are not supported by "As You Type" formatter.
|
|
2783
|
+
return a}
|
|
2784
|
+
/**
|
|
2785
|
+
* Returns `true` if the phone number is "possible".
|
|
2786
|
+
* Is just a shortcut for `PhoneNumber.isPossible()`.
|
|
2787
|
+
* @return {boolean}
|
|
2788
|
+
*/},{key:"isPossible",value:function e(){var t=this.getNumber();if(!t){return false}return t.isPossible()}
|
|
2789
|
+
/**
|
|
2790
|
+
* Returns `true` if the phone number is "valid".
|
|
2791
|
+
* Is just a shortcut for `PhoneNumber.isValid()`.
|
|
2792
|
+
* @return {boolean}
|
|
2793
|
+
*/},{key:"isValid",value:function e(){var t=this.getNumber();if(!t){return false}return t.isValid()}
|
|
2794
|
+
/**
|
|
2795
|
+
* Checks if the phone number length is valid.
|
|
2796
|
+
* If it is, nothing is returned.
|
|
2797
|
+
* Otherwise, a rejection reason is returned.
|
|
2798
|
+
* @return {string?}
|
|
2799
|
+
*/},{key:"validateLength",value:function e(){var t=this.state,r=t.digits,n=t.nationalSignificantNumber;if(!r){return"NOT_A_NUMBER"}if(!this.metadata.numberingPlan){return"INVALID_COUNTRY"}if(!n){return"TOO_SHORT"}
|
|
2800
|
+
// `state.callingCode` and `state.country` are somewhat independent from one another
|
|
2801
|
+
// and there could be situations when one is defined but the other is not.
|
|
2802
|
+
// See the comment in `AsYouTypeState.js` for more info on when that is possible.
|
|
2803
|
+
// Here, it uses both: if `country` is defined then it will use that,
|
|
2804
|
+
// otherwise it will use `callingCode`.
|
|
2805
|
+
var o=checkNumberLength(n,undefined,this.metadata);if(o!=="IS_POSSIBLE"){return o}}
|
|
2806
|
+
/**
|
|
2807
|
+
* @deprecated
|
|
2808
|
+
* This method is used in `react-phone-number-input/source/input-control.js`
|
|
2809
|
+
* in versions before `3.0.16`.
|
|
2810
|
+
*/},{key:"getNationalNumber",value:function e(){return this.state.nationalSignificantNumber}
|
|
2811
|
+
/**
|
|
2812
|
+
* Returns the phone number characters entered by the user.
|
|
2813
|
+
* @return {string}
|
|
2814
|
+
*/},{key:"getChars",value:function e(){return(this.state.international?"+":"")+this.state.digits}
|
|
2815
|
+
/**
|
|
2816
|
+
* Returns the template for the formatted phone number.
|
|
2817
|
+
* @return {string}
|
|
2818
|
+
*/},{key:"getTemplate",value:function e(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}])}();// In situations when multiple countries use the same calling code,
|
|
2819
|
+
function getExactCountryForMultiCountryCallingCode(e,t,r){var n=r.getCountryCodesForCallingCode(e);if(n.length>1){return getCountryByNationalNumber(t,n,r.metadata)}}function parsePhoneNumber(){return withMetadataArgument(parsePhoneNumber$1,arguments)}
|
|
2820
|
+
// Importing from a ".js" file is a workaround for Node.js "ES Modules"
|
|
2821
|
+
// importing system which is even uncapable of importing "*.json" files.
|
|
2822
|
+
function AsYouType(e){return AsYouType$1.call(this,e,metadata)}AsYouType.prototype=Object.create(AsYouType$1.prototype,{});AsYouType.prototype.constructor=AsYouType;
|
|
2823
|
+
// Sort out arguments
|
|
2824
|
+
function normalizeArguments(e){
|
|
2825
|
+
// This line of code appeared to not work correctly with `babel`/`istanbul`:
|
|
2826
|
+
// for some weird reason, it caused coverage less than 100%.
|
|
2827
|
+
// That's because `babel`/`istanbul`, for some weird reason,
|
|
2828
|
+
// apparently doesn't know how to properly exclude Babel polyfills from code coverage.
|
|
2829
|
+
// const [arg_1, arg_2, arg_3, arg_4] = Array.prototype.slice.call(args)
|
|
2830
|
+
var t=e[0];var r=e[1];var n=e[2];var o=e[3];var i;var d={};var s;
|
|
2831
|
+
// If the phone number is passed as a string.
|
|
2832
|
+
// `getNumberType('88005553535', ...)`.
|
|
2833
|
+
if(typeof t==="string"){
|
|
2834
|
+
// If "default country" argument is being passed
|
|
2835
|
+
// then convert it to an `options` object.
|
|
2836
|
+
// `getNumberType('88005553535', 'RU', metadata)`.
|
|
2837
|
+
if(!isObject(r)){if(o){d=n;s=o}else{s=n}
|
|
2838
|
+
// `parse` extracts phone numbers from raw text,
|
|
2839
|
+
// therefore it will cut off all "garbage" characters,
|
|
2840
|
+
// while this `validate` function needs to verify
|
|
2841
|
+
// that the phone number contains no "garbage"
|
|
2842
|
+
// therefore the explicit `isViablePhoneNumber` check.
|
|
2843
|
+
if(isViablePhoneNumber(t)){i=parse(t,{defaultCountry:r},s)}else{i={}}}
|
|
2844
|
+
// No "resrict country" argument is being passed.
|
|
2845
|
+
// International phone number is passed.
|
|
2846
|
+
// `getNumberType('+78005553535', metadata)`.
|
|
2847
|
+
else{if(n){d=r;s=n}else{s=r}
|
|
2848
|
+
// `parse` extracts phone numbers from raw text,
|
|
2849
|
+
// therefore it will cut off all "garbage" characters,
|
|
2850
|
+
// while this `validate` function needs to verify
|
|
2851
|
+
// that the phone number contains no "garbage"
|
|
2852
|
+
// therefore the explicit `isViablePhoneNumber` check.
|
|
2853
|
+
if(isViablePhoneNumber(t)){i=parse(t,undefined,s)}else{i={}}}}
|
|
2854
|
+
// If the phone number is passed as a parsed phone number.
|
|
2855
|
+
// `getNumberType({ phone: '88005553535', country: 'RU' }, ...)`.
|
|
2856
|
+
else if(isObject(t)){i=t;if(n){d=r;s=n}else{s=r}}else throw new TypeError("A phone number must either be a string or an object of shape { phone, [country] }.");return{input:i,options:d,metadata:s}}
|
|
2857
|
+
/**
|
|
2858
|
+
* Checks if a given phone number is possible.
|
|
2859
|
+
* Which means it only checks phone number length
|
|
2860
|
+
* and doesn't test any regular expressions.
|
|
2861
|
+
*
|
|
2862
|
+
* Examples:
|
|
2863
|
+
*
|
|
2864
|
+
* ```js
|
|
2865
|
+
* isPossibleNumber('+78005553535', metadata)
|
|
2866
|
+
* isPossibleNumber('8005553535', 'RU', metadata)
|
|
2867
|
+
* isPossibleNumber('88005553535', 'RU', metadata)
|
|
2868
|
+
* isPossibleNumber({ phone: '8005553535', country: 'RU' }, metadata)
|
|
2869
|
+
* ```
|
|
2870
|
+
*/function isPossibleNumber$1(){var e=normalizeArguments(arguments),t=e.input,r=e.options,n=e.metadata;
|
|
2871
|
+
// `parseNumber()` would return `{}` when no phone number could be parsed from the input.
|
|
2872
|
+
if(!t.phone&&!(r&&r.v2)){return false}return isPossiblePhoneNumber(t,r,n)}
|
|
2873
|
+
// Deprecated.
|
|
2874
|
+
function isPossibleNumber(){return withMetadataArgument(isPossibleNumber$1,arguments)}var ChevronDownIcon$1='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var zonosStripePhoneInputCss=function(){return'.sc-zonos-stripe-phone-input-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-stripe-phone-input-h *.sc-zonos-stripe-phone-input{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-stripe-phone-input-h img.sc-zonos-stripe-phone-input{max-width:100%}.sc-zonos-stripe-phone-input-h dl.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h dd.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h1.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h2.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h3.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h4.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h5.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h h6.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h hr.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h figure.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h p.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h pre.sc-zonos-stripe-phone-input{margin:0}.sc-zonos-stripe-phone-input-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-stripe-phone-input-h{--zonos--background-color:#f1f1f1;--zonos--local-glowing-color:0 0 0 3px hsla(0, 0%, 100%, 25%), 0 0 0 1px var(--zonos--primary-color);--zonos--border:1px solid #e8e8e8;margin:1px;position:relative;display:block}.dark.sc-zonos-stripe-phone-input-h,[data-theme=DARK].sc-zonos-stripe-phone-input-h{color-scheme:dark;--zonos--background-color:#30313d;--zonos--local-glowing-color:0px 2px 4px rgba(0, 0, 0, 0.5), 0px 1px 6px rgba(0, 0, 0, 0.25), 0 0 0 3px hsla(0, 0%, 100%, 25%), 0 1px 1px 0 rgba(255, 255, 255, 0.12);--zonos--border:1px solid var(--zonos--primary-color)}.sc-zonos-stripe-phone-input-h{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:4px;position:relative;width:100%}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.sc-zonos-stripe-phone-input{position:relative;width:100%;display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch;height:calc(var(--zonos-elements-size-xl) - 2px);background:var(--zonos--background-color);border-radius:var(--zonos--border-radius);border:var(--zonos--border);outline-offset:0;outline-width:2px;overflow:visible}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.sc-zonos-stripe-phone-input .zonos--select.sc-zonos-stripe-phone-input{position:absolute;opacity:0;inset:0;width:100%;cursor:pointer}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.sc-zonos-stripe-phone-input .zonos--input-group.sc-zonos-stripe-phone-input{display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch;width:100%;height:100%;pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.focused.sc-zonos-stripe-phone-input::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius);-webkit-box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.has-error.sc-zonos-stripe-phone-input::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius);-webkit-box-shadow:0 0 0 2px #df1b41;box-shadow:0 0 0 2px #df1b41;pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--label-wrapper.disabled.sc-zonos-stripe-phone-input{opacity:var(--zonos-elements-opacity-disabled);cursor:not-allowed;pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--select-wrapper.sc-zonos-stripe-phone-input{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer}.sc-zonos-stripe-phone-input-h .zonos--select-wrapper.sc-zonos-stripe-phone-input:hover{background-color:rgba(0, 0, 0, 0.02)}.sc-zonos-stripe-phone-input-h .zonos--input-container.sc-zonos-stripe-phone-input{-ms-flex:1;flex:1;position:relative;z-index:2;pointer-events:all}.sc-zonos-stripe-phone-input-h .zonos--input-container.has-label.sc-zonos-stripe-phone-input .zonos--floated-input.sc-zonos-stripe-phone-input{padding:24px 12px 2px}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input{background:transparent;border:none;width:100%;height:100%;padding:0 12px;font-size:var(--zonos--font-size);color:var(--zonos-elements-text-color);outline:none;-webkit-box-sizing:border-box;box-sizing:border-box}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:disabled{cursor:not-allowed}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input::-webkit-input-placeholder{opacity:0;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input::-moz-placeholder{opacity:0;-moz-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:-ms-input-placeholder{opacity:0;-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input::-ms-input-placeholder{opacity:0;-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input::placeholder{opacity:0;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus:-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-input.sc-zonos-stripe-phone-input:focus::placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-phone-input-h .zonos--floated-label.sc-zonos-stripe-phone-input{display:block;max-height:0;pointer-events:none}.sc-zonos-stripe-phone-input-h .zonos--floated-label.sc-zonos-stripe-phone-input label.sc-zonos-stripe-phone-input{color:var(--zonos-elements-gray-800);position:absolute;font-size:16px;line-height:16px;display:inline-block;-webkit-filter:blur(0);filter:blur(0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);left:12px;top:calc(50% - 8px);z-index:1}.sc-zonos-stripe-phone-input-h .has-content.sc-zonos-stripe-phone-input .zonos--input-container.sc-zonos-stripe-phone-input .zonos--floated-label.sc-zonos-stripe-phone-input label.sc-zonos-stripe-phone-input,.sc-zonos-stripe-phone-input-h .focused.sc-zonos-stripe-phone-input .zonos--input-container.sc-zonos-stripe-phone-input .zonos--floated-label.sc-zonos-stripe-phone-input label.sc-zonos-stripe-phone-input{top:11px;-webkit-transform:scale(0.8);transform:scale(0.8)}.zonos--country-select.sc-zonos-stripe-phone-input{position:relative;height:100%}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-select-content.sc-zonos-stripe-phone-input{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-left:12px;height:100%;z-index:1}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-select-selected.sc-zonos-stripe-phone-input{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--select-chevron-wrapper.sc-zonos-stripe-phone-input{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-left:4px}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--select-chevron-wrapper.sc-zonos-stripe-phone-input .zonos--select-chevron.sc-zonos-stripe-phone-input{pointer-events:none;color:var(--zonos-elements-gray-800);padding-left:4px}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-flag-wrapper.sc-zonos-stripe-phone-input{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-flag.sc-zonos-stripe-phone-input{border-radius:var(--zonos-elements-radius-4);width:20px;height:16px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium)}.zonos--country-select.sc-zonos-stripe-phone-input .zonos--country-code.sc-zonos-stripe-phone-input{font-size:var(--zonos--font-size);color:var(--zonos-elements-text-color)}'};var inputId=0;var ZonosStripePhoneInput=/** @class */function(){function e(e){var t=this;registerInstance(this,e);this.inputValueChange=createEvent(this,"inputValueChange",7);this.inputId="zonos--phone-input-".concat(++inputId);
|
|
2875
|
+
/**
|
|
2876
|
+
* Inherited attributes from the host element
|
|
2877
|
+
*/this.inheritedAttributes={};
|
|
2878
|
+
/**
|
|
2879
|
+
* The autoComplete attribute for the phone input
|
|
2880
|
+
*/this.autoComplete="";
|
|
2881
|
+
/**
|
|
2882
|
+
* Available country options for the select dropdown
|
|
2883
|
+
*/this.countryOptions=null;
|
|
2884
|
+
/**
|
|
2885
|
+
* Whether the input is disabled
|
|
2886
|
+
*/this.disabled=false;
|
|
2887
|
+
/**
|
|
2888
|
+
* The country code of the phone input
|
|
2889
|
+
*/this.countryCode=null;this.phoneNumber="";this.isFocused=false;this.isSelectOpen=false;this.handleCountryChange=function(e){var r;var n=e.target;var o=(r=t.countryOptions)===null||r===void 0?void 0:r[n.value];t.selectedCountry=o;
|
|
2890
|
+
// Update the phone formatter to use the new country code
|
|
2891
|
+
t.updatePhoneFormatter();var i=t.validatePhoneNumber(),d=i.isEmpty,s=i.valid,a=i.wrongFormat;t.inputValueChange.emit({countryCode:(o===null||o===void 0?void 0:o.countryCode)||null,isEmpty:d,phoneNumber:t.phoneNumber,valid:s,wrongFormat:a})};this.handlePhoneChange=function(e){var r,n;var o=e.target;var i=o.value.replace(/[^0-9]/g,"");if(t.asYouType){t.asYouType.reset();var d=t.asYouType.input(i);
|
|
2892
|
+
// Get the full number (including the country code) from the formatter (e.g. +17022920000)
|
|
2893
|
+
t.phoneNumber=((r=t.asYouType.getNumber())===null||r===void 0?void 0:r.number)||"";o.value=d}else{t.phoneNumber=i}var s=t.validatePhoneNumber(),a=s.isEmpty,u=s.valid,l=s.wrongFormat;t.inputValueChange.emit({countryCode:((n=t.selectedCountry)===null||n===void 0?void 0:n.countryCode)||null,isEmpty:a,phoneNumber:t.phoneNumber,valid:u,wrongFormat:l})};this.handleFocus=function(){t.isFocused=true};this.handleBlur=function(){t.isFocused=false};
|
|
2894
|
+
// Type guard to check if the country code is in the country options
|
|
2895
|
+
this.isCountryCode=function(e){var r;return((r=t.countryOptions)===null||r===void 0?void 0:r[e])!==undefined};this.initPhoneNumberValue=function(){var e;if(!t.countryOptions){return}
|
|
2896
|
+
// Guess the country code from the phone number
|
|
2897
|
+
var r=(e=parsePhoneNumber(t.inputValue||"",{defaultCountry:t.countryCode}))===null||e===void 0?void 0:e.country;
|
|
2898
|
+
// If the guessed country code is not in the country options, use the provided country code
|
|
2899
|
+
var n=r&&t.isCountryCode(r)?r:t.countryCode;
|
|
2900
|
+
// Get the first available country from the options
|
|
2901
|
+
var o=Object.values(t.countryOptions).find(Boolean);
|
|
2902
|
+
// If no country code is provided, set the first available country
|
|
2903
|
+
if(!n){t.selectedCountry=o;var i=t.validatePhoneNumber(),d=i.isEmpty,s=i.valid,a=i.wrongFormat;
|
|
2904
|
+
// Emit the change event so the parent component can update the state to the first country
|
|
2905
|
+
t.inputValueChange.emit({countryCode:(o===null||o===void 0?void 0:o.countryCode)||null,isEmpty:d,phoneNumber:t.phoneNumber,valid:s,wrongFormat:a});return}t.selectedCountry=t.countryOptions[n]||o;t.phoneNumber=t.inputValue||"";
|
|
2906
|
+
// Update the phone formatter to use the new country code
|
|
2907
|
+
t.updatePhoneFormatter()}}e.prototype.onCountryCodeChange=function(){
|
|
2908
|
+
/**
|
|
2909
|
+
* Re-derive the dial code when the address country changes, otherwise a
|
|
2910
|
+
* shopper who changes country keeps the previous country's dial code — for
|
|
2911
|
+
* example a US billing address on a Mexico shipment would send a US phone
|
|
2912
|
+
* number prefixed with +52 (05CHECK-915).
|
|
2913
|
+
*/
|
|
2914
|
+
this.initPhoneNumberValue()};e.prototype.onCountryOptionsChange=function(){
|
|
2915
|
+
// Re-initialize the phone number value when the country options change
|
|
2916
|
+
this.initPhoneNumberValue()};e.prototype.onSelectedCountryChange=function(){this.updatePhoneFormatter()};e.prototype.onPhoneNumberChange=function(){this.phoneNumber=this.inputValue||"";this.updatePhoneFormatter()};e.prototype.validatePhoneNumber=function(){var e;if(!this.phoneNumber){return{isEmpty:true,valid:false,wrongFormat:false}}
|
|
2917
|
+
// Just accept the phone number if the formatter is not available
|
|
2918
|
+
var t=((e=this.asYouType.getNumber())===null||e===void 0?void 0:e.number)||"";var r=isPossibleNumber(t);return{isEmpty:false,valid:r,wrongFormat:!r}};
|
|
2919
|
+
/**
|
|
2920
|
+
* Update the phone formatter to use the new country code
|
|
2921
|
+
*/e.prototype.updatePhoneFormatter=function(){var e,t,r,n;var o=Object.values(this.countryOptions||[]).find(Boolean);var i=((e=this.selectedCountry)===null||e===void 0?void 0:e.countryCode)||(o===null||o===void 0?void 0:o.countryCode)||"US";this.asYouType=new AsYouType(i);if(this.phoneNumber){
|
|
2922
|
+
// Re-format existing number with new formatter
|
|
2923
|
+
this.asYouType.input(this.phoneNumber);if(this.inputRef){this.inputRef.value=((t=this.asYouType.getNumber())===null||t===void 0?void 0:t.formatNational())||"";var d=this.validatePhoneNumber(),s=d.isEmpty,a=d.valid,u=d.wrongFormat;
|
|
2924
|
+
// emit the change event
|
|
2925
|
+
this.inputValueChange.emit({countryCode:((r=this.selectedCountry)===null||r===void 0?void 0:r.countryCode)||null,isEmpty:s,phoneNumber:((n=this.asYouType.getNumber())===null||n===void 0?void 0:n.number)||"",valid:a,wrongFormat:u})}}};e.prototype.componentWillLoad=function(){this.inheritedAttributes=Object.assign(Object.assign({},inheritAriaAttributes(this.el)),inheritAttributes(this.el,["tabindex","title","data-form-type","dir"]));this.initPhoneNumberValue()};e.prototype.componentDidLoad=function(){this.initPhoneNumberValue()};e.prototype.render=function(){var e=this;var t;var r=this.overridePrimaryColor||zonosStore.appearance.colorPrimary;var n=this.overrideSecondaryColor||zonosStore.appearance.colorSecondary;var o=r&&isDarkColor(r);var i=zonosStore.appearance.fontSizeInputValue||16;var d=!!this.phoneNumber;var s=this.countryOptions?Object.values(this.countryOptions).filter(Boolean).sort((function(e,t){return e.displayName.localeCompare(t.displayName)})):[];return h(Host,{key:"e2a1fc4c2e5f57dc1ae904b70b5f7f421297ae0c",class:classes(["zonos--phone-input zonos--elements",o&&"dark"]),"data-theme":o?"DARK":"LIGHT",style:Object.assign({"--zonos--border-radius":getBorderRadius(),"--zonos--font-family":zonosStoreFontFamily(),"--zonos--font-size":"".concat(i,"px"),"--zonos--primary-color":n},this.minWidth?{"--zonos--min-width":this.minWidth}:{})},h("div",{key:"61a2ee1f566234692a80fe68fbc4d171f36263dc",class:classes(["zonos--label-wrapper",this.disabled&&"disabled",this.isFocused&&"focused",d&&"has-content",this.error&&"has-error",this.inputLabel&&"has-label"])},h("select",{key:"32602cf340a06a26c483f049595cdd812826275e",class:"zonos--select",disabled:this.disabled,onBlur:this.handleBlur,onChange:this.handleCountryChange,onFocus:this.handleFocus},s.map((function(t){var r;return h("option",{key:t.countryCode,selected:t.countryCode===((r=e.selectedCountry)===null||r===void 0?void 0:r.countryCode),value:t.countryCode},t.displayName," (+",t.phoneCode,")")}))),h("div",{key:"1a36aa363a853c420303241e75d89e5aa298dee9",class:"zonos--input-group"},h("div",{key:"7f4d30619c8f69b98422bfcab964113d598d45fa",class:"zonos--select-wrapper"},h("div",{key:"44d0f28dde38fc09ce612ad4cb78f9d1fbdbe951",class:"zonos--country-select"},h("div",{key:"c438e242374e303688150aec2c8eae51b6e1427d",class:"zonos--country-select-content"},this.selectedCountry&&h("div",{key:"2aaec2a6315d2ee84244c4458efce6d27c8598ad",class:"zonos--country-select-selected"},h("div",{key:"819a8b6fd270e43992c19a4b96a4ce5335ae166f",class:"zonos--country-flag-wrapper"},h("zonos-country-flag",{key:"090e6ce55541db022a55497b1b3a6fa7ff2b5406",class:"zonos--country-flag",countryCode:this.selectedCountry.countryCode})),h("div",{key:"021bc4bf590fb6dca736478cc8f9914ce764c1ab",class:"zonos--country-code"},"+",this.selectedCountry.phoneCode)),h("div",{key:"f7256f51c803d1b5aedb3b5d646a777cb553aa9d",class:"zonos--select-chevron-wrapper"},h("zonos-icon",{key:"a018c3fffc1c029df874d9be3c938307b4609d82","aria-label":"Expand collapsed section",class:"zonos--select-chevron",content:ChevronDownIcon$1,iconColor:"gray-800"}))))),h("div",{key:"dd20516acf7d5cab10fe91ff4a6f59cc91600732",class:classes(["zonos--input-container",this.inputLabel&&"has-label",d&&"has-content"])},h("input",Object.assign({key:"ed8b536ba7aac9bae8012692ceb9f8573640c5d6"},this.inheritedAttributes,{autoComplete:this.autoComplete,class:"zonos--floated-input",disabled:this.disabled,id:this.inputId,onBlur:this.handleBlur,onFocus:this.handleFocus,onInput:this.handlePhoneChange,placeholder:((t=this.selectedCountry)===null||t===void 0?void 0:t.phonePlaceholder)||"",ref:function(t){return e.inputRef=t},type:"tel"})),this.inputLabel&&h("div",{key:"be2ae82b335dd291d53f48a73f9b23744392daf6",class:"zonos--floated-label"},h("label",{key:"1894a34c3a5ea09b2b45e8dfc9103d944ac69118",htmlFor:this.inputId},this.inputLabel||translate("Phone number")))))),this.error&&h("zonos-text",{key:"ae0ab1f97abbecf8dda4eced5aa139d8c51decaf",textColor:"red-600"},this.error))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{countryCode:[{onCountryCodeChange:0}],countryOptions:[{onCountryOptionsChange:0}],selectedCountry:[{onSelectedCountryChange:0}],inputValue:[{onPhoneNumberChange:0}]}},enumerable:false,configurable:true});return e}();ZonosStripePhoneInput.style=zonosStripePhoneInputCss();var ChevronDownIcon='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var RemoveLineIcon='<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M14.475 10.586a.75.75 0 1 0-1.06-1.06L12 10.938l-1.414-1.414a.75.75 0 0 0-1.06 1.06L10.938 12l-1.414 1.414a.75.75 0 1 0 1.06 1.06L12 13.062l1.414 1.414a.75.75 0 0 0 1.06-1.06L13.062 12l1.414-1.414Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>';var zonosStripeSelectCss=function(){return':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--background-color:#f1f1f1;--zonos--local-glowing-color:0 0 0 3px hsla(0, 0%, 100%, 25%), 0 0 0 1px var(--zonos--primary-color);--zonos--border:1px solid #e8e8e8}:host(.dark){color-scheme:dark;--zonos--background-color:#30313d;--zonos--local-glowing-color:0px 2px 4px rgba(0, 0, 0, 0.5), 0px 1px 6px rgba(0, 0, 0, 0.25), 0 0 0 3px hsla(0, 0%, 100%, 25%), 0 1px 1px 0 rgba(255, 255, 255, 0.12);--zonos--border:1px solid var(--zonos--primary-color)}:host{margin:1px;position:relative;min-width:var(--zonos--min-width, unset)}:host .zonos--label-wrapper{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:calc(var(--zonos-elements-size-xl) - 4px);width:100%;background:var(--zonos--background-color);border-radius:var(--zonos--border-radius);border:var(--zonos--border);outline-offset:0;outline-width:2px}:host .zonos--floated-select{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;padding:0 36px 0 16px;outline:none;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);width:100%;border-radius:var(--zonos--border-radius);background:var(--zonos--background-color);border:var(--zonos--border);-ms-flex-order:2;order:2;font-weight:400;font-size:var(--zonos--font-size);color:var(--zonos--background-color);-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}:host .zonos--floated-select.has-label{padding:24px 36px 2px 16px}:host .zonos--floated-select:focus{outline:none;border:var(--zonos--border)}:host .zonos--floated-select:focus~.zonos--floated-label::after{-webkit-box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color))}:host .zonos--floated-select.has-error+.zonos--floated-label::after{-webkit-box-shadow:0 0 0 2px #df1b41;box-shadow:0 0 0 2px #df1b41}:host .zonos--floated-select.has-content,:host .zonos--floated-select:focus{color:var(--zonos-elements-text-color)}:host .zonos--floated-select.has-content~.zonos--floated-label label,:host .zonos--floated-select:focus~.zonos--floated-label label{top:11px;-webkit-transform:scale(0.8);transform:scale(0.8)}:host .zonos--floated-select:-webkit-autofill,:host .zonos--floated-select:-moz-autofill{background-color:var(--zonos-elements-input-background);color:var(--zonos-elements-text-color)}:host .zonos--floated-select option{background-color:var(--zonos--background-color);color:inherit}:host .zonos--floated-label{display:block;max-height:0;pointer-events:none;-ms-flex-order:1;order:1}:host .zonos--floated-label label{color:var(--zonos-elements-gray-800);position:absolute;font-size:16px;line-height:16px;display:inline-block;-webkit-filter:blur(0);filter:blur(0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);margin-left:16px;top:calc(50% - 8px);z-index:1}:host .zonos--floated-label::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius)}:host .zonos--actions-wrapper{position:absolute;right:8px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);z-index:1;pointer-events:none;display:-ms-flexbox;display:flex}:host .zonos--select-chevron{cursor:pointer;color:var(--zonos-elements-gray-800);z-index:1}:host{}:host .disabled .zonos--floated-label{pointer-events:inherit}:host .disabled .zonos--floated-label::after{cursor:not-allowed;z-index:1}:host .disabled .zonos--select-chevron{opacity:0.5}.zonos--clear-button{background:none;border:none;pointer-events:auto;cursor:pointer}.zonos--clear-button:hover{-webkit-filter:brightness(0.8);filter:brightness(0.8)}:host(.dark) .zonos--label-wrapper{background:#30313d}'};var selectId=0;var ZonosStripeSelect=/** @class */function(){function e(e){var t=this;registerInstance(this,e);this.selectChange=createEvent(this,"selectChange",7);
|
|
2926
|
+
/**
|
|
2927
|
+
* Inherited attributes from the host element
|
|
2928
|
+
*/this.inheritedAttributes={};this.selectId="zonos--select-".concat(++selectId);
|
|
2929
|
+
/**
|
|
2930
|
+
* Selected value of the select
|
|
2931
|
+
*/this.selectedValue="";
|
|
2932
|
+
/**
|
|
2933
|
+
* Disables the select
|
|
2934
|
+
*/this.isDisabled=false;
|
|
2935
|
+
/**
|
|
2936
|
+
* Error state of the select
|
|
2937
|
+
*/this.isError=false;
|
|
2938
|
+
/**
|
|
2939
|
+
* Error message of the select
|
|
2940
|
+
*/this.error="";
|
|
2941
|
+
/**
|
|
2942
|
+
* Placeholder for the select
|
|
2943
|
+
*/this.selectPlaceholder="";
|
|
2944
|
+
/**
|
|
2945
|
+
* Options for the select. Must be set using a query selector.
|
|
2946
|
+
*/this.options=[];
|
|
2947
|
+
/**
|
|
2948
|
+
* The autoComplete attribute for the select.
|
|
2949
|
+
*/this.autoComplete="";
|
|
2950
|
+
/**
|
|
2951
|
+
* The value of the select.
|
|
2952
|
+
*/this.value="";
|
|
2953
|
+
/**
|
|
2954
|
+
* Whether the select is required
|
|
2955
|
+
*/this.required=false;
|
|
2956
|
+
/**
|
|
2957
|
+
* Whether the select can be cleared
|
|
2958
|
+
*/this.isClearable=false;this.internalValue=this.selectedValue;this.internalOptions=this.options;this.handleClear=function(e){e.stopPropagation();t.internalValue="";t.selectChange.emit("");t.el.selectedValue="";t.el.dispatchEvent(new Event("change"))}}e.prototype.onOptionsChange=function(e){this.internalOptions=e};e.prototype.onSelectedValueChange=function(e){this.internalValue=e;this.selectChange.emit(e);this.value=e;
|
|
2959
|
+
// If the value is not found in the options, clear the value to force user to select an option
|
|
2960
|
+
this.handleNotFoundOption(e)};e.prototype.onValueChange=function(e){this.internalValue=e;
|
|
2961
|
+
// If the value is not found in the options, clear the value to force user to select an option
|
|
2962
|
+
this.handleNotFoundOption(e)};
|
|
2963
|
+
// If the value is not found in the options, clear the value to force user to select an option
|
|
2964
|
+
e.prototype.handleNotFoundOption=function(e){var t=this.internalOptions.find((function(t){return t.value===e||t.label===e}));if(!t){this.internalValue="";this.selectChange.emit("")}};e.prototype.componentWillLoad=function(){this.inheritedAttributes=Object.assign(Object.assign({},inheritAriaAttributes(this.el)),inheritAttributes(this.el,["tabindex","title","data-form-type","dir"]))};e.prototype.render=function(){var e=this;var t=this.overridePrimaryColor||zonosStore.appearance.colorPrimary;var r=this.overrideSecondaryColor||zonosStore.appearance.colorSecondary;var n=t&&isDarkColor(t);var o=zonosStore.appearance.fontSizeInputValue||16;var i=this.internalValue||this.selectPlaceholder;var d=this.isClearable&&this.internalValue&&!this.isDisabled;return h(Host,{key:"c6bf5ed45fd7756985bd97b542933d25a472aa2c",class:classes(["zonos--select zonos--elements",n&&"dark",this.isError&&"has-error"]),"data-theme":n?"DARK":"LIGHT",style:Object.assign({"--zonos--border-radius":getBorderRadius(),"--zonos--font-family":zonosStoreFontFamily(),"--zonos--font-size":"".concat(o,"px"),"--zonos--primary-color":r},this.minWidth?{"--zonos--min-width":this.minWidth}:{})},h("div",{key:"7ff61460b6ac3c5b3e6e35000f3713609a26ebe2",class:classes(["zonos--label-wrapper",this.isDisabled&&"disabled"])},h("select",Object.assign({key:"9d644b04d7b46621245581c5143d7310e1d5396d"},this.inheritedAttributes,{autoComplete:this.autoComplete,class:classes(["zonos--floated-select",!!this.selectLabel&&"has-label",i&&"has-content",this.isError&&"has-error"]),disabled:this.isDisabled,id:this.selectId,name:this.name,onChange:function(t){var r=t.target;e.selectChange.emit(r.value);e.selectedValue=r.value;e.el.dispatchEvent(new Event("change"))},required:this.required}),h("option",{key:"b448bc3c2a083334108afad566feff22bf89547a",disabled:true,selected:!this.internalValue,value:""},this.selectPlaceholder||translate("Select")),this.internalOptions.map((function(t){return h("option",{key:t.value,selected:e.internalValue===t.value||
|
|
2965
|
+
// Sometimes google returns the label not the code for some countries
|
|
2966
|
+
e.internalValue===t.label,value:t.value},t.label)}))),h("div",{key:"14b3c9dad1202d432ba2a30d03e8335aebaafa89",class:"zonos--floated-label"},h("label",{key:"4e7870ce3eeaf4ea6fd116e3a486537bebb88c87",htmlFor:this.selectId},this.selectLabel)),h("div",{key:"4567ca19c1e018d483105c23ca781e0bbd1d2c3a",class:"zonos--actions-wrapper"},d&&h("button",{key:"cdceea7255fdd19177b82c42878a6c4a20690a1a","aria-label":"Clear selection",class:"zonos--clear-button",onClick:this.handleClear,tabIndex:0,type:"button"},h("zonos-icon",{key:"099b2f1a4fb475bfa76b0f4aeee9e66f27d473f3",class:"zonos--clear-icon",content:RemoveLineIcon,iconColor:"gray-1200"})),h("zonos-icon",{key:"8c7fdaf2de40a14e4fa0f8f3598851edac1c1ae6","aria-label":"Expand collapsed section",class:"zonos--select-chevron",content:ChevronDownIcon,iconColor:"gray-800"}))),this.error&&h("zonos-text",{key:"1cb569a7feeea85874c852a1c69cf88076fd6856",textColor:"red-600"},this.error))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{options:[{onOptionsChange:0}],selectedValue:[{onSelectedValueChange:0}],value:[{onValueChange:0}]}},enumerable:false,configurable:true});return e}();ZonosStripeSelect.style=zonosStripeSelectCss();export{ZonosAddressCompletionDialog as zonos_address_completion_dialog,ZonosAddressForm as zonos_address_form,ZonosAddressSuggestions as zonos_address_suggestions,ZonosAddressUpdateDialog as zonos_address_update_dialog,ZonosAddress as zonos_custom_address,ZonosStripePhoneInput as zonos_stripe_phone_input,ZonosStripeSelect as zonos_stripe_select};
|