solve-engine 1.0.0-beta.2 → 1.0.0-beta.4

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 (171) hide show
  1. package/dist/{Lexer-D9l4Yrk2.d.ts → Lexer-Cfm79Dak.d.cts} +18 -2
  2. package/dist/{Lexer-BJdhlnej.d.cts → Lexer-W9MBOP0V.d.ts} +18 -2
  3. package/dist/{PackageRegistry-DaH4aIKP.d.ts → PackageRegistry-CjDt-Jy_.d.ts} +60 -4
  4. package/dist/{PackageRegistry-D-Tv_7ca.d.cts → PackageRegistry-pHtKythi.d.cts} +60 -4
  5. package/dist/{Parselet-CK8cQu2a.d.cts → Parselet-Cu0bLSis.d.cts} +1 -1
  6. package/dist/{Parselet-ConOIdRO.d.ts → Parselet-DEdF9I7n.d.ts} +1 -1
  7. package/dist/{Token-0jpvUdPY.d.cts → Token-BzG5G4ja.d.cts} +44 -0
  8. package/dist/{Token-0jpvUdPY.d.ts → Token-BzG5G4ja.d.ts} +44 -0
  9. package/dist/TokenNormalizer-DGVa24Q-.d.cts +377 -0
  10. package/dist/TokenNormalizer-t_GotBxr.d.ts +377 -0
  11. package/dist/{chunk-HWSZJQCI.js → chunk-2CS6OMZK.js} +37 -15
  12. package/dist/chunk-2CS6OMZK.js.map +1 -0
  13. package/dist/{chunk-XJCMXB2E.cjs → chunk-2MV4HBKC.cjs} +187 -61
  14. package/dist/chunk-2MV4HBKC.cjs.map +1 -0
  15. package/dist/{chunk-J73SJHR3.cjs → chunk-2NPS5DQ3.cjs} +558 -341
  16. package/dist/chunk-2NPS5DQ3.cjs.map +1 -0
  17. package/dist/{chunk-QWY3VEZN.js → chunk-3MNKQZ77.js} +65 -12
  18. package/dist/chunk-3MNKQZ77.js.map +1 -0
  19. package/dist/{chunk-RZCWSXTA.cjs → chunk-43G3JT2E.cjs} +1491 -218
  20. package/dist/chunk-43G3JT2E.cjs.map +1 -0
  21. package/dist/{chunk-WQTTOGXC.cjs → chunk-4AVD7NZW.cjs} +4 -4
  22. package/dist/{chunk-WQTTOGXC.cjs.map → chunk-4AVD7NZW.cjs.map} +1 -1
  23. package/dist/{chunk-HTXVVJRA.cjs → chunk-4CVLFLOB.cjs} +112 -2
  24. package/dist/chunk-4CVLFLOB.cjs.map +1 -0
  25. package/dist/{chunk-5YEMOYSE.js → chunk-6GCKCWLB.js} +9 -3
  26. package/dist/chunk-6GCKCWLB.js.map +1 -0
  27. package/dist/{chunk-EBSPLUW4.cjs → chunk-AHCLWAM5.cjs} +28 -10
  28. package/dist/chunk-AHCLWAM5.cjs.map +1 -0
  29. package/dist/{chunk-KVILKGMS.js → chunk-AJA6LUI7.js} +36 -2
  30. package/dist/chunk-AJA6LUI7.js.map +1 -0
  31. package/dist/{chunk-EHAHVROS.cjs → chunk-CLVQBF5C.cjs} +5 -5
  32. package/dist/{chunk-EHAHVROS.cjs.map → chunk-CLVQBF5C.cjs.map} +1 -1
  33. package/dist/{chunk-34RRD7PC.js → chunk-CYFK5SY2.js} +111 -3
  34. package/dist/chunk-CYFK5SY2.js.map +1 -0
  35. package/dist/{chunk-M5LX5AOO.js → chunk-DDQVZGLO.js} +25 -12
  36. package/dist/chunk-DDQVZGLO.js.map +1 -0
  37. package/dist/{chunk-LR7YASZF.cjs → chunk-EAAHVJ4P.cjs} +3 -3
  38. package/dist/chunk-EAAHVJ4P.cjs.map +1 -0
  39. package/dist/{chunk-3PPFLFH4.js → chunk-FIFQPKBA.js} +1417 -144
  40. package/dist/chunk-FIFQPKBA.js.map +1 -0
  41. package/dist/{chunk-RIN643A3.js → chunk-GPPLSM2Z.js} +61 -2
  42. package/dist/chunk-GPPLSM2Z.js.map +1 -0
  43. package/dist/{chunk-4QADQTWS.js → chunk-KHJUSHFU.js} +231 -14
  44. package/dist/chunk-KHJUSHFU.js.map +1 -0
  45. package/dist/{chunk-NMD5VRN4.cjs → chunk-M4F66R4O.cjs} +74 -73
  46. package/dist/chunk-M4F66R4O.cjs.map +1 -0
  47. package/dist/{chunk-6NTVRDQV.cjs → chunk-M4Q47KHF.cjs} +126 -73
  48. package/dist/chunk-M4Q47KHF.cjs.map +1 -0
  49. package/dist/{chunk-LIPPNDBE.js → chunk-M5E34VG5.js} +3 -3
  50. package/dist/{chunk-LIPPNDBE.js.map → chunk-M5E34VG5.js.map} +1 -1
  51. package/dist/{chunk-53B6KDDJ.cjs → chunk-MBNQVDVC.cjs} +38 -3
  52. package/dist/{chunk-53B6KDDJ.cjs.map → chunk-MBNQVDVC.cjs.map} +1 -1
  53. package/dist/{chunk-SDGRK7EP.js → chunk-MEOHSQEH.js} +6 -5
  54. package/dist/chunk-MEOHSQEH.js.map +1 -0
  55. package/dist/{chunk-NMCRQP3Z.cjs → chunk-MTX2KVU7.cjs} +71 -70
  56. package/dist/chunk-MTX2KVU7.cjs.map +1 -0
  57. package/dist/{chunk-QNJ4ACRT.cjs → chunk-NJTXJ5AG.cjs} +37 -15
  58. package/dist/chunk-NJTXJ5AG.cjs.map +1 -0
  59. package/dist/{chunk-C4XZV6E7.cjs → chunk-NZFKROS7.cjs} +26 -20
  60. package/dist/chunk-NZFKROS7.cjs.map +1 -0
  61. package/dist/{chunk-64W6GLLZ.js → chunk-OFXOTECC.js} +24 -6
  62. package/dist/chunk-OFXOTECC.js.map +1 -0
  63. package/dist/{chunk-3YNVWKR2.cjs → chunk-OUHT5Z36.cjs} +28 -5
  64. package/dist/chunk-OUHT5Z36.cjs.map +1 -0
  65. package/dist/{chunk-EIGTWK5N.js → chunk-OWRHDUJD.js} +3 -3
  66. package/dist/chunk-OWRHDUJD.js.map +1 -0
  67. package/dist/{chunk-4MG4XKO2.js → chunk-PCPX42KL.js} +38 -3
  68. package/dist/{chunk-4MG4XKO2.js.map → chunk-PCPX42KL.js.map} +1 -1
  69. package/dist/{chunk-GW32KPCU.cjs → chunk-R24DI24X.cjs} +61 -2
  70. package/dist/chunk-R24DI24X.cjs.map +1 -0
  71. package/dist/{chunk-XVWCOTR6.js → chunk-SFQWJMKT.js} +7 -6
  72. package/dist/chunk-SFQWJMKT.js.map +1 -0
  73. package/dist/{chunk-6BKTCEUP.cjs → chunk-TY3TLZAW.cjs} +36 -2
  74. package/dist/chunk-TY3TLZAW.cjs.map +1 -0
  75. package/dist/{chunk-DM3LMRBC.js → chunk-UKPGSAZW.js} +187 -61
  76. package/dist/chunk-UKPGSAZW.js.map +1 -0
  77. package/dist/{chunk-NH2O2AUR.js → chunk-WC5FFSHB.js} +26 -4
  78. package/dist/chunk-WC5FFSHB.js.map +1 -0
  79. package/dist/{chunk-CLL7RUQV.cjs → chunk-WWOLFXTX.cjs} +40 -18
  80. package/dist/chunk-WWOLFXTX.cjs.map +1 -0
  81. package/dist/{chunk-JBSYC7BB.cjs → chunk-X2BWAZAU.cjs} +66 -53
  82. package/dist/chunk-X2BWAZAU.cjs.map +1 -0
  83. package/dist/{chunk-GOLDJNMZ.js → chunk-XBTEO4OB.js} +28 -5
  84. package/dist/chunk-XBTEO4OB.js.map +1 -0
  85. package/dist/{chunk-EPOXXJBK.js → chunk-YU2CUNFO.js} +3 -3
  86. package/dist/{chunk-EPOXXJBK.js.map → chunk-YU2CUNFO.js.map} +1 -1
  87. package/dist/constants.cjs +4 -4
  88. package/dist/constants.js +1 -1
  89. package/dist/engine.cjs +29 -30
  90. package/dist/engine.d.cts +6 -6
  91. package/dist/engine.d.ts +6 -6
  92. package/dist/engine.js +19 -20
  93. package/dist/format.cjs +7 -8
  94. package/dist/format.cjs.map +1 -1
  95. package/dist/format.js +2 -3
  96. package/dist/format.js.map +1 -1
  97. package/dist/index.cjs +28 -29
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.d.cts +6 -6
  100. package/dist/index.d.ts +6 -6
  101. package/dist/index.js +20 -21
  102. package/dist/index.js.map +1 -1
  103. package/dist/language.cjs +74 -12
  104. package/dist/language.cjs.map +1 -1
  105. package/dist/language.d.cts +6 -6
  106. package/dist/language.d.ts +6 -6
  107. package/dist/language.js +68 -6
  108. package/dist/language.js.map +1 -1
  109. package/dist/lexer.cjs +19 -19
  110. package/dist/lexer.d.cts +3 -3
  111. package/dist/lexer.d.ts +3 -3
  112. package/dist/lexer.js +7 -7
  113. package/dist/normalizer.cjs +12 -12
  114. package/dist/normalizer.d.cts +4 -210
  115. package/dist/normalizer.d.ts +4 -210
  116. package/dist/normalizer.js +6 -6
  117. package/dist/packages.cjs +36 -37
  118. package/dist/packages.d.cts +5 -47
  119. package/dist/packages.d.ts +5 -47
  120. package/dist/packages.js +13 -14
  121. package/dist/parser.cjs +12 -12
  122. package/dist/parser.d.cts +3 -2
  123. package/dist/parser.d.ts +3 -2
  124. package/dist/parser.js +4 -4
  125. package/dist/resolvers.d.cts +1 -1
  126. package/dist/resolvers.d.ts +1 -1
  127. package/dist/uom.cjs +14 -14
  128. package/dist/uom.d.cts +12 -4
  129. package/dist/uom.d.ts +12 -4
  130. package/dist/uom.js +4 -4
  131. package/dist/vm.cjs +17 -17
  132. package/dist/vm.js +6 -6
  133. package/package.json +2 -1
  134. package/dist/NormalizerRule-BrVoVjmP.d.cts +0 -163
  135. package/dist/NormalizerRule-CEjf1FyD.d.ts +0 -163
  136. package/dist/chunk-34RRD7PC.js.map +0 -1
  137. package/dist/chunk-3PPFLFH4.js.map +0 -1
  138. package/dist/chunk-3YNVWKR2.cjs.map +0 -1
  139. package/dist/chunk-4QADQTWS.js.map +0 -1
  140. package/dist/chunk-5YEMOYSE.js.map +0 -1
  141. package/dist/chunk-64W6GLLZ.js.map +0 -1
  142. package/dist/chunk-6BKTCEUP.cjs.map +0 -1
  143. package/dist/chunk-6NTVRDQV.cjs.map +0 -1
  144. package/dist/chunk-C4XZV6E7.cjs.map +0 -1
  145. package/dist/chunk-CLL7RUQV.cjs.map +0 -1
  146. package/dist/chunk-DM3LMRBC.js.map +0 -1
  147. package/dist/chunk-EBSPLUW4.cjs.map +0 -1
  148. package/dist/chunk-EIGTWK5N.js.map +0 -1
  149. package/dist/chunk-GOLDJNMZ.js.map +0 -1
  150. package/dist/chunk-GW32KPCU.cjs.map +0 -1
  151. package/dist/chunk-HTXVVJRA.cjs.map +0 -1
  152. package/dist/chunk-HWSZJQCI.js.map +0 -1
  153. package/dist/chunk-J73SJHR3.cjs.map +0 -1
  154. package/dist/chunk-JBSYC7BB.cjs.map +0 -1
  155. package/dist/chunk-KVILKGMS.js.map +0 -1
  156. package/dist/chunk-LR7YASZF.cjs.map +0 -1
  157. package/dist/chunk-M5LX5AOO.js.map +0 -1
  158. package/dist/chunk-NH2O2AUR.js.map +0 -1
  159. package/dist/chunk-NMCRQP3Z.cjs.map +0 -1
  160. package/dist/chunk-NMD5VRN4.cjs.map +0 -1
  161. package/dist/chunk-OT6OJY7C.cjs +0 -114
  162. package/dist/chunk-OT6OJY7C.cjs.map +0 -1
  163. package/dist/chunk-QNJ4ACRT.cjs.map +0 -1
  164. package/dist/chunk-QWY3VEZN.js.map +0 -1
  165. package/dist/chunk-RFYD5TJE.js +0 -111
  166. package/dist/chunk-RFYD5TJE.js.map +0 -1
  167. package/dist/chunk-RIN643A3.js.map +0 -1
  168. package/dist/chunk-RZCWSXTA.cjs.map +0 -1
  169. package/dist/chunk-SDGRK7EP.js.map +0 -1
  170. package/dist/chunk-XJCMXB2E.cjs.map +0 -1
  171. package/dist/chunk-XVWCOTR6.js.map +0 -1
