markdown-flow-ui 0.1.83-beta.17 → 0.1.83-beta.18
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/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/_virtual/index3.js +5 -4
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/_virtual/index4.js +4 -5
- package/dist/_virtual/index4.js.map +1 -1
- package/dist/components/ContentRender/utils/split-content.js +24 -13
- package/dist/components/ContentRender/utils/split-content.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import $ from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
|
|
|
2
2
|
import oe from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/extends.js";
|
|
3
3
|
import r from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/defineProperty.js";
|
|
4
4
|
import te from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/typeof.js";
|
|
5
|
-
import d from "../../../../../../../../../_virtual/
|
|
5
|
+
import d from "../../../../../../../../../_virtual/index3.js";
|
|
6
6
|
import l, { useRef as q, cloneElement as ie } from "react";
|
|
7
7
|
import { hasPrefixSuffix as re, hasAddon as de } from "./utils/commonUtils.js";
|
|
8
8
|
var xe = /* @__PURE__ */ l.forwardRef(function(e, z) {
|
|
@@ -4,7 +4,7 @@ import w from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
|
|
|
4
4
|
import J from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/typeof.js";
|
|
5
5
|
import s from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/slicedToArray.js";
|
|
6
6
|
import K from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js";
|
|
7
|
-
import Q from "../../../../../../../../../_virtual/
|
|
7
|
+
import Q from "../../../../../../../../../_virtual/index3.js";
|
|
8
8
|
import ee from "../../../../rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
|
|
9
9
|
import M from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useLayoutEffect.js";
|
|
10
10
|
import te from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useMergedState.js";
|
|
@@ -4,7 +4,7 @@ import d from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
|
|
|
4
4
|
import Ae from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js";
|
|
5
5
|
import x from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/slicedToArray.js";
|
|
6
6
|
import Fe from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js";
|
|
7
|
-
import h from "../../../../../../../../../_virtual/
|
|
7
|
+
import h from "../../../../../../../../../_virtual/index3.js";
|
|
8
8
|
import Ne from "../../../../rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.js";
|
|
9
9
|
import Te from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useMergedState.js";
|
|
10
10
|
import o, { useRef as Y, useImperativeHandle as $e, useEffect as Ie } from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import t from "./TextArea.js";
|
|
2
|
-
import "../../../../../../../../../_virtual/
|
|
2
|
+
import "../../../../../../../../../_virtual/index3.js";
|
|
3
3
|
import "../../../../rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
|
|
4
4
|
import "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useLayoutEffect.js";
|
|
5
5
|
import "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exports as a } from "../../../../../../../../../_virtual/remark-custom-variable.js";
|
|
2
|
-
import g from "../../../../../../../../../_virtual/
|
|
2
|
+
import g from "../../../../../../../../../_virtual/index4.js";
|
|
3
3
|
import { __require as h } from "./interaction-parser.js";
|
|
4
4
|
var m;
|
|
5
5
|
function C() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exports as n } from "../../../../../../../../../_virtual/remark-interaction.js";
|
|
2
|
-
import I from "../../../../../../../../../_virtual/
|
|
2
|
+
import I from "../../../../../../../../../_virtual/index4.js";
|
|
3
3
|
import { __require as g } from "./interaction-parser.js";
|
|
4
4
|
var m;
|
|
5
5
|
function k() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as r } from "../../../../../../../../../_virtual/
|
|
1
|
+
import { __exports as r } from "../../../../../../../../../_virtual/index8.js";
|
|
2
2
|
import { __require as p } from "../../../../inline-style-parser@0.2.4/node_modules/inline-style-parser/index.js";
|
|
3
3
|
var f;
|
|
4
4
|
function q() {
|
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as s } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js";
|
|
3
|
+
var e = s();
|
|
4
|
+
const t = /* @__PURE__ */ r(e);
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
+
t as default
|
|
6
7
|
};
|
|
7
8
|
//# sourceMappingURL=index3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const t = /* @__PURE__ */ r(e);
|
|
1
|
+
import { getAugmentedNamespace as e } from "./_commonjsHelpers.js";
|
|
2
|
+
import * as r from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/index.js";
|
|
3
|
+
const m = /* @__PURE__ */ e(r);
|
|
5
4
|
export {
|
|
6
|
-
|
|
5
|
+
m as default
|
|
7
6
|
};
|
|
8
7
|
//# sourceMappingURL=index4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -28,37 +28,48 @@ const k = /<(script|style|link|iframe|html|head|body|meta|title|base|template|di
|
|
|
28
28
|
if (!o.trim().startsWith("|")) break;
|
|
29
29
|
m.push(o);
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const a = m.join(`
|
|
32
32
|
`);
|
|
33
|
-
return { start: e, block:
|
|
33
|
+
return { start: e, block: a, end: e + a.length };
|
|
34
34
|
}, g = (t, n = !1) => {
|
|
35
35
|
const s = t.indexOf("```");
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
if (s !== -1 && t.indexOf("```", s + 3) === -1) {
|
|
37
|
+
if (n) {
|
|
38
|
+
const i = t.slice(0, s).trimEnd(), d = t.slice(s), u = [];
|
|
39
|
+
return i && u.push({ type: "text", value: i }), u.push({ type: "markdown", value: d }), u;
|
|
40
|
+
}
|
|
41
|
+
return [{ type: "markdown", value: t }];
|
|
39
42
|
}
|
|
40
43
|
const e = t.search(/<svg\b/i);
|
|
41
44
|
if (n && e !== -1) {
|
|
42
|
-
const l = t.slice(0, e), r = t.indexOf("</svg>", e), i = r === -1 ? `${t.slice(e)}</svg>` : t.slice(e, r + 6),
|
|
43
|
-
return l.trim() &&
|
|
45
|
+
const l = t.slice(0, e), r = t.indexOf("</svg>", e), i = r === -1 ? `${t.slice(e)}</svg>` : t.slice(e, r + 6), d = r === -1 ? "" : t.slice(r + 6), u = [];
|
|
46
|
+
return l.trim() && u.push({ type: "text", value: l }), u.push({ type: "markdown", value: i }), d.trim() && u.push(...g(d, !0)), u;
|
|
44
47
|
}
|
|
45
48
|
if (e !== -1 && t.indexOf("</svg>", e) === -1)
|
|
46
|
-
return [{ type: "markdown", value: t }];
|
|
49
|
+
return [{ type: "markdown", value: `${t}</svg>` }];
|
|
47
50
|
const c = O(t);
|
|
48
51
|
if (c) {
|
|
49
52
|
const l = [], r = t.slice(0, c.start);
|
|
50
53
|
n && r.trim() && l.push({ type: "text", value: r }), l.push({ type: "markdown", value: c.block });
|
|
51
|
-
const i = t.slice(c.end),
|
|
52
|
-
return i.trim() &&
|
|
54
|
+
const i = t.slice(c.end), d = i.length < t.length;
|
|
55
|
+
return i.trim() && d && l.push(
|
|
53
56
|
...n ? g(i, !0) : g(i)
|
|
54
57
|
), l;
|
|
55
58
|
}
|
|
56
59
|
if (t.match(/<svg[\s\S]*?<\/svg>/i) && n)
|
|
57
60
|
return t.trim().toLowerCase().endsWith("</svg>") ? [{ type: "markdown", value: t }] : [{ type: "markdown", value: `${t}</svg>` }];
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
61
|
+
const a = t.search(k), o = E(t);
|
|
62
|
+
if (a === -1 && !o)
|
|
60
63
|
return n && t.trim() ? [{ type: "text", value: t }] : [];
|
|
61
|
-
const f = !!o && (
|
|
64
|
+
const f = !!o && (a === -1 || o.start < a);
|
|
65
|
+
if (!n)
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
68
|
+
type: f ? "markdown" : "sandbox",
|
|
69
|
+
value: t
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
const v = f ? o.start : a, p = f ? o.end : I(t, v), h = [], b = t.slice(0, v), S = t.slice(v, p), x = t.slice(p);
|
|
62
73
|
return n && b.trim() && h.push({ type: "text", value: b }), h.push({
|
|
63
74
|
type: f ? "markdown" : "sandbox",
|
|
64
75
|
value: S
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-content.js","sources":["../../../../src/components/ContentRender/utils/split-content.ts"],"sourcesContent":["export type RenderSegment =\n | { type: \"markdown\"; value: string }\n | { type: \"sandbox\"; value: string }\n | { type: \"text\"; value: string };\n\nconst SANDBOX_START_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\\s>]/i;\n\nconst INLINE_SANDBOX_PATTERNS: RegExp[] = [\n /<svg[\\s\\S]*?<\\/svg>/i,\n /<img\\b[^>]*?>/i,\n /```mermaid[\\s\\S]*?```/i,\n /```[a-zA-Z0-9]+[\\s\\S]*?```/i,\n];\n\nconst closingBoundary = /<\\/[a-z][^>]*>\\s*\\n(?=[^\\s<])/gi;\n\ntype MatchResult = { start: number; end: number };\n\nconst findHtmlBlockEnd = (raw: string, startIndex: number) => {\n let blockEnd = raw.length;\n let match: RegExpExecArray | null;\n closingBoundary.lastIndex = 0;\n\n while ((match = closingBoundary.exec(raw))) {\n if (match.index <= startIndex) continue;\n blockEnd = match.index + match[0].length;\n break;\n }\n\n return blockEnd;\n};\n\nconst findInlineSandboxMatch = (raw: string): MatchResult | null => {\n let earliest: MatchResult | null = null;\n\n INLINE_SANDBOX_PATTERNS.forEach((pattern) => {\n const match = pattern.exec(raw);\n if (!match || typeof match.index !== \"number\") return;\n const start = match.index;\n const end = match.index + match[0].length;\n\n if (!earliest || start < earliest.start) {\n earliest = { start, end };\n }\n });\n\n return earliest;\n};\n\nconst extractTableBlock = (\n raw: string\n): { start: number; block: string; end: number } | null => {\n const tableMatch = raw.match(/^\\s*\\|.+\\|\\s*$/m);\n if (!tableMatch || typeof tableMatch.index !== \"number\") return null;\n\n const leadingSpaces = tableMatch[0].match(/^\\s*/)?.[0].length ?? 0;\n const tableStart = tableMatch.index + leadingSpaces;\n\n const lines = raw.slice(tableStart).split(\"\\n\");\n const tableLines: string[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"|\")) break;\n tableLines.push(line);\n }\n\n const block = tableLines.join(\"\\n\");\n return { start: tableStart, block, end: tableStart + block.length };\n};\n\n// Split incoming markdown content into markdown and sandbox HTML segments\nexport const splitContentSegments = (\n raw: string,\n keepText = false\n): RenderSegment[] => {\n const fenceStart = raw.indexOf(\"```\");\n if (keepText && fenceStart !== -1) {\n const closingFence = raw.indexOf(\"```\", fenceStart + 3);\n if (closingFence === -1) {\n const before = raw.slice(0, fenceStart);\n const beforeText = before.trimEnd();\n const fenceBlock = raw.slice(fenceStart);\n const segments: RenderSegment[] = [];\n if (beforeText) {\n segments.push({ type: \"text\", value: beforeText });\n }\n segments.push({ type: \"markdown\", value: fenceBlock });\n return segments;\n }\n }\n\n const svgOpenIndex = raw.search(/<svg\\b/i);\n if (keepText && svgOpenIndex !== -1) {\n const before = raw.slice(0, svgOpenIndex);\n const closeIdx = raw.indexOf(\"</svg>\", svgOpenIndex);\n const svgBlock =\n closeIdx === -1\n ? `${raw.slice(svgOpenIndex)}</svg>`\n : raw.slice(svgOpenIndex, closeIdx + \"</svg>\".length);\n const after = closeIdx === -1 ? \"\" : raw.slice(closeIdx + \"</svg>\".length);\n\n const segments: RenderSegment[] = [];\n if (before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n segments.push({ type: \"markdown\", value: svgBlock });\n if (after.trim()) {\n segments.push(...splitContentSegments(after, true));\n }\n return segments;\n }\n if (svgOpenIndex !== -1 && raw.indexOf(\"</svg>\", svgOpenIndex) === -1) {\n return [{ type: \"markdown\", value: raw }];\n }\n\n const tableBlock = extractTableBlock(raw);\n if (tableBlock) {\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, tableBlock.start);\n if (keepText && before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n segments.push({ type: \"markdown\", value: tableBlock.block });\n const after = raw.slice(tableBlock.end);\n const hasProgress = after.length < raw.length;\n if (after.trim() && hasProgress) {\n segments.push(\n ...(keepText\n ? splitContentSegments(after, true)\n : splitContentSegments(after))\n );\n }\n return segments;\n }\n\n const completeSvgMatch = raw.match(/<svg[\\s\\S]*?<\\/svg>/i);\n if (completeSvgMatch && keepText) {\n if (!raw.trim().toLowerCase().endsWith(\"</svg>\")) {\n return [{ type: \"markdown\", value: `${raw}</svg>` }];\n }\n return [{ type: \"markdown\", value: raw }];\n }\n\n const sandboxStartIndex = raw.search(SANDBOX_START_PATTERN);\n const inlineMatch = findInlineSandboxMatch(raw);\n\n if (sandboxStartIndex === -1 && !inlineMatch) {\n if (keepText && raw.trim()) {\n return [{ type: \"text\", value: raw }];\n }\n return [];\n }\n\n const shouldUseInline =\n !!inlineMatch &&\n (sandboxStartIndex === -1 || inlineMatch.start < sandboxStartIndex);\n\n const startIndex = shouldUseInline ? inlineMatch!.start : sandboxStartIndex;\n const blockEnd = shouldUseInline\n ? inlineMatch!.end\n : findHtmlBlockEnd(raw, startIndex);\n\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, startIndex);\n const matchedBlock = raw.slice(startIndex, blockEnd);\n const after = raw.slice(blockEnd);\n\n if (keepText && before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n\n segments.push({\n type: shouldUseInline ? \"markdown\" : \"sandbox\",\n value: matchedBlock,\n });\n\n if (after.trim()) {\n segments.push(...splitContentSegments(after, keepText));\n }\n\n return segments;\n};\n"],"names":["SANDBOX_START_PATTERN","INLINE_SANDBOX_PATTERNS","closingBoundary","findHtmlBlockEnd","raw","startIndex","blockEnd","match","findInlineSandboxMatch","earliest","pattern","start","end","extractTableBlock","tableMatch","leadingSpaces","tableStart","lines","tableLines","line","block","splitContentSegments","keepText","fenceStart","beforeText","fenceBlock","segments","svgOpenIndex","before","closeIdx","svgBlock","after","tableBlock","hasProgress","sandboxStartIndex","inlineMatch","shouldUseInline","matchedBlock"],"mappings":"AAKA,MAAMA,IACJ,sGAEIC,IAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAkB,mCAIlBC,IAAmB,CAACC,GAAaC,MAAuB;AAC5D,MAAIC,IAAWF,EAAI,QACfG;AAGJ,OAFAL,EAAgB,YAAY,GAEpBK,IAAQL,EAAgB,KAAKE,CAAG;AACtC,QAAI,EAAAG,EAAM,SAASF,IACnB;AAAA,MAAAC,IAAWC,EAAM,QAAQA,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AAAA,MACP,GAAIJ,IACAD,EAAqBU,GAAO,EAAI,IAChCV,EAAqBU,CAAK;AAAA,IAAA,GAG3BL;AAAAA,EACT;AAGA,MADyBtB,EAAI,MAAM,sBAAsB,KACjCkB;AACtB,WAAKlB,EAAI,KAAA,EAAO,cAAc,SAAS,QAAQ,IAGxC,CAAC,EAAE,MAAM,YAAY,OAAOA,GAAK,IAF/B,CAAC,EAAE,MAAM,YAAY,OAAO,GAAGA,CAAG,UAAU;AAKvD,QAAM8B,IAAoB9B,EAAI,OAAOJ,CAAqB,GACpDmC,IAAc3B,EAAuBJ,CAAG;AAE9C,MAAI8B,MAAsB,MAAM,CAACC;AAC/B,WAAIb,KAAYlB,EAAI,SACX,CAAC,EAAE,MAAM,QAAQ,OAAOA,GAAK,IAE/B,CAAA;AAGT,QAAMgC,IACJ,CAAC,CAACD,MACDD,MAAsB,MAAMC,EAAY,QAAQD,IAE7C7B,IAAa+B,IAAkBD,EAAa,QAAQD,GACpD5B,IAAW8B,IACbD,EAAa,MACbhC,EAAiBC,GAAKC,CAAU,GAE9BqB,IAA4B,CAAA,GAC5BE,IAASxB,EAAI,MAAM,GAAGC,CAAU,GAChCgC,IAAejC,EAAI,MAAMC,GAAYC,CAAQ,GAC7CyB,IAAQ3B,EAAI,MAAME,CAAQ;AAEhC,SAAIgB,KAAYM,EAAO,UACrBF,EAAS,KAAK,EAAE,MAAM,QAAQ,OAAOE,GAAQ,GAG/CF,EAAS,KAAK;AAAA,IACZ,MAAMU,IAAkB,aAAa;AAAA,IACrC,OAAOC;AAAA,EAAA,CACR,GAEGN,EAAM,UACRL,EAAS,KAAK,GAAGL,EAAqBU,GAAOT,CAAQ,CAAC,GAGjDI;AACT;"}
|
|
1
|
+
{"version":3,"file":"split-content.js","sources":["../../../../src/components/ContentRender/utils/split-content.ts"],"sourcesContent":["export type RenderSegment =\n | { type: \"markdown\"; value: string }\n | { type: \"sandbox\"; value: string }\n | { type: \"text\"; value: string };\n\nconst SANDBOX_START_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\\s>]/i;\n\nconst INLINE_SANDBOX_PATTERNS: RegExp[] = [\n /<svg[\\s\\S]*?<\\/svg>/i,\n /<img\\b[^>]*?>/i,\n /```mermaid[\\s\\S]*?```/i,\n /```[a-zA-Z0-9]+[\\s\\S]*?```/i,\n];\n\nconst closingBoundary = /<\\/[a-z][^>]*>\\s*\\n(?=[^\\s<])/gi;\n\ntype MatchResult = { start: number; end: number };\n\nconst findHtmlBlockEnd = (raw: string, startIndex: number) => {\n let blockEnd = raw.length;\n let match: RegExpExecArray | null;\n closingBoundary.lastIndex = 0;\n\n while ((match = closingBoundary.exec(raw))) {\n if (match.index <= startIndex) continue;\n blockEnd = match.index + match[0].length;\n break;\n }\n\n return blockEnd;\n};\n\nconst findInlineSandboxMatch = (raw: string): MatchResult | null => {\n let earliest: MatchResult | null = null;\n\n INLINE_SANDBOX_PATTERNS.forEach((pattern) => {\n const match = pattern.exec(raw);\n if (!match || typeof match.index !== \"number\") return;\n const start = match.index;\n const end = match.index + match[0].length;\n\n if (!earliest || start < earliest.start) {\n earliest = { start, end };\n }\n });\n\n return earliest;\n};\n\nconst extractTableBlock = (\n raw: string\n): { start: number; block: string; end: number } | null => {\n const tableMatch = raw.match(/^\\s*\\|.+\\|\\s*$/m);\n if (!tableMatch || typeof tableMatch.index !== \"number\") return null;\n\n const leadingSpaces = tableMatch[0].match(/^\\s*/)?.[0].length ?? 0;\n const tableStart = tableMatch.index + leadingSpaces;\n\n const lines = raw.slice(tableStart).split(\"\\n\");\n const tableLines: string[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"|\")) break;\n tableLines.push(line);\n }\n\n const block = tableLines.join(\"\\n\");\n return { start: tableStart, block, end: tableStart + block.length };\n};\n\n// Split incoming markdown content into markdown and sandbox HTML segments\nexport const splitContentSegments = (\n raw: string,\n keepText = false\n): RenderSegment[] => {\n const fenceStart = raw.indexOf(\"```\");\n if (fenceStart !== -1) {\n const closingFence = raw.indexOf(\"```\", fenceStart + 3);\n if (closingFence === -1) {\n if (keepText) {\n const before = raw.slice(0, fenceStart);\n const beforeText = before.trimEnd();\n const fenceBlock = raw.slice(fenceStart);\n const segments: RenderSegment[] = [];\n if (beforeText) {\n segments.push({ type: \"text\", value: beforeText });\n }\n segments.push({ type: \"markdown\", value: fenceBlock });\n return segments;\n }\n return [{ type: \"markdown\", value: raw }];\n }\n }\n\n const svgOpenIndex = raw.search(/<svg\\b/i);\n if (keepText && svgOpenIndex !== -1) {\n const before = raw.slice(0, svgOpenIndex);\n const closeIdx = raw.indexOf(\"</svg>\", svgOpenIndex);\n const svgBlock =\n closeIdx === -1\n ? `${raw.slice(svgOpenIndex)}</svg>`\n : raw.slice(svgOpenIndex, closeIdx + \"</svg>\".length);\n const after = closeIdx === -1 ? \"\" : raw.slice(closeIdx + \"</svg>\".length);\n\n const segments: RenderSegment[] = [];\n if (before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n segments.push({ type: \"markdown\", value: svgBlock });\n if (after.trim()) {\n segments.push(...splitContentSegments(after, true));\n }\n return segments;\n }\n if (svgOpenIndex !== -1 && raw.indexOf(\"</svg>\", svgOpenIndex) === -1) {\n return [{ type: \"markdown\", value: `${raw}</svg>` }];\n }\n\n const tableBlock = extractTableBlock(raw);\n if (tableBlock) {\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, tableBlock.start);\n if (keepText && before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n segments.push({ type: \"markdown\", value: tableBlock.block });\n const after = raw.slice(tableBlock.end);\n const hasProgress = after.length < raw.length;\n if (after.trim() && hasProgress) {\n segments.push(\n ...(keepText\n ? splitContentSegments(after, true)\n : splitContentSegments(after))\n );\n }\n return segments;\n }\n\n const completeSvgMatch = raw.match(/<svg[\\s\\S]*?<\\/svg>/i);\n if (completeSvgMatch && keepText) {\n if (!raw.trim().toLowerCase().endsWith(\"</svg>\")) {\n return [{ type: \"markdown\", value: `${raw}</svg>` }];\n }\n return [{ type: \"markdown\", value: raw }];\n }\n\n const sandboxStartIndex = raw.search(SANDBOX_START_PATTERN);\n const inlineMatch = findInlineSandboxMatch(raw);\n\n if (sandboxStartIndex === -1 && !inlineMatch) {\n if (keepText && raw.trim()) {\n return [{ type: \"text\", value: raw }];\n }\n return [];\n }\n\n const shouldUseInline =\n !!inlineMatch &&\n (sandboxStartIndex === -1 || inlineMatch.start < sandboxStartIndex);\n\n if (!keepText) {\n return [\n {\n type: shouldUseInline ? \"markdown\" : \"sandbox\",\n value: raw,\n },\n ];\n }\n\n const startIndex = shouldUseInline ? inlineMatch!.start : sandboxStartIndex;\n const blockEnd = shouldUseInline\n ? inlineMatch!.end\n : findHtmlBlockEnd(raw, startIndex);\n\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, startIndex);\n const matchedBlock = raw.slice(startIndex, blockEnd);\n const after = raw.slice(blockEnd);\n\n if (keepText && before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n\n segments.push({\n type: shouldUseInline ? \"markdown\" : \"sandbox\",\n value: matchedBlock,\n });\n\n if (after.trim()) {\n segments.push(...splitContentSegments(after, keepText));\n }\n\n return segments;\n};\n"],"names":["SANDBOX_START_PATTERN","INLINE_SANDBOX_PATTERNS","closingBoundary","findHtmlBlockEnd","raw","startIndex","blockEnd","match","findInlineSandboxMatch","earliest","pattern","start","end","extractTableBlock","tableMatch","leadingSpaces","tableStart","lines","tableLines","line","block","splitContentSegments","keepText","fenceStart","beforeText","fenceBlock","segments","svgOpenIndex","before","closeIdx","svgBlock","after","tableBlock","hasProgress","sandboxStartIndex","inlineMatch","shouldUseInline","matchedBlock"],"mappings":"AAKA,MAAMA,IACJ,sGAEIC,IAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAkB,mCAIlBC,IAAmB,CAACC,GAAaC,MAAuB;AAC5D,MAAIC,IAAWF,EAAI,QACfG;AAGJ,OAFAL,EAAg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,IACZ,MAAMU,IAAkB,aAAa;AAAA,IACrC,OAAOC;AAAA,EAAA,CACR,GAEGN,EAAM,UACRL,EAAS,KAAK,GAAGL,EAAqBU,GAAOT,CAAQ,CAAC,GAGjDI;AACT;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as i } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import * as d from "react";
|
|
3
3
|
import n from "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.js";
|
|
4
|
-
import "../../../_virtual/
|
|
4
|
+
import "../../../_virtual/index3.js";
|
|
5
5
|
import "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
|
|
6
6
|
import "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useLayoutEffect.js";
|
|
7
7
|
import "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/raf.js";
|