polytypo 1.21.0 → 1.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/{chunk-IBN7DIS5.js → chunk-2QD7JARJ.js} +3 -3
  2. package/dist/{chunk-FEVHV3ED.js → chunk-44KKUSOQ.js} +2 -2
  3. package/dist/{chunk-5AEJFYWK.cjs → chunk-6S7AKBQZ.cjs} +3 -3
  4. package/dist/{chunk-5AEJFYWK.cjs.map → chunk-6S7AKBQZ.cjs.map} +1 -1
  5. package/dist/{chunk-DHKVVUYY.cjs → chunk-BF6OL3QM.cjs} +4 -4
  6. package/dist/{chunk-DHKVVUYY.cjs.map → chunk-BF6OL3QM.cjs.map} +1 -1
  7. package/dist/{chunk-QXUC42OO.js → chunk-D6CWTH54.js} +154 -48
  8. package/dist/chunk-D6CWTH54.js.map +1 -0
  9. package/dist/chunk-FSDQXTM5.cjs +36 -0
  10. package/dist/{chunk-F2CNG4TF.cjs.map → chunk-FSDQXTM5.cjs.map} +1 -1
  11. package/dist/{chunk-FV4S3LDM.js → chunk-IQ7T2HFZ.js} +2 -2
  12. package/dist/{chunk-75BQY5RY.cjs → chunk-JWOUHTOD.cjs} +154 -48
  13. package/dist/chunk-JWOUHTOD.cjs.map +1 -0
  14. package/dist/{chunk-NJXVMN4M.js → chunk-MEVOJV7I.js} +2 -2
  15. package/dist/{chunk-55LL24PJ.js → chunk-N2QFEDI2.js} +3 -3
  16. package/dist/chunk-OEKUKIMI.cjs +38 -0
  17. package/dist/{chunk-AUKI3EXL.cjs.map → chunk-OEKUKIMI.cjs.map} +1 -1
  18. package/dist/{chunk-3L5KLKLP.cjs → chunk-OY3D5CRP.cjs} +23 -23
  19. package/dist/{chunk-3L5KLKLP.cjs.map → chunk-OY3D5CRP.cjs.map} +1 -1
  20. package/dist/{chunk-3WYVUARI.cjs → chunk-PLDK525W.cjs} +6 -6
  21. package/dist/{chunk-3WYVUARI.cjs.map → chunk-PLDK525W.cjs.map} +1 -1
  22. package/dist/{chunk-KY6R54DA.js → chunk-PREUPLPO.js} +2 -2
  23. package/dist/{chunk-5AQIJOPD.js → chunk-PRG3GQNV.js} +4 -4
  24. package/dist/chunk-UNXIWWE7.cjs +34 -0
  25. package/dist/{chunk-QIUGMSFQ.cjs.map → chunk-UNXIWWE7.cjs.map} +1 -1
  26. package/dist/{errors-CjpOoBlm.d.cts → errors-C5bXmTWu.d.cts} +2 -0
  27. package/dist/{errors-CjpOoBlm.d.ts → errors-C5bXmTWu.d.ts} +2 -0
  28. package/dist/html.cjs +9 -9
  29. package/dist/html.d.cts +2 -2
  30. package/dist/html.d.ts +2 -2
  31. package/dist/html.js +4 -4
  32. package/dist/index.cjs +17 -17
  33. package/dist/index.d.cts +2 -2
  34. package/dist/index.d.ts +2 -2
  35. package/dist/index.js +7 -7
  36. package/dist/markdown.cjs +10 -10
  37. package/dist/markdown.d.cts +2 -2
  38. package/dist/markdown.d.ts +2 -2
  39. package/dist/markdown.js +5 -5
  40. package/dist/text.cjs +8 -8
  41. package/dist/text.d.cts +2 -2
  42. package/dist/text.d.ts +2 -2
  43. package/dist/text.js +3 -3
  44. package/dist/yaml.cjs +9 -9
  45. package/dist/yaml.d.cts +2 -2
  46. package/dist/yaml.d.ts +2 -2
  47. package/dist/yaml.js +4 -4
  48. package/package.json +1 -1
  49. package/dist/chunk-75BQY5RY.cjs.map +0 -1
  50. package/dist/chunk-AUKI3EXL.cjs +0 -38
  51. package/dist/chunk-F2CNG4TF.cjs +0 -36
  52. package/dist/chunk-QIUGMSFQ.cjs +0 -34
  53. package/dist/chunk-QXUC42OO.js.map +0 -1
  54. /package/dist/{chunk-IBN7DIS5.js.map → chunk-2QD7JARJ.js.map} +0 -0
  55. /package/dist/{chunk-FEVHV3ED.js.map → chunk-44KKUSOQ.js.map} +0 -0
  56. /package/dist/{chunk-FV4S3LDM.js.map → chunk-IQ7T2HFZ.js.map} +0 -0
  57. /package/dist/{chunk-NJXVMN4M.js.map → chunk-MEVOJV7I.js.map} +0 -0
  58. /package/dist/{chunk-55LL24PJ.js.map → chunk-N2QFEDI2.js.map} +0 -0
  59. /package/dist/{chunk-KY6R54DA.js.map → chunk-PREUPLPO.js.map} +0 -0
  60. /package/dist/{chunk-5AQIJOPD.js.map → chunk-PRG3GQNV.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolveYamlKeys,
3
3
  yamlSpans
4
- } from "./chunk-FV4S3LDM.js";
4
+ } from "./chunk-IQ7T2HFZ.js";
5
5
  import {
6
6
  analyzeOverSpans,
7
7
  assertNoProtect,
@@ -9,7 +9,7 @@ import {
9
9
  planRules,
10
10
  resolveNarrowTarget,
11
11
  runOverSpans
12
- } from "./chunk-QXUC42OO.js";
12
+ } from "./chunk-D6CWTH54.js";
13
13
 
14
14
  // src/engine/yaml-pipeline.ts
15
15
  function runYamlPipeline(input, options) {
@@ -33,4 +33,4 @@ export {
33
33
  runYamlPipeline,
34
34
  analyzeYamlPipeline
35
35
  };
36
- //# sourceMappingURL=chunk-IBN7DIS5.js.map
36
+ //# sourceMappingURL=chunk-2QD7JARJ.js.map
@@ -9,7 +9,7 @@ import {
9
9
  runRules,
10
10
  runRulesRecording,
11
11
  toCodePoints
12
- } from "./chunk-QXUC42OO.js";
12
+ } from "./chunk-D6CWTH54.js";
13
13
 
14
14
  // src/engine/text-pipeline.ts
