@salla.sa/twilight-components 2.14.524 → 2.14.526

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/dist/cjs/{filepond-BVaAyFoF.js → filepond-dCwl_WGS.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-D_7P3fIq.js → filepond-plugin-file-poster-JE47euyP.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-wpUbEEJQ.js → filepond-plugin-file-validate-size-CFbzBG_a.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DnsofxYi.js → filepond-plugin-file-validate-type-B95BRuZd.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-BN8NNj8r.js → filepond-plugin-image-edit-QbQgAOte.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-Bh2lasm5.js → filepond-plugin-image-exif-orientation-C3KRxOCO.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-CEuvK6zb.js → filepond-plugin-image-preview-Bg5kON16.js} +1 -1
  8. package/dist/cjs/{functions-BsqbMNo6.js → functions-DI3Yp4Of.js} +1 -1
  9. package/dist/cjs/{index-B2m0lkUU.js → index-CL2v3rWe.js} +2 -2
  10. package/dist/cjs/intlTelInput-BhGMuXpz.js +4449 -0
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +24 -6
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-booking-field_7.cjs.entry.js +32 -16
  22. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +82 -7
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  47. package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
  48. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  49. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  55. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-map_2.cjs.entry.js +71 -15
  58. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  106. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  107. package/dist/cjs/{tracked-promise-DV7LEYsU.js → tracked-promise-BE9q9nKy.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +2 -2
  109. package/dist/cjs/utils-BD1un9WN.js +544 -0
  110. package/dist/cjs/{vanilla-picker-CXvH2EWT.js → vanilla-picker-DOFw7Ga1.js} +1 -1
  111. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +82 -6
  112. package/dist/collection/components/salla-map/salla-map.css +20 -1
  113. package/dist/collection/components/salla-map/salla-map.js +86 -13
  114. package/dist/collection/components/salla-product-options/salla-product-options.js +27 -5
  115. package/dist/collection/components/salla-tel-input/salla-tel-input.css +25 -17
  116. package/dist/collection/components/salla-tel-input/salla-tel-input.js +21 -5
  117. package/dist/components/index.js +2 -2
  118. package/dist/components/intlTelInput.js +4447 -0
  119. package/dist/components/salla-bullet-delivery.js +82 -6
  120. package/dist/components/salla-map2.js +71 -14
  121. package/dist/components/salla-product-options2.js +23 -5
  122. package/dist/components/salla-tel-input2.js +23 -7
  123. package/dist/components/utils.js +542 -0
  124. package/dist/esm/{filepond-DTzVnm2p.js → filepond-CTe79mlR.js} +1 -1
  125. package/dist/esm/{filepond-plugin-file-poster-Bgus9Ofh.js → filepond-plugin-file-poster-FpMbRCuf.js} +1 -1
  126. package/dist/esm/{filepond-plugin-file-validate-size-B8PRvgIP.js → filepond-plugin-file-validate-size-B_GPzKYu.js} +1 -1
  127. package/dist/esm/{filepond-plugin-file-validate-type-CAs60OfK.js → filepond-plugin-file-validate-type-CgBrFV7x.js} +1 -1
  128. package/dist/esm/{filepond-plugin-image-edit-5pQX-bqs.js → filepond-plugin-image-edit-DElBchkY.js} +1 -1
  129. package/dist/esm/{filepond-plugin-image-exif-orientation-CQmP0y_L.js → filepond-plugin-image-exif-orientation-BhZHvn_5.js} +1 -1
  130. package/dist/esm/{filepond-plugin-image-preview-DdIiCGg1.js → filepond-plugin-image-preview-D2oaWqOt.js} +1 -1
  131. package/dist/esm/{functions-DpljrYCU.js → functions-DzuTSHQl.js} +1 -1
  132. package/dist/esm/{index-Dm54yhRt.js → index-LKlIr4DH.js} +2 -2
  133. package/dist/esm/intlTelInput-Dv1YqwOl.js +4447 -0
  134. package/dist/esm/loader.js +3 -3
  135. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  136. package/dist/esm/salla-accordion_6.entry.js +1 -1
  137. package/dist/esm/salla-add-product-button_5.entry.js +24 -6
  138. package/dist/esm/salla-advertisement.entry.js +1 -1
  139. package/dist/esm/salla-alert_2.entry.js +1 -1
  140. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  141. package/dist/esm/salla-apps-icons.entry.js +1 -1
  142. package/dist/esm/salla-badge.entry.js +1 -1
  143. package/dist/esm/salla-basket-gap.entry.js +1 -1
  144. package/dist/esm/salla-booking-field_7.entry.js +32 -16
  145. package/dist/esm/salla-bullet-delivery_2.entry.js +82 -7
  146. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  147. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  148. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  149. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  150. package/dist/esm/salla-comment-factors.entry.js +1 -1
  151. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  152. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  153. package/dist/esm/salla-contacts.entry.js +1 -1
  154. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  155. package/dist/esm/salla-count-down_2.entry.js +1 -1
  156. package/dist/esm/salla-custom-fields.entry.js +1 -1
  157. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  158. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  159. package/dist/esm/salla-filters-widget.entry.js +1 -1
  160. package/dist/esm/salla-filters.entry.js +1 -1
  161. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  162. package/dist/esm/salla-gifting.entry.js +1 -1
  163. package/dist/esm/salla-hook.entry.js +1 -1
  164. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  165. package/dist/esm/salla-installment.entry.js +1 -1
  166. package/dist/esm/salla-list-tile.entry.js +1 -1
  167. package/dist/esm/salla-localization-modal.entry.js +1 -1
  168. package/dist/esm/salla-login-modal.entry.js +1 -1
  169. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  170. package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
  171. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  172. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  173. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  174. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  175. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  176. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  177. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  178. package/dist/esm/salla-loyalty.entry.js +1 -1
  179. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  180. package/dist/esm/salla-map_2.entry.js +71 -15
  181. package/dist/esm/salla-menu.entry.js +1 -1
  182. package/dist/esm/salla-metadata.entry.js +1 -1
  183. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  184. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  185. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  186. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  187. package/dist/esm/salla-notification-item.entry.js +1 -1
  188. package/dist/esm/salla-notifications.entry.js +1 -1
  189. package/dist/esm/salla-offer-modal.entry.js +1 -1
  190. package/dist/esm/salla-offer.entry.js +1 -1
  191. package/dist/esm/salla-order-branch.entry.js +1 -1
  192. package/dist/esm/salla-order-cancel.entry.js +1 -1
  193. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  194. package/dist/esm/salla-order-details-options.entry.js +1 -1
  195. package/dist/esm/salla-order-details.entry.js +1 -1
  196. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  197. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  198. package/dist/esm/salla-order-edit.entry.js +1 -1
  199. package/dist/esm/salla-order-shipments.entry.js +1 -1
  200. package/dist/esm/salla-order-summary.entry.js +1 -1
  201. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  202. package/dist/esm/salla-orders.entry.js +1 -1
  203. package/dist/esm/salla-payments.entry.js +1 -1
  204. package/dist/esm/salla-placeholder.entry.js +1 -1
  205. package/dist/esm/salla-price-range.entry.js +1 -1
  206. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  207. package/dist/esm/salla-product-card_2.entry.js +1 -1
  208. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  209. package/dist/esm/salla-products-list.entry.js +1 -1
  210. package/dist/esm/salla-quick-order.entry.js +1 -1
  211. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  212. package/dist/esm/salla-rating-modal.entry.js +1 -1
  213. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  214. package/dist/esm/salla-scopes.entry.js +1 -1
  215. package/dist/esm/salla-search.entry.js +1 -1
  216. package/dist/esm/salla-skeleton.entry.js +1 -1
  217. package/dist/esm/salla-slider.entry.js +1 -1
  218. package/dist/esm/salla-social-share.entry.js +1 -1
  219. package/dist/esm/salla-social.entry.js +1 -1
  220. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  221. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  222. package/dist/esm/salla-tooltip.entry.js +1 -1
  223. package/dist/esm/salla-trust-badges.entry.js +1 -1
  224. package/dist/esm/salla-user-menu.entry.js +1 -1
  225. package/dist/esm/salla-user-profile.entry.js +1 -1
  226. package/dist/esm/salla-user-settings.entry.js +1 -1
  227. package/dist/esm/salla-verify.entry.js +1 -1
  228. package/dist/esm/salla-wallet.entry.js +1 -1
  229. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  230. package/dist/esm/{tracked-promise-B8yCrzxY.js → tracked-promise-yYcxeJzZ.js} +1 -1
  231. package/dist/esm/twilight.js +3 -3
  232. package/dist/esm/utils-DxnArMXe.js +542 -0
  233. package/dist/esm/{vanilla-picker-DFISd8Ab.js → vanilla-picker-BAPOtEmC.js} +1 -1
  234. package/dist/twilight/{p-d6146737.entry.js → p-0559d448.entry.js} +1 -1
  235. package/dist/twilight/{p-34bb17c9.entry.js → p-067f052b.entry.js} +1 -1
  236. package/dist/twilight/{p-2e9f26cf.entry.js → p-06c4a0cd.entry.js} +1 -1
  237. package/dist/twilight/{p-4f5916dd.entry.js → p-10c3a012.entry.js} +1 -1
  238. package/dist/twilight/{p-cd0f27b8.entry.js → p-1227aa55.entry.js} +1 -1
  239. package/dist/twilight/{p-85ffcb0d.entry.js → p-146706fc.entry.js} +1 -1
  240. package/dist/twilight/{p-18dc5f4f.entry.js → p-166343b3.entry.js} +1 -1
  241. package/dist/twilight/{p-9f88fd32.entry.js → p-172a034d.entry.js} +1 -1
  242. package/dist/twilight/{p-6f20f79a.entry.js → p-1b5189f0.entry.js} +1 -1
  243. package/dist/twilight/{p-e4c40a79.entry.js → p-1e799c60.entry.js} +1 -1
  244. package/dist/twilight/{p-acfc17d6.entry.js → p-233039ec.entry.js} +1 -1
  245. package/dist/twilight/{p-0b74b865.entry.js → p-253afd49.entry.js} +1 -1
  246. package/dist/twilight/{p-bc633deb.entry.js → p-2766a17f.entry.js} +1 -1
  247. package/dist/twilight/{p-c55ed08e.entry.js → p-288e4fd6.entry.js} +1 -1
  248. package/dist/twilight/p-2c14546d.entry.js +4 -0
  249. package/dist/twilight/{p-a307c408.entry.js → p-2e9fcab1.entry.js} +1 -1
  250. package/dist/twilight/{p-eb1e775a.entry.js → p-2ea5c336.entry.js} +1 -1
  251. package/dist/twilight/{p-d5262ac3.entry.js → p-2f6e46b0.entry.js} +1 -1
  252. package/dist/twilight/{p-00d22240.entry.js → p-31a1bd9c.entry.js} +1 -1
  253. package/dist/twilight/{p-e6255c72.entry.js → p-326a584d.entry.js} +1 -1
  254. package/dist/twilight/{p-a5070e48.entry.js → p-385e1853.entry.js} +1 -1
  255. package/dist/twilight/{p-df1badad.entry.js → p-3a46d113.entry.js} +1 -1
  256. package/dist/twilight/{p-c38bfc00.entry.js → p-3a9c2e9d.entry.js} +1 -1
  257. package/dist/twilight/p-3f6fac09.entry.js +4 -0
  258. package/dist/twilight/{p-2798756b.entry.js → p-44bf6cdf.entry.js} +1 -1
  259. package/dist/twilight/{p-70e2d99d.entry.js → p-466fa362.entry.js} +1 -1
  260. package/dist/twilight/{p-4364da4b.entry.js → p-4c36ba4c.entry.js} +1 -1
  261. package/dist/twilight/{p-0e24390e.entry.js → p-4cc9583f.entry.js} +1 -1
  262. package/dist/twilight/{p-01277c1f.entry.js → p-4d46bd3d.entry.js} +1 -1
  263. package/dist/twilight/{p-1daa6531.entry.js → p-4e213aab.entry.js} +1 -1
  264. package/dist/twilight/{p-90929ee0.entry.js → p-500f0db8.entry.js} +1 -1
  265. package/dist/twilight/{p-b775c3a7.entry.js → p-50365a49.entry.js} +1 -1
  266. package/dist/twilight/{p-44ce2c67.entry.js → p-5555817c.entry.js} +1 -1
  267. package/dist/twilight/{p-d171016f.entry.js → p-584817e5.entry.js} +1 -1
  268. package/dist/twilight/{p-31d66e74.entry.js → p-59dbe5f1.entry.js} +1 -1
  269. package/dist/twilight/{p-2dbea343.entry.js → p-5c5f4f73.entry.js} +1 -1
  270. package/dist/twilight/{p-6c0de09b.entry.js → p-60a7b50b.entry.js} +1 -1
  271. package/dist/twilight/{p-764b05c3.entry.js → p-61cd30d3.entry.js} +1 -1
  272. package/dist/twilight/{p-6d989923.entry.js → p-6204462a.entry.js} +1 -1
  273. package/dist/twilight/{p-e8cc3acd.entry.js → p-630e769f.entry.js} +1 -1
  274. package/dist/twilight/{p-92cf1e0d.entry.js → p-65d86157.entry.js} +1 -1
  275. package/dist/twilight/{p-ce888cc2.entry.js → p-6bbc3c94.entry.js} +1 -1
  276. package/dist/twilight/{p-f9f3639d.entry.js → p-71344ddc.entry.js} +1 -1
  277. package/dist/twilight/{p-811d6f89.entry.js → p-72e4ef6a.entry.js} +1 -1
  278. package/dist/twilight/{p-fcfd176b.entry.js → p-761165fd.entry.js} +1 -1
  279. package/dist/twilight/{p-a26fb2b5.entry.js → p-797a7c1e.entry.js} +1 -1
  280. package/dist/twilight/{p-32f66a87.entry.js → p-7edb518f.entry.js} +1 -1
  281. package/dist/twilight/{p-82e55dfd.entry.js → p-85819cea.entry.js} +1 -1
  282. package/dist/twilight/{p-453ac18c.entry.js → p-879de784.entry.js} +1 -1
  283. package/dist/twilight/{p-8d2a1e57.entry.js → p-882128d2.entry.js} +1 -1
  284. package/dist/twilight/{p-bbad7f4d.entry.js → p-8993c586.entry.js} +1 -1
  285. package/dist/twilight/{p-e14dc1a9.entry.js → p-89ff463e.entry.js} +1 -1
  286. package/dist/twilight/{p-24901c56.entry.js → p-8a3cb52e.entry.js} +1 -1
  287. package/dist/twilight/{p-2b52c465.entry.js → p-8bb53ed2.entry.js} +2 -2
  288. package/dist/twilight/{p-f1639848.entry.js → p-8f7579e4.entry.js} +1 -1
  289. package/dist/twilight/{p-ff58cb8e.entry.js → p-9445f844.entry.js} +1 -1
  290. package/dist/twilight/{p-b53f24e0.entry.js → p-961941f2.entry.js} +1 -1
  291. package/dist/twilight/{p-6aa57467.entry.js → p-96fff354.entry.js} +1 -1
  292. package/dist/twilight/{p-2db47792.entry.js → p-97f12f7b.entry.js} +1 -1
  293. package/dist/twilight/{p-b9228f9e.entry.js → p-99228024.entry.js} +1 -1
  294. package/dist/twilight/{p-7622f77e.entry.js → p-9a9d4676.entry.js} +1 -1
  295. package/dist/twilight/{p-edae5524.entry.js → p-9bd015e5.entry.js} +1 -1
  296. package/dist/twilight/{p-DOQPe4jW.js → p-BGqFcZFD.js} +1 -1
  297. package/dist/twilight/{p-D6U543Hv.js → p-BJ2QKyWM.js} +1 -1
  298. package/dist/twilight/{p-CfrlyZxh.js → p-BOmRCp86.js} +1 -1
  299. package/dist/twilight/{p-CQ_QHwLy.js → p-BVtJp-gU.js} +1 -1
  300. package/dist/twilight/p-Bdz016Fy.js +4 -0
  301. package/dist/twilight/{p-CK_JEpA3.js → p-By36wPtc.js} +1 -1
  302. package/dist/twilight/{p-BdU8gNuL.js → p-CnIis-ob.js} +1 -1
  303. package/dist/twilight/{p-Bmtik9Kw.js → p-DkALFehO.js} +1 -1
  304. package/dist/twilight/{p-N0-g_Ku2.js → p-DmcP-9uS.js} +2 -2
  305. package/dist/twilight/p-DxnArMXe.js +4 -0
  306. package/dist/twilight/{p-3Tx29o41.js → p-HiDU1qAC.js} +1 -1
  307. package/dist/twilight/{p-Dm54yhRt.js → p-LKlIr4DH.js} +1 -1
  308. package/dist/twilight/{p-e775748f.entry.js → p-a435c54c.entry.js} +1 -1
  309. package/dist/twilight/{p-6417da90.entry.js → p-b063d0f3.entry.js} +1 -1
  310. package/dist/twilight/{p-d8d26e4b.entry.js → p-b1b11ebb.entry.js} +1 -1
  311. package/dist/twilight/{p-6fe98a4d.entry.js → p-b46bd39f.entry.js} +1 -1
  312. package/dist/twilight/{p-4467ceb0.entry.js → p-b5c106ac.entry.js} +1 -1
  313. package/dist/twilight/{p-f351fca5.entry.js → p-b6ce3117.entry.js} +1 -1
  314. package/dist/twilight/{p-8e05dbd7.entry.js → p-b76720e1.entry.js} +1 -1
  315. package/dist/twilight/{p-b089053b.entry.js → p-bb242f20.entry.js} +1 -1
  316. package/dist/twilight/{p-bd31410b.entry.js → p-beaf3f78.entry.js} +1 -1
  317. package/dist/twilight/{p-865393ae.entry.js → p-c06229a1.entry.js} +1 -1
  318. package/dist/twilight/{p-1ca4cb0a.entry.js → p-c06ab3be.entry.js} +1 -1
  319. package/dist/twilight/{p-083bc1c5.entry.js → p-c1036ebd.entry.js} +1 -1
  320. package/dist/twilight/{p-08c61694.entry.js → p-c19412a4.entry.js} +1 -1
  321. package/dist/twilight/{p-8493acd8.entry.js → p-c7c2dad0.entry.js} +1 -1
  322. package/dist/twilight/{p-d34ee17e.entry.js → p-cf3b863c.entry.js} +1 -1
  323. package/dist/twilight/{p-879904a5.entry.js → p-cf95b06d.entry.js} +1 -1
  324. package/dist/twilight/{p-042fe473.entry.js → p-cffe12a3.entry.js} +1 -1
  325. package/dist/twilight/{p-d8909798.entry.js → p-d477d0ab.entry.js} +1 -1
  326. package/dist/twilight/p-d81ee10d.entry.js +4 -0
  327. package/dist/twilight/{p-282d3b67.entry.js → p-de14bb3d.entry.js} +1 -1
  328. package/dist/twilight/{p-fcc76e96.entry.js → p-dfea079f.entry.js} +1 -1
  329. package/dist/twilight/{p-d9a53204.entry.js → p-e407d576.entry.js} +1 -1
  330. package/dist/twilight/{p-5acbcd72.entry.js → p-e6ae56e1.entry.js} +1 -1
  331. package/dist/twilight/{p-f6b097ee.entry.js → p-ebaa623e.entry.js} +1 -1
  332. package/dist/twilight/{p-074f8d80.entry.js → p-ec1730a3.entry.js} +1 -1
  333. package/dist/twilight/{p-066b78d8.entry.js → p-eea93ac7.entry.js} +1 -1
  334. package/dist/twilight/{p-71aeefcf.entry.js → p-eed700e7.entry.js} +1 -1
  335. package/dist/twilight/{p-2ca2dc2a.entry.js → p-ef4a0ae4.entry.js} +1 -1
  336. package/dist/twilight/{p-be71261f.entry.js → p-f418df90.entry.js} +1 -1
  337. package/dist/twilight/{p-4c3b7f11.entry.js → p-f4733e21.entry.js} +1 -1
  338. package/dist/twilight/{p-c88af64d.entry.js → p-f5154b22.entry.js} +1 -1
  339. package/dist/twilight/{p-d594a28c.entry.js → p-fd33515c.entry.js} +1 -1
  340. package/dist/twilight/{p-bf7b92c5.entry.js → p-fe40bb32.entry.js} +1 -1
  341. package/dist/twilight/{p-Bsy6Ioog.js → p-j2CozAo8.js} +1 -1
  342. package/dist/twilight/twilight.esm.js +1 -1
  343. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +16 -0
  344. package/dist/types/components/salla-map/salla-map.d.ts +15 -0
  345. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +3 -0
  346. package/dist/types/components.d.ts +4 -0
  347. package/package.json +6 -6
  348. package/dist/cjs/index-D5DmfeX9.js +0 -1714
  349. package/dist/components/index3.js +0 -1712
  350. package/dist/esm/index-DPAGXd41.js +0 -1712
  351. package/dist/twilight/p-8a789d76.entry.js +0 -4
  352. package/dist/twilight/p-96d471a9.entry.js +0 -4
  353. package/dist/twilight/p-C_YmM4Ke.js +0 -4
  354. package/dist/twilight/p-a7643570.entry.js +0 -4
@@ -0,0 +1,4447 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { d as getDefaultExportFromCjs } from './index-LKlIr4DH.js';
5
+
6
+ function _mergeNamespaces(n, m) {
7
+ m.forEach(function (e) {
8
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default' && !(k in n)) {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ });
18
+ return Object.freeze(n);
19
+ }
20
+
21
+ var intlTelInput$2 = {exports: {}};
22
+
23
+ /*
24
+ * International Telephone Input v26.9.2
25
+ * https://github.com/jackocnr/intl-tel-input.git
26
+ * Licensed under the MIT license
27
+ */
28
+
29
+ var hasRequiredIntlTelInput;
30
+
31
+ function requireIntlTelInput () {
32
+ if (hasRequiredIntlTelInput) return intlTelInput$2.exports;
33
+ hasRequiredIntlTelInput = 1;
34
+ (function (module) {
35
+ // UMD
36
+ (function(factory) {
37
+ if (module.exports) {
38
+ module.exports = factory();
39
+ } else {
40
+ window.intlTelInput = factory();
41
+ }
42
+ }(() => {
43
+
44
+ var factoryOutput = (() => {
45
+ var __defProp = Object.defineProperty;
46
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
47
+ var __getOwnPropNames = Object.getOwnPropertyNames;
48
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
49
+ var __export = (target, all) => {
50
+ for (var name in all)
51
+ __defProp(target, name, { get: all[name], enumerable: true });
52
+ };
53
+ var __copyProps = (to, from, except, desc) => {
54
+ if (from && typeof from === "object" || typeof from === "function") {
55
+ for (let key of __getOwnPropNames(from))
56
+ if (!__hasOwnProp.call(to, key) && key !== except)
57
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
58
+ }
59
+ return to;
60
+ };
61
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
62
+
63
+ // src/js/intl-tel-input.ts
64
+ var intl_tel_input_exports = {};
65
+ __export(intl_tel_input_exports, {
66
+ Iti: () => Iti,
67
+ default: () => intl_tel_input_default
68
+ });
69
+
70
+ // src/js/intl-tel-input/data.ts
71
+ var rawCountryData = [
72
+ [
73
+ "af",
74
+ // Afghanistan
75
+ "93",
76
+ 0,
77
+ null,
78
+ "0"
79
+ ],
80
+ [
81
+ "ax",
82
+ // Åland Islands
83
+ "358",
84
+ 1,
85
+ ["18", "4"],
86
+ // (4 is a mobile range shared with FI)
87
+ "0"
88
+ ],
89
+ [
90
+ "al",
91
+ // Albania
92
+ "355",
93
+ 0,
94
+ null,
95
+ "0"
96
+ ],
97
+ [
98
+ "dz",
99
+ // Algeria
100
+ "213",
101
+ 0,
102
+ null,
103
+ "0"
104
+ ],
105
+ [
106
+ "as",
107
+ // American Samoa
108
+ "1",
109
+ 5,
110
+ ["684"],
111
+ "1"
112
+ ],
113
+ [
114
+ "ad",
115
+ // Andorra
116
+ "376"
117
+ ],
118
+ [
119
+ "ao",
120
+ // Angola
121
+ "244"
122
+ ],
123
+ [
124
+ "ai",
125
+ // Anguilla
126
+ "1",
127
+ 6,
128
+ ["264"],
129
+ "1"
130
+ ],
131
+ [
132
+ "ag",
133
+ // Antigua and Barbuda
134
+ "1",
135
+ 7,
136
+ ["268"],
137
+ "1"
138
+ ],
139
+ [
140
+ "ar",
141
+ // Argentina
142
+ "54",
143
+ 0,
144
+ null,
145
+ "0"
146
+ ],
147
+ [
148
+ "am",
149
+ // Armenia
150
+ "374",
151
+ 0,
152
+ null,
153
+ "0"
154
+ ],
155
+ [
156
+ "aw",
157
+ // Aruba
158
+ "297"
159
+ ],
160
+ [
161
+ "ac",
162
+ // Ascension Island
163
+ "247"
164
+ ],
165
+ [
166
+ "au",
167
+ // Australia
168
+ "61",
169
+ 0,
170
+ ["4"],
171
+ // (mobile range shared with CX and CC)
172
+ "0"
173
+ ],
174
+ [
175
+ "at",
176
+ // Austria
177
+ "43",
178
+ 0,
179
+ null,
180
+ "0"
181
+ ],
182
+ [
183
+ "az",
184
+ // Azerbaijan
185
+ "994",
186
+ 0,
187
+ null,
188
+ "0"
189
+ ],
190
+ [
191
+ "bs",
192
+ // Bahamas
193
+ "1",
194
+ 8,
195
+ ["242"],
196
+ "1"
197
+ ],
198
+ [
199
+ "bh",
200
+ // Bahrain
201
+ "973"
202
+ ],
203
+ [
204
+ "bd",
205
+ // Bangladesh
206
+ "880",
207
+ 0,
208
+ null,
209
+ "0"
210
+ ],
211
+ [
212
+ "bb",
213
+ // Barbados
214
+ "1",
215
+ 9,
216
+ ["246"],
217
+ "1"
218
+ ],
219
+ [
220
+ "by",
221
+ // Belarus
222
+ "375",
223
+ 0,
224
+ null,
225
+ "8"
226
+ ],
227
+ [
228
+ "be",
229
+ // Belgium
230
+ "32",
231
+ 0,
232
+ null,
233
+ "0"
234
+ ],
235
+ [
236
+ "bz",
237
+ // Belize
238
+ "501"
239
+ ],
240
+ [
241
+ "bj",
242
+ // Benin
243
+ "229"
244
+ ],
245
+ [
246
+ "bm",
247
+ // Bermuda
248
+ "1",
249
+ 10,
250
+ ["441"],
251
+ "1"
252
+ ],
253
+ [
254
+ "bt",
255
+ // Bhutan
256
+ "975"
257
+ ],
258
+ [
259
+ "bo",
260
+ // Bolivia
261
+ "591",
262
+ 0,
263
+ null,
264
+ "0"
265
+ ],
266
+ [
267
+ "ba",
268
+ // Bosnia and Herzegovina
269
+ "387",
270
+ 0,
271
+ null,
272
+ "0"
273
+ ],
274
+ [
275
+ "bw",
276
+ // Botswana
277
+ "267"
278
+ ],
279
+ [
280
+ "br",
281
+ // Brazil
282
+ "55",
283
+ 0,
284
+ null,
285
+ "0"
286
+ ],
287
+ [
288
+ "io",
289
+ // British Indian Ocean Territory
290
+ "246"
291
+ ],
292
+ [
293
+ "vg",
294
+ // British Virgin Islands
295
+ "1",
296
+ 11,
297
+ ["284"],
298
+ "1"
299
+ ],
300
+ [
301
+ "bn",
302
+ // Brunei
303
+ "673"
304
+ ],
305
+ [
306
+ "bg",
307
+ // Bulgaria
308
+ "359",
309
+ 0,
310
+ null,
311
+ "0"
312
+ ],
313
+ [
314
+ "bf",
315
+ // Burkina Faso
316
+ "226"
317
+ ],
318
+ [
319
+ "bi",
320
+ // Burundi
321
+ "257"
322
+ ],
323
+ [
324
+ "kh",
325
+ // Cambodia
326
+ "855",
327
+ 0,
328
+ null,
329
+ "0"
330
+ ],
331
+ [
332
+ "cm",
333
+ // Cameroon
334
+ "237"
335
+ ],
336
+ [
337
+ "ca",
338
+ // Canada
339
+ "1",
340
+ 1,
341
+ ["204", "226", "236", "249", "250", "257", "263", "289", "306", "343", "354", "365", "367", "368", "382", "403", "416", "418", "428", "431", "437", "438", "450", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "879", "902", "905", "942"],
342
+ "1"
343
+ ],
344
+ [
345
+ "cv",
346
+ // Cape Verde
347
+ "238"
348
+ ],
349
+ [
350
+ "bq",
351
+ // Caribbean Netherlands
352
+ "599",
353
+ 1,
354
+ ["3", "4", "7"]
355
+ ],
356
+ [
357
+ "ky",
358
+ // Cayman Islands
359
+ "1",
360
+ 12,
361
+ ["345"],
362
+ "1"
363
+ ],
364
+ [
365
+ "cf",
366
+ // Central African Republic
367
+ "236"
368
+ ],
369
+ [
370
+ "td",
371
+ // Chad
372
+ "235"
373
+ ],
374
+ [
375
+ "cl",
376
+ // Chile
377
+ "56"
378
+ ],
379
+ [
380
+ "cn",
381
+ // China
382
+ "86",
383
+ 0,
384
+ null,
385
+ "0"
386
+ ],
387
+ [
388
+ "cx",
389
+ // Christmas Island
390
+ "61",
391
+ 2,
392
+ ["4", "89164"],
393
+ // (4 is a mobile range shared with AU and CC)
394
+ "0"
395
+ ],
396
+ [
397
+ "cc",
398
+ // Cocos (Keeling) Islands
399
+ "61",
400
+ 1,
401
+ ["4", "89162"],
402
+ // (4 is a mobile range shared with AU and CX)
403
+ "0"
404
+ ],
405
+ [
406
+ "co",
407
+ // Colombia
408
+ "57",
409
+ 0,
410
+ null,
411
+ "0"
412
+ ],
413
+ [
414
+ "km",
415
+ // Comoros
416
+ "269"
417
+ ],
418
+ [
419
+ "cg",
420
+ // Congo (Brazzaville)
421
+ "242"
422
+ ],
423
+ [
424
+ "cd",
425
+ // Congo (Kinshasa)
426
+ "243",
427
+ 0,
428
+ null,
429
+ "0"
430
+ ],
431
+ [
432
+ "ck",
433
+ // Cook Islands
434
+ "682"
435
+ ],
436
+ [
437
+ "cr",
438
+ // Costa Rica
439
+ "506"
440
+ ],
441
+ [
442
+ "ci",
443
+ // Côte d'Ivoire
444
+ "225"
445
+ ],
446
+ [
447
+ "hr",
448
+ // Croatia
449
+ "385",
450
+ 0,
451
+ null,
452
+ "0"
453
+ ],
454
+ [
455
+ "cu",
456
+ // Cuba
457
+ "53",
458
+ 0,
459
+ null,
460
+ "0"
461
+ ],
462
+ [
463
+ "cw",
464
+ // Curaçao
465
+ "599",
466
+ 0
467
+ ],
468
+ [
469
+ "cy",
470
+ // Cyprus
471
+ "357"
472
+ ],
473
+ [
474
+ "cz",
475
+ // Czech Republic
476
+ "420"
477
+ ],
478
+ [
479
+ "dk",
480
+ // Denmark
481
+ "45"
482
+ ],
483
+ [
484
+ "dj",
485
+ // Djibouti
486
+ "253"
487
+ ],
488
+ [
489
+ "dm",
490
+ // Dominica
491
+ "1",
492
+ 13,
493
+ ["767"],
494
+ "1"
495
+ ],
496
+ [
497
+ "do",
498
+ // Dominican Republic
499
+ "1",
500
+ 2,
501
+ ["809", "829", "849"],
502
+ "1"
503
+ ],
504
+ [
505
+ "ec",
506
+ // Ecuador
507
+ "593",
508
+ 0,
509
+ null,
510
+ "0"
511
+ ],
512
+ [
513
+ "eg",
514
+ // Egypt
515
+ "20",
516
+ 0,
517
+ null,
518
+ "0"
519
+ ],
520
+ [
521
+ "sv",
522
+ // El Salvador
523
+ "503"
524
+ ],
525
+ [
526
+ "gq",
527
+ // Equatorial Guinea
528
+ "240"
529
+ ],
530
+ [
531
+ "er",
532
+ // Eritrea
533
+ "291",
534
+ 0,
535
+ null,
536
+ "0"
537
+ ],
538
+ [
539
+ "ee",
540
+ // Estonia
541
+ "372"
542
+ ],
543
+ [
544
+ "sz",
545
+ // Eswatini
546
+ "268"
547
+ ],
548
+ [
549
+ "et",
550
+ // Ethiopia
551
+ "251",
552
+ 0,
553
+ null,
554
+ "0"
555
+ ],
556
+ [
557
+ "fk",
558
+ // Falkland Islands (Malvinas)
559
+ "500"
560
+ ],
561
+ [
562
+ "fo",
563
+ // Faroe Islands
564
+ "298"
565
+ ],
566
+ [
567
+ "fj",
568
+ // Fiji
569
+ "679"
570
+ ],
571
+ [
572
+ "fi",
573
+ // Finland
574
+ "358",
575
+ 0,
576
+ ["4"],
577
+ // (mobile range shared with AX)
578
+ "0"
579
+ ],
580
+ [
581
+ "fr",
582
+ // France
583
+ "33",
584
+ 0,
585
+ null,
586
+ "0"
587
+ ],
588
+ [
589
+ "gf",
590
+ // French Guiana
591
+ "594",
592
+ 0,
593
+ null,
594
+ "0"
595
+ ],
596
+ [
597
+ "pf",
598
+ // French Polynesia
599
+ "689"
600
+ ],
601
+ [
602
+ "ga",
603
+ // Gabon
604
+ "241"
605
+ ],
606
+ [
607
+ "gm",
608
+ // Gambia
609
+ "220"
610
+ ],
611
+ [
612
+ "ge",
613
+ // Georgia
614
+ "995",
615
+ 0,
616
+ null,
617
+ "0"
618
+ ],
619
+ [
620
+ "de",
621
+ // Germany
622
+ "49",
623
+ 0,
624
+ null,
625
+ "0"
626
+ ],
627
+ [
628
+ "gh",
629
+ // Ghana
630
+ "233",
631
+ 0,
632
+ null,
633
+ "0"
634
+ ],
635
+ [
636
+ "gi",
637
+ // Gibraltar
638
+ "350"
639
+ ],
640
+ [
641
+ "gr",
642
+ // Greece
643
+ "30"
644
+ ],
645
+ [
646
+ "gl",
647
+ // Greenland
648
+ "299"
649
+ ],
650
+ [
651
+ "gd",
652
+ // Grenada
653
+ "1",
654
+ 14,
655
+ ["473"],
656
+ "1"
657
+ ],
658
+ [
659
+ "gp",
660
+ // Guadeloupe
661
+ "590",
662
+ 0,
663
+ null,
664
+ "0"
665
+ ],
666
+ [
667
+ "gu",
668
+ // Guam
669
+ "1",
670
+ 15,
671
+ ["671"],
672
+ "1"
673
+ ],
674
+ [
675
+ "gt",
676
+ // Guatemala
677
+ "502"
678
+ ],
679
+ [
680
+ "gg",
681
+ // Guernsey
682
+ "44",
683
+ 1,
684
+ ["1481", "7781", "7839", "7911"],
685
+ "0"
686
+ ],
687
+ [
688
+ "gn",
689
+ // Guinea
690
+ "224"
691
+ ],
692
+ [
693
+ "gw",
694
+ // Guinea-Bissau
695
+ "245"
696
+ ],
697
+ [
698
+ "gy",
699
+ // Guyana
700
+ "592"
701
+ ],
702
+ [
703
+ "ht",
704
+ // Haiti
705
+ "509"
706
+ ],
707
+ [
708
+ "hn",
709
+ // Honduras
710
+ "504"
711
+ ],
712
+ [
713
+ "hk",
714
+ // Hong Kong SAR China
715
+ "852"
716
+ ],
717
+ [
718
+ "hu",
719
+ // Hungary
720
+ "36",
721
+ 0,
722
+ null,
723
+ "06"
724
+ ],
725
+ [
726
+ "is",
727
+ // Iceland
728
+ "354"
729
+ ],
730
+ [
731
+ "in",
732
+ // India
733
+ "91",
734
+ 0,
735
+ null,
736
+ "0"
737
+ ],
738
+ [
739
+ "id",
740
+ // Indonesia
741
+ "62",
742
+ 0,
743
+ null,
744
+ "0"
745
+ ],
746
+ [
747
+ "ir",
748
+ // Iran
749
+ "98",
750
+ 0,
751
+ null,
752
+ "0"
753
+ ],
754
+ [
755
+ "iq",
756
+ // Iraq
757
+ "964",
758
+ 0,
759
+ null,
760
+ "0"
761
+ ],
762
+ [
763
+ "ie",
764
+ // Ireland
765
+ "353",
766
+ 0,
767
+ null,
768
+ "0"
769
+ ],
770
+ [
771
+ "im",
772
+ // Isle of Man
773
+ "44",
774
+ 2,
775
+ ["1624", "74576", "7524", "7624", "7924"],
776
+ "0"
777
+ ],
778
+ [
779
+ "il",
780
+ // Israel
781
+ "972",
782
+ 0,
783
+ null,
784
+ "0"
785
+ ],
786
+ [
787
+ "it",
788
+ // Italy
789
+ "39",
790
+ 0,
791
+ ["3"]
792
+ // (mobile range shared with VA)
793
+ ],
794
+ [
795
+ "jm",
796
+ // Jamaica
797
+ "1",
798
+ 4,
799
+ ["658", "876"],
800
+ "1"
801
+ ],
802
+ [
803
+ "jp",
804
+ // Japan
805
+ "81",
806
+ 0,
807
+ null,
808
+ "0"
809
+ ],
810
+ [
811
+ "je",
812
+ // Jersey
813
+ "44",
814
+ 3,
815
+ ["1534", "7509", "7700", "7797", "7829", "7937"],
816
+ "0"
817
+ ],
818
+ [
819
+ "jo",
820
+ // Jordan
821
+ "962",
822
+ 0,
823
+ null,
824
+ "0"
825
+ ],
826
+ [
827
+ "kz",
828
+ // Kazakhstan
829
+ "7",
830
+ 1,
831
+ ["33", "7"],
832
+ // (33 is shared with RU)
833
+ "8"
834
+ ],
835
+ [
836
+ "ke",
837
+ // Kenya
838
+ "254",
839
+ 0,
840
+ null,
841
+ "0"
842
+ ],
843
+ [
844
+ "ki",
845
+ // Kiribati
846
+ "686",
847
+ 0,
848
+ null,
849
+ "0"
850
+ ],
851
+ [
852
+ "xk",
853
+ // Kosovo
854
+ "383",
855
+ 0,
856
+ null,
857
+ "0"
858
+ ],
859
+ [
860
+ "kw",
861
+ // Kuwait
862
+ "965"
863
+ ],
864
+ [
865
+ "kg",
866
+ // Kyrgyzstan
867
+ "996",
868
+ 0,
869
+ null,
870
+ "0"
871
+ ],
872
+ [
873
+ "la",
874
+ // Laos
875
+ "856",
876
+ 0,
877
+ null,
878
+ "0"
879
+ ],
880
+ [
881
+ "lv",
882
+ // Latvia
883
+ "371"
884
+ ],
885
+ [
886
+ "lb",
887
+ // Lebanon
888
+ "961",
889
+ 0,
890
+ null,
891
+ "0"
892
+ ],
893
+ [
894
+ "ls",
895
+ // Lesotho
896
+ "266"
897
+ ],
898
+ [
899
+ "lr",
900
+ // Liberia
901
+ "231",
902
+ 0,
903
+ null,
904
+ "0"
905
+ ],
906
+ [
907
+ "ly",
908
+ // Libya
909
+ "218",
910
+ 0,
911
+ null,
912
+ "0"
913
+ ],
914
+ [
915
+ "li",
916
+ // Liechtenstein
917
+ "423",
918
+ 0,
919
+ null,
920
+ "0"
921
+ ],
922
+ [
923
+ "lt",
924
+ // Lithuania
925
+ "370",
926
+ 0,
927
+ null,
928
+ "0"
929
+ ],
930
+ [
931
+ "lu",
932
+ // Luxembourg
933
+ "352"
934
+ ],
935
+ [
936
+ "mo",
937
+ // Macao SAR China
938
+ "853"
939
+ ],
940
+ [
941
+ "mg",
942
+ // Madagascar
943
+ "261",
944
+ 0,
945
+ null,
946
+ "0"
947
+ ],
948
+ [
949
+ "mw",
950
+ // Malawi
951
+ "265",
952
+ 0,
953
+ null,
954
+ "0"
955
+ ],
956
+ [
957
+ "my",
958
+ // Malaysia
959
+ "60",
960
+ 0,
961
+ null,
962
+ "0"
963
+ ],
964
+ [
965
+ "mv",
966
+ // Maldives
967
+ "960"
968
+ ],
969
+ [
970
+ "ml",
971
+ // Mali
972
+ "223"
973
+ ],
974
+ [
975
+ "mt",
976
+ // Malta
977
+ "356"
978
+ ],
979
+ [
980
+ "mh",
981
+ // Marshall Islands
982
+ "692",
983
+ 0,
984
+ null,
985
+ "1"
986
+ ],
987
+ [
988
+ "mq",
989
+ // Martinique
990
+ "596",
991
+ 0,
992
+ null,
993
+ "0"
994
+ ],
995
+ [
996
+ "mr",
997
+ // Mauritania
998
+ "222"
999
+ ],
1000
+ [
1001
+ "mu",
1002
+ // Mauritius
1003
+ "230"
1004
+ ],
1005
+ [
1006
+ "yt",
1007
+ // Mayotte
1008
+ "262",
1009
+ 1,
1010
+ ["269", "639"],
1011
+ "0"
1012
+ ],
1013
+ [
1014
+ "mx",
1015
+ // Mexico
1016
+ "52"
1017
+ ],
1018
+ [
1019
+ "fm",
1020
+ // Micronesia
1021
+ "691"
1022
+ ],
1023
+ [
1024
+ "md",
1025
+ // Moldova
1026
+ "373",
1027
+ 0,
1028
+ null,
1029
+ "0"
1030
+ ],
1031
+ [
1032
+ "mc",
1033
+ // Monaco
1034
+ "377",
1035
+ 0,
1036
+ null,
1037
+ "0"
1038
+ ],
1039
+ [
1040
+ "mn",
1041
+ // Mongolia
1042
+ "976",
1043
+ 0,
1044
+ null,
1045
+ "0"
1046
+ ],
1047
+ [
1048
+ "me",
1049
+ // Montenegro
1050
+ "382",
1051
+ 0,
1052
+ null,
1053
+ "0"
1054
+ ],
1055
+ [
1056
+ "ms",
1057
+ // Montserrat
1058
+ "1",
1059
+ 16,
1060
+ ["664"],
1061
+ "1"
1062
+ ],
1063
+ [
1064
+ "ma",
1065
+ // Morocco
1066
+ "212",
1067
+ 0,
1068
+ ["6", "7"],
1069
+ // (mobile ranges shared with EH)
1070
+ "0"
1071
+ ],
1072
+ [
1073
+ "mz",
1074
+ // Mozambique
1075
+ "258"
1076
+ ],
1077
+ [
1078
+ "mm",
1079
+ // Myanmar (Burma)
1080
+ "95",
1081
+ 0,
1082
+ null,
1083
+ "0"
1084
+ ],
1085
+ [
1086
+ "na",
1087
+ // Namibia
1088
+ "264",
1089
+ 0,
1090
+ null,
1091
+ "0"
1092
+ ],
1093
+ [
1094
+ "nr",
1095
+ // Nauru
1096
+ "674"
1097
+ ],
1098
+ [
1099
+ "np",
1100
+ // Nepal
1101
+ "977",
1102
+ 0,
1103
+ null,
1104
+ "0"
1105
+ ],
1106
+ [
1107
+ "nl",
1108
+ // Netherlands
1109
+ "31",
1110
+ 0,
1111
+ null,
1112
+ "0"
1113
+ ],
1114
+ [
1115
+ "nc",
1116
+ // New Caledonia
1117
+ "687"
1118
+ ],
1119
+ [
1120
+ "nz",
1121
+ // New Zealand
1122
+ "64",
1123
+ 0,
1124
+ null,
1125
+ "0"
1126
+ ],
1127
+ [
1128
+ "ni",
1129
+ // Nicaragua
1130
+ "505"
1131
+ ],
1132
+ [
1133
+ "ne",
1134
+ // Niger
1135
+ "227"
1136
+ ],
1137
+ [
1138
+ "ng",
1139
+ // Nigeria
1140
+ "234",
1141
+ 0,
1142
+ null,
1143
+ "0"
1144
+ ],
1145
+ [
1146
+ "nu",
1147
+ // Niue
1148
+ "683"
1149
+ ],
1150
+ [
1151
+ "nf",
1152
+ // Norfolk Island
1153
+ "672"
1154
+ ],
1155
+ [
1156
+ "kp",
1157
+ // North Korea
1158
+ "850",
1159
+ 0,
1160
+ null,
1161
+ "0"
1162
+ ],
1163
+ [
1164
+ "mk",
1165
+ // North Macedonia
1166
+ "389",
1167
+ 0,
1168
+ null,
1169
+ "0"
1170
+ ],
1171
+ [
1172
+ "mp",
1173
+ // Northern Mariana Islands
1174
+ "1",
1175
+ 17,
1176
+ ["670"],
1177
+ "1"
1178
+ ],
1179
+ [
1180
+ "no",
1181
+ // Norway
1182
+ "47",
1183
+ 0,
1184
+ ["4", "9"]
1185
+ // (mobile ranges shared with SJ)
1186
+ ],
1187
+ [
1188
+ "om",
1189
+ // Oman
1190
+ "968"
1191
+ ],
1192
+ [
1193
+ "pk",
1194
+ // Pakistan
1195
+ "92",
1196
+ 0,
1197
+ null,
1198
+ "0"
1199
+ ],
1200
+ [
1201
+ "pw",
1202
+ // Palau
1203
+ "680"
1204
+ ],
1205
+ [
1206
+ "ps",
1207
+ // Palestinian Territories
1208
+ "970",
1209
+ 0,
1210
+ null,
1211
+ "0"
1212
+ ],
1213
+ [
1214
+ "pa",
1215
+ // Panama
1216
+ "507"
1217
+ ],
1218
+ [
1219
+ "pg",
1220
+ // Papua New Guinea
1221
+ "675"
1222
+ ],
1223
+ [
1224
+ "py",
1225
+ // Paraguay
1226
+ "595",
1227
+ 0,
1228
+ null,
1229
+ "0"
1230
+ ],
1231
+ [
1232
+ "pe",
1233
+ // Peru
1234
+ "51",
1235
+ 0,
1236
+ null,
1237
+ "0"
1238
+ ],
1239
+ [
1240
+ "ph",
1241
+ // Philippines
1242
+ "63",
1243
+ 0,
1244
+ null,
1245
+ "0"
1246
+ ],
1247
+ [
1248
+ "pl",
1249
+ // Poland
1250
+ "48"
1251
+ ],
1252
+ [
1253
+ "pt",
1254
+ // Portugal
1255
+ "351"
1256
+ ],
1257
+ [
1258
+ "pr",
1259
+ // Puerto Rico
1260
+ "1",
1261
+ 3,
1262
+ ["787", "939"],
1263
+ "1"
1264
+ ],
1265
+ [
1266
+ "qa",
1267
+ // Qatar
1268
+ "974"
1269
+ ],
1270
+ [
1271
+ "re",
1272
+ // Réunion
1273
+ "262",
1274
+ 0,
1275
+ null,
1276
+ "0"
1277
+ ],
1278
+ [
1279
+ "ro",
1280
+ // Romania
1281
+ "40",
1282
+ 0,
1283
+ null,
1284
+ "0"
1285
+ ],
1286
+ [
1287
+ "ru",
1288
+ // Russia
1289
+ "7",
1290
+ 0,
1291
+ ["33"],
1292
+ // (shared with KZ)
1293
+ "8"
1294
+ ],
1295
+ [
1296
+ "rw",
1297
+ // Rwanda
1298
+ "250",
1299
+ 0,
1300
+ null,
1301
+ "0"
1302
+ ],
1303
+ [
1304
+ "ws",
1305
+ // Samoa
1306
+ "685"
1307
+ ],
1308
+ [
1309
+ "sm",
1310
+ // San Marino
1311
+ "378"
1312
+ ],
1313
+ [
1314
+ "st",
1315
+ // São Tomé & Príncipe
1316
+ "239"
1317
+ ],
1318
+ [
1319
+ "sa",
1320
+ // Saudi Arabia
1321
+ "966",
1322
+ 0,
1323
+ null,
1324
+ "0"
1325
+ ],
1326
+ [
1327
+ "sn",
1328
+ // Senegal
1329
+ "221"
1330
+ ],
1331
+ [
1332
+ "rs",
1333
+ // Serbia
1334
+ "381",
1335
+ 0,
1336
+ null,
1337
+ "0"
1338
+ ],
1339
+ [
1340
+ "sc",
1341
+ // Seychelles
1342
+ "248"
1343
+ ],
1344
+ [
1345
+ "sl",
1346
+ // Sierra Leone
1347
+ "232",
1348
+ 0,
1349
+ null,
1350
+ "0"
1351
+ ],
1352
+ [
1353
+ "sg",
1354
+ // Singapore
1355
+ "65"
1356
+ ],
1357
+ [
1358
+ "sx",
1359
+ // Sint Maarten
1360
+ "1",
1361
+ 21,
1362
+ ["721"],
1363
+ "1"
1364
+ ],
1365
+ [
1366
+ "sk",
1367
+ // Slovakia
1368
+ "421",
1369
+ 0,
1370
+ null,
1371
+ "0"
1372
+ ],
1373
+ [
1374
+ "si",
1375
+ // Slovenia
1376
+ "386",
1377
+ 0,
1378
+ null,
1379
+ "0"
1380
+ ],
1381
+ [
1382
+ "sb",
1383
+ // Solomon Islands
1384
+ "677"
1385
+ ],
1386
+ [
1387
+ "so",
1388
+ // Somalia
1389
+ "252",
1390
+ 0,
1391
+ null,
1392
+ "0"
1393
+ ],
1394
+ [
1395
+ "za",
1396
+ // South Africa
1397
+ "27",
1398
+ 0,
1399
+ null,
1400
+ "0"
1401
+ ],
1402
+ [
1403
+ "kr",
1404
+ // South Korea
1405
+ "82",
1406
+ 0,
1407
+ null,
1408
+ "0"
1409
+ ],
1410
+ [
1411
+ "ss",
1412
+ // South Sudan
1413
+ "211",
1414
+ 0,
1415
+ null,
1416
+ "0"
1417
+ ],
1418
+ [
1419
+ "es",
1420
+ // Spain
1421
+ "34"
1422
+ ],
1423
+ [
1424
+ "lk",
1425
+ // Sri Lanka
1426
+ "94",
1427
+ 0,
1428
+ null,
1429
+ "0"
1430
+ ],
1431
+ [
1432
+ "bl",
1433
+ // St. Barthélemy
1434
+ "590",
1435
+ 1,
1436
+ null,
1437
+ "0"
1438
+ ],
1439
+ [
1440
+ "sh",
1441
+ // St. Helena
1442
+ "290"
1443
+ ],
1444
+ [
1445
+ "kn",
1446
+ // St. Kitts & Nevis
1447
+ "1",
1448
+ 18,
1449
+ ["869"],
1450
+ "1"
1451
+ ],
1452
+ [
1453
+ "lc",
1454
+ // St. Lucia
1455
+ "1",
1456
+ 19,
1457
+ ["758"],
1458
+ "1"
1459
+ ],
1460
+ [
1461
+ "mf",
1462
+ // St. Martin
1463
+ "590",
1464
+ 2,
1465
+ null,
1466
+ "0"
1467
+ ],
1468
+ [
1469
+ "pm",
1470
+ // St. Pierre & Miquelon
1471
+ "508",
1472
+ 0,
1473
+ null,
1474
+ "0"
1475
+ ],
1476
+ [
1477
+ "vc",
1478
+ // St. Vincent & Grenadines
1479
+ "1",
1480
+ 20,
1481
+ ["784"],
1482
+ "1"
1483
+ ],
1484
+ [
1485
+ "sd",
1486
+ // Sudan
1487
+ "249",
1488
+ 0,
1489
+ null,
1490
+ "0"
1491
+ ],
1492
+ [
1493
+ "sr",
1494
+ // Suriname
1495
+ "597"
1496
+ ],
1497
+ [
1498
+ "sj",
1499
+ // Svalbard & Jan Mayen
1500
+ "47",
1501
+ 1,
1502
+ ["4", "79", "9"]
1503
+ // (4 and 9 are mobile ranges shared with NO)
1504
+ ],
1505
+ [
1506
+ "se",
1507
+ // Sweden
1508
+ "46",
1509
+ 0,
1510
+ null,
1511
+ "0"
1512
+ ],
1513
+ [
1514
+ "ch",
1515
+ // Switzerland
1516
+ "41",
1517
+ 0,
1518
+ null,
1519
+ "0"
1520
+ ],
1521
+ [
1522
+ "sy",
1523
+ // Syria
1524
+ "963",
1525
+ 0,
1526
+ null,
1527
+ "0"
1528
+ ],
1529
+ [
1530
+ "tw",
1531
+ // Taiwan
1532
+ "886",
1533
+ 0,
1534
+ null,
1535
+ "0"
1536
+ ],
1537
+ [
1538
+ "tj",
1539
+ // Tajikistan
1540
+ "992"
1541
+ ],
1542
+ [
1543
+ "tz",
1544
+ // Tanzania
1545
+ "255",
1546
+ 0,
1547
+ null,
1548
+ "0"
1549
+ ],
1550
+ [
1551
+ "th",
1552
+ // Thailand
1553
+ "66",
1554
+ 0,
1555
+ null,
1556
+ "0"
1557
+ ],
1558
+ [
1559
+ "tl",
1560
+ // Timor-Leste
1561
+ "670"
1562
+ ],
1563
+ [
1564
+ "tg",
1565
+ // Togo
1566
+ "228"
1567
+ ],
1568
+ [
1569
+ "tk",
1570
+ // Tokelau
1571
+ "690"
1572
+ ],
1573
+ [
1574
+ "to",
1575
+ // Tonga
1576
+ "676"
1577
+ ],
1578
+ [
1579
+ "tt",
1580
+ // Trinidad & Tobago
1581
+ "1",
1582
+ 22,
1583
+ ["868"],
1584
+ "1"
1585
+ ],
1586
+ [
1587
+ "tn",
1588
+ // Tunisia
1589
+ "216"
1590
+ ],
1591
+ [
1592
+ "tr",
1593
+ // Turkey
1594
+ "90",
1595
+ 0,
1596
+ null,
1597
+ "0"
1598
+ ],
1599
+ [
1600
+ "tm",
1601
+ // Turkmenistan
1602
+ "993",
1603
+ 0,
1604
+ null,
1605
+ "8"
1606
+ ],
1607
+ [
1608
+ "tc",
1609
+ // Turks & Caicos Islands
1610
+ "1",
1611
+ 23,
1612
+ ["649"],
1613
+ "1"
1614
+ ],
1615
+ [
1616
+ "tv",
1617
+ // Tuvalu
1618
+ "688"
1619
+ ],
1620
+ [
1621
+ "vi",
1622
+ // U.S. Virgin Islands
1623
+ "1",
1624
+ 24,
1625
+ ["340"],
1626
+ "1"
1627
+ ],
1628
+ [
1629
+ "ug",
1630
+ // Uganda
1631
+ "256",
1632
+ 0,
1633
+ null,
1634
+ "0"
1635
+ ],
1636
+ [
1637
+ "ua",
1638
+ // Ukraine
1639
+ "380",
1640
+ 0,
1641
+ null,
1642
+ "0"
1643
+ ],
1644
+ [
1645
+ "ae",
1646
+ // United Arab Emirates
1647
+ "971",
1648
+ 0,
1649
+ null,
1650
+ "0"
1651
+ ],
1652
+ [
1653
+ "gb",
1654
+ // United Kingdom
1655
+ "44",
1656
+ 0,
1657
+ null,
1658
+ "0"
1659
+ ],
1660
+ [
1661
+ "us",
1662
+ // United States
1663
+ "1",
1664
+ 0,
1665
+ null,
1666
+ "1"
1667
+ ],
1668
+ [
1669
+ "uy",
1670
+ // Uruguay
1671
+ "598",
1672
+ 0,
1673
+ null,
1674
+ "0"
1675
+ ],
1676
+ [
1677
+ "uz",
1678
+ // Uzbekistan
1679
+ "998"
1680
+ ],
1681
+ [
1682
+ "vu",
1683
+ // Vanuatu
1684
+ "678"
1685
+ ],
1686
+ [
1687
+ "va",
1688
+ // Vatican City
1689
+ "39",
1690
+ 1,
1691
+ ["06698", "3"]
1692
+ // (3 is a mobile range shared with IT)
1693
+ ],
1694
+ [
1695
+ "ve",
1696
+ // Venezuela
1697
+ "58",
1698
+ 0,
1699
+ null,
1700
+ "0"
1701
+ ],
1702
+ [
1703
+ "vn",
1704
+ // Vietnam
1705
+ "84",
1706
+ 0,
1707
+ null,
1708
+ "0"
1709
+ ],
1710
+ [
1711
+ "wf",
1712
+ // Wallis & Futuna
1713
+ "681"
1714
+ ],
1715
+ [
1716
+ "eh",
1717
+ // Western Sahara
1718
+ "212",
1719
+ 1,
1720
+ ["5288", "5289", "6", "7"],
1721
+ // (6 and 7 are mobile ranges shared with MA)
1722
+ "0"
1723
+ ],
1724
+ [
1725
+ "ye",
1726
+ // Yemen
1727
+ "967",
1728
+ 0,
1729
+ null,
1730
+ "0"
1731
+ ],
1732
+ [
1733
+ "zm",
1734
+ // Zambia
1735
+ "260",
1736
+ 0,
1737
+ null,
1738
+ "0"
1739
+ ],
1740
+ [
1741
+ "zw",
1742
+ // Zimbabwe
1743
+ "263",
1744
+ 0,
1745
+ null,
1746
+ "0"
1747
+ ]
1748
+ ];
1749
+ var allCountries = [];
1750
+ for (const c of rawCountryData) {
1751
+ allCountries.push({
1752
+ name: "",
1753
+ // populated in the plugin
1754
+ iso2: c[0],
1755
+ dialCode: c[1],
1756
+ priority: c[2] || 0,
1757
+ areaCodes: c[3] || null,
1758
+ nodeById: {},
1759
+ // populated by the plugin
1760
+ nationalPrefix: c[4] || null,
1761
+ normalisedName: "",
1762
+ // populated in the plugin
1763
+ initials: "",
1764
+ // populated in the plugin
1765
+ dialCodePlus: ""
1766
+ // populated in the plugin
1767
+ });
1768
+ }
1769
+ var iso2Set = new Set(allCountries.map((c) => c.iso2));
1770
+ var isIso2 = (val) => iso2Set.has(val);
1771
+ var data_default = allCountries;
1772
+
1773
+ // src/js/modules/constants.ts
1774
+ var EVENTS = {
1775
+ OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1776
+ CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
1777
+ COUNTRY_CHANGE: "countrychange",
1778
+ INPUT: "input"
1779
+ // used for synthetic input trigger
1780
+ };
1781
+ var CLASSES = {
1782
+ HIDE: "iti__hide",
1783
+ V_HIDE: "iti__v-hide",
1784
+ ARROW_UP: "iti__arrow--up",
1785
+ GLOBE: "iti__globe",
1786
+ FLAG: "iti__flag",
1787
+ LOADING: "iti__loading",
1788
+ COUNTRY_ITEM: "iti__country",
1789
+ HIGHLIGHT: "iti__highlight"
1790
+ };
1791
+ var KEYS = {
1792
+ ARROW_UP: "ArrowUp",
1793
+ ARROW_DOWN: "ArrowDown",
1794
+ SPACE: " ",
1795
+ ENTER: "Enter",
1796
+ ESC: "Escape",
1797
+ TAB: "Tab"
1798
+ };
1799
+ var INPUT_TYPES = {
1800
+ PASTE: "insertFromPaste",
1801
+ DELETE_FWD: "deleteContentForward"
1802
+ };
1803
+ var REGEX = {
1804
+ ALPHA_UNICODE: /\p{L}/u,
1805
+ // any kind of letter from any language
1806
+ NON_PLUS_NUMERIC: /[^+0-9]/,
1807
+ // chars that are NOT + or digit
1808
+ NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
1809
+ // chars that are NOT + or digit (global)
1810
+ HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
1811
+ // single acceptable hidden-search char
1812
+ };
1813
+ var TIMINGS = {
1814
+ SEARCH_DEBOUNCE_MS: 100,
1815
+ HIDDEN_SEARCH_RESET_MS: 1e3};
1816
+ var SENTINELS = {
1817
+ UNKNOWN_NUMBER_TYPE: -99,
1818
+ UNKNOWN_VALIDATION_ERROR: -99
1819
+ };
1820
+ var LAYOUT = {
1821
+ NARROW_VIEWPORT_WIDTH: 500,
1822
+ // keep in sync with .iti__country-list CSS media query
1823
+ SANE_SELECTED_WITH_DIAL_WIDTH: 78,
1824
+ // px width fallback when separateDialCode enabled
1825
+ SANE_SELECTED_NO_DIAL_WIDTH: 42,
1826
+ // px width fallback when no separate dial code
1827
+ INPUT_PADDING_EXTRA_LEFT: 6,
1828
+ // px gap between selected country container and input text
1829
+ DROPDOWN_MARGIN: 3,
1830
+ // px margin between dropdown and tel input
1831
+ SANE_DROPDOWN_HEIGHT: 200
1832
+ // px height fallback for dropdown
1833
+ };
1834
+ var DIAL = {
1835
+ NANP: "1"
1836
+ // North American Numbering Plan
1837
+ };
1838
+ var UK = {
1839
+ DIAL_CODE: "44",
1840
+ // +44 United Kingdom
1841
+ MOBILE_PREFIX: "7",
1842
+ // UK mobile numbers start with 7 after national trunk (0) or core section
1843
+ MOBILE_CORE_LENGTH: 10
1844
+ // core number length (excluding dial code / national prefix) for mobiles
1845
+ };
1846
+ var US = {
1847
+ ISO2: "us"};
1848
+ var PLACEHOLDER_MODES = {
1849
+ AGGRESSIVE: "aggressive",
1850
+ POLITE: "polite",
1851
+ OFF: "off"
1852
+ };
1853
+ var INITIAL_COUNTRY = {
1854
+ AUTO: "auto"
1855
+ };
1856
+ var NUMBER_TYPES = [
1857
+ "FIXED_LINE",
1858
+ "MOBILE",
1859
+ "FIXED_LINE_OR_MOBILE",
1860
+ "TOLL_FREE",
1861
+ "PREMIUM_RATE",
1862
+ "SHARED_COST",
1863
+ "VOIP",
1864
+ "PERSONAL_NUMBER",
1865
+ "PAGER",
1866
+ "UAN",
1867
+ "VOICEMAIL",
1868
+ "UNKNOWN"
1869
+ ];
1870
+ var NUMBER_TYPE_SET = new Set(NUMBER_TYPES);
1871
+ var DATA_KEYS = {
1872
+ COUNTRY_CODE: "countryCode",
1873
+ DIAL_CODE: "dialCode"
1874
+ };
1875
+ var ARIA = {
1876
+ EXPANDED: "aria-expanded",
1877
+ LABEL: "aria-label",
1878
+ SELECTED: "aria-selected",
1879
+ ACTIVE_DESCENDANT: "aria-activedescendant",
1880
+ HASPOPUP: "aria-haspopup",
1881
+ CONTROLS: "aria-controls",
1882
+ HIDDEN: "aria-hidden",
1883
+ AUTOCOMPLETE: "aria-autocomplete",
1884
+ MODAL: "aria-modal"
1885
+ };
1886
+
1887
+ // src/js/intl-tel-input/i18n/en/index.ts
1888
+ var interfaceTranslations = {
1889
+ selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1890
+ noCountrySelected: "Select country",
1891
+ countryListAriaLabel: "List of countries",
1892
+ searchPlaceholder: "Search",
1893
+ clearSearchAriaLabel: "Clear search",
1894
+ searchEmptyState: "No results found",
1895
+ searchSummaryAria(count) {
1896
+ if (count === 0) {
1897
+ return "No results found";
1898
+ }
1899
+ if (count === 1) {
1900
+ return "1 result found";
1901
+ }
1902
+ return `${count} results found`;
1903
+ }
1904
+ };
1905
+ var en_default = interfaceTranslations;
1906
+
1907
+ // src/js/modules/core/options.ts
1908
+ var mq = (q) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
1909
+ var isNarrowViewport = () => mq(`(max-width: ${LAYOUT.NARROW_VIEWPORT_WIDTH}px)`);
1910
+ var computeDefaultUseFullscreenPopup = () => {
1911
+ if (typeof navigator !== "undefined" && typeof window !== "undefined") {
1912
+ const isShortViewport = mq("(max-height: 600px)");
1913
+ const isCoarsePointer = mq("(pointer: coarse)");
1914
+ return isNarrowViewport() || isCoarsePointer && isShortViewport;
1915
+ }
1916
+ return false;
1917
+ };
1918
+ var defaults = {
1919
+ //* Whether or not to allow the dropdown.
1920
+ allowDropdown: true,
1921
+ //* The number type to enforce during validation.
1922
+ allowedNumberTypes: ["MOBILE", "FIXED_LINE"],
1923
+ //* Whether or not to allow extensions after the main number.
1924
+ allowNumberExtensions: false,
1925
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1926
+ allowPhonewords: false,
1927
+ //* Add a placeholder in the input with an example number for the selected country.
1928
+ autoPlaceholder: PLACEHOLDER_MODES.POLITE,
1929
+ //* Add a custom class to the (injected) container element.
1930
+ containerClass: "",
1931
+ //* Locale for localising country names via Intl.DisplayNames.
1932
+ countryNameLocale: "en",
1933
+ //* The order of the countries in the dropdown. Defaults to alphabetical.
1934
+ countryOrder: null,
1935
+ //* Add a country search input at the top of the dropdown.
1936
+ countrySearch: true,
1937
+ //* Modify the auto placeholder.
1938
+ customPlaceholder: null,
1939
+ //* Always show the dropdown
1940
+ dropdownAlwaysOpen: false,
1941
+ //* Append menu to specified element.
1942
+ dropdownContainer: null,
1943
+ //* Don't display these countries.
1944
+ excludeCountries: [],
1945
+ //* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
1946
+ fixDropdownWidth: true,
1947
+ //* Format the number as the user types
1948
+ formatAsYouType: true,
1949
+ //* Format the input value during initialisation and on setNumber.
1950
+ formatOnDisplay: true,
1951
+ //* geoIp lookup function.
1952
+ geoIpLookup: null,
1953
+ //* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
1954
+ hiddenInput: null,
1955
+ //* Internationalise the plugin text e.g. search input placeholder, country names.
1956
+ i18n: {},
1957
+ //* Initial country.
1958
+ initialCountry: "",
1959
+ //* A function to load the utils script.
1960
+ loadUtils: null,
1961
+ //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
1962
+ nationalMode: true,
1963
+ //* Display only these countries.
1964
+ onlyCountries: [],
1965
+ //* Number type to use for placeholders.
1966
+ placeholderNumberType: "MOBILE",
1967
+ //* Add custom classes to the search input element.
1968
+ searchInputClass: "",
1969
+ //* Display the international dial code next to the selected flag.
1970
+ separateDialCode: false,
1971
+ //* Show flags - for both the selected country, and in the country dropdown
1972
+ showFlags: true,
1973
+ //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
1974
+ strictMode: false,
1975
+ //* Use full screen popup instead of dropdown for country list.
1976
+ useFullscreenPopup: computeDefaultUseFullscreenPopup()
1977
+ };
1978
+ var toString = (val) => JSON.stringify(val);
1979
+ var isPlainObject = (val) => Boolean(val) && typeof val === "object" && !Array.isArray(val);
1980
+ var isFn = (val) => typeof val === "function";
1981
+ var isElLike = (val) => {
1982
+ if (!val || typeof val !== "object") return false;
1983
+ const v = val;
1984
+ return v.nodeType === 1 && typeof v.tagName === "string" && typeof v.appendChild === "function";
1985
+ };
1986
+ var placeholderModeSet = new Set(Object.values(PLACEHOLDER_MODES));
1987
+ var warn = (message) => {
1988
+ console.warn(`[intl-tel-input] ${message}`);
1989
+ };
1990
+ var warnOption = (optionName, expectedType, actualValue) => {
1991
+ warn(`Option '${optionName}' must be ${expectedType}; got ${toString(actualValue)}. Ignoring.`);
1992
+ };
1993
+ var hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
1994
+ var validateIso2Array = (key, value) => {
1995
+ const expectedType = "an array of ISO2 country code strings";
1996
+ if (!Array.isArray(value)) {
1997
+ warnOption(key, expectedType, value);
1998
+ return false;
1999
+ }
2000
+ const valid = [];
2001
+ for (const v of value) {
2002
+ if (typeof v !== "string") {
2003
+ warnOption(key, expectedType, value);
2004
+ return false;
2005
+ }
2006
+ const lower = v.toLowerCase();
2007
+ if (!isIso2(lower)) {
2008
+ warn(`Invalid country code in '${key}': '${v}'. Skipping.`);
2009
+ } else {
2010
+ valid.push(v);
2011
+ }
2012
+ }
2013
+ return valid;
2014
+ };
2015
+ var validateOptions = (customOptions) => {
2016
+ if (customOptions === void 0) {
2017
+ return {};
2018
+ }
2019
+ if (!isPlainObject(customOptions)) {
2020
+ const error = `The second argument must be an options object; got ${toString(customOptions)}. Using defaults.`;
2021
+ warn(error);
2022
+ return {};
2023
+ }
2024
+ const validatedOptions = {};
2025
+ for (const [key, value] of Object.entries(customOptions)) {
2026
+ if (!hasOwn(defaults, key)) {
2027
+ warn(`Unknown option '${key}'. Ignoring.`);
2028
+ continue;
2029
+ }
2030
+ switch (key) {
2031
+ case "allowDropdown":
2032
+ case "allowNumberExtensions":
2033
+ case "allowPhonewords":
2034
+ case "countrySearch":
2035
+ case "dropdownAlwaysOpen":
2036
+ case "fixDropdownWidth":
2037
+ case "formatAsYouType":
2038
+ case "formatOnDisplay":
2039
+ case "nationalMode":
2040
+ case "showFlags":
2041
+ case "separateDialCode":
2042
+ case "strictMode":
2043
+ case "useFullscreenPopup":
2044
+ if (typeof value !== "boolean") {
2045
+ warnOption(key, "a boolean", value);
2046
+ break;
2047
+ }
2048
+ validatedOptions[key] = value;
2049
+ break;
2050
+ case "autoPlaceholder":
2051
+ if (typeof value !== "string" || !placeholderModeSet.has(value)) {
2052
+ const validModes = Array.from(placeholderModeSet).join(", ");
2053
+ warnOption("autoPlaceholder", `one of ${validModes}`, value);
2054
+ break;
2055
+ }
2056
+ validatedOptions[key] = value;
2057
+ break;
2058
+ case "containerClass":
2059
+ case "searchInputClass":
2060
+ case "countryNameLocale":
2061
+ if (typeof value !== "string") {
2062
+ warnOption(key, "a string", value);
2063
+ break;
2064
+ }
2065
+ validatedOptions[key] = value;
2066
+ break;
2067
+ case "countryOrder": {
2068
+ if (value === null) {
2069
+ validatedOptions[key] = value;
2070
+ } else {
2071
+ const filtered = validateIso2Array(key, value);
2072
+ if (filtered !== false) {
2073
+ validatedOptions[key] = filtered;
2074
+ }
2075
+ }
2076
+ break;
2077
+ }
2078
+ case "customPlaceholder":
2079
+ case "geoIpLookup":
2080
+ case "hiddenInput":
2081
+ case "loadUtils":
2082
+ if (value !== null && !isFn(value)) {
2083
+ warnOption(key, "a function or null", value);
2084
+ break;
2085
+ }
2086
+ validatedOptions[key] = value;
2087
+ break;
2088
+ case "dropdownContainer":
2089
+ if (value !== null && !isElLike(value)) {
2090
+ warnOption("dropdownContainer", "an HTMLElement or null", value);
2091
+ break;
2092
+ }
2093
+ validatedOptions[key] = value;
2094
+ break;
2095
+ case "excludeCountries":
2096
+ case "onlyCountries": {
2097
+ const filtered = validateIso2Array(key, value);
2098
+ if (filtered !== false) {
2099
+ validatedOptions[key] = filtered;
2100
+ }
2101
+ break;
2102
+ }
2103
+ case "i18n":
2104
+ if (value && !isPlainObject(value)) {
2105
+ warnOption("i18n", "an object", value);
2106
+ break;
2107
+ }
2108
+ validatedOptions[key] = value;
2109
+ break;
2110
+ case "initialCountry": {
2111
+ if (typeof value !== "string") {
2112
+ warnOption("initialCountry", "a string", value);
2113
+ break;
2114
+ }
2115
+ const lower = value.toLowerCase();
2116
+ if (lower && (lower !== INITIAL_COUNTRY.AUTO && !isIso2(lower))) {
2117
+ warnOption("initialCountry", "a valid ISO2 country code or 'auto'", value);
2118
+ break;
2119
+ }
2120
+ validatedOptions[key] = value;
2121
+ break;
2122
+ }
2123
+ case "placeholderNumberType":
2124
+ if (typeof value !== "string" || !NUMBER_TYPE_SET.has(value)) {
2125
+ const validTypes = Array.from(NUMBER_TYPE_SET).join(", ");
2126
+ warnOption("placeholderNumberType", `one of ${validTypes}`, value);
2127
+ break;
2128
+ }
2129
+ validatedOptions[key] = value;
2130
+ break;
2131
+ case "allowedNumberTypes":
2132
+ if (value !== null) {
2133
+ if (!Array.isArray(value)) {
2134
+ warnOption("allowedNumberTypes", "an array of number types or null", value);
2135
+ break;
2136
+ }
2137
+ let allValid = true;
2138
+ for (const v of value) {
2139
+ if (typeof v !== "string" || !NUMBER_TYPE_SET.has(v)) {
2140
+ const validTypes = Array.from(NUMBER_TYPE_SET).join(", ");
2141
+ warnOption("allowedNumberTypes", `an array of valid number types (${validTypes})`, v);
2142
+ allValid = false;
2143
+ break;
2144
+ }
2145
+ }
2146
+ if (allValid) {
2147
+ validatedOptions[key] = value;
2148
+ }
2149
+ } else {
2150
+ validatedOptions[key] = null;
2151
+ }
2152
+ break;
2153
+ }
2154
+ }
2155
+ return validatedOptions;
2156
+ };
2157
+ var normaliseOptions = (o) => {
2158
+ if (o.initialCountry) {
2159
+ o.initialCountry = o.initialCountry.toLowerCase();
2160
+ }
2161
+ if (o.onlyCountries?.length) {
2162
+ o.onlyCountries = o.onlyCountries.map((c) => c.toLowerCase());
2163
+ }
2164
+ if (o.excludeCountries?.length) {
2165
+ o.excludeCountries = o.excludeCountries.map((c) => c.toLowerCase());
2166
+ }
2167
+ if (o.countryOrder) {
2168
+ o.countryOrder = o.countryOrder.map((c) => c.toLowerCase());
2169
+ }
2170
+ };
2171
+ var applyOptionSideEffects = (o) => {
2172
+ if (o.dropdownAlwaysOpen) {
2173
+ o.useFullscreenPopup = false;
2174
+ o.allowDropdown = true;
2175
+ }
2176
+ if (o.useFullscreenPopup) {
2177
+ o.fixDropdownWidth = false;
2178
+ } else {
2179
+ if (isNarrowViewport()) {
2180
+ o.fixDropdownWidth = true;
2181
+ }
2182
+ }
2183
+ if (o.onlyCountries.length === 1) {
2184
+ o.initialCountry = o.onlyCountries[0];
2185
+ }
2186
+ if (o.separateDialCode) {
2187
+ o.nationalMode = false;
2188
+ }
2189
+ if (o.allowDropdown && !o.showFlags && !o.separateDialCode) {
2190
+ o.nationalMode = false;
2191
+ }
2192
+ if (o.useFullscreenPopup && !o.dropdownContainer) {
2193
+ o.dropdownContainer = document.body;
2194
+ }
2195
+ o.i18n = { ...en_default, ...o.i18n };
2196
+ };
2197
+
2198
+ // src/js/modules/utils/string.ts
2199
+ var getNumeric = (s) => s.replace(/\D/g, "");
2200
+ var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
2201
+
2202
+ // src/js/modules/utils/isAndroid.ts
2203
+ var getIsAndroid = () => typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
2204
+
2205
+ // src/js/modules/core/countrySearch.ts
2206
+ var getMatchedCountries = (countries, query) => {
2207
+ const normalisedQuery = normaliseString(query);
2208
+ const iso2Matches = [];
2209
+ const nameStartWith = [];
2210
+ const nameContains = [];
2211
+ const dialCodeMatches = [];
2212
+ const dialCodeContains = [];
2213
+ const initialsMatches = [];
2214
+ for (const c of countries) {
2215
+ if (c.iso2 === normalisedQuery) {
2216
+ iso2Matches.push(c);
2217
+ } else if (c.normalisedName.startsWith(normalisedQuery)) {
2218
+ nameStartWith.push(c);
2219
+ } else if (c.normalisedName.includes(normalisedQuery)) {
2220
+ nameContains.push(c);
2221
+ } else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
2222
+ dialCodeMatches.push(c);
2223
+ } else if (c.dialCodePlus.includes(normalisedQuery)) {
2224
+ dialCodeContains.push(c);
2225
+ } else if (c.initials.includes(normalisedQuery)) {
2226
+ initialsMatches.push(c);
2227
+ }
2228
+ }
2229
+ const sortByPriority = (a, b) => a.priority - b.priority;
2230
+ return [
2231
+ ...iso2Matches,
2232
+ ...nameStartWith,
2233
+ ...nameContains,
2234
+ // priority sort is only relevant when showing multiple countries with the same dial code (that's what the priority field is used to distinguish between)
2235
+ ...dialCodeMatches.sort(sortByPriority),
2236
+ ...dialCodeContains.sort(sortByPriority),
2237
+ ...initialsMatches
2238
+ ];
2239
+ };
2240
+ var findFirstCountryStartingWith = (countries, query) => {
2241
+ const normalisedQuery = normaliseString(query);
2242
+ for (const c of countries) {
2243
+ if (c.normalisedName.startsWith(normalisedQuery)) {
2244
+ return c;
2245
+ }
2246
+ }
2247
+ return null;
2248
+ };
2249
+
2250
+ // src/js/modules/utils/dom.ts
2251
+ var buildClassNames = (flags) => Object.keys(flags).filter((k) => Boolean(flags[k])).join(" ");
2252
+ var createEl = (tagName, attrs, container) => {
2253
+ const el = document.createElement(tagName);
2254
+ if (attrs) {
2255
+ Object.entries(attrs).forEach(
2256
+ ([key, value]) => el.setAttribute(key, value)
2257
+ );
2258
+ }
2259
+ if (container) {
2260
+ container.appendChild(el);
2261
+ }
2262
+ return el;
2263
+ };
2264
+
2265
+ // src/js/modules/core/icons.ts
2266
+ var buildSearchIcon = () => `
2267
+ <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${ARIA.HIDDEN}="true">
2268
+ <circle cx="11" cy="11" r="7" />
2269
+ <line x1="21" y1="21" x2="16.65" y2="16.65" />
2270
+ </svg>`;
2271
+ var buildClearIcon = (id2) => {
2272
+ const maskId = `iti-${id2}-clear-mask`;
2273
+ return `
2274
+ <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${ARIA.HIDDEN}="true" focusable="false">
2275
+ <mask id="${maskId}" maskUnits="userSpaceOnUse">
2276
+ <rect width="16" height="16" fill="white" />
2277
+ <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
2278
+ </mask>
2279
+ <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
2280
+ </svg>`;
2281
+ };
2282
+ var buildCheckIcon = () => `
2283
+ <svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${ARIA.HIDDEN}="true">
2284
+ <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
2285
+ </svg>`;
2286
+ var buildGlobeIcon = () => `
2287
+ <svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
2288
+ <path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
2289
+ <path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
2290
+ </svg>`;
2291
+
2292
+ // src/js/modules/core/ui.ts
2293
+ var UI = class _UI {
2294
+ constructor(input, options, id2) {
2295
+ this.#searchKeyupTimer = null;
2296
+ this.#inlineDropdownHeight = null;
2297
+ this.#dropdownForContainer = null;
2298
+ this.#selectedItem = null;
2299
+ this.highlightedItem = null;
2300
+ input.dataset.intlTelInputId = id2.toString();
2301
+ this.telInput = input;
2302
+ this.#options = options;
2303
+ this.#id = id2;
2304
+ this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
2305
+ this.#isRTL = !!this.telInput.closest("[dir=rtl]");
2306
+ if (this.#options.separateDialCode) {
2307
+ this.#originalPaddingLeft = this.telInput.style.paddingLeft;
2308
+ }
2309
+ }
2310
+ // private
2311
+ #options;
2312
+ #id;
2313
+ #isRTL;
2314
+ #originalPaddingLeft;
2315
+ #countries;
2316
+ #searchKeyupTimer;
2317
+ #inlineDropdownHeight;
2318
+ #selectedDialCode;
2319
+ #dropdownArrow;
2320
+ #dropdownContent;
2321
+ #searchIcon;
2322
+ #searchNoResults;
2323
+ #searchResultsA11yText;
2324
+ #dropdownForContainer;
2325
+ #selectedItem;
2326
+ // Validate that the provided element is an HTMLInputElement.
2327
+ static validateInput(input) {
2328
+ const tagName = input?.tagName;
2329
+ const isInputEl = Boolean(input) && typeof input === "object" && tagName === "INPUT" && typeof input.setAttribute === "function";
2330
+ if (!isInputEl) {
2331
+ const type = Object.prototype.toString.call(input);
2332
+ throw new TypeError(
2333
+ `The first argument must be an HTMLInputElement, not ${type}`
2334
+ );
2335
+ }
2336
+ }
2337
+ //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
2338
+ generateMarkup(countries) {
2339
+ this.#countries = countries;
2340
+ this.telInput.classList.add("iti__tel-input");
2341
+ if (!this.telInput.hasAttribute("autocomplete")) {
2342
+ this.telInput.setAttribute("autocomplete", "tel");
2343
+ }
2344
+ if (!this.telInput.hasAttribute("inputmode")) {
2345
+ this.telInput.setAttribute("inputmode", "tel");
2346
+ }
2347
+ const wrapper = this.#createWrapperAndInsert();
2348
+ this.#maybeBuildCountryContainer(wrapper);
2349
+ wrapper.appendChild(this.telInput);
2350
+ this.#maybeUpdateInputPaddingAndReveal();
2351
+ this.#maybeBuildHiddenInputs(wrapper);
2352
+ }
2353
+ #createWrapperAndInsert() {
2354
+ const {
2355
+ allowDropdown,
2356
+ showFlags,
2357
+ containerClass,
2358
+ useFullscreenPopup
2359
+ } = this.#options;
2360
+ const parentClasses = buildClassNames({
2361
+ iti: true,
2362
+ "iti--allow-dropdown": allowDropdown,
2363
+ "iti--show-flags": showFlags,
2364
+ "iti--inline-dropdown": !useFullscreenPopup,
2365
+ [containerClass]: Boolean(containerClass)
2366
+ });
2367
+ const wrapper = createEl("div", { class: parentClasses });
2368
+ if (this.#isRTL) {
2369
+ wrapper.setAttribute("dir", "ltr");
2370
+ }
2371
+ this.telInput.before(wrapper);
2372
+ return wrapper;
2373
+ }
2374
+ #maybeBuildCountryContainer(wrapper) {
2375
+ const { allowDropdown, separateDialCode, showFlags } = this.#options;
2376
+ if (allowDropdown || showFlags || separateDialCode) {
2377
+ this.countryContainer = createEl(
2378
+ "div",
2379
+ // visibly hidden until we measure it's width to set the input padding correctly
2380
+ { class: `iti__country-container ${CLASSES.V_HIDE}` },
2381
+ wrapper
2382
+ );
2383
+ if (allowDropdown) {
2384
+ this.selectedCountry = createEl(
2385
+ "button",
2386
+ {
2387
+ type: "button",
2388
+ class: "iti__selected-country",
2389
+ [ARIA.EXPANDED]: "false",
2390
+ [ARIA.LABEL]: this.#options.i18n.noCountrySelected,
2391
+ [ARIA.HASPOPUP]: "dialog",
2392
+ [ARIA.CONTROLS]: `iti-${this.#id}__dropdown-content`
2393
+ },
2394
+ this.countryContainer
2395
+ );
2396
+ if (this.telInput.disabled) {
2397
+ this.selectedCountry.setAttribute("disabled", "true");
2398
+ }
2399
+ } else {
2400
+ this.selectedCountry = createEl(
2401
+ "div",
2402
+ { class: "iti__selected-country" },
2403
+ this.countryContainer
2404
+ );
2405
+ }
2406
+ const selectedCountryPrimary = createEl(
2407
+ "div",
2408
+ { class: "iti__selected-country-primary" },
2409
+ this.selectedCountry
2410
+ );
2411
+ this.selectedCountryInner = createEl(
2412
+ "div",
2413
+ { class: CLASSES.FLAG },
2414
+ selectedCountryPrimary
2415
+ );
2416
+ if (allowDropdown) {
2417
+ this.#dropdownArrow = createEl(
2418
+ "div",
2419
+ { class: "iti__arrow", [ARIA.HIDDEN]: "true" },
2420
+ selectedCountryPrimary
2421
+ );
2422
+ }
2423
+ if (separateDialCode) {
2424
+ this.#selectedDialCode = createEl(
2425
+ "div",
2426
+ { class: "iti__selected-dial-code" },
2427
+ this.selectedCountry
2428
+ );
2429
+ }
2430
+ if (allowDropdown) {
2431
+ this.#buildDropdownContent();
2432
+ }
2433
+ }
2434
+ }
2435
+ #maybeEnsureDropdownWidthSet() {
2436
+ const { fixDropdownWidth } = this.#options;
2437
+ if (fixDropdownWidth && !this.#dropdownContent.style.width) {
2438
+ const inputWidth = this.telInput.offsetWidth;
2439
+ if (inputWidth > 0) {
2440
+ this.#dropdownContent.style.width = `${inputWidth}px`;
2441
+ }
2442
+ }
2443
+ }
2444
+ #buildDropdownContent() {
2445
+ const {
2446
+ fixDropdownWidth,
2447
+ useFullscreenPopup,
2448
+ countrySearch,
2449
+ i18n,
2450
+ dropdownContainer,
2451
+ containerClass
2452
+ } = this.#options;
2453
+ const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
2454
+ this.#dropdownContent = createEl("div", {
2455
+ id: `iti-${this.#id}__dropdown-content`,
2456
+ class: `iti__dropdown-content ${CLASSES.HIDE} ${extraClasses}`,
2457
+ role: "dialog",
2458
+ [ARIA.MODAL]: "true"
2459
+ });
2460
+ if (this.#isRTL) {
2461
+ this.#dropdownContent.setAttribute("dir", "rtl");
2462
+ }
2463
+ if (countrySearch) {
2464
+ this.#buildSearchUI();
2465
+ }
2466
+ this.countryList = createEl(
2467
+ "ul",
2468
+ {
2469
+ class: "iti__country-list",
2470
+ id: `iti-${this.#id}__country-listbox`,
2471
+ role: "listbox",
2472
+ [ARIA.LABEL]: i18n.countryListAriaLabel
2473
+ },
2474
+ this.#dropdownContent
2475
+ );
2476
+ this.#appendListItems();
2477
+ if (countrySearch) {
2478
+ this.#updateSearchResultsA11yText();
2479
+ }
2480
+ if (!useFullscreenPopup) {
2481
+ this.#maybeEnsureDropdownWidthSet();
2482
+ this.#inlineDropdownHeight = this.#getHiddenInlineDropdownHeight();
2483
+ if (countrySearch) {
2484
+ this.#dropdownContent.style.height = `${this.#inlineDropdownHeight}px`;
2485
+ }
2486
+ }
2487
+ if (dropdownContainer) {
2488
+ const dropdownClasses = buildClassNames({
2489
+ iti: true,
2490
+ "iti--container": true,
2491
+ "iti--fullscreen-popup": useFullscreenPopup,
2492
+ "iti--inline-dropdown": !useFullscreenPopup,
2493
+ [containerClass]: Boolean(containerClass)
2494
+ });
2495
+ this.#dropdownForContainer = createEl("div", { class: dropdownClasses });
2496
+ this.#dropdownForContainer.appendChild(this.#dropdownContent);
2497
+ } else {
2498
+ this.countryContainer.appendChild(this.#dropdownContent);
2499
+ }
2500
+ }
2501
+ #buildSearchUI() {
2502
+ const { i18n, searchInputClass } = this.#options;
2503
+ const searchWrapper = createEl(
2504
+ "div",
2505
+ { class: "iti__search-input-wrapper" },
2506
+ this.#dropdownContent
2507
+ );
2508
+ this.#searchIcon = createEl(
2509
+ "span",
2510
+ {
2511
+ class: "iti__search-icon",
2512
+ [ARIA.HIDDEN]: "true"
2513
+ },
2514
+ searchWrapper
2515
+ );
2516
+ this.#searchIcon.innerHTML = buildSearchIcon();
2517
+ this.searchInput = createEl(
2518
+ "input",
2519
+ {
2520
+ id: `iti-${this.#id}__search-input`,
2521
+ // Chrome says inputs need either a name or an id
2522
+ type: "search",
2523
+ class: `iti__search-input ${searchInputClass}`,
2524
+ placeholder: i18n.searchPlaceholder,
2525
+ // role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
2526
+ role: "combobox",
2527
+ [ARIA.EXPANDED]: "true",
2528
+ [ARIA.LABEL]: i18n.searchPlaceholder,
2529
+ [ARIA.CONTROLS]: `iti-${this.#id}__country-listbox`,
2530
+ [ARIA.AUTOCOMPLETE]: "list",
2531
+ autocomplete: "off"
2532
+ },
2533
+ searchWrapper
2534
+ );
2535
+ this.searchClearButton = createEl(
2536
+ "button",
2537
+ {
2538
+ type: "button",
2539
+ class: `iti__search-clear ${CLASSES.HIDE}`,
2540
+ [ARIA.LABEL]: i18n.clearSearchAriaLabel,
2541
+ tabindex: "-1"
2542
+ },
2543
+ searchWrapper
2544
+ );
2545
+ this.searchClearButton.innerHTML = buildClearIcon(this.#id);
2546
+ this.#searchResultsA11yText = createEl(
2547
+ "span",
2548
+ { class: "iti__a11y-text" },
2549
+ this.#dropdownContent
2550
+ );
2551
+ this.#searchNoResults = createEl(
2552
+ "div",
2553
+ {
2554
+ class: `iti__no-results ${CLASSES.HIDE}`,
2555
+ [ARIA.HIDDEN]: "true"
2556
+ // all a11y messaging happens in this.#searchResultsA11yText
2557
+ },
2558
+ this.#dropdownContent
2559
+ );
2560
+ this.#searchNoResults.textContent = i18n.searchEmptyState;
2561
+ }
2562
+ #maybeUpdateInputPaddingAndReveal() {
2563
+ if (this.countryContainer) {
2564
+ this.#updateInputPadding();
2565
+ this.countryContainer.classList.remove(CLASSES.V_HIDE);
2566
+ }
2567
+ }
2568
+ #maybeBuildHiddenInputs(wrapper) {
2569
+ const { hiddenInput } = this.#options;
2570
+ if (hiddenInput) {
2571
+ const telInputName = this.telInput.getAttribute("name") || "";
2572
+ const names = hiddenInput(telInputName);
2573
+ if (names.phone) {
2574
+ const existingInput = this.telInput.form?.querySelector(
2575
+ `input[name="${names.phone}"]`
2576
+ );
2577
+ if (existingInput) {
2578
+ this.hiddenInput = existingInput;
2579
+ } else {
2580
+ this.hiddenInput = createEl("input", {
2581
+ type: "hidden",
2582
+ name: names.phone
2583
+ });
2584
+ wrapper.appendChild(this.hiddenInput);
2585
+ }
2586
+ }
2587
+ if (names.country) {
2588
+ const existingInput = this.telInput.form?.querySelector(
2589
+ `input[name="${names.country}"]`
2590
+ );
2591
+ if (existingInput) {
2592
+ this.hiddenInputCountry = existingInput;
2593
+ } else {
2594
+ this.hiddenInputCountry = createEl("input", {
2595
+ type: "hidden",
2596
+ name: names.country
2597
+ });
2598
+ wrapper.appendChild(this.hiddenInputCountry);
2599
+ }
2600
+ }
2601
+ }
2602
+ }
2603
+ //* For each country: add a country list item <li> to the countryList <ul> container.
2604
+ #appendListItems() {
2605
+ const frag = document.createDocumentFragment();
2606
+ for (let i = 0; i < this.#countries.length; i++) {
2607
+ const c = this.#countries[i];
2608
+ const liClass = buildClassNames({
2609
+ [CLASSES.COUNTRY_ITEM]: true
2610
+ });
2611
+ const listItem = createEl("li", {
2612
+ id: `iti-${this.#id}__item-${c.iso2}`,
2613
+ class: liClass,
2614
+ tabindex: "-1",
2615
+ role: "option",
2616
+ [ARIA.SELECTED]: "false"
2617
+ });
2618
+ listItem.dataset.dialCode = c.dialCode;
2619
+ listItem.dataset.countryCode = c.iso2;
2620
+ c.nodeById[this.#id] = listItem;
2621
+ if (this.#options.showFlags) {
2622
+ createEl("div", { class: `${CLASSES.FLAG} iti__${c.iso2}` }, listItem);
2623
+ }
2624
+ const nameEl = createEl("span", { class: "iti__country-name" }, listItem);
2625
+ nameEl.textContent = `${c.name} `;
2626
+ const dialEl = createEl("span", { class: "iti__dial-code" }, nameEl);
2627
+ if (this.#isRTL) {
2628
+ dialEl.setAttribute("dir", "ltr");
2629
+ }
2630
+ dialEl.textContent = `(+${c.dialCode})`;
2631
+ frag.appendChild(listItem);
2632
+ }
2633
+ this.countryList.appendChild(frag);
2634
+ }
2635
+ //* Update the input padding to make space for the selected country/dial code.
2636
+ #updateInputPadding() {
2637
+ if (this.selectedCountry) {
2638
+ const fallbackWidth = this.#options.separateDialCode ? LAYOUT.SANE_SELECTED_WITH_DIAL_WIDTH : LAYOUT.SANE_SELECTED_NO_DIAL_WIDTH;
2639
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this.#getHiddenSelectedCountryWidth() || fallbackWidth;
2640
+ const inputPadding = selectedCountryWidth + LAYOUT.INPUT_PADDING_EXTRA_LEFT;
2641
+ this.telInput.style.paddingLeft = `${inputPadding}px`;
2642
+ }
2643
+ }
2644
+ static #getBody() {
2645
+ let body;
2646
+ try {
2647
+ body = window.top.document.body;
2648
+ } catch (e) {
2649
+ body = document.body;
2650
+ }
2651
+ return body;
2652
+ }
2653
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2654
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2655
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2656
+ //* and then to inject a deep clone of the selectedCountry element.
2657
+ #getHiddenSelectedCountryWidth() {
2658
+ if (this.telInput.parentNode) {
2659
+ const body = _UI.#getBody();
2660
+ const containerClone = this.telInput.parentNode.cloneNode(
2661
+ false
2662
+ );
2663
+ containerClone.style.visibility = "hidden";
2664
+ body.appendChild(containerClone);
2665
+ const countryContainerClone = this.countryContainer.cloneNode();
2666
+ containerClone.appendChild(countryContainerClone);
2667
+ const selectedCountryClone = this.selectedCountry.cloneNode(
2668
+ true
2669
+ );
2670
+ countryContainerClone.appendChild(selectedCountryClone);
2671
+ const width = selectedCountryClone.offsetWidth;
2672
+ body.removeChild(containerClone);
2673
+ return width;
2674
+ }
2675
+ return 0;
2676
+ }
2677
+ // this is run before we add the dropdown to the DOM
2678
+ #getHiddenInlineDropdownHeight() {
2679
+ const body = _UI.#getBody();
2680
+ this.#dropdownContent.classList.remove(CLASSES.HIDE);
2681
+ const tempContainer = createEl("div", { class: "iti iti--inline-dropdown" });
2682
+ tempContainer.appendChild(this.#dropdownContent);
2683
+ tempContainer.style.visibility = "hidden";
2684
+ body.appendChild(tempContainer);
2685
+ const height = this.#dropdownContent.offsetHeight;
2686
+ body.removeChild(tempContainer);
2687
+ tempContainer.style.visibility = "";
2688
+ this.#dropdownContent.classList.add(CLASSES.HIDE);
2689
+ return height > 0 ? height : LAYOUT.SANE_DROPDOWN_HEIGHT;
2690
+ }
2691
+ //* Update search results text (for a11y).
2692
+ #updateSearchResultsA11yText() {
2693
+ const { i18n } = this.#options;
2694
+ const count = this.countryList.childElementCount;
2695
+ this.#searchResultsA11yText.textContent = i18n.searchSummaryAria(count);
2696
+ }
2697
+ //* Country search: Filter the countries according to the search query.
2698
+ filterCountriesByQuery(query) {
2699
+ let matchedCountries;
2700
+ if (query === "") {
2701
+ matchedCountries = this.#countries;
2702
+ } else {
2703
+ matchedCountries = getMatchedCountries(this.#countries, query);
2704
+ }
2705
+ this.#filterCountries(matchedCountries);
2706
+ }
2707
+ // Search input handlers
2708
+ #doFilter() {
2709
+ const inputQuery = this.searchInput.value.trim();
2710
+ this.filterCountriesByQuery(inputQuery);
2711
+ if (this.searchInput.value) {
2712
+ this.searchClearButton.classList.remove(CLASSES.HIDE);
2713
+ } else {
2714
+ this.searchClearButton.classList.add(CLASSES.HIDE);
2715
+ }
2716
+ }
2717
+ handleSearchChange() {
2718
+ if (this.#searchKeyupTimer) {
2719
+ clearTimeout(this.#searchKeyupTimer);
2720
+ }
2721
+ this.#searchKeyupTimer = setTimeout(() => {
2722
+ this.#doFilter();
2723
+ this.#searchKeyupTimer = null;
2724
+ }, TIMINGS.SEARCH_DEBOUNCE_MS);
2725
+ }
2726
+ handleSearchClear() {
2727
+ this.searchInput.value = "";
2728
+ this.searchInput.focus();
2729
+ this.#doFilter();
2730
+ }
2731
+ //* Check if a country list item element is visible within it's container (the country list), else scroll until it is.
2732
+ scrollCountryListToItem(element) {
2733
+ const container = this.countryList;
2734
+ const containerRect = container.getBoundingClientRect();
2735
+ const elementRect = element.getBoundingClientRect();
2736
+ const offsetTop = elementRect.top - containerRect.top + container.scrollTop;
2737
+ if (elementRect.top < containerRect.top) {
2738
+ container.scrollTop = offsetTop;
2739
+ } else if (elementRect.bottom > containerRect.bottom) {
2740
+ container.scrollTop = offsetTop - containerRect.height + elementRect.height;
2741
+ }
2742
+ }
2743
+ //* Remove highlighting from the previous list item and highlight the new one.
2744
+ highlightListItem(listItem, shouldFocus) {
2745
+ const prevItem = this.highlightedItem;
2746
+ if (prevItem) {
2747
+ prevItem.classList.remove(CLASSES.HIGHLIGHT);
2748
+ }
2749
+ this.highlightedItem = listItem;
2750
+ if (this.highlightedItem) {
2751
+ this.highlightedItem.classList.add(CLASSES.HIGHLIGHT);
2752
+ if (this.#options.countrySearch) {
2753
+ const activeDescendant = this.highlightedItem.getAttribute("id") || "";
2754
+ this.searchInput.setAttribute(ARIA.ACTIVE_DESCENDANT, activeDescendant);
2755
+ }
2756
+ if (shouldFocus) {
2757
+ this.highlightedItem.focus();
2758
+ }
2759
+ }
2760
+ }
2761
+ //* Highlight the next/prev item in the list (and ensure it is visible).
2762
+ handleUpDownKey(key) {
2763
+ let next = key === KEYS.ARROW_UP ? this.highlightedItem?.previousElementSibling : this.highlightedItem?.nextElementSibling;
2764
+ if (!next && this.countryList.childElementCount > 1) {
2765
+ next = key === KEYS.ARROW_UP ? this.countryList.lastElementChild : this.countryList.firstElementChild;
2766
+ }
2767
+ if (next) {
2768
+ this.scrollCountryListToItem(next);
2769
+ this.highlightListItem(next, false);
2770
+ }
2771
+ }
2772
+ // Update the selected list item in the dropdown
2773
+ #updateSelectedItem(iso2) {
2774
+ if (this.#selectedItem && this.#selectedItem.dataset.countryCode !== iso2) {
2775
+ this.#selectedItem.setAttribute(ARIA.SELECTED, "false");
2776
+ this.#selectedItem.querySelector(".iti__country-check")?.remove();
2777
+ this.#selectedItem = null;
2778
+ }
2779
+ if (iso2 && !this.#selectedItem) {
2780
+ const newListItem = this.countryList.querySelector(
2781
+ `[data-country-code="${iso2}"]`
2782
+ );
2783
+ if (newListItem) {
2784
+ newListItem.setAttribute(ARIA.SELECTED, "true");
2785
+ const checkIcon = createEl(
2786
+ "span",
2787
+ { class: "iti__country-check", [ARIA.HIDDEN]: "true" },
2788
+ newListItem
2789
+ );
2790
+ checkIcon.innerHTML = buildCheckIcon();
2791
+ this.#selectedItem = newListItem;
2792
+ }
2793
+ }
2794
+ }
2795
+ //* Country search: Filter the country list to the given array of countries.
2796
+ #filterCountries(matchedCountries) {
2797
+ this.countryList.replaceChildren();
2798
+ let noCountriesAddedYet = true;
2799
+ for (const c of matchedCountries) {
2800
+ const listItem = c.nodeById[this.#id];
2801
+ if (listItem) {
2802
+ this.countryList.appendChild(listItem);
2803
+ if (noCountriesAddedYet) {
2804
+ this.highlightListItem(listItem, false);
2805
+ noCountriesAddedYet = false;
2806
+ }
2807
+ }
2808
+ }
2809
+ if (noCountriesAddedYet) {
2810
+ this.highlightListItem(null, false);
2811
+ if (this.#searchNoResults) {
2812
+ this.#searchNoResults.classList.remove(CLASSES.HIDE);
2813
+ }
2814
+ } else if (this.#searchNoResults) {
2815
+ this.#searchNoResults.classList.add(CLASSES.HIDE);
2816
+ }
2817
+ this.countryList.scrollTop = 0;
2818
+ this.#updateSearchResultsA11yText();
2819
+ }
2820
+ destroy() {
2821
+ this.telInput.iti = void 0;
2822
+ delete this.telInput.dataset.intlTelInputId;
2823
+ if (this.#options.separateDialCode) {
2824
+ this.telInput.style.paddingLeft = this.#originalPaddingLeft;
2825
+ }
2826
+ const wrapper = this.telInput.parentNode;
2827
+ wrapper.before(this.telInput);
2828
+ wrapper.remove();
2829
+ this.telInput = null;
2830
+ this.countryContainer = null;
2831
+ this.selectedCountry = null;
2832
+ this.selectedCountryInner = null;
2833
+ this.searchInput = null;
2834
+ this.searchClearButton = null;
2835
+ this.countryList = null;
2836
+ this.hiddenInput = null;
2837
+ this.hiddenInputCountry = null;
2838
+ this.highlightedItem = null;
2839
+ this.#selectedDialCode = null;
2840
+ this.#dropdownArrow = null;
2841
+ this.#dropdownContent = null;
2842
+ this.#searchIcon = null;
2843
+ this.#searchNoResults = null;
2844
+ this.#searchResultsA11yText = null;
2845
+ this.#dropdownForContainer = null;
2846
+ this.#selectedItem = null;
2847
+ for (const c of this.#countries) {
2848
+ delete c.nodeById[this.#id];
2849
+ }
2850
+ this.#countries = null;
2851
+ }
2852
+ // UI: Open the dropdown (DOM only).
2853
+ openDropdown() {
2854
+ const {
2855
+ countrySearch,
2856
+ dropdownAlwaysOpen,
2857
+ dropdownContainer
2858
+ } = this.#options;
2859
+ this.#maybeEnsureDropdownWidthSet();
2860
+ if (dropdownContainer) {
2861
+ this.#handleDropdownContainer();
2862
+ } else {
2863
+ const positionBelow = this.#shouldPositionInlineDropdownBelowInput();
2864
+ const distance = this.telInput.offsetHeight + LAYOUT.DROPDOWN_MARGIN;
2865
+ if (positionBelow) {
2866
+ this.#dropdownContent.style.top = `${distance}px`;
2867
+ } else {
2868
+ this.#dropdownContent.style.bottom = `${distance}px`;
2869
+ }
2870
+ }
2871
+ this.#dropdownContent.classList.remove(CLASSES.HIDE);
2872
+ this.selectedCountry.setAttribute(ARIA.EXPANDED, "true");
2873
+ if (countrySearch) {
2874
+ const firstCountryItem = this.countryList.firstElementChild;
2875
+ if (firstCountryItem) {
2876
+ this.highlightListItem(firstCountryItem, false);
2877
+ this.countryList.scrollTop = 0;
2878
+ }
2879
+ if (!dropdownAlwaysOpen) {
2880
+ this.searchInput.focus();
2881
+ }
2882
+ }
2883
+ this.#dropdownArrow.classList.add(CLASSES.ARROW_UP);
2884
+ }
2885
+ // UI: Close the dropdown (DOM only).
2886
+ closeDropdown() {
2887
+ const { countrySearch, dropdownContainer } = this.#options;
2888
+ this.#dropdownContent.classList.add(CLASSES.HIDE);
2889
+ this.selectedCountry.setAttribute(ARIA.EXPANDED, "false");
2890
+ if (countrySearch) {
2891
+ this.searchInput.removeAttribute(ARIA.ACTIVE_DESCENDANT);
2892
+ if (this.highlightedItem) {
2893
+ this.highlightedItem.classList.remove(CLASSES.HIGHLIGHT);
2894
+ this.highlightedItem = null;
2895
+ }
2896
+ }
2897
+ this.#dropdownArrow.classList.remove(CLASSES.ARROW_UP);
2898
+ if (dropdownContainer) {
2899
+ this.#dropdownForContainer.remove();
2900
+ this.#dropdownForContainer.style.top = "";
2901
+ this.#dropdownForContainer.style.bottom = "";
2902
+ this.#dropdownForContainer.style.paddingLeft = "";
2903
+ this.#dropdownForContainer.style.paddingRight = "";
2904
+ } else {
2905
+ this.#dropdownContent.style.top = "";
2906
+ this.#dropdownContent.style.bottom = "";
2907
+ }
2908
+ }
2909
+ #shouldPositionInlineDropdownBelowInput() {
2910
+ if (this.#options.dropdownAlwaysOpen) {
2911
+ return true;
2912
+ }
2913
+ const inputPos = this.telInput.getBoundingClientRect();
2914
+ const spaceAbove = inputPos.top;
2915
+ const spaceBelow = window.innerHeight - inputPos.bottom;
2916
+ return spaceBelow >= this.#inlineDropdownHeight || spaceBelow >= spaceAbove;
2917
+ }
2918
+ // inject dropdown into container and apply positioning styles
2919
+ #handleDropdownContainer() {
2920
+ const { dropdownContainer, useFullscreenPopup } = this.#options;
2921
+ if (useFullscreenPopup) {
2922
+ if (window.innerWidth >= LAYOUT.NARROW_VIEWPORT_WIDTH) {
2923
+ const inputPos = this.telInput.getBoundingClientRect();
2924
+ this.#dropdownForContainer.style.paddingLeft = `${inputPos.left}px`;
2925
+ this.#dropdownForContainer.style.paddingRight = `${window.innerWidth - inputPos.right}px`;
2926
+ }
2927
+ } else {
2928
+ const inputPos = this.telInput.getBoundingClientRect();
2929
+ this.#dropdownForContainer.style.left = `${inputPos.left}px`;
2930
+ const positionBelow = this.#shouldPositionInlineDropdownBelowInput();
2931
+ if (positionBelow) {
2932
+ this.#dropdownForContainer.style.top = `${inputPos.bottom + LAYOUT.DROPDOWN_MARGIN}px`;
2933
+ } else {
2934
+ this.#dropdownForContainer.style.top = "unset";
2935
+ this.#dropdownForContainer.style.bottom = `${window.innerHeight - inputPos.top + LAYOUT.DROPDOWN_MARGIN}px`;
2936
+ }
2937
+ }
2938
+ dropdownContainer.appendChild(this.#dropdownForContainer);
2939
+ }
2940
+ // UI: Whether the dropdown is currently closed (hidden).
2941
+ isDropdownClosed() {
2942
+ return this.#dropdownContent.classList.contains(CLASSES.HIDE);
2943
+ }
2944
+ setCountry(selectedCountryData) {
2945
+ const { allowDropdown, showFlags, separateDialCode, i18n } = this.#options;
2946
+ const { name, dialCode, iso2 = "" } = selectedCountryData;
2947
+ if (allowDropdown) {
2948
+ this.#updateSelectedItem(iso2);
2949
+ }
2950
+ if (this.selectedCountry) {
2951
+ const flagClass = iso2 && showFlags ? `${CLASSES.FLAG} iti__${iso2}` : `${CLASSES.FLAG} ${CLASSES.GLOBE}`;
2952
+ let ariaLabel, title, selectedCountryInner;
2953
+ if (iso2) {
2954
+ title = name;
2955
+ ariaLabel = i18n.selectedCountryAriaLabel.replace("${countryName}", name).replace("${dialCode}", `+${dialCode}`);
2956
+ selectedCountryInner = showFlags ? "" : buildGlobeIcon();
2957
+ } else {
2958
+ title = i18n.noCountrySelected;
2959
+ ariaLabel = i18n.noCountrySelected;
2960
+ selectedCountryInner = buildGlobeIcon();
2961
+ }
2962
+ this.selectedCountryInner.className = flagClass;
2963
+ this.selectedCountry.setAttribute("title", title);
2964
+ this.selectedCountry.setAttribute(ARIA.LABEL, ariaLabel);
2965
+ this.selectedCountryInner.innerHTML = selectedCountryInner;
2966
+ }
2967
+ if (separateDialCode) {
2968
+ const fullDialCode = dialCode ? `+${dialCode}` : "";
2969
+ this.#selectedDialCode.textContent = fullDialCode;
2970
+ this.#updateInputPadding();
2971
+ }
2972
+ }
2973
+ };
2974
+
2975
+ // src/js/modules/data/country-data.ts
2976
+ var processAllCountries = (options) => {
2977
+ const { onlyCountries, excludeCountries } = options;
2978
+ if (onlyCountries?.length) {
2979
+ return data_default.filter(
2980
+ (country) => onlyCountries.includes(country.iso2)
2981
+ );
2982
+ } else if (excludeCountries?.length) {
2983
+ return data_default.filter(
2984
+ (country) => !excludeCountries.includes(country.iso2)
2985
+ );
2986
+ }
2987
+ return data_default;
2988
+ };
2989
+ var generateCountryNames = (countries, options) => {
2990
+ const { countryNameLocale, i18n } = options;
2991
+ let displayNames;
2992
+ try {
2993
+ const hasDisplayNames = typeof Intl !== "undefined" && typeof Intl.DisplayNames === "function";
2994
+ if (hasDisplayNames) {
2995
+ displayNames = new Intl.DisplayNames(countryNameLocale, {
2996
+ type: "region"
2997
+ });
2998
+ } else {
2999
+ displayNames = null;
3000
+ }
3001
+ } catch (e) {
3002
+ console.error(e);
3003
+ displayNames = null;
3004
+ }
3005
+ for (const c of countries) {
3006
+ c.name = i18n[c.iso2] || displayNames?.of(c.iso2.toUpperCase()) || "";
3007
+ }
3008
+ };
3009
+ var processDialCodes = (countries) => {
3010
+ const dialCodes = /* @__PURE__ */ new Set();
3011
+ let dialCodeMaxLen = 0;
3012
+ const dialCodeToIso2Map = {};
3013
+ const addToDialCodeMap = (iso2, dialCode) => {
3014
+ if (!iso2 || !dialCode) {
3015
+ return;
3016
+ }
3017
+ if (dialCode.length > dialCodeMaxLen) {
3018
+ dialCodeMaxLen = dialCode.length;
3019
+ }
3020
+ if (!dialCodeToIso2Map.hasOwnProperty(dialCode)) {
3021
+ dialCodeToIso2Map[dialCode] = [];
3022
+ }
3023
+ const iso2List = dialCodeToIso2Map[dialCode];
3024
+ if (iso2List.includes(iso2)) {
3025
+ return;
3026
+ }
3027
+ iso2List.push(iso2);
3028
+ };
3029
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
3030
+ for (const c of countriesSortedByPriority) {
3031
+ if (!dialCodes.has(c.dialCode)) {
3032
+ dialCodes.add(c.dialCode);
3033
+ }
3034
+ for (let k = 1; k < c.dialCode.length; k++) {
3035
+ const partialDialCode = c.dialCode.substring(0, k);
3036
+ addToDialCodeMap(c.iso2, partialDialCode);
3037
+ }
3038
+ addToDialCodeMap(c.iso2, c.dialCode);
3039
+ if (c.areaCodes) {
3040
+ const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
3041
+ for (const areaCode of c.areaCodes) {
3042
+ for (let k = 1; k < areaCode.length; k++) {
3043
+ const partialAreaCode = areaCode.substring(0, k);
3044
+ const partialDialCode = c.dialCode + partialAreaCode;
3045
+ addToDialCodeMap(rootIso2Code, partialDialCode);
3046
+ addToDialCodeMap(c.iso2, partialDialCode);
3047
+ }
3048
+ addToDialCodeMap(c.iso2, c.dialCode + areaCode);
3049
+ }
3050
+ }
3051
+ }
3052
+ return { dialCodes, dialCodeMaxLen, dialCodeToIso2Map };
3053
+ };
3054
+ var sortCountries = (countries, options) => {
3055
+ const { countryOrder } = options;
3056
+ countries.sort((a, b) => {
3057
+ if (countryOrder) {
3058
+ const aIndex = countryOrder.indexOf(a.iso2);
3059
+ const bIndex = countryOrder.indexOf(b.iso2);
3060
+ const aIndexExists = aIndex > -1;
3061
+ const bIndexExists = bIndex > -1;
3062
+ if (aIndexExists || bIndexExists) {
3063
+ if (aIndexExists && bIndexExists) {
3064
+ return aIndex - bIndex;
3065
+ }
3066
+ return aIndexExists ? -1 : 1;
3067
+ }
3068
+ }
3069
+ return a.name.localeCompare(b.name);
3070
+ });
3071
+ };
3072
+ var cacheSearchTokens = (countries) => {
3073
+ for (const c of countries) {
3074
+ c.normalisedName = normaliseString(c.name);
3075
+ c.initials = c.normalisedName.split(/[^a-z]/).map((word) => word[0]).join("");
3076
+ c.dialCodePlus = `+${c.dialCode}`;
3077
+ }
3078
+ };
3079
+
3080
+ // src/js/modules/data/intl-regionless.ts
3081
+ var REGIONLESS_DIAL_CODES = /* @__PURE__ */ new Set([
3082
+ "800",
3083
+ "808",
3084
+ "870",
3085
+ "881",
3086
+ "882",
3087
+ "883",
3088
+ "888",
3089
+ "979"
3090
+ ]);
3091
+ var hasRegionlessDialCode = (number) => {
3092
+ const dialCode = getNumeric(number).slice(0, 3);
3093
+ return number.startsWith("+") && REGIONLESS_DIAL_CODES.has(dialCode);
3094
+ };
3095
+
3096
+ // src/js/modules/format/formatting.ts
3097
+ var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedCountryData) => {
3098
+ let number = fullNumber;
3099
+ if (separateDialCode) {
3100
+ if (hasValidDialCode) {
3101
+ const dialCode = `+${selectedCountryData.dialCode}`;
3102
+ const start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
3103
+ number = number.substring(start);
3104
+ }
3105
+ }
3106
+ return number;
3107
+ };
3108
+ var formatNumberAsYouType = (fullNumber, telInputValue, utils, selectedCountryData, separateDialCode) => {
3109
+ const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData.iso2) : fullNumber;
3110
+ const { dialCode } = selectedCountryData;
3111
+ if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
3112
+ const afterDialCode = result.split(`+${dialCode}`)[1] || "";
3113
+ return afterDialCode.trim();
3114
+ }
3115
+ return result;
3116
+ };
3117
+
3118
+ // src/js/modules/format/caret.ts
3119
+ var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => {
3120
+ if (prevCaretPos === 0 && !isDeleteForwards) {
3121
+ return 0;
3122
+ }
3123
+ let relevantCharCount = 0;
3124
+ for (let i = 0; i < formattedValue.length; i++) {
3125
+ if (/[+0-9]/.test(formattedValue[i])) {
3126
+ relevantCharCount++;
3127
+ }
3128
+ if (relevantCharCount === relevantChars && !isDeleteForwards) {
3129
+ return i + 1;
3130
+ }
3131
+ if (isDeleteForwards && relevantCharCount === relevantChars + 1) {
3132
+ return i;
3133
+ }
3134
+ }
3135
+ return formattedValue.length;
3136
+ };
3137
+
3138
+ // src/js/modules/data/nanp-regionless.ts
3139
+ var regionlessNanpNumbers = /* @__PURE__ */ new Set([
3140
+ "800",
3141
+ "822",
3142
+ "833",
3143
+ "844",
3144
+ "855",
3145
+ "866",
3146
+ "877",
3147
+ "880",
3148
+ "881",
3149
+ "882",
3150
+ "883",
3151
+ "884",
3152
+ "885",
3153
+ "886",
3154
+ "887",
3155
+ "888",
3156
+ "889"
3157
+ ]);
3158
+ var isRegionlessNanp = (number) => {
3159
+ const numeric = getNumeric(number);
3160
+ if (numeric.startsWith(DIAL.NANP) && numeric.length >= 4) {
3161
+ const areaCode = numeric.substring(1, 4);
3162
+ return regionlessNanpNumbers.has(areaCode);
3163
+ }
3164
+ return false;
3165
+ };
3166
+
3167
+ // src/js/modules/core/numerals.ts
3168
+ var Numerals = class {
3169
+ #userNumeralSet;
3170
+ constructor(initialValue) {
3171
+ if (initialValue) {
3172
+ this.#updateNumeralSet(initialValue);
3173
+ }
3174
+ }
3175
+ // If any Arabic-Indic digits, then label it as that set. Same for Persian. Otherwise assume ASCII.
3176
+ #updateNumeralSet(str) {
3177
+ if (/[\u0660-\u0669]/.test(str)) {
3178
+ this.#userNumeralSet = "arabic-indic";
3179
+ } else if (/[\u06F0-\u06F9]/.test(str)) {
3180
+ this.#userNumeralSet = "persian";
3181
+ } else {
3182
+ this.#userNumeralSet = "ascii";
3183
+ }
3184
+ }
3185
+ // Denormalise ASCII 0-9 to the user's numeral set. If not yet known, return as-is.
3186
+ // NOTE: normalise is always called before this, so it should be impossible for the numeral set to be unknown at this point.
3187
+ denormalise(str) {
3188
+ if (!this.#userNumeralSet || this.#userNumeralSet === "ascii") {
3189
+ return str;
3190
+ }
3191
+ const base = this.#userNumeralSet === "arabic-indic" ? 1632 : 1776;
3192
+ return str.replace(/[0-9]/g, (d) => String.fromCharCode(base + Number(d)));
3193
+ }
3194
+ // Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9
3195
+ normalise(str) {
3196
+ if (!str) {
3197
+ return "";
3198
+ }
3199
+ this.#updateNumeralSet(str);
3200
+ if (this.#userNumeralSet === "ascii") {
3201
+ return str;
3202
+ }
3203
+ const base = this.#userNumeralSet === "arabic-indic" ? 1632 : 1776;
3204
+ const regex = this.#userNumeralSet === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
3205
+ return str.replace(regex, (ch) => String.fromCharCode(48 + (ch.charCodeAt(0) - base)));
3206
+ }
3207
+ isAscii() {
3208
+ return !this.#userNumeralSet || this.#userNumeralSet === "ascii";
3209
+ }
3210
+ };
3211
+
3212
+ // src/js/intl-tel-input.ts
3213
+ var id = 0;
3214
+ var Iti = class _Iti {
3215
+ //* PRIVATE FIELDS
3216
+ #ui;
3217
+ #options;
3218
+ #isAndroid;
3219
+ // country data
3220
+ #countries;
3221
+ #dialCodeMaxLen;
3222
+ #dialCodeToIso2Map;
3223
+ #dialCodes;
3224
+ #countryByIso2;
3225
+ #selectedCountryData;
3226
+ #maxCoreNumberLength;
3227
+ #defaultCountry;
3228
+ #abortController;
3229
+ #dropdownAbortController;
3230
+ #numerals;
3231
+ #resolveAutoCountryPromise;
3232
+ #rejectAutoCountryPromise;
3233
+ #resolveUtilsScriptPromise;
3234
+ #rejectUtilsScriptPromise;
3235
+ constructor(input, customOptions = {}) {
3236
+ this.id = id++;
3237
+ UI.validateInput(input);
3238
+ const validatedOptions = validateOptions(customOptions);
3239
+ this.#options = { ...defaults, ...validatedOptions };
3240
+ normaliseOptions(this.#options);
3241
+ applyOptionSideEffects(this.#options);
3242
+ this.#ui = new UI(input, this.#options, this.id);
3243
+ this.#isAndroid = getIsAndroid();
3244
+ this.#numerals = new Numerals(input.value);
3245
+ this.promise = this.#createInitPromises(this.#options);
3246
+ this.#countries = processAllCountries(this.#options);
3247
+ const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(
3248
+ this.#countries
3249
+ );
3250
+ this.#dialCodes = dialCodes;
3251
+ this.#dialCodeMaxLen = dialCodeMaxLen;
3252
+ this.#dialCodeToIso2Map = dialCodeToIso2Map;
3253
+ this.#countryByIso2 = new Map(this.#countries.map((c) => [c.iso2, c]));
3254
+ this.#init();
3255
+ }
3256
+ #getTelInputValue() {
3257
+ const inputValue = this.#ui.telInput.value.trim();
3258
+ return this.#numerals.normalise(inputValue);
3259
+ }
3260
+ #setTelInputValue(asciiValue) {
3261
+ this.#ui.telInput.value = this.#numerals.denormalise(asciiValue);
3262
+ }
3263
+ #createInitPromises(options) {
3264
+ const { initialCountry, geoIpLookup, loadUtils } = options;
3265
+ const needsAutoCountryPromise = initialCountry === INITIAL_COUNTRY.AUTO && Boolean(geoIpLookup);
3266
+ const needsUtilsScriptPromise = Boolean(loadUtils) && !intlTelInput.utils;
3267
+ let autoCountryPromise;
3268
+ if (needsAutoCountryPromise) {
3269
+ autoCountryPromise = new Promise((resolve, reject) => {
3270
+ this.#resolveAutoCountryPromise = resolve;
3271
+ this.#rejectAutoCountryPromise = reject;
3272
+ });
3273
+ } else {
3274
+ autoCountryPromise = Promise.resolve(void 0);
3275
+ this.#resolveAutoCountryPromise = () => {
3276
+ };
3277
+ this.#rejectAutoCountryPromise = () => {
3278
+ };
3279
+ }
3280
+ let utilsScriptPromise;
3281
+ if (needsUtilsScriptPromise) {
3282
+ utilsScriptPromise = new Promise((resolve, reject) => {
3283
+ this.#resolveUtilsScriptPromise = resolve;
3284
+ this.#rejectUtilsScriptPromise = reject;
3285
+ });
3286
+ } else {
3287
+ utilsScriptPromise = Promise.resolve(void 0);
3288
+ this.#resolveUtilsScriptPromise = () => {
3289
+ };
3290
+ this.#rejectUtilsScriptPromise = () => {
3291
+ };
3292
+ }
3293
+ return Promise.all([autoCountryPromise, utilsScriptPromise]).then(() => {
3294
+ });
3295
+ }
3296
+ #init() {
3297
+ this.#selectedCountryData = null;
3298
+ this.#abortController = new AbortController();
3299
+ this.#processCountryData();
3300
+ this.#ui.generateMarkup(this.#countries);
3301
+ this.#setInitialState();
3302
+ this.#initListeners();
3303
+ this.#initRequests();
3304
+ if (this.#options.dropdownAlwaysOpen) {
3305
+ this.#openDropdown();
3306
+ }
3307
+ }
3308
+ //********************
3309
+ //* PRIVATE METHODS
3310
+ //********************
3311
+ //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
3312
+ #processCountryData() {
3313
+ generateCountryNames(this.#countries, this.#options);
3314
+ sortCountries(this.#countries, this.#options);
3315
+ cacheSearchTokens(this.#countries);
3316
+ }
3317
+ //* Set the initial state of the input value and the selected country by:
3318
+ //* 1. Extracting a dial code from the given number
3319
+ //* 2. Using explicit initialCountry
3320
+ #setInitialState(overrideAutoCountry = false) {
3321
+ const attributeValueRaw = this.#ui.telInput.getAttribute("value");
3322
+ const attributeValue = this.#numerals.normalise(attributeValueRaw);
3323
+ const inputValue = this.#getTelInputValue();
3324
+ const useAttribute = attributeValue && attributeValue.startsWith("+") && (!inputValue || !inputValue.startsWith("+"));
3325
+ const val = useAttribute ? attributeValue : inputValue;
3326
+ const dialCode = this.#getDialCode(val);
3327
+ const isRegionlessNanpNumber = isRegionlessNanp(val);
3328
+ const { initialCountry, geoIpLookup } = this.#options;
3329
+ const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
3330
+ const doingAutoCountryLookup = isAutoCountry && !overrideAutoCountry;
3331
+ const isValidInitialCountry = isIso2(initialCountry);
3332
+ if (dialCode) {
3333
+ if (isRegionlessNanpNumber) {
3334
+ if (isValidInitialCountry) {
3335
+ this.#setCountry(initialCountry);
3336
+ } else if (!doingAutoCountryLookup) {
3337
+ this.#setCountry(US.ISO2);
3338
+ }
3339
+ } else {
3340
+ this.#updateCountryFromNumber(val);
3341
+ }
3342
+ } else if (isValidInitialCountry) {
3343
+ this.#setCountry(initialCountry);
3344
+ } else if (!doingAutoCountryLookup) {
3345
+ this.#setCountry("");
3346
+ }
3347
+ if (val) {
3348
+ this.#updateValFromNumber(val);
3349
+ }
3350
+ }
3351
+ //* Initialise the main event listeners: input keyup, and click selected country.
3352
+ #initListeners() {
3353
+ this.#initTelInputListeners();
3354
+ if (this.#options.allowDropdown) {
3355
+ this.#initDropdownListeners();
3356
+ }
3357
+ if ((this.#ui.hiddenInput || this.#ui.hiddenInputCountry) && this.#ui.telInput.form) {
3358
+ this.#initHiddenInputListener();
3359
+ }
3360
+ }
3361
+ //* Update hidden input on form submit.
3362
+ #initHiddenInputListener() {
3363
+ const handleHiddenInputSubmit = () => {
3364
+ if (this.#ui.hiddenInput) {
3365
+ this.#ui.hiddenInput.value = this.getNumber();
3366
+ }
3367
+ if (this.#ui.hiddenInputCountry) {
3368
+ this.#ui.hiddenInputCountry.value = this.#selectedCountryData?.iso2 || "";
3369
+ }
3370
+ };
3371
+ this.#ui.telInput.form?.addEventListener("submit", handleHiddenInputSubmit, {
3372
+ signal: this.#abortController.signal
3373
+ });
3374
+ }
3375
+ //* initialise the dropdown listeners.
3376
+ #initDropdownListeners() {
3377
+ const signal = this.#abortController.signal;
3378
+ const handleLabelClick = (e) => {
3379
+ if (this.#ui.isDropdownClosed()) {
3380
+ this.#ui.telInput.focus();
3381
+ } else {
3382
+ e.preventDefault();
3383
+ }
3384
+ };
3385
+ const label = this.#ui.telInput.closest("label");
3386
+ if (label) {
3387
+ label.addEventListener("click", handleLabelClick, { signal });
3388
+ }
3389
+ const handleClickSelectedCountry = () => {
3390
+ if (this.#ui.isDropdownClosed() && !this.#ui.telInput.disabled && !this.#ui.telInput.readOnly) {
3391
+ this.#openDropdown();
3392
+ }
3393
+ };
3394
+ this.#ui.selectedCountry.addEventListener(
3395
+ "click",
3396
+ handleClickSelectedCountry,
3397
+ {
3398
+ signal
3399
+ }
3400
+ );
3401
+ const handleCountryContainerKeydown = (e) => {
3402
+ const allowedKeys = [KEYS.ARROW_UP, KEYS.ARROW_DOWN, KEYS.SPACE, KEYS.ENTER];
3403
+ if (this.#ui.isDropdownClosed() && allowedKeys.includes(e.key)) {
3404
+ e.preventDefault();
3405
+ e.stopPropagation();
3406
+ this.#openDropdown();
3407
+ }
3408
+ if (e.key === KEYS.TAB) {
3409
+ this.#closeDropdown();
3410
+ }
3411
+ };
3412
+ this.#ui.countryContainer.addEventListener(
3413
+ "keydown",
3414
+ handleCountryContainerKeydown,
3415
+ { signal }
3416
+ );
3417
+ }
3418
+ //* Init requests: utils script / geo ip lookup.
3419
+ #initRequests() {
3420
+ const { loadUtils, initialCountry, geoIpLookup } = this.#options;
3421
+ if (loadUtils && !intlTelInput.utils) {
3422
+ const doAttachUtils = () => {
3423
+ intlTelInput.attachUtils(loadUtils)?.catch(() => {
3424
+ });
3425
+ };
3426
+ if (intlTelInput.documentReady()) {
3427
+ doAttachUtils();
3428
+ } else {
3429
+ window.addEventListener("load", doAttachUtils, {
3430
+ signal: this.#abortController.signal
3431
+ });
3432
+ }
3433
+ } else {
3434
+ this.#resolveUtilsScriptPromise();
3435
+ }
3436
+ const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
3437
+ if (isAutoCountry) {
3438
+ if (this.#selectedCountryData?.iso2) {
3439
+ this.#resolveAutoCountryPromise();
3440
+ } else {
3441
+ this.#loadAutoCountry();
3442
+ }
3443
+ }
3444
+ }
3445
+ //* Perform the geo ip lookup.
3446
+ #loadAutoCountry() {
3447
+ if (intlTelInput.autoCountry) {
3448
+ this.#handleAutoCountry();
3449
+ } else {
3450
+ this.#ui.selectedCountryInner.classList.add(CLASSES.LOADING);
3451
+ if (!intlTelInput.startedLoadingAutoCountry) {
3452
+ intlTelInput.startedLoadingAutoCountry = true;
3453
+ if (typeof this.#options.geoIpLookup === "function") {
3454
+ const successCallback = (iso2 = "") => {
3455
+ this.#ui.selectedCountryInner.classList.remove(CLASSES.LOADING);
3456
+ const iso2Lower = iso2.toLowerCase();
3457
+ if (isIso2(iso2Lower)) {
3458
+ intlTelInput.autoCountry = iso2Lower;
3459
+ setTimeout(() => _Iti.forEachInstance("handleAutoCountry"));
3460
+ } else {
3461
+ _Iti.forEachInstance("handleAutoCountryFailure");
3462
+ }
3463
+ };
3464
+ const failureCallback = () => {
3465
+ this.#ui.selectedCountryInner.classList.remove(CLASSES.LOADING);
3466
+ _Iti.forEachInstance("handleAutoCountryFailure");
3467
+ };
3468
+ this.#options.geoIpLookup(successCallback, failureCallback);
3469
+ }
3470
+ }
3471
+ }
3472
+ }
3473
+ #openDropdownWithPlus() {
3474
+ this.#openDropdown();
3475
+ this.#ui.searchInput.value = "+";
3476
+ this.#ui.filterCountriesByQuery("");
3477
+ }
3478
+ //* Initialize the tel input listeners.
3479
+ #initTelInputListeners() {
3480
+ this.#bindInputListener();
3481
+ this.#maybeBindKeydownListener();
3482
+ this.#maybeBindPasteListener();
3483
+ }
3484
+ #bindInputListener() {
3485
+ const {
3486
+ strictMode,
3487
+ formatAsYouType,
3488
+ separateDialCode,
3489
+ allowDropdown,
3490
+ countrySearch
3491
+ } = this.#options;
3492
+ let userOverrideFormatting = false;
3493
+ if (REGEX.ALPHA_UNICODE.test(this.#getTelInputValue())) {
3494
+ userOverrideFormatting = true;
3495
+ }
3496
+ const handleInputEvent = (e) => {
3497
+ const inputValue = this.#getTelInputValue();
3498
+ if (this.#isAndroid && e?.data === "+" && separateDialCode && allowDropdown && countrySearch) {
3499
+ const currentCaretPos = this.#ui.telInput.selectionStart || 0;
3500
+ const valueBeforeCaret = inputValue.substring(0, currentCaretPos - 1);
3501
+ const valueAfterCaret = inputValue.substring(currentCaretPos);
3502
+ this.#setTelInputValue(valueBeforeCaret + valueAfterCaret);
3503
+ this.#openDropdownWithPlus();
3504
+ return;
3505
+ }
3506
+ if (this.#updateCountryFromNumber(inputValue)) {
3507
+ this.#triggerCountryChange();
3508
+ }
3509
+ const isFormattingChar = e?.data && REGEX.NON_PLUS_NUMERIC.test(e.data);
3510
+ const isPaste = e?.inputType === INPUT_TYPES.PASTE && inputValue;
3511
+ if (isFormattingChar || isPaste && !strictMode) {
3512
+ userOverrideFormatting = true;
3513
+ } else if (!REGEX.NON_PLUS_NUMERIC.test(inputValue)) {
3514
+ userOverrideFormatting = false;
3515
+ }
3516
+ const isSetNumber = e?.detail && e.detail["isSetNumber"];
3517
+ const isAscii = this.#numerals.isAscii();
3518
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber && isAscii) {
3519
+ const currentCaretPos = this.#ui.telInput.selectionStart || 0;
3520
+ const valueBeforeCaret = inputValue.substring(
3521
+ 0,
3522
+ currentCaretPos
3523
+ );
3524
+ const relevantCharsBeforeCaret = valueBeforeCaret.replace(
3525
+ REGEX.NON_PLUS_NUMERIC_GLOBAL,
3526
+ ""
3527
+ ).length;
3528
+ const isDeleteForwards = e?.inputType === INPUT_TYPES.DELETE_FWD;
3529
+ const fullNumber = this.#getFullNumber();
3530
+ const formattedValue = formatNumberAsYouType(
3531
+ fullNumber,
3532
+ inputValue,
3533
+ intlTelInput.utils,
3534
+ this.#selectedCountryData ?? {},
3535
+ separateDialCode
3536
+ );
3537
+ const newCaretPos = translateCursorPosition(
3538
+ relevantCharsBeforeCaret,
3539
+ formattedValue,
3540
+ currentCaretPos,
3541
+ isDeleteForwards
3542
+ );
3543
+ this.#setTelInputValue(formattedValue);
3544
+ this.#ui.telInput.setSelectionRange(newCaretPos, newCaretPos);
3545
+ }
3546
+ if (separateDialCode && inputValue.startsWith("+") && this.#selectedCountryData?.dialCode) {
3547
+ const cleanNumber = beforeSetNumber(
3548
+ inputValue,
3549
+ true,
3550
+ separateDialCode,
3551
+ this.#selectedCountryData ?? {}
3552
+ );
3553
+ this.#setTelInputValue(cleanNumber);
3554
+ }
3555
+ };
3556
+ this.#ui.telInput.addEventListener(
3557
+ "input",
3558
+ handleInputEvent,
3559
+ {
3560
+ signal: this.#abortController.signal
3561
+ }
3562
+ );
3563
+ }
3564
+ #maybeBindKeydownListener() {
3565
+ const { strictMode, separateDialCode, allowDropdown, countrySearch } = this.#options;
3566
+ if (strictMode || separateDialCode) {
3567
+ const handleKeydownEvent = (e) => {
3568
+ if (e.key && e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
3569
+ if (separateDialCode && allowDropdown && countrySearch && e.key === "+") {
3570
+ e.preventDefault();
3571
+ this.#openDropdownWithPlus();
3572
+ return;
3573
+ }
3574
+ if (strictMode) {
3575
+ const inputValue = this.#getTelInputValue();
3576
+ const alreadyHasPlus = inputValue.startsWith("+");
3577
+ const isInitialPlus = !alreadyHasPlus && this.#ui.telInput.selectionStart === 0 && e.key === "+";
3578
+ const normalisedKey = this.#numerals.normalise(e.key);
3579
+ const isNumeric = /^[0-9]$/.test(normalisedKey);
3580
+ const isAllowedChar = separateDialCode ? isNumeric : isInitialPlus || isNumeric;
3581
+ const input = this.#ui.telInput;
3582
+ const selStart = input.selectionStart;
3583
+ const selEnd = input.selectionEnd;
3584
+ const before = inputValue.slice(0, selStart);
3585
+ const after = inputValue.slice(selEnd);
3586
+ const newValue = before + e.key + after;
3587
+ const newFullNumber = this.#getFullNumber(newValue);
3588
+ let hasExceededMaxLength = false;
3589
+ if (intlTelInput.utils && this.#maxCoreNumberLength) {
3590
+ const coreNumber = intlTelInput.utils.getCoreNumber(
3591
+ newFullNumber,
3592
+ this.#selectedCountryData?.iso2
3593
+ );
3594
+ hasExceededMaxLength = coreNumber.length > this.#maxCoreNumberLength;
3595
+ }
3596
+ const newCountry = this.#getNewCountryFromNumber(newFullNumber);
3597
+ const isChangingDialCode = newCountry !== null;
3598
+ if (!isAllowedChar || hasExceededMaxLength && !isChangingDialCode && !isInitialPlus) {
3599
+ e.preventDefault();
3600
+ }
3601
+ }
3602
+ }
3603
+ };
3604
+ this.#ui.telInput.addEventListener("keydown", handleKeydownEvent, {
3605
+ signal: this.#abortController.signal
3606
+ });
3607
+ }
3608
+ }
3609
+ #maybeBindPasteListener() {
3610
+ if (this.#options.strictMode) {
3611
+ const handlePasteEvent = (e) => {
3612
+ e.preventDefault();
3613
+ const input = this.#ui.telInput;
3614
+ const selStart = input.selectionStart;
3615
+ const selEnd = input.selectionEnd;
3616
+ const inputValue = this.#getTelInputValue();
3617
+ const before = inputValue.slice(0, selStart);
3618
+ const after = inputValue.slice(selEnd);
3619
+ const iso2 = this.#selectedCountryData?.iso2;
3620
+ const pastedRaw = e.clipboardData.getData("text");
3621
+ const pasted = this.#numerals.normalise(pastedRaw);
3622
+ const initialCharSelected = selStart === 0 && selEnd > 0;
3623
+ const allowLeadingPlus = !inputValue.startsWith("+") || initialCharSelected;
3624
+ const allowedChars = pasted.replace(REGEX.NON_PLUS_NUMERIC_GLOBAL, "");
3625
+ const hasLeadingPlus = allowedChars.startsWith("+");
3626
+ const numerics = allowedChars.replace(/\+/g, "");
3627
+ const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
3628
+ let newVal = before + sanitised + after;
3629
+ if (newVal.length > 5) {
3630
+ let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
3631
+ while (coreNumber.length === 0 && newVal.length > 0) {
3632
+ newVal = newVal.slice(0, -1);
3633
+ coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
3634
+ }
3635
+ if (!coreNumber) {
3636
+ return;
3637
+ }
3638
+ if (this.#maxCoreNumberLength && coreNumber.length > this.#maxCoreNumberLength) {
3639
+ if (input.selectionEnd === inputValue.length) {
3640
+ const trimLength = coreNumber.length - this.#maxCoreNumberLength;
3641
+ newVal = newVal.slice(0, newVal.length - trimLength);
3642
+ } else {
3643
+ return;
3644
+ }
3645
+ }
3646
+ }
3647
+ this.#setTelInputValue(newVal);
3648
+ const caretPos = selStart + sanitised.length;
3649
+ input.setSelectionRange(caretPos, caretPos);
3650
+ input.dispatchEvent(new InputEvent("input", { bubbles: true }));
3651
+ };
3652
+ this.#ui.telInput.addEventListener("paste", handlePasteEvent, {
3653
+ signal: this.#abortController.signal
3654
+ });
3655
+ }
3656
+ }
3657
+ //* Adhere to the input's maxlength attr.
3658
+ #cap(number) {
3659
+ const max = Number(this.#ui.telInput.getAttribute("maxlength"));
3660
+ return max && number.length > max ? number.substring(0, max) : number;
3661
+ }
3662
+ //* Trigger a custom event on the input (typed via ItiEventMap).
3663
+ #trigger(name, detailProps = {}) {
3664
+ const e = new CustomEvent(name, {
3665
+ bubbles: true,
3666
+ cancelable: true,
3667
+ detail: detailProps
3668
+ });
3669
+ this.#ui.telInput.dispatchEvent(e);
3670
+ }
3671
+ //* Open the dropdown.
3672
+ #openDropdown() {
3673
+ const { dropdownContainer, useFullscreenPopup } = this.#options;
3674
+ this.#dropdownAbortController = new AbortController();
3675
+ this.#ui.openDropdown();
3676
+ if (!useFullscreenPopup && dropdownContainer) {
3677
+ const handleWindowScroll = () => this.#closeDropdown();
3678
+ window.addEventListener("scroll", handleWindowScroll, {
3679
+ signal: this.#dropdownAbortController.signal
3680
+ });
3681
+ }
3682
+ this.#bindDropdownListeners();
3683
+ this.#trigger(EVENTS.OPEN_COUNTRY_DROPDOWN);
3684
+ }
3685
+ //* We only bind dropdown listeners when the dropdown is open.
3686
+ #bindDropdownListeners() {
3687
+ const signal = this.#dropdownAbortController.signal;
3688
+ this.#bindDropdownMouseoverListener(signal);
3689
+ this.#bindDropdownCountryClickListener(signal);
3690
+ if (!this.#options.dropdownAlwaysOpen) {
3691
+ this.#bindDropdownClickOffListener(signal);
3692
+ }
3693
+ this.#bindDropdownKeydownListener(signal);
3694
+ if (this.#options.countrySearch) {
3695
+ this.#bindDropdownSearchListeners(signal);
3696
+ }
3697
+ }
3698
+ //* When mouse over a list item, just highlight that one
3699
+ //* we add the class "highlight", so if they hit "enter" we know which one to select.
3700
+ #bindDropdownMouseoverListener(signal) {
3701
+ const handleMouseoverCountryList = (e) => {
3702
+ const listItem = e.target?.closest(
3703
+ `.${CLASSES.COUNTRY_ITEM}`
3704
+ );
3705
+ if (listItem) {
3706
+ this.#ui.highlightListItem(listItem, false);
3707
+ }
3708
+ };
3709
+ this.#ui.countryList.addEventListener(
3710
+ "mouseover",
3711
+ handleMouseoverCountryList,
3712
+ {
3713
+ signal
3714
+ }
3715
+ );
3716
+ }
3717
+ //* Listen for country selection.
3718
+ #bindDropdownCountryClickListener(signal) {
3719
+ const handleClickCountryList = (e) => {
3720
+ const listItem = e.target?.closest(
3721
+ `.${CLASSES.COUNTRY_ITEM}`
3722
+ );
3723
+ if (listItem) {
3724
+ this.#selectListItem(listItem);
3725
+ }
3726
+ };
3727
+ this.#ui.countryList.addEventListener("click", handleClickCountryList, {
3728
+ signal
3729
+ });
3730
+ }
3731
+ //* Click off to close (except when this initial opening click is bubbling up).
3732
+ //* We cannot just stopPropagation as it may be needed to close another instance.
3733
+ #bindDropdownClickOffListener(signal) {
3734
+ const handleClickOffToClose = (e) => {
3735
+ const target = e.target;
3736
+ const clickedInsideDropdown = !!target.closest(
3737
+ `#iti-${this.id}__dropdown-content`
3738
+ );
3739
+ if (!clickedInsideDropdown) {
3740
+ this.#closeDropdown();
3741
+ }
3742
+ };
3743
+ setTimeout(() => {
3744
+ document.documentElement.addEventListener(
3745
+ "click",
3746
+ handleClickOffToClose,
3747
+ { signal }
3748
+ );
3749
+ }, 0);
3750
+ }
3751
+ //* Listen for up/down scrolling, enter to select, or escape to close.
3752
+ //* Use keydown as keypress doesn't fire for non-char keys and we want to catch if they
3753
+ //* just hit down and hold it to scroll down (no keyup event).
3754
+ //* Listen on the document because that's where key events are triggered if no input has focus.
3755
+ #bindDropdownKeydownListener(signal) {
3756
+ let query = "";
3757
+ let queryTimer = null;
3758
+ const handleKeydownOnDropdown = (e) => {
3759
+ const allowedKeys = [
3760
+ KEYS.ARROW_UP,
3761
+ KEYS.ARROW_DOWN,
3762
+ KEYS.ENTER,
3763
+ KEYS.ESC
3764
+ ];
3765
+ if (allowedKeys.includes(e.key)) {
3766
+ e.preventDefault();
3767
+ e.stopPropagation();
3768
+ if (e.key === KEYS.ARROW_UP || e.key === KEYS.ARROW_DOWN) {
3769
+ this.#ui.handleUpDownKey(e.key);
3770
+ } else if (e.key === KEYS.ENTER && !e.isComposing) {
3771
+ this.#handleEnterKey();
3772
+ } else if (e.key === KEYS.ESC) {
3773
+ this.#closeDropdown();
3774
+ this.#ui.selectedCountry.focus();
3775
+ }
3776
+ }
3777
+ if (!this.#options.countrySearch && REGEX.HIDDEN_SEARCH_CHAR.test(e.key)) {
3778
+ e.stopPropagation();
3779
+ if (queryTimer) {
3780
+ clearTimeout(queryTimer);
3781
+ }
3782
+ query += e.key.toLowerCase();
3783
+ this.#searchForCountry(query);
3784
+ queryTimer = setTimeout(() => {
3785
+ query = "";
3786
+ }, TIMINGS.HIDDEN_SEARCH_RESET_MS);
3787
+ }
3788
+ };
3789
+ document.addEventListener("keydown", handleKeydownOnDropdown, { signal });
3790
+ }
3791
+ //* Search input listeners when countrySearch enabled.
3792
+ #bindDropdownSearchListeners(signal) {
3793
+ this.#ui.searchInput.addEventListener(
3794
+ "input",
3795
+ () => this.#ui.handleSearchChange(),
3796
+ { signal }
3797
+ );
3798
+ this.#ui.searchClearButton.addEventListener(
3799
+ "click",
3800
+ () => this.#ui.handleSearchClear(),
3801
+ { signal }
3802
+ );
3803
+ }
3804
+ //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
3805
+ #searchForCountry(query) {
3806
+ const match = findFirstCountryStartingWith(this.#countries, query);
3807
+ if (match) {
3808
+ const listItem = match.nodeById[this.id];
3809
+ this.#ui.highlightListItem(listItem, false);
3810
+ this.#ui.scrollCountryListToItem(listItem);
3811
+ }
3812
+ }
3813
+ //* Select the currently highlighted item.
3814
+ #handleEnterKey() {
3815
+ if (this.#ui.highlightedItem) {
3816
+ this.#selectListItem(this.#ui.highlightedItem);
3817
+ }
3818
+ }
3819
+ //* Update the input's value to the given val (format first if possible)
3820
+ //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
3821
+ #updateValFromNumber(fullNumber) {
3822
+ const { formatOnDisplay, nationalMode, separateDialCode } = this.#options;
3823
+ let number = fullNumber;
3824
+ if (formatOnDisplay && intlTelInput.utils && this.#selectedCountryData) {
3825
+ const isRegionless = hasRegionlessDialCode(fullNumber);
3826
+ const useNational = nationalMode && !isRegionless || !number.startsWith("+") && !separateDialCode;
3827
+ const { NATIONAL, INTERNATIONAL } = intlTelInput.utils.numberFormat;
3828
+ const format = useNational ? NATIONAL : INTERNATIONAL;
3829
+ number = intlTelInput.utils.formatNumber(
3830
+ number,
3831
+ this.#selectedCountryData?.iso2,
3832
+ format
3833
+ );
3834
+ }
3835
+ number = this.#beforeSetNumber(number);
3836
+ this.#setTelInputValue(number);
3837
+ }
3838
+ //* Check if need to select a new country based on the given number
3839
+ //* Note: called from _setInitialState, keyup handler, setNumber.
3840
+ #updateCountryFromNumber(fullNumber) {
3841
+ const iso2 = this.#getNewCountryFromNumber(fullNumber);
3842
+ if (iso2 !== null) {
3843
+ return this.#setCountry(iso2);
3844
+ }
3845
+ return false;
3846
+ }
3847
+ // if there is a selected country, and the number doesn't start with a dial code, then add it
3848
+ #ensureHasDialCode(number) {
3849
+ const dialCode = this.#selectedCountryData?.dialCode;
3850
+ const nationalPrefix = this.#selectedCountryData?.nationalPrefix;
3851
+ const alreadyHasPlus = number.startsWith("+");
3852
+ if (alreadyHasPlus || !dialCode) {
3853
+ return number;
3854
+ }
3855
+ const hasPrefix = nationalPrefix && number.startsWith(nationalPrefix) && !this.#options.separateDialCode;
3856
+ const cleanNumber = hasPrefix ? number.substring(1) : number;
3857
+ return `+${dialCode}${cleanNumber}`;
3858
+ }
3859
+ //* Get the new country based on the input number, or return null if no change, or empty string if should be empty (e.g. if they type an invalid dial code).
3860
+ #getNewCountryFromNumber(fullNumber) {
3861
+ const plusIndex = fullNumber.indexOf("+");
3862
+ let number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber;
3863
+ const selectedIso2 = this.#selectedCountryData?.iso2;
3864
+ const selectedDialCode = this.#selectedCountryData?.dialCode;
3865
+ number = this.#ensureHasDialCode(number);
3866
+ const dialCodeMatch = this.#getDialCode(number, true);
3867
+ const numeric = getNumeric(number);
3868
+ if (dialCodeMatch) {
3869
+ const dialCodeMatchNumeric = getNumeric(dialCodeMatch);
3870
+ const iso2Codes = this.#dialCodeToIso2Map[dialCodeMatchNumeric];
3871
+ if (iso2Codes.length === 1) {
3872
+ if (iso2Codes[0] === selectedIso2) {
3873
+ return null;
3874
+ }
3875
+ return iso2Codes[0];
3876
+ }
3877
+ if (!selectedIso2 && this.#defaultCountry && iso2Codes.includes(this.#defaultCountry)) {
3878
+ return this.#defaultCountry;
3879
+ }
3880
+ const isRegionlessNanpNumber = selectedDialCode === DIAL.NANP && isRegionlessNanp(numeric);
3881
+ if (isRegionlessNanpNumber) {
3882
+ return null;
3883
+ }
3884
+ const areaCodes = this.#selectedCountryData?.areaCodes;
3885
+ const priority = this.#selectedCountryData?.priority;
3886
+ if (areaCodes) {
3887
+ const dialCodeAreaCodes = areaCodes.map(
3888
+ (areaCode) => `${selectedDialCode}${areaCode}`
3889
+ );
3890
+ for (const dialCodeAreaCode of dialCodeAreaCodes) {
3891
+ if (numeric.startsWith(dialCodeAreaCode)) {
3892
+ return null;
3893
+ }
3894
+ }
3895
+ }
3896
+ const isMainCountry = priority === 0;
3897
+ const hasAreaCodesButNoneMatched = areaCodes && !isMainCountry && numeric.length > dialCodeMatchNumeric.length;
3898
+ const isValidSelection = selectedIso2 && iso2Codes.includes(selectedIso2) && !hasAreaCodesButNoneMatched;
3899
+ const alreadySelected = selectedIso2 === iso2Codes[0];
3900
+ if (!isValidSelection && !alreadySelected) {
3901
+ return iso2Codes[0];
3902
+ }
3903
+ } else if (number.startsWith("+") && numeric.length) {
3904
+ const currentDial = this.#selectedCountryData?.dialCode || "";
3905
+ if (currentDial && currentDial.startsWith(numeric)) {
3906
+ return null;
3907
+ }
3908
+ return "";
3909
+ } else if ((!number || number === "+") && !selectedIso2 && this.#defaultCountry) {
3910
+ return this.#defaultCountry;
3911
+ }
3912
+ return null;
3913
+ }
3914
+ //* Update the selected country, dial code (if separateDialCode), placeholder, title, and selected list item.
3915
+ //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
3916
+ #setCountry(iso2) {
3917
+ const prevIso2 = this.#selectedCountryData?.iso2 || "";
3918
+ this.#selectedCountryData = iso2 ? this.#countryByIso2.get(iso2) : null;
3919
+ if (this.#selectedCountryData?.iso2) {
3920
+ this.#defaultCountry = this.#selectedCountryData.iso2;
3921
+ }
3922
+ this.#ui.setCountry(this.#selectedCountryData ?? {});
3923
+ this.#updatePlaceholder();
3924
+ this.#updateMaxLength();
3925
+ return prevIso2 !== iso2;
3926
+ }
3927
+ //* Update the maximum valid number length for the currently selected country.
3928
+ #updateMaxLength() {
3929
+ const { strictMode, placeholderNumberType, allowedNumberTypes } = this.#options;
3930
+ const iso2 = this.#selectedCountryData?.iso2;
3931
+ if (strictMode && intlTelInput.utils) {
3932
+ if (iso2) {
3933
+ const numberType = intlTelInput.utils.numberType[placeholderNumberType];
3934
+ let exampleNumber = intlTelInput.utils.getExampleNumber(
3935
+ iso2,
3936
+ false,
3937
+ numberType,
3938
+ true
3939
+ );
3940
+ let validNumber = exampleNumber;
3941
+ while (intlTelInput.utils.isPossibleNumber(
3942
+ exampleNumber,
3943
+ iso2,
3944
+ allowedNumberTypes
3945
+ )) {
3946
+ validNumber = exampleNumber;
3947
+ exampleNumber += "0";
3948
+ }
3949
+ const coreNumber = intlTelInput.utils.getCoreNumber(validNumber, iso2);
3950
+ this.#maxCoreNumberLength = coreNumber.length;
3951
+ if (iso2 === "by") {
3952
+ this.#maxCoreNumberLength = coreNumber.length + 1;
3953
+ }
3954
+ } else {
3955
+ this.#maxCoreNumberLength = null;
3956
+ }
3957
+ }
3958
+ }
3959
+ //* Update the input placeholder to an example number from the currently selected country.
3960
+ #updatePlaceholder() {
3961
+ const {
3962
+ autoPlaceholder,
3963
+ placeholderNumberType,
3964
+ nationalMode,
3965
+ customPlaceholder
3966
+ } = this.#options;
3967
+ const shouldSetPlaceholder = autoPlaceholder === PLACEHOLDER_MODES.AGGRESSIVE || !this.#ui.hadInitialPlaceholder && autoPlaceholder === PLACEHOLDER_MODES.POLITE;
3968
+ if (intlTelInput.utils && shouldSetPlaceholder) {
3969
+ const numberType = intlTelInput.utils.numberType[placeholderNumberType];
3970
+ let placeholder = this.#selectedCountryData?.iso2 ? intlTelInput.utils.getExampleNumber(
3971
+ this.#selectedCountryData.iso2,
3972
+ nationalMode,
3973
+ numberType
3974
+ ) : "";
3975
+ placeholder = this.#beforeSetNumber(placeholder);
3976
+ if (typeof customPlaceholder === "function") {
3977
+ placeholder = customPlaceholder(placeholder, this.#selectedCountryData ?? {});
3978
+ }
3979
+ this.#ui.telInput.setAttribute("placeholder", placeholder);
3980
+ }
3981
+ }
3982
+ //* Called when the user selects a list item from the dropdown.
3983
+ #selectListItem(listItem) {
3984
+ const iso2 = listItem.dataset[DATA_KEYS.COUNTRY_CODE];
3985
+ const countryChanged = this.#setCountry(iso2);
3986
+ this.#closeDropdown();
3987
+ const dialCode = listItem.dataset[DATA_KEYS.DIAL_CODE];
3988
+ this.#updateDialCode(dialCode);
3989
+ if (this.#options.formatOnDisplay) {
3990
+ const inputValue = this.#getTelInputValue();
3991
+ this.#updateValFromNumber(inputValue);
3992
+ }
3993
+ this.#ui.telInput.focus();
3994
+ if (countryChanged) {
3995
+ this.#triggerCountryChange();
3996
+ }
3997
+ }
3998
+ //* Close the dropdown and unbind any listeners.
3999
+ #closeDropdown(isDestroy) {
4000
+ if (this.#ui.isDropdownClosed() || this.#options.dropdownAlwaysOpen && !isDestroy) {
4001
+ return;
4002
+ }
4003
+ this.#ui.closeDropdown();
4004
+ this.#dropdownAbortController.abort();
4005
+ this.#dropdownAbortController = null;
4006
+ this.#trigger(EVENTS.CLOSE_COUNTRY_DROPDOWN);
4007
+ }
4008
+ //* Replace any existing dial code with the new one
4009
+ //* Note: called from _selectListItem and setCountry
4010
+ #updateDialCode(newDialCodeBare) {
4011
+ const inputVal = this.#getTelInputValue();
4012
+ const newDialCode = `+${newDialCodeBare}`;
4013
+ let newNumber;
4014
+ if (inputVal.startsWith("+")) {
4015
+ const prevDialCode = this.#getDialCode(inputVal);
4016
+ if (prevDialCode) {
4017
+ newNumber = inputVal.replace(prevDialCode, newDialCode);
4018
+ } else {
4019
+ newNumber = newDialCode;
4020
+ }
4021
+ this.#setTelInputValue(newNumber);
4022
+ }
4023
+ }
4024
+ //* Try and extract a valid international dial code from a full telephone number.
4025
+ //* Note: returns the raw string inc plus character and any whitespace/dots etc.
4026
+ #getDialCode(number, includeAreaCode) {
4027
+ let dialCode = "";
4028
+ if (number.startsWith("+")) {
4029
+ let numericChars = "";
4030
+ let foundBaseDialCode = false;
4031
+ for (let i = 0; i < number.length; i++) {
4032
+ const c = number.charAt(i);
4033
+ if (/[0-9]/.test(c)) {
4034
+ numericChars += c;
4035
+ const hasMapEntry = Boolean(this.#dialCodeToIso2Map[numericChars]);
4036
+ if (!hasMapEntry) {
4037
+ break;
4038
+ }
4039
+ if (this.#dialCodes.has(numericChars)) {
4040
+ dialCode = number.substring(0, i + 1);
4041
+ foundBaseDialCode = true;
4042
+ if (!includeAreaCode) {
4043
+ break;
4044
+ }
4045
+ } else if (includeAreaCode && foundBaseDialCode) {
4046
+ dialCode = number.substring(0, i + 1);
4047
+ }
4048
+ if (numericChars.length === this.#dialCodeMaxLen) {
4049
+ break;
4050
+ }
4051
+ }
4052
+ }
4053
+ }
4054
+ return dialCode;
4055
+ }
4056
+ //* Get the input val, adding the dial code if separateDialCode is enabled.
4057
+ #getFullNumber(overrideVal) {
4058
+ const val = overrideVal ? this.#numerals.normalise(overrideVal) : this.#getTelInputValue();
4059
+ const dialCode = this.#selectedCountryData?.dialCode;
4060
+ let prefix;
4061
+ const numericVal = getNumeric(val);
4062
+ if (this.#options.separateDialCode && !val.startsWith("+") && dialCode && numericVal) {
4063
+ prefix = `+${dialCode}`;
4064
+ } else {
4065
+ prefix = "";
4066
+ }
4067
+ return prefix + val;
4068
+ }
4069
+ //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
4070
+ #beforeSetNumber(fullNumber) {
4071
+ const hasValidDialCode = Boolean(this.#getDialCode(fullNumber));
4072
+ const number = beforeSetNumber(
4073
+ fullNumber,
4074
+ hasValidDialCode,
4075
+ this.#options.separateDialCode,
4076
+ this.#selectedCountryData ?? {}
4077
+ );
4078
+ return this.#cap(number);
4079
+ }
4080
+ //* Return only the public-facing subset of the selected country data.
4081
+ #getPublicCountryData() {
4082
+ const d = this.#selectedCountryData;
4083
+ if (!d) return {};
4084
+ const { iso2, dialCode, name } = d;
4085
+ return { iso2, dialCode, name };
4086
+ }
4087
+ //* Trigger the 'countrychange' event.
4088
+ #triggerCountryChange() {
4089
+ const countryData = this.#getPublicCountryData();
4090
+ this.#trigger(EVENTS.COUNTRY_CHANGE, countryData);
4091
+ }
4092
+ //**************************
4093
+ //* INTERNAL METHODS
4094
+ //**************************
4095
+ //* Called when the geoip call returns.
4096
+ #handleAutoCountry() {
4097
+ if (!this.#ui.telInput) {
4098
+ this.#resolveAutoCountryPromise?.();
4099
+ return;
4100
+ }
4101
+ if (this.#options.initialCountry === INITIAL_COUNTRY.AUTO && intlTelInput.autoCountry) {
4102
+ this.#defaultCountry = intlTelInput.autoCountry;
4103
+ const hasSelectedCountryOrGlobe = this.#selectedCountryData?.iso2 || this.#ui.selectedCountryInner.classList.contains(CLASSES.GLOBE);
4104
+ if (!hasSelectedCountryOrGlobe) {
4105
+ this.setCountry(this.#defaultCountry);
4106
+ }
4107
+ this.#resolveAutoCountryPromise();
4108
+ }
4109
+ }
4110
+ //* Called when the geoip call fails or times out.
4111
+ #handleAutoCountryFailure() {
4112
+ if (!this.#ui.telInput) {
4113
+ this.#rejectAutoCountryPromise?.();
4114
+ return;
4115
+ }
4116
+ this.#setInitialState(true);
4117
+ this.#rejectAutoCountryPromise();
4118
+ }
4119
+ //* Called when the utils request completes.
4120
+ #handleUtils() {
4121
+ if (!this.#ui.telInput) {
4122
+ this.#resolveUtilsScriptPromise?.();
4123
+ return;
4124
+ }
4125
+ if (intlTelInput.utils) {
4126
+ const inputValue = this.#getTelInputValue();
4127
+ if (inputValue) {
4128
+ this.#updateValFromNumber(inputValue);
4129
+ }
4130
+ if (this.#selectedCountryData?.iso2) {
4131
+ this.#updatePlaceholder();
4132
+ this.#updateMaxLength();
4133
+ }
4134
+ }
4135
+ this.#resolveUtilsScriptPromise();
4136
+ }
4137
+ //* Called when the utils request fails or times out.
4138
+ #handleUtilsFailure(error) {
4139
+ if (!this.#ui.telInput) {
4140
+ this.#rejectUtilsScriptPromise?.(error);
4141
+ return;
4142
+ }
4143
+ this.#rejectUtilsScriptPromise(error);
4144
+ }
4145
+ //********************
4146
+ //* PUBLIC METHODS
4147
+ //********************
4148
+ //* Remove plugin.
4149
+ destroy() {
4150
+ if (!this.#ui.telInput) {
4151
+ return;
4152
+ }
4153
+ if (this.#options.allowDropdown) {
4154
+ this.#closeDropdown(true);
4155
+ }
4156
+ this.#abortController.abort();
4157
+ this.#abortController = null;
4158
+ this.#ui.destroy();
4159
+ delete intlTelInput.instances[this.id];
4160
+ }
4161
+ // check if the instance is still valid (not destroyed/unmounted)
4162
+ isActive() {
4163
+ return !!this.#ui?.telInput;
4164
+ }
4165
+ //* Get the extension from the current number.
4166
+ getExtension() {
4167
+ if (intlTelInput.utils && this.#ui.telInput) {
4168
+ return intlTelInput.utils.getExtension(
4169
+ this.#getFullNumber(),
4170
+ this.#selectedCountryData?.iso2
4171
+ );
4172
+ }
4173
+ return "";
4174
+ }
4175
+ //* Format the number to the given format.
4176
+ getNumber(format) {
4177
+ if (intlTelInput.utils && this.#ui.telInput) {
4178
+ const iso2 = this.#selectedCountryData?.iso2;
4179
+ const fullNumber = this.#getFullNumber();
4180
+ const formattedNumber = intlTelInput.utils.formatNumber(
4181
+ fullNumber,
4182
+ iso2,
4183
+ format
4184
+ );
4185
+ return this.#numerals.denormalise(formattedNumber);
4186
+ }
4187
+ return "";
4188
+ }
4189
+ //* Get the type of the entered number e.g. landline/mobile.
4190
+ getNumberType() {
4191
+ if (intlTelInput.utils && this.#ui.telInput) {
4192
+ return intlTelInput.utils.getNumberType(
4193
+ this.#getFullNumber(),
4194
+ this.#selectedCountryData?.iso2
4195
+ );
4196
+ }
4197
+ return SENTINELS.UNKNOWN_NUMBER_TYPE;
4198
+ }
4199
+ //* Get the country data for the currently selected country.
4200
+ getSelectedCountryData() {
4201
+ return this.#getPublicCountryData();
4202
+ }
4203
+ //* Get the validation error.
4204
+ getValidationError() {
4205
+ if (intlTelInput.utils && this.#ui.telInput) {
4206
+ const iso2 = this.#selectedCountryData?.iso2;
4207
+ return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
4208
+ }
4209
+ return SENTINELS.UNKNOWN_VALIDATION_ERROR;
4210
+ }
4211
+ //* Validate the input val using number length only
4212
+ isValidNumber() {
4213
+ const dialCode = this.#selectedCountryData?.dialCode;
4214
+ const iso2 = this.#selectedCountryData?.iso2;
4215
+ if (intlTelInput.utils && this.#ui.telInput) {
4216
+ const number = this.#getFullNumber();
4217
+ const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
4218
+ if (coreNumber) {
4219
+ if (dialCode === UK.DIAL_CODE) {
4220
+ if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
4221
+ return false;
4222
+ }
4223
+ }
4224
+ const hasAlphaChar = REGEX.ALPHA_UNICODE.test(number);
4225
+ if (!hasAlphaChar && dialCode) {
4226
+ const nationalPortion = number.startsWith("+") ? number.slice(1 + dialCode.length) : number;
4227
+ const nationalDigitCount = getNumeric(nationalPortion).length;
4228
+ if (coreNumber.length > nationalDigitCount) {
4229
+ return false;
4230
+ }
4231
+ }
4232
+ }
4233
+ }
4234
+ return this.#validateNumber(false);
4235
+ }
4236
+ //* Validate the input val with precise validation
4237
+ isValidNumberPrecise() {
4238
+ return this.#validateNumber(true);
4239
+ }
4240
+ #utilsIsPossibleNumber(val) {
4241
+ return intlTelInput.utils ? intlTelInput.utils.isPossibleNumber(
4242
+ val,
4243
+ this.#selectedCountryData?.iso2,
4244
+ this.#options.allowedNumberTypes
4245
+ ) : null;
4246
+ }
4247
+ //* Shared internal validation logic to handle alpha character extension rules.
4248
+ #validateNumber(precise) {
4249
+ if (!intlTelInput.utils || !this.#ui.telInput) {
4250
+ return null;
4251
+ }
4252
+ const { allowNumberExtensions, allowPhonewords } = this.#options;
4253
+ const testValidity = (s) => precise ? this.#utilsIsValidNumber(s) : this.#utilsIsPossibleNumber(s);
4254
+ const val = this.#getFullNumber();
4255
+ if (!this.#selectedCountryData?.iso2) {
4256
+ const isRegionlessDialCode = hasRegionlessDialCode(val);
4257
+ if (!isRegionlessDialCode) {
4258
+ return false;
4259
+ }
4260
+ }
4261
+ if (!testValidity(val)) {
4262
+ return false;
4263
+ }
4264
+ const alphaCharPosition = val.search(REGEX.ALPHA_UNICODE);
4265
+ const hasAlphaChar = alphaCharPosition > -1;
4266
+ if (hasAlphaChar) {
4267
+ const selectedIso2 = this.#selectedCountryData?.iso2;
4268
+ const hasExtension = Boolean(intlTelInput.utils.getExtension(val, selectedIso2));
4269
+ if (hasExtension) {
4270
+ return allowNumberExtensions;
4271
+ }
4272
+ return allowPhonewords;
4273
+ }
4274
+ return true;
4275
+ }
4276
+ #utilsIsValidNumber(val) {
4277
+ return intlTelInput.utils ? intlTelInput.utils.isValidNumber(
4278
+ val,
4279
+ this.#selectedCountryData?.iso2,
4280
+ this.#options.allowedNumberTypes
4281
+ ) : null;
4282
+ }
4283
+ //* Update the selected country, and update the input val accordingly.
4284
+ setCountry(iso2) {
4285
+ if (!this.#ui.telInput) {
4286
+ return;
4287
+ }
4288
+ const iso2Lower = iso2?.toLowerCase();
4289
+ if (!isIso2(iso2Lower)) {
4290
+ throw new Error(`Invalid country code: '${iso2Lower}'`);
4291
+ }
4292
+ const currentCountry = this.#selectedCountryData?.iso2;
4293
+ const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
4294
+ if (isCountryChange) {
4295
+ this.#setCountry(iso2Lower);
4296
+ this.#updateDialCode(this.#selectedCountryData?.dialCode || "");
4297
+ if (this.#options.formatOnDisplay) {
4298
+ const inputValue = this.#getTelInputValue();
4299
+ this.#updateValFromNumber(inputValue);
4300
+ }
4301
+ this.#triggerCountryChange();
4302
+ }
4303
+ }
4304
+ //* Set the input value and update the country.
4305
+ setNumber(number) {
4306
+ if (!this.#ui.telInput) {
4307
+ return;
4308
+ }
4309
+ const normalisedNumber = this.#numerals.normalise(number);
4310
+ const countryChanged = this.#updateCountryFromNumber(normalisedNumber);
4311
+ this.#updateValFromNumber(normalisedNumber);
4312
+ if (countryChanged) {
4313
+ this.#triggerCountryChange();
4314
+ }
4315
+ this.#trigger(EVENTS.INPUT, { isSetNumber: true });
4316
+ }
4317
+ //* Set the placeholder number typ
4318
+ setPlaceholderNumberType(type) {
4319
+ if (!this.#ui.telInput) {
4320
+ return;
4321
+ }
4322
+ this.#options.placeholderNumberType = type;
4323
+ this.#updatePlaceholder();
4324
+ }
4325
+ setDisabled(disabled) {
4326
+ if (!this.#ui.telInput) {
4327
+ return;
4328
+ }
4329
+ this.#ui.telInput.disabled = disabled;
4330
+ if (this.#ui.selectedCountry) {
4331
+ if (disabled) {
4332
+ this.#ui.selectedCountry.setAttribute("disabled", "true");
4333
+ } else {
4334
+ this.#ui.selectedCountry.removeAttribute("disabled");
4335
+ }
4336
+ }
4337
+ }
4338
+ //********************
4339
+ //* STATIC METHODS
4340
+ //********************
4341
+ // Internal instance notification used by utils/geoip loaders.
4342
+ // Kept public so module-level helpers (e.g. attachUtils) can call it, while still allowing
4343
+ // access to private instance methods.
4344
+ static forEachInstance(method, ...args) {
4345
+ const values = Object.values(intlTelInput.instances);
4346
+ const arg = args[0];
4347
+ values.forEach((instance) => {
4348
+ if (!(instance instanceof _Iti)) {
4349
+ return;
4350
+ }
4351
+ switch (method) {
4352
+ case "handleUtils":
4353
+ instance.#handleUtils();
4354
+ break;
4355
+ case "handleUtilsFailure":
4356
+ instance.#handleUtilsFailure(arg);
4357
+ break;
4358
+ case "handleAutoCountry":
4359
+ instance.#handleAutoCountry();
4360
+ break;
4361
+ case "handleAutoCountryFailure":
4362
+ instance.#handleAutoCountryFailure();
4363
+ break;
4364
+ }
4365
+ });
4366
+ }
4367
+ };
4368
+ var attachUtils = (source) => {
4369
+ if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
4370
+ let loadCall;
4371
+ if (typeof source === "function") {
4372
+ try {
4373
+ loadCall = Promise.resolve(source());
4374
+ } catch (error) {
4375
+ return Promise.reject(error);
4376
+ }
4377
+ } else {
4378
+ return Promise.reject(
4379
+ new TypeError(
4380
+ `The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof source}`
4381
+ )
4382
+ );
4383
+ }
4384
+ intlTelInput.startedLoadingUtilsScript = true;
4385
+ return loadCall.then((module) => {
4386
+ const utils = module?.default;
4387
+ if (!utils || typeof utils !== "object") {
4388
+ throw new TypeError(
4389
+ "The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
4390
+ );
4391
+ }
4392
+ intlTelInput.utils = utils;
4393
+ Iti.forEachInstance("handleUtils");
4394
+ return true;
4395
+ }).catch((error) => {
4396
+ Iti.forEachInstance("handleUtilsFailure", error);
4397
+ throw error;
4398
+ });
4399
+ }
4400
+ return null;
4401
+ };
4402
+ var intlTelInput = Object.assign(
4403
+ (input, options) => {
4404
+ const iti = new Iti(input, options);
4405
+ intlTelInput.instances[iti.id] = iti;
4406
+ input.iti = iti;
4407
+ return iti;
4408
+ },
4409
+ {
4410
+ defaults,
4411
+ //* Using a static var like this allows us to mock it in the tests.
4412
+ documentReady: () => document.readyState === "complete",
4413
+ //* Get the country data object.
4414
+ getCountryData: () => data_default,
4415
+ //* A getter for the plugin instance.
4416
+ getInstance: (input) => {
4417
+ const id2 = input.dataset.intlTelInputId;
4418
+ return id2 ? intlTelInput.instances[id2] : null;
4419
+ },
4420
+ //* A map from instance ID to instance object.
4421
+ instances: {},
4422
+ attachUtils,
4423
+ startedLoadingUtilsScript: false,
4424
+ startedLoadingAutoCountry: false,
4425
+ version: "26.9.2"
4426
+ }
4427
+ );
4428
+ var intl_tel_input_default = intlTelInput;
4429
+ return __toCommonJS(intl_tel_input_exports);
4430
+ })();
4431
+
4432
+ // UMD
4433
+ return factoryOutput.default;
4434
+ }));
4435
+ } (intlTelInput$2));
4436
+ return intlTelInput$2.exports;
4437
+ }
4438
+
4439
+ var intlTelInputExports = requireIntlTelInput();
4440
+ var intlTelInput = /*@__PURE__*/getDefaultExportFromCjs(intlTelInputExports);
4441
+
4442
+ var intlTelInput$1 = /*#__PURE__*/_mergeNamespaces({
4443
+ __proto__: null,
4444
+ default: intlTelInput
4445
+ }, [intlTelInputExports]);
4446
+
4447
+ export { intlTelInput$1 as i };