@intlayer/core 8.11.0 → 8.11.2

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 (125) hide show
  1. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +0 -1
  2. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -1
  3. package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs +0 -1
  4. package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs.map +1 -1
  5. package/dist/cjs/formatters/compact.cjs +0 -1
  6. package/dist/cjs/formatters/compact.cjs.map +1 -1
  7. package/dist/cjs/formatters/currency.cjs +0 -1
  8. package/dist/cjs/formatters/currency.cjs.map +1 -1
  9. package/dist/cjs/formatters/date.cjs +0 -1
  10. package/dist/cjs/formatters/date.cjs.map +1 -1
  11. package/dist/cjs/formatters/list.cjs +0 -1
  12. package/dist/cjs/formatters/list.cjs.map +1 -1
  13. package/dist/cjs/formatters/number.cjs +0 -1
  14. package/dist/cjs/formatters/number.cjs.map +1 -1
  15. package/dist/cjs/formatters/percentage.cjs +0 -1
  16. package/dist/cjs/formatters/percentage.cjs.map +1 -1
  17. package/dist/cjs/formatters/relativeTime.cjs +0 -1
  18. package/dist/cjs/formatters/relativeTime.cjs.map +1 -1
  19. package/dist/cjs/formatters/units.cjs +0 -1
  20. package/dist/cjs/formatters/units.cjs.map +1 -1
  21. package/dist/cjs/index.cjs +3 -1
  22. package/dist/cjs/interpreter/getCondition.cjs.map +1 -1
  23. package/dist/cjs/interpreter/getContent/getContent.cjs +0 -1
  24. package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
  25. package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
  26. package/dist/cjs/interpreter/getEnumeration.cjs.map +1 -1
  27. package/dist/cjs/interpreter/getGender.cjs.map +1 -1
  28. package/dist/cjs/interpreter/getIntlayer.cjs +0 -1
  29. package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
  30. package/dist/cjs/interpreter/getNesting.cjs.map +1 -1
  31. package/dist/cjs/interpreter/getPlural.cjs.map +1 -1
  32. package/dist/cjs/interpreter/getTranslation.cjs.map +1 -1
  33. package/dist/cjs/localization/getBrowserLocale.cjs +0 -21
  34. package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -1
  35. package/dist/cjs/localization/getLocale.cjs +0 -1
  36. package/dist/cjs/localization/getLocale.cjs.map +1 -1
  37. package/dist/cjs/localization/getLocalizedUrl.cjs +0 -1
  38. package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
  39. package/dist/cjs/localization/getPathWithoutLocale.cjs +0 -1
  40. package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -1
  41. package/dist/cjs/localization/getPrefix.cjs +0 -1
  42. package/dist/cjs/localization/getPrefix.cjs.map +1 -1
  43. package/dist/cjs/localization/index.cjs +0 -1
  44. package/dist/cjs/localization/localeMapper.cjs +0 -1
  45. package/dist/cjs/localization/localeMapper.cjs.map +1 -1
  46. package/dist/cjs/localization/localeResolver.cjs +0 -1
  47. package/dist/cjs/localization/localeResolver.cjs.map +1 -1
  48. package/dist/cjs/markdown/compiler.cjs +53 -31
  49. package/dist/cjs/markdown/compiler.cjs.map +1 -1
  50. package/dist/cjs/markdown/index.cjs +2 -0
  51. package/dist/cjs/transpiler/condition/condition.cjs +0 -1
  52. package/dist/cjs/transpiler/condition/condition.cjs.map +1 -1
  53. package/dist/cjs/transpiler/enumeration/enumeration.cjs +0 -1
  54. package/dist/cjs/transpiler/enumeration/enumeration.cjs.map +1 -1
  55. package/dist/cjs/transpiler/file/file.cjs +0 -1
  56. package/dist/cjs/transpiler/file/file.cjs.map +1 -1
  57. package/dist/cjs/transpiler/gender/gender.cjs +0 -1
  58. package/dist/cjs/transpiler/gender/gender.cjs.map +1 -1
  59. package/dist/cjs/transpiler/html/html.cjs +0 -1
  60. package/dist/cjs/transpiler/html/html.cjs.map +1 -1
  61. package/dist/cjs/transpiler/insertion/insertion.cjs +0 -1
  62. package/dist/cjs/transpiler/insertion/insertion.cjs.map +1 -1
  63. package/dist/cjs/transpiler/markdown/markdown.cjs +0 -1
  64. package/dist/cjs/transpiler/markdown/markdown.cjs.map +1 -1
  65. package/dist/cjs/transpiler/nesting/nesting.cjs +0 -1
  66. package/dist/cjs/transpiler/nesting/nesting.cjs.map +1 -1
  67. package/dist/cjs/transpiler/plural/plural.cjs +0 -1
  68. package/dist/cjs/transpiler/plural/plural.cjs.map +1 -1
  69. package/dist/cjs/transpiler/translation/translation.cjs +0 -1
  70. package/dist/cjs/transpiler/translation/translation.cjs.map +1 -1
  71. package/dist/cjs/utils/index.cjs +1 -0
  72. package/dist/cjs/utils/intl.cjs +0 -1
  73. package/dist/cjs/utils/intl.cjs.map +1 -1
  74. package/dist/cjs/utils/localeStorage.cjs +21 -3
  75. package/dist/cjs/utils/localeStorage.cjs.map +1 -1
  76. package/dist/esm/index.mjs +4 -4
  77. package/dist/esm/interpreter/getCondition.mjs.map +1 -1
  78. package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
  79. package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
  80. package/dist/esm/interpreter/getEnumeration.mjs.map +1 -1
  81. package/dist/esm/interpreter/getGender.mjs.map +1 -1
  82. package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
  83. package/dist/esm/interpreter/getNesting.mjs.map +1 -1
  84. package/dist/esm/interpreter/getPlural.mjs.map +1 -1
  85. package/dist/esm/interpreter/getTranslation.mjs.map +1 -1
  86. package/dist/esm/localization/getBrowserLocale.mjs +1 -20
  87. package/dist/esm/localization/getBrowserLocale.mjs.map +1 -1
  88. package/dist/esm/localization/index.mjs +2 -2
  89. package/dist/esm/markdown/compiler.mjs +44 -24
  90. package/dist/esm/markdown/compiler.mjs.map +1 -1
  91. package/dist/esm/markdown/index.mjs +2 -2
  92. package/dist/esm/utils/index.mjs +2 -2
  93. package/dist/esm/utils/localeStorage.mjs +20 -2
  94. package/dist/esm/utils/localeStorage.mjs.map +1 -1
  95. package/dist/types/index.d.ts +4 -4
  96. package/dist/types/interpreter/getCondition.d.ts +1 -1
  97. package/dist/types/interpreter/getCondition.d.ts.map +1 -1
  98. package/dist/types/interpreter/getContent/getContent.d.ts +1 -1
  99. package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -1
  100. package/dist/types/interpreter/getDictionary.d.ts +1 -1
  101. package/dist/types/interpreter/getDictionary.d.ts.map +1 -1
  102. package/dist/types/interpreter/getEnumeration.d.ts +2 -2
  103. package/dist/types/interpreter/getEnumeration.d.ts.map +1 -1
  104. package/dist/types/interpreter/getGender.d.ts +1 -1
  105. package/dist/types/interpreter/getGender.d.ts.map +1 -1
  106. package/dist/types/interpreter/getIntlayer.d.ts +1 -1
  107. package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
  108. package/dist/types/interpreter/getNesting.d.ts +1 -1
  109. package/dist/types/interpreter/getNesting.d.ts.map +1 -1
  110. package/dist/types/interpreter/getPlural.d.ts +1 -1
  111. package/dist/types/interpreter/getPlural.d.ts.map +1 -1
  112. package/dist/types/interpreter/getTranslation.d.ts +1 -1
  113. package/dist/types/interpreter/getTranslation.d.ts.map +1 -1
  114. package/dist/types/localization/getBrowserLocale.d.ts +1 -3
  115. package/dist/types/localization/getBrowserLocale.d.ts.map +1 -1
  116. package/dist/types/localization/getPrefix.d.ts +5 -5
  117. package/dist/types/localization/getPrefix.d.ts.map +1 -1
  118. package/dist/types/localization/index.d.ts +2 -2
  119. package/dist/types/markdown/compiler.d.ts +12 -1
  120. package/dist/types/markdown/compiler.d.ts.map +1 -1
  121. package/dist/types/markdown/index.d.ts +2 -2
  122. package/dist/types/utils/index.d.ts +2 -2
  123. package/dist/types/utils/localeStorage.d.ts +2 -1
  124. package/dist/types/utils/localeStorage.d.ts.map +1 -1
  125. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.cjs","names":["get","cx","defaultSlugify","defaultSanitizer","NAMED_CODES_TO_UNICODE","ORDERED_LIST_R","UNORDERED_LIST_R","ORDERED_LIST_ITEM_R","UNORDERED_LIST_ITEM_R","ORDERED_LIST_ITEM_PREFIX_R","UNORDERED_LIST_ITEM_PREFIX_R","allowInline","LIST_LOOKBEHIND_R","Priority","BLOCK_END_R","trimEnd","some","RuleType","blockRegex","BLOCKQUOTE_R","BLOCKQUOTE_TRIM_LEFT_MULTILINE_R","BLOCKQUOTE_ALERT_R","parseBlock","parseInline","anyScopeRegex","BREAK_LINE_R","captureNothing","BREAK_THEMATIC_R","CODE_BLOCK_R","unescapeString","CODE_BLOCK_FENCED_R","simpleInlineRegex","CODE_INLINE_R","FOOTNOTE_R","renderNothing","inlineRegex","FOOTNOTE_REFERENCE_R","GFM_TASK_R","HEADING_ATX_COMPLIANT_R","HEADING_R","HEADING_SETEXT_R","HTML_BLOCK_ELEMENT_R","HTML_LEFT_TRIM_AMOUNT_R","trimLeadingWhitespaceOutsideFences","DO_NOT_PROCESS_HTML_ELEMENTS","HTML_COMMENT_R","HTML_SELF_CLOSING_ELEMENT_R","CUSTOM_COMPONENT_R","parseCaptureInline","parseSimpleInline","LINK_AUTOLINK_R","startsWith","LINK_AUTOLINK_BARE_URL_R","CONSECUTIVE_NEWLINE_R","REFERENCE_IMAGE_OR_LINK","REFERENCE_IMAGE_R","REFERENCE_LINK_R","NP_TABLE_R","parseTableAlign","parseTableCells","parseTableRow","SHORTCODE_R","TEXT_PLAIN_R","HTML_CHAR_CODE_R","TEXT_BOLD_R","TEXT_EMPHASIZED_R","TEXT_ESCAPED_R","TEXT_MARKED_R","TEXT_STRIKETHROUGHED_R","ATTR_EXTRACTOR_R","normalizeAttributeKey","unquote","ATTRIBUTE_TO_NODE_PROP_MAP","attributeValueToNodePropValue","TRIM_STARTING_NEWLINES","PARAGRAPH_R","parserFor","renderFor","createRenderer","FRONT_MATTER_R","SHOULD_RENDER_AS_BLOCK_R"],"sources":["../../../src/markdown/compiler.ts"],"sourcesContent":["import {\n ATTR_EXTRACTOR_R,\n ATTRIBUTE_TO_NODE_PROP_MAP,\n BLOCK_END_R,\n BLOCKQUOTE_ALERT_R,\n BLOCKQUOTE_R,\n BLOCKQUOTE_TRIM_LEFT_MULTILINE_R,\n BREAK_LINE_R,\n BREAK_THEMATIC_R,\n CODE_BLOCK_FENCED_R,\n CODE_BLOCK_R,\n CODE_INLINE_R,\n CONSECUTIVE_NEWLINE_R,\n CUSTOM_COMPONENT_R,\n DO_NOT_PROCESS_HTML_ELEMENTS,\n FOOTNOTE_R,\n FOOTNOTE_REFERENCE_R,\n FRONT_MATTER_R,\n GFM_TASK_R,\n HEADING_ATX_COMPLIANT_R,\n HEADING_R,\n HEADING_SETEXT_R,\n HTML_BLOCK_ELEMENT_R,\n HTML_CHAR_CODE_R,\n HTML_COMMENT_R,\n HTML_LEFT_TRIM_AMOUNT_R,\n HTML_SELF_CLOSING_ELEMENT_R,\n LINK_AUTOLINK_BARE_URL_R,\n LINK_AUTOLINK_R,\n LIST_LOOKBEHIND_R,\n type ListType,\n NAMED_CODES_TO_UNICODE,\n NP_TABLE_R,\n ORDERED,\n ORDERED_LIST_ITEM_PREFIX_R,\n ORDERED_LIST_ITEM_R,\n ORDERED_LIST_R,\n PARAGRAPH_R,\n Priority,\n REFERENCE_IMAGE_OR_LINK,\n REFERENCE_IMAGE_R,\n REFERENCE_LINK_R,\n RuleType,\n SHORTCODE_R,\n SHOULD_RENDER_AS_BLOCK_R,\n TEXT_BOLD_R,\n TEXT_EMPHASIZED_R,\n TEXT_ESCAPED_R,\n TEXT_MARKED_R,\n TEXT_PLAIN_R,\n TEXT_STRIKETHROUGHED_R,\n TRIM_STARTING_NEWLINES,\n UNORDERED,\n UNORDERED_LIST_ITEM_PREFIX_R,\n UNORDERED_LIST_ITEM_R,\n UNORDERED_LIST_R,\n} from './constants';\nimport { parserFor } from './parser';\nimport { createRenderer, renderFor } from './renderer';\nimport type {\n CompileOptions,\n ComponentOverrides as ComponentDefinition,\n HeadingNode,\n HTMLTag,\n MarkdownContext,\n MarkdownOptions,\n MarkdownRuntime,\n OrderedListNode,\n ParseState,\n Rule,\n Rules,\n TableNode,\n UnorderedListNode,\n} from './types';\nimport {\n allowInline,\n anyScopeRegex,\n attributeValueToNodePropValue,\n blockRegex,\n captureNothing,\n cx,\n sanitizer as defaultSanitizer,\n slugify as defaultSlugify,\n get,\n inlineRegex,\n normalizeAttributeKey,\n parseBlock,\n parseCaptureInline,\n parseInline,\n parseSimpleInline,\n parseTableAlign,\n parseTableCells,\n parseTableRow,\n renderNothing,\n simpleInlineRegex,\n some,\n startsWith,\n trimEnd,\n trimLeadingWhitespaceOutsideFences,\n unescapeString,\n unquote,\n} from './utils';\n\ntype CreateElementFunction = (\n tag: any,\n props: Record<string, any> | null,\n ...children: any[]\n) => unknown;\n\ntype FootnoteDef = { footnote: string; identifier: string };\n\nconst IMAGE_R = /^!\\[(.*?)\\]\\( *((?:\\([^)]*\\)|[^() ])*) *\"?([^)\"]*)?\"?\\)/;\nconst LINK_INSIDE =\n '(?:\\\\[[^\\\\[\\\\]]*(?:\\\\[[^\\\\[\\\\]]*\\\\][^\\\\[\\\\]]*)*\\\\]|[^\\\\[\\\\]])*';\nconst LINK_HREF_AND_TITLE =\n '\\\\s*<?((?:\\\\([^)]*\\\\)|[^\\\\s\\\\\\\\]|\\\\\\\\.)*?)>?(?:\\\\s+[\\'\"]([\\\\s\\\\S]*?)[\\'\"])?\\\\s*';\nconst LINK_R = new RegExp(\n `^\\\\[(${LINK_INSIDE})\\\\]\\\\(${LINK_HREF_AND_TITLE}\\\\)`\n);\n\nconst getTag = (tag: any, components: ComponentDefinition<any>): any => {\n if (typeof tag !== 'string') return tag;\n let override = get(components, tag);\n\n if (!override && typeof tag === 'string') {\n const lowercaseTag = tag.toLowerCase();\n // Try case-insensitive lookup\n const key = Object.keys(components).find(\n (k) => k.toLowerCase() === lowercaseTag\n );\n if (key) {\n override = get(components, key);\n }\n }\n\n if (!override) return tag;\n\n return override;\n};\n\nconst createElementFactory = (\n ctx: MarkdownContext<any>,\n options: MarkdownOptions\n): CreateElementFunction => {\n const { runtime, components = {} } = ctx;\n const filteredTags = options.tagfilter\n ? [\n 'title',\n 'textarea',\n 'style',\n 'xmp',\n 'iframe',\n 'noembed',\n 'noframes',\n 'script',\n 'plaintext',\n ]\n : [];\n\n return (\n tag: any,\n props: Record<string, any> | null,\n ...children: any[]\n ): unknown => {\n if (typeof tag === 'string' && filteredTags.includes(tag.toLowerCase())) {\n return null;\n }\n\n const isStringTag = typeof tag === 'string';\n\n const className = cx(props?.className, props?.class);\n\n const mergedProps: Record<string, any> = {};\n let classNameHandled = false;\n\n // Preserve attribute order while merging className\n if (props) {\n for (const key in props) {\n const value = props[key];\n\n if (value === undefined || value === null) continue;\n\n if (key === 'className' || key === 'class') {\n if (!classNameHandled) {\n if (className) mergedProps.className = className;\n classNameHandled = true;\n }\n } else {\n mergedProps[key] = value;\n }\n }\n }\n\n if (!classNameHandled && className) {\n mergedProps.className = className;\n }\n\n let finalProps = mergedProps;\n\n if (runtime.normalizeProps && isStringTag)\n finalProps = runtime.normalizeProps(tag as string, mergedProps);\n const component = getTag(tag, components);\n\n return runtime.createElement(\n component,\n finalProps,\n ...(children.length === 1 ? [children[0]] : children)\n );\n };\n};\n\nconst createRules = (\n createElement: CreateElementFunction,\n ctx: MarkdownContext<any>,\n options: MarkdownOptions,\n footnotes: FootnoteDef[],\n refs: Record<string, { target: string; title?: string }>,\n attrStringToMap: (tag: HTMLTag, str: string) => Record<string, any> | null,\n containsBlockSyntax: (input: string) => boolean,\n nonParagraphBlockSyntaxes: RegExp[]\n): Rules => {\n const slug = (input: string) => {\n if (process.env.NODE_ENV === 'test' && input === '中文') {\n const def = defaultSlugify(input);\n console.log('Slug check:', {\n input,\n ctxSlugify: !!ctx.slugify,\n defaultSlugifyResult: def,\n });\n }\n return ctx.slugify\n ? ctx.slugify(input, defaultSlugify)\n : defaultSlugify(input);\n };\n const sanitize = ctx.sanitizer ?? defaultSanitizer;\n const namedCodesToUnicode = ctx.namedCodesToUnicode\n ? { ...NAMED_CODES_TO_UNICODE, ...ctx.namedCodesToUnicode }\n : NAMED_CODES_TO_UNICODE;\n\n const generateListRule = (\n type: ListType\n ): Rule<OrderedListNode | UnorderedListNode> => {\n const ordered = type === ORDERED;\n const LIST_R = ordered ? ORDERED_LIST_R : UNORDERED_LIST_R;\n const LIST_ITEM_R = ordered ? ORDERED_LIST_ITEM_R : UNORDERED_LIST_ITEM_R;\n const LIST_ITEM_PREFIX_R = ordered\n ? ORDERED_LIST_ITEM_PREFIX_R\n : UNORDERED_LIST_ITEM_PREFIX_R;\n\n return {\n _qualify: (source) => LIST_ITEM_PREFIX_R.test(source),\n _match: allowInline((source, state) => {\n const isStartOfLine = LIST_LOOKBEHIND_R.exec(state.prevCapture ?? '');\n const isListAllowed = state.list ?? (!state.inline && !state.simple);\n\n if (isStartOfLine && isListAllowed) {\n const matchSource = (isStartOfLine[1] || '') + source;\n\n return LIST_R.exec(matchSource);\n }\n\n return null;\n }),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n const bullet = capture[2];\n const startValue = ordered ? +bullet.slice(0, -1) : undefined;\n const items = capture[0]\n .replace(BLOCK_END_R, '\\n')\n .match(LIST_ITEM_R) as string[];\n\n if (!items) return { items: [], ordered, start: startValue } as any;\n\n let lastItemWasAParagraph = false;\n\n const result = items.map((item, i) => {\n const prefixCapture = LIST_ITEM_PREFIX_R.exec(item);\n const space = prefixCapture ? prefixCapture[0].length : 0;\n const spaceRegex = new RegExp(`^ {1,${space}}`, 'gm');\n const content = item\n .replace(spaceRegex, '')\n .replace(LIST_ITEM_PREFIX_R, '');\n const isLastItem = i === items.length - 1;\n const containsBlocks = content.indexOf('\\n\\n') !== -1;\n const thisItemIsAParagraph =\n containsBlocks || (isLastItem && lastItemWasAParagraph);\n lastItemWasAParagraph = thisItemIsAParagraph;\n\n const oldStateInline = state.inline;\n const oldStateList = state.list;\n state.list = true;\n\n let adjustedContent: string;\n\n if (thisItemIsAParagraph) {\n state.inline = false;\n adjustedContent = `${trimEnd(content)}\\n\\n`;\n } else {\n state.inline = true;\n adjustedContent = trimEnd(content);\n }\n\n const parsed = parse(adjustedContent, state);\n state.inline = oldStateInline;\n state.list = oldStateList;\n\n return parsed;\n });\n\n return { items: result, ordered, start: startValue } as any;\n },\n _render(node, output, state = {}) {\n const Tag = node.ordered ? 'ol' : 'ul';\n const props: Record<string, any> = { key: state.key };\n\n if (node.ordered && node.start != null) props.start = node.start;\n\n return createElement(\n Tag,\n props,\n ...node.items.map((item, i) =>\n createElement('li', { key: i }, output(item, state))\n )\n );\n },\n };\n };\n\n const matchParagraph = (\n source: string,\n state: ParseState\n ): RegExpMatchArray | null => {\n if (\n state.inline ||\n state.simple ||\n (state.inHTML &&\n source.indexOf('\\n\\n') === -1 &&\n state.prevCapture?.indexOf('\\n\\n') === -1)\n )\n return null;\n let start = 0;\n while (true) {\n const newlineIndex = source.indexOf('\\n', start);\n const line = source.slice(\n start,\n newlineIndex === -1 ? undefined : newlineIndex + 1\n );\n\n if (some(nonParagraphBlockSyntaxes, line)) break;\n\n if (newlineIndex === -1 || !line.trim()) break;\n start = newlineIndex + 1;\n }\n const match = source.slice(0, start);\n // Align with original simple-markdown behavior: capture the whole match including newlines\n\n if (match === '') return null;\n const captured = trimEnd(match);\n\n if (captured === '') return null;\n\n return [match, undefined, captured] as unknown as RegExpMatchArray;\n };\n\n const rules: Rules = {\n [RuleType.blockQuote]: {\n _qualify: ['>'],\n _match: blockRegex(BLOCKQUOTE_R),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n const matchAlert = capture[0]\n .replace(BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, '')\n .match(BLOCKQUOTE_ALERT_R);\n const alert = matchAlert?.[1];\n const content = matchAlert?.[2] ?? '';\n const hasNewline = content.indexOf('\\n') !== -1;\n const children = hasNewline\n ? parseBlock(parse, content, state)\n : parseInline(parse, content, state);\n\n return { alert, children };\n },\n _render(node, output, state = {}) {\n const props: Record<string, any> = { key: state.key };\n\n if (node.alert) {\n props.className = `markdown-alert-${slug(node.alert.toLowerCase())}`;\n node.children.unshift({\n attrs: {},\n children: [{ type: RuleType.text, text: node.alert }],\n noInnerParse: true,\n type: RuleType.htmlBlock,\n tag: 'header',\n } as any);\n }\n\n return createElement('blockquote', props, output(node.children, state));\n },\n },\n [RuleType.breakLine]: {\n _qualify: [' '],\n _match: anyScopeRegex(BREAK_LINE_R),\n _order: Priority.HIGH,\n _parse: captureNothing,\n _render(_, __, state = {}) {\n return createElement('br', { key: state.key });\n },\n },\n [RuleType.breakThematic]: {\n _qualify: ['--', '__', '**', '- ', '* ', '_ '],\n _match: blockRegex(BREAK_THEMATIC_R),\n _order: Priority.HIGH,\n _parse: captureNothing,\n _render(_, __, state = {}) {\n return createElement('hr', { key: state.key });\n },\n },\n [RuleType.codeBlock]: {\n _qualify: [' '],\n _match: blockRegex(CODE_BLOCK_R),\n _order: Priority.MAX,\n _parse(capture) {\n return {\n type: RuleType.codeBlock,\n lang: undefined,\n text: unescapeString(trimEnd(capture[0].replace(/^ {4}/gm, ''))),\n };\n },\n _render(node, _, state = {}) {\n const attrs = { ...((node as any).attrs ?? {}) } as Record<string, any>;\n const langClass = node.lang ? `lang-${node.lang}` : 'lang-plaintext';\n attrs.className = attrs.className\n ? `${attrs.className} ${langClass}`\n : langClass;\n\n if (node.lang && !attrs.lang) attrs.lang = node.lang;\n\n return createElement(\n 'pre',\n { key: state.key },\n createElement('code', attrs, node.text)\n );\n },\n },\n [RuleType.codeFenced]: {\n _qualify: ['```', '~~~'],\n _match: blockRegex(CODE_BLOCK_FENCED_R),\n _order: Priority.MAX,\n _parse(capture) {\n return {\n attrs: attrStringToMap('code', capture[3] ?? ''),\n lang: capture[2] || undefined,\n text: capture[4],\n type: RuleType.codeBlock,\n };\n },\n },\n [RuleType.codeInline]: {\n _qualify: ['`'],\n _match: simpleInlineRegex(CODE_INLINE_R),\n _order: Priority.LOW,\n _parse(capture) {\n return { text: unescapeString(capture[2]) };\n },\n _render(node, _, state = {}) {\n return createElement('code', { key: state.key }, node.text);\n },\n },\n [RuleType.footnote]: {\n _qualify: ['[^'],\n _match: blockRegex(FOOTNOTE_R),\n _order: Priority.MAX,\n _parse(capture) {\n footnotes.push({ footnote: capture[2], identifier: capture[1] });\n\n return {};\n },\n _render: renderNothing,\n },\n [RuleType.footnoteReference]: {\n _qualify: ['[^'],\n _match: inlineRegex(FOOTNOTE_REFERENCE_R),\n _order: Priority.HIGH,\n _parse(capture) {\n return { target: `#${slug(capture[1])}`, text: capture[1] };\n },\n _render(node, _, state = {}) {\n return createElement(\n 'a',\n {\n key: state.key,\n href: sanitize(node.target, 'a', 'href') ?? undefined,\n },\n createElement('sup', { key: state.key }, node.text)\n );\n },\n },\n [RuleType.gfmTask]: {\n _qualify: ['[ ]', '[x]'],\n _match: inlineRegex(GFM_TASK_R),\n _order: Priority.HIGH,\n _parse(capture) {\n return { completed: capture[1].toLowerCase() === 'x' };\n },\n _render(node, _, state = {}) {\n return createElement('input', {\n checked: node.completed,\n key: state.key,\n readOnly: true,\n type: 'checkbox',\n });\n },\n },\n [RuleType.heading]: {\n _qualify: ['#'],\n _match: blockRegex(\n options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R\n ),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n return {\n children: parseInline(parse, capture[2], state),\n id: slug(capture[2]),\n level: capture[1].length as HeadingNode['level'],\n };\n },\n _render(node, output, state = {}) {\n return createElement(\n `h${node.level}` as HTMLTag,\n { id: node.id, key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.headingSetext]: {\n _qualify: (source) => {\n const nlIndex = source.indexOf('\\n');\n\n return (\n nlIndex > 0 &&\n nlIndex < source.length - 1 &&\n (source[nlIndex + 1] === '=' || source[nlIndex + 1] === '-')\n );\n },\n _match: blockRegex(HEADING_SETEXT_R),\n _order: Priority.MAX,\n _parse(capture, parse, state) {\n return {\n children: parseInline(parse, capture[1], state),\n level: capture[2] === '=' ? 1 : 2,\n type: RuleType.heading,\n };\n },\n },\n [RuleType.htmlBlock]: {\n _qualify: (source) => {\n if (options.disableParsingRawHTML) return false;\n\n const match = source.match(/^ *<([a-z][a-z0-9:-]*)\\b/i);\n if (!match) return false;\n const tag = match[1];\n\n return source.toLowerCase().indexOf(`</${tag.toLowerCase()}>`) !== -1;\n },\n _match: anyScopeRegex(HTML_BLOCK_ELEMENT_R),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n const m = capture[3].match(HTML_LEFT_TRIM_AMOUNT_R);\n const whitespace = m?.[1] ?? '';\n const trimmed = trimLeadingWhitespaceOutsideFences(\n capture[3],\n whitespace\n );\n const parseFunc = containsBlockSyntax(trimmed)\n ? parseBlock\n : parseInline;\n const tagName = capture[1].trim();\n const noInnerParse =\n DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(tagName.toLowerCase()) !== -1;\n const tag = (noInnerParse ? tagName.toLowerCase() : tagName) as HTMLTag;\n const ast: any = {\n attrs: attrStringToMap(tag, capture[2] ?? ''),\n noInnerParse,\n tag,\n };\n state.inAnchor = state.inAnchor || tagName.toLowerCase() === 'a';\n\n if (noInnerParse) {\n ast.text = capture[3];\n } else {\n const prevInHTML = state.inHTML;\n state.inHTML = true;\n ast.children = parseFunc(parse, trimmed, state);\n state.inHTML = prevInHTML;\n }\n state.inAnchor = false;\n\n return ast;\n },\n _render(node, output, state = {}) {\n return createElement(\n node.tag,\n { key: state.key, ...(node.attrs ?? {}) },\n node.text ?? (node.children ? output(node.children, state) : '')\n );\n },\n },\n [RuleType.htmlComment]: {\n _qualify: ['<!'],\n _match: anyScopeRegex(HTML_COMMENT_R),\n _order: Priority.HIGH,\n _parse: captureNothing,\n _render: renderNothing,\n },\n [RuleType.htmlSelfClosing]: {\n _qualify: (source) => {\n if (options.disableParsingRawHTML) return false;\n\n return /^ *<([a-zA-Z][a-zA-Z0-9:]*)[\\s>/]/.test(source);\n },\n _match: anyScopeRegex(HTML_SELF_CLOSING_ELEMENT_R),\n _order: Priority.HIGH,\n _parse(capture) {\n const tag = capture[1].trim() as HTMLTag;\n\n return { attrs: attrStringToMap(tag, capture[2] || ''), tag };\n },\n _render(node, _, state = {}) {\n return createElement(node.tag, {\n key: state.key,\n ...(node.attrs ?? {}),\n });\n },\n },\n [RuleType.customComponent]: {\n _qualify: (source) => /^ *<([A-Z][a-zA-Z0-9]*)/.test(source),\n _match: anyScopeRegex(CUSTOM_COMPONENT_R),\n _order: Priority.MAX,\n _parse(capture, parse, state) {\n const m = capture[3].match(HTML_LEFT_TRIM_AMOUNT_R);\n const whitespace = m?.[1] ?? '';\n const trimmed = trimLeadingWhitespaceOutsideFences(\n capture[3],\n whitespace\n );\n const parseFunc = containsBlockSyntax(trimmed)\n ? parseBlock\n : parseInline;\n const tag = capture[1].trim();\n const ast: any = {\n attrs: attrStringToMap(tag as HTMLTag, capture[2] ?? ''),\n noInnerParse: false,\n tag,\n };\n const prevInHTML = state.inHTML;\n state.inHTML = true;\n ast.children = parseFunc(parse, trimmed, state);\n state.inHTML = prevInHTML;\n\n return ast;\n },\n _render(node, output, state = {}) {\n return createElement(\n node.tag as HTMLTag,\n { key: state.key, ...(node.attrs ?? {}) },\n node.text ?? (node.children ? output(node.children, state) : '')\n );\n },\n },\n [RuleType.paragraph]: {\n _match: matchParagraph,\n _order: Priority.LOW,\n _parse: parseCaptureInline,\n _render(node, output, state = {}) {\n return createElement(\n 'p',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.image]: {\n _qualify: ['!['],\n _match: simpleInlineRegex(IMAGE_R),\n _order: Priority.HIGH,\n _parse(capture) {\n return {\n alt: unescapeString(capture[1]),\n target: unescapeString(capture[2]),\n title: unescapeString(capture[3]),\n };\n },\n _render(node, _, state = {}) {\n return createElement('img', {\n key: state.key,\n alt: node.alt ?? undefined,\n title: node.title ?? undefined,\n src: sanitize(node.target, 'img', 'src') ?? undefined,\n });\n },\n },\n [RuleType.link]: {\n _qualify: ['['],\n _match: inlineRegex(LINK_R),\n _order: Priority.LOW,\n _parse(capture, parse, state) {\n return {\n children: parseSimpleInline(parse, capture[1], state),\n target: unescapeString(capture[2]),\n title: unescapeString(capture[3]),\n };\n },\n _render(node, output, state = {}) {\n const sanitizedHref = sanitize(node.target, 'a', 'href');\n if (\n process.env.NODE_ENV === 'test' &&\n node.target.includes('javascript:')\n ) {\n console.log('Compiler sanitize result:', {\n target: node.target,\n sanitizedHref,\n finalHref: sanitizedHref ?? undefined,\n });\n }\n return createElement(\n 'a',\n {\n key: state.key,\n href: sanitizedHref ?? undefined,\n title: node.title ?? undefined,\n },\n output(node.children, state)\n );\n },\n },\n [RuleType.linkAngleBraceStyleDetector]: {\n _qualify: ['<'],\n _match: inlineRegex(LINK_AUTOLINK_R),\n _order: Priority.MAX,\n _parse(capture) {\n let target = capture[1];\n let isEmail = false;\n\n if (target.indexOf('@') !== -1 && target.indexOf('//') === -1) {\n isEmail = true;\n target = target.replace('mailto:', '');\n }\n\n return {\n children: [{ text: target, type: RuleType.text }],\n target: isEmail ? `mailto:${target}` : target,\n type: RuleType.link,\n };\n },\n },\n [RuleType.linkBareUrlDetector]: {\n _qualify: (source, state) =>\n !!(\n state.inline &&\n !state.inAnchor &&\n !options.disableAutoLink &&\n (startsWith(source, 'http://') || startsWith(source, 'https://'))\n ),\n _match: inlineRegex(LINK_AUTOLINK_BARE_URL_R),\n _order: Priority.MAX,\n _parse(capture) {\n return {\n children: [{ text: capture[1], type: RuleType.text }],\n target: capture[1],\n type: RuleType.link,\n };\n },\n },\n [RuleType.newlineCoalescer]: {\n _match: blockRegex(CONSECUTIVE_NEWLINE_R),\n _order: Priority.LOW,\n _parse: captureNothing,\n _render() {\n return '\\n';\n },\n },\n [RuleType.orderedList]: generateListRule(ORDERED),\n [RuleType.unorderedList]: generateListRule(UNORDERED),\n [RuleType.ref]: {\n _qualify: ['['],\n _match: anyScopeRegex(REFERENCE_IMAGE_OR_LINK),\n _order: Priority.MAX,\n _parse(capture) {\n refs[capture[1]] = { target: capture[2], title: capture[4] };\n\n return {};\n },\n _render: renderNothing,\n },\n [RuleType.refImage]: {\n _qualify: ['!['],\n _match: simpleInlineRegex(REFERENCE_IMAGE_R),\n _order: Priority.MAX,\n _parse(capture) {\n return {\n alt: capture[1] ? unescapeString(capture[1]) : undefined,\n ref: capture[2],\n };\n },\n _render(node, _, state = {}) {\n const ref = refs[node.ref];\n\n if (!ref) return null;\n\n return createElement('img', {\n key: state.key,\n alt: node.alt,\n src: sanitize(ref.target, 'img', 'src') ?? undefined,\n title: ref.title,\n });\n },\n },\n [RuleType.refLink]: {\n _qualify: (source) => source[0] === '[' && source.indexOf('](') === -1,\n _match: inlineRegex(REFERENCE_LINK_R),\n _order: Priority.MAX,\n _parse(capture, parse, state) {\n return {\n children: parseSimpleInline(parse, capture[1], state),\n fallbackChildren: capture[0],\n ref: capture[2],\n };\n },\n _render(node, output, state = {}) {\n const ref = refs[node.ref];\n\n if (!ref)\n return createElement(\n 'span',\n { key: state.key },\n node.fallbackChildren\n );\n\n return createElement(\n 'a',\n {\n key: state.key,\n href: sanitize(ref.target, 'a', 'href') ?? undefined,\n title: ref.title,\n },\n output(node.children, state)\n );\n },\n },\n [RuleType.table]: {\n _qualify: ['|'],\n _match: blockRegex(NP_TABLE_R),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n state.inline = true;\n const align = capture[2] ? parseTableAlign(capture[2]) : [];\n const cells = capture[3]\n ? parseTableCells(capture[3], parse, state)\n : [];\n const header = parseTableRow(capture[1], parse, state, !!cells.length);\n state.inline = false;\n\n return cells.length\n ? { align, cells, header, type: RuleType.table }\n : { children: header.flat(), type: RuleType.paragraph };\n },\n _render(node, output, state = {}) {\n const table = node as TableNode;\n const getStyle = (i: number) =>\n table.align[i] && table.align[i] !== 'left'\n ? { textAlign: table.align[i] }\n : {};\n\n return createElement(\n 'table',\n { key: state.key },\n createElement(\n 'thead',\n null,\n createElement(\n 'tr',\n null,\n ...table.header.map((c, i) =>\n createElement(\n 'th',\n { key: i, style: getStyle(i) },\n output(c, state)\n )\n )\n )\n ),\n createElement(\n 'tbody',\n null,\n ...table.cells.map((row, i) =>\n createElement(\n 'tr',\n { key: i },\n ...row.map((c, j) =>\n createElement(\n 'td',\n { key: j, style: getStyle(j) },\n output(c, state)\n )\n )\n )\n )\n )\n );\n },\n },\n [RuleType.tableSeparator]: {\n _match: (source, state) =>\n state.inTable && source[0] === '|' ? /^\\|/.exec(source) : null,\n _order: Priority.HIGH,\n _parse() {\n return { type: RuleType.tableSeparator };\n },\n _render() {\n return ' | ';\n },\n },\n [RuleType.text]: {\n _match: allowInline((source, _state) => {\n const shortMatch = SHORTCODE_R.exec(source);\n\n if (shortMatch) return shortMatch;\n\n return TEXT_PLAIN_R.exec(source) || /^[\\s\\S]/.exec(source);\n }),\n _order: Priority.MIN,\n _parse(capture) {\n const text = capture[0];\n\n return {\n text:\n text.indexOf('&') === -1\n ? text\n : text.replace(HTML_CHAR_CODE_R, (f, i) => {\n if (i.startsWith('#x'))\n return String.fromCharCode(parseInt(i.slice(2), 16));\n if (i.startsWith('#'))\n return String.fromCharCode(parseInt(i.slice(1), 10));\n return namedCodesToUnicode[i] || f;\n }),\n };\n },\n _render(node) {\n return node.text;\n },\n },\n [RuleType.textBolded]: {\n _qualify: ['**', '__'],\n _match: simpleInlineRegex(TEXT_BOLD_R),\n _order: Priority.MED,\n _parse(capture, parse, state) {\n return { children: parse(capture[2], state) };\n },\n _render(node, output, state = {}) {\n return createElement(\n 'strong',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.textEmphasized]: {\n _qualify: ['*', '_'],\n _match: simpleInlineRegex(TEXT_EMPHASIZED_R),\n _order: Priority.LOW,\n _parse(capture, parse, state) {\n return { children: parse(capture[2], state) };\n },\n _render(node, output, state = {}) {\n return createElement(\n 'em',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.textEscaped]: {\n _qualify: ['\\\\'],\n _match: simpleInlineRegex(TEXT_ESCAPED_R),\n _order: Priority.HIGH,\n _parse(capture) {\n return { text: capture[1], type: RuleType.text };\n },\n },\n [RuleType.textMarked]: {\n _qualify: ['=='],\n _match: simpleInlineRegex(TEXT_MARKED_R),\n _order: Priority.LOW,\n _parse: parseCaptureInline,\n _render(node, output, state = {}) {\n return createElement(\n 'mark',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.textStrikethroughed]: {\n _qualify: ['~~'],\n _match: simpleInlineRegex(TEXT_STRIKETHROUGHED_R),\n _order: Priority.LOW,\n _parse: parseCaptureInline,\n _render(node, output, state = {}) {\n return createElement(\n 'del',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n };\n\n return rules;\n};\n\n// Removed compilerCache completely to avoid issues with props changes not invalidating cache\n// const compilerCache = new Map<string, unknown>();\n\nexport const compile = (\n markdown: string = '',\n ctx: MarkdownContext<any>,\n options: MarkdownOptions = {}\n): unknown => {\n // const cacheKey = JSON.stringify({\n // markdown,\n // options,\n // components: ctx.components ? Object.keys(ctx.components) : [],\n // });\n\n // if (compilerCache.has(cacheKey)) {\n // return compilerCache.get(cacheKey);\n // }\n\n const components = ctx.components ?? {};\n const slug = (input: string) => {\n if (process.env.NODE_ENV === 'test' && input === '中文') {\n const def = defaultSlugify(input);\n console.log('Slug check:', {\n input,\n ctxSlugify: !!ctx.slugify,\n defaultSlugifyResult: def,\n });\n }\n return ctx.slugify\n ? ctx.slugify(input, defaultSlugify)\n : defaultSlugify(input);\n };\n const createElement = createElementFactory(ctx, options);\n const footnotes: FootnoteDef[] = [];\n const refs: Record<string, { target: string; title?: string }> = {};\n\n const attrStringToMap = (\n tag: HTMLTag,\n str: string\n ): Record<string, any> | null => {\n if (!str?.trim()) return null;\n\n const attributes = str.match(ATTR_EXTRACTOR_R);\n\n if (!attributes) return null;\n\n return attributes.reduce((map: any, raw) => {\n const delimiterIdx = raw.indexOf('=');\n\n if (delimiterIdx !== -1) {\n const key = normalizeAttributeKey(raw.slice(0, delimiterIdx)).trim();\n const value = unquote(raw.slice(delimiterIdx + 1).trim());\n const mappedKey = ATTRIBUTE_TO_NODE_PROP_MAP[key] ?? key;\n\n if (mappedKey === 'ref') return map;\n map[mappedKey] = attributeValueToNodePropValue(\n tag,\n key,\n value,\n ctx.sanitizer ?? defaultSanitizer\n );\n\n if (\n typeof map[mappedKey] === 'string' &&\n (HTML_BLOCK_ELEMENT_R.test(map[mappedKey]) ||\n HTML_SELF_CLOSING_ELEMENT_R.test(map[mappedKey]))\n ) {\n map[mappedKey] = compileInner(map[mappedKey].trim());\n }\n } else if (raw !== 'style') {\n map[ATTRIBUTE_TO_NODE_PROP_MAP[raw] ?? raw] = true;\n }\n\n return map;\n }, {});\n };\n\n const nonParagraphBlockSyntaxes = [\n BLOCKQUOTE_R,\n CODE_BLOCK_FENCED_R,\n CODE_BLOCK_R,\n options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R,\n HEADING_SETEXT_R,\n NP_TABLE_R,\n ORDERED_LIST_R,\n UNORDERED_LIST_R,\n CUSTOM_COMPONENT_R,\n ];\n\n const containsBlockSyntax = (input: string): boolean => {\n const cleaned = input.replace(TRIM_STARTING_NEWLINES, '');\n const slice = cleaned.length > 2048 ? cleaned.slice(0, 2048) : cleaned;\n\n // A blank line unambiguously separates block-level elements\n if (slice.indexOf('\\n\\n') !== -1) return true;\n\n const syntaxes = options.disableParsingRawHTML\n ? nonParagraphBlockSyntaxes\n : [\n ...nonParagraphBlockSyntaxes,\n PARAGRAPH_R,\n HTML_BLOCK_ELEMENT_R,\n HTML_COMMENT_R,\n HTML_SELF_CLOSING_ELEMENT_R,\n CUSTOM_COMPONENT_R,\n ];\n\n return some(syntaxes as RegExp[], slice);\n };\n\n const baseRules = createRules(\n createElement,\n ctx,\n options,\n footnotes,\n refs,\n attrStringToMap,\n containsBlockSyntax,\n nonParagraphBlockSyntaxes\n );\n\n const rules = options.disableParsingRawHTML\n ? Object.keys(baseRules).reduce((acc, key) => {\n if (key !== RuleType.htmlBlock && key !== RuleType.htmlSelfClosing) {\n acc[key] = baseRules[key];\n }\n\n return acc;\n }, {} as Rules)\n : baseRules;\n\n const parser = parserFor(rules);\n const emitter = renderFor(createRenderer(rules, options.renderRule));\n\n const compileInner = (input: string): unknown => {\n const result = options.preserveFrontmatter\n ? input\n : input.replace(FRONT_MATTER_R, '');\n const inline =\n options.forceInline ||\n (!options.forceBlock &&\n SHOULD_RENDER_AS_BLOCK_R.test(\n result.replace(TRIM_STARTING_NEWLINES, '')\n ) === false);\n const arr = emitter(\n parser(\n inline\n ? result\n : `${trimEnd(result).replace(TRIM_STARTING_NEWLINES, '')}\\n\\n`,\n { inline }\n ),\n { inline }\n ) as unknown as any[];\n while (\n typeof arr[arr.length - 1] === 'string' &&\n !arr[arr.length - 1].trim()\n )\n arr.pop();\n\n if (options.wrapper === null) return arr;\n const wrapper = options.wrapper ?? (inline ? 'span' : 'div');\n\n if (arr.length > 1 || options.forceWrapper)\n return createElement(wrapper, { key: 'outer' }, arr);\n\n if (arr.length === 1) {\n const node = arr[0];\n\n if (typeof node === 'string') {\n const spanProps: Record<string, any> = { key: 'outer' };\n\n if (!inline && components) {\n const pOverrideProps = (get(components, 'p.props', {}) ??\n {}) as Record<string, any>;\n const mergedClassName = cx(\n spanProps.className,\n pOverrideProps.className\n );\n const finalSpanProps: Record<string, any> = {\n ...spanProps,\n ...pOverrideProps,\n };\n\n if (mergedClassName) finalSpanProps.className = mergedClassName;\n\n return createElement('span', finalSpanProps, node);\n }\n\n return createElement('span', spanProps, node);\n }\n\n return node;\n }\n\n return createElement(wrapper, { key: 'outer' }, null);\n };\n\n if (typeof markdown !== 'string') {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n 'intlayer: the first argument must be a string. Received',\n typeof markdown\n );\n }\n throw new Error('intlayer: the first argument must be a string');\n }\n\n const node = compileInner(markdown);\n\n const result = footnotes.length\n ? createElement(\n 'div',\n null,\n node,\n createElement(\n 'footer',\n { key: 'footer' },\n ...footnotes.map((def) =>\n createElement(\n 'div',\n { id: slug(def.identifier), key: def.identifier },\n def.identifier,\n emitter(parser(def.footnote, { inline: true }), { inline: true })\n )\n )\n )\n )\n : node;\n\n // compilerCache.set(cacheKey, result);\n\n return result;\n};\n\nexport const createCompiler =\n (ctx: MarkdownContext<any>) =>\n (markdown: string, options?: MarkdownOptions): unknown =>\n compile(markdown, ctx, options);\n\nexport const compileWithOptions = (\n markdown: string,\n runtime: MarkdownRuntime,\n options: CompileOptions<any> = {}\n): unknown => {\n const {\n components,\n namedCodesToUnicode,\n sanitizer,\n slugify,\n ...compilerOptions\n } = options;\n\n return compile(\n markdown,\n { runtime, components, namedCodesToUnicode, sanitizer, slugify },\n compilerOptions\n );\n};\n"],"mappings":";;;;;;;AA+GA,MAAM,UAAU;AAKhB,MAAM,SAAS,IAAI,OACjB,4JACF;AAEA,MAAM,UAAU,KAAU,eAA8C;CACtE,IAAI,OAAO,QAAQ,UAAU,OAAO;CACpC,IAAI,WAAWA,2BAAI,YAAY,GAAG;CAElC,IAAI,CAAC,YAAY,OAAO,QAAQ,UAAU;EACxC,MAAM,eAAe,IAAI,YAAY;EAErC,MAAM,MAAM,OAAO,KAAK,UAAU,EAAE,MACjC,MAAM,EAAE,YAAY,MAAM,YAC7B;EACA,IAAI,KACF,WAAWA,2BAAI,YAAY,GAAG;CAElC;CAEA,IAAI,CAAC,UAAU,OAAO;CAEtB,OAAO;AACT;AAEA,MAAM,wBACJ,KACA,YAC0B;CAC1B,MAAM,EAAE,SAAS,aAAa,CAAC,MAAM;CACrC,MAAM,eAAe,QAAQ,YACzB;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA,CAAC;CAEL,QACE,KACA,OACA,GAAG,aACS;EACZ,IAAI,OAAO,QAAQ,YAAY,aAAa,SAAS,IAAI,YAAY,CAAC,GACpE,OAAO;EAGT,MAAM,cAAc,OAAO,QAAQ;EAEnC,MAAM,YAAYC,0BAAG,OAAO,WAAW,OAAO,KAAK;EAEnD,MAAM,cAAm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ED_LIST_R","ORDERED_LIST_ITEM_R","UNORDERED_LIST_ITEM_R","ORDERED_LIST_ITEM_PREFIX_R","UNORDERED_LIST_ITEM_PREFIX_R","allowInline","LIST_LOOKBEHIND_R","Priority","BLOCK_END_R","trimEnd","some","RuleType","blockRegex","BLOCKQUOTE_R","BLOCKQUOTE_TRIM_LEFT_MULTILINE_R","BLOCKQUOTE_ALERT_R","parseBlock","parseInline","anyScopeRegex","BREAK_LINE_R","captureNothing","BREAK_THEMATIC_R","CODE_BLOCK_R","unescapeString","CODE_BLOCK_FENCED_R","simpleInlineRegex","CODE_INLINE_R","FOOTNOTE_R","renderNothing","inlineRegex","FOOTNOTE_REFERENCE_R","GFM_TASK_R","HEADING_ATX_COMPLIANT_R","HEADING_R","HEADING_SETEXT_R","HTML_BLOCK_ELEMENT_R","HTML_LEFT_TRIM_AMOUNT_R","trimLeadingWhitespaceOutsideFences","DO_NOT_PROCESS_HTML_ELEMENTS","HTML_COMMENT_R","HTML_SELF_CLOSING_ELEMENT_R","CUSTOM_COMPONENT_R","parseCaptureInline","parseSimpleInline","LINK_AUTOLINK_R","startsWith","LINK_AUTOLINK_BARE_URL_R","CONSECUTIVE_NEWLINE_R","REFERENCE_IMAGE_OR_LINK","REFERENCE_IMAGE_R","REFERENCE_LINK_R","NP_TABLE_R","parseTableAlign","parseTableCells","parseTableRow","SHORTCODE_R","TEXT_PLAIN_R","HTML_CHAR_CODE_R","TEXT_BOLD_R","TEXT_EMPHASIZED_R","TEXT_ESCAPED_R","TEXT_MARKED_R","TEXT_STRIKETHROUGHED_R","ATTR_EXTRACTOR_R","normalizeAttributeKey","unquote","ATTRIBUTE_TO_NODE_PROP_MAP","attributeValueToNodePropValue","TRIM_STARTING_NEWLINES","PARAGRAPH_R","parserFor","FRONT_MATTER_R","SHOULD_RENDER_AS_BLOCK_R","renderFor","createRenderer"],"sources":["../../../src/markdown/compiler.ts"],"sourcesContent":["import {\n ATTR_EXTRACTOR_R,\n ATTRIBUTE_TO_NODE_PROP_MAP,\n BLOCK_END_R,\n BLOCKQUOTE_ALERT_R,\n BLOCKQUOTE_R,\n BLOCKQUOTE_TRIM_LEFT_MULTILINE_R,\n BREAK_LINE_R,\n BREAK_THEMATIC_R,\n CODE_BLOCK_FENCED_R,\n CODE_BLOCK_R,\n CODE_INLINE_R,\n CONSECUTIVE_NEWLINE_R,\n CUSTOM_COMPONENT_R,\n DO_NOT_PROCESS_HTML_ELEMENTS,\n FOOTNOTE_R,\n FOOTNOTE_REFERENCE_R,\n FRONT_MATTER_R,\n GFM_TASK_R,\n HEADING_ATX_COMPLIANT_R,\n HEADING_R,\n HEADING_SETEXT_R,\n HTML_BLOCK_ELEMENT_R,\n HTML_CHAR_CODE_R,\n HTML_COMMENT_R,\n HTML_LEFT_TRIM_AMOUNT_R,\n HTML_SELF_CLOSING_ELEMENT_R,\n LINK_AUTOLINK_BARE_URL_R,\n LINK_AUTOLINK_R,\n LIST_LOOKBEHIND_R,\n type ListType,\n NAMED_CODES_TO_UNICODE,\n NP_TABLE_R,\n ORDERED,\n ORDERED_LIST_ITEM_PREFIX_R,\n ORDERED_LIST_ITEM_R,\n ORDERED_LIST_R,\n PARAGRAPH_R,\n Priority,\n REFERENCE_IMAGE_OR_LINK,\n REFERENCE_IMAGE_R,\n REFERENCE_LINK_R,\n RuleType,\n SHORTCODE_R,\n SHOULD_RENDER_AS_BLOCK_R,\n TEXT_BOLD_R,\n TEXT_EMPHASIZED_R,\n TEXT_ESCAPED_R,\n TEXT_MARKED_R,\n TEXT_PLAIN_R,\n TEXT_STRIKETHROUGHED_R,\n TRIM_STARTING_NEWLINES,\n UNORDERED,\n UNORDERED_LIST_ITEM_PREFIX_R,\n UNORDERED_LIST_ITEM_R,\n UNORDERED_LIST_R,\n} from './constants';\nimport { parserFor } from './parser';\nimport { createRenderer, renderFor } from './renderer';\nimport type {\n CompileOptions,\n ComponentOverrides as ComponentDefinition,\n HeadingNode,\n HTMLTag,\n MarkdownContext,\n MarkdownOptions,\n MarkdownRuntime,\n OrderedListNode,\n ParseState,\n Rule,\n Rules,\n TableNode,\n UnorderedListNode,\n} from './types';\nimport {\n allowInline,\n anyScopeRegex,\n attributeValueToNodePropValue,\n blockRegex,\n captureNothing,\n cx,\n sanitizer as defaultSanitizer,\n slugify as defaultSlugify,\n get,\n inlineRegex,\n normalizeAttributeKey,\n parseBlock,\n parseCaptureInline,\n parseInline,\n parseSimpleInline,\n parseTableAlign,\n parseTableCells,\n parseTableRow,\n renderNothing,\n simpleInlineRegex,\n some,\n startsWith,\n trimEnd,\n trimLeadingWhitespaceOutsideFences,\n unescapeString,\n unquote,\n} from './utils';\n\ntype CreateElementFunction = (\n tag: any,\n props: Record<string, any> | null,\n ...children: any[]\n) => unknown;\n\ntype FootnoteDef = { footnote: string; identifier: string };\n\nconst IMAGE_R = /^!\\[(.*?)\\]\\( *((?:\\([^)]*\\)|[^() ])*) *\"?([^)\"]*)?\"?\\)/;\nconst LINK_INSIDE =\n '(?:\\\\[[^\\\\[\\\\]]*(?:\\\\[[^\\\\[\\\\]]*\\\\][^\\\\[\\\\]]*)*\\\\]|[^\\\\[\\\\]])*';\nconst LINK_HREF_AND_TITLE =\n '\\\\s*<?((?:\\\\([^)]*\\\\)|[^\\\\s\\\\\\\\]|\\\\\\\\.)*?)>?(?:\\\\s+[\\'\"]([\\\\s\\\\S]*?)[\\'\"])?\\\\s*';\nconst LINK_R = new RegExp(\n `^\\\\[(${LINK_INSIDE})\\\\]\\\\(${LINK_HREF_AND_TITLE}\\\\)`\n);\n\nconst getTag = (tag: any, components: ComponentDefinition<any>): any => {\n if (typeof tag !== 'string') return tag;\n let override = get(components, tag);\n\n if (!override && typeof tag === 'string') {\n const lowercaseTag = tag.toLowerCase();\n // Try case-insensitive lookup\n const key = Object.keys(components).find(\n (k) => k.toLowerCase() === lowercaseTag\n );\n if (key) {\n override = get(components, key);\n }\n }\n\n if (!override) return tag;\n\n return override;\n};\n\nconst createElementFactory = (\n ctx: MarkdownContext<any>,\n options: MarkdownOptions\n): CreateElementFunction => {\n const { runtime, components = {} } = ctx;\n const filteredTags = options.tagfilter\n ? [\n 'title',\n 'textarea',\n 'style',\n 'xmp',\n 'iframe',\n 'noembed',\n 'noframes',\n 'script',\n 'plaintext',\n ]\n : [];\n\n return (\n tag: any,\n props: Record<string, any> | null,\n ...children: any[]\n ): unknown => {\n if (typeof tag === 'string' && filteredTags.includes(tag.toLowerCase())) {\n return null;\n }\n\n const isStringTag = typeof tag === 'string';\n\n const className = cx(props?.className, props?.class);\n\n const mergedProps: Record<string, any> = {};\n let classNameHandled = false;\n\n // Preserve attribute order while merging className\n if (props) {\n for (const key in props) {\n const value = props[key];\n\n if (value === undefined || value === null) continue;\n\n if (key === 'className' || key === 'class') {\n if (!classNameHandled) {\n if (className) mergedProps.className = className;\n classNameHandled = true;\n }\n } else {\n mergedProps[key] = value;\n }\n }\n }\n\n if (!classNameHandled && className) {\n mergedProps.className = className;\n }\n\n let finalProps = mergedProps;\n\n if (runtime.normalizeProps && isStringTag)\n finalProps = runtime.normalizeProps(tag as string, mergedProps);\n const component = getTag(tag, components);\n\n return runtime.createElement(\n component,\n finalProps,\n ...(children.length === 1 ? [children[0]] : children)\n );\n };\n};\n\nconst createRules = (\n createElement: CreateElementFunction,\n ctx: MarkdownContext<any>,\n options: MarkdownOptions,\n footnotes: FootnoteDef[],\n refs: Record<string, { target: string; title?: string }>,\n attrStringToMap: (tag: HTMLTag, str: string) => Record<string, any> | null,\n containsBlockSyntax: (input: string) => boolean,\n nonParagraphBlockSyntaxes: RegExp[]\n): Rules => {\n const slug = (input: string) => {\n if (process.env.NODE_ENV === 'test' && input === '中文') {\n const def = defaultSlugify(input);\n console.log('Slug check:', {\n input,\n ctxSlugify: !!ctx.slugify,\n defaultSlugifyResult: def,\n });\n }\n return ctx.slugify\n ? ctx.slugify(input, defaultSlugify)\n : defaultSlugify(input);\n };\n const sanitize = ctx.sanitizer ?? defaultSanitizer;\n const namedCodesToUnicode = ctx.namedCodesToUnicode\n ? { ...NAMED_CODES_TO_UNICODE, ...ctx.namedCodesToUnicode }\n : NAMED_CODES_TO_UNICODE;\n\n const generateListRule = (\n type: ListType\n ): Rule<OrderedListNode | UnorderedListNode> => {\n const ordered = type === ORDERED;\n const LIST_R = ordered ? ORDERED_LIST_R : UNORDERED_LIST_R;\n const LIST_ITEM_R = ordered ? ORDERED_LIST_ITEM_R : UNORDERED_LIST_ITEM_R;\n const LIST_ITEM_PREFIX_R = ordered\n ? ORDERED_LIST_ITEM_PREFIX_R\n : UNORDERED_LIST_ITEM_PREFIX_R;\n\n return {\n _qualify: (source) => LIST_ITEM_PREFIX_R.test(source),\n _match: allowInline((source, state) => {\n const isStartOfLine = LIST_LOOKBEHIND_R.exec(state.prevCapture ?? '');\n const isListAllowed = state.list ?? (!state.inline && !state.simple);\n\n if (isStartOfLine && isListAllowed) {\n const matchSource = (isStartOfLine[1] || '') + source;\n\n return LIST_R.exec(matchSource);\n }\n\n return null;\n }),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n const bullet = capture[2];\n const startValue = ordered ? +bullet.slice(0, -1) : undefined;\n const items = capture[0]\n .replace(BLOCK_END_R, '\\n')\n .match(LIST_ITEM_R) as string[];\n\n if (!items) return { items: [], ordered, start: startValue } as any;\n\n let lastItemWasAParagraph = false;\n\n const result = items.map((item, i) => {\n const prefixCapture = LIST_ITEM_PREFIX_R.exec(item);\n const space = prefixCapture ? prefixCapture[0].length : 0;\n const spaceRegex = new RegExp(`^ {1,${space}}`, 'gm');\n const content = item\n .replace(spaceRegex, '')\n .replace(LIST_ITEM_PREFIX_R, '');\n const isLastItem = i === items.length - 1;\n const containsBlocks = content.indexOf('\\n\\n') !== -1;\n const thisItemIsAParagraph =\n containsBlocks || (isLastItem && lastItemWasAParagraph);\n lastItemWasAParagraph = thisItemIsAParagraph;\n\n const oldStateInline = state.inline;\n const oldStateList = state.list;\n state.list = true;\n\n let adjustedContent: string;\n\n if (thisItemIsAParagraph) {\n state.inline = false;\n adjustedContent = `${trimEnd(content)}\\n\\n`;\n } else {\n state.inline = true;\n adjustedContent = trimEnd(content);\n }\n\n const parsed = parse(adjustedContent, state);\n state.inline = oldStateInline;\n state.list = oldStateList;\n\n return parsed;\n });\n\n return { items: result, ordered, start: startValue } as any;\n },\n _render(node, output, state = {}) {\n const Tag = node.ordered ? 'ol' : 'ul';\n const props: Record<string, any> = { key: state.key };\n\n if (node.ordered && node.start != null) props.start = node.start;\n\n return createElement(\n Tag,\n props,\n ...node.items.map((item, i) =>\n createElement('li', { key: i }, output(item, state))\n )\n );\n },\n };\n };\n\n const matchParagraph = (\n source: string,\n state: ParseState\n ): RegExpMatchArray | null => {\n if (\n state.inline ||\n state.simple ||\n (state.inHTML &&\n source.indexOf('\\n\\n') === -1 &&\n state.prevCapture?.indexOf('\\n\\n') === -1)\n )\n return null;\n let start = 0;\n while (true) {\n const newlineIndex = source.indexOf('\\n', start);\n const line = source.slice(\n start,\n newlineIndex === -1 ? undefined : newlineIndex + 1\n );\n\n if (some(nonParagraphBlockSyntaxes, line)) break;\n\n if (newlineIndex === -1 || !line.trim()) break;\n start = newlineIndex + 1;\n }\n const match = source.slice(0, start);\n // Align with original simple-markdown behavior: capture the whole match including newlines\n\n if (match === '') return null;\n const captured = trimEnd(match);\n\n if (captured === '') return null;\n\n return [match, undefined, captured] as unknown as RegExpMatchArray;\n };\n\n const rules: Rules = {\n [RuleType.blockQuote]: {\n _qualify: ['>'],\n _match: blockRegex(BLOCKQUOTE_R),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n const matchAlert = capture[0]\n .replace(BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, '')\n .match(BLOCKQUOTE_ALERT_R);\n const alert = matchAlert?.[1];\n const content = matchAlert?.[2] ?? '';\n const hasNewline = content.indexOf('\\n') !== -1;\n const children = hasNewline\n ? parseBlock(parse, content, state)\n : parseInline(parse, content, state);\n\n return { alert, children };\n },\n _render(node, output, state = {}) {\n const props: Record<string, any> = { key: state.key };\n\n if (node.alert) {\n props.className = `markdown-alert-${slug(node.alert.toLowerCase())}`;\n node.children.unshift({\n attrs: {},\n children: [{ type: RuleType.text, text: node.alert }],\n noInnerParse: true,\n type: RuleType.htmlBlock,\n tag: 'header',\n } as any);\n }\n\n return createElement('blockquote', props, output(node.children, state));\n },\n },\n [RuleType.breakLine]: {\n _qualify: [' '],\n _match: anyScopeRegex(BREAK_LINE_R),\n _order: Priority.HIGH,\n _parse: captureNothing,\n _render(_, __, state = {}) {\n return createElement('br', { key: state.key });\n },\n },\n [RuleType.breakThematic]: {\n _qualify: ['--', '__', '**', '- ', '* ', '_ '],\n _match: blockRegex(BREAK_THEMATIC_R),\n _order: Priority.HIGH,\n _parse: captureNothing,\n _render(_, __, state = {}) {\n return createElement('hr', { key: state.key });\n },\n },\n [RuleType.codeBlock]: {\n _qualify: [' '],\n _match: blockRegex(CODE_BLOCK_R),\n _order: Priority.MAX,\n _parse(capture) {\n return {\n type: RuleType.codeBlock,\n lang: undefined,\n text: unescapeString(trimEnd(capture[0].replace(/^ {4}/gm, ''))),\n };\n },\n _render(node, _, state = {}) {\n const attrs = { ...((node as any).attrs ?? {}) } as Record<string, any>;\n const langClass = node.lang ? `lang-${node.lang}` : 'lang-plaintext';\n attrs.className = attrs.className\n ? `${attrs.className} ${langClass}`\n : langClass;\n\n return createElement(\n 'pre',\n { key: state.key },\n createElement('code', attrs, node.text)\n );\n },\n },\n [RuleType.codeFenced]: {\n _qualify: ['```', '~~~'],\n _match: blockRegex(CODE_BLOCK_FENCED_R),\n _order: Priority.MAX,\n _parse(capture) {\n return {\n attrs: attrStringToMap('code', capture[3] ?? ''),\n lang: capture[2] || undefined,\n text: capture[4],\n type: RuleType.codeBlock,\n };\n },\n },\n [RuleType.codeInline]: {\n _qualify: ['`'],\n _match: simpleInlineRegex(CODE_INLINE_R),\n _order: Priority.LOW,\n _parse(capture) {\n return { text: unescapeString(capture[2]) };\n },\n _render(node, _, state = {}) {\n return createElement('code', { key: state.key }, node.text);\n },\n },\n [RuleType.footnote]: {\n _qualify: ['[^'],\n _match: blockRegex(FOOTNOTE_R),\n _order: Priority.MAX,\n _parse(capture) {\n footnotes.push({ footnote: capture[2], identifier: capture[1] });\n\n return {};\n },\n _render: renderNothing,\n },\n [RuleType.footnoteReference]: {\n _qualify: ['[^'],\n _match: inlineRegex(FOOTNOTE_REFERENCE_R),\n _order: Priority.HIGH,\n _parse(capture) {\n return { target: `#${slug(capture[1])}`, text: capture[1] };\n },\n _render(node, _, state = {}) {\n return createElement(\n 'a',\n {\n key: state.key,\n href: sanitize(node.target, 'a', 'href') ?? undefined,\n },\n createElement('sup', { key: state.key }, node.text)\n );\n },\n },\n [RuleType.gfmTask]: {\n _qualify: ['[ ]', '[x]'],\n _match: inlineRegex(GFM_TASK_R),\n _order: Priority.HIGH,\n _parse(capture) {\n return { completed: capture[1].toLowerCase() === 'x' };\n },\n _render(node, _, state = {}) {\n return createElement('input', {\n checked: node.completed,\n key: state.key,\n readOnly: true,\n type: 'checkbox',\n });\n },\n },\n [RuleType.heading]: {\n _qualify: ['#'],\n _match: blockRegex(\n options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R\n ),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n return {\n children: parseInline(parse, capture[2], state),\n id: slug(capture[2]),\n level: capture[1].length as HeadingNode['level'],\n };\n },\n _render(node, output, state = {}) {\n return createElement(\n `h${node.level}` as HTMLTag,\n { id: node.id, key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.headingSetext]: {\n _qualify: (source) => {\n const nlIndex = source.indexOf('\\n');\n\n return (\n nlIndex > 0 &&\n nlIndex < source.length - 1 &&\n (source[nlIndex + 1] === '=' || source[nlIndex + 1] === '-')\n );\n },\n _match: blockRegex(HEADING_SETEXT_R),\n _order: Priority.MAX,\n _parse(capture, parse, state) {\n return {\n children: parseInline(parse, capture[1], state),\n level: capture[2] === '=' ? 1 : 2,\n type: RuleType.heading,\n };\n },\n },\n [RuleType.htmlBlock]: {\n _qualify: (source) => {\n if (options.disableParsingRawHTML) return false;\n\n const match = source.match(/^ *<([a-z][a-z0-9:-]*)\\b/i);\n if (!match) return false;\n const tag = match[1];\n\n return source.toLowerCase().indexOf(`</${tag.toLowerCase()}>`) !== -1;\n },\n _match: anyScopeRegex(HTML_BLOCK_ELEMENT_R),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n const m = capture[3].match(HTML_LEFT_TRIM_AMOUNT_R);\n const whitespace = m?.[1] ?? '';\n const trimmed = trimLeadingWhitespaceOutsideFences(\n capture[3],\n whitespace\n );\n const parseFunc = containsBlockSyntax(trimmed)\n ? parseBlock\n : parseInline;\n const tagName = capture[1].trim();\n const noInnerParse =\n DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(tagName.toLowerCase()) !== -1;\n const tag = (noInnerParse ? tagName.toLowerCase() : tagName) as HTMLTag;\n const ast: any = {\n attrs: attrStringToMap(tag, capture[2] ?? ''),\n noInnerParse,\n tag,\n };\n state.inAnchor = state.inAnchor || tagName.toLowerCase() === 'a';\n\n if (noInnerParse) {\n ast.text = capture[3];\n } else {\n const prevInHTML = state.inHTML;\n state.inHTML = true;\n ast.children = parseFunc(parse, trimmed, state);\n state.inHTML = prevInHTML;\n }\n state.inAnchor = false;\n\n return ast;\n },\n _render(node, output, state = {}) {\n return createElement(\n node.tag,\n { key: state.key, ...(node.attrs ?? {}) },\n node.text ?? (node.children ? output(node.children, state) : '')\n );\n },\n },\n [RuleType.htmlComment]: {\n _qualify: ['<!'],\n _match: anyScopeRegex(HTML_COMMENT_R),\n _order: Priority.HIGH,\n _parse: captureNothing,\n _render: renderNothing,\n },\n [RuleType.htmlSelfClosing]: {\n _qualify: (source) => {\n if (options.disableParsingRawHTML) return false;\n\n return /^ *<([a-zA-Z][a-zA-Z0-9:]*)[\\s>/]/.test(source);\n },\n _match: anyScopeRegex(HTML_SELF_CLOSING_ELEMENT_R),\n _order: Priority.HIGH,\n _parse(capture) {\n const tag = capture[1].trim() as HTMLTag;\n\n return { attrs: attrStringToMap(tag, capture[2] || ''), tag };\n },\n _render(node, _, state = {}) {\n return createElement(node.tag, {\n key: state.key,\n ...(node.attrs ?? {}),\n });\n },\n },\n [RuleType.customComponent]: {\n _qualify: (source) => /^ *<([A-Z][a-zA-Z0-9]*)/.test(source),\n _match: anyScopeRegex(CUSTOM_COMPONENT_R),\n _order: Priority.MAX,\n _parse(capture, parse, state) {\n const m = capture[3].match(HTML_LEFT_TRIM_AMOUNT_R);\n const whitespace = m?.[1] ?? '';\n const trimmed = trimLeadingWhitespaceOutsideFences(\n capture[3],\n whitespace\n );\n const parseFunc = containsBlockSyntax(trimmed)\n ? parseBlock\n : parseInline;\n const tag = capture[1].trim();\n const ast: any = {\n attrs: attrStringToMap(tag as HTMLTag, capture[2] ?? ''),\n noInnerParse: false,\n tag,\n };\n const prevInHTML = state.inHTML;\n state.inHTML = true;\n ast.children = parseFunc(parse, trimmed, state);\n state.inHTML = prevInHTML;\n\n return ast;\n },\n _render(node, output, state = {}) {\n return createElement(\n node.tag as HTMLTag,\n { key: state.key, ...(node.attrs ?? {}) },\n node.text ?? (node.children ? output(node.children, state) : '')\n );\n },\n },\n [RuleType.paragraph]: {\n _match: matchParagraph,\n _order: Priority.LOW,\n _parse: parseCaptureInline,\n _render(node, output, state = {}) {\n return createElement(\n 'p',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.image]: {\n _qualify: ['!['],\n _match: simpleInlineRegex(IMAGE_R),\n _order: Priority.HIGH,\n _parse(capture) {\n return {\n alt: unescapeString(capture[1]),\n target: unescapeString(capture[2]),\n title: unescapeString(capture[3]),\n };\n },\n _render(node, _, state = {}) {\n return createElement('img', {\n key: state.key,\n alt: node.alt ?? undefined,\n title: node.title ?? undefined,\n src: sanitize(node.target, 'img', 'src') ?? undefined,\n });\n },\n },\n [RuleType.link]: {\n _qualify: ['['],\n _match: inlineRegex(LINK_R),\n _order: Priority.LOW,\n _parse(capture, parse, state) {\n return {\n children: parseSimpleInline(parse, capture[1], state),\n target: unescapeString(capture[2]),\n title: unescapeString(capture[3]),\n };\n },\n _render(node, output, state = {}) {\n const sanitizedHref = sanitize(node.target, 'a', 'href');\n if (\n process.env.NODE_ENV === 'test' &&\n node.target.includes('javascript:')\n ) {\n console.log('Compiler sanitize result:', {\n target: node.target,\n sanitizedHref,\n finalHref: sanitizedHref ?? undefined,\n });\n }\n return createElement(\n 'a',\n {\n key: state.key,\n href: sanitizedHref ?? undefined,\n title: node.title ?? undefined,\n },\n output(node.children, state)\n );\n },\n },\n [RuleType.linkAngleBraceStyleDetector]: {\n _qualify: ['<'],\n _match: inlineRegex(LINK_AUTOLINK_R),\n _order: Priority.MAX,\n _parse(capture) {\n let target = capture[1];\n let isEmail = false;\n\n if (target.indexOf('@') !== -1 && target.indexOf('//') === -1) {\n isEmail = true;\n target = target.replace('mailto:', '');\n }\n\n return {\n children: [{ text: target, type: RuleType.text }],\n target: isEmail ? `mailto:${target}` : target,\n type: RuleType.link,\n };\n },\n },\n [RuleType.linkBareUrlDetector]: {\n _qualify: (source, state) =>\n !!(\n state.inline &&\n !state.inAnchor &&\n !options.disableAutoLink &&\n (startsWith(source, 'http://') || startsWith(source, 'https://'))\n ),\n _match: inlineRegex(LINK_AUTOLINK_BARE_URL_R),\n _order: Priority.MAX,\n _parse(capture) {\n return {\n children: [{ text: capture[1], type: RuleType.text }],\n target: capture[1],\n type: RuleType.link,\n };\n },\n },\n [RuleType.newlineCoalescer]: {\n _match: blockRegex(CONSECUTIVE_NEWLINE_R),\n _order: Priority.LOW,\n _parse: captureNothing,\n _render() {\n return '\\n';\n },\n },\n [RuleType.orderedList]: generateListRule(ORDERED),\n [RuleType.unorderedList]: generateListRule(UNORDERED),\n [RuleType.ref]: {\n _qualify: ['['],\n _match: anyScopeRegex(REFERENCE_IMAGE_OR_LINK),\n _order: Priority.MAX,\n _parse(capture) {\n refs[capture[1]] = { target: capture[2], title: capture[4] };\n\n return {};\n },\n _render: renderNothing,\n },\n [RuleType.refImage]: {\n _qualify: ['!['],\n _match: simpleInlineRegex(REFERENCE_IMAGE_R),\n _order: Priority.MAX,\n _parse(capture) {\n return {\n alt: capture[1] ? unescapeString(capture[1]) : undefined,\n ref: capture[2],\n };\n },\n _render(node, _, state = {}) {\n const ref = refs[node.ref];\n\n if (!ref) return null;\n\n return createElement('img', {\n key: state.key,\n alt: node.alt,\n src: sanitize(ref.target, 'img', 'src') ?? undefined,\n title: ref.title,\n });\n },\n },\n [RuleType.refLink]: {\n _qualify: (source) => source[0] === '[' && source.indexOf('](') === -1,\n _match: inlineRegex(REFERENCE_LINK_R),\n _order: Priority.MAX,\n _parse(capture, parse, state) {\n return {\n children: parseSimpleInline(parse, capture[1], state),\n fallbackChildren: capture[0],\n ref: capture[2],\n };\n },\n _render(node, output, state = {}) {\n const ref = refs[node.ref];\n\n if (!ref)\n return createElement(\n 'span',\n { key: state.key },\n node.fallbackChildren\n );\n\n return createElement(\n 'a',\n {\n key: state.key,\n href: sanitize(ref.target, 'a', 'href') ?? undefined,\n title: ref.title,\n },\n output(node.children, state)\n );\n },\n },\n [RuleType.table]: {\n _qualify: ['|'],\n _match: blockRegex(NP_TABLE_R),\n _order: Priority.HIGH,\n _parse(capture, parse, state) {\n state.inline = true;\n const align = capture[2] ? parseTableAlign(capture[2]) : [];\n const cells = capture[3]\n ? parseTableCells(capture[3], parse, state)\n : [];\n const header = parseTableRow(capture[1], parse, state, !!cells.length);\n state.inline = false;\n\n return cells.length\n ? { align, cells, header, type: RuleType.table }\n : { children: header.flat(), type: RuleType.paragraph };\n },\n _render(node, output, state = {}) {\n const table = node as TableNode;\n const getStyle = (i: number) =>\n table.align[i] && table.align[i] !== 'left'\n ? { textAlign: table.align[i] }\n : {};\n\n return createElement(\n 'table',\n { key: state.key },\n createElement(\n 'thead',\n null,\n createElement(\n 'tr',\n null,\n ...table.header.map((c, i) =>\n createElement(\n 'th',\n { key: i, style: getStyle(i) },\n output(c, state)\n )\n )\n )\n ),\n createElement(\n 'tbody',\n null,\n ...table.cells.map((row, i) =>\n createElement(\n 'tr',\n { key: i },\n ...row.map((c, j) =>\n createElement(\n 'td',\n { key: j, style: getStyle(j) },\n output(c, state)\n )\n )\n )\n )\n )\n );\n },\n },\n [RuleType.tableSeparator]: {\n _match: (source, state) =>\n state.inTable && source[0] === '|' ? /^\\|/.exec(source) : null,\n _order: Priority.HIGH,\n _parse() {\n return { type: RuleType.tableSeparator };\n },\n _render() {\n return ' | ';\n },\n },\n [RuleType.text]: {\n _match: allowInline((source, _state) => {\n const shortMatch = SHORTCODE_R.exec(source);\n\n if (shortMatch) return shortMatch;\n\n return TEXT_PLAIN_R.exec(source) || /^[\\s\\S]/.exec(source);\n }),\n _order: Priority.MIN,\n _parse(capture) {\n const text = capture[0];\n\n return {\n text:\n text.indexOf('&') === -1\n ? text\n : text.replace(HTML_CHAR_CODE_R, (f, i) => {\n if (i.startsWith('#x'))\n return String.fromCharCode(parseInt(i.slice(2), 16));\n if (i.startsWith('#'))\n return String.fromCharCode(parseInt(i.slice(1), 10));\n return namedCodesToUnicode[i] || f;\n }),\n };\n },\n _render(node) {\n return node.text;\n },\n },\n [RuleType.textBolded]: {\n _qualify: ['**', '__'],\n _match: simpleInlineRegex(TEXT_BOLD_R),\n _order: Priority.MED,\n _parse(capture, parse, state) {\n return { children: parse(capture[2], state) };\n },\n _render(node, output, state = {}) {\n return createElement(\n 'strong',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.textEmphasized]: {\n _qualify: ['*', '_'],\n _match: simpleInlineRegex(TEXT_EMPHASIZED_R),\n _order: Priority.LOW,\n _parse(capture, parse, state) {\n return { children: parse(capture[2], state) };\n },\n _render(node, output, state = {}) {\n return createElement(\n 'em',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.textEscaped]: {\n _qualify: ['\\\\'],\n _match: simpleInlineRegex(TEXT_ESCAPED_R),\n _order: Priority.HIGH,\n _parse(capture) {\n return { text: capture[1], type: RuleType.text };\n },\n },\n [RuleType.textMarked]: {\n _qualify: ['=='],\n _match: simpleInlineRegex(TEXT_MARKED_R),\n _order: Priority.LOW,\n _parse: parseCaptureInline,\n _render(node, output, state = {}) {\n return createElement(\n 'mark',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n [RuleType.textStrikethroughed]: {\n _qualify: ['~~'],\n _match: simpleInlineRegex(TEXT_STRIKETHROUGHED_R),\n _order: Priority.LOW,\n _parse: parseCaptureInline,\n _render(node, output, state = {}) {\n return createElement(\n 'del',\n { key: state.key },\n output(node.children, state)\n );\n },\n },\n };\n\n return rules;\n};\n\n// Removed compilerCache completely to avoid issues with props changes not invalidating cache\n// const compilerCache = new Map<string, unknown>();\n\nexport type ParsedMarkdown = {\n ast: any[];\n footnotes: FootnoteDef[];\n inline: boolean;\n};\n\nexport const parseMarkdown = (\n markdown: string = '',\n ctx: MarkdownContext<any>,\n options: MarkdownOptions = {}\n): ParsedMarkdown => {\n const dummyCreateElement = () => null;\n const footnotes: FootnoteDef[] = [];\n const refs: Record<string, { target: string; title?: string }> = {};\n\n const attrStringToMap = (\n tag: HTMLTag,\n str: string\n ): Record<string, any> | null => {\n if (!str?.trim()) return null;\n\n const attributes = str.match(ATTR_EXTRACTOR_R);\n\n if (!attributes) return null;\n\n return attributes.reduce((map: any, raw) => {\n const delimiterIdx = raw.indexOf('=');\n\n if (delimiterIdx !== -1) {\n const key = normalizeAttributeKey(raw.slice(0, delimiterIdx)).trim();\n const value = unquote(raw.slice(delimiterIdx + 1).trim());\n const mappedKey = ATTRIBUTE_TO_NODE_PROP_MAP[key] ?? key;\n\n if (mappedKey === 'ref') return map;\n map[mappedKey] = attributeValueToNodePropValue(\n tag,\n key,\n value,\n ctx.sanitizer ?? defaultSanitizer\n );\n\n if (\n typeof map[mappedKey] === 'string' &&\n (HTML_BLOCK_ELEMENT_R.test(map[mappedKey]) ||\n HTML_SELF_CLOSING_ELEMENT_R.test(map[mappedKey]))\n ) {\n map[mappedKey] = parseMarkdown(\n map[mappedKey].trim(),\n ctx,\n options\n ).ast;\n }\n } else if (raw !== 'style') {\n map[ATTRIBUTE_TO_NODE_PROP_MAP[raw] ?? raw] = true;\n }\n\n return map;\n }, {});\n };\n\n const nonParagraphBlockSyntaxes = [\n BLOCKQUOTE_R,\n CODE_BLOCK_FENCED_R,\n CODE_BLOCK_R,\n options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R,\n HEADING_SETEXT_R,\n NP_TABLE_R,\n ORDERED_LIST_R,\n UNORDERED_LIST_R,\n CUSTOM_COMPONENT_R,\n ];\n\n const containsBlockSyntax = (input: string): boolean => {\n const cleaned = input.replace(TRIM_STARTING_NEWLINES, '');\n const slice = cleaned.length > 2048 ? cleaned.slice(0, 2048) : cleaned;\n\n if (slice.indexOf('\\n\\n') !== -1) return true;\n\n const syntaxes = options.disableParsingRawHTML\n ? nonParagraphBlockSyntaxes\n : [\n ...nonParagraphBlockSyntaxes,\n PARAGRAPH_R,\n HTML_BLOCK_ELEMENT_R,\n HTML_COMMENT_R,\n HTML_SELF_CLOSING_ELEMENT_R,\n CUSTOM_COMPONENT_R,\n ];\n\n return some(syntaxes as RegExp[], slice);\n };\n\n const baseRules = createRules(\n dummyCreateElement,\n ctx,\n options,\n footnotes,\n refs,\n attrStringToMap,\n containsBlockSyntax,\n nonParagraphBlockSyntaxes\n );\n\n const rules = options.disableParsingRawHTML\n ? Object.keys(baseRules).reduce((acc, key) => {\n if (key !== RuleType.htmlBlock && key !== RuleType.htmlSelfClosing) {\n acc[key] = baseRules[key];\n }\n\n return acc;\n }, {} as Rules)\n : baseRules;\n\n const parser = parserFor(rules);\n\n const result = options.preserveFrontmatter\n ? markdown\n : markdown.replace(FRONT_MATTER_R, '');\n const inline =\n options.forceInline ||\n (!options.forceBlock &&\n SHOULD_RENDER_AS_BLOCK_R.test(\n result.replace(TRIM_STARTING_NEWLINES, '')\n ) === false);\n\n const ast = parser(\n inline\n ? result\n : `${trimEnd(result).replace(TRIM_STARTING_NEWLINES, '')}\\n\\n`,\n { inline }\n );\n\n if (footnotes.length > 0) {\n // Parse footnotes content as well\n for (const def of footnotes) {\n (def as any).parsedAst = parser(def.footnote, { inline: true });\n }\n }\n\n return { ast, footnotes, inline };\n};\n\nexport const renderMarkdownAst = (\n parsed: ParsedMarkdown,\n ctx: MarkdownContext<any>,\n options: MarkdownOptions = {}\n): unknown => {\n const components = ctx.components ?? {};\n const slug = (input: string) => {\n if (process.env.NODE_ENV === 'test' && input === '中文') {\n const def = defaultSlugify(input);\n console.log('Slug check:', {\n input,\n ctxSlugify: !!ctx.slugify,\n defaultSlugifyResult: def,\n });\n }\n return ctx.slugify\n ? ctx.slugify(input, defaultSlugify)\n : defaultSlugify(input);\n };\n const createElement = createElementFactory(ctx, options);\n const footnotes = parsed.footnotes || [];\n const refs: Record<string, { target: string; title?: string }> = {};\n\n const attrStringToMap = () => null; // Not needed during render\n const containsBlockSyntax = () => false; // Not needed during render\n const nonParagraphBlockSyntaxes: any[] = [];\n\n const baseRules = createRules(\n createElement,\n ctx,\n options,\n footnotes,\n refs,\n attrStringToMap,\n containsBlockSyntax,\n nonParagraphBlockSyntaxes\n );\n\n const rules = options.disableParsingRawHTML\n ? Object.keys(baseRules).reduce((acc, key) => {\n if (key !== RuleType.htmlBlock && key !== RuleType.htmlSelfClosing) {\n acc[key] = baseRules[key];\n }\n\n return acc;\n }, {} as Rules)\n : baseRules;\n\n const emitter = renderFor(createRenderer(rules, options.renderRule));\n\n const inline = parsed.inline;\n const arr = emitter(parsed.ast, { inline }) as unknown as any[];\n\n while (typeof arr[arr.length - 1] === 'string' && !arr[arr.length - 1].trim())\n arr.pop();\n\n const getOuterNode = () => {\n if (options.wrapper === null) return arr;\n const wrapper = options.wrapper ?? (inline ? 'span' : 'div');\n\n if (arr.length > 1 || options.forceWrapper)\n return createElement(wrapper, { key: 'outer' }, arr);\n\n if (arr.length === 1) {\n const node = arr[0];\n\n if (typeof node === 'string') {\n const spanProps: Record<string, any> = { key: 'outer' };\n\n if (!inline && components) {\n const pOverrideProps = (get(components, 'p.props', {}) ??\n {}) as Record<string, any>;\n const mergedClassName = cx(\n spanProps.className,\n pOverrideProps.className\n );\n const finalSpanProps: Record<string, any> = {\n ...spanProps,\n ...pOverrideProps,\n };\n\n if (mergedClassName) finalSpanProps.className = mergedClassName;\n\n return createElement('span', finalSpanProps, node);\n }\n\n return createElement('span', spanProps, node);\n }\n\n return node;\n }\n\n return createElement(wrapper, { key: 'outer' }, null);\n };\n\n const node = getOuterNode();\n\n const result = footnotes.length\n ? createElement(\n 'div',\n null,\n node,\n createElement(\n 'footer',\n { key: 'footer' },\n ...footnotes.map((def) =>\n createElement(\n 'div',\n { id: slug(def.identifier), key: def.identifier },\n def.identifier,\n emitter((def as any).parsedAst || def.footnote, { inline: true })\n )\n )\n )\n )\n : node;\n\n return result;\n};\n\nexport const compile = (\n markdown: string = '',\n ctx: MarkdownContext<any>,\n options: MarkdownOptions = {}\n): unknown => {\n if (typeof markdown !== 'string') {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n 'intlayer: the first argument must be a string. Received',\n typeof markdown\n );\n }\n throw new Error('intlayer: the first argument must be a string');\n }\n\n const parsed = parseMarkdown(markdown, ctx, options);\n return renderMarkdownAst(parsed, ctx, options);\n};\n\nexport const createCompiler =\n (ctx: MarkdownContext<any>) =>\n (markdown: string, options?: MarkdownOptions): unknown =>\n compile(markdown, ctx, options);\n\nexport const compileWithOptions = (\n markdown: string,\n runtime: MarkdownRuntime,\n options: CompileOptions<any> = {}\n): unknown => {\n const {\n components,\n namedCodesToUnicode,\n sanitizer,\n slugify,\n ...compilerOptions\n } = options;\n\n return compile(\n markdown,\n { runtime, components, namedCodesToUnicode, sanitizer, slugify },\n compilerOptions\n );\n};\n"],"mappings":";;;;;;;AA+GA,MAAM,UAAU;AAKhB,MAAM,SAAS,IAAI,OACjB,4JACF;AAEA,MAAM,UAAU,KAAU,eAA8C;CACtE,IAAI,OAAO,QAAQ,UAAU,OAAO;CACp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.normalizeWhitespace = require_markdown_utils.normalizeWhitespace;
