@fluidattacks/design 3.1.11 → 3.1.13

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 (205) hide show
  1. package/dist/_commonjsHelpers-C6fGbg64.mjs +6 -0
  2. package/dist/components/@core/index.js +18 -1
  3. package/dist/components/accordion/accordion-content/index.js +22 -1
  4. package/dist/components/accordion/index.js +78 -1
  5. package/dist/components/alert/index.js +162 -4
  6. package/dist/components/button/index.js +69 -1
  7. package/dist/components/card/card-header/index.js +83 -1
  8. package/dist/components/card/card-with-image/index.js +93 -1
  9. package/dist/components/card/card-with-input/index.js +106 -3
  10. package/dist/components/card/card-with-selector/index.js +71 -1
  11. package/dist/components/card/card-with-switch/index.js +50 -1
  12. package/dist/components/card/index.js +12 -1
  13. package/dist/components/carousel/index.js +62 -10
  14. package/dist/components/checkbox/index.js +118 -3
  15. package/dist/components/cloud-image/index.js +8 -1
  16. package/dist/components/code-snippet/index.js +72 -1
  17. package/dist/components/code-snippet/location-code/index.js +171 -1
  18. package/dist/components/colors/index.js +224 -1
  19. package/dist/components/confirm-dialog/index.js +46 -1
  20. package/dist/components/container/index.js +51 -3
  21. package/dist/components/content-card/category-tag/index.js +42 -1
  22. package/dist/components/content-card/event-date/index.js +61 -1
  23. package/dist/components/content-card/index.js +168 -3
  24. package/dist/components/content-card-carousel/index.js +95 -1
  25. package/dist/components/content-card-carousel/scroll-buttons/index.js +9 -1
  26. package/dist/components/divider/index.js +25 -1
  27. package/dist/components/empty-state/empty-button/index.js +6 -1
  28. package/dist/components/empty-state/index.js +58 -8
  29. package/dist/components/file-preview/index.js +31 -3
  30. package/dist/components/form/index.js +63 -3
  31. package/dist/components/grid-container/index.js +46 -5
  32. package/dist/components/group-selector/index.js +135 -1
  33. package/dist/components/group-selector/option-container/index.js +12 -1
  34. package/dist/components/icon/index.js +102 -4
  35. package/dist/components/icon-button/index.js +76 -3
  36. package/dist/components/indicator-card/index.js +74 -1
  37. package/dist/components/info-sidebar/index.js +116 -1
  38. package/dist/components/inputs/fields/combobox/index.js +146 -1
  39. package/dist/components/inputs/fields/combobox/option/index.js +8 -1
  40. package/dist/components/inputs/fields/date/calendar/cell/index.js +27 -1
  41. package/dist/components/inputs/fields/date/calendar/grid/index.js +26 -1
  42. package/dist/components/inputs/fields/date/calendar/header/index.js +38 -1
  43. package/dist/components/inputs/fields/date/calendar/index.js +30 -1
  44. package/dist/components/inputs/fields/date/index.js +68 -1
  45. package/dist/components/inputs/fields/date-range/calendar/index.js +35 -1
  46. package/dist/components/inputs/fields/date-range/index.js +108 -3
  47. package/dist/components/inputs/fields/date-time/calendar/index.js +60 -5
  48. package/dist/components/inputs/fields/date-time/index.js +69 -1
  49. package/dist/components/inputs/fields/editable/index.js +28 -1
  50. package/dist/components/inputs/fields/input/index.js +77 -1
  51. package/dist/components/inputs/fields/input-file/index.js +117 -4
  52. package/dist/components/inputs/fields/input-tags/index.js +63 -2
  53. package/dist/components/inputs/fields/number/index.js +57 -1
  54. package/dist/components/inputs/fields/number-range/index.js +49 -1
  55. package/dist/components/inputs/fields/phone/index.js +574 -11
  56. package/dist/components/inputs/fields/text-area/index.js +81 -1
  57. package/dist/components/inputs/index.js +28 -1
  58. package/dist/components/inputs/label/index.js +38 -1
  59. package/dist/components/inputs/outline-container/index.js +104 -1
  60. package/dist/components/inputs/utils/action-button/index.js +31 -1
  61. package/dist/components/inputs/utils/calendar-button/index.js +37 -1
  62. package/dist/components/inputs/utils/date-selector/index.js +62 -1
  63. package/dist/components/inputs/utils/date-time-field/index.js +133 -1
  64. package/dist/components/inputs/utils/dialog/index.js +14 -1
  65. package/dist/components/inputs/utils/number-field/index.js +86 -1
  66. package/dist/components/inputs/utils/popover/index.js +44 -1
  67. package/dist/components/interactive-card/icon/index.js +7 -1
  68. package/dist/components/interactive-card/index.js +118 -1
  69. package/dist/components/language-selector/index.js +37 -1
  70. package/dist/components/language-selector/item-list/index.js +8 -1
  71. package/dist/components/link/index.js +106 -7
  72. package/dist/components/list-item/index.js +67 -1
  73. package/dist/components/little-flag/index.js +32 -3
  74. package/dist/components/loading/index.js +55 -14
  75. package/dist/components/logo/index.js +13 -1
  76. package/dist/components/logo-carousel/index.js +45 -4
  77. package/dist/components/lottie/index.js +20 -3
  78. package/dist/components/menu/index.js +67 -1
  79. package/dist/components/message-banner/index.js +87 -4
  80. package/dist/components/modal/index.js +65 -1
  81. package/dist/components/modal/modal-confirm/index.js +51 -1
  82. package/dist/components/modal/modal-footer/index.js +25 -1
  83. package/dist/components/modal/modal-header/index.js +51 -1
  84. package/dist/components/notification/index.js +113 -5
  85. package/dist/components/notification-sign/index.js +43 -6
  86. package/dist/components/number-input/index.js +62 -7
  87. package/dist/components/oauth-selector/index.js +100 -1
  88. package/dist/components/oauth-selector/option-container/index.js +76 -1
  89. package/dist/components/plan-card/index.js +155 -5
  90. package/dist/components/plan-card/recommended-tag/index.js +31 -1
  91. package/dist/components/pop-up/description/index.js +51 -1
  92. package/dist/components/pop-up/index.js +152 -1
  93. package/dist/components/premium-feature/index.js +85 -3
  94. package/dist/components/priority-score/index.js +29 -1
  95. package/dist/components/progress/index.js +36 -3
  96. package/dist/components/progress-bar/index.js +153 -5
  97. package/dist/components/radio-button/index.js +125 -3
  98. package/dist/components/scroll-button/index.js +38 -2
  99. package/dist/components/search/index.js +105 -7
  100. package/dist/components/search-bar/index.js +219 -1
  101. package/dist/components/search-bar/item-searching/index.js +10 -1
  102. package/dist/components/severity-badge/index.js +74 -1
  103. package/dist/components/severity-overview/badge/index.js +69 -1
  104. package/dist/components/severity-overview/index.js +17 -1
  105. package/dist/components/show-on-hover/index.js +31 -3
  106. package/dist/components/slide-out-menu/index.js +3456 -3
  107. package/dist/components/slide-out-menu/menu-item/index.js +67 -1
  108. package/dist/components/slider/index.js +124 -7
  109. package/dist/components/slider/thumb/index.js +17 -1
  110. package/dist/components/step-lapse/index.js +153 -9
  111. package/dist/components/table-button/index.js +97 -3
  112. package/dist/components/tabs/fixed-tabs/index.js +29 -1
  113. package/dist/components/tabs/index.js +57 -1
  114. package/dist/components/tabs/tab/index.js +39 -1
  115. package/dist/components/tag/index.js +184 -3
  116. package/dist/components/timeline/card/index.js +9 -1
  117. package/dist/components/timeline/index.js +17 -1
  118. package/dist/components/toggle/index.js +85 -14
  119. package/dist/components/toggle-buttons/index.js +103 -5
  120. package/dist/components/tooltip/index.js +13 -1
  121. package/dist/components/tour/index.js +4549 -4
  122. package/dist/components/typography/heading/index.js +47 -1
  123. package/dist/components/typography/index.js +8 -1
  124. package/dist/components/typography/span/index.js +41 -1
  125. package/dist/components/typography/text/index.js +47 -1
  126. package/dist/components/web-form/index.js +68 -7
  127. package/dist/hooks/index.js +13 -1
  128. package/dist/index-BMHVi812.mjs +234 -0
  129. package/dist/index-BzAniA2J.mjs +135 -0
  130. package/dist/index-C6LbClYh.mjs +146 -0
  131. package/dist/index-CAIe8hBv.mjs +130 -0
  132. package/dist/index-CUQBAqt_.mjs +75 -0
  133. package/dist/index-CWlrSlUk.mjs +68 -0
  134. package/dist/index-Ckmu1TfV.mjs +86 -0
  135. package/dist/index-DwznImvK.mjs +1678 -0
  136. package/dist/index-maWH3JYC.mjs +3561 -0
  137. package/dist/index.js +206 -1
  138. package/dist/styles-B2N0JLw1.mjs +114 -0
  139. package/dist/styles-B64DVBIF.mjs +115 -0
  140. package/dist/{styles-BAhpqi6C.mjs → styles-BXFVwnWT.mjs} +28 -28
  141. package/dist/styles-BZQOqe8p.mjs +141 -0
  142. package/dist/styles-Bdque9TT.mjs +65 -0
  143. package/dist/styles-BlHspTrz.mjs +144 -0
  144. package/dist/styles-CROOwXEH.mjs +76 -0
  145. package/dist/styles-CplEd2kw.mjs +228 -0
  146. package/dist/styles-D1eTIklB.mjs +110 -0
  147. package/dist/styles-ePGii_9g.mjs +74 -0
  148. package/dist/use-carousel-CgAF78h3.mjs +23 -0
  149. package/dist/use-click-outside-BUll8Ag-.mjs +18 -0
  150. package/dist/use-cloudinary-image-BCxwj15o.mjs +1176 -0
  151. package/dist/use-modal-CtgexKnf.mjs +14 -0
  152. package/dist/use-search-Dj47QDw9.mjs +15 -0
  153. package/dist/utils-V0EumEPM.mjs +6 -0
  154. package/package.json +1 -3
  155. package/dist/_commonjsHelpers-C37NGDzP.js +0 -1
  156. package/dist/_commonjsHelpers-D6CrkqQz.mjs +0 -6
  157. package/dist/index-BH27NQKA.mjs +0 -2311
  158. package/dist/index-Bcw2vW_n.mjs +0 -75
  159. package/dist/index-C0_LPuYU.mjs +0 -106
  160. package/dist/index-C8zdgAVH.mjs +0 -82
  161. package/dist/index-CA_9DXWd.js +0 -5
  162. package/dist/index-CmylnDrF.js +0 -14
  163. package/dist/index-DUMgwAbO.js +0 -26
  164. package/dist/index-DpQYiwGu.js +0 -5
  165. package/dist/index-Dy8ZUIYs.js +0 -5
  166. package/dist/index-JPf5Yzg6.js +0 -17
  167. package/dist/index-OBZtKZuT.mjs +0 -1021
  168. package/dist/index-SsXlDjK4.mjs +0 -122
  169. package/dist/index-TKLFHcRp.js +0 -18
  170. package/dist/index-TnyKqJHo.mjs +0 -61
  171. package/dist/index-Yr95Cb7Z.mjs +0 -54
  172. package/dist/index-h9-U5wxq.mjs +0 -209
  173. package/dist/index-qCiUU4sZ.js +0 -9
  174. package/dist/index-qe0nJwzl.js +0 -15
  175. package/dist/styles--Elze-LV.js +0 -3
  176. package/dist/styles-3pR4Xdvy.js +0 -33
  177. package/dist/styles-59h91S9m.mjs +0 -65
  178. package/dist/styles-BCwLWpC3.mjs +0 -126
  179. package/dist/styles-BJ7-0I5X.mjs +0 -74
  180. package/dist/styles-BKObp9bh.mjs +0 -76
  181. package/dist/styles-BWVdbvFu.js +0 -5
  182. package/dist/styles-Bl-CstrT.js +0 -5
  183. package/dist/styles-Bn42XCW5.js +0 -7
  184. package/dist/styles-C2CoGJl7.js +0 -33
  185. package/dist/styles-CNzziAXG.js +0 -5
  186. package/dist/styles-CdD9waPD.js +0 -29
  187. package/dist/styles-CnKTwnFk.mjs +0 -110
  188. package/dist/styles-D4R-eerv.mjs +0 -77
  189. package/dist/styles-DNIIhyRC.mjs +0 -144
  190. package/dist/styles-DV8yOaqV.mjs +0 -131
  191. package/dist/styles-DYoftbd3.js +0 -42
  192. package/dist/styles-DlmKLhPh.js +0 -7
  193. package/dist/styles-be8gOdgy.mjs +0 -106
  194. package/dist/use-carousel-64dKFW4E.js +0 -1
  195. package/dist/use-carousel-D7xeL3YZ.mjs +0 -17
  196. package/dist/use-click-outside-BqkLISED.js +0 -1
  197. package/dist/use-click-outside-C4Z4pdiW.mjs +0 -18
  198. package/dist/use-cloudinary-image-DKMl7jbx.mjs +0 -612
  199. package/dist/use-cloudinary-image-YMMafagv.js +0 -1
  200. package/dist/use-modal-CNbLSSQb.mjs +0 -14
  201. package/dist/use-modal-_bYY6M_n.js +0 -1
  202. package/dist/use-search-75ip5xR-.mjs +0 -12
  203. package/dist/use-search-DeL4UDMh.js +0 -1
  204. package/dist/utils-C2whpEd3.js +0 -1
  205. package/dist/utils-Da0qL35u.mjs +0 -4
