@saasquatch/mint-components 1.6.1-9 → 1.6.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{GenericTableView-9d93f114.js → GenericTableView-4921be4b.js} +5 -1
- package/dist/cjs/{ShadowViewAddon-1bbdf477.js → ShadowViewAddon-7b7dd5e3.js} +21 -16
- package/dist/cjs/{global-22fb2ec7.js → global-6e1584a6.js} +2 -2
- package/dist/cjs/{index.module-fb61a163.js → index.module-d169a23f.js} +30 -29
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/mint-components.cjs.js +3 -3
- package/dist/cjs/raisins-plop-target.cjs.entry.js +25 -0
- package/dist/cjs/{re-render-7248fc06.js → re-render-83d1c1f0.js} +4 -4
- package/dist/cjs/sqm-asset-card.cjs.entry.js +2 -2
- package/dist/cjs/sqm-big-stat_35.cjs.entry.js +103 -3965
- package/dist/cjs/sqm-empty_5.cjs.entry.js +5 -1
- package/dist/cjs/sqm-graphql-client-provider.cjs.entry.js +5 -5
- package/dist/cjs/sqm-leaderboard-rank.cjs.entry.js +6 -6
- package/dist/cjs/{sqm-navigation-sidebar-item-view-52ab014f.js → sqm-navigation-sidebar-item-view-7ff14840.js} +2 -2
- package/dist/cjs/sqm-navigation-sidebar-item.cjs.entry.js +4 -4
- package/dist/cjs/sqm-password-field.cjs.entry.js +2 -2
- package/dist/cjs/sqm-popup-container.cjs.entry.js +4 -4
- package/dist/cjs/{sqm-portal-email-verification-view-fc30fd1a.js → sqm-portal-email-verification-view-6b4ef802.js} +1 -1
- package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +10 -8
- package/dist/cjs/{sqm-portal-footer-view-78528c31.js → sqm-portal-footer-view-204583ac.js} +1 -1
- package/dist/cjs/sqm-portal-footer.cjs.entry.js +3 -3
- package/dist/cjs/sqm-portal-forgot-password.cjs.entry.js +8 -6
- package/dist/cjs/sqm-portal-logout.cjs.entry.js +4 -4
- package/dist/cjs/{sqm-portal-profile-view-64e85659.js → sqm-portal-profile-view-444c8e2c.js} +1 -1
- package/dist/cjs/sqm-portal-profile.cjs.entry.js +7 -7
- package/dist/cjs/sqm-portal-protected-route.cjs.entry.js +7 -6
- package/dist/cjs/sqm-portal-registration-form.cjs.entry.js +309 -0
- package/dist/cjs/sqm-portal-reset-password.cjs.entry.js +17 -9
- package/dist/cjs/sqm-portal-verify-email.cjs.entry.js +9 -8
- package/dist/cjs/sqm-qa-referral-card.cjs.entry.js +89 -0
- package/dist/cjs/sqm-qa-tabs.cjs.entry.js +100 -0
- package/dist/cjs/sqm-qa.cjs.entry.js +1 -0
- package/dist/cjs/sqm-referral-table_11.cjs.entry.js +33 -9
- package/dist/cjs/sqm-rewards-table-customer-note-column.cjs.entry.js +2 -2
- package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +34 -14
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +169 -96
- package/dist/cjs/sqm-tabs.cjs.entry.js +19 -5
- package/dist/cjs/{useChildElements-24538fc5.js → useChildElements-36106d83.js} +2 -2
- package/dist/cjs/{useReferralTable-1e71d2dc.js → useReferralTable-1aab8416.js} +8 -8
- package/dist/cjs/useValidationState-733d7e8c.js +3886 -0
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/sqm-big-stat/sqm-big-stat.js +9 -5
- package/dist/collection/components/sqm-big-stat/useBigStat.js +3 -0
- package/dist/collection/components/sqm-big-stat/useDemoBigStat.js +3 -0
- package/dist/collection/components/sqm-brand/sqm-brand.js +1 -1
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +4 -0
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +4 -0
- package/dist/collection/components/sqm-hero-image/sqm-hero-image.js +4 -0
- package/dist/collection/components/sqm-input-field/sqm-input-field.js +4 -0
- package/dist/collection/components/sqm-leaderboard/Leaderboard.stories.js +74 -2
- package/dist/collection/components/sqm-leaderboard/sqm-leaderboard.js +4 -0
- package/dist/collection/components/sqm-portal-change-password/usePortalChangePassword.js +2 -2
- package/dist/collection/components/sqm-portal-container/sqm-portal-container.js +1 -1
- package/dist/collection/components/sqm-portal-email-verification/usePortalEmailVerification.js +4 -2
- package/dist/collection/components/sqm-portal-forgot-password/usePortalForgotPassword.js +4 -2
- package/dist/collection/components/sqm-portal-login/usePortalLogin.js +3 -2
- package/dist/collection/components/sqm-portal-protected-route/sqm-portal-protected-route.js +4 -0
- package/dist/collection/components/sqm-portal-register/sqm-portal-register.js +8 -0
- package/dist/collection/components/sqm-portal-register/usePortalRegister.js +2 -2
- package/dist/collection/components/sqm-portal-registration-form/PortalRegistrationForm.stories.js +104 -0
- package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form-view.js +74 -0
- package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form.js +409 -0
- package/dist/collection/components/sqm-portal-registration-form/usePortalRegistrationForm.js +119 -0
- package/dist/collection/components/sqm-portal-reset-password/sqm-portal-reset-password.js +4 -0
- package/dist/collection/components/sqm-portal-reset-password/usePortalResetPassword.js +10 -3
- package/dist/collection/components/sqm-portal-verify-email/usePortalVerifyEmail.js +3 -2
- package/dist/collection/components/sqm-program-explainer-step/sqm-program-explainer-step.js +1 -1
- package/dist/collection/components/sqm-qa/sqm-qa.js +13 -0
- package/dist/collection/components/sqm-qa-referral-card/ReferralCard.stories.js +79 -0
- package/dist/collection/components/sqm-qa-referral-card/sqm-referral-card-view.js +56 -0
- package/dist/collection/components/sqm-qa-referral-card/sqm-referral-card.js +70 -0
- package/dist/collection/components/sqm-qa-tabs/Tabs.stories.js +491 -0
- package/dist/collection/components/sqm-qa-tabs/sqm-tabs-view.js +31 -0
- package/dist/collection/components/sqm-qa-tabs/sqm-tabs.js +59 -0
- package/dist/collection/components/sqm-qa-tabs/useTabs.js +46 -0
- package/dist/collection/components/sqm-referral-table/columns/sqm-referral-table-rewards-column.js +4 -0
- package/dist/collection/components/sqm-referral-table/sqm-referral-table.js +29 -3
- package/dist/collection/components/sqm-rewards-table/columns/sqm-rewards-table-plop-target.js +58 -0
- package/dist/collection/components/sqm-rewards-table/columns/sqm-rewards-table-status-column.js +10 -6
- package/dist/collection/components/sqm-rewards-table/sqm-rewards-table.js +18 -2
- package/dist/collection/components/sqm-scroll/sqm-scroll.js +4 -6
- package/dist/collection/components/sqm-share-button/sqm-share-button.js +8 -0
- package/dist/collection/components/sqm-tab/sqm-tab.js +1 -1
- package/dist/collection/components/sqm-tabs/sqm-tabs-view.js +5 -0
- package/dist/collection/components/sqm-tabs/useTabs.js +11 -2
- package/dist/collection/components/sqm-task-card/sqm-task-card.js +17 -1
- package/dist/collection/components/sqm-timeline/sqm-timeline-entry.js +1 -1
- package/dist/collection/components/sqm-titled-section/sqm-titled-section.js +9 -5
- package/dist/collection/tables/GenericTableView.js +5 -1
- package/dist/esm/{GenericTableView-ebc09be0.js → GenericTableView-59c5d47c.js} +5 -1
- package/dist/esm/{ShadowViewAddon-e2996624.js → ShadowViewAddon-82a3c62b.js} +23 -18
- package/dist/esm/{global-5c84f57f.js → global-59aa17be.js} +3 -3
- package/dist/esm/{index.module-f5e17a4e.js → index.module-c6c6943f.js} +5 -5
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{luxon-f44215d9.js → luxon-578505e2.js} +1 -1
- package/dist/esm/mint-components.js +5 -5
- package/dist/esm/raisins-plop-target.entry.js +21 -0
- package/dist/esm/{re-render-69774e13.js → re-render-e804551e.js} +5 -5
- package/dist/esm/sqm-asset-card.entry.js +4 -4
- package/dist/esm/sqm-big-stat_35.entry.js +101 -3963
- package/dist/esm/sqm-empty_5.entry.js +6 -2
- package/dist/esm/sqm-form-message.entry.js +1 -1
- package/dist/esm/sqm-graphql-client-provider.entry.js +7 -7
- package/dist/esm/{sqm-hero-view-71d1202f.js → sqm-hero-view-b54265df.js} +2 -2
- package/dist/esm/sqm-hero.entry.js +3 -3
- package/dist/esm/sqm-leaderboard-rank.entry.js +8 -8
- package/dist/esm/{sqm-navigation-sidebar-item-view-51714c31.js → sqm-navigation-sidebar-item-view-4181f286.js} +2 -2
- package/dist/esm/sqm-navigation-sidebar-item.entry.js +6 -6
- package/dist/esm/sqm-navigation-sidebar.entry.js +1 -1
- package/dist/esm/sqm-password-field.entry.js +4 -4
- package/dist/esm/sqm-popup-container.entry.js +6 -6
- package/dist/esm/{sqm-portal-email-verification-view-ac38b167.js → sqm-portal-email-verification-view-5b888e5c.js} +1 -1
- package/dist/esm/sqm-portal-email-verification.entry.js +12 -10
- package/dist/esm/{sqm-portal-footer-view-a6d09022.js → sqm-portal-footer-view-56689d55.js} +1 -1
- package/dist/esm/sqm-portal-footer.entry.js +5 -5
- package/dist/esm/sqm-portal-forgot-password.entry.js +10 -8
- package/dist/esm/sqm-portal-logout.entry.js +6 -6
- package/dist/esm/{sqm-portal-profile-view-419d1eb9.js → sqm-portal-profile-view-148efa76.js} +1 -1
- package/dist/esm/sqm-portal-profile.entry.js +9 -9
- package/dist/esm/sqm-portal-protected-route.entry.js +9 -8
- package/dist/esm/sqm-portal-registration-form.entry.js +305 -0
- package/dist/esm/sqm-portal-reset-password.entry.js +19 -11
- package/dist/esm/sqm-portal-verify-email.entry.js +11 -10
- package/dist/esm/sqm-qa-referral-card.entry.js +85 -0
- package/dist/esm/sqm-qa-tabs.entry.js +96 -0
- package/dist/esm/sqm-qa.entry.js +2 -1
- package/dist/esm/sqm-referral-table_11.entry.js +36 -12
- package/dist/esm/sqm-rewards-table-customer-note-cell.entry.js +1 -1
- package/dist/esm/sqm-rewards-table-customer-note-column.entry.js +4 -4
- package/dist/esm/sqm-rewards-table_9.entry.js +37 -17
- package/dist/esm/sqm-stencilbook.entry.js +173 -100
- package/dist/esm/sqm-tabs.entry.js +21 -7
- package/dist/esm/sqm-text-span.entry.js +1 -1
- package/dist/esm/{stencil-hooks.module-acc8a613.js → stencil-hooks.module-e39af977.js} +1 -1
- package/dist/esm/{use-callback-7e0bfd3b.js → use-callback-697e2ff0.js} +1 -1
- package/dist/esm/{useChildElements-a8347aea.js → useChildElements-31287783.js} +3 -3
- package/dist/esm/{useReferralTable-5cac5b13.js → useReferralTable-1693d531.js} +9 -9
- package/dist/esm/useValidationState-f5db8783.js +3882 -0
- package/dist/esm-es5/{GenericTableView-ebc09be0.js → GenericTableView-59c5d47c.js} +1 -1
- package/dist/esm-es5/ShadowViewAddon-82a3c62b.js +1 -0
- package/dist/esm-es5/{global-5c84f57f.js → global-59aa17be.js} +2 -2
- package/dist/esm-es5/{index.module-f5e17a4e.js → index.module-c6c6943f.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{luxon-f44215d9.js → luxon-578505e2.js} +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/raisins-plop-target.entry.js +1 -0
- package/dist/esm-es5/re-render-e804551e.js +1 -0
- package/dist/esm-es5/sqm-asset-card.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_35.entry.js +1 -1
- package/dist/esm-es5/sqm-empty_5.entry.js +1 -1
- package/dist/esm-es5/sqm-form-message.entry.js +1 -1
- package/dist/esm-es5/sqm-graphql-client-provider.entry.js +1 -1
- package/dist/esm-es5/{sqm-hero-view-71d1202f.js → sqm-hero-view-b54265df.js} +1 -1
- package/dist/esm-es5/sqm-hero.entry.js +1 -1
- package/dist/esm-es5/sqm-leaderboard-rank.entry.js +1 -1
- package/dist/esm-es5/sqm-navigation-sidebar-item-view-4181f286.js +1 -0
- package/dist/esm-es5/sqm-navigation-sidebar-item.entry.js +1 -1
- package/dist/esm-es5/sqm-navigation-sidebar.entry.js +1 -1
- package/dist/esm-es5/sqm-password-field.entry.js +1 -1
- package/dist/esm-es5/sqm-popup-container.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-email-verification-view-ac38b167.js → sqm-portal-email-verification-view-5b888e5c.js} +1 -1
- package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-footer-view-a6d09022.js → sqm-portal-footer-view-56689d55.js} +1 -1
- package/dist/esm-es5/sqm-portal-footer.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-forgot-password.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-logout.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-profile-view-419d1eb9.js → sqm-portal-profile-view-148efa76.js} +1 -1
- package/dist/esm-es5/sqm-portal-profile.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-protected-route.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-registration-form.entry.js +1 -0
- package/dist/esm-es5/sqm-portal-reset-password.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-verify-email.entry.js +1 -1
- package/dist/esm-es5/sqm-qa-referral-card.entry.js +1 -0
- package/dist/esm-es5/sqm-qa-tabs.entry.js +1 -0
- package/dist/esm-es5/sqm-qa.entry.js +1 -1
- package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table-customer-note-cell.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table-customer-note-column.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-tabs.entry.js +1 -1
- package/dist/esm-es5/sqm-text-span.entry.js +1 -1
- package/dist/esm-es5/{stencil-hooks.module-acc8a613.js → stencil-hooks.module-e39af977.js} +1 -1
- package/dist/esm-es5/use-callback-697e2ff0.js +1 -0
- package/dist/esm-es5/useChildElements-31287783.js +1 -0
- package/dist/esm-es5/useReferralTable-1693d531.js +1 -0
- package/dist/esm-es5/useValidationState-f5db8783.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/mint-components.js +1 -1
- package/dist/mint-components/p-0616e87e.system.entry.js +1 -0
- package/dist/mint-components/{p-48f9babc.system.entry.js → p-0accfb5c.system.entry.js} +1 -1
- package/dist/mint-components/p-0b3b7596.entry.js +1 -0
- package/dist/mint-components/{p-ee26e870.entry.js → p-10483359.entry.js} +2 -2
- package/dist/mint-components/p-1125c6ef.entry.js +1 -0
- package/dist/mint-components/{p-3970de96.js → p-11a1a6a8.js} +1 -1
- package/dist/mint-components/p-144583fb.entry.js +1 -0
- package/dist/mint-components/{p-c0d24b76.system.entry.js → p-1537ba4c.system.entry.js} +1 -1
- package/dist/mint-components/{p-e01d8fdc.system.js → p-154958ee.system.js} +1 -1
- package/dist/mint-components/p-165bfabc.entry.js +1 -0
- package/dist/mint-components/{p-bd7b8620.system.entry.js → p-1706b667.system.entry.js} +1 -1
- package/dist/mint-components/{p-4b0e876f.js → p-199defdf.js} +2 -2
- package/dist/mint-components/{p-7548e059.system.entry.js → p-1e665fe0.system.entry.js} +1 -1
- package/dist/mint-components/p-22b1898f.entry.js +1 -0
- package/dist/mint-components/p-29ceaa99.system.entry.js +1 -0
- package/dist/mint-components/{p-f298a1bc.system.entry.js → p-2ba9b60a.system.entry.js} +1 -1
- package/dist/mint-components/p-2c64d0fb.entry.js +1 -0
- package/dist/mint-components/{p-27455c4c.js → p-30b3592f.js} +1 -1
- package/dist/mint-components/p-31553b15.entry.js +1 -0
- package/dist/mint-components/{p-6738565c.entry.js → p-33e657bf.entry.js} +1 -1
- package/dist/mint-components/p-3521c62c.entry.js +1 -0
- package/dist/mint-components/p-3913a42f.system.entry.js +1 -0
- package/dist/mint-components/{p-5ab46a89.entry.js → p-3915b77c.entry.js} +1 -1
- package/dist/mint-components/p-3b99eaf1.js +1 -0
- package/dist/mint-components/p-408f983a.system.js +1 -0
- package/dist/mint-components/{p-bbf96ff3.system.js → p-4519c6d9.system.js} +1 -1
- package/dist/mint-components/{p-e707831a.entry.js → p-46aabfb7.entry.js} +1 -1
- package/dist/mint-components/{p-cf9cfac0.entry.js → p-48a1e759.entry.js} +1 -1
- package/dist/mint-components/p-4d90bec1.system.entry.js +1 -0
- package/dist/mint-components/{p-ba99d04e.system.entry.js → p-51c3cec9.system.entry.js} +1 -1
- package/dist/mint-components/{p-596902cd.system.entry.js → p-55678b75.system.entry.js} +1 -1
- package/dist/mint-components/{p-97650e34.js → p-5674fe4d.js} +1 -1
- package/dist/mint-components/p-5ad360ab.entry.js +13 -0
- package/dist/mint-components/p-5b2d40f4.system.entry.js +1 -0
- package/dist/mint-components/{p-72751bb7.entry.js → p-6352cbee.entry.js} +1 -1
- package/dist/mint-components/p-648022ed.entry.js +159 -0
- package/dist/mint-components/p-675d6c48.system.entry.js +1 -0
- package/dist/mint-components/{p-0494f792.js → p-6882f2bb.js} +1 -1
- package/dist/mint-components/{p-4ebe044d.entry.js → p-69f10938.entry.js} +1 -1
- package/dist/mint-components/p-6dabc870.system.entry.js +1 -0
- package/dist/mint-components/p-6dc6ed05.entry.js +1 -0
- package/dist/mint-components/p-706e42f0.system.js +1 -0
- package/dist/mint-components/{p-f92e3e87.system.js → p-71a504fd.system.js} +1 -1
- package/dist/mint-components/{p-eb314fed.js → p-72ebbd38.js} +1 -1
- package/dist/mint-components/p-73046229.js +1 -0
- package/dist/mint-components/p-745255d9.entry.js +1 -0
- package/dist/mint-components/{p-19042a54.system.entry.js → p-79c04821.system.entry.js} +1 -1
- package/dist/mint-components/p-7c660f98.entry.js +1 -0
- package/dist/mint-components/{p-3c96bae3.entry.js → p-7cec4e63.entry.js} +1 -1
- package/dist/mint-components/p-8153deff.entry.js +99 -0
- package/dist/mint-components/{p-60de562c.entry.js → p-82d1bb86.entry.js} +1 -1
- package/dist/mint-components/p-8425534f.entry.js +9 -0
- package/dist/mint-components/p-8858d00c.system.js +1 -0
- package/dist/mint-components/{p-6ee04453.entry.js → p-8f09f202.entry.js} +1 -1
- package/dist/mint-components/{p-82ecbcd1.js → p-8f12df83.js} +1 -1
- package/dist/mint-components/p-90efeeb4.entry.js +1 -0
- package/dist/mint-components/{p-7794c289.js → p-916a8f50.js} +1 -1
- package/dist/mint-components/{p-819298a8.system.js → p-92c99ab9.system.js} +1 -1
- package/dist/mint-components/{p-6549ad6a.system.js → p-946de27f.system.js} +1 -1
- package/dist/mint-components/{p-5cdcff11.system.entry.js → p-965b2770.system.entry.js} +1 -1
- package/dist/mint-components/p-97a63829.js +1 -0
- package/dist/mint-components/p-98eab726.system.js +1 -0
- package/dist/mint-components/p-a4a62f35.entry.js +1 -0
- package/dist/mint-components/p-a8efda40.js +1 -0
- package/dist/mint-components/p-aa998fc1.entry.js +1 -0
- package/dist/mint-components/{p-e4e5168b.entry.js → p-ae1a283d.entry.js} +1 -1
- package/dist/mint-components/p-b0bcbf67.js +268 -0
- package/dist/mint-components/{p-e2f8b782.system.entry.js → p-b1918aeb.system.entry.js} +1 -1
- package/dist/mint-components/{p-c11ce36c.js → p-b22b94ac.js} +1 -1
- package/dist/mint-components/p-c11237bf.system.entry.js +1 -0
- package/dist/mint-components/{p-0221bfef.system.entry.js → p-c14b6ff9.system.entry.js} +1 -1
- package/dist/mint-components/{p-e1d01511.system.js → p-c1c9bd9d.system.js} +1 -1
- package/dist/mint-components/{p-c0a8476e.system.entry.js → p-c4b55529.system.entry.js} +1 -1
- package/dist/mint-components/p-c5debea4.entry.js +1 -0
- package/dist/mint-components/p-c8c4e727.system.entry.js +1 -0
- package/dist/mint-components/{p-a6d4cffd.system.entry.js → p-c8c83a9e.system.entry.js} +1 -1
- package/dist/mint-components/p-d67a6057.entry.js +1 -0
- package/dist/mint-components/{p-63136070.system.entry.js → p-d8d0ec81.system.entry.js} +1 -1
- package/dist/mint-components/p-d9c3f39a.system.entry.js +1 -0
- package/dist/mint-components/{p-48ec6605.system.js → p-dc7b06ef.system.js} +1 -1
- package/dist/mint-components/p-dced4933.system.entry.js +1 -0
- package/dist/mint-components/p-ddeba605.system.entry.js +1 -0
- package/dist/mint-components/{p-dcdbf128.system.js → p-dfb6765a.system.js} +1 -1
- package/dist/mint-components/{p-4ac2d13b.system.entry.js → p-e00abc43.system.entry.js} +1 -1
- package/dist/mint-components/{p-28d44352.js → p-e175ad25.js} +1 -1
- package/dist/mint-components/p-e28dd7a3.system.js +1 -0
- package/dist/mint-components/{p-fc942cbd.system.js → p-e2bf9132.system.js} +1 -1
- package/dist/mint-components/p-e39919d4.system.js +1 -0
- package/dist/mint-components/{p-f6d3a2d4.system.js → p-e3acae66.system.js} +1 -1
- package/dist/mint-components/{p-78640db1.system.entry.js → p-ea5afb36.system.entry.js} +1 -1
- package/dist/mint-components/p-ee461c80.js +1 -0
- package/dist/mint-components/p-eeca87d4.system.entry.js +1 -0
- package/dist/mint-components/p-f0e2df53.system.entry.js +1 -0
- package/dist/mint-components/{p-047a840f.system.entry.js → p-f86ba72a.system.entry.js} +1 -1
- package/dist/mint-components/{p-0ee797b8.system.js → p-fb7288a2.system.js} +1 -1
- package/dist/types/components/sqm-big-stat/sqm-big-stat.d.ts +6 -5
- package/dist/types/components/sqm-brand/sqm-brand.d.ts +1 -1
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +1 -0
- package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field.d.ts +1 -0
- package/dist/types/components/sqm-hero-image/sqm-hero-image.d.ts +1 -0
- package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +1 -0
- package/dist/types/components/sqm-leaderboard/sqm-leaderboard.d.ts +1 -0
- package/dist/types/components/sqm-portal-container/sqm-portal-container.d.ts +1 -1
- package/dist/types/components/sqm-portal-protected-route/sqm-portal-protected-route.d.ts +1 -0
- package/dist/types/components/sqm-portal-register/sqm-portal-register.d.ts +2 -0
- package/dist/types/components/sqm-portal-registration-form/PortalRegistrationForm.stories.d.ts +10 -0
- package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form-view.d.ts +32 -0
- package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form.d.ts +76 -0
- package/dist/types/components/sqm-portal-registration-form/usePortalRegistrationForm.d.ts +25 -0
- package/dist/types/components/sqm-portal-reset-password/sqm-portal-reset-password.d.ts +1 -0
- package/dist/types/components/sqm-program-explainer-step/sqm-program-explainer-step.d.ts +1 -1
- package/dist/types/components/sqm-qa/sqm-qa.d.ts +4 -0
- package/dist/types/components/sqm-qa-referral-card/ReferralCard.stories.d.ts +14 -0
- package/dist/types/components/sqm-qa-referral-card/sqm-referral-card-view.d.ts +9 -0
- package/dist/types/components/sqm-qa-referral-card/sqm-referral-card.d.ts +20 -0
- package/dist/types/components/sqm-qa-tabs/Tabs.stories.d.ts +15 -0
- package/dist/types/components/sqm-qa-tabs/sqm-tabs-view.d.ts +9 -0
- package/dist/types/components/sqm-qa-tabs/sqm-tabs.d.ts +23 -0
- package/dist/types/components/sqm-qa-tabs/useTabs.d.ts +9 -0
- package/dist/types/components/sqm-referral-table/columns/sqm-referral-table-rewards-column.d.ts +1 -0
- package/dist/types/components/sqm-referral-table/sqm-referral-table.d.ts +2 -1
- package/dist/types/components/sqm-rewards-table/columns/RewardTableColumn.d.ts +1 -1
- package/dist/types/components/sqm-rewards-table/columns/sqm-rewards-table-plop-target.d.ts +11 -0
- package/dist/types/components/sqm-rewards-table/columns/sqm-rewards-table-status-column.d.ts +6 -2
- package/dist/types/components/sqm-rewards-table/sqm-rewards-table.d.ts +1 -1
- package/dist/types/components/sqm-scroll/sqm-scroll.d.ts +5 -2
- package/dist/types/components/sqm-share-button/sqm-share-button.d.ts +2 -0
- package/dist/types/components/sqm-tab/sqm-tab.d.ts +1 -1
- package/dist/types/components/sqm-task-card/sqm-task-card.d.ts +5 -1
- package/dist/types/components/sqm-timeline/sqm-timeline-entry.d.ts +1 -1
- package/dist/types/components/sqm-titled-section/sqm-titled-section.d.ts +6 -2
- package/dist/types/components.d.ts +275 -12
- package/dist/types/global/android.d.ts +7 -0
- package/dist/types/global/demo.d.ts +1 -0
- package/dist/types/stories/features.d.ts +4 -0
- package/dist/types/stories/templates.d.ts +4 -0
- package/docs/docs.docx +0 -0
- package/docs/grapesjs.js +54 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +3 -3
- package/dist/esm-es5/ShadowViewAddon-e2996624.js +0 -1
- package/dist/esm-es5/re-render-69774e13.js +0 -1
- package/dist/esm-es5/sqm-navigation-sidebar-item-view-51714c31.js +0 -1
- package/dist/esm-es5/use-callback-7e0bfd3b.js +0 -1
- package/dist/esm-es5/useChildElements-a8347aea.js +0 -1
- package/dist/esm-es5/useReferralTable-5cac5b13.js +0 -1
- package/dist/mint-components/p-03828842.system.entry.js +0 -1
- package/dist/mint-components/p-12a9ade0.entry.js +0 -99
- package/dist/mint-components/p-13086b8d.js +0 -1
- package/dist/mint-components/p-232672a2.entry.js +0 -13
- package/dist/mint-components/p-25ac7c14.system.entry.js +0 -1
- package/dist/mint-components/p-38d6112f.entry.js +0 -1
- package/dist/mint-components/p-3facf714.js +0 -268
- package/dist/mint-components/p-4a1f24ef.entry.js +0 -1
- package/dist/mint-components/p-4a2782fd.system.entry.js +0 -1
- package/dist/mint-components/p-4f8830b7.entry.js +0 -1
- package/dist/mint-components/p-4fe59c93.system.entry.js +0 -1
- package/dist/mint-components/p-60b01103.js +0 -1
- package/dist/mint-components/p-66ce7f0e.entry.js +0 -9
- package/dist/mint-components/p-71969ce5.system.entry.js +0 -1
- package/dist/mint-components/p-71ecbb3b.system.js +0 -1
- package/dist/mint-components/p-83e4168e.system.entry.js +0 -1
- package/dist/mint-components/p-91acec3d.entry.js +0 -159
- package/dist/mint-components/p-94096609.system.js +0 -1
- package/dist/mint-components/p-95398ce2.js +0 -1
- package/dist/mint-components/p-95bbe8a7.entry.js +0 -1
- package/dist/mint-components/p-982ad256.js +0 -1
- package/dist/mint-components/p-9eb6d960.entry.js +0 -1
- package/dist/mint-components/p-a57057c4.system.entry.js +0 -1
- package/dist/mint-components/p-ac6c93ee.entry.js +0 -1
- package/dist/mint-components/p-c7d34b6a.system.entry.js +0 -1
- package/dist/mint-components/p-cc6d91bd.entry.js +0 -1
- package/dist/mint-components/p-cccba50e.entry.js +0 -1
- package/dist/mint-components/p-d3cc0d60.system.js +0 -1
- package/dist/mint-components/p-d7bc7e50.entry.js +0 -1
- package/dist/mint-components/p-d815567f.system.js +0 -1
- package/dist/mint-components/p-e0d5d38e.system.entry.js +0 -1
- package/dist/mint-components/p-ef3f3523.entry.js +0 -1
- package/dist/mint-components/p-f7fba9e4.system.entry.js +0 -1
- package/dist/mint-components/p-fd2852a7.entry.js +0 -1
- package/dist/mint-components/p-fd4d90b9.system.js +0 -1
- package/dist/mint-components/p-ff932bfa.entry.js +0 -1
|
@@ -4,21 +4,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b0129cd6.js');
|
|
6
6
|
const stencilHooks_module = require('./stencil-hooks.module-87a1f4f7.js');
|
|
7
|
-
const global = require('./global-
|
|
7
|
+
const global = require('./global-6e1584a6.js');
|
|
8
8
|
const useCallback = require('./use-callback-e754042f.js');
|
|
9
|
-
const index_module = require('./index.module-
|
|
9
|
+
const index_module = require('./index.module-d169a23f.js');
|
|
10
10
|
require('./extends-08099afd.js');
|
|
11
11
|
const jsonpointer = require('./jsonpointer-11327262.js');
|
|
12
12
|
const cjs = require('./cjs-1066ec21.js');
|
|
13
13
|
require('./mixins-fe9d4112.js');
|
|
14
14
|
const JSS = require('./JSS-97fd087e.js');
|
|
15
|
-
const reRender = require('./re-render-
|
|
16
|
-
const useChildElements = require('./useChildElements-
|
|
15
|
+
const reRender = require('./re-render-83d1c1f0.js');
|
|
16
|
+
const useChildElements = require('./useChildElements-36106d83.js');
|
|
17
17
|
require('./luxon-59ca7d19.js');
|
|
18
18
|
const utils = require('./utils-6847bc06.js');
|
|
19
19
|
require('./sqm-text-span-view-2c7d94b5.js');
|
|
20
20
|
require('./sqm-portal-container-view-840db620.js');
|
|
21
|
-
const
|
|
21
|
+
const useValidationState = require('./useValidationState-733d7e8c.js');
|
|
22
|
+
const ShadowViewAddon = require('./ShadowViewAddon-7b7dd5e3.js');
|
|
22
23
|
require('./sqm-portal-section-view-854a3e9c.js');
|
|
23
24
|
|
|
24
25
|
const BigStat = class {
|
|
@@ -28,6 +29,7 @@ const BigStat = class {
|
|
|
28
29
|
* Controls the order of the stat value & description column
|
|
29
30
|
*
|
|
30
31
|
* @uiName Flex Reverse
|
|
32
|
+
* @default
|
|
31
33
|
*/
|
|
32
34
|
this.flexReverse = false;
|
|
33
35
|
this.ignored = true;
|
|
@@ -36,8 +38,8 @@ const BigStat = class {
|
|
|
36
38
|
disconnectedCallback() { }
|
|
37
39
|
render() {
|
|
38
40
|
var _a;
|
|
39
|
-
const { props, label } = index_module.
|
|
40
|
-
const host = index_module.
|
|
41
|
+
const { props, label } = index_module.T() ? ShadowViewAddon.useDemoBigStat(this) : ShadowViewAddon.useBigStat(this);
|
|
42
|
+
const host = index_module.k();
|
|
41
43
|
const hasLabel = !!((_a = host.innerHTML) === null || _a === void 0 ? void 0 : _a.trim());
|
|
42
44
|
const labelSlot = index.h("slot", { name: "label" }, hasLabel ? index.h("slot", null) : label);
|
|
43
45
|
return index.h(ShadowViewAddon.BigStatView, Object.assign({}, props, { labelSlot: labelSlot }));
|
|
@@ -149,7 +151,7 @@ const styleString = sheet.toString();
|
|
|
149
151
|
function RequiredPropsError({ missingProps, heading = "There was a problem loading this section", subheading = "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.", description = "Error occured while loading <{tagName}>. Values for the following attributes are missing:", }, children) {
|
|
150
152
|
if (!missingProps)
|
|
151
153
|
return false;
|
|
152
|
-
const host = index_module.
|
|
154
|
+
const host = index_module.k();
|
|
153
155
|
const [detailsOpen, setDetailsOpen] = stencilHooks_module.useState(false);
|
|
154
156
|
return (index.h("sl-alert", { type: "danger", open: true },
|
|
155
157
|
index.h("style", { type: "text/css" }, styleString),
|
|
@@ -177,15 +179,8 @@ function RequiredPropsError({ missingProps, heading = "There was a problem loadi
|
|
|
177
179
|
index.h("div", { class: sheet.classes.Children }, children)));
|
|
178
180
|
}
|
|
179
181
|
|
|
180
|
-
const FORM_VALIDATION_CONTEXT = "sq:validation-state";
|
|
181
|
-
function useValidationState(formState) {
|
|
182
|
-
const host = index_module.P();
|
|
183
|
-
const [validationState, setValidationState] = stencilHooks_module.y(host, FORM_VALIDATION_CONTEXT, formState);
|
|
184
|
-
return { validationState, setValidationState };
|
|
185
|
-
}
|
|
186
|
-
|
|
187
182
|
function useCheckboxField() {
|
|
188
|
-
const validationState = stencilHooks_module.d(FORM_VALIDATION_CONTEXT);
|
|
183
|
+
const validationState = stencilHooks_module.d(useValidationState.FORM_VALIDATION_CONTEXT);
|
|
189
184
|
const [checked, setChecked] = stencilHooks_module.useState(false);
|
|
190
185
|
return {
|
|
191
186
|
states: {
|
|
@@ -222,6 +217,7 @@ const CheckboxField = class {
|
|
|
222
217
|
this.errorMessage = "Must be checked";
|
|
223
218
|
/**
|
|
224
219
|
* @uiName Optional
|
|
220
|
+
* @default
|
|
225
221
|
*/
|
|
226
222
|
this.checkboxOptional = false;
|
|
227
223
|
stencilHooks_module.h$1(this);
|
|
@@ -234,13 +230,13 @@ const CheckboxField = class {
|
|
|
234
230
|
value: this.checkboxName,
|
|
235
231
|
},
|
|
236
232
|
]);
|
|
237
|
-
if (!index_module.
|
|
233
|
+
if (!index_module.T() && missingProps) {
|
|
238
234
|
return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this checkbox field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
|
|
239
235
|
}
|
|
240
236
|
const content = {
|
|
241
237
|
...utils.getProps(this),
|
|
242
238
|
};
|
|
243
|
-
const { states, callbacks } = index_module.
|
|
239
|
+
const { states, callbacks } = index_module.T()
|
|
244
240
|
? useCheckboxFieldDemo(this)
|
|
245
241
|
: useCheckboxField();
|
|
246
242
|
return (index.h(ShadowViewAddon.CheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
|
|
@@ -326,7 +322,7 @@ const DividedLayout = class {
|
|
|
326
322
|
};
|
|
327
323
|
|
|
328
324
|
function useDropdownField() {
|
|
329
|
-
const validationState = stencilHooks_module.d(FORM_VALIDATION_CONTEXT);
|
|
325
|
+
const validationState = stencilHooks_module.d(useValidationState.FORM_VALIDATION_CONTEXT);
|
|
330
326
|
return {
|
|
331
327
|
states: {
|
|
332
328
|
validationErrors: validationState === null || validationState === void 0 ? void 0 : validationState.validationErrors,
|
|
@@ -348,6 +344,7 @@ const DropdownField = class {
|
|
|
348
344
|
this.errorMessage = "Select an option";
|
|
349
345
|
/**
|
|
350
346
|
* @uiName Optional
|
|
347
|
+
* @default
|
|
351
348
|
*/
|
|
352
349
|
this.dropdownOptional = false;
|
|
353
350
|
stencilHooks_module.h$1(this);
|
|
@@ -360,14 +357,14 @@ const DropdownField = class {
|
|
|
360
357
|
value: this.dropdownName,
|
|
361
358
|
},
|
|
362
359
|
]);
|
|
363
|
-
if (!index_module.
|
|
360
|
+
if (!index_module.T() && missingProps) {
|
|
364
361
|
return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this drop down field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }, index.h("slot", null)));
|
|
365
362
|
}
|
|
366
363
|
const content = {
|
|
367
364
|
...utils.getProps(this),
|
|
368
365
|
selectOptions: index.h("slot", null),
|
|
369
366
|
};
|
|
370
|
-
const { states } = index_module.
|
|
367
|
+
const { states } = index_module.T()
|
|
371
368
|
? useDropdownFieldDemo(this)
|
|
372
369
|
: useDropdownField();
|
|
373
370
|
return (index.h(ShadowViewAddon.DropdownFieldView, { states: states, content: content }));
|
|
@@ -424,13 +421,13 @@ const defaultFormState = {
|
|
|
424
421
|
error: "",
|
|
425
422
|
};
|
|
426
423
|
function useEditProfile(props) {
|
|
427
|
-
const userIdent = index_module.
|
|
424
|
+
const userIdent = index_module.oe();
|
|
428
425
|
const [showEdit, setShowEdit] = stencilHooks_module.useState(false);
|
|
429
426
|
const [error, setError] = stencilHooks_module.useState("");
|
|
430
427
|
const [userData, setUserData] = stencilHooks_module.useState(undefined);
|
|
431
428
|
const [formState, setFormState] = stencilHooks_module.useState(defaultFormState);
|
|
432
|
-
const userDataResponse = index_module.
|
|
433
|
-
const [upsertUser, upsertUserResponse] = index_module.
|
|
429
|
+
const userDataResponse = index_module.kt(GET_USER, {}, !(userIdent === null || userIdent === void 0 ? void 0 : userIdent.jwt));
|
|
430
|
+
const [upsertUser, upsertUserResponse] = index_module.Oe(UPSERT_USER);
|
|
434
431
|
stencilHooks_module.useEffect(() => {
|
|
435
432
|
if ((upsertUserResponse === null || upsertUserResponse === void 0 ? void 0 : upsertUserResponse.loading) || !showEdit)
|
|
436
433
|
return;
|
|
@@ -544,7 +541,7 @@ const EditProfile = class {
|
|
|
544
541
|
}
|
|
545
542
|
disconnectedCallback() { }
|
|
546
543
|
render() {
|
|
547
|
-
const props = index_module.
|
|
544
|
+
const props = index_module.T()
|
|
548
545
|
? useEditProfileDemo(utils.getProps(this))
|
|
549
546
|
: useEditProfile(utils.getProps(this));
|
|
550
547
|
return index.h(ShadowViewAddon.EditProfileView, Object.assign({}, props));
|
|
@@ -777,6 +774,7 @@ const HeroImage = class {
|
|
|
777
774
|
this.imageMobilePos = "top";
|
|
778
775
|
/**
|
|
779
776
|
* @uiName Open Link in New Tab
|
|
777
|
+
* @default
|
|
780
778
|
*/
|
|
781
779
|
this.buttonNewTab = false;
|
|
782
780
|
/**
|
|
@@ -815,7 +813,7 @@ const SqmHookStoryContainer = class {
|
|
|
815
813
|
};
|
|
816
814
|
|
|
817
815
|
function useInputField() {
|
|
818
|
-
const validationState = stencilHooks_module.d(FORM_VALIDATION_CONTEXT);
|
|
816
|
+
const validationState = stencilHooks_module.d(useValidationState.FORM_VALIDATION_CONTEXT);
|
|
819
817
|
return {
|
|
820
818
|
states: {
|
|
821
819
|
validationErrors: validationState === null || validationState === void 0 ? void 0 : validationState.validationErrors,
|
|
@@ -840,6 +838,7 @@ const InputField = class {
|
|
|
840
838
|
this.errorMessage = "Cannot be empty";
|
|
841
839
|
/**
|
|
842
840
|
* @uiName Optional
|
|
841
|
+
* @default
|
|
843
842
|
*/
|
|
844
843
|
this.fieldOptional = false;
|
|
845
844
|
stencilHooks_module.h$1(this);
|
|
@@ -855,10 +854,10 @@ const InputField = class {
|
|
|
855
854
|
value: this.fieldName,
|
|
856
855
|
},
|
|
857
856
|
]);
|
|
858
|
-
if (!index_module.
|
|
857
|
+
if (!index_module.T() && missingProps) {
|
|
859
858
|
return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this input field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
|
|
860
859
|
}
|
|
861
|
-
const { states } = index_module.
|
|
860
|
+
const { states } = index_module.T() ? useInputFieldDemo(this) : useInputField();
|
|
862
861
|
return index.h(ShadowViewAddon.InputFieldView, { states: states, content: content });
|
|
863
862
|
}
|
|
864
863
|
};
|
|
@@ -914,11 +913,11 @@ const GET_RANK = index_module.dist.gql `
|
|
|
914
913
|
`;
|
|
915
914
|
function useLeaderboard(props) {
|
|
916
915
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
917
|
-
const programIdContext = index_module.
|
|
916
|
+
const programIdContext = index_module.F();
|
|
918
917
|
// Default to context, overriden by props
|
|
919
918
|
const programId = (_a = props.programId) !== null && _a !== void 0 ? _a : programIdContext;
|
|
920
|
-
const user = index_module.
|
|
921
|
-
const locale = index_module.
|
|
919
|
+
const user = index_module.oe();
|
|
920
|
+
const locale = index_module.M();
|
|
922
921
|
const variables = programId
|
|
923
922
|
? {
|
|
924
923
|
type: props.leaderboardType,
|
|
@@ -937,8 +936,8 @@ function useLeaderboard(props) {
|
|
|
937
936
|
if (props.maxRows > 0) {
|
|
938
937
|
variables["limit"] = props.maxRows;
|
|
939
938
|
}
|
|
940
|
-
const { data: leaderboardData, loading: loadingLeaderboard } = index_module.
|
|
941
|
-
const { data: rankData } = index_module.
|
|
939
|
+
const { data: leaderboardData, loading: loadingLeaderboard } = index_module.kt(GET_LEADERBOARD, variables, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
940
|
+
const { data: rankData } = index_module.kt(GET_RANK, variables, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
942
941
|
const leaderboardRows = (_b = leaderboardData === null || leaderboardData === void 0 ? void 0 : leaderboardData.userLeaderboard) === null || _b === void 0 ? void 0 : _b.rows;
|
|
943
942
|
const flattenedLeaderboard = getFlattenedLeaderboard(leaderboardRows);
|
|
944
943
|
const sortedLeaderboard = flattenedLeaderboard === null || flattenedLeaderboard === void 0 ? void 0 : flattenedLeaderboard.sort(function (a, b) {
|
|
@@ -988,6 +987,7 @@ const Leaderboard = class {
|
|
|
988
987
|
* Hide the viewer's leaderboard row if not in the top results.
|
|
989
988
|
*
|
|
990
989
|
* @uiName Hide Viewing User
|
|
990
|
+
* @default
|
|
991
991
|
*/
|
|
992
992
|
this.hideViewer = false;
|
|
993
993
|
/**
|
|
@@ -1023,7 +1023,7 @@ const Leaderboard = class {
|
|
|
1023
1023
|
showRank: this.showRank,
|
|
1024
1024
|
};
|
|
1025
1025
|
const demoProps = { ...props, demoData: this.demoData };
|
|
1026
|
-
const viewprops = index_module.
|
|
1026
|
+
const viewprops = index_module.T()
|
|
1027
1027
|
? useLeaderboardDemo(demoProps)
|
|
1028
1028
|
: useLeaderboard(props);
|
|
1029
1029
|
return index.h(ShadowViewAddon.LeaderboardView, Object.assign({}, viewprops));
|
|
@@ -1105,7 +1105,7 @@ function useLeaderboardDemo(props) {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
1107
1107
|
function useNameFields(props) {
|
|
1108
|
-
const validationState = stencilHooks_module.d(FORM_VALIDATION_CONTEXT);
|
|
1108
|
+
const validationState = stencilHooks_module.d(useValidationState.FORM_VALIDATION_CONTEXT);
|
|
1109
1109
|
return {
|
|
1110
1110
|
states: {
|
|
1111
1111
|
validationErrors: validationState === null || validationState === void 0 ? void 0 : validationState.validationErrors,
|
|
@@ -1133,7 +1133,7 @@ const NameFields = class {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
disconnectedCallback() { }
|
|
1135
1135
|
render() {
|
|
1136
|
-
const { states } = index_module.
|
|
1136
|
+
const { states } = index_module.T() ? useNameFieldsDemo(this) : useNameFields(this);
|
|
1137
1137
|
return index.h(ShadowViewAddon.NameFieldsView, { states: states });
|
|
1138
1138
|
}
|
|
1139
1139
|
};
|
|
@@ -1164,12 +1164,12 @@ function NavigationMenuView(props) {
|
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
1166
1166
|
function handleMenu(e) {
|
|
1167
|
-
index_module.
|
|
1167
|
+
index_module.Ft.push(e.detail.item.value);
|
|
1168
1168
|
}
|
|
1169
1169
|
function useNavigationMenu(props) {
|
|
1170
1170
|
const ref = stencilHooks_module.useRef();
|
|
1171
|
-
const [, rerender] = index_module.
|
|
1172
|
-
const user = index_module.
|
|
1171
|
+
const [, rerender] = index_module.Pt();
|
|
1172
|
+
const user = index_module.oe();
|
|
1173
1173
|
stencilHooks_module.useEffect(() => {
|
|
1174
1174
|
var _a;
|
|
1175
1175
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener("sl-select", (e) => handleMenu(e));
|
|
@@ -1198,7 +1198,7 @@ const NavigationMenu = class {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
disconnectedCallback() { }
|
|
1200
1200
|
render() {
|
|
1201
|
-
const props = index_module.
|
|
1201
|
+
const props = index_module.T()
|
|
1202
1202
|
? useNavigationMenuDemo(utils.getProps(this))
|
|
1203
1203
|
: useNavigationMenu(utils.getProps(this));
|
|
1204
1204
|
return (index.h(index.Host, { slot: "sqm-navigation-menu" }, index.h(NavigationMenuView, Object.assign({}, props))));
|
|
@@ -1222,12 +1222,12 @@ function useNavigationMenuDemo(props) {
|
|
|
1222
1222
|
NavigationMenu.style = sqmNavigationMenuCss;
|
|
1223
1223
|
|
|
1224
1224
|
function usePortalChangePassword(props) {
|
|
1225
|
-
var _a, _b, _c, _d;
|
|
1226
|
-
const [request, { loading, errors, data }] = index_module
|
|
1225
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1226
|
+
const [request, { loading, errors, data }] = index_module.Ze();
|
|
1227
1227
|
const [open, setOpen] = stencilHooks_module.useState(false);
|
|
1228
1228
|
const [error, setError] = stencilHooks_module.useState("");
|
|
1229
1229
|
const [success, setSuccess] = stencilHooks_module.useState(false);
|
|
1230
|
-
const user = index_module.
|
|
1230
|
+
const user = index_module.oe();
|
|
1231
1231
|
const submit = async (event) => {
|
|
1232
1232
|
var _a;
|
|
1233
1233
|
setSuccess(false);
|
|
@@ -1260,7 +1260,7 @@ function usePortalChangePassword(props) {
|
|
|
1260
1260
|
open,
|
|
1261
1261
|
loading,
|
|
1262
1262
|
success,
|
|
1263
|
-
error: error || ((_d = (_c = (_b = errors === null || errors === void 0 ? void 0 : errors.response) === null || _b === void 0 ? void 0 : _b.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.message),
|
|
1263
|
+
error: error || ((_e = (_d = (_c = (_b = errors === null || errors === void 0 ? void 0 : errors.response) === null || _b === void 0 ? void 0 : _b.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.extensions) === null || _e === void 0 ? void 0 : _e.message) || ((_h = (_g = (_f = errors === null || errors === void 0 ? void 0 : errors.response) === null || _f === void 0 ? void 0 : _f.errors) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.message),
|
|
1264
1264
|
content: {
|
|
1265
1265
|
modalChangePasswordHeader: props.modalChangePasswordHeader,
|
|
1266
1266
|
cancelText: props.cancelText,
|
|
@@ -1332,7 +1332,7 @@ const PortalChangePassword = class {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
disconnectedCallback() { }
|
|
1334
1334
|
render() {
|
|
1335
|
-
const { states, callbacks } = index_module.
|
|
1335
|
+
const { states, callbacks } = index_module.T()
|
|
1336
1336
|
? usePortalChangePasswordDemo(this)
|
|
1337
1337
|
: usePortalChangePassword(this);
|
|
1338
1338
|
return index.h(ShadowViewAddon.PortalChangePasswordView, { states: states, callbacks: callbacks });
|
|
@@ -1362,7 +1362,7 @@ function usePortalChangePasswordDemo(props) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
1364
|
function usePortalFrame(footerContent, headerContent) {
|
|
1365
|
-
const [, rerender] = index_module.
|
|
1365
|
+
const [, rerender] = index_module.Pt();
|
|
1366
1366
|
return {
|
|
1367
1367
|
data: {
|
|
1368
1368
|
footer: footerContent,
|
|
@@ -1384,7 +1384,7 @@ const PortalFrame = class {
|
|
|
1384
1384
|
render() {
|
|
1385
1385
|
const footerContent = index.h("slot", { name: "footer" });
|
|
1386
1386
|
const headerContent = index.h("slot", { name: "header" });
|
|
1387
|
-
const props = index_module.
|
|
1387
|
+
const props = index_module.T()
|
|
1388
1388
|
? usePortalFrameDemo(footerContent, headerContent, this)
|
|
1389
1389
|
: usePortalFrame(footerContent, headerContent);
|
|
1390
1390
|
return (index.h(ShadowViewAddon.PortalFrameView, Object.assign({}, props), index.h("slot", null)));
|
|
@@ -1406,8 +1406,8 @@ function usePortalFrameDemo(footerContent, headerContent, props) {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
|
|
1408
1408
|
function usePortalLogin(props) {
|
|
1409
|
-
var _a, _b, _c, _d;
|
|
1410
|
-
const [request, { loading, errors, data }] = index_module.
|
|
1409
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1410
|
+
const [request, { loading, errors, data }] = index_module.Ae();
|
|
1411
1411
|
const [error, setError] = stencilHooks_module.useState("");
|
|
1412
1412
|
const urlParams = new URLSearchParams(window.location.search);
|
|
1413
1413
|
const nextPageOverride = urlParams.get("nextPage");
|
|
@@ -1425,7 +1425,7 @@ function usePortalLogin(props) {
|
|
|
1425
1425
|
if ((_a = data === null || data === void 0 ? void 0 : data.authenticateManagedIdentityWithEmailAndPassword) === null || _a === void 0 ? void 0 : _a.token) {
|
|
1426
1426
|
urlParams.delete("nextPage");
|
|
1427
1427
|
const url = utils.sanitizeUrlPath(nextPageOverride || props.nextPage);
|
|
1428
|
-
index_module.
|
|
1428
|
+
index_module.Ft.push(url.href);
|
|
1429
1429
|
}
|
|
1430
1430
|
}, [(_a = data === null || data === void 0 ? void 0 : data.authenticateManagedIdentityWithEmailAndPassword) === null || _a === void 0 ? void 0 : _a.token]);
|
|
1431
1431
|
stencilHooks_module.useEffect(() => {
|
|
@@ -1434,7 +1434,8 @@ function usePortalLogin(props) {
|
|
|
1434
1434
|
setError("Network request failed.");
|
|
1435
1435
|
}
|
|
1436
1436
|
}, [errors]);
|
|
1437
|
-
const errorMessage = ((_d = (_c = (_b = errors === null || errors === void 0 ? void 0 : errors.response) === null || _b === void 0 ? void 0 : _b.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.message) ||
|
|
1437
|
+
const errorMessage = ((_e = (_d = (_c = (_b = errors === null || errors === void 0 ? void 0 : errors.response) === null || _b === void 0 ? void 0 : _b.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.extensions) === null || _e === void 0 ? void 0 : _e.message) || ((_h = (_g = (_f = errors === null || errors === void 0 ? void 0 : errors.response) === null || _f === void 0 ? void 0 : _f.errors) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.message) ||
|
|
1438
|
+
error;
|
|
1438
1439
|
return {
|
|
1439
1440
|
states: {
|
|
1440
1441
|
loading,
|
|
@@ -1508,12 +1509,12 @@ const PortalLogin = class {
|
|
|
1508
1509
|
}
|
|
1509
1510
|
disconnectedCallback() { }
|
|
1510
1511
|
render() {
|
|
1511
|
-
const { states, callbacks } = index_module.
|
|
1512
|
+
const { states, callbacks } = index_module.T()
|
|
1512
1513
|
? useLoginDemo(this)
|
|
1513
1514
|
: usePortalLogin(this);
|
|
1514
1515
|
const content = {
|
|
1515
|
-
forgotPasswordButton: (index.h("slot", { name: "forgotPassword" }, index.h("a", { onClick: () => index_module.
|
|
1516
|
-
secondaryButton: (index.h("slot", { name: "secondaryButton" }, index.h("sl-button", { type: "text", disabled: states.loading, onClick: () => index_module.
|
|
1516
|
+
forgotPasswordButton: (index.h("slot", { name: "forgotPassword" }, index.h("a", { onClick: () => index_module.Ft.push(states.forgotPasswordPath) }, this.forgotPasswordLabel))),
|
|
1517
|
+
secondaryButton: (index.h("slot", { name: "secondaryButton" }, index.h("sl-button", { type: "text", disabled: states.loading, onClick: () => index_module.Ft.push(states.registerPath) }, this.registerLabel))),
|
|
1517
1518
|
emailLabel: this.emailLabel,
|
|
1518
1519
|
passwordLabel: this.passwordLabel,
|
|
1519
1520
|
submitLabel: this.submitLabel,
|
|
@@ -1538,3882 +1539,11 @@ function useLoginDemo(props) {
|
|
|
1538
1539
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
1539
1540
|
}
|
|
1540
1541
|
|
|
1541
|
-
// This file is a workaround for a bug in web browsers' "native"
|
|
1542
|
-
// ES6 importing system which is uncapable of importing "*.json" files.
|
|
1543
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/239
|
|
1544
|
-
const 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,"1|([457]\\d{6})$","268$1",0,"268"],"AI":["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2457]\\d{6})$","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,"1|([267]\\d{6})$","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(?: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,8}|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10],[["(\\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,"0|(183[12])",0,0,0,[["(?:(?: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]))\\d{3}|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]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[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}",[9]],["4(?:83[0-38]|93[0-4])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-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{3}|45[0-4])\\d{3}|13\\d{4}",[6,8,10]]],"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|46","1[28]|2|365(?:[0-46-9]|5[0-35-9])|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,"1|([2-9]\\d{6})$","246$1",0,"246"],"BD":["880","00","1\\d{9}|2\\d{7,8}|88\\d{4,6}|(?:8[0-79]|9\\d)\\d{4,8}|(?:[346]\\d|[57])\\d{5,8}",[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(?:28|4[14]|5)|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]"],"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","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],"BG":["359","00","[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9],[["(\\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[047]"]]]],"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","[25689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[25689]"]]]],"BL":["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"BM":["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-8]\\d{6})$","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-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\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-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-24679]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\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,"1|([3-8]\\d{6})$","242$1",0,"242"],"BT":["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],"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-79]"]],["(\\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-8]\\d|90)\\d{8}",[10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50)|3(?:06|43|6[578])|4(?:03|1[68]|3[178]|50|74)|5(?:06|1[49]|48|79|8[17])|6(?:04|13|39|47|72)|7(?:0[59]|78|8[02])|8(?:[06]7|19|25|73)|90[25])[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[12]|33|44|66|77|88)|622)[2-9]\\d{6}"],0,0,0,["600[2-9]\\d{6}"]]],"CC":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d|8[0-24-9])\\d{7}|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10],0,"0",0,"0|([59]\\d{7})$","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(?:83[0-38]|93[0-4])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-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{3}|45[0-4])\\d{3}|13\\d{4}",[6,8,10]]],"0011"],"CD":["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\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{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],"CF":["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],"CG":["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["801"]],["(\\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],[["(\\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{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-3]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[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[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","(?:10|2[0-57-9])(?:100|9[56])"],"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,"0|(1(?:[12]\\d|79)\\d\\d)",0,0,0,0,"00"],"CO":["57","00(?:4(?:[14]4|56)|[579])","(?:(?:1\\d|3)\\d{3}|9101)\\d{6}|[124-8]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1 $2",["[14][2-9]|[25-8]"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["[39]"]],["(\\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","[27]\\d{6,7}|[34]\\d{5,7}|(?:5|8\\d\\d)\\d{7}",[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",["5"],"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[0-24-9])\\d{7}|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10],0,"0",0,"0|([59]\\d{7})$","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(?:83[0-38]|93[0-4])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-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{3}|45[0-4])\\d{3}|13\\d{4}",[6,8,10]]],"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],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\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(?:[12]\\d|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[05]\\d|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{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"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,"1|([2-7]\\d{6})$","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",["[189]"],"0$1"]],"0"],"EH":["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],"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-59]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-59]"],"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)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"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",["11|[67]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]]],0,0,"0(11\\d{6}|6[256]\\d{6}|7[47]\\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,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[023])|4(?:[0-5]\\d\\d|69[7-9]|70[059])|(?:5[0-26-9]|[78][0-49])\\d\\d|6(?:[0-4]\\d\\d|50[259]))|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\\d|1(?:[0-7]\\d\\d|8(?:[02]\\d|1[278])))|(?: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-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|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,"1|([2-9]\\d{6})$","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","(?:[56]94|80\\d|976)\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"GG":["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"0|([25-9]\\d{5})$","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-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],"GH":["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],"GI":["350","00","(?:[25]\\d\\d|606)\\d{5}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],"GL":["299","00","(?:19|[2-689]\\d)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-689]"]]]],"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","(?:590|(?:69|80)\\d|976)\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|1[0-2]|2[0-68]|3[1289]|4[0-24-9]|5[3-579]|6[0189]|7[08]|8[0-689]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"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,10}|(?:[269]\\d|70)\\d{8}",[10,11],[["(\\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})(\\d{5})","$1 $2 $3",["8"]]]],"GT":["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],"GU":["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"1|([3-9]\\d{6})$","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","(?:862\\d|9008)\\d{3}|(?:[2-46]\\d|77)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-46-9]"]]]],"HK":["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4}(?:\\d(?:\\d(?:\\d{4})?)?)?|(?:[235-79]\\d|46)\\d{6}",[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","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,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",["[67]"],"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-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],"HT":["509","00","[2-489]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-489]"]]]],"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]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\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,"0|([25-8]\\d{5})$","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]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[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(?:(?:2[14]|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|4[47])|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(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|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]|28|3[129]|4[1-35689]|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[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|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|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|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",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[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,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],[["(\\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[245])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|[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[4679]|[38]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]"]],["(\\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",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|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[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d\\d|89(?:2|4[5-9]\\d))\\d{3}|89[45][0-4]\\d\\d|(?:1(?:44|6[346])|89(?:5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,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|([0-24-8]\\d{5})$","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\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-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|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|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",["7"],"0$1"]],"0"],"JP":["81","010","00[1-9]\\d{6,14}|[257-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|63)|9(?:49|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]|636)|9(?:496|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]|636[457-9])|9(?:496|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",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"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[045]|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[27-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])|5(?:2|3[045]|4[0-369]|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])|49|51|6(?:[0-24]|36|5[0-3589]|72|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]))|(?:49|55|83)[29]|(?: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]|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]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|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]","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]|7[015-9]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17|3[015-9]))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|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(?:[019]|4[1-3]|6(?:[0-47-9]|5[01346-9])))|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|829(?:2|66)|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",["[257-9]"],"0$1"]],"0"],"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-8]\\d|99)\\d{7}",[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,"1|([2-7]\\d{6})$","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",["60|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|[2569]\\d\\d)\\d{5}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[25]"]]]],"KY":["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","345$1",0,"345"],"KZ":["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|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",["30[013-9]"],"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-7]|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,"1|([2-8]\\d{6})$","758$1",0,"758"],"LI":["423","00","90\\d{5}|(?:[2378]|6\\d\\d)\\d{6}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[237-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"0|(1001)"],"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","(?:2|33|5\\d|77|88)\\d{7}|[4-6]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3578]"],"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]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",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",["2(?:[0367]|4[3-8])"]],["(\\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",["2(?:[0367]|4[3-8])"]],["(\\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]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],"LV":["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|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{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29|38)[89]","5(?:29|38)[89]0"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:29(?:[189][05]|2[29]|3[01])|38[89][05])\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|90)|3(?:[0-47]\\d|5[02-9]|6[02-8]|80|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:0\\d|1[0-3]|6[1267]|7[0-57]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],"MC":["377","00","(?:[3489]|6\\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",["6"],"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","(?:590|(?:69|80)\\d|976)\\d{6}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|30|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"MG":["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"0|([24-9]\\d{6})$","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"],"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",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"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}|[57-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[57-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","08005\\d\\d|(?: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,"1|([2-9]\\d{6})$","670$1",0,"670"],"MQ":["596","00","(?:69|80)\\d{7}|(?:59|97)6\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"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,"1|([34]\\d{6})$","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])","(?:5|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",["5"]],["(\\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",["[3467]|9[13-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],"MW":["265","00","(?:[19]\\d|[23]1|77|88)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],"MX":["52","0[09]","199[1-9]\\d{7}|(?:1(?:[01467]\\d|[235][1-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",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])|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[36-8]"]],["(\\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","[2-57-9]\\d{5}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[2-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[04]"]]]],"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","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"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}|[89]\\d{6,9}|1\\d{4,5}",[5,6,7,8,9,10],[["(\\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-57-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",["[489]|59"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-7]"]]],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-579]|6[2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],"NR":["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],"NU":["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],"NZ":["64","0(?:0|161)","[29]\\d{7,9}|50\\d{5}(?:\\d{2,3})?|6[0-35-9]\\d{6}|7\\d{7,8}|8\\d{4,9}|(?:11\\d|[34])\\d{7}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-579]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|[89]0","50(?:[0367]|88)|[89]0"],"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)|[59]|80"],"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|86"],"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","8\\d{9}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10],[["(\\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","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,0," 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\\d{5}(?:\\d{2})?|8\\d{9}|[1-9]\\d{6}(?:\\d{2})?",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?: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","(?: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","(?:[45]|80\\d\\d)\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\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","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,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",["[26]1|3[289]|4[1246-8]|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-6])"],"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","[2-7]\\d{7}|(?:2\\d\\d|800)\\d{4}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["2[126]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]]]],"RE":["262","00","9769\\d{5}|(?:26|[68]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,"26[23]|69|[89]"],"RO":["40","00","(?:[237]\\d|[89]0)\\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",["[237-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-6]2|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-6]2|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,"3[04-689]|[489]",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",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]]],"0"],"SA":["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[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{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],"SB":["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],"SC":["248","010|0[0-2]","8000\\d{3}|(?:[249]\\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],[["(\\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)"],"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-4]|[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[0139]|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|[57]9)\\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{4}|93330)\\d{4}",[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)(\\d{7})","$1 $2",["24|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3478]|64|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[1-35-9]|9[2-9]"]]],"0"],"SR":["597","00","(?:[2-5]|68|[78]\\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-8]"]]]],"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","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\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,"1|(5\\d{6})$","721$1",0,"721"],"SY":["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"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,"1|([2-479]\\d{6})$","649$1",0,"649"],"TD":["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],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]","1\\d{9}|[1689]\\d{8}|[1-57]\\d{7}",[8,9,10],[["(\\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","(?:00|11|[2-57-9]\\d)\\d{7}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"],0,1],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[34]7|91[78]"],0,1],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"],0,1],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02-57-9]|11"],0,1]],"8",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{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",["6"],"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-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"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,"1|([2-46-8]\\d{6})$","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{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?: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]","(?:[26-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{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{2})(\\d{3})(\\d{4})","$1 $2 $3",["4[45][0-5]|5(?:0|6[37])|6(?:[12][018]|[36-8])|7|89|9[1-9]|(?:48|57)[0137-9]","4[45][0-5]|5(?:0|6(?:3[14-7]|7))|6(?:[12][018]|[36-8])|7|89|9[1-9]|(?:48|57)[0137-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["[3-6]"],"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}",[10],[["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[12]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[39]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[19]|6[1-47]|7[0-5]|8[056])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[0179]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[02-59]|8[156])|8(?:0[1-68]|1[02-8]|2[08]|3[0-289]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01579]|5[12469]|7[0-389]|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[12]|33|44|66|77|88)[2-9]\\d{6}"]]],"UY":["598","0(?:0|1[3-9]\\d)","4\\d{9}|[249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[24]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"]],"0",0,0,0,0,0,0,"00"," int. "],"UZ":["998","810","(?:33|55|[679]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[35-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],"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],0,0,0,0,0,0,"06698"],"VC":["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","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,"1|([2-578]\\d{6})$","284$1",0,"284"],"VI":["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","340$1",0,"340"],"VN":["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[69]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3578]"],"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)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\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","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\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",["[23]"],"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-68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],"YT":["262","00","80\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,"269|63"],"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","(?:63|80)0\\d{6}|(?:21|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"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,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,["[1-9]\\d{7}"]]],"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}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],"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,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],"882":["882",0,"[13]\\d{6}(?:\\d{2,5})?|285\\d{9}|(?:[19]\\d|49)\\d{6}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["4"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[19]"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["34[57]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-3]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|3(?:2|47|7\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,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})|(?:(?:285\\d\\d|3(?:45|[69]\\d{3}))\\d|9[89])\\d{6}"]]],"883":["883",0,"210\\d{7}|51\\d{7}(?:\\d{3})?",[9,10,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["510"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["5"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:210|51[013]0\\d)\\d{7}|5100\\d{5}"]]],"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}"]]]}};
|
|
1545
|
-
|
|
1546
|
-
// The minimum length of the national significant number.
|
|
1547
|
-
|
|
1548
|
-
var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers
|
|
1549
|
-
// (ascii, fullwidth, arabic-indic, and eastern arabic digits).
|
|
1550
|
-
|
|
1551
|
-
var VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9"; // `DASHES` will be right after the opening square bracket of the "character class"
|
|
1552
|
-
|
|
1553
|
-
var DASHES = "-\u2010-\u2015\u2212\u30FC\uFF0D";
|
|
1554
|
-
var SLASHES = "\uFF0F/";
|
|
1555
|
-
var DOTS = "\uFF0E.";
|
|
1556
|
-
var WHITESPACE = " \xA0\xAD\u200B\u2060\u3000";
|
|
1557
|
-
var BRACKETS = "()\uFF08\uFF09\uFF3B\uFF3D\\[\\]"; // export const OPENING_BRACKETS = '(\uFF08\uFF3B\\\['
|
|
1558
|
-
|
|
1559
|
-
var TILDES = "~\u2053\u223C\uFF5E"; // Regular expression of acceptable punctuation found in phone numbers. This
|
|
1560
|
-
// excludes punctuation found as a leading character only. This consists of dash
|
|
1561
|
-
// characters, white space characters, full stops, slashes, square brackets,
|
|
1562
|
-
// parentheses and tildes. Full-width variants are also present.
|
|
1563
|
-
|
|
1564
|
-
var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);
|
|
1565
|
-
var PLUS_CHARS = "+\uFF0B"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')
|
|
1566
|
-
|
|
1567
|
-
// Copy-pasted from:
|
|
1568
|
-
// https://github.com/substack/semver-compare/blob/master/index.js
|
|
1569
|
-
//
|
|
1570
|
-
// Inlining this function because some users reported issues with
|
|
1571
|
-
// importing from `semver-compare` in a browser with ES6 "native" modules.
|
|
1572
|
-
//
|
|
1573
|
-
// Fixes `semver-compare` not being able to compare versions with alpha/beta/etc "tags".
|
|
1574
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/381
|
|
1575
|
-
function compare (a, b) {
|
|
1576
|
-
a = a.split('-');
|
|
1577
|
-
b = b.split('-');
|
|
1578
|
-
var pa = a[0].split('.');
|
|
1579
|
-
var pb = b[0].split('.');
|
|
1580
|
-
|
|
1581
|
-
for (var i = 0; i < 3; i++) {
|
|
1582
|
-
var na = Number(pa[i]);
|
|
1583
|
-
var nb = Number(pb[i]);
|
|
1584
|
-
if (na > nb) return 1;
|
|
1585
|
-
if (nb > na) return -1;
|
|
1586
|
-
if (!isNaN(na) && isNaN(nb)) return 1;
|
|
1587
|
-
if (isNaN(na) && !isNaN(nb)) return -1;
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
if (a[1] && b[1]) {
|
|
1591
|
-
return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
1598
|
-
|
|
1599
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1600
|
-
|
|
1601
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1602
|
-
|
|
1603
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
1604
|
-
|
|
1605
|
-
var V3 = '1.2.0'; // Moved `001` country code to "nonGeographic" section of metadata.
|
|
1606
|
-
|
|
1607
|
-
var V4 = '1.7.35';
|
|
1608
|
-
var DEFAULT_EXT_PREFIX = ' ext. ';
|
|
1609
|
-
var CALLING_CODE_REG_EXP = /^\d+$/;
|
|
1610
|
-
/**
|
|
1611
|
-
* See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md
|
|
1612
|
-
*/
|
|
1613
|
-
|
|
1614
|
-
var Metadata =
|
|
1615
|
-
/*#__PURE__*/
|
|
1616
|
-
function () {
|
|
1617
|
-
function Metadata(metadata) {
|
|
1618
|
-
_classCallCheck(this, Metadata);
|
|
1619
|
-
|
|
1620
|
-
validateMetadata(metadata);
|
|
1621
|
-
this.metadata = metadata;
|
|
1622
|
-
setVersion.call(this, metadata);
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
_createClass(Metadata, [{
|
|
1626
|
-
key: "getCountries",
|
|
1627
|
-
value: function getCountries() {
|
|
1628
|
-
return Object.keys(this.metadata.countries).filter(function (_) {
|
|
1629
|
-
return _ !== '001';
|
|
1630
|
-
});
|
|
1631
|
-
}
|
|
1632
|
-
}, {
|
|
1633
|
-
key: "getCountryMetadata",
|
|
1634
|
-
value: function getCountryMetadata(countryCode) {
|
|
1635
|
-
return this.metadata.countries[countryCode];
|
|
1636
|
-
}
|
|
1637
|
-
}, {
|
|
1638
|
-
key: "nonGeographic",
|
|
1639
|
-
value: function nonGeographic() {
|
|
1640
|
-
if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.
|
|
1641
|
-
// It's present in metadata generated from `1.7.35` to `1.7.37`.
|
|
1642
|
-
|
|
1643
|
-
return this.metadata.nonGeographic || this.metadata.nonGeographical;
|
|
1644
|
-
}
|
|
1645
|
-
}, {
|
|
1646
|
-
key: "hasCountry",
|
|
1647
|
-
value: function hasCountry(country) {
|
|
1648
|
-
return this.getCountryMetadata(country) !== undefined;
|
|
1649
|
-
}
|
|
1650
|
-
}, {
|
|
1651
|
-
key: "hasCallingCode",
|
|
1652
|
-
value: function hasCallingCode(callingCode) {
|
|
1653
|
-
if (this.getCountryCodesForCallingCode(callingCode)) {
|
|
1654
|
-
return true;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
if (this.nonGeographic()) {
|
|
1658
|
-
if (this.nonGeographic()[callingCode]) {
|
|
1659
|
-
return true;
|
|
1660
|
-
}
|
|
1661
|
-
} else {
|
|
1662
|
-
// A hacky workaround for old custom metadata (generated before V4).
|
|
1663
|
-
var countryCodes = this.countryCallingCodes()[callingCode];
|
|
1664
|
-
|
|
1665
|
-
if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
|
|
1666
|
-
return true;
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
}, {
|
|
1671
|
-
key: "isNonGeographicCallingCode",
|
|
1672
|
-
value: function isNonGeographicCallingCode(callingCode) {
|
|
1673
|
-
if (this.nonGeographic()) {
|
|
1674
|
-
return this.nonGeographic()[callingCode] ? true : false;
|
|
1675
|
-
} else {
|
|
1676
|
-
return this.getCountryCodesForCallingCode(callingCode) ? false : true;
|
|
1677
|
-
}
|
|
1678
|
-
} // Deprecated.
|
|
1679
|
-
|
|
1680
|
-
}, {
|
|
1681
|
-
key: "country",
|
|
1682
|
-
value: function country(countryCode) {
|
|
1683
|
-
return this.selectNumberingPlan(countryCode);
|
|
1684
|
-
}
|
|
1685
|
-
}, {
|
|
1686
|
-
key: "selectNumberingPlan",
|
|
1687
|
-
value: function selectNumberingPlan(countryCode, callingCode) {
|
|
1688
|
-
// Supports just passing `callingCode` as the first argument.
|
|
1689
|
-
if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {
|
|
1690
|
-
callingCode = countryCode;
|
|
1691
|
-
countryCode = null;
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
if (countryCode && countryCode !== '001') {
|
|
1695
|
-
if (!this.hasCountry(countryCode)) {
|
|
1696
|
-
throw new Error("Unknown country: ".concat(countryCode));
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);
|
|
1700
|
-
} else if (callingCode) {
|
|
1701
|
-
if (!this.hasCallingCode(callingCode)) {
|
|
1702
|
-
throw new Error("Unknown calling code: ".concat(callingCode));
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);
|
|
1706
|
-
} else {
|
|
1707
|
-
this.numberingPlan = undefined;
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
return this;
|
|
1711
|
-
}
|
|
1712
|
-
}, {
|
|
1713
|
-
key: "getCountryCodesForCallingCode",
|
|
1714
|
-
value: function getCountryCodesForCallingCode(callingCode) {
|
|
1715
|
-
var countryCodes = this.countryCallingCodes()[callingCode];
|
|
1716
|
-
|
|
1717
|
-
if (countryCodes) {
|
|
1718
|
-
// Metadata before V4 included "non-geographic entity" calling codes
|
|
1719
|
-
// inside `country_calling_codes` (for example, `"881":["001"]`).
|
|
1720
|
-
// Now the semantics of `country_calling_codes` has changed:
|
|
1721
|
-
// it's specifically for "countries" now.
|
|
1722
|
-
// Older versions of custom metadata will simply skip parsing
|
|
1723
|
-
// "non-geographic entity" phone numbers with new versions
|
|
1724
|
-
// of this library: it's not considered a bug,
|
|
1725
|
-
// because such numbers are extremely rare,
|
|
1726
|
-
// and developers extremely rarely use custom metadata.
|
|
1727
|
-
if (countryCodes.length === 1 && countryCodes[0].length === 3) {
|
|
1728
|
-
return;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
return countryCodes;
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
}, {
|
|
1735
|
-
key: "getCountryCodeForCallingCode",
|
|
1736
|
-
value: function getCountryCodeForCallingCode(callingCode) {
|
|
1737
|
-
var countryCodes = this.getCountryCodesForCallingCode(callingCode);
|
|
1738
|
-
|
|
1739
|
-
if (countryCodes) {
|
|
1740
|
-
return countryCodes[0];
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
}, {
|
|
1744
|
-
key: "getNumberingPlanMetadata",
|
|
1745
|
-
value: function getNumberingPlanMetadata(callingCode) {
|
|
1746
|
-
var countryCode = this.getCountryCodeForCallingCode(callingCode);
|
|
1747
|
-
|
|
1748
|
-
if (countryCode) {
|
|
1749
|
-
return this.getCountryMetadata(countryCode);
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
if (this.nonGeographic()) {
|
|
1753
|
-
var metadata = this.nonGeographic()[callingCode];
|
|
1754
|
-
|
|
1755
|
-
if (metadata) {
|
|
1756
|
-
return metadata;
|
|
1757
|
-
}
|
|
1758
|
-
} else {
|
|
1759
|
-
// A hacky workaround for old custom metadata (generated before V4).
|
|
1760
|
-
var countryCodes = this.countryCallingCodes()[callingCode];
|
|
1761
|
-
|
|
1762
|
-
if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
|
|
1763
|
-
return this.metadata.countries['001'];
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
} // Deprecated.
|
|
1767
|
-
|
|
1768
|
-
}, {
|
|
1769
|
-
key: "countryCallingCode",
|
|
1770
|
-
value: function countryCallingCode() {
|
|
1771
|
-
return this.numberingPlan.callingCode();
|
|
1772
|
-
} // Deprecated.
|
|
1773
|
-
|
|
1774
|
-
}, {
|
|
1775
|
-
key: "IDDPrefix",
|
|
1776
|
-
value: function IDDPrefix() {
|
|
1777
|
-
return this.numberingPlan.IDDPrefix();
|
|
1778
|
-
} // Deprecated.
|
|
1779
|
-
|
|
1780
|
-
}, {
|
|
1781
|
-
key: "defaultIDDPrefix",
|
|
1782
|
-
value: function defaultIDDPrefix() {
|
|
1783
|
-
return this.numberingPlan.defaultIDDPrefix();
|
|
1784
|
-
} // Deprecated.
|
|
1785
|
-
|
|
1786
|
-
}, {
|
|
1787
|
-
key: "nationalNumberPattern",
|
|
1788
|
-
value: function nationalNumberPattern() {
|
|
1789
|
-
return this.numberingPlan.nationalNumberPattern();
|
|
1790
|
-
} // Deprecated.
|
|
1791
|
-
|
|
1792
|
-
}, {
|
|
1793
|
-
key: "possibleLengths",
|
|
1794
|
-
value: function possibleLengths() {
|
|
1795
|
-
return this.numberingPlan.possibleLengths();
|
|
1796
|
-
} // Deprecated.
|
|
1797
|
-
|
|
1798
|
-
}, {
|
|
1799
|
-
key: "formats",
|
|
1800
|
-
value: function formats() {
|
|
1801
|
-
return this.numberingPlan.formats();
|
|
1802
|
-
} // Deprecated.
|
|
1803
|
-
|
|
1804
|
-
}, {
|
|
1805
|
-
key: "nationalPrefixForParsing",
|
|
1806
|
-
value: function nationalPrefixForParsing() {
|
|
1807
|
-
return this.numberingPlan.nationalPrefixForParsing();
|
|
1808
|
-
} // Deprecated.
|
|
1809
|
-
|
|
1810
|
-
}, {
|
|
1811
|
-
key: "nationalPrefixTransformRule",
|
|
1812
|
-
value: function nationalPrefixTransformRule() {
|
|
1813
|
-
return this.numberingPlan.nationalPrefixTransformRule();
|
|
1814
|
-
} // Deprecated.
|
|
1815
|
-
|
|
1816
|
-
}, {
|
|
1817
|
-
key: "leadingDigits",
|
|
1818
|
-
value: function leadingDigits() {
|
|
1819
|
-
return this.numberingPlan.leadingDigits();
|
|
1820
|
-
} // Deprecated.
|
|
1821
|
-
|
|
1822
|
-
}, {
|
|
1823
|
-
key: "hasTypes",
|
|
1824
|
-
value: function hasTypes() {
|
|
1825
|
-
return this.numberingPlan.hasTypes();
|
|
1826
|
-
} // Deprecated.
|
|
1827
|
-
|
|
1828
|
-
}, {
|
|
1829
|
-
key: "type",
|
|
1830
|
-
value: function type(_type) {
|
|
1831
|
-
return this.numberingPlan.type(_type);
|
|
1832
|
-
} // Deprecated.
|
|
1833
|
-
|
|
1834
|
-
}, {
|
|
1835
|
-
key: "ext",
|
|
1836
|
-
value: function ext() {
|
|
1837
|
-
return this.numberingPlan.ext();
|
|
1838
|
-
}
|
|
1839
|
-
}, {
|
|
1840
|
-
key: "countryCallingCodes",
|
|
1841
|
-
value: function countryCallingCodes() {
|
|
1842
|
-
if (this.v1) return this.metadata.country_phone_code_to_countries;
|
|
1843
|
-
return this.metadata.country_calling_codes;
|
|
1844
|
-
} // Deprecated.
|
|
1845
|
-
|
|
1846
|
-
}, {
|
|
1847
|
-
key: "chooseCountryByCountryCallingCode",
|
|
1848
|
-
value: function chooseCountryByCountryCallingCode(callingCode) {
|
|
1849
|
-
return this.selectNumberingPlan(callingCode);
|
|
1850
|
-
}
|
|
1851
|
-
}, {
|
|
1852
|
-
key: "hasSelectedNumberingPlan",
|
|
1853
|
-
value: function hasSelectedNumberingPlan() {
|
|
1854
|
-
return this.numberingPlan !== undefined;
|
|
1855
|
-
}
|
|
1856
|
-
}]);
|
|
1857
|
-
|
|
1858
|
-
return Metadata;
|
|
1859
|
-
}();
|
|
1860
|
-
|
|
1861
|
-
var NumberingPlan =
|
|
1862
|
-
/*#__PURE__*/
|
|
1863
|
-
function () {
|
|
1864
|
-
function NumberingPlan(metadata, globalMetadataObject) {
|
|
1865
|
-
_classCallCheck(this, NumberingPlan);
|
|
1866
|
-
|
|
1867
|
-
this.globalMetadataObject = globalMetadataObject;
|
|
1868
|
-
this.metadata = metadata;
|
|
1869
|
-
setVersion.call(this, globalMetadataObject.metadata);
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
_createClass(NumberingPlan, [{
|
|
1873
|
-
key: "callingCode",
|
|
1874
|
-
value: function callingCode() {
|
|
1875
|
-
return this.metadata[0];
|
|
1876
|
-
} // Formatting information for regions which share
|
|
1877
|
-
// a country calling code is contained by only one region
|
|
1878
|
-
// for performance reasons. For example, for NANPA region
|
|
1879
|
-
// ("North American Numbering Plan Administration",
|
|
1880
|
-
// which includes USA, Canada, Cayman Islands, Bahamas, etc)
|
|
1881
|
-
// it will be contained in the metadata for `US`.
|
|
1882
|
-
|
|
1883
|
-
}, {
|
|
1884
|
-
key: "getDefaultCountryMetadataForRegion",
|
|
1885
|
-
value: function getDefaultCountryMetadataForRegion() {
|
|
1886
|
-
return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
|
|
1887
|
-
}
|
|
1888
|
-
}, {
|
|
1889
|
-
key: "IDDPrefix",
|
|
1890
|
-
value: function IDDPrefix() {
|
|
1891
|
-
if (this.v1 || this.v2) return;
|
|
1892
|
-
return this.metadata[1];
|
|
1893
|
-
}
|
|
1894
|
-
}, {
|
|
1895
|
-
key: "defaultIDDPrefix",
|
|
1896
|
-
value: function defaultIDDPrefix() {
|
|
1897
|
-
if (this.v1 || this.v2) return;
|
|
1898
|
-
return this.metadata[12];
|
|
1899
|
-
}
|
|
1900
|
-
}, {
|
|
1901
|
-
key: "nationalNumberPattern",
|
|
1902
|
-
value: function nationalNumberPattern() {
|
|
1903
|
-
if (this.v1 || this.v2) return this.metadata[1];
|
|
1904
|
-
return this.metadata[2];
|
|
1905
|
-
}
|
|
1906
|
-
}, {
|
|
1907
|
-
key: "possibleLengths",
|
|
1908
|
-
value: function possibleLengths() {
|
|
1909
|
-
if (this.v1) return;
|
|
1910
|
-
return this.metadata[this.v2 ? 2 : 3];
|
|
1911
|
-
}
|
|
1912
|
-
}, {
|
|
1913
|
-
key: "_getFormats",
|
|
1914
|
-
value: function _getFormats(metadata) {
|
|
1915
|
-
return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];
|
|
1916
|
-
} // For countries of the same region (e.g. NANPA)
|
|
1917
|
-
// formats are all stored in the "main" country for that region.
|
|
1918
|
-
// E.g. "RU" and "KZ", "US" and "CA".
|
|
1919
|
-
|
|
1920
|
-
}, {
|
|
1921
|
-
key: "formats",
|
|
1922
|
-
value: function formats() {
|
|
1923
|
-
var _this = this;
|
|
1924
|
-
|
|
1925
|
-
var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
|
|
1926
|
-
return formats.map(function (_) {
|
|
1927
|
-
return new Format(_, _this);
|
|
1928
|
-
});
|
|
1929
|
-
}
|
|
1930
|
-
}, {
|
|
1931
|
-
key: "nationalPrefix",
|
|
1932
|
-
value: function nationalPrefix() {
|
|
1933
|
-
return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
|
|
1934
|
-
}
|
|
1935
|
-
}, {
|
|
1936
|
-
key: "_getNationalPrefixFormattingRule",
|
|
1937
|
-
value: function _getNationalPrefixFormattingRule(metadata) {
|
|
1938
|
-
return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];
|
|
1939
|
-
} // For countries of the same region (e.g. NANPA)
|
|
1940
|
-
// national prefix formatting rule is stored in the "main" country for that region.
|
|
1941
|
-
// E.g. "RU" and "KZ", "US" and "CA".
|
|
1942
|
-
|
|
1943
|
-
}, {
|
|
1944
|
-
key: "nationalPrefixFormattingRule",
|
|
1945
|
-
value: function nationalPrefixFormattingRule() {
|
|
1946
|
-
return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
|
|
1947
|
-
}
|
|
1948
|
-
}, {
|
|
1949
|
-
key: "_nationalPrefixForParsing",
|
|
1950
|
-
value: function _nationalPrefixForParsing() {
|
|
1951
|
-
return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
|
|
1952
|
-
}
|
|
1953
|
-
}, {
|
|
1954
|
-
key: "nationalPrefixForParsing",
|
|
1955
|
-
value: function nationalPrefixForParsing() {
|
|
1956
|
-
// If `national_prefix_for_parsing` is not set explicitly,
|
|
1957
|
-
// then infer it from `national_prefix` (if any)
|
|
1958
|
-
return this._nationalPrefixForParsing() || this.nationalPrefix();
|
|
1959
|
-
}
|
|
1960
|
-
}, {
|
|
1961
|
-
key: "nationalPrefixTransformRule",
|
|
1962
|
-
value: function nationalPrefixTransformRule() {
|
|
1963
|
-
return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
|
|
1964
|
-
}
|
|
1965
|
-
}, {
|
|
1966
|
-
key: "_getNationalPrefixIsOptionalWhenFormatting",
|
|
1967
|
-
value: function _getNationalPrefixIsOptionalWhenFormatting() {
|
|
1968
|
-
return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
|
|
1969
|
-
} // For countries of the same region (e.g. NANPA)
|
|
1970
|
-
// "national prefix is optional when formatting" flag is
|
|
1971
|
-
// stored in the "main" country for that region.
|
|
1972
|
-
// E.g. "RU" and "KZ", "US" and "CA".
|
|
1973
|
-
|
|
1974
|
-
}, {
|
|
1975
|
-
key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
|
|
1976
|
-
value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
|
|
1977
|
-
return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
|
|
1978
|
-
}
|
|
1979
|
-
}, {
|
|
1980
|
-
key: "leadingDigits",
|
|
1981
|
-
value: function leadingDigits() {
|
|
1982
|
-
return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
|
|
1983
|
-
}
|
|
1984
|
-
}, {
|
|
1985
|
-
key: "types",
|
|
1986
|
-
value: function types() {
|
|
1987
|
-
return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
|
|
1988
|
-
}
|
|
1989
|
-
}, {
|
|
1990
|
-
key: "hasTypes",
|
|
1991
|
-
value: function hasTypes() {
|
|
1992
|
-
// Versions 1.2.0 - 1.2.4: can be `[]`.
|
|
1993
|
-
|
|
1994
|
-
/* istanbul ignore next */
|
|
1995
|
-
if (this.types() && this.types().length === 0) {
|
|
1996
|
-
return false;
|
|
1997
|
-
} // Versions <= 1.2.4: can be `undefined`.
|
|
1998
|
-
// Version >= 1.2.5: can be `0`.
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
return !!this.types();
|
|
2002
|
-
}
|
|
2003
|
-
}, {
|
|
2004
|
-
key: "type",
|
|
2005
|
-
value: function type(_type2) {
|
|
2006
|
-
if (this.hasTypes() && getType(this.types(), _type2)) {
|
|
2007
|
-
return new Type(getType(this.types(), _type2), this);
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
}, {
|
|
2011
|
-
key: "ext",
|
|
2012
|
-
value: function ext() {
|
|
2013
|
-
if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;
|
|
2014
|
-
return this.metadata[13] || DEFAULT_EXT_PREFIX;
|
|
2015
|
-
}
|
|
2016
|
-
}]);
|
|
2017
|
-
|
|
2018
|
-
return NumberingPlan;
|
|
2019
|
-
}();
|
|
2020
|
-
|
|
2021
|
-
var Format =
|
|
2022
|
-
/*#__PURE__*/
|
|
2023
|
-
function () {
|
|
2024
|
-
function Format(format, metadata) {
|
|
2025
|
-
_classCallCheck(this, Format);
|
|
2026
|
-
|
|
2027
|
-
this._format = format;
|
|
2028
|
-
this.metadata = metadata;
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
_createClass(Format, [{
|
|
2032
|
-
key: "pattern",
|
|
2033
|
-
value: function pattern() {
|
|
2034
|
-
return this._format[0];
|
|
2035
|
-
}
|
|
2036
|
-
}, {
|
|
2037
|
-
key: "format",
|
|
2038
|
-
value: function format() {
|
|
2039
|
-
return this._format[1];
|
|
2040
|
-
}
|
|
2041
|
-
}, {
|
|
2042
|
-
key: "leadingDigitsPatterns",
|
|
2043
|
-
value: function leadingDigitsPatterns() {
|
|
2044
|
-
return this._format[2] || [];
|
|
2045
|
-
}
|
|
2046
|
-
}, {
|
|
2047
|
-
key: "nationalPrefixFormattingRule",
|
|
2048
|
-
value: function nationalPrefixFormattingRule() {
|
|
2049
|
-
return this._format[3] || this.metadata.nationalPrefixFormattingRule();
|
|
2050
|
-
}
|
|
2051
|
-
}, {
|
|
2052
|
-
key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
|
|
2053
|
-
value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
|
|
2054
|
-
return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
|
|
2055
|
-
}
|
|
2056
|
-
}, {
|
|
2057
|
-
key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
|
|
2058
|
-
value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {
|
|
2059
|
-
// National prefix is omitted if there's no national prefix formatting rule
|
|
2060
|
-
// set for this country, or when the national prefix formatting rule
|
|
2061
|
-
// contains no national prefix itself, or when this rule is set but
|
|
2062
|
-
// national prefix is optional for this phone number format
|
|
2063
|
-
// (and it is not enforced explicitly)
|
|
2064
|
-
return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
|
|
2065
|
-
} // Checks whether national prefix formatting rule contains national prefix.
|
|
2066
|
-
|
|
2067
|
-
}, {
|
|
2068
|
-
key: "usesNationalPrefix",
|
|
2069
|
-
value: function usesNationalPrefix() {
|
|
2070
|
-
return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
|
|
2071
|
-
!FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`
|
|
2072
|
-
// when `national_prefix_formatting_rule` is not present.
|
|
2073
|
-
// So, `true` or `false` are returned explicitly here, so that
|
|
2074
|
-
// `0` number isn't returned.
|
|
2075
|
-
? true : false;
|
|
2076
|
-
}
|
|
2077
|
-
}, {
|
|
2078
|
-
key: "internationalFormat",
|
|
2079
|
-
value: function internationalFormat() {
|
|
2080
|
-
return this._format[5] || this.format();
|
|
2081
|
-
}
|
|
2082
|
-
}]);
|
|
2083
|
-
|
|
2084
|
-
return Format;
|
|
2085
|
-
}();
|
|
2086
|
-
/**
|
|
2087
|
-
* A pattern that is used to determine if the national prefix formatting rule
|
|
2088
|
-
* has the first group only, i.e., does not start with the national prefix.
|
|
2089
|
-
* Note that the pattern explicitly allows for unbalanced parentheses.
|
|
2090
|
-
*/
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/;
|
|
2094
|
-
|
|
2095
|
-
var Type =
|
|
2096
|
-
/*#__PURE__*/
|
|
2097
|
-
function () {
|
|
2098
|
-
function Type(type, metadata) {
|
|
2099
|
-
_classCallCheck(this, Type);
|
|
2100
|
-
|
|
2101
|
-
this.type = type;
|
|
2102
|
-
this.metadata = metadata;
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
_createClass(Type, [{
|
|
2106
|
-
key: "pattern",
|
|
2107
|
-
value: function pattern() {
|
|
2108
|
-
if (this.metadata.v1) return this.type;
|
|
2109
|
-
return this.type[0];
|
|
2110
|
-
}
|
|
2111
|
-
}, {
|
|
2112
|
-
key: "possibleLengths",
|
|
2113
|
-
value: function possibleLengths() {
|
|
2114
|
-
if (this.metadata.v1) return;
|
|
2115
|
-
return this.type[1] || this.metadata.possibleLengths();
|
|
2116
|
-
}
|
|
2117
|
-
}]);
|
|
2118
|
-
|
|
2119
|
-
return Type;
|
|
2120
|
-
}();
|
|
2121
|
-
|
|
2122
|
-
function getType(types, type) {
|
|
2123
|
-
switch (type) {
|
|
2124
|
-
case 'FIXED_LINE':
|
|
2125
|
-
return types[0];
|
|
2126
|
-
|
|
2127
|
-
case 'MOBILE':
|
|
2128
|
-
return types[1];
|
|
2129
|
-
|
|
2130
|
-
case 'TOLL_FREE':
|
|
2131
|
-
return types[2];
|
|
2132
|
-
|
|
2133
|
-
case 'PREMIUM_RATE':
|
|
2134
|
-
return types[3];
|
|
2135
|
-
|
|
2136
|
-
case 'PERSONAL_NUMBER':
|
|
2137
|
-
return types[4];
|
|
2138
|
-
|
|
2139
|
-
case 'VOICEMAIL':
|
|
2140
|
-
return types[5];
|
|
2141
|
-
|
|
2142
|
-
case 'UAN':
|
|
2143
|
-
return types[6];
|
|
2144
|
-
|
|
2145
|
-
case 'PAGER':
|
|
2146
|
-
return types[7];
|
|
2147
|
-
|
|
2148
|
-
case 'VOIP':
|
|
2149
|
-
return types[8];
|
|
2150
|
-
|
|
2151
|
-
case 'SHARED_COST':
|
|
2152
|
-
return types[9];
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
function validateMetadata(metadata) {
|
|
2157
|
-
if (!metadata) {
|
|
2158
|
-
throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');
|
|
2159
|
-
} // `country_phone_code_to_countries` was renamed to
|
|
2160
|
-
// `country_calling_codes` in `1.0.18`.
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
if (!is_object(metadata) || !is_object(metadata.countries)) {
|
|
2164
|
-
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(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata, "."));
|
|
2165
|
-
}
|
|
2166
|
-
} // Babel transforms `typeof` into some "branches"
|
|
2167
|
-
// so istanbul will show this as "branch not covered".
|
|
2168
|
-
|
|
2169
|
-
/* istanbul ignore next */
|
|
2170
|
-
|
|
2171
|
-
var is_object = function is_object(_) {
|
|
2172
|
-
return _typeof(_) === 'object';
|
|
2173
|
-
}; // Babel transforms `typeof` into some "branches"
|
|
2174
|
-
// so istanbul will show this as "branch not covered".
|
|
2175
|
-
|
|
2176
|
-
/* istanbul ignore next */
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
var type_of = function type_of(_) {
|
|
2180
|
-
return _typeof(_);
|
|
2181
|
-
};
|
|
2182
|
-
/**
|
|
2183
|
-
* Returns "country calling code" for a country.
|
|
2184
|
-
* Throws an error if the country doesn't exist or isn't supported by this library.
|
|
2185
|
-
* @param {string} country
|
|
2186
|
-
* @param {object} metadata
|
|
2187
|
-
* @return {string}
|
|
2188
|
-
* @example
|
|
2189
|
-
* // Returns "44"
|
|
2190
|
-
* getCountryCallingCode("GB")
|
|
2191
|
-
*/
|
|
2192
|
-
|
|
2193
|
-
function getCountryCallingCode(country, metadata) {
|
|
2194
|
-
metadata = new Metadata(metadata);
|
|
2195
|
-
|
|
2196
|
-
if (metadata.hasCountry(country)) {
|
|
2197
|
-
return metadata.country(country).countryCallingCode();
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
|
-
throw new Error("Unknown country: ".concat(country));
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
function setVersion(metadata) {
|
|
2204
|
-
var version = metadata.version;
|
|
2205
|
-
|
|
2206
|
-
if (typeof version === 'number') {
|
|
2207
|
-
this.v1 = version === 1;
|
|
2208
|
-
this.v2 = version === 2;
|
|
2209
|
-
this.v3 = version === 3;
|
|
2210
|
-
this.v4 = version === 4;
|
|
2211
|
-
} else {
|
|
2212
|
-
if (!version) {
|
|
2213
|
-
this.v1 = true;
|
|
2214
|
-
} else if (compare(version, V3) === -1) {
|
|
2215
|
-
this.v2 = true;
|
|
2216
|
-
} else if (compare(version, V4) === -1) {
|
|
2217
|
-
this.v3 = true;
|
|
2218
|
-
} else {
|
|
2219
|
-
this.v4 = true;
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
} // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/
|
|
2223
|
-
// function isCountryCode(countryCode) {
|
|
2224
|
-
// return ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)
|
|
2225
|
-
// }
|
|
2226
|
-
|
|
2227
|
-
// These mappings map a character (key) to a specific digit that should
|
|
2228
|
-
// replace it for normalization purposes. Non-European digits that
|
|
2229
|
-
// may be used in phone numbers are mapped to a European equivalent.
|
|
2230
|
-
//
|
|
2231
|
-
// E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
2232
|
-
//
|
|
2233
|
-
var DIGITS = {
|
|
2234
|
-
'0': '0',
|
|
2235
|
-
'1': '1',
|
|
2236
|
-
'2': '2',
|
|
2237
|
-
'3': '3',
|
|
2238
|
-
'4': '4',
|
|
2239
|
-
'5': '5',
|
|
2240
|
-
'6': '6',
|
|
2241
|
-
'7': '7',
|
|
2242
|
-
'8': '8',
|
|
2243
|
-
'9': '9',
|
|
2244
|
-
"\uFF10": '0',
|
|
2245
|
-
// Fullwidth digit 0
|
|
2246
|
-
"\uFF11": '1',
|
|
2247
|
-
// Fullwidth digit 1
|
|
2248
|
-
"\uFF12": '2',
|
|
2249
|
-
// Fullwidth digit 2
|
|
2250
|
-
"\uFF13": '3',
|
|
2251
|
-
// Fullwidth digit 3
|
|
2252
|
-
"\uFF14": '4',
|
|
2253
|
-
// Fullwidth digit 4
|
|
2254
|
-
"\uFF15": '5',
|
|
2255
|
-
// Fullwidth digit 5
|
|
2256
|
-
"\uFF16": '6',
|
|
2257
|
-
// Fullwidth digit 6
|
|
2258
|
-
"\uFF17": '7',
|
|
2259
|
-
// Fullwidth digit 7
|
|
2260
|
-
"\uFF18": '8',
|
|
2261
|
-
// Fullwidth digit 8
|
|
2262
|
-
"\uFF19": '9',
|
|
2263
|
-
// Fullwidth digit 9
|
|
2264
|
-
"\u0660": '0',
|
|
2265
|
-
// Arabic-indic digit 0
|
|
2266
|
-
"\u0661": '1',
|
|
2267
|
-
// Arabic-indic digit 1
|
|
2268
|
-
"\u0662": '2',
|
|
2269
|
-
// Arabic-indic digit 2
|
|
2270
|
-
"\u0663": '3',
|
|
2271
|
-
// Arabic-indic digit 3
|
|
2272
|
-
"\u0664": '4',
|
|
2273
|
-
// Arabic-indic digit 4
|
|
2274
|
-
"\u0665": '5',
|
|
2275
|
-
// Arabic-indic digit 5
|
|
2276
|
-
"\u0666": '6',
|
|
2277
|
-
// Arabic-indic digit 6
|
|
2278
|
-
"\u0667": '7',
|
|
2279
|
-
// Arabic-indic digit 7
|
|
2280
|
-
"\u0668": '8',
|
|
2281
|
-
// Arabic-indic digit 8
|
|
2282
|
-
"\u0669": '9',
|
|
2283
|
-
// Arabic-indic digit 9
|
|
2284
|
-
"\u06F0": '0',
|
|
2285
|
-
// Eastern-Arabic digit 0
|
|
2286
|
-
"\u06F1": '1',
|
|
2287
|
-
// Eastern-Arabic digit 1
|
|
2288
|
-
"\u06F2": '2',
|
|
2289
|
-
// Eastern-Arabic digit 2
|
|
2290
|
-
"\u06F3": '3',
|
|
2291
|
-
// Eastern-Arabic digit 3
|
|
2292
|
-
"\u06F4": '4',
|
|
2293
|
-
// Eastern-Arabic digit 4
|
|
2294
|
-
"\u06F5": '5',
|
|
2295
|
-
// Eastern-Arabic digit 5
|
|
2296
|
-
"\u06F6": '6',
|
|
2297
|
-
// Eastern-Arabic digit 6
|
|
2298
|
-
"\u06F7": '7',
|
|
2299
|
-
// Eastern-Arabic digit 7
|
|
2300
|
-
"\u06F8": '8',
|
|
2301
|
-
// Eastern-Arabic digit 8
|
|
2302
|
-
"\u06F9": '9' // Eastern-Arabic digit 9
|
|
2303
|
-
|
|
2304
|
-
};
|
|
2305
|
-
function parseDigit(character) {
|
|
2306
|
-
return DIGITS[character];
|
|
2307
|
-
}
|
|
2308
|
-
/**
|
|
2309
|
-
* Parses phone number digits from a string.
|
|
2310
|
-
* Drops all punctuation leaving only digits.
|
|
2311
|
-
* Also converts wide-ascii and arabic-indic numerals to conventional numerals.
|
|
2312
|
-
* E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
|
|
2313
|
-
* @param {string} string
|
|
2314
|
-
* @return {string}
|
|
2315
|
-
* @example
|
|
2316
|
-
* ```js
|
|
2317
|
-
* parseDigits('8 (800) 555')
|
|
2318
|
-
* // Outputs '8800555'.
|
|
2319
|
-
* ```
|
|
2320
|
-
*/
|
|
2321
|
-
|
|
2322
|
-
function parseDigits(string) {
|
|
2323
|
-
var result = ''; // Using `.split('')` here instead of normal `for ... of`
|
|
2324
|
-
// because the importing application doesn't neccessarily include an ES6 polyfill.
|
|
2325
|
-
// The `.split('')` approach discards "exotic" UTF-8 characters
|
|
2326
|
-
// (the ones consisting of four bytes) but digits
|
|
2327
|
-
// (including non-European ones) don't fall into that range
|
|
2328
|
-
// so such "exotic" characters would be discarded anyway.
|
|
2329
|
-
|
|
2330
|
-
for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
2331
|
-
var _ref;
|
|
2332
|
-
|
|
2333
|
-
if (_isArray) {
|
|
2334
|
-
if (_i >= _iterator.length) break;
|
|
2335
|
-
_ref = _iterator[_i++];
|
|
2336
|
-
} else {
|
|
2337
|
-
_i = _iterator.next();
|
|
2338
|
-
if (_i.done) break;
|
|
2339
|
-
_ref = _i.value;
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
|
-
var character = _ref;
|
|
2343
|
-
var digit = parseDigit(character);
|
|
2344
|
-
|
|
2345
|
-
if (digit) {
|
|
2346
|
-
result += digit;
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
return result;
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
/**
|
|
2354
|
-
* Merges two arrays.
|
|
2355
|
-
* @param {*} a
|
|
2356
|
-
* @param {*} b
|
|
2357
|
-
* @return {*}
|
|
2358
|
-
*/
|
|
2359
|
-
function mergeArrays(a, b) {
|
|
2360
|
-
var merged = a.slice();
|
|
2361
|
-
|
|
2362
|
-
for (var _iterator = b, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
2363
|
-
var _ref;
|
|
2364
|
-
|
|
2365
|
-
if (_isArray) {
|
|
2366
|
-
if (_i >= _iterator.length) break;
|
|
2367
|
-
_ref = _iterator[_i++];
|
|
2368
|
-
} else {
|
|
2369
|
-
_i = _iterator.next();
|
|
2370
|
-
if (_i.done) break;
|
|
2371
|
-
_ref = _i.value;
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
var element = _ref;
|
|
2375
|
-
|
|
2376
|
-
if (a.indexOf(element) < 0) {
|
|
2377
|
-
merged.push(element);
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
return merged.sort(function (a, b) {
|
|
2382
|
-
return a - b;
|
|
2383
|
-
}); // ES6 version, requires Set polyfill.
|
|
2384
|
-
// let merged = new Set(a)
|
|
2385
|
-
// for (const element of b) {
|
|
2386
|
-
// merged.add(i)
|
|
2387
|
-
// }
|
|
2388
|
-
// return Array.from(merged).sort((a, b) => a - b)
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
function checkNumberLength(nationalNumber, metadata) {
|
|
2392
|
-
return checkNumberLengthForType(nationalNumber, undefined, metadata);
|
|
2393
|
-
} // Checks whether a number is possible for the country based on its length.
|
|
2394
|
-
// Should only be called for the "new" metadata which has "possible lengths".
|
|
2395
|
-
|
|
2396
|
-
function checkNumberLengthForType(nationalNumber, type, metadata) {
|
|
2397
|
-
var type_info = metadata.type(type); // There should always be "<possiblePengths/>" set for every type element.
|
|
2398
|
-
// This is declared in the XML schema.
|
|
2399
|
-
// For size efficiency, where a sub-description (e.g. fixed-line)
|
|
2400
|
-
// has the same "<possiblePengths/>" as the "general description", this is missing,
|
|
2401
|
-
// so we fall back to the "general description". Where no numbers of the type
|
|
2402
|
-
// exist at all, there is one possible length (-1) which is guaranteed
|
|
2403
|
-
// not to match the length of any real phone number.
|
|
2404
|
-
|
|
2405
|
-
var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()
|
|
2406
|
-
// Metadata before version `1.0.18` didn't contain `possible_lengths`.
|
|
2407
|
-
|
|
2408
|
-
if (!possible_lengths) {
|
|
2409
|
-
return 'IS_POSSIBLE';
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
|
-
if (type === 'FIXED_LINE_OR_MOBILE') {
|
|
2413
|
-
// No such country in metadata.
|
|
2414
|
-
|
|
2415
|
-
/* istanbul ignore next */
|
|
2416
|
-
if (!metadata.type('FIXED_LINE')) {
|
|
2417
|
-
// The rare case has been encountered where no fixedLine data is available
|
|
2418
|
-
// (true for some non-geographic entities), so we just check mobile.
|
|
2419
|
-
return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata);
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
var mobile_type = metadata.type('MOBILE');
|
|
2423
|
-
|
|
2424
|
-
if (mobile_type) {
|
|
2425
|
-
// Merge the mobile data in if there was any. "Concat" creates a new
|
|
2426
|
-
// array, it doesn't edit possible_lengths in place, so we don't need a copy.
|
|
2427
|
-
// Note that when adding the possible lengths from mobile, we have
|
|
2428
|
-
// to again check they aren't empty since if they are this indicates
|
|
2429
|
-
// they are the same as the general desc and should be obtained from there.
|
|
2430
|
-
possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and
|
|
2431
|
-
// re-sort (duplicates are okay). Sorting isn't so expensive because
|
|
2432
|
-
// the lists are very small.
|
|
2433
|
-
// if (local_lengths) {
|
|
2434
|
-
// local_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())
|
|
2435
|
-
// } else {
|
|
2436
|
-
// local_lengths = mobile_type.possibleLengthsLocal()
|
|
2437
|
-
// }
|
|
2438
|
-
}
|
|
2439
|
-
} // If the type doesn't exist then return 'INVALID_LENGTH'.
|
|
2440
|
-
else if (type && !type_info) {
|
|
2441
|
-
return 'INVALID_LENGTH';
|
|
2442
|
-
}
|
|
2443
|
-
|
|
2444
|
-
var actual_length = nationalNumber.length; // In `libphonenumber-js` all "local-only" formats are dropped for simplicity.
|
|
2445
|
-
// // This is safe because there is never an overlap beween the possible lengths
|
|
2446
|
-
// // and the local-only lengths; this is checked at build time.
|
|
2447
|
-
// if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)
|
|
2448
|
-
// {
|
|
2449
|
-
// return 'IS_POSSIBLE_LOCAL_ONLY'
|
|
2450
|
-
// }
|
|
2451
|
-
|
|
2452
|
-
var minimum_length = possible_lengths[0];
|
|
2453
|
-
|
|
2454
|
-
if (minimum_length === actual_length) {
|
|
2455
|
-
return 'IS_POSSIBLE';
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
if (minimum_length > actual_length) {
|
|
2459
|
-
return 'TOO_SHORT';
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
if (possible_lengths[possible_lengths.length - 1] < actual_length) {
|
|
2463
|
-
return 'TOO_LONG';
|
|
2464
|
-
} // We skip the first element since we've already checked it.
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';
|
|
2468
|
-
}
|
|
2469
|
-
|
|
2470
|
-
function isPossiblePhoneNumber(input, options, metadata) {
|
|
2471
|
-
/* istanbul ignore if */
|
|
2472
|
-
if (options === undefined) {
|
|
2473
|
-
options = {};
|
|
2474
|
-
}
|
|
2475
|
-
|
|
2476
|
-
metadata = new Metadata(metadata);
|
|
2477
|
-
|
|
2478
|
-
if (options.v2) {
|
|
2479
|
-
if (!input.countryCallingCode) {
|
|
2480
|
-
throw new Error('Invalid phone number object passed');
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
metadata.selectNumberingPlan(input.countryCallingCode);
|
|
2484
|
-
} else {
|
|
2485
|
-
if (!input.phone) {
|
|
2486
|
-
return false;
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
if (input.country) {
|
|
2490
|
-
if (!metadata.hasCountry(input.country)) {
|
|
2491
|
-
throw new Error("Unknown country: ".concat(input.country));
|
|
2492
|
-
}
|
|
2493
|
-
|
|
2494
|
-
metadata.country(input.country);
|
|
2495
|
-
} else {
|
|
2496
|
-
if (!input.countryCallingCode) {
|
|
2497
|
-
throw new Error('Invalid phone number object passed');
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
|
-
metadata.selectNumberingPlan(input.countryCallingCode);
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
if (metadata.possibleLengths()) {
|
|
2505
|
-
return isPossibleNumber(input.phone || input.nationalNumber, metadata);
|
|
2506
|
-
} else {
|
|
2507
|
-
// There was a bug between `1.7.35` and `1.7.37` where "possible_lengths"
|
|
2508
|
-
// were missing for "non-geographical" numbering plans.
|
|
2509
|
-
// Just assume the number is possible in such cases:
|
|
2510
|
-
// it's unlikely that anyone generated their custom metadata
|
|
2511
|
-
// in that short period of time (one day).
|
|
2512
|
-
// This code can be removed in some future major version update.
|
|
2513
|
-
if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
|
|
2514
|
-
// "Non-geographic entities" did't have `possibleLengths`
|
|
2515
|
-
// due to a bug in metadata generation process.
|
|
2516
|
-
return true;
|
|
2517
|
-
} else {
|
|
2518
|
-
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
|
|
2519
|
-
}
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
function isPossibleNumber(nationalNumber, metadata) {
|
|
2523
|
-
//, isInternational) {
|
|
2524
|
-
switch (checkNumberLength(nationalNumber, metadata)) {
|
|
2525
|
-
case 'IS_POSSIBLE':
|
|
2526
|
-
return true;
|
|
2527
|
-
// This library ignores "local-only" phone numbers (for simplicity).
|
|
2528
|
-
// See the readme for more info on what are "local-only" phone numbers.
|
|
2529
|
-
// case 'IS_POSSIBLE_LOCAL_ONLY':
|
|
2530
|
-
// return !isInternational
|
|
2531
|
-
|
|
2532
|
-
default:
|
|
2533
|
-
return false;
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
|
|
2537
|
-
/**
|
|
2538
|
-
* @param {object} - `{ ?number, ?extension }`.
|
|
2539
|
-
* @return {string} Phone URI (RFC 3966).
|
|
2540
|
-
*/
|
|
2541
|
-
|
|
2542
|
-
function formatRFC3966(_ref2) {
|
|
2543
|
-
var number = _ref2.number,
|
|
2544
|
-
ext = _ref2.ext;
|
|
2545
|
-
|
|
2546
|
-
if (!number) {
|
|
2547
|
-
return '';
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
if (number[0] !== '+') {
|
|
2551
|
-
throw new Error("\"formatRFC3966()\" expects \"number\" to be in E.164 format.");
|
|
2552
|
-
}
|
|
2553
|
-
|
|
2554
|
-
return "tel:".concat(number).concat(ext ? ';ext=' + ext : '');
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
/**
|
|
2558
|
-
* Checks whether the entire input sequence can be matched
|
|
2559
|
-
* against the regular expression.
|
|
2560
|
-
* @return {boolean}
|
|
2561
|
-
*/
|
|
2562
|
-
function matchesEntirely(text, regular_expression) {
|
|
2563
|
-
// If assigning the `''` default value is moved to the arguments above,
|
|
2564
|
-
// code coverage would decrease for some weird reason.
|
|
2565
|
-
text = text || '';
|
|
2566
|
-
return new RegExp('^(?:' + regular_expression + ')$').test(text);
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
var NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc)
|
|
2570
|
-
|
|
2571
|
-
function getNumberType(input, options, metadata) {
|
|
2572
|
-
// If assigning the `{}` default value is moved to the arguments above,
|
|
2573
|
-
// code coverage would decrease for some weird reason.
|
|
2574
|
-
options = options || {}; // When `parse()` returned `{}`
|
|
2575
|
-
// meaning that the phone number is not a valid one.
|
|
2576
|
-
|
|
2577
|
-
if (!input.country) {
|
|
2578
|
-
return;
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
|
-
metadata = new Metadata(metadata);
|
|
2582
|
-
metadata.selectNumberingPlan(input.country, input.countryCallingCode);
|
|
2583
|
-
var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function:
|
|
2584
|
-
// https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835
|
|
2585
|
-
// Is this national number even valid for this country
|
|
2586
|
-
|
|
2587
|
-
if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {
|
|
2588
|
-
return;
|
|
2589
|
-
} // Is it fixed line number
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) {
|
|
2593
|
-
// Because duplicate regular expressions are removed
|
|
2594
|
-
// to reduce metadata size, if "mobile" pattern is ""
|
|
2595
|
-
// then it means it was removed due to being a duplicate of the fixed-line pattern.
|
|
2596
|
-
//
|
|
2597
|
-
if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {
|
|
2598
|
-
return 'FIXED_LINE_OR_MOBILE';
|
|
2599
|
-
} // v1 metadata.
|
|
2600
|
-
// Legacy.
|
|
2601
|
-
// Deprecated.
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
if (!metadata.type('MOBILE')) {
|
|
2605
|
-
return 'FIXED_LINE_OR_MOBILE';
|
|
2606
|
-
} // Check if the number happens to qualify as both fixed line and mobile.
|
|
2607
|
-
// (no such country in the minimal metadata set)
|
|
2608
|
-
|
|
2609
|
-
/* istanbul ignore if */
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) {
|
|
2613
|
-
return 'FIXED_LINE_OR_MOBILE';
|
|
2614
|
-
}
|
|
2615
|
-
|
|
2616
|
-
return 'FIXED_LINE';
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
for (var _i = 0, _NON_FIXED_LINE_PHONE = NON_FIXED_LINE_PHONE_TYPES; _i < _NON_FIXED_LINE_PHONE.length; _i++) {
|
|
2620
|
-
var type = _NON_FIXED_LINE_PHONE[_i];
|
|
2621
|
-
|
|
2622
|
-
if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {
|
|
2623
|
-
return type;
|
|
2624
|
-
}
|
|
2625
|
-
}
|
|
2626
|
-
}
|
|
2627
|
-
function isNumberTypeEqualTo(nationalNumber, type, metadata) {
|
|
2628
|
-
type = metadata.type(type);
|
|
2629
|
-
|
|
2630
|
-
if (!type || !type.pattern()) {
|
|
2631
|
-
return false;
|
|
2632
|
-
} // Check if any possible number lengths are present;
|
|
2633
|
-
// if so, we use them to avoid checking
|
|
2634
|
-
// the validation pattern if they don't match.
|
|
2635
|
-
// If they are absent, this means they match
|
|
2636
|
-
// the general description, which we have
|
|
2637
|
-
// already checked before a specific number type.
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {
|
|
2641
|
-
return false;
|
|
2642
|
-
}
|
|
2643
|
-
|
|
2644
|
-
return matchesEntirely(nationalNumber, type.pattern());
|
|
2645
|
-
}
|
|
2646
|
-
|
|
2647
|
-
/**
|
|
2648
|
-
* Checks if a given phone number is valid.
|
|
2649
|
-
*
|
|
2650
|
-
* If the `number` is a string, it will be parsed to an object,
|
|
2651
|
-
* but only if it contains only valid phone number characters (including punctuation).
|
|
2652
|
-
* If the `number` is an object, it is used as is.
|
|
2653
|
-
*
|
|
2654
|
-
* The optional `defaultCountry` argument is the default country.
|
|
2655
|
-
* I.e. it does not restrict to just that country,
|
|
2656
|
-
* e.g. in those cases where several countries share
|
|
2657
|
-
* the same phone numbering rules (NANPA, Britain, etc).
|
|
2658
|
-
* For example, even though the number `07624 369230`
|
|
2659
|
-
* belongs to the Isle of Man ("IM" country code)
|
|
2660
|
-
* calling `isValidNumber('07624369230', 'GB', metadata)`
|
|
2661
|
-
* still returns `true` because the country is not restricted to `GB`,
|
|
2662
|
-
* it's just that `GB` is the default one for the phone numbering rules.
|
|
2663
|
-
* For restricting the country see `isValidNumberForRegion()`
|
|
2664
|
-
* though restricting a country might not be a good idea.
|
|
2665
|
-
* https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
|
|
2666
|
-
*
|
|
2667
|
-
* Examples:
|
|
2668
|
-
*
|
|
2669
|
-
* ```js
|
|
2670
|
-
* isValidNumber('+78005553535', metadata)
|
|
2671
|
-
* isValidNumber('8005553535', 'RU', metadata)
|
|
2672
|
-
* isValidNumber('88005553535', 'RU', metadata)
|
|
2673
|
-
* isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)
|
|
2674
|
-
* ```
|
|
2675
|
-
*/
|
|
2676
|
-
|
|
2677
|
-
function isValidNumber(input, options, metadata) {
|
|
2678
|
-
// If assigning the `{}` default value is moved to the arguments above,
|
|
2679
|
-
// code coverage would decrease for some weird reason.
|
|
2680
|
-
options = options || {};
|
|
2681
|
-
metadata = new Metadata(metadata); // This is just to support `isValidNumber({})`
|
|
2682
|
-
// for cases when `parseNumber()` returns `{}`.
|
|
2683
|
-
|
|
2684
|
-
if (!input.country) {
|
|
2685
|
-
return false;
|
|
2686
|
-
}
|
|
2687
|
-
|
|
2688
|
-
metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for
|
|
2689
|
-
// distinguishing different countries having the same `countryCallingCode`.
|
|
2690
|
-
|
|
2691
|
-
if (metadata.hasTypes()) {
|
|
2692
|
-
return getNumberType(input, options, metadata.metadata) !== undefined;
|
|
2693
|
-
} // If there are no type regexps for this country in metadata then use
|
|
2694
|
-
// `nationalNumberPattern` as a "better than nothing" replacement.
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
var national_number = options.v2 ? input.nationalNumber : input.phone;
|
|
2698
|
-
return matchesEntirely(national_number, metadata.nationalNumberPattern());
|
|
2699
|
-
}
|
|
2700
|
-
|
|
2701
|
-
//
|
|
2702
|
-
// E.g. "(999) 111-22-33" -> "999 111 22 33"
|
|
2703
|
-
//
|
|
2704
|
-
// For some reason Google's metadata contains `<intlFormat/>`s with brackets and dashes.
|
|
2705
|
-
// Meanwhile, there's no single opinion about using punctuation in international phone numbers.
|
|
2706
|
-
//
|
|
2707
|
-
// For example, Google's `<intlFormat/>` for USA is `+1 213-373-4253`.
|
|
2708
|
-
// And here's a quote from WikiPedia's "North American Numbering Plan" page:
|
|
2709
|
-
// https://en.wikipedia.org/wiki/North_American_Numbering_Plan
|
|
2710
|
-
//
|
|
2711
|
-
// "The country calling code for all countries participating in the NANP is 1.
|
|
2712
|
-
// In international format, an NANP number should be listed as +1 301 555 01 00,
|
|
2713
|
-
// where 301 is an area code (Maryland)."
|
|
2714
|
-
//
|
|
2715
|
-
// I personally prefer the international format without any punctuation.
|
|
2716
|
-
// For example, brackets are remnants of the old age, meaning that the
|
|
2717
|
-
// phone number part in brackets (so called "area code") can be omitted
|
|
2718
|
-
// if dialing within the same "area".
|
|
2719
|
-
// And hyphens were clearly introduced for splitting local numbers into memorizable groups.
|
|
2720
|
-
// For example, remembering "5553535" is difficult but "555-35-35" is much simpler.
|
|
2721
|
-
// Imagine a man taking a bus from home to work and seeing an ad with a phone number.
|
|
2722
|
-
// He has a couple of seconds to memorize that number until it passes by.
|
|
2723
|
-
// If it were spaces instead of hyphens the man wouldn't necessarily get it,
|
|
2724
|
-
// but with hyphens instead of spaces the grouping is more explicit.
|
|
2725
|
-
// I personally think that hyphens introduce visual clutter,
|
|
2726
|
-
// so I prefer replacing them with spaces in international numbers.
|
|
2727
|
-
// In the modern age all output is done on displays where spaces are clearly distinguishable
|
|
2728
|
-
// so hyphens can be safely replaced with spaces without losing any legibility.
|
|
2729
|
-
//
|
|
2730
|
-
|
|
2731
|
-
function applyInternationalSeparatorStyle(formattedNumber) {
|
|
2732
|
-
return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), 'g'), ' ').trim();
|
|
2733
|
-
}
|
|
2734
|
-
|
|
2735
|
-
// first group is not used in the national pattern (e.g. Argentina) so the $1
|
|
2736
|
-
// group does not match correctly. Therefore, we use `\d`, so that the first
|
|
2737
|
-
// group actually used in the pattern will be matched.
|
|
2738
|
-
|
|
2739
|
-
var FIRST_GROUP_PATTERN = /(\$\d)/;
|
|
2740
|
-
function formatNationalNumberUsingFormat(number, format, _ref) {
|
|
2741
|
-
var useInternationalFormat = _ref.useInternationalFormat,
|
|
2742
|
-
withNationalPrefix = _ref.withNationalPrefix;
|
|
2743
|
-
var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`,
|
|
2744
|
-
// because that one is only used when formatting phone numbers
|
|
2745
|
-
// for dialing from a mobile phone, and this is not a dialing library.
|
|
2746
|
-
// carrierCode && format.domesticCarrierCodeFormattingRule()
|
|
2747
|
-
// // First, replace the $CC in the formatting rule with the desired carrier code.
|
|
2748
|
-
// // Then, replace the $FG in the formatting rule with the first group
|
|
2749
|
-
// // and the carrier code combined in the appropriate way.
|
|
2750
|
-
// ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
|
|
2751
|
-
// : (
|
|
2752
|
-
// withNationalPrefix && format.nationalPrefixFormattingRule()
|
|
2753
|
-
// ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
|
|
2754
|
-
// : format.format()
|
|
2755
|
-
// )
|
|
2756
|
-
withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());
|
|
2757
|
-
|
|
2758
|
-
if (useInternationalFormat) {
|
|
2759
|
-
return applyInternationalSeparatorStyle(formattedNumber);
|
|
2760
|
-
}
|
|
2761
|
-
|
|
2762
|
-
return formattedNumber;
|
|
2763
|
-
}
|
|
2764
|
-
|
|
2765
|
-
/**
|
|
2766
|
-
* Pattern that makes it easy to distinguish whether a region has a single
|
|
2767
|
-
* international dialing prefix or not. If a region has a single international
|
|
2768
|
-
* prefix (e.g. 011 in USA), it will be represented as a string that contains
|
|
2769
|
-
* a sequence of ASCII digits, and possibly a tilde, which signals waiting for
|
|
2770
|
-
* the tone. If there are multiple available international prefixes in a
|
|
2771
|
-
* region, they will be represented as a regex string that always contains one
|
|
2772
|
-
* or more characters that are not ASCII digits or a tilde.
|
|
2773
|
-
*/
|
|
2774
|
-
|
|
2775
|
-
var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/; // For regions that have multiple IDD prefixes
|
|
2776
|
-
// a preferred IDD prefix is returned.
|
|
2777
|
-
|
|
2778
|
-
function getIddPrefix(country, callingCode, metadata) {
|
|
2779
|
-
var countryMetadata = new Metadata(metadata);
|
|
2780
|
-
countryMetadata.selectNumberingPlan(country, callingCode);
|
|
2781
|
-
|
|
2782
|
-
if (countryMetadata.defaultIDDPrefix()) {
|
|
2783
|
-
return countryMetadata.defaultIDDPrefix();
|
|
2784
|
-
}
|
|
2785
|
-
|
|
2786
|
-
if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {
|
|
2787
|
-
return countryMetadata.IDDPrefix();
|
|
2788
|
-
}
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
2792
|
-
|
|
2793
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2794
|
-
var DEFAULT_OPTIONS = {
|
|
2795
|
-
formatExtension: function formatExtension(formattedNumber, extension, metadata) {
|
|
2796
|
-
return "".concat(formattedNumber).concat(metadata.ext()).concat(extension);
|
|
2797
|
-
} // Formats a phone number
|
|
2798
|
-
//
|
|
2799
|
-
// Example use cases:
|
|
2800
|
-
//
|
|
2801
|
-
// ```js
|
|
2802
|
-
// formatNumber('8005553535', 'RU', 'INTERNATIONAL')
|
|
2803
|
-
// formatNumber('8005553535', 'RU', 'INTERNATIONAL', metadata)
|
|
2804
|
-
// formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL')
|
|
2805
|
-
// formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', metadata)
|
|
2806
|
-
// formatNumber('+78005553535', 'NATIONAL')
|
|
2807
|
-
// formatNumber('+78005553535', 'NATIONAL', metadata)
|
|
2808
|
-
// ```
|
|
2809
|
-
//
|
|
2810
|
-
|
|
2811
|
-
};
|
|
2812
|
-
function formatNumber(input, format, options, metadata) {
|
|
2813
|
-
// Apply default options.
|
|
2814
|
-
if (options) {
|
|
2815
|
-
options = _objectSpread({}, DEFAULT_OPTIONS, options);
|
|
2816
|
-
} else {
|
|
2817
|
-
options = DEFAULT_OPTIONS;
|
|
2818
|
-
}
|
|
2819
|
-
|
|
2820
|
-
metadata = new Metadata(metadata);
|
|
2821
|
-
|
|
2822
|
-
if (input.country && input.country !== '001') {
|
|
2823
|
-
// Validate `input.country`.
|
|
2824
|
-
if (!metadata.hasCountry(input.country)) {
|
|
2825
|
-
throw new Error("Unknown country: ".concat(input.country));
|
|
2826
|
-
}
|
|
2827
|
-
|
|
2828
|
-
metadata.country(input.country);
|
|
2829
|
-
} else if (input.countryCallingCode) {
|
|
2830
|
-
metadata.selectNumberingPlan(input.countryCallingCode);
|
|
2831
|
-
} else return input.phone || '';
|
|
2832
|
-
|
|
2833
|
-
var countryCallingCode = metadata.countryCallingCode();
|
|
2834
|
-
var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s
|
|
2835
|
-
// but Babel has a bug and it says "duplicate variable declaration".
|
|
2836
|
-
|
|
2837
|
-
var number;
|
|
2838
|
-
|
|
2839
|
-
switch (format) {
|
|
2840
|
-
case 'NATIONAL':
|
|
2841
|
-
// Legacy argument support.
|
|
2842
|
-
// (`{ country: ..., phone: '' }`)
|
|
2843
|
-
if (!nationalNumber) {
|
|
2844
|
-
return '';
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options);
|
|
2848
|
-
return addExtension(number, input.ext, metadata, options.formatExtension);
|
|
2849
|
-
|
|
2850
|
-
case 'INTERNATIONAL':
|
|
2851
|
-
// Legacy argument support.
|
|
2852
|
-
// (`{ country: ..., phone: '' }`)
|
|
2853
|
-
if (!nationalNumber) {
|
|
2854
|
-
return "+".concat(countryCallingCode);
|
|
2855
|
-
}
|
|
2856
|
-
|
|
2857
|
-
number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options);
|
|
2858
|
-
number = "+".concat(countryCallingCode, " ").concat(number);
|
|
2859
|
-
return addExtension(number, input.ext, metadata, options.formatExtension);
|
|
2860
|
-
|
|
2861
|
-
case 'E.164':
|
|
2862
|
-
// `E.164` doesn't define "phone number extensions".
|
|
2863
|
-
return "+".concat(countryCallingCode).concat(nationalNumber);
|
|
2864
|
-
|
|
2865
|
-
case 'RFC3966':
|
|
2866
|
-
return formatRFC3966({
|
|
2867
|
-
number: "+".concat(countryCallingCode).concat(nationalNumber),
|
|
2868
|
-
ext: input.ext
|
|
2869
|
-
});
|
|
2870
|
-
// For reference, here's Google's IDD formatter:
|
|
2871
|
-
// https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546
|
|
2872
|
-
// Not saying that this IDD formatter replicates it 1:1, but it seems to work.
|
|
2873
|
-
// Who would even need to format phone numbers in IDD format anyway?
|
|
2874
|
-
|
|
2875
|
-
case 'IDD':
|
|
2876
|
-
if (!options.fromCountry) {
|
|
2877
|
-
return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')
|
|
2878
|
-
}
|
|
2879
|
-
|
|
2880
|
-
var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);
|
|
2881
|
-
return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);
|
|
2882
|
-
|
|
2883
|
-
default:
|
|
2884
|
-
throw new Error("Unknown \"format\" argument passed to \"formatNumber()\": \"".concat(format, "\""));
|
|
2885
|
-
}
|
|
2886
|
-
}
|
|
2887
|
-
|
|
2888
|
-
function formatNationalNumber(number, carrierCode, formatAs, metadata, options) {
|
|
2889
|
-
var format = chooseFormatForNumber(metadata.formats(), number);
|
|
2890
|
-
|
|
2891
|
-
if (!format) {
|
|
2892
|
-
return number;
|
|
2893
|
-
}
|
|
2894
|
-
|
|
2895
|
-
return formatNationalNumberUsingFormat(number, format, {
|
|
2896
|
-
useInternationalFormat: formatAs === 'INTERNATIONAL',
|
|
2897
|
-
withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,
|
|
2898
|
-
carrierCode: carrierCode,
|
|
2899
|
-
metadata: metadata
|
|
2900
|
-
});
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
function chooseFormatForNumber(availableFormats, nationalNnumber) {
|
|
2904
|
-
for (var _iterator = availableFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
2905
|
-
var _ref;
|
|
2906
|
-
|
|
2907
|
-
if (_isArray) {
|
|
2908
|
-
if (_i >= _iterator.length) break;
|
|
2909
|
-
_ref = _iterator[_i++];
|
|
2910
|
-
} else {
|
|
2911
|
-
_i = _iterator.next();
|
|
2912
|
-
if (_i.done) break;
|
|
2913
|
-
_ref = _i.value;
|
|
2914
|
-
}
|
|
2915
|
-
|
|
2916
|
-
var format = _ref;
|
|
2917
|
-
|
|
2918
|
-
// Validate leading digits
|
|
2919
|
-
if (format.leadingDigitsPatterns().length > 0) {
|
|
2920
|
-
// The last leading_digits_pattern is used here, as it is the most detailed
|
|
2921
|
-
var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format
|
|
2922
|
-
|
|
2923
|
-
if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {
|
|
2924
|
-
continue;
|
|
2925
|
-
}
|
|
2926
|
-
} // Check that the national number matches the phone number format regular expression
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
if (matchesEntirely(nationalNnumber, format.pattern())) {
|
|
2930
|
-
return format;
|
|
2931
|
-
}
|
|
2932
|
-
}
|
|
2933
|
-
}
|
|
2934
|
-
|
|
2935
|
-
function addExtension(formattedNumber, ext, metadata, formatExtension) {
|
|
2936
|
-
return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;
|
|
2937
|
-
}
|
|
2938
|
-
|
|
2939
|
-
function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {
|
|
2940
|
-
var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata); // When calling within the same country calling code.
|
|
2941
|
-
|
|
2942
|
-
if (fromCountryCallingCode === countryCallingCode) {
|
|
2943
|
-
var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata); // For NANPA regions, return the national format for these regions
|
|
2944
|
-
// but prefix it with the country calling code.
|
|
2945
|
-
|
|
2946
|
-
if (countryCallingCode === '1') {
|
|
2947
|
-
return countryCallingCode + ' ' + formattedNumber;
|
|
2948
|
-
} // If regions share a country calling code, the country calling code need
|
|
2949
|
-
// not be dialled. This also applies when dialling within a region, so this
|
|
2950
|
-
// if clause covers both these cases. Technically this is the case for
|
|
2951
|
-
// dialling from La Reunion to other overseas departments of France (French
|
|
2952
|
-
// Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover
|
|
2953
|
-
// this edge case for now and for those cases return the version including
|
|
2954
|
-
// country calling code. Details here:
|
|
2955
|
-
// http://www.petitfute.com/voyage/225-info-pratiques-reunion
|
|
2956
|
-
//
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
return formattedNumber;
|
|
2960
|
-
}
|
|
2961
|
-
|
|
2962
|
-
var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata);
|
|
2963
|
-
|
|
2964
|
-
if (iddPrefix) {
|
|
2965
|
-
return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata));
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
|
|
2969
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } return target; }
|
|
2970
|
-
|
|
2971
|
-
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2972
|
-
|
|
2973
|
-
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2974
|
-
|
|
2975
|
-
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2976
|
-
|
|
2977
|
-
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
|
|
2978
|
-
|
|
2979
|
-
var PhoneNumber =
|
|
2980
|
-
/*#__PURE__*/
|
|
2981
|
-
function () {
|
|
2982
|
-
function PhoneNumber(countryCallingCode, nationalNumber, metadata) {
|
|
2983
|
-
_classCallCheck$1(this, PhoneNumber);
|
|
2984
|
-
|
|
2985
|
-
if (!countryCallingCode) {
|
|
2986
|
-
throw new TypeError('`country` or `countryCallingCode` not passed');
|
|
2987
|
-
}
|
|
2988
|
-
|
|
2989
|
-
if (!nationalNumber) {
|
|
2990
|
-
throw new TypeError('`nationalNumber` not passed');
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
if (!metadata) {
|
|
2994
|
-
throw new TypeError('`metadata` not passed');
|
|
2995
|
-
}
|
|
2996
|
-
|
|
2997
|
-
var _metadata = new Metadata(metadata); // If country code is passed then derive `countryCallingCode` from it.
|
|
2998
|
-
// Also store the country code as `.country`.
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
if (isCountryCode(countryCallingCode)) {
|
|
3002
|
-
this.country = countryCallingCode;
|
|
3003
|
-
|
|
3004
|
-
_metadata.country(countryCallingCode);
|
|
3005
|
-
|
|
3006
|
-
countryCallingCode = _metadata.countryCallingCode();
|
|
3007
|
-
}
|
|
3008
|
-
|
|
3009
|
-
this.countryCallingCode = countryCallingCode;
|
|
3010
|
-
this.nationalNumber = nationalNumber;
|
|
3011
|
-
this.number = '+' + this.countryCallingCode + this.nationalNumber;
|
|
3012
|
-
this.metadata = metadata;
|
|
3013
|
-
}
|
|
3014
|
-
|
|
3015
|
-
_createClass$1(PhoneNumber, [{
|
|
3016
|
-
key: "isPossible",
|
|
3017
|
-
value: function isPossible() {
|
|
3018
|
-
return isPossiblePhoneNumber(this, {
|
|
3019
|
-
v2: true
|
|
3020
|
-
}, this.metadata);
|
|
3021
|
-
}
|
|
3022
|
-
}, {
|
|
3023
|
-
key: "isValid",
|
|
3024
|
-
value: function isValid() {
|
|
3025
|
-
return isValidNumber(this, {
|
|
3026
|
-
v2: true
|
|
3027
|
-
}, this.metadata);
|
|
3028
|
-
}
|
|
3029
|
-
}, {
|
|
3030
|
-
key: "isNonGeographic",
|
|
3031
|
-
value: function isNonGeographic() {
|
|
3032
|
-
var metadata = new Metadata(this.metadata);
|
|
3033
|
-
return metadata.isNonGeographicCallingCode(this.countryCallingCode);
|
|
3034
|
-
}
|
|
3035
|
-
}, {
|
|
3036
|
-
key: "isEqual",
|
|
3037
|
-
value: function isEqual(phoneNumber) {
|
|
3038
|
-
return this.number === phoneNumber.number && this.ext === phoneNumber.ext;
|
|
3039
|
-
} // // Is just an alias for `this.isValid() && this.country === country`.
|
|
3040
|
-
// // https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
|
|
3041
|
-
// isValidForRegion(country) {
|
|
3042
|
-
// return isValidNumberForRegion(this, country, { v2: true }, this.metadata)
|
|
3043
|
-
// }
|
|
3044
|
-
|
|
3045
|
-
}, {
|
|
3046
|
-
key: "getType",
|
|
3047
|
-
value: function getType() {
|
|
3048
|
-
return getNumberType(this, {
|
|
3049
|
-
v2: true
|
|
3050
|
-
}, this.metadata);
|
|
3051
|
-
}
|
|
3052
|
-
}, {
|
|
3053
|
-
key: "format",
|
|
3054
|
-
value: function format(_format, options) {
|
|
3055
|
-
return formatNumber(this, _format, options ? _objectSpread$1({}, options, {
|
|
3056
|
-
v2: true
|
|
3057
|
-
}) : {
|
|
3058
|
-
v2: true
|
|
3059
|
-
}, this.metadata);
|
|
3060
|
-
}
|
|
3061
|
-
}, {
|
|
3062
|
-
key: "formatNational",
|
|
3063
|
-
value: function formatNational(options) {
|
|
3064
|
-
return this.format('NATIONAL', options);
|
|
3065
|
-
}
|
|
3066
|
-
}, {
|
|
3067
|
-
key: "formatInternational",
|
|
3068
|
-
value: function formatInternational(options) {
|
|
3069
|
-
return this.format('INTERNATIONAL', options);
|
|
3070
|
-
}
|
|
3071
|
-
}, {
|
|
3072
|
-
key: "getURI",
|
|
3073
|
-
value: function getURI(options) {
|
|
3074
|
-
return this.format('RFC3966', options);
|
|
3075
|
-
}
|
|
3076
|
-
}]);
|
|
3077
|
-
|
|
3078
|
-
return PhoneNumber;
|
|
3079
|
-
}();
|
|
3080
|
-
|
|
3081
|
-
var isCountryCode = function isCountryCode(value) {
|
|
3082
|
-
return /^[A-Z]{2}$/.test(value);
|
|
3083
|
-
};
|
|
3084
|
-
|
|
3085
|
-
var CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');
|
|
3086
|
-
function stripIddPrefix(number, country, callingCode, metadata) {
|
|
3087
|
-
if (!country) {
|
|
3088
|
-
return;
|
|
3089
|
-
} // Check if the number is IDD-prefixed.
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
var countryMetadata = new Metadata(metadata);
|
|
3093
|
-
countryMetadata.selectNumberingPlan(country, callingCode);
|
|
3094
|
-
var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());
|
|
3095
|
-
|
|
3096
|
-
if (number.search(IDDPrefixPattern) !== 0) {
|
|
3097
|
-
return;
|
|
3098
|
-
} // Strip IDD prefix.
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
number = number.slice(number.match(IDDPrefixPattern)[0].length); // If there're any digits after an IDD prefix,
|
|
3102
|
-
// then those digits are a country calling code.
|
|
3103
|
-
// Since no country code starts with a `0`,
|
|
3104
|
-
// the code below validates that the next digit (if present) is not `0`.
|
|
3105
|
-
|
|
3106
|
-
var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);
|
|
3107
|
-
|
|
3108
|
-
if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {
|
|
3109
|
-
if (matchedGroups[1] === '0') {
|
|
3110
|
-
return;
|
|
3111
|
-
}
|
|
3112
|
-
}
|
|
3113
|
-
|
|
3114
|
-
return number;
|
|
3115
|
-
}
|
|
3116
|
-
|
|
3117
|
-
/**
|
|
3118
|
-
* Strips any national prefix (such as 0, 1) present in a
|
|
3119
|
-
* (possibly incomplete) number provided.
|
|
3120
|
-
* "Carrier codes" are only used in Colombia and Brazil,
|
|
3121
|
-
* and only when dialing within those countries from a mobile phone to a fixed line number.
|
|
3122
|
-
* Sometimes it won't actually strip national prefix
|
|
3123
|
-
* and will instead prepend some digits to the `number`:
|
|
3124
|
-
* for example, when number `2345678` is passed with `VI` country selected,
|
|
3125
|
-
* it will return `{ number: "3402345678" }`, because `340` area code is prepended.
|
|
3126
|
-
* @param {string} number — National number digits.
|
|
3127
|
-
* @param {object} metadata — Metadata with country selected.
|
|
3128
|
-
* @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`.
|
|
3129
|
-
*/
|
|
3130
|
-
function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
|
|
3131
|
-
if (number && metadata.numberingPlan.nationalPrefixForParsing()) {
|
|
3132
|
-
// See METADATA.md for the description of
|
|
3133
|
-
// `national_prefix_for_parsing` and `national_prefix_transform_rule`.
|
|
3134
|
-
// Attempt to parse the first digits as a national prefix.
|
|
3135
|
-
var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');
|
|
3136
|
-
var prefixMatch = prefixPattern.exec(number);
|
|
3137
|
-
|
|
3138
|
-
if (prefixMatch) {
|
|
3139
|
-
var nationalNumber;
|
|
3140
|
-
var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
3141
|
-
// If a `national_prefix_for_parsing` has any "capturing groups"
|
|
3142
|
-
// then it means that the national (significant) number is equal to
|
|
3143
|
-
// those "capturing groups" transformed via `national_prefix_transform_rule`,
|
|
3144
|
-
// and nothing could be said about the actual national prefix:
|
|
3145
|
-
// what is it and was it even there.
|
|
3146
|
-
// If a `national_prefix_for_parsing` doesn't have any "capturing groups",
|
|
3147
|
-
// then everything it matches is a national prefix.
|
|
3148
|
-
// To determine whether `national_prefix_for_parsing` matched any
|
|
3149
|
-
// "capturing groups", the value of the result of calling `.exec()`
|
|
3150
|
-
// is looked at, and if it has non-undefined values where there're
|
|
3151
|
-
// "capturing groups" in the regular expression, then it means
|
|
3152
|
-
// that "capturing groups" have been matched.
|
|
3153
|
-
// It's not possible to tell whether there'll be any "capturing gropus"
|
|
3154
|
-
// before the matching process, because a `national_prefix_for_parsing`
|
|
3155
|
-
// could exhibit both behaviors.
|
|
3156
|
-
|
|
3157
|
-
var capturedGroupsCount = prefixMatch.length - 1;
|
|
3158
|
-
var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];
|
|
3159
|
-
|
|
3160
|
-
if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {
|
|
3161
|
-
nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group,
|
|
3162
|
-
// then carrier code is the second one.
|
|
3163
|
-
|
|
3164
|
-
if (capturedGroupsCount > 1) {
|
|
3165
|
-
carrierCode = prefixMatch[1];
|
|
3166
|
-
}
|
|
3167
|
-
} // If there're no "capturing groups",
|
|
3168
|
-
// or if there're "capturing groups" but no
|
|
3169
|
-
// `national_prefix_transform_rule`,
|
|
3170
|
-
// then just strip the national prefix from the number,
|
|
3171
|
-
// and possibly a carrier code.
|
|
3172
|
-
// Seems like there could be more.
|
|
3173
|
-
else {
|
|
3174
|
-
// `prefixBeforeNationalNumber` is the whole substring matched by
|
|
3175
|
-
// the `national_prefix_for_parsing` regular expression.
|
|
3176
|
-
// There seem to be no guarantees that it's just a national prefix.
|
|
3177
|
-
// For example, if there's a carrier code, it's gonna be a
|
|
3178
|
-
// part of `prefixBeforeNationalNumber` too.
|
|
3179
|
-
var prefixBeforeNationalNumber = prefixMatch[0];
|
|
3180
|
-
nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group,
|
|
3181
|
-
// then carrier code is the first one.
|
|
3182
|
-
|
|
3183
|
-
if (hasCapturedGroups) {
|
|
3184
|
-
carrierCode = prefixMatch[1];
|
|
3185
|
-
}
|
|
3186
|
-
} // Tries to guess whether a national prefix was present in the input.
|
|
3187
|
-
// This is not something copy-pasted from Google's library:
|
|
3188
|
-
// they don't seem to have an equivalent for that.
|
|
3189
|
-
// So this isn't an "officially approved" way of doing something like that.
|
|
3190
|
-
// But since there seems no other existing method, this library uses it.
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
var nationalPrefix;
|
|
3194
|
-
|
|
3195
|
-
if (hasCapturedGroups) {
|
|
3196
|
-
var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);
|
|
3197
|
-
var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`.
|
|
3198
|
-
// `prefixMatch[0]` is `01115`, and `$1` is `11`,
|
|
3199
|
-
// and the rest of the phone number is `23456789`.
|
|
3200
|
-
// The national number is transformed via `9$1` to `91123456789`.
|
|
3201
|
-
// National prefix `0` is detected being present at the start.
|
|
3202
|
-
// if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {
|
|
3203
|
-
|
|
3204
|
-
if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {
|
|
3205
|
-
nationalPrefix = metadata.numberingPlan.nationalPrefix();
|
|
3206
|
-
}
|
|
3207
|
-
} else {
|
|
3208
|
-
nationalPrefix = prefixMatch[0];
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
return {
|
|
3212
|
-
nationalNumber: nationalNumber,
|
|
3213
|
-
nationalPrefix: nationalPrefix,
|
|
3214
|
-
carrierCode: carrierCode
|
|
3215
|
-
};
|
|
3216
|
-
}
|
|
3217
|
-
}
|
|
3218
|
-
|
|
3219
|
-
return {
|
|
3220
|
-
nationalNumber: number
|
|
3221
|
-
};
|
|
3222
|
-
}
|
|
3223
|
-
|
|
3224
|
-
/**
|
|
3225
|
-
* Strips national prefix and carrier code from a complete phone number.
|
|
3226
|
-
* The difference from the non-"FromCompleteNumber" function is that
|
|
3227
|
-
* it won't extract national prefix if the resultant number is too short
|
|
3228
|
-
* to be a complete number for the selected phone numbering plan.
|
|
3229
|
-
* @param {string} number — Complete phone number digits.
|
|
3230
|
-
* @param {Metadata} metadata — Metadata with a phone numbering plan selected.
|
|
3231
|
-
* @return {object} `{ nationalNumber: string, carrierCode: string? }`.
|
|
3232
|
-
*/
|
|
3233
|
-
|
|
3234
|
-
function extractNationalNumber(number, metadata) {
|
|
3235
|
-
// Parsing national prefixes and carrier codes
|
|
3236
|
-
// is only required for local phone numbers
|
|
3237
|
-
// but some people don't understand that
|
|
3238
|
-
// and sometimes write international phone numbers
|
|
3239
|
-
// with national prefixes (or maybe even carrier codes).
|
|
3240
|
-
// http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html
|
|
3241
|
-
// Google's original library forgives such mistakes
|
|
3242
|
-
// and so does this library, because it has been requested:
|
|
3243
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/127
|
|
3244
|
-
var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),
|
|
3245
|
-
nationalNumber = _extractNationalNumbe.nationalNumber,
|
|
3246
|
-
carrierCode = _extractNationalNumbe.carrierCode;
|
|
3247
|
-
|
|
3248
|
-
if (!shouldExtractNationalPrefix(number, nationalNumber, metadata)) {
|
|
3249
|
-
// Don't strip the national prefix.
|
|
3250
|
-
return {
|
|
3251
|
-
nationalNumber: number
|
|
3252
|
-
};
|
|
3253
|
-
} // If a national prefix has been extracted, check to see
|
|
3254
|
-
// if the resultant number isn't too short.
|
|
3255
|
-
// Same code in Google's `libphonenumber`:
|
|
3256
|
-
// https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3291-L3302
|
|
3257
|
-
// For some reason, they do this check right after the `national_number_pattern` check
|
|
3258
|
-
// this library does in `shouldExtractNationalPrefix()` function.
|
|
3259
|
-
// Why is there a second "resultant" number validity check?
|
|
3260
|
-
// They don't provide an explanation.
|
|
3261
|
-
// This library just copies the behavior.
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
if (number.length !== nationalNumber.length + (carrierCode ? carrierCode.length : 0)) {
|
|
3265
|
-
// If not using legacy generated metadata (before version `1.0.18`)
|
|
3266
|
-
// then it has "possible lengths", so use those to validate the number length.
|
|
3267
|
-
if (metadata.possibleLengths()) {
|
|
3268
|
-
// "We require that the NSN remaining after stripping the national prefix and
|
|
3269
|
-
// carrier code be long enough to be a possible length for the region.
|
|
3270
|
-
// Otherwise, we don't do the stripping, since the original number could be
|
|
3271
|
-
// a valid short number."
|
|
3272
|
-
// https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250
|
|
3273
|
-
switch (checkNumberLength(nationalNumber, metadata)) {
|
|
3274
|
-
case 'TOO_SHORT':
|
|
3275
|
-
case 'INVALID_LENGTH':
|
|
3276
|
-
// case 'IS_POSSIBLE_LOCAL_ONLY':
|
|
3277
|
-
// Don't strip the national prefix.
|
|
3278
|
-
return {
|
|
3279
|
-
nationalNumber: number
|
|
3280
|
-
};
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
return {
|
|
3286
|
-
nationalNumber: nationalNumber,
|
|
3287
|
-
carrierCode: carrierCode
|
|
3288
|
-
};
|
|
3289
|
-
} // In some countries, the same digit could be a national prefix
|
|
3290
|
-
// or a leading digit of a valid phone number.
|
|
3291
|
-
// For example, in Russia, national prefix is `8`,
|
|
3292
|
-
// and also `800 555 35 35` is a valid number
|
|
3293
|
-
// in which `8` is not a national prefix, but the first digit
|
|
3294
|
-
// of a national (significant) number.
|
|
3295
|
-
// Same's with Belarus:
|
|
3296
|
-
// `82004910060` is a valid national (significant) number,
|
|
3297
|
-
// but `2004910060` is not.
|
|
3298
|
-
// To support such cases (to prevent the code from always stripping
|
|
3299
|
-
// national prefix), a condition is imposed: a national prefix
|
|
3300
|
-
// is not extracted when the original number is "viable" and the
|
|
3301
|
-
// resultant number is not, a "viable" national number being the one
|
|
3302
|
-
// that matches `national_number_pattern`.
|
|
3303
|
-
|
|
3304
|
-
function shouldExtractNationalPrefix(number, nationalSignificantNumber, metadata) {
|
|
3305
|
-
// The equivalent in Google's code is:
|
|
3306
|
-
// https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004
|
|
3307
|
-
if (matchesEntirely(number, metadata.nationalNumberPattern()) && !matchesEntirely(nationalSignificantNumber, metadata.nationalNumberPattern())) {
|
|
3308
|
-
return false;
|
|
3309
|
-
} // Just "possible" number check would be more relaxed, so it's not used.
|
|
3310
|
-
// if (isPossibleNumber(number, metadata) &&
|
|
3311
|
-
// !isPossibleNumber(numberWithNationalPrefixExtracted, metadata)) {
|
|
3312
|
-
// return false
|
|
3313
|
-
// }
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
return true;
|
|
3317
|
-
}
|
|
3318
|
-
|
|
3319
|
-
/**
|
|
3320
|
-
* Sometimes some people incorrectly input international phone numbers
|
|
3321
|
-
* without the leading `+`. This function corrects such input.
|
|
3322
|
-
* @param {string} number — Phone number digits.
|
|
3323
|
-
* @param {string?} country
|
|
3324
|
-
* @param {string?} callingCode
|
|
3325
|
-
* @param {object} metadata
|
|
3326
|
-
* @return {object} `{ countryCallingCode: string?, number: string }`.
|
|
3327
|
-
*/
|
|
3328
|
-
|
|
3329
|
-
function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) {
|
|
3330
|
-
var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode;
|
|
3331
|
-
|
|
3332
|
-
if (number.indexOf(countryCallingCode) === 0) {
|
|
3333
|
-
metadata = new Metadata(metadata);
|
|
3334
|
-
metadata.selectNumberingPlan(country, callingCode);
|
|
3335
|
-
var possibleShorterNumber = number.slice(countryCallingCode.length);
|
|
3336
|
-
|
|
3337
|
-
var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata),
|
|
3338
|
-
possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;
|
|
3339
|
-
|
|
3340
|
-
var _extractNationalNumbe2 = extractNationalNumber(number, metadata),
|
|
3341
|
-
nationalNumber = _extractNationalNumbe2.nationalNumber; // If the number was not valid before but is valid now,
|
|
3342
|
-
// or if it was too long before, we consider the number
|
|
3343
|
-
// with the country calling code stripped to be a better result
|
|
3344
|
-
// and keep that instead.
|
|
3345
|
-
// For example, in Germany (+49), `49` is a valid area code,
|
|
3346
|
-
// so if a number starts with `49`, it could be both a valid
|
|
3347
|
-
// national German number or an international number without
|
|
3348
|
-
// a leading `+`.
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') {
|
|
3352
|
-
return {
|
|
3353
|
-
countryCallingCode: countryCallingCode,
|
|
3354
|
-
number: possibleShorterNumber
|
|
3355
|
-
};
|
|
3356
|
-
}
|
|
3357
|
-
}
|
|
3358
|
-
|
|
3359
|
-
return {
|
|
3360
|
-
number: number
|
|
3361
|
-
};
|
|
3362
|
-
}
|
|
3363
|
-
|
|
3364
|
-
/**
|
|
3365
|
-
* Converts a phone number digits (possibly with a `+`)
|
|
3366
|
-
* into a calling code and the rest phone number digits.
|
|
3367
|
-
* The "rest phone number digits" could include
|
|
3368
|
-
* a national prefix, carrier code, and national
|
|
3369
|
-
* (significant) number.
|
|
3370
|
-
* @param {string} number — Phone number digits (possibly with a `+`).
|
|
3371
|
-
* @param {string} [country] — Default country.
|
|
3372
|
-
* @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic).
|
|
3373
|
-
* @param {object} metadata
|
|
3374
|
-
* @return {object} `{ countryCallingCode: string?, number: string }`
|
|
3375
|
-
* @example
|
|
3376
|
-
* // Returns `{ countryCallingCode: "1", number: "2133734253" }`.
|
|
3377
|
-
* extractCountryCallingCode('2133734253', 'US', null, metadata)
|
|
3378
|
-
* extractCountryCallingCode('2133734253', null, '1', metadata)
|
|
3379
|
-
* extractCountryCallingCode('+12133734253', null, null, metadata)
|
|
3380
|
-
* extractCountryCallingCode('+12133734253', 'RU', null, metadata)
|
|
3381
|
-
*/
|
|
3382
|
-
|
|
3383
|
-
function extractCountryCallingCode(number, country, callingCode, metadata) {
|
|
3384
|
-
if (!number) {
|
|
3385
|
-
return {};
|
|
3386
|
-
} // If this is not an international phone number,
|
|
3387
|
-
// then either extract an "IDD" prefix, or extract a
|
|
3388
|
-
// country calling code from a number by autocorrecting it
|
|
3389
|
-
// by prepending a leading `+` in cases when it starts
|
|
3390
|
-
// with the country calling code.
|
|
3391
|
-
// https://wikitravel.org/en/International_dialling_prefix
|
|
3392
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
if (number[0] !== '+') {
|
|
3396
|
-
// Convert an "out-of-country" dialing phone number
|
|
3397
|
-
// to a proper international phone number.
|
|
3398
|
-
var numberWithoutIDD = stripIddPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then
|
|
3399
|
-
// convert the number to international one
|
|
3400
|
-
// for subsequent parsing.
|
|
3401
|
-
|
|
3402
|
-
if (numberWithoutIDD && numberWithoutIDD !== number) {
|
|
3403
|
-
number = '+' + numberWithoutIDD;
|
|
3404
|
-
} else {
|
|
3405
|
-
// Check to see if the number starts with the country calling code
|
|
3406
|
-
// for the default country. If so, we remove the country calling code,
|
|
3407
|
-
// and do some checks on the validity of the number before and after.
|
|
3408
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
3409
|
-
if (country || callingCode) {
|
|
3410
|
-
var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata),
|
|
3411
|
-
countryCallingCode = _extractCountryCallin.countryCallingCode,
|
|
3412
|
-
shorterNumber = _extractCountryCallin.number;
|
|
3413
|
-
|
|
3414
|
-
if (countryCallingCode) {
|
|
3415
|
-
return {
|
|
3416
|
-
countryCallingCode: countryCallingCode,
|
|
3417
|
-
number: shorterNumber
|
|
3418
|
-
};
|
|
3419
|
-
}
|
|
3420
|
-
}
|
|
3421
|
-
|
|
3422
|
-
return {
|
|
3423
|
-
number: number
|
|
3424
|
-
};
|
|
3425
|
-
}
|
|
3426
|
-
} // Fast abortion: country codes do not begin with a '0'
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
if (number[1] === '0') {
|
|
3430
|
-
return {};
|
|
3431
|
-
}
|
|
3432
|
-
|
|
3433
|
-
metadata = new Metadata(metadata); // The thing with country phone codes
|
|
3434
|
-
// is that they are orthogonal to each other
|
|
3435
|
-
// i.e. there's no such country phone code A
|
|
3436
|
-
// for which country phone code B exists
|
|
3437
|
-
// where B starts with A.
|
|
3438
|
-
// Therefore, while scanning digits,
|
|
3439
|
-
// if a valid country code is found,
|
|
3440
|
-
// that means that it is the country code.
|
|
3441
|
-
//
|
|
3442
|
-
|
|
3443
|
-
var i = 2;
|
|
3444
|
-
|
|
3445
|
-
while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {
|
|
3446
|
-
var _countryCallingCode = number.slice(1, i);
|
|
3447
|
-
|
|
3448
|
-
if (metadata.hasCallingCode(_countryCallingCode)) {
|
|
3449
|
-
metadata.selectNumberingPlan(_countryCallingCode);
|
|
3450
|
-
return {
|
|
3451
|
-
countryCallingCode: _countryCallingCode,
|
|
3452
|
-
number: number.slice(i)
|
|
3453
|
-
};
|
|
3454
|
-
}
|
|
3455
|
-
|
|
3456
|
-
i++;
|
|
3457
|
-
}
|
|
3458
|
-
|
|
3459
|
-
return {};
|
|
3460
|
-
}
|
|
3461
|
-
|
|
3462
|
-
function getCountryByCallingCode(callingCode, nationalPhoneNumber, metadata) {
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);
|
|
3466
|
-
|
|
3467
|
-
if (!possibleCountries) {
|
|
3468
|
-
return;
|
|
3469
|
-
} // If there's just one country corresponding to the country code,
|
|
3470
|
-
// then just return it, without further phone number digits validation.
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
if (possibleCountries.length === 1) {
|
|
3474
|
-
return possibleCountries[0];
|
|
3475
|
-
}
|
|
3476
|
-
|
|
3477
|
-
return selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata.metadata);
|
|
3478
|
-
}
|
|
3479
|
-
|
|
3480
|
-
function selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata) {
|
|
3481
|
-
// Re-create `metadata` because it will be selecting a `country`.
|
|
3482
|
-
metadata = new Metadata(metadata);
|
|
3483
|
-
|
|
3484
|
-
for (var _iterator = possibleCountries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
3485
|
-
var _ref;
|
|
3486
|
-
|
|
3487
|
-
if (_isArray) {
|
|
3488
|
-
if (_i >= _iterator.length) break;
|
|
3489
|
-
_ref = _iterator[_i++];
|
|
3490
|
-
} else {
|
|
3491
|
-
_i = _iterator.next();
|
|
3492
|
-
if (_i.done) break;
|
|
3493
|
-
_ref = _i.value;
|
|
3494
|
-
}
|
|
3495
|
-
|
|
3496
|
-
var country = _ref;
|
|
3497
|
-
metadata.country(country); // Leading digits check would be the simplest one
|
|
3498
|
-
|
|
3499
|
-
if (metadata.leadingDigits()) {
|
|
3500
|
-
if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {
|
|
3501
|
-
return country;
|
|
3502
|
-
}
|
|
3503
|
-
} // Else perform full validation with all of those
|
|
3504
|
-
// fixed-line/mobile/etc regular expressions.
|
|
3505
|
-
else if (getNumberType({
|
|
3506
|
-
phone: nationalPhoneNumber,
|
|
3507
|
-
country: country
|
|
3508
|
-
}, undefined, metadata.metadata)) {
|
|
3509
|
-
return country;
|
|
3510
|
-
}
|
|
3511
|
-
}
|
|
3512
|
-
}
|
|
3513
|
-
|
|
3514
|
-
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3515
|
-
|
|
3516
|
-
function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
3517
|
-
|
|
3518
|
-
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); return Constructor; }
|
|
3519
|
-
|
|
3520
|
-
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3521
|
-
|
|
3522
|
-
var AsYouTypeState =
|
|
3523
|
-
/*#__PURE__*/
|
|
3524
|
-
function () {
|
|
3525
|
-
function AsYouTypeState(_ref) {
|
|
3526
|
-
var _this = this;
|
|
3527
|
-
|
|
3528
|
-
var onCountryChange = _ref.onCountryChange,
|
|
3529
|
-
onCallingCodeChange = _ref.onCallingCodeChange;
|
|
3530
|
-
|
|
3531
|
-
_classCallCheck$2(this, AsYouTypeState);
|
|
3532
|
-
|
|
3533
|
-
_defineProperty$2(this, "update", function (properties) {
|
|
3534
|
-
for (var _i = 0, _Object$keys = Object.keys(properties); _i < _Object$keys.length; _i++) {
|
|
3535
|
-
var key = _Object$keys[_i];
|
|
3536
|
-
_this[key] = properties[key];
|
|
3537
|
-
}
|
|
3538
|
-
});
|
|
3539
|
-
|
|
3540
|
-
this.onCountryChange = onCountryChange;
|
|
3541
|
-
this.onCallingCodeChange = onCallingCodeChange;
|
|
3542
|
-
}
|
|
3543
|
-
|
|
3544
|
-
_createClass$2(AsYouTypeState, [{
|
|
3545
|
-
key: "reset",
|
|
3546
|
-
value: function reset(defaultCountry, defaultCallingCode) {
|
|
3547
|
-
this.international = false;
|
|
3548
|
-
this.IDDPrefix = undefined;
|
|
3549
|
-
this.missingPlus = undefined;
|
|
3550
|
-
this.callingCode = undefined;
|
|
3551
|
-
this.digits = '';
|
|
3552
|
-
this.resetNationalSignificantNumber();
|
|
3553
|
-
this.initCountryAndCallingCode(defaultCountry, defaultCallingCode);
|
|
3554
|
-
}
|
|
3555
|
-
}, {
|
|
3556
|
-
key: "resetNationalSignificantNumber",
|
|
3557
|
-
value: function resetNationalSignificantNumber() {
|
|
3558
|
-
this.nationalSignificantNumber = this.getNationalDigits();
|
|
3559
|
-
this.nationalSignificantNumberMatchesInput = true;
|
|
3560
|
-
this.nationalPrefix = undefined;
|
|
3561
|
-
this.carrierCode = undefined;
|
|
3562
|
-
this.complexPrefixBeforeNationalSignificantNumber = undefined;
|
|
3563
|
-
}
|
|
3564
|
-
}, {
|
|
3565
|
-
key: "initCountryAndCallingCode",
|
|
3566
|
-
value: function initCountryAndCallingCode(country, callingCode) {
|
|
3567
|
-
this.setCountry(country);
|
|
3568
|
-
this.setCallingCode(callingCode);
|
|
3569
|
-
}
|
|
3570
|
-
}, {
|
|
3571
|
-
key: "setCountry",
|
|
3572
|
-
value: function setCountry(country) {
|
|
3573
|
-
this.country = country;
|
|
3574
|
-
this.onCountryChange(country);
|
|
3575
|
-
}
|
|
3576
|
-
}, {
|
|
3577
|
-
key: "setCallingCode",
|
|
3578
|
-
value: function setCallingCode(callingCode) {
|
|
3579
|
-
this.callingCode = callingCode;
|
|
3580
|
-
return this.onCallingCodeChange(this.country, callingCode);
|
|
3581
|
-
}
|
|
3582
|
-
}, {
|
|
3583
|
-
key: "startInternationalNumber",
|
|
3584
|
-
value: function startInternationalNumber() {
|
|
3585
|
-
// Prepend the `+` to parsed input.
|
|
3586
|
-
this.international = true; // If a default country was set then reset it
|
|
3587
|
-
// because an explicitly international phone
|
|
3588
|
-
// number is being entered.
|
|
3589
|
-
|
|
3590
|
-
this.initCountryAndCallingCode();
|
|
3591
|
-
}
|
|
3592
|
-
}, {
|
|
3593
|
-
key: "appendDigits",
|
|
3594
|
-
value: function appendDigits(nextDigits) {
|
|
3595
|
-
this.digits += nextDigits;
|
|
3596
|
-
}
|
|
3597
|
-
}, {
|
|
3598
|
-
key: "appendNationalSignificantNumberDigits",
|
|
3599
|
-
value: function appendNationalSignificantNumberDigits(nextDigits) {
|
|
3600
|
-
this.nationalSignificantNumber += nextDigits;
|
|
3601
|
-
}
|
|
3602
|
-
/**
|
|
3603
|
-
* Returns the part of `this.digits` that corresponds to the national number.
|
|
3604
|
-
* Basically, all digits that have been input by the user, except for the
|
|
3605
|
-
* international prefix and the country calling code part
|
|
3606
|
-
* (if the number is an international one).
|
|
3607
|
-
* @return {string}
|
|
3608
|
-
*/
|
|
3609
|
-
|
|
3610
|
-
}, {
|
|
3611
|
-
key: "getNationalDigits",
|
|
3612
|
-
value: function getNationalDigits() {
|
|
3613
|
-
if (this.international) {
|
|
3614
|
-
return this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0));
|
|
3615
|
-
}
|
|
3616
|
-
|
|
3617
|
-
return this.digits;
|
|
3618
|
-
}
|
|
3619
|
-
}, {
|
|
3620
|
-
key: "getDigitsWithoutInternationalPrefix",
|
|
3621
|
-
value: function getDigitsWithoutInternationalPrefix() {
|
|
3622
|
-
if (this.international) {
|
|
3623
|
-
if (this.IDDPrefix) {
|
|
3624
|
-
return this.digits.slice(this.IDDPrefix.length);
|
|
3625
|
-
}
|
|
3626
|
-
}
|
|
3627
|
-
|
|
3628
|
-
return this.digits;
|
|
3629
|
-
}
|
|
3630
|
-
}]);
|
|
3631
|
-
|
|
3632
|
-
return AsYouTypeState;
|
|
3633
|
-
}();
|
|
3634
|
-
|
|
3635
|
-
// Should be the same as `DIGIT_PLACEHOLDER` in `libphonenumber-metadata-generator`.
|
|
3636
|
-
var DIGIT_PLACEHOLDER = 'x'; // '\u2008' (punctuation space)
|
|
3637
|
-
|
|
3638
|
-
var DIGIT_PLACEHOLDER_MATCHER = new RegExp(DIGIT_PLACEHOLDER); // Counts all occurences of a symbol in a string.
|
|
3639
|
-
// http://stackoverflow.com/questions/202605/repeat-string-javascript
|
|
3640
|
-
|
|
3641
|
-
function repeat(string, times) {
|
|
3642
|
-
if (times < 1) {
|
|
3643
|
-
return '';
|
|
3644
|
-
}
|
|
3645
|
-
|
|
3646
|
-
var result = '';
|
|
3647
|
-
|
|
3648
|
-
while (times > 1) {
|
|
3649
|
-
if (times & 1) {
|
|
3650
|
-
result += string;
|
|
3651
|
-
}
|
|
3652
|
-
|
|
3653
|
-
times >>= 1;
|
|
3654
|
-
string += string;
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3657
|
-
return result + string;
|
|
3658
|
-
}
|
|
3659
|
-
function cutAndStripNonPairedParens(string, cutBeforeIndex) {
|
|
3660
|
-
if (string[cutBeforeIndex] === ')') {
|
|
3661
|
-
cutBeforeIndex++;
|
|
3662
|
-
}
|
|
3663
|
-
|
|
3664
|
-
return stripNonPairedParens(string.slice(0, cutBeforeIndex));
|
|
3665
|
-
}
|
|
3666
|
-
function stripNonPairedParens(string) {
|
|
3667
|
-
var dangling_braces = [];
|
|
3668
|
-
var i = 0;
|
|
3669
|
-
|
|
3670
|
-
while (i < string.length) {
|
|
3671
|
-
if (string[i] === '(') {
|
|
3672
|
-
dangling_braces.push(i);
|
|
3673
|
-
} else if (string[i] === ')') {
|
|
3674
|
-
dangling_braces.pop();
|
|
3675
|
-
}
|
|
3676
|
-
|
|
3677
|
-
i++;
|
|
3678
|
-
}
|
|
3679
|
-
|
|
3680
|
-
var start = 0;
|
|
3681
|
-
var cleared_string = '';
|
|
3682
|
-
dangling_braces.push(string.length);
|
|
3683
|
-
|
|
3684
|
-
for (var _i2 = 0, _dangling_braces = dangling_braces; _i2 < _dangling_braces.length; _i2++) {
|
|
3685
|
-
var index = _dangling_braces[_i2];
|
|
3686
|
-
cleared_string += string.slice(start, index);
|
|
3687
|
-
start = index + 1;
|
|
3688
|
-
}
|
|
3689
|
-
|
|
3690
|
-
return cleared_string;
|
|
3691
|
-
}
|
|
3692
|
-
function populateTemplateWithDigits(template, position, digits) {
|
|
3693
|
-
// Using `.split('')` to iterate through a string here
|
|
3694
|
-
// to avoid requiring `Symbol.iterator` polyfill.
|
|
3695
|
-
// `.split('')` is generally not safe for Unicode,
|
|
3696
|
-
// but in this particular case for `digits` it is safe.
|
|
3697
|
-
// for (const digit of digits)
|
|
3698
|
-
for (var _iterator2 = digits.split(''), _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
3699
|
-
var _ref2;
|
|
3700
|
-
|
|
3701
|
-
if (_isArray2) {
|
|
3702
|
-
if (_i3 >= _iterator2.length) break;
|
|
3703
|
-
_ref2 = _iterator2[_i3++];
|
|
3704
|
-
} else {
|
|
3705
|
-
_i3 = _iterator2.next();
|
|
3706
|
-
if (_i3.done) break;
|
|
3707
|
-
_ref2 = _i3.value;
|
|
3708
|
-
}
|
|
3709
|
-
|
|
3710
|
-
var digit = _ref2;
|
|
3711
|
-
|
|
3712
|
-
// If there is room for more digits in current `template`,
|
|
3713
|
-
// then set the next digit in the `template`,
|
|
3714
|
-
// and return the formatted digits so far.
|
|
3715
|
-
// If more digits are entered than the current format could handle.
|
|
3716
|
-
if (template.slice(position + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) {
|
|
3717
|
-
return;
|
|
3718
|
-
}
|
|
3719
|
-
|
|
3720
|
-
position = template.search(DIGIT_PLACEHOLDER_MATCHER);
|
|
3721
|
-
template = template.replace(DIGIT_PLACEHOLDER_MATCHER, digit);
|
|
3722
|
-
}
|
|
3723
|
-
|
|
3724
|
-
return [template, position];
|
|
3725
|
-
}
|
|
3726
|
-
|
|
3727
|
-
function formatCompleteNumber(state, format, _ref) {
|
|
3728
|
-
var metadata = _ref.metadata,
|
|
3729
|
-
shouldTryNationalPrefixFormattingRule = _ref.shouldTryNationalPrefixFormattingRule,
|
|
3730
|
-
getSeparatorAfterNationalPrefix = _ref.getSeparatorAfterNationalPrefix;
|
|
3731
|
-
var matcher = new RegExp("^(?:".concat(format.pattern(), ")$"));
|
|
3732
|
-
|
|
3733
|
-
if (matcher.test(state.nationalSignificantNumber)) {
|
|
3734
|
-
return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, {
|
|
3735
|
-
metadata: metadata,
|
|
3736
|
-
shouldTryNationalPrefixFormattingRule: shouldTryNationalPrefixFormattingRule,
|
|
3737
|
-
getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix
|
|
3738
|
-
});
|
|
3739
|
-
}
|
|
3740
|
-
}
|
|
3741
|
-
function canFormatCompleteNumber(nationalSignificantNumber, metadata) {
|
|
3742
|
-
return checkNumberLength(nationalSignificantNumber, metadata) === 'IS_POSSIBLE';
|
|
3743
|
-
}
|
|
3744
|
-
|
|
3745
|
-
function formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, _ref2) {
|
|
3746
|
-
var metadata = _ref2.metadata,
|
|
3747
|
-
shouldTryNationalPrefixFormattingRule = _ref2.shouldTryNationalPrefixFormattingRule,
|
|
3748
|
-
getSeparatorAfterNationalPrefix = _ref2.getSeparatorAfterNationalPrefix;
|
|
3749
|
-
// If the resulting formatted number is a valid formatted number, then return it.
|
|
3750
|
-
//
|
|
3751
|
-
// Google's AsYouType formatter is different in a way that it doesn't try
|
|
3752
|
-
// to format using the "national prefix formatting rule", and instead it
|
|
3753
|
-
// simply prepends a national prefix followed by a " " character.
|
|
3754
|
-
// This code does that too, but as a fallback.
|
|
3755
|
-
// The reason is that "national prefix formatting rule" may use parentheses,
|
|
3756
|
-
// which wouldn't be included has it used the simpler Google's way.
|
|
3757
|
-
//
|
|
3758
|
-
|
|
3759
|
-
if (shouldTryNationalPrefixFormattingRule(format)) {
|
|
3760
|
-
var formattedNumber = formatNationalNumber$1(state, format, {
|
|
3761
|
-
useNationalPrefixFormattingRule: true,
|
|
3762
|
-
getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix,
|
|
3763
|
-
metadata: metadata
|
|
3764
|
-
});
|
|
3765
|
-
|
|
3766
|
-
if (formattedNumber) {
|
|
3767
|
-
return formattedNumber;
|
|
3768
|
-
}
|
|
3769
|
-
} // Format the number without using `national_prefix_formatting_rule`.
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
return formatNationalNumber$1(state, format, {
|
|
3773
|
-
useNationalPrefixFormattingRule: false,
|
|
3774
|
-
getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix,
|
|
3775
|
-
metadata: metadata
|
|
3776
|
-
});
|
|
3777
|
-
}
|
|
3778
|
-
|
|
3779
|
-
function formatNationalNumber$1(state, format, _ref3) {
|
|
3780
|
-
var metadata = _ref3.metadata,
|
|
3781
|
-
useNationalPrefixFormattingRule = _ref3.useNationalPrefixFormattingRule,
|
|
3782
|
-
getSeparatorAfterNationalPrefix = _ref3.getSeparatorAfterNationalPrefix;
|
|
3783
|
-
var formattedNationalNumber = formatNationalNumberUsingFormat(state.nationalSignificantNumber, format, {
|
|
3784
|
-
carrierCode: state.carrierCode,
|
|
3785
|
-
useInternationalFormat: state.international,
|
|
3786
|
-
withNationalPrefix: useNationalPrefixFormattingRule,
|
|
3787
|
-
metadata: metadata
|
|
3788
|
-
});
|
|
3789
|
-
|
|
3790
|
-
if (!useNationalPrefixFormattingRule) {
|
|
3791
|
-
if (state.nationalPrefix) {
|
|
3792
|
-
// If a national prefix was extracted, then just prepend it,
|
|
3793
|
-
// followed by a " " character.
|
|
3794
|
-
formattedNationalNumber = state.nationalPrefix + getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;
|
|
3795
|
-
} else if (state.complexPrefixBeforeNationalSignificantNumber) {
|
|
3796
|
-
formattedNationalNumber = state.complexPrefixBeforeNationalSignificantNumber + ' ' + formattedNationalNumber;
|
|
3797
|
-
}
|
|
3798
|
-
}
|
|
3799
|
-
|
|
3800
|
-
if (isValidFormattedNationalNumber(formattedNationalNumber, state)) {
|
|
3801
|
-
return formattedNationalNumber;
|
|
3802
|
-
}
|
|
3803
|
-
} // Check that the formatted phone number contains exactly
|
|
3804
|
-
// the same digits that have been input by the user.
|
|
3805
|
-
// For example, when "0111523456789" is input for `AR` country,
|
|
3806
|
-
// the extracted `this.nationalSignificantNumber` is "91123456789",
|
|
3807
|
-
// which means that the national part of `this.digits` isn't simply equal to
|
|
3808
|
-
// `this.nationalPrefix` + `this.nationalSignificantNumber`.
|
|
3809
|
-
//
|
|
3810
|
-
// Also, a `format` can add extra digits to the `this.nationalSignificantNumber`
|
|
3811
|
-
// being formatted via `metadata[country].national_prefix_transform_rule`.
|
|
3812
|
-
// For example, for `VI` country, it prepends `340` to the national number,
|
|
3813
|
-
// and if this check hasn't been implemented, then there would be a bug
|
|
3814
|
-
// when `340` "area coude" is "duplicated" during input for `VI` country:
|
|
3815
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/318
|
|
3816
|
-
//
|
|
3817
|
-
// So, all these "gotchas" are filtered out.
|
|
3818
|
-
//
|
|
3819
|
-
// In the original Google's code, the comments say:
|
|
3820
|
-
// "Check that we didn't remove nor add any extra digits when we matched
|
|
3821
|
-
// this formatting pattern. This usually happens after we entered the last
|
|
3822
|
-
// digit during AYTF. Eg: In case of MX, we swallow mobile token (1) when
|
|
3823
|
-
// formatted but AYTF should retain all the number entered and not change
|
|
3824
|
-
// in order to match a format (of same leading digits and length) display
|
|
3825
|
-
// in that way."
|
|
3826
|
-
// "If it's the same (i.e entered number and format is same), then it's
|
|
3827
|
-
// safe to return this in formatted number as nothing is lost / added."
|
|
3828
|
-
// Otherwise, don't use this format.
|
|
3829
|
-
// https://github.com/google/libphonenumber/commit/3e7c1f04f5e7200f87fb131e6f85c6e99d60f510#diff-9149457fa9f5d608a11bb975c6ef4bc5
|
|
3830
|
-
// https://github.com/google/libphonenumber/commit/3ac88c7106e7dcb553bcc794b15f19185928a1c6#diff-2dcb77e833422ee304da348b905cde0b
|
|
3831
|
-
//
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
function isValidFormattedNationalNumber(formattedNationalNumber, state) {
|
|
3835
|
-
return parseDigits(formattedNationalNumber) === state.getNationalDigits();
|
|
3836
|
-
}
|
|
3837
|
-
|
|
3838
|
-
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3839
|
-
|
|
3840
|
-
function _defineProperties$3(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
3841
|
-
|
|
3842
|
-
function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); if (staticProps) _defineProperties$3(Constructor, staticProps); return Constructor; }
|
|
3843
|
-
|
|
3844
|
-
function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3845
|
-
// Could be any digit, I guess.
|
|
3846
|
-
|
|
3847
|
-
var DUMMY_DIGIT = '9'; // I don't know why is it exactly `15`
|
|
3848
|
-
|
|
3849
|
-
var LONGEST_NATIONAL_PHONE_NUMBER_LENGTH = 15; // Create a phone number consisting only of the digit 9 that matches the
|
|
3850
|
-
// `number_pattern` by applying the pattern to the "longest phone number" string.
|
|
3851
|
-
|
|
3852
|
-
var LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, LONGEST_NATIONAL_PHONE_NUMBER_LENGTH); // A set of characters that, if found in a national prefix formatting rules, are an indicator to
|
|
3853
|
-
// us that we should separate the national prefix from the number when formatting.
|
|
3854
|
-
|
|
3855
|
-
var NATIONAL_PREFIX_SEPARATORS_PATTERN = /[- ]/; // Deprecated: Google has removed some formatting pattern related code from their repo.
|
|
3856
|
-
// An example of a character class is "[1-4]".
|
|
3857
|
-
|
|
3858
|
-
var CREATE_CHARACTER_CLASS_PATTERN = function () {
|
|
3859
|
-
return /\[([^\[\]])*\]/g;
|
|
3860
|
-
}; // Any digit in a regular expression that actually denotes a digit. For
|
|
3861
|
-
// example, in the regular expression "80[0-2]\d{6,10}", the first 2 digits
|
|
3862
|
-
// (8 and 0) are standalone digits, but the rest are not.
|
|
3863
|
-
// Two look-aheads are needed because the number following \\d could be a
|
|
3864
|
-
// two-digit number, since the phone number can be as long as 15 digits.
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
var CREATE_STANDALONE_DIGIT_PATTERN = function () {
|
|
3868
|
-
return /\d(?=[^,}][^,}])/g;
|
|
3869
|
-
}; // A regular expression that is used to determine if a `format` is
|
|
3870
|
-
// suitable to be used in the "as you type formatter".
|
|
3871
|
-
// A `format` is suitable when the resulting formatted number has
|
|
3872
|
-
// the same digits as the user has entered.
|
|
3873
|
-
//
|
|
3874
|
-
// In the simplest case, that would mean that the format
|
|
3875
|
-
// doesn't add any additional digits when formatting a number.
|
|
3876
|
-
// Google says that it also shouldn't add "star" (`*`) characters,
|
|
3877
|
-
// like it does in some Israeli formats.
|
|
3878
|
-
// Such basic format would only contain "valid punctuation"
|
|
3879
|
-
// and "captured group" identifiers ($1, $2, etc).
|
|
3880
|
-
//
|
|
3881
|
-
// An example of a format that adds additional digits:
|
|
3882
|
-
//
|
|
3883
|
-
// Country: `AR` (Argentina).
|
|
3884
|
-
// Format:
|
|
3885
|
-
// {
|
|
3886
|
-
// "pattern": "(\\d)(\\d{2})(\\d{4})(\\d{4})",
|
|
3887
|
-
// "leading_digits_patterns": ["91"],
|
|
3888
|
-
// "national_prefix_formatting_rule": "0$1",
|
|
3889
|
-
// "format": "$2 15-$3-$4",
|
|
3890
|
-
// "international_format": "$1 $2 $3-$4"
|
|
3891
|
-
// }
|
|
3892
|
-
//
|
|
3893
|
-
// In the format above, the `format` adds `15` to the digits when formatting a number.
|
|
3894
|
-
// A sidenote: this format actually is suitable because `national_prefix_for_parsing`
|
|
3895
|
-
// has previously removed `15` from a national number, so re-adding `15` in `format`
|
|
3896
|
-
// doesn't actually result in any extra digits added to user's input.
|
|
3897
|
-
// But verifying that would be a complex procedure, so the code chooses a simpler path:
|
|
3898
|
-
// it simply filters out all `format`s that contain anything but "captured group" ids.
|
|
3899
|
-
//
|
|
3900
|
-
// This regular expression is called `ELIGIBLE_FORMAT_PATTERN` in Google's
|
|
3901
|
-
// `libphonenumber` code.
|
|
3902
|
-
//
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
var NON_ALTERING_FORMAT_REG_EXP = new RegExp('^' + '[' + VALID_PUNCTUATION + ']*' + '(\\$\\d[' + VALID_PUNCTUATION + ']*)+' + '$'); // This is the minimum length of the leading digits of a phone number
|
|
3906
|
-
// to guarantee the first "leading digits pattern" for a phone number format
|
|
3907
|
-
// to be preemptive.
|
|
3908
|
-
|
|
3909
|
-
var MIN_LEADING_DIGITS_LENGTH = 3;
|
|
3910
|
-
|
|
3911
|
-
var AsYouTypeFormatter =
|
|
3912
|
-
/*#__PURE__*/
|
|
3913
|
-
function () {
|
|
3914
|
-
function AsYouTypeFormatter(_ref) {
|
|
3915
|
-
var _this = this;
|
|
3916
|
-
|
|
3917
|
-
var metadata = _ref.metadata;
|
|
3918
|
-
|
|
3919
|
-
_classCallCheck$3(this, AsYouTypeFormatter);
|
|
3920
|
-
|
|
3921
|
-
_defineProperty$3(this, "getSeparatorAfterNationalPrefix", function (format) {
|
|
3922
|
-
// `US` metadata doesn't have a `national_prefix_formatting_rule`,
|
|
3923
|
-
// so the `if` condition below doesn't apply to `US`,
|
|
3924
|
-
// but in reality there shoudl be a separator
|
|
3925
|
-
// between a national prefix and a national (significant) number.
|
|
3926
|
-
// So `US` national prefix separator is a "special" "hardcoded" case.
|
|
3927
|
-
if (_this.isNANP) {
|
|
3928
|
-
return ' ';
|
|
3929
|
-
} // If a `format` has a `national_prefix_formatting_rule`
|
|
3930
|
-
// and that rule has a separator after a national prefix,
|
|
3931
|
-
// then it means that there should be a separator
|
|
3932
|
-
// between a national prefix and a national (significant) number.
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) {
|
|
3936
|
-
return ' ';
|
|
3937
|
-
} // At this point, there seems to be no clear evidence that
|
|
3938
|
-
// there should be a separator between a national prefix
|
|
3939
|
-
// and a national (significant) number. So don't insert one.
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
return '';
|
|
3943
|
-
});
|
|
3944
|
-
|
|
3945
|
-
_defineProperty$3(this, "shouldTryNationalPrefixFormattingRule", function (format, _ref2) {
|
|
3946
|
-
var international = _ref2.international,
|
|
3947
|
-
nationalPrefix = _ref2.nationalPrefix;
|
|
3948
|
-
|
|
3949
|
-
if (format.nationalPrefixFormattingRule()) {
|
|
3950
|
-
// In some countries, `national_prefix_formatting_rule` is `($1)`,
|
|
3951
|
-
// so it applies even if the user hasn't input a national prefix.
|
|
3952
|
-
// `format.usesNationalPrefix()` detects such cases.
|
|
3953
|
-
var usesNationalPrefix = format.usesNationalPrefix();
|
|
3954
|
-
|
|
3955
|
-
if (usesNationalPrefix && nationalPrefix || !usesNationalPrefix && !international) {
|
|
3956
|
-
return true;
|
|
3957
|
-
}
|
|
3958
|
-
}
|
|
3959
|
-
});
|
|
3960
|
-
|
|
3961
|
-
this.metadata = metadata;
|
|
3962
|
-
this.resetFormat();
|
|
3963
|
-
}
|
|
3964
|
-
|
|
3965
|
-
_createClass$3(AsYouTypeFormatter, [{
|
|
3966
|
-
key: "resetFormat",
|
|
3967
|
-
value: function resetFormat() {
|
|
3968
|
-
this.chosenFormat = undefined;
|
|
3969
|
-
this.template = undefined;
|
|
3970
|
-
this.nationalNumberTemplate = undefined;
|
|
3971
|
-
this.populatedNationalNumberTemplate = undefined;
|
|
3972
|
-
this.populatedNationalNumberTemplatePosition = -1;
|
|
3973
|
-
}
|
|
3974
|
-
}, {
|
|
3975
|
-
key: "reset",
|
|
3976
|
-
value: function reset(numberingPlan, state) {
|
|
3977
|
-
this.resetFormat();
|
|
3978
|
-
|
|
3979
|
-
if (numberingPlan) {
|
|
3980
|
-
this.isNANP = numberingPlan.callingCode() === '1';
|
|
3981
|
-
this.matchingFormats = numberingPlan.formats();
|
|
3982
|
-
|
|
3983
|
-
if (state.nationalSignificantNumber) {
|
|
3984
|
-
this.narrowDownMatchingFormats(state);
|
|
3985
|
-
}
|
|
3986
|
-
} else {
|
|
3987
|
-
this.isNANP = undefined;
|
|
3988
|
-
this.matchingFormats = [];
|
|
3989
|
-
}
|
|
3990
|
-
}
|
|
3991
|
-
}, {
|
|
3992
|
-
key: "format",
|
|
3993
|
-
value: function format(nextDigits, state) {
|
|
3994
|
-
var _this2 = this;
|
|
3995
|
-
|
|
3996
|
-
// See if the phone number digits can be formatted as a complete phone number.
|
|
3997
|
-
// If not, use the results from `formatNationalNumberWithNextDigits()`,
|
|
3998
|
-
// which formats based on the chosen formatting pattern.
|
|
3999
|
-
//
|
|
4000
|
-
// Attempting to format complete phone number first is how it's done
|
|
4001
|
-
// in Google's `libphonenumber`, so this library just follows it.
|
|
4002
|
-
// Google's `libphonenumber` code doesn't explain in detail why does it
|
|
4003
|
-
// attempt to format digits as a complete phone number
|
|
4004
|
-
// instead of just going with a previoulsy (or newly) chosen `format`:
|
|
4005
|
-
//
|
|
4006
|
-
// "Checks to see if there is an exact pattern match for these digits.
|
|
4007
|
-
// If so, we should use this instead of any other formatting template
|
|
4008
|
-
// whose leadingDigitsPattern also matches the input."
|
|
4009
|
-
//
|
|
4010
|
-
if (canFormatCompleteNumber(state.nationalSignificantNumber, this.metadata)) {
|
|
4011
|
-
for (var _iterator = this.matchingFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
4012
|
-
var _ref3;
|
|
4013
|
-
|
|
4014
|
-
if (_isArray) {
|
|
4015
|
-
if (_i >= _iterator.length) break;
|
|
4016
|
-
_ref3 = _iterator[_i++];
|
|
4017
|
-
} else {
|
|
4018
|
-
_i = _iterator.next();
|
|
4019
|
-
if (_i.done) break;
|
|
4020
|
-
_ref3 = _i.value;
|
|
4021
|
-
}
|
|
4022
|
-
|
|
4023
|
-
var format = _ref3;
|
|
4024
|
-
var formattedCompleteNumber = formatCompleteNumber(state, format, {
|
|
4025
|
-
metadata: this.metadata,
|
|
4026
|
-
shouldTryNationalPrefixFormattingRule: function shouldTryNationalPrefixFormattingRule(format) {
|
|
4027
|
-
return _this2.shouldTryNationalPrefixFormattingRule(format, {
|
|
4028
|
-
international: state.international,
|
|
4029
|
-
nationalPrefix: state.nationalPrefix
|
|
4030
|
-
});
|
|
4031
|
-
},
|
|
4032
|
-
getSeparatorAfterNationalPrefix: this.getSeparatorAfterNationalPrefix
|
|
4033
|
-
});
|
|
4034
|
-
|
|
4035
|
-
if (formattedCompleteNumber) {
|
|
4036
|
-
this.resetFormat();
|
|
4037
|
-
this.chosenFormat = format;
|
|
4038
|
-
this.setNationalNumberTemplate(formattedCompleteNumber.replace(/\d/g, DIGIT_PLACEHOLDER), state);
|
|
4039
|
-
this.populatedNationalNumberTemplate = formattedCompleteNumber; // With a new formatting template, the matched position
|
|
4040
|
-
// using the old template needs to be reset.
|
|
4041
|
-
|
|
4042
|
-
this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf(DIGIT_PLACEHOLDER);
|
|
4043
|
-
return formattedCompleteNumber;
|
|
4044
|
-
}
|
|
4045
|
-
}
|
|
4046
|
-
} // Format the digits as a partial (incomplete) phone number
|
|
4047
|
-
// using the previously chosen formatting pattern (or a newly chosen one).
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
return this.formatNationalNumberWithNextDigits(nextDigits, state);
|
|
4051
|
-
} // Formats the next phone number digits.
|
|
4052
|
-
|
|
4053
|
-
}, {
|
|
4054
|
-
key: "formatNationalNumberWithNextDigits",
|
|
4055
|
-
value: function formatNationalNumberWithNextDigits(nextDigits, state) {
|
|
4056
|
-
var previouslyChosenFormat = this.chosenFormat; // Choose a format from the list of matching ones.
|
|
4057
|
-
|
|
4058
|
-
var newlyChosenFormat = this.chooseFormat(state);
|
|
4059
|
-
|
|
4060
|
-
if (newlyChosenFormat) {
|
|
4061
|
-
if (newlyChosenFormat === previouslyChosenFormat) {
|
|
4062
|
-
// If it can format the next (current) digits
|
|
4063
|
-
// using the previously chosen phone number format
|
|
4064
|
-
// then return the updated formatted number.
|
|
4065
|
-
return this.formatNextNationalNumberDigits(nextDigits);
|
|
4066
|
-
} else {
|
|
4067
|
-
// If a more appropriate phone number format
|
|
4068
|
-
// has been chosen for these "leading digits",
|
|
4069
|
-
// then re-format the national phone number part
|
|
4070
|
-
// using the newly selected format.
|
|
4071
|
-
return this.formatNextNationalNumberDigits(state.getNationalDigits());
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
}
|
|
4075
|
-
}, {
|
|
4076
|
-
key: "narrowDownMatchingFormats",
|
|
4077
|
-
value: function narrowDownMatchingFormats(_ref4) {
|
|
4078
|
-
var _this3 = this;
|
|
4079
|
-
|
|
4080
|
-
var nationalSignificantNumber = _ref4.nationalSignificantNumber,
|
|
4081
|
-
nationalPrefix = _ref4.nationalPrefix,
|
|
4082
|
-
international = _ref4.international;
|
|
4083
|
-
var leadingDigits = nationalSignificantNumber; // "leading digits" pattern list starts with a
|
|
4084
|
-
// "leading digits" pattern fitting a maximum of 3 leading digits.
|
|
4085
|
-
// So, after a user inputs 3 digits of a national (significant) phone number
|
|
4086
|
-
// this national (significant) number can already be formatted.
|
|
4087
|
-
// The next "leading digits" pattern is for 4 leading digits max,
|
|
4088
|
-
// and the "leading digits" pattern after it is for 5 leading digits max, etc.
|
|
4089
|
-
// This implementation is different from Google's
|
|
4090
|
-
// in that it searches for a fitting format
|
|
4091
|
-
// even if the user has entered less than
|
|
4092
|
-
// `MIN_LEADING_DIGITS_LENGTH` digits of a national number.
|
|
4093
|
-
// Because some leading digit patterns already match for a single first digit.
|
|
4094
|
-
|
|
4095
|
-
var leadingDigitsPatternIndex = leadingDigits.length - MIN_LEADING_DIGITS_LENGTH;
|
|
4096
|
-
|
|
4097
|
-
if (leadingDigitsPatternIndex < 0) {
|
|
4098
|
-
leadingDigitsPatternIndex = 0;
|
|
4099
|
-
}
|
|
4100
|
-
|
|
4101
|
-
this.matchingFormats = this.matchingFormats.filter(function (format) {
|
|
4102
|
-
return _this3.formatSuits(format, international, nationalPrefix) && _this3.formatMatches(format, leadingDigits, leadingDigitsPatternIndex);
|
|
4103
|
-
}); // If there was a phone number format chosen
|
|
4104
|
-
// and it no longer holds given the new leading digits then reset it.
|
|
4105
|
-
// The test for this `if` condition is marked as:
|
|
4106
|
-
// "Reset a chosen format when it no longer holds given the new leading digits".
|
|
4107
|
-
// To construct a valid test case for this one can find a country
|
|
4108
|
-
// in `PhoneNumberMetadata.xml` yielding one format for 3 `<leadingDigits>`
|
|
4109
|
-
// and yielding another format for 4 `<leadingDigits>` (Australia in this case).
|
|
4110
|
-
|
|
4111
|
-
if (this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1) {
|
|
4112
|
-
this.resetFormat();
|
|
4113
|
-
}
|
|
4114
|
-
}
|
|
4115
|
-
}, {
|
|
4116
|
-
key: "formatSuits",
|
|
4117
|
-
value: function formatSuits(format, international, nationalPrefix) {
|
|
4118
|
-
// When a prefix before a national (significant) number is
|
|
4119
|
-
// simply a national prefix, then it's parsed as `this.nationalPrefix`.
|
|
4120
|
-
// In more complex cases, a prefix before national (significant) number
|
|
4121
|
-
// could include a national prefix as well as some "capturing groups",
|
|
4122
|
-
// and in that case there's no info whether a national prefix has been parsed.
|
|
4123
|
-
// If national prefix is not used when formatting a phone number
|
|
4124
|
-
// using this format, but a national prefix has been entered by the user,
|
|
4125
|
-
// and was extracted, then discard such phone number format.
|
|
4126
|
-
// In Google's "AsYouType" formatter code, the equivalent would be this part:
|
|
4127
|
-
// https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L175-L184
|
|
4128
|
-
if (nationalPrefix && !format.usesNationalPrefix() && // !format.domesticCarrierCodeFormattingRule() &&
|
|
4129
|
-
!format.nationalPrefixIsOptionalWhenFormattingInNationalFormat()) {
|
|
4130
|
-
return false;
|
|
4131
|
-
} // If national prefix is mandatory for this phone number format
|
|
4132
|
-
// and there're no guarantees that a national prefix is present in user input
|
|
4133
|
-
// then discard this phone number format as not suitable.
|
|
4134
|
-
// In Google's "AsYouType" formatter code, the equivalent would be this part:
|
|
4135
|
-
// https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L185-L193
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
if (!international && !nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) {
|
|
4139
|
-
return false;
|
|
4140
|
-
}
|
|
4141
|
-
|
|
4142
|
-
return true;
|
|
4143
|
-
}
|
|
4144
|
-
}, {
|
|
4145
|
-
key: "formatMatches",
|
|
4146
|
-
value: function formatMatches(format, leadingDigits, leadingDigitsPatternIndex) {
|
|
4147
|
-
var leadingDigitsPatternsCount = format.leadingDigitsPatterns().length; // If this format is not restricted to a certain
|
|
4148
|
-
// leading digits pattern then it fits.
|
|
4149
|
-
|
|
4150
|
-
if (leadingDigitsPatternsCount === 0) {
|
|
4151
|
-
return true;
|
|
4152
|
-
} // Start excluding any non-matching formats only when the
|
|
4153
|
-
// national number entered so far is at least 3 digits long,
|
|
4154
|
-
// otherwise format matching would give false negatives.
|
|
4155
|
-
// For example, when the digits entered so far are `2`
|
|
4156
|
-
// and the leading digits pattern is `21` –
|
|
4157
|
-
// it's quite obvious in this case that the format could be the one
|
|
4158
|
-
// but due to the absence of further digits it would give false negative.
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) {
|
|
4162
|
-
return true;
|
|
4163
|
-
} // If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are available
|
|
4164
|
-
// then format matching starts narrowing down the list of possible formats
|
|
4165
|
-
// (only previously matched formats are considered for next digits).
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);
|
|
4169
|
-
var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex]; // Brackets are required for `^` to be applied to
|
|
4170
|
-
// all or-ed (`|`) parts, not just the first one.
|
|
4171
|
-
|
|
4172
|
-
return new RegExp("^(".concat(leadingDigitsPattern, ")")).test(leadingDigits);
|
|
4173
|
-
}
|
|
4174
|
-
}, {
|
|
4175
|
-
key: "getFormatFormat",
|
|
4176
|
-
value: function getFormatFormat(format, international) {
|
|
4177
|
-
return international ? format.internationalFormat() : format.format();
|
|
4178
|
-
}
|
|
4179
|
-
}, {
|
|
4180
|
-
key: "chooseFormat",
|
|
4181
|
-
value: function chooseFormat(state) {
|
|
4182
|
-
var _this4 = this;
|
|
4183
|
-
|
|
4184
|
-
var _loop2 = function _loop2() {
|
|
4185
|
-
if (_isArray2) {
|
|
4186
|
-
if (_i2 >= _iterator2.length) return "break";
|
|
4187
|
-
_ref5 = _iterator2[_i2++];
|
|
4188
|
-
} else {
|
|
4189
|
-
_i2 = _iterator2.next();
|
|
4190
|
-
if (_i2.done) return "break";
|
|
4191
|
-
_ref5 = _i2.value;
|
|
4192
|
-
}
|
|
4193
|
-
|
|
4194
|
-
var format = _ref5;
|
|
4195
|
-
|
|
4196
|
-
// If this format is currently being used
|
|
4197
|
-
// and is still suitable, then stick to it.
|
|
4198
|
-
if (_this4.chosenFormat === format) {
|
|
4199
|
-
return "break";
|
|
4200
|
-
} // Sometimes, a formatting rule inserts additional digits in a phone number,
|
|
4201
|
-
// and "as you type" formatter can't do that: it should only use the digits
|
|
4202
|
-
// that the user has input.
|
|
4203
|
-
//
|
|
4204
|
-
// For example, in Argentina, there's a format for mobile phone numbers:
|
|
4205
|
-
//
|
|
4206
|
-
// {
|
|
4207
|
-
// "pattern": "(\\d)(\\d{2})(\\d{4})(\\d{4})",
|
|
4208
|
-
// "leading_digits_patterns": ["91"],
|
|
4209
|
-
// "national_prefix_formatting_rule": "0$1",
|
|
4210
|
-
// "format": "$2 15-$3-$4",
|
|
4211
|
-
// "international_format": "$1 $2 $3-$4"
|
|
4212
|
-
// }
|
|
4213
|
-
//
|
|
4214
|
-
// In that format, `international_format` is used instead of `format`
|
|
4215
|
-
// because `format` inserts `15` in the formatted number,
|
|
4216
|
-
// and `AsYouType` formatter should only use the digits
|
|
4217
|
-
// the user has actually input, without adding any extra digits.
|
|
4218
|
-
// In this case, it wouldn't make a difference, because the `15`
|
|
4219
|
-
// is first stripped when applying `national_prefix_for_parsing`
|
|
4220
|
-
// and then re-added when using `format`, so in reality it doesn't
|
|
4221
|
-
// add any new digits to the number, but to detect that, the code
|
|
4222
|
-
// would have to be more complex: it would have to try formatting
|
|
4223
|
-
// the digits using the format and then see if any digits have
|
|
4224
|
-
// actually been added or removed, and then, every time a new digit
|
|
4225
|
-
// is input, it should re-check whether the chosen format doesn't
|
|
4226
|
-
// alter the digits.
|
|
4227
|
-
//
|
|
4228
|
-
// Google's code doesn't go that far, and so does this library:
|
|
4229
|
-
// it simply requires that a `format` doesn't add any additonal
|
|
4230
|
-
// digits to user's input.
|
|
4231
|
-
//
|
|
4232
|
-
// Also, people in general should move from inputting phone numbers
|
|
4233
|
-
// in national format (possibly with national prefixes)
|
|
4234
|
-
// and use international phone number format instead:
|
|
4235
|
-
// it's a logical thing in the modern age of mobile phones,
|
|
4236
|
-
// globalization and the internet.
|
|
4237
|
-
//
|
|
4238
|
-
|
|
4239
|
-
/* istanbul ignore if */
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
if (!NON_ALTERING_FORMAT_REG_EXP.test(_this4.getFormatFormat(format, state.international))) {
|
|
4243
|
-
return "continue";
|
|
4244
|
-
}
|
|
4245
|
-
|
|
4246
|
-
if (!_this4.createTemplateForFormat(format, state)) {
|
|
4247
|
-
// Remove the format if it can't generate a template.
|
|
4248
|
-
_this4.matchingFormats = _this4.matchingFormats.filter(function (_) {
|
|
4249
|
-
return _ !== format;
|
|
4250
|
-
});
|
|
4251
|
-
return "continue";
|
|
4252
|
-
}
|
|
4253
|
-
|
|
4254
|
-
_this4.chosenFormat = format;
|
|
4255
|
-
return "break";
|
|
4256
|
-
};
|
|
4257
|
-
|
|
4258
|
-
// When there are multiple available formats, the formatter uses the first
|
|
4259
|
-
// format where a formatting template could be created.
|
|
4260
|
-
_loop: for (var _iterator2 = this.matchingFormats.slice(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
4261
|
-
var _ref5;
|
|
4262
|
-
|
|
4263
|
-
var _ret = _loop2();
|
|
4264
|
-
|
|
4265
|
-
switch (_ret) {
|
|
4266
|
-
case "break":
|
|
4267
|
-
break _loop;
|
|
4268
|
-
|
|
4269
|
-
case "continue":
|
|
4270
|
-
continue;
|
|
4271
|
-
}
|
|
4272
|
-
}
|
|
4273
|
-
|
|
4274
|
-
if (!this.chosenFormat) {
|
|
4275
|
-
// No format matches the national (significant) phone number.
|
|
4276
|
-
this.resetFormat();
|
|
4277
|
-
}
|
|
4278
|
-
|
|
4279
|
-
return this.chosenFormat;
|
|
4280
|
-
}
|
|
4281
|
-
}, {
|
|
4282
|
-
key: "createTemplateForFormat",
|
|
4283
|
-
value: function createTemplateForFormat(format, state) {
|
|
4284
|
-
// The formatter doesn't format numbers when numberPattern contains '|', e.g.
|
|
4285
|
-
// (20|3)\d{4}. In those cases we quickly return.
|
|
4286
|
-
// (Though there's no such format in current metadata)
|
|
4287
|
-
|
|
4288
|
-
/* istanbul ignore if */
|
|
4289
|
-
if ( format.pattern().indexOf('|') >= 0) {
|
|
4290
|
-
return;
|
|
4291
|
-
} // Get formatting template for this phone number format
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
var template = this.getTemplateForFormat(format, state); // If the national number entered is too long
|
|
4295
|
-
// for any phone number format, then abort.
|
|
4296
|
-
|
|
4297
|
-
if (template) {
|
|
4298
|
-
this.setNationalNumberTemplate(template, state);
|
|
4299
|
-
return true;
|
|
4300
|
-
}
|
|
4301
|
-
}
|
|
4302
|
-
}, {
|
|
4303
|
-
key: "getInternationalPrefixBeforeCountryCallingCode",
|
|
4304
|
-
value: function getInternationalPrefixBeforeCountryCallingCode(_ref6, options) {
|
|
4305
|
-
var IDDPrefix = _ref6.IDDPrefix,
|
|
4306
|
-
missingPlus = _ref6.missingPlus;
|
|
4307
|
-
|
|
4308
|
-
if (IDDPrefix) {
|
|
4309
|
-
return options && options.spacing === false ? IDDPrefix : IDDPrefix + ' ';
|
|
4310
|
-
}
|
|
4311
|
-
|
|
4312
|
-
if (missingPlus) {
|
|
4313
|
-
return '';
|
|
4314
|
-
}
|
|
4315
|
-
|
|
4316
|
-
return '+';
|
|
4317
|
-
}
|
|
4318
|
-
}, {
|
|
4319
|
-
key: "getTemplate",
|
|
4320
|
-
value: function getTemplate(state) {
|
|
4321
|
-
if (!this.template) {
|
|
4322
|
-
return;
|
|
4323
|
-
} // `this.template` holds the template for a "complete" phone number.
|
|
4324
|
-
// The currently entered phone number is most likely not "complete",
|
|
4325
|
-
// so trim all non-populated digits.
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
var index = -1;
|
|
4329
|
-
var i = 0;
|
|
4330
|
-
var internationalPrefix = state.international ? this.getInternationalPrefixBeforeCountryCallingCode(state, {
|
|
4331
|
-
spacing: false
|
|
4332
|
-
}) : '';
|
|
4333
|
-
|
|
4334
|
-
while (i < internationalPrefix.length + state.getDigitsWithoutInternationalPrefix().length) {
|
|
4335
|
-
index = this.template.indexOf(DIGIT_PLACEHOLDER, index + 1);
|
|
4336
|
-
i++;
|
|
4337
|
-
}
|
|
4338
|
-
|
|
4339
|
-
return cutAndStripNonPairedParens(this.template, index + 1);
|
|
4340
|
-
}
|
|
4341
|
-
}, {
|
|
4342
|
-
key: "setNationalNumberTemplate",
|
|
4343
|
-
value: function setNationalNumberTemplate(template, state) {
|
|
4344
|
-
this.nationalNumberTemplate = template;
|
|
4345
|
-
this.populatedNationalNumberTemplate = template; // With a new formatting template, the matched position
|
|
4346
|
-
// using the old template needs to be reset.
|
|
4347
|
-
|
|
4348
|
-
this.populatedNationalNumberTemplatePosition = -1; // For convenience, the public `.template` property
|
|
4349
|
-
// contains the whole international number
|
|
4350
|
-
// if the phone number being input is international:
|
|
4351
|
-
// 'x' for the '+' sign, 'x'es for the country phone code,
|
|
4352
|
-
// a spacebar and then the template for the formatted national number.
|
|
4353
|
-
|
|
4354
|
-
if (state.international) {
|
|
4355
|
-
this.template = this.getInternationalPrefixBeforeCountryCallingCode(state).replace(/[\d\+]/g, DIGIT_PLACEHOLDER) + repeat(DIGIT_PLACEHOLDER, state.callingCode.length) + ' ' + template;
|
|
4356
|
-
} else {
|
|
4357
|
-
this.template = template;
|
|
4358
|
-
}
|
|
4359
|
-
}
|
|
4360
|
-
/**
|
|
4361
|
-
* Generates formatting template for a national phone number,
|
|
4362
|
-
* optionally containing a national prefix, for a format.
|
|
4363
|
-
* @param {Format} format
|
|
4364
|
-
* @param {string} nationalPrefix
|
|
4365
|
-
* @return {string}
|
|
4366
|
-
*/
|
|
4367
|
-
|
|
4368
|
-
}, {
|
|
4369
|
-
key: "getTemplateForFormat",
|
|
4370
|
-
value: function getTemplateForFormat(format, _ref7) {
|
|
4371
|
-
var nationalSignificantNumber = _ref7.nationalSignificantNumber,
|
|
4372
|
-
international = _ref7.international,
|
|
4373
|
-
nationalPrefix = _ref7.nationalPrefix,
|
|
4374
|
-
complexPrefixBeforeNationalSignificantNumber = _ref7.complexPrefixBeforeNationalSignificantNumber;
|
|
4375
|
-
var pattern = format.pattern();
|
|
4376
|
-
/* istanbul ignore else */
|
|
4377
|
-
|
|
4378
|
-
{
|
|
4379
|
-
pattern = pattern // Replace anything in the form of [..] with \d
|
|
4380
|
-
.replace(CREATE_CHARACTER_CLASS_PATTERN(), '\\d') // Replace any standalone digit (not the one in `{}`) with \d
|
|
4381
|
-
.replace(CREATE_STANDALONE_DIGIT_PATTERN(), '\\d');
|
|
4382
|
-
} // Generate a dummy national number (consisting of `9`s)
|
|
4383
|
-
// that fits this format's `pattern`.
|
|
4384
|
-
//
|
|
4385
|
-
// This match will always succeed,
|
|
4386
|
-
// because the "longest dummy phone number"
|
|
4387
|
-
// has enough length to accomodate any possible
|
|
4388
|
-
// national phone number format pattern.
|
|
4389
|
-
//
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
var digits = LONGEST_DUMMY_PHONE_NUMBER.match(pattern)[0]; // If the national number entered is too long
|
|
4393
|
-
// for any phone number format, then abort.
|
|
4394
|
-
|
|
4395
|
-
if (nationalSignificantNumber.length > digits.length) {
|
|
4396
|
-
return;
|
|
4397
|
-
} // Get a formatting template which can be used to efficiently format
|
|
4398
|
-
// a partial number where digits are added one by one.
|
|
4399
|
-
// Below `strictPattern` is used for the
|
|
4400
|
-
// regular expression (with `^` and `$`).
|
|
4401
|
-
// This wasn't originally in Google's `libphonenumber`
|
|
4402
|
-
// and I guess they don't really need it
|
|
4403
|
-
// because they're not using "templates" to format phone numbers
|
|
4404
|
-
// but I added `strictPattern` after encountering
|
|
4405
|
-
// South Korean phone number formatting bug.
|
|
4406
|
-
//
|
|
4407
|
-
// Non-strict regular expression bug demonstration:
|
|
4408
|
-
//
|
|
4409
|
-
// this.nationalSignificantNumber : `111111111` (9 digits)
|
|
4410
|
-
//
|
|
4411
|
-
// pattern : (\d{2})(\d{3,4})(\d{4})
|
|
4412
|
-
// format : `$1 $2 $3`
|
|
4413
|
-
// digits : `9999999999` (10 digits)
|
|
4414
|
-
//
|
|
4415
|
-
// '9999999999'.replace(new RegExp(/(\d{2})(\d{3,4})(\d{4})/g), '$1 $2 $3') = "99 9999 9999"
|
|
4416
|
-
//
|
|
4417
|
-
// template : xx xxxx xxxx
|
|
4418
|
-
//
|
|
4419
|
-
// But the correct template in this case is `xx xxx xxxx`.
|
|
4420
|
-
// The template was generated incorrectly because of the
|
|
4421
|
-
// `{3,4}` variability in the `pattern`.
|
|
4422
|
-
//
|
|
4423
|
-
// The fix is, if `this.nationalSignificantNumber` has already sufficient length
|
|
4424
|
-
// to satisfy the `pattern` completely then `this.nationalSignificantNumber`
|
|
4425
|
-
// is used instead of `digits`.
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
var strictPattern = new RegExp('^' + pattern + '$');
|
|
4429
|
-
var nationalNumberDummyDigits = nationalSignificantNumber.replace(/\d/g, DUMMY_DIGIT); // If `this.nationalSignificantNumber` has already sufficient length
|
|
4430
|
-
// to satisfy the `pattern` completely then use it
|
|
4431
|
-
// instead of `digits`.
|
|
4432
|
-
|
|
4433
|
-
if (strictPattern.test(nationalNumberDummyDigits)) {
|
|
4434
|
-
digits = nationalNumberDummyDigits;
|
|
4435
|
-
}
|
|
4436
|
-
|
|
4437
|
-
var numberFormat = this.getFormatFormat(format, international);
|
|
4438
|
-
var nationalPrefixIncludedInTemplate; // If a user did input a national prefix (and that's guaranteed),
|
|
4439
|
-
// and if a `format` does have a national prefix formatting rule,
|
|
4440
|
-
// then see if that national prefix formatting rule
|
|
4441
|
-
// prepends exactly the same national prefix the user has input.
|
|
4442
|
-
// If that's the case, then use the `format` with the national prefix formatting rule.
|
|
4443
|
-
// Otherwise, use the `format` without the national prefix formatting rule,
|
|
4444
|
-
// and prepend a national prefix manually to it.
|
|
4445
|
-
|
|
4446
|
-
if (this.shouldTryNationalPrefixFormattingRule(format, {
|
|
4447
|
-
international: international,
|
|
4448
|
-
nationalPrefix: nationalPrefix
|
|
4449
|
-
})) {
|
|
4450
|
-
var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()); // If `national_prefix_formatting_rule` of a `format` simply prepends
|
|
4451
|
-
// national prefix at the start of a national (significant) number,
|
|
4452
|
-
// then such formatting can be used with `AsYouType` formatter.
|
|
4453
|
-
// There seems to be no `else` case: everywhere in metadata,
|
|
4454
|
-
// national prefix formatting rule is national prefix + $1,
|
|
4455
|
-
// or `($1)`, in which case such format isn't even considered
|
|
4456
|
-
// when the user has input a national prefix.
|
|
4457
|
-
|
|
4458
|
-
/* istanbul ignore else */
|
|
4459
|
-
|
|
4460
|
-
if (parseDigits(format.nationalPrefixFormattingRule()) === (nationalPrefix || '') + parseDigits('$1')) {
|
|
4461
|
-
numberFormat = numberFormatWithNationalPrefix;
|
|
4462
|
-
nationalPrefixIncludedInTemplate = true; // Replace all digits of the national prefix in the formatting template
|
|
4463
|
-
// with `DIGIT_PLACEHOLDER`s.
|
|
4464
|
-
|
|
4465
|
-
if (nationalPrefix) {
|
|
4466
|
-
var i = nationalPrefix.length;
|
|
4467
|
-
|
|
4468
|
-
while (i > 0) {
|
|
4469
|
-
numberFormat = numberFormat.replace(/\d/, DIGIT_PLACEHOLDER);
|
|
4470
|
-
i--;
|
|
4471
|
-
}
|
|
4472
|
-
}
|
|
4473
|
-
}
|
|
4474
|
-
} // Generate formatting template for this phone number format.
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
var template = digits // Format the dummy phone number according to the format.
|
|
4478
|
-
.replace(new RegExp(pattern), numberFormat) // Replace each dummy digit with a DIGIT_PLACEHOLDER.
|
|
4479
|
-
.replace(new RegExp(DUMMY_DIGIT, 'g'), DIGIT_PLACEHOLDER); // If a prefix of a national (significant) number is not as simple
|
|
4480
|
-
// as just a basic national prefix, then just prepend such prefix
|
|
4481
|
-
// before the national (significant) number, optionally spacing
|
|
4482
|
-
// the two with a whitespace.
|
|
4483
|
-
|
|
4484
|
-
if (!nationalPrefixIncludedInTemplate) {
|
|
4485
|
-
if (complexPrefixBeforeNationalSignificantNumber) {
|
|
4486
|
-
// Prepend the prefix to the template manually.
|
|
4487
|
-
template = repeat(DIGIT_PLACEHOLDER, complexPrefixBeforeNationalSignificantNumber.length) + ' ' + template;
|
|
4488
|
-
} else if (nationalPrefix) {
|
|
4489
|
-
// Prepend national prefix to the template manually.
|
|
4490
|
-
template = repeat(DIGIT_PLACEHOLDER, nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;
|
|
4491
|
-
}
|
|
4492
|
-
}
|
|
4493
|
-
|
|
4494
|
-
if (international) {
|
|
4495
|
-
template = applyInternationalSeparatorStyle(template);
|
|
4496
|
-
}
|
|
4497
|
-
|
|
4498
|
-
return template;
|
|
4499
|
-
}
|
|
4500
|
-
}, {
|
|
4501
|
-
key: "formatNextNationalNumberDigits",
|
|
4502
|
-
value: function formatNextNationalNumberDigits(digits) {
|
|
4503
|
-
var result = populateTemplateWithDigits(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, digits);
|
|
4504
|
-
|
|
4505
|
-
if (!result) {
|
|
4506
|
-
// Reset the format.
|
|
4507
|
-
this.resetFormat();
|
|
4508
|
-
return;
|
|
4509
|
-
}
|
|
4510
|
-
|
|
4511
|
-
this.populatedNationalNumberTemplate = result[0];
|
|
4512
|
-
this.populatedNationalNumberTemplatePosition = result[1]; // Return the formatted phone number so far.
|
|
4513
|
-
|
|
4514
|
-
return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1); // The old way which was good for `input-format` but is not so good
|
|
4515
|
-
// for `react-phone-number-input`'s default input (`InputBasic`).
|
|
4516
|
-
// return closeNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1)
|
|
4517
|
-
// .replace(new RegExp(DIGIT_PLACEHOLDER, 'g'), ' ')
|
|
4518
|
-
}
|
|
4519
|
-
}]);
|
|
4520
|
-
|
|
4521
|
-
return AsYouTypeFormatter;
|
|
4522
|
-
}();
|
|
4523
|
-
|
|
4524
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
4525
|
-
|
|
4526
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
4527
|
-
|
|
4528
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
4529
|
-
|
|
4530
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
4531
|
-
|
|
4532
|
-
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4533
|
-
|
|
4534
|
-
function _defineProperties$4(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4535
|
-
|
|
4536
|
-
function _createClass$4(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$4(Constructor.prototype, protoProps); if (staticProps) _defineProperties$4(Constructor, staticProps); return Constructor; }
|
|
4537
|
-
var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART = '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+';
|
|
4538
|
-
var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN = new RegExp('^' + VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART + '$', 'i');
|
|
4539
|
-
var VALID_FORMATTED_PHONE_NUMBER_PART = '(?:' + '[' + PLUS_CHARS + ']' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*' + '|' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + ')';
|
|
4540
|
-
var AFTER_PHONE_NUMBER_DIGITS_END_PATTERN = new RegExp('[^' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + '.*' + '$'); // Tests whether `national_prefix_for_parsing` could match
|
|
4541
|
-
// different national prefixes.
|
|
4542
|
-
// Matches anything that's not a digit or a square bracket.
|
|
4543
|
-
|
|
4544
|
-
var COMPLEX_NATIONAL_PREFIX = /[^\d\[\]]/;
|
|
4545
|
-
|
|
4546
|
-
var AsYouTypeParser =
|
|
4547
|
-
/*#__PURE__*/
|
|
4548
|
-
function () {
|
|
4549
|
-
function AsYouTypeParser(_ref) {
|
|
4550
|
-
var defaultCountry = _ref.defaultCountry,
|
|
4551
|
-
defaultCallingCode = _ref.defaultCallingCode,
|
|
4552
|
-
metadata = _ref.metadata,
|
|
4553
|
-
onNationalSignificantNumberChange = _ref.onNationalSignificantNumberChange;
|
|
4554
|
-
|
|
4555
|
-
_classCallCheck$4(this, AsYouTypeParser);
|
|
4556
|
-
|
|
4557
|
-
this.defaultCountry = defaultCountry;
|
|
4558
|
-
this.defaultCallingCode = defaultCallingCode;
|
|
4559
|
-
this.metadata = metadata;
|
|
4560
|
-
this.onNationalSignificantNumberChange = onNationalSignificantNumberChange;
|
|
4561
|
-
}
|
|
4562
|
-
|
|
4563
|
-
_createClass$4(AsYouTypeParser, [{
|
|
4564
|
-
key: "input",
|
|
4565
|
-
value: function input(text, state) {
|
|
4566
|
-
var _extractFormattedDigi = extractFormattedDigitsAndPlus(text),
|
|
4567
|
-
_extractFormattedDigi2 = _slicedToArray(_extractFormattedDigi, 2),
|
|
4568
|
-
formattedDigits = _extractFormattedDigi2[0],
|
|
4569
|
-
hasPlus = _extractFormattedDigi2[1];
|
|
4570
|
-
|
|
4571
|
-
var digits = parseDigits(formattedDigits); // Checks for a special case: just a leading `+` has been entered.
|
|
4572
|
-
|
|
4573
|
-
var justLeadingPlus;
|
|
4574
|
-
|
|
4575
|
-
if (hasPlus) {
|
|
4576
|
-
if (!state.digits) {
|
|
4577
|
-
state.startInternationalNumber();
|
|
4578
|
-
|
|
4579
|
-
if (!digits) {
|
|
4580
|
-
justLeadingPlus = true;
|
|
4581
|
-
}
|
|
4582
|
-
}
|
|
4583
|
-
}
|
|
4584
|
-
|
|
4585
|
-
if (digits) {
|
|
4586
|
-
this.inputDigits(digits, state);
|
|
4587
|
-
}
|
|
4588
|
-
|
|
4589
|
-
return {
|
|
4590
|
-
digits: digits,
|
|
4591
|
-
justLeadingPlus: justLeadingPlus
|
|
4592
|
-
};
|
|
4593
|
-
}
|
|
4594
|
-
/**
|
|
4595
|
-
* Inputs "next" phone number digits.
|
|
4596
|
-
* @param {string} digits
|
|
4597
|
-
* @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".
|
|
4598
|
-
*/
|
|
4599
|
-
|
|
4600
|
-
}, {
|
|
4601
|
-
key: "inputDigits",
|
|
4602
|
-
value: function inputDigits(nextDigits, state) {
|
|
4603
|
-
var digits = state.digits;
|
|
4604
|
-
var hasReceivedThreeLeadingDigits = digits.length < 3 && digits.length + nextDigits.length >= 3; // Append phone number digits.
|
|
4605
|
-
|
|
4606
|
-
state.appendDigits(nextDigits); // Attempt to extract IDD prefix:
|
|
4607
|
-
// Some users input their phone number in international format,
|
|
4608
|
-
// but in an "out-of-country" dialing format instead of using the leading `+`.
|
|
4609
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/185
|
|
4610
|
-
// Detect such numbers as soon as there're at least 3 digits.
|
|
4611
|
-
// Google's library attempts to extract IDD prefix at 3 digits,
|
|
4612
|
-
// so this library just copies that behavior.
|
|
4613
|
-
// I guess that's because the most commot IDD prefixes are
|
|
4614
|
-
// `00` (Europe) and `011` (US).
|
|
4615
|
-
// There exist really long IDD prefixes too:
|
|
4616
|
-
// for example, in Australia the default IDD prefix is `0011`,
|
|
4617
|
-
// and it could even be as long as `14880011`.
|
|
4618
|
-
// An IDD prefix is extracted here, and then every time when
|
|
4619
|
-
// there's a new digit and the number couldn't be formatted.
|
|
4620
|
-
|
|
4621
|
-
if (hasReceivedThreeLeadingDigits) {
|
|
4622
|
-
this.extractIddPrefix(state);
|
|
4623
|
-
}
|
|
4624
|
-
|
|
4625
|
-
if (this.isWaitingForCountryCallingCode(state)) {
|
|
4626
|
-
if (!this.extractCountryCallingCode(state)) {
|
|
4627
|
-
return;
|
|
4628
|
-
}
|
|
4629
|
-
} else {
|
|
4630
|
-
state.appendNationalSignificantNumberDigits(nextDigits);
|
|
4631
|
-
} // If a phone number is being input in international format,
|
|
4632
|
-
// then it's not valid for it to have a national prefix.
|
|
4633
|
-
// Still, some people incorrectly input such numbers with a national prefix.
|
|
4634
|
-
// In such cases, only attempt to strip a national prefix if the number becomes too long.
|
|
4635
|
-
// (but that is done later, not here)
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
if (!state.international) {
|
|
4639
|
-
if (!this.hasExtractedNationalSignificantNumber) {
|
|
4640
|
-
this.extractNationalSignificantNumber(state.getNationalDigits(), state.update);
|
|
4641
|
-
}
|
|
4642
|
-
}
|
|
4643
|
-
}
|
|
4644
|
-
}, {
|
|
4645
|
-
key: "isWaitingForCountryCallingCode",
|
|
4646
|
-
value: function isWaitingForCountryCallingCode(_ref2) {
|
|
4647
|
-
var international = _ref2.international,
|
|
4648
|
-
callingCode = _ref2.callingCode;
|
|
4649
|
-
return international && !callingCode;
|
|
4650
|
-
} // Extracts a country calling code from a number
|
|
4651
|
-
// being entered in internatonal format.
|
|
4652
|
-
|
|
4653
|
-
}, {
|
|
4654
|
-
key: "extractCountryCallingCode",
|
|
4655
|
-
value: function extractCountryCallingCode$1(state) {
|
|
4656
|
-
var _extractCountryCallin = extractCountryCallingCode('+' + state.getDigitsWithoutInternationalPrefix(), this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),
|
|
4657
|
-
countryCallingCode = _extractCountryCallin.countryCallingCode,
|
|
4658
|
-
number = _extractCountryCallin.number;
|
|
4659
|
-
|
|
4660
|
-
if (countryCallingCode) {
|
|
4661
|
-
state.setCallingCode(countryCallingCode);
|
|
4662
|
-
state.update({
|
|
4663
|
-
nationalSignificantNumber: number
|
|
4664
|
-
});
|
|
4665
|
-
return true;
|
|
4666
|
-
}
|
|
4667
|
-
}
|
|
4668
|
-
}, {
|
|
4669
|
-
key: "reset",
|
|
4670
|
-
value: function reset(numberingPlan) {
|
|
4671
|
-
if (numberingPlan) {
|
|
4672
|
-
this.hasSelectedNumberingPlan = true;
|
|
4673
|
-
|
|
4674
|
-
var nationalPrefixForParsing = numberingPlan._nationalPrefixForParsing();
|
|
4675
|
-
|
|
4676
|
-
this.couldPossiblyExtractAnotherNationalSignificantNumber = nationalPrefixForParsing && COMPLEX_NATIONAL_PREFIX.test(nationalPrefixForParsing);
|
|
4677
|
-
} else {
|
|
4678
|
-
this.hasSelectedNumberingPlan = undefined;
|
|
4679
|
-
this.couldPossiblyExtractAnotherNationalSignificantNumber = undefined;
|
|
4680
|
-
}
|
|
4681
|
-
}
|
|
4682
|
-
/**
|
|
4683
|
-
* Extracts a national (significant) number from user input.
|
|
4684
|
-
* Google's library is different in that it only applies `national_prefix_for_parsing`
|
|
4685
|
-
* and doesn't apply `national_prefix_transform_rule` after that.
|
|
4686
|
-
* https://github.com/google/libphonenumber/blob/a3d70b0487875475e6ad659af404943211d26456/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L539
|
|
4687
|
-
* @return {boolean} [extracted]
|
|
4688
|
-
*/
|
|
4689
|
-
|
|
4690
|
-
}, {
|
|
4691
|
-
key: "extractNationalSignificantNumber",
|
|
4692
|
-
value: function extractNationalSignificantNumber(nationalDigits, setState) {
|
|
4693
|
-
if (!this.hasSelectedNumberingPlan) {
|
|
4694
|
-
return;
|
|
4695
|
-
}
|
|
4696
|
-
|
|
4697
|
-
var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata),
|
|
4698
|
-
nationalPrefix = _extractNationalNumbe.nationalPrefix,
|
|
4699
|
-
nationalNumber = _extractNationalNumbe.nationalNumber,
|
|
4700
|
-
carrierCode = _extractNationalNumbe.carrierCode;
|
|
4701
|
-
|
|
4702
|
-
if (nationalNumber === nationalDigits) {
|
|
4703
|
-
return;
|
|
4704
|
-
}
|
|
4705
|
-
|
|
4706
|
-
this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
|
|
4707
|
-
return true;
|
|
4708
|
-
}
|
|
4709
|
-
/**
|
|
4710
|
-
* In Google's code this function is called "attempt to extract longer NDD".
|
|
4711
|
-
* "Some national prefixes are a substring of others", they say.
|
|
4712
|
-
* @return {boolean} [result] — Returns `true` if extracting a national prefix produced different results from what they were.
|
|
4713
|
-
*/
|
|
4714
|
-
|
|
4715
|
-
}, {
|
|
4716
|
-
key: "extractAnotherNationalSignificantNumber",
|
|
4717
|
-
value: function extractAnotherNationalSignificantNumber(nationalDigits, prevNationalSignificantNumber, setState) {
|
|
4718
|
-
if (!this.hasExtractedNationalSignificantNumber) {
|
|
4719
|
-
return this.extractNationalSignificantNumber(nationalDigits, setState);
|
|
4720
|
-
}
|
|
4721
|
-
|
|
4722
|
-
if (!this.couldPossiblyExtractAnotherNationalSignificantNumber) {
|
|
4723
|
-
return;
|
|
4724
|
-
}
|
|
4725
|
-
|
|
4726
|
-
var _extractNationalNumbe2 = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata),
|
|
4727
|
-
nationalPrefix = _extractNationalNumbe2.nationalPrefix,
|
|
4728
|
-
nationalNumber = _extractNationalNumbe2.nationalNumber,
|
|
4729
|
-
carrierCode = _extractNationalNumbe2.carrierCode; // If a national prefix has been extracted previously,
|
|
4730
|
-
// then it's always extracted as additional digits are added.
|
|
4731
|
-
// That's assuming `extractNationalNumberFromPossiblyIncompleteNumber()`
|
|
4732
|
-
// doesn't do anything different from what it currently does.
|
|
4733
|
-
// So, just in case, here's this check, though it doesn't occur.
|
|
4734
|
-
|
|
4735
|
-
/* istanbul ignore if */
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
if (nationalNumber === prevNationalSignificantNumber) {
|
|
4739
|
-
return;
|
|
4740
|
-
}
|
|
4741
|
-
|
|
4742
|
-
this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
|
|
4743
|
-
return true;
|
|
4744
|
-
}
|
|
4745
|
-
}, {
|
|
4746
|
-
key: "onExtractedNationalNumber",
|
|
4747
|
-
value: function onExtractedNationalNumber(nationalPrefix, carrierCode, nationalSignificantNumber, nationalDigits, setState) {
|
|
4748
|
-
var complexPrefixBeforeNationalSignificantNumber;
|
|
4749
|
-
var nationalSignificantNumberMatchesInput; // This check also works with empty `this.nationalSignificantNumber`.
|
|
4750
|
-
|
|
4751
|
-
var nationalSignificantNumberIndex = nationalDigits.lastIndexOf(nationalSignificantNumber); // If the extracted national (significant) number is the
|
|
4752
|
-
// last substring of the `digits`, then it means that it hasn't been altered:
|
|
4753
|
-
// no digits have been removed from the national (significant) number
|
|
4754
|
-
// while applying `national_prefix_transform_rule`.
|
|
4755
|
-
// https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
|
|
4756
|
-
|
|
4757
|
-
if (nationalSignificantNumberIndex >= 0 && nationalSignificantNumberIndex === nationalDigits.length - nationalSignificantNumber.length) {
|
|
4758
|
-
nationalSignificantNumberMatchesInput = true; // If a prefix of a national (significant) number is not as simple
|
|
4759
|
-
// as just a basic national prefix, then such prefix is stored in
|
|
4760
|
-
// `this.complexPrefixBeforeNationalSignificantNumber` property and will be
|
|
4761
|
-
// prepended "as is" to the national (significant) number to produce
|
|
4762
|
-
// a formatted result.
|
|
4763
|
-
|
|
4764
|
-
var prefixBeforeNationalNumber = nationalDigits.slice(0, nationalSignificantNumberIndex); // `prefixBeforeNationalNumber` is always non-empty,
|
|
4765
|
-
// because `onExtractedNationalNumber()` isn't called
|
|
4766
|
-
// when a national (significant) number hasn't been actually "extracted":
|
|
4767
|
-
// when a national (significant) number is equal to the national part of `digits`,
|
|
4768
|
-
// then `onExtractedNationalNumber()` doesn't get called.
|
|
4769
|
-
|
|
4770
|
-
if (prefixBeforeNationalNumber !== nationalPrefix) {
|
|
4771
|
-
complexPrefixBeforeNationalSignificantNumber = prefixBeforeNationalNumber;
|
|
4772
|
-
}
|
|
4773
|
-
}
|
|
4774
|
-
|
|
4775
|
-
setState({
|
|
4776
|
-
nationalPrefix: nationalPrefix,
|
|
4777
|
-
carrierCode: carrierCode,
|
|
4778
|
-
nationalSignificantNumber: nationalSignificantNumber,
|
|
4779
|
-
nationalSignificantNumberMatchesInput: nationalSignificantNumberMatchesInput,
|
|
4780
|
-
complexPrefixBeforeNationalSignificantNumber: complexPrefixBeforeNationalSignificantNumber
|
|
4781
|
-
}); // `onExtractedNationalNumber()` is only called when
|
|
4782
|
-
// the national (significant) number actually did change.
|
|
4783
|
-
|
|
4784
|
-
this.hasExtractedNationalSignificantNumber = true;
|
|
4785
|
-
this.onNationalSignificantNumberChange();
|
|
4786
|
-
}
|
|
4787
|
-
}, {
|
|
4788
|
-
key: "reExtractNationalSignificantNumber",
|
|
4789
|
-
value: function reExtractNationalSignificantNumber(state) {
|
|
4790
|
-
// Attempt to extract a national prefix.
|
|
4791
|
-
//
|
|
4792
|
-
// Some people incorrectly input national prefix
|
|
4793
|
-
// in an international phone number.
|
|
4794
|
-
// For example, some people write British phone numbers as `+44(0)...`.
|
|
4795
|
-
//
|
|
4796
|
-
// Also, in some rare cases, it is valid for a national prefix
|
|
4797
|
-
// to be a part of an international phone number.
|
|
4798
|
-
// For example, mobile phone numbers in Mexico are supposed to be
|
|
4799
|
-
// dialled internationally using a `1` national prefix,
|
|
4800
|
-
// so the national prefix will be part of an international number.
|
|
4801
|
-
//
|
|
4802
|
-
// Quote from:
|
|
4803
|
-
// https://www.mexperience.com/dialing-cell-phones-in-mexico/
|
|
4804
|
-
//
|
|
4805
|
-
// "Dialing a Mexican cell phone from abroad
|
|
4806
|
-
// When you are calling a cell phone number in Mexico from outside Mexico,
|
|
4807
|
-
// it’s necessary to dial an additional “1” after Mexico’s country code
|
|
4808
|
-
// (which is “52”) and before the area code.
|
|
4809
|
-
// You also ignore the 045, and simply dial the area code and the
|
|
4810
|
-
// cell phone’s number.
|
|
4811
|
-
//
|
|
4812
|
-
// If you don’t add the “1”, you’ll receive a recorded announcement
|
|
4813
|
-
// asking you to redial using it.
|
|
4814
|
-
//
|
|
4815
|
-
// For example, if you are calling from the USA to a cell phone
|
|
4816
|
-
// in Mexico City, you would dial +52 – 1 – 55 – 1234 5678.
|
|
4817
|
-
// (Note that this is different to calling a land line in Mexico City
|
|
4818
|
-
// from abroad, where the number dialed would be +52 – 55 – 1234 5678)".
|
|
4819
|
-
//
|
|
4820
|
-
// Google's demo output:
|
|
4821
|
-
// https://libphonenumber.appspot.com/phonenumberparser?number=%2b5215512345678&country=MX
|
|
4822
|
-
//
|
|
4823
|
-
if (this.extractAnotherNationalSignificantNumber(state.getNationalDigits(), state.nationalSignificantNumber, state.update)) {
|
|
4824
|
-
return true;
|
|
4825
|
-
} // If no format matches the phone number, then it could be
|
|
4826
|
-
// "a really long IDD" (quote from a comment in Google's library).
|
|
4827
|
-
// An IDD prefix is first extracted when the user has entered at least 3 digits,
|
|
4828
|
-
// and then here — every time when there's a new digit and the number
|
|
4829
|
-
// couldn't be formatted.
|
|
4830
|
-
// For example, in Australia the default IDD prefix is `0011`,
|
|
4831
|
-
// and it could even be as long as `14880011`.
|
|
4832
|
-
//
|
|
4833
|
-
// Could also check `!hasReceivedThreeLeadingDigits` here
|
|
4834
|
-
// to filter out the case when this check duplicates the one
|
|
4835
|
-
// already performed when there're 3 leading digits,
|
|
4836
|
-
// but it's not a big deal, and in most cases there
|
|
4837
|
-
// will be a suitable `format` when there're 3 leading digits.
|
|
4838
|
-
//
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
if (this.extractIddPrefix(state)) {
|
|
4842
|
-
this.extractCallingCodeAndNationalSignificantNumber(state);
|
|
4843
|
-
return true;
|
|
4844
|
-
} // Google's AsYouType formatter supports sort of an "autocorrection" feature
|
|
4845
|
-
// when it "autocorrects" numbers that have been input for a country
|
|
4846
|
-
// with that country's calling code.
|
|
4847
|
-
// Such "autocorrection" feature looks weird, but different people have been requesting it:
|
|
4848
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/376
|
|
4849
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/375
|
|
4850
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/316
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
if (this.fixMissingPlus(state)) {
|
|
4854
|
-
this.extractCallingCodeAndNationalSignificantNumber(state);
|
|
4855
|
-
return true;
|
|
4856
|
-
}
|
|
4857
|
-
}
|
|
4858
|
-
}, {
|
|
4859
|
-
key: "extractIddPrefix",
|
|
4860
|
-
value: function extractIddPrefix(state) {
|
|
4861
|
-
// An IDD prefix can't be present in a number written with a `+`.
|
|
4862
|
-
// Also, don't re-extract an IDD prefix if has already been extracted.
|
|
4863
|
-
var international = state.international,
|
|
4864
|
-
IDDPrefix = state.IDDPrefix,
|
|
4865
|
-
digits = state.digits;
|
|
4866
|
-
|
|
4867
|
-
if (international || IDDPrefix) {
|
|
4868
|
-
return;
|
|
4869
|
-
} // Some users input their phone number in "out-of-country"
|
|
4870
|
-
// dialing format instead of using the leading `+`.
|
|
4871
|
-
// https://github.com/catamphetamine/libphonenumber-js/issues/185
|
|
4872
|
-
// Detect such numbers.
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
var numberWithoutIDD = stripIddPrefix(digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);
|
|
4876
|
-
|
|
4877
|
-
if (numberWithoutIDD !== undefined && numberWithoutIDD !== digits) {
|
|
4878
|
-
// If an IDD prefix was stripped then convert the IDD-prefixed number
|
|
4879
|
-
// to international number for subsequent parsing.
|
|
4880
|
-
state.update({
|
|
4881
|
-
IDDPrefix: digits.slice(0, digits.length - numberWithoutIDD.length)
|
|
4882
|
-
});
|
|
4883
|
-
this.startInternationalNumber(state);
|
|
4884
|
-
return true;
|
|
4885
|
-
}
|
|
4886
|
-
}
|
|
4887
|
-
}, {
|
|
4888
|
-
key: "fixMissingPlus",
|
|
4889
|
-
value: function fixMissingPlus(state) {
|
|
4890
|
-
if (!state.international) {
|
|
4891
|
-
var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(state.digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),
|
|
4892
|
-
newCallingCode = _extractCountryCallin2.countryCallingCode;
|
|
4893
|
-
|
|
4894
|
-
if (newCallingCode) {
|
|
4895
|
-
state.update({
|
|
4896
|
-
missingPlus: true
|
|
4897
|
-
});
|
|
4898
|
-
this.startInternationalNumber(state);
|
|
4899
|
-
return true;
|
|
4900
|
-
}
|
|
4901
|
-
}
|
|
4902
|
-
}
|
|
4903
|
-
}, {
|
|
4904
|
-
key: "startInternationalNumber",
|
|
4905
|
-
value: function startInternationalNumber(state) {
|
|
4906
|
-
state.startInternationalNumber(); // If a national (significant) number has been extracted before, reset it.
|
|
4907
|
-
|
|
4908
|
-
if (state.nationalSignificantNumber) {
|
|
4909
|
-
state.resetNationalSignificantNumber();
|
|
4910
|
-
this.onNationalSignificantNumberChange();
|
|
4911
|
-
this.hasExtractedNationalSignificantNumber = undefined;
|
|
4912
|
-
}
|
|
4913
|
-
}
|
|
4914
|
-
}, {
|
|
4915
|
-
key: "extractCallingCodeAndNationalSignificantNumber",
|
|
4916
|
-
value: function extractCallingCodeAndNationalSignificantNumber(state) {
|
|
4917
|
-
if (this.extractCountryCallingCode(state)) {
|
|
4918
|
-
// `this.extractCallingCode()` is currently called when the number
|
|
4919
|
-
// couldn't be formatted during the standard procedure.
|
|
4920
|
-
// Normally, the national prefix would be re-extracted
|
|
4921
|
-
// for an international number if such number couldn't be formatted,
|
|
4922
|
-
// but since it's already not able to be formatted,
|
|
4923
|
-
// there won't be yet another retry, so also extract national prefix here.
|
|
4924
|
-
this.extractNationalSignificantNumber(state.getNationalDigits(), state.update);
|
|
4925
|
-
}
|
|
4926
|
-
}
|
|
4927
|
-
}]);
|
|
4928
|
-
|
|
4929
|
-
return AsYouTypeParser;
|
|
4930
|
-
}();
|
|
4931
|
-
|
|
4932
|
-
function extractFormattedPhoneNumber(text) {
|
|
4933
|
-
// Attempt to extract a possible number from the string passed in.
|
|
4934
|
-
var startsAt = text.search(VALID_FORMATTED_PHONE_NUMBER_PART);
|
|
4935
|
-
|
|
4936
|
-
if (startsAt < 0) {
|
|
4937
|
-
return;
|
|
4938
|
-
} // Trim everything to the left of the phone number.
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
text = text.slice(startsAt); // Trim the `+`.
|
|
4942
|
-
|
|
4943
|
-
var hasPlus;
|
|
4944
|
-
|
|
4945
|
-
if (text[0] === '+') {
|
|
4946
|
-
hasPlus = true;
|
|
4947
|
-
text = text.slice('+'.length);
|
|
4948
|
-
} // Trim everything to the right of the phone number.
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
text = text.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN, ''); // Re-add the previously trimmed `+`.
|
|
4952
|
-
|
|
4953
|
-
if (hasPlus) {
|
|
4954
|
-
text = '+' + text;
|
|
4955
|
-
}
|
|
4956
|
-
|
|
4957
|
-
return text;
|
|
4958
|
-
}
|
|
4959
|
-
/**
|
|
4960
|
-
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
4961
|
-
* @param {string} text
|
|
4962
|
-
* @return {any[]}
|
|
4963
|
-
*/
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
function _extractFormattedDigitsAndPlus(text) {
|
|
4967
|
-
// Extract a formatted phone number part from text.
|
|
4968
|
-
var extractedNumber = extractFormattedPhoneNumber(text) || ''; // Trim a `+`.
|
|
4969
|
-
|
|
4970
|
-
if (extractedNumber[0] === '+') {
|
|
4971
|
-
return [extractedNumber.slice('+'.length), true];
|
|
4972
|
-
}
|
|
4973
|
-
|
|
4974
|
-
return [extractedNumber];
|
|
4975
|
-
}
|
|
4976
|
-
/**
|
|
4977
|
-
* Extracts formatted phone number digits (and a `+`) from text (if there're any).
|
|
4978
|
-
* @param {string} text
|
|
4979
|
-
* @return {any[]}
|
|
4980
|
-
*/
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
function extractFormattedDigitsAndPlus(text) {
|
|
4984
|
-
var _extractFormattedDigi3 = _extractFormattedDigitsAndPlus(text),
|
|
4985
|
-
_extractFormattedDigi4 = _slicedToArray(_extractFormattedDigi3, 2),
|
|
4986
|
-
formattedDigits = _extractFormattedDigi4[0],
|
|
4987
|
-
hasPlus = _extractFormattedDigi4[1]; // If the extracted phone number part
|
|
4988
|
-
// can possibly be a part of some valid phone number
|
|
4989
|
-
// then parse phone number characters from a formatted phone number.
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
if (!VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN.test(formattedDigits)) {
|
|
4993
|
-
formattedDigits = '';
|
|
4994
|
-
}
|
|
4995
|
-
|
|
4996
|
-
return [formattedDigits, hasPlus];
|
|
4997
|
-
}
|
|
4998
|
-
|
|
4999
|
-
function _typeof$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
|
|
5000
|
-
|
|
5001
|
-
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1(); }
|
|
5002
|
-
|
|
5003
|
-
function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
5004
|
-
|
|
5005
|
-
function _iterableToArrayLimit$1(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
5006
|
-
|
|
5007
|
-
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
|
|
5008
|
-
|
|
5009
|
-
function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5010
|
-
|
|
5011
|
-
function _defineProperties$5(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
5012
|
-
|
|
5013
|
-
function _createClass$5(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$5(Constructor.prototype, protoProps); if (staticProps) _defineProperties$5(Constructor, staticProps); return Constructor; }
|
|
5014
|
-
|
|
5015
|
-
var AsYouType =
|
|
5016
|
-
/*#__PURE__*/
|
|
5017
|
-
function () {
|
|
5018
|
-
/**
|
|
5019
|
-
* @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.
|
|
5020
|
-
* @param {Object} metadata
|
|
5021
|
-
*/
|
|
5022
|
-
function AsYouType(optionsOrDefaultCountry, metadata) {
|
|
5023
|
-
_classCallCheck$5(this, AsYouType);
|
|
5024
|
-
|
|
5025
|
-
this.metadata = new Metadata(metadata);
|
|
5026
|
-
|
|
5027
|
-
var _this$getCountryAndCa = this.getCountryAndCallingCode(optionsOrDefaultCountry),
|
|
5028
|
-
_this$getCountryAndCa2 = _slicedToArray$1(_this$getCountryAndCa, 2),
|
|
5029
|
-
defaultCountry = _this$getCountryAndCa2[0],
|
|
5030
|
-
defaultCallingCode = _this$getCountryAndCa2[1];
|
|
5031
|
-
|
|
5032
|
-
this.defaultCountry = defaultCountry;
|
|
5033
|
-
this.defaultCallingCode = defaultCallingCode;
|
|
5034
|
-
this.reset();
|
|
5035
|
-
}
|
|
5036
|
-
|
|
5037
|
-
_createClass$5(AsYouType, [{
|
|
5038
|
-
key: "getCountryAndCallingCode",
|
|
5039
|
-
value: function getCountryAndCallingCode(optionsOrDefaultCountry) {
|
|
5040
|
-
// Set `defaultCountry` and `defaultCallingCode` options.
|
|
5041
|
-
var defaultCountry;
|
|
5042
|
-
var defaultCallingCode; // Turns out `null` also has type "object". Weird.
|
|
5043
|
-
|
|
5044
|
-
if (optionsOrDefaultCountry) {
|
|
5045
|
-
if (_typeof$1(optionsOrDefaultCountry) === 'object') {
|
|
5046
|
-
defaultCountry = optionsOrDefaultCountry.defaultCountry;
|
|
5047
|
-
defaultCallingCode = optionsOrDefaultCountry.defaultCallingCode;
|
|
5048
|
-
} else {
|
|
5049
|
-
defaultCountry = optionsOrDefaultCountry;
|
|
5050
|
-
}
|
|
5051
|
-
}
|
|
5052
|
-
|
|
5053
|
-
if (defaultCountry && !this.metadata.hasCountry(defaultCountry)) {
|
|
5054
|
-
defaultCountry = undefined;
|
|
5055
|
-
}
|
|
5056
|
-
|
|
5057
|
-
return [defaultCountry, defaultCallingCode];
|
|
5058
|
-
}
|
|
5059
|
-
/**
|
|
5060
|
-
* Inputs "next" phone number characters.
|
|
5061
|
-
* @param {string} text
|
|
5062
|
-
* @return {string} Formatted phone number characters that have been input so far.
|
|
5063
|
-
*/
|
|
5064
|
-
|
|
5065
|
-
}, {
|
|
5066
|
-
key: "input",
|
|
5067
|
-
value: function input(text) {
|
|
5068
|
-
var _this$parser$input = this.parser.input(text, this.state),
|
|
5069
|
-
digits = _this$parser$input.digits,
|
|
5070
|
-
justLeadingPlus = _this$parser$input.justLeadingPlus;
|
|
5071
|
-
|
|
5072
|
-
if (justLeadingPlus) {
|
|
5073
|
-
this.formattedOutput = '+';
|
|
5074
|
-
} else if (digits) {
|
|
5075
|
-
this.determineTheCountryIfNeeded(); // Match the available formats by the currently available leading digits.
|
|
5076
|
-
|
|
5077
|
-
if (this.state.nationalSignificantNumber) {
|
|
5078
|
-
this.formatter.narrowDownMatchingFormats(this.state);
|
|
5079
|
-
}
|
|
5080
|
-
|
|
5081
|
-
var formattedNationalNumber;
|
|
5082
|
-
|
|
5083
|
-
if (this.metadata.hasSelectedNumberingPlan()) {
|
|
5084
|
-
formattedNationalNumber = this.formatter.format(digits, this.state);
|
|
5085
|
-
}
|
|
5086
|
-
|
|
5087
|
-
if (formattedNationalNumber === undefined) {
|
|
5088
|
-
// See if another national (significant) number could be re-extracted.
|
|
5089
|
-
if (this.parser.reExtractNationalSignificantNumber(this.state)) {
|
|
5090
|
-
this.determineTheCountryIfNeeded(); // If it could, then re-try formatting the new national (significant) number.
|
|
5091
|
-
|
|
5092
|
-
var nationalDigits = this.state.getNationalDigits();
|
|
5093
|
-
|
|
5094
|
-
if (nationalDigits) {
|
|
5095
|
-
formattedNationalNumber = this.formatter.format(nationalDigits, this.state);
|
|
5096
|
-
}
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
|
|
5100
|
-
this.formattedOutput = formattedNationalNumber ? this.getFullNumber(formattedNationalNumber) : this.getNonFormattedNumber();
|
|
5101
|
-
}
|
|
5102
|
-
|
|
5103
|
-
return this.formattedOutput;
|
|
5104
|
-
}
|
|
5105
|
-
}, {
|
|
5106
|
-
key: "reset",
|
|
5107
|
-
value: function reset() {
|
|
5108
|
-
var _this = this;
|
|
5109
|
-
|
|
5110
|
-
this.state = new AsYouTypeState({
|
|
5111
|
-
onCountryChange: function onCountryChange(country) {
|
|
5112
|
-
// Before version `1.6.0`, the official `AsYouType` formatter API
|
|
5113
|
-
// included the `.country` property of an `AsYouType` instance.
|
|
5114
|
-
// Since that property (along with the others) have been moved to
|
|
5115
|
-
// `this.state`, `this.country` property is emulated for compatibility
|
|
5116
|
-
// with the old versions.
|
|
5117
|
-
_this.country = country;
|
|
5118
|
-
},
|
|
5119
|
-
onCallingCodeChange: function onCallingCodeChange(country, callingCode) {
|
|
5120
|
-
_this.metadata.selectNumberingPlan(country, callingCode);
|
|
5121
|
-
|
|
5122
|
-
_this.formatter.reset(_this.metadata.numberingPlan, _this.state);
|
|
5123
|
-
|
|
5124
|
-
_this.parser.reset(_this.metadata.numberingPlan);
|
|
5125
|
-
}
|
|
5126
|
-
});
|
|
5127
|
-
this.formatter = new AsYouTypeFormatter({
|
|
5128
|
-
state: this.state,
|
|
5129
|
-
metadata: this.metadata
|
|
5130
|
-
});
|
|
5131
|
-
this.parser = new AsYouTypeParser({
|
|
5132
|
-
defaultCountry: this.defaultCountry,
|
|
5133
|
-
defaultCallingCode: this.defaultCallingCode,
|
|
5134
|
-
metadata: this.metadata,
|
|
5135
|
-
state: this.state,
|
|
5136
|
-
onNationalSignificantNumberChange: function onNationalSignificantNumberChange() {
|
|
5137
|
-
_this.determineTheCountryIfNeeded();
|
|
5138
|
-
|
|
5139
|
-
_this.formatter.reset(_this.metadata.numberingPlan, _this.state);
|
|
5140
|
-
}
|
|
5141
|
-
});
|
|
5142
|
-
this.state.reset(this.defaultCountry, this.defaultCallingCode);
|
|
5143
|
-
this.formattedOutput = '';
|
|
5144
|
-
return this;
|
|
5145
|
-
}
|
|
5146
|
-
/**
|
|
5147
|
-
* Returns `true` if the phone number is being input in international format.
|
|
5148
|
-
* In other words, returns `true` if and only if the parsed phone number starts with a `"+"`.
|
|
5149
|
-
* @return {boolean}
|
|
5150
|
-
*/
|
|
5151
|
-
|
|
5152
|
-
}, {
|
|
5153
|
-
key: "isInternational",
|
|
5154
|
-
value: function isInternational() {
|
|
5155
|
-
return this.state.international;
|
|
5156
|
-
}
|
|
5157
|
-
/**
|
|
5158
|
-
* Returns the "country calling code" part of the phone number.
|
|
5159
|
-
* Returns `undefined` if the number is not being input in international format.
|
|
5160
|
-
* Returns "country calling code" for "non-geographic" phone numbering plans too.
|
|
5161
|
-
* @return {string} [callingCode]
|
|
5162
|
-
*/
|
|
5163
|
-
|
|
5164
|
-
}, {
|
|
5165
|
-
key: "getCallingCode",
|
|
5166
|
-
value: function getCallingCode() {
|
|
5167
|
-
return this.state.callingCode;
|
|
5168
|
-
} // A legacy alias.
|
|
5169
|
-
|
|
5170
|
-
}, {
|
|
5171
|
-
key: "getCountryCallingCode",
|
|
5172
|
-
value: function getCountryCallingCode() {
|
|
5173
|
-
return this.getCallingCode();
|
|
5174
|
-
}
|
|
5175
|
-
/**
|
|
5176
|
-
* Returns a two-letter country code of the phone number.
|
|
5177
|
-
* Returns `undefined` for "non-geographic" phone numbering plans.
|
|
5178
|
-
* Returns `undefined` if no phone number has been input yet.
|
|
5179
|
-
* @return {string} [country]
|
|
5180
|
-
*/
|
|
5181
|
-
|
|
5182
|
-
}, {
|
|
5183
|
-
key: "getCountry",
|
|
5184
|
-
value: function getCountry() {
|
|
5185
|
-
var _this$state = this.state,
|
|
5186
|
-
digits = _this$state.digits,
|
|
5187
|
-
country = _this$state.country; // If no digits have been input yet,
|
|
5188
|
-
// then `this.country` is the `defaultCountry`.
|
|
5189
|
-
// Won't return the `defaultCountry` in such case.
|
|
5190
|
-
|
|
5191
|
-
if (!digits) {
|
|
5192
|
-
return;
|
|
5193
|
-
}
|
|
5194
|
-
|
|
5195
|
-
var countryCode = country;
|
|
5196
|
-
|
|
5197
|
-
return countryCode;
|
|
5198
|
-
}
|
|
5199
|
-
}, {
|
|
5200
|
-
key: "determineTheCountryIfNeeded",
|
|
5201
|
-
value: function determineTheCountryIfNeeded() {
|
|
5202
|
-
// Suppose a user enters a phone number in international format,
|
|
5203
|
-
// and there're several countries corresponding to that country calling code,
|
|
5204
|
-
// and a country has been derived from the number, and then
|
|
5205
|
-
// a user enters one more digit and the number is no longer
|
|
5206
|
-
// valid for the derived country, so the country should be re-derived
|
|
5207
|
-
// on every new digit in those cases.
|
|
5208
|
-
//
|
|
5209
|
-
// If the phone number is being input in national format,
|
|
5210
|
-
// then it could be a case when `defaultCountry` wasn't specified
|
|
5211
|
-
// when creating `AsYouType` instance, and just `defaultCallingCode` was specified,
|
|
5212
|
-
// and that "calling code" could correspond to a "non-geographic entity",
|
|
5213
|
-
// or there could be several countries corresponding to that country calling code.
|
|
5214
|
-
// In those cases, `this.country` is `undefined` and should be derived
|
|
5215
|
-
// from the number. Again, if country calling code is ambiguous, then
|
|
5216
|
-
// `this.country` should be re-derived with each new digit.
|
|
5217
|
-
//
|
|
5218
|
-
if (!this.state.country || this.isCountryCallingCodeAmbiguous()) {
|
|
5219
|
-
this.determineTheCountry();
|
|
5220
|
-
}
|
|
5221
|
-
} // Prepends `+CountryCode ` in case of an international phone number
|
|
5222
|
-
|
|
5223
|
-
}, {
|
|
5224
|
-
key: "getFullNumber",
|
|
5225
|
-
value: function getFullNumber(formattedNationalNumber) {
|
|
5226
|
-
var _this2 = this;
|
|
5227
|
-
|
|
5228
|
-
if (this.isInternational()) {
|
|
5229
|
-
var prefix = function prefix(text) {
|
|
5230
|
-
return _this2.formatter.getInternationalPrefixBeforeCountryCallingCode(_this2.state, {
|
|
5231
|
-
spacing: text ? true : false
|
|
5232
|
-
}) + text;
|
|
5233
|
-
};
|
|
5234
|
-
|
|
5235
|
-
var callingCode = this.state.callingCode;
|
|
5236
|
-
|
|
5237
|
-
if (!callingCode) {
|
|
5238
|
-
return prefix("".concat(this.state.getDigitsWithoutInternationalPrefix()));
|
|
5239
|
-
}
|
|
5240
|
-
|
|
5241
|
-
if (!formattedNationalNumber) {
|
|
5242
|
-
return prefix(callingCode);
|
|
5243
|
-
}
|
|
5244
|
-
|
|
5245
|
-
return prefix("".concat(callingCode, " ").concat(formattedNationalNumber));
|
|
5246
|
-
}
|
|
5247
|
-
|
|
5248
|
-
return formattedNationalNumber;
|
|
5249
|
-
}
|
|
5250
|
-
}, {
|
|
5251
|
-
key: "getNonFormattedNationalNumberWithPrefix",
|
|
5252
|
-
value: function getNonFormattedNationalNumberWithPrefix() {
|
|
5253
|
-
var _this$state2 = this.state,
|
|
5254
|
-
nationalSignificantNumber = _this$state2.nationalSignificantNumber,
|
|
5255
|
-
complexPrefixBeforeNationalSignificantNumber = _this$state2.complexPrefixBeforeNationalSignificantNumber,
|
|
5256
|
-
nationalPrefix = _this$state2.nationalPrefix;
|
|
5257
|
-
var number = nationalSignificantNumber;
|
|
5258
|
-
var prefix = complexPrefixBeforeNationalSignificantNumber || nationalPrefix;
|
|
5259
|
-
|
|
5260
|
-
if (prefix) {
|
|
5261
|
-
number = prefix + number;
|
|
5262
|
-
}
|
|
5263
|
-
|
|
5264
|
-
return number;
|
|
5265
|
-
}
|
|
5266
|
-
}, {
|
|
5267
|
-
key: "getNonFormattedNumber",
|
|
5268
|
-
value: function getNonFormattedNumber() {
|
|
5269
|
-
var nationalSignificantNumberMatchesInput = this.state.nationalSignificantNumberMatchesInput;
|
|
5270
|
-
return this.getFullNumber(nationalSignificantNumberMatchesInput ? this.getNonFormattedNationalNumberWithPrefix() : this.state.getNationalDigits());
|
|
5271
|
-
}
|
|
5272
|
-
}, {
|
|
5273
|
-
key: "getNonFormattedTemplate",
|
|
5274
|
-
value: function getNonFormattedTemplate() {
|
|
5275
|
-
var number = this.getNonFormattedNumber();
|
|
5276
|
-
|
|
5277
|
-
if (number) {
|
|
5278
|
-
return number.replace(/[\+\d]/g, DIGIT_PLACEHOLDER);
|
|
5279
|
-
}
|
|
5280
|
-
}
|
|
5281
|
-
}, {
|
|
5282
|
-
key: "isCountryCallingCodeAmbiguous",
|
|
5283
|
-
value: function isCountryCallingCodeAmbiguous() {
|
|
5284
|
-
var callingCode = this.state.callingCode;
|
|
5285
|
-
var countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode);
|
|
5286
|
-
return countryCodes && countryCodes.length > 1;
|
|
5287
|
-
} // Determines the country of the phone number
|
|
5288
|
-
// entered so far based on the country phone code
|
|
5289
|
-
// and the national phone number.
|
|
5290
|
-
|
|
5291
|
-
}, {
|
|
5292
|
-
key: "determineTheCountry",
|
|
5293
|
-
value: function determineTheCountry() {
|
|
5294
|
-
this.state.setCountry(getCountryByCallingCode(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, this.state.nationalSignificantNumber, this.metadata));
|
|
5295
|
-
}
|
|
5296
|
-
/**
|
|
5297
|
-
* Returns an instance of `PhoneNumber` class.
|
|
5298
|
-
* Will return `undefined` if no national (significant) number
|
|
5299
|
-
* digits have been entered so far, or if no `defaultCountry` has been
|
|
5300
|
-
* set and the user enters a phone number not in international format.
|
|
5301
|
-
*/
|
|
5302
|
-
|
|
5303
|
-
}, {
|
|
5304
|
-
key: "getNumber",
|
|
5305
|
-
value: function getNumber() {
|
|
5306
|
-
var _this$state3 = this.state,
|
|
5307
|
-
nationalSignificantNumber = _this$state3.nationalSignificantNumber,
|
|
5308
|
-
carrierCode = _this$state3.carrierCode;
|
|
5309
|
-
|
|
5310
|
-
if (this.isInternational()) {
|
|
5311
|
-
if (!this.state.callingCode) {
|
|
5312
|
-
return;
|
|
5313
|
-
}
|
|
5314
|
-
} else {
|
|
5315
|
-
if (!this.state.country && !this.defaultCallingCode) {
|
|
5316
|
-
return;
|
|
5317
|
-
}
|
|
5318
|
-
}
|
|
5319
|
-
|
|
5320
|
-
if (!nationalSignificantNumber) {
|
|
5321
|
-
return;
|
|
5322
|
-
}
|
|
5323
|
-
|
|
5324
|
-
var countryCode = this.getCountry();
|
|
5325
|
-
var callingCode = this.getCountryCallingCode() || this.defaultCallingCode;
|
|
5326
|
-
var phoneNumber = new PhoneNumber(countryCode || callingCode, nationalSignificantNumber, this.metadata.metadata);
|
|
5327
|
-
|
|
5328
|
-
if (carrierCode) {
|
|
5329
|
-
phoneNumber.carrierCode = carrierCode;
|
|
5330
|
-
} // Phone number extensions are not supported by "As You Type" formatter.
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
return phoneNumber;
|
|
5334
|
-
}
|
|
5335
|
-
/**
|
|
5336
|
-
* Returns `true` if the phone number is "possible".
|
|
5337
|
-
* Is just a shortcut for `PhoneNumber.isPossible()`.
|
|
5338
|
-
* @return {boolean}
|
|
5339
|
-
*/
|
|
5340
|
-
|
|
5341
|
-
}, {
|
|
5342
|
-
key: "isPossible",
|
|
5343
|
-
value: function isPossible() {
|
|
5344
|
-
var phoneNumber = this.getNumber();
|
|
5345
|
-
|
|
5346
|
-
if (!phoneNumber) {
|
|
5347
|
-
return false;
|
|
5348
|
-
}
|
|
5349
|
-
|
|
5350
|
-
return phoneNumber.isPossible();
|
|
5351
|
-
}
|
|
5352
|
-
/**
|
|
5353
|
-
* Returns `true` if the phone number is "valid".
|
|
5354
|
-
* Is just a shortcut for `PhoneNumber.isValid()`.
|
|
5355
|
-
* @return {boolean}
|
|
5356
|
-
*/
|
|
5357
|
-
|
|
5358
|
-
}, {
|
|
5359
|
-
key: "isValid",
|
|
5360
|
-
value: function isValid() {
|
|
5361
|
-
var phoneNumber = this.getNumber();
|
|
5362
|
-
|
|
5363
|
-
if (!phoneNumber) {
|
|
5364
|
-
return false;
|
|
5365
|
-
}
|
|
5366
|
-
|
|
5367
|
-
return phoneNumber.isValid();
|
|
5368
|
-
}
|
|
5369
|
-
/**
|
|
5370
|
-
* @deprecated
|
|
5371
|
-
* This method is used in `react-phone-number-input/source/input-control.js`
|
|
5372
|
-
* in versions before `3.0.16`.
|
|
5373
|
-
*/
|
|
5374
|
-
|
|
5375
|
-
}, {
|
|
5376
|
-
key: "getNationalNumber",
|
|
5377
|
-
value: function getNationalNumber() {
|
|
5378
|
-
return this.state.nationalSignificantNumber;
|
|
5379
|
-
}
|
|
5380
|
-
/**
|
|
5381
|
-
* Returns the phone number characters entered by the user.
|
|
5382
|
-
* @return {string}
|
|
5383
|
-
*/
|
|
5384
|
-
|
|
5385
|
-
}, {
|
|
5386
|
-
key: "getChars",
|
|
5387
|
-
value: function getChars() {
|
|
5388
|
-
return (this.state.international ? '+' : '') + this.state.digits;
|
|
5389
|
-
}
|
|
5390
|
-
/**
|
|
5391
|
-
* Returns the template for the formatted phone number.
|
|
5392
|
-
* @return {string}
|
|
5393
|
-
*/
|
|
5394
|
-
|
|
5395
|
-
}, {
|
|
5396
|
-
key: "getTemplate",
|
|
5397
|
-
value: function getTemplate() {
|
|
5398
|
-
return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || '';
|
|
5399
|
-
}
|
|
5400
|
-
}]);
|
|
5401
|
-
|
|
5402
|
-
return AsYouType;
|
|
5403
|
-
}();
|
|
5404
|
-
|
|
5405
|
-
function AsYouType$1(country) {
|
|
5406
|
-
return AsYouType.call(this, country, metadata)
|
|
5407
|
-
}
|
|
5408
|
-
|
|
5409
|
-
AsYouType$1.prototype = Object.create(AsYouType.prototype, {});
|
|
5410
|
-
AsYouType$1.prototype.constructor = AsYouType$1;
|
|
5411
|
-
|
|
5412
1542
|
function usePortalRegister(props) {
|
|
5413
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1543
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
5414
1544
|
const formRef = stencilHooks_module.useRef(null);
|
|
5415
|
-
const { validationState, setValidationState } = useValidationState({});
|
|
5416
|
-
const [request, { loading, errors, data }] = index_module.
|
|
1545
|
+
const { validationState, setValidationState } = useValidationState.useValidationState({});
|
|
1546
|
+
const [request, { loading, errors, data }] = index_module.Ne();
|
|
5417
1547
|
const submit = async (event) => {
|
|
5418
1548
|
let formControls = event.target.getFormControls();
|
|
5419
1549
|
let formData = {};
|
|
@@ -5472,13 +1602,13 @@ function usePortalRegister(props) {
|
|
|
5472
1602
|
const name = (_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
5473
1603
|
if (name !== "tel")
|
|
5474
1604
|
return;
|
|
5475
|
-
const asYouType = new AsYouType
|
|
1605
|
+
const asYouType = new useValidationState.AsYouType("US");
|
|
5476
1606
|
e.target.value = asYouType.input(e.target.value);
|
|
5477
1607
|
}, []);
|
|
5478
1608
|
stencilHooks_module.useEffect(() => {
|
|
5479
1609
|
var _a;
|
|
5480
1610
|
if ((_a = data === null || data === void 0 ? void 0 : data.registerManagedIdentityWithEmailAndPassword) === null || _a === void 0 ? void 0 : _a.token) {
|
|
5481
|
-
index_module.
|
|
1611
|
+
index_module.Ft.push(props.nextPage);
|
|
5482
1612
|
}
|
|
5483
1613
|
}, [(_a = data === null || data === void 0 ? void 0 : data.registerManagedIdentityWithEmailAndPassword) === null || _a === void 0 ? void 0 : _a.token]);
|
|
5484
1614
|
stencilHooks_module.useEffect(() => {
|
|
@@ -5499,7 +1629,7 @@ function usePortalRegister(props) {
|
|
|
5499
1629
|
}
|
|
5500
1630
|
else {
|
|
5501
1631
|
errorMessage =
|
|
5502
|
-
((_f = (_e = (_d = errors === null || errors === void 0 ? void 0 : errors.response) === null || _d === void 0 ? void 0 : _d.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.message) || (validationState === null || validationState === void 0 ? void 0 : validationState.error);
|
|
1632
|
+
((_g = (_f = (_e = (_d = errors === null || errors === void 0 ? void 0 : errors.response) === null || _d === void 0 ? void 0 : _d.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.extensions) === null || _g === void 0 ? void 0 : _g.message) || ((_k = (_j = (_h = errors === null || errors === void 0 ? void 0 : errors.response) === null || _h === void 0 ? void 0 : _h.errors) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.message) || (validationState === null || validationState === void 0 ? void 0 : validationState.error);
|
|
5503
1633
|
}
|
|
5504
1634
|
return {
|
|
5505
1635
|
states: {
|
|
@@ -5560,6 +1690,7 @@ const PortalRegister = class {
|
|
|
5560
1690
|
* Show or hide the confirm password input
|
|
5561
1691
|
*
|
|
5562
1692
|
* @uiName Show Confirm Password Field
|
|
1693
|
+
* @default
|
|
5563
1694
|
*/
|
|
5564
1695
|
this.confirmPassword = false;
|
|
5565
1696
|
/**
|
|
@@ -5570,6 +1701,7 @@ const PortalRegister = class {
|
|
|
5570
1701
|
* Hide default input fields to use custom fields
|
|
5571
1702
|
*
|
|
5572
1703
|
* @uiName Hide Default Inputs
|
|
1704
|
+
* @default
|
|
5573
1705
|
*/
|
|
5574
1706
|
this.hideInputs = false;
|
|
5575
1707
|
/**
|
|
@@ -5586,12 +1718,12 @@ const PortalRegister = class {
|
|
|
5586
1718
|
}
|
|
5587
1719
|
disconnectedCallback() { }
|
|
5588
1720
|
render() {
|
|
5589
|
-
const { states, callbacks, refs } = index_module.
|
|
1721
|
+
const { states, callbacks, refs } = index_module.T()
|
|
5590
1722
|
? useRegisterDemo(this)
|
|
5591
1723
|
: usePortalRegister(this);
|
|
5592
1724
|
const content = {
|
|
5593
1725
|
formData: index.h("slot", { name: "formData" }),
|
|
5594
|
-
secondaryButton: (index.h("slot", { name: "secondaryButton" }, index.h("sl-button", { type: "text", disabled: states.loading, onClick: () => index_module.
|
|
1726
|
+
secondaryButton: (index.h("slot", { name: "secondaryButton" }, index.h("sl-button", { type: "text", disabled: states.loading, onClick: () => index_module.Ft.push(states.loginPath) }, this.loginLabel))),
|
|
5595
1727
|
terms: index.h("slot", { name: "terms" }),
|
|
5596
1728
|
emailLabel: this.emailLabel,
|
|
5597
1729
|
passwordLabel: this.passwordLabel,
|
|
@@ -5753,11 +1885,11 @@ const ProgramExplainerStep = class {
|
|
|
5753
1885
|
const debug = stencilHooks_module.browser('sq:useProgramMenu');
|
|
5754
1886
|
const UPDATE_PROGRAM_EVENT = 'sq:update-program-id';
|
|
5755
1887
|
function useProgramMenu(props) {
|
|
5756
|
-
const programId = index_module.
|
|
5757
|
-
const host = index_module.
|
|
1888
|
+
const programId = index_module.F();
|
|
1889
|
+
const host = index_module.k();
|
|
5758
1890
|
debug({ programId, props });
|
|
5759
1891
|
const ref = stencilHooks_module.useRef();
|
|
5760
|
-
const [, rerender] = index_module.
|
|
1892
|
+
const [, rerender] = index_module.Pt();
|
|
5761
1893
|
stencilHooks_module.useEffect(() => {
|
|
5762
1894
|
var _a;
|
|
5763
1895
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener('sl-select', (e) => {
|
|
@@ -5883,9 +2015,9 @@ const GET_USER_DETAILS = index_module.dist.gql `
|
|
|
5883
2015
|
`;
|
|
5884
2016
|
function useReferralIframe(props) {
|
|
5885
2017
|
var _a;
|
|
5886
|
-
const programId = index_module.
|
|
5887
|
-
const user = index_module.
|
|
5888
|
-
const { data } = index_module.
|
|
2018
|
+
const programId = index_module.F();
|
|
2019
|
+
const user = index_module.oe();
|
|
2020
|
+
const { data } = index_module.kt(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
5889
2021
|
return {
|
|
5890
2022
|
states: {
|
|
5891
2023
|
content: props,
|
|
@@ -5923,7 +2055,7 @@ const SqmReferralIframe = class {
|
|
|
5923
2055
|
if (missingProps) {
|
|
5924
2056
|
return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this page", subheading: "A technical problem prevented this iframe from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
|
|
5925
2057
|
}
|
|
5926
|
-
const { states, data } = index_module.
|
|
2058
|
+
const { states, data } = index_module.T()
|
|
5927
2059
|
? useReferralIframeDemo(utils.getProps(this))
|
|
5928
2060
|
: useReferralIframe(utils.getProps(this));
|
|
5929
2061
|
return (index.h(index.Host, { style: { display: "contents" } }, index.h(ShadowViewAddon.ReferralIframeView, { data: data, states: states })));
|
|
@@ -6610,9 +2742,9 @@ function useRewardExchangeList(props) {
|
|
|
6610
2742
|
});
|
|
6611
2743
|
const [open, setOpen] = stencilHooks_module.useState(false);
|
|
6612
2744
|
const { selectedItem, selectedStep, redeemStage, amount, exchangeError } = exchangeState;
|
|
6613
|
-
const user = index_module.
|
|
6614
|
-
const [exchange, { data: exchangeResponse, loading: exchangeLoading, errors },] = index_module.
|
|
6615
|
-
const { data, loading, refetch, errors: queryError, } = index_module.
|
|
2745
|
+
const user = index_module.oe();
|
|
2746
|
+
const [exchange, { data: exchangeResponse, loading: exchangeLoading, errors },] = index_module.Oe(EXCHANGE);
|
|
2747
|
+
const { data, loading, refetch, errors: queryError, } = index_module.kt(GET_EXCHANGE_LIST, {}, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
6616
2748
|
stencilHooks_module.useEffect(() => {
|
|
6617
2749
|
var _a, _b;
|
|
6618
2750
|
if ((_b = (_a = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _a === void 0 ? void 0 : _a.reward) === null || _b === void 0 ? void 0 : _b.id) {
|
|
@@ -6631,7 +2763,7 @@ function useRewardExchangeList(props) {
|
|
|
6631
2763
|
canvas.confetti || confetti.create(canvas, { resize: true });
|
|
6632
2764
|
canvas.confetti();
|
|
6633
2765
|
}, [canvasRef.current]);
|
|
6634
|
-
const { refresh } = index_module.
|
|
2766
|
+
const { refresh } = index_module.at();
|
|
6635
2767
|
async function exchangeReward() {
|
|
6636
2768
|
if (!selectedItem)
|
|
6637
2769
|
return;
|
|
@@ -6887,7 +3019,7 @@ const SqmRewardExchangeList = class {
|
|
|
6887
3019
|
...utils.getProps(this),
|
|
6888
3020
|
empty: index.h(EmptySlot$1, null),
|
|
6889
3021
|
};
|
|
6890
|
-
const { states, data, callbacks, refs } = index_module.
|
|
3022
|
+
const { states, data, callbacks, refs } = index_module.T()
|
|
6891
3023
|
? useRewardExchangeListDemo(props)
|
|
6892
3024
|
: useRewardExchangeList(props);
|
|
6893
3025
|
return (index.h(index.Host, { style: { display: "contents" } }, index.h(ShadowViewAddon.RewardExchangeView, { states: states, data: data, callbacks: callbacks, refs: refs })));
|
|
@@ -6939,8 +3071,8 @@ function matchPath(pattern, page) {
|
|
|
6939
3071
|
return regexp.exec(page);
|
|
6940
3072
|
}
|
|
6941
3073
|
function useRouter() {
|
|
6942
|
-
const location = index_module.
|
|
6943
|
-
const host = index_module.
|
|
3074
|
+
const location = index_module.Rt();
|
|
3075
|
+
const host = index_module.k();
|
|
6944
3076
|
const [slot, setSlot] = stencilHooks_module.useState(undefined);
|
|
6945
3077
|
const [container, setContainer] = stencilHooks_module.useState(undefined);
|
|
6946
3078
|
const page = location.pathname;
|
|
@@ -7085,7 +3217,7 @@ const Scroll = class {
|
|
|
7085
3217
|
color: "var(--sl-color-primary-text)",
|
|
7086
3218
|
background: "var(--sl-color-neutral-500)",
|
|
7087
3219
|
"&:hover": {
|
|
7088
|
-
opacity: "0.8"
|
|
3220
|
+
opacity: "0.8",
|
|
7089
3221
|
},
|
|
7090
3222
|
},
|
|
7091
3223
|
},
|
|
@@ -7144,10 +3276,12 @@ const ShareButton = class {
|
|
|
7144
3276
|
this.iconslot = "prefix";
|
|
7145
3277
|
/**
|
|
7146
3278
|
* @uiName Hide Icon
|
|
3279
|
+
* @default
|
|
7147
3280
|
*/
|
|
7148
3281
|
this.hideicon = false;
|
|
7149
3282
|
/**
|
|
7150
3283
|
* @uiName Hide Text
|
|
3284
|
+
* @default
|
|
7151
3285
|
*/
|
|
7152
3286
|
this.hidetext = false;
|
|
7153
3287
|
stencilHooks_module.h$1(this);
|
|
@@ -7155,7 +3289,7 @@ const ShareButton = class {
|
|
|
7155
3289
|
disconnectedCallback() { }
|
|
7156
3290
|
render() {
|
|
7157
3291
|
const thisProps = utils.getProps(this);
|
|
7158
|
-
const props = index_module.
|
|
3292
|
+
const props = index_module.T()
|
|
7159
3293
|
? useDemoShareButton(thisProps)
|
|
7160
3294
|
: ShadowViewAddon.useShareButton(thisProps);
|
|
7161
3295
|
return (index.h(ShadowViewAddon.ShareButtonView, Object.assign({}, props), index.h("slot", null)));
|
|
@@ -7189,11 +3323,11 @@ const WIDGET_ENGAGEMENT_EVENT = index_module.dist.gql `
|
|
|
7189
3323
|
`;
|
|
7190
3324
|
function useShareCode(props) {
|
|
7191
3325
|
var _a, _b;
|
|
7192
|
-
const programId = index_module.
|
|
7193
|
-
const user = index_module.
|
|
7194
|
-
const engagementMedium = index_module.
|
|
7195
|
-
const { data } = index_module.
|
|
7196
|
-
const [sendLoadEvent] = index_module.
|
|
3326
|
+
const programId = index_module.F();
|
|
3327
|
+
const user = index_module.oe();
|
|
3328
|
+
const engagementMedium = index_module.H();
|
|
3329
|
+
const { data } = index_module.kt(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
3330
|
+
const [sendLoadEvent] = index_module.Oe(WIDGET_ENGAGEMENT_EVENT);
|
|
7197
3331
|
const shareString = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.referralCode) !== null && _b !== void 0 ? _b :
|
|
7198
3332
|
// Shown during loading
|
|
7199
3333
|
"...";
|
|
@@ -7240,7 +3374,7 @@ const ShareCode = class {
|
|
|
7240
3374
|
disconnectedCallback() { }
|
|
7241
3375
|
render() {
|
|
7242
3376
|
const thisProps = utils.getProps(this);
|
|
7243
|
-
const props = index_module.
|
|
3377
|
+
const props = index_module.T()
|
|
7244
3378
|
? useDemoShareCode(thisProps)
|
|
7245
3379
|
: useShareCode(thisProps);
|
|
7246
3380
|
return index.h(ShadowViewAddon.ShareLinkView, Object.assign({}, props));
|
|
@@ -7283,7 +3417,7 @@ const ShareLink = class {
|
|
|
7283
3417
|
disconnectedCallback() { }
|
|
7284
3418
|
render() {
|
|
7285
3419
|
const thisProps = utils.getProps(this);
|
|
7286
|
-
const props = index_module.
|
|
3420
|
+
const props = index_module.T()
|
|
7287
3421
|
? useDemoShareLink(thisProps)
|
|
7288
3422
|
: ShadowViewAddon.useShareLink(thisProps);
|
|
7289
3423
|
return index.h(ShadowViewAddon.ShareLinkView, Object.assign({}, props));
|
|
@@ -7361,10 +3495,10 @@ const SEND_EVENT = index_module.dist.gql `
|
|
|
7361
3495
|
}
|
|
7362
3496
|
`;
|
|
7363
3497
|
function useTaskCard(props) {
|
|
7364
|
-
const user = index_module.
|
|
7365
|
-
const locale = index_module.
|
|
7366
|
-
const [sendUserEvent, { data, loading: loadingEvent }] = index_module.
|
|
7367
|
-
const { refresh } = index_module.
|
|
3498
|
+
const user = index_module.oe();
|
|
3499
|
+
const locale = index_module.M();
|
|
3500
|
+
const [sendUserEvent, { data, loading: loadingEvent }] = index_module.Oe(SEND_EVENT);
|
|
3501
|
+
const { refresh } = index_module.at();
|
|
7368
3502
|
stencilHooks_module.useEffect(() => {
|
|
7369
3503
|
if (data) {
|
|
7370
3504
|
refresh();
|
|
@@ -7421,6 +3555,7 @@ const TaskCard = class {
|
|
|
7421
3555
|
/**
|
|
7422
3556
|
* @uiName Goal Repeatable
|
|
7423
3557
|
* @uiGroup Goal
|
|
3558
|
+
* @default
|
|
7424
3559
|
*/
|
|
7425
3560
|
this.repeatable = false;
|
|
7426
3561
|
/**
|
|
@@ -7433,6 +3568,7 @@ const TaskCard = class {
|
|
|
7433
3568
|
/**
|
|
7434
3569
|
* @uiName Show Progress Bar
|
|
7435
3570
|
* @uiGroup Goal
|
|
3571
|
+
* @default
|
|
7436
3572
|
*/
|
|
7437
3573
|
this.showProgressBar = false;
|
|
7438
3574
|
/**
|
|
@@ -7445,6 +3581,7 @@ const TaskCard = class {
|
|
|
7445
3581
|
/**
|
|
7446
3582
|
* @uiName Progress Bar Steps
|
|
7447
3583
|
* @uiGroup Goal
|
|
3584
|
+
* @default
|
|
7448
3585
|
*/
|
|
7449
3586
|
this.steps = false;
|
|
7450
3587
|
/**
|
|
@@ -7492,17 +3629,18 @@ const TaskCard = class {
|
|
|
7492
3629
|
* Button Link Opens in New Tab
|
|
7493
3630
|
* @uiName Open In New Tab
|
|
7494
3631
|
* @uiGroup Button
|
|
3632
|
+
* @default
|
|
7495
3633
|
*/
|
|
7496
3634
|
this.openNewTab = false;
|
|
7497
3635
|
stencilHooks_module.h$1(this);
|
|
7498
3636
|
}
|
|
7499
3637
|
disconnectedCallback() { }
|
|
7500
3638
|
render() {
|
|
7501
|
-
const { props } = index_module.
|
|
3639
|
+
const { props } = index_module.T()
|
|
7502
3640
|
? ShadowViewAddon.useDemoBigStat(this)
|
|
7503
3641
|
: ShadowViewAddon.useBigStat({ ...utils.getProps(this), programId: this.programId });
|
|
7504
3642
|
const { value, loading } = props;
|
|
7505
|
-
const { states, callbacks } = index_module.
|
|
3643
|
+
const { states, callbacks } = index_module.T()
|
|
7506
3644
|
? useTaskCardDemo(this)
|
|
7507
3645
|
: useTaskCard(this);
|
|
7508
3646
|
return (index.h(ShadowViewAddon.TaskCardView, { callbacks: callbacks, states: {
|
|
@@ -7676,8 +3814,8 @@ const GET_USER_NAME = index_module.dist.gql `
|
|
|
7676
3814
|
`;
|
|
7677
3815
|
function useUserName(props) {
|
|
7678
3816
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7679
|
-
const user = index_module.
|
|
7680
|
-
const res = index_module.
|
|
3817
|
+
const user = index_module.oe();
|
|
3818
|
+
const res = index_module.kt(GET_USER_NAME, {}, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
7681
3819
|
const loading = res.loading;
|
|
7682
3820
|
const username = ((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.viewer) === null || _b === void 0 ? void 0 : _b.firstName) || ((_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.viewer) === null || _d === void 0 ? void 0 : _d.lastName)
|
|
7683
3821
|
? `${(_f = (_e = res.data) === null || _e === void 0 ? void 0 : _e.viewer) === null || _f === void 0 ? void 0 : _f.firstName} ${(_h = (_g = res.data) === null || _g === void 0 ? void 0 : _g.viewer) === null || _h === void 0 ? void 0 : _h.lastName}`
|
|
@@ -7706,7 +3844,7 @@ const UserName = class {
|
|
|
7706
3844
|
}
|
|
7707
3845
|
disconnectedCallback() { }
|
|
7708
3846
|
render() {
|
|
7709
|
-
const props = index_module.
|
|
3847
|
+
const props = index_module.T() ? useUserNameDemo(this) : useUserName(this);
|
|
7710
3848
|
return index.h(UserNameView, Object.assign({}, props));
|
|
7711
3849
|
}
|
|
7712
3850
|
};
|