15
15
  function runTextPipeline(input, options) {
@@ -35,4 +35,4 @@ export {
35
35
  runTextPipeline,
36
36
  analyzeTextPipeline
37
37
  };
38
- //# sourceMappingURL=chunk-FEVHV3ED.js.map
38
+ //# sourceMappingURL=chunk-44KKUSOQ.js.map
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk75BQY5RYcjs = require('./chunk-75BQY5RY.cjs');
3
+ var _chunkJWOUHTODcjs = require('./chunk-JWOUHTOD.cjs');
4
4
 
5
5
  // src/engine/assert-fixed-mode.ts
6
6
  function assertFixedMode(mode, fixed, entryPoint) {
7
7
  if (mode === void 0 || mode === fixed) return;
8
- throw new (0, _chunk75BQY5RYcjs.PolytypoError)(
8
+ throw new (0, _chunkJWOUHTODcjs.PolytypoError)(
9
9
  "POLYTYPO_INVALID_MODE",
10
10
  `"${entryPoint}" only supports mode "${fixed}". Received "${String(mode)}" \u2014 import from "polytypo" for the other modes, or omit \`mode\` here.`
11
11
  );
@@ -14,4 +14,4 @@ function assertFixedMode(mode, fixed, entryPoint) {
14
14
 
15
15
 
16
16
  exports.assertFixedMode = assertFixedMode;
17
- //# sourceMappingURL=chunk-5AEJFYWK.cjs.map
17
+ //# sourceMappingURL=chunk-6S7AKBQZ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-5AEJFYWK.cjs","../src/engine/assert-fixed-mode.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACMO,SAAS,eAAA,CAAgB,IAAA,EAAe,KAAA,EAAa,UAAA,EAA0B;AACpF,EAAA,GAAA,CAAI,KAAA,IAAS,KAAA,EAAA,GAAa,KAAA,IAAS,KAAA,EAAO,MAAA;AAC1C,EAAA,MAAM,IAAI,oCAAA;AAAA,IACR,uBAAA;AAAA,IACA,CAAA,CAAA,EAAI,UAAU,CAAA,sBAAA,EAAyB,KAAK,CAAA,aAAA,EAAgB,MAAA,CAAO,IAAI,CAAC,CAAA,2EAAA;AAAA,EAE1E,CAAA;AACF;ADLA;AACA;AACE;AACF,0CAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-5AEJFYWK.cjs","sourcesContent":[null,"import { PolytypoError } from \"../errors.js\";\nimport type { Mode } from \"../types.js\";\n\n/**\n * `polytypo/text`, `polytypo/html` and `polytypo/markdown` each fix `mode` at the type level by\n * omitting it from their Options type (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1, criterion 6).\n * A plain-JS caller — or a TypeScript caller passing a wider-typed variable, which excess-property\n * checking does not catch — can still supply a conflicting `mode` at runtime. That is rejected\n * explicitly here, never silently ignored or overridden.\n */\nexport function assertFixedMode(mode: unknown, fixed: Mode, entryPoint: string): void {\n if (mode === undefined || mode === fixed) return;\n throw new PolytypoError(\n \"POLYTYPO_INVALID_MODE\",\n `\"${entryPoint}\" only supports mode \"${fixed}\". Received \"${String(mode)}\" — ` +\n `import from \"polytypo\" for the other modes, or omit \\`mode\\` here.`,\n );\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-6S7AKBQZ.cjs","../src/engine/assert-fixed-mode.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACMO,SAAS,eAAA,CAAgB,IAAA,EAAe,KAAA,EAAa,UAAA,EAA0B;AACpF,EAAA,GAAA,CAAI,KAAA,IAAS,KAAA,EAAA,GAAa,KAAA,IAAS,KAAA,EAAO,MAAA;AAC1C,EAAA,MAAM,IAAI,oCAAA;AAAA,IACR,uBAAA;AAAA,IACA,CAAA,CAAA,EAAI,UAAU,CAAA,sBAAA,EAAyB,KAAK,CAAA,aAAA,EAAgB,MAAA,CAAO,IAAI,CAAC,CAAA,2EAAA;AAAA,EAE1E,CAAA;AACF;ADLA;AACA;AACE;AACF,0CAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-6S7AKBQZ.cjs","sourcesContent":[null,"import { PolytypoError } from \"../errors.js\";\nimport type { Mode } from \"../types.js\";\n\n/**\n * `polytypo/text`, `polytypo/html` and `polytypo/markdown` each fix `mode` at the type level by\n * omitting it from their Options type (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1, criterion 6).\n * A plain-JS caller — or a TypeScript caller passing a wider-typed variable, which excess-property\n * checking does not catch — can still supply a conflicting `mode` at runtime. That is rejected\n * explicitly here, never silently ignored or overridden.\n */\nexport function assertFixedMode(mode: unknown, fixed: Mode, entryPoint: string): void {\n if (mode === undefined || mode === fixed) return;\n throw new PolytypoError(\n \"POLYTYPO_INVALID_MODE\",\n `\"${entryPoint}\" only supports mode \"${fixed}\". Received \"${String(mode)}\" — ` +\n `import from \"polytypo\" for the other modes, or omit \\`mode\\` here.`,\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk75BQY5RYcjs = require('./chunk-75BQY5RY.cjs');
3
+ var _chunkJWOUHTODcjs = require('./chunk-JWOUHTOD.cjs');
4
4
 
5
5
  // src/modes/html.ts
6
6
  var _parse5 = require('parse5');
@@ -20,8 +20,8 @@ function wrapParserErrors(what, run) {
20
20
  try {
21
21
  return run();
22
22
  } catch (error) {
23
- if (error instanceof _chunk75BQY5RYcjs.PolytypoError) throw error;
24
- throw new (0, _chunk75BQY5RYcjs.PolytypoError)(
23
+ if (error instanceof _chunkJWOUHTODcjs.PolytypoError) throw error;
24
+ throw new (0, _chunkJWOUHTODcjs.PolytypoError)(
25
25
  "POLYTYPO_MALFORMED_INPUT",
26
26
  `Input does not parse as ${what}: ${describe(error)}`
27
27
  );
@@ -144,4 +144,4 @@ function htmlFragmentSpans(source, offset) {
144
144
 
145
145
 
146
146
  exports.wrapParserErrors = wrapParserErrors; exports.isSkippedElement = isSkippedElement; exports.htmlSpans = htmlSpans; exports.htmlFragmentSpans = htmlFragmentSpans;
147
- //# sourceMappingURL=chunk-DHKVVUYY.cjs.map
147
+ //# sourceMappingURL=chunk-BF6OL3QM.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-DHKVVUYY.cjs","../src/modes/html.ts","../src/modes/parse-error.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,gCAAqC;ADMrC;AACA;AEAA,SAAS,QAAA,CAAS,KAAA,EAAwB;AACxC,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,SAAA,GAAY,MAAA,IAAU,IAAA,EAAM,OAAO,MAAA,CAAO,KAAK,CAAA;AACpE,EAAA,MAAM,WAAA,EAAa,KAAA;AACnB,EAAA,MAAM,OAAA,EACJ,OAAO,UAAA,CAAW,OAAA,IAAW,SAAA,EAAW,UAAA,CAAW,OAAA,EAAU,KAAA,CAAgB,OAAA;AAC/E,EAAA,MAAM,MAAA,EAAQ,UAAA,CAAW,KAAA;AACzB,EAAA,GAAA,CACE,MAAA,IAAU,KAAA,GACV,MAAA,IAAU,KAAA,EAAA,GACV,OAAO,KAAA,CAAM,KAAA,IAAS,SAAA,GACtB,OAAO,KAAA,CAAM,OAAA,IAAW,QAAA,EACxB;AACA,IAAA,OAAO,CAAA,EAAA;AACT,EAAA;AACO,EAAA;AACT;AAcgB;AACV,EAAA;AACK,IAAA;AACA,EAAA;AACH,IAAA;AACE,IAAA;AACJ,MAAA;AACA,MAAA;AACF,IAAA;AACF,EAAA;AACF;AFjBY;AACA;ACfN;AACJ,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACD;AAEe;AACP,EAAA;AACT;AAEM;AACA;AACO;AACP;AACA;AAGA;AAEG;AACA,EAAA;AACT;AAES;AACA,EAAA;AACT;AAES;AACA,EAAA;AACT;AAQS;AACH,EAAA;AACI,EAAA;AACC,EAAA;AAEL,EAAA;AACG,IAAA;AACC,IAAA;AACA,IAAA;AACG,IAAA;AACH,IAAA;AAEJ,IAAA;AAGK,MAAA;AACP,IAAA;AACI,IAAA;AACG,IAAA;AACT,EAAA;AAEM,EAAA;AAEJ,EAAA;AAIK,IAAA;AACP,EAAA;AACU,EAAA;AACH,EAAA;AACT;AAOgB;AACR,EAAA;AACF,EAAA;AACI,EAAA;AACD,EAAA;AACD,IAAA;AACI,MAAA;AACF,MAAA;AACE,QAAA;AACJ,QAAA;AACI,QAAA;AACJ,QAAA;AACF,MAAA;AACF,IAAA;AACK,IAAA;AACP,EAAA;AACU,EAAA;AACH,EAAA;AACT;AAES;AACA,EAAA;AACT;AAES;AACE,EAAA;AACD,IAAA;AACF,IAAA;AACJ,IAAA;AACQ,MAAA;AACR,IAAA;AACA,IAAA;AACF,EAAA;AAGS,EAAA;AAEL,EAAA;AAGK,EAAA;AACC,IAAA;AACR,IAAA;AACF,EAAA;AAEK,EAAA;AACL,EAAA;AACF;AAQgB;AACR,EAAA;AACA,EAAA;AACE,EAAA;AACD,EAAA;AACT;AAGgB;AACR,EAAA;AAA4B,IAAA;AAChC,IAAA;AACF,EAAA;AACM,EAAA;AACE,EAAA;AACD,EAAA;AAGT;AD9BY;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-DHKVVUYY.cjs","sourcesContent":[null,"import { parse, parseFragment } from \"parse5\";\nimport type { DefaultTreeAdapterMap } from \"parse5\";\nimport { wrapParserErrors } from \"./parse-error.js\";\nimport type { Span } from \"./spans.js\";\n\ntype Node = DefaultTreeAdapterMap[\"node\"];\ntype ParentNode = DefaultTreeAdapterMap[\"parentNode\"];\n\n/**\n * spec/rules/modes.md 3.6, exhaustive and **closed**: extending it is a spec change, not an\n * implementation decision. `svg` and `math` are here because in MathML a quotation mark, a\n * hyphen and a prime are operators and identifiers — substituting a curly glyph changes what\n * the expression means. Everything not listed is processable, **including unknown and custom\n * elements**: guessing from a tag name is exactly the heuristic that diverges across runtimes.\n */\nconst SKIPPED_ELEMENTS: ReadonlySet<string> = new Set([\n \"code\",\n \"pre\",\n \"kbd\",\n \"samp\",\n \"var\",\n \"script\",\n \"style\",\n \"textarea\",\n \"svg\",\n \"math\",\n]);\n\nexport function isSkippedElement(tagName: string): boolean {\n return SKIPPED_ELEMENTS.has(tagName);\n}\n\nconst AMPERSAND = 0x26;\nconst SEMICOLON = 0x3b;\nconst HASH = 0x23;\nconst LOWER_X = 0x78;\nconst UPPER_X = 0x58;\n\n/** Longest named reference in the WHATWG table is 32 characters; the guard is a bound, not a rule. */\nconst MAX_REFERENCE_BODY = 34;\n\nfunction isAsciiDigit(unit: number): boolean {\n return unit >= 0x30 && unit <= 0x39;\n}\n\nfunction isAsciiHexDigit(unit: number): boolean {\n return isAsciiDigit(unit) || (unit >= 0x61 && unit <= 0x66) || (unit >= 0x41 && unit <= 0x46);\n}\n\nfunction isAsciiAlphanumeric(unit: number): boolean {\n return isAsciiDigit(unit) || (unit >= 0x61 && unit <= 0x7a) || (unit >= 0x41 && unit <= 0x5a);\n}\n\n/**\n * The end offset of a well-formed character reference starting at `at`, or -1. A bare `&` that a\n * parser would repair is deliberately **not** treated as a reference: it stays inside the span,\n * where no rule can emit or delete it, rather than manufacturing a boundary that suppresses\n * conversions around it.\n */\nfunction characterReferenceEnd(source: string, at: number, limit: number): number {\n if (source.charCodeAt(at) !== AMPERSAND) return -1;\n let i = at + 1;\n if (i >= limit) return -1;\n\n if (source.charCodeAt(i) === HASH) {\n i += 1;\n const unit = i < limit ? source.charCodeAt(i) : -1;\n const hex = unit === LOWER_X || unit === UPPER_X;\n if (hex) i += 1;\n const digitsAt = i;\n while (\n i < limit &&\n (hex ? isAsciiHexDigit(source.charCodeAt(i)) : isAsciiDigit(source.charCodeAt(i)))\n ) {\n i += 1;\n }\n if (i === digitsAt) return -1;\n return i < limit && source.charCodeAt(i) === SEMICOLON ? i + 1 : -1;\n }\n\n const nameAt = i;\n while (\n i < limit &&\n i - nameAt < MAX_REFERENCE_BODY &&\n isAsciiAlphanumeric(source.charCodeAt(i))\n ) {\n i += 1;\n }\n if (i === nameAt) return -1;\n return i < limit && source.charCodeAt(i) === SEMICOLON ? i + 1 : -1;\n}\n\n/**\n * modes.md 3.6: every character reference is skipped as an **opaque unit**, and a text node\n * containing one is split into spans around it. That is the only way `&nbsp;` survives as\n * `&nbsp;` instead of becoming a literal U+00A0 on the way out.\n */\nexport function splitCharacterReferences(source: string, start: number, end: number): Span[] {\n const spans: Span[] = [];\n let cursor = start;\n let i = start;\n while (i < end) {\n if (source.charCodeAt(i) === AMPERSAND) {\n const stop = characterReferenceEnd(source, i, end);\n if (stop > 0) {\n if (i > cursor) spans.push({ start: cursor, end: i });\n cursor = stop;\n i = stop;\n continue;\n }\n }\n i += 1;\n }\n if (end > cursor) spans.push({ start: cursor, end });\n return spans;\n}\n\nfunction isParent(node: Node): node is ParentNode {\n return \"childNodes\" in node;\n}\n\nfunction collect(node: Node, source: string, spans: Span[]): void {\n if (node.nodeName === \"#text\") {\n const location = node.sourceCodeLocation;\n if (location === undefined || location === null) return;\n for (const span of splitCharacterReferences(source, location.startOffset, location.endOffset)) {\n spans.push(span);\n }\n return;\n }\n\n // Comments, doctype and processing instructions never contribute a span (modes.md 3.6).\n if (node.nodeName === \"#comment\" || node.nodeName === \"#documentType\") return;\n\n if (\"tagName\" in node && isSkippedElement(node.tagName)) return;\n\n // A `template`'s children live in a separate document fragment; `template` is not skipped.\n if (node.nodeName === \"template\" && \"content\" in node) {\n collect(node.content, source, spans);\n return;\n }\n\n if (!isParent(node)) return;\n for (const child of node.childNodes) collect(child, source, spans);\n}\n\n/**\n * Locate the processable spans of an HTML document. The tree is used only to find offsets and is\n * then discarded — modes.md 4 forbids reserialisation, which is what makes attribute quoting,\n * self-closing forms, entity spelling, tag case and malformed-input recovery preserved by\n * construction rather than by effort.\n */\nexport function htmlSpans(source: string): Span[] {\n const document = wrapParserErrors(\"HTML\", () => parse(source, { sourceCodeLocationInfo: true }));\n const spans: Span[] = [];\n collect(document, source, spans);\n return spans;\n}\n\n/** The same, for a fragment: used for HTML blocks embedded in markdown (modes.md 3.7). */\nexport function htmlFragmentSpans(source: string, offset: number): Span[] {\n const fragment = wrapParserErrors(\"HTML\", () =>\n parseFragment(source, { sourceCodeLocationInfo: true }),\n );\n const spans: Span[] = [];\n collect(fragment, source, spans);\n return offset === 0\n ? spans\n : spans.map((span) => ({ start: span.start + offset, end: span.end + offset }));\n}\n","import { PolytypoError } from \"../errors.js\";\n\ninterface PositionedError {\n readonly reason?: unknown;\n readonly place?: { readonly line?: unknown; readonly column?: unknown } | null;\n}\n\nfunction describe(error: unknown): string {\n if (typeof error !== \"object\" || error === null) return String(error);\n const positioned = error as PositionedError;\n const reason =\n typeof positioned.reason === \"string\" ? positioned.reason : (error as Error).message;\n const place = positioned.place;\n if (\n place !== null &&\n place !== undefined &&\n typeof place.line === \"number\" &&\n typeof place.column === \"number\"\n ) {\n return `${reason} (line ${place.line}, column ${place.column})`;\n }\n return reason;\n}\n\n/**\n * spec/rules/modes.md 3.7.2. **The parser's own error type must never escape.** A\n * `VFileMessage`, a `Nokogiri::SyntaxError` or a Python exception on the public surface puts a\n * dependency's type into the contract and is unreproducible in the other four runtimes; only the\n * code is contractual (ARCHITECTURE.md 4.6), while the message and the source position are\n * useful and are not.\n *\n * Reachable in exactly one place: `dialect: \"mdx\"`, because MDX embeds JavaScript. HTML parsing\n * is specified with total error recovery and every byte sequence is valid CommonMark, so neither\n * of the other two languages can fail. The wrapper is applied to all of them anyway — the\n * guarantee is that no parser type escapes, not that this particular parser is trusted.\n */\nexport function wrapParserErrors<T>(what: string, run: () => T): T {\n try {\n return run();\n } catch (error) {\n if (error instanceof PolytypoError) throw error;\n throw new PolytypoError(\n \"POLYTYPO_MALFORMED_INPUT\",\n `Input does not parse as ${what}: ${describe(error)}`,\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-BF6OL3QM.cjs","../src/modes/html.ts","../src/modes/parse-error.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,gCAAqC;ADMrC;AACA;AEAA,SAAS,QAAA,CAAS,KAAA,EAAwB;AACxC,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,SAAA,GAAY,MAAA,IAAU,IAAA,EAAM,OAAO,MAAA,CAAO,KAAK,CAAA;AACpE,EAAA,MAAM,WAAA,EAAa,KAAA;AACnB,EAAA,MAAM,OAAA,EACJ,OAAO,UAAA,CAAW,OAAA,IAAW,SAAA,EAAW,UAAA,CAAW,OAAA,EAAU,KAAA,CAAgB,OAAA;AAC/E,EAAA,MAAM,MAAA,EAAQ,UAAA,CAAW,KAAA;AACzB,EAAA,GAAA,CACE,MAAA,IAAU,KAAA,GACV,MAAA,IAAU,KAAA,EAAA,GACV,OAAO,KAAA,CAAM,KAAA,IAAS,SAAA,GACtB,OAAO,KAAA,CAAM,OAAA,IAAW,QAAA,EACxB;AACA,IAAA,OAAO,CAAA,EAAA;AACT,EAAA;AACO,EAAA;AACT;AAcgB;AACV,EAAA;AACK,IAAA;AACA,EAAA;AACH,IAAA;AACE,IAAA;AACJ,MAAA;AACA,MAAA;AACF,IAAA;AACF,EAAA;AACF;AFjBY;AACA;ACfN;AACJ,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACD;AAEe;AACP,EAAA;AACT;AAEM;AACA;AACO;AACP;AACA;AAGA;AAEG;AACA,EAAA;AACT;AAES;AACA,EAAA;AACT;AAES;AACA,EAAA;AACT;AAQS;AACH,EAAA;AACI,EAAA;AACC,EAAA;AAEL,EAAA;AACG,IAAA;AACC,IAAA;AACA,IAAA;AACG,IAAA;AACH,IAAA;AAEJ,IAAA;AAGK,MAAA;AACP,IAAA;AACI,IAAA;AACG,IAAA;AACT,EAAA;AAEM,EAAA;AAEJ,EAAA;AAIK,IAAA;AACP,EAAA;AACU,EAAA;AACH,EAAA;AACT;AAOgB;AACR,EAAA;AACF,EAAA;AACI,EAAA;AACD,EAAA;AACD,IAAA;AACI,MAAA;AACF,MAAA;AACE,QAAA;AACJ,QAAA;AACI,QAAA;AACJ,QAAA;AACF,MAAA;AACF,IAAA;AACK,IAAA;AACP,EAAA;AACU,EAAA;AACH,EAAA;AACT;AAES;AACA,EAAA;AACT;AAES;AACE,EAAA;AACD,IAAA;AACF,IAAA;AACJ,IAAA;AACQ,MAAA;AACR,IAAA;AACA,IAAA;AACF,EAAA;AAGS,EAAA;AAEL,EAAA;AAGK,EAAA;AACC,IAAA;AACR,IAAA;AACF,EAAA;AAEK,EAAA;AACL,EAAA;AACF;AAQgB;AACR,EAAA;AACA,EAAA;AACE,EAAA;AACD,EAAA;AACT;AAGgB;AACR,EAAA;AAA4B,IAAA;AAChC,IAAA;AACF,EAAA;AACM,EAAA;AACE,EAAA;AACD,EAAA;AAGT;AD9BY;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-BF6OL3QM.cjs","sourcesContent":[null,"import { parse, parseFragment } from \"parse5\";\nimport type { DefaultTreeAdapterMap } from \"parse5\";\nimport { wrapParserErrors } from \"./parse-error.js\";\nimport type { Span } from \"./spans.js\";\n\ntype Node = DefaultTreeAdapterMap[\"node\"];\ntype ParentNode = DefaultTreeAdapterMap[\"parentNode\"];\n\n/**\n * spec/rules/modes.md 3.6, exhaustive and **closed**: extending it is a spec change, not an\n * implementation decision. `svg` and `math` are here because in MathML a quotation mark, a\n * hyphen and a prime are operators and identifiers — substituting a curly glyph changes what\n * the expression means. Everything not listed is processable, **including unknown and custom\n * elements**: guessing from a tag name is exactly the heuristic that diverges across runtimes.\n */\nconst SKIPPED_ELEMENTS: ReadonlySet<string> = new Set([\n \"code\",\n \"pre\",\n \"kbd\",\n \"samp\",\n \"var\",\n \"script\",\n \"style\",\n \"textarea\",\n \"svg\",\n \"math\",\n]);\n\nexport function isSkippedElement(tagName: string): boolean {\n return SKIPPED_ELEMENTS.has(tagName);\n}\n\nconst AMPERSAND = 0x26;\nconst SEMICOLON = 0x3b;\nconst HASH = 0x23;\nconst LOWER_X = 0x78;\nconst UPPER_X = 0x58;\n\n/** Longest named reference in the WHATWG table is 32 characters; the guard is a bound, not a rule. */\nconst MAX_REFERENCE_BODY = 34;\n\nfunction isAsciiDigit(unit: number): boolean {\n return unit >= 0x30 && unit <= 0x39;\n}\n\nfunction isAsciiHexDigit(unit: number): boolean {\n return isAsciiDigit(unit) || (unit >= 0x61 && unit <= 0x66) || (unit >= 0x41 && unit <= 0x46);\n}\n\nfunction isAsciiAlphanumeric(unit: number): boolean {\n return isAsciiDigit(unit) || (unit >= 0x61 && unit <= 0x7a) || (unit >= 0x41 && unit <= 0x5a);\n}\n\n/**\n * The end offset of a well-formed character reference starting at `at`, or -1. A bare `&` that a\n * parser would repair is deliberately **not** treated as a reference: it stays inside the span,\n * where no rule can emit or delete it, rather than manufacturing a boundary that suppresses\n * conversions around it.\n */\nfunction characterReferenceEnd(source: string, at: number, limit: number): number {\n if (source.charCodeAt(at) !== AMPERSAND) return -1;\n let i = at + 1;\n if (i >= limit) return -1;\n\n if (source.charCodeAt(i) === HASH) {\n i += 1;\n const unit = i < limit ? source.charCodeAt(i) : -1;\n const hex = unit === LOWER_X || unit === UPPER_X;\n if (hex) i += 1;\n const digitsAt = i;\n while (\n i < limit &&\n (hex ? isAsciiHexDigit(source.charCodeAt(i)) : isAsciiDigit(source.charCodeAt(i)))\n ) {\n i += 1;\n }\n if (i === digitsAt) return -1;\n return i < limit && source.charCodeAt(i) === SEMICOLON ? i + 1 : -1;\n }\n\n const nameAt = i;\n while (\n i < limit &&\n i - nameAt < MAX_REFERENCE_BODY &&\n isAsciiAlphanumeric(source.charCodeAt(i))\n ) {\n i += 1;\n }\n if (i === nameAt) return -1;\n return i < limit && source.charCodeAt(i) === SEMICOLON ? i + 1 : -1;\n}\n\n/**\n * modes.md 3.6: every character reference is skipped as an **opaque unit**, and a text node\n * containing one is split into spans around it. That is the only way `&nbsp;` survives as\n * `&nbsp;` instead of becoming a literal U+00A0 on the way out.\n */\nexport function splitCharacterReferences(source: string, start: number, end: number): Span[] {\n const spans: Span[] = [];\n let cursor = start;\n let i = start;\n while (i < end) {\n if (source.charCodeAt(i) === AMPERSAND) {\n const stop = characterReferenceEnd(source, i, end);\n if (stop > 0) {\n if (i > cursor) spans.push({ start: cursor, end: i });\n cursor = stop;\n i = stop;\n continue;\n }\n }\n i += 1;\n }\n if (end > cursor) spans.push({ start: cursor, end });\n return spans;\n}\n\nfunction isParent(node: Node): node is ParentNode {\n return \"childNodes\" in node;\n}\n\nfunction collect(node: Node, source: string, spans: Span[]): void {\n if (node.nodeName === \"#text\") {\n const location = node.sourceCodeLocation;\n if (location === undefined || location === null) return;\n for (const span of splitCharacterReferences(source, location.startOffset, location.endOffset)) {\n spans.push(span);\n }\n return;\n }\n\n // Comments, doctype and processing instructions never contribute a span (modes.md 3.6).\n if (node.nodeName === \"#comment\" || node.nodeName === \"#documentType\") return;\n\n if (\"tagName\" in node && isSkippedElement(node.tagName)) return;\n\n // A `template`'s children live in a separate document fragment; `template` is not skipped.\n if (node.nodeName === \"template\" && \"content\" in node) {\n collect(node.content, source, spans);\n return;\n }\n\n if (!isParent(node)) return;\n for (const child of node.childNodes) collect(child, source, spans);\n}\n\n/**\n * Locate the processable spans of an HTML document. The tree is used only to find offsets and is\n * then discarded — modes.md 4 forbids reserialisation, which is what makes attribute quoting,\n * self-closing forms, entity spelling, tag case and malformed-input recovery preserved by\n * construction rather than by effort.\n */\nexport function htmlSpans(source: string): Span[] {\n const document = wrapParserErrors(\"HTML\", () => parse(source, { sourceCodeLocationInfo: true }));\n const spans: Span[] = [];\n collect(document, source, spans);\n return spans;\n}\n\n/** The same, for a fragment: used for HTML blocks embedded in markdown (modes.md 3.7). */\nexport function htmlFragmentSpans(source: string, offset: number): Span[] {\n const fragment = wrapParserErrors(\"HTML\", () =>\n parseFragment(source, { sourceCodeLocationInfo: true }),\n );\n const spans: Span[] = [];\n collect(fragment, source, spans);\n return offset === 0\n ? spans\n : spans.map((span) => ({ start: span.start + offset, end: span.end + offset }));\n}\n","import { PolytypoError } from \"../errors.js\";\n\ninterface PositionedError {\n readonly reason?: unknown;\n readonly place?: { readonly line?: unknown; readonly column?: unknown } | null;\n}\n\nfunction describe(error: unknown): string {\n if (typeof error !== \"object\" || error === null) return String(error);\n const positioned = error as PositionedError;\n const reason =\n typeof positioned.reason === \"string\" ? positioned.reason : (error as Error).message;\n const place = positioned.place;\n if (\n place !== null &&\n place !== undefined &&\n typeof place.line === \"number\" &&\n typeof place.column === \"number\"\n ) {\n return `${reason} (line ${place.line}, column ${place.column})`;\n }\n return reason;\n}\n\n/**\n * spec/rules/modes.md 3.7.2. **The parser's own error type must never escape.** A\n * `VFileMessage`, a `Nokogiri::SyntaxError` or a Python exception on the public surface puts a\n * dependency's type into the contract and is unreproducible in the other four runtimes; only the\n * code is contractual (ARCHITECTURE.md 4.6), while the message and the source position are\n * useful and are not.\n *\n * Reachable in exactly one place: `dialect: \"mdx\"`, because MDX embeds JavaScript. HTML parsing\n * is specified with total error recovery and every byte sequence is valid CommonMark, so neither\n * of the other two languages can fail. The wrapper is applied to all of them anyway — the\n * guarantee is that no parser type escapes, not that this particular parser is trusted.\n */\nexport function wrapParserErrors<T>(what: string, run: () => T): T {\n try {\n return run();\n } catch (error) {\n if (error instanceof PolytypoError) throw error;\n throw new PolytypoError(\n \"POLYTYPO_MALFORMED_INPUT\",\n `Input does not parse as ${what}: ${describe(error)}`,\n );\n }\n}\n"]}
@@ -78,33 +78,33 @@ var ALIASES = {
78
78
  pt: "pt-PT"
79
79
  };
80
80
  var LOCALES = {
81
- bg: { locale: "bg", name: "Bulgarian", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["\u043A\u043C", "\u043A\u0433", "\u043B\u0432.", "\u0433."], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
82
- cs: { locale: "cs", name: "Czech", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["a", "i", "k", "o", "s", "u", "v", "z"], abbreviations: ["a. s.", "s. r. o."], beforeUnits: ["%", "\xB0C", "ha", "kg", "km", "cm", "mm", "m\xB2", "kWh", "km/h", "str.", "hod."], beforeNumber: [], beforeWord: ["tj.", "tzv.", "tzn."], afterSymbols: ["\xA7"], initialBinding: "single" } },
83
- "de-CH": { locale: "de-CH", name: "German (Switzerland)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u2039", close: "\u203A", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["z. B.", "d. h.", "u. a.", "u. U.", "m. a. W.", "m. w. H."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["Art.", "Abs.", "Ziff.", "Kap.", "S."], beforeWord: ["St."], afterSymbols: ["\xA7", "\xA7\xA7"], initialBinding: "chain" } },
84
- "de-DE": { locale: "de-DE", name: "German (Germany)", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["z. B.", "d. h.", "u. a.", "u. \xC4.", "z. T.", "i. d. R."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["Nr.", "S."], beforeWord: ["St."], afterSymbols: ["\xA7", "\xA7\xA7"], initialBinding: "chain" } },
85
- el: { locale: "el", name: "Greek", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-paired", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: [], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
86
- "en-GB": { locale: "en-GB", name: "English (United Kingdom)", quotes: { primary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: ["s"] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "kg", "g", "mg", "km", "m", "cm", "mm", "mi", "ft", "lb", "oz", "L", "mL", "h", "min", "s", "ms", "\xB0C", "\xB0F", "kB", "MB", "GB", "TB", "kW", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
87
- "en-US": { locale: "en-US", name: "English (United States)", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [{ left: "rock", elided: "n", right: "roll" }], elisionClitics: { before: [], after: ["s"] }, punctuationPlacement: "inside" }, dash: { parenthetical: "em-tight", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "kg", "g", "mg", "km", "m", "cm", "mm", "mi", "ft", "lb", "oz", "L", "mL", "h", "min", "s", "ms", "\xB0C", "\xB0F", "kB", "MB", "GB", "TB", "kW", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "chain" } },
88
- es: { locale: "es", name: "Spanish", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-paired", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ej.", "a. C.", "d. C.", "EE. UU.", "FF. AA.", "N. del T.", "q. e. p. d.", "et al."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "mg", "mL", "min", "dB", "kW", "kWh"], beforeNumber: ["art.", "cap.", "n\xFAm.", "nro.", "p\xE1g.", "p\xE1gs."], beforeWord: ["Sr.", "Sra.", "Srta."], afterSymbols: [], initialBinding: "chain" } },
89
- fi: { locale: "fi", name: "Finnish", quotes: { primary: { open: "\u201D", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["fil. maist."], beforeUnits: ["%", "\u2030", "\xA7", "kg", "g", "mg", "km", "m", "cm", "mm", "l", "dl", "cl", "ml", "h", "min", "s", "ms", "\xB0C", "kW", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
90
- fr: { locale: "fr", name: "French (France)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "nbsp" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "j", "m", "t", "s", "c", "qu", "jusqu", "d", "n", "lorsqu", "puisqu", "quoiqu"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [":"], narrowBeforePunctuation: [";", "!", "?"], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["art.", "fig.", "n\xB0", "N\xB0"], beforeWord: ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"], afterSymbols: ["\xA7"], initialBinding: "single" } },
91
- "fr-CA": { locale: "fr-CA", name: "French (Canada)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "nbsp" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "j", "m", "t", "s", "c", "qu", "jusqu", "d", "n", "lorsqu", "puisqu", "quoiqu"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [":"], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["art.", "fig.", "n\xB0", "N\xB0"], beforeWord: ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"], afterSymbols: ["\xA7"], initialBinding: "single" } },
92
- hr: { locale: "hr", name: "Croatian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["dipl. ing.", "d. o. o."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "kg"], beforeNumber: ["str."], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
93
- hu: { locale: "hu", name: "Hungarian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xBB", close: "\xAB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["a. m.", "i. sz.", "Kr. e.", "Kr. u.", "s. k.", "i. e."], beforeUnits: ["km", "kg", "kWh", "km/h", "\xB0C"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
94
- it: { locale: "it", name: "Italian", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "un", "d"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["n.", "pag."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
95
- lt: { locale: "lt", name: "Lithuanian", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["t. y.", "t. t.", "\u0161. m."], beforeUnits: ["%", "proc.", "\xB0C", "kg", "km", "cm", "mm", "EUR", "Eur", "\u20AC", "mln.", "val.", "min.", "m.", "d."], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
96
- nl: { locale: "nl", name: "Dutch", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: ["s", "t", "ns", "k", "m", "em", "r", "et"] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["prof. dr."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: ["\u20AC", "$"], initialBinding: "none" } },
97
- pl: { locale: "pl", name: "Polish", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xBB", close: "\xAB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["a", "i", "o", "u", "w", "z"], abbreviations: ["lek. med.", "in\u017C. g\xF3rn.", "bp sufr."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
98
- "pt-BR": { locale: "pt-BR", name: "Portuguese (Brazil)", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["d", "n", "pel", "m", "t", "lh", "sant"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "kW", "kWh", "Hz"], beforeNumber: ["p."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
99
- "pt-PT": { locale: "pt-PT", name: "Portuguese (Portugal)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["d", "n", "pel", "m", "t", "lh", "sant"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "kW", "kWh", "Hz"], beforeNumber: ["p."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
100
- ro: { locale: "ro", name: "Romanian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["km", "kg", "cm", "mm", "km/h", "\xB0C"], beforeNumber: ["art.", "nr."], beforeWord: [], afterSymbols: [], initialBinding: "single" } },
101
- ru: { locale: "ru", name: "Russian", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "em-tight" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: ["\u043A\u043E\u0435-", "\u043A\u043E\u0439-"], suffixes: ["-\u0442\u043E", "-\u043B\u0438\u0431\u043E", "-\u043D\u0438\u0431\u0443\u0434\u044C", "-\u0442\u0430\u043A\u0438", "-\u043A\u0430"], compounds: ["\u0438\u0437-\u0437\u0430", "\u0438\u0437-\u043F\u043E\u0434"] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["\u0430", "\u0432", "\u0438", "\u043A", "\u043E", "\u0441", "\u0443", "\u0432\u043E", "\u0434\u043E", "\u0437\u0430", "\u0438\u0437", "\u043A\u043E", "\u043D\u0430", "\u043E\u0431", "\u043E\u0442", "\u043F\u043E", "\u0441\u043E"], abbreviations: ["\u0438 \u0442. \u0434.", "\u0438 \u0442. \u043F.", "\u0442. \u0435.", "\u0438 \u0434\u0440."], beforeUnits: ["%", "\u2030", "\u20BD", "\xB0C", "\u043A\u043C", "\u0441\u043C", "\u043C\u043C", "\u043A\u0433", "\u0433.", "\u0433\u0433.", "\u0432.", "\u0432\u0432.", "\u0442\u044B\u0441.", "\u043C\u043B\u043D", "\u043C\u043B\u0440\u0434"], beforeNumber: [], beforeWord: ["\u0443\u043B.", "\u043F\u043B."], afterSymbols: ["\u2116", "\xA7"], initialBinding: "chain" } },
102
- sk: { locale: "sk", name: "Slovak", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["t. j.", "a pod.", "a. s."], beforeUnits: ["%", "\u2030", "kg", "km", "km/s", "m/s", "min"], beforeNumber: ["\u010D.", "ods.", "s."], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
103
- sl: { locale: "sl", name: "Slovenian", quotes: { primary: { open: "\xBB", close: "\xAB", innerSpace: "none" }, secondary: { open: "\u203A", close: "\u2039", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["t. i."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "kg", "km"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
104
- sr: { locale: "sr", name: "Serbian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["kg", "cm", "mm", "\xB0C"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
105
- sv: { locale: "sv", name: "Swedish", quotes: { primary: { open: "\u201D", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "\u2030", "kr", "\u20AC", "kg", "g", "mg", "km", "m", "cm", "mm", "l", "dl", "cl", "ml", "kW", "kWh", "min", "sek", "tim", "h", "\xB0C"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
106
- tr: { locale: "tr", name: "Turkish", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: ["nin", "n\u0131n", "de", "da", "te", "ye", "yle", "n\u0131", "dan", "den", "lik", "nci", "\xFCm"] }, punctuationPlacement: "none" }, dash: { parenthetical: "none", range: "none" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["Kur. B\u015Fk.", "N\xF6. Sb."], beforeUnits: ["mm", "cm", "km", "kg", "mg", "hl", "m\xB2", "cm\xB2", "\xB0C", "ton"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
107
- uk: { locale: "uk", name: "Ukrainian", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "em-tight" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: ["\u0431\u0443\u0434\u044C-", "\u043A\u0430\u0437\u043D\u0430-", "\u0445\u0442\u043E\u0437\u043D\u0430-", "\u0431\u043E\u0437\u043D\u0430-"], suffixes: ["-\u0431\u043E", "-\u043D\u043E", "-\u043E\u0442", "-\u0442\u043E", "-\u0442\u0430\u043A\u0438", "-\u0431\u0443\u0434\u044C", "-\u043D\u0435\u0431\u0443\u0434\u044C"], compounds: ["\u0432\u0438\u0434-\u0432\u043E", "\u0433\u0440-\u043D", "\u0456\u043D-\u0442", "\u0440-\u043D", "\u0443\u043D-\u0442", "\u0444-\u043A\u0430", "\u0442-\u0432\u043E", "\u0437-\u0437\u0430", "\u0456\u0437-\u0437\u0430", "\u0437-\u043D\u0430\u0434", "\u0437-\u043F\u0435\u0440\u0435\u0434", "\u0437-\u043F\u0456\u0434", "\u0456\u0437-\u043F\u0456\u0434", "\u0437-\u043F\u043E\u0437\u0430", "\u0437-\u043F\u043E\u043C\u0456\u0436", "\u0437-\u043F\u043E\u043D\u0430\u0434", "\u0437-\u043F\u043E\u043F\u0456\u0434", "\u0437-\u043F\u043E\u0441\u0435\u0440\u0435\u0434", "\u0437-\u043F\u0440\u043E\u043C\u0456\u0436"] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["\u0456 \u0442. \u0434.", "\u0456 \u0442. \u0456\u043D.", "\u0442\u0430 \u0456\u043D.", "\u043A\u0443\u0431. \u0441\u043C"], beforeUnits: ["%", "\u0433\u0430", "\u0433\u043E\u0434", "\u0434\u043C", "\u043A\u0411", "\u043A\u0412\u0442", "\u043A\u0433", "\u043A\u043C", "\u043C\u043C", "\u0441\u043C", "\u0445\u0432", "\u0412\u0442", "\u043A\u043C/\u0433\u043E\u0434", "\u043C/\u0441", "\u043C\u043B\u043D", "\u043C\u043B\u0440\u0434", "\u0442\u0440\u043B\u043D", "\u0433\u0440\u043D", "\u0440."], beforeNumber: [], beforeWord: ["\u0430\u043A\u0430\u0434.", "\u0434\u043E\u0446.", "\u043F\u0440\u043E\u0444."], afterSymbols: [], initialBinding: "chain" } }
81
+ bg: { locale: "bg", name: "Bulgarian", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: [], spacedUnits: ["\u043A\u043C", "\u043A\u0433", "\u043B\u0432.", "\u0433."], closedUnits: ["%"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
82
+ cs: { locale: "cs", name: "Czech", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["a", "i", "k", "o", "s", "u", "v", "z"], abbreviations: ["a. s.", "s. r. o."], beforeUnits: ["%", "\xB0C", "ha", "kg", "km", "cm", "mm", "m\xB2", "kWh", "km/h", "str.", "hod."], spacedUnits: [], closedUnits: [], beforeNumber: [], beforeWord: ["tj.", "tzv.", "tzn."], afterSymbols: ["\xA7"], initialBinding: "single" } },
83
+ "de-CH": { locale: "de-CH", name: "German (Switzerland)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u2039", close: "\u203A", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["z. B.", "d. h.", "u. a.", "u. U.", "m. a. W.", "m. w. H."], beforeUnits: [], spacedUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], closedUnits: [], beforeNumber: ["Art.", "Abs.", "Ziff.", "Kap.", "S."], beforeWord: ["St."], afterSymbols: ["\xA7", "\xA7\xA7"], initialBinding: "chain" } },
84
+ "de-DE": { locale: "de-DE", name: "German (Germany)", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["z. B.", "d. h.", "u. a.", "u. \xC4.", "z. T.", "i. d. R."], beforeUnits: ["\u2030"], spacedUnits: ["%", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], closedUnits: [], beforeNumber: ["Nr.", "S."], beforeWord: ["St."], afterSymbols: ["\xA7", "\xA7\xA7"], initialBinding: "chain" } },
85
+ el: { locale: "el", name: "Greek", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-paired", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: [], spacedUnits: [], closedUnits: ["%", "\xB0C"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
86
+ "en-GB": { locale: "en-GB", name: "English (United Kingdom)", quotes: { primary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: ["s"] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["kg", "g", "mg", "km", "m", "cm", "mm", "mi", "ft", "lb", "oz", "L", "mL", "h", "min", "s", "ms", "kB", "MB", "GB", "TB", "kW", "kWh"], spacedUnits: [], closedUnits: ["%", "\xB0C", "\xB0F"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
87
+ "en-US": { locale: "en-US", name: "English (United States)", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [{ left: "rock", elided: "n", right: "roll" }], elisionClitics: { before: [], after: ["s"] }, punctuationPlacement: "inside" }, dash: { parenthetical: "em-tight", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["g", "m", "L", "h", "s", "\xB0C", "\xB0F"], spacedUnits: ["kg", "mg", "km", "cm", "mm", "mi", "ft", "lb", "oz", "mL", "ms", "min", "kB", "MB", "GB", "TB", "kW", "kWh"], closedUnits: ["%"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "chain" } },
88
+ es: { locale: "es", name: "Spanish", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-paired", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ej.", "a. C.", "d. C.", "EE. UU.", "FF. AA.", "N. del T.", "q. e. p. d.", "et al."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "mg", "mL", "min", "dB", "kW", "kWh"], spacedUnits: [], closedUnits: [], beforeNumber: ["art.", "cap.", "n\xFAm.", "nro.", "p\xE1g.", "p\xE1gs."], beforeWord: ["Sr.", "Sra.", "Srta."], afterSymbols: [], initialBinding: "chain" } },
89
+ fi: { locale: "fi", name: "Finnish", quotes: { primary: { open: "\u201D", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["fil. maist."], beforeUnits: ["\xA7", "kg", "g", "mg", "km", "m", "cm", "mm", "l", "dl", "cl", "ml", "h", "min", "s", "ms", "kW", "kWh"], spacedUnits: ["%", "\u2030", "\xB0C", "\xB0F"], closedUnits: [], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
90
+ fr: { locale: "fr", name: "French (France)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "nbsp" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "j", "m", "t", "s", "c", "qu", "jusqu", "d", "n", "lorsqu", "puisqu", "quoiqu"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [":"], narrowBeforePunctuation: [";", "!", "?"], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["\u2030", "km", "cm", "mm", "kg", "km/h", "kWh"], spacedUnits: ["%", "\u20AC", "\xB0C"], closedUnits: [], beforeNumber: ["art.", "fig.", "n\xB0", "N\xB0"], beforeWord: ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"], afterSymbols: ["\xA7"], initialBinding: "single" } },
91
+ "fr-CA": { locale: "fr-CA", name: "French (Canada)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "nbsp" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "j", "m", "t", "s", "c", "qu", "jusqu", "d", "n", "lorsqu", "puisqu", "quoiqu"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [":"], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["\u2030"], spacedUnits: ["%", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh", "$", "\xB0F"], closedUnits: [], beforeNumber: ["art.", "fig.", "n\xB0", "N\xB0"], beforeWord: ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"], afterSymbols: ["\xA7"], initialBinding: "single" } },
92
+ hr: { locale: "hr", name: "Croatian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["dipl. ing.", "d. o. o."], beforeUnits: [], spacedUnits: ["%", "\u2030", "\u20AC", "\xB0C", "kg"], closedUnits: [], beforeNumber: ["str."], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
93
+ hu: { locale: "hu", name: "Hungarian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xBB", close: "\xAB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["a. m.", "i. sz.", "Kr. e.", "Kr. u.", "s. k.", "i. e."], beforeUnits: [], spacedUnits: ["km", "kg", "kWh", "km/h", "\xB0C"], closedUnits: ["%"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
94
+ it: { locale: "it", name: "Italian", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "un", "d"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], spacedUnits: [], closedUnits: [], beforeNumber: ["n.", "pag."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
95
+ lt: { locale: "lt", name: "Lithuanian", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["t. y.", "t. t.", "\u0161. m."], beforeUnits: ["cm", "mm", "m.", "d."], spacedUnits: ["%", "proc.", "\xB0C", "kg", "km", "EUR", "Eur", "\u20AC", "mln.", "val.", "min.", "km/h", "m/s", "ha"], closedUnits: [], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
96
+ nl: { locale: "nl", name: "Dutch", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: ["s", "t", "ns", "k", "m", "em", "r", "et"] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["prof. dr."], beforeUnits: ["\xB0C", "km/h", "kWh"], spacedUnits: ["km", "cm", "mm", "kg"], closedUnits: ["%", "\u2030"], beforeNumber: [], beforeWord: [], afterSymbols: ["\u20AC", "$"], initialBinding: "none" } },
97
+ pl: { locale: "pl", name: "Polish", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xBB", close: "\xAB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["a", "i", "o", "u", "w", "z"], abbreviations: ["lek. med.", "in\u017C. g\xF3rn.", "bp sufr."], beforeUnits: ["\u2030", "\xB0C"], spacedUnits: ["km", "cm", "mm", "kg", "km/h", "kWh"], closedUnits: ["%"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
98
+ "pt-BR": { locale: "pt-BR", name: "Portuguese (Brazil)", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["d", "n", "pel", "m", "t", "lh", "sant"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030"], spacedUnits: ["\xB0C", "km", "cm", "mm", "kg", "kW", "kWh", "Hz"], closedUnits: [], beforeNumber: ["p."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
99
+ "pt-PT": { locale: "pt-PT", name: "Portuguese (Portugal)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["d", "n", "pel", "m", "t", "lh", "sant"], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["\u2030", "kWh"], spacedUnits: ["%", "\xB0C", "km", "cm", "mm", "kg", "kW", "Hz"], closedUnits: [], beforeNumber: ["p."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
100
+ ro: { locale: "ro", name: "Romanian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["km", "kg", "cm", "mm", "km/h", "\xB0C"], spacedUnits: [], closedUnits: [], beforeNumber: ["art.", "nr."], beforeWord: [], afterSymbols: [], initialBinding: "single" } },
101
+ ru: { locale: "ru", name: "Russian", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "em-tight" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: ["\u043A\u043E\u0435-", "\u043A\u043E\u0439-"], suffixes: ["-\u0442\u043E", "-\u043B\u0438\u0431\u043E", "-\u043D\u0438\u0431\u0443\u0434\u044C", "-\u0442\u0430\u043A\u0438", "-\u043A\u0430"], compounds: ["\u0438\u0437-\u0437\u0430", "\u0438\u0437-\u043F\u043E\u0434"] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["\u0430", "\u0432", "\u0438", "\u043A", "\u043E", "\u0441", "\u0443", "\u0432\u043E", "\u0434\u043E", "\u0437\u0430", "\u0438\u0437", "\u043A\u043E", "\u043D\u0430", "\u043E\u0431", "\u043E\u0442", "\u043F\u043E", "\u0441\u043E"], abbreviations: ["\u0438 \u0442. \u0434.", "\u0438 \u0442. \u043F.", "\u0442. \u0435.", "\u0438 \u0434\u0440."], beforeUnits: ["\u2030", "\u20BD", "\u0433.", "\u0433\u0433.", "\u0432.", "\u0432\u0432.", "\u0442\u044B\u0441.", "\u043C\u043B\u043D", "\u043C\u043B\u0440\u0434"], spacedUnits: ["\xB0C", "\u043A\u043C", "\u0441\u043C", "\u043C\u043C", "\u043A\u0433"], closedUnits: ["%"], beforeNumber: [], beforeWord: ["\u0443\u043B.", "\u043F\u043B."], afterSymbols: ["\u2116", "\xA7"], initialBinding: "chain" } },
102
+ sk: { locale: "sk", name: "Slovak", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["t. j.", "a pod.", "a. s."], beforeUnits: ["kg", "km", "km/s", "m/s", "min"], spacedUnits: ["%", "\u2030"], closedUnits: [], beforeNumber: ["\u010D.", "ods.", "s."], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
103
+ sl: { locale: "sl", name: "Slovenian", quotes: { primary: { open: "\xBB", close: "\xAB", innerSpace: "none" }, secondary: { open: "\u203A", close: "\u2039", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["t. i."], beforeUnits: ["\u20AC", "km"], spacedUnits: ["%", "\u2030", "\xB0C", "kg"], closedUnits: [], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
104
+ sr: { locale: "sr", name: "Serbian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: [], spacedUnits: ["kg", "cm", "mm", "\xB0C"], closedUnits: ["%"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
105
+ sv: { locale: "sv", name: "Swedish", quotes: { primary: { open: "\u201D", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["g", "mg", "m", "cm", "mm", "l", "dl", "cl", "ml", "kW", "kWh", "min", "sek", "tim", "h", "\xB0C"], spacedUnits: ["%", "\u2030", "kr", "\u20AC", "km", "kg"], closedUnits: [], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
106
+ tr: { locale: "tr", name: "Turkish", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: ["nin", "n\u0131n", "de", "da", "te", "ye", "yle", "n\u0131", "dan", "den", "lik", "nci", "\xFCm"] }, punctuationPlacement: "none" }, dash: { parenthetical: "none", range: "none" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["Kur. B\u015Fk.", "N\xF6. Sb."], beforeUnits: [], spacedUnits: ["mm", "cm", "km", "kg", "mg", "hl", "m\xB2", "cm\xB2", "\xB0C", "ton"], closedUnits: [], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
107
+ uk: { locale: "uk", name: "Ukrainian", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] }, punctuationPlacement: "none" }, dash: { parenthetical: "em-spaced", range: "em-tight" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: ["\u0431\u0443\u0434\u044C-", "\u043A\u0430\u0437\u043D\u0430-", "\u0445\u0442\u043E\u0437\u043D\u0430-", "\u0431\u043E\u0437\u043D\u0430-"], suffixes: ["-\u0431\u043E", "-\u043D\u043E", "-\u043E\u0442", "-\u0442\u043E", "-\u0442\u0430\u043A\u0438", "-\u0431\u0443\u0434\u044C", "-\u043D\u0435\u0431\u0443\u0434\u044C"], compounds: ["\u0432\u0438\u0434-\u0432\u043E", "\u0433\u0440-\u043D", "\u0456\u043D-\u0442", "\u0440-\u043D", "\u0443\u043D-\u0442", "\u0444-\u043A\u0430", "\u0442-\u0432\u043E", "\u0437-\u0437\u0430", "\u0456\u0437-\u0437\u0430", "\u0437-\u043D\u0430\u0434", "\u0437-\u043F\u0435\u0440\u0435\u0434", "\u0437-\u043F\u0456\u0434", "\u0456\u0437-\u043F\u0456\u0434", "\u0437-\u043F\u043E\u0437\u0430", "\u0437-\u043F\u043E\u043C\u0456\u0436", "\u0437-\u043F\u043E\u043D\u0430\u0434", "\u0437-\u043F\u043E\u043F\u0456\u0434", "\u0437-\u043F\u043E\u0441\u0435\u0440\u0435\u0434", "\u0437-\u043F\u0440\u043E\u043C\u0456\u0436"] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["\u0456 \u0442. \u0434.", "\u0456 \u0442. \u0456\u043D.", "\u0442\u0430 \u0456\u043D.", "\u043A\u0443\u0431. \u0441\u043C"], beforeUnits: ["%", "\u0433\u0430", "\u0433\u043E\u0434", "\u0434\u043C", "\u043A\u0411", "\u043A\u0412\u0442", "\u043A\u0433", "\u043A\u043C", "\u043C\u043C", "\u0441\u043C", "\u0445\u0432", "\u0412\u0442", "\u043A\u043C/\u0433\u043E\u0434", "\u043C/\u0441", "\u043C\u043B\u043D", "\u043C\u043B\u0440\u0434", "\u0442\u0440\u043B\u043D", "\u0433\u0440\u043D", "\u0440."], spacedUnits: [], closedUnits: [], beforeNumber: [], beforeWord: ["\u0430\u043A\u0430\u0434.", "\u0434\u043E\u0446.", "\u043F\u0440\u043E\u0444."], afterSymbols: [], initialBinding: "chain" } }
108
108
  };
109
109
 
110
110
  // src/engine/locale.ts
@@ -4637,6 +4637,19 @@ function prepareList(entries) {
4637
4637
  out.sort((a, b) => b.length - a.length);
4638
4638
  return out;
4639
4639
  }
4640
+ function prepareUnits(data) {
4641
+ const out = [];
4642
+ const lists = [
4643
+ [data.beforeUnits, "before"],
4644
+ [data.spacedUnits, "spaced"],
4645
+ [data.closedUnits, "closed"]
4646
+ ];
4647
+ for (const [entries, kind] of lists) {
4648
+ for (const entry of entries) out.push({ w: toCodePoints(entry), kind });
4649
+ }
4650
+ out.sort((a, b) => b.w.length - a.w.length);
4651
+ return out;
4652
+ }
4640
4653
  function prepare(locale, narrowTarget = NNBSP) {
4641
4654
  const data = locale.nbsp;
4642
4655
  const beforePunctuation = data.beforePunctuation.map(
@@ -4681,7 +4694,7 @@ function prepare(locale, narrowTarget = NNBSP) {
4681
4694
  narrowBeforePunctuation,
4682
4695
  shortWords: prepareList(data.afterShortWords),
4683
4696
  abbreviations: prepareList(data.abbreviations),
4684
- units: prepareList(data.beforeUnits),
4697
+ units: prepareUnits(data),
4685
4698
  beforeNumber: prepareList(data.beforeNumber),
4686
4699
  beforeWord: prepareList(data.beforeWord),
4687
4700
  symbols: prepareList(data.afterSymbols),
@@ -4811,21 +4824,114 @@ function abbreviationsSubRule(cp, prep, claims) {
4811
4824
  }
4812
4825
  }
4813
4826
  }
4827
+ var NUMBER_PREFIXES = /* @__PURE__ */ new Set([43, 177, 215, 8722, 126, 8776, 60, 62, 8288]);
4828
+ var HYPHEN_MINUS3 = 45;
4829
+ var NON_BREAKING_HYPHEN2 = 8209;
4830
+ var LOW_LINE = 95;
4831
+ var COMMA2 = 44;
4832
+ var WORD_JOINER2 = 8288;
4833
+ function isClosedSymbol(cp) {
4834
+ return cp === 36 || cp >= 162 && cp <= 165 || cp >= 8352 && cp <= 8399 || cp === 37 || cp === 8240 || cp === 8241 || cp === 176;
4835
+ }
4836
+ function isAnyDash(cp) {
4837
+ return cp === 45 || cp === 8208 || cp === 8211 || cp === 8212 || cp === 8722 || cp === 173 || cp === 8209 || cp === 8210 || cp === 8213 || cp === 65112 || cp === 65123 || cp === 65293;
4838
+ }
4839
+ function nearestBeyond(cp, from, step) {
4840
+ let i = from;
4841
+ while (i >= 0 && i < cp.length) {
4842
+ const c = cp[i];
4843
+ if (c === WORD_JOINER2 || isSpaceLike(c) && !isBreak2(c)) {
4844
+ i += step;
4845
+ continue;
4846
+ }
4847
+ return c;
4848
+ }
4849
+ return NONE;
4850
+ }
4851
+ function numberStart(cp, end) {
4852
+ let b = end;
4853
+ while (b - 1 >= 0 && isDigit4(cp[b - 1])) b -= 1;
4854
+ while ((at4(cp, b - 1) === COMMA2 || at4(cp, b - 1) === FULL_STOP2) && isDigit4(at4(cp, b - 2))) {
4855
+ b -= 2;
4856
+ while (b - 1 >= 0 && isDigit4(cp[b - 1])) b -= 1;
4857
+ }
4858
+ return b;
4859
+ }
4860
+ function numberStartIsClean(cp, prep, b) {
4861
+ const c = at4(cp, b - 1);
4862
+ if (c === NONE || isSpaceLike(c) || isOpenish(prep, c) || isSentenceDash(c)) return true;
4863
+ if (NUMBER_PREFIXES.has(c)) return true;
4864
+ if (c !== HYPHEN_MINUS3) return false;
4865
+ const before = at4(cp, b - 2);
4866
+ return before === NONE || isSpaceLike(before) || isOpenish(prep, before);
4867
+ }
4868
+ function isMulSpace(cp) {
4869
+ return cp === SPACE2 || cp === NBSP || cp === NNBSP;
4870
+ }
4871
+ function isRightOperandOfMultiplication(cp, b) {
4872
+ let i = b - 1;
4873
+ if (isMulSpace(at4(cp, i))) i -= 1;
4874
+ const c = at4(cp, i);
4875
+ if (c !== 120 && c !== 88 && c !== 1093 && c !== 1061) return false;
4876
+ i -= 1;
4877
+ if (isMulSpace(at4(cp, i))) i -= 1;
4878
+ return isDigit4(at4(cp, i));
4879
+ }
4814
4880
  function unitsSubRule(cp, prep, claims) {
4815
4881
  if (prep.units.length === 0) return;
4816
4882
  for (let a = 0; a < cp.length; a += 1) {
4817
- const w = longestMatch(prep.units, cp, a, matchExact);
4818
- if (w === void 0) continue;
4819
- const k = w.length;
4883
+ let entry;
4884
+ for (const candidate of prep.units) {
4885
+ if (matchExact(cp, a, candidate.w)) {
4886
+ entry = candidate;
4887
+ break;
4888
+ }
4889
+ }
4890
+ if (entry === void 0) continue;
4891
+ const k = entry.w.length;
4820
4892
  if (isAlnum2(at4(cp, a + k))) continue;
4821
4893
  const left = at4(cp, a - 1);
4822
- if (left === NBSP) continue;
4823
- if (left !== SPACE2) continue;
4824
- if (!isDigit4(at4(cp, a - 2))) continue;
4825
- let b = a - 2;
4894
+ if (entry.kind === "before") {
4895
+ if (left === NBSP) continue;
4896
+ if (left !== SPACE2) continue;
4897
+ if (!isDigit4(at4(cp, a - 2))) continue;
4898
+ let b2 = a - 2;
4899
+ while (b2 - 1 >= 0 && isDigit4(cp[b2 - 1])) b2 -= 1;
4900
+ if (isLetter(at4(cp, b2 - 1))) continue;
4901
+ claimConversion(claims, a - 1, NBSP);
4902
+ continue;
4903
+ }
4904
+ const isClosed = entry.kind === "closed";
4905
+ const isSeparated = left === SPACE2 || left === NBSP || isClosed && left === NNBSP;
4906
+ const isTouching = isDigit4(left);
4907
+ if (!isSeparated && !(isTouching && !isClosed)) continue;
4908
+ if (!isClosed && left === NBSP) continue;
4909
+ const end = isSeparated ? a - 2 : a - 1;
4910
+ if (!isDigit4(at4(cp, end))) continue;
4911
+ let b = end;
4826
4912
  while (b - 1 >= 0 && isDigit4(cp[b - 1])) b -= 1;
4827
4913
  if (isLetter(at4(cp, b - 1))) continue;
4828
- claimConversion(claims, a - 1, NBSP);
4914
+ if (!isClosed && isSeparated) {
4915
+ if (left === SPACE2) claimConversion(claims, a - 1, NBSP);
4916
+ continue;
4917
+ }
4918
+ const start = numberStart(cp, end);
4919
+ if (!numberStartIsClean(cp, prep, start)) continue;
4920
+ if (isClosedSymbol(entry.w[0]) && (isAnyDash(nearestBeyond(cp, start - 1, -1)) || isAnyDash(nearestBeyond(cp, a + k, 1)))) {
4921
+ continue;
4922
+ }
4923
+ if (!isClosed && isRightOperandOfMultiplication(cp, start)) continue;
4924
+ const next = at4(cp, a + k);
4925
+ if (next === HYPHEN_MINUS3 || next === NON_BREAKING_HYPHEN2 || next === LOW_LINE) continue;
4926
+ if (next === FULL_STOP2 && isAlnum2(at4(cp, a + k + 1))) continue;
4927
+ if (isClosed) {
4928
+ if (next === SPACE2 && isDigit4(at4(cp, a + k + 1))) continue;
4929
+ if (claims[a - 1] === void 0) {
4930
+ claims[a - 1] = { start: a - 1, end: a, replacement: [], ruleId: "nbsp" };
4931
+ }
4932
+ } else {
4933
+ claimInsertion(claims, a, NBSP);
4934
+ }
4829
4935
  }
4830
4936
  }
4831
4937
  function symbolsSubRule(cp, prep, claims) {
@@ -4960,7 +5066,7 @@ var nbspRule = {
4960
5066
  };
4961
5067
 
4962
5068
  // src/rules/quote-punctuation.ts
4963
- var COMMA2 = 44;
5069
+ var COMMA3 = 44;
4964
5070
  var FULL_STOP3 = 46;
4965
5071
  var SPACELIKE2 = /* @__PURE__ */ new Set([
4966
5072
  32,
@@ -4995,7 +5101,7 @@ var quotePunctuationRule = {
4995
5101
  let i = 0;
4996
5102
  while (i + 1 < n) {
4997
5103
  const next = at5(cp, i + 1);
4998
- if (at5(cp, i) === close && (next === COMMA2 || next === FULL_STOP3) && i >= 1 && isLetter(at5(cp, i - 1)) && (at5(cp, i + 2) === NONE || SPACELIKE2.has(at5(cp, i + 2)))) {
5104
+ if (at5(cp, i) === close && (next === COMMA3 || next === FULL_STOP3) && i >= 1 && isLetter(at5(cp, i - 1)) && (at5(cp, i + 2) === NONE || SPACELIKE2.has(at5(cp, i + 2)))) {
4999
5105
  edits.push({
5000
5106
  start: i,
5001
5107
  end: i + 2,
@@ -5469,7 +5575,7 @@ var quotesRule = {
5469
5575
 
5470
5576
  // src/rules/ranges.ts
5471
5577
  var FULL_STOP4 = 46;
5472
- var COMMA3 = 44;
5578
+ var COMMA4 = 44;
5473
5579
  var SOLIDUS = 47;
5474
5580
  var DIGIT_ZERO6 = 48;
5475
5581
  function isNonDecreasing(cp, leftStart, rightStart, length) {
@@ -5488,7 +5594,7 @@ function rangeGuardsPass(cp, flanks) {
5488
5594
  if (isLetter(before)) return false;
5489
5595
  if (isDashUnion(before)) return false;
5490
5596
  if (isDashUnion(after)) return false;
5491
- if (before === FULL_STOP4 || before === COMMA3 || before === SOLIDUS) return false;
5597
+ if (before === FULL_STOP4 || before === COMMA4 || before === SOLIDUS) return false;
5492
5598
  if (after === SOLIDUS) return false;
5493
5599
  const leftLength = left - a + 1;
5494
5600
  const rightLength = b - right + 1;
@@ -5538,7 +5644,7 @@ var FF = 12;
5538
5644
  var NEL = 133;
5539
5645
  var LS = 8232;
5540
5646
  var PS = 8233;
5541
- var COMMA4 = 44;
5647
+ var COMMA5 = 44;
5542
5648
  var FULL_STOP5 = 46;
5543
5649
  var SEMICOLON2 = 59;
5544
5650
  var COLON = 58;
@@ -5551,7 +5657,7 @@ var SQUARE_OPEN2 = 91;
5551
5657
  var SQUARE_CLOSE2 = 93;
5552
5658
  var CURLY_OPEN = 123;
5553
5659
  var CURLY_CLOSE = 125;
5554
- var HYPHEN_MINUS3 = 45;
5660
+ var HYPHEN_MINUS4 = 45;
5555
5661
  var CARET = 94;
5556
5662
  var SOLIDUS2 = 47;
5557
5663
  var REVERSE_SOLIDUS = 92;
@@ -5573,7 +5679,7 @@ function isBreak3(cp) {
5573
5679
  return cp === LF || cp === CR || cp === VT || cp === FF || cp === NEL || cp === LS || cp === PS || cp === LINE_MARKER;
5574
5680
  }
5575
5681
  function isStripBefore(cp) {
5576
- return cp === COMMA4 || cp === FULL_STOP5 || cp === SEMICOLON2 || cp === COLON || cp === EXCLAMATION2 || cp === QUESTION2;
5682
+ return cp === COMMA5 || cp === FULL_STOP5 || cp === SEMICOLON2 || cp === COLON || cp === EXCLAMATION2 || cp === QUESTION2;
5577
5683
  }
5578
5684
  function isDotlike2(cp) {
5579
5685
  return cp === FULL_STOP5 || cp === ELLIPSIS2;
@@ -5609,7 +5715,7 @@ function isEmoticon(cp, e) {
5609
5715
  if (eye !== COLON && eye !== SEMICOLON2) return false;
5610
5716
  let i = e + 1;
5611
5717
  const nose = at8(cp, i);
5612
- if (nose === HYPHEN_MINUS3 || nose === CARET) i += 1;
5718
+ if (nose === HYPHEN_MINUS4 || nose === CARET) i += 1;
5613
5719
  if (!isEmoticonMouth(at8(cp, i))) return false;
5614
5720
  i += 1;
5615
5721
  const after = at8(cp, i);
@@ -5619,7 +5725,7 @@ function isEmoticonEnd(cp, s) {
5619
5725
  if (!isEmoticonMouth(at8(cp, s - 1))) return false;
5620
5726
  let j = s - 2;
5621
5727
  const nose = at8(cp, j);
5622
- if (nose === HYPHEN_MINUS3 || nose === CARET) j -= 1;
5728
+ if (nose === HYPHEN_MINUS4 || nose === CARET) j -= 1;
5623
5729
  const eye = at8(cp, j);
5624
5730
  return eye === COLON || eye === SEMICOLON2;
5625
5731
  }
@@ -5686,7 +5792,7 @@ var DIGIT_ZERO8 = 48;
5686
5792
  var DIGIT_NINE7 = 57;
5687
5793
  var PLUS = 43;
5688
5794
  var SOLIDUS3 = 47;
5689
- var HYPHEN_MINUS4 = 45;
5795
+ var HYPHEN_MINUS5 = 45;
5690
5796
  var PLUS_MINUS = 177;
5691
5797
  var SQUARE_OPEN3 = 91;
5692
5798
  function at9(cp, i) {
@@ -5799,7 +5905,7 @@ function chainEdits(cp, a, chain) {
5799
5905
  return edits;
5800
5906
  }
5801
5907
  function plusMinusAt(cp, i) {
5802
- if (at9(cp, i + 1) !== SOLIDUS3 || at9(cp, i + 2) !== HYPHEN_MINUS4) return null;
5908
+ if (at9(cp, i + 1) !== SOLIDUS3 || at9(cp, i + 2) !== HYPHEN_MINUS5) return null;
5803
5909
  if (at9(cp, i - 1) === SQUARE_OPEN3) return null;
5804
5910
  let j = i + 3;
5805
5911
  if (at9(cp, j) === SPACE4) j += 1;
@@ -6449,4 +6555,4 @@ export {
6449
6555
  runProtected,
6450
6556
  analyzeProtected
6451
6557
  };
6452
- //# sourceMappingURL=chunk-QXUC42OO.js.map
6558
+ //# sourceMappingURL=chunk-D6CWTH54.js.map