@intlayer/design-system 6.1.2 → 6.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/.vite/manifest.json +62 -7
  2. package/dist/better-auth.CiuwFiHM-7umXOENE.js.map +1 -1
  3. package/dist/better-auth.CiuwFiHM-C2nBKRMa.cjs.map +1 -1
  4. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +2 -2
  5. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
  6. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +1 -1
  7. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs +2 -1
  8. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs.map +1 -1
  9. package/dist/components/ExpandCollapse/expandCollapse.content.cjs +2 -1
  10. package/dist/components/ExpandCollapse/expandCollapse.content.cjs.map +1 -1
  11. package/dist/components/Headers/index.cjs +12 -0
  12. package/dist/components/Headers/index.cjs.map +1 -1
  13. package/dist/components/Headers/index.d.ts +1 -0
  14. package/dist/components/Headers/index.d.ts.map +1 -1
  15. package/dist/components/Headers/index.mjs +13 -1
  16. package/dist/components/Headers/index.mjs.map +1 -1
  17. package/dist/components/IDE/Code.cjs +1 -1
  18. package/dist/components/IDE/Code.cjs.map +1 -1
  19. package/dist/components/IDE/Code.mjs +1 -1
  20. package/dist/components/IDE/Code.mjs.map +1 -1
  21. package/dist/components/IDE/code.content.cjs +2 -1
  22. package/dist/components/IDE/code.content.cjs.map +1 -1
  23. package/dist/components/IDE/copyCode.content.cjs +2 -1
  24. package/dist/components/IDE/copyCode.content.cjs.map +1 -1
  25. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs +2 -1
  26. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs.map +1 -1
  27. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs +2 -1
  28. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs.map +1 -1
  29. package/dist/components/MarkDownRender/MarkDownRender.cjs +188 -0
  30. package/dist/components/MarkDownRender/MarkDownRender.cjs.map +1 -0
  31. package/dist/components/MarkDownRender/MarkDownRender.d.ts +12 -0
  32. package/dist/components/MarkDownRender/MarkDownRender.d.ts.map +1 -0
  33. package/dist/components/MarkDownRender/MarkDownRender.mjs +188 -0
  34. package/dist/components/MarkDownRender/MarkDownRender.mjs.map +1 -0
  35. package/dist/components/MarkDownRender/index.cjs +2 -150
  36. package/dist/components/MarkDownRender/index.cjs.map +1 -1
  37. package/dist/components/MarkDownRender/index.d.ts +1 -11
  38. package/dist/components/MarkDownRender/index.d.ts.map +1 -1
  39. package/dist/components/MarkDownRender/index.mjs +1 -149
  40. package/dist/components/MarkDownRender/index.mjs.map +1 -1
  41. package/dist/components/MarkDownRender/processer.cjs +1619 -0
  42. package/dist/components/MarkDownRender/processer.cjs.map +1 -0
  43. package/dist/components/MarkDownRender/processer.d.ts +368 -0
  44. package/dist/components/MarkDownRender/processer.d.ts.map +1 -0
  45. package/dist/components/MarkDownRender/processer.mjs +1619 -0
  46. package/dist/components/MarkDownRender/processer.mjs.map +1 -0
  47. package/dist/components/Tab/Tab.cjs +171 -0
  48. package/dist/components/Tab/Tab.cjs.map +1 -0
  49. package/dist/components/Tab/Tab.d.ts +24 -0
  50. package/dist/components/Tab/Tab.d.ts.map +1 -0
  51. package/dist/components/Tab/Tab.mjs +171 -0
  52. package/dist/components/Tab/Tab.mjs.map +1 -0
  53. package/dist/components/Tab/TabContext.cjs +28 -0
  54. package/dist/components/Tab/TabContext.cjs.map +1 -0
  55. package/dist/components/Tab/TabContext.d.ts +19 -0
  56. package/dist/components/Tab/TabContext.d.ts.map +1 -0
  57. package/dist/components/Tab/TabContext.mjs +28 -0
  58. package/dist/components/Tab/TabContext.mjs.map +1 -0
  59. package/dist/components/Tab/index.cjs +5 -0
  60. package/dist/components/Tab/index.cjs.map +1 -0
  61. package/dist/components/Tab/index.d.ts +2 -0
  62. package/dist/components/Tab/index.d.ts.map +1 -0
  63. package/dist/components/Tab/index.mjs +5 -0
  64. package/dist/components/Tab/index.mjs.map +1 -0
  65. package/dist/components/TabSelector/TabSelector.cjs +6 -1
  66. package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
  67. package/dist/components/TabSelector/TabSelector.d.ts +1 -1
  68. package/dist/components/TabSelector/TabSelector.d.ts.map +1 -1
  69. package/dist/components/TabSelector/TabSelector.mjs +6 -1
  70. package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
  71. package/dist/components/Table/Table.cjs +15 -8
  72. package/dist/components/Table/Table.cjs.map +1 -1
  73. package/dist/components/Table/Table.d.ts.map +1 -1
  74. package/dist/components/Table/Table.mjs +15 -8
  75. package/dist/components/Table/Table.mjs.map +1 -1
  76. package/dist/components/Table/table.content.cjs +2 -1
  77. package/dist/components/Table/table.content.cjs.map +1 -1
  78. package/dist/components/index.cjs +5 -2
  79. package/dist/components/index.cjs.map +1 -1
  80. package/dist/components/index.d.ts +1 -0
  81. package/dist/components/index.d.ts.map +1 -1
  82. package/dist/components/index.mjs +5 -2
  83. package/dist/components/index.mjs.map +1 -1
  84. package/dist/hooks/auth.cjs +7 -5
  85. package/dist/hooks/auth.cjs.map +1 -1
  86. package/dist/hooks/auth.mjs +7 -5
  87. package/dist/hooks/auth.mjs.map +1 -1
  88. package/dist/hooks/index.cjs +2 -0
  89. package/dist/hooks/index.cjs.map +1 -1
  90. package/dist/hooks/index.d.ts +1 -0
  91. package/dist/hooks/index.d.ts.map +1 -1
  92. package/dist/hooks/index.mjs +2 -0
  93. package/dist/hooks/index.mjs.map +1 -1
  94. package/dist/hooks/useHorizontalSwipe.cjs +144 -0
  95. package/dist/hooks/useHorizontalSwipe.cjs.map +1 -0
  96. package/dist/hooks/useHorizontalSwipe.d.ts +26 -0
  97. package/dist/hooks/useHorizontalSwipe.d.ts.map +1 -0
  98. package/dist/hooks/useHorizontalSwipe.mjs +144 -0
  99. package/dist/hooks/useHorizontalSwipe.mjs.map +1 -0
  100. package/package.json +43 -18
