@rpcbase/ui 0.234.0 → 0.235.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/dist/components/FilesUploadField/index.d.ts.map +1 -1
  2. package/dist/index151.js +4 -4
  3. package/dist/index156.js +1 -1
  4. package/dist/index157.js +1 -1
  5. package/dist/index164.js +1 -1
  6. package/dist/index165.js +6 -6
  7. package/dist/index167.js +4 -4
  8. package/dist/index169.js +1 -1
  9. package/dist/index172.js +9 -9
  10. package/dist/index175.js +1 -1
  11. package/dist/index176.js +4 -4
  12. package/dist/index178.js +1 -1
  13. package/dist/index182.js +1 -1
  14. package/dist/index184.js +12 -12
  15. package/dist/index187.js +6 -6
  16. package/dist/index189.js +3 -3
  17. package/dist/index190.js +1 -1
  18. package/dist/index193.js +3 -3
  19. package/dist/index194.js +5 -5
  20. package/dist/index256.js +20 -14
  21. package/dist/index256.js.map +1 -1
  22. package/dist/index257.js +58 -146
  23. package/dist/index257.js.map +1 -1
  24. package/dist/index258.js +6 -30
  25. package/dist/index258.js.map +1 -1
  26. package/dist/index259.js +11 -9
  27. package/dist/index259.js.map +1 -1
  28. package/dist/index260.js +46 -44
  29. package/dist/index260.js.map +1 -1
  30. package/dist/index261.js +4 -12
  31. package/dist/index261.js.map +1 -1
  32. package/dist/index262.js +28 -43
  33. package/dist/index262.js.map +1 -1
  34. package/dist/index263.js +14 -93
  35. package/dist/index263.js.map +1 -1
  36. package/dist/index264.js +5 -86
  37. package/dist/index264.js.map +1 -1
  38. package/dist/index265.js +21 -105
  39. package/dist/index265.js.map +1 -1
  40. package/dist/index266.js +50 -51
  41. package/dist/index266.js.map +1 -1
  42. package/dist/index267.js +25 -11
  43. package/dist/index267.js.map +1 -1
  44. package/dist/index268.js +41 -37
  45. package/dist/index268.js.map +1 -1
  46. package/dist/index269.js +39 -8
  47. package/dist/index269.js.map +1 -1
  48. package/dist/index270.js +45 -117
  49. package/dist/index270.js.map +1 -1
  50. package/dist/index271.js +20 -17
  51. package/dist/index271.js.map +1 -1
  52. package/dist/index272.js +69 -14
  53. package/dist/index272.js.map +1 -1
  54. package/dist/index273.js +17 -3
  55. package/dist/index273.js.map +1 -1
  56. package/dist/index274.js +11 -36
  57. package/dist/index274.js.map +1 -1
  58. package/dist/index275.js +27 -20
  59. package/dist/index275.js.map +1 -1
  60. package/dist/index276.js +13 -9
  61. package/dist/index276.js.map +1 -1
  62. package/dist/index277.js +18 -8
  63. package/dist/index277.js.map +1 -1
  64. package/dist/index278.js +35 -18
  65. package/dist/index278.js.map +1 -1
  66. package/dist/index279.js +260 -26
  67. package/dist/index279.js.map +1 -1
  68. package/dist/index280.js +277 -15
  69. package/dist/index280.js.map +1 -1
  70. package/dist/index281.js +69 -20
  71. package/dist/index281.js.map +1 -1
  72. package/dist/index282.js +92 -59
  73. package/dist/index282.js.map +1 -1
  74. package/dist/index283.js +83 -6
  75. package/dist/index283.js.map +1 -1
  76. package/dist/index284.js +3 -11
  77. package/dist/index284.js.map +1 -1
  78. package/dist/index285.js +27 -48
  79. package/dist/index285.js.map +1 -1
  80. package/dist/index286.js +17 -4
  81. package/dist/index286.js.map +1 -1
  82. package/dist/index287.js +35 -30
  83. package/dist/index287.js.map +1 -1
  84. package/dist/index288.js +15 -15
  85. package/dist/index288.js.map +1 -1
  86. package/dist/index289.js +3 -5
  87. package/dist/index289.js.map +1 -1
  88. package/dist/index290.js +25 -20
  89. package/dist/index290.js.map +1 -1
  90. package/dist/index291.js +26 -49
  91. package/dist/index291.js.map +1 -1
  92. package/dist/index292.js +4 -26
  93. package/dist/index292.js.map +1 -1
  94. package/dist/index293.js +76 -39
  95. package/dist/index293.js.map +1 -1
  96. package/dist/index294.js +265 -35
  97. package/dist/index294.js.map +1 -1
  98. package/dist/index295.js +12 -45
  99. package/dist/index295.js.map +1 -1
  100. package/dist/index296.js +10 -20
  101. package/dist/index296.js.map +1 -1
  102. package/dist/index297.js +25 -70
  103. package/dist/index297.js.map +1 -1
  104. package/dist/index298.js +16 -17
  105. package/dist/index298.js.map +1 -1
  106. package/dist/index299.js +125 -11
  107. package/dist/index299.js.map +1 -1
  108. package/dist/index300.js +5 -27
  109. package/dist/index300.js.map +1 -1
  110. package/dist/index301.js +39 -12
  111. package/dist/index301.js.map +1 -1
  112. package/dist/index302.js +63 -16
  113. package/dist/index302.js.map +1 -1
  114. package/dist/index303.js +13 -36
  115. package/dist/index303.js.map +1 -1
  116. package/dist/index304.js +7 -262
  117. package/dist/index304.js.map +1 -1
  118. package/dist/index305.js +5 -278
  119. package/dist/index305.js.map +1 -1
  120. package/dist/index306.js +3 -68
  121. package/dist/index306.js.map +1 -1
  122. package/dist/index307.js +10 -99
  123. package/dist/index307.js.map +1 -1
  124. package/dist/index308.js +7 -83
  125. package/dist/index308.js.map +1 -1
  126. package/dist/index309.js +133 -3
  127. package/dist/index309.js.map +1 -1
  128. package/dist/index310.js +399 -29
  129. package/dist/index310.js.map +1 -1
  130. package/dist/index311.js +52 -16
  131. package/dist/index311.js.map +1 -1
  132. package/dist/index312.js +12 -35
  133. package/dist/index312.js.map +1 -1
  134. package/dist/index313.js +11 -16
  135. package/dist/index313.js.map +1 -1
  136. package/dist/index314.js +13 -3
  137. package/dist/index314.js.map +1 -1
  138. package/dist/index315.js +150 -22
  139. package/dist/index315.js.map +1 -1
  140. package/dist/index316.js +27 -25
  141. package/dist/index316.js.map +1 -1
  142. package/dist/index317.js +10 -4
  143. package/dist/index317.js.map +1 -1
  144. package/dist/index318.js +44 -74
  145. package/dist/index318.js.map +1 -1
  146. package/dist/index319.js +10 -268
  147. package/dist/index319.js.map +1 -1
  148. package/dist/index320.js +44 -11
  149. package/dist/index320.js.map +1 -1
  150. package/dist/index321.js +95 -10
  151. package/dist/index321.js.map +1 -1
  152. package/dist/index322.js +86 -25
  153. package/dist/index322.js.map +1 -1
  154. package/dist/index323.js +104 -15
  155. package/dist/index323.js.map +1 -1
  156. package/dist/index324.js +50 -123
  157. package/dist/index324.js.map +1 -1
  158. package/dist/index325.js +11 -5
  159. package/dist/index325.js.map +1 -1
  160. package/dist/index326.js +34 -37
  161. package/dist/index326.js.map +1 -1
  162. package/dist/index327.js +8 -65
  163. package/dist/index327.js.map +1 -1
  164. package/dist/index328.js +116 -13
  165. package/dist/index328.js.map +1 -1
  166. package/dist/index329.js +17 -7
  167. package/dist/index329.js.map +1 -1
  168. package/dist/index330.js +15 -5
  169. package/dist/index330.js.map +1 -1
  170. package/dist/index331.js +3 -3
  171. package/dist/index331.js.map +1 -1
  172. package/dist/index332.js +36 -10
  173. package/dist/index332.js.map +1 -1
  174. package/dist/index333.js +20 -7
  175. package/dist/index333.js.map +1 -1
  176. package/dist/index334.js +9 -133
  177. package/dist/index334.js.map +1 -1
  178. package/dist/index335.js +7 -398
  179. package/dist/index335.js.map +1 -1
  180. package/dist/index336.js +8 -52
  181. package/dist/index336.js.map +1 -1
  182. package/dist/index337.js +11 -11
  183. package/dist/index337.js.map +1 -1
  184. package/dist/index338.js +8 -11
  185. package/dist/index338.js.map +1 -1
  186. package/dist/index339.js +13 -8
  187. package/dist/index339.js.map +1 -1
  188. package/dist/index340.js +3 -11
  189. package/dist/index340.js.map +1 -1
  190. package/dist/index341.js +3 -8
  191. package/dist/index341.js.map +1 -1
  192. package/dist/index342.js +16 -12
  193. package/dist/index342.js.map +1 -1
  194. package/dist/index343.js +19 -3
  195. package/dist/index343.js.map +1 -1
  196. package/dist/index344.js +28 -3
  197. package/dist/index344.js.map +1 -1
  198. package/dist/index345.js +15 -16
  199. package/dist/index345.js.map +1 -1
  200. package/dist/index346.js +2 -2
  201. package/dist/index347.js +8 -8
  202. package/dist/index348.js +4 -4
  203. package/dist/index349.js +3 -3
  204. package/dist/index350.js +5 -5
  205. package/dist/index352.js +1 -1
  206. package/dist/index362.js +10 -19
  207. package/dist/index362.js.map +1 -1
  208. package/dist/index363.js +17 -4
  209. package/dist/index363.js.map +1 -1
  210. package/dist/index364.js +5 -11
  211. package/dist/index364.js.map +1 -1
  212. package/dist/index365.js +4 -17
  213. package/dist/index365.js.map +1 -1
  214. package/dist/index366.js +20 -5
  215. package/dist/index366.js.map +1 -1
  216. package/dist/index367.js +43 -19
  217. package/dist/index367.js.map +1 -1
  218. package/dist/index368.js +13 -40
  219. package/dist/index368.js.map +1 -1
  220. package/dist/index369.js +4 -17
  221. package/dist/index369.js.map +1 -1
  222. package/dist/index370.js +200 -4
  223. package/dist/index370.js.map +1 -1
  224. package/dist/index371.js +74 -197
  225. package/dist/index371.js.map +1 -1
  226. package/dist/index372.js +20 -77
  227. package/dist/index372.js.map +1 -1
  228. package/dist/index374.js +3 -3
  229. package/dist/index375.js +1 -1
  230. package/dist/index376.js +3 -3
  231. package/dist/index378.js +2 -2
  232. package/dist/index380.js +1 -1
  233. package/dist/index381.js +2 -2
  234. package/dist/index407.js +1 -1
  235. package/dist/index417.js +1 -1
  236. package/dist/index418.js +1 -1
  237. package/dist/index421.js +1 -1
  238. package/dist/index422.js +1 -1
  239. package/dist/index427.js +2 -2
  240. package/dist/index429.js +2 -2
  241. package/dist/index44.js +1 -1
  242. package/dist/index45.js +2 -2
  243. package/dist/index49.js +28 -28
  244. package/dist/index50.js +21 -21
  245. package/dist/index51.js +1 -1
  246. package/dist/index52.js +8 -8
  247. package/dist/index53.js +2 -2
  248. package/dist/index55.js +17 -17
  249. package/dist/index56.js +4 -4
  250. package/dist/index57.js +3 -3
  251. package/dist/index58.js +7 -7
  252. package/dist/index59.js +4 -4
  253. package/dist/index60.js +12 -12
  254. package/dist/index61.js +2 -2
  255. package/dist/index62.js +2 -2
  256. package/dist/index70.js +1 -1
  257. package/dist/index71.js +1 -1
  258. package/dist/index74.js +2 -6
  259. package/dist/index74.js.map +1 -1
  260. package/dist/index75.js +2 -8
  261. package/dist/index75.js.map +1 -1
  262. package/dist/index76.js +5 -5
  263. package/dist/index76.js.map +1 -1
  264. package/dist/index77.js +8 -2
  265. package/dist/index77.js.map +1 -1
  266. package/dist/index78.js +6 -2
  267. package/dist/index78.js.map +1 -1
  268. package/dist/index8.js +533 -698
  269. package/dist/index8.js.map +1 -1
  270. package/package.json +1 -1