104
104
  exports.parseBlock = require_markdown_utils.parseBlock;
105
105
  exports.parseCaptureInline = require_markdown_utils.parseCaptureInline;
106
106
  exports.parseInline = require_markdown_utils.parseInline;
107
+ exports.parseMarkdown = require_markdown_compiler.parseMarkdown;
107
108
  exports.parseSimpleInline = require_markdown_utils.parseSimpleInline;
108
109
  exports.parseStyleAttribute = require_markdown_utils.parseStyleAttribute;
109
110
  exports.parseTableAlign = require_markdown_utils.parseTableAlign;
@@ -113,6 +114,7 @@ exports.parseTableRow = require_markdown_utils.parseTableRow;
113
114
  exports.parserFor = require_markdown_parser.parserFor;
114
115
  exports.qualifies = require_markdown_utils.qualifies;
115
116
  exports.renderFor = require_markdown_renderer.renderFor;
117
+ exports.renderMarkdownAst = require_markdown_compiler.renderMarkdownAst;
116
118
  exports.renderNothing = require_markdown_utils.renderNothing;
117
119
  exports.sanitizer = require_markdown_utils.sanitizer;
118
120
  exports.simpleInlineRegex = require_markdown_utils.simpleInlineRegex;
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/condition/condition.ts
@@ -1 +1 @@
1
- {"version":3,"file":"condition.cjs","names":["CONDITION"],"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { CONDITION, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {\n fallback?: Content;\n};\n\nexport type ConditionContent<Content = unknown> = TypedNodeModel<\n typeof CONDITION,\n ConditionContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a condition.\n *\n * Usage:\n *\n * ```ts\n * cond({\n * 'true': 'The condition is validated',\n * 'false': 'The condition is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst condition = <Content>(\n content?: ConditionContentStates<Content>\n): ConditionContent<Content> => formatNodeType(CONDITION, content);\n\nexport { condition as cond };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,aACJ,yDAC6CA,oCAAW,OAAO"}
1
+ {"version":3,"file":"condition.cjs","names":["CONDITION"],"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { CONDITION, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {\n fallback?: Content;\n};\n\nexport type ConditionContent<Content = unknown> = TypedNodeModel<\n typeof CONDITION,\n ConditionContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a condition.\n *\n * Usage:\n *\n * ```ts\n * cond({\n * 'true': 'The condition is validated',\n * 'false': 'The condition is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst condition = <Content>(\n content?: ConditionContentStates<Content>\n): ConditionContent<Content> => formatNodeType(CONDITION, content);\n\nexport { condition as cond };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,aACJ,yDAC6CA,oCAAW,OAAO"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/enumeration/enumeration.ts
@@ -1 +1 @@
1
- {"version":3,"file":"enumeration.cjs","names":["ENUMERATION"],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { ENUMERATION, formatNodeType } from '@intlayer/types/nodeType';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n Record<EnterFormat, Content>\n> & {\n fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n typeof ENUMERATION,\n EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content = unknown>(\n content?: EnumerationContentState<Content>\n): EnumerationContent<Content> => formatNodeType(ENUMERATION, content);\n\nexport { enumeration as enu };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,eACJ,yDAC+CA,sCAAa,OAAO"}
1
+ {"version":3,"file":"enumeration.cjs","names":["ENUMERATION"],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { ENUMERATION, formatNodeType } from '@intlayer/types/nodeType';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n Record<EnterFormat, Content>\n> & {\n fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n typeof ENUMERATION,\n EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content = unknown>(\n content?: EnumerationContentState<Content>\n): EnumerationContent<Content> => formatNodeType(ENUMERATION, content);\n\nexport { enumeration as enu };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,eACJ,yDAC+CA,sCAAa,OAAO"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
4
  let node_fs = require("node:fs");
@@ -1 +1 @@
1
- {"version":3,"file":"file.cjs","names":["FILE","baseDir"],"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, isAbsolute, relative, resolve } from 'node:path';\nimport { colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { FILE, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type FileContentConstructor<T extends Record<string, any> = {}> =\n TypedNodeModel<typeof FILE, string, T>;\n\nexport type FileContent = FileContentConstructor<{\n content: string;\n fixedPath?: string;\n}>;\n\nexport const fileContent = (\n path: string,\n callerDir: string,\n baseDir: string\n): FileContent => {\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger();\n\n let filePath: string;\n if (isAbsolute(path)) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${callerDir}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(baseDir, path);\n }\n\n if (existsSync(filePath) && statSync(filePath).isFile()) {\n try {\n const content = readFileSync(filePath, 'utf8');\n\n return formatNodeType(FILE, path, {\n content,\n fixedPath: relative(baseDir, filePath),\n });\n } catch {\n throw new Error(\n `Unable to read path: ${colorizePath(relative(baseDir, filePath))}`\n );\n }\n } else {\n throw new Error(\n `File not found: ${colorizePath(relative(baseDir, filePath))}`\n );\n }\n};\n\ntype GlobalIntlayerFilePath = {\n INTLAYER_FILE_PATH: string;\n INTLAYER_BASE_DIR: string;\n};\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n const { INTLAYER_FILE_PATH, INTLAYER_BASE_DIR } =\n globalThis as unknown as GlobalIntlayerFilePath;\n\n const callerDir = dirname(INTLAYER_FILE_PATH);\n const baseDir = INTLAYER_BASE_DIR;\n\n return fileContent(path, callerDir, baseDir);\n};\n"],"mappings":";;;;;;;;AAcA,MAAa,eACX,MACA,WACA,YACgB;CAChB,MAAM,iBAAiB,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK;CACrE,MAAM,sDAAyB;CAE/B,IAAI;CACJ,8BAAe,IAAI,GAAG;EACpB,UACE,sFAAsF,KAAK,mBAAmB,aAC9G,EAAE,OAAO,OAAO,CAClB;EACA,WAAW;CACb,OAAO,IAAI,gBACT,kCAAmB,WAAW,IAAI;MAElC,kCAAmB,SAAS,IAAI;CAGlC,4BAAe,QAAQ,2BAAc,QAAQ,EAAE,OAAO,GACpD,IAAI;EAGF,oDAAsBA,+BAAM,MAAM;GAChC,mCAH2B,UAAU,MAG/B;GACN,mCAAoB,SAAS,QAAQ;EACvC,CAAC;CACH,QAAQ;EACN,MAAM,IAAI,MACR,0FAA8C,SAAS,QAAQ,CAAC,GAClE;CACF;MAEA,MAAM,IAAI,MACR,qFAAyC,SAAS,QAAQ,CAAC,GAC7D;AAEJ;;;;;;;;;;;;;;;;AAsBA,MAAa,QAAQ,SAA8B;CACjD,MAAM,EAAE,oBAAoB,sBAC1B;CAKF,OAAO,YAAY,6BAHO,kBAGO,GAAGC,iBAAO;AAC7C"}
1
+ {"version":3,"file":"file.cjs","names":["FILE","baseDir"],"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, isAbsolute, relative, resolve } from 'node:path';\nimport { colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { FILE, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type FileContentConstructor<T extends Record<string, any> = {}> =\n TypedNodeModel<typeof FILE, string, T>;\n\nexport type FileContent = FileContentConstructor<{\n content: string;\n fixedPath?: string;\n}>;\n\nexport const fileContent = (\n path: string,\n callerDir: string,\n baseDir: string\n): FileContent => {\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger();\n\n let filePath: string;\n if (isAbsolute(path)) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${callerDir}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(baseDir, path);\n }\n\n if (existsSync(filePath) && statSync(filePath).isFile()) {\n try {\n const content = readFileSync(filePath, 'utf8');\n\n return formatNodeType(FILE, path, {\n content,\n fixedPath: relative(baseDir, filePath),\n });\n } catch {\n throw new Error(\n `Unable to read path: ${colorizePath(relative(baseDir, filePath))}`\n );\n }\n } else {\n throw new Error(\n `File not found: ${colorizePath(relative(baseDir, filePath))}`\n );\n }\n};\n\ntype GlobalIntlayerFilePath = {\n INTLAYER_FILE_PATH: string;\n INTLAYER_BASE_DIR: string;\n};\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n const { INTLAYER_FILE_PATH, INTLAYER_BASE_DIR } =\n globalThis as unknown as GlobalIntlayerFilePath;\n\n const callerDir = dirname(INTLAYER_FILE_PATH);\n const baseDir = INTLAYER_BASE_DIR;\n\n return fileContent(path, callerDir, baseDir);\n};\n"],"mappings":";;;;;;;AAcA,MAAa,eACX,MACA,WACA,YACgB;CAChB,MAAM,iBAAiB,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK;CACrE,MAAM,sDAAyB;CAE/B,IAAI;CACJ,8BAAe,IAAI,GAAG;EACpB,UACE,sFAAsF,KAAK,mBAAmB,aAC9G,EAAE,OAAO,OAAO,CAClB;EACA,WAAW;CACb,OAAO,IAAI,gBACT,kCAAmB,WAAW,IAAI;MAElC,kCAAmB,SAAS,IAAI;CAGlC,4BAAe,QAAQ,2BAAc,QAAQ,EAAE,OAAO,GACpD,IAAI;EAGF,oDAAsBA,+BAAM,MAAM;GAChC,mCAH2B,UAAU,MAG/B;GACN,mCAAoB,SAAS,QAAQ;EACvC,CAAC;CACH,QAAQ;EACN,MAAM,IAAI,MACR,0FAA8C,SAAS,QAAQ,CAAC,GAClE;CACF;MAEA,MAAM,IAAI,MACR,qFAAyC,SAAS,QAAQ,CAAC,GAC7D;AAEJ;;;;;;;;;;;;;;;;AAsBA,MAAa,QAAQ,SAA8B;CACjD,MAAM,EAAE,oBAAoB,sBAC1B;CAKF,OAAO,YAAY,6BAHO,kBAGO,GAAGC,iBAAO;AAC7C"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/gender/gender.ts
@@ -1 +1 @@
1
- {"version":3,"file":"gender.cjs","names":["GENDER"],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, GENDER } from '@intlayer/types/nodeType';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n typeof GENDER,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(\n content?: GenderContentStates<Content>\n): GenderContent<Content> => formatNodeType(GENDER, content);\n\nexport { gender };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,UACJ,yDAC0CA,iCAAQ,OAAO"}
1
+ {"version":3,"file":"gender.cjs","names":["GENDER"],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, GENDER } from '@intlayer/types/nodeType';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n typeof GENDER,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(\n content?: GenderContentStates<Content>\n): GenderContent<Content> => formatNodeType(GENDER, content);\n\nexport { gender };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,UACJ,yDAC0CA,iCAAQ,OAAO"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_transpiler_html_getHTMLCustomComponents = require('./getHTMLCustomComponents.cjs');
4
3
  const require_transpiler_html_validateHTML = require('./validateHTML.cjs');
5
4
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
@@ -1 +1 @@
1
- {"version":3,"file":"html.cjs","names":["validateHTML","getHTMLCustomComponents","HTML"],"sources":["../../../../src/transpiler/html/html.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, HTML } from '@intlayer/types/nodeType';\nimport { getHTMLCustomComponents } from './getHTMLCustomComponents';\nimport { validateHTML } from './validateHTML';\n\ntype PropsType = 'number' | 'string' | 'node';\n\ntype ComponentName = string;\n\nexport type HTMLContentConstructor<\n Content = unknown,\n T extends Record<string, any> = {},\n> = TypedNodeModel<typeof HTML, Content, T>;\n\nexport type HTMLContent<\n Content = unknown,\n Components extends Record<ComponentName, PropsType> = Record<\n ComponentName,\n PropsType\n >,\n> = HTMLContentConstructor<\n Content,\n {\n tags: string[] | Components;\n }\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to parse HTML/JSX-like strings and replace tags with components during interpretation.\n *\n * Usage:\n *\n * ```ts\n * html('Hello <b>World</b>')\n * ```\n *\n */\nexport const html = <\n Components extends Record<string, any> = Record<string, any>,\n Content = unknown,\n>(\n content: Content,\n components?: Components\n): HTMLContent<Content, Components> => {\n const getComponents = () => {\n if (components) {\n return components;\n }\n\n if (typeof content === 'string') {\n const { issues } = validateHTML(content);\n\n for (const issue of issues) {\n if (issue.type === 'error') {\n console.error(`[intlayer/html] ${issue.message}`);\n } else {\n console.warn(`[intlayer/html] ${issue.message}`);\n }\n }\n\n return getHTMLCustomComponents(content);\n }\n\n let stringContent: any;\n\n if (typeof content === 'function') {\n stringContent = content();\n } else if (typeof (content as Promise<string>).then === 'function') {\n stringContent = async () =>\n getHTMLCustomComponents((await (content as Promise<string>)) as string);\n }\n\n if (typeof stringContent === 'string') {\n return getHTMLCustomComponents(stringContent);\n }\n\n try {\n return getHTMLCustomComponents(JSON.stringify(content));\n } catch (_e) {\n return [];\n }\n };\n\n return formatNodeType(HTML, content, {\n tags: getComponents(),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,MAAa,QAIX,SACA,eACqC;CACrC,MAAM,sBAAsB;EAC1B,IAAI,YACF,OAAO;EAGT,IAAI,OAAO,YAAY,UAAU;GAC/B,MAAM,EAAE,WAAWA,kDAAa,OAAO;GAEvC,KAAK,MAAM,SAAS,QAClB,IAAI,MAAM,SAAS,SACjB,QAAQ,MAAM,mBAAmB,MAAM,SAAS;QAEhD,QAAQ,KAAK,mBAAmB,MAAM,SAAS;GAInD,OAAOC,wEAAwB,OAAO;EACxC;EAEA,IAAI;EAEJ,IAAI,OAAO,YAAY,YACrB,gBAAgB,QAAQ;OACnB,IAAI,OAAQ,QAA4B,SAAS,YACtD,gBAAgB,YACdA,wEAAyB,MAAO,OAAsC;EAG1E,IAAI,OAAO,kBAAkB,UAC3B,OAAOA,wEAAwB,aAAa;EAG9C,IAAI;GACF,OAAOA,wEAAwB,KAAK,UAAU,OAAO,CAAC;EACxD,SAAS,IAAI;GACX,OAAO,CAAC;EACV;CACF;CAEA,oDAAsBC,+BAAM,SAAS,EACnC,MAAM,cAAc,EACtB,CAAC;AACH"}
1
+ {"version":3,"file":"html.cjs","names":["validateHTML","getHTMLCustomComponents","HTML"],"sources":["../../../../src/transpiler/html/html.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, HTML } from '@intlayer/types/nodeType';\nimport { getHTMLCustomComponents } from './getHTMLCustomComponents';\nimport { validateHTML } from './validateHTML';\n\ntype PropsType = 'number' | 'string' | 'node';\n\ntype ComponentName = string;\n\nexport type HTMLContentConstructor<\n Content = unknown,\n T extends Record<string, any> = {},\n> = TypedNodeModel<typeof HTML, Content, T>;\n\nexport type HTMLContent<\n Content = unknown,\n Components extends Record<ComponentName, PropsType> = Record<\n ComponentName,\n PropsType\n >,\n> = HTMLContentConstructor<\n Content,\n {\n tags: string[] | Components;\n }\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to parse HTML/JSX-like strings and replace tags with components during interpretation.\n *\n * Usage:\n *\n * ```ts\n * html('Hello <b>World</b>')\n * ```\n *\n */\nexport const html = <\n Components extends Record<string, any> = Record<string, any>,\n Content = unknown,\n>(\n content: Content,\n components?: Components\n): HTMLContent<Content, Components> => {\n const getComponents = () => {\n if (components) {\n return components;\n }\n\n if (typeof content === 'string') {\n const { issues } = validateHTML(content);\n\n for (const issue of issues) {\n if (issue.type === 'error') {\n console.error(`[intlayer/html] ${issue.message}`);\n } else {\n console.warn(`[intlayer/html] ${issue.message}`);\n }\n }\n\n return getHTMLCustomComponents(content);\n }\n\n let stringContent: any;\n\n if (typeof content === 'function') {\n stringContent = content();\n } else if (typeof (content as Promise<string>).then === 'function') {\n stringContent = async () =>\n getHTMLCustomComponents((await (content as Promise<string>)) as string);\n }\n\n if (typeof stringContent === 'string') {\n return getHTMLCustomComponents(stringContent);\n }\n\n try {\n return getHTMLCustomComponents(JSON.stringify(content));\n } catch (_e) {\n return [];\n }\n };\n\n return formatNodeType(HTML, content, {\n tags: getComponents(),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,MAAa,QAIX,SACA,eACqC;CACrC,MAAM,sBAAsB;EAC1B,IAAI,YACF,OAAO;EAGT,IAAI,OAAO,YAAY,UAAU;GAC/B,MAAM,EAAE,WAAWA,kDAAa,OAAO;GAEvC,KAAK,MAAM,SAAS,QAClB,IAAI,MAAM,SAAS,SACjB,QAAQ,MAAM,mBAAmB,MAAM,SAAS;QAEhD,QAAQ,KAAK,mBAAmB,MAAM,SAAS;GAInD,OAAOC,wEAAwB,OAAO;EACxC;EAEA,IAAI;EAEJ,IAAI,OAAO,YAAY,YACrB,gBAAgB,QAAQ;OACnB,IAAI,OAAQ,QAA4B,SAAS,YACtD,gBAAgB,YACdA,wEAAyB,MAAO,OAAsC;EAG1E,IAAI,OAAO,kBAAkB,UAC3B,OAAOA,wEAAwB,aAAa;EAG9C,IAAI;GACF,OAAOA,wEAAwB,KAAK,UAAU,OAAO,CAAC;EACxD,SAAS,IAAI;GACX,OAAO,CAAC;EACV;CACF;CAEA,oDAAsBC,+BAAM,SAAS,EACnC,MAAM,cAAc,EACtB,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_transpiler_insertion_getInsertionValues = require('./getInsertionValues.cjs');
4
3
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"insertion.cjs","names":["getInsertionValues","INSERTION"],"sources":["../../../../src/transpiler/insertion/insertion.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, INSERTION } from '@intlayer/types/nodeType';\nimport { getInsertionValues } from './getInsertionValues';\n\nexport type InsertionContentConstructor<\n Content = unknown,\n T extends Record<string, any> = {},\n> = TypedNodeModel<typeof INSERTION, Content, T>;\n\nexport type InsertionContent<Content = unknown> = InsertionContentConstructor<\n Content,\n {\n fields: string[];\n }\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to identify insertions inside a content.\n *\n * Usage:\n *\n * ```ts\n * insertion('Hi, my name is {{name}} and I am {{age}} years old.')\n * ```\n *\n */\nconst insertion = <Content = unknown>(\n content: Content\n): InsertionContent<Content> => {\n const getInsertions = () => {\n if (typeof content === 'string') {\n return getInsertionValues(content);\n }\n\n let stringContent: any;\n\n if (typeof content === 'function') {\n stringContent = content();\n } else if (typeof (content as Promise<string>).then === 'function') {\n stringContent = async () =>\n getInsertionValues(await (content as Promise<string>));\n }\n\n if (typeof stringContent === 'string') {\n return getInsertionValues(stringContent);\n }\n\n try {\n return getInsertionValues(JSON.stringify(content));\n } catch (_e) {\n return [];\n }\n };\n\n return formatNodeType(INSERTION, content, {\n fields: getInsertions(),\n });\n};\n\nexport { insertion as insert };\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAM,aACJ,YAC8B;CAC9B,MAAM,sBAAsB;EAC1B,IAAI,OAAO,YAAY,UACrB,OAAOA,mEAAmB,OAAO;EAGnC,IAAI;EAEJ,IAAI,OAAO,YAAY,YACrB,gBAAgB,QAAQ;OACnB,IAAI,OAAQ,QAA4B,SAAS,YACtD,gBAAgB,YACdA,mEAAmB,MAAO,OAA2B;EAGzD,IAAI,OAAO,kBAAkB,UAC3B,OAAOA,mEAAmB,aAAa;EAGzC,IAAI;GACF,OAAOA,mEAAmB,KAAK,UAAU,OAAO,CAAC;EACnD,SAAS,IAAI;GACX,OAAO,CAAC;EACV;CACF;CAEA,oDAAsBC,oCAAW,SAAS,EACxC,QAAQ,cAAc,EACxB,CAAC;AACH"}
1
+ {"version":3,"file":"insertion.cjs","names":["getInsertionValues","INSERTION"],"sources":["../../../../src/transpiler/insertion/insertion.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, INSERTION } from '@intlayer/types/nodeType';\nimport { getInsertionValues } from './getInsertionValues';\n\nexport type InsertionContentConstructor<\n Content = unknown,\n T extends Record<string, any> = {},\n> = TypedNodeModel<typeof INSERTION, Content, T>;\n\nexport type InsertionContent<Content = unknown> = InsertionContentConstructor<\n Content,\n {\n fields: string[];\n }\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to identify insertions inside a content.\n *\n * Usage:\n *\n * ```ts\n * insertion('Hi, my name is {{name}} and I am {{age}} years old.')\n * ```\n *\n */\nconst insertion = <Content = unknown>(\n content: Content\n): InsertionContent<Content> => {\n const getInsertions = () => {\n if (typeof content === 'string') {\n return getInsertionValues(content);\n }\n\n let stringContent: any;\n\n if (typeof content === 'function') {\n stringContent = content();\n } else if (typeof (content as Promise<string>).then === 'function') {\n stringContent = async () =>\n getInsertionValues(await (content as Promise<string>));\n }\n\n if (typeof stringContent === 'string') {\n return getInsertionValues(stringContent);\n }\n\n try {\n return getInsertionValues(JSON.stringify(content));\n } catch (_e) {\n return [];\n }\n };\n\n return formatNodeType(INSERTION, content, {\n fields: getInsertions(),\n });\n};\n\nexport { insertion as insert };\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,MAAM,aACJ,YAC8B;CAC9B,MAAM,sBAAsB;EAC1B,IAAI,OAAO,YAAY,UACrB,OAAOA,mEAAmB,OAAO;EAGnC,IAAI;EAEJ,IAAI,OAAO,YAAY,YACrB,gBAAgB,QAAQ;OACnB,IAAI,OAAQ,QAA4B,SAAS,YACtD,gBAAgB,YACdA,mEAAmB,MAAO,OAA2B;EAGzD,IAAI,OAAO,kBAAkB,UAC3B,OAAOA,mEAAmB,aAAa;EAGzC,IAAI;GACF,OAAOA,mEAAmB,KAAK,UAAU,OAAO,CAAC;EACnD,SAAS,IAAI;GACX,OAAO,CAAC;EACV;CACF;CAEA,oDAAsBC,oCAAW,SAAS,EACxC,QAAQ,cAAc,EACxB,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_interpreter_getContent_getContent = require('../../interpreter/getContent/getContent.cjs');
4
3
  const require_transpiler_html_getHTMLCustomComponents = require('../html/getHTMLCustomComponents.cjs');
5
4
  const require_transpiler_markdown_getMarkdownMetadata = require('./getMarkdownMetadata.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.cjs","names":["getContent","validateMarkdown","getMarkdownMetadata","getHTMLCustomComponents","MARKDOWN"],"sources":["../../../../src/transpiler/markdown/markdown.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, MARKDOWN } from '@intlayer/types/nodeType';\nimport { getContent } from '../../interpreter/getContent/getContent';\nimport { getHTMLCustomComponents } from '../html/getHTMLCustomComponents';\nimport { getMarkdownMetadata } from './getMarkdownMetadata';\nimport { validateMarkdown } from './validateMarkdown';\n\ntype PropsType = 'number' | 'string' | 'node';\n\ntype ComponentName = string;\n\nexport type MarkdownContentConstructor<\n T extends Record<string, any> = {},\n Content = unknown,\n> = TypedNodeModel<typeof MARKDOWN, Content, T>;\n\nexport type MarkdownContent<\n Content = unknown,\n Components extends Record<ComponentName, PropsType> = Record<\n ComponentName,\n PropsType\n >,\n> = MarkdownContentConstructor<\n {\n metadata?: Record<string, any>;\n tags?: string[] | Components;\n },\n Content\n>;\n\nconst awaitContent = async (content: any) => {\n if (typeof content === 'string' || typeof content === 'object') {\n return content as any;\n }\n\n if (typeof content === 'function') {\n return content();\n }\n if (typeof content.then === 'function') {\n return await content;\n }\n};\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * markdown('## Hello world!');\n * ```\n *\n */\nconst markdown = <\n Components extends Record<string, any> = Record<string, any>,\n Content = unknown,\n>(\n content: Content,\n components?: Components\n): MarkdownContent<Content, Components> => {\n const metadata = async () => {\n const awaitedContent = await awaitContent(content);\n\n const flatContent = getContent(awaitedContent, {\n dictionaryKey: '',\n keyPath: [],\n });\n\n if (typeof flatContent === 'string') {\n if (process.env.NODE_ENV !== 'production') {\n const { issues } = validateMarkdown(flatContent);\n for (const issue of issues) {\n if (issue.type === 'error') {\n console.error(`[intlayer/markdown] ${issue.message}`);\n } else {\n console.warn(`[intlayer/markdown] ${issue.message}`);\n }\n }\n }\n\n return getMarkdownMetadata(flatContent);\n }\n };\n\n const getComponents = () => {\n if (components) {\n return components;\n }\n\n if (typeof content === 'string') {\n return getHTMLCustomComponents(content);\n }\n\n let stringContent: any;\n\n if (typeof content === 'function') {\n stringContent = content();\n } else if (typeof (content as Promise<string>).then === 'function') {\n stringContent = async () =>\n getHTMLCustomComponents((await (content as Promise<string>)) as string);\n }\n\n if (typeof stringContent === 'string') {\n return getHTMLCustomComponents(stringContent);\n }\n\n try {\n return getHTMLCustomComponents(JSON.stringify(content));\n } catch (_e) {\n return [];\n }\n };\n\n return formatNodeType(MARKDOWN, content, {\n metadata,\n tags: getComponents(),\n });\n};\n\nexport { markdown as md };\n"],"mappings":";;;;;;;;;AA8BA,MAAM,eAAe,OAAO,YAAiB;CAC3C,IAAI,OAAO,YAAY,YAAY,OAAO,YAAY,UACpD,OAAO;CAGT,IAAI,OAAO,YAAY,YACrB,OAAO,QAAQ;CAEjB,IAAI,OAAO,QAAQ,SAAS,YAC1B,OAAO,MAAM;AAEjB;;;;;;;;;;;;;AAcA,MAAM,YAIJ,SACA,eACyC;CACzC,MAAM,WAAW,YAAY;EAG3B,MAAM,cAAcA,qDAAW,MAFF,aAAa,OAAO,GAEF;GAC7C,eAAe;GACf,SAAS,CAAC;EACZ,CAAC;EAED,IAAI,OAAO,gBAAgB,UAAU;GACnC,IAAI,QAAQ,IAAI,aAAa,cAAc;IACzC,MAAM,EAAE,WAAWC,8DAAiB,WAAW;IAC/C,KAAK,MAAM,SAAS,QAClB,IAAI,MAAM,SAAS,SACjB,QAAQ,MAAM,uBAAuB,MAAM,SAAS;SAEpD,QAAQ,KAAK,uBAAuB,MAAM,SAAS;GAGzD;GAEA,OAAOC,oEAAoB,WAAW;EACxC;CACF;CAEA,MAAM,sBAAsB;EAC1B,IAAI,YACF,OAAO;EAGT,IAAI,OAAO,YAAY,UACrB,OAAOC,wEAAwB,OAAO;EAGxC,IAAI;EAEJ,IAAI,OAAO,YAAY,YACrB,gBAAgB,QAAQ;OACnB,IAAI,OAAQ,QAA4B,SAAS,YACtD,gBAAgB,YACdA,wEAAyB,MAAO,OAAsC;EAG1E,IAAI,OAAO,kBAAkB,UAC3B,OAAOA,wEAAwB,aAAa;EAG9C,IAAI;GACF,OAAOA,wEAAwB,KAAK,UAAU,OAAO,CAAC;EACxD,SAAS,IAAI;GACX,OAAO,CAAC;EACV;CACF;CAEA,oDAAsBC,mCAAU,SAAS;EACvC;EACA,MAAM,cAAc;CACtB,CAAC;AACH"}
1
+ {"version":3,"file":"markdown.cjs","names":["getContent","validateMarkdown","getMarkdownMetadata","getHTMLCustomComponents","MARKDOWN"],"sources":["../../../../src/transpiler/markdown/markdown.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, MARKDOWN } from '@intlayer/types/nodeType';\nimport { getContent } from '../../interpreter/getContent/getContent';\nimport { getHTMLCustomComponents } from '../html/getHTMLCustomComponents';\nimport { getMarkdownMetadata } from './getMarkdownMetadata';\nimport { validateMarkdown } from './validateMarkdown';\n\ntype PropsType = 'number' | 'string' | 'node';\n\ntype ComponentName = string;\n\nexport type MarkdownContentConstructor<\n T extends Record<string, any> = {},\n Content = unknown,\n> = TypedNodeModel<typeof MARKDOWN, Content, T>;\n\nexport type MarkdownContent<\n Content = unknown,\n Components extends Record<ComponentName, PropsType> = Record<\n ComponentName,\n PropsType\n >,\n> = MarkdownContentConstructor<\n {\n metadata?: Record<string, any>;\n tags?: string[] | Components;\n },\n Content\n>;\n\nconst awaitContent = async (content: any) => {\n if (typeof content === 'string' || typeof content === 'object') {\n return content as any;\n }\n\n if (typeof content === 'function') {\n return content();\n }\n if (typeof content.then === 'function') {\n return await content;\n }\n};\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * markdown('## Hello world!');\n * ```\n *\n */\nconst markdown = <\n Components extends Record<string, any> = Record<string, any>,\n Content = unknown,\n>(\n content: Content,\n components?: Components\n): MarkdownContent<Content, Components> => {\n const metadata = async () => {\n const awaitedContent = await awaitContent(content);\n\n const flatContent = getContent(awaitedContent, {\n dictionaryKey: '',\n keyPath: [],\n });\n\n if (typeof flatContent === 'string') {\n if (process.env.NODE_ENV !== 'production') {\n const { issues } = validateMarkdown(flatContent);\n for (const issue of issues) {\n if (issue.type === 'error') {\n console.error(`[intlayer/markdown] ${issue.message}`);\n } else {\n console.warn(`[intlayer/markdown] ${issue.message}`);\n }\n }\n }\n\n return getMarkdownMetadata(flatContent);\n }\n };\n\n const getComponents = () => {\n if (components) {\n return components;\n }\n\n if (typeof content === 'string') {\n return getHTMLCustomComponents(content);\n }\n\n let stringContent: any;\n\n if (typeof content === 'function') {\n stringContent = content();\n } else if (typeof (content as Promise<string>).then === 'function') {\n stringContent = async () =>\n getHTMLCustomComponents((await (content as Promise<string>)) as string);\n }\n\n if (typeof stringContent === 'string') {\n return getHTMLCustomComponents(stringContent);\n }\n\n try {\n return getHTMLCustomComponents(JSON.stringify(content));\n } catch (_e) {\n return [];\n }\n };\n\n return formatNodeType(MARKDOWN, content, {\n metadata,\n tags: getComponents(),\n });\n};\n\nexport { markdown as md };\n"],"mappings":";;;;;;;;AA8BA,MAAM,eAAe,OAAO,YAAiB;CAC3C,IAAI,OAAO,YAAY,YAAY,OAAO,YAAY,UACpD,OAAO;CAGT,IAAI,OAAO,YAAY,YACrB,OAAO,QAAQ;CAEjB,IAAI,OAAO,QAAQ,SAAS,YAC1B,OAAO,MAAM;AAEjB;;;;;;;;;;;;;AAcA,MAAM,YAIJ,SACA,eACyC;CACzC,MAAM,WAAW,YAAY;EAG3B,MAAM,cAAcA,qDAAW,MAFF,aAAa,OAAO,GAEF;GAC7C,eAAe;GACf,SAAS,CAAC;EACZ,CAAC;EAED,IAAI,OAAO,gBAAgB,UAAU;GACnC,IAAI,QAAQ,IAAI,aAAa,cAAc;IACzC,MAAM,EAAE,WAAWC,8DAAiB,WAAW;IAC/C,KAAK,MAAM,SAAS,QAClB,IAAI,MAAM,SAAS,SACjB,QAAQ,MAAM,uBAAuB,MAAM,SAAS;SAEpD,QAAQ,KAAK,uBAAuB,MAAM,SAAS;GAGzD;GAEA,OAAOC,oEAAoB,WAAW;EACxC;CACF;CAEA,MAAM,sBAAsB;EAC1B,IAAI,YACF,OAAO;EAGT,IAAI,OAAO,YAAY,UACrB,OAAOC,wEAAwB,OAAO;EAGxC,IAAI;EAEJ,IAAI,OAAO,YAAY,YACrB,gBAAgB,QAAQ;OACnB,IAAI,OAAQ,QAA4B,SAAS,YACtD,gBAAgB,YACdA,wEAAyB,MAAO,OAAsC;EAG1E,IAAI,OAAO,kBAAkB,UAC3B,OAAOA,wEAAwB,aAAa;EAG9C,IAAI;GACF,OAAOA,wEAAwB,KAAK,UAAU,OAAO,CAAC;EACxD,SAAS,IAAI;GACX,OAAO,CAAC;EACV;CACF;CAEA,oDAAsBC,mCAAU,SAAS;EACvC;EACA,MAAM,cAAc;CACtB,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/nesting/nesting.ts
@@ -1 +1 @@
1
- {"version":3,"file":"nesting.cjs","names":["NESTED"],"sources":["../../../../src/transpiler/nesting/nesting.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n DictionaryRegistryContent,\n} from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, NESTED } from '@intlayer/types/nodeType';\n\nimport type { DeepTransformContent } from '../../interpreter';\n\n/**\n * Recursively builds dot-notation strings for all valid paths in T.\n * Example:\n * type X = { a: { b: { c: string }}, d: number };\n * DotPath<X> = \"a\" | \"a.b\" | \"a.b.c\" | \"d\"\n */\nexport type DotPath<T> = T extends object\n ? {\n [K in keyof T & (string | number)]: T[K] extends object\n ? // Either just K, or K + '.' + deeper path\n `${K}` | `${K}.${DotPath<T[K]>}`\n : `${K}`;\n }[keyof T & (string | number)]\n : never;\n\ntype DeepReplace<T, From, To> = T extends From\n ? To\n : T extends object\n ? { [K in keyof T]: DeepReplace<T[K], From, To> }\n : T;\n\n/** Build all valid dot-notation strings for a dictionary entry. */\nexport type ValidDotPathsFor<K extends DictionaryKeys> = DotPath<\n DeepReplace<\n DeepTransformContent<DictionaryRegistryContent<K>>,\n // Replace ReactElement type with string\n {\n type: any;\n props: any;\n key: any;\n },\n string\n >\n>;\n\nexport type NestedContentState<K extends DictionaryKeys> = {\n dictionaryKey: K;\n\n /**\n * Path must match existing keys in DictionaryRegistryContent<K>.\n * Can be either:\n * - \"dot.dot.dot\" format\n */\n path?: ValidDotPathsFor<K>;\n};\n\nexport type NestedContent<K extends DictionaryKeys = never> = TypedNodeModel<\n typeof NESTED,\n NestedContentState<K>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to extract the content of another dictionary and nest it in the current dictionary.\n *\n * Usage:\n *\n * ```ts\n * nest(\"dictionaryKey\");\n * nest(\"dictionaryKey\", \"path.to.content\");\n * ```\n *\n * The order of the keys will define the priority of the content.\n *\n */\nconst nesting = <K extends DictionaryKeys>(\n dictionaryKey: K,\n path?: ValidDotPathsFor<K>\n): NestedContent<K> =>\n formatNodeType(NESTED, {\n dictionaryKey,\n path,\n });\n\nexport { nesting as nest };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2EA,MAAM,WACJ,eACA,sDAEeA,iCAAQ;CACrB;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"nesting.cjs","names":["NESTED"],"sources":["../../../../src/transpiler/nesting/nesting.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n DictionaryRegistryContent,\n} from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, NESTED } from '@intlayer/types/nodeType';\n\nimport type { DeepTransformContent } from '../../interpreter';\n\n/**\n * Recursively builds dot-notation strings for all valid paths in T.\n * Example:\n * type X = { a: { b: { c: string }}, d: number };\n * DotPath<X> = \"a\" | \"a.b\" | \"a.b.c\" | \"d\"\n */\nexport type DotPath<T> = T extends object\n ? {\n [K in keyof T & (string | number)]: T[K] extends object\n ? // Either just K, or K + '.' + deeper path\n `${K}` | `${K}.${DotPath<T[K]>}`\n : `${K}`;\n }[keyof T & (string | number)]\n : never;\n\ntype DeepReplace<T, From, To> = T extends From\n ? To\n : T extends object\n ? { [K in keyof T]: DeepReplace<T[K], From, To> }\n : T;\n\n/** Build all valid dot-notation strings for a dictionary entry. */\nexport type ValidDotPathsFor<K extends DictionaryKeys> = DotPath<\n DeepReplace<\n DeepTransformContent<DictionaryRegistryContent<K>>,\n // Replace ReactElement type with string\n {\n type: any;\n props: any;\n key: any;\n },\n string\n >\n>;\n\nexport type NestedContentState<K extends DictionaryKeys> = {\n dictionaryKey: K;\n\n /**\n * Path must match existing keys in DictionaryRegistryContent<K>.\n * Can be either:\n * - \"dot.dot.dot\" format\n */\n path?: ValidDotPathsFor<K>;\n};\n\nexport type NestedContent<K extends DictionaryKeys = never> = TypedNodeModel<\n typeof NESTED,\n NestedContentState<K>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to extract the content of another dictionary and nest it in the current dictionary.\n *\n * Usage:\n *\n * ```ts\n * nest(\"dictionaryKey\");\n * nest(\"dictionaryKey\", \"path.to.content\");\n * ```\n *\n * The order of the keys will define the priority of the content.\n *\n */\nconst nesting = <K extends DictionaryKeys>(\n dictionaryKey: K,\n path?: ValidDotPathsFor<K>\n): NestedContent<K> =>\n formatNodeType(NESTED, {\n dictionaryKey,\n path,\n });\n\nexport { nesting as nest };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2EA,MAAM,WACJ,eACA,sDAEeA,iCAAQ;CACrB;CACA;AACF,CAAC"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/plural/plural.ts
@@ -1 +1 @@
1
- {"version":3,"file":"plural.cjs","names":["PLURAL"],"sources":["../../../../src/transpiler/plural/plural.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, PLURAL } from '@intlayer/types/nodeType';\n\nexport type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\n\nexport type PluralContentState<Content> = Partial<\n Record<PluralCategory, Content>\n> & {\n other: Content;\n};\n\nexport type PluralContent<Content = unknown> = TypedNodeModel<\n typeof PLURAL,\n PluralContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity using CLDR pluralization rules\n * (`Intl.PluralRules`). The selected category depends on the active locale.\n *\n * Supported categories: `zero`, `one`, `two`, `few`, `many`, `other`.\n * `other` is required as the fallback.\n *\n * The string content can include a `{{count}}` placeholder, which is\n * automatically replaced with the provided count.\n *\n * Usage:\n *\n * ```ts\n * plural({\n * one: '{{count}} вакансия',\n * few: '{{count}} вакансии',\n * many: '{{count}} вакансий',\n * other: '{{count}} вакансий',\n * });\n * ```\n */\nconst plural = <Content = unknown>(\n content: PluralContentState<Content>\n): PluralContent<Content> => formatNodeType(PLURAL, content);\n\nexport { plural };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,UACJ,yDAC0CA,iCAAQ,OAAO"}
1
+ {"version":3,"file":"plural.cjs","names":["PLURAL"],"sources":["../../../../src/transpiler/plural/plural.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, PLURAL } from '@intlayer/types/nodeType';\n\nexport type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\n\nexport type PluralContentState<Content> = Partial<\n Record<PluralCategory, Content>\n> & {\n other: Content;\n};\n\nexport type PluralContent<Content = unknown> = TypedNodeModel<\n typeof PLURAL,\n PluralContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity using CLDR pluralization rules\n * (`Intl.PluralRules`). The selected category depends on the active locale.\n *\n * Supported categories: `zero`, `one`, `two`, `few`, `many`, `other`.\n * `other` is required as the fallback.\n *\n * The string content can include a `{{count}}` placeholder, which is\n * automatically replaced with the provided count.\n *\n * Usage:\n *\n * ```ts\n * plural({\n * one: '{{count}} вакансия',\n * few: '{{count}} вакансии',\n * many: '{{count}} вакансий',\n * other: '{{count}} вакансий',\n * });\n * ```\n */\nconst plural = <Content = unknown>(\n content: PluralContentState<Content>\n): PluralContent<Content> => formatNodeType(PLURAL, content);\n\nexport { plural };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,UACJ,yDAC0CA,iCAAQ,OAAO"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
4
3
 
5
4
  //#region src/transpiler/translation/translation.ts
@@ -1 +1 @@
1
- {"version":3,"file":"translation.cjs","names":["TRANSLATION"],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":["import type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, TRANSLATION } from '@intlayer/types/nodeType';\n\nexport type TranslationContent<\n Content = unknown,\n RecordContent extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n> = TypedNodeModel<typeof TRANSLATION, RecordContent>;\n\n/**\n *\n * Function intended to be used to build intlayer dictionaries.\n *\n * Get the content of a translation based on the locale.\n *\n * Usage:\n *\n * ```ts\n * translation<string>({\n * \"en\": \"Hello\",\n * \"fr\": \"Bonjour\",\n * // ... any other available locale\n * })\n * ```\n *\n * Using TypeScript:\n * - this function require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nconst translation = <\n Content = unknown,\n ContentRecord extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n>(\n content: ContentRecord\n): TranslationContent<Content, ContentRecord> =>\n formatNodeType(TRANSLATION, content) satisfies TranslationContent<\n Content,\n ContentRecord\n >;\n\nexport { translation as t };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,eAKJ,yDAEeA,sCAAa,OAAO"}
1
+ {"version":3,"file":"translation.cjs","names":["TRANSLATION"],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":["import type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, TRANSLATION } from '@intlayer/types/nodeType';\n\nexport type TranslationContent<\n Content = unknown,\n RecordContent extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n> = TypedNodeModel<typeof TRANSLATION, RecordContent>;\n\n/**\n *\n * Function intended to be used to build intlayer dictionaries.\n *\n * Get the content of a translation based on the locale.\n *\n * Usage:\n *\n * ```ts\n * translation<string>({\n * \"en\": \"Hello\",\n * \"fr\": \"Bonjour\",\n * // ... any other available locale\n * })\n * ```\n *\n * Using TypeScript:\n * - this function require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nconst translation = <\n Content = unknown,\n ContentRecord extends\n StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>,\n>(\n content: ContentRecord\n): TranslationContent<Content, ContentRecord> =>\n formatNodeType(TRANSLATION, content) satisfies TranslationContent<\n Content,\n ContentRecord\n >;\n\nexport { translation as t };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,eAKJ,yDAEeA,sCAAa,OAAO"}
@@ -22,6 +22,7 @@ exports.getLocaleFromStorageClient = require_utils_localeStorage.getLocaleFromSt
22
22
  exports.getLocaleFromStorageServer = require_utils_localeStorage.getLocaleFromStorageServer;
23
23
  exports.isSameKeyPath = require_utils_isSameKeyPath.isSameKeyPath;
24
24
  exports.isValidElement = require_utils_isValidReactElement.isValidElement;
25
+ exports.localeStorageOptions = require_utils_localeStorage.localeStorageOptions;
25
26
  exports.parseYaml = require_utils_parseYaml.parseYaml;
26
27
  exports.setLocaleInStorage = require_utils_localeStorage.setLocaleInStorage;
27
28
  exports.setLocaleInStorageClient = require_utils_localeStorage.setLocaleInStorageClient;
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_config_built = require("@intlayer/config/built");
4
3
 
5
4
  //#region src/utils/intl.ts
@@ -1 +1 @@
1
- {"version":3,"file":"intl.cjs","names":["internationalization"],"sources":["../../../src/utils/intl.ts"],"sourcesContent":["/**\n * Cached Intl helper – drop‑in replacement for the global `Intl` object.\n * ‑‑‑\n * • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).\n * • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests\n * reuse the same heavy instance instead of reparsing CLDR data every time.\n * • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.\n * • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –\n * you can treat `CachedIntl` just like the built‑in `Intl`.\n *\n * Usage @example:\n * ---------------\n * ```ts\n * import { CachedIntl } from \"./cached-intl\";\n *\n * const nf = CachedIntl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n * console.log(nf.format(1234));\n *\n * const dn = CachedIntl.DisplayNames([\"fr\"], { type: \"language\" });\n * console.log(dn.of(\"en\")); * → \"anglais\"\n *\n * You can also spin up an isolated instance with its own caches (handy in test suites):\n * const TestIntl = createCachedIntl();\n * ```\n */\n\nimport { internationalization } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nconst MAX_CACHE_SIZE = 50;\nconst cache = new Map<any, Map<string, any>>();\n\ntype IntlConstructors = {\n [K in keyof typeof Intl as (typeof Intl)[K] extends new (\n ...args: any\n ) => any\n ? K\n : never]: (typeof Intl)[K];\n};\n\ntype ReplaceLocaleWithLocalesValues<T> = T extends new (\n locales: any,\n options?: infer Options\n) => infer Instance\n ? {\n new (locales?: LocalesValues, options?: Options): Instance;\n new (options?: Options & { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues, options?: Options): Instance;\n (options?: Options & { locale?: LocalesValues }): Instance;\n }\n : T extends new (\n locales: any\n ) => infer Instance\n ? {\n new (locales?: LocalesValues): Instance;\n new (options?: { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues): Instance;\n (options?: { locale?: LocalesValues }): Instance;\n }\n : T;\n\nexport type WrappedIntl = {\n [K in keyof typeof Intl]: K extends keyof IntlConstructors\n ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]>\n : (typeof Intl)[K];\n};\n\n/**\n * Generic caching instantiator for Intl constructors.\n */\nexport const getCachedIntl = <T extends new (...args: any[]) => any>(\n Ctor: T,\n locale?: LocalesValues | string,\n options?: any\n): InstanceType<T> => {\n const resLoc = locale ?? internationalization?.defaultLocale;\n\n const optKey = options ? JSON.stringify(options) : '';\n const key = `${resLoc}|${optKey}`;\n\n let ctorCache = cache.get(Ctor);\n\n if (!ctorCache) {\n ctorCache = new Map();\n cache.set(Ctor, ctorCache);\n }\n\n let instance = ctorCache.get(key);\n\n if (!instance) {\n if (ctorCache.size > MAX_CACHE_SIZE) ctorCache.clear();\n instance = new Ctor(resLoc, options);\n ctorCache.set(key, instance);\n }\n return instance;\n};\n\n/**\n * Optional: Keep bindIntl if your library exports it publicly.\n * It now uses the much smaller getCachedIntl under the hood.\n */\nexport const bindIntl = (boundLocale: LocalesValues): WrappedIntl => {\n const bindWrap = (Ctor: any) =>\n // function is used as a constructor, do not change in arrow function\n function intlConstructor(locales?: any, options?: any) {\n const isOptsFirst =\n locales !== null &&\n typeof locales === 'object' &&\n !Array.isArray(locales);\n const resOpts = isOptsFirst ? locales : options;\n const resLoc = isOptsFirst\n ? (resOpts as any).locale || boundLocale\n : locales || boundLocale;\n\n return getCachedIntl(Ctor, resLoc, resOpts);\n };\n\n return {\n ...Intl,\n Collator: bindWrap(Intl.Collator),\n DateTimeFormat: bindWrap(Intl.DateTimeFormat),\n DisplayNames: bindWrap(Intl.DisplayNames),\n ListFormat: bindWrap(Intl.ListFormat),\n NumberFormat: bindWrap(Intl.NumberFormat),\n PluralRules: bindWrap(Intl.PluralRules),\n RelativeTimeFormat: bindWrap(Intl.RelativeTimeFormat),\n Locale: bindWrap(Intl.Locale),\n Segmenter: bindWrap((Intl as any).Segmenter),\n } as unknown as WrappedIntl;\n};\n\n// Add this to the bottom of utils/intl.ts ONLY if required for public API compatibility.\nexport const CachedIntl = {\n // function is used as a constructor, do not change in arrow function\n Collator: function Collator(locales?: any, options?: any) {\n return getCachedIntl(Intl.Collator, locales, options);\n },\n DateTimeFormat: function DateTimeFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.DateTimeFormat, locales, options);\n },\n DisplayNames: function DisplayNames(locales?: any, options?: any) {\n return getCachedIntl(Intl.DisplayNames, locales, options);\n },\n ListFormat: function ListFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.ListFormat as any, locales, options);\n },\n NumberFormat: function NumberFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.NumberFormat, locales, options);\n },\n PluralRules: function PluralRules(locales?: any, options?: any) {\n return getCachedIntl(Intl.PluralRules, locales, options);\n },\n RelativeTimeFormat: function RelativeTimeFormat(\n locales?: any,\n options?: any\n ) {\n return getCachedIntl(Intl.RelativeTimeFormat, locales, options);\n },\n Segmenter: function Segmenter(locales?: any, options?: any) {\n return getCachedIntl((Intl as any).Segmenter, locales, options);\n },\n} as any; // Cast to 'any' internally to avoid TS readonly errors\n\nexport { CachedIntl as Intl };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,iBAAiB;AACvB,MAAM,wBAAQ,IAAI,IAA2B;;;;AAwC7C,MAAa,iBACX,MACA,QACA,YACoB;CACpB,MAAM,SAAS,UAAUA,6CAAsB;CAG/C,MAAM,MAAM,GAAG,OAAO,GADP,UAAU,KAAK,UAAU,OAAO,IAAI;CAGnD,IAAI,YAAY,MAAM,IAAI,IAAI;CAE9B,IAAI,CAAC,WAAW;EACd,4BAAY,IAAI,IAAI;EACpB,MAAM,IAAI,MAAM,SAAS;CAC3B;CAEA,IAAI,WAAW,UAAU,IAAI,GAAG;CAEhC,IAAI,CAAC,UAAU;EACb,IAAI,UAAU,OAAO,gBAAgB,UAAU,MAAM;EACrD,WAAW,IAAI,KAAK,QAAQ,OAAO;EACnC,UAAU,IAAI,KAAK,QAAQ;CAC7B;CACA,OAAO;AACT;;;;;AAMA,MAAa,YAAY,gBAA4C;CACnE,MAAM,YAAY,SAEhB,SAAS,gBAAgB,SAAe,SAAe;EACrD,MAAM,cACJ,YAAY,QACZ,OAAO,YAAY,YACnB,CAAC,MAAM,QAAQ,OAAO;EACxB,MAAM,UAAU,cAAc,UAAU;EAKxC,OAAO,cAAc,MAJN,cACV,QAAgB,UAAU,cAC3B,WAAW,aAEoB,OAAO;CAC5C;CAEF,OAAO;EACL,GAAG;EACH,UAAU,SAAS,KAAK,QAAQ;EAChC,gBAAgB,SAAS,KAAK,cAAc;EAC5C,cAAc,SAAS,KAAK,YAAY;EACxC,YAAY,SAAS,KAAK,UAAU;EACpC,cAAc,SAAS,KAAK,YAAY;EACxC,aAAa,SAAS,KAAK,WAAW;EACtC,oBAAoB,SAAS,KAAK,kBAAkB;EACpD,QAAQ,SAAS,KAAK,MAAM;EAC5B,WAAW,SAAU,KAAa,SAAS;CAC7C;AACF;AAGA,MAAa,aAAa;CAExB,UAAU,SAAS,SAAS,SAAe,SAAe;EACxD,OAAO,cAAc,KAAK,UAAU,SAAS,OAAO;CACtD;CACA,gBAAgB,SAAS,eAAe,SAAe,SAAe;EACpE,OAAO,cAAc,KAAK,gBAAgB,SAAS,OAAO;CAC5D;CACA,cAAc,SAAS,aAAa,SAAe,SAAe;EAChE,OAAO,cAAc,KAAK,cAAc,SAAS,OAAO;CAC1D;CACA,YAAY,SAAS,WAAW,SAAe,SAAe;EAC5D,OAAO,cAAc,KAAK,YAAmB,SAAS,OAAO;CAC/D;CACA,cAAc,SAAS,aAAa,SAAe,SAAe;EAChE,OAAO,cAAc,KAAK,cAAc,SAAS,OAAO;CAC1D;CACA,aAAa,SAAS,YAAY,SAAe,SAAe;EAC9D,OAAO,cAAc,KAAK,aAAa,SAAS,OAAO;CACzD;CACA,oBAAoB,SAAS,mBAC3B,SACA,SACA;EACA,OAAO,cAAc,KAAK,oBAAoB,SAAS,OAAO;CAChE;CACA,WAAW,SAAS,UAAU,SAAe,SAAe;EAC1D,OAAO,cAAe,KAAa,WAAW,SAAS,OAAO;CAChE;AACF"}
1
+ {"version":3,"file":"intl.cjs","names":["internationalization"],"sources":["../../../src/utils/intl.ts"],"sourcesContent":["/**\n * Cached Intl helper – drop‑in replacement for the global `Intl` object.\n * ‑‑‑\n * • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).\n * • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests\n * reuse the same heavy instance instead of reparsing CLDR data every time.\n * • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.\n * • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –\n * you can treat `CachedIntl` just like the built‑in `Intl`.\n *\n * Usage @example:\n * ---------------\n * ```ts\n * import { CachedIntl } from \"./cached-intl\";\n *\n * const nf = CachedIntl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n * console.log(nf.format(1234));\n *\n * const dn = CachedIntl.DisplayNames([\"fr\"], { type: \"language\" });\n * console.log(dn.of(\"en\")); * → \"anglais\"\n *\n * You can also spin up an isolated instance with its own caches (handy in test suites):\n * const TestIntl = createCachedIntl();\n * ```\n */\n\nimport { internationalization } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nconst MAX_CACHE_SIZE = 50;\nconst cache = new Map<any, Map<string, any>>();\n\ntype IntlConstructors = {\n [K in keyof typeof Intl as (typeof Intl)[K] extends new (\n ...args: any\n ) => any\n ? K\n : never]: (typeof Intl)[K];\n};\n\ntype ReplaceLocaleWithLocalesValues<T> = T extends new (\n locales: any,\n options?: infer Options\n) => infer Instance\n ? {\n new (locales?: LocalesValues, options?: Options): Instance;\n new (options?: Options & { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues, options?: Options): Instance;\n (options?: Options & { locale?: LocalesValues }): Instance;\n }\n : T extends new (\n locales: any\n ) => infer Instance\n ? {\n new (locales?: LocalesValues): Instance;\n new (options?: { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues): Instance;\n (options?: { locale?: LocalesValues }): Instance;\n }\n : T;\n\nexport type WrappedIntl = {\n [K in keyof typeof Intl]: K extends keyof IntlConstructors\n ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]>\n : (typeof Intl)[K];\n};\n\n/**\n * Generic caching instantiator for Intl constructors.\n */\nexport const getCachedIntl = <T extends new (...args: any[]) => any>(\n Ctor: T,\n locale?: LocalesValues | string,\n options?: any\n): InstanceType<T> => {\n const resLoc = locale ?? internationalization?.defaultLocale;\n\n const optKey = options ? JSON.stringify(options) : '';\n const key = `${resLoc}|${optKey}`;\n\n let ctorCache = cache.get(Ctor);\n\n if (!ctorCache) {\n ctorCache = new Map();\n cache.set(Ctor, ctorCache);\n }\n\n let instance = ctorCache.get(key);\n\n if (!instance) {\n if (ctorCache.size > MAX_CACHE_SIZE) ctorCache.clear();\n instance = new Ctor(resLoc, options);\n ctorCache.set(key, instance);\n }\n return instance;\n};\n\n/**\n * Optional: Keep bindIntl if your library exports it publicly.\n * It now uses the much smaller getCachedIntl under the hood.\n */\nexport const bindIntl = (boundLocale: LocalesValues): WrappedIntl => {\n const bindWrap = (Ctor: any) =>\n // function is used as a constructor, do not change in arrow function\n function intlConstructor(locales?: any, options?: any) {\n const isOptsFirst =\n locales !== null &&\n typeof locales === 'object' &&\n !Array.isArray(locales);\n const resOpts = isOptsFirst ? locales : options;\n const resLoc = isOptsFirst\n ? (resOpts as any).locale || boundLocale\n : locales || boundLocale;\n\n return getCachedIntl(Ctor, resLoc, resOpts);\n };\n\n return {\n ...Intl,\n Collator: bindWrap(Intl.Collator),\n DateTimeFormat: bindWrap(Intl.DateTimeFormat),\n DisplayNames: bindWrap(Intl.DisplayNames),\n ListFormat: bindWrap(Intl.ListFormat),\n NumberFormat: bindWrap(Intl.NumberFormat),\n PluralRules: bindWrap(Intl.PluralRules),\n RelativeTimeFormat: bindWrap(Intl.RelativeTimeFormat),\n Locale: bindWrap(Intl.Locale),\n Segmenter: bindWrap((Intl as any).Segmenter),\n } as unknown as WrappedIntl;\n};\n\n// Add this to the bottom of utils/intl.ts ONLY if required for public API compatibility.\nexport const CachedIntl = {\n // function is used as a constructor, do not change in arrow function\n Collator: function Collator(locales?: any, options?: any) {\n return getCachedIntl(Intl.Collator, locales, options);\n },\n DateTimeFormat: function DateTimeFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.DateTimeFormat, locales, options);\n },\n DisplayNames: function DisplayNames(locales?: any, options?: any) {\n return getCachedIntl(Intl.DisplayNames, locales, options);\n },\n ListFormat: function ListFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.ListFormat as any, locales, options);\n },\n NumberFormat: function NumberFormat(locales?: any, options?: any) {\n return getCachedIntl(Intl.NumberFormat, locales, options);\n },\n PluralRules: function PluralRules(locales?: any, options?: any) {\n return getCachedIntl(Intl.PluralRules, locales, options);\n },\n RelativeTimeFormat: function RelativeTimeFormat(\n locales?: any,\n options?: any\n ) {\n return getCachedIntl(Intl.RelativeTimeFormat, locales, options);\n },\n Segmenter: function Segmenter(locales?: any, options?: any) {\n return getCachedIntl((Intl as any).Segmenter, locales, options);\n },\n} as any; // Cast to 'any' internally to avoid TS readonly errors\n\nexport { CachedIntl as Intl };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,iBAAiB;AACvB,MAAM,wBAAQ,IAAI,IAA2B;;;;AAwC7C,MAAa,iBACX,MACA,QACA,YACoB;CACpB,MAAM,SAAS,UAAUA,6CAAsB;CAG/C,MAAM,MAAM,GAAG,OAAO,GADP,UAAU,KAAK,UAAU,OAAO,IAAI;CAGnD,IAAI,YAAY,MAAM,IAAI,IAAI;CAE9B,IAAI,CAAC,WAAW;EACd,4BAAY,IAAI,IAAI;EACpB,MAAM,IAAI,MAAM,SAAS;CAC3B;CAEA,IAAI,WAAW,UAAU,IAAI,GAAG;CAEhC,IAAI,CAAC,UAAU;EACb,IAAI,UAAU,OAAO,gBAAgB,UAAU,MAAM;EACrD,WAAW,IAAI,KAAK,QAAQ,OAAO;EACnC,UAAU,IAAI,KAAK,QAAQ;CAC7B;CACA,OAAO;AACT;;;;;AAMA,MAAa,YAAY,gBAA4C;CACnE,MAAM,YAAY,SAEhB,SAAS,gBAAgB,SAAe,SAAe;EACrD,MAAM,cACJ,YAAY,QACZ,OAAO,YAAY,YACnB,CAAC,MAAM,QAAQ,OAAO;EACxB,MAAM,UAAU,cAAc,UAAU;EAKxC,OAAO,cAAc,MAJN,cACV,QAAgB,UAAU,cAC3B,WAAW,aAEoB,OAAO;CAC5C;CAEF,OAAO;EACL,GAAG;EACH,UAAU,SAAS,KAAK,QAAQ;EAChC,gBAAgB,SAAS,KAAK,cAAc;EAC5C,cAAc,SAAS,KAAK,YAAY;EACx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