@xiangfa/mindmap 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +534 -0
  2. package/README.zh-CN.md +534 -0
  3. package/dist/MindMap.d.ts +3 -0
  4. package/dist/components/MindMapContextMenu.d.ts +20 -0
  5. package/dist/components/MindMapControls.d.ts +16 -0
  6. package/dist/components/MindMapNode.d.ts +32 -0
  7. package/dist/components/icons.d.ts +8 -0
  8. package/dist/esm/MindMap2.js +713 -0
  9. package/dist/esm/components/MindMapContextMenu.js +123 -0
  10. package/dist/esm/components/MindMapControls.js +114 -0
  11. package/dist/esm/components/MindMapNode.js +588 -0
  12. package/dist/esm/components/icons.js +45 -0
  13. package/dist/esm/hooks/useDrag.js +346 -0
  14. package/dist/esm/hooks/useNewNodeAnimation.js +20 -0
  15. package/dist/esm/hooks/useNodeEdit.js +57 -0
  16. package/dist/esm/hooks/usePanZoom.js +85 -0
  17. package/dist/esm/hooks/useTheme.js +16 -0
  18. package/dist/esm/index.js +14 -0
  19. package/dist/esm/logo.svg +9 -0
  20. package/dist/esm/plugins/cross-link.js +65 -0
  21. package/dist/esm/plugins/dotted-line.js +23 -0
  22. package/dist/esm/plugins/folding.js +20 -0
  23. package/dist/esm/plugins/front-matter.js +19 -0
  24. package/dist/esm/plugins/index.js +19 -0
  25. package/dist/esm/plugins/latex.js +132 -0
  26. package/dist/esm/plugins/multi-line.js +39 -0
  27. package/dist/esm/plugins/runner.js +128 -0
  28. package/dist/esm/plugins/tags.js +55 -0
  29. package/dist/esm/style.css +2 -0
  30. package/dist/esm/utils/export.js +50 -0
  31. package/dist/esm/utils/i18n.js +61 -0
  32. package/dist/esm/utils/inline-markdown.js +189 -0
  33. package/dist/esm/utils/layout.js +208 -0
  34. package/dist/esm/utils/markdown.js +288 -0
  35. package/dist/esm/utils/theme.js +119 -0
  36. package/dist/esm/utils/tree-ops.js +136 -0
  37. package/dist/hooks/useDrag.d.ts +40 -0
  38. package/dist/hooks/useNewNodeAnimation.d.ts +2 -0
  39. package/dist/hooks/useNodeEdit.d.ts +17 -0
  40. package/dist/hooks/usePanZoom.d.ts +26 -0
  41. package/dist/hooks/useTheme.d.ts +3 -0
  42. package/dist/index.d.ts +16 -0
  43. package/dist/logo.svg +9 -0
  44. package/dist/mindmap.umd.cjs +24 -0
  45. package/dist/plugins/cross-link.d.ts +2 -0
  46. package/dist/plugins/dotted-line.d.ts +2 -0
  47. package/dist/plugins/folding.d.ts +2 -0
  48. package/dist/plugins/front-matter.d.ts +2 -0
  49. package/dist/plugins/index.d.ts +11 -0
  50. package/dist/plugins/latex.d.ts +20 -0
  51. package/dist/plugins/multi-line.d.ts +2 -0
  52. package/dist/plugins/runner.d.ts +30 -0
  53. package/dist/plugins/tags.d.ts +2 -0
  54. package/dist/plugins/types.d.ts +78 -0
  55. package/dist/style.css +2 -0
  56. package/dist/types.d.ts +105 -0
  57. package/dist/utils/export.d.ts +18 -0
  58. package/dist/utils/i18n.d.ts +22 -0
  59. package/dist/utils/inline-markdown.d.ts +66 -0
  60. package/dist/utils/layout.d.ts +14 -0
  61. package/dist/utils/markdown.d.ts +20 -0
  62. package/dist/utils/theme.d.ts +62 -0
  63. package/dist/utils/tree-ops.d.ts +36 -0
  64. package/package.json +65 -0