@@ -1,16 +1,579 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../../index-CmylnDrF.js"),a=require("react"),r=require("react-dom"),n=require("styled-components"),i=require("../../outline-container/index.js"),o=require("../../../../styles-Bl-CstrT.js"),l=require("../../../icon/index.js");require("../../../typography/heading/index.js"),require("../../../typography/span/index.js");const s=require("../../../typography/text/index.js"),u=require("../../../../use-click-outside-BqkLISED.js");var d=[["Afghanistan","af","93"],["Albania","al","355"],["Algeria","dz","213"],["Andorra","ad","376"],["Angola","ao","244"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54","(..) ........",0],["Armenia","am","374",".. ......"],["Aruba","aw","297"],["Australia","au","61",{default:". .... ....","/^4/":"... ... ...","/^5(?!50)/":"... ... ...","/^1(3|8)00/":".... ... ...","/^13/":".. .. ..","/^180/":"... ...."},0,[]],["Austria","at","43"],["Azerbaijan","az","994","(..) ... .. .."],["Bahamas","bs","1242"],["Bahrain","bh","973"],["Bangladesh","bd","880"],["Barbados","bb","1246"],["Belarus","by","375","(..) ... .. .."],["Belgium","be","32","... .. .. .."],["Belize","bz","501"],["Benin","bj","229"],["Bhutan","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina","ba","387"],["Botswana","bw","267"],["Brazil","br","55","(..) ........."],["British Indian Ocean Territory","io","246"],["Brunei","bn","673"],["Bulgaria","bg","359"],["Burkina Faso","bf","226"],["Burundi","bi","257"],["Cambodia","kh","855"],["Cameroon","cm","237"],["Canada","ca","1","(...) ...-....",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde","cv","238"],["Caribbean Netherlands","bq","599","",1],["Cayman Islands","ky","1","... ... ....",4,["345"]],["Central African Republic","cf","236"],["Chad","td","235"],["Chile","cl","56"],["China","cn","86","... .... ...."],["Colombia","co","57","... ... ...."],["Comoros","km","269"],["Congo","cd","243"],["Congo","cg","242"],["Costa Rica","cr","506","....-...."],["Côte d'Ivoire","ci","225",".. .. .. .. .."],["Croatia","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599","",0],["Cyprus","cy","357",".. ......"],["Czech Republic","cz","420","... ... ..."],["Denmark","dk","45",".. .. .. .."],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic","do","1","(...) ...-....",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt","eg","20"],["El Salvador","sv","503","....-...."],["Equatorial Guinea","gq","240"],["Eritrea","er","291"],["Estonia","ee","372",".... ......"],["Ethiopia","et","251"],["Fiji","fj","679"],["Finland","fi","358",".. ... .. .."],["France","fr","33",". .. .. .. .."],["French Guiana","gf","594"],["French Polynesia","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia","ge","995"],["Germany","de","49","... ........."],["Ghana","gh","233"],["Greece","gr","30"],["Greenland","gl","299",".. .. .."],["Grenada","gd","1473"],["Guadeloupe","gp","590","",0],["Guam","gu","1671"],["Guatemala","gt","502","....-...."],["Guinea","gn","224"],["Guinea-Bissau","gw","245"],["Guyana","gy","592"],["Haiti","ht","509","....-...."],["Honduras","hn","504"],["Hong Kong","hk","852",".... ...."],["Hungary","hu","36"],["Iceland","is","354","... ...."],["India","in","91",".....-....."],["Indonesia","id","62"],["Iran","ir","98","... ... ...."],["Iraq","iq","964"],["Ireland","ie","353",".. ......."],["Israel","il","972","... ... ...."],["Italy","it","39","... .......",0],["Jamaica","jm","1876"],["Japan","jp","81",".. .... ...."],["Jordan","jo","962"],["Kazakhstan","kz","7","... ...-..-..",0],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait","kw","965"],["Kyrgyzstan","kg","996","... ... ..."],["Laos","la","856"],["Latvia","lv","371",".. ... ..."],["Lebanon","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya","ly","218"],["Liechtenstein","li","423"],["Lithuania","lt","370"],["Luxembourg","lu","352"],["Macau","mo","853"],["Macedonia","mk","389"],["Madagascar","mg","261"],["Malawi","mw","265"],["Malaysia","my","60","..-....-...."],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania","mr","222"],["Mauritius","mu","230"],["Mexico","mx","52","... ... ....",0],["Micronesia","fm","691"],["Moldova","md","373","(..) ..-..-.."],["Monaco","mc","377"],["Mongolia","mn","976"],["Montenegro","me","382"],["Morocco","ma","212"],["Mozambique","mz","258"],["Myanmar","mm","95"],["Namibia","na","264"],["Nauru","nr","674"],["Nepal","np","977"],["Netherlands","nl","31",{"/^06/":"(.). .........","/^6/":". .........","/^0(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/":"(.).. ........","/^(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/":".. ........","/^0/":"(.)... .......",default:"... ......."}],["New Caledonia","nc","687"],["New Zealand","nz","64","...-...-...."],["Nicaragua","ni","505"],["Niger","ne","227"],["Nigeria","ng","234"],["North Korea","kp","850"],["Norway","no","47","... .. ..."],["Oman","om","968"],["Pakistan","pk","92","...-......."],["Palau","pw","680"],["Palestine","ps","970"],["Panama","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru","pe","51"],["Philippines","ph","63","... ... ...."],["Poland","pl","48","...-...-..."],["Portugal","pt","351"],["Puerto Rico","pr","1","(...) ...-....",3,["787","939"]],["Qatar","qa","974"],["Réunion","re","262"],["Romania","ro","40"],["Russia","ru","7","(...) ...-..-..",1],["Rwanda","rw","250"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe","st","239"],["Saudi Arabia","sa","966"],["Senegal","sn","221"],["Serbia","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65","....-...."],["Slovakia","sk","421"],["Slovenia","si","386"],["Solomon Islands","sb","677"],["Somalia","so","252"],["South Africa","za","27"],["South Korea","kr","82","... .... ...."],["South Sudan","ss","211"],["Spain","es","34","... ... ..."],["Sri Lanka","lk","94"],["Sudan","sd","249"],["Suriname","sr","597"],["Swaziland","sz","268"],["Sweden","se","46","... ... ..."],["Switzerland","ch","41",".. ... .. .."],["Syria","sy","963"],["Taiwan","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia","tn","216"],["Turkey","tr","90","... ... .. .."],["Turkmenistan","tm","993"],["Tuvalu","tv","688"],["Uganda","ug","256"],["Ukraine","ua","380","(..) ... .. .."],["United Arab Emirates","ae","971"],["United Kingdom","gb","44",".... ......"],["United States","us","1","(...) ...-....",0],["Uruguay","uy","598"],["Uzbekistan","uz","998",".. ... .. .."],["Vanuatu","vu","678"],["Vatican City","va","39",".. .... ....",1],["Venezuela","ve","58"],["Vietnam","vn","84"],["Yemen","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"]],c=(...e)=>e.filter((e=>!!e)).join(" ").trim(),p=({addPrefix:e,rawClassNames:t})=>c(((...e)=>c(...e).split(" ").map((e=>`react-international-phone-${e}`)).join(" "))(...e),...t),f=e=>!!e&&/^\d+$/.test(e),m=e=>e.replace(/\D/g,""),h=({phone:e,prefix:t})=>e?`${t}${m(e)}`:"";function y({value:e,country:t,insertDialCodeOnEmpty:a,trimNonDigitsEnd:r,countries:n,prefix:i,charAfterDialCode:o,forceDialCode:l,disableDialCodeAndPrefix:s,defaultMask:u,countryGuessingEnabled:d,disableFormatting:c}){let p=e;s&&(p=p.startsWith(`${i}`)?p:`${i}${t.dialCode}${p}`);let f=d?D({phone:p,countries:n,currentCountryIso2:null==t?void 0:t.iso2}):void 0,y=(null==f?void 0:f.country)??t,g=((e,t)=>{let a=!t.disableDialCodeAndPrefix&&t.forceDialCode,r=!t.disableDialCodeAndPrefix&&t.insertDialCodeOnEmpty,n=e,i=e=>t.trimNonDigitsEnd?e.trim():e;if(!n)return r&&!n.length||a?i(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`):i(n);if(n=m(n),n===t.dialCode&&!t.disableDialCodeAndPrefix)return i(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`);if(t.dialCode.startsWith(n)&&!t.disableDialCodeAndPrefix)return i(a?`${t.prefix}${t.dialCode}${t.charAfterDialCode}`:`${t.prefix}${n}`);if(!n.startsWith(t.dialCode)&&!t.disableDialCodeAndPrefix){if(a)return i(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`);if(n.length<t.dialCode.length)return i(`${t.prefix}${n}`)}let{phoneLeftSide:o,phoneRightSide:l}=(()=>{let e=t.dialCode.length;return{phoneLeftSide:n.slice(0,e),phoneRightSide:n.slice(e)}})();return o=`${t.prefix}${o}${t.charAfterDialCode}`,l=(({value:e,mask:t,maskSymbol:a,offset:r=0,trimNonMaskCharsLeftover:n=!1})=>{if(e.length<r)return e;let i=e.slice(0,r),o=e.slice(r),l=i,s=0;for(let u of t.split("")){if(s>=o.length){if(!n&&u!==a){l+=u;continue}break}u===a?(l+=o[s],s+=1):l+=u}return l})({value:l,mask:t.mask,maskSymbol:t.maskChar,trimNonMaskCharsLeftover:t.trimNonDigitsEnd||t.disableDialCodeAndPrefix&&0===l.length}),t.disableDialCodeAndPrefix&&(o=""),i(`${o}${l}`)})(p,{prefix:i,mask:w({phone:p,country:y,defaultMask:u,disableFormatting:c}),maskChar:C,dialCode:y.dialCode,trimNonDigitsEnd:r,charAfterDialCode:o,forceDialCode:l,insertDialCodeOnEmpty:a,disableDialCodeAndPrefix:s}),b=d&&!(null==f?void 0:f.fullDialCodeMatch)?t:y;return{phone:h({phone:s?`${b.dialCode}${g}`:g,prefix:i}),inputValue:g,country:b}}var g={size:20,overrideLastItemDebounceMS:-1};var C=".",b=d,v=({defaultCountry:e="us",value:t="",countries:r=b,prefix:n="+",defaultMask:i="............",charAfterDialCode:o=" ",historySaveDebounceMS:l=200,disableCountryGuess:s=false,disableDialCodePrefill:u=false,forceDialCode:d=false,disableDialCodeAndPrefix:c=false,disableFormatting:p=false,onChange:m,inputRef:C})=>{let v={countries:r,prefix:n,charAfterDialCode:o,forceDialCode:!c&&d,disableDialCodeAndPrefix:c,defaultMask:i,countryGuessingEnabled:!s,disableFormatting:p},w=a.useRef(null),x=C||w,D=e=>{Promise.resolve().then((()=>{var t;typeof window>"u"||x.current!==(null==document?void 0:document.activeElement)||null==(t=x.current)||t.setSelectionRange(e,e)}))},[{phone:$,inputValue:S,country:N},P,A,E]=function(e,t){let{size:r,overrideLastItemDebounceMS:n,onChange:i}={...g,...t},[o,l]=a.useState(e),[s,u]=a.useState([o]),[d,c]=a.useState(0),p=(()=>{let e=a.useRef(),t=a.useRef(Date.now());return{check:()=>{let a=Date.now(),r=e.current?a-t.current:void 0;return e.current=t.current,t.current=a,r}}})();return[o,(e,t)=>{if("object"==typeof e&&"object"==typeof o&&((e,t)=>{let a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(let n of a)if(e[n]!==t[n])return!1;return!0})(e,o)||e===o)return;let a=n>0,f=p.check(),m=!a||void 0===f||f>n;if(void 0!==(null==t?void 0:t.overrideLastItem)?t.overrideLastItem:!m)u((t=>[...t.slice(0,d),e]));else{let t=s.length>=r;u((a=>[...a.slice(t?1:0,d+1),e])),t||c((e=>e+1))}l(e),null==i||i(e)},()=>{if(d<=0)return{success:!1};let e=s[d-1];return l(e),c((e=>e-1)),null==i||i(e),{success:!0,value:e}},()=>{if(d+1>=s.length)return{success:!1};let e=s[d+1];return l(e),c((e=>e+1)),null==i||i(e),{success:!0,value:e}}]}((()=>{let a=k({value:e,field:"iso2",countries:r}),n=a||k({value:"us",field:"iso2",countries:r}),{phone:i,inputValue:o,country:l}=y({value:t,country:n,insertDialCodeOnEmpty:!u,...v});return D(o.length),{phone:i,inputValue:o,country:l.iso2}}),{overrideLastItemDebounceMS:l,onChange:({inputValue:e,phone:t,country:a})=>{if(!m)return;let r=M(a);m({phone:t,inputValue:e,country:r})}}),M=a.useCallback((e=>k({value:e,field:"iso2",countries:r})),[r]),j=a.useMemo((()=>M(N)),[N,M]);a.useEffect((()=>{let e=x.current;if(!e)return;let t=e=>{if(!e.key)return;let t=e.ctrlKey,a=e.metaKey,r=e.shiftKey;if("z"===e.key.toLowerCase()){if(typeof window>"u"||!window.navigator.userAgent.toLowerCase().includes("macintosh")){if(!t)return}else if(!a)return;r?E():A()}};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[x,A,E]);let[I,z]=a.useState(!1);return a.useEffect((()=>{if(!I)return z(!0),void(t!==$&&(null==m||m({inputValue:S,phone:$,country:j})));if(t===$)return;let{phone:e,inputValue:a,country:r}=y({value:t,country:j,insertDialCodeOnEmpty:!u,...v});P({phone:e,inputValue:a,country:r.iso2})}),[t]),{phone:$,inputValue:S,country:j,setCountry:(e,t={focusOnInput:!1})=>{let a=k({value:e,field:"iso2",countries:r});if(!a)return;let i=c?"":`${n}${a.dialCode}${o}`;P({inputValue:i,phone:`${n}${a.dialCode}`,country:a.iso2}),t.focusOnInput&&Promise.resolve().then((()=>{var e;null==(e=x.current)||e.focus()}))},handlePhoneValueChange:e=>{e.preventDefault();let{phone:a,inputValue:r,country:n,cursorPosition:i}=((e,{country:t,insertDialCodeOnEmpty:a,phoneBeforeInput:r,prefix:n,charAfterDialCode:i,forceDialCode:o,disableDialCodeAndPrefix:l,countryGuessingEnabled:s,defaultMask:u,disableFormatting:d,countries:c})=>{let p=e.nativeEvent,m=p.inputType,g=(e=>{if(null==e?void 0:e.toLocaleLowerCase().includes("delete"))return(null==e?void 0:e.toLocaleLowerCase().includes("forward"))?"forward":"backward"})(m),C=!!(null==m?void 0:m.startsWith("insertFrom")),b="insertText"===m,v=(null==p?void 0:p.data)||void 0,w=e.target.value,x=e.target.selectionStart??0;if(null==m?void 0:m.includes("history"))return{inputValue:r,phone:h({phone:r,prefix:n}),cursorPosition:r.length,country:t};if(b&&!f(v)&&w!==n)return{inputValue:r,phone:h({phone:l?`${t.dialCode}${r}`:r,prefix:n}),cursorPosition:x-((null==v?void 0:v.length)??0),country:t};if(o&&!w.startsWith(`${n}${t.dialCode}`)&&!C){let e=w?r:`${n}${t.dialCode}${i}`;return{inputValue:e,phone:h({phone:e,prefix:n}),cursorPosition:n.length+t.dialCode.length+i.length,country:t}}let{phone:k,inputValue:D,country:$}=y({value:w,country:t,trimNonDigitsEnd:"backward"===g,insertDialCodeOnEmpty:a,countryGuessingEnabled:s,countries:c,prefix:n,charAfterDialCode:i,forceDialCode:o,disableDialCodeAndPrefix:l,disableFormatting:d,defaultMask:u});return{phone:k,inputValue:D,cursorPosition:(({phoneBeforeInput:e,phoneAfterInput:t,phoneAfterFormatted:a,cursorPositionAfterInput:r,leftOffset:n=0,deletion:i})=>{if(r<n)return n;if(!e)return a.length;let o=null;for(let d=r-1;d>=0;d-=1)if(f(t[d])){o=d;break}if(null===o){for(let e=0;e<t.length;e+=1)if(f(a[e]))return e;return t.length}let l=0;for(let d=0;d<o;d+=1)f(t[d])&&(l+=1);let s=0,u=0;for(let d=0;d<a.length&&(s+=1,f(a[d])&&(u+=1),!(u>=l+1));d+=1);if("backward"!==i)for(;!f(a[s])&&s<a.length;)s+=1;return s})({cursorPositionAfterInput:x,phoneBeforeInput:r,phoneAfterInput:w,phoneAfterFormatted:D,leftOffset:o?n.length+t.dialCode.length+i.length:0,deletion:g}),country:$}})(e,{country:j,phoneBeforeInput:S,insertDialCodeOnEmpty:!1,...v});return P({inputValue:r,phone:a,country:n.iso2}),D(i),t},inputRef:x}},w=({phone:e,country:t,defaultMask:a="............",disableFormatting:r=!1})=>{let n=t.format,i=e=>r?e.replace(new RegExp(`[^${C}]`,"g"),""):e;if(!n)return i(a);if("string"==typeof n)return i(n);if(!n.default)return i(a);let o=Object.keys(n).find((a=>{if("default"===a)return!1;if("/"!==a.charAt(0)||"/"!==a.charAt(a.length-1))return!1;let r=new RegExp(a.substring(1,a.length-1)),n=e.replace(t.dialCode,"");return r.test(m(n))}));return i(o?n[o]:n.default)},x=e=>{let[t,a,r,n,i,o]=e;return{name:t,iso2:a,dialCode:r,format:n,priority:i,areaCodes:o}},k=({field:e,value:t,countries:a=d})=>{if(["priority"].includes(e))throw new Error(`Field "${e}" is not supported`);let r=a.find((a=>{let r=x(a);return t===r[e]}));if(r)return x(r)},D=({phone:e,countries:t=d,currentCountryIso2:a})=>{var r;let n={country:void 0,fullDialCodeMatch:!1};if(!e)return n;let i=m(e);if(!i)return n;let o=n,l=({country:e,fullDialCodeMatch:t})=>{var a,r;let n=e.dialCode===(null==(a=o.country)?void 0:a.dialCode),i=(e.priority??0)<((null==(r=o.country)?void 0:r.priority)??0);(!n||i)&&(o={country:e,fullDialCodeMatch:t})};for(let s of t){let e=x(s),{dialCode:t,areaCodes:a}=e;if(i.startsWith(t)){let r=!o.country||Number(t)>=Number(o.country.dialCode);if(a){let r=i.substring(t.length);for(let t of a)if(r.startsWith(t))return{country:e,fullDialCodeMatch:!0}}(r||t===i||!o.fullDialCodeMatch)&&l({country:e,fullDialCodeMatch:!0})}o.fullDialCodeMatch||i.length<t.length&&t.startsWith(i)&&(!o.country||Number(t)<=Number(o.country.dialCode))&&l({country:e,fullDialCodeMatch:!1})}if(a){let e=k({value:a,field:"iso2",countries:t});if(!e)return o;let n=!!e&&(e=>{if(!(null==e?void 0:e.areaCodes))return!1;let t=i.substring(e.dialCode.length);return e.areaCodes.some((e=>e.startsWith(t)))})(e);o&&(null==(r=o.country)?void 0:r.dialCode)===e.dialCode&&o.country!==e&&o.fullDialCodeMatch&&(!e.areaCodes||n)&&(o={country:e,fullDialCodeMatch:!0})}return o},$=(e,t)=>{let a=parseInt(e,16);return Number(a+t).toString(16)},S="abcdefghijklmnopqrstuvwxyz".split("").reduce(((e,t,a)=>({...e,[t]:$("1f1e6",a)})),{}),N=({iso2:e,size:t,src:r,protocol:n="https",disableLazyLoading:i,className:o,style:l,...s})=>e?a.createElement("img",{className:p({addPrefix:["flag-emoji"],rawClassNames:[o]}),src:(()=>{if(r)return r;let t=[S[(a=e)[0]],S[a[1]]].join("-");var a;return`${n}://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${t}.svg`})(),width:t,height:t,draggable:!1,"data-country":e,loading:i?void 0:"lazy",style:{width:t,height:t,...l},alt:"",...s}):a.createElement("img",{className:p({addPrefix:["flag-emoji"],rawClassNames:[o]}),width:t,height:t,...s}),P=({show:e,dialCodePrefix:t="+",selectedCountry:r,countries:n=d,preferredCountries:i=[],flags:o,onSelect:l,onClose:s,...u})=>{let c=a.useRef(null),f=a.useRef(),m=a.useMemo((()=>{if(!i||!i.length)return n;let e=[],t=[...n];for(let a of i){let r=t.findIndex((e=>x(e).iso2===a));if(-1!==r){let a=t.splice(r,1)[0];e.push(a)}}return e.concat(t)}),[n,i]),h=a.useRef({updatedAt:void 0,value:""}),y=a.useCallback((e=>m.findIndex((t=>x(t).iso2===e))),[m]),[g,C]=a.useState(y(r)),b=()=>{f.current!==r&&C(y(r))},v=a.useCallback((e=>{C(y(e.iso2)),null==l||l(e)}),[l,y]),w=e=>{let t=m.length-1;C((a=>{let r=(n=a,"prev"===e?n-1:"next"===e?n+1:"last"===e?t:0);var n;return r<0?0:r>t?t:r}))},k=a.useCallback((()=>{if(!c.current||void 0===g)return;let e=x(m[g]).iso2;if(e===f.current)return;let t=c.current.querySelector(`[data-country="${e}"]`);t&&(((e,t)=>{let a=e.style.display;"block"!==a&&(e.style.display="block");let r=e.getBoundingClientRect(),n=t.getBoundingClientRect(),i=n.top-r.top,o=r.bottom-n.bottom;i>=0&&o>=0||(Math.abs(i)<Math.abs(o)?e.scrollTop+=i:e.scrollTop-=o),e.style.display=a})(c.current,t),f.current=e)}),[g,m]);return a.useEffect((()=>{k()}),[g,k]),a.useEffect((()=>{c.current&&(e?c.current.focus():b())}),[e]),a.useEffect((()=>{b()}),[r]),a.createElement("ul",{ref:c,role:"listbox",className:p({addPrefix:["country-selector-dropdown"],rawClassNames:[u.className]}),style:{display:e?"block":"none",...u.style},onKeyDown:e=>{if(e.stopPropagation(),"Enter"!==e.key){if("Escape"!==e.key)return"ArrowUp"===e.key?(e.preventDefault(),void w("prev")):"ArrowDown"===e.key?(e.preventDefault(),void w("next")):"PageUp"===e.key?(e.preventDefault(),void w("first")):"PageDown"===e.key?(e.preventDefault(),void w("last")):(" "===e.key&&e.preventDefault(),void(1===e.key.length&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&(e=>{let t=h.current.updatedAt&&(new Date).getTime()-h.current.updatedAt.getTime()>1e3;h.current={value:t?e:`${h.current.value}${e}`,updatedAt:new Date};let a=m.findIndex((e=>x(e).name.toLowerCase().startsWith(h.current.value)));-1!==a&&C(a)})(e.key.toLocaleLowerCase())));null==s||s()}else{e.preventDefault();let t=x(m[g]);v(t)}},onBlur:s,tabIndex:-1,"aria-activedescendant":`react-international-phone__${x(m[g]).iso2}-option`},m.map(((e,n)=>{let l=x(e),s=l.iso2===r,d=n===g,c=i.includes(l.iso2),f=n===i.length-1,m=null==o?void 0:o.find((e=>e.iso2===l.iso2));return a.createElement(a.Fragment,{key:l.iso2},a.createElement("li",{"data-country":l.iso2,role:"option","aria-selected":s,"aria-label":`${l.name} ${t}${l.dialCode}`,id:`react-international-phone__${l.iso2}-option`,className:p({addPrefix:["country-selector-dropdown__list-item",c&&"country-selector-dropdown__list-item--preferred",s&&"country-selector-dropdown__list-item--selected",d&&"country-selector-dropdown__list-item--focused"],rawClassNames:[u.listItemClassName]}),onClick:()=>v(l),style:u.listItemStyle,title:l.name},a.createElement(N,{iso2:l.iso2,src:null==m?void 0:m.src,className:p({addPrefix:["country-selector-dropdown__list-item-flag-emoji"],rawClassNames:[u.listItemFlagClassName]}),style:u.listItemFlagStyle}),a.createElement("span",{className:p({addPrefix:["country-selector-dropdown__list-item-country-name"],rawClassNames:[u.listItemCountryNameClassName]}),style:u.listItemCountryNameStyle},l.name),a.createElement("span",{className:p({addPrefix:["country-selector-dropdown__list-item-dial-code"],rawClassNames:[u.listItemDialCodeClassName]}),style:u.listItemDialCodeStyle},t,l.dialCode)),f?a.createElement("hr",{className:p({addPrefix:["country-selector-dropdown__preferred-list-divider"],rawClassNames:[u.preferredListDividerClassName]}),style:u.preferredListDividerStyle}):null)})))},A=({selectedCountry:e,onSelect:t,disabled:r,hideDropdown:n,countries:i=d,preferredCountries:o=[],flags:l,renderButtonWrapper:s,...u})=>{let[c,f]=a.useState(!1),m=a.useMemo((()=>{if(e)return k({value:e,field:"iso2",countries:i})}),[i,e]),h=a.useRef(null),y=e=>{e.key&&["ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),f(!0))};return a.createElement("div",{className:p({addPrefix:["country-selector"],rawClassNames:[u.className]}),style:u.style,ref:h},(()=>{var t;let i={title:null==m?void 0:m.name,onClick:()=>f((e=>!e)),onMouseDown:e=>e.preventDefault(),onKeyDown:y,disabled:n||r,role:"combobox","aria-label":"Country selector","aria-haspopup":"listbox","aria-expanded":c},o=a.createElement("div",{className:p({addPrefix:["country-selector-button__button-content"],rawClassNames:[u.buttonContentWrapperClassName]}),style:u.buttonContentWrapperStyle},a.createElement(N,{iso2:e,src:null==(t=null==l?void 0:l.find((t=>t.iso2===e)))?void 0:t.src,className:p({addPrefix:["country-selector-button__flag-emoji",r&&"country-selector-button__flag-emoji--disabled"],rawClassNames:[u.flagClassName]}),style:{visibility:e?"visible":"hidden",...u.flagStyle}}),!n&&a.createElement("div",{className:p({addPrefix:["country-selector-button__dropdown-arrow",r&&"country-selector-button__dropdown-arrow--disabled",c&&"country-selector-button__dropdown-arrow--active"],rawClassNames:[u.dropdownArrowClassName]}),style:u.dropdownArrowStyle}));return s?s({children:o,rootProps:i}):a.createElement("button",{...i,type:"button",className:p({addPrefix:["country-selector-button",c&&"country-selector-button--active",r&&"country-selector-button--disabled",n&&"country-selector-button--hide-dropdown"],rawClassNames:[u.buttonClassName]}),"data-country":e,style:u.buttonStyle},o)})(),a.createElement(P,{show:c,countries:i,preferredCountries:o,flags:l,onSelect:e=>{f(!1),null==t||t(e)},selectedCountry:e,onClose:()=>{f(!1)},...u.dropdownStyleProps}))},E=({dialCode:e,prefix:t,disabled:r,style:n,className:i})=>a.createElement("div",{className:p({addPrefix:["dial-code-preview",r&&"dial-code-preview--disabled"],rawClassNames:[i]}),style:n},`${t}${e}`);a.forwardRef((({value:e,onChange:t,countries:r=d,preferredCountries:n=[],hideDropdown:i,showDisabledDialCodeAndPrefix:o,disableFocusAfterCountrySelect:l,flags:s,style:u,className:c,inputStyle:f,inputClassName:m,countrySelectorStyleProps:h,dialCodePreviewStyleProps:y,inputProps:g,placeholder:C,disabled:b,name:w,onFocus:x,onBlur:k,required:D,autoFocus:$,...S},N)=>{let{phone:P,inputValue:M,inputRef:j,country:I,setCountry:z,handlePhoneValueChange:L}=v({value:e,countries:r,...S,onChange:e=>{null==t||t(e.phone,{country:e.country,inputValue:e.inputValue})}}),B=S.disableDialCodeAndPrefix&&o&&(null==I?void 0:I.dialCode);return a.useImperativeHandle(N,(()=>j.current?Object.assign(j.current,{setCountry:z,state:{phone:P,inputValue:M,country:I}}):null),[j,z,P,M,I]),a.createElement("div",{ref:N,className:p({addPrefix:["input-container"],rawClassNames:[c]}),style:u},a.createElement(A,{onSelect:e=>z(e.iso2,{focusOnInput:!l}),flags:s,selectedCountry:I.iso2,countries:r,preferredCountries:n,disabled:b,hideDropdown:i,...h}),B&&a.createElement(E,{dialCode:I.dialCode,prefix:S.prefix??"+",disabled:b,...y}),a.createElement("input",{onChange:L,value:M,type:"tel",ref:j,className:p({addPrefix:["input",b&&"input--disabled"],rawClassNames:[m]}),placeholder:C,disabled:b,style:f,name:w,onFocus:x,onBlur:k,autoFocus:$,required:D,...g}))}));const M=n.styled.div`
2
- ${({theme:e})=>`\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n gap: ${e.spacing[.5]};\n\n > button, div {\n border: 1px solid ${e.palette.gray[300]};\n border-radius: ${e.spacing[.5]};\n }\n\n &.disabled {\n > button, div {\n background: ${e.palette.gray[100]};\n color: ${e.palette.gray[400]};\n cursor: not-allowed;\n }\n }\n\n &.error:not(.disabled) {\n > button, div {\n border: 1px solid ${e.palette.error[500]};\n }\n }\n\n &:focus-within:not(.disabled, .error) {\n > button, div {\n background: ${e.palette.white};\n border: 2px solid ${e.palette.black};\n }\n }\n\n &:hover:not(:focus-within, .disabled, .error) {\n > button, div {\n background: ${e.palette.white};\n border-color: ${e.palette.gray[600]};\n }\n }\n `}
3
- `,j=n.styled.button`
4
- ${({theme:e})=>`\n align-items: center;\n background: inherit;\n border-color: inherit;\n display: flex;\n gap: ${e.spacing[.25]};\n height: 40px;\n min-width: 67px;\n padding: ${e.spacing[.625]} ${e.spacing[1]};\n\n &:disabled {\n background: ${e.palette.gray[100]};\n cursor: not-allowed;\n }\n `}
5
- `,I=n.styled.ul`
6
- ${({theme:e})=>`\n align-items: flex-start;\n box-shadow: ${e.shadows.md};\n display: flex;\n flex-direction: column;\n max-height: 190px;\n overflow: hidden auto;\n scrollbar-color: ${e.palette.gray[600]} ${e.palette.gray[100]};\n scroll-padding: ${e.spacing[.5]};\n scrollbar-width: thin;\n width: max-content;\n `}
7
- `,z=n.styled.li`
8
- ${({theme:e})=>`\n align-items: center;\n background: ${e.palette.white};\n cursor: pointer;\n display: inline-flex;\n font-size: ${e.typography.text.sm};\n gap: ${e.spacing[.5]};\n height: 38px;\n line-height: ${e.spacing[1.25]};\n padding: ${e.spacing[.5]} ${e.spacing[1]};\n width: 190px;\n\n &:hover {\n background: ${e.palette.gray[100]};\n }\n `}
9
- `,L=n.styled.p`
10
- color: ${({theme:e})=>e.palette.gray[800]};
1
+ import { jsx as F, jsxs as H } from "react/jsx-runtime";
2
+ import { u as le, a as se } from "../../../../index-DwznImvK.mjs";
3
+ import S, { forwardRef as ae, useImperativeHandle as de, useRef as T, useCallback as O, useMemo as Y, useEffect as U, useState as G } from "react";
4
+ import { createPortal as ue } from "react-dom";
5
+ import { styled as W, useTheme as ce } from "styled-components";
6
+ import { OutlineContainer as fe } from "../../outline-container/index.js";
7
+ import { S as pe } from "../../../../styles-BXFVwnWT.mjs";
8
+ import { Icon as ee } from "../../../icon/index.js";
9
+ import "../../../typography/heading/index.js";
10
+ import "../../../typography/span/index.js";
11
+ import { Text as ye } from "../../../typography/text/index.js";
12
+ import { u as me } from "../../../../use-click-outside-BUll8Ag-.mjs";
13
+ var R = [["Afghanistan", "af", "93"], ["Albania", "al", "355"], ["Algeria", "dz", "213"], ["Andorra", "ad", "376"], ["Angola", "ao", "244"], ["Antigua and Barbuda", "ag", "1268"], ["Argentina", "ar", "54", "(..) ........", 0], ["Armenia", "am", "374", ".. ......"], ["Aruba", "aw", "297"], ["Australia", "au", "61", { default: ". .... ....", "/^4/": "... ... ...", "/^5(?!50)/": "... ... ...", "/^1(3|8)00/": ".... ... ...", "/^13/": ".. .. ..", "/^180/": "... ...." }, 0, []], ["Austria", "at", "43"], ["Azerbaijan", "az", "994", "(..) ... .. .."], ["Bahamas", "bs", "1242"], ["Bahrain", "bh", "973"], ["Bangladesh", "bd", "880"], ["Barbados", "bb", "1246"], ["Belarus", "by", "375", "(..) ... .. .."], ["Belgium", "be", "32", "... .. .. .."], ["Belize", "bz", "501"], ["Benin", "bj", "229"], ["Bhutan", "bt", "975"], ["Bolivia", "bo", "591"], ["Bosnia and Herzegovina", "ba", "387"], ["Botswana", "bw", "267"], ["Brazil", "br", "55", "(..) ........."], ["British Indian Ocean Territory", "io", "246"], ["Brunei", "bn", "673"], ["Bulgaria", "bg", "359"], ["Burkina Faso", "bf", "226"], ["Burundi", "bi", "257"], ["Cambodia", "kh", "855"], ["Cameroon", "cm", "237"], ["Canada", "ca", "1", "(...) ...-....", 1, ["204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"]], ["Cape Verde", "cv", "238"], ["Caribbean Netherlands", "bq", "599", "", 1], ["Cayman Islands", "ky", "1", "... ... ....", 4, ["345"]], ["Central African Republic", "cf", "236"], ["Chad", "td", "235"], ["Chile", "cl", "56"], ["China", "cn", "86", "... .... ...."], ["Colombia", "co", "57", "... ... ...."], ["Comoros", "km", "269"], ["Congo", "cd", "243"], ["Congo", "cg", "242"], ["Costa Rica", "cr", "506", "....-...."], ["Côte d'Ivoire", "ci", "225", ".. .. .. .. .."], ["Croatia", "hr", "385"], ["Cuba", "cu", "53"], ["Curaçao", "cw", "599", "", 0], ["Cyprus", "cy", "357", ".. ......"], ["Czech Republic", "cz", "420", "... ... ..."], ["Denmark", "dk", "45", ".. .. .. .."], ["Djibouti", "dj", "253"], ["Dominica", "dm", "1767"], ["Dominican Republic", "do", "1", "(...) ...-....", 2, ["809", "829", "849"]], ["Ecuador", "ec", "593"], ["Egypt", "eg", "20"], ["El Salvador", "sv", "503", "....-...."], ["Equatorial Guinea", "gq", "240"], ["Eritrea", "er", "291"], ["Estonia", "ee", "372", ".... ......"], ["Ethiopia", "et", "251"], ["Fiji", "fj", "679"], ["Finland", "fi", "358", ".. ... .. .."], ["France", "fr", "33", ". .. .. .. .."], ["French Guiana", "gf", "594"], ["French Polynesia", "pf", "689"], ["Gabon", "ga", "241"], ["Gambia", "gm", "220"], ["Georgia", "ge", "995"], ["Germany", "de", "49", "... ........."], ["Ghana", "gh", "233"], ["Greece", "gr", "30"], ["Greenland", "gl", "299", ".. .. .."], ["Grenada", "gd", "1473"], ["Guadeloupe", "gp", "590", "", 0], ["Guam", "gu", "1671"], ["Guatemala", "gt", "502", "....-...."], ["Guinea", "gn", "224"], ["Guinea-Bissau", "gw", "245"], ["Guyana", "gy", "592"], ["Haiti", "ht", "509", "....-...."], ["Honduras", "hn", "504"], ["Hong Kong", "hk", "852", ".... ...."], ["Hungary", "hu", "36"], ["Iceland", "is", "354", "... ...."], ["India", "in", "91", ".....-....."], ["Indonesia", "id", "62"], ["Iran", "ir", "98", "... ... ...."], ["Iraq", "iq", "964"], ["Ireland", "ie", "353", ".. ......."], ["Israel", "il", "972", "... ... ...."], ["Italy", "it", "39", "... .......", 0], ["Jamaica", "jm", "1876"], ["Japan", "jp", "81", ".. .... ...."], ["Jordan", "jo", "962"], ["Kazakhstan", "kz", "7", "... ...-..-..", 0], ["Kenya", "ke", "254"], ["Kiribati", "ki", "686"], ["Kosovo", "xk", "383"], ["Kuwait", "kw", "965"], ["Kyrgyzstan", "kg", "996", "... ... ..."], ["Laos", "la", "856"], ["Latvia", "lv", "371", ".. ... ..."], ["Lebanon", "lb", "961"], ["Lesotho", "ls", "266"], ["Liberia", "lr", "231"], ["Libya", "ly", "218"], ["Liechtenstein", "li", "423"], ["Lithuania", "lt", "370"], ["Luxembourg", "lu", "352"], ["Macau", "mo", "853"], ["Macedonia", "mk", "389"], ["Madagascar", "mg", "261"], ["Malawi", "mw", "265"], ["Malaysia", "my", "60", "..-....-...."], ["Maldives", "mv", "960"], ["Mali", "ml", "223"], ["Malta", "mt", "356"], ["Marshall Islands", "mh", "692"], ["Martinique", "mq", "596"], ["Mauritania", "mr", "222"], ["Mauritius", "mu", "230"], ["Mexico", "mx", "52", "... ... ....", 0], ["Micronesia", "fm", "691"], ["Moldova", "md", "373", "(..) ..-..-.."], ["Monaco", "mc", "377"], ["Mongolia", "mn", "976"], ["Montenegro", "me", "382"], ["Morocco", "ma", "212"], ["Mozambique", "mz", "258"], ["Myanmar", "mm", "95"], ["Namibia", "na", "264"], ["Nauru", "nr", "674"], ["Nepal", "np", "977"], ["Netherlands", "nl", "31", { "/^06/": "(.). .........", "/^6/": ". .........", "/^0(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/": "(.).. ........", "/^(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/": ".. ........", "/^0/": "(.)... .......", default: "... ......." }], ["New Caledonia", "nc", "687"], ["New Zealand", "nz", "64", "...-...-...."], ["Nicaragua", "ni", "505"], ["Niger", "ne", "227"], ["Nigeria", "ng", "234"], ["North Korea", "kp", "850"], ["Norway", "no", "47", "... .. ..."], ["Oman", "om", "968"], ["Pakistan", "pk", "92", "...-......."], ["Palau", "pw", "680"], ["Palestine", "ps", "970"], ["Panama", "pa", "507"], ["Papua New Guinea", "pg", "675"], ["Paraguay", "py", "595"], ["Peru", "pe", "51"], ["Philippines", "ph", "63", "... ... ...."], ["Poland", "pl", "48", "...-...-..."], ["Portugal", "pt", "351"], ["Puerto Rico", "pr", "1", "(...) ...-....", 3, ["787", "939"]], ["Qatar", "qa", "974"], ["Réunion", "re", "262"], ["Romania", "ro", "40"], ["Russia", "ru", "7", "(...) ...-..-..", 1], ["Rwanda", "rw", "250"], ["Saint Kitts and Nevis", "kn", "1869"], ["Saint Lucia", "lc", "1758"], ["Saint Vincent and the Grenadines", "vc", "1784"], ["Samoa", "ws", "685"], ["San Marino", "sm", "378"], ["São Tomé and Príncipe", "st", "239"], ["Saudi Arabia", "sa", "966"], ["Senegal", "sn", "221"], ["Serbia", "rs", "381"], ["Seychelles", "sc", "248"], ["Sierra Leone", "sl", "232"], ["Singapore", "sg", "65", "....-...."], ["Slovakia", "sk", "421"], ["Slovenia", "si", "386"], ["Solomon Islands", "sb", "677"], ["Somalia", "so", "252"], ["South Africa", "za", "27"], ["South Korea", "kr", "82", "... .... ...."], ["South Sudan", "ss", "211"], ["Spain", "es", "34", "... ... ..."], ["Sri Lanka", "lk", "94"], ["Sudan", "sd", "249"], ["Suriname", "sr", "597"], ["Swaziland", "sz", "268"], ["Sweden", "se", "46", "... ... ..."], ["Switzerland", "ch", "41", ".. ... .. .."], ["Syria", "sy", "963"], ["Taiwan", "tw", "886"], ["Tajikistan", "tj", "992"], ["Tanzania", "tz", "255"], ["Thailand", "th", "66"], ["Timor-Leste", "tl", "670"], ["Togo", "tg", "228"], ["Tonga", "to", "676"], ["Trinidad and Tobago", "tt", "1868"], ["Tunisia", "tn", "216"], ["Turkey", "tr", "90", "... ... .. .."], ["Turkmenistan", "tm", "993"], ["Tuvalu", "tv", "688"], ["Uganda", "ug", "256"], ["Ukraine", "ua", "380", "(..) ... .. .."], ["United Arab Emirates", "ae", "971"], ["United Kingdom", "gb", "44", ".... ......"], ["United States", "us", "1", "(...) ...-....", 0], ["Uruguay", "uy", "598"], ["Uzbekistan", "uz", "998", ".. ... .. .."], ["Vanuatu", "vu", "678"], ["Vatican City", "va", "39", ".. .... ....", 1], ["Venezuela", "ve", "58"], ["Vietnam", "vn", "84"], ["Yemen", "ye", "967"], ["Zambia", "zm", "260"], ["Zimbabwe", "zw", "263"]], he = "react-international-phone-", re = (...e) => e.filter((t) => !!t).join(" ").trim(), Ce = (...e) => re(...e).split(" ").map((t) => `${he}${t}`).join(" "), A = ({ addPrefix: e, rawClassNames: t }) => re(Ce(...e), ...t), ge = ({ value: e, mask: t, maskSymbol: r, offset: l = 0, trimNonMaskCharsLeftover: a = !1 }) => {
14
+ if (e.length < l) return e;
15
+ let n = e.slice(0, l), f = e.slice(l), u = n, o = 0;
16
+ for (let s of t.split("")) {
17
+ if (o >= f.length) {
18
+ if (!a && s !== r) {
19
+ u += s;
20
+ continue;
21
+ }
22
+ break;
23
+ }
24
+ s === r ? (u += f[o], o += 1) : u += s;
25
+ }
26
+ return u;
27
+ }, K = (e) => e ? /^\d+$/.test(e) : !1, Q = (e) => e.replace(/\D/g, ""), be = (e, t) => {
28
+ let r = e.style.display;
29
+ r !== "block" && (e.style.display = "block");
30
+ let l = e.getBoundingClientRect(), a = t.getBoundingClientRect(), n = a.top - l.top, f = l.bottom - a.bottom;
31
+ n >= 0 && f >= 0 || (Math.abs(n) < Math.abs(f) ? e.scrollTop += n : e.scrollTop -= f), e.style.display = r;
32
+ }, we = () => typeof window > "u" ? !1 : window.navigator.userAgent.toLowerCase().includes("macintosh"), ve = (e, t) => {
33
+ let r = t.disableDialCodeAndPrefix ? !1 : t.forceDialCode, l = t.disableDialCodeAndPrefix ? !1 : t.insertDialCodeOnEmpty, a = e, n = (s) => t.trimNonDigitsEnd ? s.trim() : s;
34
+ if (!a) return l && !a.length || r ? n(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`) : n(a);
35
+ if (a = Q(a), a === t.dialCode && !t.disableDialCodeAndPrefix) return n(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`);
36
+ if (t.dialCode.startsWith(a) && !t.disableDialCodeAndPrefix) return n(r ? `${t.prefix}${t.dialCode}${t.charAfterDialCode}` : `${t.prefix}${a}`);
37
+ if (!a.startsWith(t.dialCode) && !t.disableDialCodeAndPrefix) {
38
+ if (r) return n(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`);
39
+ if (a.length < t.dialCode.length) return n(`${t.prefix}${a}`);
40
+ }
41
+ let f = () => {
42
+ let s = t.dialCode.length, i = a.slice(0, s), y = a.slice(s);
43
+ return { phoneLeftSide: i, phoneRightSide: y };
44
+ }, { phoneLeftSide: u, phoneRightSide: o } = f();
45
+ return u = `${t.prefix}${u}${t.charAfterDialCode}`, o = ge({ value: o, mask: t.mask, maskSymbol: t.maskChar, trimNonMaskCharsLeftover: t.trimNonDigitsEnd || t.disableDialCodeAndPrefix && o.length === 0 }), t.disableDialCodeAndPrefix && (u = ""), n(`${u}${o}`);
46
+ }, xe = ({ phoneBeforeInput: e, phoneAfterInput: t, phoneAfterFormatted: r, cursorPositionAfterInput: l, leftOffset: a = 0, deletion: n }) => {
47
+ if (l < a) return a;
48
+ if (!e) return r.length;
49
+ let f = null;
50
+ for (let i = l - 1; i >= 0; i -= 1) if (K(t[i])) {
51
+ f = i;
52
+ break;
53
+ }
54
+ if (f === null) {
55
+ for (let i = 0; i < t.length; i += 1) if (K(r[i])) return i;
56
+ return t.length;
57
+ }
58
+ let u = 0;
59
+ for (let i = 0; i < f; i += 1) K(t[i]) && (u += 1);
60
+ let o = 0, s = 0;
61
+ for (let i = 0; i < r.length && (o += 1, K(r[i]) && (s += 1), !(s >= u + 1)); i += 1) ;
62
+ if (n !== "backward") for (; !K(r[o]) && o < r.length; ) o += 1;
63
+ return o;
64
+ }, J = ({ phone: e, prefix: t }) => e ? `${t}${Q(e)}` : "";
65
+ function X({ value: e, country: t, insertDialCodeOnEmpty: r, trimNonDigitsEnd: l, countries: a, prefix: n, charAfterDialCode: f, forceDialCode: u, disableDialCodeAndPrefix: o, defaultMask: s, countryGuessingEnabled: i, disableFormatting: y }) {
66
+ let d = e;
67
+ o && (d = d.startsWith(`${n}`) ? d : `${n}${t.dialCode}${d}`);
68
+ let p = i ? Ie({ phone: d, countries: a, currentCountryIso2: t == null ? void 0 : t.iso2 }) : void 0, v = (p == null ? void 0 : p.country) ?? t, m = ve(d, { prefix: n, mask: Ae({ phone: d, country: v, defaultMask: s, disableFormatting: y }), maskChar: ne, dialCode: v.dialCode, trimNonDigitsEnd: l, charAfterDialCode: f, forceDialCode: u, insertDialCodeOnEmpty: r, disableDialCodeAndPrefix: o }), g = i && !(p != null && p.fullDialCodeMatch) ? t : v;
69
+ return { phone: J({ phone: o ? `${g.dialCode}${m}` : m, prefix: n }), inputValue: m, country: g };
70
+ }
71
+ var De = (e) => {
72
+ if ((e == null ? void 0 : e.toLocaleLowerCase().includes("delete")) ?? !1) return e != null && e.toLocaleLowerCase().includes("forward") ? "forward" : "backward";
73
+ }, ke = (e, { country: t, insertDialCodeOnEmpty: r, phoneBeforeInput: l, prefix: a, charAfterDialCode: n, forceDialCode: f, disableDialCodeAndPrefix: u, countryGuessingEnabled: o, defaultMask: s, disableFormatting: i, countries: y }) => {
74
+ let d = e.nativeEvent, p = d.inputType, v = De(p), m = !!(p != null && p.startsWith("insertFrom")), g = p === "insertText", x = (d == null ? void 0 : d.data) || void 0, b = e.target.value, E = e.target.selectionStart ?? 0;
75
+ if (p != null && p.includes("history")) return { inputValue: l, phone: J({ phone: l, prefix: a }), cursorPosition: l.length, country: t };
76
+ if (g && !K(x) && b !== a) return { inputValue: l, phone: J({ phone: u ? `${t.dialCode}${l}` : l, prefix: a }), cursorPosition: E - ((x == null ? void 0 : x.length) ?? 0), country: t };
77
+ if (f && !b.startsWith(`${a}${t.dialCode}`) && !m) {
78
+ let h = b ? l : `${a}${t.dialCode}${n}`;
79
+ return { inputValue: h, phone: J({ phone: h, prefix: a }), cursorPosition: a.length + t.dialCode.length + n.length, country: t };
80
+ }
81
+ let { phone: V, inputValue: M, country: c } = X({ value: b, country: t, trimNonDigitsEnd: v === "backward", insertDialCodeOnEmpty: r, countryGuessingEnabled: o, countries: y, prefix: a, charAfterDialCode: n, forceDialCode: f, disableDialCodeAndPrefix: u, disableFormatting: i, defaultMask: s }), C = xe({ cursorPositionAfterInput: E, phoneBeforeInput: l, phoneAfterInput: b, phoneAfterFormatted: M, leftOffset: f ? a.length + t.dialCode.length + n.length : 0, deletion: v });
82
+ return { phone: V, inputValue: M, cursorPosition: C, country: c };
83
+ }, $e = (e, t) => {
84
+ let r = Object.keys(e), l = Object.keys(t);
85
+ if (r.length !== l.length) return !1;
86
+ for (let a of r) if (e[a] !== t[a]) return !1;
87
+ return !0;
88
+ }, Se = () => {
89
+ let e = T(), t = T(Date.now());
90
+ return { check: () => {
91
+ let r = Date.now(), l = e.current ? r - t.current : void 0;
92
+ return e.current = t.current, t.current = r, l;
93
+ } };
94
+ }, Ne = { size: 20, overrideLastItemDebounceMS: -1 };
95
+ function Pe(e, t) {
96
+ let { size: r, overrideLastItemDebounceMS: l, onChange: a } = { ...Ne, ...t }, [n, f] = G(e), [u, o] = G([n]), [s, i] = G(0), y = Se();
97
+ return [n, (d, p) => {
98
+ if (typeof d == "object" && typeof n == "object" && $e(d, n) || d === n) return;
99
+ let v = l > 0, m = y.check(), g = v && m !== void 0 ? m > l : !0;
100
+ if ((p == null ? void 0 : p.overrideLastItem) !== void 0 ? p.overrideLastItem : !g) o((x) => [...x.slice(0, s), d]);
101
+ else {
102
+ let x = u.length >= r;
103
+ o((b) => [...b.slice(x ? 1 : 0, s + 1), d]), x || i((b) => b + 1);
104
+ }
105
+ f(d), a == null || a(d);
106
+ }, () => {
107
+ if (s <= 0) return { success: !1 };
108
+ let d = u[s - 1];
109
+ return f(d), i((p) => p - 1), a == null || a(d), { success: !0, value: d };
110
+ }, () => {
111
+ if (s + 1 >= u.length) return { success: !1 };
112
+ let d = u[s + 1];
113
+ return f(d), i((p) => p + 1), a == null || a(d), { success: !0, value: d };
114
+ }];
115
+ }
116
+ var ne = ".", z = { defaultCountry: "us", value: "", prefix: "+", defaultMask: "............", charAfterDialCode: " ", historySaveDebounceMS: 200, disableCountryGuess: !1, disableDialCodePrefill: !1, forceDialCode: !1, disableDialCodeAndPrefix: !1, disableFormatting: !1, countries: R, preferredCountries: [] }, oe = ({ defaultCountry: e = z.defaultCountry, value: t = z.value, countries: r = z.countries, prefix: l = z.prefix, defaultMask: a = z.defaultMask, charAfterDialCode: n = z.charAfterDialCode, historySaveDebounceMS: f = z.historySaveDebounceMS, disableCountryGuess: u = z.disableCountryGuess, disableDialCodePrefill: o = z.disableDialCodePrefill, forceDialCode: s = z.forceDialCode, disableDialCodeAndPrefix: i = z.disableDialCodeAndPrefix, disableFormatting: y = z.disableFormatting, onChange: d, inputRef: p }) => {
117
+ let v = { countries: r, prefix: l, charAfterDialCode: n, forceDialCode: i ? !1 : s, disableDialCodeAndPrefix: i, defaultMask: a, countryGuessingEnabled: !u, disableFormatting: y }, m = T(null), g = p || m, x = (w) => {
118
+ Promise.resolve().then(() => {
119
+ var $;
120
+ typeof window > "u" || g.current !== (document == null ? void 0 : document.activeElement) || (($ = g.current) == null || $.setSelectionRange(w, w));
121
+ });
122
+ }, [{ phone: b, inputValue: E, country: V }, M, c, C] = Pe(() => {
123
+ let w = q({ value: e, field: "iso2", countries: r });
124
+ w || console.error(`[react-international-phone]: can not find a country with "${e}" iso2 code`);
125
+ let $ = w || q({ value: "us", field: "iso2", countries: r }), { phone: P, inputValue: B, country: j } = X({ value: t, country: $, insertDialCodeOnEmpty: !o, ...v });
126
+ return x(B.length), { phone: P, inputValue: B, country: j.iso2 };
127
+ }, { overrideLastItemDebounceMS: f, onChange: ({ inputValue: w, phone: $, country: P }) => {
128
+ if (!d) return;
129
+ let B = h(P);
130
+ d({ phone: $, inputValue: w, country: B });
131
+ } }), h = O((w) => q({ value: w, field: "iso2", countries: r }), [r]), D = Y(() => h(V), [V, h]);
132
+ U(() => {
133
+ let w = g.current;
134
+ if (!w) return;
135
+ let $ = (P) => {
136
+ if (!P.key) return;
137
+ let B = P.ctrlKey, j = P.metaKey, ie = P.shiftKey;
138
+ if (P.key.toLowerCase() === "z") {
139
+ if (we()) {
140
+ if (!j) return;
141
+ } else if (!B) return;
142
+ ie ? C() : c();
143
+ }
144
+ };
145
+ return w.addEventListener("keydown", $), () => {
146
+ w.removeEventListener("keydown", $);
147
+ };
148
+ }, [g, c, C]);
149
+ let N = (w) => {
150
+ w.preventDefault();
151
+ let { phone: $, inputValue: P, country: B, cursorPosition: j } = ke(w, { country: D, phoneBeforeInput: E, insertDialCodeOnEmpty: !1, ...v });
152
+ return M({ inputValue: P, phone: $, country: B.iso2 }), x(j), t;
153
+ }, k = (w, $ = { focusOnInput: !1 }) => {
154
+ let P = q({ value: w, field: "iso2", countries: r });
155
+ if (!P) {
156
+ console.error(`[react-international-phone]: can not find a country with "${w}" iso2 code`);
157
+ return;
158
+ }
159
+ let B = i ? "" : `${l}${P.dialCode}${n}`;
160
+ M({ inputValue: B, phone: `${l}${P.dialCode}`, country: P.iso2 }), $.focusOnInput && Promise.resolve().then(() => {
161
+ var j;
162
+ (j = g.current) == null || j.focus();
163
+ });
164
+ }, [I, L] = G(!1);
165
+ return U(() => {
166
+ if (!I) {
167
+ L(!0), t !== b && (d == null || d({ inputValue: E, phone: b, country: D }));
168
+ return;
169
+ }
170
+ if (t === b) return;
171
+ let { phone: w, inputValue: $, country: P } = X({ value: t, country: D, insertDialCodeOnEmpty: !o, ...v });
172
+ M({ phone: w, inputValue: $, country: P.iso2 });
173
+ }, [t]), { phone: b, inputValue: E, country: D, setCountry: k, handlePhoneValueChange: N, inputRef: g };
174
+ }, Ae = ({ phone: e, country: t, defaultMask: r = "............", disableFormatting: l = !1 }) => {
175
+ let a = t.format, n = (u) => l ? u.replace(new RegExp(`[^${ne}]`, "g"), "") : u;
176
+ if (!a) return n(r);
177
+ if (typeof a == "string") return n(a);
178
+ if (!a.default) return console.error(`[react-international-phone]: default mask for ${t.iso2} is not provided`), n(r);
179
+ let f = Object.keys(a).find((u) => {
180
+ if (u === "default") return !1;
181
+ if (!(u.charAt(0) === "/" && u.charAt(u.length - 1) === "/")) return console.error(`[react-international-phone]: format regex "${u}" for ${t.iso2} is not valid`), !1;
182
+ let o = new RegExp(u.substring(1, u.length - 1)), s = e.replace(t.dialCode, "");
183
+ return o.test(Q(s));
184
+ });
185
+ return n(f ? a[f] : a.default);
186
+ }, _ = (e) => {
187
+ let [t, r, l, a, n, f] = e;
188
+ return { name: t, iso2: r, dialCode: l, format: a, priority: n, areaCodes: f };
189
+ }, Ee = (e) => `Field "${e}" is not supported`, q = ({ field: e, value: t, countries: r = R }) => {
190
+ if (["priority"].includes(e)) throw new Error(Ee(e));
191
+ let l = r.find((a) => {
192
+ let n = _(a);
193
+ return t === n[e];
194
+ });
195
+ if (l) return _(l);
196
+ }, Ie = ({ phone: e, countries: t = R, currentCountryIso2: r }) => {
197
+ var u;
198
+ let l = { country: void 0, fullDialCodeMatch: !1 };
199
+ if (!e) return l;
200
+ let a = Q(e);
201
+ if (!a) return l;
202
+ let n = l, f = ({ country: o, fullDialCodeMatch: s }) => {
203
+ var d, p;
204
+ let i = o.dialCode === ((d = n.country) == null ? void 0 : d.dialCode), y = (o.priority ?? 0) < (((p = n.country) == null ? void 0 : p.priority) ?? 0);
205
+ (!i || y) && (n = { country: o, fullDialCodeMatch: s });
206
+ };
207
+ for (let o of t) {
208
+ let s = _(o), { dialCode: i, areaCodes: y } = s;
209
+ if (a.startsWith(i)) {
210
+ let d = n.country ? Number(i) >= Number(n.country.dialCode) : !0;
211
+ if (y) {
212
+ let p = a.substring(i.length);
213
+ for (let v of y) if (p.startsWith(v)) return { country: s, fullDialCodeMatch: !0 };
214
+ }
215
+ (d || i === a || !n.fullDialCodeMatch) && f({ country: s, fullDialCodeMatch: !0 });
216
+ }
217
+ n.fullDialCodeMatch || a.length < i.length && i.startsWith(a) && (!n.country || Number(i) <= Number(n.country.dialCode)) && f({ country: s, fullDialCodeMatch: !1 });
218
+ }
219
+ if (r) {
220
+ let o = q({ value: r, field: "iso2", countries: t });
221
+ if (!o) return n;
222
+ let s = o ? ((i) => {
223
+ if (!(i != null && i.areaCodes)) return !1;
224
+ let y = a.substring(i.dialCode.length);
225
+ return i.areaCodes.some((d) => d.startsWith(y));
226
+ })(o) : !1;
227
+ n && ((u = n.country) == null ? void 0 : u.dialCode) === o.dialCode && n.country !== o && n.fullDialCodeMatch && (!o.areaCodes || s) && (n = { country: o, fullDialCodeMatch: !0 });
228
+ }
229
+ return n;
230
+ }, Me = (e, t) => {
231
+ let r = parseInt(e, 16);
232
+ return Number(r + t).toString(16);
233
+ }, Le = "abcdefghijklmnopqrstuvwxyz", ze = "1f1e6", te = Le.split("").reduce((e, t, r) => ({ ...e, [t]: Me(ze, r) }), {}), _e = (e) => [te[e[0]], te[e[1]]].join("-"), Z = ({ iso2: e, size: t, src: r, protocol: l = "https", disableLazyLoading: a, className: n, style: f, ...u }) => {
234
+ if (!e) return S.createElement("img", { className: A({ addPrefix: ["flag-emoji"], rawClassNames: [n] }), width: t, height: t, ...u });
235
+ let o = () => {
236
+ if (r) return r;
237
+ let s = _e(e);
238
+ return `${l}://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${s}.svg`;
239
+ };
240
+ return S.createElement("img", { className: A({ addPrefix: ["flag-emoji"], rawClassNames: [n] }), src: o(), width: t, height: t, draggable: !1, "data-country": e, loading: a ? void 0 : "lazy", style: { width: t, height: t, ...f }, alt: "", ...u });
241
+ }, Ve = 1e3, Be = ({ show: e, dialCodePrefix: t = "+", selectedCountry: r, countries: l = R, preferredCountries: a = [], flags: n, onSelect: f, onClose: u, ...o }) => {
242
+ let s = T(null), i = T(), y = Y(() => {
243
+ if (!a || !a.length) return l;
244
+ let c = [], C = [...l];
245
+ for (let h of a) {
246
+ let D = C.findIndex((N) => _(N).iso2 === h);
247
+ if (D !== -1) {
248
+ let N = C.splice(D, 1)[0];
249
+ c.push(N);
250
+ }
251
+ }
252
+ return c.concat(C);
253
+ }, [l, a]), d = T({ updatedAt: void 0, value: "" }), p = (c) => {
254
+ let C = d.current.updatedAt && (/* @__PURE__ */ new Date()).getTime() - d.current.updatedAt.getTime() > Ve;
255
+ d.current = { value: C ? c : `${d.current.value}${c}`, updatedAt: /* @__PURE__ */ new Date() };
256
+ let h = y.findIndex((D) => _(D).name.toLowerCase().startsWith(d.current.value));
257
+ h !== -1 && g(h);
258
+ }, v = O((c) => y.findIndex((C) => _(C).iso2 === c), [y]), [m, g] = G(v(r)), x = () => {
259
+ i.current !== r && g(v(r));
260
+ }, b = O((c) => {
261
+ g(v(c.iso2)), f == null || f(c);
262
+ }, [f, v]), E = (c) => {
263
+ let C = y.length - 1, h = (D) => c === "prev" ? D - 1 : c === "next" ? D + 1 : c === "last" ? C : 0;
264
+ g((D) => {
265
+ let N = h(D);
266
+ return N < 0 ? 0 : N > C ? C : N;
267
+ });
268
+ }, V = (c) => {
269
+ if (c.stopPropagation(), c.key === "Enter") {
270
+ c.preventDefault();
271
+ let C = _(y[m]);
272
+ b(C);
273
+ return;
274
+ }
275
+ if (c.key === "Escape") {
276
+ u == null || u();
277
+ return;
278
+ }
279
+ if (c.key === "ArrowUp") {
280
+ c.preventDefault(), E("prev");
281
+ return;
282
+ }
283
+ if (c.key === "ArrowDown") {
284
+ c.preventDefault(), E("next");
285
+ return;
286
+ }
287
+ if (c.key === "PageUp") {
288
+ c.preventDefault(), E("first");
289
+ return;
290
+ }
291
+ if (c.key === "PageDown") {
292
+ c.preventDefault(), E("last");
293
+ return;
294
+ }
295
+ c.key === " " && c.preventDefault(), c.key.length === 1 && !c.altKey && !c.ctrlKey && !c.metaKey && p(c.key.toLocaleLowerCase());
296
+ }, M = O(() => {
297
+ if (!s.current || m === void 0) return;
298
+ let c = _(y[m]).iso2;
299
+ if (c === i.current) return;
300
+ let C = s.current.querySelector(`[data-country="${c}"]`);
301
+ C && (be(s.current, C), i.current = c);
302
+ }, [m, y]);
303
+ return U(() => {
304
+ M();
305
+ }, [m, M]), U(() => {
306
+ s.current && (e ? s.current.focus() : x());
307
+ }, [e]), U(() => {
308
+ x();
309
+ }, [r]), S.createElement("ul", { ref: s, role: "listbox", className: A({ addPrefix: ["country-selector-dropdown"], rawClassNames: [o.className] }), style: { display: e ? "block" : "none", ...o.style }, onKeyDown: V, onBlur: u, tabIndex: -1, "aria-activedescendant": `react-international-phone__${_(y[m]).iso2}-option` }, y.map((c, C) => {
310
+ let h = _(c), D = h.iso2 === r, N = C === m, k = a.includes(h.iso2), I = C === a.length - 1, L = n == null ? void 0 : n.find((w) => w.iso2 === h.iso2);
311
+ return S.createElement(S.Fragment, { key: h.iso2 }, S.createElement("li", { "data-country": h.iso2, role: "option", "aria-selected": D, "aria-label": `${h.name} ${t}${h.dialCode}`, id: `react-international-phone__${h.iso2}-option`, className: A({ addPrefix: ["country-selector-dropdown__list-item", k && "country-selector-dropdown__list-item--preferred", D && "country-selector-dropdown__list-item--selected", N && "country-selector-dropdown__list-item--focused"], rawClassNames: [o.listItemClassName] }), onClick: () => b(h), style: o.listItemStyle, title: h.name }, S.createElement(Z, { iso2: h.iso2, src: L == null ? void 0 : L.src, className: A({ addPrefix: ["country-selector-dropdown__list-item-flag-emoji"], rawClassNames: [o.listItemFlagClassName] }), style: o.listItemFlagStyle }), S.createElement("span", { className: A({ addPrefix: ["country-selector-dropdown__list-item-country-name"], rawClassNames: [o.listItemCountryNameClassName] }), style: o.listItemCountryNameStyle }, h.name), S.createElement("span", { className: A({ addPrefix: ["country-selector-dropdown__list-item-dial-code"], rawClassNames: [o.listItemDialCodeClassName] }), style: o.listItemDialCodeStyle }, t, h.dialCode)), I ? S.createElement("hr", { className: A({ addPrefix: ["country-selector-dropdown__preferred-list-divider"], rawClassNames: [o.preferredListDividerClassName] }), style: o.preferredListDividerStyle }) : null);
312
+ }));
313
+ }, Fe = ({ selectedCountry: e, onSelect: t, disabled: r, hideDropdown: l, countries: a = R, preferredCountries: n = [], flags: f, renderButtonWrapper: u, ...o }) => {
314
+ let [s, i] = G(!1), y = Y(() => {
315
+ if (e) return q({ value: e, field: "iso2", countries: a });
316
+ }, [a, e]), d = T(null), p = (m) => {
317
+ m.key && ["ArrowUp", "ArrowDown"].includes(m.key) && (m.preventDefault(), i(!0));
318
+ }, v = () => {
319
+ var x;
320
+ let m = { title: y == null ? void 0 : y.name, onClick: () => i((b) => !b), onMouseDown: (b) => b.preventDefault(), onKeyDown: p, disabled: l || r, role: "combobox", "aria-label": "Country selector", "aria-haspopup": "listbox", "aria-expanded": s }, g = S.createElement("div", { className: A({ addPrefix: ["country-selector-button__button-content"], rawClassNames: [o.buttonContentWrapperClassName] }), style: o.buttonContentWrapperStyle }, S.createElement(Z, { iso2: e, src: (x = f == null ? void 0 : f.find((b) => b.iso2 === e)) == null ? void 0 : x.src, className: A({ addPrefix: ["country-selector-button__flag-emoji", r && "country-selector-button__flag-emoji--disabled"], rawClassNames: [o.flagClassName] }), style: { visibility: e ? "visible" : "hidden", ...o.flagStyle } }), !l && S.createElement("div", { className: A({ addPrefix: ["country-selector-button__dropdown-arrow", r && "country-selector-button__dropdown-arrow--disabled", s && "country-selector-button__dropdown-arrow--active"], rawClassNames: [o.dropdownArrowClassName] }), style: o.dropdownArrowStyle }));
321
+ return u ? u({ children: g, rootProps: m }) : S.createElement("button", { ...m, type: "button", className: A({ addPrefix: ["country-selector-button", s && "country-selector-button--active", r && "country-selector-button--disabled", l && "country-selector-button--hide-dropdown"], rawClassNames: [o.buttonClassName] }), "data-country": e, style: o.buttonStyle }, g);
322
+ };
323
+ return S.createElement("div", { className: A({ addPrefix: ["country-selector"], rawClassNames: [o.className] }), style: o.style, ref: d }, v(), S.createElement(Be, { show: s, countries: a, preferredCountries: n, flags: f, onSelect: (m) => {
324
+ i(!1), t == null || t(m);
325
+ }, selectedCountry: e, onClose: () => {
326
+ i(!1);
327
+ }, ...o.dropdownStyleProps }));
328
+ }, je = ({ dialCode: e, prefix: t, disabled: r, style: l, className: a }) => S.createElement("div", { className: A({ addPrefix: ["dial-code-preview", r && "dial-code-preview--disabled"], rawClassNames: [a] }), style: l }, `${t}${e}`);
329
+ ae(({ value: e, onChange: t, countries: r = R, preferredCountries: l = [], hideDropdown: a, showDisabledDialCodeAndPrefix: n, disableFocusAfterCountrySelect: f, flags: u, style: o, className: s, inputStyle: i, inputClassName: y, countrySelectorStyleProps: d, dialCodePreviewStyleProps: p, inputProps: v, placeholder: m, disabled: g, name: x, onFocus: b, onBlur: E, required: V, autoFocus: M, ...c }, C) => {
330
+ let { phone: h, inputValue: D, inputRef: N, country: k, setCountry: I, handlePhoneValueChange: L } = oe({ value: e, countries: r, ...c, onChange: ($) => {
331
+ t == null || t($.phone, { country: $.country, inputValue: $.inputValue });
332
+ } }), w = c.disableDialCodeAndPrefix && n && (k == null ? void 0 : k.dialCode);
333
+ return de(C, () => N.current ? Object.assign(N.current, { setCountry: I, state: { phone: h, inputValue: D, country: k } }) : null, [N, I, h, D, k]), S.createElement("div", { ref: C, className: A({ addPrefix: ["input-container"], rawClassNames: [s] }), style: o }, S.createElement(Fe, { onSelect: ($) => I($.iso2, { focusOnInput: !f }), flags: u, selectedCountry: k.iso2, countries: r, preferredCountries: l, disabled: g, hideDropdown: a, ...d }), w && S.createElement(je, { dialCode: k.dialCode, prefix: c.prefix ?? "+", disabled: g, ...p }), S.createElement("input", { onChange: L, value: D, type: "tel", ref: N, className: A({ addPrefix: ["input", g && "input--disabled"], rawClassNames: [y] }), placeholder: m, disabled: g, style: i, name: x, onFocus: b, onBlur: E, autoFocus: M, required: V, ...v }));
334
+ });
335
+ const Te = W.div`
336
+ ${({ theme: e }) => `
337
+ align-items: flex-start;
338
+ align-self: stretch;
339
+ display: flex;
340
+ gap: ${e.spacing[0.5]};
341
+
342
+ > button, div {
343
+ border: 1px solid ${e.palette.gray[300]};
344
+ border-radius: ${e.spacing[0.5]};
345
+ }
346
+
347
+ &.disabled {
348
+ > button, div {
349
+ background: ${e.palette.gray[100]};
350
+ color: ${e.palette.gray[400]};
351
+ cursor: not-allowed;
352
+ }
353
+ }
354
+
355
+ &.error:not(.disabled) {
356
+ > button, div {
357
+ border: 1px solid ${e.palette.error[500]};
358
+ }
359
+ }
360
+
361
+ &:focus-within:not(.disabled, .error) {
362
+ > button, div {
363
+ background: ${e.palette.white};
364
+ border: 2px solid ${e.palette.black};
365
+ }
366
+ }
367
+
368
+ &:hover:not(:focus-within, .disabled, .error) {
369
+ > button, div {
370
+ background: ${e.palette.white};
371
+ border-color: ${e.palette.gray[600]};
372
+ }
373
+ }
374
+ `}
375
+ `, Ge = W.button`
376
+ ${({ theme: e }) => `
377
+ align-items: center;
378
+ background: inherit;
379
+ border-color: inherit;
380
+ display: flex;
381
+ gap: ${e.spacing[0.25]};
382
+ height: 40px;
383
+ min-width: 67px;
384
+ padding: ${e.spacing[0.625]} ${e.spacing[1]};
385
+
386
+ &:disabled {
387
+ background: ${e.palette.gray[100]};
388
+ cursor: not-allowed;
389
+ }
390
+ `}
391
+ `, Re = W.ul`
392
+ ${({ theme: e }) => `
393
+ align-items: flex-start;
394
+ box-shadow: ${e.shadows.md};
395
+ display: flex;
396
+ flex-direction: column;
397
+ max-height: 190px;
398
+ overflow: hidden auto;
399
+ scrollbar-color: ${e.palette.gray[600]} ${e.palette.gray[100]};
400
+ scroll-padding: ${e.spacing[0.5]};
401
+ scrollbar-width: thin;
402
+ width: max-content;
403
+ `}
404
+ `, Oe = W.li`
405
+ ${({ theme: e }) => `
406
+ align-items: center;
407
+ background: ${e.palette.white};
408
+ cursor: pointer;
409
+ display: inline-flex;
410
+ font-size: ${e.typography.text.sm};
411
+ gap: ${e.spacing[0.5]};
412
+ height: 38px;
413
+ line-height: ${e.spacing[1.25]};
414
+ padding: ${e.spacing[0.5]} ${e.spacing[1]};
415
+ width: 190px;
416
+
417
+ &:hover {
418
+ background: ${e.palette.gray[100]};
419
+ }
420
+ `}
421
+ `, Ke = W.p`
422
+ color: ${({ theme: e }) => e.palette.gray[800]};
11
423
  font-size: inherit;
12
424
  min-width: 55%;
13
425
  overflow: hidden;
14
426
  text-overflow: ellipsis;
15
427
  white-space: nowrap;
16
- `,B=a.forwardRef((function({disabled:c,error:p,label:f,name:m,required:h,tooltip:y,value:g,weight:C,...b},w){const k=n.useTheme(),[D,$]=a.useState(!1),[S,P]=a.useState(""),A=a.useRef(null),{refs:E,floatingStyles:B}=t.useFloating({placement:"bottom-start",whileElementsMounted:t.autoUpdate}),{inputValue:V,handlePhoneValueChange:_,country:R,setCountry:q}=v({countries:d,defaultCountry:"us",value:g?String(g):void 0}),F=a.useCallback((()=>{$((e=>!e)),D||P("")}),[D]),T=a.useCallback((e=>()=>{q(e),$(!1),P("")}),[q,$]),G=a.useCallback((e=>{1===e.key.length?P((t=>t+e.key)):"Backspace"===e.key&&P((e=>e.slice(0,-1)))}),[]),O=d.filter((e=>{const{name:t}=x(e);return t.toLowerCase().includes(S.toLowerCase())}));return u.useClickOutside(E.floating.current,(()=>{$(!1),P("")}),!0),e.jsx(i.OutlineContainer,{error:p,htmlFor:m,label:f,required:h,tooltip:y,weight:C,children:e.jsxs(M,{className:`${c?"disabled":""} ${p?"error":""}`,ref:A,children:[e.jsxs(j,{"aria-label":"country-selector","data-testid":"country-selector",disabled:c,id:"country-selector",onClick:F,onKeyDown:G,ref:E.setReference,children:[e.jsx(N,{iso2:R.iso2,size:"16px"}),e.jsx(l.Icon,{icon:"angle-down",iconColor:k.palette.gray[400],iconSize:"xs",iconType:"fa-light"})]}),e.jsxs(o.StyledTextInputContainer,{className:`${c?"disabled":""} ${p?"error":""}`,children:[e.jsx("input",{"aria-hidden":!1,"aria-invalid":p?"true":"false","aria-label":m,"aria-required":h,autoComplete:"off","data-testid":`${m}-input`,disabled:c,id:m,name:m,onChange:_,ref:w,type:"tel",value:V,...b}),p?e.jsx(l.Icon,{icon:"exclamation-circle",iconClass:"error-icon",iconColor:k.palette.error[500],iconSize:"xs"}):void 0]}),D&&r.createPortal(e.jsx(I,{ref:E.setFloating,style:B,children:O.map((t=>{const{dialCode:a,iso2:r,name:n}=x(t);return e.jsxs(z,{onClick:T(r),value:r,children:[e.jsx(N,{iso2:r,size:"16px"}),e.jsx(L,{children:n}),e.jsx(s.Text,{color:k.palette.gray[400],size:"sm",sizeSm:"xs",textAlign:"end",children:"+"+a})]},r)}))}),document.getElementById("root")??document.body)]})})}));exports.PhoneInput=B;
428
+ `, rt = ae(function({
429
+ disabled: t,
430
+ error: r,
431
+ label: l,
432
+ name: a,
433
+ required: n,
434
+ tooltip: f,
435
+ value: u,
436
+ weight: o,
437
+ ...s
438
+ }, i) {
439
+ const y = ce(), [d, p] = G(!1), [v, m] = G(""), g = T(null), { refs: x, floatingStyles: b } = le({
440
+ placement: "bottom-start",
441
+ whileElementsMounted: se
442
+ }), { inputValue: E, handlePhoneValueChange: V, country: M, setCountry: c } = oe({
443
+ countries: R,
444
+ defaultCountry: "us",
445
+ value: u ? String(u) : void 0
446
+ }), C = O(() => {
447
+ p((k) => !k), d || m("");
448
+ }, [d]), h = O(
449
+ (k) => () => {
450
+ c(k), p(!1), m("");
451
+ },
452
+ [c, p]
453
+ ), D = O(
454
+ (k) => {
455
+ k.key.length === 1 ? m((I) => I + k.key) : k.key === "Backspace" && m((I) => I.slice(0, -1));
456
+ },
457
+ []
458
+ ), N = R.filter((k) => {
459
+ const { name: I } = _(k);
460
+ return I.toLowerCase().includes(v.toLowerCase());
461
+ });
462
+ return me(
463
+ x.floating.current,
464
+ () => {
465
+ p(!1), m("");
466
+ },
467
+ !0
468
+ ), /* @__PURE__ */ F(
469
+ fe,
470
+ {
471
+ error: r,
472
+ htmlFor: a,
473
+ label: l,
474
+ required: n,
475
+ tooltip: f,
476
+ weight: o,
477
+ children: /* @__PURE__ */ H(
478
+ Te,
479
+ {
480
+ className: `${t ? "disabled" : ""} ${r ? "error" : ""}`,
481
+ ref: g,
482
+ children: [
483
+ /* @__PURE__ */ H(
484
+ Ge,
485
+ {
486
+ "aria-label": "country-selector",
487
+ "data-testid": "country-selector",
488
+ disabled: t,
489
+ id: "country-selector",
490
+ onClick: C,
491
+ onKeyDown: D,
492
+ ref: x.setReference,
493
+ children: [
494
+ /* @__PURE__ */ F(Z, { iso2: M.iso2, size: "16px" }),
495
+ /* @__PURE__ */ F(
496
+ ee,
497
+ {
498
+ icon: "angle-down",
499
+ iconColor: y.palette.gray[400],
500
+ iconSize: "xs",
501
+ iconType: "fa-light"
502
+ }
503
+ )
504
+ ]
505
+ }
506
+ ),
507
+ /* @__PURE__ */ H(
508
+ pe,
509
+ {
510
+ className: `${t ? "disabled" : ""} ${r ? "error" : ""}`,
511
+ children: [
512
+ /* @__PURE__ */ F(
513
+ "input",
514
+ {
515
+ "aria-hidden": !1,
516
+ "aria-invalid": r ? "true" : "false",
517
+ "aria-label": a,
518
+ "aria-required": n,
519
+ autoComplete: "off",
520
+ "data-testid": `${a}-input`,
521
+ disabled: t,
522
+ id: a,
523
+ name: a,
524
+ onChange: V,
525
+ ref: i,
526
+ type: "tel",
527
+ value: E,
528
+ ...s
529
+ }
530
+ ),
531
+ r ? /* @__PURE__ */ F(
532
+ ee,
533
+ {
534
+ icon: "exclamation-circle",
535
+ iconClass: "error-icon",
536
+ iconColor: y.palette.error[500],
537
+ iconSize: "xs"
538
+ }
539
+ ) : void 0
540
+ ]
541
+ }
542
+ ),
543
+ d && ue(
544
+ /* @__PURE__ */ F(Re, { ref: x.setFloating, style: b, children: N.map((k) => {
545
+ const { dialCode: I, iso2: L, name: w } = _(k);
546
+ return /* @__PURE__ */ H(
547
+ Oe,
548
+ {
549
+ onClick: h(L),
550
+ value: L,
551
+ children: [
552
+ /* @__PURE__ */ F(Z, { iso2: L, size: "16px" }),
553
+ /* @__PURE__ */ F(Ke, { children: w }),
554
+ /* @__PURE__ */ F(
555
+ ye,
556
+ {
557
+ color: y.palette.gray[400],
558
+ size: "sm",
559
+ sizeSm: "xs",
560
+ textAlign: "end",
561
+ children: "+" + I
562
+ }
563
+ )
564
+ ]
565
+ },
566
+ L
567
+ );
568
+ }) }),
569
+ document.getElementById("root") ?? document.body
570
+ )
571
+ ]
572
+ }
573
+ )
574
+ }
575
+ );
576
+ });
577
+ export {
578
+ rt as PhoneInput
579
+ };