package/dist/index258.js CHANGED
@@ -1,34 +1,10 @@
1
- import o from "./index164.js";
2
- import l from "./index256.js";
3
- function u(e, n, r) {
4
- if (n === void 0 && (n = {}), r = new o(r), n.v2) {
5
- if (!e.countryCallingCode)
6
- throw new Error("Invalid phone number object passed");
7
- r.selectNumberingPlan(e.countryCallingCode);
8
- } else {
9
- if (!e.phone)
10
- return !1;
11
- if (e.country) {
12
- if (!r.hasCountry(e.country))
13
- throw new Error("Unknown country: ".concat(e.country));
14
- r.selectNumberingPlan(e.country);
15
- } else {
16
- if (!e.countryCallingCode)
17
- throw new Error("Invalid phone number object passed");
18
- r.selectNumberingPlan(e.countryCallingCode);
19
- }
20
- }
21
- if (r.possibleLengths())
22
- return s(e.phone || e.nationalNumber, e.country, r);
23
- if (e.countryCallingCode && r.isNonGeographicCallingCode(e.countryCallingCode))
24
- return !0;
25
- throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
26
- }
27
- function s(e, n, r) {
28
- return l(e, n, r) === "IS_POSSIBLE";
1
+ import * as c from "react";
2
+ const e = {};
3
+ function f(r, n) {
4
+ const t = c.useRef(e);
5
+ return t.current === e && (t.current = r(n)), t;
29
6
  }
30
7
  export {
31
- u as default,
32
- s as isPossibleNumber
8
+ f as useRefWithInit
33
9
  };
34
10
  //# sourceMappingURL=index258.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index258.js","sources":["../../../node_modules/libphonenumber-js/es6/isPossible.js"],"sourcesContent":["import Metadata from './metadata.js';\nimport checkNumberLength from './helpers/checkNumberLength.js';\n\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\r\n *\r\n * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {object} [options]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\nexport default function isPossiblePhoneNumber(input, options, metadata) {\n /* istanbul ignore if */\n if (options === undefined) {\n options = {};\n }\n metadata = new Metadata(metadata);\n if (options.v2) {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n metadata.selectNumberingPlan(input.countryCallingCode);\n } else {\n if (!input.phone) {\n return false;\n }\n if (input.country) {\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n metadata.selectNumberingPlan(input.country);\n } else {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n metadata.selectNumberingPlan(input.countryCallingCode);\n }\n }\n\n // Old metadata (< 1.0.18) had no \"possible length\" data.\n if (metadata.possibleLengths()) {\n return isPossibleNumber(input.phone || input.nationalNumber, input.country, metadata);\n } else {\n // There was a bug between `1.7.35` and `1.7.37` where \"possible_lengths\"\n // were missing for \"non-geographical\" numbering plans.\n // Just assume the number is possible in such cases:\n // it's unlikely that anyone generated their custom metadata\n // in that short period of time (one day).\n // This code can be removed in some future major version update.\n if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {\n // \"Non-geographic entities\" did't have `possibleLengths`\n // due to a bug in metadata generation process.\n return true;\n } else {\n throw new Error('Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.');\n }\n }\n}\nexport function isPossibleNumber(nationalNumber, country, metadata) {\n //, isInternational) {\n switch (checkNumberLength(nationalNumber, country, metadata)) {\n case 'IS_POSSIBLE':\n return true;\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // \treturn !isInternational\n default:\n return false;\n }\n}\n//# sourceMappingURL=isPossible.js.map"],"names":["isPossiblePhoneNumber","input","options","metadata","Metadata","isPossibleNumber","nationalNumber","country","checkNumberLength"],"mappings":";;AAgBe,SAASA,EAAsBC,GAAOC,GAASC,GAAU;AAMtE,MAJID,MAAY,WACdA,IAAU,CAAA,IAEZC,IAAW,IAAIC,EAASD,CAAQ,GAC5BD,EAAQ,IAAI;AACd,QAAI,CAACD,EAAM;AACT,YAAM,IAAI,MAAM,oCAAoC;AAEtD,IAAAE,EAAS,oBAAoBF,EAAM,kBAAkB;AAAA,EACvD,OAAO;AACL,QAAI,CAACA,EAAM;AACT,aAAO;AAET,QAAIA,EAAM,SAAS;AACjB,UAAI,CAACE,EAAS,WAAWF,EAAM,OAAO;AACpC,cAAM,IAAI,MAAM,oBAAoB,OAAOA,EAAM,OAAO,CAAC;AAE3D,MAAAE,EAAS,oBAAoBF,EAAM,OAAO;AAAA,IAC5C,OAAO;AACL,UAAI,CAACA,EAAM;AACT,cAAM,IAAI,MAAM,oCAAoC;AAEtD,MAAAE,EAAS,oBAAoBF,EAAM,kBAAkB;AAAA,IACvD;AAAA,EACF;AAGA,MAAIE,EAAS;AACX,WAAOE,EAAiBJ,EAAM,SAASA,EAAM,gBAAgBA,EAAM,SAASE,CAAQ;AAQpF,MAAIF,EAAM,sBAAsBE,EAAS,2BAA2BF,EAAM,kBAAkB;AAG1F,WAAO;AAEP,QAAM,IAAI,MAAM,gGAAgG;AAGtH;AACO,SAASI,EAAiBC,GAAgBC,GAASJ,GAAU;AAElE,SAAQK,EAAkBF,GAAgBC,GAASJ,CAAQ,MACpD;AAST;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index258.js","sources":["../../../node_modules/@base-ui/utils/esm/useRefWithInit.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nconst UNINITIALIZED = {};\n\n/**\n * A React.useRef() that is initialized with a function. Note that it accepts an optional\n * initialization argument, so the initialization function doesn't need to be an inline closure.\n *\n * @usage\n * const ref = useRefWithInit(sortColumns, columns)\n */\n\nexport function useRefWithInit(init, initArg) {\n const ref = React.useRef(UNINITIALIZED);\n if (ref.current === UNINITIALIZED) {\n ref.current = init(initArg);\n }\n return ref;\n}"],"names":["UNINITIALIZED","useRefWithInit","init","initArg","ref","React"],"mappings":";AAGA,MAAMA,IAAgB,CAAA;AAUf,SAASC,EAAeC,GAAMC,GAAS;AAC5C,QAAMC,IAAMC,EAAM,OAAOL,CAAa;AACtC,SAAII,EAAI,YAAYJ,MAClBI,EAAI,UAAUF,EAAKC,CAAO,IAErBC;AACT;","x_google_ignoreList":[0]}
package/dist/index259.js CHANGED
@@ -1,13 +1,15 @@
1
- import m from "./index164.js";
2
- import o from "./index273.js";
3
- import u from "./index260.js";
4
- function b(e, n, r) {
5
- if (n = n || {}, r = new m(r), r.selectNumberingPlan(e.country, e.countryCallingCode), r.hasTypes())
6
- return u(e, n, r.metadata) !== void 0;
7
- var l = n.v2 ? e.nationalNumber : e.phone;
8
- return o(l, r.nationalNumberPattern());
1
+ import * as u from "react";
2
+ function s(r) {
3
+ const [t, e] = u.useState({
4
+ current: r,
5
+ previous: null
6
+ });
7
+ return r !== t.current && e({
8
+ current: r,
9
+ previous: t.current
10
+ }), t.previous;
9
11
  }
10
12
  export {
11
- b as default
13
+ s as usePreviousValue
12
14
  };
13
15
  //# sourceMappingURL=index259.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index259.js","sources":["../../../node_modules/libphonenumber-js/es6/isValid.js"],"sourcesContent":["import Metadata from './metadata.js';\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport getNumberType from './helpers/getNumberType.js';\n\n/**\r\n * Checks if a given phone number is valid.\r\n *\r\n * isValid(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * If the `number` is a string, it will be parsed to an object,\r\n * but only if it contains only valid phone number characters (including punctuation).\r\n * If the `number` is an object, it is used as is.\r\n *\r\n * The optional `defaultCountry` argument is the default country.\r\n * I.e. it does not restrict to just that country,\r\n * e.g. in those cases where several countries share\r\n * the same phone numbering rules (NANPA, Britain, etc).\r\n * For example, even though the number `07624 369230`\r\n * belongs to the Isle of Man (\"IM\" country code)\r\n * calling `isValidNumber('07624369230', 'GB', metadata)`\r\n * still returns `true` because the country is not restricted to `GB`,\r\n * it's just that `GB` is the default one for the phone numbering rules.\r\n * For restricting the country see `isValidNumberForRegion()`\r\n * though restricting a country might not be a good idea.\r\n * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\r\n *\r\n * Examples:\r\n *\r\n * ```js\r\n * isValidNumber('+78005553535', metadata)\r\n * isValidNumber('8005553535', 'RU', metadata)\r\n * isValidNumber('88005553535', 'RU', metadata)\r\n * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)\r\n * ```\r\n */\nexport default function isValidNumber(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(input.country, input.countryCallingCode);\n\n // By default, countries only have type regexps when it's required for\n // distinguishing different countries having the same `countryCallingCode`.\n if (metadata.hasTypes()) {\n return getNumberType(input, options, metadata.metadata) !== undefined;\n }\n\n // If there are no type regexps for this country in metadata then use\n // `nationalNumberPattern` as a \"better than nothing\" replacement.\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone;\n return matchesEntirely(nationalNumber, metadata.nationalNumberPattern());\n}\n//# sourceMappingURL=isValid.js.map"],"names":["isValidNumber","input","options","metadata","Metadata","getNumberType","nationalNumber","matchesEntirely"],"mappings":";;;AAsCe,SAASA,EAAcC,GAAOC,GAASC,GAAU;AAS9D,MANAD,IAAUA,KAAW,CAAA,GACrBC,IAAW,IAAIC,EAASD,CAAQ,GAChCA,EAAS,oBAAoBF,EAAM,SAASA,EAAM,kBAAkB,GAIhEE,EAAS;AACX,WAAOE,EAAcJ,GAAOC,GAASC,EAAS,QAAQ,MAAM;AAK9D,MAAIG,IAAiBJ,EAAQ,KAAKD,EAAM,iBAAiBA,EAAM;AAC/D,SAAOM,EAAgBD,GAAgBH,EAAS,sBAAqB,CAAE;AACzE;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index259.js","sources":["../../../node_modules/@base-ui/utils/esm/usePreviousValue.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\n/**\n * Returns a previous value of its argument.\n * @param value Current value.\n * @returns Previous value, or null if there is no previous value.\n */\nexport function usePreviousValue(value) {\n const [state, setState] = React.useState({\n current: value,\n previous: null\n });\n if (value !== state.current) {\n setState({\n current: value,\n previous: state.current\n });\n }\n return state.previous;\n}"],"names":["usePreviousValue","value","state","setState","React"],"mappings":";AASO,SAASA,EAAiBC,GAAO;AACtC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAM,SAAS;AAAA,IACvC,SAASH;AAAA,IACT,UAAU;AAAA,EACd,CAAG;AACD,SAAIA,MAAUC,EAAM,WAClBC,EAAS;AAAA,IACP,SAASF;AAAA,IACT,UAAUC,EAAM;AAAA,EACtB,CAAK,GAEIA,EAAM;AACf;","x_google_ignoreList":[0]}
package/dist/index260.js CHANGED
@@ -1,52 +1,54 @@
1
- import a from "./index164.js";
2
- import f from "./index273.js";
3
- function I(e, n) {
4
- var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
5
- if (r) return (r = r.call(e)).next.bind(r);
6
- if (Array.isArray(e) || (r = y(e)) || n) {
7
- r && (e = r);
8
- var t = 0;
9
- return function() {
10
- return t >= e.length ? { done: !0 } : { done: !1, value: e[t++] };
11
- };
1
+ import * as r from "react";
2
+ import { error as l } from "./index355.js";
3
+ function _({
4
+ controlled: n,
5
+ default: o,
6
+ name: t,
7
+ state: s = "value"
8
+ }) {
9
+ const {
10
+ current: i
11
+ } = r.useRef(n !== void 0), [f, e] = r.useState(o), c = i ? n : f;
12
+ if (process.env.NODE_ENV !== "production") {
13
+ r.useEffect(() => {
14
+ i !== (n !== void 0) && l([`A component is changing the ${i ? "" : "un"}controlled ${s} state of ${t} to be ${i ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${t} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
15
+ `));
16
+ }, [s, t, n]);
17
+ const {
18
+ current: u
19
+ } = r.useRef(o);
20
+ r.useEffect(() => {
21
+ !i && d(u) !== d(o) && l([`A component is changing the default ${s} state of an uncontrolled ${t} after being initialized. To suppress this warning opt to use a controlled ${t}.`].join(`
22
+ `));
23
+ }, [o]);
12
24
  }
13
- throw new TypeError(`Invalid attempt to iterate non-iterable instance.
14
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
25
+ const a = r.useCallback((u) => {
26
+ i || e(u);
27
+ }, []);
28
+ return [c, a];
15
29
  }
16
- function y(e, n) {
17
- if (e) {
18
- if (typeof e == "string") return l(e, n);
19
- var r = {}.toString.call(e).slice(8, -1);
20
- return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? l(e, n) : void 0;
21
- }
22
- }
23
- function l(e, n) {
24
- (n == null || n > e.length) && (n = e.length);
25
- for (var r = 0, t = Array(n); r < n; r++) t[r] = e[r];
26
- return t;
27
- }
28
- var c = ["MOBILE", "PREMIUM_RATE", "TOLL_FREE", "SHARED_COST", "VOIP", "PERSONAL_NUMBER", "PAGER", "UAN", "VOICEMAIL"];
29
- function O(e, n, r) {
30
- if (n = n || {}, !(!e.country && !e.countryCallingCode)) {
31
- r = new a(r), r.selectNumberingPlan(e.country, e.countryCallingCode);
32
- var t = n.v2 ? e.nationalNumber : e.phone;
33
- if (f(t, r.nationalNumberPattern())) {
34
- if (o(t, "FIXED_LINE", r))
35
- return r.type("MOBILE") && r.type("MOBILE").pattern() === "" || !r.type("MOBILE") || o(t, "MOBILE", r) ? "FIXED_LINE_OR_MOBILE" : "FIXED_LINE";
36
- for (var E = I(c), i; !(i = E()).done; ) {
37
- var u = i.value;
38
- if (o(t, u, r))
39
- return u;
30
+ function d(n) {
31
+ let o = 0;
32
+ const t = /* @__PURE__ */ new WeakMap();
33
+ try {
34
+ return JSON.stringify(n, function(f, e) {
35
+ if (!(f === "_owner" && this != null && typeof this == "object" && "$$typeof" in this)) {
36
+ if (typeof e == "bigint")
37
+ return `__bigint__:${e}`;
38
+ if (e !== null && typeof e == "object") {
39
+ const c = t.get(e);
40
+ if (c !== void 0)
41
+ return `__object__:${c}`;
42
+ t.set(e, o), o += 1;
43
+ }
44
+ return e;
40
45
  }
41
- }
46
+ }) ?? `__top__:${typeof n}`;
47
+ } catch {
48
+ return "__unserializable__";
42
49
  }
43
50
  }
44
- function o(e, n, r) {
45
- var t = r.type(n);
46
- return !t || !t.pattern() || t.possibleLengths() && t.possibleLengths().indexOf(e.length) < 0 ? !1 : f(e, t.pattern());
47
- }
48
51
  export {
49
- O as default,
50
- o as isNumberTypeEqualTo
52
+ _ as useControlled
51
53
  };
52
54
  //# sourceMappingURL=index260.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index260.js","sources":["../../../node_modules/libphonenumber-js/es6/helpers/getNumberType.js"],"sourcesContent":["function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport Metadata from '../metadata.js';\nimport matchesEntirely from './matchesEntirely.js';\nvar NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL'];\n\n// Finds out national phone number type (fixed line, mobile, etc)\nexport default function getNumberType(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n\n // When `parse()` returns an empty object — `{}` —\n // that means that the phone number is malformed,\n // so it can't possibly be valid.\n if (!input.country && !input.countryCallingCode) {\n return;\n }\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(input.country, input.countryCallingCode);\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone;\n\n // The following is copy-pasted from the original function:\n // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835\n\n // Is this national number even valid for this country\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {\n return;\n }\n\n // Is it fixed line number\n if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) {\n // Because duplicate regular expressions are removed\n // to reduce metadata size, if \"mobile\" pattern is \"\"\n // then it means it was removed due to being a duplicate of the fixed-line pattern.\n //\n if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {\n return 'FIXED_LINE_OR_MOBILE';\n }\n\n // `MOBILE` type pattern isn't included if it matched `FIXED_LINE` one.\n // For example, for \"US\" country.\n // Old metadata (< `1.0.18`) had a specific \"types\" data structure\n // that happened to be `undefined` for `MOBILE` in that case.\n // Newer metadata (>= `1.0.18`) has another data structure that is\n // not `undefined` for `MOBILE` in that case (it's just an empty array).\n // So this `if` is just for backwards compatibility with old metadata.\n if (!metadata.type('MOBILE')) {\n return 'FIXED_LINE_OR_MOBILE';\n }\n\n // Check if the number happens to qualify as both fixed line and mobile.\n // (no such country in the minimal metadata set)\n /* istanbul ignore if */\n if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) {\n return 'FIXED_LINE_OR_MOBILE';\n }\n return 'FIXED_LINE';\n }\n for (var _iterator = _createForOfIteratorHelperLoose(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) {\n var type = _step.value;\n if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {\n return type;\n }\n }\n}\nexport function isNumberTypeEqualTo(nationalNumber, type, metadata) {\n var typeDefinition = metadata.type(type);\n if (!typeDefinition || !typeDefinition.pattern()) {\n return false;\n }\n\n // Check if any possible number lengths are present;\n // if so, we use them to avoid checking\n // the validation pattern if they don't match.\n // If they are absent, this means they match\n // the general description, which we have\n // already checked before a specific number type.\n if (typeDefinition.possibleLengths() && typeDefinition.possibleLengths().indexOf(nationalNumber.length) < 0) {\n return false;\n }\n return matchesEntirely(nationalNumber, typeDefinition.pattern());\n}\n//# sourceMappingURL=getNumberType.js.map"],"names":["_createForOfIteratorHelperLoose","r","e","t","_unsupportedIterableToArray","o","a","_arrayLikeToArray","n","NON_FIXED_LINE_PHONE_TYPES","getNumberType","input","options","metadata","Metadata","nationalNumber","matchesEntirely","isNumberTypeEqualTo","_iterator","_step","type","typeDefinition"],"mappings":";;AAAA,SAASA,EAAgCC,GAAGC,GAAG;AAAE,MAAIC,IAAmB,OAAO,SAAtB,OAAgCF,EAAE,OAAO,QAAQ,KAAKA,EAAE,YAAY;AAAG,MAAIE,EAAG,S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,EAASD,CAAQ,GAChCA,EAAS,oBAAoBF,EAAM,SAASA,EAAM,kBAAkB;AACpE,QAAII,IAAiBH,EAAQ,KAAKD,EAAM,iBAAiBA,EAAM;AAM/D,QAAKK,EAAgBD,GAAgBF,EAAS,sBAAqB,CAAE,GAKrE;AAAA,UAAII,EAAoBF,GAAgB,cAAcF,CAAQ;AAuB5D,eAlBIA,EAAS,KAAK,QAAQ,KAAKA,EAAS,KAAK,QAAQ,EAAE,QAAO,MAAO,MAWjE,CAACA,EAAS,KAAK,QAAQ,KAOvBI,EAAoBF,GAAgB,UAAUF,CAAQ,IACjD,yBAEF;AAET,eAASK,IAAYlB,EAAgCS,CAA0B,GAAGU,GAAO,EAAEA,IAAQD,EAAS,GAAI,QAAO;AACrH,YAAIE,IAAOD,EAAM;AACjB,YAAIF,EAAoBF,GAAgBK,GAAMP,CAAQ;AACpD,iBAAOO;AAAA,MAEX;AAAA;AAAA;AACF;AACO,SAASH,EAAoBF,GAAgBK,GAAMP,GAAU;AAClE,MAAIQ,IAAiBR,EAAS,KAAKO,CAAI;AAWvC,SAVI,CAACC,KAAkB,CAACA,EAAe,QAAO,KAU1CA,EAAe,gBAAe,KAAMA,EAAe,kBAAkB,QAAQN,EAAe,MAAM,IAAI,IACjG,KAEFC,EAAgBD,GAAgBM,EAAe,QAAO,CAAE;AACjE;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index260.js","sources":["../../../node_modules/@base-ui/utils/esm/useControlled.js"],"sourcesContent":["'use client';\n\n// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes, dependency arrays are intentionally ignored\n/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */\nimport * as React from 'react';\nimport { error } from \"./error.js\";\nexport function useControlled({\n controlled,\n default: defaultProp,\n name,\n state = 'value'\n}) {\n // isControlled is ignored in the hook dependency lists as it should never change.\n const {\n current: isControlled\n } = React.useRef(controlled !== undefined);\n const [valueState, setValue] = React.useState(defaultProp);\n const value = isControlled ? controlled : valueState;\n if (process.env.NODE_ENV !== 'production') {\n React.useEffect(() => {\n if (isControlled !== (controlled !== undefined)) {\n error([`A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', \"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.\", 'More info: https://fb.me/react-controlled-components'].join('\\n'));\n }\n }, [state, name, controlled]);\n const {\n current: defaultValue\n } = React.useRef(defaultProp);\n React.useEffect(() => {\n if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {\n error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\\n'));\n }\n }, [defaultProp]);\n }\n const setValueIfUncontrolled = React.useCallback(newValue => {\n if (!isControlled) {\n setValue(newValue);\n }\n }, []);\n return [value, setValueIfUncontrolled];\n}\nfunction serializeToDevModeString(input) {\n let nextId = 0;\n const seen = new WeakMap();\n try {\n const result = JSON.stringify(input, function replacer(key, value) {\n if (key === '_owner' && this != null && typeof this === 'object' && '$$typeof' in this) {\n return undefined;\n }\n if (typeof value === 'bigint') {\n return `__bigint__:${value}`;\n }\n if (value !== null && typeof value === 'object') {\n const id = seen.get(value);\n if (id !== undefined) {\n return `__object__:${id}`;\n }\n seen.set(value, nextId);\n nextId += 1;\n }\n return value;\n });\n return result ?? `__top__:${typeof input}`;\n } catch {\n return '__unserializable__';\n }\n}"],"names":["useControlled","controlled","defaultProp","name","state","isControlled","React","valueState","setValue","value","error","defaultValue","serializeToDevModeString","setValueIfUncontrolled","newValue","input","nextId","seen","key","id"],"mappings":";;AAMO,SAASA,EAAc;AAAA,EAC5B,YAAAC;AAAA,EACA,SAASC;AAAA,EACT,MAAAC;AAAA,EACA,OAAAC,IAAQ;AACV,GAAG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AE5B,YAAIA,MAAU,QAAQ,OAAOA,KAAU,UAAU;AAC/C,gBAAMU,IAAKF,EAAK,IAAIR,CAAK;AACzB,cAAIU,MAAO;AACT,mBAAO,cAAcA,CAAE;AAEzB,UAAAF,EAAK,IAAIR,GAAOO,CAAM,GACtBA,KAAU;AAAA,QACZ;AACA,eAAOP;AAAA;AAAA,IACT,CAAC,KACgB,WAAW,OAAOM,CAAK;AAAA,EAC1C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","x_google_ignoreList":[0]}
package/dist/index261.js CHANGED
@@ -1,15 +1,7 @@
1
- import u from "./index164.js";
2
- function s(r, t, e) {
3
- var n = new u(e), o = n.getCountryCodesForCallingCode(r);
4
- return o ? o.filter(function(a) {
5
- return i(t, a, e);
6
- }) : [];
7
- }
8
- function i(r, t, e) {
9
- var n = new u(e);
10
- return n.selectNumberingPlan(t), n.numberingPlan.possibleLengths().indexOf(r.length) >= 0;
11
- }
1
+ import * as o from "react";
2
+ const t = () => {
3
+ }, e = typeof document < "u" ? o.useLayoutEffect : t;
12
4
  export {
13
- s as default
5
+ e as useIsoLayoutEffect
14
6
  };
15
7
  //# sourceMappingURL=index261.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index261.js","sources":["../../../node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js"],"sourcesContent":["import Metadata from '../metadata.js';\n\n/**\r\n * Returns a list of countries that the phone number could potentially belong to.\r\n * @param {string} callingCode — Calling code.\r\n * @param {string} nationalNumber — National (significant) number.\r\n * @param {object} metadata — Metadata.\r\n * @return {string[]} A list of possible countries.\r\n */\nexport default function getPossibleCountriesForNumber(callingCode, nationalNumber, metadata) {\n var _metadata = new Metadata(metadata);\n var possibleCountries = _metadata.getCountryCodesForCallingCode(callingCode);\n if (!possibleCountries) {\n return [];\n }\n return possibleCountries.filter(function (country) {\n return couldNationalNumberBelongToCountry(nationalNumber, country, metadata);\n });\n}\nfunction couldNationalNumberBelongToCountry(nationalNumber, country, metadata) {\n var _metadata = new Metadata(metadata);\n _metadata.selectNumberingPlan(country);\n if (_metadata.numberingPlan.possibleLengths().indexOf(nationalNumber.length) >= 0) {\n return true;\n }\n return false;\n}\n//# sourceMappingURL=getPossibleCountriesForNumber.js.map"],"names":["getPossibleCountriesForNumber","callingCode","nationalNumber","metadata","_metadata","Metadata","possibleCountries","country","couldNationalNumberBelongToCountry"],"mappings":";AASe,SAASA,EAA8BC,GAAaC,GAAgBC,GAAU;AAC3F,MAAIC,IAAY,IAAIC,EAASF,CAAQ,GACjCG,IAAoBF,EAAU,8BAA8BH,CAAW;AAC3E,SAAKK,IAGEA,EAAkB,OAAO,SAAUC,GAAS;AACjD,WAAOC,EAAmCN,GAAgBK,GAASJ,CAAQ;AAAA,EAC7E,CAAC,IAJQ,CAAA;AAKX;AACA,SAASK,EAAmCN,GAAgBK,GAASJ,GAAU;AAC7E,MAAIC,IAAY,IAAIC,EAASF,CAAQ;AAErC,SADAC,EAAU,oBAAoBG,CAAO,GACjCH,EAAU,cAAc,gBAAe,EAAG,QAAQF,EAAe,MAAM,KAAK;AAIlF;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index261.js","sources":["../../../node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nconst noop = () => {};\nexport const useIsoLayoutEffect = typeof document !== 'undefined' ? React.useLayoutEffect : noop;"],"names":["noop","useIsoLayoutEffect","React"],"mappings":";AAGA,MAAMA,IAAO,MAAM;AAAC,GACPC,IAAqB,OAAO,WAAa,MAAcC,EAAM,kBAAkBF;","x_google_ignoreList":[0]}
package/dist/index262.js CHANGED
@@ -1,48 +1,33 @@
1
- import t from "./index280.js";
2
- import I from "./index278.js";
3
- import R from "./index164.js";
4
- import { MAX_LENGTH_COUNTRY_CODE as S } from "./index160.js";
5
- function O(r, e, f, _, i) {
6
- if (!r)
7
- return {};
8
- var n;
9
- if (r[0] !== "+") {
10
- var l = t(r, e || f, _, i);
11
- if (l && l !== r)
12
- n = !0, r = "+" + l;
13
- else {
14
- if (e || f || _) {
15
- var s = I(r, e, f, _, i), M = s.countryCallingCode, c = s.number;
16
- if (M)
17
- return {
18
- countryCallingCodeSource: "FROM_NUMBER_WITHOUT_PLUS_SIGN",
19
- countryCallingCode: M,
20
- number: c
21
- };
22
- }
23
- return {
24
- // No need to set it to `UNSPECIFIED`. It can be just `undefined`.
25
- // countryCallingCodeSource: 'UNSPECIFIED',
26
- number: r
27
- };
1
+ import * as a from "react";
2
+ import { useRefWithInit as c } from "./index258.js";
3
+ const n = a[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)], r = (
4
+ // React 17 doesn't have useInsertionEffect.
5
+ n && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
6
+ n !== a.useLayoutEffect ? n : (e) => e()
7
+ );
8
+ function f(e) {
9
+ const t = c(o).current;
10
+ return t.next = e, r(t.effect), t.trampoline;
11
+ }
12
+ function o() {
13
+ const e = {
14
+ next: void 0,
15
+ callback: l,
16
+ trampoline: (...t) => e.callback?.(...t),
17
+ effect: () => {
18
+ e.callback = e.next;
28
19
  }
29
- }
30
- if (r[1] === "0")
31
- return {};
32
- i = new R(i);
33
- for (var o = 2; o - 1 <= S && o <= r.length; ) {
34
- var N = r.slice(1, o);
35
- if (i.hasCallingCode(N))
36
- return i.selectNumberingPlan(N), {
37
- countryCallingCodeSource: n ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
38
- countryCallingCode: N,
39
- number: r.slice(o)
40
- };
41
- o++;
42
- }
43
- return {};
20
+ };
21
+ return e;
22
+ }
23
+ function l() {
24
+ if (process.env.NODE_ENV !== "production")
25
+ throw (
26
+ /* minify-error-disabled */
27
+ new Error("Base UI: Cannot call an event handler while rendering.")
28
+ );
44
29
  }
45
30
  export {
46
- O as default
31
+ f as useStableCallback
47
32
  };
48
33
  //# sourceMappingURL=index262.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index262.js","sources":["../../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js"],"sourcesContent":["import stripIddPrefix from './stripIddPrefix.js';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js';\nimport Metadata from '../metadata.js';\nimport { MAX_LENGTH_COUNTRY_CODE } from '../constants.js';\n\n/**\r\n * Converts a phone number digits (possibly with a `+`)\r\n * into a calling code and the rest phone number digits.\r\n * The \"rest phone number digits\" could include\r\n * a national prefix, carrier code, and national\r\n * (significant) number.\r\n * @param {string} number — Phone number digits (possibly with a `+`).\r\n * @param {string} [country] — Country.\r\n * @param {string} [defaultCountry] — Default country.\r\n * @param {string} [defaultCallingCode] — Default calling code (some phone numbering plans are non-geographic).\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }`\r\n * @example\r\n * // Returns `{ countryCallingCode: \"1\", number: \"2133734253\" }`.\r\n * extractCountryCallingCode('2133734253', null, 'US', null, metadata)\r\n * extractCountryCallingCode('2133734253', null, null, '1', metadata)\r\n * extractCountryCallingCode('+12133734253', null, null, null, metadata)\r\n * extractCountryCallingCode('+12133734253', null, 'RU', null, metadata)\r\n */\nexport default function extractCountryCallingCode(number, country, defaultCountry, defaultCallingCode, metadata) {\n if (!number) {\n return {};\n }\n var isNumberWithIddPrefix;\n\n // If this is not an international phone number,\n // then either extract an \"IDD\" prefix, or extract a\n // country calling code from a number by autocorrecting it\n // by prepending a leading `+` in cases when it starts\n // with the country calling code.\n // https://wikitravel.org/en/International_dialling_prefix\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (number[0] !== '+') {\n // Convert an \"out-of-country\" dialing phone number\n // to a proper international phone number.\n var numberWithoutIDD = stripIddPrefix(number, country || defaultCountry, defaultCallingCode, metadata);\n // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n if (numberWithoutIDD && numberWithoutIDD !== number) {\n isNumberWithIddPrefix = true;\n number = '+' + numberWithoutIDD;\n } else {\n // Check to see if the number starts with the country calling code\n // for the default country. If so, we remove the country calling code,\n // and do some checks on the validity of the number before and after.\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (country || defaultCountry || defaultCallingCode) {\n var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n shorterNumber = _extractCountryCallin.number;\n if (countryCallingCode) {\n return {\n countryCallingCodeSource: 'FROM_NUMBER_WITHOUT_PLUS_SIGN',\n countryCallingCode: countryCallingCode,\n number: shorterNumber\n };\n }\n }\n return {\n // No need to set it to `UNSPECIFIED`. It can be just `undefined`.\n // countryCallingCodeSource: 'UNSPECIFIED',\n number: number\n };\n }\n }\n\n // `number` can only be international at this point.\n\n // Fast abortion: country codes do not begin with a '0'\n if (number[1] === '0') {\n return {};\n }\n metadata = new Metadata(metadata);\n\n // The thing with country phone codes\n // is that they are orthogonal to each other\n // i.e. there's no such country phone code A\n // for which country phone code B exists\n // where B starts with A.\n // Therefore, while scanning digits,\n // if a valid country code is found,\n // that means that it is the country code.\n //\n var i = 2;\n while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {\n var _countryCallingCode = number.slice(1, i);\n if (metadata.hasCallingCode(_countryCallingCode)) {\n metadata.selectNumberingPlan(_countryCallingCode);\n return {\n countryCallingCodeSource: isNumberWithIddPrefix ? 'FROM_NUMBER_WITH_IDD' : 'FROM_NUMBER_WITH_PLUS_SIGN',\n countryCallingCode: _countryCallingCode,\n number: number.slice(i)\n };\n }\n i++;\n }\n return {};\n}\n\n// The possible values for the returned `countryCallingCodeSource` are:\n//\n// Copy-pasted from:\n// https://github.com/google/libphonenumber/blob/master/resources/phonenumber.proto\n//\n// // The source from which the country_code is derived. This is not set in the\n// // general parsing method, but in the method that parses and keeps raw_input.\n// // New fields could be added upon request.\n// enum CountryCodeSource {\n// // Default value returned if this is not set, because the phone number was\n// // created using parse, not parseAndKeepRawInput. hasCountryCodeSource will\n// // return false if this is the case.\n// UNSPECIFIED = 0;\n//\n// // The country_code is derived based on a phone number with a leading \"+\",\n// // e.g. the French number \"+33 1 42 68 53 00\".\n// FROM_NUMBER_WITH_PLUS_SIGN = 1;\n//\n// // The country_code is derived based on a phone number with a leading IDD,\n// // e.g. the French number \"011 33 1 42 68 53 00\", as it is dialled from US.\n// FROM_NUMBER_WITH_IDD = 5;\n//\n// // The country_code is derived based on a phone number without a leading\n// // \"+\", e.g. the French number \"33 1 42 68 53 00\" when defaultCountry is\n// // supplied as France.\n// FROM_NUMBER_WITHOUT_PLUS_SIGN = 10;\n//\n// // The country_code is derived NOT based on the phone number itself, but\n// // from the defaultCountry parameter provided in the parsing function by the\n// // clients. This happens mostly for numbers written in the national format\n// // (without country code). For example, this would be set when parsing the\n// // French number \"01 42 68 53 00\", when defaultCountry is supplied as\n// // France.\n// FROM_DEFAULT_COUNTRY = 20;\n// }\n//# sourceMappingURL=extractCountryCallingCode.js.map"],"names":["extractCountryCallingCode","number","country","defaultCountry","defaultCallingCode","metadata","isNumberWithIddPrefix","numberWithoutIDD","stripIddPrefix","_extractCountryCallin","extractCountryCallingCodeFromInternationalNumberWithoutPlusSign","countryCallingCode","shorterNumber","Metadata","i","MAX_LENGTH_COUNTRY_CODE","_countryCallingCode"],"mappings":";;;;AAwBe,SAASA,EAA0BC,GAAQC,GAASC,GAAgBC,GAAoBC,GAAU;AAC/G,MAAI,CAACJ;AACH,WAAO,CAAA;AAET,MAAIK;AASJ,MAAIL,EAAO,CAAC,MAAM,KAAK;AAGrB,QAAIM,IAAmBC,EAAeP,GAAQC,KAAWC,GAAgBC,GAAoBC,CAAQ;AAIrG,QAAIE,KAAoBA,MAAqBN;AAC3C,MAAAK,IAAwB,IACxBL,IAAS,MAAMM;AAAA,SACV;AAKL,UAAIL,KAAWC,KAAkBC,GAAoB;AACnD,YAAIK,IAAwBC,EAAgET,GAAQC,GAASC,GAAgBC,GAAoBC,CAAQ,GACvJM,IAAqBF,EAAsB,oBAC3CG,IAAgBH,EAAsB;AACxC,YAAIE;AACF,iBAAO;AAAA,YACL,0BAA0B;AAAA,YAC1B,oBAAoBA;AAAA,YACpB,QAAQC;AAAA,UACpB;AAAA,MAEM;AACA,aAAO;AAAA;AAAA;AAAA,QAGL,QAAQX;AAAA,MAChB;AAAA,IACI;AAAA,EACF;AAKA,MAAIA,EAAO,CAAC,MAAM;AAChB,WAAO,CAAA;AAET,EAAAI,IAAW,IAAIQ,EAASR,CAAQ;AAYhC,WADIS,IAAI,GACDA,IAAI,KAAKC,KAA2BD,KAAKb,EAAO,UAAQ;AAC7D,QAAIe,IAAsBf,EAAO,MAAM,GAAGa,CAAC;AAC3C,QAAIT,EAAS,eAAeW,CAAmB;AAC7C,aAAAX,EAAS,oBAAoBW,CAAmB,GACzC;AAAA,QACL,0BAA0BV,IAAwB,yBAAyB;AAAA,QAC3E,oBAAoBU;AAAA,QACpB,QAAQf,EAAO,MAAMa,CAAC;AAAA,MAC9B;AAEI,IAAAA;AAAA,EACF;AACA,SAAO,CAAA;AACT;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index262.js","sources":["../../../node_modules/@base-ui/utils/esm/useStableCallback.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useRefWithInit } from \"./useRefWithInit.js\";\n\n// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379\nconst useInsertionEffect = React[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)];\nconst useSafeInsertionEffect =\n// React 17 doesn't have useInsertionEffect.\nuseInsertionEffect &&\n// Preact replaces useInsertionEffect with useLayoutEffect and fires too late.\nuseInsertionEffect !== React.useLayoutEffect ? useInsertionEffect : fn => fn();\n/**\n * Stabilizes the function passed so it's always the same between renders.\n *\n * The function becomes non-reactive to any values it captures.\n * It can safely be passed as a dependency of `React.useMemo` and `React.useEffect` without re-triggering them if its captured values change.\n *\n * The function must only be called inside effects and event handlers, never during render (which throws an error).\n *\n * This hook is a more permissive version of React 19.2's `React.useEffectEvent` in that it can be passed through contexts and called in event handler props, not just effects.\n */\nexport function useStableCallback(callback) {\n const stable = useRefWithInit(createStableCallback).current;\n stable.next = callback;\n useSafeInsertionEffect(stable.effect);\n return stable.trampoline;\n}\nfunction createStableCallback() {\n const stable = {\n next: undefined,\n callback: assertNotCalled,\n trampoline: (...args) => stable.callback?.(...args),\n effect: () => {\n stable.callback = stable.next;\n }\n };\n return stable;\n}\nfunction assertNotCalled() {\n if (process.env.NODE_ENV !== 'production') {\n throw /* minify-error-disabled */new Error('Base UI: Cannot call an event handler while rendering.');\n }\n}"],"names":["useInsertionEffect","React","useSafeInsertionEffect","fn","useStableCallback","callback","stable","useRefWithInit","createStableCallback","assertNotCalled","args"],"mappings":";;AAMA,MAAMA,IAAqBC,EAAM,qBAAqB,KAAK,OAAM,EAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,GAAG,EAAE,CAAC,GACvFC;AAAA;AAAA,EAENF;AAAA,EAEAA,MAAuBC,EAAM,kBAAkBD,IAAqB,CAAAG,MAAMA,EAAE;AAAA;AAWrE,SAASC,EAAkBC,GAAU;AAC1C,QAAMC,IAASC,EAAeC,CAAoB,EAAE;AACpD,SAAAF,EAAO,OAAOD,GACdH,EAAuBI,EAAO,MAAM,GAC7BA,EAAO;AAChB;AACA,SAASE,IAAuB;AAC9B,QAAMF,IAAS;AAAA,IACb,MAAM;AAAA,IACN,UAAUG;AAAA,IACV,YAAY,IAAIC,MAASJ,EAAO,WAAW,GAAGI,CAAI;AAAA,IAClD,QAAQ,MAAM;AACZ,MAAAJ,EAAO,WAAWA,EAAO;AAAA,IAC3B;AAAA,EACJ;AACE,SAAOA;AACT;AACA,SAASG,IAAkB;AACzB,MAAI,QAAQ,IAAI,aAAa;AAC3B;AAAA;AAAA,MAAiC,IAAI,MAAM,wDAAwD;AAAA;AAEvG;","x_google_ignoreList":[0]}
package/dist/index263.js CHANGED
@@ -1,99 +1,20 @@
1
- import N from "./index273.js";
2
- import g from "./index159.js";
3
- import m, { getCountryCallingCode as s } from "./index164.js";
4
- import h from "./index276.js";
5
- import { formatRFC3966 as I } from "./index269.js";
6
- var l = {
7
- formatExtension: function(t, r, e) {
8
- return "".concat(t).concat(e.ext()).concat(r);
9
- }
10
- };
11
- function O(n, t, r, e) {
12
- if (r ? r = E({}, l, r) : r = l, e = new m(e), n.country && n.country !== "001") {
13
- if (!e.hasCountry(n.country))
14
- throw new Error("Unknown country: ".concat(n.country));
15
- e.selectNumberingPlan(n.country);
16
- } else if (n.countryCallingCode)
17
- e.selectNumberingPlan(n.countryCallingCode);
18
- else return n.phone || "";
19
- var o = e.countryCallingCode(), a = r.v2 ? n.nationalNumber : n.phone, c;
20
- switch (t) {
21
- case "NATIONAL":
22
- return a ? (c = f(a, n.carrierCode, "NATIONAL", e, r), u(c, n.ext, e, r.formatExtension)) : "";
23
- case "INTERNATIONAL":
24
- return a ? (c = f(a, null, "INTERNATIONAL", e, r), c = "+".concat(o, " ").concat(c), u(c, n.ext, e, r.formatExtension)) : "+".concat(o);
25
- case "E.164":
26
- return "+".concat(o).concat(a);
27
- case "RFC3966":
28
- return I({
29
- number: "+".concat(o).concat(a),
30
- ext: n.ext
31
- });
32
- // For reference, here's Google's IDD formatter:
33
- // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546
34
- // Not saying that this IDD formatter replicates it 1:1, but it seems to work.
35
- // Who would even need to format phone numbers in IDD format anyway?
36
- case "IDD":
37
- if (!r.fromCountry)
38
- return;
39
- var i = A(a, n.carrierCode, o, r.fromCountry, e);
40
- return i ? u(i, n.ext, e, r.formatExtension) : void 0;
41
- default:
42
- throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t, '"'));
43
- }
44
- }
45
- function f(n, t, r, e, o) {
46
- var a = x(e.formats(), n);
47
- return a ? g(n, a, {
48
- useInternationalFormat: r === "INTERNATIONAL",
49
- withNationalPrefix: !(a.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && o && o.nationalPrefix === !1),
50
- carrierCode: t,
51
- metadata: e
52
- }) : n;
1
+ import { useIsoLayoutEffect as r } from "./index261.js";
2
+ import { useRefWithInit as n } from "./index258.js";
3
+ function s(e) {
4
+ const t = n(f, e).current;
5
+ return t.next = e, r(t.effect), t;
53
6
  }
54
- function x(n, t) {
55
- return v(n, function(r) {
56
- if (r.leadingDigitsPatterns().length > 0) {
57
- var e = r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length - 1];
58
- if (t.search(e) !== 0)
59
- return !1;
7
+ function f(e) {
8
+ const t = {
9
+ current: e,
10
+ next: e,
11
+ effect: () => {
12
+ t.current = t.next;
60
13
  }
61
- return N(t, r.pattern());
62
- });
63
- }
64
- function u(n, t, r, e) {
65
- return t ? e(n, t, r) : n;
66
- }
67
- function A(n, t, r, e, o) {
68
- var a = s(e, o.metadata);
69
- if (a === r) {
70
- var c = f(n, t, "NATIONAL", o);
71
- return r === "1" ? r + " " + c : c;
72
- }
73
- var i = h(e, void 0, o.metadata);
74
- if (i)
75
- return "".concat(i, " ").concat(r, " ").concat(f(n, null, "INTERNATIONAL", o));
76
- }
77
- function E() {
78
- for (var n = 1, t = arguments.length, r = new Array(t), e = 0; e < t; e++)
79
- r[e] = arguments[e];
80
- for (; n < r.length; ) {
81
- if (r[n])
82
- for (var o in r[n])
83
- r[0][o] = r[n][o];
84
- n++;
85
- }
86
- return r[0];
87
- }
88
- function v(n, t) {
89
- for (var r = 0; r < n.length; ) {
90
- if (t(n[r]))
91
- return n[r];
92
- r++;
93
- }
14
+ };
15
+ return t;
94
16
  }
95
17
  export {
96
- x as chooseFormatForNumber,
97
- O as default
18
+ s as useValueAsRef
98
19
  };
99
20
  //# sourceMappingURL=index263.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index263.js","sources":["../../../node_modules/libphonenumber-js/es6/format.js"],"sourcesContent":["// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\n\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport formatNationalNumberUsingFormat from './helpers/formatNationalNumberUsingFormat.js';\nimport Metadata, { getCountryCallingCode } from './metadata.js';\nimport getIddPrefix from './helpers/getIddPrefix.js';\nimport { formatRFC3966 } from './helpers/RFC3966.js';\nvar DEFAULT_OPTIONS = {\n formatExtension: function formatExtension(formattedNumber, extension, metadata) {\n return \"\".concat(formattedNumber).concat(metadata.ext()).concat(extension);\n }\n};\n\n/**\r\n * Formats a phone number.\r\n *\r\n * format(phoneNumberInstance, 'INTERNATIONAL', { ..., v2: true }, metadata)\r\n * format(phoneNumberInstance, 'NATIONAL', { ..., v2: true }, metadata)\r\n *\r\n * format({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', { ... }, metadata)\r\n * format({ phone: '8005553535', country: 'RU' }, 'NATIONAL', undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {string} format\r\n * @param {object} [options]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\nexport default function formatNumber(input, format, options, metadata) {\n // Apply default options.\n if (options) {\n // Using ES6 \"rest spread\" syntax here didn't work with `babel`/`istanbul`\n // for some weird reason: this line of code would cause the code coverage\n // to show as not 100%. That's because `babel`/`istanbul`, for some weird reason,\n // apparently doesn't know how to properly exclude Babel polyfills from code coverage.\n //\n // options = { ...DEFAULT_OPTIONS, ...options }\n //\n options = merge({}, DEFAULT_OPTIONS, options);\n } else {\n options = DEFAULT_OPTIONS;\n }\n metadata = new Metadata(metadata);\n\n // Normally, the `input` object is supposed to be a `PhoneNumber` class instance.\n // Also, according to the `PhoneNumber` class source code, `country` can't be \"001\".\n // It means that normally `input.country` or `input.countryCallingCode` is supposed\n // to be present because either of the two is always required to exist in a `PhoneNumber` instance.\n // This means that realistically, it's gonna step into either the first `if`\n // or the following `else if`, and normally it won't even reach the legacy-compatibility\n // `else return input.phone || ''` part.\n // So normally, it won't ever return an empty string here.\n if (input.country && input.country !== '001') {\n // Validate `input.country`.\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n metadata.selectNumberingPlan(input.country);\n } else if (input.countryCallingCode) {\n metadata.selectNumberingPlan(input.countryCallingCode);\n } else return input.phone || '';\n var countryCallingCode = metadata.countryCallingCode();\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone;\n\n // This variable should have been declared inside `case`s\n // but Babel has a bug and it says \"duplicate variable declaration\".\n var number;\n switch (format) {\n case 'NATIONAL':\n // Normally, the `input` object is supposed to be a `PhoneNumber` class instance,\n // and a `PhoneNumber` class instance is always required to have a `nationalNumber`.\n // This means that the `if (!nationalNumber)` below is just for legacy-compatibility\n // and it normally can't really happen, so normally it won't ever return an empty string here.\n if (!nationalNumber) {\n return '';\n }\n number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n case 'INTERNATIONAL':\n // Legacy argument support.\n // (`{ country: ..., phone: '' }`)\n if (!nationalNumber) {\n return \"+\".concat(countryCallingCode);\n }\n number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options);\n number = \"+\".concat(countryCallingCode, \" \").concat(number);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n case 'E.164':\n // `E.164` doesn't define \"phone number extensions\".\n return \"+\".concat(countryCallingCode).concat(nationalNumber);\n case 'RFC3966':\n return formatRFC3966({\n number: \"+\".concat(countryCallingCode).concat(nationalNumber),\n ext: input.ext\n });\n\n // For reference, here's Google's IDD formatter:\n // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546\n // Not saying that this IDD formatter replicates it 1:1, but it seems to work.\n // Who would even need to format phone numbers in IDD format anyway?\n case 'IDD':\n // If the required `fromCountry` parameter is not passed, it will return `undefined`.\n if (!options.fromCountry) {\n return;\n // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')\n }\n var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);\n // If the country of the phone number doesn't support IDD calling, it will return `undefined`.\n if (!formattedNumber) {\n return;\n }\n return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);\n default:\n throw new Error(\"Unknown \\\"format\\\" argument passed to \\\"formatNumber()\\\": \\\"\".concat(format, \"\\\"\"));\n }\n}\nfunction formatNationalNumber(number, carrierCode, formatAs, metadata, options) {\n var format = chooseFormatForNumber(metadata.formats(), number);\n if (!format) {\n return number;\n }\n return formatNationalNumberUsingFormat(number, format, {\n useInternationalFormat: formatAs === 'INTERNATIONAL',\n withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,\n carrierCode: carrierCode,\n metadata: metadata\n });\n}\nexport function chooseFormatForNumber(availableFormats, nationalNumber) {\n // Using a `for ... of` loop here didn't work with `babel`/`istanbul`:\n // for some weird reason, it showed code coverage less than 100%.\n // That's because `babel`/`istanbul`, for some weird reason,\n // apparently doesn't know how to properly exclude Babel polyfills from code coverage.\n //\n // for (const format of availableFormats) { ... }\n //\n return pickFirstMatchingElement(availableFormats, function (format) {\n // Validate leading digits.\n // The test case for \"else path\" could be found by searching for\n // \"format.leadingDigitsPatterns().length === 0\".\n if (format.leadingDigitsPatterns().length > 0) {\n // The last leading_digits_pattern is used here, as it is the most detailed\n var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1];\n // If leading digits don't match then move on to the next phone number format\n if (nationalNumber.search(lastLeadingDigitsPattern) !== 0) {\n return false;\n }\n }\n // Check that the national number matches the phone number format regular expression\n return matchesEntirely(nationalNumber, format.pattern());\n });\n}\nfunction addExtension(formattedNumber, ext, metadata, formatExtension) {\n return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;\n}\nfunction formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {\n var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata);\n // When calling within the same country calling code.\n if (fromCountryCallingCode === countryCallingCode) {\n var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata);\n // For NANPA regions, return the national format for these regions\n // but prefix it with the country calling code.\n if (countryCallingCode === '1') {\n return countryCallingCode + ' ' + formattedNumber;\n }\n // If regions share a country calling code, the country calling code need\n // not be dialled. This also applies when dialling within a region, so this\n // if clause covers both these cases. Technically this is the case for\n // dialling from La Reunion to other overseas departments of France (French\n // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover\n // this edge case for now and for those cases return the version including\n // country calling code. Details here:\n // http://www.petitfute.com/voyage/225-info-pratiques-reunion\n //\n return formattedNumber;\n }\n var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata);\n if (iddPrefix) {\n return \"\".concat(iddPrefix, \" \").concat(countryCallingCode, \" \").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata));\n }\n}\nfunction merge() {\n var i = 1;\n for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {\n objects[_key] = arguments[_key];\n }\n while (i < objects.length) {\n if (objects[i]) {\n for (var key in objects[i]) {\n objects[0][key] = objects[i][key];\n }\n }\n i++;\n }\n return objects[0];\n}\nfunction pickFirstMatchingElement(elements, testFunction) {\n var i = 0;\n while (i < elements.length) {\n if (testFunction(elements[i])) {\n return elements[i];\n }\n i++;\n }\n}\n//# sourceMappingURL=format.js.map"],"names":["DEFAULT_OPTIONS","formattedNumber","extension","metadata","formatNumber","input","format","options","merge","Metadata","countryCallingCode","nationalNumber","number","formatNationalNumber","addExtension","formatRFC3966","formatIDD","carrierCode","formatAs","chooseFormatForNumber","formatNationalNumberUsingFormat","availableFormats","pickFirstMatchingElement","lastLeadingDigitsPattern","matchesEntirely","ext","formatExtension","fromCountry","fromCountryCallingCode","getCountryCallingCode","iddPrefix","getIddPrefix","i","_len","objects","_key","key","elements","testFunction"],"mappings":";;;;;AAUA,IAAIA,IAAkB;AAAA,EACpB,iBAAiB,SAAyBC,GAAiBC,GAAWC,GAAU;AAC9E,WAAO,GAAG,OAAOF,CAAe,EAAE,OAAOE,EAAS,IAAG,CAAE,EAAE,OAAOD,CAAS;AAAA,EAC3E;AACF;AAiBe,SAASE,EAAaC,GAAOC,GAAQC,GAASJ,GAAU;AAwBrE,MAtBII,IAQFA,IAAUC,EAAM,IAAIR,GAAiBO,CAAO,IAE5CA,IAAUP,GAEZG,IAAW,IAAIM,EAASN,CAAQ,GAU5BE,EAAM,WAAWA,EAAM,YAAY,OAAO;AAE5C,QAAI,CAACF,EAAS,WAAWE,EAAM,OAAO;AACpC,YAAM,IAAI,MAAM,oBAAoB,OAAOA,EAAM,OAAO,CAAC;AAE3D,IAAAF,EAAS,oBAAoBE,EAAM,OAAO;AAAA,EAC5C,WAAWA,EAAM;AACf,IAAAF,EAAS,oBAAoBE,EAAM,kBAAkB;AAAA,MAChD,QAAOA,EAAM,SAAS;AAC7B,MAAIK,IAAqBP,EAAS,mBAAkB,GAChDQ,IAAiBJ,EAAQ,KAAKF,EAAM,iBAAiBA,EAAM,OAI3DO;AACJ,UAAQN,GAAM;AAAA,IACZ,KAAK;AAKH,aAAKK,KAGLC,IAASC,EAAqBF,GAAgBN,EAAM,aAAa,YAAYF,GAAUI,CAAO,GACvFO,EAAaF,GAAQP,EAAM,KAAKF,GAAUI,EAAQ,eAAe,KAH/D;AAAA,IAIX,KAAK;AAGH,aAAKI,KAGLC,IAASC,EAAqBF,GAAgB,MAAM,iBAAiBR,GAAUI,CAAO,GACtFK,IAAS,IAAI,OAAOF,GAAoB,GAAG,EAAE,OAAOE,CAAM,GACnDE,E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modules/@base-ui/utils/esm/useValueAsRef.js"],"sourcesContent":["'use client';\n\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.js\";\nimport { useRefWithInit } from \"./useRefWithInit.js\";\n\n/**\n * Untracks the provided value by turning it into a ref to remove its reactivity.\n *\n * Used to access the passed value inside `React.useEffect` without causing the effect to re-run when the value changes.\n */\nexport function useValueAsRef(value) {\n const latest = useRefWithInit(createLatestRef, value).current;\n latest.next = value;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useIsoLayoutEffect(latest.effect);\n return latest;\n}\nfunction createLatestRef(value) {\n const latest = {\n current: value,\n next: value,\n effect: () => {\n latest.current = latest.next;\n }\n };\n return latest;\n}"],"names":["useValueAsRef","value","latest","useRefWithInit","createLatestRef","useIsoLayoutEffect"],"mappings":";;AAUO,SAASA,EAAcC,GAAO;AACnC,QAAMC,IAASC,EAAeC,GAAiBH,CAAK,EAAE;AACtD,SAAAC,EAAO,OAAOD,GAGdI,EAAmBH,EAAO,MAAM,GACzBA;AACT;AACA,SAASE,EAAgBH,GAAO;AAC9B,QAAMC,IAAS;AAAA,IACb,SAASD;AAAA,IACT,MAAMA;AAAA,IACN,QAAQ,MAAM;AACZ,MAAAC,EAAO,UAAUA,EAAO;AAAA,IAC1B;AAAA,EACJ;AACE,SAAOA;AACT;","x_google_ignoreList":[0]}