@@ -0,0 +1,119 @@
1
+ //#region src/components/MindMap/utils/theme.ts
2
+ var e = [
3
+ "#FF6B6B",
4
+ "#4ECDC4",
5
+ "#45B7D1",
6
+ "#96CEB4",
7
+ "#FFEAA7",
8
+ "#DDA0DD",
9
+ "#98D8C8",
10
+ "#F7DC6F",
11
+ "#BB8FCE",
12
+ "#F0B27A"
13
+ ], t = {
14
+ root: {
15
+ fontSize: 20,
16
+ fontWeight: 600,
17
+ fontFamily: "system-ui, 'Segoe UI', Roboto, sans-serif",
18
+ paddingH: 24,
19
+ paddingV: 12
20
+ },
21
+ node: {
22
+ fontSize: 15,
23
+ fontWeight: 400,
24
+ fontFamily: "system-ui, 'Segoe UI', Roboto, sans-serif",
25
+ paddingH: 8,
26
+ paddingV: 6
27
+ },
28
+ level1: {
29
+ fontSize: 16,
30
+ fontWeight: 500
31
+ },
32
+ connection: { strokeWidth: 2.5 },
33
+ layout: {
34
+ horizontalGap: 80,
35
+ verticalGap: 16
36
+ }
37
+ }, n = {
38
+ ...t,
39
+ root: {
40
+ ...t.root,
41
+ bgColor: "#2C3E50",
42
+ textColor: "#FFFFFF"
43
+ },
44
+ node: {
45
+ ...t.node,
46
+ textColor: "#333333"
47
+ },
48
+ canvas: { bgColor: "#fafafa" },
49
+ controls: {
50
+ bgColor: "rgba(255, 255, 255, 0.9)",
51
+ textColor: "#555",
52
+ hoverBg: "rgba(0, 0, 0, 0.08)",
53
+ activeBg: "rgba(0, 0, 0, 0.08)"
54
+ },
55
+ contextMenu: {
56
+ bgColor: "rgba(255, 255, 255, 0.95)",
57
+ textColor: "#333",
58
+ hoverBg: "rgba(0, 0, 0, 0.06)",
59
+ borderColor: "rgba(0, 0, 0, 0.08)",
60
+ shadowColor: "rgba(0, 0, 0, 0.15)"
61
+ },
62
+ addBtn: {
63
+ fill: "rgba(200, 200, 220, 0.6)",
64
+ hoverFill: "rgba(180, 180, 200, 0.8)",
65
+ iconColor: "#666"
66
+ },
67
+ selection: {
68
+ strokeColor: "#4A90D9",
69
+ fillColor: "rgba(74, 144, 217, 0.08)"
70
+ },
71
+ highlight: {
72
+ textColor: "#fac800",
73
+ bgColor: "rgba(252, 211, 77, 0.2)"
74
+ }
75
+ }, r = {
76
+ ...t,
77
+ root: {
78
+ ...t.root,
79
+ bgColor: "#4A6FA5",
80
+ textColor: "#FFFFFF"
81
+ },
82
+ node: {
83
+ ...t.node,
84
+ textColor: "#E0E0E0"
85
+ },
86
+ canvas: { bgColor: "#1a1a2e" },
87
+ controls: {
88
+ bgColor: "rgba(30, 30, 45, 0.9)",
89
+ textColor: "#ccc",
90
+ hoverBg: "rgba(255, 255, 255, 0.1)",
91
+ activeBg: "rgba(255, 255, 255, 0.12)"
92
+ },
93
+ contextMenu: {
94
+ bgColor: "rgba(35, 35, 50, 0.95)",
95
+ textColor: "#ddd",
96
+ hoverBg: "rgba(255, 255, 255, 0.08)",
97
+ borderColor: "rgba(255, 255, 255, 0.1)",
98
+ shadowColor: "rgba(0, 0, 0, 0.4)"
99
+ },
100
+ addBtn: {
101
+ fill: "rgba(100, 100, 130, 0.6)",
102
+ hoverFill: "rgba(120, 120, 150, 0.8)",
103
+ iconColor: "#aaa"
104
+ },
105
+ selection: {
106
+ strokeColor: "#5B9BD5",
107
+ fillColor: "rgba(91, 155, 213, 0.15)"
108
+ },
109
+ highlight: {
110
+ textColor: "#fcd34d",
111
+ bgColor: "rgba(251, 191, 36, 0.2)"
112
+ }
113
+ };
114
+ function i(e) {
115
+ return e === "dark" ? r : n;
116
+ }
117
+ var a = n;
118
+ //#endregion
119
+ export { e as BRANCH_COLORS, a as THEME, i as getTheme };
@@ -0,0 +1,136 @@
1
+ //#region src/components/MindMap/utils/tree-ops.ts
2
+ function e() {
3
+ return Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
4
+ }
5
+ function t(e) {
6
+ return Array.isArray(e) ? e : [e];
7
+ }
8
+ function n(e, t, r) {
9
+ if (e.id === t) {
10
+ let t = {
11
+ ...e,
12
+ ...r
13
+ };
14
+ return "taskStatus" in r && r.taskStatus === void 0 && delete t.taskStatus, "remark" in r && r.remark === void 0 && delete t.remark, t;
15
+ }
16
+ return e.children ? {
17
+ ...e,
18
+ children: e.children.map((e) => n(e, t, r))
19
+ } : e;
20
+ }
21
+ function r(e, t, n) {
22
+ return e.id === t ? {
23
+ ...e,
24
+ children: [...e.children || [], n]
25
+ } : e.children ? {
26
+ ...e,
27
+ children: e.children.map((e) => r(e, t, n))
28
+ } : e;
29
+ }
30
+ function i(e, t) {
31
+ if (!e.children) return e;
32
+ let n = e.children.filter((e) => e.id !== t).map((e) => i(e, t));
33
+ return {
34
+ ...e,
35
+ children: n.length > 0 ? n : void 0
36
+ };
37
+ }
38
+ function a(e, t, n) {
39
+ if (!e.children) return e;
40
+ let r = e.children.findIndex((e) => e.id === t), i = e.children.findIndex((e) => e.id === n);
41
+ if (r !== -1 && i !== -1) {
42
+ let t = [...e.children];
43
+ return [t[r], t[i]] = [t[i], t[r]], {
44
+ ...e,
45
+ children: t
46
+ };
47
+ }
48
+ return {
49
+ ...e,
50
+ children: e.children.map((e) => a(e, t, n))
51
+ };
52
+ }
53
+ function o(e, t) {
54
+ if (e.id === t) return structuredClone(e);
55
+ if (!e.children) return null;
56
+ for (let n of e.children) {
57
+ let e = o(n, t);
58
+ if (e) return e;
59
+ }
60
+ return null;
61
+ }
62
+ function s(t) {
63
+ return {
64
+ ...t,
65
+ id: e(),
66
+ children: t.children?.map((e) => s(e))
67
+ };
68
+ }
69
+ function c(e, t) {
70
+ let n = {};
71
+ for (let e of t) e.parentId && (n[e.parentId] || (n[e.parentId] = []), n[e.parentId].push(e.id));
72
+ let r = [], i = [e];
73
+ for (; i.length > 0;) {
74
+ let e = n[i.pop()];
75
+ if (e) for (let t of e) r.push(t), i.push(t);
76
+ }
77
+ return r;
78
+ }
79
+ function l(e, t, r) {
80
+ return e.map((e) => n(e, t, r));
81
+ }
82
+ function u(e, t, n) {
83
+ return e.map((e) => r(e, t, n));
84
+ }
85
+ function d(e, t) {
86
+ let n = e.filter((e) => e.id !== t);
87
+ return n.length < e.length ? n : e.map((e) => i(e, t));
88
+ }
89
+ function f(e, t, n) {
90
+ return e.map((e) => a(e, t, n));
91
+ }
92
+ function p(e, t) {
93
+ for (let n of e) {
94
+ let e = o(n, t);
95
+ if (e) return e;
96
+ }
97
+ return null;
98
+ }
99
+ function m(e, t, n, r) {
100
+ let i = [...e.children || []], a = Math.min(r, i.length);
101
+ return n === "right" ? (i.splice(a, 0, t), {
102
+ data: {
103
+ ...e,
104
+ children: i
105
+ },
106
+ newSplitIndex: a + 1
107
+ }) : (i.push(t), {
108
+ data: {
109
+ ...e,
110
+ children: i
111
+ },
112
+ newSplitIndex: a
113
+ });
114
+ }
115
+ function h(e, t, n, r) {
116
+ let i = e.children || [], a = i.findIndex((e) => e.id === t);
117
+ if (a === -1) return null;
118
+ let o = Math.min(Math.max(r, 0), i.length);
119
+ if (n === "right" && a < o || n === "left" && a >= o) return null;
120
+ let s = [...i], [c] = s.splice(a, 1);
121
+ return n === "left" ? (s.push(c), {
122
+ data: {
123
+ ...e,
124
+ children: s
125
+ },
126
+ newSplitIndex: o - 1
127
+ }) : (s.splice(o, 0, c), {
128
+ data: {
129
+ ...e,
130
+ children: s
131
+ },
132
+ newSplitIndex: o + 1
133
+ });
134
+ }
135
+ //#endregion
136
+ export { u as addChildMulti, m as addChildToSide, p as findSubtreeMulti, e as generateId, c as getDescendantIds, h as moveChildToSide, t as normalizeData, s as regenerateIds, d as removeNodeMulti, f as swapSiblingsMulti, l as updateNodeFieldsMulti };
@@ -0,0 +1,40 @@
1
+ import type { MindMapData, LayoutNode, LayoutDirection } from '../types';
2
+ interface UseDragParams {
3
+ svgRef: React.RefObject<SVGSVGElement | null>;
4
+ zoom: number;
5
+ pan: {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ setPan: React.Dispatch<React.SetStateAction<{
10
+ x: number;
11
+ y: number;
12
+ }>>;
13
+ setZoom: React.Dispatch<React.SetStateAction<number>>;
14
+ nodeMap: Record<string, LayoutNode>;
15
+ nodes: LayoutNode[];
16
+ updateData: (updater: (prev: MindMapData[]) => MindMapData[]) => void;
17
+ direction: LayoutDirection;
18
+ splitIndices: Record<string, number>;
19
+ setSplitIndices: React.Dispatch<React.SetStateAction<Record<string, number>>>;
20
+ mapData: MindMapData[];
21
+ contentCenter: {
22
+ x: number;
23
+ y: number;
24
+ };
25
+ }
26
+ export declare function useDrag({ svgRef, zoom, pan, setPan, setZoom, nodeMap, nodes, updateData, direction, splitIndices, setSplitIndices, mapData, contentCenter, }: UseDragParams): {
27
+ draggingCanvas: boolean;
28
+ floatingNodeId: string | null;
29
+ floatingPos: {
30
+ x: number;
31
+ y: number;
32
+ } | null;
33
+ floatingSubtreeIds: Set<string>;
34
+ didDragRef: import("react").RefObject<boolean>;
35
+ handleCanvasMouseDown: (e: React.MouseEvent) => void;
36
+ handleMouseMove: (e: React.MouseEvent) => void;
37
+ handleMouseUp: () => void;
38
+ handleNodeMouseDown: (e: React.MouseEvent, nodeId: string) => void;
39
+ };
40
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { LayoutNode } from '../types';
2
+ export declare function useNewNodeAnimation(nodes: LayoutNode[]): Set<string>;
@@ -0,0 +1,17 @@
1
+ import type { MindMapData, LayoutNode } from '../types';
2
+ interface UseNodeEditParams {
3
+ nodeMap: Record<string, LayoutNode>;
4
+ updateData: (updater: (prev: MindMapData[]) => MindMapData[]) => void;
5
+ onTextChange?: (nodeId: string, oldText: string, newText: string) => void;
6
+ }
7
+ export declare function useNodeEdit({ nodeMap, updateData, onTextChange, }: UseNodeEditParams): {
8
+ editingId: string | null;
9
+ editText: string;
10
+ setEditText: import("react").Dispatch<import("react").SetStateAction<string>>;
11
+ pendingEditId: string | null;
12
+ setPendingEditId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
13
+ handleNodeDoubleClick: (_e: React.MouseEvent, _nodeId: string, text: string) => void;
14
+ commitEdit: () => void;
15
+ cancelEdit: () => void;
16
+ };
17
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { LayoutNode } from '../types';
2
+ export declare function usePanZoom(svgRef: React.RefObject<SVGSVGElement | null>, nodes: LayoutNode[]): {
3
+ pan: {
4
+ x: number;
5
+ y: number;
6
+ };
7
+ setPan: import("react").Dispatch<import("react").SetStateAction<{
8
+ x: number;
9
+ y: number;
10
+ }>>;
11
+ zoom: number;
12
+ setZoom: import("react").Dispatch<import("react").SetStateAction<number>>;
13
+ animateTo: (targetZoom: number, targetPanX: number, targetPanY: number) => void;
14
+ autoFit: () => {
15
+ zoom: number;
16
+ panX: number;
17
+ panY: number;
18
+ } | undefined;
19
+ zoomIn: () => void;
20
+ zoomOut: () => void;
21
+ contentCenter: {
22
+ x: number;
23
+ y: number;
24
+ };
25
+ panToNode: (nodeId: string) => void;
26
+ };
@@ -0,0 +1,3 @@
1
+ import type { ThemeMode } from '../types';
2
+ import type { ThemeColors } from '../utils/theme';
3
+ export declare function useTheme(themeProp?: ThemeMode): ThemeColors;
@@ -0,0 +1,16 @@
1
+ export { MindMap } from './MindMap';
2
+ export type { MindMapData, MindMapProps, MindMapRef, MindMapEvent, LayoutDirection, ThemeMode, ToolbarConfig, TaskStatus, CrossLink } from './types';
3
+ export type { MindMapMessages } from './utils/i18n';
4
+ export { resolveMessages, detectLocale } from './utils/i18n';
5
+ export { buildExportSVG, buildExportSVGForPNG, exportToPNG } from './utils/export';
6
+ export { parseMarkdownList, toMarkdownList, parseMarkdownMultiRoot, toMarkdownMultiRoot, parseMarkdownWithFrontMatter } from './utils/markdown';
7
+ export { parseInlineMarkdown, stripInlineMarkdown } from './utils/inline-markdown';
8
+ export type { MindMapPlugin, ParseContext, LayoutContext, ParsedLineResult } from './plugins/types';
9
+ export { frontMatterPlugin } from './plugins/front-matter';
10
+ export { dottedLinePlugin } from './plugins/dotted-line';
11
+ export { foldingPlugin } from './plugins/folding';
12
+ export { multiLinePlugin } from './plugins/multi-line';
13
+ export { tagsPlugin } from './plugins/tags';
14
+ export { crossLinkPlugin } from './plugins/cross-link';
15
+ export { latexPlugin } from './plugins/latex';
16
+ export { allPlugins } from './plugins';
package/dist/logo.svg ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="192px" height="192px" viewBox="0 0 192 192" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>192x192@1x</title>
4
+ <g id="192x192" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
+ <g id="open-mindmap" transform="translate(27, 34)" fill="#FF6B6B">
6
+ <path d="M65.2942453,0.192083517 C59.8455194,1.55726816 56.0732557,5.16121182 54.5364241,10.4696141 C52.70243,16.8043764 55.6897191,23.6276034 61.685779,26.7992536 C63.6786478,27.8534745 64.4640698,27.9981715 68.203216,28 C72.0828879,28.0022158 72.664682,27.8853798 74.8553607,26.6671389 C84.6626198,21.2131409 84.2960895,6.40731353 74.2314984,1.46290056 C71.8349541,0.28555238 67.4240594,-0.341318119 65.2942453,0.192083517 M66.6757112,8.41163667 C65.2714183,8.9725578 63.4030866,11.3751699 63.0901196,13.0223193 C62.4389317,16.4479447 65.4121182,20 68.9305166,20 C73.5641418,20 76.2676535,15.7120696 74.4060861,11.3146261 C73.2746248,8.64134723 69.5776458,7.25284486 66.6757112,8.41163667 M26.9077072,14.3521949 C22.6763866,15.428857 18.6913715,18.6921892 16.9676837,22.4922536 C16.2247148,24.129858 16.0031749,25.5048062 16,28.4986303 C15.9946195,33.1761949 16.9424678,35.5035573 20.1669528,38.728062 C23.1446822,41.7063551 26.2156204,42.8131656 30.6297563,42.4984349 C32.4871786,42.3659648 34.6872671,42.1160988 35.5184918,41.9425173 C36.9400389,41.6465152 37.1885958,41.799541 39.6993805,44.5174618 C42.7000743,47.7670902 44.8141586,51.7407361 45.4868832,55.3973674 C45.7358903,56.7508463 45.9394188,61.1611867 45.9394188,65.1978702 L45.9394188,72.5380836 L56.0118258,82.7844167 C69.0714182,96.0702533 67.1149334,95.8400294 77.5363107,85.3173362 C81.7379125,81.0750958 86.2254447,76.3865681 87.5087547,74.8992488 L89.8421274,72.1941181 L90.0672695,62.9970395 L90.2924116,53.799504 L91.9526094,50.3941091 C93.000871,48.2435257 94.5710119,46.0079787 96.2136487,44.3283493 C98.6429319,41.8443067 98.9203069,41.6876266 100.407596,41.9548507 C101.283398,42.1124445 103.549679,42.3559154 105.444024,42.4966077 C108.535676,42.7254612 109.170126,42.6235963 111.640835,41.4985141 C120.764944,37.3448916 122.890285,25.0562351 115.670429,18.2052474 C112.571122,15.2644114 109.955872,14.1653664 106.017686,14.1484651 C101.716572,14.1301933 97.6009742,16.1053681 95.0095887,19.4308241 C91.9719716,23.329556 91.2299032,27.5160676 92.6302871,32.848674 L93.3926182,35.7502258 L90.041153,39.3186959 C83.8781133,45.8823605 81.9644054,51.3136343 81.9585518,62.2602317 L81.9553998,68.9248477 L77.6434784,73.6069802 C75.2722818,76.1819247 73.0510299,78.2891127 72.7074631,78.2891127 C72.1864842,78.2891127 72.0622058,74.9663974 71.9568393,58.2267458 L71.8307597,38.1639222 L70.7392709,36.9858519 C69.2506313,35.3788527 66.6097145,35.3523587 65.0562341,36.9287528 L63.9507864,38.0497238 L63.9507864,58.1696467 C63.9507864,74.1195024 63.8323617,78.2891127 63.3793758,78.2891127 C63.0650774,78.2891127 60.8555329,76.28516 58.4694769,73.8353769 L54.1305385,69.3816411 L53.9171038,61.616153 C53.7468964,55.4097008 53.5145497,53.2545495 52.7603237,50.8815077 C51.3968632,46.5903903 48.8554592,42.4861015 45.3454939,38.9066683 L42.275006,35.7758062 L43.0630034,33.3936285 C44.9024143,27.8307983 43.5596668,21.9884105 39.5724003,18.2052474 C35.8913271,14.7121481 31.1552379,13.2714217 26.9077072,14.3521949 M27.235249,23.6088612 C21.7500564,26.3640569 23.6694642,35 29.7671564,35 C33.6469267,35 35.9981786,32.7733704 36,29.0976786 C36.001819,25.7316654 33.9099466,23.427279 30.4966042,23.0348995 C29.411761,22.9103989 28.2031438,23.1229939 27.235249,23.6088612 M103.103845,23.7565027 C100.88837,24.9235968 99.7892725,27.0996711 100.033466,29.8358433 C100.197626,31.6746976 100.503208,32.2870535 101.873784,33.5206982 C103.241176,34.7516631 103.871895,35 105.629906,35 C108.463368,35 110.501041,33.7199037 111.475541,31.3276513 C112.365915,29.1421973 112.120812,27.1398695 110.753874,25.4332234 C108.774407,22.9614673 105.835901,22.3173994 103.103845,23.7565027 M11.3176117,51.4490768 C6.67273908,52.3691606 2.55622295,55.8705277 0.905221,60.3055025 C-3.25973528,71.4939189 7.67518117,82.5448412 18.842431,78.4330903 C20.1992038,77.9336034 21.6232547,77.4196909 22.0067392,77.2912128 C22.6216601,77.0851969 37.1940734,87.8210097 51.0802511,98.7109962 L54.9482872,101.744432 L55.1725472,111.557908 L55.3968072,121.370932 L56.8616733,122.685466 L58.3265395,124 L68.6007861,124 L78.8754811,124 L80.2551285,122.832878 L81.6352244,121.665755 L81.6352244,112.019527 L81.6352244,102.373299 L84.8869941,99.6950936 C86.6752431,98.2218777 93.9919491,92.5300712 101.145842,87.0460837 C110.655362,79.7561896 114.394225,77.1338834 115.049961,77.293016 C115.543333,77.4129289 117.158005,77.9511846 118.638121,78.4889896 C125.471322,80.9724492 132.927069,77.708654 136.064915,70.8605443 C136.795554,69.2669647 137.015329,67.9285382 137,65.170541 C136.97541,60.9925224 135.846037,58.2534589 132.953532,55.3584184 C126.117191,48.5166199 114.810003,50.5718192 110.475057,59.4440229 C109.336714,61.7742104 109.225929,62.427871 109.290516,66.4237663 L109.361831,70.8325947 L101.665677,76.6691081 C88.1522193,86.9171548 74.7011059,97.4266657 74.1225152,98.1889693 C73.7197443,98.7191106 73.5618653,101.317975 73.5618653,107.406486 L73.5618653,115.885592 L68.4038858,115.885592 L63.2459063,115.885592 L63.2459063,107.345628 C63.2459063,99.1248311 63.2082307,98.7632891 62.2367364,97.674606 C61.3612255,96.6936642 49.3826031,87.3566852 32.3926673,74.4119503 L27.3629645,70.5801464 L27.7002515,68.7769446 C28.238924,65.8931741 27.9254085,61.9495718 26.9875533,59.818638 C25.889128,57.3234575 23.2634921,54.3869434 20.8984464,53.0088464 C19.4030809,52.1374491 14.5047945,50.8224642 13.4897938,51.0199148 C13.3503041,51.0469628 12.3725306,51.2399054 11.3176117,51.4490768 M10.2857859,59.7135188 C8.1500563,60.7305963 7.00185926,62.7045033 7,65.3625611 C6.99816582,67.2918398 7.19853475,67.7283039 8.79040584,69.2675318 C10.4159795,70.8388921 10.8079455,71 13,71 C15.1920545,71 15.5840205,70.8388921 17.2095942,69.2675318 C18.8014653,67.7283039 19.0018342,67.2918398 19,65.3625611 C18.9981407,62.6696932 17.8300915,60.7006954 15.639422,59.6956675 C13.6057236,58.7629373 12.2728547,58.7674002 10.2857859,59.7135188 M120.527041,59.6974997 C117.432794,61.2687562 116.166924,64.6438655 117.568696,67.5851537 C119.606327,71.8619653 125.604018,72.1945016 128.101556,68.1695572 C129.309374,66.2236371 129.299474,64.1903254 128.071405,62.0144981 C126.449581,59.1408823 123.441735,58.21722 120.527041,59.6974997" id="形状"></path>
7
+ </g>
8
+ </g>
9
+ </svg>
@@ -0,0 +1,24 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.OpenMindMap={},e.React,e.ReactJSXRuntime))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=[`#FF6B6B`,`#4ECDC4`,`#45B7D1`,`#96CEB4`,`#FFEAA7`,`#DDA0DD`,`#98D8C8`,`#F7DC6F`,`#BB8FCE`,`#F0B27A`],i={root:{fontSize:20,fontWeight:600,fontFamily:`system-ui, 'Segoe UI', Roboto, sans-serif`,paddingH:24,paddingV:12},node:{fontSize:15,fontWeight:400,fontFamily:`system-ui, 'Segoe UI', Roboto, sans-serif`,paddingH:8,paddingV:6},level1:{fontSize:16,fontWeight:500},connection:{strokeWidth:2.5},layout:{horizontalGap:80,verticalGap:16}},a={...i,root:{...i.root,bgColor:`#2C3E50`,textColor:`#FFFFFF`},node:{...i.node,textColor:`#333333`},canvas:{bgColor:`#fafafa`},controls:{bgColor:`rgba(255, 255, 255, 0.9)`,textColor:`#555`,hoverBg:`rgba(0, 0, 0, 0.08)`,activeBg:`rgba(0, 0, 0, 0.08)`},contextMenu:{bgColor:`rgba(255, 255, 255, 0.95)`,textColor:`#333`,hoverBg:`rgba(0, 0, 0, 0.06)`,borderColor:`rgba(0, 0, 0, 0.08)`,shadowColor:`rgba(0, 0, 0, 0.15)`},addBtn:{fill:`rgba(200, 200, 220, 0.6)`,hoverFill:`rgba(180, 180, 200, 0.8)`,iconColor:`#666`},selection:{strokeColor:`#4A90D9`,fillColor:`rgba(74, 144, 217, 0.08)`},highlight:{textColor:`#fac800`,bgColor:`rgba(252, 211, 77, 0.2)`}},o={...i,root:{...i.root,bgColor:`#4A6FA5`,textColor:`#FFFFFF`},node:{...i.node,textColor:`#E0E0E0`},canvas:{bgColor:`#1a1a2e`},controls:{bgColor:`rgba(30, 30, 45, 0.9)`,textColor:`#ccc`,hoverBg:`rgba(255, 255, 255, 0.1)`,activeBg:`rgba(255, 255, 255, 0.12)`},contextMenu:{bgColor:`rgba(35, 35, 50, 0.95)`,textColor:`#ddd`,hoverBg:`rgba(255, 255, 255, 0.08)`,borderColor:`rgba(255, 255, 255, 0.1)`,shadowColor:`rgba(0, 0, 0, 0.4)`},addBtn:{fill:`rgba(100, 100, 130, 0.6)`,hoverFill:`rgba(120, 120, 150, 0.8)`,iconColor:`#aaa`},selection:{strokeColor:`#5B9BD5`,fillColor:`rgba(91, 155, 213, 0.15)`},highlight:{textColor:`#fcd34d`,bgColor:`rgba(251, 191, 36, 0.2)`}};function s(e){return e===`dark`?o:a}var c=a,l="!\\[([^\\]]*)\\]\\(([^)]+)\\)|\\[([^\\]]+)\\]\\(([^)]+)\\)|`([^`]+)`|\\*\\*(.+?)\\*\\*|\\*(.+?)\\*|~~(.+?)~~|==(.+?)==";function u(e,t){let n=[],r=l,i=[];if(t&&t.length>0){let e=[];for(let n of t)if(n.inlineTokenPattern){let{pattern:t,priority:r}=n.inlineTokenPattern();e.push({plugin:n,pattern:t,priority:r})}e.sort((e,t)=>e.priority-t.priority);let n=0;for(let t of e){let e=d(t.pattern);i.push({plugin:t.plugin,groupOffset:n,pattern:t.pattern}),n+=e}i.length>0&&(r=i.map(e=>e.pattern).join(`|`)+"|!\\[([^\\]]*)\\]\\(([^)]+)\\)|\\[([^\\]]+)\\]\\(([^)]+)\\)|`([^`]+)`|\\*\\*(.+?)\\*\\*|\\*(.+?)\\*|~~(.+?)~~|==(.+?)==")}let a=new RegExp(r,`g`),o=i.reduce((e,t)=>e+d(t.pattern),0),s=0,c;for(;(c=a.exec(e))!==null;){c.index>s&&n.push({type:`text`,content:e.slice(s,c.index)});let t=!1;if(i.length>0)for(let e of i){let r=e.groupOffset+1,i=d(e.pattern),a=!1;for(let e=r;e<r+i;e++)if(c[e]!==void 0){a=!0;break}if(a&&e.plugin.createInlineToken){let r=e.plugin.createInlineToken(c,e.groupOffset);if(r){n.push(r),t=!0;break}}}if(!t){let e=o,t=t=>c[e+t];t(1)!==void 0||t(2)!==void 0?n.push({type:`image`,alt:t(1)??``,url:t(2)}):t(3)===void 0?t(5)===void 0?t(6)===void 0?t(7)===void 0?t(8)===void 0?t(9)!==void 0&&n.push({type:`highlight`,content:t(9)}):n.push({type:`strikethrough`,content:t(8)}):n.push({type:`italic`,content:t(7)}):n.push({type:`bold`,content:t(6)}):n.push({type:`code`,content:t(5)}):n.push({type:`link`,text:t(3),url:t(4)})}s=c.index+c[0].length}return s<e.length&&n.push({type:`text`,content:e.slice(s)}),n.length===0&&n.push({type:`text`,content:e}),n}function d(e){let t=0;for(let n=0;n<e.length;n++){if(e[n]===`\\`){n++;continue}e[n]===`(`&&e[n+1]!==`?`&&t++}return t}function f(e){return e.replace(/!\[([^\]]*)\]\([^)]+\)/g,`$1`).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/\*\*(.+?)\*\*/g,`$1`).replace(/\*(.+?)\*/g,`$1`).replace(/~~(.+?)~~/g,`$1`).replace(/==(.+?)==/g,`$1`).replace(/\$\$(.+?)\$\$/g,`$1`).replace(/\$([^$]+?)\$/g,`$1`)}var p=`'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace`,m=null;function h(){return m||=document.createElement(`canvas`).getContext(`2d`),m}function g(e,t,n,r){let i=h();return i.font=`${n} ${t}px ${r}`,i.measureText(e).width}function _(e,t,n,r){let i=[],a=0;for(let o of e){let e;switch(o.type){case`bold`:e=g(o.content,t,700,r);break;case`code`:e=g(o.content,t*.88,400,p);break;case`link`:e=g(o.text,t,n,r);break;case`image`:e=g(`[${o.alt||`image`}]`,t,n,r);break;case`latex-inline`:case`latex-block`:e=g(o.content,t*.9,n,p);break;default:e=g(`content`in o?o.content:``,t,n,r);break}i.push({token:o,x:a,width:e}),a+=e}return i}function v(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function y(e,t,n,r,i,a,o,s,c,l,d){let f=_(u(e,s),t,n,r),p=f.length>0?f[f.length-1].x+f[f.length-1].width:0,m=t*.85,h=a?m+(a?4:0):0,g=t*.7,v=o?4:0,y=o?g+v:0,S=-(h+p+y)/2,C=S+h,w=[];a&&(w.push(`<g transform="translate(${S}, ${-m/2})">`),w.push(x(a,m)),w.push(`</g>`));let T=-t/2-2,E=t+4;for(let e of f)e.token.type===`code`?w.push(`<rect x="${C+e.x-2}" y="${T}" width="${e.width+4}" height="${E}" rx="3" fill="rgba(128,128,128,0.12)"/>`):e.token.type===`highlight`&&w.push(`<rect x="${C+e.x-1}" y="${T}" width="${e.width+2}" height="${E}" rx="2" fill="${l||`rgba(255,213,79,0.3)`}"/>`);w.push(`<text text-anchor="start" dominant-baseline="central" x="${C}" fill="${i}" font-size="${t}" font-weight="${n}" font-family="${r}">`);for(let e of f)w.push(b(e.token,s,c,d));return w.push(`</text>`),o&&w.push(`<text x="${C+p+v}" text-anchor="start" dominant-baseline="central" font-size="${g}" opacity="0.5">💬</text>`),w.join(``)}function b(e,t,n,r){switch(e.type){case`bold`:return`<tspan font-weight="700">${v(e.content)}</tspan>`;case`italic`:return`<tspan font-style="italic">${v(e.content)}</tspan>`;case`strikethrough`:return`<tspan text-decoration="line-through" opacity="0.6">${v(e.content)}</tspan>`;case`code`:return`<tspan font-family="${p}" font-size="0.88em">${v(e.content)}</tspan>`;case`highlight`:return`<tspan fill="${n||`#FFEB3B`}">${v(e.content)}</tspan>`;case`link`:return`<a href="${v(e.url)}" target="_blank"><tspan fill="#2563EB" text-decoration="underline">${v(e.text)}</tspan></a>`;case`image`:return`<tspan font-style="italic">[${v(e.alt||`image`)}]</tspan>`;case`latex-inline`:case`latex-block`:if(t){for(let n of t)if(n.exportInlineToken){let t=n.exportInlineToken({token:e,x:0,width:0},r);if(t)return t}}return`<tspan font-family="${p}" font-style="italic" font-size="0.9em">${v(e.content)}</tspan>`;default:return v(e.content)}}function x(e,t){return e===`done`?`<rect x="0" y="0" width="${t}" height="${t}" rx="${t*.2}" fill="#22C55E"/><path d="M${t*.28} ${t*.5}L${t*.44} ${t*.66}L${t*.72} ${t*.34}" stroke="white" stroke-width="${t*.13}" stroke-linecap="round" stroke-linejoin="round" fill="none"/>`:e===`doing`?`<rect x="0" y="0" width="${t}" height="${t}" rx="${t*.2}" fill="none" stroke="#FBBF24" stroke-width="${t*.1}"/><rect x="${t*.25}" y="${t*.25}" width="${t*.5}" height="${t*.5}" rx="${t*.1}" fill="#FBBF24" opacity="0.6"/>`:`<rect x="0" y="0" width="${t}" height="${t}" rx="${t*.2}" fill="none" stroke="#999" stroke-width="${t*.1}" opacity="0.4"/>`}function S(e,t,n,r,i,a,o,s,c,l){let d=_(u(e,o),t,n,r),f=-(d.length>0?d[d.length-1].x+d[d.length-1].width:0)/2,p=[],m=a-t/2-2,h=t+4;for(let e of d)e.token.type===`code`?p.push(`<rect x="${f+e.x-2}" y="${m}" width="${e.width+4}" height="${h}" rx="3" fill="rgba(128,128,128,0.12)"/>`):e.token.type===`highlight`&&p.push(`<rect x="${f+e.x-1}" y="${m}" width="${e.width+2}" height="${h}" rx="2" fill="${c||`rgba(255,213,79,0.3)`}"/>`);let g=l===void 0?``:` opacity="${l}"`;p.push(`<text x="${f}" y="${a}" text-anchor="start" dominant-baseline="central" fill="${i}" font-size="${t}" font-weight="${n}" font-family="${r}"${g}>`);for(let e of d)p.push(b(e.token,o,s));return p.push(`</text>`),p.join(``)}function C(e,t,n){for(let r of e)r.preParseMarkdown&&(t=r.preParseMarkdown(t,n));return t}function w(e,t,n,r){for(let i of e)if(i.parseLine){let e=i.parseLine(t,n,r);if(e)return e}return null}function T(e,t,n,r,i){let a=0;for(let o of e)if(o.collectFollowLines){let e=o.collectFollowLines(t,n+a,r,i);a+=e}return a}function E(e,t,n,r){for(let i of e)i.transformNodeData&&(t=i.transformNodeData(t,n,r));return t}function D(e,t,n){for(let r of e)r.postParseTree&&(t=r.postParseTree(t,n));return t}function O(e,t){let n=``;for(let r of e)if(r.serializePreamble){let e=r.serializePreamble(t);e&&(n+=e)}return n}function ee(e,t,n){let r=n;for(let n of e)if(n.serializeListMarker){let e=n.serializeListMarker(t,r);if(e!==r){r=e;break}}return r}function k(e,t,n){for(let r of e)r.serializeNodeText&&(n=r.serializeNodeText(t,n));return n}function te(e,t,n){let r=[];for(let i of e)if(i.serializeFollowLines){let e=i.serializeFollowLines(t,n);e&&r.push(...e)}return r}function A(e,t,n,r,i){for(let a of e)if(a.adjustNodeSize){let e=a.adjustNodeSize(t,n,r,i);n=e.width,r=e.height}return{width:n,height:r}}function j(e,t,n,r){for(let i of e)i.filterChildren&&(n=i.filterChildren(t,n,r));return n}function M(e,t,n,r){for(let i of e)i.transformEdge&&(t=i.transformEdge(t,n,r));return t}function N(e,t,n,r){let i=[];for(let a of e)a.generateExtraEdges&&i.push(...a.generateExtraEdges(t,n,r));return i}function P(e,t,n,r){let i={};for(let a of e)if(a.transformNodeColor){let e=a.transformNodeColor(t,n,r);i={...i,...e}}return i}function F(e,t,n){let r=[];for(let i of e)if(i.renderNodeDecoration){let e=i.renderNodeDecoration(t,n);e&&r.push(e)}return r}function I(e,t,n){for(let r of e)if(r.renderInlineToken){let e=r.renderInlineToken(t,n);if(e)return e}return null}function ne(e,t,n,r){let i=[];for(let a of e)if(a.renderOverlay){let e=a.renderOverlay(t,n,r);e&&i.push(e)}return i}function re(e,t,n,r,i){let a=``;for(let o of e)o.exportNodeDecoration&&(a+=o.exportNodeDecoration(t,n,r,i));return a}function ie(e,t,n,r){let i=``;for(let a of e)a.exportOverlay&&(i+=a.exportOverlay(t,n,r));return i}var ae=null;function oe(){return ae||=document.createElement(`canvas`).getContext(`2d`),ae}function se(e,t,n,r){let i=oe();return i.font=`${n} ${t}px ${r||c.root.fontFamily}`,i.measureText(e).width}var ce=4,L=20;function le(e,t,n,r,i){let a=se(f(e),t,n);return r&&(a+=t*.9+ce),i&&(a+=L),a}function R(e,t,n,i,a,o,s){let l=t===0,u=t===1,d=l?c.root.fontSize:u?c.level1.fontSize:c.node.fontSize,f=l?c.root.fontWeight:u?c.level1.fontWeight:c.node.fontWeight,p=l?c.root.paddingH:c.node.paddingH,m=l?c.root.paddingV:c.node.paddingV,h=le(e.text,d,f,e.taskStatus,!!e.remark)+p*2,g=d+m*2;if(o&&o.length>0){let t=A(o,e,h,g,d);h=t.width,g=t.height}let _=e.children||[];o&&o.length>0&&s&&(_=j(o,e,_,s));let v=i;if(o&&o.length>0){let r=P(o,{id:e.id,text:e.text,x:0,y:0,width:h,height:g,color:i,depth:t,side:n,parentId:a},e,i);r.color&&(v=r.color)}let y=_.map((i,a)=>{let c=l?r[a%r.length]:v;return R(i,t+1,n,c,e.id,o,s)});return{id:e.id,text:e.text,children:y,width:h,height:g,depth:t,side:n,color:v,x:0,y:0,subtreeHeight:0,parentId:a,remark:e.remark,taskStatus:e.taskStatus,dottedLine:e.dottedLine,multiLineContent:e.multiLineContent,tags:e.tags,anchorId:e.anchorId,crossLinks:e.crossLinks,collapsed:e.collapsed}}function z(e){if(e.children.length===0)return e.subtreeHeight=e.height,e.height;let t=e.children.reduce((e,t)=>e+z(t),0)+(e.children.length-1)*c.layout.verticalGap;return e.subtreeHeight=Math.max(e.height,t),e.subtreeHeight}function B(e,t,n){if(e.x=t,e.y=n,e.children.length===0)return;let r=e.side===`left`?-1:1,i=n-(e.children.reduce((e,t)=>e+t.subtreeHeight,0)+(e.children.length-1)*c.layout.verticalGap)/2;for(let n of e.children){let a=i+n.subtreeHeight/2;B(n,t+r*(e.width/2+c.layout.horizontalGap+n.width/2),a),i+=n.subtreeHeight+c.layout.verticalGap}}function ue(e,t){t.push({id:e.id,text:e.text,x:e.x,y:e.y,width:e.width,height:e.height,color:e.color,depth:e.depth,side:e.side,parentId:e.parentId,remark:e.remark,taskStatus:e.taskStatus,dottedLine:e.dottedLine,multiLineContent:e.multiLineContent,tags:e.tags,anchorId:e.anchorId,crossLinks:e.crossLinks,collapsed:e.collapsed});for(let n of e.children)ue(n,t)}function de(e,t,n,r,i,a,o){let s=o===`left`?-1:1,c=e+n/2*s,l=t,u=r-a/2*s,d=i,f=c+(u-c)*.5;return`M ${c},${l} C ${f},${l} ${f},${d} ${u},${d}`}function V(e,t,n,r){for(let i of e.children){let a={key:`${e.id}-${i.id}`,path:de(e.x,e.y,e.width,i.x,i.y,i.width,i.side),color:i.color,fromId:e.id,toId:i.id};if(r&&r.length>0){let t=n.find(t=>t.id===e.id),o=n.find(e=>e.id===i.id);t&&o&&(a=M(r,a,t,o))}t.push(a),V(i,t,n,r)}}function H(e,t=`both`,n,i,a,o,s){let l=a&&a.length>0?{direction:t,theme:c,readonly:!!o,foldOverrides:s||{}}:void 0,u=e.children||[],d,f,p;t===`right`?(d=u,f=[],p=u.length):t===`left`?(d=[],f=u,p=0):(p=i??Math.ceil(u.length/2),p=Math.min(Math.max(p,0),u.length),d=u.slice(0,p),f=u.slice(p));let m=R({...e,children:[]},0,`root`,c.root.bgColor,void 0,a,l),h=d.map((t,i)=>R(t,1,`right`,n?.[t.id]??r[i%r.length],e.id,a,l)),g=f.map((i,o)=>R(i,1,`left`,n?.[i.id]??r[((t===`left`?0:p)+o)%r.length],e.id,a,l));m.children=[...h,...g];for(let e of m.children)z(e);m.x=0,m.y=0;let _=m.children.filter(e=>e.side===`right`),v=m.children.filter(e=>e.side===`left`),y=(e,t)=>{let n=-(e.reduce((e,t)=>e+t.subtreeHeight,0)+Math.max(0,e.length-1)*c.layout.verticalGap)/2;for(let r of e){let e=n+r.subtreeHeight/2;B(r,t*(m.width/2+c.layout.horizontalGap+r.width/2),e),n+=r.subtreeHeight+c.layout.verticalGap}};y(_,1),y(v,-1);let b=[],x=[];if(ue(m,b),V(m,x,b,a),a&&a.length>0&&l){let t=N(a,b,[e],l);x.push(...t)}return{nodes:b,edges:x}}function fe(e,t=`both`,n,r,i,a,o){if(e.length===0)return{nodes:[],edges:[]};if(e.length===1)return H(e[0],t,n,r?.[e[0].id],i,a,o);let s=e.map(e=>H(e,t,n,r?.[e.id],i,a,o)),c=s.map(e=>{let t=1/0,n=-1/0;for(let r of e.nodes)t=Math.min(t,r.y-r.height/2),n=Math.max(n,r.y+r.height/2);return{minY:t,maxY:n}}),l=[],u=[],d=c[0].maxY;for(let e of s[0].nodes)l.push(e);for(let e of s[0].edges)u.push(e);for(let e=1;e<s.length;e++){let t=d+80-c[e].minY,n=l.length;for(let n of s[e].nodes)l.push({...n,y:n.y+t});for(let t of s[e].edges){let e=l.slice(n).find(e=>e.id===t.fromId),r=l.slice(n).find(e=>e.id===t.toId);e&&r?u.push({...t,path:de(e.x,e.y,e.width,r.x,r.y,r.width,r.side)}):u.push(t)}d=d+80+(c[e].maxY-c[e].minY)}let f=-(Math.min(...l.map(e=>e.y-e.height/2))+Math.max(...l.map(e=>e.y+e.height/2)))/2;if(Math.abs(f)>.1){for(let e of l)e.y+=f;for(let e=0;e<u.length;e++){let t=u[e];if(t.isCrossLink)continue;let n=l.find(e=>e.id===t.fromId),r=l.find(e=>e.id===t.toId);n&&r&&(u[e]={...t,path:de(n.x,n.y,n.width,r.x,r.y,r.width,r.side)})}}return{nodes:l,edges:u}}function pe(e,t,n={},r=c,i){let{padding:a=40,background:o=r.canvas.bgColor,pngSafe:s=!1}=n,l=1/0,u=-1/0,d=1/0,f=-1/0;for(let t of e)l=Math.min(l,t.x-t.width/2),u=Math.max(u,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),f=Math.max(f,t.y+t.height/2);let p=u-l+a*2,m=f-d+a*2,h=-l+a,g=-d+a,_=[];_.push(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${p}" height="${m}" viewBox="0 0 ${p} ${m}">`),t.some(e=>e.isCrossLink)&&(_.push(`<defs>`),_.push(`<marker id="arrowhead" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto">`),_.push(`<path d="M0,0 L8,3 L0,6" fill="none" stroke="currentColor" stroke-width="1.5"/>`),_.push(`</marker>`),_.push(`</defs>`)),_.push(`<rect width="100%" height="100%" fill="${o}"/>`),_.push(`<g transform="translate(${h}, ${g})">`);for(let n of t){let t=`d="${n.path}" stroke="${n.color}" stroke-width="${r.connection.strokeWidth}" stroke-linecap="round" fill="none"`;if(n.strokeDasharray&&(t+=` stroke-dasharray="${n.strokeDasharray}"`),n.isCrossLink&&(t+=` marker-end="url(#arrowhead)" opacity="0.7"`),_.push(`<path ${t}/>`),n.label){let t=e.find(e=>e.id===n.fromId),i=e.find(e=>e.id===n.toId);if(t&&i){let e=(t.x+i.x)/2,a=(t.y+i.y)/2;_.push(`<text x="${e}" y="${a-6}" text-anchor="middle" font-size="11" fill="${n.color}" opacity="0.8" font-family="${r.node.fontFamily}">${n.label}</text>`)}}}for(let t of e){let e=t.x,n=t.y;if(t.depth===0){let{fontSize:a,fontWeight:o,fontFamily:c,textColor:l}=r.root,u=r.root.bgColor;_.push(`<g transform="translate(${e}, ${n})">`),_.push(`<rect x="${-t.width/2}" y="${-t.height/2}" width="${t.width}" height="${t.height}" rx="${t.height/2}" ry="${t.height/2}" fill="${u}"/>`),_.push(y(t.text,a,o,c,l,t.taskStatus,t.remark,i,r.highlight.textColor,r.highlight.bgColor,s)),i&&i.length>0&&_.push(re(i,t,r,i,s)),_.push(`</g>`)}else{let a=t.depth===1?r.level1.fontSize:r.node.fontSize,o=t.depth===1?r.level1.fontWeight:r.node.fontWeight,c=t.width-r.node.paddingH*2,l=a/2+4;_.push(`<g transform="translate(${e}, ${n})">`),_.push(y(t.text,a,o,r.node.fontFamily,r.node.textColor,t.taskStatus,t.remark,i,r.highlight.textColor,r.highlight.bgColor,s)),_.push(`<line x1="${-c/2}" y1="${l}" x2="${c/2}" y2="${l}" stroke="${t.color}" stroke-width="2.5" stroke-linecap="round"/>`),i&&i.length>0&&_.push(re(i,t,r,i,s)),_.push(`</g>`)}}return i&&i.length>0&&_.push(ie(i,e,t,r)),_.push(`</g>`),_.push(`</svg>`),_.join(`
2
+ `)}var me=pe;function he(e,t={}){let n=typeof window<`u`?Math.max(window.devicePixelRatio??1,2):2,{scale:r=n}=t;return new Promise((t,n)=>{let i=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,a=parseFloat(i.getAttribute(`width`)||`800`),o=parseFloat(i.getAttribute(`height`)||`600`),s=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),c=URL.createObjectURL(s),l=new Image;l.onload=()=>{let e=document.createElement(`canvas`);e.width=a*r,e.height=o*r;let i=e.getContext(`2d`);i.scale(r,r),i.drawImage(l,0,0,a,o),URL.revokeObjectURL(c),e.toBlob(e=>{e?t(e):n(Error(`Failed to create PNG blob`))},`image/png`)},l.onerror=()=>{URL.revokeObjectURL(c),n(Error(`Failed to load SVG image`))},l.src=c})}function U(e){let t=e.match(/^\[([ x\-])\]\s+(.*)/);if(!t)return{text:e};let n=t[1],r=t[2];return n===` `?{taskStatus:`todo`,text:r}:n===`x`?{taskStatus:`done`,text:r}:n===`-`?{taskStatus:`doing`,text:r}:{text:e}}function W(e,t){let n=t&&t.length>0?t:void 0,r=n?{lines:[],frontMatter:{}}:void 0,i=e;n&&r&&(i=C(n,i,r));let a=i.split(`
3
+ `);r&&(r.lines=a);let o=[],s=null,c=[],l=0;for(;l<a.length;){let e=a[l],t=n&&r?w(n,e,l,r):null;if(t){let e=t.text.trim(),i=t.taskStatus,{taskStatus:s,text:c}=i?{taskStatus:i,text:e}:U(e);if(c){let e={indent:t.indent,text:c,taskStatus:s,remarkLines:[],dottedLine:t.dottedLine,collapsed:t.collapsed},i=l+1;for(;i<a.length;){let t=a[i].match(/^(\s*)>\s?(.*)$/);if(t)e.remarkLines.push(t[2]),i++;else break}if(n&&r){let t={id:`temp`,text:c},o=T(n,a,i,t,r);Object.assign(e,{_pluginNode:t}),i+=o}o.push(e),l=i;continue}}let i=e.match(/^(\s*)[*-]\s+(.+)/);if(i){let e=i[1].replace(/\t/g,` `).length,{taskStatus:t,text:s}=U(i[2].trim());if(s){let i={indent:e,text:s,taskStatus:t,remarkLines:[]},c=l+1;for(;c<a.length;){let e=a[c].match(/^(\s*)>\s?(.*)$/);if(e)i.remarkLines.push(e[2]),c++;else break}if(n&&r){let e={id:`temp`,text:s},t=T(n,a,c,e,r);Object.assign(i,{_pluginNode:e}),c+=t}o.push(i),l=c;continue}}if(s===null&&o.length===0){let t=e.trim();if(t){s=t;let e=l+1;for(;e<a.length;){let t=a[e].match(/^(\s*)>\s?(.*)$/);if(t)c.push(t[2]),e++;else break}l=e;continue}}l++}if(o.length===0&&s===null)return{id:`md-0`,text:`Root`};let u=(e,t)=>{t.dottedLine&&(e={...e,dottedLine:!0}),t.collapsed&&(e={...e,collapsed:!0});let i=t._pluginNode;return i&&i.multiLineContent&&(e={...e,multiLineContent:i.multiLineContent}),n&&r&&(e=E(n,e,e.text,r)),e};if(s!==null){let e={id:`md-0`,text:s,children:[],...c.length>0?{remark:c.join(`
4
+ `)}:{}};if(n&&r&&(e=E(n,e,s,r)),o.length===0)return delete e.children,e;let t=2;for(let e of o)if(e.indent>0){t=e.indent;break}let i=o.map(e=>({level:e.indent>0?Math.round(e.indent/t):0,text:e.text,taskStatus:e.taskStatus,remarkLines:e.remarkLines,_item:e})),a=[[e,-1]];for(let e=0;e<i.length;e++){let{level:t,text:n,taskStatus:r,remarkLines:o,_item:s}=i[e],c={id:`md-tmp`,text:n,...r?{taskStatus:r}:{},...o.length>0?{remark:o.join(`
5
+ `)}:{}};for(;a.length>1&&a[a.length-1][1]>=t;)a.pop();let l=a[a.length-1][0];l.children||=[],c.id=`${l.id}-${l.children.length}`,c=u(c,s),l.children.push(c),a.push([c,t])}if(G(e),n&&r){let[t]=D(n,[e],r);return t}return e}let d=2;for(let e of o)if(e.indent>0){d=e.indent;break}let f=o.map(e=>({level:e.indent>0?Math.round(e.indent/d):0,text:e.text,taskStatus:e.taskStatus,remarkLines:e.remarkLines,_item:e})),p={id:`md-0`,text:f[0].text,children:[],...f[0].taskStatus?{taskStatus:f[0].taskStatus}:{},...f[0].remarkLines.length>0?{remark:f[0].remarkLines.join(`
6
+ `)}:{}};p=u(p,f[0]._item);let m=[[p,0]];for(let e=1;e<f.length;e++){let{level:t,text:n,taskStatus:r,remarkLines:i,_item:a}=f[e],o=t===0?1:t,s={id:`md-tmp`,text:n,...r?{taskStatus:r}:{},...i.length>0?{remark:i.join(`
7
+ `)}:{}};for(;m.length>1&&m[m.length-1][1]>=o;)m.pop();let c=m[m.length-1][0];c.children||=[];let l=c.children.length;s.id=`${c.id}-${l}`,s=u(s,a),c.children.push(s),m.push([s,o])}if(G(p),n&&r){let[e]=D(n,[p],r);return e}return p}function G(e){if(e.children&&e.children.length===0)delete e.children;else if(e.children)for(let t of e.children)G(t)}function K(e,t=0,n){let r=n&&n.length>0?n:void 0,i;if(t===0){let t=e.text;r&&(t=k(r,e,t)),i=t+`
8
+ `}else{let n=``;e.taskStatus&&(n={todo:`[ ]`,doing:`[-]`,done:`[x]`}[e.taskStatus]+` `);let a=`- `;r&&(a=ee(r,e,a));let o=e.text;r&&(o=k(r,e,o)),i=` `.repeat(t-1)+a+n+o+`
9
+ `}if(e.remark){let n=t===0?` `:` `.repeat(t);for(let t of e.remark.split(`
10
+ `))i+=n+`> `+t+`
11
+ `}if(r){let n=te(r,e,t),a=t===0?` `:` `.repeat(t);for(let e of n)i+=a+e+`
12
+ `}if(e.children)for(let r of e.children)i+=K(r,t+1,n);return i}function ge(e,t){let n=t&&t.length>0?t:void 0,r=e,i=n?{lines:[],frontMatter:{}}:void 0;n&&i&&(r=C(n,r,i)),r=r.split(`
13
+ `).filter(e=>e.trim().length>0).join(`
14
+ `);let a=r.split(/\n[ \t]*\n/).filter(e=>e.trim());if(a.length===0)return[{id:`md-0`,text:`Root`}];let o=n?n.map(e=>({...e,preParseMarkdown:void 0})):void 0;if(a.length===1){let e=[W(r,o)];return n&&i?D(n,e,i):e}let s=a.map((e,t)=>{let n=W(e,o);return q(n,`md-${t}`),n});return n&&i?D(n,s,i):s}function q(e,t){if(e.id=t,e.children)for(let n=0;n<e.children.length;n++)q(e.children[n],`${t}-${n}`)}function _e(e,t){let n=t&&t.length>0?t:void 0,r=``;n&&(r=O(n,e));let i=e.map(e=>K(e,0,t)).join(`
15
+ `);return r+i}function ve(e,t){let n={lines:[],frontMatter:{}},r=C(t,e,n);r=r.split(`
16
+ `).filter(e=>e.trim().length>0).join(`
17
+ `);let i=t.map(e=>({...e,preParseMarkdown:void 0})),a=r.split(/\n[ \t]*\n/).filter(e=>e.trim());if(a.length===0)return{roots:[{id:`md-0`,text:`Root`}],frontMatter:n.frontMatter};let o;return o=a.length===1?[W(r,i)]:a.map((e,t)=>{let n=W(e,i);return q(n,`md-${t}`),n}),o=D(t,o,n),{roots:o,frontMatter:n.frontMatter}}var ye={newNode:`新节点`,zoomIn:`放大`,zoomOut:`缩小`,resetView:`重置视图`,layoutLeft:`向左排版`,layoutBoth:`左右排版`,layoutRight:`向右排版`,textMode:`文本模式`,viewMode:`视图模式`,fullscreen:`全屏`,exitFullscreen:`退出全屏`,newRootNode:`新建主节点`,export:`导出`,exportSVG:`导出为 SVG`,exportPNG:`导出为 PNG`,exportMarkdown:`导出为 Markdown`,layout:`布局`,close:`关闭`},be={newNode:`New Node`,zoomIn:`Zoom In`,zoomOut:`Zoom Out`,resetView:`Reset View`,layoutLeft:`Left Layout`,layoutBoth:`Both Layout`,layoutRight:`Right Layout`,textMode:`Text Mode`,viewMode:`View Mode`,fullscreen:`Fullscreen`,exitFullscreen:`Exit Fullscreen`,newRootNode:`New Root Node`,export:`Export`,exportSVG:`Export as SVG`,exportPNG:`Export as PNG`,exportMarkdown:`Export as Markdown`,layout:`Layout`,close:`Close`},xe={"zh-CN":ye,"en-US":be};function Se(){if(typeof navigator>`u`)return`en-US`;let e=navigator.language||``;if(xe[e])return e;if(e.startsWith(`zh`))return`zh-CN`;let t=e.split(`-`)[0];for(let e of Object.keys(xe))if(e.startsWith(t))return e;return`en-US`}function Ce(e=`zh-CN`,t){let n=xe[e]??ye;return t?{...n,...t}:n}function we(){return Date.now().toString(36)+Math.random().toString(36).slice(2,6)}function Te(e){return Array.isArray(e)?e:[e]}function Ee(e,t,n){if(e.id===t){let t={...e,...n};return`taskStatus`in n&&n.taskStatus===void 0&&delete t.taskStatus,`remark`in n&&n.remark===void 0&&delete t.remark,t}return e.children?{...e,children:e.children.map(e=>Ee(e,t,n))}:e}function De(e,t,n){return e.id===t?{...e,children:[...e.children||[],n]}:e.children?{...e,children:e.children.map(e=>De(e,t,n))}:e}function Oe(e,t){if(!e.children)return e;let n=e.children.filter(e=>e.id!==t).map(e=>Oe(e,t));return{...e,children:n.length>0?n:void 0}}function ke(e,t,n){if(!e.children)return e;let r=e.children.findIndex(e=>e.id===t),i=e.children.findIndex(e=>e.id===n);if(r!==-1&&i!==-1){let t=[...e.children];return[t[r],t[i]]=[t[i],t[r]],{...e,children:t}}return{...e,children:e.children.map(e=>ke(e,t,n))}}function Ae(e,t){if(e.id===t)return structuredClone(e);if(!e.children)return null;for(let n of e.children){let e=Ae(n,t);if(e)return e}return null}function je(e){return{...e,id:we(),children:e.children?.map(e=>je(e))}}function Me(e,t){let n={};for(let e of t)e.parentId&&(n[e.parentId]||(n[e.parentId]=[]),n[e.parentId].push(e.id));let r=[],i=[e];for(;i.length>0;){let e=n[i.pop()];if(e)for(let t of e)r.push(t),i.push(t)}return r}function Ne(e,t,n){return e.map(e=>Ee(e,t,n))}function Pe(e,t,n){return e.map(e=>De(e,t,n))}function Fe(e,t){let n=e.filter(e=>e.id!==t);return n.length<e.length?n:e.map(e=>Oe(e,t))}function J(e,t,n){return e.map(e=>ke(e,t,n))}function Ie(e,t){for(let n of e){let e=Ae(n,t);if(e)return e}return null}function Le(e,t,n,r){let i=[...e.children||[]],a=Math.min(r,i.length);return n===`right`?(i.splice(a,0,t),{data:{...e,children:i},newSplitIndex:a+1}):(i.push(t),{data:{...e,children:i},newSplitIndex:a})}function Re(e,t,n,r){let i=e.children||[],a=i.findIndex(e=>e.id===t);if(a===-1)return null;let o=Math.min(Math.max(r,0),i.length);if(n===`right`&&a<o||n===`left`&&a>=o)return null;let s=[...i],[c]=s.splice(a,1);return n===`left`?(s.push(c),{data:{...e,children:s},newSplitIndex:o-1}):(s.splice(o,0,c),{data:{...e,children:s},newSplitIndex:o+1})}var ze=typeof window<`u`?window.matchMedia(`(prefers-color-scheme: dark)`):null;function Be(e){return ze?.addEventListener(`change`,e),()=>ze?.removeEventListener(`change`,e)}function Ve(){return ze?.matches??!1}function He(e=`auto`){let n=(0,t.useSyncExternalStore)(Be,Ve,()=>!1),r=e===`auto`?n?`dark`:`light`:e;return(0,t.useMemo)(()=>s(r),[r])}function Ue(e,n){let[r,i]=(0,t.useState)({x:0,y:0}),[a,o]=(0,t.useState)(1),s=(0,t.useRef)(0),c=(0,t.useRef)(a),l=(0,t.useRef)(r);c.current=a,l.current=r;let u=(0,t.useMemo)(()=>{if(n.length===0)return{x:0,y:0};let e=1/0,t=-1/0,r=1/0,i=-1/0;for(let a of n)e=Math.min(e,a.x-a.width/2),t=Math.max(t,a.x+a.width/2),r=Math.min(r,a.y-a.height/2),i=Math.max(i,a.y+a.height/2);return{x:(e+t)/2,y:(r+i)/2}},[n]),d=(0,t.useCallback)((e,t,n)=>{cancelAnimationFrame(s.current);let r=c.current,a=l.current.x,u=l.current.y,d=performance.now(),f=c=>{let l=c-d,p=Math.min(l/200,1),m=1-(1-p)**3;o(r+(e-r)*m),i({x:a+(t-a)*m,y:u+(n-u)*m}),p<1&&(s.current=requestAnimationFrame(f))};s.current=requestAnimationFrame(f)},[]),f=(0,t.useCallback)(()=>{let t=e.current;if(!t||n.length===0)return;let r=t.clientWidth,i=t.clientHeight,a=1/0,o=-1/0,s=1/0,c=-1/0;for(let e of n)a=Math.min(a,e.x-e.width/2),o=Math.max(o,e.x+e.width/2),s=Math.min(s,e.y-e.height/2),c=Math.max(c,e.y+e.height/2);let l=o-a,u=c-s,d=Math.min((r-120)/l,(i-120)/u,1.5),f=(a+o)/2,p=(s+c)/2;return{zoom:d,panX:r/2-f*d,panY:i/2-p*d}},[e,n]);return(0,t.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>{e.preventDefault();let n=t.getBoundingClientRect(),r=e.clientX-n.left,a=e.clientY-n.top,s=e.deltaY>0?.9:1.1,u=Math.min(Math.max(c.current*s,.1),5);i({x:r-(r-l.current.x)*(u/c.current),y:a-(a-l.current.y)*(u/c.current)}),o(u)};return t.addEventListener(`wheel`,n,{passive:!1}),()=>t.removeEventListener(`wheel`,n)},[e]),{pan:r,setPan:i,zoom:a,setZoom:o,animateTo:d,autoFit:f,zoomIn:(0,t.useCallback)(()=>{let t=Math.min(c.current*1.2,5),n=e.current,r=n.clientWidth/2,i=n.clientHeight/2;d(t,r-(r-l.current.x)*(t/c.current),i-(i-l.current.y)*(t/c.current))},[e,d]),zoomOut:(0,t.useCallback)(()=>{let t=Math.max(c.current*.8,.1),n=e.current,r=n.clientWidth/2,i=n.clientHeight/2;d(t,r-(r-l.current.x)*(t/c.current),i-(i-l.current.y)*(t/c.current))},[e,d]),contentCenter:u,panToNode:(0,t.useCallback)(t=>{let r=e.current;if(!r)return;let i=n.find(e=>e.id===t);if(!i)return;let a=r.clientWidth,o=r.clientHeight,s=i.x*c.current+l.current.x,u=i.y*c.current+l.current.y;s>100&&s<a-100&&u>100&&u<o-100||d(c.current,a/2-i.x*c.current,o/2-i.y*c.current)},[e,n,d])}}function We({svgRef:e,zoom:n,pan:r,setPan:i,setZoom:a,nodeMap:o,nodes:s,updateData:c,direction:l,splitIndices:u,setSplitIndices:d,mapData:f,contentCenter:p}){let[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(null),[v,y]=(0,t.useState)(null),b=(0,t.useRef)({x:0,y:0,panX:0,panY:0}),x=(0,t.useRef)({x:0,y:0}),S=(0,t.useRef)(!1),C=(0,t.useRef)(0),w=(0,t.useRef)({type:`none`,startPan:{x:0,y:0},startZoom:1,startTouches:[],pinchDistance:0,contentCenter:{x:0,y:0},touchNodeId:null}),T=(0,t.useMemo)(()=>{if(!g)return new Set;let e=new Set([g]);for(let t of Me(g,s))e.add(t);return e},[g,s]),E=(0,t.useCallback)((t,i)=>{let a=e.current.getBoundingClientRect();return{x:(t-a.left-r.x)/n,y:(i-a.top-r.y)/n}},[e,r,n]),D=(0,t.useCallback)((e,t,n)=>{let r=E(e,t),i={x:r.x+x.current.x,y:r.y+x.current.y};y(i);let a=Date.now();if(a-C.current>500){let e=o[n];if(e&&e.parentId){if(e.depth===1&&l===`both`){let t=e.side,r=t===`right`&&i.x<0,o=t===`left`&&i.x>0;if(r||o){let t=r?`left`:`right`,i=e.parentId,o=f.find(e=>e.id===i);if(o){let e=Re(o,n,t,u[i]??Math.ceil((o.children?.length??0)/2));if(e){C.current=a,d(t=>({...t,[i]:e.newSplitIndex})),c(t=>t.map(t=>t.id===i?e.data:t));return}}}}let t=s.filter(t=>t.parentId===e.parentId&&t.id!==n&&t.side===e.side);for(let r of t){let t=Math.max(e.height,r.height)*.6;if(Math.abs(i.y-r.y)<t){C.current=a,c(e=>J(e,n,r.id));break}}}}},[E,o,s,c,l,u,d,f]),O=(0,t.useCallback)(e=>{e.button===0&&(S.current=!1,h(!0),b.current={x:e.clientX,y:e.clientY,panX:r.x,panY:r.y})},[r]),ee=(0,t.useCallback)(e=>{m?(S.current=!0,i({x:b.current.panX+(e.clientX-b.current.x),y:b.current.panY+(e.clientY-b.current.y)})):g&&(S.current=!0,D(e.clientX,e.clientY,g))},[m,g,i,D]),k=(0,t.useCallback)(()=>{h(!1),_(null),y(null)},[]),te=(0,t.useCallback)((e,t)=>{if(e.stopPropagation(),e.button!==0)return;S.current=!1;let n=o[t];if(!n)return;_(t),y({x:n.x,y:n.y});let r=E(e.clientX,e.clientY);x.current={x:n.x-r.x,y:n.y-r.y}},[o,E]),A=(0,t.useRef)(r),j=(0,t.useRef)(n),M=(0,t.useRef)(o),N=(0,t.useRef)(p),P=(0,t.useRef)(g);(0,t.useEffect)(()=>{A.current=r,j.current=n,M.current=o,N.current=p,P.current=g});let F=(0,t.useCallback)(t=>{let n=t;for(;n&&n!==e.current;){if(n.classList?.contains(`mindmap-node-g`)){let e=n.getAttribute(`transform`);if(e)for(let t of s){let n=t.x,r=t.y;if(e.includes(`translate(${n}`)&&e.includes(`${r})`))return t.id}}n=n.parentElement}return null},[e,s]);return(0,t.useEffect)(()=>{let t=e.current;if(!t)return;let n=t;function r(e,t){return Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY)}function o(e){e.preventDefault();let t=e.touches;if(t.length===2){let e=r(t[0],t[1]);w.current={type:`pinch`,startPan:{...A.current},startZoom:j.current,startTouches:[{id:t[0].identifier,x:t[0].clientX,y:t[0].clientY},{id:t[1].identifier,x:t[1].clientX,y:t[1].clientY}],pinchDistance:e,contentCenter:{...N.current},touchNodeId:null},P.current&&(_(null),y(null)),h(!1);return}if(t.length===1){let r=t[0],i=F(e.target);if(i){let t=e.target;for(;t&&t!==n;){if(t.classList?.contains(`mindmap-add-btn`))return;t=t.parentElement}S.current=!1;let a=M.current[i];if(a){_(i),y({x:a.x,y:a.y});let e=n.getBoundingClientRect(),t=(r.clientX-e.left-A.current.x)/j.current,o=(r.clientY-e.top-A.current.y)/j.current;x.current={x:a.x-t,y:a.y-o},w.current={type:`node-drag`,startPan:{...A.current},startZoom:j.current,startTouches:[{id:r.identifier,x:r.clientX,y:r.clientY}],pinchDistance:0,contentCenter:{...N.current},touchNodeId:i}}}else S.current=!1,h(!0),b.current={x:r.clientX,y:r.clientY,panX:A.current.x,panY:A.current.y},w.current={type:`canvas-pan`,startPan:{...A.current},startZoom:j.current,startTouches:[{id:r.identifier,x:r.clientX,y:r.clientY}],pinchDistance:0,contentCenter:{...N.current},touchNodeId:null}}}function p(e){e.preventDefault();let t=w.current,o=e.touches;if(t.type===`pinch`&&o.length>=2){let e=r(o[0],o[1])/t.pinchDistance,s=Math.min(Math.max(t.startZoom*e,.1),5),c=n.clientWidth/2,l=n.clientHeight/2,u=t.contentCenter;a(s),i({x:c-u.x*s,y:l-u.y*s});return}if(t.type===`canvas-pan`&&o.length===1){S.current=!0;let e=o[0];i({x:b.current.panX+(e.clientX-b.current.x),y:b.current.panY+(e.clientY-b.current.y)});return}if(t.type===`node-drag`&&o.length===1&&t.touchNodeId){S.current=!0;let e=o[0],r=n.getBoundingClientRect(),i=(e.clientX-r.left-A.current.x)/j.current,a=(e.clientY-r.top-A.current.y)/j.current,p={x:i+x.current.x,y:a+x.current.y};y(p);let m=Date.now();if(m-C.current>500){let e=M.current[t.touchNodeId];if(e&&e.parentId){if(e.depth===1&&l===`both`){let n=e.side,r=n===`right`&&p.x<0,i=n===`left`&&p.x>0;if(r||i){let n=r?`left`:`right`,i=e.parentId,a=f.find(e=>e.id===i);if(a){let e=u[i]??Math.ceil((a.children?.length??0)/2),r=Re(a,t.touchNodeId,n,e);if(r){C.current=m,d(e=>({...e,[i]:r.newSplitIndex})),c(e=>e.map(e=>e.id===i?r.data:e));return}}}}let n=s.filter(n=>n.parentId===e.parentId&&n.id!==t.touchNodeId&&n.side===e.side);for(let r of n){let n=Math.max(e.height,r.height)*.6;if(Math.abs(p.y-r.y)<n){C.current=m,c(e=>J(e,t.touchNodeId,r.id));break}}}}return}}function m(e){e.preventDefault();let t=w.current,n=e.touches;if(t.type===`pinch`&&n.length===1){let e=n[0];b.current={x:e.clientX,y:e.clientY,panX:A.current.x,panY:A.current.y},h(!0),w.current={...t,type:`canvas-pan`,startTouches:[{id:e.identifier,x:e.clientX,y:e.clientY}]};return}n.length===0&&(h(!1),_(null),y(null),w.current={type:`none`,startPan:{x:0,y:0},startZoom:1,startTouches:[],pinchDistance:0,contentCenter:{x:0,y:0},touchNodeId:null})}return n.addEventListener(`touchstart`,o,{passive:!1}),n.addEventListener(`touchmove`,p,{passive:!1}),n.addEventListener(`touchend`,m,{passive:!1}),n.addEventListener(`touchcancel`,m,{passive:!1}),()=>{n.removeEventListener(`touchstart`,o),n.removeEventListener(`touchmove`,p),n.removeEventListener(`touchend`,m),n.removeEventListener(`touchcancel`,m)}},[e,i,a,F,l,f,u,d,c,s]),{draggingCanvas:m,floatingNodeId:g,floatingPos:v,floatingSubtreeIds:T,didDragRef:S,handleCanvasMouseDown:O,handleMouseMove:ee,handleMouseUp:k,handleNodeMouseDown:te}}function Ge(e){let t=e.match(/^\[([ x\-])\]\s+(.*)/);if(!t)return{text:e};let n=t[1],r=t[2];return n===` `?{taskStatus:`todo`,text:r}:n===`x`?{taskStatus:`done`,text:r}:n===`-`?{taskStatus:`doing`,text:r}:{text:e}}function Ke({nodeMap:e,updateData:n,onTextChange:r}){let[i,a]=(0,t.useState)(null),[o,s]=(0,t.useState)(``),[c,l]=(0,t.useState)(null);return(0,t.useEffect)(()=>{c&&e[c]&&(a(c),s(``),l(null))},[c,e]),{editingId:i,editText:o,setEditText:s,pendingEditId:c,setPendingEditId:l,handleNodeDoubleClick:(0,t.useCallback)((e,t,n)=>{e.stopPropagation(),a(t),s(n)},[]),commitEdit:(0,t.useCallback)(()=>{if(i){let t=o.trim();if(t){let a=e[i]?.text??``,{taskStatus:o,text:s}=Ge(t);n(e=>Ne(e,i,{text:s,taskStatus:o})),s!==a&&r?.(i,a,s)}}a(null)},[i,o,n,e,r]),cancelEdit:(0,t.useCallback)(()=>{a(null)},[])}}function qe(e){let[n,r]=(0,t.useState)(new Set),i=(0,t.useRef)(new Set);return(0,t.useEffect)(()=>{let t=new Set(e.map(e=>e.id));if(i.current.size>0){let e=new Set;for(let n of t)i.current.has(n)||e.add(n);if(e.size>0){r(e);let n=setTimeout(()=>r(new Set),350);return i.current=t,()=>clearTimeout(n)}}i.current=t},[e]),n}var Je=`'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace`,Ye=null,Y=!1,X=null,Z=[];function Xe(){return X||(X=import(`katex`).then(e=>{Ye=e.default||e,Y=!0,$e();for(let e of Z)e();Z=[]}).catch(()=>{Y=!0}),X)}function Ze(){return Ye}function Qe(e){Y?e():Z.push(e)}Xe();function $e(){if(!(typeof document>`u`)&&!document.getElementById(`katex-style`)){let e=document.createElement(`link`);e.id=`katex-style`,e.rel=`stylesheet`,e.href=`https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css`,document.head.appendChild(e)}}function et(e,t){let n=Ze();if(!n)return null;try{return n.renderToString(e,{throwOnError:!1,displayMode:t})}catch{return null}}function tt(e,t){let n=Ze();if(!n)return null;try{return n.renderToString(e,{throwOnError:!1,displayMode:t,output:`mathml`})}catch{return null}}var nt={name:`latex`,inlineTokenPattern(){return{pattern:`\\$\\$(.+?)\\$\\$|\\$([^$]+?)\\$`,priority:3}},createInlineToken(e,t){let n=e[t+1],r=e[t+2];return n===void 0?r===void 0?null:{type:`latex-inline`,content:r}:{type:`latex-block`,content:n}},renderInlineToken(e,t){let{token:r}=e;return r.type!==`latex-inline`&&r.type!==`latex-block`?null:Ze()?(0,n.jsx)(`tspan`,{opacity:0,children:r.content},t):(0,n.jsx)(`tspan`,{fontFamily:Je,fontStyle:`italic`,fontSize:`0.9em`,children:r.content},t)},exportInlineToken(e,t){let{token:n}=e;if(n.type!==`latex-inline`&&n.type!==`latex-block`)return``;let r=n.content.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`);return t?`<tspan font-family="${Je}" font-style="italic" font-size="0.9em">${r}</tspan>`:Ze()?`<tspan opacity="0">${r}</tspan>`:`<tspan font-family="${Je}" font-style="italic" font-size="0.9em">${r}</tspan>`},exportNodeDecoration(e,t,n,r){if(r||!Ze())return``;let i=[],a=(t,r,a,o,s,c)=>{let l=_(u(t,n),r,a,o),d=l.length>0?l[l.length-1].x+l[l.length-1].width:0,f=r*.85,p=e.taskStatus?4:0,m=e.taskStatus?f+p:0,h=r*.7,g=e.remark?4:0,v=e.remark?h+g:0,y=-(m+d+v)/2+m;for(let e of l){let{token:t}=e;if(t.type!==`latex-inline`&&t.type!==`latex-block`)continue;let n=tt(t.content,t.type===`latex-block`);if(!n)continue;let a=n.match(/<math[\s\S]*<\/math>/);if(!a)continue;let o=y+e.x+e.width/2,l=Math.max(e.width*2.5,120),u=r*2;i.push(`<foreignObject x="${o-l/2}" y="${c-u/2}" width="${l}" height="${u}" style="overflow:visible"><div xmlns="http://www.w3.org/1999/xhtml" style="font-size:${r*.75}px;line-height:${u}px;color:${s};white-space:nowrap;text-align:center">`+a[0]+`</div></foreignObject>`)}},o=(e,t,r,a,o,s)=>{let c=_(u(e,n),t,r,a),l=-(c.length>0?c[c.length-1].x+c[c.length-1].width:0)/2;for(let e of c){let{token:n}=e;if(n.type!==`latex-inline`&&n.type!==`latex-block`)continue;let r=tt(n.content,n.type===`latex-block`);if(!r)continue;let a=r.match(/<math[\s\S]*<\/math>/);if(!a)continue;let c=l+e.x+e.width/2,u=Math.max(e.width*2.5,120),d=t*2;i.push(`<foreignObject x="${c-u/2}" y="${s-d/2}" width="${u}" height="${d}" style="overflow:visible"><div xmlns="http://www.w3.org/1999/xhtml" style="font-size:${t*.75}px;line-height:${d}px;color:${o};white-space:nowrap;text-align:center;opacity:0.8">`+a[0]+`</div></foreignObject>`)}},s=e.depth===0?t.root.fontSize:e.depth===1?t.level1.fontSize:t.node.fontSize,c=e.depth===0?t.root.fontWeight:e.depth===1?t.level1.fontWeight:t.node.fontWeight,l=e.depth===0?t.root.fontFamily:t.node.fontFamily,d=e.depth===0?t.root.textColor:t.node.textColor;if(a(e.text,s,c,l,d,0),e.multiLineContent&&e.multiLineContent.length>0){let t=s*.85,n=s*1.4,r=s/2+8;for(let i=0;i<e.multiLineContent.length;i++){let a=r+i*n;o(e.multiLineContent[i],t,400,l,d,a)}}return i.join(``)},adjustNodeSize(e,t,n){return{width:t,height:n}}},rt=`'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace`;function it(e,t,r,i){let{token:a}=e;if(a.type!==`text`&&a.type!==`bold`&&a.type!==`italic`&&a.type!==`strikethrough`&&a.type!==`code`&&a.type!==`highlight`&&a.type!==`link`&&a.type!==`image`&&r&&r.length>0){let n=I(r,e,t);if(n)return n}switch(a.type){case`bold`:return(0,n.jsx)(`tspan`,{className:`mindmap-text-bold`,fontWeight:700,children:a.content},t);case`italic`:return(0,n.jsx)(`tspan`,{className:`mindmap-text-italic`,fontStyle:`italic`,children:a.content},t);case`strikethrough`:return(0,n.jsx)(`tspan`,{className:`mindmap-text-strikethrough`,textDecoration:`line-through`,opacity:.6,children:a.content},t);case`code`:return(0,n.jsx)(`tspan`,{className:`mindmap-text-code`,fontFamily:rt,fontSize:`0.88em`,children:a.content},t);case`highlight`:return(0,n.jsx)(`tspan`,{className:`mindmap-text-highlight`,fill:i||`#FFEB3B`,children:a.content},t);case`link`:return(0,n.jsx)(`a`,{className:`mindmap-text-link`,href:a.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:(0,n.jsx)(`tspan`,{fill:`#2563EB`,textDecoration:`underline`,children:a.text})},t);case`image`:return(0,n.jsxs)(`tspan`,{className:`mindmap-text-image`,fontStyle:`italic`,children:[`[`,a.alt||`image`,`]`]},t);case`latex-inline`:case`latex-block`:return(0,n.jsx)(`tspan`,{className:`mindmap-text-latex`,fontFamily:rt,fontStyle:`italic`,fontSize:`0.9em`,children:a.content},t);default:return(0,n.jsx)(`tspan`,{className:`mindmap-text-plain`,children:a.content},t)}}function at({status:e,size:t}){return e===`done`?(0,n.jsxs)(`g`,{children:[(0,n.jsx)(`rect`,{x:0,y:0,width:t,height:t,rx:t*.2,fill:`#22C55E`}),(0,n.jsx)(`path`,{d:`M${t*.28} ${t*.5}L${t*.44} ${t*.66}L${t*.72} ${t*.34}`,stroke:`white`,strokeWidth:t*.13,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]}):e===`doing`?(0,n.jsxs)(`g`,{children:[(0,n.jsx)(`rect`,{x:0,y:0,width:t,height:t,rx:t*.2,fill:`none`,stroke:`#FBBF24`,strokeWidth:t*.1}),(0,n.jsx)(`rect`,{x:t*.25,y:t*.25,width:t*.5,height:t*.5,rx:t*.1,fill:`#FBBF24`,opacity:.6})]}):(0,n.jsx)(`rect`,{x:0,y:0,width:t,height:t,rx:t*.2,fill:`none`,stroke:`#999`,strokeWidth:t*.1,opacity:.4})}function Q({node:e,fontSize:r,fontWeight:i,fontFamily:a,textColor:o,onRemarkHover:s,plugins:c,highlightTextColor:l,highlightBgColor:d}){let[f,p]=(0,t.useState)(()=>!!Ze());(0,t.useEffect)(()=>{f||Qe(()=>p(!0))},[f]);let{layouts:m,textContentWidth:h,taskIconWidth:g,totalWidth:v}=(0,t.useMemo)(()=>{let t=_(u(e.text,c),r,i,a),n=t.length>0?t[t.length-1].x+t[t.length-1].width:0,o=r*.85,s=e.taskStatus?4:0,l=e.taskStatus?o+s:0,d=r*.7,f=e.remark?4:0,p=e.remark?d+f:0;return{layouts:t,textContentWidth:n,taskIconWidth:l,totalWidth:l+n+p}},[e.text,e.taskStatus,e.remark,r,i,a,c]),y=-v/2,b=y+g,x=r*.85,S=-r/2-2,C=r+4,w=r*.7,T=e.multiLineContent,E=r*1.4,D=r/2+8;return(0,n.jsxs)(`g`,{className:`mindmap-node-content`,children:[e.taskStatus&&(0,n.jsx)(`g`,{className:`mindmap-task-icon mindmap-task-${e.taskStatus}`,transform:`translate(${y}, ${-x/2})`,children:(0,n.jsx)(at,{status:e.taskStatus,size:x})}),m.map((e,t)=>e.token.type===`code`?(0,n.jsx)(`rect`,{className:`mindmap-code-bg`,x:b+e.x-2,y:S,width:e.width+4,height:C,rx:3,fill:`rgba(128,128,128,0.12)`},`bg-${t}`):e.token.type===`highlight`?(0,n.jsx)(`rect`,{className:`mindmap-highlight-bg`,x:b+e.x-1,y:S,width:e.width+2,height:C,rx:2,fill:d||`rgba(255,213,79,0.3)`},`bg-${t}`):null),(0,n.jsx)(`text`,{className:`mindmap-node-text`,textAnchor:`start`,dominantBaseline:`central`,x:b,fill:o,fontSize:r,fontWeight:i,fontFamily:a,children:m.map((e,t)=>it(e,t,c,l))}),f&&m.map((e,t)=>{let{token:i}=e;if(i.type!==`latex-inline`&&i.type!==`latex-block`)return null;let a=et(i.content,i.type===`latex-block`);if(!a)return null;$e();let s=b+e.x+e.width/2,c=Math.max(e.width*2.5,120),l=r*2;return(0,n.jsx)(`foreignObject`,{className:`mindmap-latex`,x:s-c/2,y:-l/2,width:c,height:l,style:{overflow:`visible`,pointerEvents:`none`},children:(0,n.jsx)(`div`,{style:{fontSize:r*.75,lineHeight:`${l}px`,color:o,whiteSpace:`nowrap`,textAlign:`center`},dangerouslySetInnerHTML:{__html:a}})},`latex-fo-${t}`)}),T&&T.length>0&&T.map((e,t)=>{let i=r*.85,s=_(u(e,c),i,400,a),p=-(s.length>0?s[s.length-1].x+s[s.length-1].width:0)/2,m=D+t*E,h=m-i/2-2,g=i+4;return(0,n.jsxs)(`g`,{className:`mindmap-multiline`,children:[s.map((e,t)=>e.token.type===`code`?(0,n.jsx)(`rect`,{className:`mindmap-code-bg`,x:p+e.x-2,y:h,width:e.width+4,height:g,rx:3,fill:`rgba(128,128,128,0.12)`},`ml-bg-${t}`):e.token.type===`highlight`?(0,n.jsx)(`rect`,{className:`mindmap-highlight-bg`,x:p+e.x-1,y:h,width:e.width+2,height:g,rx:2,fill:d||`rgba(255,213,79,0.3)`},`ml-bg-${t}`):null),(0,n.jsx)(`text`,{className:`mindmap-multiline-text`,x:p,y:m,textAnchor:`start`,dominantBaseline:`central`,fill:o,fontSize:i,fontWeight:400,fontFamily:a,opacity:.8,children:s.map((e,t)=>it(e,t,c,l))}),f&&s.map((e,r)=>{let{token:a}=e;if(a.type!==`latex-inline`&&a.type!==`latex-block`)return null;let s=et(a.content,a.type===`latex-block`);if(!s)return null;$e();let c=p+e.x+e.width/2,l=Math.max(e.width*2.5,120),u=i*2;return(0,n.jsx)(`foreignObject`,{className:`mindmap-latex`,x:c-l/2,y:m-u/2,width:l,height:u,style:{overflow:`visible`,pointerEvents:`none`},children:(0,n.jsx)(`div`,{style:{fontSize:i*.75,lineHeight:`${u}px`,color:o,whiteSpace:`nowrap`,textAlign:`center`,opacity:.8},dangerouslySetInnerHTML:{__html:s}})},`ml-latex-fo-${t}-${r}`)})]},`ml-${t}`)}),e.tags&&e.tags.length>0&&(()=>{let t=r*.65,i=r/2+6+(T?T.length*E:0),o=-v/2;return e.tags.map((e,r)=>{let s=e.length*t*.65+10,c=o;o+=s+4;let l=[`#3B82F6`,`#8B5CF6`,`#EC4899`,`#F59E0B`,`#10B981`,`#6366F1`],u=l[r%l.length];return(0,n.jsxs)(`g`,{className:`mindmap-tag`,children:[(0,n.jsx)(`rect`,{className:`mindmap-tag-bg`,x:c,y:i,width:s,height:t+6,rx:3,fill:u,opacity:.15}),(0,n.jsx)(`text`,{className:`mindmap-tag-text`,x:c+s/2,y:i+(t+6)/2,textAnchor:`middle`,dominantBaseline:`central`,fontSize:t,fill:u,fontFamily:a,children:e})]},`tag-${r}`)})})(),e.remark&&(0,n.jsxs)(`text`,{className:`mindmap-remark-indicator`,x:b+h+4,textAnchor:`start`,dominantBaseline:`central`,fontSize:w,opacity:.5,style:{cursor:`help`},onMouseEnter:()=>s?.(e.id),onMouseLeave:()=>s?.(null),children:[(0,n.jsx)(`title`,{children:e.remark}),`💬`]})]})}function ot({node:e,offset:t,isEditing:r,isPendingEdit:i,isSelected:a,isNew:o,isGhost:s,animClass:c,editText:l,theme:u,direction:d,readonly:f,plugins:p,onMouseDown:m,onClick:h,onDoubleClick:g,onEditChange:_,onEditCommit:v,onEditCancel:y,onAddChild:b,onRemarkHover:x,onFoldToggle:S,expandDelay:C}){let w=e.x+(t?.x??0),T=e.y+(t?.y??0),E=r||i,D=i&&!r?``:l,O=o?`mindmap-node-new`:``,ee=C===void 0?``:`mindmap-node-expanding`,k=C===void 0?void 0:{animationDelay:`${C}ms`},te=(e.taskStatus===`done`?`[x] `:e.taskStatus===`doing`?`[-] `:e.taskStatus===`todo`?`[ ] `:``)+e.text,A=p&&p.length>0?F(p,e,u):null;if(e.depth===0){let t=u.root.bgColor;return(0,n.jsxs)(`g`,{transform:`translate(${w}, ${T})`,className:`mindmap-node-g mindmap-node-root ${c} ${O} ${ee}`,onMouseDown:t=>m(t,e.id),onClick:t=>h(t,e.id),onDoubleClick:t=>g(t,e.id,te),style:{cursor:`pointer`,opacity:s?.3:1,...k},children:[(0,n.jsx)(`rect`,{className:`mindmap-node-bg`,x:-e.width/2,y:-e.height/2,width:e.width,height:e.height,rx:e.height/2,ry:e.height/2,fill:t,stroke:a?u.selection.strokeColor:`none`,strokeWidth:a?2.5:0}),E?(0,n.jsx)(`foreignObject`,{x:-e.width/2,y:-e.height/2,width:e.width,height:e.height,children:(0,n.jsx)(`input`,{className:`mindmap-edit-input mindmap-edit-root`,value:D,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v()},onBlur:v,autoFocus:!0,style:{fontSize:u.root.fontSize,fontWeight:u.root.fontWeight,fontFamily:u.root.fontFamily}})}):(0,n.jsx)(Q,{node:e,fontSize:u.root.fontSize,fontWeight:u.root.fontWeight,fontFamily:u.root.fontFamily,textColor:u.root.textColor,onRemarkHover:x,plugins:p,highlightTextColor:u.highlight.textColor,highlightBgColor:u.highlight.bgColor}),A,!f&&!s&&(d===`right`||d===`both`)&&(0,n.jsxs)(`g`,{className:`mindmap-add-btn`,onMouseDown:e=>e.stopPropagation(),onClick:t=>b(t,e.id,`right`),children:[(0,n.jsx)(`circle`,{cx:e.width/2+18,cy:0,r:11,fill:u.addBtn.fill}),(0,n.jsx)(`line`,{x1:e.width/2+14,y1:0,x2:e.width/2+22,y2:0,stroke:u.addBtn.iconColor,strokeWidth:2,strokeLinecap:`round`}),(0,n.jsx)(`line`,{x1:e.width/2+18,y1:-4,x2:e.width/2+18,y2:4,stroke:u.addBtn.iconColor,strokeWidth:2,strokeLinecap:`round`})]}),!f&&!s&&(d===`left`||d===`both`)&&(0,n.jsxs)(`g`,{className:`mindmap-add-btn`,onMouseDown:e=>e.stopPropagation(),onClick:t=>b(t,e.id,`left`),children:[(0,n.jsx)(`circle`,{cx:-(e.width/2+18),cy:0,r:11,fill:u.addBtn.fill}),(0,n.jsx)(`line`,{x1:-(e.width/2+22),y1:0,x2:-(e.width/2+14),y2:0,stroke:u.addBtn.iconColor,strokeWidth:2,strokeLinecap:`round`}),(0,n.jsx)(`line`,{x1:-(e.width/2+18),y1:-4,x2:-(e.width/2+18),y2:4,stroke:u.addBtn.iconColor,strokeWidth:2,strokeLinecap:`round`})]}),e.collapsed!==void 0&&f&&S&&(0,n.jsx)(`g`,{className:`mindmap-fold-btn`,style:{cursor:`pointer`},onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),S(e.id)},children:(0,n.jsx)(`circle`,{cx:e.width/2+14,cy:0,r:6,fill:e.color})})]},e.id)}let j=e.depth===1?u.level1.fontSize:u.node.fontSize,M=e.depth===1?u.level1.fontWeight:u.node.fontWeight,N=e.width-u.node.paddingH*2,P=j/2+4,I=e.side===`left`?-e.width/2-18:e.width/2+18;return(0,n.jsxs)(`g`,{transform:`translate(${w}, ${T})`,className:`mindmap-node-g mindmap-node-child ${c} ${O}`,onMouseDown:t=>m(t,e.id),onClick:t=>h(t,e.id),onDoubleClick:t=>g(t,e.id,te),style:{cursor:`pointer`,opacity:s?.3:1},children:[(0,n.jsx)(`rect`,{className:`mindmap-node-bg`,x:-e.width/2,y:-e.height/2,width:e.width,height:e.height,fill:a?u.selection.fillColor:`transparent`,stroke:a?u.selection.strokeColor:`none`,strokeWidth:a?1.5:0,rx:4}),E?(0,n.jsx)(`foreignObject`,{x:-Math.max(e.width,80)/2,y:-e.height/2,width:Math.max(e.width,80),height:e.height,children:(0,n.jsx)(`input`,{className:`mindmap-edit-input mindmap-edit-child`,value:D,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v(),e.key===`Escape`&&y()},onBlur:v,autoFocus:!0,style:{fontSize:j,fontWeight:M,fontFamily:u.node.fontFamily,color:u.node.textColor,textAlign:`center`,borderBottom:`2.5px solid ${e.color}`}})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{node:e,fontSize:j,fontWeight:M,fontFamily:u.node.fontFamily,textColor:u.node.textColor,onRemarkHover:x,plugins:p,highlightTextColor:u.highlight.textColor,highlightBgColor:u.highlight.bgColor}),(0,n.jsx)(`line`,{className:`mindmap-node-underline`,x1:-N/2,y1:P,x2:N/2,y2:P,stroke:e.color,strokeWidth:2.5,strokeLinecap:`round`})]}),A,!f&&!s&&(0,n.jsxs)(`g`,{className:`mindmap-add-btn`,onMouseDown:e=>e.stopPropagation(),onClick:t=>b(t,e.id),children:[(0,n.jsx)(`circle`,{cx:I,cy:0,r:11,fill:u.addBtn.fill}),(0,n.jsx)(`line`,{x1:I-4,y1:0,x2:I+4,y2:0,stroke:u.addBtn.iconColor,strokeWidth:2,strokeLinecap:`round`}),(0,n.jsx)(`line`,{x1:I,y1:-4,x2:I,y2:4,stroke:u.addBtn.iconColor,strokeWidth:2,strokeLinecap:`round`})]}),e.collapsed!==void 0&&f&&S&&(0,n.jsx)(`g`,{className:`mindmap-fold-btn`,style:{cursor:`pointer`},onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),S(e.id)},children:(0,n.jsx)(`circle`,{cx:I,cy:0,r:6,fill:e.color})})]},e.id)}function st({size:e=24,className:t}){return(0,n.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,className:t,children:[(0,n.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,n.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]})}function ct({size:e=24,className:t}){return(0,n.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,className:t,children:(0,n.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})})}function lt({zoom:e,theme:t,messages:r,showZoom:i=!0,mode:a,isFullscreen:o,onZoomIn:s,onZoomOut:c,onAutoFit:l,onModeToggle:u,onFullscreenToggle:d}){return(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsxs)(`div`,{className:`mindmap-zoom-controls`,style:{background:t.controls.bgColor,color:t.controls.textColor},children:[(0,n.jsx)(`button`,{className:`mindmap-ctrl-btn mindmap-ctrl-zoom-out`,onClick:c,title:r.zoomOut,style:{color:t.controls.textColor},children:(0,n.jsx)(ct,{size:16})}),(0,n.jsxs)(`button`,{className:`mindmap-ctrl-pct`,onClick:l,title:r.resetView,style:{color:t.controls.textColor},children:[Math.round(e*100),`%`]}),(0,n.jsx)(`button`,{className:`mindmap-ctrl-btn mindmap-ctrl-zoom-in`,onClick:s,title:r.zoomIn,style:{color:t.controls.textColor},children:(0,n.jsx)(st,{size:16})})]}),(0,n.jsxs)(`div`,{className:`mindmap-extra-controls`,style:{background:t.controls.bgColor,color:t.controls.textColor},children:[(0,n.jsx)(`button`,{className:`mindmap-ctrl-btn mindmap-ctrl-mode`,onClick:u,title:a===`view`?r.textMode:r.viewMode,style:{color:t.controls.textColor},children:a===`view`?(0,n.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M6 5h12`}),(0,n.jsx)(`path`,{d:`M4 12h10`}),(0,n.jsx)(`path`,{d:`M12 19h8`})]}):(0,n.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}),(0,n.jsx)(`button`,{className:`mindmap-ctrl-btn mindmap-ctrl-fullscreen`,onClick:d,title:o?r.exitFullscreen:r.fullscreen,style:{color:t.controls.textColor},children:o?(0,n.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`}),(0,n.jsx)(`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`}),(0,n.jsx)(`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`}),(0,n.jsx)(`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`})]}):(0,n.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`}),(0,n.jsx)(`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`}),(0,n.jsx)(`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`}),(0,n.jsx)(`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`})]})})]})]})}function ut({position:e,theme:r,messages:i,readonly:a,onNewRootNode:o,onExportSVG:s,onExportPNG:c,onExportMarkdown:l,onDirectionChange:u,onClose:d}){let[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1);return(0,n.jsxs)(`div`,{className:`mindmap-context-menu`,style:{left:e.x,top:e.y,background:r.contextMenu.bgColor,color:r.contextMenu.textColor,boxShadow:`0 4px 16px ${r.contextMenu.shadowColor}`,borderColor:r.contextMenu.borderColor},onClick:e=>e.stopPropagation(),children:[!a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`mindmap-ctx-item mindmap-ctx-new-root`,onClick:o,style:{color:r.contextMenu.textColor},children:i.newRootNode}),(0,n.jsx)(`div`,{className:`mindmap-ctx-divider`,style:{borderColor:r.contextMenu.borderColor}})]}),(0,n.jsxs)(`div`,{className:`mindmap-ctx-item mindmap-ctx-has-sub mindmap-ctx-layout`,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{color:r.contextMenu.textColor},children:[i.layout,(0,n.jsx)(`span`,{className:`mindmap-ctx-arrow`,children:`▶`}),m&&(0,n.jsxs)(`div`,{className:`mindmap-ctx-submenu`,style:{background:r.contextMenu.bgColor,boxShadow:`0 4px 16px ${r.contextMenu.shadowColor}`,borderColor:r.contextMenu.borderColor},children:[(0,n.jsx)(`div`,{className:`mindmap-ctx-item mindmap-ctx-layout-left`,onClick:()=>{u(`left`),d()},style:{color:r.contextMenu.textColor},children:i.layoutLeft}),(0,n.jsx)(`div`,{className:`mindmap-ctx-item mindmap-ctx-layout-both`,onClick:()=>{u(`both`),d()},style:{color:r.contextMenu.textColor},children:i.layoutBoth}),(0,n.jsx)(`div`,{className:`mindmap-ctx-item mindmap-ctx-layout-right`,onClick:()=>{u(`right`),d()},style:{color:r.contextMenu.textColor},children:i.layoutRight})]})]}),(0,n.jsx)(`div`,{className:`mindmap-ctx-divider`,style:{borderColor:r.contextMenu.borderColor}}),(0,n.jsxs)(`div`,{className:`mindmap-ctx-item mindmap-ctx-has-sub mindmap-ctx-export`,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{color:r.contextMenu.textColor},children:[i.export,(0,n.jsx)(`span`,{className:`mindmap-ctx-arrow`,children:`▶`}),f&&(0,n.jsxs)(`div`,{className:`mindmap-ctx-submenu`,style:{background:r.contextMenu.bgColor,boxShadow:`0 4px 16px ${r.contextMenu.shadowColor}`,borderColor:r.contextMenu.borderColor},children:[(0,n.jsx)(`div`,{className:`mindmap-ctx-item mindmap-ctx-export-svg`,onClick:s,style:{color:r.contextMenu.textColor},children:i.exportSVG}),(0,n.jsx)(`div`,{className:`mindmap-ctx-item mindmap-ctx-export-png`,onClick:c,style:{color:r.contextMenu.textColor},children:i.exportPNG}),(0,n.jsx)(`div`,{className:`mindmap-ctx-item mindmap-ctx-export-md`,onClick:l,style:{color:r.contextMenu.textColor},children:i.exportMarkdown})]})]})]})}function dt(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}var ft=(0,t.forwardRef)(function({data:e,markdown:r,defaultDirection:i=`both`,theme:a=`auto`,locale:o,messages:s,readonly:c=!1,toolbar:l=!0,onDataChange:u,onEvent:d,plugins:f},p){let m=(0,t.useRef)(null),h=(0,t.useRef)(null),g=f&&f.length>0?f:void 0,_=(0,t.useMemo)(()=>{if(e||r===void 0)return null;if(g){let e=ve(r,g),t=e.frontMatter.direction,n=e.frontMatter.theme;return{roots:e.roots,direction:t===`left`||t===`right`||t===`both`?t:void 0,theme:n===`light`||n===`dark`||n===`auto`?n:void 0}}return{roots:ge(r),direction:void 0,theme:void 0}},[]),[v,y]=(0,t.useState)(()=>e?Te(e):_?_.roots:[{id:`md-0`,text:`Root`}]),[b,x]=(0,t.useState)(()=>_?.direction??i),[S,C]=(0,t.useState)({}),[w,T]=(0,t.useState)(null),[E,D]=(0,t.useState)(null),[O,ee]=(0,t.useState)({}),k=(0,t.useRef)(null),[te,A]=(0,t.useState)(`view`),[j,M]=(0,t.useState)(!1),[N,P]=(0,t.useState)(``),[F,I]=(0,t.useState)(null),[re,ie]=(0,t.useState)({}),[ae,oe]=(0,t.useState)(null),[se,ce]=(0,t.useState)(()=>_?.theme);(0,t.useEffect)(()=>{e&&y(Te(e))},[e]),(0,t.useEffect)(()=>{if(r!==void 0)if(g){let{roots:e,frontMatter:t}=ve(r,g);if(y(e),t.direction){let e=t.direction;(e===`left`||e===`right`||e===`both`)&&x(e)}if(t.theme){let e=t.theme;(e===`light`||e===`dark`||e===`auto`)&&ce(e)}}else y(ge(r))},[r,g]);let L=(0,t.useCallback)(e=>{y(t=>{let n=e(t);return u?.(n),n})},[u]),le=(0,t.useRef)(d);le.current=d;let R=(0,t.useCallback)(e=>{le.current?.(e)},[]),z=He(se??a),B=(0,t.useMemo)(()=>Ce(o??Se(),s),[o,s]),ue=(0,t.useMemo)(()=>l===!1?{zoom:!1}:l===!0||l===void 0?{zoom:!0}:{zoom:l.zoom??!0},[l]),{nodes:V,edges:H}=(0,t.useMemo)(()=>fe(v,b,O,S,g,c,re),[v,b,O,S,g,c,re]);(0,t.useEffect)(()=>{let e={},t=!1;for(let n of V)n.depth===1&&!O[n.id]&&(e[n.id]=n.color,t=!0);t&&ee(t=>({...t,...e}))},[V,O]);let U=(0,t.useMemo)(()=>{let e={};for(let t of V)e[t.id]=t;return e},[V]),W=(0,t.useMemo)(()=>{if(!ae)return{};let e={},t=[];for(let e of V)e.parentId===ae&&t.push({id:e.id,depth:1});for(;t.length>0;){let{id:n,depth:r}=t.shift();e[n]=r*100;for(let e of V)e.parentId===n&&t.push({id:e.id,depth:r+1})}return e},[ae,V]),{pan:G,setPan:K,zoom:q,setZoom:ye,animateTo:be,autoFit:xe,zoomIn:Ee,zoomOut:De,contentCenter:Oe,panToNode:ke}=Ue(h,V),{draggingCanvas:Ae,floatingNodeId:Me,floatingPos:Ne,floatingSubtreeIds:J,didDragRef:Re,handleCanvasMouseDown:ze,handleMouseMove:Be,handleMouseUp:Ve,handleNodeMouseDown:Ge}=We({svgRef:h,zoom:q,pan:G,setPan:K,setZoom:ye,nodeMap:U,nodes:V,updateData:L,direction:b,splitIndices:S,setSplitIndices:C,mapData:v,contentCenter:Oe}),{editingId:Je,editText:Ye,setEditText:Y,pendingEditId:X,setPendingEditId:Z,handleNodeDoubleClick:Xe,commitEdit:Ze,cancelEdit:Qe}=Ke({nodeMap:U,updateData:L,onTextChange:(e,t,n)=>{R({type:`nodeTextChange`,nodeId:e,oldText:t,newText:n})}}),$e=qe(V),[et,tt]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(Me||X)return;let e=xe();e?et?(ye(e.zoom),K({x:e.panX,y:e.panY})):(ye(e.zoom*.92),K({x:e.panX,y:e.panY}),requestAnimationFrame(()=>{tt(!0),be(e.zoom,e.panX,e.panY)})):et||requestAnimationFrame(()=>tt(!0))},[V,xe,Me,X,ye,K,et,be]),(0,t.useEffect)(()=>{X&&U[X]&&ke(X)},[X,U,ke]);let nt=(0,t.useCallback)(e=>{D(null),ze(e)},[ze]),rt=(0,t.useCallback)((e,t)=>{e.stopPropagation(),Re.current||(T(t),R({type:`nodeSelect`,nodeId:t}))},[Re,R]),it=(0,t.useCallback)(()=>{Re.current||(T(null),R({type:`nodeSelect`,nodeId:null}))},[Re,R]),at=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=m.current;if(!t)return;let n=t.getBoundingClientRect();D({x:e.clientX-n.left,y:e.clientY-n.top})},[]),Q=(0,t.useCallback)(()=>{D(null)},[]),st=(0,t.useCallback)(e=>{if(!e){I(null);return}let t=U[e];if(!t||!t.remark){I(null);return}let n=h.current;if(!n)return;let r=n.getBoundingClientRect(),i=(t.x+t.width/2)*q+G.x,a=(t.y-t.height/2)*q+G.y;I({nodeId:e,text:t.remark,x:Math.min(i,r.width-300),y:a-8})},[U,q,G]),ct=(0,t.useCallback)((e,t,n)=>{if(e.stopPropagation(),c)return;let r=we(),i={id:r,text:B.newNode};v.some(e=>e.id===t)&&n&&b===`both`?L(e=>e.map(e=>{if(e.id!==t)return e;let r=e.children||[],a=S[t]??Math.ceil(r.length/2),o=a,s=r.length-a,c=n;n===`right`&&o>=3*Math.max(s,1)?c=`left`:n===`left`&&s>=3*Math.max(o,1)&&(c=`right`);let l=Le(e,i,c,a);return C(e=>({...e,[t]:l.newSplitIndex})),l.data})):L(e=>Pe(e,t,i)),R({type:`nodeAdd`,node:i,parentId:t}),Z(r),Y(``)},[L,v,b,S,Z,Y,B,c,R]),ft=(0,t.useCallback)(()=>{if(c)return;let e=we(),t={id:e,text:B.newNode};L(e=>[...e,t]),R({type:`nodeAdd`,node:t,parentId:null}),Z(e),Y(``),Q()},[L,Q,Z,Y,B,c,R]),pt=(0,t.useCallback)(()=>{let e=pe(V,H,{},z,g);dt(new Blob([e],{type:`image/svg+xml;charset=utf-8`}),`mindmap.svg`),Q()},[V,H,z,Q,g]),mt=(0,t.useCallback)(async()=>{dt(await he(me(V,H,{pngSafe:!0},z,g)),`mindmap.png`),Q()},[V,H,z,Q,g]),ht=(0,t.useCallback)(()=>{let e=_e(v,g);dt(new Blob([e],{type:`text/markdown;charset=utf-8`}),`mindmap.md`),Q()},[v,Q,g]),gt=(0,t.useCallback)(()=>{let e=xe();e&&be(e.zoom,e.panX,e.panY)},[xe,be]),$=(0,t.useCallback)(e=>{x(e),C({}),R({type:`directionChange`,direction:e})},[R]),_t=(0,t.useCallback)(()=>{A(e=>{if(e===`view`)return P(_e(v,g)),R({type:`modeChange`,mode:`text`}),`text`;{let e=g?ve(N,g).roots:ge(N);return L(()=>e),C({}),R({type:`modeChange`,mode:`view`}),`view`}})},[v,N,L,g,R]),vt=(0,t.useCallback)(()=>{let e=m.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen())},[]);(0,t.useEffect)(()=>{let e=()=>{let e=!!document.fullscreenElement;M(e),R({type:`fullscreenChange`,fullscreen:e})};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[R]);let yt=(0,t.useRef)(q);(0,t.useEffect)(()=>{q!==yt.current&&(yt.current=q,R({type:`zoomChange`,zoom:q}))},[q,R]);let bt=(0,t.useCallback)(e=>{if(e.key===`Escape`&&E){e.preventDefault(),Q();return}if(Je)return;let t=e.metaKey||e.ctrlKey;if(e.shiftKey&&!t){if(e.code===`Equal`){e.preventDefault(),Ee();return}if(e.code===`Minus`){e.preventDefault(),De();return}if(e.code===`Digit0`){e.preventDefault(),gt();return}if(e.code===`KeyL`){e.preventDefault(),$(`left`);return}if(e.code===`KeyR`){e.preventDefault(),$(`right`);return}if(e.code===`KeyM`){e.preventDefault(),$(`both`);return}}if(e.key===`Enter`&&!t&&w&&!c){e.preventDefault();let t=we(),n={id:t,text:B.newNode};v.some(e=>e.id===w)&&b===`both`?L(e=>e.map(e=>{if(e.id!==w)return e;let t=e.children||[],r=Le(e,n,`right`,S[w]??Math.ceil(t.length/2));return C(e=>({...e,[w]:r.newSplitIndex})),r.data})):L(e=>Pe(e,w,n)),Z(t),Y(``),R({type:`nodeAdd`,node:n,parentId:w});return}if((e.key===`Delete`||e.key===`Backspace`)&&w&&!c){if(e.preventDefault(),v.some(e=>e.id===w)&&v.length<=1)return;R({type:`nodeDelete`,nodeId:w}),L(e=>Fe(e,w)),T(null);return}if(t&&e.key===`c`&&w){e.preventDefault(),k.current=Ie(v,w);return}if(t&&e.key===`x`&&w&&!c){if(e.preventDefault(),k.current=Ie(v,w),v.some(e=>e.id===w)&&v.length<=1)return;R({type:`nodeDelete`,nodeId:w}),L(e=>Fe(e,w)),T(null);return}if(t&&e.key===`v`&&w&&k.current&&!c){e.preventDefault();let t=je(k.current);L(e=>Pe(e,w,t)),R({type:`nodeAdd`,node:t,parentId:w});return}},[Je,w,v,b,S,L,E,Q,Z,Y,B,Ee,De,gt,$,c,R]);(0,t.useImperativeHandle)(p,()=>({exportToSVG(){return pe(V,H,{},z,g)},async exportToPNG(){return he(me(V,H,{},z,g))},exportToOutline(){return _e(v,g)},getData(){return v},setData(e){y(Te(e)),C({})},setMarkdown(e){y(g?ve(e,g).roots:ge(e)),C({})},fitView(){gt()},setDirection(e){$(e)}}),[V,H,v,g,gt,$,z]),(0,t.useEffect)(()=>{if(!E)return;let e=()=>Q();return window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[E,Q]);let xt=(0,t.useCallback)(e=>{if(e.key!==`Tab`)return;e.preventDefault();let t=e.currentTarget,{selectionStart:n,selectionEnd:r,value:i}=t;if(e.shiftKey){let e=i.lastIndexOf(`
18
+ `,n-1)+1;if(n===r){let a=i.slice(e,r),o=a.match(/^ {1,2}/);if(!o)return;let s=o[0].length;P(i.slice(0,e)+a.slice(s)+i.slice(r)),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=Math.max(e,n-s)})}else{let a=i.slice(e,r).split(`
19
+ `),o=0,s=0,c=a.map((e,t)=>{let n=e.match(/^ {1,2}/),r=n?n[0].length:0;return o+=r,t===0&&(s=r),e.slice(r)}).join(`
20
+ `);P(i.slice(0,e)+c+i.slice(r)),requestAnimationFrame(()=>{t.selectionStart=n-s,t.selectionEnd=r-o})}}else if(n===r)P(i.slice(0,n)+` `+i.slice(r)),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=n+2});else{let e=i.lastIndexOf(`
21
+ `,n-1)+1,a=i.slice(e,r).split(`
22
+ `),o=a.map(e=>` `+e).join(`
23
+ `);P(i.slice(0,e)+o+i.slice(r)),requestAnimationFrame(()=>{t.selectionStart=n+2,t.selectionEnd=r+a.length*2})}},[]);return(0,n.jsxs)(`div`,{ref:m,className:`mindmap-container`,children:[te===`text`&&(0,n.jsx)(`textarea`,{className:`mindmap-text-editor`,value:N,onChange:e=>P(e.target.value),onKeyDown:xt,readOnly:c,style:{background:z.canvas.bgColor,color:z.node.textColor,opacity:c?.7:1}}),(0,n.jsx)(`svg`,{ref:h,className:`mindmap-svg ${Ae?`dragging-canvas`:``} ${Me?`dragging-node`:``}`,style:{background:z.canvas.bgColor,display:te===`text`?`none`:`block`},tabIndex:0,onMouseDown:nt,onMouseMove:Be,onMouseUp:Ve,onMouseLeave:Ve,onClick:it,onKeyDown:bt,onContextMenu:at,children:(0,n.jsxs)(`g`,{className:`mindmap-canvas`,transform:`translate(${G.x}, ${G.y}) scale(${q})`,opacity:et?1:0,style:{transition:et?`opacity 0.4s ease-out`:`none`},children:[(0,n.jsxs)(`g`,{className:`mindmap-edges`,children:[H.some(e=>e.isCrossLink)&&(0,n.jsx)(`defs`,{children:(0,n.jsx)(`marker`,{id:`mindmap-arrowhead`,markerWidth:`8`,markerHeight:`6`,refX:`8`,refY:`3`,orient:`auto`,children:(0,n.jsx)(`path`,{d:`M0,0 L8,3 L0,6`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5})})}),H.map(e=>{let t=W[e.toId],r=t!==void 0;return(0,n.jsxs)(`g`,{children:[(0,n.jsx)(`path`,{d:e.path,stroke:e.color,strokeWidth:z.connection.strokeWidth,strokeLinecap:`round`,strokeDasharray:r?void 0:e.strokeDasharray,markerEnd:e.isCrossLink?`url(#mindmap-arrowhead)`:void 0,opacity:e.isCrossLink?.7:1,fill:`none`,className:[`mindmap-edge`,e.isCrossLink?`mindmap-edge-cross-link`:``,r?`mindmap-edge-expanding`:Ae||J.has(e.fromId)||J.has(e.toId)?``:`mindmap-edge-animated`].filter(Boolean).join(` `),style:r?{animationDelay:`${t}ms`}:void 0}),e.label&&(()=>{let t=U[e.fromId],r=U[e.toId];return!t||!r?null:(0,n.jsx)(`text`,{className:`mindmap-edge-label`,x:(t.x+r.x)/2,y:(t.y+r.y)/2-6,textAnchor:`middle`,fontSize:11,fill:e.color,opacity:.8,fontFamily:z.node.fontFamily,style:{pointerEvents:`none`},children:e.label})})()]},e.key)})]}),(0,n.jsx)(`g`,{className:`mindmap-nodes`,children:V.map(e=>{let t=J.has(e.id),r=t||Ae?``:`mindmap-node-animated`;return(0,n.jsx)(ot,{node:e,isEditing:Je===e.id,isPendingEdit:X===e.id,isSelected:w===e.id,isNew:$e.has(e.id),isGhost:t,animClass:r,editText:Ye,theme:z,direction:b,onMouseDown:Ge,onClick:rt,onDoubleClick:c?()=>{}:Xe,onEditChange:Y,onEditCommit:Ze,onEditCancel:Qe,onAddChild:ct,onRemarkHover:st,onFoldToggle:g?e=>{re[e]||(oe(e),setTimeout(()=>oe(null),800)),ie(t=>({...t,[e]:!t[e]}))}:void 0,expandDelay:W[e.id],readonly:c,plugins:g},e.id)})}),Me&&Ne&&(()=>{let e=U[Me];if(!e)return null;let t=Ne.x-e.x,r=Ne.y-e.y,i=e.parentId?U[e.parentId]:null;return(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsx)(`path`,{className:`mindmap-floating-edge`,d:de(i.x,i.y,i.width,Ne.x,Ne.y,e.width,e.side),stroke:e.color,strokeWidth:z.connection.strokeWidth,strokeLinecap:`round`,fill:`none`,style:{pointerEvents:`none`}}),(0,n.jsxs)(`g`,{className:`mindmap-floating`,transform:`translate(${t}, ${r})`,style:{pointerEvents:`none`},children:[H.filter(e=>J.has(e.fromId)&&J.has(e.toId)).map(e=>(0,n.jsx)(`path`,{className:`mindmap-floating-edge`,d:e.path,stroke:e.color,strokeWidth:z.connection.strokeWidth,strokeLinecap:`round`,fill:`none`},`fl-${e.key}`)),V.filter(e=>J.has(e.id)).map(e=>(0,n.jsx)(ot,{node:e,isEditing:!1,isPendingEdit:!1,isSelected:!1,isNew:!1,animClass:``,editText:``,theme:z,direction:b,onMouseDown:()=>{},onClick:()=>{},onDoubleClick:()=>{},onEditChange:()=>{},onEditCommit:()=>{},onEditCancel:()=>{},onAddChild:()=>{},readonly:!0},`fl-${e.id}`))]})]})})(),g&&ne(g,V,H,z).map((e,t)=>(0,n.jsx)(`g`,{className:`mindmap-plugin-overlay`,children:e},`plugin-overlay-${t}`))]})}),(0,n.jsx)(lt,{zoom:q,theme:z,messages:B,showZoom:ue.zoom,mode:te,isFullscreen:j,onZoomIn:Ee,onZoomOut:De,onAutoFit:gt,onModeToggle:_t,onFullscreenToggle:vt}),E&&(0,n.jsx)(ut,{position:E,theme:z,messages:B,direction:b,readonly:c,onNewRootNode:ft,onExportSVG:pt,onExportPNG:mt,onExportMarkdown:ht,onDirectionChange:$,onClose:Q}),F&&(0,n.jsx)(`div`,{className:`mindmap-remark-tooltip`,style:{left:F.x,top:F.y,transform:`translateY(-100%)`,background:z.contextMenu.bgColor,color:z.contextMenu.textColor,borderColor:z.contextMenu.borderColor,border:`1px solid ${z.contextMenu.borderColor}`},children:F.text})]})}),pt={name:`front-matter`,preParseMarkdown(e,t){let n=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!n)return e;let r=n[1];for(let e of r.split(`
24
+ `)){let n=e.match(/^(\w[\w-]*)\s*:\s*(.+)/);n&&(t.frontMatter[n[1].trim()]=n[2].trim())}return e.slice(n[0].length)},serializePreamble(e){return``}},mt={name:`dotted-line`,parseLine(e){let t=e.match(/^(\s*)-\.\s+(.+)/);return t?{indent:t[1].replace(/\t/g,` `).length,text:t[2].trim(),dottedLine:!0}:null},serializeListMarker(e,t){return e.dottedLine?`-. `:t},transformEdge(e,t,n){return n.dottedLine?{...e,strokeDasharray:`6 4`}:e}},ht={name:`folding`,parseLine(e){let t=e.match(/^(\s*)\+\s+(.+)/);return t?{indent:t[1].replace(/\t/g,` `).length,text:t[2].trim(),collapsed:!0}:null},serializeListMarker(e,t){return e.collapsed?`+ `:t},filterChildren(e,t,n){return!n.readonly||!e.collapsed||n.foldOverrides[e.id]?t:[]}},gt={name:`multi-line`,collectFollowLines(e,t,n){let r=0,i=[],a=t;for(;a<e.length;){let t=e[a].match(/^(\s*)\|\s?(.*)$/);if(t)i.push(t[2]),r++,a++;else break}return i.length>0&&(n.multiLineContent=i),r},serializeFollowLines(e,t){return!e.multiLineContent||e.multiLineContent.length===0?[]:e.multiLineContent.map(e=>`| ${e}`)},adjustNodeSize(e,t,n,r){if(!e.multiLineContent||e.multiLineContent.length===0)return{width:t,height:n};let i=r*1.4;return{width:t,height:n+e.multiLineContent.length*i}},exportNodeDecoration(e,t,n){if(!e.multiLineContent||e.multiLineContent.length===0)return``;let r=e.depth===0?t.root.fontSize:e.depth===1?t.level1.fontSize:t.node.fontSize,i=e.depth===0?t.root.fontFamily:t.node.fontFamily,a=e.depth===0?t.root.textColor:t.node.textColor,o=r*.85,s=r*1.4,c=r/2+8,l=[];for(let r=0;r<e.multiLineContent.length;r++){let u=c+r*s;l.push(S(e.multiLineContent[r],o,400,i,a,u,n,t.highlight.textColor,t.highlight.bgColor,.8))}return l.join(``)}},$=/((?:\s+#[\w-]+)+)$/,_t=[`#3B82F6`,`#8B5CF6`,`#EC4899`,`#F59E0B`,`#10B981`,`#6366F1`],vt={name:`tags`,transformNodeData(e,t){let n=e.text.match($);if(!n)return e;let r=n[1],i=e.text.slice(0,e.text.length-r.length).trim(),a=[],o=/#([\w-]+)/g,s;for(;(s=o.exec(r))!==null;)a.push(s[1]);return a.length>0?{...e,text:i,tags:a}:e},serializeNodeText(e,t){return!e.tags||e.tags.length===0?t:t+` `+e.tags.map(e=>`#`+e).join(` `)},adjustNodeSize(e,t,n,r){if(!e.tags||e.tags.length===0)return{width:t,height:n};let i=r*.65,a=0;for(let t of e.tags)a+=t.length*i*.65+10+4;return{width:Math.max(t,a+16),height:n+(i+10)}},exportNodeDecoration(e,t){if(!e.tags||e.tags.length===0)return``;let n=e.depth===0?t.root.fontSize:e.depth===1?t.level1.fontSize:t.node.fontSize,r=e.depth===0?t.root.fontFamily:t.node.fontFamily,i=n*.65,a=n*1.4,o=e.multiLineContent?e.multiLineContent.length*a:0,s=n/2+6+o,c=i+6,l=0,u=[];for(let t of e.tags){let e=t.length*i*.65+10;u.push(e),l+=e}l+=(e.tags.length-1)*4;let d=-l/2,f=[];for(let t=0;t<e.tags.length;t++){let n=e.tags[t],a=u[t],o=_t[t%_t.length];f.push(`<rect x="${d}" y="${s}" width="${a}" height="${c}" rx="3" fill="${o}" opacity="0.15"/>`),f.push(`<text x="${d+a/2}" y="${s+c/2}" text-anchor="middle" dominant-baseline="central" font-size="${i}" fill="${o}" font-family="${r}">${v(n)}</text>`),d+=a+4}return f.join(``)}},yt=/\{#([\w-]+)\}/,bt=/(-?\.?)>\s*\{#([\w-]+)\}(?:\s+"([^"]*)")?/g,xt={name:`cross-link`,transformNodeData(e){let t=e.text,n,r=[],i=new RegExp(bt.source,`g`),a;for(;(a=i.exec(t))!==null;){let e=a[1]===`-.`;r.push({targetAnchorId:a[2],label:a[3]||void 0,dotted:e})}t=t.replace(new RegExp(bt.source,`g`),``).trim();let o=t.match(yt);return o&&(n=o[1],t=t.replace(yt,``).trim()),n||r.length>0?{...e,text:t,...n?{anchorId:n}:{},...r.length>0?{crossLinks:r}:{}}:e},serializeNodeText(e,t){let n=t;if(e.anchorId&&(n+=` {#${e.anchorId}}`),e.crossLinks)for(let t of e.crossLinks){let e=t.dotted?`-.>`:`->`;n+=` ${e} {#${t.targetAnchorId}}`,t.label&&(n+=` "${t.label}"`)}return n},generateExtraEdges(e,t){let n=[],r=new Map;for(let t of e)t.anchorId&&r.set(t.anchorId,t);function i(t){if(t.crossLinks){let i=e.find(e=>e.id===t.id);if(i)for(let e of t.crossLinks){let t=r.get(e.targetAnchorId);if(t){let r=St(i,t);n.push({key:`xlink-${i.id}-${t.id}`,path:r,color:i.color,fromId:i.id,toId:t.id,strokeDasharray:`6 4`,isCrossLink:!0,label:e.label})}}}if(t.children)for(let e of t.children)i(e)}for(let e of t)i(e);return n}};function St(e,t){let n=e.x,r=e.y,i=t.x,a=t.y,o=i-n,s=a-r,c=Math.sqrt(o*o+s*s),l=(n+i)/2,u=(r+a)/2,d=Math.min(c*.3,60),f=-s/c,p=o/c;return`M ${n},${r} Q ${l+f*d},${u+p*d} ${i},${a}`}var Ct=[pt,mt,ht,gt,vt,xt,nt];e.MindMap=ft,e.allPlugins=Ct,e.buildExportSVG=pe,e.buildExportSVGForPNG=me,e.crossLinkPlugin=xt,e.detectLocale=Se,e.dottedLinePlugin=mt,e.exportToPNG=he,e.foldingPlugin=ht,e.frontMatterPlugin=pt,e.latexPlugin=nt,e.multiLinePlugin=gt,e.parseInlineMarkdown=u,e.parseMarkdownList=W,e.parseMarkdownMultiRoot=ge,e.parseMarkdownWithFrontMatter=ve,e.resolveMessages=Ce,e.stripInlineMarkdown=f,e.tagsPlugin=vt,e.toMarkdownList=K,e.toMarkdownMultiRoot=_e});
@@ -0,0 +1,2 @@
1
+ import type { MindMapPlugin } from './types';
2
+ export declare const crossLinkPlugin: MindMapPlugin;
@@ -0,0 +1,2 @@
1
+ import type { MindMapPlugin } from './types';
2
+ export declare const dottedLinePlugin: MindMapPlugin;
@@ -0,0 +1,2 @@
1
+ import type { MindMapPlugin } from './types';
2
+ export declare const foldingPlugin: MindMapPlugin;
@@ -0,0 +1,2 @@
1
+ import type { MindMapPlugin } from './types';
2
+ export declare const frontMatterPlugin: MindMapPlugin;
@@ -0,0 +1,11 @@
1
+ export type { MindMapPlugin, ParseContext, LayoutContext, ParsedLineResult } from './types';
2
+ export { frontMatterPlugin } from './front-matter';
3
+ export { dottedLinePlugin } from './dotted-line';
4
+ export { foldingPlugin } from './folding';
5
+ export { multiLinePlugin } from './multi-line';
6
+ export { tagsPlugin } from './tags';
7
+ export { crossLinkPlugin } from './cross-link';
8
+ export { latexPlugin } from './latex';
9
+ import type { MindMapPlugin } from './types';
10
+ /** All 7 plugins in recommended processing order */
11
+ export declare const allPlugins: MindMapPlugin[];
@@ -0,0 +1,20 @@
1
+ import type { MindMapPlugin } from "./types";
2
+ export declare function initKatex(): Promise<void>;
3
+ /** Get KaTeX module synchronously (returns null if not yet loaded) */
4
+ export declare function getKatexSync(): any;
5
+ /** Whether KaTeX loading has completed (success or failure) */
6
+ export declare function isKatexReady(): boolean;
7
+ /** Register a callback for when KaTeX becomes available */
8
+ export declare function onKatexReady(cb: () => void): void;
9
+ export declare function loadKatexStyle(): void;
10
+ /**
11
+ * Render a LaTeX string to HTML using KaTeX.
12
+ * Returns null if KaTeX is not loaded yet.
13
+ */
14
+ export declare function renderLatexToHtml(content: string, displayMode: boolean): string | null;
15
+ /**
16
+ * Render a LaTeX string to MathML using KaTeX (no CSS dependency).
17
+ * Returns null if KaTeX is not loaded yet.
18
+ */
19
+ export declare function renderLatexToMathML(content: string, displayMode: boolean): string | null;
20
+ export declare const latexPlugin: MindMapPlugin;