markdown-flow-ui 0.3.4-dev.1 → 0.3.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.
- package/README.md +8 -17
- package/dist/_virtual/index.es3.js +5 -4
- package/dist/_virtual/index.es3.js.map +1 -1
- package/dist/_virtual/index.es4.js +4 -5
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/_virtual/index.es6.js +5 -3
- package/dist/_virtual/index.es6.js.map +1 -1
- package/dist/_virtual/index.es7.js +3 -5
- package/dist/_virtual/index.es7.js.map +1 -1
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index6.cjs +1 -1
- package/dist/_virtual/index7.cjs +1 -1
- package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
- package/dist/components/ContentRender/ContentRender.es.js +0 -1
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +0 -2
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +260 -284
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +40 -48
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -22
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +16 -18
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +49 -51
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +41 -43
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +49 -51
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +47 -49
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +45 -47
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +19 -21
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +18 -20
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +13 -15
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +41 -43
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +23 -25
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/FixedTextPlaceholder.test.d.ts +1 -0
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +2 -6
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +152 -157
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.es.js +0 -12
- package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.es.js +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.es.js +70 -67
- package/dist/node_modules/remark-flow/dist/interaction-parser.es.js.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
- package/package.json +2 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentRender.es.js","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import { trimVariablePadding } from \"remark-flow\";\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport { unified, type PluggableList, type Plugin } from \"unified\";\nimport remarkRehype from \"remark-rehype\";\nimport type { Element, Root } from \"hast\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport CodeBlock, { CodeBlockContext } from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart, { type MermaidChartProps } from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\n// import { processMarkdownText } from \"./utils/process-markdown\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport {\n getInlineCodeRanges,\n getMarkdownSourceAnalysis,\n} from \"./utils/inline-code-ranges\";\nimport { remarkPlugins } from \"./utils/markdown-plugins\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport {\n escapeTypedMarkdownMetadata,\n type MarkdownMetadataRange,\n} from \"./utils/escape-typed-metadata\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n appendContentAwareTypewriterQueue,\n CONTENT_AWARE_TYPEWRITER_TICK_BUDGET,\n consumeContentAwareTypewriterQueue,\n getTrailingTypewriterGrapheme,\n isContentAwareTypewriterQueueEmpty,\n type ContentAwareTypewriterQueue,\n} from \"./utils/typewriter-pacing\";\nimport {\n normalizeWrappedSandboxContent,\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport {\n createVideoMarkdownRunPlan,\n cloneVideoMarkdownSourceTree,\n projectVideoMarkdownRun,\n prepareVideoMarkdownRun,\n getVideoMarkdownNodeState,\n type VideoMarkdownRunPlan,\n} from \"./utils/video-markdown-run\";\n\nconst FIXED_TYPEWRITER_CHUNK_SIZE = 2;\n\nexport type ContentRenderTypewriterPacing = \"fixed\" | \"content-aware\";\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /** Locale used for built-in UI text when a more specific text prop is not provided. */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language; omitted values inherit from the host. */\n lang?: string;\n /** Overrides locale-derived direction; omitted values inherit when no locale is set. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n /** Types prose only; following HTML renders progressively once preceding prose is displayed. */\n enableTypewriter?: boolean;\n /** Controls how much text is revealed per tick. Defaults to the legacy fixed pacing. */\n typewriterPacing?: ContentRenderTypewriterPacing;\n onTypeFinished?: () => void;\n onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Exit fullscreen button text for iframe sandbox\n sandboxExitFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n // tooltipMinLength?: number; // Control minimum character length for tooltip display, default 10\n}\n\nexport interface ContentRenderTypewriterState {\n isTypewriterEnabled: boolean;\n isTyping: boolean;\n isComplete: boolean;\n /** Received source units already displayed, including unpaced HTML. */\n renderedLength: number;\n totalLength: number;\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string; inline?: boolean }> = ({\n svg,\n inline = false,\n}) => {\n const hostRef = useRef<HTMLElement | null>(null);\n const Wrapper = inline ? \"span\" : \"div\";\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <Wrapper className=\"content-render-svg-scroll\">\n <Wrapper\n className=\"content-render-svg\"\n ref={(node) => {\n hostRef.current = node;\n }}\n />\n </Wrapper>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\ntype MarkdownComponentRuntimeValues = {\n direction?: ContentRenderProps[\"dir\"];\n language?: string;\n mermaidMessages: MermaidChartProps[\"messages\"];\n beforeSend?: (param: OnSendContentParams) => boolean;\n locale?: MarkdownFlowLocale;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n readonly: boolean;\n renderContent: string;\n resolvedConfirmButtonText: string;\n resolvedCopiedButtonText: string;\n resolvedCopyButtonText: string;\n resolvedDefaultButtonText?: string;\n resolvedDefaultInputText?: string;\n resolvedDefaultSelectedValues?: string[];\n};\n\nconst MarkdownComponentRuntimeContext =\n React.createContext<React.RefObject<MarkdownComponentRuntimeValues> | null>(\n null\n );\n\nconst MarkdownCode = (\n props: React.ComponentProps<\"code\"> & { receivedTree?: boolean }\n) => {\n const { receivedTree, ...codeProps } = props;\n const runtimeValuesRef = React.useContext(MarkdownComponentRuntimeContext);\n const isInCodeBlock = React.useContext(CodeBlockContext);\n if (!runtimeValuesRef) {\n throw new Error(\"Markdown code renderer requires ContentRender context.\");\n }\n const { className, children, ...rest } = codeProps as {\n className?: string;\n children?: React.ReactNode;\n dir?: string;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const complete = mermaidBlockIsComplete(\n runtimeValuesRef.current.renderContent,\n chartContent\n );\n // The received-tree path replaces standalone Mermaid segments, whose\n // unfinished charts freeze until the closing fence reaches the prose budget.\n const frozen = receivedTree ? !complete : complete;\n return (\n <MermaidChart\n chart={chartContent}\n frozen={frozen}\n messages={runtimeValuesRef.current.mermaidMessages}\n />\n );\n }\n\n return (\n <code\n className={className}\n {...rest}\n dir={rest.dir ?? (isInCodeBlock ? undefined : \"ltr\")}\n >\n {children}\n </code>\n );\n};\n\nconst sourceRehypePlugins: PluggableList = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n];\nconst formattingRehypePlugins: PluggableList = [\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\nconst rehypePlugins: PluggableList = [\n ...sourceRehypePlugins,\n ...formattingRehypePlugins,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ content: markdownContent, components, locale }) => {\n const texts = getContentRenderLocaleTexts(locale);\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n remarkRehypeOptions={{\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) => {\n const reference =\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\");\n return texts.footnoteBackLabel.replace(\"{reference}\", reference);\n },\n }}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n );\n};\n\n// ReactMarkdown still owns URL handling and JSX conversion. Its parser is\n// bypassed because the received source was already parsed and transformed.\nconst usePreparedTree: Plugin = function () {\n this.parser = () => ({ type: \"root\", children: [] });\n};\n\nconst StableVideoMarkdownRenderer: React.FC<{\n plan: VideoMarkdownRunPlan;\n renderedSegments: readonly RenderSegment[];\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ plan, renderedSegments, components, locale }) => {\n const prepared = useMemo(() => {\n const texts = getContentRenderLocaleTexts(locale);\n const sourceProcessor = unified()\n .use(remarkPlugins)\n .use(remarkRehype, {\n allowDangerousHtml: true,\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) =>\n texts.footnoteBackLabel.replace(\n \"{reference}\",\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\")\n ),\n })\n .use(sourceRehypePlugins);\n const formattingProcessor = unified().use(formattingRehypePlugins);\n const tree = sourceProcessor.runSync(\n cloneVideoMarkdownSourceTree(plan),\n plan.markdownSource\n ) as Root;\n return prepareVideoMarkdownRun(\n plan,\n tree,\n (value) => formattingProcessor.runSync(value, plan.fullSource) as Root\n );\n }, [plan, locale]);\n const projected = useMemo(\n () => projectVideoMarkdownRun(prepared, renderedSegments),\n [prepared, renderedSegments]\n );\n const originalComponents = useRef(components);\n originalComponents.current = components;\n const wrappers = useRef(\n new Map<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n >()\n );\n const stableComponents = useMemo(() => {\n const tags = new Set<string>();\n const collect = (node: Root | Root[\"children\"][number]) => {\n if (node.type === \"element\") tags.add(node.tagName);\n if (\"children\" in node) node.children.forEach(collect);\n };\n collect(prepared.tree!);\n const result: Record<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n > = {};\n for (const tag of tags) {\n if (!wrappers.current.has(tag)) {\n const Component = ({\n node,\n children,\n ...props\n }: {\n node: Element;\n children?: React.ReactNode;\n }) => {\n const state = getVideoMarkdownNodeState(node);\n if (state?.svg) {\n return state.svgSource ? (\n <SvgBlockInShadow svg={state.svgSource} inline />\n ) : null;\n }\n if (state?.atomic) {\n return state.active ? <>{children}</> : null;\n }\n if (state?.active === false && tag !== \"a\") return null;\n const current = originalComponents.current as Record<\n string,\n React.ElementType\n >;\n const Original = current[tag];\n const visibleProps =\n state?.active === false\n ? { ...props, href: undefined, tabIndex: -1 }\n : props;\n return Original\n ? React.createElement(\n Original,\n {\n ...visibleProps,\n node,\n ...(Original === MarkdownCode ? { receivedTree: true } : {}),\n },\n children\n )\n : React.createElement(tag, visibleProps, children);\n };\n Component.displayName = `StableMarkdown(${tag})`;\n wrappers.current.set(tag, Component);\n }\n result[tag] = wrappers.current.get(tag)!;\n }\n return result as CustomComponents;\n }, [prepared]);\n const preparedPlugins = useMemo<PluggableList>(\n () => [() => () => projected],\n [projected]\n );\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={[usePreparedTree]}\n rehypePlugins={preparedPlugins}\n components={stableComponents}\n >\n {\"\"}\n </ReactMarkdown>\n </div>\n );\n};\n\nconst isImmediateSegment = (segment: RenderSegment) =>\n segment.type === \"markdown\" && segment.immediate === true;\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\" && !isImmediateSegment(last)) {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst closeTypedInlineCode = (\n visible: string,\n source: string,\n ranges: ReturnType<typeof getInlineCodeRanges>\n) => {\n if (visible.length >= source.length) return visible;\n const range = ranges.find(\n ({ start, end }) => start < visible.length && visible.length < end\n );\n if (!range) return visible;\n const delimiter = /^`+/.exec(source.slice(range.start))?.[0];\n if (!delimiter || visible.length < range.start + delimiter.length) {\n return visible;\n }\n const closingStart = range.end - delimiter.length;\n if (visible.length > closingStart) {\n return visible + delimiter.slice(visible.length - closingStart);\n }\n // Close only the render copy so a typed prefix cannot activate code as HTML.\n return visible + (visible.endsWith(\"`\") ? \" \" : \"\") + delimiter;\n};\n\nconst protectTypedMarkdownPrefix = (\n visible: string,\n source: string,\n inlineCodeRanges: ReturnType<typeof getInlineCodeRanges>,\n metadataRanges: readonly MarkdownMetadataRange[],\n sourceOffset = 0\n) => {\n // Both protections use raw coordinates. Append any synthetic code delimiter\n // after escaping so encoded '<' characters cannot shift the typing budget.\n const closed = closeTypedInlineCode(visible, source, inlineCodeRanges);\n return (\n escapeTypedMarkdownMetadata(visible, metadataRanges, sourceOffset) +\n closed.slice(visible.length)\n );\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst areStringArraysEqual = (left?: string[], right?: string[]) => {\n if (left === right) {\n return true;\n }\n if (!left || !right || left.length !== right.length) {\n return false;\n }\n return left.every((value, index) => value === right[index]);\n};\n\nconst useStableStringArray = (values?: string[]) => {\n const valuesRef = useRef<string[] | undefined>(values);\n\n if (!areStringArraysEqual(valuesRef.current, values)) {\n valuesRef.current = values;\n }\n\n return valuesRef.current;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n contentType,\n locale,\n lang,\n dir,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n typewriterPacing = \"fixed\",\n onTypeFinished,\n onTypewriterStateChange,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxExitFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n // tooltipMinLength,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const mermaidMessages = useMemo(\n () => ({\n loading: localeTexts.mermaidLoadingText,\n emptyChart: localeTexts.mermaidEmptyChartText,\n error: localeTexts.mermaidErrorText,\n }),\n [localeTexts]\n );\n const direction = dir ?? getMarkdownFlowDirection(locale);\n const language = lang ?? getMarkdownFlowLanguage(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const resolvedCopyButtonText = copyButtonText || localeTexts.copyButtonText;\n const resolvedCopiedButtonText =\n copiedButtonText || localeTexts.copiedButtonText;\n const resolvedSandboxFullscreenButtonText =\n sandboxFullscreenButtonText || localeTexts.sandboxFullscreenButtonText;\n const resolvedSandboxExitFullscreenButtonText =\n sandboxExitFullscreenButtonText ||\n localeTexts.sandboxExitFullscreenButtonText;\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const sourceContent = useMemo(\n () => normalizeWrappedSandboxContent(content),\n [content]\n );\n const sourceAnalysis = useMemo(\n () => getMarkdownSourceAnalysis(sourceContent),\n [sourceContent]\n );\n // Parse the received source, never a typewriter-truncated HTML string.\n const sourceSegments = useMemo(() => {\n const segments = mergeNonSandboxSegments(\n splitContentSegments(sourceContent, true, true, sourceAnalysis)\n );\n if (\n sourceContent !== content &&\n segments.length &&\n (segments[0].type === \"sandbox\" || isImmediateSegment(segments[0]))\n ) {\n // The removed opening quote occupied a prose slot before the wrapper\n // completed. Retain its empty slot so the existing iframe keeps its key.\n return [{ type: \"text\" as const, value: \"\" }, ...segments];\n }\n return segments;\n }, [content, sourceContent, sourceAnalysis]);\n const hasRichSegments = sourceSegments.some(\n (segment) => segment.type === \"sandbox\" || isImmediateSegment(segment)\n );\n const typewriterContent = hasRichSegments\n ? sourceSegments\n .filter(\n (segment) =>\n segment.type !== \"sandbox\" && !isImmediateSegment(segment)\n )\n .map((segment) => segment.value)\n .join(\"\")\n : sourceContent;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const fixedTypewriterContentVersion =\n typewriterPacing === \"fixed\" ? typewriterContent : undefined;\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : typewriterContent\n );\n const displayContentRef = useRef(displayContent);\n const pendingContentRef = useRef(\"\");\n const contentAwareQueueRef = useRef<ContentAwareTypewriterQueue>({\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n });\n const contentAwareBudgetRef = useRef(0);\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n const previousTypewriterPacingRef = useRef(typewriterPacing);\n const previousSourceContentRef = useRef(typewriterContent);\n const previousReceivedContentRef = useRef(content);\n const hasReportedTypeFinishedRef = useRef(false);\n const [typewriterWakeVersion, setTypewriterWakeVersion] = useState(0);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n const previousTypewriterPacing = previousTypewriterPacingRef.current;\n const previousSourceContent = previousSourceContentRef.current;\n const wasPending = Boolean(pendingContentRef.current);\n const receivedContentChanged =\n previousReceivedContentRef.current !== content;\n const receivedContentAppended =\n receivedContentChanged &&\n content.startsWith(previousReceivedContentRef.current);\n previousReceivedContentRef.current = content;\n\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n previousTypewriterPacingRef.current = typewriterPacing;\n previousSourceContentRef.current = typewriterContent;\n\n if (\n receivedContentChanged ||\n isTypewriterEnabled !== wasTypewriterEnabled\n ) {\n hasReportedTypeFinishedRef.current = false;\n }\n\n const clearPendingContent = () => {\n pendingContentRef.current = \"\";\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n };\n\n const updateDisplayContent = (nextContent: string) => {\n displayContentRef.current = nextContent;\n setDisplayContent(nextContent);\n };\n\n if (!isTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(typewriterContent);\n return;\n }\n\n if (!wasTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(\"\");\n }\n\n let visibleContent = !wasTypewriterEnabled ? \"\" : displayContentRef.current;\n\n if (!typewriterContent.startsWith(visibleContent)) {\n clearPendingContent();\n if (!receivedContentAppended) {\n updateDisplayContent(typewriterContent);\n if (typewriterPacing === \"content-aware\") {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(typewriterContent),\n };\n }\n return;\n }\n // A newly recognized HTML tag can replace a previously literal prefix.\n // Keep the shared prose visible and pace only the newly received prose.\n let sharedLength = 0;\n while (\n sharedLength < visibleContent.length &&\n sharedLength < typewriterContent.length &&\n visibleContent[sharedLength] === typewriterContent[sharedLength]\n ) {\n sharedLength += 1;\n }\n visibleContent = visibleContent.slice(0, sharedLength);\n updateDisplayContent(visibleContent);\n }\n\n let nextPendingContent = typewriterContent.slice(visibleContent.length);\n if (!nextPendingContent) {\n pendingContentRef.current = \"\";\n contentAwareBudgetRef.current = 0;\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n return;\n }\n\n if (typewriterPacing === \"content-aware\") {\n const previousPendingContent = previousSourceContent.slice(\n visibleContent.length\n );\n const canAppendToCachedQueue =\n wasTypewriterEnabled &&\n previousTypewriterPacing === \"content-aware\" &&\n typewriterContent.startsWith(previousSourceContent) &&\n pendingContentRef.current === previousPendingContent;\n\n if (canAppendToCachedQueue) {\n const appended = appendContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n typewriterContent.slice(previousSourceContent.length)\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n } else {\n const appended = appendContentAwareTypewriterQueue(\n {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n },\n nextPendingContent\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n\n contentAwareBudgetRef.current = 0;\n }\n } else {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n }\n\n pendingContentRef.current = nextPendingContent;\n\n if (!wasPending && nextPendingContent) {\n setTypewriterWakeVersion((version) => version + 1);\n }\n }, [content, typewriterContent, isTypewriterEnabled, typewriterPacing]);\n\n useEffect(() => {\n if (!isTypewriterEnabled) {\n return;\n }\n\n if (\n hasReportedTypeFinishedRef.current ||\n pendingContentRef.current ||\n displayContent !== typewriterContent\n ) {\n return;\n }\n\n hasReportedTypeFinishedRef.current = true;\n onTypeFinished?.();\n }, [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n onTypeFinished,\n ]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n if (!pendingContentRef.current) {\n return;\n }\n\n let chunk = \"\";\n\n if (typewriterPacing === \"content-aware\") {\n const result = consumeContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n contentAwareBudgetRef.current + CONTENT_AWARE_TYPEWRITER_TICK_BUDGET\n );\n\n chunk = result.chunk;\n contentAwareQueueRef.current = result.queue;\n\n if (isContentAwareTypewriterQueueEmpty(result.queue)) {\n contentAwareBudgetRef.current = 0;\n } else {\n contentAwareBudgetRef.current = result.remainingBudget;\n }\n } else {\n const fixedChunk = splitTextByCharacterChunk(\n pendingContentRef.current,\n FIXED_TYPEWRITER_CHUNK_SIZE\n );\n chunk = fixedChunk.chunk;\n }\n\n if (!chunk) {\n return;\n }\n\n pendingContentRef.current = pendingContentRef.current.slice(chunk.length);\n if (!pendingContentRef.current) {\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: contentAwareQueueRef.current.trailingGrapheme,\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n contentAwareBudgetRef.current = 0;\n }\n\n const nextDisplayContent = `${displayContentRef.current}${chunk}`;\n displayContentRef.current = nextDisplayContent;\n setDisplayContent(nextDisplayContent);\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n displayContent,\n fixedTypewriterContentVersion,\n isTypewriterEnabled,\n typewriterPacing,\n typewriterTickMs,\n typewriterWakeVersion,\n ]);\n\n const mergedRenderSegments = useMemo(() => {\n let textOffset = 0;\n return sourceSegments.map((segment) => {\n if (!isTypewriterEnabled) return segment;\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n // HTML skips the prose budget only after earlier prose has caught up.\n // Retain its source slot so later updates keep the same render key.\n return displayContent.length >= textOffset\n ? segment\n : { ...segment, value: \"\" };\n }\n const value = displayContent.slice(\n textOffset,\n textOffset + segment.value.length\n );\n textOffset += segment.value.length;\n // Keep empty prose slots so an existing sandbox never changes its key.\n return { ...segment, value };\n });\n }, [sourceSegments, displayContent, isTypewriterEnabled]);\n const typewriterState = useMemo<ContentRenderTypewriterState>(\n () => ({\n isTypewriterEnabled,\n isTyping: isTypewriterEnabled && displayContent !== typewriterContent,\n isComplete: displayContent === typewriterContent,\n renderedLength:\n content.length -\n sourceSegments.reduce(\n (remaining, segment, index) =>\n remaining +\n segment.value.length -\n mergedRenderSegments[index].value.length,\n 0\n ),\n totalLength: content.length,\n }),\n [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n sourceSegments,\n mergedRenderSegments,\n ]\n );\n\n useEffect(() => {\n onTypewriterStateChange?.(typewriterState);\n }, [onTypewriterStateChange, typewriterState]);\n const sourceSegmentOffsets = useMemo(() => {\n let offset = 0;\n return sourceSegments.map((segment) => {\n const start = offset;\n offset += segment.value.length;\n return start;\n });\n }, [sourceSegments]);\n const sourceInlineCodeRanges = useMemo(\n () =>\n isTypewriterEnabled\n ? sourceSegments.map((segment) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? []\n : segment.value === sourceContent\n ? sourceAnalysis.inline\n : getInlineCodeRanges(segment.value)\n )\n : [],\n [isTypewriterEnabled, sourceSegments, sourceContent, sourceAnalysis]\n );\n const safeRichMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? mergedRenderSegments.map((segment, index) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? segment.value\n : isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n segment.value,\n sourceSegments[index].value,\n sourceInlineCodeRanges[index] ?? [],\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n : escapeTypedMarkdownMetadata(\n segment.value,\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n )\n : [],\n [\n hasRichSegments,\n isTypewriterEnabled,\n mergedRenderSegments,\n sourceInlineCodeRanges,\n sourceSegments,\n sourceAnalysis.metadata,\n sourceSegmentOffsets,\n ]\n );\n const richRenderRuns = useMemo(() => {\n const runs: Array<{\n indices: number[];\n sandbox: boolean;\n plan?: ReturnType<typeof createVideoMarkdownRunPlan>;\n }> = [];\n sourceSegments.forEach((segment, index) => {\n const previous = runs.at(-1);\n if (segment.type !== \"sandbox\" && previous && !previous.sandbox) {\n previous.indices.push(index);\n } else {\n runs.push({ indices: [index], sandbox: segment.type === \"sandbox\" });\n }\n });\n for (const run of runs) {\n if (\n !run.sandbox &&\n run.indices.some((index) => isImmediateSegment(sourceSegments[index]))\n ) {\n const segments = run.indices.map((index) => sourceSegments[index]);\n const fullSource = segments.map((segment) => segment.value).join(\"\");\n run.plan = createVideoMarkdownRunPlan(\n segments,\n fullSource === sourceContent ? sourceAnalysis : undefined\n );\n }\n }\n return runs;\n }, [sourceSegments, sourceContent, sourceAnalysis]);\n const renderContent = hasRichSegments\n ? mergedRenderSegments.map((segment) => segment.value).join(\"\")\n : isTypewriterEnabled\n ? displayContent\n : sourceContent;\n const normalizedContent = useMemo(\n () => (customRenderBar ? normalizeInlineHtml(renderContent) : \"\"),\n [customRenderBar, renderContent]\n );\n\n const safeMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? \"\"\n : normalizeInlineHtml(\n isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n renderContent,\n sourceContent,\n sourceInlineCodeRanges[0] ?? [],\n sourceAnalysis.metadata\n )\n : escapeTypedMarkdownMetadata(\n renderContent,\n sourceAnalysis.metadata\n )\n ),\n [\n sourceContent,\n hasRichSegments,\n isTypewriterEnabled,\n renderContent,\n sourceInlineCodeRanges,\n sourceAnalysis.metadata,\n ]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n (defaultButtonText ? trimVariablePadding(defaultButtonText) : undefined) ||\n interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => trimVariablePadding(value))\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n const stableDefaultSelectedValues = useStableStringArray(\n resolvedDefaultSelectedValues\n );\n const componentRuntimeValuesRef = useRef<MarkdownComponentRuntimeValues>({\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n });\n\n componentRuntimeValuesRef.current = {\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n };\n\n const components = useMemo<CustomComponents>(\n () => ({\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={\n componentRuntimeValuesRef.current.onClickCustomButtonAfterContent\n }\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={componentRuntimeValuesRef.current.readonly}\n defaultButtonText={\n componentRuntimeValuesRef.current.resolvedDefaultButtonText\n }\n defaultInputText={\n componentRuntimeValuesRef.current.resolvedDefaultInputText\n }\n defaultSelectedValues={\n componentRuntimeValuesRef.current.resolvedDefaultSelectedValues\n }\n onSend={componentRuntimeValuesRef.current.onSend}\n beforeSend={componentRuntimeValuesRef.current.beforeSend}\n locale={componentRuntimeValuesRef.current.locale}\n dir={componentRuntimeValuesRef.current.direction}\n lang={componentRuntimeValuesRef.current.language}\n confirmButtonText={\n componentRuntimeValuesRef.current.resolvedConfirmButtonText\n }\n // tooltipMinLength={tooltipMinLength}\n />\n ),\n code: MarkdownCode,\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={\n componentRuntimeValuesRef.current.resolvedCopyButtonText\n }\n copiedButtonText={\n componentRuntimeValuesRef.current.resolvedCopiedButtonText\n }\n />\n ),\n }),\n []\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(safeMarkdownContent),\n [safeMarkdownContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={key}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={key}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n const customBar = customRenderBar ? (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n ) : null;\n\n if (hasRichSegments) {\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {richRenderRuns.map((run) => {\n const idx = run.indices[0];\n const segment = mergedRenderSegments[idx];\n if (run.sandbox)\n return segment.type === \"sandbox\" &&\n segment.value &&\n !segment.pending ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n locale={locale}\n dir={direction}\n lang={language}\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={resolvedSandboxFullscreenButtonText}\n exitFullScreenButtonText={\n resolvedSandboxExitFullscreenButtonText\n }\n mode={sandboxMode}\n />\n ) : null;\n if (run.plan)\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={`md-${idx}`}\n value={componentRuntimeValuesRef}\n >\n <StableVideoMarkdownRenderer\n locale={locale}\n components={components}\n plan={run.plan}\n renderedSegments={run.indices.map(\n (index) => mergedRenderSegments[index]\n )}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n return run.indices.map((index) => (\n <React.Fragment key={`md-${index}`}>\n {mergedRenderSegments[index].type === \"markdown\" &&\n mergedRenderSegments[index].pending\n ? null\n : renderMarkdownSegments(\n safeRichMarkdownContent[index],\n `md-${index}`\n )}\n </React.Fragment>\n ));\n })}\n {customBar}\n </div>\n );\n }\n\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={index}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customBar}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["FIXED_TYPEWRITER_CHUNK_SIZE","SvgBlockInShadow","svg","inline","hostRef","useRef","Wrapper","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","MarkdownComponentRuntimeContext","React","MarkdownCode","props","receivedTree","codeProps","runtimeValuesRef","isInCodeBlock","CodeBlockContext","className","children","rest","chartContent","complete","mermaidBlockIsComplete","MermaidChart","sourceRehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","formattingRehypePlugins","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","rehypePlugins","MarkdownRenderer","markdownContent","components","locale","texts","getContentRenderLocaleTexts","ReactMarkdown","remarkPlugins","referenceIndex","rereferenceIndex","reference","usePreparedTree","StableVideoMarkdownRenderer","plan","renderedSegments","prepared","useMemo","sourceProcessor","unified","remarkRehype","formattingProcessor","tree","cloneVideoMarkdownSourceTree","prepareVideoMarkdownRun","projected","projectVideoMarkdownRun","originalComponents","wrappers","stableComponents","tags","collect","result","tag","Component","state","getVideoMarkdownNodeState","Fragment","Original","visibleProps","preparedPlugins","isImmediateSegment","segment","mergeNonSandboxSegments","segments","merged","last","closeTypedInlineCode","visible","source","ranges","range","start","end","delimiter","closingStart","protectTypedMarkdownPrefix","inlineCodeRanges","metadataRanges","sourceOffset","closed","escapeTypedMarkdownMetadata","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","areStringArraysEqual","left","right","index","useStableStringArray","values","valuesRef","ContentRender","content","contentType","lang","dir","customRenderBar","onSend","typingSpeed","enableTypewriter","typewriterPacing","onTypeFinished","onTypewriterStateChange","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","localeTexts","mermaidMessages","direction","getMarkdownFlowDirection","language","getMarkdownFlowLanguage","resolvedConfirmButtonText","resolvedCopyButtonText","resolvedCopiedButtonText","resolvedSandboxFullscreenButtonText","resolvedSandboxExitFullscreenButtonText","isTypewriterEnabled","sourceContent","normalizeWrappedSandboxContent","sourceAnalysis","getMarkdownSourceAnalysis","sourceSegments","splitContentSegments","hasRichSegments","typewriterContent","typewriterTickMs","fixedTypewriterContentVersion","displayContent","setDisplayContent","useState","displayContentRef","pendingContentRef","contentAwareQueueRef","contentAwareBudgetRef","previousTypewriterEnabledRef","previousTypewriterPacingRef","previousSourceContentRef","previousReceivedContentRef","hasReportedTypeFinishedRef","typewriterWakeVersion","setTypewriterWakeVersion","wasTypewriterEnabled","previousTypewriterPacing","previousSourceContent","wasPending","receivedContentChanged","receivedContentAppended","clearPendingContent","updateDisplayContent","nextContent","visibleContent","getTrailingTypewriterGrapheme","sharedLength","nextPendingContent","previousPendingContent","appended","appendContentAwareTypewriterQueue","version","typewriterTimer","chunk","consumeContentAwareTypewriterQueue","CONTENT_AWARE_TYPEWRITER_TICK_BUDGET","isContentAwareTypewriterQueueEmpty","nextDisplayContent","mergedRenderSegments","textOffset","typewriterState","remaining","sourceSegmentOffsets","offset","sourceInlineCodeRanges","getInlineCodeRanges","safeRichMarkdownContent","richRenderRuns","runs","previous","run","fullSource","createVideoMarkdownRunPlan","renderContent","normalizedContent","normalizeInlineHtml","safeMarkdownContent","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","trimVariablePadding","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","stableDefaultSelectedValues","componentRuntimeValuesRef","CustomButtonInputVariable","CodeBlock","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","key","customBar","jsxs","idx","IframeSandbox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAMA,KAA8B,GA6E9BC,KAAgE,CAAC;AAAA,EACrE,KAAAC;AAAA,EACA,QAAAC,IAAS;AACX,MAAM;AACJ,QAAMC,IAAUC,EAA2B,IAAI,GACzCC,IAAUH,IAAS,SAAS;AAElC,SAAAI,GAAU,MAAM;AACd,UAAMC,IAAOJ,EAAQ;AACrB,QAAI,CAACI,EAAM;AACX,UAAMC,IAAaD,EAAK,cAAcA,EAAK,aAAa,EAAE,MAAM,QAAQ,GAClEE,IAAU;AAChB,QAAIC,IAAUF,EAAW,eAAeC,CAAO;AAE/C,IAAKC,MACHA,IAAU,SAAS,cAAc,OAAO,GACxCA,EAAQ,KAAKD,GAEbC,EAAQ,cAAc;AAAA;AAAA;AAAA;AAAA,SAKtBF,EAAW,YAAYE,CAAO,IAGV,MAAM,KAAKF,EAAW,UAAU,EAAE;AAAA,MACtD,CAACG,MAASA,MAASD;AAAA,IAAA,EAEP,QAAQ,CAACC,MAASH,EAAW,YAAYG,CAAI,CAAC;AAE5D,UAAMC,IAAW,SAAS,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;AAAA,gBAEP,UAAA,gBAAAxN;AAAA,kBAAC4B;AAAA,kBAAA;AAAA,oBACC,QAAAG;AAAA,oBACA,YAAAD;AAAA,oBACA,SAASiM,EAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACf;AAAA,cAPK/H;AAAA,YAAA;AAYX,cAAI+H,EAAI,SAAS;AACf,mBACE,gBAAA/N;AAAA,cAACgB;AAAA,cAAA;AAAA,gBAEC,OAAO+M,EAAI;AAAA,gBACX,QAAQ,CAACA,EAAI;AAAA,gBACb,UAAU5F;AAAA,cAAA;AAAA,cAHLnC;AAAA,YAAA;AAQX,cAAI+H,EAAI,SAAS;AACf,mBAAO,gBAAA/N,EAACpC,IAAA,EAA6B,KAAKmQ,EAAI,SAAhB/H,CAAuB;AAAA,QAEzD,CAAC;AAAA,QAEAiI;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
1
|
+
{"version":3,"file":"ContentRender.es.js","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import { trimVariablePadding } from \"remark-flow\";\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport { unified, type PluggableList, type Plugin } from \"unified\";\nimport remarkRehype from \"remark-rehype\";\nimport type { Element, Root } from \"hast\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport CodeBlock, { CodeBlockContext } from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart, { type MermaidChartProps } from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport {\n getInlineCodeRanges,\n getMarkdownSourceAnalysis,\n} from \"./utils/inline-code-ranges\";\nimport { remarkPlugins } from \"./utils/markdown-plugins\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport {\n escapeTypedMarkdownMetadata,\n type MarkdownMetadataRange,\n} from \"./utils/escape-typed-metadata\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n appendContentAwareTypewriterQueue,\n CONTENT_AWARE_TYPEWRITER_TICK_BUDGET,\n consumeContentAwareTypewriterQueue,\n getTrailingTypewriterGrapheme,\n isContentAwareTypewriterQueueEmpty,\n type ContentAwareTypewriterQueue,\n} from \"./utils/typewriter-pacing\";\nimport {\n normalizeWrappedSandboxContent,\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport {\n createVideoMarkdownRunPlan,\n cloneVideoMarkdownSourceTree,\n projectVideoMarkdownRun,\n prepareVideoMarkdownRun,\n getVideoMarkdownNodeState,\n type VideoMarkdownRunPlan,\n} from \"./utils/video-markdown-run\";\n\nconst FIXED_TYPEWRITER_CHUNK_SIZE = 2;\n\nexport type ContentRenderTypewriterPacing = \"fixed\" | \"content-aware\";\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /** Locale used for built-in UI text when a more specific text prop is not provided. */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language; omitted values inherit from the host. */\n lang?: string;\n /** Overrides locale-derived direction; omitted values inherit when no locale is set. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n /** Types prose only; following HTML renders progressively once preceding prose is displayed. */\n enableTypewriter?: boolean;\n /** Controls how much text is revealed per tick. Defaults to the legacy fixed pacing. */\n typewriterPacing?: ContentRenderTypewriterPacing;\n onTypeFinished?: () => void;\n onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Exit fullscreen button text for iframe sandbox\n sandboxExitFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n}\n\nexport interface ContentRenderTypewriterState {\n isTypewriterEnabled: boolean;\n isTyping: boolean;\n isComplete: boolean;\n /** Received source units already displayed, including unpaced HTML. */\n renderedLength: number;\n totalLength: number;\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string; inline?: boolean }> = ({\n svg,\n inline = false,\n}) => {\n const hostRef = useRef<HTMLElement | null>(null);\n const Wrapper = inline ? \"span\" : \"div\";\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <Wrapper className=\"content-render-svg-scroll\">\n <Wrapper\n className=\"content-render-svg\"\n ref={(node) => {\n hostRef.current = node;\n }}\n />\n </Wrapper>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\ntype MarkdownComponentRuntimeValues = {\n direction?: ContentRenderProps[\"dir\"];\n language?: string;\n mermaidMessages: MermaidChartProps[\"messages\"];\n beforeSend?: (param: OnSendContentParams) => boolean;\n locale?: MarkdownFlowLocale;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n readonly: boolean;\n renderContent: string;\n resolvedConfirmButtonText: string;\n resolvedCopiedButtonText: string;\n resolvedCopyButtonText: string;\n resolvedDefaultButtonText?: string;\n resolvedDefaultInputText?: string;\n resolvedDefaultSelectedValues?: string[];\n};\n\nconst MarkdownComponentRuntimeContext =\n React.createContext<React.RefObject<MarkdownComponentRuntimeValues> | null>(\n null\n );\n\nconst MarkdownCode = (\n props: React.ComponentProps<\"code\"> & { receivedTree?: boolean }\n) => {\n const { receivedTree, ...codeProps } = props;\n const runtimeValuesRef = React.useContext(MarkdownComponentRuntimeContext);\n const isInCodeBlock = React.useContext(CodeBlockContext);\n if (!runtimeValuesRef) {\n throw new Error(\"Markdown code renderer requires ContentRender context.\");\n }\n const { className, children, ...rest } = codeProps as {\n className?: string;\n children?: React.ReactNode;\n dir?: string;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const complete = mermaidBlockIsComplete(\n runtimeValuesRef.current.renderContent,\n chartContent\n );\n // The received-tree path replaces standalone Mermaid segments, whose\n // unfinished charts freeze until the closing fence reaches the prose budget.\n const frozen = receivedTree ? !complete : complete;\n return (\n <MermaidChart\n chart={chartContent}\n frozen={frozen}\n messages={runtimeValuesRef.current.mermaidMessages}\n />\n );\n }\n\n return (\n <code\n className={className}\n {...rest}\n dir={rest.dir ?? (isInCodeBlock ? undefined : \"ltr\")}\n >\n {children}\n </code>\n );\n};\n\nconst sourceRehypePlugins: PluggableList = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n];\nconst formattingRehypePlugins: PluggableList = [\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\nconst rehypePlugins: PluggableList = [\n ...sourceRehypePlugins,\n ...formattingRehypePlugins,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ content: markdownContent, components, locale }) => {\n const texts = getContentRenderLocaleTexts(locale);\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n remarkRehypeOptions={{\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) => {\n const reference =\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\");\n return texts.footnoteBackLabel.replace(\"{reference}\", reference);\n },\n }}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n );\n};\n\n// ReactMarkdown still owns URL handling and JSX conversion. Its parser is\n// bypassed because the received source was already parsed and transformed.\nconst usePreparedTree: Plugin = function () {\n this.parser = () => ({ type: \"root\", children: [] });\n};\n\nconst StableVideoMarkdownRenderer: React.FC<{\n plan: VideoMarkdownRunPlan;\n renderedSegments: readonly RenderSegment[];\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ plan, renderedSegments, components, locale }) => {\n const prepared = useMemo(() => {\n const texts = getContentRenderLocaleTexts(locale);\n const sourceProcessor = unified()\n .use(remarkPlugins)\n .use(remarkRehype, {\n allowDangerousHtml: true,\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) =>\n texts.footnoteBackLabel.replace(\n \"{reference}\",\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\")\n ),\n })\n .use(sourceRehypePlugins);\n const formattingProcessor = unified().use(formattingRehypePlugins);\n const tree = sourceProcessor.runSync(\n cloneVideoMarkdownSourceTree(plan),\n plan.markdownSource\n ) as Root;\n return prepareVideoMarkdownRun(\n plan,\n tree,\n (value) => formattingProcessor.runSync(value, plan.fullSource) as Root\n );\n }, [plan, locale]);\n const projected = useMemo(\n () => projectVideoMarkdownRun(prepared, renderedSegments),\n [prepared, renderedSegments]\n );\n const originalComponents = useRef(components);\n originalComponents.current = components;\n const wrappers = useRef(\n new Map<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n >()\n );\n const stableComponents = useMemo(() => {\n const tags = new Set<string>();\n const collect = (node: Root | Root[\"children\"][number]) => {\n if (node.type === \"element\") tags.add(node.tagName);\n if (\"children\" in node) node.children.forEach(collect);\n };\n collect(prepared.tree!);\n const result: Record<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n > = {};\n for (const tag of tags) {\n if (!wrappers.current.has(tag)) {\n const Component = ({\n node,\n children,\n ...props\n }: {\n node: Element;\n children?: React.ReactNode;\n }) => {\n const state = getVideoMarkdownNodeState(node);\n if (state?.svg) {\n return state.svgSource ? (\n <SvgBlockInShadow svg={state.svgSource} inline />\n ) : null;\n }\n if (state?.atomic) {\n return state.active ? <>{children}</> : null;\n }\n if (state?.active === false && tag !== \"a\") return null;\n const current = originalComponents.current as Record<\n string,\n React.ElementType\n >;\n const Original = current[tag];\n const visibleProps =\n state?.active === false\n ? { ...props, href: undefined, tabIndex: -1 }\n : props;\n return Original\n ? React.createElement(\n Original,\n {\n ...visibleProps,\n node,\n ...(Original === MarkdownCode ? { receivedTree: true } : {}),\n },\n children\n )\n : React.createElement(tag, visibleProps, children);\n };\n Component.displayName = `StableMarkdown(${tag})`;\n wrappers.current.set(tag, Component);\n }\n result[tag] = wrappers.current.get(tag)!;\n }\n return result as CustomComponents;\n }, [prepared]);\n const preparedPlugins = useMemo<PluggableList>(\n () => [() => () => projected],\n [projected]\n );\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={[usePreparedTree]}\n rehypePlugins={preparedPlugins}\n components={stableComponents}\n >\n {\"\"}\n </ReactMarkdown>\n </div>\n );\n};\n\nconst isImmediateSegment = (segment: RenderSegment) =>\n segment.type === \"markdown\" && segment.immediate === true;\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\" && !isImmediateSegment(last)) {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst closeTypedInlineCode = (\n visible: string,\n source: string,\n ranges: ReturnType<typeof getInlineCodeRanges>\n) => {\n if (visible.length >= source.length) return visible;\n const range = ranges.find(\n ({ start, end }) => start < visible.length && visible.length < end\n );\n if (!range) return visible;\n const delimiter = /^`+/.exec(source.slice(range.start))?.[0];\n if (!delimiter || visible.length < range.start + delimiter.length) {\n return visible;\n }\n const closingStart = range.end - delimiter.length;\n if (visible.length > closingStart) {\n return visible + delimiter.slice(visible.length - closingStart);\n }\n // Close only the render copy so a typed prefix cannot activate code as HTML.\n return visible + (visible.endsWith(\"`\") ? \" \" : \"\") + delimiter;\n};\n\nconst protectTypedMarkdownPrefix = (\n visible: string,\n source: string,\n inlineCodeRanges: ReturnType<typeof getInlineCodeRanges>,\n metadataRanges: readonly MarkdownMetadataRange[],\n sourceOffset = 0\n) => {\n // Both protections use raw coordinates. Append any synthetic code delimiter\n // after escaping so encoded '<' characters cannot shift the typing budget.\n const closed = closeTypedInlineCode(visible, source, inlineCodeRanges);\n return (\n escapeTypedMarkdownMetadata(visible, metadataRanges, sourceOffset) +\n closed.slice(visible.length)\n );\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst areStringArraysEqual = (left?: string[], right?: string[]) => {\n if (left === right) {\n return true;\n }\n if (!left || !right || left.length !== right.length) {\n return false;\n }\n return left.every((value, index) => value === right[index]);\n};\n\nconst useStableStringArray = (values?: string[]) => {\n const valuesRef = useRef<string[] | undefined>(values);\n\n if (!areStringArraysEqual(valuesRef.current, values)) {\n valuesRef.current = values;\n }\n\n return valuesRef.current;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n contentType,\n locale,\n lang,\n dir,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n typewriterPacing = \"fixed\",\n onTypeFinished,\n onTypewriterStateChange,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxExitFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const mermaidMessages = useMemo(\n () => ({\n loading: localeTexts.mermaidLoadingText,\n emptyChart: localeTexts.mermaidEmptyChartText,\n error: localeTexts.mermaidErrorText,\n }),\n [localeTexts]\n );\n const direction = dir ?? getMarkdownFlowDirection(locale);\n const language = lang ?? getMarkdownFlowLanguage(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const resolvedCopyButtonText = copyButtonText || localeTexts.copyButtonText;\n const resolvedCopiedButtonText =\n copiedButtonText || localeTexts.copiedButtonText;\n const resolvedSandboxFullscreenButtonText =\n sandboxFullscreenButtonText || localeTexts.sandboxFullscreenButtonText;\n const resolvedSandboxExitFullscreenButtonText =\n sandboxExitFullscreenButtonText ||\n localeTexts.sandboxExitFullscreenButtonText;\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const sourceContent = useMemo(\n () => normalizeWrappedSandboxContent(content),\n [content]\n );\n const sourceAnalysis = useMemo(\n () => getMarkdownSourceAnalysis(sourceContent),\n [sourceContent]\n );\n // Parse the received source, never a typewriter-truncated HTML string.\n const sourceSegments = useMemo(() => {\n const segments = mergeNonSandboxSegments(\n splitContentSegments(sourceContent, true, true, sourceAnalysis)\n );\n if (\n sourceContent !== content &&\n segments.length &&\n (segments[0].type === \"sandbox\" || isImmediateSegment(segments[0]))\n ) {\n // The removed opening quote occupied a prose slot before the wrapper\n // completed. Retain its empty slot so the existing iframe keeps its key.\n return [{ type: \"text\" as const, value: \"\" }, ...segments];\n }\n return segments;\n }, [content, sourceContent, sourceAnalysis]);\n const hasRichSegments = sourceSegments.some(\n (segment) => segment.type === \"sandbox\" || isImmediateSegment(segment)\n );\n const typewriterContent = hasRichSegments\n ? sourceSegments\n .filter(\n (segment) =>\n segment.type !== \"sandbox\" && !isImmediateSegment(segment)\n )\n .map((segment) => segment.value)\n .join(\"\")\n : sourceContent;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const fixedTypewriterContentVersion =\n typewriterPacing === \"fixed\" ? typewriterContent : undefined;\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : typewriterContent\n );\n const displayContentRef = useRef(displayContent);\n const pendingContentRef = useRef(\"\");\n const contentAwareQueueRef = useRef<ContentAwareTypewriterQueue>({\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n });\n const contentAwareBudgetRef = useRef(0);\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n const previousTypewriterPacingRef = useRef(typewriterPacing);\n const previousSourceContentRef = useRef(typewriterContent);\n const previousReceivedContentRef = useRef(content);\n const hasReportedTypeFinishedRef = useRef(false);\n const [typewriterWakeVersion, setTypewriterWakeVersion] = useState(0);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n const previousTypewriterPacing = previousTypewriterPacingRef.current;\n const previousSourceContent = previousSourceContentRef.current;\n const wasPending = Boolean(pendingContentRef.current);\n const receivedContentChanged =\n previousReceivedContentRef.current !== content;\n const receivedContentAppended =\n receivedContentChanged &&\n content.startsWith(previousReceivedContentRef.current);\n previousReceivedContentRef.current = content;\n\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n previousTypewriterPacingRef.current = typewriterPacing;\n previousSourceContentRef.current = typewriterContent;\n\n if (\n receivedContentChanged ||\n isTypewriterEnabled !== wasTypewriterEnabled\n ) {\n hasReportedTypeFinishedRef.current = false;\n }\n\n const clearPendingContent = () => {\n pendingContentRef.current = \"\";\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n };\n\n const updateDisplayContent = (nextContent: string) => {\n displayContentRef.current = nextContent;\n setDisplayContent(nextContent);\n };\n\n if (!isTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(typewriterContent);\n return;\n }\n\n if (!wasTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(\"\");\n }\n\n let visibleContent = !wasTypewriterEnabled ? \"\" : displayContentRef.current;\n\n if (!typewriterContent.startsWith(visibleContent)) {\n clearPendingContent();\n if (!receivedContentAppended) {\n updateDisplayContent(typewriterContent);\n if (typewriterPacing === \"content-aware\") {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(typewriterContent),\n };\n }\n return;\n }\n // A newly recognized HTML tag can replace a previously literal prefix.\n // Keep the shared prose visible and pace only the newly received prose.\n let sharedLength = 0;\n while (\n sharedLength < visibleContent.length &&\n sharedLength < typewriterContent.length &&\n visibleContent[sharedLength] === typewriterContent[sharedLength]\n ) {\n sharedLength += 1;\n }\n visibleContent = visibleContent.slice(0, sharedLength);\n updateDisplayContent(visibleContent);\n }\n\n let nextPendingContent = typewriterContent.slice(visibleContent.length);\n if (!nextPendingContent) {\n pendingContentRef.current = \"\";\n contentAwareBudgetRef.current = 0;\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n return;\n }\n\n if (typewriterPacing === \"content-aware\") {\n const previousPendingContent = previousSourceContent.slice(\n visibleContent.length\n );\n const canAppendToCachedQueue =\n wasTypewriterEnabled &&\n previousTypewriterPacing === \"content-aware\" &&\n typewriterContent.startsWith(previousSourceContent) &&\n pendingContentRef.current === previousPendingContent;\n\n if (canAppendToCachedQueue) {\n const appended = appendContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n typewriterContent.slice(previousSourceContent.length)\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n } else {\n const appended = appendContentAwareTypewriterQueue(\n {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n },\n nextPendingContent\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n\n contentAwareBudgetRef.current = 0;\n }\n } else {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n }\n\n pendingContentRef.current = nextPendingContent;\n\n if (!wasPending && nextPendingContent) {\n setTypewriterWakeVersion((version) => version + 1);\n }\n }, [content, typewriterContent, isTypewriterEnabled, typewriterPacing]);\n\n useEffect(() => {\n if (!isTypewriterEnabled) {\n return;\n }\n\n if (\n hasReportedTypeFinishedRef.current ||\n pendingContentRef.current ||\n displayContent !== typewriterContent\n ) {\n return;\n }\n\n hasReportedTypeFinishedRef.current = true;\n onTypeFinished?.();\n }, [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n onTypeFinished,\n ]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n if (!pendingContentRef.current) {\n return;\n }\n\n let chunk = \"\";\n\n if (typewriterPacing === \"content-aware\") {\n const result = consumeContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n contentAwareBudgetRef.current + CONTENT_AWARE_TYPEWRITER_TICK_BUDGET\n );\n\n chunk = result.chunk;\n contentAwareQueueRef.current = result.queue;\n\n if (isContentAwareTypewriterQueueEmpty(result.queue)) {\n contentAwareBudgetRef.current = 0;\n } else {\n contentAwareBudgetRef.current = result.remainingBudget;\n }\n } else {\n const fixedChunk = splitTextByCharacterChunk(\n pendingContentRef.current,\n FIXED_TYPEWRITER_CHUNK_SIZE\n );\n chunk = fixedChunk.chunk;\n }\n\n if (!chunk) {\n return;\n }\n\n pendingContentRef.current = pendingContentRef.current.slice(chunk.length);\n if (!pendingContentRef.current) {\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: contentAwareQueueRef.current.trailingGrapheme,\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n contentAwareBudgetRef.current = 0;\n }\n\n const nextDisplayContent = `${displayContentRef.current}${chunk}`;\n displayContentRef.current = nextDisplayContent;\n setDisplayContent(nextDisplayContent);\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n displayContent,\n fixedTypewriterContentVersion,\n isTypewriterEnabled,\n typewriterPacing,\n typewriterTickMs,\n typewriterWakeVersion,\n ]);\n\n const mergedRenderSegments = useMemo(() => {\n let textOffset = 0;\n return sourceSegments.map((segment) => {\n if (!isTypewriterEnabled) return segment;\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n // HTML skips the prose budget only after earlier prose has caught up.\n // Retain its source slot so later updates keep the same render key.\n return displayContent.length >= textOffset\n ? segment\n : { ...segment, value: \"\" };\n }\n const value = displayContent.slice(\n textOffset,\n textOffset + segment.value.length\n );\n textOffset += segment.value.length;\n // Keep empty prose slots so an existing sandbox never changes its key.\n return { ...segment, value };\n });\n }, [sourceSegments, displayContent, isTypewriterEnabled]);\n const typewriterState = useMemo<ContentRenderTypewriterState>(\n () => ({\n isTypewriterEnabled,\n isTyping: isTypewriterEnabled && displayContent !== typewriterContent,\n isComplete: displayContent === typewriterContent,\n renderedLength:\n content.length -\n sourceSegments.reduce(\n (remaining, segment, index) =>\n remaining +\n segment.value.length -\n mergedRenderSegments[index].value.length,\n 0\n ),\n totalLength: content.length,\n }),\n [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n sourceSegments,\n mergedRenderSegments,\n ]\n );\n\n useEffect(() => {\n onTypewriterStateChange?.(typewriterState);\n }, [onTypewriterStateChange, typewriterState]);\n const sourceSegmentOffsets = useMemo(() => {\n let offset = 0;\n return sourceSegments.map((segment) => {\n const start = offset;\n offset += segment.value.length;\n return start;\n });\n }, [sourceSegments]);\n const sourceInlineCodeRanges = useMemo(\n () =>\n isTypewriterEnabled\n ? sourceSegments.map((segment) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? []\n : segment.value === sourceContent\n ? sourceAnalysis.inline\n : getInlineCodeRanges(segment.value)\n )\n : [],\n [isTypewriterEnabled, sourceSegments, sourceContent, sourceAnalysis]\n );\n const safeRichMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? mergedRenderSegments.map((segment, index) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? segment.value\n : isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n segment.value,\n sourceSegments[index].value,\n sourceInlineCodeRanges[index] ?? [],\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n : escapeTypedMarkdownMetadata(\n segment.value,\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n )\n : [],\n [\n hasRichSegments,\n isTypewriterEnabled,\n mergedRenderSegments,\n sourceInlineCodeRanges,\n sourceSegments,\n sourceAnalysis.metadata,\n sourceSegmentOffsets,\n ]\n );\n const richRenderRuns = useMemo(() => {\n const runs: Array<{\n indices: number[];\n sandbox: boolean;\n plan?: ReturnType<typeof createVideoMarkdownRunPlan>;\n }> = [];\n sourceSegments.forEach((segment, index) => {\n const previous = runs.at(-1);\n if (segment.type !== \"sandbox\" && previous && !previous.sandbox) {\n previous.indices.push(index);\n } else {\n runs.push({ indices: [index], sandbox: segment.type === \"sandbox\" });\n }\n });\n for (const run of runs) {\n if (\n !run.sandbox &&\n run.indices.some((index) => isImmediateSegment(sourceSegments[index]))\n ) {\n const segments = run.indices.map((index) => sourceSegments[index]);\n const fullSource = segments.map((segment) => segment.value).join(\"\");\n run.plan = createVideoMarkdownRunPlan(\n segments,\n fullSource === sourceContent ? sourceAnalysis : undefined\n );\n }\n }\n return runs;\n }, [sourceSegments, sourceContent, sourceAnalysis]);\n const renderContent = hasRichSegments\n ? mergedRenderSegments.map((segment) => segment.value).join(\"\")\n : isTypewriterEnabled\n ? displayContent\n : sourceContent;\n const normalizedContent = useMemo(\n () => (customRenderBar ? normalizeInlineHtml(renderContent) : \"\"),\n [customRenderBar, renderContent]\n );\n\n const safeMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? \"\"\n : normalizeInlineHtml(\n isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n renderContent,\n sourceContent,\n sourceInlineCodeRanges[0] ?? [],\n sourceAnalysis.metadata\n )\n : escapeTypedMarkdownMetadata(\n renderContent,\n sourceAnalysis.metadata\n )\n ),\n [\n sourceContent,\n hasRichSegments,\n isTypewriterEnabled,\n renderContent,\n sourceInlineCodeRanges,\n sourceAnalysis.metadata,\n ]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n (defaultButtonText ? trimVariablePadding(defaultButtonText) : undefined) ||\n interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => trimVariablePadding(value))\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n const stableDefaultSelectedValues = useStableStringArray(\n resolvedDefaultSelectedValues\n );\n const componentRuntimeValuesRef = useRef<MarkdownComponentRuntimeValues>({\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n });\n\n componentRuntimeValuesRef.current = {\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n };\n\n const components = useMemo<CustomComponents>(\n () => ({\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={\n componentRuntimeValuesRef.current.onClickCustomButtonAfterContent\n }\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={componentRuntimeValuesRef.current.readonly}\n defaultButtonText={\n componentRuntimeValuesRef.current.resolvedDefaultButtonText\n }\n defaultInputText={\n componentRuntimeValuesRef.current.resolvedDefaultInputText\n }\n defaultSelectedValues={\n componentRuntimeValuesRef.current.resolvedDefaultSelectedValues\n }\n onSend={componentRuntimeValuesRef.current.onSend}\n beforeSend={componentRuntimeValuesRef.current.beforeSend}\n locale={componentRuntimeValuesRef.current.locale}\n dir={componentRuntimeValuesRef.current.direction}\n lang={componentRuntimeValuesRef.current.language}\n confirmButtonText={\n componentRuntimeValuesRef.current.resolvedConfirmButtonText\n }\n />\n ),\n code: MarkdownCode,\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={\n componentRuntimeValuesRef.current.resolvedCopyButtonText\n }\n copiedButtonText={\n componentRuntimeValuesRef.current.resolvedCopiedButtonText\n }\n />\n ),\n }),\n []\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(safeMarkdownContent),\n [safeMarkdownContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={key}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={key}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n const customBar = customRenderBar ? (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n ) : null;\n\n if (hasRichSegments) {\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {richRenderRuns.map((run) => {\n const idx = run.indices[0];\n const segment = mergedRenderSegments[idx];\n if (run.sandbox)\n return segment.type === \"sandbox\" &&\n segment.value &&\n !segment.pending ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n locale={locale}\n dir={direction}\n lang={language}\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={resolvedSandboxFullscreenButtonText}\n exitFullScreenButtonText={\n resolvedSandboxExitFullscreenButtonText\n }\n mode={sandboxMode}\n />\n ) : null;\n if (run.plan)\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={`md-${idx}`}\n value={componentRuntimeValuesRef}\n >\n <StableVideoMarkdownRenderer\n locale={locale}\n components={components}\n plan={run.plan}\n renderedSegments={run.indices.map(\n (index) => mergedRenderSegments[index]\n )}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n return run.indices.map((index) => (\n <React.Fragment key={`md-${index}`}>\n {mergedRenderSegments[index].type === \"markdown\" &&\n mergedRenderSegments[index].pending\n ? null\n : renderMarkdownSegments(\n safeRichMarkdownContent[index],\n `md-${index}`\n )}\n </React.Fragment>\n ));\n })}\n {customBar}\n </div>\n );\n }\n\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={index}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customBar}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["FIXED_TYPEWRITER_CHUNK_SIZE","SvgBlockInShadow","svg","inline","hostRef","useRef","Wrapper","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","MarkdownComponentRuntimeContext","React","MarkdownCode","props","receivedTree","codeProps","runtimeValuesRef","isInCodeBlock","CodeBlockContext","className","children","rest","chartContent","complete","mermaidBlockIsComplete","MermaidChart","sourceRehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","formattingRehypePlugins","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","rehypePlugins","MarkdownRenderer","markdownContent","components","locale","texts","getContentRenderLocaleTexts","ReactMarkdown","remarkPlugins","referenceIndex","rereferenceIndex","reference","usePreparedTree","StableVideoMarkdownRenderer","plan","renderedSegments","prepared","useMemo","sourceProcessor","unified","remarkRehype","formattingProcessor","tree","cloneVideoMarkdownSourceTree","prepareVideoMarkdownRun","projected","projectVideoMarkdownRun","originalComponents","wrappers","stableComponents","tags","collect","result","tag","Component","state","getVideoMarkdownNodeState","Fragment","Original","visibleProps","preparedPlugins","isImmediateSegment","segment","mergeNonSandboxSegments","segments","merged","last","closeTypedInlineCode","visible","source","ranges","range","start","end","delimiter","closingStart","protectTypedMarkdownPrefix","inlineCodeRanges","metadataRanges","sourceOffset","closed","escapeTypedMarkdownMetadata","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","areStringArraysEqual","left","right","index","useStableStringArray","values","valuesRef","ContentRender","content","contentType","lang","dir","customRenderBar","onSend","typingSpeed","enableTypewriter","typewriterPacing","onTypeFinished","onTypewriterStateChange","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","localeTexts","mermaidMessages","direction","getMarkdownFlowDirection","language","getMarkdownFlowLanguage","resolvedConfirmButtonText","resolvedCopyButtonText","resolvedCopiedButtonText","resolvedSandboxFullscreenButtonText","resolvedSandboxExitFullscreenButtonText","isTypewriterEnabled","sourceContent","normalizeWrappedSandboxContent","sourceAnalysis","getMarkdownSourceAnalysis","sourceSegments","splitContentSegments","hasRichSegments","typewriterContent","typewriterTickMs","fixedTypewriterContentVersion","displayContent","setDisplayContent","useState","displayContentRef","pendingContentRef","contentAwareQueueRef","contentAwareBudgetRef","previousTypewriterEnabledRef","previousTypewriterPacingRef","previousSourceContentRef","previousReceivedContentRef","hasReportedTypeFinishedRef","typewriterWakeVersion","setTypewriterWakeVersion","wasTypewriterEnabled","previousTypewriterPacing","previousSourceContent","wasPending","receivedContentChanged","receivedContentAppended","clearPendingContent","updateDisplayContent","nextContent","visibleContent","getTrailingTypewriterGrapheme","sharedLength","nextPendingContent","previousPendingContent","appended","appendContentAwareTypewriterQueue","version","typewriterTimer","chunk","consumeContentAwareTypewriterQueue","CONTENT_AWARE_TYPEWRITER_TICK_BUDGET","isContentAwareTypewriterQueueEmpty","nextDisplayContent","mergedRenderSegments","textOffset","typewriterState","remaining","sourceSegmentOffsets","offset","sourceInlineCodeRanges","getInlineCodeRanges","safeRichMarkdownContent","richRenderRuns","runs","previous","run","fullSource","createVideoMarkdownRunPlan","renderContent","normalizedContent","normalizeInlineHtml","safeMarkdownContent","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","trimVariablePadding","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","stableDefaultSelectedValues","componentRuntimeValuesRef","CustomButtonInputVariable","CodeBlock","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","key","customBar","jsxs","idx","IframeSandbox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,MAAMA,KAA8B,GA4E9BC,KAAgE,CAAC;AAAA,EACrE,KAAAC;AAAA,EACA,QAAAC,IAAS;AACX,MAAM;AACJ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AAAhG,EAACE,EAAM,UAAN,EACE,UAAA2L,EAAqB7F,CAAK,EAAE,SAAS,cACtC6F,EAAqB7F,CAAK,EAAE,UACxB,OACA4H;AAAA,YACEvB,GAAwBrG,CAAK;AAAA,YAC7B,MAAMA,CAAK;AAAA,UAAA,EACb,GAPe,MAAMA,CAAK,EAQhC,CACD;AAAA,QACH,CAAC;AAAA,QACAiI;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAML,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,KAAK9F;AAAA,MACL,MAAME;AAAA,MAEL,UAAA;AAAA,QAAA/D,GAAS,IAAI,CAACwJ,GAAK/H,MAAU;AAC5B,cAAI+H,EAAI,SAAS;AACf,mBACE,gBAAA/N;AAAA,cAACC,GAAgC;AAAA,cAAhC;AAAA,gBAEC,OAAOuN;AAAA,gBAEP,UAAA,gBAAAxN;AAAA,kBAAC4B;AAAA,kBAAA;AAAA,oBACC,QAAAG;AAAA,oBACA,YAAAD;AAAA,oBACA,SAASiM,EAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACf;AAAA,cAPK/H;AAAA,YAAA;AAYX,cAAI+H,EAAI,SAAS;AACf,mBACE,gBAAA/N;AAAA,cAACgB;AAAA,cAAA;AAAA,gBAEC,OAAO+M,EAAI;AAAA,gBACX,QAAQ,CAACA,EAAI;AAAA,gBACb,UAAU5F;AAAA,cAAA;AAAA,cAHLnC;AAAA,YAAA;AAQX,cAAI+H,EAAI,SAAS;AACf,mBAAO,gBAAA/N,EAACpC,IAAA,EAA6B,KAAKmQ,EAAI,SAAhB/H,CAAuB;AAAA,QAEzD,CAAC;AAAA,QAEAiI;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),n=require("react"),ve=require("../../node_modules/@uiw/react-codemirror/esm/index.cjs"),Le=require("../../node_modules/@codemirror/autocomplete/dist/index.cjs"),ee=require("../../node_modules/@codemirror/view/dist/index.cjs"),Oe=require("../../node_modules/@codemirror/lang-markdown/dist/index.cjs"),te=require("../../node_modules/@codemirror/language/dist/index.cjs"),A=require("../ui/tooltip.cjs"),xe=require("./components/CustomDialog.cjs"),we=require("./components/EditorToolbar.cjs"),Se=require("./editor-context.cjs"),Te=require("./components/ImageInject.cjs"),Ee=require("./components/VideoInject.cjs"),m=require("./types.cjs");;/* empty css */const V=require("./utils.cjs"),be=require("./plugins/ImgPlaceholder.cjs"),Ve=require("./plugins/VideoPlaceholder.cjs"),qe=require("./plugins/mediaPlaceholderLabels.cjs"),oe=require("./plugins/SyntaxHighlighter.cjs"),F=require("../../node_modules/i18next/dist/esm/i18next.cjs"),v=require("./editorI18n.cjs"),_=require("../../lib/locale.cjs"),Pe=require("../../lib/useDetachedLanguage.cjs"),je=require("../../lib/useResolvedDirection.cjs"),ye=require("../../node_modules/react-i18next/dist/es/initReactI18next.cjs"),De=require("../../node_modules/react-i18next/dist/es/useTranslation.cjs");F.default.isInitialized?Object.entries(v.editorLocaleResources).forEach(([q,L])=>{F.default.addResourceBundle(q,"translation",L.translation,!0,!0)}):F.default.use(ye.initReactI18next).init({resources:v.editorLocaleResources,lng:v.DEFAULT_EDITOR_LOCALE,fallbackLng:v.DEFAULT_EDITOR_LOCALE,interpolation:{escapeValue:!1}});const Re=({content:q="",editMode:L="codeEdit",questionMode:f=!1,onChange:x,onBlur:ne,locale:P,lang:re,uploadProps:le,disabled:o=!1,toolbarActionsRight:j,onReady:ie})=>{const{t:s,i18n:y}=De.useTranslation(),w=_.normalizeMarkdownFlowLocale(P??v.DEFAULT_EDITOR_LOCALE),B=_.getMarkdownFlowDirection(P),H=re??_.getMarkdownFlowLanguage(P);n.useEffect(()=>{y.language!==w&&y.changeLanguage(w)},[y,w]);const a=v.getEditorLocaleMessages(w),d=n.useMemo(()=>({image:s("toolbarInsertImage",{defaultValue:"Insert image"}),video:s("toolbarInsertVideo",{defaultValue:"Insert video"}),confirmOutput:s("toolbarConfirmOutput",{defaultValue:"Confirm output"}),insertLink:s("toolbarInsertLink",{defaultValue:"Insert link"}),insertButton:s("toolbarInsertButton",{defaultValue:"Insert button"}),insertSingleChoice:s("toolbarInsertSingleChoice",{defaultValue:"Insert single choice"}),insertMultiChoice:s("toolbarInsertMultiChoice",{defaultValue:"Insert multi choice"}),insertInput:s("toolbarInsertInput",{defaultValue:"Insert input"}),singleChoiceOption1:s("toolbarChoiceOption1",{defaultValue:"Option 1"}),singleChoiceOption2:s("toolbarChoiceOption2",{defaultValue:"Option 2"}),inputPlaceholder:s("toolbarInputPlaceholder",{defaultValue:"Please enter"})}),[s]),se=L==="quickEdit"?s("placeholderQuickEdit",{defaultValue:s("placeholderCodeEdit",{defaultValue:s("placeholder")})}):s("placeholderCodeEdit",{defaultValue:s("placeholder")}),[D,p]=n.useState(!1),R=n.useRef(null),S=Pe.useDetachedLanguage(R,H),{resolvedDirection:T}=je.useResolvedDirection(R,B),[O,C]=n.useState(m.SelectedOption.Empty),[u,E]=n.useState(),l=n.useRef(null),ce={selectedOption:O,setSelectedOption:C,dialogOpen:D,setDialogOpen:p};n.useEffect(()=>{o&&(p(!1),C(m.SelectedOption.Empty),E(null))},[o,p,C,E]);const N=n.useCallback(e=>{o||(C(e),p(!0))},[o]),I=n.useCallback(e=>{if(o||!l.current)return;const{state:r,dispatch:i}=l.current,t=r.selection.main.from;i({changes:{from:t,insert:e},selection:{anchor:t+e.length}})},[l,o]),M=n.useCallback(e=>{if(o||!l.current)return;const{state:r,dispatch:i}=l.current,t=r.selection.main;i({changes:{from:t.from,to:t.to,insert:e},selection:{anchor:t.from+e.length}})},[o]),U=n.useCallback(()=>{l.current?.focus()},[]),z=n.useCallback(()=>l.current?.state.doc.toString()??"",[]),G=n.useCallback(e=>{if(o)return;if(!l.current){x?.(e);return}const r=l.current,{state:i,dispatch:t}=r;t({changes:{from:0,to:i.doc.length,insert:e},selection:{anchor:e.length}})},[o,x]),b=n.useCallback(()=>{if(o||!u||!l.current||u.from===-1)return;const{from:e,to:r}=u,{dispatch:i}=l.current;i({changes:{from:e,to:r,insert:""}})},[u,l,o]),ae=n.useCallback(()=>{if(o||!l.current)return;const e=l.current,{state:r,dispatch:i}=e,t=r.selection.main;i({changes:{from:t.from,to:t.to,insert:"======"},selection:{anchor:t.from+3}}),e.focus()},[o]),ue=n.useCallback(()=>{if(o||!l.current)return;const e=l.current,{state:r,dispatch:i}=e,t=r.selection.main;i({changes:{from:t.from,to:t.to,insert:"[]()"},selection:{anchor:t.from+1}}),e.focus()},[o]),he=n.useCallback(()=>{if(o||!l.current)return;const e=l.current,{state:r,dispatch:i}=e,t=r.selection.main;i({changes:{from:t.from,to:t.to,insert:"?[]"},selection:{anchor:t.from+2}}),e.focus()},[o]),fe=n.useCallback(()=>{if(o||!l.current)return;const e=l.current,{state:r,dispatch:i}=e,t=r.selection.main,h=d.singleChoiceOption1,g=d.singleChoiceOption2,$=`?[%{{ ${f?a.questionPlaceholder:""} }} ${h} | ${g}]`;i({changes:{from:t.from,to:t.to,insert:$},selection:{anchor:t.from+6,head:t.from+6+(f?a.questionPlaceholder.length:0)}}),e.focus()},[o,d.singleChoiceOption1,d.singleChoiceOption2,f,a.questionPlaceholder]),de=n.useCallback(()=>{if(o||!l.current)return;const e=l.current,{state:r,dispatch:i}=e,t=r.selection.main,h=d.singleChoiceOption1,g=d.singleChoiceOption2,$=`?[%{{ ${f?a.questionPlaceholder:""} }} ${h} || ${g}]`;i({changes:{from:t.from,to:t.to,insert:$},selection:{anchor:t.from+6,head:t.from+6+(f?a.questionPlaceholder.length:0)}}),e.focus()},[o,d.singleChoiceOption1,d.singleChoiceOption2,f,a.questionPlaceholder]),me=n.useCallback(()=>{if(o||!l.current)return;const e=l.current,{state:r,dispatch:i}=e,t=r.selection.main,h=d.inputPlaceholder??"请输入",g=`?[%{{ ${f?a.questionPlaceholder:""} }}...${h}]`;i({changes:{from:t.from,to:t.to,insert:g},selection:{anchor:t.from+6,head:t.from+6+(f?a.questionPlaceholder.length:0)}}),e.focus()},[o,d.inputPlaceholder,f,a.questionPlaceholder]),pe=n.useCallback(({resourceUrl:e,resourceTitle:r,scalePercent:i})=>{if(!e||o)return;const t=V.getImageContentToInsert({resourceUrl:e,resourceTitle:r,scalePercent:i});if(u?.type===m.SelectedOption.Image){if(b(),!l.current)return;const{dispatch:h}=l.current;h({changes:{from:u.from,insert:t}})}else I(t);p(!1)},[b,o,I,u]),ge=n.useCallback(({resourceUrl:e,resourceTitle:r})=>{if(o)return;const i=V.getVideoContentToInsert(e,r);if(u?.type===m.SelectedOption.Video){if(b(),!l.current)return;const{dispatch:t}=l.current;t({changes:{from:u.from,insert:i}})}else I(i);p(!1)},[b,o,I,u]),Q=n.useCallback(()=>Le.autocompletion({override:[V.createSlashCommands(N,{image:a.slashImage,video:a.slashVideo})]}),[a.slashImage,a.slashVideo,N]),W=n.useCallback(e=>{l.current=e.view},[]),K=n.useCallback(e=>{if(e.stopPropagation(),o)return;const{type:r,from:i,to:t,dataset:h}=e.detail,g=V.parseContentInfo(r,h);E({type:r,value:g,from:i,to:t}),C(r),p(!0)},[o]);n.useEffect(()=>{D||(C(m.SelectedOption.Empty),E(null))},[D]),n.useEffect(()=>{const e=r=>{r.detail.view===l.current&&K(r)};return window.addEventListener("globalTagClick",e),()=>{window.removeEventListener("globalTagClick",e)}},[K]);const J=s("imageDefaultTitle"),X=s("videoDefaultTitle"),Y=n.useMemo(()=>qe.mediaPlaceholderLabels.of({image:J,video:X}),[J,X]),Ce=n.useMemo(()=>{const e=[ee.EditorView.lineWrapping,Oe.markdown(),te.syntaxHighlighting(te.defaultHighlightStyle),f?oe.QuestionSyntaxHighlighter:oe.default];return o||e.push(Q()),L==="quickEdit"&&e.push(Y,be.default,Ve.default),e.push(ee.EditorView.updateListener.of(r=>{W(r)})),e},[o,L,Q,W,Y,f]),Ie=n.useCallback(e=>{o||x?.(e)},[x,o]),k=n.useMemo(()=>({insertTextAtCursor:I,replaceSelection:M,focus:U,getContent:z,setContent:G}),[U,z,I,M,G]),Z=n.useCallback(e=>{o||"render"in e||e.onClick?.(k)},[o,k]),ke=n.useMemo(()=>j?.length?c.jsx("div",{className:"markdown-flow-editor-toolbar-right",children:j.map(e=>{if("render"in e)return c.jsx("div",{className:"markdown-flow-editor-toolbar-right-item",children:e.render(k)},e.key);const r=e.label||e.tooltip||void 0,i=c.jsxs("button",{type:"button",disabled:o||e.disabled,onClick:()=>Z(e),className:"markdown-flow-editor-toolbar-right-button","aria-label":r,title:e.label||e.tooltip,children:[e.icon?c.jsx("span",{className:"toolbar-right-icon",children:e.icon}):null,e.label?c.jsx("span",{className:"toolbar-right-label",children:e.label}):null]},e.key),t=e.tooltip?c.jsxs(A.Tooltip,{children:[c.jsx(A.TooltipTrigger,{asChild:!0,children:i}),c.jsx(A.TooltipContent,{side:"top",dir:T,lang:S,children:e.tooltip})]}):i;return c.jsx("div",{className:"markdown-flow-editor-toolbar-right-item",children:t},e.key)})}):null,[o,k,Z,T,S,j]);return n.useEffect(()=>{ie?.(k)},[k]),c.jsxs("div",{className:"markdown-flow-editor",ref:R,dir:B,lang:H,"data-disabled":o?"true":void 0,"aria-disabled":o,children:[c.jsx(we.default,{disabled:o,labels:d,tooltipDirection:T,tooltipLanguage:S,onSelect:N,onInsertConfirmOutput:ae,onInsertLink:ue,onInsertButton:he,onInsertSingleChoice:fe,onInsertMultiChoice:de,onInsertInputField:me,rightSlot:ke}),c.jsx("div",{className:"markdown-flow-editor-body relative overflow-auto",children:c.jsxs(Se.default.Provider,{value:ce,children:[c.jsx(ve.default,{extensions:Ce,basicSetup:{lineNumbers:!1,searchKeymap:!1,syntaxHighlighting:!0,highlightActiveLine:!0,highlightActiveLineGutter:!0,foldGutter:!1},className:"rounded-md",placeholder:se,value:q,theme:"light",minHeight:"2rem",editable:!o,onChange:Ie,onBlur:ne}),!o&&c.jsxs(xe.default,{dir:T,lang:S,labels:{closeButtonLabel:s("dialogCloseLabel"),title:O===m.SelectedOption.Image?s("dialogTitleImage"):O===m.SelectedOption.Video?s("dialogTitleVideo"):s("dialogTitle")},children:[O===m.SelectedOption.Image&&c.jsx(Te.default,{value:u?.value,onSelect:pe,uploadProps:le}),O===m.SelectedOption.Video&&c.jsx(Ee.default,{value:u?.value,onSelect:ge})]})]})})]})};exports.default=Re;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),n=require("react"),Ie=require("../../node_modules/@uiw/react-codemirror/esm/index.cjs"),ke=require("../../node_modules/@codemirror/autocomplete/dist/index.cjs"),Z=require("../../node_modules/@codemirror/view/dist/index.cjs"),ve=require("../../node_modules/@codemirror/lang-markdown/dist/index.cjs"),ee=require("../../node_modules/@codemirror/language/dist/index.cjs"),N=require("../ui/tooltip.cjs"),Le=require("./components/CustomDialog.cjs"),Oe=require("./components/EditorToolbar.cjs"),we=require("./editor-context.cjs"),xe=require("./components/ImageInject.cjs"),Te=require("./components/VideoInject.cjs"),d=require("./types.cjs");;/* empty css */const b=require("./utils.cjs"),Ee=require("./plugins/ImgPlaceholder.cjs"),Se=require("./plugins/VideoPlaceholder.cjs"),be=require("./plugins/mediaPlaceholderLabels.cjs"),Ve=require("./plugins/SyntaxHighlighter.cjs"),A=require("../../node_modules/i18next/dist/esm/i18next.cjs"),I=require("./editorI18n.cjs"),F=require("../../lib/locale.cjs"),qe=require("../../lib/useDetachedLanguage.cjs"),je=require("../../lib/useResolvedDirection.cjs"),ye=require("../../node_modules/react-i18next/dist/es/initReactI18next.cjs"),De=require("../../node_modules/react-i18next/dist/es/useTranslation.cjs");A.default.isInitialized?Object.entries(I.editorLocaleResources).forEach(([V,k])=>{A.default.addResourceBundle(V,"translation",k.translation,!0,!0)}):A.default.use(ye.initReactI18next).init({resources:I.editorLocaleResources,lng:I.DEFAULT_EDITOR_LOCALE,fallbackLng:I.DEFAULT_EDITOR_LOCALE,interpolation:{escapeValue:!1}});const Re=({content:V="",editMode:k="codeEdit",onChange:L,onBlur:te,locale:q,lang:oe,uploadProps:ne,disabled:t=!1,toolbarActionsRight:j,onReady:re})=>{const{t:s,i18n:y}=De.useTranslation(),O=F.normalizeMarkdownFlowLocale(q??I.DEFAULT_EDITOR_LOCALE),_=F.getMarkdownFlowDirection(q),$=oe??F.getMarkdownFlowLanguage(q);n.useEffect(()=>{y.language!==O&&y.changeLanguage(O)},[y,O]);const w=I.getEditorLocaleMessages(O),u=n.useMemo(()=>({image:s("toolbarInsertImage",{defaultValue:"Insert image"}),video:s("toolbarInsertVideo",{defaultValue:"Insert video"}),confirmOutput:s("toolbarConfirmOutput",{defaultValue:"Insert preserved output"}),insertLink:s("toolbarInsertLink",{defaultValue:"Insert link"}),insertButton:s("toolbarInsertButton",{defaultValue:"Insert button"}),insertSingleChoice:s("toolbarInsertSingleChoice",{defaultValue:"Insert single choice"}),insertMultiChoice:s("toolbarInsertMultiChoice",{defaultValue:"Insert multi choice"}),insertInput:s("toolbarInsertInput",{defaultValue:"Insert input"}),singleChoiceOption1:s("toolbarChoiceOption1",{defaultValue:"Option 1"}),singleChoiceOption2:s("toolbarChoiceOption2",{defaultValue:"Option 2"}),inputPlaceholder:s("toolbarInputPlaceholder",{defaultValue:"Please enter"})}),[s]),ie=k==="quickEdit"?s("placeholderQuickEdit",{defaultValue:s("placeholderCodeEdit",{defaultValue:s("placeholder")})}):s("placeholderCodeEdit",{defaultValue:s("placeholder")}),[D,h]=n.useState(!1),R=n.useRef(null),x=qe.useDetachedLanguage(R,$),{resolvedDirection:T}=je.useResolvedDirection(R,_),[v,m]=n.useState(d.SelectedOption.Empty),[a,E]=n.useState(),i=n.useRef(null),le={selectedOption:v,setSelectedOption:m,dialogOpen:D,setDialogOpen:h};n.useEffect(()=>{t&&(h(!1),m(d.SelectedOption.Empty),E(null))},[t,h,m,E]);const P=n.useCallback(e=>{t||(m(e),h(!0))},[t]),g=n.useCallback(e=>{if(t||!i.current)return;const{state:r,dispatch:l}=i.current,o=r.selection.main.from;l({changes:{from:o,insert:e},selection:{anchor:o+e.length}})},[i,t]),B=n.useCallback(e=>{if(t||!i.current)return;const{state:r,dispatch:l}=i.current,o=r.selection.main;l({changes:{from:o.from,to:o.to,insert:e},selection:{anchor:o.from+e.length}})},[t]),H=n.useCallback(()=>{i.current?.focus()},[]),U=n.useCallback(()=>i.current?.state.doc.toString()??"",[]),z=n.useCallback(e=>{if(t)return;if(!i.current){L?.(e);return}const r=i.current,{state:l,dispatch:o}=r;o({changes:{from:0,to:l.doc.length,insert:e},selection:{anchor:e.length}})},[t,L]),S=n.useCallback(()=>{if(t||!a||!i.current||a.from===-1)return;const{from:e,to:r}=a,{dispatch:l}=i.current;l({changes:{from:e,to:r,insert:""}})},[a,i,t]),se=n.useCallback(()=>{if(t||!i.current)return;const e=i.current,{state:r,dispatch:l}=e,o=r.selection.main;l({changes:{from:o.from,to:o.to,insert:"======"},selection:{anchor:o.from+3}}),e.focus()},[t]),ce=n.useCallback(()=>{if(t||!i.current)return;const e=i.current,{state:r,dispatch:l}=e,o=r.selection.main;l({changes:{from:o.from,to:o.to,insert:"[]()"},selection:{anchor:o.from+1}}),e.focus()},[t]),ae=n.useCallback(()=>{if(t||!i.current)return;const e=i.current,{state:r,dispatch:l}=e,o=r.selection.main;l({changes:{from:o.from,to:o.to,insert:"?[]"},selection:{anchor:o.from+2}}),e.focus()},[t]),ue=n.useCallback(()=>{if(t||!i.current)return;const e=i.current,{state:r,dispatch:l}=e,o=r.selection.main,f=u.singleChoiceOption1,p=u.singleChoiceOption2,M=`?[{{ }} ${f} | ${p}]`;l({changes:{from:o.from,to:o.to,insert:M},selection:{anchor:o.from+5}}),e.focus()},[t,u.singleChoiceOption1,u.singleChoiceOption2]),fe=n.useCallback(()=>{if(t||!i.current)return;const e=i.current,{state:r,dispatch:l}=e,o=r.selection.main,f=u.singleChoiceOption1,p=u.singleChoiceOption2,M=`?[{{ }} ${f} || ${p}]`;l({changes:{from:o.from,to:o.to,insert:M},selection:{anchor:o.from+5}}),e.focus()},[t,u.singleChoiceOption1,u.singleChoiceOption2]),de=n.useCallback(()=>{if(t||!i.current)return;const e=i.current,{state:r,dispatch:l}=e,o=r.selection.main,p=`?[{{ }}...${u.inputPlaceholder??"请输入"}]`;l({changes:{from:o.from,to:o.to,insert:p},selection:{anchor:o.from+5}}),e.focus()},[t,u.inputPlaceholder]),he=n.useCallback(({resourceUrl:e,resourceTitle:r,scalePercent:l})=>{if(!e||t)return;const o=b.getImageContentToInsert({resourceUrl:e,resourceTitle:r,scalePercent:l});if(a?.type===d.SelectedOption.Image){if(S(),!i.current)return;const{dispatch:f}=i.current;f({changes:{from:a.from,insert:o}})}else g(o);h(!1)},[S,t,g,a]),pe=n.useCallback(({resourceUrl:e,resourceTitle:r})=>{if(t)return;const l=b.getVideoContentToInsert(e,r);if(a?.type===d.SelectedOption.Video){if(S(),!i.current)return;const{dispatch:o}=i.current;o({changes:{from:a.from,insert:l}})}else g(l);h(!1)},[S,t,g,a]),G=n.useCallback(()=>ke.autocompletion({override:[b.createSlashCommands(P,{image:w.slashImage,video:w.slashVideo})]}),[w.slashImage,w.slashVideo,P]),W=n.useCallback(e=>{i.current=e.view},[]),K=n.useCallback(e=>{if(e.stopPropagation(),t)return;const{type:r,from:l,to:o,dataset:f}=e.detail,p=b.parseContentInfo(r,f);E({type:r,value:p,from:l,to:o}),m(r),h(!0)},[t]);n.useEffect(()=>{D||(m(d.SelectedOption.Empty),E(null))},[D]),n.useEffect(()=>{const e=r=>{r.detail.view===i.current&&K(r)};return window.addEventListener("globalTagClick",e),()=>{window.removeEventListener("globalTagClick",e)}},[K]);const Q=s("imageDefaultTitle"),J=s("videoDefaultTitle"),X=n.useMemo(()=>be.mediaPlaceholderLabels.of({image:Q,video:J}),[Q,J]),me=n.useMemo(()=>{const e=[Z.EditorView.lineWrapping,ve.markdown(),ee.syntaxHighlighting(ee.defaultHighlightStyle),Ve.default];return t||e.push(G()),k==="quickEdit"&&e.push(X,Ee.default,Se.default),e.push(Z.EditorView.updateListener.of(r=>{W(r)})),e},[t,k,G,W,X]),ge=n.useCallback(e=>{t||L?.(e)},[L,t]),C=n.useMemo(()=>({insertTextAtCursor:g,replaceSelection:B,focus:H,getContent:U,setContent:z}),[H,U,g,B,z]),Y=n.useCallback(e=>{t||"render"in e||e.onClick?.(C)},[t,C]),Ce=n.useMemo(()=>j?.length?c.jsx("div",{className:"markdown-flow-editor-toolbar-right",children:j.map(e=>{if("render"in e)return c.jsx("div",{className:"markdown-flow-editor-toolbar-right-item",children:e.render(C)},e.key);const r=e.label||e.tooltip||void 0,l=c.jsxs("button",{type:"button",disabled:t||e.disabled,onClick:()=>Y(e),className:"markdown-flow-editor-toolbar-right-button","aria-label":r,title:e.tooltip?void 0:e.label,children:[e.icon?c.jsx("span",{className:"toolbar-right-icon",children:e.icon}):null,e.label?c.jsx("span",{className:"toolbar-right-label",children:e.label}):null]},e.key),o=e.tooltip?c.jsxs(N.Tooltip,{children:[c.jsx(N.TooltipTrigger,{asChild:!0,children:l}),c.jsx(N.TooltipContent,{side:"top",dir:T,lang:x,children:e.tooltip})]}):l;return c.jsx("div",{className:"markdown-flow-editor-toolbar-right-item",children:o},e.key)})}):null,[t,C,Y,T,x,j]);return n.useEffect(()=>{re?.(C)},[C]),c.jsxs("div",{className:"markdown-flow-editor",ref:R,dir:_,lang:$,"data-disabled":t?"true":void 0,"aria-disabled":t,children:[c.jsx(Oe.default,{disabled:t,labels:u,tooltipDirection:T,tooltipLanguage:x,onSelect:P,onInsertConfirmOutput:se,onInsertLink:ce,onInsertButton:ae,onInsertSingleChoice:ue,onInsertMultiChoice:fe,onInsertInputField:de,rightSlot:Ce}),c.jsx("div",{className:"markdown-flow-editor-body relative overflow-auto",children:c.jsxs(we.default.Provider,{value:le,children:[c.jsx(Ie.default,{extensions:me,basicSetup:{lineNumbers:!1,searchKeymap:!1,syntaxHighlighting:!0,highlightActiveLine:!0,highlightActiveLineGutter:!0,foldGutter:!1},className:"rounded-md",placeholder:ie,value:V,theme:"light",minHeight:"2rem",editable:!t,onChange:ge,onBlur:te}),!t&&c.jsxs(Le.default,{dir:T,lang:x,labels:{closeButtonLabel:s("dialogCloseLabel"),title:v===d.SelectedOption.Image?s("dialogTitleImage"):v===d.SelectedOption.Video?s("dialogTitleVideo"):s("dialogTitle")},children:[v===d.SelectedOption.Image&&c.jsx(xe.default,{value:a?.value,onSelect:he,uploadProps:ne}),v===d.SelectedOption.Video&&c.jsx(Te.default,{value:a?.value,onSelect:pe})]})]})})]})};exports.default=Re;
|
|
2
2
|
//# sourceMappingURL=MarkdownFlowEditor.cjs.map
|