@ai-react-markdown/mantine 1.1.0 → 1.2.5

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Brian Lee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @ai-react-markdown/mantine
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@ai-react-markdown/mantine)](https://www.npmjs.com/package/@ai-react-markdown/mantine)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@ai-react-markdown/mantine)](https://www.npmjs.com/package/@ai-react-markdown/mantine)
5
+ [![license](https://img.shields.io/npm/l/@ai-react-markdown/mantine)](../../LICENSE)
6
+
3
7
  Mantine UI integration for `@ai-react-markdown/core`. Provides a drop-in `<MantineAIMarkdown>` component that renders AI-generated markdown with Mantine-themed typography, syntax-highlighted code blocks, mermaid diagram support, and automatic color scheme detection.
4
8
 
5
9
  ## What It Adds on Top of Core
@@ -7,7 +11,6 @@ Mantine UI integration for `@ai-react-markdown/core`. Provides a drop-in `<Manti
7
11
  - **Mantine typography** -- uses Mantine's `<Typography>` component for consistent theming
8
12
  - **Code highlighting** -- renders code blocks with `@mantine/code-highlight` (powered by highlight.js), including tabbed views with language labels, expand/collapse, and optional auto-detection for unlabeled blocks
9
13
  - **Mermaid diagrams** -- `mermaid` code blocks are rendered as interactive SVG diagrams with dark/light theme support, toggle to source view, copy, and open-in-new-window
10
- - **Same font size mode** -- `forceSameFontSize` config flattens all heading levels to body text size, useful in compact layouts like chat bubbles
11
14
  - **Automatic color scheme** -- detects Mantine's computed color scheme (`useComputedColorScheme`) and passes it to the core renderer automatically
12
15
  - **Mantine-scoped CSS** -- extra styles wrapper overrides Mantine spacing/font-size custom properties to use relative `em` units, ensuring consistent scaling at any base font size
13
16
 
@@ -117,17 +120,15 @@ Inherits all core config fields plus:
117
120
 
118
121
  | Field | Type | Default | Description |
119
122
  | ------------------------------------- | --------- | ------- | ------------------------------------------------------------------- |
120
- | `forceSameFontSize` | `boolean` | `false` | Render all headings at the same size as body text. |
121
123
  | `codeBlock.defaultExpanded` | `boolean` | `true` | Whether code blocks start expanded. |
122
124
  | `codeBlock.autoDetectUnknownLanguage` | `boolean` | `false` | Use highlight.js to auto-detect language for unlabeled code blocks. |
123
125
 
124
- ### Example: Compact Chat Mode
126
+ ### Example: Collapsed Code Blocks
125
127
 
126
128
  ```tsx
127
129
  <MantineAIMarkdown
128
130
  content={markdown}
129
131
  config={{
130
- forceSameFontSize: true,
131
132
  codeBlock: { defaultExpanded: false },
132
133
  }}
133
134
  />
@@ -145,7 +146,6 @@ import { useMantineAIMarkdownRenderState } from '@ai-react-markdown/mantine';
145
146
  function MyCodeBlock() {
146
147
  const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();
147
148
  const isExpanded = config.codeBlock.defaultExpanded;
148
- const isSameSize = config.forceSameFontSize;
149
149
  // ...
150
150
  }
151
151
  ```
package/dist/index.cjs CHANGED
@@ -48,29 +48,21 @@ var import_core6 = require("@ai-react-markdown/core");
48
48
  var import_react = require("react");
49
49
  var import_core = require("@mantine/core");
50
50
  var import_jsx_runtime = require("react/jsx-runtime");
51
- var MantineAIMarkdownTypography = (0, import_react.memo)(({ children, fontSize }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Typography, { w: "100%", fz: fontSize, children }));
51
+ var MantineAIMarkdownTypography = (0, import_react.memo)(({ children, fontSize, style }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Typography, { w: "100%", fz: fontSize, style, children }));
52
52
  MantineAIMarkdownTypography.displayName = "MantineAIMarkdownTypography";
53
53
  var MantineTypography_default = MantineAIMarkdownTypography;
54
54
 
55
- // src/hooks/useMantineAIMarkdownRenderState.ts
56
- var import_core2 = require("@ai-react-markdown/core");
57
- var useMantineAIMarkdownRenderState = () => {
58
- return (0, import_core2.useAIMarkdownRenderState)();
59
- };
60
-
61
55
  // src/components/extra-styles/DefaultExtraStyles/index.tsx
62
56
  var import_jsx_runtime2 = require("react/jsx-runtime");
63
57
  var MantineAIMDefaultExtraStyles = ({ children }) => {
64
- const renderState = useMantineAIMarkdownRenderState();
65
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `aim-mantine-extra-styles${renderState.config.forceSameFontSize ? " same-font-size" : ""}`, children });
58
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "aim-mantine-extra-styles", children });
66
59
  };
67
60
  var DefaultExtraStyles_default = MantineAIMDefaultExtraStyles;
68
61
 
69
62
  // src/defs.tsx
70
- var import_core3 = require("@ai-react-markdown/core");
63
+ var import_core2 = require("@ai-react-markdown/core");
71
64
  var defaultMantineAIMarkdownRenderConfig = Object.freeze({
72
- ...import_core3.defaultAIMarkdownRenderConfig,
73
- forceSameFontSize: false,
65
+ ...import_core2.defaultAIMarkdownRenderConfig,
74
66
  codeBlock: Object.freeze({
75
67
  defaultExpanded: true,
76
68
  autoDetectUnknownLanguage: false
@@ -83,11 +75,231 @@ var import_code_highlight2 = require("@mantine/code-highlight");
83
75
  var import_deep_parse_json = require("deep-parse-json");
84
76
  var import_highlight = __toESM(require("highlight.js"), 1);
85
77
 
78
+ // src/hooks/useMantineAIMarkdownRenderState.ts
79
+ var import_core3 = require("@ai-react-markdown/core");
80
+ var useMantineAIMarkdownRenderState = () => {
81
+ return (0, import_core3.useAIMarkdownRenderState)();
82
+ };
83
+
86
84
  // src/components/customized/MermaidCode/index.tsx
87
85
  var import_react2 = require("react");
88
86
  var import_code_highlight = require("@mantine/code-highlight");
89
87
  var import_core4 = require("@mantine/core");
90
- var import_debounce = __toESM(require("lodash-es/debounce"), 1);
88
+
89
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.js
90
+ function isObject(value) {
91
+ var type = typeof value;
92
+ return value != null && (type == "object" || type == "function");
93
+ }
94
+ var isObject_default = isObject;
95
+
96
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js
97
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
98
+ var freeGlobal_default = freeGlobal;
99
+
100
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.js
101
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
102
+ var root = freeGlobal_default || freeSelf || Function("return this")();
103
+ var root_default = root;
104
+
105
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/now.js
106
+ var now = function() {
107
+ return root_default.Date.now();
108
+ };
109
+ var now_default = now;
110
+
111
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js
112
+ var reWhitespace = /\s/;
113
+ function trimmedEndIndex(string) {
114
+ var index = string.length;
115
+ while (index-- && reWhitespace.test(string.charAt(index))) {
116
+ }
117
+ return index;
118
+ }
119
+ var trimmedEndIndex_default = trimmedEndIndex;
120
+
121
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js
122
+ var reTrimStart = /^\s+/;
123
+ function baseTrim(string) {
124
+ return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
125
+ }
126
+ var baseTrim_default = baseTrim;
127
+
128
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js
129
+ var Symbol2 = root_default.Symbol;
130
+ var Symbol_default = Symbol2;
131
+
132
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js
133
+ var objectProto = Object.prototype;
134
+ var hasOwnProperty = objectProto.hasOwnProperty;
135
+ var nativeObjectToString = objectProto.toString;
136
+ var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
137
+ function getRawTag(value) {
138
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
139
+ try {
140
+ value[symToStringTag] = void 0;
141
+ var unmasked = true;
142
+ } catch (e) {
143
+ }
144
+ var result = nativeObjectToString.call(value);
145
+ if (unmasked) {
146
+ if (isOwn) {
147
+ value[symToStringTag] = tag;
148
+ } else {
149
+ delete value[symToStringTag];
150
+ }
151
+ }
152
+ return result;
153
+ }
154
+ var getRawTag_default = getRawTag;
155
+
156
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js
157
+ var objectProto2 = Object.prototype;
158
+ var nativeObjectToString2 = objectProto2.toString;
159
+ function objectToString(value) {
160
+ return nativeObjectToString2.call(value);
161
+ }
162
+ var objectToString_default = objectToString;
163
+
164
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js
165
+ var nullTag = "[object Null]";
166
+ var undefinedTag = "[object Undefined]";
167
+ var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
168
+ function baseGetTag(value) {
169
+ if (value == null) {
170
+ return value === void 0 ? undefinedTag : nullTag;
171
+ }
172
+ return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
173
+ }
174
+ var baseGetTag_default = baseGetTag;
175
+
176
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js
177
+ function isObjectLike(value) {
178
+ return value != null && typeof value == "object";
179
+ }
180
+ var isObjectLike_default = isObjectLike;
181
+
182
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js
183
+ var symbolTag = "[object Symbol]";
184
+ function isSymbol(value) {
185
+ return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
186
+ }
187
+ var isSymbol_default = isSymbol;
188
+
189
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js
190
+ var NAN = 0 / 0;
191
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
192
+ var reIsBinary = /^0b[01]+$/i;
193
+ var reIsOctal = /^0o[0-7]+$/i;
194
+ var freeParseInt = parseInt;
195
+ function toNumber(value) {
196
+ if (typeof value == "number") {
197
+ return value;
198
+ }
199
+ if (isSymbol_default(value)) {
200
+ return NAN;
201
+ }
202
+ if (isObject_default(value)) {
203
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
204
+ value = isObject_default(other) ? other + "" : other;
205
+ }
206
+ if (typeof value != "string") {
207
+ return value === 0 ? value : +value;
208
+ }
209
+ value = baseTrim_default(value);
210
+ var isBinary = reIsBinary.test(value);
211
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
212
+ }
213
+ var toNumber_default = toNumber;
214
+
215
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/debounce.js
216
+ var FUNC_ERROR_TEXT = "Expected a function";
217
+ var nativeMax = Math.max;
218
+ var nativeMin = Math.min;
219
+ function debounce(func, wait, options) {
220
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
221
+ if (typeof func != "function") {
222
+ throw new TypeError(FUNC_ERROR_TEXT);
223
+ }
224
+ wait = toNumber_default(wait) || 0;
225
+ if (isObject_default(options)) {
226
+ leading = !!options.leading;
227
+ maxing = "maxWait" in options;
228
+ maxWait = maxing ? nativeMax(toNumber_default(options.maxWait) || 0, wait) : maxWait;
229
+ trailing = "trailing" in options ? !!options.trailing : trailing;
230
+ }
231
+ function invokeFunc(time) {
232
+ var args = lastArgs, thisArg = lastThis;
233
+ lastArgs = lastThis = void 0;
234
+ lastInvokeTime = time;
235
+ result = func.apply(thisArg, args);
236
+ return result;
237
+ }
238
+ function leadingEdge(time) {
239
+ lastInvokeTime = time;
240
+ timerId = setTimeout(timerExpired, wait);
241
+ return leading ? invokeFunc(time) : result;
242
+ }
243
+ function remainingWait(time) {
244
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
245
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
246
+ }
247
+ function shouldInvoke(time) {
248
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
249
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
250
+ }
251
+ function timerExpired() {
252
+ var time = now_default();
253
+ if (shouldInvoke(time)) {
254
+ return trailingEdge(time);
255
+ }
256
+ timerId = setTimeout(timerExpired, remainingWait(time));
257
+ }
258
+ function trailingEdge(time) {
259
+ timerId = void 0;
260
+ if (trailing && lastArgs) {
261
+ return invokeFunc(time);
262
+ }
263
+ lastArgs = lastThis = void 0;
264
+ return result;
265
+ }
266
+ function cancel() {
267
+ if (timerId !== void 0) {
268
+ clearTimeout(timerId);
269
+ }
270
+ lastInvokeTime = 0;
271
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
272
+ }
273
+ function flush() {
274
+ return timerId === void 0 ? result : trailingEdge(now_default());
275
+ }
276
+ function debounced() {
277
+ var time = now_default(), isInvoking = shouldInvoke(time);
278
+ lastArgs = arguments;
279
+ lastThis = this;
280
+ lastCallTime = time;
281
+ if (isInvoking) {
282
+ if (timerId === void 0) {
283
+ return leadingEdge(lastCallTime);
284
+ }
285
+ if (maxing) {
286
+ clearTimeout(timerId);
287
+ timerId = setTimeout(timerExpired, wait);
288
+ return invokeFunc(lastCallTime);
289
+ }
290
+ }
291
+ if (timerId === void 0) {
292
+ timerId = setTimeout(timerExpired, wait);
293
+ }
294
+ return result;
295
+ }
296
+ debounced.cancel = cancel;
297
+ debounced.flush = flush;
298
+ return debounced;
299
+ }
300
+ var debounce_default = debounce;
301
+
302
+ // src/components/customized/MermaidCode/index.tsx
91
303
  var import_mermaid = __toESM(require("mermaid"), 1);
92
304
  var import_jsx_runtime3 = require("react/jsx-runtime");
93
305
  var generateMermaidUUID = () => {
@@ -113,7 +325,7 @@ var MantineAIMMermaidCode = (0, import_react2.memo)((props) => {
113
325
  const [renderError, setRenderError] = (0, import_react2.useState)(false);
114
326
  const [chartType, setChartType] = (0, import_react2.useState)("unknown");
115
327
  const debouncedUpdateRenderError = (0, import_react2.useMemo)(
116
- () => (0, import_debounce.default)((error) => {
328
+ () => debounce_default((error) => {
117
329
  setRenderError(error);
118
330
  }, 200),
119
331
  []
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.tsx","../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/hooks/useMantineAIMarkdownRenderState.ts","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/defs.tsx","../src/components/customized/PreCode.tsx","../src/components/customized/MermaidCode/index.tsx","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["/**\n * Public API surface for `@ai-react-markdown/mantine`.\n *\n * Re-exports the Mantine-integrated AI markdown component, its supporting\n * sub-components, extended types, default configuration, and typed hooks.\n *\n * @packageDocumentation\n */\n\n// --- Components ---\n\n/** Props for the main {@link MantineAIMarkdown} component. */\nexport type { MantineAIMarkdownProps } from './MantineAIMarkdown';\n\n/** Main component -- Mantine-integrated AI markdown renderer (default export). */\nexport { default } from './MantineAIMarkdown';\n\n/** Mantine-themed typography wrapper used by default inside {@link MantineAIMarkdown}. */\nexport { default as MantineAIMarkdownTypography } from './components/typography/MantineTypography';\n\n/** Default extra styles wrapper providing Mantine-compatible CSS scoping and overrides. */\nexport { default as MantineAIMDefaultExtraStyles } from './components/extra-styles/DefaultExtraStyles';\n\n// --- Types, config, and hooks ---\n\n/** Extended render configuration and metadata types for the Mantine integration. */\nexport type { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata } from './defs';\n\n/** Default Mantine render configuration (frozen). */\nexport { defaultMantineAIMarkdownRenderConfig } from './defs';\n\n/** Typed hook for accessing render state with Mantine-specific config fields. */\nexport { useMantineAIMarkdownRenderState } from './hooks/useMantineAIMarkdownRenderState';\n\n/** Typed hook for accessing metadata within the Mantine AI markdown tree. */\nexport { useMantineAIMarkdownMetadata } from './hooks/useMantineAIMarkdownMetadata';\n","/**\n * Main Mantine integration component for AI markdown rendering.\n *\n * Wraps the core {@link AIMarkdown} component with Mantine-specific defaults:\n * - {@link MantineAIMarkdownTypography} as the typography wrapper\n * - {@link MantineAIMDefaultExtraStyles} as the extra styles wrapper\n * - {@link MantineAIMPreCode} as the default `<pre>` component (with syntax\n * highlighting via Mantine's CodeHighlight and mermaid diagram support)\n * - Automatic color scheme detection via Mantine's `useComputedColorScheme`\n *\n * @module MantineAIMarkdown\n */\n\nimport { memo, useMemo } from 'react';\nimport AIMarkdown from '@ai-react-markdown/core';\nimport { type AIMarkdownProps, type AIMarkdownCustomComponents, useStableValue } from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata, defaultMantineAIMarkdownRenderConfig } from './defs';\nimport MantineAIMPreCode from './components/customized/PreCode';\nimport { useComputedColorScheme } from '@mantine/core';\n\n/**\n * Props for the {@link MantineAIMarkdown} component.\n *\n * Extends {@link AIMarkdownProps} with Mantine-specific config and metadata generics.\n * All core props (`content`, `streaming`, `fontSize`, `config`, etc.) are inherited.\n *\n * @typeParam TConfig - Render configuration type, defaults to {@link MantineAIMarkdownRenderConfig}.\n * @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TConfig, TRenderData> {}\n\n/**\n * Default custom component overrides applied by the Mantine integration.\n *\n * Overrides the `<pre>` element to extract code blocks and render them via\n * {@link MantineAIMPreCode}, which provides syntax highlighting, expand/collapse,\n * and mermaid diagram support. Falls back to a plain `<pre>` when the child\n * is not a recognized code element.\n */\nconst DefaultCustomComponents: AIMarkdownCustomComponents = {\n pre: ({ node, ...usefulProps }) => {\n const code = node?.children[0] as\n | { type: string; tagName?: string; position?: { start?: { offset?: number } }; properties?: Record<string, unknown>; children: { value?: string }[] }\n | undefined;\n if (!code || code.type !== 'element' || code.tagName !== 'code' || !code.position) {\n return <pre {...usefulProps} />;\n }\n const key = `pre-code-${node?.position?.start?.offset || 0}`;\n const detectedLanguage = (code.properties?.className as string[])\n ?.find((className: string) => className.startsWith('language-'))\n ?.substring('language-'.length);\n const codeText = code.children\n .map((child: { value?: string }) => child.value ?? '')\n .join('\\n');\n return <MantineAIMPreCode key={key} codeText={codeText} existLanguage={detectedLanguage} />;\n },\n};\n\n/**\n * Inner (non-memoized) implementation of the Mantine AI markdown component.\n *\n * Merges caller-provided `customComponents` with the Mantine defaults (the caller's\n * overrides take precedence). Automatically resolves the color scheme from Mantine's\n * `useComputedColorScheme` when no explicit `colorScheme` prop is provided.\n *\n * @typeParam TConfig - Render configuration type.\n * @typeParam TRenderData - Metadata type.\n */\nconst MantineAIMarkdownComponent = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n defaultConfig = defaultMantineAIMarkdownRenderConfig as TConfig,\n customComponents,\n colorScheme,\n ...props\n}: MantineAIMarkdownProps<TConfig, TRenderData>) => {\n const stableCustomComponents = useStableValue(customComponents);\n\n const usedComponents = useMemo(() => {\n return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;\n }, [stableCustomComponents]);\n\n const computedColorScheme = useComputedColorScheme('light');\n\n return (\n <AIMarkdown<MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n defaultConfig={defaultConfig}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n );\n};\n\n/**\n * Mantine-integrated AI markdown renderer.\n *\n * A memoized wrapper around the core `<AIMarkdown>` component that provides\n * Mantine-themed typography, code highlighting (via `@mantine/code-highlight`),\n * mermaid diagram rendering, and automatic color scheme detection.\n *\n * This is the default export of `@ai-react-markdown/mantine`.\n *\n * @example\n * ```tsx\n * import MantineAIMarkdown from '@ai-react-markdown/mantine';\n *\n * function Chat({ content }: { content: string }) {\n * return <MantineAIMarkdown content={content} />;\n * }\n * ```\n */\nexport const MantineAIMarkdown = memo(MantineAIMarkdownComponent);\n\nMantineAIMarkdown.displayName = 'MantineAIMarkdown';\n\nexport default MantineAIMarkdown as typeof MantineAIMarkdownComponent;\n","import { memo } from 'react';\nimport { Typography } from '@mantine/core';\nimport type { AIMarkdownTypographyProps } from '@ai-react-markdown/core';\n\n/**\n * Mantine-themed typography wrapper for AI markdown content.\n *\n * Replaces the core default typography component with Mantine's `<Typography>`\n * element, applying the configured `fontSize` at full width. This ensures all\n * rendered markdown inherits Mantine's font family, line height, and theming.\n *\n * Used as the default `Typography` prop in {@link MantineAIMarkdown}.\n * Can be replaced by passing a custom `Typography` component.\n *\n * @param props - Standard {@link AIMarkdownTypographyProps} from the core package.\n */\nconst MantineAIMarkdownTypography = memo(({ children, fontSize }: AIMarkdownTypographyProps) => (\n <Typography w=\"100%\" fz={fontSize}>\n {children}\n </Typography>\n));\n\nMantineAIMarkdownTypography.displayName = 'MantineAIMarkdownTypography';\n\nexport default MantineAIMarkdownTypography;\n","import { useAIMarkdownRenderState } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownRenderConfig } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownRenderState} hook.\n *\n * Returns the current {@link AIMarkdownRenderState} defaulting to\n * {@link MantineAIMarkdownRenderConfig}. Accepts an optional generic parameter\n * for further extension, giving consumers direct access to Mantine-specific\n * config fields (`forceSameFontSize`, `codeBlock`, etc.) without manual annotation.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n * Throws if called outside the provider boundary.\n *\n * @typeParam TConfig - Config type (defaults to {@link MantineAIMarkdownRenderConfig}).\n * @returns The current render state typed with `TConfig`.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();\n * const isExpanded = config.codeBlock.defaultExpanded;\n * // ...\n * }\n * ```\n */\nexport const useMantineAIMarkdownRenderState = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n>() => {\n return useAIMarkdownRenderState<TConfig>();\n};\n","import { AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Default extra styles wrapper for the Mantine integration.\n *\n * Wraps markdown content in a `<div>` with the `aim-mantine-extra-styles` CSS class,\n * which provides Mantine-compatible typography overrides including:\n * - Relative `em`-based Mantine spacing and font-size CSS custom properties\n * - Heading, list, paragraph, blockquote, and code styling\n * - Definition list layout\n *\n * When {@link MantineAIMarkdownRenderConfig.forceSameFontSize} is enabled, the\n * `same-font-size` class is appended, overriding all heading levels to render\n * at the same size as body text.\n *\n * Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}.\n */\nconst MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent = ({ children }) => {\n const renderState = useMantineAIMarkdownRenderState();\n return (\n <div className={`aim-mantine-extra-styles${renderState.config.forceSameFontSize ? ' same-font-size' : ''}`}>\n {children}\n </div>\n );\n};\n\nexport default MantineAIMDefaultExtraStyles;\n","/**\n * Mantine-specific type definitions and default configuration.\n *\n * Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}\n * with Mantine-themed options such as uniform heading sizes and code block behavior.\n *\n * @module defs\n */\n\nimport { AIMarkdownRenderConfig, AIMarkdownMetadata, defaultAIMarkdownRenderConfig } from '@ai-react-markdown/core';\n\n/**\n * Extended render configuration for the Mantine integration.\n *\n * Inherits all core config fields (extra syntax, display optimizations) and adds\n * Mantine-specific options for typography sizing and code block behavior.\n */\nexport interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {\n /**\n * When `true`, all heading levels (h1-h6) are rendered at the same font size\n * as body text. Useful in compact UI contexts like chat bubbles.\n *\n * @default false\n */\n forceSameFontSize: boolean;\n\n /** Code block rendering options. */\n codeBlock: {\n /**\n * Whether code blocks start in their expanded state.\n * When `false`, long code blocks are collapsed with an expand button.\n *\n * @default true\n */\n defaultExpanded: boolean;\n\n /**\n * When `true`, uses `highlight.js` auto-detection to determine the language\n * of code blocks that lack an explicit language annotation.\n *\n * @default false\n */\n autoDetectUnknownLanguage: boolean;\n };\n}\n\n/**\n * Default Mantine render configuration.\n *\n * Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.\n * Frozen to prevent accidental mutation.\n */\nexport const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig = Object.freeze({\n ...defaultAIMarkdownRenderConfig,\n forceSameFontSize: false,\n codeBlock: Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\n }),\n});\n\n/**\n * Metadata type for the Mantine integration.\n *\n * Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point\n * so that consumers can augment metadata in Mantine-specific wrappers without\n * needing to reference the core type directly.\n */\nexport interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {}\n","'use client';\n\nimport { HTMLAttributes, memo, useMemo } from 'react';\nimport { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { deepParseJson } from 'deep-parse-json';\nimport hljs from 'highlight.js';\nimport { useMantineAIMarkdownRenderState } from '../../hooks/useMantineAIMarkdownRenderState';\nimport MantineAIMMermaidCode from './MermaidCode';\n\n/**\n * Code languages that receive specialized rendering instead of standard\n * syntax-highlighted code blocks. Adding a new member here automatically\n * marks that language as \"special\" — you only need to add the corresponding\n * rendering branch in the component's return.\n */\nenum SpecialCodeLanguage {\n /** Rendered as interactive diagrams via {@link MantineAIMMermaidCode} */\n Mermaid = 'mermaid',\n}\n\n/** O(1) lookup set, derived from {@link SpecialCodeLanguage}. */\nconst SPECIAL_LANGUAGES = new Set<string>(Object.values(SpecialCodeLanguage));\n\n/**\n * Mantine code block renderer for `<pre>` elements.\n *\n * Replaces the default `<pre>` rendering with Mantine's {@link CodeHighlight} or\n * {@link CodeHighlightTabs} components, providing syntax highlighting, expand/collapse\n * behavior, and file-name tabs.\n *\n * Behavior:\n * - If the code block has an explicit language annotation, uses that language.\n * - If no language is specified and `config.codeBlock.autoDetectUnknownLanguage` is\n * enabled, uses `highlight.js` auto-detection.\n * - Mermaid code blocks (`language-mermaid`) are rendered as interactive diagrams\n * via {@link MantineAIMMermaidCode}.\n * - JSON code blocks are deep-parsed and pretty-printed before display.\n * - Unrecognized languages render as plaintext with an \"unknown\" label using\n * {@link CodeHighlight} (no tabs).\n * - Recognized languages render with {@link CodeHighlightTabs} showing the\n * language name as the tab label.\n *\n * @param props.codeText - The raw text content of the code block.\n * @param props.existLanguage - Language identifier extracted from the `language-*` CSS class, if present.\n */\nconst MantineAIMPreCode = memo(\n (\n props: HTMLAttributes<HTMLPreElement> & {\n codeText: string;\n existLanguage?: string;\n }\n ) => {\n const renderState = useMantineAIMarkdownRenderState();\n\n const codeLanguage = useMemo(() => {\n if (props.existLanguage) return props.existLanguage;\n if (renderState.config.codeBlock.autoDetectUnknownLanguage) {\n return hljs.highlightAuto(props.codeText).language || '';\n }\n return '';\n }, [props.existLanguage, props.codeText, renderState.config.codeBlock.autoDetectUnknownLanguage]);\n\n const [usedCodeLanguage, usedFileName] = useMemo(() => {\n if (!codeLanguage) return ['plaintext', 'unknown'];\n if (!hljs.getLanguage(codeLanguage)) {\n return ['plaintext', codeLanguage];\n }\n return [codeLanguage, codeLanguage];\n }, [codeLanguage]);\n\n const isSpecialCodeBlock = SPECIAL_LANGUAGES.has(codeLanguage);\n\n const normalCodeBlockContent = useMemo(() => {\n if (isSpecialCodeBlock) return null;\n let usedCodeStr = props.codeText;\n if (usedCodeStr && usedCodeLanguage.toLowerCase() === 'json') {\n const deepParsedResult = deepParseJson(usedCodeStr);\n usedCodeStr =\n typeof deepParsedResult === 'string' ? deepParsedResult : JSON.stringify(deepParsedResult, null, 2);\n }\n return usedFileName === 'unknown' ? (\n <CodeHighlight\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [\n isSpecialCodeBlock,\n props.codeText,\n usedCodeLanguage,\n usedFileName,\n renderState.fontSize,\n renderState.config.codeBlock.defaultExpanded,\n ]);\n\n const specialCodeBlockContent = useMemo(() => {\n switch (codeLanguage) {\n case SpecialCodeLanguage.Mermaid:\n return <MantineAIMMermaidCode code={props.codeText} />;\n default:\n return null;\n }\n }, [codeLanguage, props.codeText]);\n\n return isSpecialCodeBlock ? specialCodeBlockContent : normalCodeBlockContent;\n }\n);\n\nMantineAIMPreCode.displayName = 'MantineAIMPreCode';\n\nexport default MantineAIMPreCode;\n","'use client';\n\nimport React, { memo, useMemo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport debounce from 'lodash-es/debounce';\nimport mermaid from 'mermaid';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Generate a unique ID for mermaid SVG rendering.\n * Combines a timestamp with a random suffix to avoid collisions when\n * multiple mermaid diagrams render concurrently.\n *\n * @returns A unique string in the format `mermaid-{timestamp}-{random}`.\n */\nconst generateMermaidUUID = () => {\n return `mermaid-${new Date().getTime()}-${Math.random().toString(36).slice(2, 10)}`;\n};\n\n/**\n * Open the rendered mermaid SVG in a new browser window.\n *\n * Clones the SVG element, applies a background color matching the current\n * color scheme, serializes it to an object URL, and opens it in a new tab.\n * The object URL is revoked after a short delay to free memory.\n *\n * @param svgElement - The rendered SVG element to view, or `null`/`undefined` to no-op.\n * @param isDark - Whether the current color scheme is dark (used for background color).\n */\nconst handleViewSVGInNewWindow = (svgElement: SVGElement | null | undefined, isDark: boolean) => {\n if (!svgElement) return;\n const targetSvg = svgElement.cloneNode(true) as SVGElement;\n targetSvg.style.backgroundColor = isDark ? '#242424' : 'white';\n const text = new XMLSerializer().serializeToString(targetSvg);\n const blob = new Blob([text], { type: 'image/svg+xml' });\n const url = URL.createObjectURL(blob);\n const win = window.open(url);\n if (win) {\n setTimeout(() => URL.revokeObjectURL(url), 5000);\n }\n};\n\n/**\n * Interactive mermaid diagram renderer.\n *\n * Parses and renders mermaid diagram source code into an inline SVG visualization.\n * Automatically adapts to the current Mantine color scheme (light/dark) by\n * re-initializing mermaid with the appropriate theme.\n *\n * Features:\n * - Live SVG rendering with automatic dark/light theme switching\n * - Fallback to raw source code display on parse/render errors\n * - Toggle between rendered diagram and raw mermaid source\n * - Click on the rendered diagram to open the SVG in a new browser window\n * - Copy button for the raw mermaid source code\n * - Chart type label extracted from mermaid's parse result\n * - Debounced error state to avoid flickering during rapid re-renders\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const renderState = useMantineAIMarkdownRenderState();\n const isDark = renderState.colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n const [renderError, setRenderError] = useState(false);\n const [chartType, setChartType] = useState('unknown');\n\n const debouncedUpdateRenderError = useMemo(\n () =>\n debounce((error: boolean) => {\n setRenderError(error);\n }, 200),\n []\n );\n\n useEffect(() => {\n return () => {\n debouncedUpdateRenderError.cancel();\n };\n }, [debouncedUpdateRenderError]);\n\n useEffect(() => {\n if (props.code && ref.current) {\n const renderMermaid = async () => {\n try {\n debouncedUpdateRenderError(false);\n if (ref.current) {\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'loose',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n });\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n const { svg, bindFunctions, diagramType } = await mermaid.render(\n generateMermaidUUID(),\n props.code,\n ref.current\n );\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n setChartType(diagramType);\n }\n } catch {\n debouncedUpdateRenderError(true);\n }\n };\n\n renderMermaid();\n }\n }, [props.code, isDark, showOriginalCode, debouncedUpdateRenderError]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, [isDark]);\n\n return (\n <>\n {(showOriginalCode || renderError) && (\n <CodeHighlightTabs\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={[\n {\n fileName: renderError ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n renderError\n ? []\n : [\n <CodeHighlightControl\n tooltipLabel=\"Render Mermaid\"\n key=\"gpt\"\n onClick={() => {\n setShowOriginalCode(false);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[gravity-ui--logo-mermaid] relative bottom-[1px] text-[16px]\"></span>\n </Flex>\n </CodeHighlightControl>,\n ]\n }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showOriginalCode || renderError\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{chartType}</div>\n <Flex align=\"center\" justify=\"flex-end\" gap={0}>\n <Tooltip label=\"Show Mermaid Code\">\n <ActionIcon\n size={28}\n className=\"action-icon\"\n variant=\"transparent\"\n onClick={() => {\n setShowOriginalCode(true);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[entypo--code] relative bottom-[0.25px] text-[16px]\"></span>\n </Flex>\n </ActionIcon>\n </Tooltip>\n <CopyButton value={props.code}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon variant=\"transparent\" size={28} className=\"action-icon\" onClick={copy}>\n {copied ? (\n <span className=\"icon-origin-[lucide--check] text-[18px]\"></span>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n width=\"18px\"\n height=\"18px\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\"></path>\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\"></path>\n </svg>\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Flex>\n </div>\n <pre\n ref={ref}\n style={{ cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' }}\n onClick={() => viewSvgInNewWindow()}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","import { useAIMarkdownMetadata } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownMetadata } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownMetadata} hook.\n *\n * Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}.\n * Accepts an optional generic parameter for further extension.\n *\n * Metadata lives in a separate React context from the render state, meaning\n * metadata updates do not trigger re-renders in components that only consume\n * render state.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n *\n * @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}).\n * @returns The current metadata, or `undefined` if none was provided.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const metadata = useMantineAIMarkdownMetadata();\n * // Access Mantine-specific metadata fields\n * }\n * ```\n */\nexport const useMantineAIMarkdownMetadata = <\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>() => {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core","import_react","import_code_highlight","import_react","import_core","import_jsx_runtime","debounce","mermaid","import_jsx_runtime","SpecialCodeLanguage","hljs","import_core","import_jsx_runtime","Typography","AIMarkdown","import_core"]}
1
+ {"version":3,"sources":["../src/index.tsx","../src/MantineAIMarkdown.tsx","../src/components/typography/MantineTypography.tsx","../src/components/extra-styles/DefaultExtraStyles/index.tsx","../src/defs.tsx","../src/components/customized/PreCode.tsx","../src/hooks/useMantineAIMarkdownRenderState.ts","../src/components/customized/MermaidCode/index.tsx","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/now.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js","../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/debounce.js","../src/hooks/useMantineAIMarkdownMetadata.ts"],"sourcesContent":["/**\n * Public API surface for `@ai-react-markdown/mantine`.\n *\n * Re-exports the Mantine-integrated AI markdown component, its supporting\n * sub-components, extended types, default configuration, and typed hooks.\n *\n * @packageDocumentation\n */\n\n// --- Components ---\n\n/** Props for the main {@link MantineAIMarkdown} component. */\nexport type { MantineAIMarkdownProps } from './MantineAIMarkdown';\n\n/** Main component -- Mantine-integrated AI markdown renderer (default export). */\nexport { default } from './MantineAIMarkdown';\n\n/** Mantine-themed typography wrapper used by default inside {@link MantineAIMarkdown}. */\nexport { default as MantineAIMarkdownTypography } from './components/typography/MantineTypography';\n\n/** Default extra styles wrapper providing Mantine-compatible CSS scoping and overrides. */\nexport { default as MantineAIMDefaultExtraStyles } from './components/extra-styles/DefaultExtraStyles';\n\n// --- Types, config, and hooks ---\n\n/** Extended render configuration and metadata types for the Mantine integration. */\nexport type { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata } from './defs';\n\n/** Default Mantine render configuration (frozen). */\nexport { defaultMantineAIMarkdownRenderConfig } from './defs';\n\n/** Typed hook for accessing render state with Mantine-specific config fields. */\nexport { useMantineAIMarkdownRenderState } from './hooks/useMantineAIMarkdownRenderState';\n\n/** Typed hook for accessing metadata within the Mantine AI markdown tree. */\nexport { useMantineAIMarkdownMetadata } from './hooks/useMantineAIMarkdownMetadata';\n","/**\n * Main Mantine integration component for AI markdown rendering.\n *\n * Wraps the core {@link AIMarkdown} component with Mantine-specific defaults:\n * - {@link MantineAIMarkdownTypography} as the typography wrapper\n * - {@link MantineAIMDefaultExtraStyles} as the extra styles wrapper\n * - {@link MantineAIMPreCode} as the default `<pre>` component (with syntax\n * highlighting via Mantine's CodeHighlight and mermaid diagram support)\n * - Automatic color scheme detection via Mantine's `useComputedColorScheme`\n *\n * @module MantineAIMarkdown\n */\n\nimport { memo, useMemo } from 'react';\nimport AIMarkdown from '@ai-react-markdown/core';\nimport { type AIMarkdownProps, type AIMarkdownCustomComponents, useStableValue } from '@ai-react-markdown/core';\nimport MantineAIMarkdownTypography from './components/typography/MantineTypography';\nimport MantineAIMDefaultExtraStyles from './components/extra-styles/DefaultExtraStyles';\nimport { MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata, defaultMantineAIMarkdownRenderConfig } from './defs';\nimport MantineAIMPreCode from './components/customized/PreCode';\nimport { useComputedColorScheme } from '@mantine/core';\n\n/**\n * Props for the {@link MantineAIMarkdown} component.\n *\n * Extends {@link AIMarkdownProps} with Mantine-specific config and metadata generics.\n * All core props (`content`, `streaming`, `fontSize`, `config`, etc.) are inherited.\n *\n * @typeParam TConfig - Render configuration type, defaults to {@link MantineAIMarkdownRenderConfig}.\n * @typeParam TRenderData - Metadata type, defaults to {@link MantineAIMarkdownMetadata}.\n */\nexport interface MantineAIMarkdownProps<\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n> extends AIMarkdownProps<TConfig, TRenderData> {}\n\n/**\n * Default custom component overrides applied by the Mantine integration.\n *\n * Overrides the `<pre>` element to extract code blocks and render them via\n * {@link MantineAIMPreCode}, which provides syntax highlighting, expand/collapse,\n * and mermaid diagram support. Falls back to a plain `<pre>` when the child\n * is not a recognized code element.\n */\nconst DefaultCustomComponents: AIMarkdownCustomComponents = {\n pre: ({ node, ...usefulProps }) => {\n const code = node?.children[0] as\n | {\n type: string;\n tagName?: string;\n position?: { start?: { offset?: number } };\n properties?: Record<string, unknown>;\n children: { value?: string }[];\n }\n | undefined;\n if (!code || code.type !== 'element' || code.tagName !== 'code' || !code.position) {\n return <pre {...usefulProps} />;\n }\n const key = `pre-code-${node?.position?.start?.offset || 0}`;\n const detectedLanguage = (code.properties?.className as string[])\n ?.find((className: string) => className.startsWith('language-'))\n ?.substring('language-'.length);\n const codeText = code.children.map((child: { value?: string }) => child.value ?? '').join('\\n');\n return <MantineAIMPreCode key={key} codeText={codeText} existLanguage={detectedLanguage} />;\n },\n};\n\n/**\n * Inner (non-memoized) implementation of the Mantine AI markdown component.\n *\n * Merges caller-provided `customComponents` with the Mantine defaults (the caller's\n * overrides take precedence). Automatically resolves the color scheme from Mantine's\n * `useComputedColorScheme` when no explicit `colorScheme` prop is provided.\n *\n * @typeParam TConfig - Render configuration type.\n * @typeParam TRenderData - Metadata type.\n */\nconst MantineAIMarkdownComponent = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n TRenderData extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>({\n Typography = MantineAIMarkdownTypography,\n ExtraStyles = MantineAIMDefaultExtraStyles,\n defaultConfig = defaultMantineAIMarkdownRenderConfig as TConfig,\n customComponents,\n colorScheme,\n ...props\n}: MantineAIMarkdownProps<TConfig, TRenderData>) => {\n const stableCustomComponents = useStableValue(customComponents);\n\n const usedComponents = useMemo(() => {\n return stableCustomComponents ? { ...DefaultCustomComponents, ...stableCustomComponents } : DefaultCustomComponents;\n }, [stableCustomComponents]);\n\n const computedColorScheme = useComputedColorScheme('light');\n\n return (\n <AIMarkdown<MantineAIMarkdownRenderConfig, MantineAIMarkdownMetadata>\n Typography={Typography}\n ExtraStyles={ExtraStyles}\n defaultConfig={defaultConfig}\n customComponents={usedComponents}\n colorScheme={colorScheme ?? computedColorScheme}\n {...props}\n />\n );\n};\n\n/**\n * Mantine-integrated AI markdown renderer.\n *\n * A memoized wrapper around the core `<AIMarkdown>` component that provides\n * Mantine-themed typography, code highlighting (via `@mantine/code-highlight`),\n * mermaid diagram rendering, and automatic color scheme detection.\n *\n * This is the default export of `@ai-react-markdown/mantine`.\n *\n * @example\n * ```tsx\n * import MantineAIMarkdown from '@ai-react-markdown/mantine';\n *\n * function Chat({ content }: { content: string }) {\n * return <MantineAIMarkdown content={content} />;\n * }\n * ```\n */\nexport const MantineAIMarkdown = memo(MantineAIMarkdownComponent);\n\nMantineAIMarkdown.displayName = 'MantineAIMarkdown';\n\nexport default MantineAIMarkdown as typeof MantineAIMarkdownComponent;\n","import { memo } from 'react';\nimport { Typography } from '@mantine/core';\nimport type { AIMarkdownTypographyProps } from '@ai-react-markdown/core';\n\n/**\n * Mantine-themed typography wrapper for AI markdown content.\n *\n * Replaces the core default typography component with Mantine's `<Typography>`\n * element, applying the configured `fontSize` at full width. This ensures all\n * rendered markdown inherits Mantine's font family, line height, and theming.\n *\n * Used as the default `Typography` prop in {@link MantineAIMarkdown}.\n * Can be replaced by passing a custom `Typography` component.\n *\n * @param props - Standard {@link AIMarkdownTypographyProps} from the core package.\n */\nconst MantineAIMarkdownTypography = memo(({ children, fontSize, style }: AIMarkdownTypographyProps) => (\n <Typography w=\"100%\" fz={fontSize} style={style}>\n {children}\n </Typography>\n));\n\nMantineAIMarkdownTypography.displayName = 'MantineAIMarkdownTypography';\n\nexport default MantineAIMarkdownTypography;\n","import React from 'react';\nimport { AIMarkdownExtraStylesComponent } from '@ai-react-markdown/core';\nimport './styles.scss';\n\n/**\n * Default extra styles wrapper for the Mantine integration.\n *\n * Wraps markdown content in a `<div>` with the `aim-mantine-extra-styles` CSS class,\n * which provides Mantine-compatible typography overrides including:\n * - Relative `em`-based Mantine spacing and font-size CSS custom properties\n * - Heading, list, paragraph, blockquote, and code styling\n * - Definition list layout\n *\n * Used as the default `ExtraStyles` prop in {@link MantineAIMarkdown}.\n */\nconst MantineAIMDefaultExtraStyles: AIMarkdownExtraStylesComponent = ({ children }) => {\n return <div className=\"aim-mantine-extra-styles\">{children}</div>;\n};\n\nexport default MantineAIMDefaultExtraStyles;\n","/**\n * Mantine-specific type definitions and default configuration.\n *\n * Extends the core {@link AIMarkdownRenderConfig} and {@link AIMarkdownMetadata}\n * with Mantine-themed options such as uniform heading sizes and code block behavior.\n *\n * @module defs\n */\n\nimport { AIMarkdownRenderConfig, AIMarkdownMetadata, defaultAIMarkdownRenderConfig } from '@ai-react-markdown/core';\n\n/**\n * Extended render configuration for the Mantine integration.\n *\n * Inherits all core config fields (extra syntax, display optimizations) and adds\n * Mantine-specific options for typography sizing and code block behavior.\n */\nexport interface MantineAIMarkdownRenderConfig extends AIMarkdownRenderConfig {\n /** Code block rendering options. */\n codeBlock: {\n /**\n * Whether code blocks start in their expanded state.\n * When `false`, long code blocks are collapsed with an expand button.\n *\n * @default true\n */\n defaultExpanded: boolean;\n\n /**\n * When `true`, uses `highlight.js` auto-detection to determine the language\n * of code blocks that lack an explicit language annotation.\n *\n * @default false\n */\n autoDetectUnknownLanguage: boolean;\n };\n}\n\n/**\n * Default Mantine render configuration.\n *\n * Extends {@link defaultAIMarkdownRenderConfig} with Mantine-specific defaults.\n * Frozen to prevent accidental mutation.\n */\nexport const defaultMantineAIMarkdownRenderConfig: MantineAIMarkdownRenderConfig = Object.freeze({\n ...defaultAIMarkdownRenderConfig,\n codeBlock: Object.freeze({\n defaultExpanded: true,\n autoDetectUnknownLanguage: false,\n }),\n});\n\n/**\n * Metadata type for the Mantine integration.\n *\n * Currently identical to {@link AIMarkdownMetadata}. Exists as an extension point\n * so that consumers can augment metadata in Mantine-specific wrappers without\n * needing to reference the core type directly.\n */\nexport interface MantineAIMarkdownMetadata extends AIMarkdownMetadata {}\n","'use client';\n\nimport { HTMLAttributes, memo, useMemo } from 'react';\nimport { CodeHighlight, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { deepParseJson } from 'deep-parse-json';\nimport hljs from 'highlight.js';\nimport { useMantineAIMarkdownRenderState } from '../../hooks/useMantineAIMarkdownRenderState';\nimport MantineAIMMermaidCode from './MermaidCode';\n\n/**\n * Code languages that receive specialized rendering instead of standard\n * syntax-highlighted code blocks. Adding a new member here automatically\n * marks that language as \"special\" — you only need to add the corresponding\n * rendering branch in the component's return.\n */\nenum SpecialCodeLanguage {\n /** Rendered as interactive diagrams via {@link MantineAIMMermaidCode} */\n Mermaid = 'mermaid',\n}\n\n/** O(1) lookup set, derived from {@link SpecialCodeLanguage}. */\nconst SPECIAL_LANGUAGES = new Set<string>(Object.values(SpecialCodeLanguage));\n\n/**\n * Mantine code block renderer for `<pre>` elements.\n *\n * Replaces the default `<pre>` rendering with Mantine's {@link CodeHighlight} or\n * {@link CodeHighlightTabs} components, providing syntax highlighting, expand/collapse\n * behavior, and file-name tabs.\n *\n * Behavior:\n * - If the code block has an explicit language annotation, uses that language.\n * - If no language is specified and `config.codeBlock.autoDetectUnknownLanguage` is\n * enabled, uses `highlight.js` auto-detection.\n * - Mermaid code blocks (`language-mermaid`) are rendered as interactive diagrams\n * via {@link MantineAIMMermaidCode}.\n * - JSON code blocks are deep-parsed and pretty-printed before display.\n * - Unrecognized languages render as plaintext with an \"unknown\" label using\n * {@link CodeHighlight} (no tabs).\n * - Recognized languages render with {@link CodeHighlightTabs} showing the\n * language name as the tab label.\n *\n * @param props.codeText - The raw text content of the code block.\n * @param props.existLanguage - Language identifier extracted from the `language-*` CSS class, if present.\n */\nconst MantineAIMPreCode = memo(\n (\n props: HTMLAttributes<HTMLPreElement> & {\n codeText: string;\n existLanguage?: string;\n }\n ) => {\n const renderState = useMantineAIMarkdownRenderState();\n\n const codeLanguage = useMemo(() => {\n if (props.existLanguage) return props.existLanguage;\n if (renderState.config.codeBlock.autoDetectUnknownLanguage) {\n return hljs.highlightAuto(props.codeText).language || '';\n }\n return '';\n }, [props.existLanguage, props.codeText, renderState.config.codeBlock.autoDetectUnknownLanguage]);\n\n const [usedCodeLanguage, usedFileName] = useMemo(() => {\n if (!codeLanguage) return ['plaintext', 'unknown'];\n if (!hljs.getLanguage(codeLanguage)) {\n return ['plaintext', codeLanguage];\n }\n return [codeLanguage, codeLanguage];\n }, [codeLanguage]);\n\n const isSpecialCodeBlock = SPECIAL_LANGUAGES.has(codeLanguage);\n\n const normalCodeBlockContent = useMemo(() => {\n if (isSpecialCodeBlock) return null;\n let usedCodeStr = props.codeText;\n if (usedCodeStr && usedCodeLanguage.toLowerCase() === 'json') {\n const deepParsedResult = deepParseJson(usedCodeStr);\n usedCodeStr =\n typeof deepParsedResult === 'string' ? deepParsedResult : JSON.stringify(deepParsedResult, null, 2);\n }\n return usedFileName === 'unknown' ? (\n <CodeHighlight\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={usedCodeStr}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n ) : (\n <CodeHighlightTabs\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={[\n {\n fileName: usedFileName,\n code: usedCodeStr,\n language: usedCodeLanguage,\n },\n ]}\n withBorder\n withExpandButton\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n />\n );\n }, [\n isSpecialCodeBlock,\n props.codeText,\n usedCodeLanguage,\n usedFileName,\n renderState.fontSize,\n renderState.config.codeBlock.defaultExpanded,\n ]);\n\n const specialCodeBlockContent = useMemo(() => {\n switch (codeLanguage) {\n case SpecialCodeLanguage.Mermaid:\n return <MantineAIMMermaidCode code={props.codeText} />;\n default:\n return null;\n }\n }, [codeLanguage, props.codeText]);\n\n return isSpecialCodeBlock ? specialCodeBlockContent : normalCodeBlockContent;\n }\n);\n\nMantineAIMPreCode.displayName = 'MantineAIMPreCode';\n\nexport default MantineAIMPreCode;\n","import { useAIMarkdownRenderState } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownRenderConfig } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownRenderState} hook.\n *\n * Returns the current {@link AIMarkdownRenderState} defaulting to\n * {@link MantineAIMarkdownRenderConfig}. Accepts an optional generic parameter\n * for further extension, giving consumers direct access to Mantine-specific\n * config fields (`codeBlock`, etc.) without manual annotation.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n * Throws if called outside the provider boundary.\n *\n * @typeParam TConfig - Config type (defaults to {@link MantineAIMarkdownRenderConfig}).\n * @returns The current render state typed with `TConfig`.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { config, streaming, colorScheme } = useMantineAIMarkdownRenderState();\n * const isExpanded = config.codeBlock.defaultExpanded;\n * // ...\n * }\n * ```\n */\nexport const useMantineAIMarkdownRenderState = <\n TConfig extends MantineAIMarkdownRenderConfig = MantineAIMarkdownRenderConfig,\n>() => {\n return useAIMarkdownRenderState<TConfig>();\n};\n","'use client';\n\nimport React, { memo, useMemo, useEffect, useRef, useState, useCallback } from 'react';\nimport { CodeHighlightControl, CodeHighlightTabs } from '@mantine/code-highlight';\nimport { ActionIcon, CopyButton, Flex, Tooltip } from '@mantine/core';\nimport debounce from 'lodash-es/debounce';\nimport mermaid from 'mermaid';\nimport { useMantineAIMarkdownRenderState } from '../../../hooks/useMantineAIMarkdownRenderState';\nimport './styles.scss';\n\n/**\n * Generate a unique ID for mermaid SVG rendering.\n * Combines a timestamp with a random suffix to avoid collisions when\n * multiple mermaid diagrams render concurrently.\n *\n * @returns A unique string in the format `mermaid-{timestamp}-{random}`.\n */\nconst generateMermaidUUID = () => {\n return `mermaid-${new Date().getTime()}-${Math.random().toString(36).slice(2, 10)}`;\n};\n\n/**\n * Open the rendered mermaid SVG in a new browser window.\n *\n * Clones the SVG element, applies a background color matching the current\n * color scheme, serializes it to an object URL, and opens it in a new tab.\n * The object URL is revoked after a short delay to free memory.\n *\n * @param svgElement - The rendered SVG element to view, or `null`/`undefined` to no-op.\n * @param isDark - Whether the current color scheme is dark (used for background color).\n */\nconst handleViewSVGInNewWindow = (svgElement: SVGElement | null | undefined, isDark: boolean) => {\n if (!svgElement) return;\n const targetSvg = svgElement.cloneNode(true) as SVGElement;\n targetSvg.style.backgroundColor = isDark ? '#242424' : 'white';\n const text = new XMLSerializer().serializeToString(targetSvg);\n const blob = new Blob([text], { type: 'image/svg+xml' });\n const url = URL.createObjectURL(blob);\n const win = window.open(url);\n if (win) {\n setTimeout(() => URL.revokeObjectURL(url), 5000);\n }\n};\n\n/**\n * Interactive mermaid diagram renderer.\n *\n * Parses and renders mermaid diagram source code into an inline SVG visualization.\n * Automatically adapts to the current Mantine color scheme (light/dark) by\n * re-initializing mermaid with the appropriate theme.\n *\n * Features:\n * - Live SVG rendering with automatic dark/light theme switching\n * - Fallback to raw source code display on parse/render errors\n * - Toggle between rendered diagram and raw mermaid source\n * - Click on the rendered diagram to open the SVG in a new browser window\n * - Copy button for the raw mermaid source code\n * - Chart type label extracted from mermaid's parse result\n * - Debounced error state to avoid flickering during rapid re-renders\n *\n * @param props.code - Raw mermaid diagram source code to render.\n */\nconst MantineAIMMermaidCode = memo((props: { code: string }) => {\n const renderState = useMantineAIMarkdownRenderState();\n const isDark = renderState.colorScheme === 'dark';\n\n const ref = useRef<HTMLPreElement>(null);\n const [showOriginalCode, setShowOriginalCode] = useState(false);\n const [renderError, setRenderError] = useState(false);\n const [chartType, setChartType] = useState('unknown');\n\n const debouncedUpdateRenderError = useMemo(\n () =>\n debounce((error: boolean) => {\n setRenderError(error);\n }, 200),\n []\n );\n\n useEffect(() => {\n return () => {\n debouncedUpdateRenderError.cancel();\n };\n }, [debouncedUpdateRenderError]);\n\n useEffect(() => {\n if (props.code && ref.current) {\n const renderMermaid = async () => {\n try {\n debouncedUpdateRenderError(false);\n if (ref.current) {\n mermaid.initialize({\n startOnLoad: false,\n securityLevel: 'loose',\n theme: isDark ? 'dark' : 'base',\n darkMode: isDark,\n });\n const parseResult = await mermaid.parse(props.code);\n if (!parseResult) {\n throw new Error('Failed to parse mermaid code');\n }\n const { svg, bindFunctions, diagramType } = await mermaid.render(\n generateMermaidUUID(),\n props.code,\n ref.current\n );\n ref.current.innerHTML = svg;\n bindFunctions?.(ref.current);\n setChartType(diagramType);\n }\n } catch {\n debouncedUpdateRenderError(true);\n }\n };\n\n renderMermaid();\n }\n }, [props.code, isDark, showOriginalCode, debouncedUpdateRenderError]);\n\n const viewSvgInNewWindow = useCallback(() => {\n handleViewSVGInNewWindow(ref.current?.querySelector('svg'), isDark);\n }, [isDark]);\n\n return (\n <>\n {(showOriginalCode || renderError) && (\n <CodeHighlightTabs\n mb={15}\n fz={renderState.fontSize}\n w=\"100%\"\n code={[\n {\n fileName: renderError ? 'Mermaid Render Error' : 'mermaid',\n code: props.code,\n language: 'mermaid',\n },\n ]}\n defaultExpanded={renderState.config.codeBlock.defaultExpanded}\n maxCollapsedHeight=\"320px\"\n styles={{\n filesScrollarea: {\n right: '90px',\n },\n }}\n controls={\n renderError\n ? []\n : [\n <CodeHighlightControl\n tooltipLabel=\"Render Mermaid\"\n key=\"gpt\"\n onClick={() => {\n setShowOriginalCode(false);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[gravity-ui--logo-mermaid] relative bottom-[1px] text-[16px]\"></span>\n </Flex>\n </CodeHighlightControl>,\n ]\n }\n withBorder\n withExpandButton\n />\n )}\n <div\n className={`aim-mantine-mermaid-code ${isDark ? 'dark' : ''}`}\n style={\n showOriginalCode || renderError\n ? {\n display: 'none',\n }\n : {}\n }\n >\n <div className=\"chart-header\">\n <div className=\"chart-type-tag\">{chartType}</div>\n <Flex align=\"center\" justify=\"flex-end\" gap={0}>\n <Tooltip label=\"Show Mermaid Code\">\n <ActionIcon\n size={28}\n className=\"action-icon\"\n variant=\"transparent\"\n onClick={() => {\n setShowOriginalCode(true);\n }}\n >\n <Flex align=\"center\" justify=\"center\" w={18} h={18}>\n <span className=\"icon-[entypo--code] relative bottom-[0.25px] text-[16px]\"></span>\n </Flex>\n </ActionIcon>\n </Tooltip>\n <CopyButton value={props.code}>\n {({ copied, copy }) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon variant=\"transparent\" size={28} className=\"action-icon\" onClick={copy}>\n {copied ? (\n <span className=\"icon-origin-[lucide--check] text-[18px]\"></span>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"2\"\n stroke=\"currentColor\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n width=\"18px\"\n height=\"18px\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z\"></path>\n <path d=\"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2\"></path>\n </svg>\n )}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Flex>\n </div>\n <pre\n ref={ref}\n style={{ cursor: 'pointer', overflow: 'auto', width: '100%', padding: '0.5rem' }}\n onClick={() => viewSvgInNewWindow()}\n />\n </div>\n </>\n );\n});\n\nMantineAIMMermaidCode.displayName = 'MantineAIMMermaidCode';\n\nexport default MantineAIMMermaidCode;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nexport default now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import isObject from './isObject.js';\nimport now from './now.js';\nimport toNumber from './toNumber.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nexport default debounce;\n","import { useAIMarkdownMetadata } from '@ai-react-markdown/core';\nimport { MantineAIMarkdownMetadata } from '../defs';\n\n/**\n * Typed wrapper around the core {@link useAIMarkdownMetadata} hook.\n *\n * Returns the current metadata defaulting to {@link MantineAIMarkdownMetadata}.\n * Accepts an optional generic parameter for further extension.\n *\n * Metadata lives in a separate React context from the render state, meaning\n * metadata updates do not trigger re-renders in components that only consume\n * render state.\n *\n * Must be called inside a component rendered within the `<MantineAIMarkdown>` tree.\n *\n * @typeParam TMetadata - Metadata type (defaults to {@link MantineAIMarkdownMetadata}).\n * @returns The current metadata, or `undefined` if none was provided.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const metadata = useMantineAIMarkdownMetadata();\n * // Access Mantine-specific metadata fields\n * }\n * ```\n */\nexport const useMantineAIMarkdownMetadata = <\n TMetadata extends MantineAIMarkdownMetadata = MantineAIMarkdownMetadata,\n>() => {\n return useAIMarkdownMetadata<TMetadata>();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,IAAAA,gBAA8B;AAC9B,IAAAC,eAAuB;AACvB,IAAAA,eAAsF;;;ACftF,mB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C3F;AACF;AAYA,IAAM,6BAA6B,CAGjC;AAAA,EACA,YAAAC,cAAa;AAAA,EACb,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoD;AAClD,QAAM,6BAAyB,6BAAe,gBAAgB;AAE9D,QAAM,qBAAiB,uBAAQ,MAAM;AACnC,WAAO,yBAAyB,EAAE,GAAG,yBAAyB,GAAG,uBAAuB,IAAI;AAAA,EAC9F,GAAG,CAAC,sBAAsB,CAAC;AAE3B,QAAM,0BAAsB,qCAAuB,OAAO;AAE1D,SACE;AAAA,IAAC,aAAAC;AAAA,IAAA;AAAA,MACC,YAAYD;AAAA,MACZ;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa,eAAe;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN;AAEJ;AAoBO,IAAM,wBAAoB,oBAAK,0BAA0B;AAEhE,kBAAkB,cAAc;AAEhC,IAAO,4BAAQ;;;AqBlIf,IAAAE,eAAsC;AA0B/B,IAAM,+BAA+B,MAErC;AACL,aAAO,oCAAiC;AAC1C;","names":["import_react","import_core","import_jsx_runtime","import_core","import_react","import_code_highlight","import_core","import_react","import_core","Symbol","objectProto","nativeObjectToString","symToStringTag","import_jsx_runtime","mermaid","import_jsx_runtime","SpecialCodeLanguage","hljs","import_core","import_jsx_runtime","Typography","AIMarkdown","import_core"]}