intl-tel-input 27.3.0 → 27.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/data.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v27.3.0
2
+ * International Telephone Input v27.3.1
3
3
  * git+https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -1775,13 +1775,7 @@ var _factory = (() => {
1775
1775
  dialCode: c[1],
1776
1776
  priority: c[2] || 0,
1777
1777
  areaCodes: c[3] || null,
1778
- nationalPrefix: c[4] || null,
1779
- normalisedName: "",
1780
- // populated in the plugin
1781
- initials: "",
1782
- // populated in the plugin
1783
- dialCodePlus: ""
1784
- // populated in the plugin
1778
+ nationalPrefix: c[4] || null
1785
1779
  });
1786
1780
  }
1787
1781
  var iso2Set = new Set(allCountries.map((c) => c.iso2));
@@ -1,7 +1,7 @@
1
1
  /*
2
- * International Telephone Input v27.3.0
2
+ * International Telephone Input v27.3.1
3
3
  * git+https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
6
- "use strict";var _factory=(()=>{var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var c=(l,n)=>{for(var s in n)t(l,s,{get:n[s],enumerable:!0})},p=(l,n,s,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of m(n))!g.call(l,u)&&u!==s&&t(l,u,{get:()=>n[u],enumerable:!(e=r(n,u))||e.enumerable});return l};var d=l=>p(t({},"__esModule",{value:!0}),l);var y={};c(y,{default:()=>k,isIso2:()=>b,iso2Set:()=>i,rawCountryData:()=>o});var o=[["af","93",0,null,"0"],["ax","358",1,["18","4"],"0"],["al","355",0,null,"0"],["dz","213",0,null,"0"],["as","1",5,["684"],"1"],["ad","376"],["ao","244"],["ai","1",6,["264"],"1"],["ag","1",7,["268"],"1"],["ar","54",0,null,"0"],["am","374",0,null,"0"],["aw","297"],["ac","247"],["au","61",0,["4"],"0"],["at","43",0,null,"0"],["az","994",0,null,"0"],["bs","1",8,["242"],"1"],["bh","973"],["bd","880",0,null,"0"],["bb","1",9,["246"],"1"],["by","375",0,null,"8"],["be","32",0,null,"0"],["bz","501"],["bj","229"],["bm","1",10,["441"],"1"],["bt","975"],["bo","591",0,null,"0"],["ba","387",0,null,"0"],["bw","267"],["br","55",0,null,"0"],["io","246"],["vg","1",11,["284"],"1"],["bn","673"],["bg","359",0,null,"0"],["bf","226"],["bi","257"],["kh","855",0,null,"0"],["cm","237"],["ca","1",1,["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"],"1"],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"],"1"],["cf","236"],["td","235"],["cl","56"],["cn","86",0,null,"0"],["cx","61",2,["4","89164"],"0"],["cc","61",1,["4","89162"],"0"],["co","57",0,null,"0"],["km","269"],["cg","242"],["cd","243",0,null,"0"],["ck","682"],["cr","506"],["ci","225"],["hr","385",0,null,"0"],["cu","53",0,null,"0"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"],"1"],["do","1",2,["809","829","849"],"1"],["ec","593",0,null,"0"],["eg","20",0,null,"0"],["sv","503"],["gq","240"],["er","291",0,null,"0"],["ee","372"],["sz","268"],["et","251",0,null,"0"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0,["4"],"0"],["fr","33",0,null,"0"],["gf","594",0,null,"0"],["pf","689"],["ga","241"],["gm","220"],["ge","995",0,null,"0"],["de","49",0,null,"0"],["gh","233",0,null,"0"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"],"1"],["gp","590",0,null,"0"],["gu","1",15,["671"],"1"],["gt","502"],["gg","44",1,["1481","7781","7839","7911"],"0"],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36",0,null,"06"],["is","354"],["in","91",0,null,"0"],["id","62",0,null,"0"],["ir","98",0,null,"0"],["iq","964",0,null,"0"],["ie","353",0,null,"0"],["im","44",2,["1624","74576","7524","7624","7924"],"0"],["il","972",0,null,"0"],["it","39",0,["3"]],["jm","1",4,["658","876"],"1"],["jp","81",0,null,"0"],["je","44",3,["1534","7509","7700","7797","7829","7937"],"0"],["jo","962",0,null,"0"],["kz","7",1,["33","7"],"8"],["ke","254",0,null,"0"],["ki","686",0,null,"0"],["xk","383",0,null,"0"],["kw","965"],["kg","996",0,null,"0"],["la","856",0,null,"0"],["lv","371"],["lb","961",0,null,"0"],["ls","266"],["lr","231",0,null,"0"],["ly","218",0,null,"0"],["li","423",0,null,"0"],["lt","370",0,null,"0"],["lu","352"],["mo","853"],["mg","261",0,null,"0"],["mw","265",0,null,"0"],["my","60",0,null,"0"],["mv","960"],["ml","223"],["mt","356"],["mh","692",0,null,"1"],["mq","596",0,null,"0"],["mr","222"],["mu","230"],["yt","262",1,["269","639"],"0"],["mx","52"],["fm","691"],["md","373",0,null,"0"],["mc","377",0,null,"0"],["mn","976",0,null,"0"],["me","382",0,null,"0"],["ms","1",16,["664"],"1"],["ma","212",0,["6","7"],"0"],["mz","258"],["mm","95",0,null,"0"],["na","264",0,null,"0"],["nr","674"],["np","977",0,null,"0"],["nl","31",0,null,"0"],["nc","687"],["nz","64",0,null,"0"],["ni","505"],["ne","227"],["ng","234",0,null,"0"],["nu","683"],["nf","672"],["kp","850",0,null,"0"],["mk","389",0,null,"0"],["mp","1",17,["670"],"1"],["no","47",0,["4","9"]],["om","968"],["pk","92",0,null,"0"],["pw","680"],["ps","970",0,null,"0"],["pa","507"],["pg","675"],["py","595",0,null,"0"],["pe","51",0,null,"0"],["ph","63",0,null,"0"],["pl","48"],["pt","351"],["pr","1",3,["787","939"],"1"],["qa","974"],["re","262",0,null,"0"],["ro","40",0,null,"0"],["ru","7",0,["33"],"8"],["rw","250",0,null,"0"],["ws","685"],["sm","378"],["st","239"],["sa","966",0,null,"0"],["sn","221"],["rs","381",0,null,"0"],["sc","248"],["sl","232",0,null,"0"],["sg","65"],["sx","1",21,["721"],"1"],["sk","421",0,null,"0"],["si","386",0,null,"0"],["sb","677"],["so","252",0,null,"0"],["za","27",0,null,"0"],["kr","82",0,null,"0"],["ss","211",0,null,"0"],["es","34"],["lk","94",0,null,"0"],["bl","590",1,null,"0"],["sh","290"],["kn","1",18,["869"],"1"],["lc","1",19,["758"],"1"],["mf","590",2,null,"0"],["pm","508",0,null,"0"],["vc","1",20,["784"],"1"],["sd","249",0,null,"0"],["sr","597"],["sj","47",1,["4","79","9"]],["se","46",0,null,"0"],["ch","41",0,null,"0"],["sy","963",0,null,"0"],["tw","886",0,null,"0"],["tj","992"],["tz","255",0,null,"0"],["th","66",0,null,"0"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"],"1"],["tn","216"],["tr","90",0,null,"0"],["tm","993",0,null,"8"],["tc","1",23,["649"],"1"],["tv","688"],["vi","1",24,["340"],"1"],["ug","256",0,null,"0"],["ua","380",0,null,"0"],["ae","971",0,null,"0"],["gb","44",0,null,"0"],["us","1",0,null,"1"],["uy","598",0,null,"0"],["uz","998"],["vu","678"],["va","39",1,["06698","3"]],["ve","58",0,null,"0"],["vn","84",0,null,"0"],["wf","681"],["eh","212",1,["5288","5289","6","7"],"0"],["ye","967",0,null,"0"],["zm","260",0,null,"0"],["zw","263",0,null,"0"]],a=[];for(let l of o)a.push({name:"",iso2:l[0],dialCode:l[1],priority:l[2]||0,areaCodes:l[3]||null,nationalPrefix:l[4]||null,normalisedName:"",initials:"",dialCodePlus:""});var i=new Set(a.map(l=>l.iso2)),b=l=>i.has(l),k=a;return d(y);})();
6
+ "use strict";var _factory=(()=>{var t=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var c=(l,n)=>{for(var s in n)t(l,s,{get:n[s],enumerable:!0})},p=(l,n,s,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of i(n))!g.call(l,u)&&u!==s&&t(l,u,{get:()=>n[u],enumerable:!(o=m(n,u))||o.enumerable});return l};var b=l=>p(t({},"__esModule",{value:!0}),l);var y={};c(y,{default:()=>k,isIso2:()=>d,iso2Set:()=>r,rawCountryData:()=>e});var e=[["af","93",0,null,"0"],["ax","358",1,["18","4"],"0"],["al","355",0,null,"0"],["dz","213",0,null,"0"],["as","1",5,["684"],"1"],["ad","376"],["ao","244"],["ai","1",6,["264"],"1"],["ag","1",7,["268"],"1"],["ar","54",0,null,"0"],["am","374",0,null,"0"],["aw","297"],["ac","247"],["au","61",0,["4"],"0"],["at","43",0,null,"0"],["az","994",0,null,"0"],["bs","1",8,["242"],"1"],["bh","973"],["bd","880",0,null,"0"],["bb","1",9,["246"],"1"],["by","375",0,null,"8"],["be","32",0,null,"0"],["bz","501"],["bj","229"],["bm","1",10,["441"],"1"],["bt","975"],["bo","591",0,null,"0"],["ba","387",0,null,"0"],["bw","267"],["br","55",0,null,"0"],["io","246"],["vg","1",11,["284"],"1"],["bn","673"],["bg","359",0,null,"0"],["bf","226"],["bi","257"],["kh","855",0,null,"0"],["cm","237"],["ca","1",1,["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"],"1"],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"],"1"],["cf","236"],["td","235"],["cl","56"],["cn","86",0,null,"0"],["cx","61",2,["4","89164"],"0"],["cc","61",1,["4","89162"],"0"],["co","57",0,null,"0"],["km","269"],["cg","242"],["cd","243",0,null,"0"],["ck","682"],["cr","506"],["ci","225"],["hr","385",0,null,"0"],["cu","53",0,null,"0"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"],"1"],["do","1",2,["809","829","849"],"1"],["ec","593",0,null,"0"],["eg","20",0,null,"0"],["sv","503"],["gq","240"],["er","291",0,null,"0"],["ee","372"],["sz","268"],["et","251",0,null,"0"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0,["4"],"0"],["fr","33",0,null,"0"],["gf","594",0,null,"0"],["pf","689"],["ga","241"],["gm","220"],["ge","995",0,null,"0"],["de","49",0,null,"0"],["gh","233",0,null,"0"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"],"1"],["gp","590",0,null,"0"],["gu","1",15,["671"],"1"],["gt","502"],["gg","44",1,["1481","7781","7839","7911"],"0"],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36",0,null,"06"],["is","354"],["in","91",0,null,"0"],["id","62",0,null,"0"],["ir","98",0,null,"0"],["iq","964",0,null,"0"],["ie","353",0,null,"0"],["im","44",2,["1624","74576","7524","7624","7924"],"0"],["il","972",0,null,"0"],["it","39",0,["3"]],["jm","1",4,["658","876"],"1"],["jp","81",0,null,"0"],["je","44",3,["1534","7509","7700","7797","7829","7937"],"0"],["jo","962",0,null,"0"],["kz","7",1,["33","7"],"8"],["ke","254",0,null,"0"],["ki","686",0,null,"0"],["xk","383",0,null,"0"],["kw","965"],["kg","996",0,null,"0"],["la","856",0,null,"0"],["lv","371"],["lb","961",0,null,"0"],["ls","266"],["lr","231",0,null,"0"],["ly","218",0,null,"0"],["li","423",0,null,"0"],["lt","370",0,null,"0"],["lu","352"],["mo","853"],["mg","261",0,null,"0"],["mw","265",0,null,"0"],["my","60",0,null,"0"],["mv","960"],["ml","223"],["mt","356"],["mh","692",0,null,"1"],["mq","596",0,null,"0"],["mr","222"],["mu","230"],["yt","262",1,["269","639"],"0"],["mx","52"],["fm","691"],["md","373",0,null,"0"],["mc","377",0,null,"0"],["mn","976",0,null,"0"],["me","382",0,null,"0"],["ms","1",16,["664"],"1"],["ma","212",0,["6","7"],"0"],["mz","258"],["mm","95",0,null,"0"],["na","264",0,null,"0"],["nr","674"],["np","977",0,null,"0"],["nl","31",0,null,"0"],["nc","687"],["nz","64",0,null,"0"],["ni","505"],["ne","227"],["ng","234",0,null,"0"],["nu","683"],["nf","672"],["kp","850",0,null,"0"],["mk","389",0,null,"0"],["mp","1",17,["670"],"1"],["no","47",0,["4","9"]],["om","968"],["pk","92",0,null,"0"],["pw","680"],["ps","970",0,null,"0"],["pa","507"],["pg","675"],["py","595",0,null,"0"],["pe","51",0,null,"0"],["ph","63",0,null,"0"],["pl","48"],["pt","351"],["pr","1",3,["787","939"],"1"],["qa","974"],["re","262",0,null,"0"],["ro","40",0,null,"0"],["ru","7",0,["33"],"8"],["rw","250",0,null,"0"],["ws","685"],["sm","378"],["st","239"],["sa","966",0,null,"0"],["sn","221"],["rs","381",0,null,"0"],["sc","248"],["sl","232",0,null,"0"],["sg","65"],["sx","1",21,["721"],"1"],["sk","421",0,null,"0"],["si","386",0,null,"0"],["sb","677"],["so","252",0,null,"0"],["za","27",0,null,"0"],["kr","82",0,null,"0"],["ss","211",0,null,"0"],["es","34"],["lk","94",0,null,"0"],["bl","590",1,null,"0"],["sh","290"],["kn","1",18,["869"],"1"],["lc","1",19,["758"],"1"],["mf","590",2,null,"0"],["pm","508",0,null,"0"],["vc","1",20,["784"],"1"],["sd","249",0,null,"0"],["sr","597"],["sj","47",1,["4","79","9"]],["se","46",0,null,"0"],["ch","41",0,null,"0"],["sy","963",0,null,"0"],["tw","886",0,null,"0"],["tj","992"],["tz","255",0,null,"0"],["th","66",0,null,"0"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"],"1"],["tn","216"],["tr","90",0,null,"0"],["tm","993",0,null,"8"],["tc","1",23,["649"],"1"],["tv","688"],["vi","1",24,["340"],"1"],["ug","256",0,null,"0"],["ua","380",0,null,"0"],["ae","971",0,null,"0"],["gb","44",0,null,"0"],["us","1",0,null,"1"],["uy","598",0,null,"0"],["uz","998"],["vu","678"],["va","39",1,["06698","3"]],["ve","58",0,null,"0"],["vn","84",0,null,"0"],["wf","681"],["eh","212",1,["5288","5289","6","7"],"0"],["ye","967",0,null,"0"],["zm","260",0,null,"0"],["zw","263",0,null,"0"]],a=[];for(let l of e)a.push({name:"",iso2:l[0],dialCode:l[1],priority:l[2]||0,areaCodes:l[3]||null,nationalPrefix:l[4]||null});var r=new Set(a.map(l=>l.iso2)),d=l=>r.has(l),k=a;return b(y);})();
7
7
  var allCountries = _factory.default;
package/dist/js/data.mjs CHANGED
@@ -1743,13 +1743,7 @@ for (const c of rawCountryData) {
1743
1743
  dialCode: c[1],
1744
1744
  priority: c[2] || 0,
1745
1745
  areaCodes: c[3] || null,
1746
- nationalPrefix: c[4] || null,
1747
- normalisedName: "",
1748
- // populated in the plugin
1749
- initials: "",
1750
- // populated in the plugin
1751
- dialCodePlus: ""
1752
- // populated in the plugin
1746
+ nationalPrefix: c[4] || null
1753
1747
  });
1754
1748
  }
1755
1749
  var iso2Set = new Set(allCountries.map((c) => c.iso2));
@@ -1592,15 +1592,12 @@ declare const rawCountryData: readonly [
1592
1592
  ];
1593
1593
  export type Iso2 = (typeof rawCountryData)[number][0];
1594
1594
  export type Country = {
1595
+ name: string;
1595
1596
  iso2: Iso2;
1596
1597
  dialCode: string;
1597
1598
  priority: number;
1598
1599
  areaCodes: readonly string[] | null;
1599
1600
  nationalPrefix: string | null;
1600
- name: string;
1601
- normalisedName: string;
1602
- initials: string;
1603
- dialCodePlus: string;
1604
1601
  };
1605
1602
  export type I18n = Partial<Record<Iso2, string>> & {
1606
1603
  selectedCountryAriaLabel?: string;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v27.3.0
2
+ * International Telephone Input v27.3.1
3
3
  * git+https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -1775,13 +1775,7 @@ var _factory = (() => {
1775
1775
  dialCode: c[1],
1776
1776
  priority: c[2] || 0,
1777
1777
  areaCodes: c[3] || null,
1778
- nationalPrefix: c[4] || null,
1779
- normalisedName: "",
1780
- // populated in the plugin
1781
- initials: "",
1782
- // populated in the plugin
1783
- dialCodePlus: ""
1784
- // populated in the plugin
1778
+ nationalPrefix: c[4] || null
1785
1779
  });
1786
1780
  }
1787
1781
  var iso2Set = new Set(allCountries.map((c) => c.iso2));
@@ -2294,7 +2288,20 @@ var _factory = (() => {
2294
2288
  </svg>`;
2295
2289
 
2296
2290
  // src/js/core/countrySearch.ts
2297
- var getMatchedCountries = (countries, query) => {
2291
+ var buildSearchTokens = (countries) => {
2292
+ const tokens = /* @__PURE__ */ new Map();
2293
+ for (const c of countries) {
2294
+ const normalisedName = normaliseString(c.name);
2295
+ const initials = normalisedName.split(/[^a-z]/).map((word) => word[0]).join("");
2296
+ tokens.set(c.iso2, {
2297
+ normalisedName,
2298
+ initials,
2299
+ dialCodePlus: `+${c.dialCode}`
2300
+ });
2301
+ }
2302
+ return tokens;
2303
+ };
2304
+ var getMatchedCountries = (countries, searchTokens, query) => {
2298
2305
  const normalisedQuery = normaliseString(query);
2299
2306
  const iso2Matches = [];
2300
2307
  const nameStartsWith = [];
@@ -2303,17 +2310,18 @@ var _factory = (() => {
2303
2310
  const dialCodeContains = [];
2304
2311
  const initialsMatches = [];
2305
2312
  for (const c of countries) {
2313
+ const t = searchTokens.get(c.iso2);
2306
2314
  if (c.iso2 === normalisedQuery) {
2307
2315
  iso2Matches.push(c);
2308
- } else if (c.normalisedName.startsWith(normalisedQuery)) {
2316
+ } else if (t.normalisedName.startsWith(normalisedQuery)) {
2309
2317
  nameStartsWith.push(c);
2310
- } else if (c.normalisedName.includes(normalisedQuery)) {
2318
+ } else if (t.normalisedName.includes(normalisedQuery)) {
2311
2319
  nameContains.push(c);
2312
- } else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
2320
+ } else if (normalisedQuery === c.dialCode || normalisedQuery === t.dialCodePlus) {
2313
2321
  dialCodeMatches.push(c);
2314
- } else if (c.dialCodePlus.includes(normalisedQuery)) {
2322
+ } else if (t.dialCodePlus.includes(normalisedQuery)) {
2315
2323
  dialCodeContains.push(c);
2316
- } else if (c.initials.includes(normalisedQuery)) {
2324
+ } else if (t.initials.includes(normalisedQuery)) {
2317
2325
  initialsMatches.push(c);
2318
2326
  }
2319
2327
  }
@@ -2328,16 +2336,75 @@ var _factory = (() => {
2328
2336
  ...initialsMatches
2329
2337
  ];
2330
2338
  };
2331
- var findFirstCountryStartingWith = (countries, query) => {
2339
+ var findFirstCountryStartingWith = (countries, searchTokens, query) => {
2332
2340
  const normalisedQuery = normaliseString(query);
2333
2341
  for (const c of countries) {
2334
- if (c.normalisedName.startsWith(normalisedQuery)) {
2342
+ const { normalisedName } = searchTokens.get(c.iso2);
2343
+ if (normalisedName.startsWith(normalisedQuery)) {
2335
2344
  return c;
2336
2345
  }
2337
2346
  }
2338
2347
  return null;
2339
2348
  };
2340
2349
 
2350
+ // src/js/core/numerals.ts
2351
+ var Numerals = class _Numerals {
2352
+ #userNumeralSet;
2353
+ //* Stateless conversion of any Arabic-Indic / Persian digits to ASCII 0-9.
2354
+ //* Use this when you need to normalise digits without affecting any instance's tracked numeral set (e.g. for the country-search query).
2355
+ static toAscii(str) {
2356
+ if (!str) {
2357
+ return "";
2358
+ }
2359
+ return str.replace(
2360
+ /[٠-٩]/g,
2361
+ (ch) => String.fromCharCode(48 + (ch.charCodeAt(0) - 1632))
2362
+ ).replace(
2363
+ /[۰-۹]/g,
2364
+ (ch) => String.fromCharCode(48 + (ch.charCodeAt(0) - 1776))
2365
+ );
2366
+ }
2367
+ constructor(initialValue) {
2368
+ if (initialValue) {
2369
+ this.#updateNumeralSet(initialValue);
2370
+ }
2371
+ }
2372
+ // If any Arabic-Indic digits, then label it as that set. Same for Persian. Otherwise assume ASCII.
2373
+ #updateNumeralSet(str) {
2374
+ if (/[٠-٩]/.test(str)) {
2375
+ this.#userNumeralSet = "arabic-indic";
2376
+ } else if (/[۰-۹]/.test(str)) {
2377
+ this.#userNumeralSet = "persian";
2378
+ } else {
2379
+ this.#userNumeralSet = "ascii";
2380
+ }
2381
+ }
2382
+ // Denormalise ASCII 0-9 to the user's numeral set. If not yet known, return as-is.
2383
+ // NOTE: normalise is always called before this, so it should be impossible for the numeral set to be unknown at this point.
2384
+ denormalise(str) {
2385
+ if (!this.#userNumeralSet || this.#userNumeralSet === "ascii") {
2386
+ return str;
2387
+ }
2388
+ const base = this.#userNumeralSet === "arabic-indic" ? 1632 : 1776;
2389
+ return str.replace(/[0-9]/g, (d) => String.fromCharCode(base + Number(d)));
2390
+ }
2391
+ // Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9.
2392
+ // Tracks the user's numeral set as a side effect so denormalise can mirror it back.
2393
+ normalise(str) {
2394
+ if (!str) {
2395
+ return "";
2396
+ }
2397
+ this.#updateNumeralSet(str);
2398
+ if (this.#userNumeralSet === "ascii") {
2399
+ return str;
2400
+ }
2401
+ return _Numerals.toAscii(str);
2402
+ }
2403
+ isAscii() {
2404
+ return !this.#userNumeralSet || this.#userNumeralSet === "ascii";
2405
+ }
2406
+ };
2407
+
2341
2408
  // src/js/core/ui.ts
2342
2409
  var UI = class _UI {
2343
2410
  // private
@@ -2346,6 +2413,7 @@ var _factory = (() => {
2346
2413
  #isRTL;
2347
2414
  #originalPaddingLeft = "";
2348
2415
  #countries;
2416
+ #searchTokens;
2349
2417
  #searchDebounceTimer = null;
2350
2418
  #inlineDropdownHeight;
2351
2419
  #countryContainerEl;
@@ -2391,8 +2459,9 @@ var _factory = (() => {
2391
2459
  }
2392
2460
  }
2393
2461
  //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
2394
- buildMarkup(countries) {
2462
+ buildMarkup(countries, searchTokens) {
2395
2463
  this.#countries = countries;
2464
+ this.#searchTokens = searchTokens;
2396
2465
  this.telInputEl.classList.add("iti__tel-input");
2397
2466
  if (!this.telInputEl.hasAttribute("type")) {
2398
2467
  this.telInputEl.setAttribute("type", "tel");
@@ -2760,7 +2829,12 @@ var _factory = (() => {
2760
2829
  if (query === "") {
2761
2830
  matchedCountries = this.#countries;
2762
2831
  } else {
2763
- matchedCountries = getMatchedCountries(this.#countries, query);
2832
+ const normalisedQuery = Numerals.toAscii(query);
2833
+ matchedCountries = getMatchedCountries(
2834
+ this.#countries,
2835
+ this.#searchTokens,
2836
+ normalisedQuery
2837
+ );
2764
2838
  }
2765
2839
  this.#showFilteredCountries(matchedCountries);
2766
2840
  }
@@ -3055,7 +3129,11 @@ var _factory = (() => {
3055
3129
  }
3056
3130
  //* Hidden search (countrySearch disabled): jump to the first list item whose name starts with the query.
3057
3131
  #searchForCountry(query) {
3058
- const match = findFirstCountryStartingWith(this.#countries, query);
3132
+ const match = findFirstCountryStartingWith(
3133
+ this.#countries,
3134
+ this.#searchTokens,
3135
+ query
3136
+ );
3059
3137
  if (match) {
3060
3138
  const listItem = this.#listItemByIso2.get(match.iso2);
3061
3139
  this.#highlightListItem(listItem);
@@ -3367,13 +3445,6 @@ var _factory = (() => {
3367
3445
  return a.name.localeCompare(b.name);
3368
3446
  });
3369
3447
  };
3370
- var cacheSearchTokens = (countries) => {
3371
- for (const c of countries) {
3372
- c.normalisedName = normaliseString(c.name);
3373
- c.initials = c.normalisedName.split(/[^a-z]/).map((word) => word[0]).join("");
3374
- c.dialCodePlus = `+${c.dialCode}`;
3375
- }
3376
- };
3377
3448
 
3378
3449
  // src/js/data/intl-regionless.ts
3379
3450
  var regionlessDialCodes = /* @__PURE__ */ new Set([
@@ -3459,54 +3530,6 @@ var _factory = (() => {
3459
3530
  return false;
3460
3531
  };
3461
3532
 
3462
- // src/js/core/numerals.ts
3463
- var Numerals = class {
3464
- #userNumeralSet;
3465
- constructor(initialValue) {
3466
- if (initialValue) {
3467
- this.#updateNumeralSet(initialValue);
3468
- }
3469
- }
3470
- // If any Arabic-Indic digits, then label it as that set. Same for Persian. Otherwise assume ASCII.
3471
- #updateNumeralSet(str) {
3472
- if (/[\u0660-\u0669]/.test(str)) {
3473
- this.#userNumeralSet = "arabic-indic";
3474
- } else if (/[\u06F0-\u06F9]/.test(str)) {
3475
- this.#userNumeralSet = "persian";
3476
- } else {
3477
- this.#userNumeralSet = "ascii";
3478
- }
3479
- }
3480
- // Denormalise ASCII 0-9 to the user's numeral set. If not yet known, return as-is.
3481
- // NOTE: normalise is always called before this, so it should be impossible for the numeral set to be unknown at this point.
3482
- denormalise(str) {
3483
- if (!this.#userNumeralSet || this.#userNumeralSet === "ascii") {
3484
- return str;
3485
- }
3486
- const base = this.#userNumeralSet === "arabic-indic" ? 1632 : 1776;
3487
- return str.replace(/[0-9]/g, (d) => String.fromCharCode(base + Number(d)));
3488
- }
3489
- // Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9
3490
- normalise(str) {
3491
- if (!str) {
3492
- return "";
3493
- }
3494
- this.#updateNumeralSet(str);
3495
- if (this.#userNumeralSet === "ascii") {
3496
- return str;
3497
- }
3498
- const base = this.#userNumeralSet === "arabic-indic" ? 1632 : 1776;
3499
- const regex = this.#userNumeralSet === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
3500
- return str.replace(
3501
- regex,
3502
- (ch) => String.fromCharCode(48 + (ch.charCodeAt(0) - base))
3503
- );
3504
- }
3505
- isAscii() {
3506
- return !this.#userNumeralSet || this.#userNumeralSet === "ascii";
3507
- }
3508
- };
3509
-
3510
3533
  // src/js/intlTelInput.ts
3511
3534
  var nextId = 0;
3512
3535
  var ensureUtils = (methodName) => {
@@ -3541,6 +3564,7 @@ var _factory = (() => {
3541
3564
  #dialCodeToIso2Map;
3542
3565
  #dialCodes;
3543
3566
  #countryByIso2;
3567
+ #searchTokens;
3544
3568
  #selectedCountry = null;
3545
3569
  #maxCoreNumberLength = null;
3546
3570
  #fallbackCountryIso2;
@@ -3597,7 +3621,7 @@ var _factory = (() => {
3597
3621
  #init() {
3598
3622
  this.#abortController = new AbortController();
3599
3623
  this.#processCountryData();
3600
- this.#ui.buildMarkup(this.#countries);
3624
+ this.#ui.buildMarkup(this.#countries, this.#searchTokens);
3601
3625
  this.#setInitialState();
3602
3626
  this.#initListeners();
3603
3627
  this.#startAsyncLoads();
@@ -3612,7 +3636,7 @@ var _factory = (() => {
3612
3636
  #processCountryData() {
3613
3637
  generateCountryNames(this.#countries, this.#options);
3614
3638
  sortCountries(this.#countries, this.#options);
3615
- cacheSearchTokens(this.#countries);
3639
+ this.#searchTokens = buildSearchTokens(this.#countries);
3616
3640
  }
3617
3641
  //* Set the initial state of the input value and the selected country by:
3618
3642
  //* 1. Extracting a dial code from the given number
@@ -3735,7 +3759,7 @@ var _factory = (() => {
3735
3759
  #bindAllTelInputListeners() {
3736
3760
  this.#bindInputListener();
3737
3761
  this.#bindKeydownListener();
3738
- this.#bindPasteListener();
3762
+ this.#bindStrictPasteListener();
3739
3763
  }
3740
3764
  //* Android workaround for handling plus when separateDialCode enabled (as impossible to handle with keydown/keyup, for which e.key always returns "Unidentified", see https://stackoverflow.com/q/59584061/217866)
3741
3765
  #handleAndroidPlusKey(inputValue) {
@@ -3903,15 +3927,16 @@ var _factory = (() => {
3903
3927
  e.preventDefault();
3904
3928
  }
3905
3929
  };
3906
- #bindPasteListener() {
3930
+ #bindStrictPasteListener() {
3907
3931
  if (!this.#options.strictMode) {
3908
3932
  return;
3909
3933
  }
3910
- this.#ui.telInputEl.addEventListener("paste", this.#handlePasteEvent, {
3934
+ this.#ui.telInputEl.addEventListener("paste", this.#handleStrictPasteEvent, {
3911
3935
  signal: this.#abortController.signal
3912
3936
  });
3913
3937
  }
3914
- #handlePasteEvent = (e) => {
3938
+ // Handle paste events when strictMode is enabled by sanitising the pasted content before it's inserted into the input, and rejecting it entirely if it would result in an invalid number
3939
+ #handleStrictPasteEvent = (e) => {
3915
3940
  e.preventDefault();
3916
3941
  const input = this.#ui.telInputEl;
3917
3942
  const selStart = input.selectionStart;
@@ -3930,6 +3955,15 @@ var _factory = (() => {
3930
3955
  const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
3931
3956
  let newValue = before + sanitised + after;
3932
3957
  let rejectReason = sanitised !== pasted ? "invalid" : null;
3958
+ if (newValue.length > 30) {
3959
+ this.#playStrictRejectAnimation();
3960
+ this.#dispatchEvent(EVENTS.STRICT_REJECT, {
3961
+ source: "paste",
3962
+ rejectedInput: pastedRaw,
3963
+ reason: "max-length"
3964
+ });
3965
+ return;
3966
+ }
3933
3967
  if (newValue.length > 5 && intlTelInput.utils) {
3934
3968
  let coreNumber = intlTelInput.utils.getCoreNumber(newValue, iso2);
3935
3969
  while (coreNumber.length === 0 && newValue.length > 0) {
@@ -4632,7 +4666,7 @@ var _factory = (() => {
4632
4666
  attachUtils,
4633
4667
  startedLoadingUtils: false,
4634
4668
  startedLoadingAutoCountry: false,
4635
- version: "27.3.0"
4669
+ version: "27.3.1"
4636
4670
  }
4637
4671
  );
4638
4672
  var intlTelInput_default = intlTelInput;