prosebook 0.0.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +604 -0
  3. package/dist/cli.d.ts +1 -0
  4. package/dist/cli.js +508 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/config-D--RITk2.js +1208 -0
  7. package/dist/config-D--RITk2.js.map +1 -0
  8. package/dist/config-_4HfnJQu.d.ts +517 -0
  9. package/dist/config-_4HfnJQu.d.ts.map +1 -0
  10. package/dist/config.d.ts +2 -0
  11. package/dist/config.js +1 -0
  12. package/dist/copy-DXnzXsJa.d.ts +162 -0
  13. package/dist/copy-DXnzXsJa.d.ts.map +1 -0
  14. package/dist/helpers-BPuPGjQP.js +61 -0
  15. package/dist/helpers-BPuPGjQP.js.map +1 -0
  16. package/dist/index.d.ts +24 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +188 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/inspector.d.ts +37 -0
  21. package/dist/inspector.d.ts.map +1 -0
  22. package/dist/inspector.js +572 -0
  23. package/dist/inspector.js.map +1 -0
  24. package/dist/react/index.d.ts +37 -0
  25. package/dist/react/index.d.ts.map +1 -0
  26. package/dist/react/index.js +86 -0
  27. package/dist/react/index.js.map +1 -0
  28. package/dist/sarif-CI8HOokm.js +1033 -0
  29. package/dist/sarif-CI8HOokm.js.map +1 -0
  30. package/dist/scan-Ch2BfIUD.js +2561 -0
  31. package/dist/scan-Ch2BfIUD.js.map +1 -0
  32. package/dist/tools.d.ts +377 -0
  33. package/dist/tools.d.ts.map +1 -0
  34. package/dist/tools.js +4 -0
  35. package/dist/vite.d.ts +24 -0
  36. package/dist/vite.d.ts.map +1 -0
  37. package/dist/vite.js +264 -0
  38. package/dist/vite.js.map +1 -0
  39. package/package.json +148 -15
  40. package/src/cli.ts +528 -0
  41. package/src/index.ts +31 -0
  42. package/src/inspector-dialog.ts +450 -0
  43. package/src/inspector.ts +228 -0
  44. package/src/react/index.tsx +112 -0
  45. package/src/runtime/copy.ts +221 -0
  46. package/src/runtime/helpers.ts +66 -0
  47. package/src/runtime/locale.ts +49 -0
  48. package/src/runtime/types.ts +106 -0
  49. package/src/tools/catalog.ts +449 -0
  50. package/src/tools/compile.ts +121 -0
  51. package/src/tools/config.ts +211 -0
  52. package/src/tools/diff.ts +84 -0
  53. package/src/tools/entry.ts +325 -0
  54. package/src/tools/extract.ts +694 -0
  55. package/src/tools/generate.ts +257 -0
  56. package/src/tools/icu.ts +211 -0
  57. package/src/tools/index.ts +91 -0
  58. package/src/tools/lint.ts +865 -0
  59. package/src/tools/lock.ts +95 -0
  60. package/src/tools/mf1.ts +246 -0
  61. package/src/tools/mf2.ts +752 -0
  62. package/src/tools/migrate.ts +138 -0
  63. package/src/tools/presets.ts +159 -0
  64. package/src/tools/pseudo.ts +40 -0
  65. package/src/tools/sarif.ts +80 -0
  66. package/src/tools/scan.ts +303 -0
  67. package/src/tools/syntax.ts +24 -0
  68. package/src/tools/types.ts +137 -0
  69. package/src/vite.ts +296 -0
  70. package/index.js +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-Ch2BfIUD.js","names":["print","numberStyle","parse","resolve","parseMessage","readEntry","parseYaml","TYPE","parse","TYPE"],"sources":["../src/tools/mf1.ts","../src/tools/mf2.ts","../src/tools/syntax.ts","../src/tools/catalog.ts","../src/tools/compile.ts","../src/tools/entry.ts","../src/tools/lock.ts","../src/tools/pseudo.ts","../src/tools/generate.ts","../src/tools/scan.ts"],"sourcesContent":["/**\n * The element tree written as MF1 (ICU MessageFormat) text, for `migrate`. A tree read from MF2 holds\n * `Intl` options where MF1 holds skeletons, so each is written as the skeleton that parses back to the\n * same options, or as the named style MF2's function was mapped from; where neither exists the\n * message is reported rather than changed.\n */\nimport { isDateElement, isNumberElement, isTimeElement, parse, TYPE } from '@formatjs/icu-messageformat-parser';\nimport type { DateElement, DateTimeSkeleton, NumberElement, NumberSkeleton, TimeElement } from '@formatjs/icu-messageformat-parser';\n\nimport type { MessageFormatElement } from './icu.ts';\nimport type { Mf2DateSkeleton, Mf2NumberSkeleton } from './mf2.ts';\n\ntype Element = MessageFormatElement;\n\nexport function toMf1(ast: Element[]): string {\n return print(native(ast, undefined), false);\n}\n\nconst CATEGORY_ORDER = ['zero', 'one', 'two', 'few', 'many', 'other'];\n\n/**\n * Printed as a person would write it: `{n, plural, =0 {…} one {…} other {…}}`, exact arms first and\n * `other` last. (formatjs's printer packs and reorders arms.)\n */\nfunction print(elements: Element[], inPlural: boolean): string {\n return elements\n .map((el, i) => {\n switch (el.type) {\n case TYPE.literal:\n return escape(el.value, inPlural, elements[i + 1] === undefined);\n case TYPE.argument:\n return `{${el.value}}`;\n case TYPE.number:\n case TYPE.date:\n case TYPE.time: {\n const kind = el.type === TYPE.number ? 'number' : el.type === TYPE.date ? 'date' : 'time';\n const style = el.style;\n if (style === null || style === undefined) return `{${el.value}, ${kind}}`;\n if (typeof style === 'string') return `{${el.value}, ${kind}, ${style}}`;\n const skeleton = 'tokens' in style ? style.tokens.map((t) => [t.stem, ...t.options].join('/')).join(' ') : style.pattern;\n return `{${el.value}, ${kind}, ::${skeleton}}`;\n }\n case TYPE.pound:\n return '#';\n case TYPE.tag:\n return `<${el.value}>${print(el.children, inPlural)}</${el.value}>`;\n case TYPE.select:\n case TYPE.plural: {\n const arms = Object.entries(el.options);\n const rank = (arm: string) => (arm.startsWith('=') ? -1 : arm === 'other' ? 99 : Math.max(0, CATEGORY_ORDER.indexOf(arm)));\n if (el.type === TYPE.plural)\n arms.sort(([a], [b]) => (rank(a) !== rank(b) ? rank(a) - rank(b) : Number(a.slice(1)) - Number(b.slice(1))));\n else arms.sort(([a], [b]) => (a === 'other' ? 1 : 0) - (b === 'other' ? 1 : 0));\n const head = el.type === TYPE.select ? 'select' : el.pluralType === 'ordinal' ? 'selectordinal' : 'plural';\n const offset = el.type === TYPE.plural && el.offset !== 0 ? ` offset:${el.offset}` : '';\n const body = arms.map(([arm, o]) => `${arm} {${print(o.value, el.type === TYPE.plural)}}`).join(' ');\n return `{${el.value}, ${head},${offset} ${body}}`;\n }\n default:\n return '';\n }\n })\n .join('');\n}\n\n/**\n * Literal text, quoted where ICU would read it as syntax. An apostrophe starts a quote only before a\n * special character, so one before ordinary text (`don't`) stays single.\n */\nfunction escape(text: string, inPlural: boolean, last: boolean): string {\n const special = (c: string | undefined) => c === '{' || c === '}' || c === '<' || (inPlural && c === '#');\n let out = '';\n for (let i = 0; i < text.length; i++) {\n const c = text[i]!;\n if (special(c)) out += `'${c}'`;\n // Before the next placeholder or tag, a trailing apostrophe would quote its brace.\n else if (c === \"'\") out += special(text[i + 1]) || text[i + 1] === \"'\" || (!last && i === text.length - 1) ? \"''\" : \"'\";\n else out += c;\n }\n return out;\n}\n\n/** The tree with MF2 styles replaced by MF1 ones, and `#` where a plural prints its own value. */\nfunction native(elements: Element[], plural: { value: string; offset: number } | undefined): Element[] {\n return elements.map((el): Element => {\n if (isNumberElement(el)) {\n if (plural?.offset === 0 && el.value === plural.value && plainNumber(el)) return { type: TYPE.pound };\n return { ...el, style: numberStyle(el) };\n }\n if (isDateElement(el) || isTimeElement(el)) return dateElement(el);\n if (el.type === TYPE.plural) {\n const inner = { value: el.value, offset: el.offset };\n return { ...el, options: Object.fromEntries(Object.entries(el.options).map(([k, o]) => [k, { value: native(o.value, inner) }])) };\n }\n // formatjs reads `#` as text inside a select, even one inside a plural.\n if (el.type === TYPE.select)\n return { ...el, options: Object.fromEntries(Object.entries(el.options).map(([k, o]) => [k, { value: native(o.value, undefined) }])) };\n if (el.type === TYPE.tag) return { ...el, children: native(el.children, plural) };\n return el;\n });\n}\n\nfunction plainNumber(el: NumberElement): boolean {\n const style = el.style;\n return (\n style === null || style === undefined || ('mf2' in Object(style) && Object.keys((style as NumberSkeleton).parsedOptions).length === 0)\n );\n}\n\nfunction same(a: object, b: object): boolean {\n const norm = (o: object) =>\n JSON.stringify(\n Object.entries(o)\n .filter(([, v]) => v !== undefined)\n .sort(([x], [y]) => x.localeCompare(y)),\n );\n return norm(a) === norm(b);\n}\n\nfunction numberStyle(el: NumberElement): NumberElement['style'] {\n const style = el.style;\n if (style === null || style === undefined || typeof style === 'string' || !('mf2' in style)) return style;\n const options = (style as Mf2NumberSkeleton).parsedOptions as Record<string, unknown>;\n if (Object.keys(options).length === 0) return null;\n if (same(options, { maximumFractionDigits: 0 })) return 'integer';\n if (same(options, { style: 'percent' })) return 'percent';\n const skeleton = numberSkeleton(options);\n const parsed = skeleton === undefined ? undefined : skeletonStyle(`{n, number, ::${skeleton}}`);\n // `unit-width-*` sets both displays; `Intl` reads only the one its style uses.\n const relevant = (o: Record<string, unknown>) => {\n const { currencyDisplay, unitDisplay, ...rest } = o;\n return { ...rest, ...(o.style === 'currency' ? { currencyDisplay } : {}), ...(o.style === 'unit' ? { unitDisplay } : {}) };\n };\n if (parsed === undefined || !same(relevant(parsed.parsedOptions as Record<string, unknown>), relevant(options)))\n throw new Error(`{${el.value} ${mf2Text((style as Mf2NumberSkeleton).mf2)}} formats in a way no MF1 skeleton says`);\n return parsed as NumberSkeleton;\n}\n\nfunction skeletonStyle(source: string): NumberSkeleton | DateTimeSkeleton | undefined {\n try {\n const el = parse(source, { shouldParseSkeletons: true })[0];\n return el !== undefined && 'style' in el && typeof el.style === 'object' && el.style !== null ? el.style : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** The ICU number skeleton for `Intl` options, as far as formatjs reads skeletons back. */\nfunction numberSkeleton(o: Record<string, unknown>): string | undefined {\n const tokens: string[] = [];\n if (o.style === 'percent') tokens.push('percent');\n if (o.style === 'currency') tokens.push(`currency/${String(o.currency)}`);\n if (o.style === 'unit') tokens.push(`unit/${String(o.unit)}`);\n const width =\n o.style === 'currency'\n ? { narrowSymbol: 'unit-width-narrow', code: 'unit-width-short', name: 'unit-width-full-name' }[String(o.currencyDisplay)]\n : o.style === 'unit'\n ? { narrow: 'unit-width-narrow', short: 'unit-width-short', long: 'unit-width-full-name' }[String(o.unitDisplay)]\n : undefined;\n if (width !== undefined) tokens.push(width);\n if (o.currencySign === 'accounting') tokens.push('sign-accounting');\n const sign = { always: 'sign-always', exceptZero: 'sign-except-zero', never: 'sign-never' }[String(o.signDisplay)];\n if (sign !== undefined) tokens.push(sign);\n if (o.useGrouping === false) tokens.push('group-off');\n if (typeof o.minimumIntegerDigits === 'number') tokens.push(`integer-width/*${'0'.repeat(o.minimumIntegerDigits)}`);\n\n const minF = o.minimumFractionDigits as number | undefined;\n const maxF = o.maximumFractionDigits as number | undefined;\n let fraction: string | undefined;\n if (minF !== undefined && maxF !== undefined) fraction = `.${'0'.repeat(minF)}${'#'.repeat(maxF - minF)}`;\n else if (maxF !== undefined) fraction = maxF === 0 ? '.' : `.${'#'.repeat(maxF)}`;\n else if (minF !== undefined) fraction = `.${'0'.repeat(minF)}*`;\n const minS = o.minimumSignificantDigits as number | undefined;\n const maxS = o.maximumSignificantDigits as number | undefined;\n let significant: string | undefined;\n if (minS !== undefined && maxS !== undefined) significant = `${'@'.repeat(minS)}${'#'.repeat(maxS - minS)}`;\n else if (maxS !== undefined) significant = `@${'#'.repeat(maxS - 1)}`;\n else if (minS !== undefined) significant = `${'@'.repeat(minS)}+`;\n if (significant !== undefined)\n significant += o.roundingPriority === 'morePrecision' ? 'r' : o.roundingPriority === 'lessPrecision' ? 's' : '';\n if (fraction !== undefined)\n tokens.push(fraction + (o.trailingZeroDisplay === 'stripIfInteger' ? '/w' : significant !== undefined ? `/${significant}` : ''));\n else if (significant !== undefined) tokens.push(significant);\n\n const mode = {\n floor: 'rounding-mode-floor',\n ceil: 'rounding-mode-ceiling',\n trunc: 'rounding-mode-down',\n expand: 'rounding-mode-up',\n halfEven: 'rounding-mode-half-even',\n halfTrunc: 'rounding-mode-half-down',\n halfExpand: 'rounding-mode-half-up',\n }[String(o.roundingMode)];\n if (mode !== undefined) tokens.push(mode);\n return tokens.length > 0 ? tokens.join(' ') : undefined;\n}\n\n/** MF2 date and time functions as the MF1 named style they were mapped from (see `dateFunction` in mf2.ts). */\nconst NAMED: Record<string, readonly [TYPE.date | TYPE.time, string]> = {\n 'date length=short': [TYPE.date, 'short'],\n date: [TYPE.date, 'medium'],\n 'date length=long': [TYPE.date, 'long'],\n 'date fields=year-month-day-weekday length=long': [TYPE.date, 'full'],\n time: [TYPE.time, 'short'],\n 'time precision=second': [TYPE.time, 'medium'],\n 'time precision=second timeZoneStyle=short': [TYPE.time, 'long'],\n 'time precision=second timeZoneStyle=long': [TYPE.time, 'full'],\n};\n\nfunction dateElement(el: DateElement | TimeElement): Element {\n const style = el.style;\n if (typeof style !== 'object' || style === null || !('mf2' in style)) return el;\n const fn = (style as Mf2DateSkeleton).mf2;\n const named = NAMED[mf2Text(fn, true).slice(1)];\n if (named !== undefined) return { type: named[0], value: el.value, style: named[1] };\n const skeleton = dateSkeleton(style.parsedOptions);\n const parsed = skeleton === undefined ? undefined : skeletonStyle(`{d, date, ::${skeleton}}`);\n if (parsed === undefined || !same(parsed.parsedOptions, style.parsedOptions))\n throw new Error(`{${el.value} ${mf2Text(fn)}} formats in a way no MF1 date skeleton says: use :date or :time with a length`);\n return { type: TYPE.date, value: el.value, style: parsed as DateTimeSkeleton };\n}\n\nfunction dateSkeleton(o: Intl.DateTimeFormatOptions): string | undefined {\n if (o.hour !== undefined || o.timeZone !== undefined || o.calendar !== undefined || o.hour12 !== undefined) return undefined;\n const letters: Record<string, Record<string, string>> = {\n weekday: { short: 'EEE', long: 'EEEE', narrow: 'EEEEE' },\n year: { numeric: 'y', '2-digit': 'yy' },\n month: { numeric: 'M', '2-digit': 'MM', short: 'MMM', long: 'MMMM', narrow: 'MMMMM' },\n day: { numeric: 'd', '2-digit': 'dd' },\n };\n let out = '';\n for (const [field, forms] of Object.entries(letters)) {\n const value = o[field as keyof Intl.DateTimeFormatOptions];\n if (value === undefined) continue;\n const letter = forms[String(value)];\n if (letter === undefined) return undefined;\n out += letter;\n }\n return out === '' ? undefined : out;\n}\n\nfunction mf2Text(fn: { name: string; options: Record<string, string> }, sortOptions = false): string {\n const options = Object.entries(fn.options);\n if (sortOptions) options.sort(([a], [b]) => a.localeCompare(b));\n return [`:${fn.name}`, ...options.map(([k, v]) => `${k}=${v}`)].join(' ');\n}\n","/**\n * Unicode MessageFormat 2, read into the element tree MF1 messages parse to, so the compiler, the\n * types, the lint and the pseudo-locale treat both syntaxes alike; and written back from that tree,\n * for `extract` and `migrate`.\n *\n * The tree holds what a message does, not how it was written. `.input {$n :number}` becomes a number\n * element at each `{$n}`, and `.match` becomes plural and select elements, one level per selector,\n * built so the runtime's ICU-style selection picks the variant MF2's would (see `matchTree`). Option\n * values are literals, resolved here into `Intl` options, so the runtime is the same for both.\n */\nimport { SKELETON_TYPE, TYPE } from '@formatjs/icu-messageformat-parser';\nimport type {\n DateElement,\n DateTimeSkeleton,\n NumberElement,\n NumberSkeleton,\n PluralElement,\n PluralOrSelectOption,\n SelectElement,\n TimeElement,\n} from '@formatjs/icu-messageformat-parser';\nimport { MessageSyntaxError, parseMessage, stringifyMessage, validate, type Model } from 'messageformat';\n\nimport { walk, type MessageFormatElement } from './icu.ts';\n\ntype Element = MessageFormatElement;\n\n/** A function as written: `:number minimumFractionDigits=2`. Kept on the styles it produces, to write back. */\nexport interface Mf2Function {\n name: string;\n options: Record<string, string>;\n}\n\ntype Value = { kind: 'literal'; value: string; fn?: Mf2Function } | { kind: 'variable'; name: string; fn?: Mf2Function; offset: number };\n\ntype Scope = Map<string, Value>;\n\ninterface Selector {\n name: string;\n kind: 'plural' | 'ordinal' | 'exact' | 'string';\n offset: number;\n}\n\nexport const NUMBER_LITERAL = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][-+]?\\d+)?$/;\nconst CATEGORIES = new Set(['zero', 'one', 'two', 'few', 'many', 'other']);\nconst NAME = /^[\\p{L}_][\\p{L}\\p{N}_.-]*$/u;\n\nconst DIGITS = [\n 'minimumIntegerDigits',\n 'minimumFractionDigits',\n 'maximumFractionDigits',\n 'minimumSignificantDigits',\n 'maximumSignificantDigits',\n 'roundingIncrement',\n];\nconst ROUNDING = ['trailingZeroDisplay', 'roundingPriority', 'roundingMode'];\nconst SIGNIFICANT = ['minimumSignificantDigits', 'maximumSignificantDigits'];\n\n/** The options each default function takes, from the MF2 spec. */\nconst OPTIONS: Record<string, readonly string[]> = {\n string: [],\n number: ['select', 'signDisplay', 'useGrouping', ...DIGITS, ...ROUNDING],\n integer: ['select', 'signDisplay', 'useGrouping', 'minimumIntegerDigits', 'maximumSignificantDigits'],\n currency: [\n 'currency',\n 'currencySign',\n 'currencyDisplay',\n 'useGrouping',\n 'minimumIntegerDigits',\n 'fractionDigits',\n ...SIGNIFICANT,\n ...ROUNDING,\n 'roundingIncrement',\n ],\n percent: ['signDisplay', 'useGrouping', 'minimumFractionDigits', 'maximumFractionDigits', ...SIGNIFICANT, ...ROUNDING],\n unit: ['unit', 'unitDisplay', 'signDisplay', 'useGrouping', ...DIGITS, ...ROUNDING],\n offset: ['add', 'subtract'],\n date: ['fields', 'length', 'calendar', 'timeZone'],\n time: ['precision', 'timeZoneStyle', 'hour12', 'calendar', 'timeZone'],\n datetime: ['dateFields', 'dateLength', 'timePrecision', 'timeZoneStyle', 'hour12', 'calendar', 'timeZone'],\n};\n\n/** Options whose values are a fixed set, checked here because MF2's names differ from `Intl`'s. */\nconst DATE_FIELDS = ['weekday', 'day-weekday', 'month-day', 'month-day-weekday', 'year-month-day', 'year-month-day-weekday'];\nconst ENUMS: Record<string, readonly string[]> = {\n select: ['plural', 'ordinal', 'exact'],\n useGrouping: ['auto', 'always', 'never', 'min2'],\n currencyDisplay: ['narrowSymbol', 'symbol', 'name', 'code'],\n fields: DATE_FIELDS,\n dateFields: DATE_FIELDS,\n length: ['long', 'medium', 'short'],\n dateLength: ['long', 'medium', 'short'],\n precision: ['hour', 'minute', 'second'],\n timePrecision: ['hour', 'minute', 'second'],\n timeZoneStyle: ['long', 'short'],\n hour12: ['true', 'false'],\n};\n\n/** Options an operand's function doesn't pass on to these, per the spec. */\nconst DISCARDED: Record<string, readonly string[]> = {\n integer: ['minimumFractionDigits', 'maximumFractionDigits', 'minimumSignificantDigits'],\n percent: ['minimumIntegerDigits', 'roundingIncrement', 'select'],\n};\n\nconst NUMERIC = new Set(['number', 'integer', 'currency', 'percent', 'unit']);\nconst TEMPORAL = new Set(['date', 'time', 'datetime']);\n\nconst family = (name: string) => (NUMERIC.has(name) ? 'number' : TEMPORAL.has(name) ? 'date' : name);\n\nconst HINTS: Record<string, string> = {\n 'missing-selector-annotation': 'a .match variable needs a function that selects, declared first: .input {$count :number}',\n 'missing-fallback': 'a .match needs a variant whose keys are all *',\n 'key-mismatch': 'each variant has one key per .match variable',\n 'duplicate-variant': 'two variants have the same keys',\n 'duplicate-declaration': 'a variable is declared twice, or declared after a use',\n 'duplicate-option-name': 'an option is given twice',\n 'duplicate-attribute': 'an attribute is given twice',\n 'bad-escape': 'only \\\\\\\\, \\\\{, \\\\} and \\\\| are escapes',\n 'bad-input-expression': '.input takes a variable: .input {$count :number}',\n 'extra-content': 'something follows the end of the message: a message with .match ends with its last variant',\n 'empty-token': 'a name or value is missing',\n};\n\n/** Thrown from `validate`'s callback, which reports a data-model error without throwing. */\nclass ModelError extends Error {\n readonly type: string;\n constructor(type: string) {\n super(type);\n this.type = type;\n }\n}\n\nfunction syntaxProblem(text: string, e: unknown): string {\n const type = e instanceof MessageSyntaxError || e instanceof ModelError ? e.type : undefined;\n const hint = type === undefined ? undefined : HINTS[type];\n let where = '';\n if (e instanceof MessageSyntaxError) {\n const before = text.slice(0, e.start).split('\\n');\n const near = text.slice(e.start, e.start + 16).split('\\n')[0];\n where = ` at line ${before.length}, column ${before.at(-1)!.length + 1}${near ? ` (near \"${near}\")` : ''}`;\n }\n const reason = hint ?? (e instanceof Error ? e.message.replace(/ at \\d+$/, '') : String(e));\n return `is not valid MessageFormat 2${where}: ${reason}`;\n}\n\n/** An MF2 message as the element tree. Throws, with the fix, where it can't be read or compiled. */\nexport function parseMf2(text: string, locale: string): Element[] {\n let message: Model.Message;\n try {\n message = parseMessage(text);\n validate(message, (type) => {\n throw new ModelError(type);\n });\n } catch (e) {\n throw new Error(syntaxProblem(text, e), { cause: e });\n }\n const scope: Scope = new Map();\n for (const declaration of message.declarations)\n // `.input` reads the argument itself; a `.local` can build on what is declared before it.\n scope.set(declaration.name, resolve(declaration.value, declaration.type === 'input' ? new Map() : scope));\n\n if (message.type === 'message') return pattern(message.pattern, scope, locale);\n const selectors = message.selectors.map((s) => selectorOf(s.name, scope));\n const candidates = message.variants.map((variant) => {\n const keys = variant.keys.map((k) => (k.type === '*' ? null : k.value));\n keys.forEach((key, i) => checkKey(selectors[i]!, key, message.selectors[i]!.name));\n return { keys, prefs: [], value: pattern(variant.value, scope, locale) };\n });\n return matchTree(selectors, candidates, 0, locale);\n}\n\nfunction functionOf(ref: Model.FunctionRef): Mf2Function {\n const allowed = OPTIONS[ref.name];\n if (allowed === undefined) {\n const known = Object.keys(OPTIONS).map((n) => `:${n}`);\n throw new Error(`:${ref.name} is not a function prosebook knows: ${known.join(', ')}`);\n }\n const options: Record<string, string> = {};\n for (const [key, value] of Object.entries(ref.options ?? {})) {\n // `u:id` and `u:dir` say nothing about formatting here: there is no bidi isolation to steer.\n if (key === 'u:id' || key === 'u:dir') continue;\n if (value.type === 'variable')\n throw new Error(`:${ref.name} ${key}=$${value.name}: option values are literals here, since formatting is fixed at build time`);\n if (!allowed.includes(key))\n throw new Error(`:${ref.name} has no option \"${key}\"${allowed.length > 0 ? `: ${allowed.join(', ')}` : ''}`);\n const values = ENUMS[key];\n if (values !== undefined && !values.includes(value.value))\n throw new Error(`:${ref.name} ${key}=${value.value} is not a value it takes: ${values.join(', ')}`);\n if (DIGITS.includes(key) && !/^\\d+$/.test(value.value)) throw new Error(`:${ref.name} ${key}=${value.value} is not a whole number`);\n options[key] = value.value;\n }\n if (ref.name === 'currency' && options.currency === undefined)\n throw new Error(':currency needs its currency named: {$price :currency currency=EUR}');\n if (ref.name === 'unit' && options.unit === undefined) throw new Error(':unit needs its unit named: {$distance :unit unit=kilometer}');\n if (ref.name === 'unit' && ref.options?.usage !== undefined)\n throw new Error(\":unit usage converts between units, which `Intl` can't do: convert the value before passing it\");\n if (options.timeZone === 'input') throw new Error(`:${ref.name} timeZone=input needs a zoned value, which a JavaScript Date isn't`);\n if (ref.name === 'offset') {\n const given = ['add', 'subtract'].filter((k) => options[k] !== undefined);\n if (given.length !== 1 || !/^\\d+$/.test(options[given[0]!]!))\n throw new Error(':offset takes one of add or subtract, as a whole number: {$count :offset subtract=1}');\n }\n return { name: ref.name, options };\n}\n\nfunction resolve(expr: Model.Expression, scope: Scope): Value {\n const fn = expr.functionRef === undefined ? undefined : functionOf(expr.functionRef);\n if (expr.arg === undefined) throw new Error(`{:${fn!.name}} has nothing to format: give it a value, {$value :${fn!.name}}`);\n if (expr.arg.type === 'literal') return apply({ kind: 'literal', value: expr.arg.value }, fn);\n return apply(scope.get(expr.arg.name) ?? { kind: 'variable', name: expr.arg.name, offset: 0 }, fn);\n}\n\n/** `fn` applied to a value that may already carry one: options carry over within a family, as the spec has it. */\nfunction apply(base: Value, fn: Mf2Function | undefined): Value {\n if (fn === undefined) return base;\n if (fn.name === 'offset') {\n const by = Number(fn.options.subtract ?? 0) - Number(fn.options.add ?? 0);\n const numeric = base.fn ?? { name: 'number', options: {} };\n if (base.kind === 'literal') return { ...base, value: String(Number(literalNumber(base.value)) - by), fn: numeric };\n return { ...base, offset: base.offset + by, fn: numeric };\n }\n if (base.fn === undefined || family(base.fn.name) !== family(fn.name)) return { ...base, fn };\n const inherited = { ...base.fn.options };\n for (const key of DISCARDED[fn.name] ?? []) delete inherited[key];\n return { ...base, fn: { name: fn.name, options: { ...inherited, ...fn.options } } };\n}\n\nfunction literalNumber(value: string): string {\n if (!NUMBER_LITERAL.test(value)) throw new Error(`|${value}| is not a number: write it as one, like 42 or 1.5`);\n return value;\n}\n\nfunction selectorOf(name: string, scope: Scope): Selector {\n const value = scope.get(name);\n // `validate` has refused a selector declared without a function.\n if (value === undefined || value.fn === undefined) throw new Error(`.match $${name} needs a function: .input {$${name} :number}`);\n if (value.kind === 'literal')\n throw new Error(`.match $${name} selects on a literal, which always picks the same variant: use that variant's text`);\n const { fn } = value;\n if (fn.name === 'string') return { name: value.name, kind: 'string', offset: 0 };\n if (fn.name === 'number' || fn.name === 'integer') {\n const kind = (fn.options.select ?? 'plural') as Selector['kind'];\n return { name: value.name, kind, offset: value.offset };\n }\n throw new Error(`.match $${name} selects with :${fn.name}, which prosebook can't select on: use :number, :integer or :string`);\n}\n\nfunction checkKey(selector: Selector, key: string | null, name: string): void {\n if (key === null) return;\n if (selector.kind === 'string') {\n // The runtime's select falls back to its `other` arm, so a key named `other` would catch everything.\n if (key === 'other') throw new Error(`.match $${name} has a key \"other\", which can't be told from *: name it something else`);\n return;\n }\n if (NUMBER_LITERAL.test(key)) {\n if (String(Number(key)) !== key) throw new Error(`.match $${name} has the key ${key}: write it as ${Number(key)}, as values print`);\n return;\n }\n if (selector.kind === 'exact') throw new Error(`.match $${name} selects exactly, so its keys are numbers, not \"${key}\"`);\n if (!CATEGORIES.has(key))\n throw new Error(`.match $${name} has the key \"${key}\": a number key is a number or one of ${[...CATEGORIES].join(', ')}`);\n}\n\ninterface Candidate {\n keys: (string | null)[];\n /** How well each key so far matched: lower is better, as the spec ranks them. */\n prefs: number[];\n value: Element[];\n}\n\n/**\n * `.match` as nested plural and select elements. MF2 picks, among the variants whose every key\n * matches, the one whose keys match best, the first selector deciding first; an exact number beats\n * a plural category, which beats `*`. The runtime picks an arm per selector instead, so each arm\n * here holds every variant that can still match a value reaching it, and the leaf takes the best.\n * An exact arm `=1` holds the variants keyed `one` as well, since 1 is also in that category: which\n * category is the locale's, which is why this runs per locale.\n */\nfunction matchTree(selectors: Selector[], candidates: Candidate[], i: number, locale: string): Element[] {\n // Never empty: `validate` requires a variant whose keys are all `*`.\n if (i === selectors.length) return candidates.reduce((a, b) => (compare(b.prefs, a.prefs) < 0 ? b : a)).value;\n const s = selectors[i]!;\n const keys = [...new Set(candidates.map((c) => c.keys[i]).filter((k): k is string => k !== null && k !== undefined))];\n const options: Record<string, PluralOrSelectOption> = {};\n const arm = (name: string, preference: (key: string | null) => number | undefined) => {\n const next = candidates.flatMap((c) => {\n const p = preference(c.keys[i]!);\n return p === undefined ? [] : [{ ...c, prefs: [...c.prefs, p] }];\n });\n options[name] = { value: matchTree(selectors, next, i + 1, locale) };\n };\n\n if (s.kind === 'string') {\n for (const k of keys) arm(k, (key) => (key === k ? 0 : key === null ? 1 : undefined));\n arm('other', (key) => (key === null ? 1 : undefined));\n return [{ type: TYPE.select, value: s.name, options }];\n }\n const rules = new Intl.PluralRules(locale, { type: s.kind === 'ordinal' ? 'ordinal' : 'cardinal' });\n for (const k of keys.filter((key) => NUMBER_LITERAL.test(key))) {\n const category = s.kind === 'exact' ? undefined : rules.select(Number(k));\n // The runtime compares the value before its offset; the key is the value after it.\n arm(`=${Number(k) + s.offset}`, (key) => (key === k ? 0 : key === category ? 1 : key === null ? 2 : undefined));\n }\n if (s.kind !== 'exact') {\n // With a key named `other`, an arm for every category, so that the catch-all arm is reached only\n // by values whose category is `other`.\n const categories: string[] = keys.includes('other') ? rules.resolvedOptions().pluralCategories : keys.filter((k) => CATEGORIES.has(k));\n for (const c of categories) arm(c, (key) => (key === c ? 1 : key === null ? 2 : undefined));\n }\n if (!('other' in options)) arm('other', (key) => (key === null ? 2 : undefined));\n return [{ type: TYPE.plural, value: s.name, offset: s.offset, pluralType: s.kind === 'ordinal' ? 'ordinal' : 'cardinal', options }];\n}\n\nfunction compare(a: number[], b: number[]): number {\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return a[i]! - b[i]!;\n return 0;\n}\n\nfunction pattern(parts: Model.Pattern, scope: Scope, locale: string): Element[] {\n const root: Element[] = [];\n const open: { name: string; children: Element[] }[] = [];\n const push = (el: Element) => {\n const into = open.at(-1)?.children ?? root;\n const last = into.at(-1);\n if (el.type === TYPE.literal && last?.type === TYPE.literal) last.value += el.value;\n else into.push(el);\n };\n for (const part of parts) {\n if (typeof part === 'string') {\n push({ type: TYPE.literal, value: part });\n } else if (part.type === 'expression') {\n push(element(resolve(part, scope), locale));\n } else if (part.kind === 'close') {\n const top = open.pop();\n if (top?.name !== part.name) {\n throw new Error(\n top\n ? `{/${part.name}} closes {#${top.name}}: close tags in the order they opened`\n : `{/${part.name}} closes nothing: open it with {#${part.name}}`,\n );\n }\n push({ type: TYPE.tag, value: top.name, children: top.children });\n } else {\n const options = Object.keys(part.options ?? {}).filter((k) => k !== 'u:id');\n if (options.length > 0)\n throw new Error(`{#${part.name}} has options (${options.join(', ')}): tags take none here, so give them to its function`);\n if (part.kind === 'open') open.push({ name: part.name, children: [] });\n else push({ type: TYPE.tag, value: part.name, children: [] });\n }\n }\n if (open.length > 0) throw new Error(`{#${open.at(-1)!.name}} is never closed: end it with {/${open.at(-1)!.name}}`);\n return root;\n}\n\nfunction element(value: Value, locale: string): Element {\n if (value.kind === 'literal') return { type: TYPE.literal, value: formatLiteral(value, locale) };\n const { name, fn, offset } = value;\n // A value less its offset is what `#` prints inside a plural, so a plural with only `other` prints it.\n if (offset !== 0)\n return { type: TYPE.plural, value: name, offset, pluralType: 'cardinal', options: { other: { value: [{ type: TYPE.pound }] } } };\n if (fn === undefined || fn.name === 'string') return { type: TYPE.argument, value: name };\n if (NUMERIC.has(fn.name)) return { type: TYPE.number, value: name, style: numberStyle(fn) };\n return { type: TYPE.date, value: name, style: dateStyle(fn) };\n}\n\n/** A literal with a function is the same in every render, so it is formatted now. */\nfunction formatLiteral(value: Extract<Value, { kind: 'literal' }>, locale: string): string {\n const { fn } = value;\n if (fn === undefined || fn.name === 'string') return value.value;\n if (NUMERIC.has(fn.name)) return new Intl.NumberFormat(locale, intlNumber(fn)).format(Number(literalNumber(value.value)));\n const date = new Date(value.value);\n if (Number.isNaN(date.getTime())) throw new Error(`|${value.value}| is not a date: write it as an ISO 8601 date, like 2026-01-05`);\n return new Intl.DateTimeFormat(locale, intlDate(fn)).format(date);\n}\n\nexport type Mf2NumberSkeleton = NumberSkeleton & { mf2: Mf2Function };\nexport type Mf2DateSkeleton = DateTimeSkeleton & { mf2: Mf2Function };\n\nfunction numberStyle(fn: Mf2Function): Mf2NumberSkeleton {\n return { type: SKELETON_TYPE.number, tokens: [], parsedOptions: intlNumber(fn) as NumberSkeleton['parsedOptions'], mf2: fn };\n}\n\nfunction dateStyle(fn: Mf2Function): Mf2DateSkeleton {\n return { type: SKELETON_TYPE.dateTime, pattern: '', parsedOptions: intlDate(fn), mf2: fn };\n}\n\n/** The `Intl.NumberFormat` options a numeric function formats with. */\nexport function intlNumber(fn: Mf2Function): Intl.NumberFormatOptions {\n const allowed = OPTIONS[fn.name] ?? [];\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(fn.options)) {\n if (!allowed.includes(key) || key === 'select') continue;\n if (key === 'useGrouping') {\n out.useGrouping = value === 'never' ? false : value;\n } else if (key === 'fractionDigits') {\n if (value !== 'auto') out.minimumFractionDigits = out.maximumFractionDigits = Number(value);\n } else if (DIGITS.includes(key)) {\n out[key] = Number(value);\n } else {\n out[key] = value;\n }\n }\n if (fn.name === 'integer') out.maximumFractionDigits = 0;\n if (fn.name === 'percent' || fn.name === 'currency' || fn.name === 'unit') out.style = fn.name;\n return out;\n}\n\n/**\n * The `Intl.DateTimeFormat` options a date or time function formats with. MF2's date and time\n * functions are still a draft; this follows the spec's semantic options as the `messageformat`\n * package does, so a message reads the same in both.\n */\nexport function intlDate(fn: Mf2Function): Intl.DateTimeFormatOptions {\n const o = fn.options;\n const out: Intl.DateTimeFormatOptions = {};\n if (o.calendar !== undefined) out.calendar = o.calendar;\n if (fn.name !== 'date' && o.hour12 !== undefined) out.hour12 = o.hour12 === 'true';\n if (o.timeZone !== undefined) out.timeZone = o.timeZone;\n if (fn.name !== 'time') {\n const fields = new Set((o[fn.name === 'date' ? 'fields' : 'dateFields'] ?? 'year-month-day').split('-'));\n const length = o[fn.name === 'date' ? 'length' : 'dateLength'];\n if (fields.has('year')) out.year = 'numeric';\n if (fields.has('month')) out.month = length === 'long' ? 'long' : length === 'short' ? 'numeric' : 'short';\n if (fields.has('day')) out.day = 'numeric';\n if (fields.has('weekday')) out.weekday = length === 'long' ? 'long' : 'short';\n }\n if (fn.name !== 'date') {\n const precision = o[fn.name === 'time' ? 'precision' : 'timePrecision'];\n out.hour = 'numeric';\n if (precision !== 'hour') out.minute = 'numeric';\n if (precision === 'second') out.second = 'numeric';\n if (o.timeZoneStyle !== undefined) out.timeZoneName = o.timeZoneStyle as 'long' | 'short';\n }\n return out;\n}\n\n// Writing MF2 ////////////////////////////////////////////////////////////////////////////////////////\n\ninterface Found {\n /** The argument a plural or select reads. */\n arg: string;\n /** The variable `.match` names: the argument, or a local less the offset. */\n variable: string;\n kind: 'plural' | 'ordinal' | 'string';\n offset: number;\n /** MF2 keys, in order of appearance; `*` is implied. */\n keys: string[];\n}\n\n/** A message tree as MF2 text. Throws, saying what has no MF2 equivalent, where it can't be written. */\nexport function toMf2(ast: Element[], locale: string): string {\n const found = selectorsOf(ast);\n if (found.length === 0) {\n const pattern = toPattern(ast, { choice: new Map(), variables: new Map(), numeric: new Set(), locale });\n return stringifyMessage({ type: 'message', declarations: [], pattern });\n }\n\n const declarations: Model.Declaration[] = [];\n for (const s of found) {\n const fn: Model.FunctionRef =\n s.kind === 'string' ? functionRef('string') : functionRef('number', s.kind === 'ordinal' ? { select: 'ordinal' } : {});\n declarations.push({ type: 'input', name: s.arg, value: { type: 'expression', arg: variable(s.arg), functionRef: fn } });\n if (s.offset !== 0) {\n declarations.push({\n type: 'local',\n name: s.variable,\n value: { type: 'expression', arg: variable(s.arg), functionRef: functionRef('offset', { subtract: String(s.offset) }) },\n });\n }\n }\n\n // Every combination of keys, `*` last, rendered by picking each plural's and select's arm.\n let combos: (string | null)[][] = [[]];\n for (const s of found) combos = combos.flatMap((c) => [...s.keys, null].map((k) => [...c, k]));\n const variables = new Map(found.map((s) => [s.arg, s.variable]));\n const numeric = new Set(found.filter((s) => s.kind !== 'string').map((s) => s.arg));\n const render = (keys: (string | null)[]) =>\n toPattern(ast, { choice: new Map(found.map((s, i) => [s.arg, keys[i]!])), variables, numeric, locale });\n const variants = combos.map((keys) => ({ keys, pattern: render(keys), text: '' }));\n for (const v of variants) v.text = JSON.stringify(v.pattern);\n const kept = prune(variants, found, locale);\n\n return stringifyMessage({\n type: 'select',\n declarations,\n selectors: found.map((s) => variable(s.variable)),\n variants: kept.map((v) => ({\n keys: v.keys.map((k): Model.Literal | Model.CatchallKey => (k === null ? { type: '*' } : { type: 'literal', value: k })),\n value: v.pattern,\n })),\n });\n}\n\nfunction selectorsOf(ast: Element[]): Found[] {\n const found = new Map<string, Found>();\n const names = new Set<string>();\n walk(ast, (el) => {\n if ('value' in el && typeof el.value === 'string' && el.type !== TYPE.literal) names.add(el.value);\n });\n walk(ast, (el) => {\n if (el.type !== TYPE.plural && el.type !== TYPE.select) return;\n const kind = el.type === TYPE.select ? 'string' : el.pluralType === 'ordinal' ? 'ordinal' : 'plural';\n const offset = el.type === TYPE.plural ? el.offset : 0;\n let s = found.get(el.value);\n if (s === undefined) {\n checkName(el.value);\n let local = `${el.value}_minus_${offset}`;\n while (names.has(local)) local += '_';\n s = { arg: el.value, variable: offset === 0 ? el.value : local, kind, offset, keys: [] };\n found.set(el.value, s);\n } else if (s.kind !== kind || s.offset !== offset) {\n throw new Error(\n `{${el.value}} is selected on in two ways (${s.kind}, ${kind}${offset !== s.offset ? ', with different offsets' : ''}), which one .match can't say: make them the same`,\n );\n }\n for (const arm of Object.keys(el.options)) {\n if (arm === 'other') continue;\n const key = el.type === TYPE.plural && arm.startsWith('=') ? String(Number(arm.slice(1)) - offset) : arm;\n if (!s.keys.includes(key)) s.keys.push(key);\n }\n });\n return [...found.values()];\n}\n\n/**\n * The variants a reader needs: one that renders like the variant it would fall back to is dropped,\n * as long as every combination of values still lands on a variant rendering what it should.\n */\nfunction prune<V extends { keys: (string | null)[]; text: string }>(variants: V[], found: Found[], locale: string): V[] {\n const rules = found.map((s) =>\n s.kind === 'string' ? undefined : new Intl.PluralRules(locale, { type: s.kind === 'ordinal' ? 'ordinal' : 'cardinal' }),\n );\n const preference = (i: number, key: string | null, value: string | null): number | undefined => {\n if (key === null) return 2;\n if (value === null) return undefined;\n if (key === value) return NUMBER_LITERAL.test(key) || rules[i] === undefined ? 0 : 1;\n if (rules[i] !== undefined && NUMBER_LITERAL.test(value) && rules[i].select(Number(value)) === key) return 1;\n return undefined;\n };\n const pick = (kept: V[], values: (string | null)[]) => {\n let best: { v: V; prefs: number[] } | undefined;\n for (const v of kept) {\n const prefs = values.map((value, i) => preference(i, v.keys[i]!, value));\n if (prefs.some((p) => p === undefined)) continue;\n if (best === undefined || compare(prefs as number[], best.prefs) < 0) best = { v, prefs: prefs as number[] };\n }\n return best?.v;\n };\n let kept = [...variants];\n const specificFirst = [...variants].sort((a, b) => b.keys.filter((k) => k !== null).length - a.keys.filter((k) => k !== null).length);\n for (const candidate of specificFirst) {\n if (candidate.keys.every((k) => k === null)) continue;\n const without = kept.filter((v) => v !== candidate);\n if (variants.every((v) => pick(without, v.keys)?.text === v.text)) kept = without;\n }\n return kept;\n}\n\ninterface Writing {\n /** The key each selected argument takes in the variant being written. */\n choice: Map<string, string | null>;\n /** The variable `.match` names for each selected argument. */\n variables: Map<string, string>;\n /** Arguments declared `.input {$n :number}`, whose plain `{$n}` already formats as a number. */\n numeric: Set<string>;\n locale: string;\n}\n\nfunction toPattern(elements: Element[], w: Writing, pound?: string): Model.Pattern {\n const out: Model.Pattern = [];\n const text = (value: string) => {\n const last = out.at(-1);\n if (typeof last === 'string') out[out.length - 1] = last + value;\n else if (value !== '') out.push(value);\n };\n for (const el of elements) {\n switch (el.type) {\n case TYPE.literal:\n text(el.value);\n break;\n case TYPE.argument:\n checkName(el.value);\n out.push({ type: 'expression', arg: variable(el.value) });\n break;\n case TYPE.number: {\n checkName(el.value);\n const fn = numberFunction(el);\n const declared = w.numeric.has(el.value) && fn.name === 'number' && fn.options === undefined;\n out.push(\n declared ? { type: 'expression', arg: variable(el.value) } : { type: 'expression', arg: variable(el.value), functionRef: fn },\n );\n break;\n }\n case TYPE.date:\n case TYPE.time:\n checkName(el.value);\n out.push({ type: 'expression', arg: variable(el.value), functionRef: dateFunction(el) });\n break;\n case TYPE.pound:\n out.push({ type: 'expression', arg: variable(pound ?? '') });\n break;\n case TYPE.plural:\n case TYPE.select: {\n const arm = armFor(el, w.choice.get(el.value) ?? null, w.locale);\n const own = w.variables.get(el.value) ?? el.value;\n for (const part of toPattern(arm, w, el.type === TYPE.plural ? own : pound)) {\n if (typeof part === 'string') text(part);\n else out.push(part);\n }\n break;\n }\n case TYPE.tag:\n checkName(el.value);\n out.push({ type: 'markup', kind: 'open', name: el.value });\n for (const part of toPattern(el.children, w, pound)) {\n if (typeof part === 'string') text(part);\n else out.push(part);\n }\n out.push({ type: 'markup', kind: 'close', name: el.value });\n break;\n }\n }\n return out;\n}\n\nfunction armFor(el: PluralElement | SelectElement, key: string | null, locale: string): Element[] {\n const other = el.options.other!.value;\n if (key === null) return other;\n if (el.type === TYPE.plural && NUMBER_LITERAL.test(key)) {\n const exact = el.options[`=${Number(key) + el.offset}`];\n if (exact !== undefined) return exact.value;\n const category = new Intl.PluralRules(locale, { type: el.pluralType }).select(Number(key));\n return el.options[category]?.value ?? other;\n }\n return el.options[key]?.value ?? other;\n}\n\nfunction checkName(name: string): void {\n if (!NAME.test(name)) throw new Error(`\"${name}\" can't be a MessageFormat 2 name: start it with a letter`);\n}\n\nfunction variable(name: string): Model.VariableRef {\n return { type: 'variable', name };\n}\n\nfunction functionRef(name: string, options: Record<string, string> = {}): Model.FunctionRef {\n const entries = Object.entries(options);\n if (entries.length === 0) return { type: 'function', name };\n return { type: 'function', name, options: Object.fromEntries(entries.map(([k, v]) => [k, { type: 'literal', value: v }])) };\n}\n\nfunction numberFunction(el: NumberElement): Model.FunctionRef {\n const style = el.style;\n if (style === null || style === undefined) return functionRef('number');\n if (typeof style === 'string') {\n if (style === 'integer' || style === 'percent') return functionRef(style);\n throw new Error(`{${el.value}, number, ${style}} has no MessageFormat 2 equivalent`);\n }\n if ('mf2' in style) return functionRef((style as Mf2NumberSkeleton).mf2.name, (style as Mf2NumberSkeleton).mf2.options);\n const {\n style: kind,\n currency,\n currencyDisplay,\n currencySign,\n unit,\n unitDisplay,\n ...rest\n } = style.parsedOptions as Record<string, string | number | boolean | undefined>;\n const name = kind === 'percent' || kind === 'currency' || kind === 'unit' ? kind : 'number';\n const options: Record<string, string> = {};\n const own = name === 'currency' ? { currency, currencyDisplay, currencySign } : name === 'unit' ? { unit, unitDisplay } : {};\n for (const [key, value] of Object.entries(own)) if (value !== undefined) options[key] = String(value);\n if (name === 'currency' && rest.minimumFractionDigits !== undefined && rest.minimumFractionDigits === rest.maximumFractionDigits) {\n options.fractionDigits = String(rest.minimumFractionDigits);\n delete rest.minimumFractionDigits;\n delete rest.maximumFractionDigits;\n }\n for (const [key, value] of Object.entries(rest)) {\n if (value === undefined) continue;\n if (key === 'useGrouping') options.useGrouping = value === false ? 'never' : String(value);\n else if (OPTIONS[name]!.includes(key) && key !== 'select') options[key] = String(value);\n else throw new Error(`{${el.value}}'s ${key}: ${String(value)} has no MessageFormat 2 equivalent`);\n }\n return functionRef(name, options);\n}\n\n/**\n * The MF2 function for a date or time element. MF1's named styles have no exact counterpart, so they\n * map to the nearest; `migrate` renders both and reports any that come out different.\n */\nfunction dateFunction(el: DateElement | TimeElement): Model.FunctionRef {\n const style = el.style;\n if (typeof style === 'object' && style !== null && 'mf2' in style)\n return functionRef((style as Mf2DateSkeleton).mf2.name, (style as Mf2DateSkeleton).mf2.options);\n if (el.type === TYPE.time && (style === null || style === undefined || typeof style === 'string')) {\n const time: Record<string, Record<string, string>> = {\n short: {},\n medium: { precision: 'second' },\n long: { precision: 'second', timeZoneStyle: 'short' },\n full: { precision: 'second', timeZoneStyle: 'long' },\n };\n return functionRef('time', time[style ?? 'short'] ?? {});\n }\n if (style === null || style === undefined || typeof style === 'string') {\n const date: Record<string, Record<string, string>> = {\n // MF1's default is `Intl`'s: numeric year, month and day.\n default: { length: 'short' },\n short: { length: 'short' },\n medium: {},\n long: { length: 'long' },\n full: { fields: 'year-month-day-weekday', length: 'long' },\n };\n return functionRef('date', date[style ?? 'default'] ?? {});\n }\n const { calendar, timeZone, hour12, ...fields } = style.parsedOptions;\n const overrides: Record<string, string> = {};\n if (calendar !== undefined) overrides.calendar = calendar;\n if (timeZone !== undefined) overrides.timeZone = timeZone;\n if (hour12 !== undefined) overrides.hour12 = String(hour12);\n const wanted = JSON.stringify(sorted(fields));\n for (const candidate of dateCandidates()) {\n const { calendar: _c, timeZone: _t, hour12: _h, ...got } = intlDate(candidate);\n if (JSON.stringify(sorted(got)) === wanted) return functionRef(candidate.name, { ...candidate.options, ...overrides });\n }\n throw new Error(`{${el.value}}'s date skeleton \"${style.pattern}\" has no MessageFormat 2 equivalent: use a named style`);\n}\n\nfunction sorted(o: object): [string, unknown][] {\n return Object.entries(o)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => a.localeCompare(b));\n}\n\nfunction* dateCandidates(): Generator<Mf2Function> {\n const lengths = [undefined, 'long', 'short'];\n const precisions = [undefined, 'hour', 'second'];\n const zones = [undefined, 'long', 'short'];\n const defined = (o: Record<string, string | undefined>) =>\n Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as Record<string, string>;\n // Defaults first, so the shortest spelling wins.\n const fieldsList = [undefined, ...DATE_FIELDS.filter((f) => f !== 'year-month-day')];\n const dates = fieldsList.flatMap((fields) => lengths.map((length) => ({ fields, length })));\n const times = precisions.flatMap((precision) => zones.map((timeZoneStyle) => ({ precision, timeZoneStyle })));\n for (const d of dates) yield { name: 'date', options: defined(d) };\n for (const t of times) yield { name: 'time', options: defined(t) };\n for (const d of dates) {\n for (const t of times) {\n const options = { dateFields: d.fields, dateLength: d.length, timePrecision: t.precision, timeZoneStyle: t.timeZoneStyle };\n yield { name: 'datetime', options: defined(options) };\n }\n }\n}\n","/**\n * The two syntaxes a catalog can be written in, behind one pair of calls: read a message into the\n * element tree, and write a tree back out. Everything past reading works on the tree alone.\n */\nimport { parseMessage, type MessageFormatElement } from './icu.ts';\nimport { toMf1 } from './mf1.ts';\nimport { parseMf2, toMf2 } from './mf2.ts';\n\nexport type MessageFormatVersion = 1 | 2;\n\nexport const SYNTAX_NAME: Record<MessageFormatVersion, string> = { 1: 'ICU MessageFormat', 2: 'MessageFormat 2' };\n\n/**\n * A message as the element tree. MF2 is read per locale: which variants a value can reach depends\n * on the locale's plural rules (see `matchTree` in mf2.ts).\n */\nexport function readMessage(version: MessageFormatVersion, text: string, locale: string): MessageFormatElement[] {\n return version === 2 ? parseMf2(text, locale) : parseMessage(text);\n}\n\n/** A tree as text in the given syntax. Throws, saying what the syntax can't express, where it can't. */\nexport function writeMessage(version: MessageFormatVersion, ast: MessageFormatElement[], locale: string): string {\n return version === 2 ? toMf2(ast, locale) : toMf1(ast);\n}\n","/**\n * Reads the catalog and its translations into one checked model.\n *\n * Every message is parsed as ICU here rather than at runtime, which is what lets the generator hand\n * TypeScript exact argument types, compile messages to plain functions, and fail the build where a\n * translation's placeholders drifted from the source instead of dropping a value off the screen.\n */\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { join, relative, resolve } from 'node:path';\n\nimport { isMap, isScalar, LineCounter, parseDocument, parse as parseYaml, Scalar } from 'yaml';\n\nimport type { ResolvedConfig } from './config.ts';\nimport { argsOf, formatProblems, formatsOf, staticLiteral, tagsOf, type MessageFormatElement } from './icu.ts';\nimport { readMessage } from './syntax.ts';\n\nexport interface Translation {\n text: string;\n ast: MessageFormatElement[];\n file: string;\n}\n\nexport interface Message {\n key: string;\n /** The first segment of the key, which names its file. */\n area: string;\n file: string;\n kind?: string;\n surface?: string;\n /** One sentence telling a translator where the string appears. */\n context?: string;\n /** What each placeholder holds, keyed by argument name. */\n argDocs: Map<string, string>;\n /** Completes something beside it rather than standing as a sentence, so sentence rules do not apply. */\n fragment: boolean;\n /** Lint rules the entry is exempt from, each with the reason. */\n allow: Map<string, string>;\n /** A change someone asked for, left for whoever edits the entry next, and deleted once it is made. */\n comment?: string;\n /** Asked to go: the entry, its translations and the code that reads it. */\n remove: boolean;\n /** The source message, in ICU MessageFormat. */\n text: string;\n ast: MessageFormatElement[];\n /** Argument name to TypeScript type. */\n args: Map<string, string>;\n /** How each formatted argument is styled, for the doc comment at the call site. */\n argFormats: Map<string, string>;\n tags: string[];\n /** Translations by locale. */\n translations: Map<string, Translation>;\n}\n\nexport interface Problem {\n severity: 'error' | 'warn';\n /** Relative to the project root; none for a problem that isn't in a file. */\n file?: string;\n /** The entry it is about, in `file`; none for the file as a whole. */\n key?: string;\n message: string;\n}\n\n/** `file key`, as the CLI names where a problem is. */\nexport function whereOf(problem: Problem): string {\n return [problem.file, problem.key].filter((s) => s !== undefined).join(' ');\n}\n\nexport interface Catalog {\n messages: Message[];\n /** The translated locales found under `locales`, without the source. */\n locales: string[];\n problems: Problem[];\n}\n\nexport class CatalogError extends Error {\n readonly problems: Problem[];\n\n constructor(problems: Problem[]) {\n super(`the catalog has ${problems.length} problem(s):\\n ${problems.map((p) => `${whereOf(p)}: ${p.message}`).join('\\n ')}`);\n this.problems = problems;\n }\n}\n\n/**\n * A key is dotted lowercase, two segments at least, and its first segment names the file it lives\n * in. Keys are read at every call site, so they say what the string is for: `cart.checkout.title`.\n */\nexport const KEY_PATTERN = /^[a-z0-9]+(?:[-_][a-z0-9]+)*(?:\\.[a-z0-9]+(?:[-_][a-z0-9]+)*)+$/;\n\nconst FIELDS = new Set(['kind', 'surface', 'context', 'args', 'fragment', 'allow', 'comment', 'remove']);\n\n/**\n * Loads and checks the catalog. Throws a `CatalogError` when anything is an error; warnings ride along.\n * `unsaved` holds file contents by absolute path to read in place of what is on disk, so an edit can be\n * checked before it is written; a translation file in it that isn't on disk yet is read too.\n */\nexport function loadCatalog(config: ResolvedConfig, unsaved?: ReadonlyMap<string, string>): Catalog {\n const read = (path: string) => unsaved?.get(resolve(path)) ?? readFileSync(path, 'utf8');\n const problems: Problem[] = [];\n const error = (message: string, file?: string, key?: string) => problems.push({ severity: 'error', file, key, message });\n const byKey = new Map<string, Message>();\n const rel = (path: string) => relative(config.root, path).replaceAll('\\\\', '/');\n\n if (!existsSync(config.catalog)) {\n error('no catalog folder here: run `prosebook init`, or set `catalog` in the config', rel(config.catalog));\n throw new CatalogError(problems);\n }\n\n for (const file of yamlFiles(config.catalog)) {\n const area = file.slice(0, -'.yaml'.length);\n const path = join(config.catalog, file);\n const at = rel(path);\n for (const [key, value] of Object.entries(readEntries(read(path), (m) => error(m, at)))) {\n if (!KEY_PATTERN.test(key)) {\n error('a key is dotted lowercase with two segments at least: `area.thing`', at, key);\n continue;\n }\n if (key.slice(0, key.indexOf('.')) !== area) {\n error(`a key in ${file} starts with \"${area}.\"`, at, key);\n continue;\n }\n if (byKey.has(key)) {\n error('duplicate key', at, key);\n continue;\n }\n const message = readEntry(key, area, at, value, config, (m) => error(m, at, key));\n if (!message) continue;\n byKey.set(key, message);\n // Asked of whoever edits next, often an agent, which finds them among the warnings of every run.\n const warn = (m: string) => problems.push({ severity: 'warn', file: at, key, message: m });\n if (message.remove) warn('marked for removal: delete the entry, its translations and the code that reads it');\n if (message.comment !== undefined) warn(`a comment to act on, then delete: ${message.comment}`);\n }\n }\n\n const created = [...(unsaved?.keys() ?? [])].filter((path) => !existsSync(path));\n const locales = readLocales(config, byKey, problems, rel, read, created);\n if (problems.some((p) => p.severity === 'error')) throw new CatalogError(problems);\n return { messages: [...byKey.values()].sort((a, b) => (a.key < b.key ? -1 : 1)), locales, problems };\n}\n\nfunction readEntry(\n key: string,\n area: string,\n file: string,\n value: unknown,\n config: ResolvedConfig,\n error: (message: string) => void,\n): Message | undefined {\n // `key: message` is the shorthand for an entry with nothing to say about itself.\n const entry = (typeof value === 'string' ? { [config.source]: value } : value) as Record<string, unknown> | null;\n if (entry === null || typeof entry !== 'object' || Array.isArray(entry)) {\n error(`an entry is a message, or a mapping holding \\`${config.source}\\` and what the string is`);\n return undefined;\n }\n let ok = true;\n const fail = (message: string) => {\n error(message);\n ok = false;\n };\n for (const field of Object.keys(entry))\n if (!FIELDS.has(field) && field !== config.source) fail(`\"${field}\" is not a field: ${[...FIELDS, config.source].join(', ')}`);\n\n const text = entry[config.source];\n if (typeof text !== 'string' || text === '') {\n fail(`${config.source} is the message, and it is missing`);\n return undefined;\n }\n for (const field of config.require) if (entry[field] === undefined) fail(`${field} is required (\\`require\\` in the config)`);\n\n const kind = optionalString(entry, 'kind', fail);\n if (kind !== undefined && !(kind in config.kinds)) fail(`kind is one of ${Object.keys(config.kinds).join(', ')}`);\n const surface = optionalString(entry, 'surface', fail);\n if (surface !== undefined && !(surface in config.surfaces)) fail(`surface is one of ${Object.keys(config.surfaces).join(', ')}`);\n const context = optionalString(entry, 'context', fail);\n if (entry.fragment !== undefined && typeof entry.fragment !== 'boolean') fail('fragment is true or false');\n const comment = optionalString(entry, 'comment', fail);\n if (entry.remove !== undefined && typeof entry.remove !== 'boolean') fail('remove is true or false');\n\n let ast: MessageFormatElement[];\n try {\n ast = readMessage(config.messageFormat, text, config.source);\n } catch (e) {\n fail(syntaxError(config, text, e));\n return undefined;\n }\n for (const problem of formatProblems(ast)) fail(problem);\n const args = argsOf(ast, (name) => fail(`\"${name}\" is used as two different types`));\n const argDocs = stringMap(entry, 'args', fail);\n // An undocumented placeholder is fine unless context is required; a doc for an argument that no\n // longer exists is always stale.\n if (config.require.includes('context'))\n for (const name of args.keys()) if (!argDocs.has(name)) fail(`args.${name} is missing: say what the placeholder holds`);\n\n for (const name of argDocs.keys()) if (!args.has(name)) fail(`args.${name} is not an argument of this message`);\n\n if (!ok) return undefined;\n return {\n key,\n area,\n file,\n kind,\n surface,\n context,\n argDocs,\n fragment: entry.fragment === true,\n allow: stringMap(entry, 'allow', fail),\n comment,\n remove: entry.remove === true,\n text,\n ast,\n args,\n argFormats: formatsOf(ast),\n tags: tagsOf(ast),\n translations: new Map(),\n };\n}\n\nfunction readLocales(\n config: ResolvedConfig,\n byKey: Map<string, Message>,\n problems: Problem[],\n rel: (p: string) => string,\n read: (path: string) => string,\n created: string[],\n): string[] {\n if (!existsSync(config.locales)) return [];\n const files = new Map<string, string[]>();\n for (const name of readdirSync(config.locales).sort()) {\n const path = join(config.locales, name);\n const isDir = statSync(path).isDirectory();\n if (!isDir && !name.endsWith('.yaml')) continue;\n const locale = isDir ? name : name.slice(0, -'.yaml'.length);\n const found = isDir ? yamlFiles(path).map((f) => join(path, f)) : [path];\n files.set(locale, [...(files.get(locale) ?? []), ...found]);\n }\n // A translation file an edit would create, read as if it were there already.\n for (const path of created) {\n const inside = relative(config.locales, path).replaceAll('\\\\', '/');\n if (inside.startsWith('..') || !inside.endsWith('.yaml')) continue;\n const [first = '', second] = inside.split('/');\n const locale = second === undefined ? first.slice(0, -'.yaml'.length) : first;\n files.set(locale, [...(files.get(locale) ?? []), path]);\n }\n files.delete(config.source);\n\n for (const [locale, paths] of files) {\n for (const path of paths) {\n const file = rel(path);\n const error = (message: string, key?: string) => problems.push({ severity: 'error', file, key, message });\n for (const [key, value] of Object.entries(readEntries(read(path), error))) {\n const message = byKey.get(key);\n if (message === undefined) {\n problems.push({ severity: 'warn', file, key, message: 'no such key in the catalog, so this translation is unused' });\n continue;\n }\n if (typeof value !== 'string' || value === '') {\n error('a translation is the message, as a string', key);\n continue;\n }\n let ast: MessageFormatElement[];\n try {\n ast = readMessage(config.messageFormat, value, locale);\n } catch (e) {\n error(syntaxError(config, value, e), key);\n continue;\n }\n const drift = driftFrom(message, ast);\n if (drift !== undefined) {\n error(drift, key);\n continue;\n }\n for (const problem of formatProblems(ast)) error(problem, key);\n message.translations.set(locale, { text: value, ast, file });\n }\n }\n }\n return [...files.keys()];\n}\n\n/** How a translation's placeholders or tags differ from the source, or nothing. */\nfunction driftFrom(message: Message, ast: MessageFormatElement[]): string | undefined {\n const args = argsOf(ast);\n const missing = [...message.args.keys()].filter((a) => !args.has(a));\n const extra = [...args.keys()].filter((a) => !message.args.has(a));\n const retyped = [...args]\n .filter(([a, type]) => message.args.has(a) && message.args.get(a) !== type && !type.includes('string &'))\n .map(([a]) => a);\n const tags = tagsOf(ast);\n const parts = [\n missing.length > 0 ? `missing {${missing.join('}, {')}}` : '',\n extra.length > 0 ? `unknown {${extra.join('}, {')}}` : '',\n retyped.length > 0 ? `{${retyped.join('}, {')}} used as another type` : '',\n tags.join() === message.tags.join()\n ? ''\n : `tags are <${tags.join('>, <') || 'none'}>, the source has <${message.tags.join('>, <') || 'none'}>`,\n ].filter(Boolean);\n return parts.length > 0 ? `differs from the source: ${parts.join('; ')}` : undefined;\n}\n\nfunction syntaxError(config: ResolvedConfig, text: string, e: unknown): string {\n // MF2's reader words its own problems; see mf2.ts.\n if (config.messageFormat === 2) return (e as Error).message;\n return icuError(text, e);\n}\n\nfunction icuError(text: string, e: unknown): string {\n const hyphenated = /select\\s*,/.test(text) ? /[,{]\\s*([a-z0-9]+(?:-[a-z0-9]+)+)\\s*\\{/.exec(text) : null;\n if (hyphenated) return `names a select arm \"${hyphenated[1]}\": an arm's name takes no hyphen, so write it with an underscore`;\n const reason = (e as Error).message;\n if (/TAG/.test(reason)) return `is not valid ICU (${reason}): a literal < is written '<'`;\n return `is not valid ICU MessageFormat: ${reason}`;\n}\n\nfunction yamlFiles(dir: string): string[] {\n return readdirSync(dir)\n .filter((f) => f.endsWith('.yaml'))\n .sort();\n}\n\n/**\n * The file's entries. YAML 1.1 and 1.2 disagree about bare scalars: 1.1 reads `n`, `on` and `yes` as\n * booleans and `12:30` as a number. Translation tools are often 1.1, so a file that reads differently\n * under each fails here, naming the value to quote, rather than corrupting quietly in the next tool.\n */\nfunction readEntries(text: string, error: (message: string) => void): Record<string, unknown> {\n let raw: unknown;\n try {\n raw = parseYaml(text);\n } catch (e) {\n error(`is not valid YAML: ${(e as Error).message}`);\n return {};\n }\n if (raw === null || raw === undefined) return {};\n if (typeof raw !== 'object' || Array.isArray(raw)) {\n error('a catalog file is a mapping of key to entry');\n return {};\n }\n try {\n const found = divergence(raw, parseYaml(text, { version: '1.1' }), '');\n if (found !== undefined) error(found);\n } catch (e) {\n error(`does not parse as YAML 1.1, which another tool may well be: ${(e as Error).message}`);\n }\n return raw as Record<string, unknown>;\n}\n\nfunction divergence(a: unknown, b: unknown, path: string): string | undefined {\n if (a === null || b === null || typeof a !== 'object' || typeof b !== 'object') {\n if (Object.is(a, b)) return undefined;\n return `${path} reads as ${JSON.stringify(a)} under YAML 1.2 and ${JSON.stringify(b)} under YAML 1.1: quote it`;\n }\n const left = a as Record<string, unknown>;\n const right = b as Record<string, unknown>;\n for (const key of new Set([...Object.keys(left), ...Object.keys(right)])) {\n const here = path === '' ? key : `${path}.${key}`;\n if (key in left !== key in right) return `${here} is a key under YAML ${key in left ? '1.2' : '1.1'} only: quote it`;\n const found = divergence(left[key], right[key], here);\n if (found !== undefined) return found;\n }\n return undefined;\n}\n\nfunction optionalString(entry: Record<string, unknown>, field: string, fail: (m: string) => void): string | undefined {\n const value = entry[field];\n if (value === undefined) return undefined;\n if (typeof value !== 'string' || value.trim() === '') {\n fail(`${field} is a non-empty string`);\n return undefined;\n }\n return value.trim();\n}\n\nfunction stringMap(entry: Record<string, unknown>, field: string, fail: (m: string) => void): Map<string, string> {\n const out = new Map<string, string>();\n const value = entry[field];\n if (value === undefined) return out;\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n fail(`${field} is a mapping of name to sentence`);\n return out;\n }\n for (const [name, said] of Object.entries(value)) {\n if (typeof said !== 'string' || said.trim() === '') fail(`${field}.${name} is a sentence`);\n else out.set(name, said.trim());\n }\n return out;\n}\n\nexport interface EntryLocation {\n /** Absolute. */\n file: string;\n /** From 1. */\n line: number;\n /** From 1. */\n column: number;\n}\n\n/**\n * Where a message's entry is written: its translation in `locale` when there is one, else the catalog.\n * Read from the file as it is now, so an entry moved since the catalog was loaded is still found.\n */\nexport function entryLocation(config: ResolvedConfig, message: Message, locale?: string): EntryLocation {\n const file = (locale === undefined ? undefined : message.translations.get(locale)?.file) ?? message.file;\n return { file: join(config.root, file), ...entryLocator(config.root)(file, message.key) };\n}\n\n/**\n * Finds a key's line and column in a catalog or translation file, given relative to `root`. Each file\n * is read once, so a report that places many entries parses each file once. A key it can't find, or no\n * key, is the top of the file.\n *\n * Given an `offset` into the message (under `field`, in an entry that is a mapping), it is that\n * character, when the value is written in the file as it reads up to there: plain, or quoted on one\n * line with nothing escaped before it. Otherwise it is the key.\n */\nexport function entryLocator(root: string): (file: string, key?: string, offset?: number, field?: string) => Omit<EntryLocation, 'file'> {\n const read = new Map<string, { doc: ReturnType<typeof parseDocument>; lines: LineCounter; source: string }>();\n return (file, key, offset, field) => {\n let parsed = read.get(file);\n if (parsed === undefined) {\n const path = join(root, file);\n const lines = new LineCounter();\n const source = existsSync(path) ? readFileSync(path, 'utf8') : '';\n parsed = { doc: parseDocument(source, { lineCounter: lines }), lines, source };\n read.set(file, parsed);\n }\n const { doc, lines, source } = parsed;\n const pair =\n key !== undefined && isMap(doc.contents) ? doc.contents.items.find((p) => isScalar(p.key) && p.key.value === key) : undefined;\n const value = isMap(pair?.value) && field !== undefined ? pair.value.get(field, true) : pair?.value;\n if (offset !== undefined && isScalar(value) && typeof value.value === 'string' && value.range) {\n const quoted = value.type === Scalar.QUOTE_DOUBLE || value.type === Scalar.QUOTE_SINGLE;\n const content = value.range[0] + (quoted ? 1 : 0);\n if (source.slice(content, content + offset) === value.value.slice(0, offset)) {\n const { line, col } = lines.linePos(content + offset);\n return { line, column: col };\n }\n }\n const start = isScalar(pair?.key) ? pair.key.range?.[0] : undefined;\n if (start === undefined) return { line: 1, column: 1 };\n const { line, col } = lines.linePos(start);\n return { line, column: col };\n };\n}\n\n/** The source message as a reader sees it with no placeholders filled: for docs and reports. */\nexport function previewOf(message: Message): string {\n return staticLiteral(message.ast) ?? message.text;\n}\n","/**\n * Compiles ICU ASTs to JavaScript.\n *\n * A message with no placeholders becomes its string. Any other becomes `(a, h) => …`, where `a` holds\n * the arguments and `h` the locale's helpers (see `runtime/helpers.ts`): a plural is a call picking an\n * arm, a number is a call to a cached `Intl.NumberFormat`. One that calls no helper is `(a) => …`, so\n * the generated TypeScript passes `noUnusedParameters`. Formatting options are resolved here and\n * hoisted to module constants, so a skeleton costs nothing at runtime and its formatter is built once.\n */\nimport { isDateElement, isNumberElement, isTimeElement } from '@formatjs/icu-messageformat-parser';\n\nimport { dateOptions, numberOptions, staticLiteral, TYPE, walk, type MessageFormatElement } from './icu.ts';\n\nexport type Entry = readonly [key: string, ast: MessageFormatElement[]];\n\n/** Module-level constants for formatting options, one per distinct object. */\nclass Hoisted {\n private readonly byJson = new Map<string, string>();\n\n /** `, oN` naming the hoisted options, or nothing when there are none. */\n arg(options: object | undefined): string {\n // `{}` (a bare `:number`) formats as no options do, so it needs no constant.\n if (options === undefined || Object.keys(options).length === 0) return '';\n const json = JSON.stringify(options);\n let name = this.byJson.get(json);\n if (name === undefined) this.byJson.set(json, (name = `o${this.byJson.size}`));\n return `, ${name}`;\n }\n\n declarations(): string[] {\n return [...this.byJson].map(([json, name]) => `const ${name} = ${json};`);\n }\n}\n\nfunction access(name: string): string {\n return /^[A-Za-z_$][\\w$]*$/.test(name) ? `a.${name}` : `a[${JSON.stringify(name)}]`;\n}\n\nfunction nodes(elements: MessageFormatElement[], hoisted: Hoisted, pound: string | null): string {\n if (elements.length === 0) return '\"\"';\n const parts = elements.map((el) => node(el, hoisted, pound));\n return parts.length === 1 ? parts[0]! : `[${parts.join(', ')}]`;\n}\n\nfunction arms(options: Record<string, { value: MessageFormatElement[] }>, hoisted: Hoisted, pound: string | null): string {\n const body = Object.entries(options).map(([arm, option]) => `${JSON.stringify(arm)}: () => ${nodes(option.value, hoisted, pound)}`);\n return `{ ${body.join(', ')} }`;\n}\n\nfunction node(el: MessageFormatElement, hoisted: Hoisted, pound: string | null): string {\n if (isNumberElement(el)) return `h.n(${access(el.value)}${hoisted.arg(numberOptions(el))})`;\n if (isDateElement(el) || isTimeElement(el)) return `h.d(${access(el.value)}${hoisted.arg(dateOptions(el))})`;\n switch (el.type) {\n case TYPE.literal:\n return JSON.stringify(el.value);\n case TYPE.argument:\n return access(el.value);\n case TYPE.pound:\n return pound ?? '\"#\"';\n case TYPE.select:\n return `h.s(${access(el.value)}, ${arms(el.options, hoisted, pound)})`;\n case TYPE.plural: {\n // `#` is the plural's own value less its offset, formatted as a number.\n const value = access(el.value);\n const hash = `h.n(${value}${el.offset !== 0 ? ` - ${el.offset}` : ''})`;\n return `h.p(${value}, ${el.offset}, ${el.pluralType === 'ordinal'}, ${arms(el.options, hoisted, hash)})`;\n }\n case TYPE.tag:\n return `h.t(a, ${JSON.stringify(el.value)}, ${nodes(el.children, hoisted, pound)})`;\n default:\n throw new Error(`prosebook: no compiler for ICU element type ${(el as MessageFormatElement).type}`);\n }\n}\n\n/** Whether the message calls a helper: everything but literals and plain placeholders does. */\nfunction usesHelpers(ast: MessageFormatElement[]): boolean {\n let uses = false;\n walk(ast, (el) => {\n if (el.type !== TYPE.literal && el.type !== TYPE.argument) uses = true;\n });\n return uses;\n}\n\nfunction message(ast: MessageFormatElement[], hoisted: Hoisted): string {\n const literal = staticLiteral(ast);\n if (literal !== undefined) return JSON.stringify(literal);\n return `(${usesHelpers(ast) ? 'a, h' : 'a'}) => ${nodes(ast, hoisted, null)}`;\n}\n\nexport interface CompiledLocale {\n /** `const oN = {…};` lines the messages refer to. */\n declarations: string[];\n /** `\"key\": message,` lines. */\n rows: string[];\n}\n\n/** One locale's messages as code, keeping only `keep` when given. */\nexport function compileLocale(entries: Iterable<Entry>, keep?: (key: string) => boolean): CompiledLocale {\n const hoisted = new Hoisted();\n const rows: string[] = [];\n for (const [key, ast] of entries) {\n if (keep && !keep(key)) continue;\n rows.push(` ${JSON.stringify(key)}: ${message(ast, hoisted)},`);\n }\n return { declarations: hoisted.declarations(), rows };\n}\n\n/** The locale as an ES module whose default export is its messages. */\nexport function localeModule(compiled: CompiledLocale, banner: string, ts: boolean): string {\n const head = ts ? `${banner}\\nimport type { CompiledMessages } from 'prosebook';\\n` : `${banner}\\n`;\n // `as const` keeps `style: \"currency\"` a literal, which is what `Intl`'s option types ask for.\n const declarations = ts ? compiled.declarations.map((d) => d.replace(/;$/, ' as const;')) : compiled.declarations;\n const consts = declarations.length > 0 ? `\\n${declarations.join('\\n')}\\n` : '';\n const close = ts ? '} satisfies CompiledMessages;' : '};';\n return `${head}${consts}\\nexport default {\\n${compiled.rows.join('\\n')}\\n${close}\\n`;\n}\n\n/** The locale as one expression, for a bundler to inline in place of the module. */\nexport function localeExpression(compiled: CompiledLocale): string {\n return `(() => {\\n${compiled.declarations.join('\\n')}\\nreturn {\\n${compiled.rows.join('\\n')}\\n};\\n})()`;\n}\n","/**\n * One entry as the dev inspector's dialog edits it, in every locale: as fields, or as the YAML written\n * in its files.\n *\n * An edit is checked as the whole catalog, with the edited files read from memory, before anything is\n * written: a save that would break the build comes back as problems instead, and the dev server never\n * sees it. Fields are written into the parsed document, so comments, order and quoting elsewhere in the\n * file stay as they were; YAML replaces the entry's text as typed. A translation left empty is no\n * translation: one that was there is removed, and the locale falls back.\n */\nimport { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative, resolve } from 'node:path';\n\nimport { isMap, isScalar, parseDocument, Scalar, type Document, type YAMLMap } from 'yaml';\n\nimport { CatalogError, loadCatalog, type Catalog, type Message, type Problem } from './catalog.ts';\nimport type { ResolvedConfig } from './config.ts';\nimport { applyEdits, lint, type Edit, type Finding } from './lint.ts';\n\nexport interface EntryFields {\n /** The source message. */\n message: string;\n /** By locale. Empty or missing is no translation, so the locale falls back. */\n translations: Record<string, string>;\n context: string;\n kind: string;\n surface: string;\n fragment: boolean;\n /** What each placeholder holds, by name. */\n args: Record<string, string>;\n /** A change asked of whoever edits next; empty is none. */\n comment: string;\n /** Asks for the entry to go, with the code that reads it. */\n remove: boolean;\n}\n\nexport interface EntryYaml {\n /** The entry in the catalog, from its key to the end of its value. */\n catalog: string;\n /** By locale, the entry in that locale's file. Empty is no translation. */\n translations?: Record<string, string>;\n}\n\nexport interface EntryView {\n key: string;\n /** The source locale. */\n source: string;\n /** Every translated locale, the source aside. */\n locales: string[];\n /** Relative to the project root. A locale without the entry names the file it would go in. */\n files: { catalog: string; translations: Record<string, string> };\n /** With every locale in `translations`, empty where it has none. */\n fields: EntryFields;\n yaml: Required<EntryYaml>;\n /** The source message's placeholders. */\n argNames: string[];\n kinds: string[];\n surfaces: string[];\n /** What lint says of the entry as it stands, in every locale. */\n findings: EntryFinding[];\n}\n\nexport interface EntryFinding extends Finding {\n /** The locale's text with this finding fixed, so the page can make the fix without lint's code. */\n fixed?: string;\n}\n\nexport type EntryEdit = { fields: EntryFields } | { yaml: EntryYaml };\n\n/** The entry for `key`, with its translation in every locale. */\nexport function readEntry(config: ResolvedConfig, key: string): EntryView {\n return viewOf(config, loadCatalog(config), key, new Map());\n}\n\n/**\n * Applies an edit and checks the catalog with it. With `write`, a clean edit is written; without, it\n * only comes back as the view, which is how the dialog turns fields into YAML and back.\n */\nexport function editEntry(config: ResolvedConfig, key: string, edit: EntryEdit, write: boolean): { view?: EntryView; problems: Problem[] } {\n const current = viewOf(config, loadCatalog(config), key, new Map());\n const unsaved = new Map<string, string>();\n const text = (file: string) => contentOf(config, file, unsaved);\n const put = (file: string, content: string) => unsaved.set(resolve(config.root, file), content);\n // Locales the edit gives a translation, which the checked catalog must then have.\n const translated: string[] = [];\n\n if ('yaml' in edit) {\n put(current.files.catalog, withSnippet(text(current.files.catalog), key, edit.yaml.catalog));\n for (const locale of current.locales) {\n const yaml = edit.yaml.translations?.[locale]?.trim() ?? current.yaml.translations[locale]!;\n if (yaml !== '') translated.push(locale);\n if (yaml === current.yaml.translations[locale]) continue;\n put(current.files.translations[locale]!, withSnippet(text(current.files.translations[locale]!), key, yaml));\n }\n } else {\n put(current.files.catalog, withFields(text(current.files.catalog), key, edit.fields, config.source));\n for (const locale of current.locales) {\n const next = edit.fields.translations[locale] ?? '';\n if (next.trim() !== '') translated.push(locale);\n if (next === current.fields.translations[locale]) continue;\n put(current.files.translations[locale]!, withTranslation(text(current.files.translations[locale]!), key, next));\n }\n }\n\n let catalog: Catalog;\n try {\n catalog = loadCatalog(config, unsaved);\n } catch (e) {\n if (!(e instanceof CatalogError)) throw e;\n return { problems: e.problems.filter((p) => p.severity === 'error') };\n }\n const message = catalog.messages.find((m) => m.key === key);\n const renamed = [\n ...(message === undefined ? [current.files.catalog] : []),\n ...translated.filter((l) => message?.translations.has(l) !== true).map((l) => current.files.translations[l]!),\n ];\n if (renamed.length > 0) {\n const problem = `the entry is still ${key}: rename a key in the code and the catalog together`;\n return { problems: renamed.map((file) => ({ severity: 'error', file, key, message: problem })) };\n }\n\n if (write) {\n for (const [path, content] of unsaved) {\n if (existsSync(path) && readFileSync(path, 'utf8') === content) continue;\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, content);\n }\n }\n return { view: viewOf(config, catalog, key, unsaved), problems: [] };\n}\n\n/**\n * Makes the edits that lint's findings carry, each message in its own file, and writes them only if\n * the catalog they make loads clean: the problems come back instead, and nothing is written.\n */\nexport function applyFixes(config: ResolvedConfig, catalog: Catalog, findings: Finding[]): { fixed: number; problems: Problem[] } {\n const unsaved = new Map<string, string>();\n const entries = new Map<string, { file: string; key: string; locale: string; edits: Edit[]; count: number }>();\n for (const f of findings) {\n if (f.fix === undefined) continue;\n const id = `${f.locale}\\u0000${f.key}`;\n const entry = entries.get(id) ?? { file: f.file, key: f.key, locale: f.locale, edits: [], count: 0 };\n entry.edits.push(...f.fix);\n entry.count += 1;\n entries.set(id, entry);\n }\n let fixed = 0;\n for (const { file, key, locale, edits, count } of entries.values()) {\n const message = catalog.messages.find((m) => m.key === key);\n const written = locale === config.source ? message?.text : message?.translations.get(locale)?.text;\n if (written === undefined) continue;\n const next = applyEdits(written, edits);\n if (next === written) continue;\n const content = contentOf(config, file, unsaved);\n unsaved.set(\n resolve(config.root, file),\n locale === config.source ? withMessage(content, key, next, config.source) : withTranslation(content, key, next),\n );\n fixed += count;\n }\n try {\n loadCatalog(config, unsaved);\n } catch (e) {\n if (!(e instanceof CatalogError)) throw e;\n return { fixed: 0, problems: e.problems.filter((p) => p.severity === 'error') };\n }\n for (const [path, content] of unsaved) writeFileSync(path, content);\n return { fixed, problems: [] };\n}\n\n/** A file as the edit has it, as it is on disk, or empty when it is still to be made. */\nfunction contentOf(config: ResolvedConfig, file: string, unsaved: Map<string, string>): string {\n const path = resolve(config.root, file);\n return unsaved.get(path) ?? (existsSync(path) ? readFileSync(path, 'utf8') : '');\n}\n\n/** The file a translation goes in: beside the locale's others, in its folder or its one file. */\nfunction translationFile(config: ResolvedConfig, message: Message, locale: string): string {\n const existing = message.translations.get(locale)?.file;\n if (existing !== undefined) return existing;\n const folder = join(config.locales, locale);\n const path = existsSync(folder) && statSync(folder).isDirectory() ? join(folder, `${message.area}.yaml`) : `${folder}.yaml`;\n return relative(config.root, path).replaceAll('\\\\', '/');\n}\n\nfunction viewOf(config: ResolvedConfig, catalog: Catalog, key: string, unsaved: Map<string, string>): EntryView {\n const message = catalog.messages.find((m) => m.key === key);\n if (message === undefined) throw new Error(`no entry for \"${key}\" in the catalog: has it been renamed since the page loaded?`);\n const files = Object.fromEntries(catalog.locales.map((l) => [l, translationFile(config, message, l)]));\n return {\n key,\n source: config.source,\n locales: catalog.locales,\n files: { catalog: message.file, translations: files },\n fields: {\n message: message.text,\n translations: Object.fromEntries(catalog.locales.map((l) => [l, message.translations.get(l)?.text ?? ''])),\n context: message.context ?? '',\n kind: message.kind ?? '',\n surface: message.surface ?? '',\n fragment: message.fragment,\n args: Object.fromEntries(message.argDocs),\n comment: message.comment ?? '',\n remove: message.remove,\n },\n yaml: {\n catalog: snippetOf(contentOf(config, message.file, unsaved), key)?.text ?? '',\n translations: Object.fromEntries(catalog.locales.map((l) => [l, snippetOf(contentOf(config, files[l]!, unsaved), key)?.text ?? ''])),\n },\n argNames: [...message.args.keys()],\n kinds: Object.keys(config.kinds),\n surfaces: Object.keys(config.surfaces),\n findings: lint([message], config).map((f) => {\n const written = f.locale === config.source ? message.text : message.translations.get(f.locale)?.text;\n return f.fix === undefined || written === undefined ? f : { ...f, fixed: applyEdits(written, f.fix) };\n }),\n };\n}\n\n/** Where an entry is written: from the start of its key's line to the end of its value. */\nfunction snippetOf(file: string, key: string): { start: number; end: number; text: string } | undefined {\n const doc = parseDocument(file);\n if (!isMap(doc.contents)) return undefined;\n const pair = doc.contents.items.find((p) => isScalar(p.key) && p.key.value === key);\n const keyStart = isScalar(pair?.key) ? pair.key.range?.[0] : undefined;\n const valueEnd = (pair?.value as { range?: [number, number, number] } | null | undefined)?.range?.[1];\n if (keyStart === undefined || valueEnd === undefined) return undefined;\n const start = file.lastIndexOf('\\n', keyStart - 1) + 1;\n // The last value in a file runs to its final newline; the snippet stops at the text.\n const end = start + file.slice(start, valueEnd).trimEnd().length;\n return { start, end, text: file.slice(start, end) };\n}\n\n/** The file with the entry's text replaced, removed when `yaml` is empty, or added at the end. */\nfunction withSnippet(file: string, key: string, yaml: string): string {\n const text = yaml.replace(/\\n+$/, '');\n const at = snippetOf(file, key);\n if (at !== undefined) {\n if (text.trim() === '') return file.slice(0, at.start) + file.slice(at.end).replace(/^\\n/, '');\n return file.slice(0, at.start) + text + file.slice(at.end);\n }\n if (text.trim() === '') return file;\n return file.trim() === '' ? `${text}\\n` : `${file.replace(/\\n*$/, '\\n')}${text}\\n`;\n}\n\n// As YAML 1.1, so a new value that 1.1 would read differently, like `n`, is quoted (as in migrate.ts).\n// An empty file starts as a plain mapping: under 1.1 a key set on nothing makes an `!!omap`.\nfunction parse(file: string): Document {\n const doc: Document = parseDocument(file, { version: '1.1' });\n if (doc.contents === null) doc.contents = doc.createNode({});\n return doc;\n}\n// New values quoted the way catalogs are; values already there keep how they were quoted.\nconst print = (doc: Document) => doc.toString({ lineWidth: 0, singleQuote: true });\n\n/** A value written where one was, keeping how it was quoted; text over several lines as a block. */\nfunction setValue(doc: Document, map: YAMLMap, name: string, value: unknown): void {\n const node = map.get(name, true);\n if (isScalar(node) && typeof value === 'string') {\n node.value = value;\n if (value.includes('\\n')) node.type = Scalar.BLOCK_LITERAL;\n return;\n }\n map.set(name, doc.createNode(value));\n}\n\nfunction withFields(file: string, key: string, fields: EntryFields, source: string): string {\n const doc = parse(file);\n let entry = doc.get(key, true);\n // `key: message` gains a mapping once it has anything to say about itself.\n if (!isMap(entry)) {\n entry = doc.createNode({ [source]: fields.message });\n doc.set(key, entry);\n }\n const map = entry as YAMLMap;\n const args = Object.fromEntries(Object.entries(fields.args).filter(([, v]) => v.trim() !== ''));\n const wanted: [string, unknown][] = [\n ['kind', fields.kind.trim() || undefined],\n ['surface', fields.surface.trim() || undefined],\n ['context', fields.context.trim() || undefined],\n ['args', Object.keys(args).length > 0 ? args : undefined],\n ['fragment', fields.fragment || undefined],\n ['comment', fields.comment.trim() || undefined],\n ['remove', fields.remove || undefined],\n ];\n for (const [name, value] of wanted) {\n if (value === undefined) {\n map.delete(name);\n continue;\n }\n if (map.has(name)) {\n setValue(doc, map, name, value);\n continue;\n }\n // A field the entry didn't have goes before the message, where the others are.\n const at = map.items.findIndex((p) => isScalar(p.key) && p.key.value === source);\n map.items.splice(at === -1 ? map.items.length : at, 0, doc.createPair(name, value));\n }\n setValue(doc, map, source, fields.message);\n return print(doc);\n}\n\n/** The source message replaced, and nothing else: a `key: message` entry stays one. */\nfunction withMessage(file: string, key: string, message: string, source: string): string {\n const doc = parse(file);\n const entry = doc.get(key, true);\n if (!isMap(entry)) return withTranslation(file, key, message);\n setValue(doc, entry, source, message);\n return print(doc);\n}\n\nfunction withTranslation(file: string, key: string, translation: string): string {\n const doc = parse(file);\n const node = doc.get(key, true);\n if (translation.trim() === '') {\n doc.delete(key);\n } else if (isScalar(node)) {\n node.value = translation;\n if (translation.includes('\\n')) node.type = Scalar.BLOCK_LITERAL;\n } else {\n doc.set(key, translation);\n }\n // A file left with nothing in it reads as no translations, not as `{}`.\n return isMap(doc.contents) && doc.contents.items.length === 0 ? '' : print(doc);\n}\n","/**\n * Stale translations: a translation made from source text that has since changed.\n *\n * The lock records, per translation, a hash of the source it was made from and a hash of the\n * translation itself. Editing the translation re-anchors it to the current source; editing only\n * the source leaves the old anchor in place, which is what marks it stale. Nobody has to remember\n * to flag anything: `prosebook status` lists what is stale, and `prosebook accept` re-anchors a\n * translation that was still right.\n *\n * The lock also keeps the text behind each anchor, once per distinct text, so a stale translation\n * can show its translator what changed rather than only what the source says now.\n */\nimport { createHash } from 'node:crypto';\nimport { existsSync, readFileSync } from 'node:fs';\n\nimport type { Catalog } from './catalog.ts';\n\nexport interface Lock {\n version: 2;\n /** Source text by hash: every text some translation is anchored to. */\n sources: Record<string, string>;\n /** Per locale, per key: `<source hash>:<translation hash>`. */\n translations: Record<string, Record<string, string>>;\n}\n\nexport function hash(text: string): string {\n return createHash('sha256').update(text).digest('hex').slice(0, 10);\n}\n\nexport function emptyLock(): Lock {\n return { version: 2, sources: {}, translations: {} };\n}\n\n/** The lock at `path`. A version 1 lock, which held only the translations, reads with no source texts. */\nexport function readLock(path: string): Lock {\n if (!existsSync(path)) return emptyLock();\n const raw = JSON.parse(readFileSync(path, 'utf8')) as Partial<Lock> | Record<string, Record<string, string>>;\n if ((raw as Partial<Lock>).version === 2) return { ...emptyLock(), ...(raw as Partial<Lock>) };\n return { version: 2, sources: {}, translations: raw as Record<string, Record<string, string>> };\n}\n\nconst sortedEntries = <T>(record: Record<string, T>) => Object.fromEntries(Object.entries(record).sort(([a], [b]) => (a < b ? -1 : 1)));\n\nexport function serializeLock(lock: Lock): string {\n const translations = Object.fromEntries(\n Object.keys(lock.translations)\n .sort()\n .map((locale) => [locale, sortedEntries(lock.translations[locale]!)]),\n );\n return `${JSON.stringify({ version: 2, sources: sortedEntries(lock.sources), translations }, null, 2)}\\n`;\n}\n\nexport interface StaleTranslation {\n /** The source the translation was made from, where the lock recorded it. */\n was: string | undefined;\n /** The source now. */\n now: string;\n /** The translation, made from `was`. */\n translation: string;\n}\n\nexport interface Reconciled {\n lock: Lock;\n /** Per locale, per key: the translations made from a source that has changed since. */\n stale: Map<string, Map<string, StaleTranslation>>;\n}\n\n/**\n * The lock brought up to date with the catalog, and what is stale. `accept` re-anchors the given\n * translations (per locale, keys, or `true` for all of them) to the current source.\n */\nexport function reconcile(catalog: Catalog, previous: Lock, accept: Map<string, Set<string> | true> = new Map()): Reconciled {\n const lock = emptyLock();\n const stale = new Map<string, Map<string, StaleTranslation>>();\n for (const message of catalog.messages) {\n const source = hash(message.text);\n for (const [locale, translation] of message.translations) {\n const text = hash(translation.text);\n const [anchor, recorded] = (previous.translations[locale]?.[message.key] ?? '').split(':');\n const accepted = accept.get(locale);\n const reanchor =\n anchor === undefined || anchor === '' || recorded !== text || accepted === true || accepted?.has(message.key) === true;\n const kept = reanchor ? source : anchor;\n (lock.translations[locale] ??= {})[message.key] = `${kept}:${text}`;\n const keptText = kept === source ? message.text : previous.sources[kept];\n if (keptText !== undefined) lock.sources[kept] = keptText;\n if (!reanchor && anchor !== source) {\n let keys = stale.get(locale);\n if (keys === undefined) stale.set(locale, (keys = new Map()));\n keys.set(message.key, { was: keptText, now: message.text, translation: translation.text });\n }\n }\n }\n return { lock, stale };\n}\n","/**\n * Pseudo-localization: the source with every letter accented, vowels doubled for the length a\n * translation usually adds, and brackets around the whole. A screen in the pseudo-locale shows at a\n * glance which text is hardcoded (it is plain), which is clipped (a bracket is missing), and which\n * splices fragments together (brackets inside brackets).\n */\nimport { TYPE, type MessageFormatElement } from './icu.ts';\n\nconst PLAIN = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\nconst ACCENTED = Array.from('áƀçðéƒĝĥíĵķļɱñóþǫŕšţúṽŵẋýžÁƁÇÐÉƑĜĤÍĴĶĻṀÑÓÞǪŔŠŢÚṼŴẊÝŽ');\n\nexport function pseudoText(text: string): string {\n return text.replace(/[A-Za-z]/g, (c) => {\n const accented = ACCENTED[PLAIN.indexOf(c)]!;\n return /[aeiou]/i.test(c) ? accented.repeat(2) : accented;\n });\n}\n\nfunction transform(elements: MessageFormatElement[]): MessageFormatElement[] {\n return elements.map((el) => {\n if (el.type === TYPE.literal) return { ...el, value: pseudoText(el.value) };\n if (el.type === TYPE.tag) return { ...el, children: transform(el.children) };\n if (el.type === TYPE.select || el.type === TYPE.plural) {\n const options = Object.fromEntries(Object.entries(el.options).map(([arm, o]) => [arm, { ...o, value: transform(o.value) }]));\n return { ...el, options };\n }\n return el;\n });\n}\n\nexport function pseudoAst(ast: MessageFormatElement[]): MessageFormatElement[] {\n const out: MessageFormatElement[] = [];\n // Adjacent literals are joined, so a message with no placeholders still compiles to a plain string.\n for (const el of [{ type: TYPE.literal, value: '⟦' }, ...transform(ast), { type: TYPE.literal, value: '⟧' }] as MessageFormatElement[]) {\n const last = out.at(-1);\n if (el.type === TYPE.literal && last?.type === TYPE.literal) out[out.length - 1] = { ...last, value: last.value + el.value };\n else out.push(el);\n }\n return out;\n}\n","/**\n * Turns the catalog into the modules an app imports.\n *\n * Generated rather than loaded so that a missing key, a misspelled key or a missing argument is a type\n * error, and so the runtime needs neither a YAML nor an ICU parser. The index carries each key's source\n * text and context as a doc comment, so hovering a key at its call site shows what the screen says.\n */\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join, relative } from 'node:path';\n\nimport { loadCatalog, type Catalog, type Message } from './catalog.ts';\nimport { compileLocale, localeModule, type Entry } from './compile.ts';\nimport type { ResolvedConfig } from './config.ts';\nimport { readLock, reconcile, serializeLock, type Lock, type StaleTranslation } from './lock.ts';\nimport { pseudoAst } from './pseudo.ts';\nimport { SYNTAX_NAME } from './syntax.ts';\n\nconst quote = (s: string) => JSON.stringify(s);\nconst prop = (name: string) => (/^[A-Za-z_$][\\w$]*$/.test(name) ? name : quote(name));\n\nfunction banner(config: ResolvedConfig): string {\n const from = relative(config.root, config.catalog).replaceAll('\\\\', '/');\n return `// Generated by prosebook from ${from}. Do not edit: change the catalog and run \\`prosebook generate\\`.`;\n}\n\n/** Every locale the app can switch to, in order: the source, the translations, the pseudo-locale. */\nexport function localesOf(catalog: Catalog, config: ResolvedConfig): string[] {\n return [config.source, ...catalog.locales, ...(config.pseudo !== false ? [config.pseudo] : [])];\n}\n\n/** Per locale, the messages its module holds. A translated locale holds only what it translates. */\nexport function localeEntries(\n catalog: Catalog,\n config: ResolvedConfig,\n stale: Map<string, Map<string, StaleTranslation>>,\n): Map<string, Entry[]> {\n const out = new Map<string, Entry[]>();\n out.set(\n config.source,\n catalog.messages.map((m) => [m.key, m.ast]),\n );\n for (const locale of catalog.locales) {\n const skip = config.stale === 'fallback' ? stale.get(locale) : undefined;\n out.set(\n locale,\n catalog.messages.flatMap((m): Entry[] => {\n const t = m.translations.get(locale);\n return t === undefined || skip?.has(m.key) === true ? [] : [[m.key, t.ast]];\n }),\n );\n }\n if (config.pseudo !== false) {\n out.set(\n config.pseudo,\n catalog.messages.map((m) => [m.key, pseudoAst(m.ast)]),\n );\n }\n return out;\n}\n\nfunction doc(lines: string[], indent: string): string {\n const safe = lines.map((l) => l.replaceAll('*/', '*\\\\/'));\n if (safe.length === 1) return `${indent}/** ${safe[0]} */\\n`;\n return `${indent}/**\\n${safe.map((l) => (l === '' ? `${indent} *` : `${indent} * ${l}`)).join('\\n')}\\n${indent} */\\n`;\n}\n\n/** A doc written as a phrase (`the person's name`) reads as a sentence in a doc comment. */\nfunction sentence(text: string): string {\n const capital = text.charAt(0).toUpperCase() + text.slice(1);\n return /[.!?]$/.test(capital) ? capital : `${capital}.`;\n}\n\nfunction shapeOf(m: Message): string {\n const tags = m.tags.length > 0 ? m.tags.map(quote).join(' | ') : 'never';\n if (m.args.size === 0) return `{ args: {}; tags: ${tags} }`;\n const fields = [...m.args].map(([name, type]) => {\n const held = m.argDocs.get(name);\n const said = [\n held === undefined ? undefined : sentence(held),\n m.argFormats.has(name) ? `Formatted as ${m.argFormats.get(name)}.` : undefined,\n ].filter(Boolean);\n return `${said.length > 0 ? doc([said.join(' ')], ' ') : ''} readonly ${prop(name)}: ${type};`;\n });\n return `{\\n args: {\\n${fields.join('\\n')}\\n };\\n tags: ${tags};\\n }`;\n}\n\nfunction typesBlock(catalog: Catalog, locales: string[]): string {\n const rows = catalog.messages.map((m) => {\n // An MF2 message with variants spans lines; each is a line of the doc comment.\n const lines = (m.text.length > 400 ? `${m.text.slice(0, 397)}...` : m.text).split('\\n');\n if (m.context) lines.push('', m.context);\n if (m.remove) lines.push('', 'Marked for removal in the catalog.');\n if (m.comment) lines.push('', `Comment: ${m.comment}`);\n return `${doc(lines, ' ')} ${quote(m.key)}: ${shapeOf(m)};`;\n });\n return [\n `export type Locale = ${locales.map(quote).join(' | ')};`,\n '',\n '/** Every message in the catalog: the arguments it takes and the tags it wraps text in. */',\n `export type Messages = {\\n${rows.join('\\n')}\\n};`,\n ].join('\\n');\n}\n\nconst REGISTER = `declare module 'prosebook' {\n interface Register {\n messages: Messages;\n locale: Locale;\n }\n}`;\n\nfunction catalogLiteral(config: ResolvedConfig, locales: string[], ext: string): { imports: string[]; literal: string } {\n const eager = locales.filter((l) => l === config.source || config.bundled.includes(l));\n const lazy = locales.filter((l) => !eager.includes(l));\n const ident = (l: string) => `m_${l.replace(/\\W/g, '_')}`;\n return {\n imports: eager.map((l) => `import ${ident(l)} from './${l}${ext}';`),\n literal: [\n '{',\n ` source: ${quote(config.source)},`,\n ` locales: [${locales.map(quote).join(', ')}],`,\n ` messages: { ${eager.map((l) => `${prop(l)}: ${ident(l)}`).join(', ')} },`,\n ` loaders: { ${lazy.map((l) => `${prop(l)}: () => import('./${l}${ext}')`).join(', ')} },`,\n '}',\n ].join('\\n'),\n };\n}\n\n/** The JSON Schema an editor reads to complete and explain catalog entries. */\nexport function catalogSchema(config: ResolvedConfig): object {\n // The shorthand satisfies no required field, so it's offered only where none is.\n const shorthand = { type: 'string', description: `The message, in ${SYNTAX_NAME[config.messageFormat]}, with nothing said about it.` };\n const entry = {\n type: 'object',\n required: [config.source, ...config.require],\n additionalProperties: false,\n properties: {\n [config.source]: { type: 'string', description: `The message, in ${SYNTAX_NAME[config.messageFormat]}.` },\n kind: {\n description: 'What sort of string it is.',\n oneOf: Object.entries(config.kinds).map(([k, r]) => ({ const: k, description: r.doc })),\n },\n surface: {\n description: 'Where the string sits.',\n oneOf: Object.entries(config.surfaces).map(([k, d]) => ({ const: k, description: d })),\n },\n context: { type: 'string', description: 'One sentence telling a translator where the string appears and what it answers to.' },\n args: { type: 'object', description: 'What each placeholder holds.', additionalProperties: { type: 'string' } },\n fragment: { type: 'boolean', description: 'Completes something beside it rather than standing as a sentence.' },\n comment: { type: 'string', description: 'A change asked of whoever edits the entry next. Make it, then delete the comment.' },\n remove: { type: 'boolean', description: 'Asks for the entry to go: delete it, its translations and the code that reads it.' },\n allow: {\n type: 'object',\n description: 'Lint rules this entry is exempt from, each with the reason.',\n propertyNames: { enum: Object.keys(config.lint.rules) },\n additionalProperties: { type: 'string' },\n },\n },\n };\n return {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n title: 'prosebook catalog',\n description: 'Generated by `prosebook generate` from the config. Do not edit.',\n type: 'object',\n propertyNames: { pattern: '^[a-z0-9]+(?:[-_][a-z0-9]+)*(?:\\\\.[a-z0-9]+(?:[-_][a-z0-9]+)*)+$' },\n additionalProperties: config.require.length === 0 ? { oneOf: [shorthand, entry] } : entry,\n };\n}\n\nexport interface Generated {\n catalog: Catalog;\n /** Absolute path to content. */\n files: Map<string, string>;\n lock: Lock;\n stale: Map<string, Map<string, StaleTranslation>>;\n entries: Map<string, Entry[]>;\n}\n\n/** Everything `generate` writes, in memory. */\nexport function render(config: ResolvedConfig, accept?: Map<string, Set<string> | true>): Generated {\n const catalog = loadCatalog(config);\n const { lock, stale } = reconcile(catalog, readLock(config.lock), accept);\n const locales = localesOf(catalog, config);\n const entries = localeEntries(catalog, config, stale);\n const ts = config.language === 'ts';\n const head = banner(config);\n const files = new Map<string, string>();\n\n for (const [locale, list] of entries)\n files.set(join(config.out, `${locale}.${ts ? 'ts' : 'js'}`), localeModule(compileLocale(list), head, ts));\n\n const { imports, literal } = catalogLiteral(config, locales, config.importExtension);\n const types = typesBlock(catalog, locales);\n if (ts) {\n files.set(\n join(config.out, 'index.ts'),\n [\n head,\n \"import { defineCatalog } from 'prosebook';\",\n ...imports,\n '',\n types,\n '',\n `export const catalog = defineCatalog<Messages, Locale>(${literal});`,\n '',\n REGISTER,\n '',\n ].join('\\n'),\n );\n } else {\n files.set(\n join(config.out, 'index.js'),\n [head, \"import { defineCatalog } from 'prosebook';\", ...imports, '', `export const catalog = defineCatalog(${literal});`, ''].join(\n '\\n',\n ),\n );\n files.set(\n join(config.out, 'index.d.ts'),\n [\n head,\n \"import type { Catalog } from 'prosebook';\",\n '',\n types,\n '',\n 'export declare const catalog: Catalog<Messages, Locale>;',\n '',\n REGISTER,\n '',\n ].join('\\n'),\n );\n }\n\n files.set(join(config.catalog, 'catalog.schema.json'), `${JSON.stringify(catalogSchema(config), null, 2)}\\n`);\n if (Object.keys(lock.translations).length > 0 || existsSync(config.lock)) files.set(config.lock, serializeLock(lock));\n return { catalog, files, lock, stale, entries };\n}\n\n/** Writes what changed. With `check`, writes nothing and returns what would have changed. */\nexport function writeFiles(files: Map<string, string>, check = false): string[] {\n const changed: string[] = [];\n for (const [path, content] of files) {\n const current = existsSync(path) ? readFileSync(path, 'utf8') : undefined;\n if (current === content) continue;\n changed.push(path);\n if (check) continue;\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, content);\n }\n return changed;\n}\n\nexport function generate(\n config: ResolvedConfig,\n options: { check?: boolean; accept?: Map<string, Set<string> | true> } = {},\n): Generated & { changed: string[] } {\n const generated = render(config, options.accept);\n return { ...generated, changed: writeFiles(generated.files, options.check) };\n}\n","/**\n * What the code says: text a person reads that is still written in a component, and which catalog\n * keys the code names.\n *\n * Key references are found by reading string literals, not by tracing calls, so a key kept in an\n * array or a map still counts, and `nav.${id}` or `'nav.' + id` keeps every key under `nav.`. That\n * errs towards keeping a key, which is the safe direction both for `unused` and for pruning a bundle.\n */\nimport { readdirSync, readFileSync, statSync } from 'node:fs';\nimport { extname, join, relative } from 'node:path';\n\nimport { parseSync } from 'oxc-parser';\n\nconst SKIP_DIRS = new Set(['node_modules', 'dist', 'build', 'out', 'coverage', '.git']);\n\nexport function sourceFiles(dirs: string[], extensions: string[], skip: string[] = []): string[] {\n const files: string[] = [];\n const visit = (dir: string) => {\n let names: string[];\n try {\n names = readdirSync(dir);\n } catch {\n return;\n }\n for (const name of names) {\n const path = join(dir, name);\n if (skip.some((s) => path === s || path.startsWith(`${s}/`) || path.startsWith(`${s}\\\\`))) continue;\n if (statSync(path).isDirectory()) {\n if (!SKIP_DIRS.has(name) && !name.startsWith('.')) visit(path);\n } else if (extensions.includes(extname(name)) && !name.endsWith('.d.ts')) {\n files.push(path);\n }\n }\n };\n for (const dir of dirs) visit(dir);\n return files.sort();\n}\n\nexport interface KeyRefs {\n exact: Set<string>;\n /** `nav.` from `nav.${id}` or `'nav.' + id`: every key under it may be read. */\n prefixes: Set<string>;\n}\n\nconst LITERAL_KEY = /(['\"`])([a-z0-9][\\w-]*(?:\\.[\\w-]+)+)\\1/g;\nconst KEY_PREFIX = /(['\"`])([a-z0-9][\\w-]*(?:\\.[\\w-]+)*\\.)(?:\\1|\\$\\{)/g;\n\nexport function keyRefs(code: string, into: KeyRefs = { exact: new Set(), prefixes: new Set() }): KeyRefs {\n for (const m of code.matchAll(LITERAL_KEY)) into.exact.add(m[2]!);\n for (const m of code.matchAll(KEY_PREFIX)) into.prefixes.add(m[2]!);\n return into;\n}\n\nexport function isReferenced(key: string, refs: KeyRefs): boolean {\n if (refs.exact.has(key)) return true;\n for (const prefix of refs.prefixes) if (key.startsWith(prefix)) return true;\n return false;\n}\n\nexport interface Hardcoded {\n file: string;\n line: number;\n column: number;\n text: string;\n /** Where it sits: `text`, or the attribute it is the value of. */\n where: string;\n}\n\ntype Node = { type: string; start: number; end: number; [field: string]: unknown };\n\n/**\n * Text that reads as code rather than prose: one token holding a path, a call, an identifier with an\n * underscore or a dotted name, as in `form.json()` or `src/index.ts`. Trailing punctuation doesn't\n * count, so `Done.` is still prose.\n */\nexport function looksLikeCode(text: string): boolean {\n const token = text.trim().replace(/[.!?:,…]+$/, '');\n return token !== '' && !/\\s/.test(token) && /[/()_=<>{}[\\].]|::/.test(token);\n}\n\nconst NON_PROSE_ELEMENTS = new Set(['code', 'pre', 'kbd', 'samp', 'script', 'style', 'svg', 'path']);\nconst LETTER = /\\p{L}/u;\n\n/** Offsets in `code` as lines and columns, and whether a line is marked `prosebook-ignore`, on it or the line above. */\nfunction lineIndex(code: string) {\n const lines = code.split('\\n');\n const lineStarts: number[] = [];\n let offset = 0;\n for (const line of lines) {\n lineStarts.push(offset);\n offset += line.length + 1;\n }\n const position = (at: number) => {\n let lo = 0;\n let hi = lineStarts.length - 1;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (lineStarts[mid]! <= at) lo = mid;\n else hi = mid - 1;\n }\n return { line: lo + 1, column: at - lineStarts[lo]! + 1 };\n };\n const ignored = (line: number) =>\n (lines[line - 1] ?? '').includes('prosebook-ignore') || (lines[line - 2] ?? '').includes('prosebook-ignore');\n return { position, ignored };\n}\n\n/** Literal text in JSX that a person reads, where it should be a catalog entry. */\nexport function hardcodedText(file: string, code: string, attributes: string[]): Hardcoded[] {\n const { program } = parseSync(file, code);\n const found: Hardcoded[] = [];\n const { position, ignored } = lineIndex(code);\n const report = (node: Node, text: string, where: string) => {\n const trimmed = text.replace(/\\s+/g, ' ').trim();\n if (!LETTER.test(trimmed) || looksLikeCode(trimmed)) return;\n const at = position(node.start + Math.max(0, code.slice(node.start, node.end).search(/\\S/)));\n if (ignored(at.line)) return;\n found.push({ file, ...at, text: trimmed, where });\n };\n\n const visit = (node: Node, inProse: boolean) => {\n let prose = inProse;\n if (node.type === 'JSXElement') {\n const opening = node.openingElement as Node & { name: Node & { name?: string } };\n if (opening.name.type === 'JSXIdentifier' && NON_PROSE_ELEMENTS.has(opening.name.name ?? '')) prose = false;\n }\n if (node.type === 'JSXText' && prose) report(node, node.value as string, 'text');\n if (node.type === 'JSXExpressionContainer' && prose) {\n const expr = node.expression as Node;\n if (expr.type === 'Literal' && typeof expr.value === 'string') report(expr, expr.value, 'text');\n if (expr.type === 'TemplateLiteral' && (expr.expressions as Node[]).length === 0)\n report(expr, String((expr.quasis as { value: { cooked: string } }[])[0]?.value.cooked), 'text');\n }\n if (node.type === 'JSXAttribute') {\n const name = node.name as Node & { name?: string };\n const value = node.value as Node | null;\n const attr = name.type === 'JSXIdentifier' ? (name.name ?? '') : '';\n if (attributes.includes(attr) && value !== null) {\n if (value.type === 'Literal' && typeof value.value === 'string') report(value, value.value, attr);\n if (value.type === 'JSXExpressionContainer') {\n const expr = value.expression as Node;\n if (expr.type === 'Literal' && typeof expr.value === 'string') report(expr, expr.value, attr);\n }\n }\n return;\n }\n for (const value of Object.values(node)) {\n if (Array.isArray(value)) {\n for (const child of value) if (isNode(child)) visit(child, prose);\n } else if (isNode(value)) {\n visit(value, prose);\n }\n }\n };\n visit(program as unknown as Node, true);\n return found;\n}\n\nfunction isNode(value: unknown): value is Node {\n return typeof value === 'object' && value !== null && typeof (value as Node).type === 'string';\n}\n\nexport interface ScanResult {\n hardcoded: Hardcoded[];\n refs: KeyRefs;\n files: number;\n}\n\nexport function scan(dirs: string[], extensions: string[], attributes: string[], root: string, skip: string[] = []): ScanResult {\n const refs: KeyRefs = { exact: new Set(), prefixes: new Set() };\n const hardcoded: Hardcoded[] = [];\n const files = sourceFiles(dirs, extensions, skip);\n for (const path of files) {\n const code = readFileSync(path, 'utf8');\n keyRefs(code, refs);\n if (/\\.[jt]sx$/.test(path)) hardcoded.push(...hardcodedText(relative(root, path).replaceAll('\\\\', '/'), code, attributes));\n }\n return { hardcoded, refs, files: files.length };\n}\n\n/** A copy's methods that take a key first. */\nexport const READERS = new Set(['t', 'rich']);\n\nexport interface UnseenRead {\n file: string;\n line: number;\n column: number;\n /** The read as written, on one line. */\n code: string;\n /** What it calls: a reader, the name it was imported by, or `Text`. */\n name: string;\n}\n\nexport interface Reads {\n /** Reads whose key a build can't see, in calls that may be to a copy's `t` or `rich`. */\n unseen: UnseenRead[];\n /** Names a copy's readers are bound to here, as in `const { rich: tRich } = copy`. */\n aliases: Set<string>;\n}\n\nconst PREFIX = /^[a-z0-9][\\w-]*(?:\\.[\\w-]+)*\\.$/;\nconst WRAPPERS = new Set(['ParenthesizedExpression', 'TSAsExpression', 'TSSatisfiesExpression', 'TSNonNullExpression', 'TSTypeAssertion']);\n\n/** Whether `keyRefs` finds every key an expression can be: a literal, or a template or sum after a key prefix. */\nfunction keySeen(node: Node | undefined): boolean {\n if (node === undefined) return false;\n if (WRAPPERS.has(node.type)) return keySeen(node.expression as Node);\n switch (node.type) {\n case 'Literal':\n return typeof node.value === 'string';\n case 'TemplateLiteral': {\n const [head] = node.quasis as { value: { cooked: string | null } }[];\n return (node.expressions as Node[]).length === 0 || PREFIX.test(head?.value.cooked ?? '');\n }\n case 'BinaryExpression': {\n const left = node.left as Node;\n return node.operator === '+' && left.type === 'Literal' && typeof left.value === 'string' && PREFIX.test(left.value);\n }\n case 'ConditionalExpression':\n return keySeen(node.consequent as Node) && keySeen(node.alternate as Node);\n case 'LogicalExpression':\n return keySeen(node.left as Node) && keySeen(node.right as Node);\n default:\n return false;\n }\n}\n\nconst nameOf = (node: Node | undefined): string | undefined =>\n node?.type === 'Identifier' || node?.type === 'JSXIdentifier'\n ? (node.name as string)\n : node?.type === 'Literal'\n ? String(node.value)\n : undefined;\n\n/**\n * The reads in a module whose key a pruned build can't see, as in `t(item.key)` or `<Text id={id} />`:\n * the build would leave the message out, and the key would show in its place. A build has no types,\n * so readers are known by name: `t` and `rich` called alone or as methods, and any name imported here,\n * which may be bound to one elsewhere (`aliases`); the caller keeps those whose name turns out to be a\n * reader. `<Text>` counts where it is imported from `prosebook/react`. Lines marked `prosebook-ignore`\n * are skipped.\n */\nexport function unseenReads(file: string, code: string): Reads {\n const { program } = parseSync(file, code);\n const { position, ignored } = lineIndex(code);\n const unseen: UnseenRead[] = [];\n const aliases = new Set<string>();\n /** Local name to the name it was imported by. */\n const imported = new Map<string, string>();\n const texts = new Set<string>();\n for (const statement of (program as unknown as Node).body as Node[]) {\n if (statement.type !== 'ImportDeclaration') continue;\n for (const s of statement.specifiers as Node[]) {\n const name = s.type === 'ImportSpecifier' ? nameOf(s.imported as Node) : undefined;\n const local = nameOf(s.local as Node);\n if (name === undefined || local === undefined) continue;\n if (name === 'Text' && (statement.source as Node).value === 'prosebook/react') texts.add(local);\n else imported.set(local, name);\n }\n }\n const report = (node: Node, name: string) => {\n const at = position(node.start);\n if (ignored(at.line)) return;\n const text = code.slice(node.start, node.end).replace(/\\s+/g, ' ');\n unseen.push({ file, ...at, name, code: text.length > 80 ? `${text.slice(0, 77)}...` : text });\n };\n // Calls by a plain name, kept until every alias in the module is known.\n const calls: [Node, string][] = [];\n const visit = (node: Node) => {\n if (node.type === 'ObjectPattern') {\n for (const p of node.properties as Node[]) {\n if (p.type === 'Property' && READERS.has(nameOf(p.key as Node) ?? '') && (p.value as Node).type === 'Identifier')\n aliases.add(nameOf(p.value as Node)!);\n }\n }\n if (node.type === 'CallExpression' && !keySeen((node.arguments as Node[])[0])) {\n const callee = node.callee as Node;\n if (callee.type === 'Identifier') calls.push([node, callee.name as string]);\n else if (callee.type === 'MemberExpression' && !callee.computed && READERS.has(nameOf(callee.property as Node) ?? ''))\n report(node, nameOf(callee.property as Node)!);\n }\n if (node.type === 'JSXOpeningElement' && texts.has(nameOf(node.name as Node) ?? '')) {\n const id = (node.attributes as Node[]).find((a) => a.type === 'JSXAttribute' && nameOf(a.name as Node) === 'id');\n const value = id?.value as Node | null | undefined;\n if (value !== null && value !== undefined && !keySeen(value.type === 'JSXExpressionContainer' ? (value.expression as Node) : value))\n report(node, 'Text');\n }\n for (const value of Object.values(node)) {\n if (Array.isArray(value)) {\n for (const child of value) if (isNode(child)) visit(child);\n } else if (isNode(value)) {\n visit(value);\n }\n }\n };\n visit(program as unknown as Node);\n for (const [node, local] of calls) {\n if (READERS.has(local) || aliases.has(local)) report(node, local);\n else if (imported.has(local)) report(node, imported.get(local)!);\n }\n unseen.sort((a, b) => (a.line === b.line ? a.column - b.column : a.line - b.line));\n return { unseen, aliases };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,MAAM,KAAwB;CAC5C,OAAOA,QAAM,OAAO,KAAK,KAAA,CAAS,GAAG,KAAK;AAC5C;AAEA,MAAM,iBAAiB;CAAC;CAAQ;CAAO;CAAO;CAAO;CAAQ;AAAO;;;;;AAMpE,SAASA,QAAM,UAAqB,UAA2B;CAC7D,OAAO,SACJ,KAAK,IAAI,MAAM;EACd,QAAQ,GAAG,MAAX;GACE,KAAK,KAAK,SACR,OAAO,OAAO,GAAG,OAAO,UAAU,SAAS,IAAI,OAAO,KAAA,CAAS;GACjE,KAAK,KAAK,UACR,OAAO,IAAI,GAAG,MAAM;GACtB,KAAK,KAAK;GACV,KAAK,KAAK;GACV,KAAK,KAAK,MAAM;IACd,MAAM,OAAO,GAAG,SAAS,KAAK,SAAS,WAAW,GAAG,SAAS,KAAK,OAAO,SAAS;IACnF,MAAM,QAAQ,GAAG;IACjB,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO,IAAI,GAAG,MAAM,IAAI,KAAK;IACxE,IAAI,OAAO,UAAU,UAAU,OAAO,IAAI,GAAG,MAAM,IAAI,KAAK,IAAI,MAAM;IACtE,MAAM,WAAW,YAAY,QAAQ,MAAM,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,MAAM;IACjH,OAAO,IAA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