@@ -1,114 +0,0 @@
1
- 'use strict';
2
-
3
- // src/uom/CurrencyAliases.ts
4
- var CURRENCY_SYMBOL_ALIASES = {
5
- "$": "USD",
6
- "\xA3": "GBP",
7
- "\u20AC": "EUR",
8
- // ¥ is genuinely ambiguous between JPY and CNY in real-world usage, JPY
9
- // is the conventional default (matches Numi/most calculator apps' own
10
- // choice); a user wanting CNY specifically can still type "CNY" directly.
11
- "\xA5": "JPY",
12
- "\u20BD": "RUB",
13
- "\u20A9": "KRW",
14
- "\u20B9": "INR",
15
- "\u20BA": "TRY",
16
- "\u20B4": "UAH",
17
- "\u20AA": "ILS",
18
- "\u20AB": "VND",
19
- "\u20A6": "NGN",
20
- "\u20B1": "PHP"
21
- };
22
- var CURRENCY_WORD_ALIASES = {
23
- dollar: "USD",
24
- dollars: "USD",
25
- euro: "EUR",
26
- euros: "EUR",
27
- yen: "JPY",
28
- ruble: "RUB",
29
- rubles: "RUB",
30
- rouble: "RUB",
31
- roubles: "RUB",
32
- won: "KRW",
33
- rupee: "INR",
34
- rupees: "INR",
35
- yuan: "CNY",
36
- renminbi: "CNY",
37
- franc: "CHF",
38
- francs: "CHF",
39
- rand: "ZAR",
40
- krona: "SEK",
41
- kronor: "SEK",
42
- krone: "NOK",
43
- kroner: "NOK",
44
- real: "BRL",
45
- reais: "BRL",
46
- peso: "MXN",
47
- pesos: "MXN",
48
- shekel: "ILS",
49
- shekels: "ILS",
50
- lira: "TRY",
51
- hryvnia: "UAH",
52
- hryvnias: "UAH",
53
- zloty: "PLN",
54
- zlotys: "PLN",
55
- forint: "HUF",
56
- koruna: "CZK",
57
- dirham: "AED",
58
- dirhams: "AED",
59
- riyal: "SAR",
60
- riyals: "SAR",
61
- rial: "SAR",
62
- rials: "SAR",
63
- ringgit: "MYR",
64
- rupiah: "IDR",
65
- baht: "THB",
66
- dong: "VND",
67
- naira: "NGN"
68
- };
69
- function resolveCurrencyAlias(text) {
70
- return CURRENCY_SYMBOL_ALIASES[text] ?? CURRENCY_WORD_ALIASES[text.toLowerCase()];
71
- }
72
- var CURRENCY_DISPLAY = {
73
- USD: { symbol: "$", position: "prefix", spaced: false },
74
- AUD: { symbol: "$", position: "prefix", spaced: false },
75
- CAD: { symbol: "$", position: "prefix", spaced: false },
76
- NZD: { symbol: "$", position: "prefix", spaced: false },
77
- HKD: { symbol: "$", position: "prefix", spaced: false },
78
- SGD: { symbol: "$", position: "prefix", spaced: false },
79
- MXN: { symbol: "$", position: "prefix", spaced: false },
80
- GBP: { symbol: "\xA3", position: "prefix", spaced: false },
81
- // English-language convention (€100.00), many EU locales instead suffix
82
- // with a space ("100,00 €"); this engine's default locale is "en", so
83
- // the English convention was chosen. A locale-aware override would be a
84
- // reasonable future extension, not attempted here.
85
- EUR: { symbol: "\u20AC", position: "prefix", spaced: false },
86
- JPY: { symbol: "\xA5", position: "prefix", spaced: false },
87
- CNY: { symbol: "\xA5", position: "prefix", spaced: false },
88
- KRW: { symbol: "\u20A9", position: "prefix", spaced: false },
89
- INR: { symbol: "\u20B9", position: "prefix", spaced: false },
90
- // Russian convention places the ruble sign AFTER the amount, with a space.
91
- RUB: { symbol: "\u20BD", position: "suffix", spaced: true },
92
- TRY: { symbol: "\u20BA", position: "prefix", spaced: false },
93
- UAH: { symbol: "\u20B4", position: "suffix", spaced: true },
94
- ILS: { symbol: "\u20AA", position: "prefix", spaced: false },
95
- // Vietnamese convention: no space, symbol after the amount.
96
- VND: { symbol: "\u20AB", position: "suffix", spaced: false },
97
- NGN: { symbol: "\u20A6", position: "prefix", spaced: false },
98
- PHP: { symbol: "\u20B1", position: "prefix", spaced: false },
99
- BRL: { symbol: "R$", position: "prefix", spaced: false },
100
- ZAR: { symbol: "R", position: "prefix", spaced: false },
101
- // Scandinavian convention: amount then "kr", space-separated.
102
- SEK: { symbol: "kr", position: "suffix", spaced: true },
103
- NOK: { symbol: "kr", position: "suffix", spaced: true },
104
- DKK: { symbol: "kr", position: "suffix", spaced: true },
105
- PLN: { symbol: "z\u0142", position: "suffix", spaced: true },
106
- CHF: { symbol: "Fr", position: "suffix", spaced: true },
107
- HUF: { symbol: "Ft", position: "suffix", spaced: true },
108
- CZK: { symbol: "K\u010D", position: "suffix", spaced: true }
109
- };
110
-
111
- exports.CURRENCY_DISPLAY = CURRENCY_DISPLAY;
112
- exports.resolveCurrencyAlias = resolveCurrencyAlias;
113
- //# sourceMappingURL=chunk-OT6OJY7C.cjs.map
114
- //# sourceMappingURL=chunk-OT6OJY7C.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/uom/CurrencyAliases.ts"],"names":[],"mappings":";;;AAwBO,IAAM,uBAAA,GAAkD;AAAA,EAC7D,GAAA,EAAK,KAA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tD,KAAK,EAAE,MAAA,EAAQ,MAAM,QAAA,EAAU,QAAA,EAAU,QAAQ,KAAA,EAAM;AAAA,EACvD,KAAK,EAAE,MAAA,EAAQ,KAAK,QAAA,EAAU,QAAA,EAAU,QAAQ,KAAA,EAAM;AAAA;AAAA,EAEtD,KAAK,EAAE,MAAA,EAAQ,MAAM,QAAA,EAAU,QAAA,EAAU,QAAQ,IAAA,EAAK;AAAA,EACtD,KAAK,EAAE,MAAA,EAAQ,MAAM,QAAA,EAAU,QAAA,EAAU,QAAQ,IAAA,EAAK;AAAA,EACtD,KAAK,EAAE,MAAA,EAAQ,MAAM,QAAA,EAAU,QAAA,EAAU,QAAQ,IAAA,EAAK;AAAA,EACtD,KAAK,EAAE,MAAA,EAAQ,WAAM,QAAA,EAAU,QAAA,EAAU,QAAQ,IAAA,EAAK;AAAA,EACtD,KAAK,EAAE,MAAA,EAAQ,MAAM,QAAA,EAAU,QAAA,EAAU,QAAQ,IAAA,EAAK;AAAA,EACtD,KAAK,EAAE,MAAA,EAAQ,MAAM,QAAA,EAAU,QAAA,EAAU,QAAQ,IAAA,EAAK;AAAA,EACtD,KAAK,EAAE,MAAA,EAAQ,WAAM,QAAA,EAAU,QAAA,EAAU,QAAQ,IAAA;AACnD","file":"chunk-OT6OJY7C.cjs","sourcesContent":["/**\n * Currency symbol/word → ISO 4217 code aliases, and the reverse table used\n * for display formatting (see `format/FormatEngine.ts`'s `formatUom()`).\n *\n * Single source of truth for BOTH directions so the same ambiguity\n * decisions (documented inline below) aren't made twice, inconsistently,\n * in two different files.\n */\n\n/**\n * Currency SYMBOLS (non-alphanumeric characters), safe to recognize as\n * bare lexer tokens with zero risk of colliding with a variable name,\n * since `:name = expr` variable names can never be symbol characters.\n * `CurrencySymbolParselet.ts` consumes these directly.\n *\n * `¥`/`₱`/`peso` ambiguity note: the PESO SIGN (₱) is, per Unicode, the\n * Philippine peso specifically, but the WORD \"peso\" (see\n * `CURRENCY_WORD_ALIASES` below) defaults to the Mexican peso, the most\n * globally recognized \"peso\" in English financial writing. This is a\n * deliberate inconsistency between the symbol and the word for the same\n * general concept, same reasoning as `¥` (JPY) vs \"yuan\" (CNY) below\n * document rather than silently guess, and a user wanting the other one\n * can always type the ISO code directly (\"PHP\"/\"CNY\").\n */\nexport const CURRENCY_SYMBOL_ALIASES: Record<string, string> = {\n \"$\": \"USD\",\n \"£\": \"GBP\",\n \"€\": \"EUR\",\n // ¥ is genuinely ambiguous between JPY and CNY in real-world usage, JPY\n // is the conventional default (matches Numi/most calculator apps' own\n // choice); a user wanting CNY specifically can still type \"CNY\" directly.\n \"¥\": \"JPY\",\n \"₽\": \"RUB\",\n \"₩\": \"KRW\",\n \"₹\": \"INR\",\n \"₺\": \"TRY\",\n \"₴\": \"UAH\",\n \"₪\": \"ILS\",\n \"₫\": \"VND\",\n \"₦\": \"NGN\",\n \"₱\": \"PHP\",\n};\n\n/**\n * Currency WORD forms (singular/plural, all lowercase. This codebase's\n * unit table is strictly case-sensitive with no aliasing, so \"Euro\"/\"EURO\"\n * are deliberately NOT recognized, matching every other word-unit here).\n * Registered as `UNIT` tokens (see `lexer/units.ts`) rather than bare\n * keywords: a bare keyword can never be a `:variableName` (this codebase's\n * tested, intentional policy. See `VariableParselet.ts`'s doc comment)\n * but `:dollar = 5` etc. must keep working, and UNIT-typed tokens ARE\n * accepted as variable names (e.g. \":b = 5\" already works for the \"b\" bits\n * unit), so these ride the same safe mechanism `workday`/`workdays` used.\n *\n * Deliberately NOT included: \"pound\"/\"pounds\", already a MASS unit in\n * `lexer/units.ts` (450g, matching \"lb\"). Remapping it to GBP would be a\n * real, silent regression for anyone using \"5 pounds\" to mean weight; GBP\n * stays reachable via the £ symbol or the \"GBP\" code, same as before.\n *\n * Deliberately NOT included: \"dinar\", used by ~10 countries (Kuwaiti\n * Bahraini, Jordanian, Iraqi, Algerian, ... dinars) with wildly different\n * values (a Kuwaiti dinar is worth roughly 1000x an Algerian one), no\n * single default is defensible the way ¥→JPY or peso→MXN are. Type the\n * ISO code directly (KWD/BHD/JOD/...).\n *\n * Ambiguous-but-resolved cases, and why:\n * - \"peso\"/\"pesos\" → MXN (Mexican peso is the most globally recognized\n * \"peso\" in English financial writing). See the ₱ symbol note above\n * for why this deliberately differs from the ₱ SYMBOL's PHP mapping.\n * - \"franc\"/\"francs\" → CHF (Swiss franc; also used by several African\n * currencies, CHF is the overwhelmingly dominant \"franc\" in English use).\n * - \"krona\"/\"kronor\" → SEK (Swedish); \"krone\"/\"kroner\" → NOK (Norwegian)\n * Danish also uses \"krone\" (DKK) with the identical spelling as\n * Norwegian; NOK was picked arbitrarily as the more commonly-referenced\n * of the two in English text. Type \"DKK\" directly for Danish krone.\n * - \"riyal\"/\"riyals\"/\"rial\"/\"rials\" → SAR (Saudi riyal), both spellings\n * also refer to Qatari/Omani riyals and the Iranian rial; SAR is the\n * most commonly referenced in English. Type \"QAR\"/\"OMR\"/\"IRR\" directly\n * for the others.\n */\nexport const CURRENCY_WORD_ALIASES: Record<string, string> = {\n dollar: \"USD\", dollars: \"USD\",\n euro: \"EUR\", euros: \"EUR\",\n yen: \"JPY\",\n ruble: \"RUB\", rubles: \"RUB\", rouble: \"RUB\", roubles: \"RUB\",\n won: \"KRW\",\n rupee: \"INR\", rupees: \"INR\",\n yuan: \"CNY\", renminbi: \"CNY\",\n franc: \"CHF\", francs: \"CHF\",\n rand: \"ZAR\",\n krona: \"SEK\", kronor: \"SEK\",\n krone: \"NOK\", kroner: \"NOK\",\n real: \"BRL\", reais: \"BRL\",\n peso: \"MXN\", pesos: \"MXN\",\n shekel: \"ILS\", shekels: \"ILS\",\n lira: \"TRY\",\n hryvnia: \"UAH\", hryvnias: \"UAH\",\n zloty: \"PLN\", zlotys: \"PLN\",\n forint: \"HUF\",\n koruna: \"CZK\",\n dirham: \"AED\", dirhams: \"AED\",\n riyal: \"SAR\", riyals: \"SAR\", rial: \"SAR\", rials: \"SAR\",\n ringgit: \"MYR\",\n rupiah: \"IDR\",\n baht: \"THB\",\n dong: \"VND\",\n naira: \"NGN\",\n};\n\n/**\n * Resolve a raw lexed unit/symbol string to its canonical ISO 4217 code\n * e.g. `\"euro\"` -> `\"EUR\"`, `\"$\"` -> `\"USD\"`, `\"USD\"` -> `\"USD\"` (already\n * canonical, returned unchanged). Returns `undefined` if `text` isn't a\n * recognized currency alias at all (distinct from \"already canonical\"\n * callers should fall back to the original text in that case).\n */\nexport function resolveCurrencyAlias(text: string): string | undefined {\n return CURRENCY_SYMBOL_ALIASES[text] ?? CURRENCY_WORD_ALIASES[text.toLowerCase()];\n}\n\n/** How a currency's amount and symbol are conventionally arranged for display. */\nexport interface CurrencyDisplayInfo {\n /** The symbol/abbreviation to render, e.g. \"$\", \"kr\", \"R$\". */\n readonly symbol: string;\n /** Whether the symbol comes before or after the formatted amount. */\n readonly position: \"prefix\" | \"suffix\";\n /** Whether a space separates the symbol from the amount. */\n readonly spaced: boolean;\n}\n\n/**\n * Display convention per ISO code, for currencies with a widely-recognized\n * symbol/abbreviation and an unambiguous placement convention. NOT\n * exhaustive, any code absent here (most of the ~150 codes\n * `CurrencyExchange.isCurrency()` recognizes) falls back to the existing\n * \"amount CODE\" format (e.g. \"100.00 AED\") in `FormatEngine.formatUom()`,\n * exactly as before this table existed. Extend as needed, same pattern as\n * this session's other \"not exhaustive, additive\" tables (city timezones,\n * ingredient densities).\n *\n * Several currencies share the same symbol (USD/AUD/CAD/NZD/HKD/SGD/MXN\n * all conventionally use \"$\" locally). This is safe here because OUTPUT\n * formatting always starts from an already-resolved, unambiguous ISO code\n * (`value.unit`), unlike INPUT parsing where a bare \"$\" genuinely is\n * ambiguous (see `CURRENCY_SYMBOL_ALIASES`'s USD default above).\n */\nexport const CURRENCY_DISPLAY: Record<string, CurrencyDisplayInfo> = {\n USD: { symbol: \"$\", position: \"prefix\", spaced: false },\n AUD: { symbol: \"$\", position: \"prefix\", spaced: false },\n CAD: { symbol: \"$\", position: \"prefix\", spaced: false },\n NZD: { symbol: \"$\", position: \"prefix\", spaced: false },\n HKD: { symbol: \"$\", position: \"prefix\", spaced: false },\n SGD: { symbol: \"$\", position: \"prefix\", spaced: false },\n MXN: { symbol: \"$\", position: \"prefix\", spaced: false },\n GBP: { symbol: \"£\", position: \"prefix\", spaced: false },\n // English-language convention (€100.00), many EU locales instead suffix\n // with a space (\"100,00 €\"); this engine's default locale is \"en\", so\n // the English convention was chosen. A locale-aware override would be a\n // reasonable future extension, not attempted here.\n EUR: { symbol: \"€\", position: \"prefix\", spaced: false },\n JPY: { symbol: \"¥\", position: \"prefix\", spaced: false },\n CNY: { symbol: \"¥\", position: \"prefix\", spaced: false },\n KRW: { symbol: \"₩\", position: \"prefix\", spaced: false },\n INR: { symbol: \"₹\", position: \"prefix\", spaced: false },\n // Russian convention places the ruble sign AFTER the amount, with a space.\n RUB: { symbol: \"₽\", position: \"suffix\", spaced: true },\n TRY: { symbol: \"₺\", position: \"prefix\", spaced: false },\n UAH: { symbol: \"₴\", position: \"suffix\", spaced: true },\n ILS: { symbol: \"₪\", position: \"prefix\", spaced: false },\n // Vietnamese convention: no space, symbol after the amount.\n VND: { symbol: \"₫\", position: \"suffix\", spaced: false },\n NGN: { symbol: \"₦\", position: \"prefix\", spaced: false },\n PHP: { symbol: \"₱\", position: \"prefix\", spaced: false },\n BRL: { symbol: \"R$\", position: \"prefix\", spaced: false },\n ZAR: { symbol: \"R\", position: \"prefix\", spaced: false },\n // Scandinavian convention: amount then \"kr\", space-separated.\n SEK: { symbol: \"kr\", position: \"suffix\", spaced: true },\n NOK: { symbol: \"kr\", position: \"suffix\", spaced: true },\n DKK: { symbol: \"kr\", position: \"suffix\", spaced: true },\n PLN: { symbol: \"zł\", position: \"suffix\", spaced: true },\n CHF: { symbol: \"Fr\", position: \"suffix\", spaced: true },\n HUF: { symbol: \"Ft\", position: \"suffix\", spaced: true },\n CZK: { symbol: \"Kč\", position: \"suffix\", spaced: true },\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/uom/UnitConversion.ts","../src/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AA,CAAe,IAAI,CAAA,EAAG,OAAO,IAAA;AACjC,EAAA,OAAO,UAAA,CAAW,WAAA,CAAY,IAAI,CAAC,CAAA,KAAM,MAAA;AAC3C;AAWO,SAAS,WAAA,CAAY,OAAe,IAAA,EAA+C;AACxF,EAAA,MAAM,CAAA,GAAI,YAAY,IAAI,CAAA;AAC1B,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,mBAAA,CAAoB,KAAA,EAAO,CAAC,CAAA;AAC3C,IAAA,OAAO,EAAE,KAAA,EAAO,MAAA,CAAO,QAAA,EAAU,IAAA,EAAM,OAAO,IAAA,EAAK;AAAA,EACrD,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,KAAA,EAAO,IAAA,EAAM,CAAA,EAAE;AAAA,EAC1B;AACF","file":"chunk-QNJ4ACRT.cjs","sourcesContent":["/**\n * The unit conversion algorithm, ported from the `convert` npm package v7.0.2\n * alongside its tables (see `generated/UnitTable.generated.ts` and\n * THIRD-PARTY-NOTICES.md).\n *\n * Transliterated expression for expression rather than rewritten. Floating\n * point is not associative, so `(q + d) * (a / b) - d2` and any algebraically\n * equal rearrangement disagree in the last bits. Those bits are observable:\n * `0.5 l` best-converts to `500.00000000000006 mL` today, and the test suite\n * pins several conversions to ten decimal places.\n *\n * This module is deliberately unaware of the engine's own additions. Workdays,\n * extended units, currency and the caches all live in `UomConverter.ts`, which\n * layers them on top of these three functions.\n */\n\nimport {\n UNIT_TABLE,\n UNIT_DIFFERENCES,\n BEST_UNITS_METRIC,\n type UnitEntry,\n} from \"./generated/UnitTable.generated\";\n\n/**\n * The generated tables re-keyed into Maps once at module load.\n *\n * Not a micro-optimization. A 1456-key object literal lands in V8's dictionary\n * mode, and guarding a read on it against inherited names (`constructor`,\n * `toString`) costs about 123ns per call with either `hasOwnProperty.call` or\n * `Object.hasOwn`, measured. `Map.get` is about 6ns and needs no guard at all,\n * because a Map has no prototype chain to fall through to. That is a 20x\n * difference on the single hottest operation in the unit system: `convertRaw`\n * performs two of these per call, and `LanguageService` sweeps all 1456 keys\n * to build completions.\n */\nconst UNIT_LOOKUP: ReadonlyMap<string, UnitEntry> = new Map(Object.entries(UNIT_TABLE));\n\n/**\n * Temperature offsets, as a Map for the same reason.\n *\n * Also removes a latent hazard: the upstream code tests membership with `in`,\n * and `\"toString\" in UNIT_DIFFERENCES` is true, so an inherited name reaching\n * that branch would add a function to a number.\n */\nconst DIFFERENCE_LOOKUP: ReadonlyMap<string, number> = new Map(Object.entries(UNIT_DIFFERENCES));\n\n/**\n * Looks up a unit spelling.\n *\n * @returns its `[kind, ratio]` entry, or `undefined` if the spelling is not a\n * unit. Case-sensitive: no normalization or aliasing happens anywhere in this\n * module.\n *\n * The one deliberate deviation from upstream. `convert` tests membership with\n * `in` and reads the property directly, so inherited names like \"constructor\"\n * and \"toString\" reach its measure comparison and fail there with \"Cannot\n * convert between different measures\" instead of \"is not a valid unit\". Both\n * throw a RangeError and both report no measure, so nothing downstream can\n * tell the difference, and naming the real problem is the better message.\n */\nexport function lookupUnit(unit: string): UnitEntry | undefined {\n return UNIT_LOOKUP.get(unit);\n}\n\n/**\n * Converts `quantity` from one unit to another.\n *\n * THROWS a `RangeError` for an unknown unit or a pair in different measures.\n * Callers depend on that: `VM.ts`'s `extractDurationMs()` calls this with an\n * arbitrary unit inside a bare try/catch and treats the throw as \"not a\n * duration, contribute zero\". Returning NaN or the input unchanged instead\n * would turn `<date> + 5 kg` into an Invalid Date rather than a no-op.\n */\nexport function convertRaw(quantity: number, from: string, to: string): number {\n const parsedFrom = UNIT_LOOKUP.get(from);\n if (parsedFrom === undefined) {\n throw new RangeError(`${from} is not a valid unit`);\n }\n\n const parsedTo = UNIT_LOOKUP.get(to);\n if (parsedTo === undefined) {\n throw new RangeError(`${to} is not a valid unit`);\n }\n\n return convertResolved(quantity, from, to, parsedFrom, parsedTo);\n}\n\n/**\n * The conversion arithmetic, for callers that have already looked both units\n * up and want to skip doing it twice.\n *\n * Split out for `UomConverter.convertUnit()`, which has to check whether\n * either side is a workday or an extended unit before it can dispatch, and\n * would otherwise resolve each unit once to decide and again to convert. The\n * entries MUST be the ones this module returned for these exact spellings.\n */\nexport function convertResolved(\n quantity: number,\n from: string,\n to: string,\n fromEntry: UnitEntry,\n toEntry: UnitEntry\n): number {\n const parsedFrom = fromEntry;\n const parsedTo = toEntry;\n\n if (parsedFrom[0] !== parsedTo[0]) {\n // DELIBERATE DEVIATION from the ported original, which silently reinterpreted\n // \"m\" as minutes whenever the other side was a time unit. That is a guess,\n // and this project's stated position is that refusing to guess is the safer\n // default for a tool doing arithmetic on someone's real numbers (see\n // docs/architecture/design-decisions.md). The guess was not harmless: it\n // reached `<date> + <duration>` through VM.ts's extractDurationMs(), where\n // `today + 5 m` silently added five MINUTES for someone who wrote metres.\n //\n // Minutes are spelled \"min\", \"minute\" or \"minutes\", all of which the table\n // has always accepted.\n throw new RangeError(`Cannot convert between different measures: ${from} and ${to}`);\n }\n\n const fromRatio = parsedFrom[1];\n const toRatio = parsedTo[1];\n\n // Only six units in the whole table carry an offset, so the common path is\n // both misses. Reading the Map once per side and reusing the value beats\n // testing membership and then reading it again.\n const fromDifference = DIFFERENCE_LOOKUP.get(from);\n const toDifference = DIFFERENCE_LOOKUP.get(to);\n\n // Scales that do not share an origin (temperature) need the offset applied\n // around the ratio. Do not refactor the four branches into one expression:\n // the grouping is what makes the result bit-identical to the original.\n if (fromDifference !== undefined) {\n if (toDifference !== undefined) {\n return (quantity + fromDifference) * (fromRatio / toRatio) - toDifference;\n }\n return (quantity + fromDifference) * (fromRatio / toRatio);\n }\n\n if (toDifference !== undefined) {\n return quantity * (fromRatio / toRatio) - toDifference;\n }\n\n return quantity * (fromRatio / toRatio);\n}\n\n/**\n * Picks the most readable metric unit for a magnitude and converts to it.\n *\n * Only the metric lists are ported; nothing has ever requested the imperial\n * ones. Note the final conversion goes from the ORIGINAL unit to the chosen\n * one directly rather than via the smallest unit, which is what keeps the\n * result exact.\n */\nexport function convertToBestMetric(\n quantity: number,\n from: string\n): { quantity: number; unit: string } {\n const parsedFrom = UNIT_LOOKUP.get(from);\n if (parsedFrom === undefined) {\n throw new RangeError(`${from} is not a valid unit`);\n }\n\n const best = BEST_UNITS_METRIC[parsedFrom[0]];\n const smallestUnit = best[0][0];\n let bestUnit = smallestUnit;\n\n const baseQuantity = convertRaw(quantity, from, smallestUnit);\n const absQuantity = baseQuantity < 0 ? -baseQuantity : baseQuantity;\n\n // Thresholds are expressed in the smallest unit and ascend, so the last one\n // the magnitude reaches wins. Breaking early rather than scanning the whole\n // list matters for zero and for negatives, which stay on the smallest unit.\n for (let i = 0; i < best.length; i++) {\n const bestEntry = best[i];\n if (absQuantity >= bestEntry[1]) {\n bestUnit = bestEntry[0];\n } else {\n break;\n }\n }\n\n return { quantity: convertRaw(quantity, from, bestUnit), unit: bestUnit };\n}\n","/**\n * UoM Converter, built on the in-house unit tables in `UnitConversion.ts` and\n * `generated/UnitTable.generated.ts` (ported from the `convert` npm package\n * v7.0.2 so the engine ships with no runtime dependencies).\n *\n * Units are strictly case-sensitive and are looked up without aliasing. No unit\n * remapping, what you type is what you get.\n * e.g. 'C' = Celsius, 'c' = cup; 'MB' = megabytes, 'mb' = millibits.\n *\n * This file owns everything the base tables do not: the workday shim, the\n * extended (custom-measure) units, and the two caches.\n */\n\nimport { lookupUnit, convertRaw, convertResolved, convertToBestMetric } from \"@solve-js/uom/UnitConversion\";\nimport { MEASURE_KIND_NAMES, MEASURE_SYMBOLS } from \"@solve-js/uom/generated/UnitTable.generated\";\nimport { EXTENDED_UNITS } from \"@solve-js/uom/ExtendedUnits\";\n\n// ── \"workday\", a synthetic unit with no entry in the base table ───────────\n//\n// A business day (Mon-Fri) backing the datetime package's `<date> + N\n// workdays` arithmetic and `$X/workday` Rate literals\n// (packages/datetime/). NOT a real physical unit, a business day has no\n// fixed duration, since it depends on which calendar dates are weekends\n// so the ported base table has no concept of it and can't be\n// taught one without monkey-patching its internal unit table.\n//\n// For RATE-MATH purposes only (e.g. \"$500/workday x 4 weeks\" needs a\n// workday count to multiply by), a workday is treated as a FIXED 7/5 of a\n// calendar day: 5 workdays span exactly 7 calendar days in a whole week,\n// so this ratio is exact for whole-week spans and a reasonable linear\n// approximation otherwise. This is deliberately NOT the same\n// calendar-aware, weekend-skipping logic real \"<date> + N workdays\" date\n// arithmetic needs (see vm/VM.ts's addBusinessDays()), that can't be\n// reduced to a fixed ratio, since the exact skip pattern depends on which\n// day of the week the calculation actually starts from.\n//\n// Handled here as a thin pre/post layer in front of the normal\n// base-table path (rather than inside the tables themselves) so every\n// caller of getMeasure()/convertUnit()/canConvert() automatically gets\n// workday support for free.\nconst WORKDAY_UNIT_NAMES = new Set([\"workday\", \"workdays\"]);\nconst WORKDAY_TO_DAY_FACTOR = 7 / 5; // 1 workday == 1.4 calendar days\n\n/** Whether `unit` is the synthetic \"workday\" unit (see module note above). */\nexport function isWorkdayUnit(unit: string | undefined): unit is string {\n return typeof unit === \"string\" && WORKDAY_UNIT_NAMES.has(unit);\n}\n\n/**\n * Validate `unit` against the known unit table.\n *\n * @returns `unit` unchanged in all cases. This does NOT normalize casing\n * or aliasing (units are strictly case-sensitive, see the module note\n * above). A unit the table doesn't recognize is still\n * returned as-is (not thrown), so callers must not assume a returned\n * string is actually convertible, check with {@link isConvertibleUnit}\n * or {@link canConvert} first if that matters.\n *\n * Kept as an identity function purely for API compatibility. It used to guard\n * a validity cache, which existed because validating a unit meant a\n * throw/catch round trip through the old dependency. Validation is now a Map\n * lookup, so the cache cost more than it saved: worse, it was capped at 1000\n * entries against a 1456-unit table, so any sweep over the full vocabulary\n * (which is exactly what LanguageService does to build completions) evicted\n * on almost every call. That one change took the full-table sweep from 7.7ms\n * to under 20us.\n */\nexport function resolveUnit(unit: string): string {\n return unit;\n}\n\n// MEASURE_KIND_NAMES now comes from the generated table (it is derived data,\n// so the generator emits it rather than it being retyped here). The reason it\n// is a module-level constant has not changed: getMeasure() runs at least twice\n// per conversion, and this used to be reallocated on every call.\n\n/**\n * Get the measure/dimension kind for `unit` (e.g. `\"length\"`, `\"mass\"`,\n * `\"temperature\"`), used to check whether two units are even in the same\n * dimension before attempting a conversion.\n *\n * @returns `undefined` if `unit` isn't recognized, rather than throwing.\n */\nexport function getMeasure(unit: string): string | undefined {\n // Workday is a Time-measure unit by convention (see isWorkdayUnit's doc\n // comment) and is not in the base table, so resolve its measure via \"day\"\n // instead of attempting the real lookup below.\n if (isWorkdayUnit(unit)) return getMeasure(\"day\");\n\n // Extended (custom) categories the base table has no measure kind for,\n // see ExtendedUnits.ts.\n const extended = EXTENDED_UNITS[unit];\n if (extended) return extended.measure;\n\n const entry = lookupUnit(unit);\n if (entry === undefined) return undefined;\n\n return MEASURE_KIND_NAMES[entry[0]];\n}\n\n/**\n * Check whether `from` can be converted to `to`. Same unit, or same\n * measure kind (length, mass, ...) and the underlying tables accept the pair.\n * Never throws; returns `false` on any failure.\n */\nexport function canConvert(from: string, to: string): boolean {\n if (from === to) return true;\n if (isWorkdayUnit(from) || isWorkdayUnit(to)) {\n const fromMeasure = getMeasure(from);\n const toMeasure = getMeasure(to);\n return !!fromMeasure && fromMeasure === toMeasure;\n }\n // One table read per side, comparing numeric kind ids. The old shape called\n // getMeasure() on each side (two more reads) purely to compare the resulting\n // STRINGS, then did a throwaway conversion to confirm what the kind check had\n // already established.\n const fromEntry = lookupUnit(from);\n const toEntry = lookupUnit(to);\n if (fromEntry !== undefined && toEntry !== undefined) {\n return fromEntry[0] === toEntry[0];\n }\n\n // Extended (custom) categories aren't in the base table at all, so they are\n // compared on their own measure names instead.\n const fromExtended = EXTENDED_UNITS[from];\n const toExtended = EXTENDED_UNITS[to];\n if (fromExtended !== undefined && toExtended !== undefined) {\n return fromExtended.measure === toExtended.measure;\n }\n\n // Mixed: one side is a base unit and the other is extended or unknown. The\n // measure spaces are disjoint by construction, so this can never convert.\n return false;\n}\n\n/**\n * Convert `value` from unit `from` to unit `to`.\n *\n * Does not validate that the conversion is possible, callers should check\n * with {@link canConvert} first if `from`/`to` aren't already known-good.\n *\n * THROWS a RangeError for an unknown unit or a cross-measure pair. `VM.ts`'s\n * `extractDurationMs()` depends on that, see {@link convertRaw}.\n *\n * This used to memoize a per-pair conversion factor in an LFU cache. The cache\n * is gone: computing the factor is now two Map reads, while the cache cost a\n * template-string key allocation on every call plus the LFU's own frequency\n * bookkeeping, so it was slower than the work it avoided. Removing it is\n * bit-exact, not merely close: the cache stored `convertRaw(1, f, t)`, which is\n * exactly `fromRatio / toRatio`, and then multiplied, which is the identical\n * expression `convertRaw(value, f, t)` evaluates. It also deleted the special\n * case that existed only to keep offset-based temperature pairs out of a\n * factor cache.\n */\nexport function convertUnit(value: number, from: string, to: string): number {\n if (from === to) return value;\n\n // Fast path first: two ordinary units, which is nearly every call. Resolving\n // both here and handing the entries to convertResolved() avoids looking them\n // up again inside convertRaw(). Neither workdays nor extended units appear in\n // the base table, so they always fall through to the branches below and this\n // ordering cannot steal a case from them. UnitVocabulary.spec.ts pins that\n // the two vocabularies stay disjoint.\n const fromEntry = lookupUnit(from);\n const toEntry = lookupUnit(to);\n if (fromEntry !== undefined && toEntry !== undefined) {\n return convertResolved(value, from, to, fromEntry, toEntry);\n }\n\n // Workday <-> any other Time-measure unit: pivot through \"day\" using the\n // fixed 7/5 ratio (see isWorkdayUnit's doc comment above).\n if (isWorkdayUnit(from) && isWorkdayUnit(to)) return value; // \"workday\" <-> \"workdays\" alias\n if (isWorkdayUnit(from)) {\n const days = value * WORKDAY_TO_DAY_FACTOR;\n return to === \"day\" ? days : convertUnit(days, \"day\", to);\n }\n if (isWorkdayUnit(to)) {\n const days = from === \"day\" ? value : convertUnit(value, from, \"day\");\n return days / WORKDAY_TO_DAY_FACTOR;\n }\n\n // Extended (custom) categories the base table has no measure kind for\n // (see ExtendedUnits.ts), compute the ratio directly from each unit's\n // factor-to-base value instead of calling convertRaw(), which would throw\n // on an unrecognized unit string. Every extended category is a pure linear\n // ratio scale (no Temperature-style offset), so this is always safe.\n const fExt = EXTENDED_UNITS[from];\n const tExt = EXTENDED_UNITS[to];\n if (fExt !== undefined && tExt !== undefined) {\n return value * (fExt.toBase / tExt.toBase);\n }\n\n // Offsets, cross-measure rejection and the unknown-unit throw all live in\n // convertRaw. Nothing is layered on top here any more.\n return convertRaw(value, from, to);\n}\n\n/**\n * List every unit symbol in the same measure/dimension as `unit` (wiki:\n * Units-Of-Measurement, \"Conversion Possibilities\", `sourceUnit to ?`\n * e.g. `cm to ?\"` → every Length unit). Excludes `unit` itself.\n *\n * Reads MEASURE_SYMBOLS, which is a curated symbols-only vocabulary and\n * deliberately NOT the keys of the unit table filtered by kind. The two\n * differ: Volume's symbols include `c` and `pt` but not `cup`/`cups`, and\n * Time's include `wk` and `mo` but not `week`/`month`. Deriving this list\n * from the unit table instead would roughly quadruple every answer.\n *\n * @returns `[]` if `unit` isn't recognized, rather than throwing.\n */\nexport function getConvertiblePossibilities(unit: string): string[] {\n const resolved = resolveUnit(unit);\n const entry = lookupUnit(resolved);\n if (entry === undefined) return [];\n const symbols = MEASURE_SYMBOLS[entry[0]];\n if (!symbols) return [];\n return symbols.filter((s) => s !== resolved);\n}\n\n/** Check whether `unit` is a unit the conversion tables recognize. Never throws. */\nexport function isConvertibleUnit(unit: string): boolean {\n if (isWorkdayUnit(unit)) return true;\n if (EXTENDED_UNITS[unit]) return true;\n return lookupUnit(resolveUnit(unit)) !== undefined;\n}\n\n/**\n * Convert `value` (in `unit`) to whichever unit of the same measure gives\n * the most human-readable magnitude, e.g. 1500 metres becomes 1.5 km. Falls\n * back to returning `value`/`unit` unchanged if `unit` isn't recognized,\n * which is what every extended unit and workday does.\n *\n * Note the chosen unit is drawn from the best-unit lists, which are not\n * restricted to spellings the lexer accepts: 0.5 l reports \"mL\".\n */\nexport function getBestUnit(value: number, unit: string): { value: number; unit: string } {\n const u = resolveUnit(unit);\n try {\n const result = convertToBestMetric(value, u);\n return { value: result.quantity, unit: result.unit };\n } catch {\n return { value, unit: u };\n }\n}\n"]}