@@ -0,0 +1,1619 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { createElement, cloneElement } from "react";
3
+ var define_process_env_default = {};
4
+ const RuleType = {
5
+ blockQuote: "0",
6
+ breakLine: "1",
7
+ breakThematic: "2",
8
+ codeBlock: "3",
9
+ codeFenced: "4",
10
+ codeInline: "5",
11
+ footnote: "6",
12
+ footnoteReference: "7",
13
+ gfmTask: "8",
14
+ heading: "9",
15
+ headingSetext: "10",
16
+ /** only available if not `disableHTMLParsing` */
17
+ htmlBlock: "11",
18
+ htmlComment: "12",
19
+ /** only available if not `disableHTMLParsing` */
20
+ htmlSelfClosing: "13",
21
+ /** Custom components like <Tabs>, <TabItem> */
22
+ customComponent: "34",
23
+ image: "14",
24
+ link: "15",
25
+ /** emits a `link` 'node', does not render directly */
26
+ linkAngleBraceStyleDetector: "16",
27
+ /** emits a `link` 'node', does not render directly */
28
+ linkBareUrlDetector: "17",
29
+ /** emits a `link` 'node', does not render directly */
30
+ linkMailtoDetector: "18",
31
+ newlineCoalescer: "19",
32
+ orderedList: "20",
33
+ paragraph: "21",
34
+ ref: "22",
35
+ refImage: "23",
36
+ refLink: "24",
37
+ table: "25",
38
+ tableSeparator: "26",
39
+ text: "27",
40
+ textBolded: "28",
41
+ textEmphasized: "29",
42
+ textEscaped: "30",
43
+ textMarked: "31",
44
+ textStrikethroughed: "32",
45
+ unorderedList: "33"
46
+ };
47
+ if (define_process_env_default.NODE_ENV === "test") {
48
+ Object.keys(RuleType).forEach((key) => RuleType[key] = key);
49
+ }
50
+ const Priority = {
51
+ /**
52
+ * anything that must scan the tree before everything else
53
+ */
54
+ MAX: 0,
55
+ /**
56
+ * scans for block-level constructs
57
+ */
58
+ HIGH: 1,
59
+ /**
60
+ * inline w/ more priority than other inline
61
+ */
62
+ MED: 2,
63
+ /**
64
+ * inline elements
65
+ */
66
+ LOW: 3,
67
+ /**
68
+ * bare text and stuff that is considered leftovers
69
+ */
70
+ MIN: 4
71
+ };
72
+ const ATTRIBUTE_TO_JSX_PROP_MAP = [
73
+ "allowFullScreen",
74
+ "allowTransparency",
75
+ "autoComplete",
76
+ "autoFocus",
77
+ "autoPlay",
78
+ "cellPadding",
79
+ "cellSpacing",
80
+ "charSet",
81
+ "classId",
82
+ "colSpan",
83
+ "contentEditable",
84
+ "contextMenu",
85
+ "crossOrigin",
86
+ "encType",
87
+ "formAction",
88
+ "formEncType",
89
+ "formMethod",
90
+ "formNoValidate",
91
+ "formTarget",
92
+ "frameBorder",
93
+ "hrefLang",
94
+ "inputMode",
95
+ "keyParams",
96
+ "keyType",
97
+ "marginHeight",
98
+ "marginWidth",
99
+ "maxLength",
100
+ "mediaGroup",
101
+ "minLength",
102
+ "noValidate",
103
+ "radioGroup",
104
+ "readOnly",
105
+ "rowSpan",
106
+ "spellCheck",
107
+ "srcDoc",
108
+ "srcLang",
109
+ "srcSet",
110
+ "tabIndex",
111
+ "useMap"
112
+ ].reduce(
113
+ (obj, x) => {
114
+ obj[x.toLowerCase()] = x;
115
+ return obj;
116
+ },
117
+ { class: "className", for: "htmlFor" }
118
+ );
119
+ const namedCodesToUnicode = {
120
+ amp: "&",
121
+ apos: "'",
122
+ gt: ">",
123
+ lt: "<",
124
+ nbsp: " ",
125
+ quot: "“"
126
+ };
127
+ const DO_NOT_PROCESS_HTML_ELEMENTS = ["style", "script", "pre"];
128
+ const ATTRIBUTES_TO_SANITIZE = [
129
+ "src",
130
+ "href",
131
+ "data",
132
+ "formAction",
133
+ "srcDoc",
134
+ "action"
135
+ ];
136
+ const ATTR_EXTRACTOR_R = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi;
137
+ const AUTOLINK_MAILTO_CHECK_R = /mailto:/i;
138
+ const BLOCK_END_R = /\n{2,}$/;
139
+ const BLOCKQUOTE_R = /^(\s*>[\s\S]*?)(?=\n\n|$)/;
140
+ const BLOCKQUOTE_TRIM_LEFT_MULTILINE_R = /^ *> ?/gm;
141
+ const BLOCKQUOTE_ALERT_R = /^(?:\[!([^\]]*)\]\n)?([\s\S]*)/;
142
+ const BREAK_LINE_R = /^ {2,}\n/;
143
+ const BREAK_THEMATIC_R = /^(?:( *[-*_])){3,} *(?:\n *)+\n/;
144
+ const CODE_BLOCK_FENCED_R = /^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/;
145
+ const CODE_BLOCK_R = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/;
146
+ const CODE_INLINE_R = /^(`+)((?:\\`|(?!\1)`|[^`])+)\1/;
147
+ const CONSECUTIVE_NEWLINE_R = /^(?:\n *)*\n/;
148
+ const CR_NEWLINE_R = /\r\n?/g;
149
+ const FOOTNOTE_R = /^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/;
150
+ const FOOTNOTE_REFERENCE_R = /^\[\^([^\]]+)]/;
151
+ const FORMFEED_R = /\f/g;
152
+ const FRONT_MATTER_R = /^---[ \t]*\n(.|\n)*\n---[ \t]*\n/;
153
+ const GFM_TASK_R = /^\s*?\[(x|\s)\]/;
154
+ const HEADING_R = /^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
155
+ const HEADING_ATX_COMPLIANT_R = /^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
156
+ const HEADING_SETEXT_R = /^([^\n]+)\n *(=|-){3,} *\n/;
157
+ const HTML_BLOCK_ELEMENT_R = /^ *(?!<[a-zA-Z][^ >/]* ?\/>)<([a-zA-Z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i;
158
+ const HTML_CHAR_CODE_R = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi;
159
+ const HTML_COMMENT_R = /^<!--[\s\S]*?(?:-->)/;
160
+ const HTML_CUSTOM_ATTR_R = /^(data|aria|x)-[a-z_][a-z\d_.-]*$/;
161
+ const HTML_SELF_CLOSING_ELEMENT_R = /^ *<([a-zA-Z][a-zA-Z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i;
162
+ const CUSTOM_COMPONENT_R = /^ *<([A-Z][a-zA-Z0-9]*)(?:\s+((?:<.*?>|[^>])*))?>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/;
163
+ const INTERPOLATION_R = /^\{.*\}$/;
164
+ const LINK_AUTOLINK_BARE_URL_R = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/;
165
+ const LINK_AUTOLINK_MAILTO_R = /^<([^ >]+@[^ >]+)>/;
166
+ const LINK_AUTOLINK_R = /^<([^ >]+:\/[^ >]+)>/;
167
+ const CAPTURE_LETTER_AFTER_HYPHEN = /-([a-z])?/gi;
168
+ const NP_TABLE_R = /^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/;
169
+ const PARAGRAPH_R = /^[^\n]+(?: \n|\n{2,})/;
170
+ const REFERENCE_IMAGE_OR_LINK = /^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/;
171
+ const REFERENCE_IMAGE_R = /^!\[([^\]]*)\] ?\[([^\]]*)\]/;
172
+ const REFERENCE_LINK_R = /^\[([^\]]*)\] ?\[([^\]]*)\]/;
173
+ const SHOULD_RENDER_AS_BLOCK_R = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/;
174
+ const TAB_R = /\t/g;
175
+ const TABLE_TRIM_PIPES = /(^ *\||\| *$)/g;
176
+ const TABLE_CENTER_ALIGN = /^ *:-+: *$/;
177
+ const TABLE_LEFT_ALIGN = /^ *:-+ *$/;
178
+ const TABLE_RIGHT_ALIGN = /^ *-+: *$/;
179
+ const LOOKAHEAD = (double) => `(?=[\\s\\S]+?\\1${double ? "\\1" : ""})`;
180
+ const INLINE_SKIP_R = "((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)";
181
+ const TEXT_BOLD_R = new RegExp(
182
+ `^([*_])\\1${LOOKAHEAD(1)}${INLINE_SKIP_R}\\1\\1(?!\\1)`
183
+ );
184
+ const TEXT_EMPHASIZED_R = new RegExp(
185
+ `^([*_])${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1(?!\\1)`
186
+ );
187
+ const TEXT_MARKED_R = new RegExp(`^(==)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1`);
188
+ const TEXT_STRIKETHROUGHED_R = new RegExp(
189
+ `^(~~)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1`
190
+ );
191
+ const SHORTCODE_R = /^(:[a-zA-Z0-9-_]+:)/;
192
+ const TEXT_ESCAPED_R = /^\\([^0-9A-Za-z\s])/;
193
+ const UNESCAPE_R = /\\([^0-9A-Za-z\s])/g;
194
+ const TEXT_PLAIN_R = /^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/;
195
+ const TRIM_STARTING_NEWLINES = /^\n+/;
196
+ const HTML_LEFT_TRIM_AMOUNT_R = /^([ \t]*)/;
197
+ const ORDERED = 1;
198
+ const UNORDERED = 2;
199
+ const LIST_LOOKBEHIND_R = /(?:^|\n)( *)$/;
200
+ const ORDERED_LIST_BULLET = "(?:\\d+\\.)";
201
+ const UNORDERED_LIST_BULLET = "(?:[*+-])";
202
+ const generateListItemPrefix = (type) => {
203
+ return "( *)(" + (type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) + ") +";
204
+ };
205
+ const ORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(ORDERED);
206
+ const UNORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(UNORDERED);
207
+ const generateListItemPrefixRegex = (type) => {
208
+ return new RegExp(
209
+ "^" + (type === ORDERED ? ORDERED_LIST_ITEM_PREFIX : UNORDERED_LIST_ITEM_PREFIX)
210
+ );
211
+ };
212
+ const ORDERED_LIST_ITEM_PREFIX_R = generateListItemPrefixRegex(ORDERED);
213
+ const UNORDERED_LIST_ITEM_PREFIX_R = generateListItemPrefixRegex(UNORDERED);
214
+ const generateListItemRegex = (type) => {
215
+ return new RegExp(
216
+ "^" + (type === ORDERED ? ORDERED_LIST_ITEM_PREFIX : UNORDERED_LIST_ITEM_PREFIX) + "[^\\n]*(?:\\n(?!\\1" + (type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) + " )[^\\n]*)*(\\n|$)",
217
+ "gm"
218
+ );
219
+ };
220
+ const ORDERED_LIST_ITEM_R = generateListItemRegex(ORDERED);
221
+ const UNORDERED_LIST_ITEM_R = generateListItemRegex(UNORDERED);
222
+ const generateListRegex = (type) => {
223
+ const bullet = type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET;
224
+ return new RegExp(
225
+ "^( *)(" + bullet + ") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1" + bullet + " (?!" + bullet + " ))\\n*|\\s*\\n*$)"
226
+ );
227
+ };
228
+ const ORDERED_LIST_R = generateListRegex(ORDERED);
229
+ const UNORDERED_LIST_R = generateListRegex(UNORDERED);
230
+ const generateListRule = (type, factory) => {
231
+ const ordered = type === ORDERED;
232
+ const LIST_R = ordered ? ORDERED_LIST_R : UNORDERED_LIST_R;
233
+ const LIST_ITEM_R = ordered ? ORDERED_LIST_ITEM_R : UNORDERED_LIST_ITEM_R;
234
+ const LIST_ITEM_PREFIX_R = ordered ? ORDERED_LIST_ITEM_PREFIX_R : UNORDERED_LIST_ITEM_PREFIX_R;
235
+ return {
236
+ _qualify: (source) => LIST_ITEM_PREFIX_R.test(source),
237
+ _match: allowInline((source, state) => {
238
+ const isStartOfLine = LIST_LOOKBEHIND_R.exec(state.prevCapture ?? "");
239
+ const isListAllowed = state.list ?? (!state.inline && !state.simple);
240
+ if (isStartOfLine && isListAllowed) {
241
+ source = isStartOfLine[1] + source;
242
+ return LIST_R.exec(source);
243
+ } else {
244
+ return null;
245
+ }
246
+ }),
247
+ _order: Priority.HIGH,
248
+ _parse(capture, parse, state) {
249
+ const bullet = capture[2];
250
+ const start = ordered ? +bullet : void 0;
251
+ const items = capture[0].replace(BLOCK_END_R, "\n").match(LIST_ITEM_R);
252
+ if (!items) return { items: [], ordered, start };
253
+ let lastItemWasAParagraph = false;
254
+ const itemContent = items.map((item, i) => {
255
+ const spaceMatch = LIST_ITEM_PREFIX_R.exec(item);
256
+ if (!spaceMatch) return [];
257
+ const space = spaceMatch[0].length;
258
+ const spaceRegex = new RegExp("^ {1," + space + "}", "gm");
259
+ const content = item.replace(spaceRegex, "").replace(LIST_ITEM_PREFIX_R, "");
260
+ const isLastItem = i === items.length - 1;
261
+ const containsBlocks = content.indexOf("\n\n") !== -1;
262
+ const thisItemIsAParagraph = containsBlocks || isLastItem && lastItemWasAParagraph;
263
+ lastItemWasAParagraph = thisItemIsAParagraph;
264
+ const oldStateInline = state.inline;
265
+ const oldStateList = state.list;
266
+ state.list = true;
267
+ let adjustedContent;
268
+ if (thisItemIsAParagraph) {
269
+ state.inline = false;
270
+ adjustedContent = trimEnd(content) + "\n\n";
271
+ } else {
272
+ state.inline = true;
273
+ adjustedContent = trimEnd(content);
274
+ }
275
+ const result = parse(adjustedContent, state);
276
+ state.inline = oldStateInline;
277
+ state.list = oldStateList;
278
+ return result;
279
+ });
280
+ return {
281
+ items: itemContent,
282
+ ordered,
283
+ start
284
+ };
285
+ },
286
+ _render(node, _output, state = {}) {
287
+ const Tag = node.ordered ? "ol" : "ul";
288
+ const props = { key: state.key };
289
+ if (node.ordered && node.start != null) props.start = node.start;
290
+ if (factory) {
291
+ return factory(
292
+ Tag,
293
+ props,
294
+ ...node.items.map(
295
+ (item, i) => factory("li", { key: i }, _output(item, state))
296
+ )
297
+ );
298
+ }
299
+ return /* @__PURE__ */ jsx(
300
+ Tag,
301
+ {
302
+ start: node.type === RuleType.orderedList ? node.start : void 0,
303
+ children: node.items.map((item, i) => {
304
+ return /* @__PURE__ */ jsx("li", { children: _output(item, state) }, i);
305
+ })
306
+ },
307
+ state.key
308
+ );
309
+ }
310
+ };
311
+ };
312
+ const LINK_INSIDE = "(?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*";
313
+ const LINK_HREF_AND_TITLE = `\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*`;
314
+ const LINK_R = new RegExp(
315
+ "^\\[(" + LINK_INSIDE + ")\\]\\(" + LINK_HREF_AND_TITLE + "\\)"
316
+ );
317
+ const IMAGE_R = /^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;
318
+ const trimEnd = (str) => {
319
+ let end = str.length;
320
+ while (end > 0 && str[end - 1] <= " ") end--;
321
+ return str.slice(0, end);
322
+ };
323
+ const startsWith = (str, prefix) => {
324
+ return str.startsWith(prefix);
325
+ };
326
+ const qualifies = (source, state, qualify) => {
327
+ if (Array.isArray(qualify)) {
328
+ for (let i = 0; i < qualify.length; i++) {
329
+ if (startsWith(source, qualify[i])) return true;
330
+ }
331
+ return false;
332
+ }
333
+ return qualify(source, state);
334
+ };
335
+ const unquote = (str) => {
336
+ const first = str[0];
337
+ if ((first === '"' || first === "'") && str.length >= 2 && str[str.length - 1] === first) {
338
+ return str.slice(1, -1);
339
+ }
340
+ return str;
341
+ };
342
+ const slugify = (str) => str.replace(/[ÀÁÂÃÄÅàáâãä忯]/g, "a").replace(/[çÇ]/g, "c").replace(/[ðÐ]/g, "d").replace(/[ÈÉÊËéèêë]/g, "e").replace(/[ÏïÎîÍíÌì]/g, "i").replace(/[Ññ]/g, "n").replace(/[øØœŒÕõÔôÓóÒò]/g, "o").replace(/[ÜüÛûÚúÙù]/g, "u").replace(/[ŸÿÝý]/g, "y").replace(/[^a-z0-9- ]/gi, "").replace(/ /gi, "-").toLowerCase();
343
+ const parseTableAlignCapture = (alignCapture) => {
344
+ if (TABLE_RIGHT_ALIGN.test(alignCapture)) {
345
+ return "right";
346
+ } else if (TABLE_CENTER_ALIGN.test(alignCapture)) {
347
+ return "center";
348
+ } else if (TABLE_LEFT_ALIGN.test(alignCapture)) {
349
+ return "left";
350
+ }
351
+ return "left";
352
+ };
353
+ const parseTableRow = (source, parse, state, tableOutput) => {
354
+ const prevInTable = state.inTable;
355
+ state.inTable = true;
356
+ let cells = [[]];
357
+ let acc = "";
358
+ const flush = () => {
359
+ if (!acc) return;
360
+ const cell = cells[cells.length - 1];
361
+ cell.push.apply(cell, parse(acc, state));
362
+ acc = "";
363
+ };
364
+ source.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((fragment, i, arr) => {
365
+ if (fragment.trim() === "|") {
366
+ flush();
367
+ if (tableOutput) {
368
+ if (i !== 0 && i !== arr.length - 1) {
369
+ cells.push([]);
370
+ }
371
+ return;
372
+ }
373
+ }
374
+ acc += fragment;
375
+ });
376
+ flush();
377
+ state.inTable = prevInTable;
378
+ return cells;
379
+ };
380
+ const parseTableAlign = (source) => {
381
+ const alignText = source.replace(TABLE_TRIM_PIPES, "").split("|");
382
+ return alignText.map(parseTableAlignCapture);
383
+ };
384
+ const parseTableCells = (source, parse, state) => {
385
+ const rowsText = source.trim().split("\n");
386
+ return rowsText.map((rowText) => {
387
+ return parseTableRow(rowText, parse, state, true);
388
+ });
389
+ };
390
+ const parseTable = (capture, parse, state) => {
391
+ state.inline = true;
392
+ const align = capture[2] ? parseTableAlign(capture[2]) : [];
393
+ const cells = capture[3] ? parseTableCells(capture[3], parse, state) : [];
394
+ const header = parseTableRow(capture[1], parse, state, !!cells.length);
395
+ state.inline = false;
396
+ return cells.length ? {
397
+ align,
398
+ cells,
399
+ header,
400
+ type: RuleType.table
401
+ } : {
402
+ children: header.flat(),
403
+ type: RuleType.paragraph
404
+ };
405
+ };
406
+ const getTableStyle = (node, colIndex) => node.align[colIndex] == null ? {} : {
407
+ textAlign: node.align[colIndex]
408
+ };
409
+ const normalizeAttributeKey = (key) => {
410
+ const hyphenIndex = key.indexOf("-");
411
+ if (hyphenIndex !== -1 && key.match(HTML_CUSTOM_ATTR_R) === null) {
412
+ key = key.replace(CAPTURE_LETTER_AFTER_HYPHEN, (_, letter) => {
413
+ return letter.toUpperCase();
414
+ });
415
+ }
416
+ return key;
417
+ };
418
+ const parseStyleAttribute = (styleString) => {
419
+ const styles = [];
420
+ let buffer = "";
421
+ let inUrl = false;
422
+ let inQuotes = false;
423
+ let quoteChar = "";
424
+ if (!styleString) return styles;
425
+ for (let i = 0; i < styleString.length; i++) {
426
+ const char = styleString[i];
427
+ if ((char === '"' || char === "'") && !inUrl) {
428
+ if (!inQuotes) {
429
+ inQuotes = true;
430
+ quoteChar = char;
431
+ } else if (char === quoteChar) {
432
+ inQuotes = false;
433
+ quoteChar = "";
434
+ }
435
+ }
436
+ if (char === "(" && buffer.endsWith("url")) {
437
+ inUrl = true;
438
+ } else if (char === ")" && inUrl) {
439
+ inUrl = false;
440
+ }
441
+ if (char === ";" && !inQuotes && !inUrl) {
442
+ const declaration2 = buffer.trim();
443
+ if (declaration2) {
444
+ const colonIndex = declaration2.indexOf(":");
445
+ if (colonIndex > 0) {
446
+ const key = declaration2.slice(0, colonIndex).trim();
447
+ const value = declaration2.slice(colonIndex + 1).trim();
448
+ styles.push([key, value]);
449
+ }
450
+ }
451
+ buffer = "";
452
+ } else {
453
+ buffer += char;
454
+ }
455
+ }
456
+ const declaration = buffer.trim();
457
+ if (declaration) {
458
+ const colonIndex = declaration.indexOf(":");
459
+ if (colonIndex > 0) {
460
+ const key = declaration.slice(0, colonIndex).trim();
461
+ const value = declaration.slice(colonIndex + 1).trim();
462
+ styles.push([key, value]);
463
+ }
464
+ }
465
+ return styles;
466
+ };
467
+ const trimLeadingWhitespaceOutsideFences = (text, whitespace) => {
468
+ if (!whitespace) return text;
469
+ const lines = text.split("\n");
470
+ let inFence = false;
471
+ let fenceToken = null;
472
+ const isFenceLine = (line) => line.match(/^\s*(`{3,}|~{3,})/);
473
+ const maybeToggleFence = (line) => {
474
+ const m = isFenceLine(line);
475
+ if (!m) return;
476
+ const token = m[1];
477
+ if (!inFence) {
478
+ inFence = true;
479
+ fenceToken = token;
480
+ } else if (fenceToken && line.includes(fenceToken)) {
481
+ inFence = false;
482
+ fenceToken = null;
483
+ }
484
+ };
485
+ const out = lines.map((line) => {
486
+ const fenceMatch = isFenceLine(line);
487
+ if (fenceMatch) {
488
+ const trimmedFenceLine = line.startsWith(whitespace) ? line.slice(whitespace.length) : line;
489
+ maybeToggleFence(line);
490
+ return trimmedFenceLine;
491
+ }
492
+ if (inFence) {
493
+ return line;
494
+ }
495
+ return line.startsWith(whitespace) ? line.slice(whitespace.length) : line;
496
+ });
497
+ return out.join("\n");
498
+ };
499
+ const attributeValueToJSXPropValue = (tag, key, value, sanitizeUrlFn) => {
500
+ if (key === "style") {
501
+ return parseStyleAttribute(value).reduce(
502
+ (styles, [key2, value2]) => {
503
+ const camelCasedKey = key2.replace(
504
+ /(-[a-z])/g,
505
+ (substr) => substr[1].toUpperCase()
506
+ );
507
+ styles[camelCasedKey] = sanitizeUrlFn(
508
+ value2,
509
+ tag,
510
+ key2
511
+ );
512
+ return styles;
513
+ },
514
+ {}
515
+ );
516
+ } else if (ATTRIBUTES_TO_SANITIZE.indexOf(key) !== -1) {
517
+ return sanitizeUrlFn(unescape(value), tag, key);
518
+ } else if (value.match(INTERPOLATION_R)) {
519
+ value = unescape(value.slice(1, value.length - 1));
520
+ }
521
+ if (value === "true") {
522
+ return true;
523
+ } else if (value === "false") {
524
+ return false;
525
+ }
526
+ return value;
527
+ };
528
+ const normalizeWhitespace = (source) => {
529
+ return source.replace(CR_NEWLINE_R, "\n").replace(FORMFEED_R, "").replace(TAB_R, " ");
530
+ };
531
+ const parserFor = (rules) => {
532
+ var ruleList = Object.keys(rules);
533
+ if (define_process_env_default.NODE_ENV !== "production") {
534
+ ruleList.forEach((type) => {
535
+ const order = rules[type]._order;
536
+ if (typeof order !== "number" || !isFinite(order)) {
537
+ console.warn(
538
+ "intlayer: Invalid order for rule `" + type + "`: " + order
539
+ );
540
+ }
541
+ });
542
+ }
543
+ ruleList.sort((a, b) => {
544
+ return rules[a]._order - rules[b]._order || (a < b ? -1 : 1);
545
+ });
546
+ const nestedParse = (source, state = {}) => {
547
+ var result = [];
548
+ state.prevCapture = state.prevCapture || "";
549
+ if (source.trim()) {
550
+ while (source) {
551
+ var i = 0;
552
+ while (i < ruleList.length) {
553
+ var ruleType = ruleList[i];
554
+ var rule = rules[ruleType];
555
+ if (rule._qualify && !qualifies(source, state, rule._qualify)) {
556
+ i++;
557
+ continue;
558
+ }
559
+ var capture = rule._match(source, state);
560
+ if (capture && capture[0]) {
561
+ source = source.substring(capture[0].length);
562
+ const parsedAny = rule._parse(capture, nestedParse, state);
563
+ state.prevCapture += capture[0];
564
+ if (!parsedAny.type)
565
+ parsedAny.type = ruleType;
566
+ result.push(parsedAny);
567
+ break;
568
+ }
569
+ i++;
570
+ }
571
+ }
572
+ }
573
+ state.prevCapture = "";
574
+ return result;
575
+ };
576
+ return (source, state) => nestedParse(normalizeWhitespace(source), state);
577
+ };
578
+ const allowInline = (fn) => {
579
+ fn.inline = 1;
580
+ return fn;
581
+ };
582
+ const inlineRegex = (regex) => allowInline((source, state) => {
583
+ if (state.inline) {
584
+ return regex.exec(source);
585
+ } else {
586
+ return null;
587
+ }
588
+ });
589
+ const simpleInlineRegex = (regex) => allowInline((source, state) => {
590
+ if (state.inline || state.simple) {
591
+ return regex.exec(source);
592
+ } else {
593
+ return null;
594
+ }
595
+ });
596
+ const blockRegex = (regex) => (source, state) => {
597
+ if (state.inline || state.simple) {
598
+ return null;
599
+ } else {
600
+ return regex.exec(source);
601
+ }
602
+ };
603
+ const anyScopeRegex = (regex) => allowInline(
604
+ (source) => regex.exec(source)
605
+ );
606
+ const SANITIZE_R = /(javascript|vbscript|data(?!:image)):/i;
607
+ const sanitizer = (input) => {
608
+ try {
609
+ const decoded = decodeURIComponent(input).replace(/[^A-Za-z0-9/:]/g, "");
610
+ if (SANITIZE_R.test(decoded)) {
611
+ if (define_process_env_default.NODE_ENV !== "production") {
612
+ console.warn(
613
+ "Input contains an unsafe JavaScript/VBScript/data expression, it will not be rendered.",
614
+ decoded
615
+ );
616
+ }
617
+ return null;
618
+ }
619
+ } catch (e) {
620
+ if (define_process_env_default.NODE_ENV !== "production") {
621
+ console.warn(
622
+ "Input could not be decoded due to malformed syntax or characters, it will not be rendered.",
623
+ input
624
+ );
625
+ }
626
+ return null;
627
+ }
628
+ return input;
629
+ };
630
+ const unescape = (rawString) => rawString ? rawString.replace(UNESCAPE_R, "$1") : rawString;
631
+ const parseInline = (parse, children, state) => {
632
+ const isCurrentlyInline = state.inline ?? false;
633
+ const isCurrentlySimple = state.simple ?? false;
634
+ state.inline = true;
635
+ state.simple = true;
636
+ const result = parse(children, state);
637
+ state.inline = isCurrentlyInline;
638
+ state.simple = isCurrentlySimple;
639
+ return result;
640
+ };
641
+ const parseSimpleInline = (parse, children, state) => {
642
+ const isCurrentlyInline = state.inline ?? false;
643
+ const isCurrentlySimple = state.simple ?? false;
644
+ state.inline = false;
645
+ state.simple = true;
646
+ const result = parse(children, state);
647
+ state.inline = isCurrentlyInline;
648
+ state.simple = isCurrentlySimple;
649
+ return result;
650
+ };
651
+ const parseBlock = (parse, children, state = {}) => {
652
+ const isCurrentlyInline = state.inline || false;
653
+ state.inline = false;
654
+ const result = parse(children, state);
655
+ state.inline = isCurrentlyInline;
656
+ return result;
657
+ };
658
+ const parseCaptureInline = (capture, parse, state) => {
659
+ return {
660
+ children: parseInline(parse, capture[2], state)
661
+ };
662
+ };
663
+ const captureNothing = () => ({});
664
+ const renderNothing = () => null;
665
+ const reactFor = (render) => (ast, state = {}) => {
666
+ const patchedRender = (ast2, state2 = {}) => reactFor(render)(ast2, state2);
667
+ if (Array.isArray(ast)) {
668
+ const oldKey = state.key;
669
+ const result = [];
670
+ let lastWasString = false;
671
+ for (let i = 0; i < ast.length; i++) {
672
+ state.key = i;
673
+ const nodeOut = patchedRender(ast[i], state);
674
+ const isString = typeof nodeOut === "string";
675
+ if (isString && lastWasString) {
676
+ result[result.length - 1] = result[result.length - 1] + nodeOut;
677
+ } else if (nodeOut !== null) {
678
+ result.push(nodeOut);
679
+ }
680
+ lastWasString = isString;
681
+ }
682
+ state.key = oldKey;
683
+ return result;
684
+ }
685
+ return render(
686
+ ast,
687
+ patchedRender,
688
+ state
689
+ );
690
+ };
691
+ const createRenderer = (rules, userRender) => (ast, render, state) => {
692
+ const renderer = rules[ast.type]._render;
693
+ return userRender ? userRender(() => renderer?.(ast, render, state), ast, render, state) : renderer?.(ast, render, state);
694
+ };
695
+ const cx = (...args) => args.filter(Boolean).join(" ");
696
+ const get = (src, path, fb) => {
697
+ let ptr = src;
698
+ const frags = path.split(".");
699
+ while (frags.length) {
700
+ ptr = ptr[frags[0]];
701
+ if (ptr === void 0) break;
702
+ else frags.shift();
703
+ }
704
+ return ptr ?? fb;
705
+ };
706
+ const getTag = (tag, overrides) => {
707
+ const override = get(overrides, tag);
708
+ if (!override) return tag;
709
+ return typeof override === "function" || typeof override === "object" && "render" in override ? override : get(overrides, `${tag}.component`, tag);
710
+ };
711
+ const compiler = (markdown = "", options = {}) => {
712
+ options.overrides = options.overrides ?? {};
713
+ options.namedCodesToUnicode = options.namedCodesToUnicode ? { ...namedCodesToUnicode, ...options.namedCodesToUnicode } : namedCodesToUnicode;
714
+ const slug = options.slugify ?? slugify;
715
+ const sanitize = options.sanitizer ?? sanitizer;
716
+ const createElementFn = options.createElement ?? createElement;
717
+ const NON_PARAGRAPH_BLOCK_SYNTAXES = [
718
+ BLOCKQUOTE_R,
719
+ CODE_BLOCK_FENCED_R,
720
+ CODE_BLOCK_R,
721
+ options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R,
722
+ HEADING_SETEXT_R,
723
+ NP_TABLE_R,
724
+ ORDERED_LIST_R,
725
+ UNORDERED_LIST_R
726
+ ];
727
+ const BLOCK_SYNTAXES = [
728
+ ...NON_PARAGRAPH_BLOCK_SYNTAXES,
729
+ PARAGRAPH_R,
730
+ HTML_BLOCK_ELEMENT_R,
731
+ HTML_COMMENT_R,
732
+ HTML_SELF_CLOSING_ELEMENT_R,
733
+ CUSTOM_COMPONENT_R
734
+ ];
735
+ const containsBlockSyntax = (input) => {
736
+ const cleaned = input.replace(TRIM_STARTING_NEWLINES, "");
737
+ return BLOCK_SYNTAXES.some((r) => r.test(cleaned));
738
+ };
739
+ const matchParagraph = (source, state) => {
740
+ if (state.inline || state.simple || state.inHTML && source.indexOf("\n\n") === -1 && state.prevCapture?.indexOf("\n\n") === -1) {
741
+ return null;
742
+ }
743
+ let match = "";
744
+ source.split("\n").every((line) => {
745
+ line += "\n";
746
+ if (NON_PARAGRAPH_BLOCK_SYNTAXES.some((regex) => regex.test(line))) {
747
+ return false;
748
+ }
749
+ match += line;
750
+ return !!line.trim();
751
+ });
752
+ const captured = trimEnd(match);
753
+ if (captured === "") {
754
+ return null;
755
+ }
756
+ return [match, , captured];
757
+ };
758
+ const h = (tag, props, ...children) => {
759
+ const overrideProps = get(
760
+ options.overrides ?? {},
761
+ `${tag}.props`,
762
+ {}
763
+ );
764
+ return createElementFn(
765
+ getTag(tag, options.overrides ?? {}),
766
+ {
767
+ ...props,
768
+ ...overrideProps,
769
+ className: cx(props?.className, overrideProps.className) ?? void 0
770
+ },
771
+ ...children
772
+ );
773
+ };
774
+ const compile = (input) => {
775
+ input = input.replace(FRONT_MATTER_R, "");
776
+ const transformFrameworkH5GroupsToTabs = (src) => {
777
+ const lines = src.split(/\r?\n/);
778
+ const out = [];
779
+ let i = 0;
780
+ let insideTabsDepth = 0;
781
+ while (i < lines.length) {
782
+ const line = lines[i];
783
+ if (/<\s*Tabs[>\s]/.test(line)) {
784
+ insideTabsDepth++;
785
+ }
786
+ if (/<\s*\/\s*Tabs\s*>/.test(line)) {
787
+ insideTabsDepth = Math.max(0, insideTabsDepth - 1);
788
+ }
789
+ if (!insideTabsDepth) {
790
+ const headingMatch = line.match(/^#{5}\s+(.+?)\s*$/);
791
+ if (headingMatch) {
792
+ const collected = [];
793
+ const captureSection = (startIndex) => {
794
+ let j2 = startIndex;
795
+ const buf = [];
796
+ while (j2 < lines.length) {
797
+ const l = lines[j2];
798
+ if (/^#{1,5}\s+/.test(l)) break;
799
+ if (/<\s*Tabs[>\s]/.test(l)) insideTabsDepth++;
800
+ if (/<\s*\/\s*Tabs\s*>/.test(l))
801
+ insideTabsDepth = Math.max(0, insideTabsDepth - 1);
802
+ buf.push(l);
803
+ j2++;
804
+ }
805
+ return {
806
+ content: buf.join("\n").replace(/\n+$/, "\n"),
807
+ endIndex: j2
808
+ };
809
+ };
810
+ let j = i;
811
+ while (j < lines.length) {
812
+ const h2 = lines[j].match(/^#{5}\s+(.+?)\s*$/);
813
+ if (!h2) break;
814
+ const hLabel = h2[1].trim();
815
+ const { content, endIndex } = captureSection(j + 1);
816
+ collected.push({
817
+ label: hLabel,
818
+ value: hLabel.toLowerCase(),
819
+ content
820
+ });
821
+ j = endIndex;
822
+ if (!lines[j]?.startsWith("#####")) break;
823
+ }
824
+ if (collected.length >= 2) {
825
+ const defaultTab = (collected.find((t) => t.value === "intlayer") ?? collected[0]).value;
826
+ out.push(`<Tabs defaultTab="${defaultTab}">`);
827
+ const order = ["intlayer", "next-intl", "next-i18next"];
828
+ for (const key of order) {
829
+ const item = collected.find((c) => c.value === key);
830
+ if (!item) continue;
831
+ out.push(
832
+ ` <TabItem label="${item.label}" value="${item.value}">`
833
+ );
834
+ const inner = item.content.replace(/^\n+|\n+$/g, "");
835
+ out.push(inner);
836
+ out.push(" </TabItem>");
837
+ }
838
+ out.push("</Tabs>");
839
+ i = j;
840
+ continue;
841
+ }
842
+ }
843
+ }
844
+ out.push(line);
845
+ i++;
846
+ }
847
+ return out.join("\n");
848
+ };
849
+ input = transformFrameworkH5GroupsToTabs(input);
850
+ let inline = false;
851
+ if (options.forceInline) {
852
+ inline = true;
853
+ } else if (!options.forceBlock) {
854
+ inline = SHOULD_RENDER_AS_BLOCK_R.test(input) === false;
855
+ }
856
+ const arr = emitter(
857
+ parser(
858
+ inline ? input : `${trimEnd(input).replace(TRIM_STARTING_NEWLINES, "")}
859
+
860
+ `,
861
+ {
862
+ inline
863
+ }
864
+ )
865
+ );
866
+ while (typeof arr[arr.length - 1] === "string" && !arr[arr.length - 1].trim()) {
867
+ arr.pop();
868
+ }
869
+ if (options.wrapper === null) {
870
+ return arr;
871
+ }
872
+ const wrapper = options.wrapper ?? (inline ? "span" : "div");
873
+ let jsx3;
874
+ if (arr.length > 1 || options.forceWrapper) {
875
+ jsx3 = arr;
876
+ } else if (arr.length === 1) {
877
+ jsx3 = arr[0];
878
+ if (typeof jsx3 === "string") {
879
+ return /* @__PURE__ */ jsx("span", { children: jsx3 }, "outer");
880
+ } else {
881
+ return jsx3;
882
+ }
883
+ } else {
884
+ jsx3 = null;
885
+ }
886
+ return createElementFn(wrapper, { key: "outer" }, jsx3);
887
+ };
888
+ const attrStringToMap = (tag, str) => {
889
+ if (!str || !str.trim()) {
890
+ return null;
891
+ }
892
+ const attributes = str.match(ATTR_EXTRACTOR_R);
893
+ if (!attributes) {
894
+ return null;
895
+ }
896
+ return attributes.reduce((map, raw) => {
897
+ const delimiterIdx = raw.indexOf("=");
898
+ if (delimiterIdx !== -1) {
899
+ const key = normalizeAttributeKey(raw.slice(0, delimiterIdx)).trim();
900
+ const value = unquote(raw.slice(delimiterIdx + 1).trim());
901
+ const mappedKey = ATTRIBUTE_TO_JSX_PROP_MAP[key] ?? key;
902
+ if (mappedKey === "ref") return map;
903
+ const normalizedValue = map[mappedKey] = attributeValueToJSXPropValue(
904
+ tag,
905
+ key,
906
+ value,
907
+ sanitize
908
+ );
909
+ if (typeof normalizedValue === "string" && (HTML_BLOCK_ELEMENT_R.test(normalizedValue) || HTML_SELF_CLOSING_ELEMENT_R.test(normalizedValue))) {
910
+ map[mappedKey] = compile(normalizedValue.trim());
911
+ }
912
+ } else if (raw !== "style") {
913
+ map[ATTRIBUTE_TO_JSX_PROP_MAP[raw] ?? raw] = true;
914
+ }
915
+ return map;
916
+ }, {});
917
+ };
918
+ if (define_process_env_default.NODE_ENV !== "production") {
919
+ if (typeof markdown !== "string") {
920
+ throw new Error(`intlayer: the first argument must be
921
+ a string`);
922
+ }
923
+ if (Object.prototype.toString.call(options.overrides) !== "[object Object]") {
924
+ throw new Error(`intlayer: options.overrides (second argument property) must be
925
+ undefined or an object literal with shape:
926
+ {
927
+ htmltagname: {
928
+ component: string|ReactComponent(optional),
929
+ props: object(optional)
930
+ }
931
+ }`);
932
+ }
933
+ }
934
+ const footnotes = [];
935
+ const refs = {};
936
+ const rules = {
937
+ [RuleType.blockQuote]: {
938
+ _qualify: [">"],
939
+ _match: blockRegex(BLOCKQUOTE_R),
940
+ _order: Priority.HIGH,
941
+ _parse(capture, parse, state) {
942
+ const matchAlert = capture[0].replace(BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, "").match(BLOCKQUOTE_ALERT_R);
943
+ const alert = matchAlert?.[1];
944
+ const content = matchAlert?.[2] ?? "";
945
+ return {
946
+ alert,
947
+ children: parse(content, state)
948
+ };
949
+ },
950
+ _render(node, _output, state = {}) {
951
+ const props = {
952
+ key: state?.key
953
+ };
954
+ if (node.alert) {
955
+ props.className = "markdown-alert-" + slug(node.alert.toLowerCase(), slugify);
956
+ node.children.unshift({
957
+ attrs: {},
958
+ children: [{ type: RuleType.text, text: node.alert }],
959
+ noInnerParse: true,
960
+ type: RuleType.htmlBlock,
961
+ tag: "header"
962
+ });
963
+ }
964
+ return h("blockquote", props, _output(node.children, state));
965
+ }
966
+ },
967
+ [RuleType.breakLine]: {
968
+ _match: anyScopeRegex(BREAK_LINE_R),
969
+ _order: Priority.HIGH,
970
+ _parse: captureNothing,
971
+ _render(_, __, state = {}) {
972
+ return /* @__PURE__ */ jsx("br", {}, state.key);
973
+ }
974
+ },
975
+ [RuleType.breakThematic]: {
976
+ _qualify: (source) => {
977
+ const char = source[0];
978
+ return char === "-" || char === "*" || char === "_";
979
+ },
980
+ _match: blockRegex(BREAK_THEMATIC_R),
981
+ _order: Priority.HIGH,
982
+ _parse: captureNothing,
983
+ _render(_, __, state = {}) {
984
+ return /* @__PURE__ */ jsx("hr", {}, state.key);
985
+ }
986
+ },
987
+ [RuleType.codeBlock]: {
988
+ _qualify: [" "],
989
+ _match: blockRegex(CODE_BLOCK_R),
990
+ _order: Priority.MAX,
991
+ _parse(capture) {
992
+ return {
993
+ type: RuleType.codeBlock,
994
+ lang: void 0,
995
+ text: unescape(trimEnd(capture[0].replace(/^ {4}/gm, "")))
996
+ };
997
+ },
998
+ _render(node, _output, state = {}) {
999
+ const attrs = { ...node.attrs ?? {} };
1000
+ const langClass = node.lang ? `lang-${node.lang}` : "lang-plaintext";
1001
+ attrs.className = attrs.className ? `${attrs.className} ${langClass}` : langClass;
1002
+ if (node.lang && !attrs.lang) attrs.lang = node.lang;
1003
+ return h(
1004
+ "pre",
1005
+ { key: state.key },
1006
+ h("code", attrs, node.text)
1007
+ );
1008
+ }
1009
+ },
1010
+ [RuleType.codeFenced]: {
1011
+ _qualify: ["```", "~~~"],
1012
+ _match: blockRegex(CODE_BLOCK_FENCED_R),
1013
+ _order: Priority.MAX,
1014
+ _parse(capture, _parse, state) {
1015
+ const rawText = capture[4];
1016
+ const text = state.inHTML && rawText.indexOf("`") !== -1 ? rawText.replace(/\n/g, "\\n") : rawText;
1017
+ return {
1018
+ // if capture[3] it's additional metadata
1019
+ attrs: attrStringToMap("code", capture[3] ?? ""),
1020
+ lang: capture[2] || void 0,
1021
+ text,
1022
+ type: RuleType.codeBlock
1023
+ };
1024
+ }
1025
+ },
1026
+ [RuleType.codeInline]: {
1027
+ _qualify: ["`"],
1028
+ _match: simpleInlineRegex(CODE_INLINE_R),
1029
+ _order: Priority.LOW,
1030
+ _parse(capture) {
1031
+ return {
1032
+ text: unescape(capture[2])
1033
+ };
1034
+ },
1035
+ _render(node, _output, state = {}) {
1036
+ return h("code", { key: state.key }, node.text);
1037
+ }
1038
+ },
1039
+ /**
1040
+ * footnotes are emitted at the end of compilation in a special <footer> block
1041
+ */
1042
+ [RuleType.footnote]: {
1043
+ _qualify: ["[^"],
1044
+ _match: blockRegex(FOOTNOTE_R),
1045
+ _order: Priority.MAX,
1046
+ _parse(capture) {
1047
+ footnotes.push({
1048
+ footnote: capture[2],
1049
+ identifier: capture[1]
1050
+ });
1051
+ return {};
1052
+ },
1053
+ _render: renderNothing
1054
+ },
1055
+ [RuleType.footnoteReference]: {
1056
+ _qualify: ["[^"],
1057
+ _match: inlineRegex(FOOTNOTE_REFERENCE_R),
1058
+ _order: Priority.HIGH,
1059
+ _parse(capture) {
1060
+ return {
1061
+ target: `#${slug(capture[1], slugify)}`,
1062
+ text: capture[1]
1063
+ };
1064
+ },
1065
+ _render(node, _output, state = {}) {
1066
+ return /* @__PURE__ */ jsx(
1067
+ "a",
1068
+ {
1069
+ href: sanitize(node.target, "a", "href") ?? void 0,
1070
+ children: /* @__PURE__ */ jsx("sup", { children: node.text }, state.key)
1071
+ },
1072
+ state.key
1073
+ );
1074
+ }
1075
+ },
1076
+ [RuleType.gfmTask]: {
1077
+ _qualify: ["[ ]", "[x]"],
1078
+ _match: inlineRegex(GFM_TASK_R),
1079
+ _order: Priority.HIGH,
1080
+ _parse(capture) {
1081
+ return {
1082
+ completed: capture[1].toLowerCase() === "x"
1083
+ };
1084
+ },
1085
+ _render(node, _output, state = {}) {
1086
+ return /* @__PURE__ */ jsx(
1087
+ "input",
1088
+ {
1089
+ checked: node.completed,
1090
+ readOnly: true,
1091
+ type: "checkbox"
1092
+ },
1093
+ state.key
1094
+ );
1095
+ }
1096
+ },
1097
+ [RuleType.heading]: {
1098
+ _qualify: ["#"],
1099
+ _match: blockRegex(
1100
+ options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R
1101
+ ),
1102
+ _order: Priority.HIGH,
1103
+ _parse(capture, parse, state) {
1104
+ return {
1105
+ children: parseInline(parse, capture[2], state),
1106
+ id: slug(capture[2], slugify),
1107
+ level: capture[1].length
1108
+ };
1109
+ },
1110
+ _render(node, _output, state = {}) {
1111
+ return h(
1112
+ `h${node.level}`,
1113
+ { id: node.id, key: state.key },
1114
+ _output(node.children, state)
1115
+ );
1116
+ }
1117
+ },
1118
+ [RuleType.headingSetext]: {
1119
+ _match: blockRegex(HEADING_SETEXT_R),
1120
+ _order: Priority.MAX,
1121
+ _parse(capture, parse, state) {
1122
+ return {
1123
+ children: parseInline(parse, capture[1], state),
1124
+ level: capture[2] === "=" ? 1 : 2,
1125
+ type: RuleType.heading
1126
+ };
1127
+ }
1128
+ },
1129
+ [RuleType.htmlBlock]: {
1130
+ _qualify: ["<"],
1131
+ /**
1132
+ * find the first matching end tag and process the interior
1133
+ */
1134
+ _match: anyScopeRegex(HTML_BLOCK_ELEMENT_R),
1135
+ _order: Priority.HIGH,
1136
+ _parse(capture, parse, state) {
1137
+ const m = capture[3].match(
1138
+ HTML_LEFT_TRIM_AMOUNT_R
1139
+ );
1140
+ const whitespace = m?.[1] ?? "";
1141
+ const trimmed = trimLeadingWhitespaceOutsideFences(
1142
+ capture[3],
1143
+ whitespace
1144
+ );
1145
+ const parseFunc = containsBlockSyntax(trimmed) ? parseBlock : parseInline;
1146
+ const tagName = capture[1].toLowerCase();
1147
+ const noInnerParse = DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(tagName) !== -1;
1148
+ const tag = (noInnerParse ? tagName : capture[1]).trim();
1149
+ const ast = {
1150
+ attrs: attrStringToMap(tag, capture[2] ?? ""),
1151
+ noInnerParse,
1152
+ tag
1153
+ };
1154
+ state.inAnchor = state.inAnchor || tagName === "a";
1155
+ if (noInnerParse) {
1156
+ ast.text = capture[3];
1157
+ } else {
1158
+ const prevInHTML = state.inHTML;
1159
+ state.inHTML = true;
1160
+ ast.children = parseFunc(parse, trimmed, state);
1161
+ state.inHTML = prevInHTML;
1162
+ }
1163
+ state.inAnchor = false;
1164
+ return ast;
1165
+ },
1166
+ _render(node, _output, state = {}) {
1167
+ return h(
1168
+ node.tag,
1169
+ { key: state.key, ...node.attrs ?? {} },
1170
+ node.text ?? (node.children ? _output(node.children, state) : "")
1171
+ );
1172
+ }
1173
+ },
1174
+ [RuleType.htmlSelfClosing]: {
1175
+ _qualify: ["<"],
1176
+ /**
1177
+ * find the first matching end tag and process the interior
1178
+ */
1179
+ _match: anyScopeRegex(HTML_SELF_CLOSING_ELEMENT_R),
1180
+ _order: Priority.HIGH,
1181
+ _parse(capture) {
1182
+ const tag = capture[1].trim();
1183
+ return {
1184
+ attrs: attrStringToMap(tag, capture[2] || ""),
1185
+ tag
1186
+ };
1187
+ },
1188
+ _render(node, _output, state = {}) {
1189
+ return h(node.tag, {
1190
+ key: state.key,
1191
+ ...node.attrs ?? {}
1192
+ });
1193
+ }
1194
+ },
1195
+ [RuleType.htmlComment]: {
1196
+ _qualify: ["<!--"],
1197
+ _match: anyScopeRegex(HTML_COMMENT_R),
1198
+ _order: Priority.HIGH,
1199
+ _parse() {
1200
+ return {};
1201
+ },
1202
+ _render: renderNothing
1203
+ },
1204
+ [RuleType.customComponent]: {
1205
+ _qualify: (source) => {
1206
+ const match = source.match(/^ *<([A-Z][a-zA-Z0-9]*)/);
1207
+ return !!match;
1208
+ },
1209
+ _match: blockRegex(CUSTOM_COMPONENT_R),
1210
+ _order: Priority.MAX,
1211
+ _parse(capture, parse, state) {
1212
+ const m = capture[3].match(
1213
+ HTML_LEFT_TRIM_AMOUNT_R
1214
+ );
1215
+ const whitespace = m?.[1] ?? "";
1216
+ const trimmed = trimLeadingWhitespaceOutsideFences(
1217
+ capture[3],
1218
+ whitespace
1219
+ );
1220
+ const parseFunc = containsBlockSyntax(trimmed) ? parseBlock : parseInline;
1221
+ const tagName = capture[1];
1222
+ const noInnerParse = false;
1223
+ const ast = {
1224
+ attrs: attrStringToMap(tagName, capture[2] ?? ""),
1225
+ noInnerParse,
1226
+ tag: tagName
1227
+ };
1228
+ {
1229
+ const prevInHTML = state.inHTML;
1230
+ state.inHTML = true;
1231
+ const parsedChildren = parseFunc(parse, trimmed, state);
1232
+ ast.children = parsedChildren;
1233
+ state.inHTML = prevInHTML;
1234
+ }
1235
+ return ast;
1236
+ },
1237
+ _render(node, _output, state = {}) {
1238
+ const customComponent = getTag(node.tag, options.overrides ?? {});
1239
+ if (typeof customComponent === "function") {
1240
+ const renderedChildren = node.children ? _output(node.children, state) : null;
1241
+ return customComponent({
1242
+ key: state.key,
1243
+ ...node.attrs,
1244
+ children: renderedChildren
1245
+ });
1246
+ }
1247
+ return createElementFn(
1248
+ node.tag,
1249
+ { key: state.key, ...node.attrs },
1250
+ node.text ?? (node.children ? _output(node.children, state) : "")
1251
+ );
1252
+ }
1253
+ },
1254
+ [RuleType.image]: {
1255
+ _qualify: ["!["],
1256
+ _match: simpleInlineRegex(IMAGE_R),
1257
+ _order: Priority.HIGH,
1258
+ _parse(capture) {
1259
+ return {
1260
+ alt: unescape(capture[1]),
1261
+ target: unescape(capture[2]),
1262
+ title: unescape(capture[3])
1263
+ };
1264
+ },
1265
+ _render(node, _output, state = {}) {
1266
+ return /* @__PURE__ */ jsx(
1267
+ "img",
1268
+ {
1269
+ alt: node.alt ?? void 0,
1270
+ title: node.title ?? void 0,
1271
+ src: sanitize(node.target, "img", "src") ?? void 0
1272
+ },
1273
+ state.key
1274
+ );
1275
+ }
1276
+ },
1277
+ [RuleType.link]: {
1278
+ _qualify: ["["],
1279
+ _match: inlineRegex(LINK_R),
1280
+ _order: Priority.LOW,
1281
+ _parse(capture, parse, state) {
1282
+ return {
1283
+ children: parseSimpleInline(parse, capture[1], state),
1284
+ target: unescape(capture[2]),
1285
+ title: unescape(capture[3])
1286
+ };
1287
+ },
1288
+ _render(node, _output, state = {}) {
1289
+ return /* @__PURE__ */ jsx(
1290
+ "a",
1291
+ {
1292
+ href: sanitize(node.target, "a", "href") ?? void 0,
1293
+ title: node.title,
1294
+ children: _output(node.children, state)
1295
+ },
1296
+ state.key
1297
+ );
1298
+ }
1299
+ },
1300
+ // https://daringfireball.net/projects/markdown/syntax#autolink
1301
+ [RuleType.linkAngleBraceStyleDetector]: {
1302
+ _qualify: ["<"],
1303
+ _match: inlineRegex(LINK_AUTOLINK_R),
1304
+ _order: Priority.MAX,
1305
+ _parse(capture) {
1306
+ return {
1307
+ children: [
1308
+ {
1309
+ text: capture[1],
1310
+ type: RuleType.text
1311
+ }
1312
+ ],
1313
+ target: capture[1],
1314
+ type: RuleType.link
1315
+ };
1316
+ }
1317
+ },
1318
+ [RuleType.linkBareUrlDetector]: {
1319
+ _qualify: (source, state) => {
1320
+ if (state.inAnchor || options.disableAutoLink) return false;
1321
+ return startsWith(source, "http://") || startsWith(source, "https://");
1322
+ },
1323
+ _match: inlineRegex(LINK_AUTOLINK_BARE_URL_R),
1324
+ _order: Priority.MAX,
1325
+ _parse(capture) {
1326
+ return {
1327
+ children: [
1328
+ {
1329
+ text: capture[1],
1330
+ type: RuleType.text
1331
+ }
1332
+ ],
1333
+ target: capture[1],
1334
+ title: void 0,
1335
+ type: RuleType.link
1336
+ };
1337
+ }
1338
+ },
1339
+ [RuleType.linkMailtoDetector]: {
1340
+ _qualify: ["<"],
1341
+ _match: inlineRegex(LINK_AUTOLINK_MAILTO_R),
1342
+ _order: Priority.MAX,
1343
+ _parse(capture) {
1344
+ let address = capture[1];
1345
+ let target = capture[1];
1346
+ if (!AUTOLINK_MAILTO_CHECK_R.test(target)) {
1347
+ target = "mailto:" + target;
1348
+ }
1349
+ return {
1350
+ children: [
1351
+ {
1352
+ text: address.replace("mailto:", ""),
1353
+ type: RuleType.text
1354
+ }
1355
+ ],
1356
+ target,
1357
+ type: RuleType.link
1358
+ };
1359
+ }
1360
+ },
1361
+ [RuleType.orderedList]: generateListRule(
1362
+ ORDERED,
1363
+ (tag, props, ...children) => h(tag, props, ...children)
1364
+ ),
1365
+ [RuleType.unorderedList]: generateListRule(
1366
+ UNORDERED,
1367
+ (tag, props, ...children) => h(tag, props, ...children)
1368
+ ),
1369
+ [RuleType.newlineCoalescer]: {
1370
+ _match: blockRegex(CONSECUTIVE_NEWLINE_R),
1371
+ _order: Priority.LOW,
1372
+ _parse: captureNothing,
1373
+ _render() {
1374
+ return "\n";
1375
+ }
1376
+ },
1377
+ [RuleType.paragraph]: {
1378
+ _match: allowInline(matchParagraph),
1379
+ _order: Priority.LOW,
1380
+ _parse: parseCaptureInline,
1381
+ _render(node, _output, state = {}) {
1382
+ return /* @__PURE__ */ jsx("p", { children: _output(node.children, state) }, state.key);
1383
+ }
1384
+ },
1385
+ [RuleType.ref]: {
1386
+ _qualify: ["["],
1387
+ _match: inlineRegex(REFERENCE_IMAGE_OR_LINK),
1388
+ _order: Priority.MAX,
1389
+ _parse(capture) {
1390
+ refs[capture[1]] = {
1391
+ target: capture[2],
1392
+ title: capture[4]
1393
+ };
1394
+ return {};
1395
+ },
1396
+ _render: renderNothing
1397
+ },
1398
+ [RuleType.refImage]: {
1399
+ _qualify: ["!["],
1400
+ _match: simpleInlineRegex(REFERENCE_IMAGE_R),
1401
+ _order: Priority.MAX,
1402
+ _parse(capture) {
1403
+ return {
1404
+ alt: capture[1] ? unescape(capture[1]) : void 0,
1405
+ ref: capture[2]
1406
+ };
1407
+ },
1408
+ _render(node, _output, state = {}) {
1409
+ return refs[node.ref] ? /* @__PURE__ */ jsx(
1410
+ "img",
1411
+ {
1412
+ alt: node.alt,
1413
+ src: sanitize(refs[node.ref].target, "img", "src") ?? void 0,
1414
+ title: refs[node.ref].title
1415
+ },
1416
+ state.key
1417
+ ) : null;
1418
+ }
1419
+ },
1420
+ [RuleType.refLink]: {
1421
+ _qualify: (source) => source[0] === "[" && source.indexOf("](") === -1,
1422
+ _match: inlineRegex(REFERENCE_LINK_R),
1423
+ _order: Priority.MAX,
1424
+ _parse(capture, parse, state) {
1425
+ return {
1426
+ children: parse(capture[1], state),
1427
+ fallbackChildren: capture[0],
1428
+ ref: capture[2]
1429
+ };
1430
+ },
1431
+ _render(node, _output, state = {}) {
1432
+ return refs[node.ref] ? /* @__PURE__ */ jsx(
1433
+ "a",
1434
+ {
1435
+ href: sanitize(refs[node.ref].target, "a", "href") ?? void 0,
1436
+ title: refs[node.ref].title,
1437
+ children: _output(node.children, state)
1438
+ },
1439
+ state.key
1440
+ ) : /* @__PURE__ */ jsx("span", { children: node.fallbackChildren }, state.key);
1441
+ }
1442
+ },
1443
+ [RuleType.table]: {
1444
+ _qualify: ["|"],
1445
+ _match: blockRegex(NP_TABLE_R),
1446
+ _order: Priority.HIGH,
1447
+ _parse: parseTable,
1448
+ _render(node, _output, state = {}) {
1449
+ const table = node;
1450
+ return h(
1451
+ "table",
1452
+ { key: state.key },
1453
+ h(
1454
+ "thead",
1455
+ {},
1456
+ h(
1457
+ "tr",
1458
+ {},
1459
+ ...table.header.map(
1460
+ (content, i) => h(
1461
+ "th",
1462
+ { key: i, style: getTableStyle(table, i) },
1463
+ _output(content, state)
1464
+ )
1465
+ )
1466
+ )
1467
+ ),
1468
+ h(
1469
+ "tbody",
1470
+ {},
1471
+ ...table.cells.map(
1472
+ (row, i) => h(
1473
+ "tr",
1474
+ { key: i },
1475
+ ...row.map(
1476
+ (content, c) => h(
1477
+ "td",
1478
+ { key: c, style: getTableStyle(table, c) },
1479
+ _output(content, state)
1480
+ )
1481
+ )
1482
+ )
1483
+ )
1484
+ )
1485
+ );
1486
+ }
1487
+ },
1488
+ [RuleType.text]: {
1489
+ // Here we look for anything followed by non-symbols,
1490
+ // double newlines, or double-space-newlines
1491
+ // We break on any symbol characters so that this grammar
1492
+ // is easy to extend without needing to modify this regex
1493
+ _match: allowInline((source, _state) => {
1494
+ let ret;
1495
+ if (startsWith(source, ":")) ret = SHORTCODE_R.exec(source);
1496
+ if (ret) return ret;
1497
+ return TEXT_PLAIN_R.exec(source);
1498
+ }),
1499
+ _order: Priority.MIN,
1500
+ _parse(capture) {
1501
+ const text = capture[0];
1502
+ return {
1503
+ text: text.indexOf("&") === -1 ? text : text.replace(
1504
+ HTML_CHAR_CODE_R,
1505
+ (full, inner) => options.namedCodesToUnicode?.[inner] ?? full
1506
+ )
1507
+ };
1508
+ },
1509
+ _render(node) {
1510
+ return node.text;
1511
+ }
1512
+ },
1513
+ [RuleType.textBolded]: {
1514
+ _qualify: ["**", "__"],
1515
+ _match: simpleInlineRegex(TEXT_BOLD_R),
1516
+ _order: Priority.MED,
1517
+ _parse(capture, parse, state) {
1518
+ return {
1519
+ // capture[1] -> the syntax control character
1520
+ // capture[2] -> inner content
1521
+ children: parse(capture[2], state)
1522
+ };
1523
+ },
1524
+ _render(node, _output, state = {}) {
1525
+ return /* @__PURE__ */ jsx("strong", { children: _output(node.children, state) }, state.key);
1526
+ }
1527
+ },
1528
+ [RuleType.textEmphasized]: {
1529
+ _qualify: (source) => {
1530
+ const char = source[0];
1531
+ return (char === "*" || char === "_") && source[1] !== char;
1532
+ },
1533
+ _match: simpleInlineRegex(TEXT_EMPHASIZED_R),
1534
+ _order: Priority.LOW,
1535
+ _parse(capture, parse, state) {
1536
+ return {
1537
+ // capture[1] -> opening * or _
1538
+ // capture[2] -> inner content
1539
+ children: parse(capture[2], state)
1540
+ };
1541
+ },
1542
+ _render(node, _output, state = {}) {
1543
+ return /* @__PURE__ */ jsx("em", { children: _output(node.children, state) }, state.key);
1544
+ }
1545
+ },
1546
+ [RuleType.textEscaped]: {
1547
+ _qualify: ["\\"],
1548
+ // We don't allow escaping numbers, letters, or spaces here so that
1549
+ // backslashes used in plain text still get rendered. But allowing
1550
+ // escaping anything else provides a very flexible escape mechanism,
1551
+ // regardless of how this grammar is extended.
1552
+ _match: simpleInlineRegex(TEXT_ESCAPED_R),
1553
+ _order: Priority.HIGH,
1554
+ _parse(capture) {
1555
+ return {
1556
+ text: capture[1],
1557
+ type: RuleType.text
1558
+ };
1559
+ }
1560
+ },
1561
+ [RuleType.textMarked]: {
1562
+ _qualify: ["=="],
1563
+ _match: simpleInlineRegex(TEXT_MARKED_R),
1564
+ _order: Priority.LOW,
1565
+ _parse: parseCaptureInline,
1566
+ _render(node, _output, state = {}) {
1567
+ return /* @__PURE__ */ jsx("mark", { children: _output(node.children, state) }, state.key);
1568
+ }
1569
+ },
1570
+ [RuleType.textStrikethroughed]: {
1571
+ _qualify: ["~~"],
1572
+ _match: simpleInlineRegex(TEXT_STRIKETHROUGHED_R),
1573
+ _order: Priority.LOW,
1574
+ _parse: parseCaptureInline,
1575
+ _render(node, _output, state = {}) {
1576
+ return /* @__PURE__ */ jsx("del", { children: _output(node.children, state) }, state.key);
1577
+ }
1578
+ }
1579
+ };
1580
+ if (options.disableParsingRawHTML === true) {
1581
+ delete rules[RuleType.htmlBlock];
1582
+ delete rules[RuleType.htmlSelfClosing];
1583
+ }
1584
+ const parser = parserFor(rules);
1585
+ const emitter = reactFor(createRenderer(rules, options.renderRule));
1586
+ const jsx2 = compile(markdown);
1587
+ if (footnotes.length) {
1588
+ return /* @__PURE__ */ jsxs("div", { children: [
1589
+ jsx2,
1590
+ /* @__PURE__ */ jsx("footer", { children: footnotes.map((def) => /* @__PURE__ */ jsxs("div", { id: slug(def.identifier, slugify), children: [
1591
+ def.identifier,
1592
+ emitter(
1593
+ parser(def.footnote, { inline: true })
1594
+ )
1595
+ ] }, def.identifier)) }, "footer")
1596
+ ] });
1597
+ }
1598
+ return jsx2;
1599
+ };
1600
+ const MarkdownProcessor = ({ children = "", options, ...props }) => {
1601
+ if (define_process_env_default.NODE_ENV !== "production" && typeof children !== "string") {
1602
+ console.error(
1603
+ "intlayer: <Markdown> component only accepts a single string as a child, received:",
1604
+ children
1605
+ );
1606
+ }
1607
+ return cloneElement(
1608
+ compiler(children, options),
1609
+ props
1610
+ );
1611
+ };
1612
+ export {
1613
+ MarkdownProcessor,
1614
+ RuleType,
1615
+ compiler,
1616
+ sanitizer,
1617
+ slugify
1618
+ };
1619
+ //# sourceMappingURL=processer.mjs.map