flow-mindmap 0.1.1-beta.1 → 0.2.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.
@@ -1,403 +1,404 @@
1
- import { defineComponent as dt, openBlock as M, createElementBlock as C, Fragment as P, createElementVNode as y, createStaticVNode as Ne, createCommentVNode as O, ref as D, reactive as Ge, onMounted as ut, onBeforeUnmount as ct, computed as Q, withModifiers as R, normalizeStyle as ve, createVNode as F, toDisplayString as be, watch as Ye, nextTick as Z, unref as z, renderList as Ot, normalizeClass as Ie, withDirectives as Wn, withKeys as Ke, vModelText as $n, createBlock as Bn } from "vue";
2
- const Rn = ["width", "height", "stroke-width"], An = {
1
+ import { defineComponent as dt, openBlock as w, createElementBlock as b, Fragment as P, createElementVNode as p, createStaticVNode as $e, createCommentVNode as q, ref as F, reactive as Ge, onMounted as ut, onBeforeUnmount as ft, computed as te, withModifiers as H, normalizeStyle as ge, createVNode as U, toDisplayString as se, watch as Ye, nextTick as ee, unref as N, renderList as De, normalizeClass as me, withDirectives as Ln, withKeys as Ke, vModelText as An, createBlock as Hn } from "vue";
2
+ const Dn = ["width", "height", "stroke-width"], Pn = {
3
3
  key: 4,
4
4
  points: "6 9 12 15 18 9"
5
- }, Ln = {
5
+ }, Tn = {
6
6
  key: 5,
7
7
  points: "9 6 15 12 9 18"
8
- }, V = /* @__PURE__ */ dt({
8
+ }, Y = /* @__PURE__ */ dt({
9
9
  __name: "Icon",
10
10
  props: {
11
11
  name: {},
12
12
  size: {},
13
13
  stroke: {}
14
14
  },
15
- setup(n) {
16
- return (s, o) => (M(), C("svg", {
17
- width: n.size ?? 16,
18
- height: n.size ?? 16,
15
+ setup(i) {
16
+ return (s, o) => (w(), b("svg", {
17
+ width: i.size ?? 16,
18
+ height: i.size ?? 16,
19
19
  viewBox: "0 0 24 24",
20
20
  fill: "none",
21
21
  stroke: "currentColor",
22
- "stroke-width": n.stroke ?? 1.8,
22
+ "stroke-width": i.stroke ?? 1.8,
23
23
  "stroke-linecap": "round",
24
24
  "stroke-linejoin": "round",
25
25
  "aria-hidden": "true"
26
26
  }, [
27
- n.name === "add" ? (M(), C(P, { key: 0 }, [
28
- o[0] || (o[0] = y("circle", {
27
+ i.name === "add" ? (w(), b(P, { key: 0 }, [
28
+ o[0] || (o[0] = p("circle", {
29
29
  cx: "12",
30
30
  cy: "12",
31
31
  r: "9"
32
32
  }, null, -1)),
33
- o[1] || (o[1] = y("line", {
33
+ o[1] || (o[1] = p("line", {
34
34
  x1: "12",
35
35
  y1: "8",
36
36
  x2: "12",
37
37
  y2: "16"
38
38
  }, null, -1)),
39
- o[2] || (o[2] = y("line", {
39
+ o[2] || (o[2] = p("line", {
40
40
  x1: "8",
41
41
  y1: "12",
42
42
  x2: "16",
43
43
  y2: "12"
44
44
  }, null, -1))
45
- ], 64)) : n.name === "minus" ? (M(), C(P, { key: 1 }, [
46
- o[3] || (o[3] = y("circle", {
45
+ ], 64)) : i.name === "minus" ? (w(), b(P, { key: 1 }, [
46
+ o[3] || (o[3] = p("circle", {
47
47
  cx: "12",
48
48
  cy: "12",
49
49
  r: "9"
50
50
  }, null, -1)),
51
- o[4] || (o[4] = y("line", {
51
+ o[4] || (o[4] = p("line", {
52
52
  x1: "8",
53
53
  y1: "12",
54
54
  x2: "16",
55
55
  y2: "12"
56
56
  }, null, -1))
57
- ], 64)) : n.name === "delete" ? (M(), C(P, { key: 2 }, [
58
- o[5] || (o[5] = Ne('<polyline points="4 7 20 7"></polyline><path d="M9 7 V5 a1 1 0 0 1 1 -1 h4 a1 1 0 0 1 1 1 V7"></path><path d="M6 7 l1 12 a1 1 0 0 0 1 1 h8 a1 1 0 0 0 1 -1 l1 -12"></path><line x1="10" y1="11" x2="10" y2="18"></line><line x1="14" y1="11" x2="14" y2="18"></line>', 5))
59
- ], 64)) : n.name === "edit" ? (M(), C(P, { key: 3 }, [
60
- o[6] || (o[6] = y("path", { d: "M4 20 l4 -1 11 -11 -3 -3 -11 11 z" }, null, -1)),
61
- o[7] || (o[7] = y("line", {
57
+ ], 64)) : i.name === "delete" ? (w(), b(P, { key: 2 }, [
58
+ o[5] || (o[5] = $e('<polyline points="4 7 20 7"></polyline><path d="M9 7 V5 a1 1 0 0 1 1 -1 h4 a1 1 0 0 1 1 1 V7"></path><path d="M6 7 l1 12 a1 1 0 0 0 1 1 h8 a1 1 0 0 0 1 -1 l1 -12"></path><line x1="10" y1="11" x2="10" y2="18"></line><line x1="14" y1="11" x2="14" y2="18"></line>', 5))
59
+ ], 64)) : i.name === "edit" ? (w(), b(P, { key: 3 }, [
60
+ o[6] || (o[6] = p("path", { d: "M4 20 l4 -1 11 -11 -3 -3 -11 11 z" }, null, -1)),
61
+ o[7] || (o[7] = p("line", {
62
62
  x1: "14",
63
63
  y1: "6",
64
64
  x2: "18",
65
65
  y2: "10"
66
66
  }, null, -1))
67
- ], 64)) : n.name === "collapse" ? (M(), C("polyline", An)) : n.name === "expand" ? (M(), C("polyline", Ln)) : n.name === "zoom-in" ? (M(), C(P, { key: 6 }, [
68
- o[8] || (o[8] = y("circle", {
67
+ ], 64)) : i.name === "collapse" ? (w(), b("polyline", Pn)) : i.name === "expand" ? (w(), b("polyline", Tn)) : i.name === "zoom-in" ? (w(), b(P, { key: 6 }, [
68
+ o[8] || (o[8] = p("circle", {
69
69
  cx: "11",
70
70
  cy: "11",
71
71
  r: "7"
72
72
  }, null, -1)),
73
- o[9] || (o[9] = y("line", {
73
+ o[9] || (o[9] = p("line", {
74
74
  x1: "11",
75
75
  y1: "8",
76
76
  x2: "11",
77
77
  y2: "14"
78
78
  }, null, -1)),
79
- o[10] || (o[10] = y("line", {
79
+ o[10] || (o[10] = p("line", {
80
80
  x1: "8",
81
81
  y1: "11",
82
82
  x2: "14",
83
83
  y2: "11"
84
84
  }, null, -1)),
85
- o[11] || (o[11] = y("line", {
85
+ o[11] || (o[11] = p("line", {
86
86
  x1: "16",
87
87
  y1: "16",
88
88
  x2: "21",
89
89
  y2: "21"
90
90
  }, null, -1))
91
- ], 64)) : n.name === "zoom-out" ? (M(), C(P, { key: 7 }, [
92
- o[12] || (o[12] = y("circle", {
91
+ ], 64)) : i.name === "zoom-out" ? (w(), b(P, { key: 7 }, [
92
+ o[12] || (o[12] = p("circle", {
93
93
  cx: "11",
94
94
  cy: "11",
95
95
  r: "7"
96
96
  }, null, -1)),
97
- o[13] || (o[13] = y("line", {
97
+ o[13] || (o[13] = p("line", {
98
98
  x1: "8",
99
99
  y1: "11",
100
100
  x2: "14",
101
101
  y2: "11"
102
102
  }, null, -1)),
103
- o[14] || (o[14] = y("line", {
103
+ o[14] || (o[14] = p("line", {
104
104
  x1: "16",
105
105
  y1: "16",
106
106
  x2: "21",
107
107
  y2: "21"
108
108
  }, null, -1))
109
- ], 64)) : n.name === "reset" ? (M(), C(P, { key: 8 }, [
110
- o[15] || (o[15] = y("circle", {
109
+ ], 64)) : i.name === "reset" ? (w(), b(P, { key: 8 }, [
110
+ o[15] || (o[15] = p("circle", {
111
111
  cx: "12",
112
112
  cy: "12",
113
113
  r: "9"
114
114
  }, null, -1)),
115
- o[16] || (o[16] = y("circle", {
115
+ o[16] || (o[16] = p("circle", {
116
116
  cx: "12",
117
117
  cy: "12",
118
118
  r: "4"
119
119
  }, null, -1)),
120
- o[17] || (o[17] = y("circle", {
120
+ o[17] || (o[17] = p("circle", {
121
121
  cx: "12",
122
122
  cy: "12",
123
123
  r: "0.8",
124
124
  fill: "currentColor"
125
125
  }, null, -1))
126
- ], 64)) : n.name === "logo" ? (M(), C(P, { key: 9 }, [
127
- o[18] || (o[18] = Ne('<circle cx="12" cy="12" r="2.2"></circle><circle cx="4" cy="5" r="1.6"></circle><circle cx="20" cy="5" r="1.6"></circle><circle cx="4" cy="19" r="1.6"></circle><circle cx="20" cy="19" r="1.6"></circle><line x1="10.5" y1="10.8" x2="5.2" y2="6.4"></line><line x1="13.5" y1="10.8" x2="18.8" y2="6.4"></line><line x1="10.5" y1="13.2" x2="5.2" y2="17.6"></line><line x1="13.5" y1="13.2" x2="18.8" y2="17.6"></line>', 9))
128
- ], 64)) : n.name === "import" ? (M(), C(P, { key: 10 }, [
129
- o[19] || (o[19] = y("path", { d: "M12 4 V15" }, null, -1)),
130
- o[20] || (o[20] = y("polyline", { points: "7 10 12 15 17 10" }, null, -1)),
131
- o[21] || (o[21] = y("path", { d: "M4 19 H20" }, null, -1))
132
- ], 64)) : n.name === "export" ? (M(), C(P, { key: 11 }, [
133
- o[22] || (o[22] = y("path", { d: "M12 15 V4" }, null, -1)),
134
- o[23] || (o[23] = y("polyline", { points: "7 9 12 4 17 9" }, null, -1)),
135
- o[24] || (o[24] = y("path", { d: "M4 19 H20" }, null, -1))
136
- ], 64)) : n.name === "balance" ? (M(), C(P, { key: 12 }, [
137
- o[25] || (o[25] = Ne('<line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line><polyline points="9 4 5 6 9 8"></polyline><polyline points="15 4 19 6 15 8"></polyline><polyline points="9 10 5 12 9 14"></polyline><polyline points="15 10 19 12 15 14"></polyline><polyline points="9 16 5 18 9 20"></polyline><polyline points="15 16 19 18 15 20"></polyline>', 9))
138
- ], 64)) : n.name === "mindmap" ? (M(), C(P, { key: 13 }, [
139
- o[26] || (o[26] = Ne('<circle cx="12" cy="12" r="2.2" fill="currentColor" stroke="none"></circle><line x1="13" y1="11" x2="19" y2="6"></line><line x1="13" y1="13" x2="19" y2="18"></line><line x1="11" y1="11" x2="5" y2="6"></line><line x1="11" y1="13" x2="5" y2="18"></line>', 5))
140
- ], 64)) : n.name === "tree" ? (M(), C(P, { key: 14 }, [
141
- o[27] || (o[27] = Ne('<circle cx="6" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="6" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="18" r="2" fill="currentColor" stroke="none"></circle><line x1="8" y1="12" x2="16" y2="6"></line><line x1="8" y1="12" x2="16" y2="12"></line><line x1="8" y1="12" x2="16" y2="18"></line>', 7))
142
- ], 64)) : n.name === "org" ? (M(), C(P, { key: 15 }, [
143
- o[28] || (o[28] = Ne('<circle cx="12" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="6" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="13"></line><line x1="6" y1="13" x2="18" y2="13"></line><line x1="6" y1="13" x2="6" y2="17"></line><line x1="12" y1="13" x2="12" y2="17"></line><line x1="18" y1="13" x2="18" y2="17"></line>', 9))
144
- ], 64)) : n.name === "image" ? (M(), C(P, { key: 16 }, [
145
- o[29] || (o[29] = y("rect", {
126
+ ], 64)) : i.name === "logo" ? (w(), b(P, { key: 9 }, [
127
+ o[18] || (o[18] = $e('<circle cx="12" cy="12" r="2.2"></circle><circle cx="4" cy="5" r="1.6"></circle><circle cx="20" cy="5" r="1.6"></circle><circle cx="4" cy="19" r="1.6"></circle><circle cx="20" cy="19" r="1.6"></circle><line x1="10.5" y1="10.8" x2="5.2" y2="6.4"></line><line x1="13.5" y1="10.8" x2="18.8" y2="6.4"></line><line x1="10.5" y1="13.2" x2="5.2" y2="17.6"></line><line x1="13.5" y1="13.2" x2="18.8" y2="17.6"></line>', 9))
128
+ ], 64)) : i.name === "import" ? (w(), b(P, { key: 10 }, [
129
+ o[19] || (o[19] = p("path", { d: "M12 4 V15" }, null, -1)),
130
+ o[20] || (o[20] = p("polyline", { points: "7 10 12 15 17 10" }, null, -1)),
131
+ o[21] || (o[21] = p("path", { d: "M4 19 H20" }, null, -1))
132
+ ], 64)) : i.name === "export" ? (w(), b(P, { key: 11 }, [
133
+ o[22] || (o[22] = p("path", { d: "M12 15 V4" }, null, -1)),
134
+ o[23] || (o[23] = p("polyline", { points: "7 9 12 4 17 9" }, null, -1)),
135
+ o[24] || (o[24] = p("path", { d: "M4 19 H20" }, null, -1))
136
+ ], 64)) : i.name === "balance" ? (w(), b(P, { key: 12 }, [
137
+ o[25] || (o[25] = $e('<line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line><polyline points="9 4 5 6 9 8"></polyline><polyline points="15 4 19 6 15 8"></polyline><polyline points="9 10 5 12 9 14"></polyline><polyline points="15 10 19 12 15 14"></polyline><polyline points="9 16 5 18 9 20"></polyline><polyline points="15 16 19 18 15 20"></polyline>', 9))
138
+ ], 64)) : i.name === "mindmap" ? (w(), b(P, { key: 13 }, [
139
+ o[26] || (o[26] = $e('<circle cx="12" cy="12" r="2.2" fill="currentColor" stroke="none"></circle><line x1="13" y1="11" x2="19" y2="6"></line><line x1="13" y1="13" x2="19" y2="18"></line><line x1="11" y1="11" x2="5" y2="6"></line><line x1="11" y1="13" x2="5" y2="18"></line>', 5))
140
+ ], 64)) : i.name === "tree" ? (w(), b(P, { key: 14 }, [
141
+ o[27] || (o[27] = $e('<circle cx="6" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="6" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="18" r="2" fill="currentColor" stroke="none"></circle><line x1="8" y1="12" x2="16" y2="6"></line><line x1="8" y1="12" x2="16" y2="12"></line><line x1="8" y1="12" x2="16" y2="18"></line>', 7))
142
+ ], 64)) : i.name === "org" ? (w(), b(P, { key: 15 }, [
143
+ o[28] || (o[28] = $e('<circle cx="12" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="6" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="13"></line><line x1="6" y1="13" x2="18" y2="13"></line><line x1="6" y1="13" x2="6" y2="17"></line><line x1="12" y1="13" x2="12" y2="17"></line><line x1="18" y1="13" x2="18" y2="17"></line>', 9))
144
+ ], 64)) : i.name === "image" ? (w(), b(P, { key: 16 }, [
145
+ o[29] || (o[29] = p("rect", {
146
146
  x: "3",
147
147
  y: "5",
148
148
  width: "18",
149
149
  height: "14",
150
150
  rx: "2"
151
151
  }, null, -1)),
152
- o[30] || (o[30] = y("circle", {
152
+ o[30] || (o[30] = p("circle", {
153
153
  cx: "9",
154
154
  cy: "11",
155
155
  r: "1.6"
156
156
  }, null, -1)),
157
- o[31] || (o[31] = y("polyline", { points: "3 17 9 12 13 15 16 13 21 17" }, null, -1))
158
- ], 64)) : n.name === "x" ? (M(), C(P, { key: 17 }, [
159
- o[32] || (o[32] = y("line", {
157
+ o[31] || (o[31] = p("polyline", { points: "3 17 9 12 13 15 16 13 21 17" }, null, -1))
158
+ ], 64)) : i.name === "x" ? (w(), b(P, { key: 17 }, [
159
+ o[32] || (o[32] = p("line", {
160
160
  x1: "6",
161
161
  y1: "6",
162
162
  x2: "18",
163
163
  y2: "18"
164
164
  }, null, -1)),
165
- o[33] || (o[33] = y("line", {
165
+ o[33] || (o[33] = p("line", {
166
166
  x1: "18",
167
167
  y1: "6",
168
168
  x2: "6",
169
169
  y2: "18"
170
170
  }, null, -1))
171
- ], 64)) : n.name === "link" ? (M(), C(P, { key: 18 }, [
172
- o[34] || (o[34] = y("path", { d: "M10 13 a4 4 0 0 0 5.66 0 l3 -3 a4 4 0 1 0 -5.66 -5.66 l-1 1" }, null, -1)),
173
- o[35] || (o[35] = y("path", { d: "M14 11 a4 4 0 0 0 -5.66 0 l-3 3 a4 4 0 1 0 5.66 5.66 l1 -1" }, null, -1))
174
- ], 64)) : n.name === "note" ? (M(), C(P, { key: 19 }, [
175
- o[36] || (o[36] = y("path", { d: "M6 4 h9 l3 3 v13 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z" }, null, -1)),
176
- o[37] || (o[37] = y("line", {
171
+ ], 64)) : i.name === "link" ? (w(), b(P, { key: 18 }, [
172
+ o[34] || (o[34] = p("path", { d: "M10 13 a4 4 0 0 0 5.66 0 l3 -3 a4 4 0 1 0 -5.66 -5.66 l-1 1" }, null, -1)),
173
+ o[35] || (o[35] = p("path", { d: "M14 11 a4 4 0 0 0 -5.66 0 l-3 3 a4 4 0 1 0 5.66 5.66 l1 -1" }, null, -1))
174
+ ], 64)) : i.name === "note" ? (w(), b(P, { key: 19 }, [
175
+ o[36] || (o[36] = p("path", { d: "M6 4 h9 l3 3 v13 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z" }, null, -1)),
176
+ o[37] || (o[37] = p("line", {
177
177
  x1: "8",
178
178
  y1: "10",
179
179
  x2: "16",
180
180
  y2: "10"
181
181
  }, null, -1)),
182
- o[38] || (o[38] = y("line", {
182
+ o[38] || (o[38] = p("line", {
183
183
  x1: "8",
184
184
  y1: "13",
185
185
  x2: "16",
186
186
  y2: "13"
187
187
  }, null, -1)),
188
- o[39] || (o[39] = y("line", {
188
+ o[39] || (o[39] = p("line", {
189
189
  x1: "8",
190
190
  y1: "16",
191
191
  x2: "13",
192
192
  y2: "16"
193
193
  }, null, -1))
194
- ], 64)) : O("", !0)
195
- ], 8, Rn));
194
+ ], 64)) : q("", !0)
195
+ ], 8, Dn));
196
196
  }
197
- }), Hn = "data:image/svg+xml,%3csvg%20t='1780822312364'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='7459'%20width='200'%20height='200'%3e%3cpath%20d='M329.16%20292.571h658.286V512H329.16zM329.16%200h658.286v219.429H329.16z'%20fill='%239AA1A2'%20p-id='7460'%3e%3c/path%3e%3cpath%20d='M44.927%20146.286a46.519%2046.519%200%200%201%2038.107-73.143h319.269v73.143H109.73V791.99l-48.713%205.705-24.43-651.41h8.339z'%20fill='%239AA1A2'%20p-id='7461'%3e%3c/path%3e%3cpath%20d='M363.83%20877.714H179.51c-78.775%200-142.921-66.12-142.921-147.31V112.787c0-21.943%2017.188-39.643%2038.473-39.643%2021.211%200%2033.5%2017.774%2033.5%2039.643v617.619c0%2037.522%2028.013%2076.58%2064.438%2076.58h190.903c21.211%200%2038.766%2013.97%2038.766%2035.84%200%2021.943-17.555%2034.89-38.766%2034.89z'%20fill='%239AA1A2'%20p-id='7462'%3e%3c/path%3e%3cpath%20d='M432.95%20438.857H179.51c-78.775%200-81.043-18.578-81.043-62.903l10.094-90.624c0%2020.48%2013.458%2080.677%2049.884%2080.677h210.139c21.211%200%20120.613%204.023%20120.613%2016.018%200%2011.922-35.036%2056.832-56.32%2056.832zM640.017%20749.714V640a54.857%2054.857%200%200%201%20109.714%200v109.714h109.715a54.857%2054.857%200%200%201%200%20109.715H749.73v109.714a54.857%2054.857%200%200%201-109.714%200V859.429H530.303a54.857%2054.857%200%200%201%200-109.715h109.714z'%20fill='%239AA1A2'%20p-id='7463'%3e%3c/path%3e%3c/svg%3e", Dn = "data:image/svg+xml,%3csvg%20t='1780822464335'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='8457'%20width='200'%20height='200'%3e%3cpath%20d='M512%20804.571h512V1024H512V804.571zM0%200h658.286v219.429H0V0z'%20fill='%239AA1A2'%20p-id='8458'%3e%3c/path%3e%3cpath%20d='M619.813%20950.857h-184.32c-78.775%200-142.922-66.121-142.922-147.31V185.93c0-21.943%2017.189-39.643%2038.474-39.643%2021.211%200%2033.353%2017.773%2033.353%2039.643v617.618c0%2037.523%2034.743%2073.728%2071.095%2073.728h184.32c21.211%200%2038.473%2012.069%2038.473%2033.939%200%2021.943-17.189%2039.643-38.473%2039.643z'%20fill='%239AA1A2'%20p-id='8459'%3e%3c/path%3e%3cpath%20d='M676.571%20457.143V347.429a54.857%2054.857%200%200%201%20109.715%200v109.714H896a54.857%2054.857%200%200%201%200%20109.714H786.286v109.714a54.857%2054.857%200%200%201-109.715%200V566.857H566.857a54.857%2054.857%200%200%201%200-109.714h109.714z'%20fill='%239AA1A2'%20p-id='8460'%3e%3c/path%3e%3c/svg%3e", Yt = [18, 15, 13, 12], Pn = [700, 600, 500, 400], Tn = [52, 40, 32, 28], On = [120, 80, 60, 44], Fn = [0.8, 0.8, 0.8, 0.8], Vn = Yt.length - 1;
198
- function Xn(n, s) {
199
- return Math.round(ft(n, s) * Fn[Ze(n)]);
197
+ }), On = "data:image/svg+xml,%3csvg%20t='1780822312364'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='7459'%20width='200'%20height='200'%3e%3cpath%20d='M329.16%20292.571h658.286V512H329.16zM329.16%200h658.286v219.429H329.16z'%20fill='%239AA1A2'%20p-id='7460'%3e%3c/path%3e%3cpath%20d='M44.927%20146.286a46.519%2046.519%200%200%201%2038.107-73.143h319.269v73.143H109.73V791.99l-48.713%205.705-24.43-651.41h8.339z'%20fill='%239AA1A2'%20p-id='7461'%3e%3c/path%3e%3cpath%20d='M363.83%20877.714H179.51c-78.775%200-142.921-66.12-142.921-147.31V112.787c0-21.943%2017.188-39.643%2038.473-39.643%2021.211%200%2033.5%2017.774%2033.5%2039.643v617.619c0%2037.522%2028.013%2076.58%2064.438%2076.58h190.903c21.211%200%2038.766%2013.97%2038.766%2035.84%200%2021.943-17.555%2034.89-38.766%2034.89z'%20fill='%239AA1A2'%20p-id='7462'%3e%3c/path%3e%3cpath%20d='M432.95%20438.857H179.51c-78.775%200-81.043-18.578-81.043-62.903l10.094-90.624c0%2020.48%2013.458%2080.677%2049.884%2080.677h210.139c21.211%200%20120.613%204.023%20120.613%2016.018%200%2011.922-35.036%2056.832-56.32%2056.832zM640.017%20749.714V640a54.857%2054.857%200%200%201%20109.714%200v109.714h109.715a54.857%2054.857%200%200%201%200%20109.715H749.73v109.714a54.857%2054.857%200%200%201-109.714%200V859.429H530.303a54.857%2054.857%200%200%201%200-109.715h109.714z'%20fill='%239AA1A2'%20p-id='7463'%3e%3c/path%3e%3c/svg%3e", Fn = "data:image/svg+xml,%3csvg%20t='1780822464335'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='8457'%20width='200'%20height='200'%3e%3cpath%20d='M512%20804.571h512V1024H512V804.571zM0%200h658.286v219.429H0V0z'%20fill='%239AA1A2'%20p-id='8458'%3e%3c/path%3e%3cpath%20d='M619.813%20950.857h-184.32c-78.775%200-142.922-66.121-142.922-147.31V185.93c0-21.943%2017.189-39.643%2038.474-39.643%2021.211%200%2033.353%2017.773%2033.353%2039.643v617.618c0%2037.523%2034.743%2073.728%2071.095%2073.728h184.32c21.211%200%2038.473%2012.069%2038.473%2033.939%200%2021.943-17.189%2039.643-38.473%2039.643z'%20fill='%239AA1A2'%20p-id='8459'%3e%3c/path%3e%3cpath%20d='M676.571%20457.143V347.429a54.857%2054.857%200%200%201%20109.715%200v109.714H896a54.857%2054.857%200%200%201%200%20109.714H786.286v109.714a54.857%2054.857%200%200%201-109.715%200V566.857H566.857a54.857%2054.857%200%200%201%200-109.714h109.714z'%20fill='%239AA1A2'%20p-id='8460'%3e%3c/path%3e%3c/svg%3e", Ut = [18, 15, 13, 12], Vn = [700, 600, 500, 400], Xn = [52, 40, 32, 28], qn = [120, 80, 60, 44], Un = [0.8, 0.8, 0.8, 0.8], Yn = Ut.length - 1;
198
+ function Kn(i, s) {
199
+ return Math.round(ht(i, s) * Un[Qe(i)]);
200
200
  }
201
- function Ze(n) {
202
- return Math.min(Vn, Math.max(0, n));
201
+ function Qe(i) {
202
+ return Math.min(Yn, Math.max(0, i));
203
203
  }
204
- function ft(n, s = 14) {
205
- return Math.round(Yt[Ze(n)] * s / 14 * 10) / 10;
204
+ function ht(i, s = 14) {
205
+ return Math.round(Ut[Qe(i)] * s / 14 * 10) / 10;
206
206
  }
207
- function qn(n, s = 14) {
208
- return Math.round(Tn[Ze(n)] * s / 14);
207
+ function jn(i, s = 14) {
208
+ return Math.round(Xn[Qe(i)] * s / 14);
209
209
  }
210
- const Ue = 60, $e = 14, te = 24;
211
- let at = null;
212
- function Yn() {
213
- if (at) return at;
214
- const n = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
215
- return n ? (at = n, n) : {
210
+ const je = 60, We = 14, oe = 24;
211
+ let st = null;
212
+ function Gn() {
213
+ if (st) return st;
214
+ const i = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
215
+ return i ? (st = i, i) : {
216
216
  font: "",
217
217
  measureText: () => ({ width: 0 })
218
218
  };
219
219
  }
220
220
  const Ft = /* @__PURE__ */ new Map();
221
- function Kn(n, s, o) {
222
- const i = `${o}|${s}|${n}`, a = Ft.get(i);
223
- if (a !== void 0) return a;
224
- const d = Yn();
225
- d.font = `${o} ${s}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;
226
- const c = d.measureText(n).width;
227
- return Ft.set(i, c), c;
221
+ function Jn(i, s, o) {
222
+ const n = `${o}|${s}|${i}`, r = Ft.get(n);
223
+ if (r !== void 0) return r;
224
+ const c = Gn();
225
+ c.font = `${o} ${s}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;
226
+ const d = c.measureText(i).width;
227
+ return Ft.set(n, d), d;
228
228
  }
229
- const Un = 24, Gn = 400, jn = 8, Vt = 16, Jn = 4;
230
- function Zn(n, s, o) {
231
- return Math.min(o, Math.max(s, n));
229
+ const Zn = 24, Qn = 400, _n = 8, Vt = 16, ei = 4, ti = 200;
230
+ function ni(i, s, o) {
231
+ return Math.min(o, Math.max(s, i));
232
232
  }
233
- function Qn(n, s, o) {
234
- const i = Ze(s), a = ft(s, o), d = Kn(n.text || "", a, Pn[i]), c = Xn(s, o), x = Math.ceil(d + c * 2), m = qn(s, o);
235
- let h = 0;
236
- if (n.link && (h += Vt), n.note && (h += Vt), h > 0) {
237
- const U = (n.link ? 1 : 0) + (n.note ? 1 : 0);
238
- h += Jn * U;
233
+ function ii(i, s, o) {
234
+ const n = Qe(s), r = ht(s, o), c = Math.min(Jn(i.text || "", r, Vn[n]), ti), d = Kn(s, o), x = Math.ceil(c + d * 2), f = jn(s, o);
235
+ let v = 0;
236
+ if (i.link && (v += Vt), i.note && (v += Vt), v > 0) {
237
+ const K = (i.link ? 1 : 0) + (i.note ? 1 : 0);
238
+ v += ei * K;
239
239
  }
240
- const u = x + h, p = Math.round(On[i] * o / 14);
241
- if (!n.image)
242
- return { w: Math.max(p, u), h: m };
243
- const S = Zn(n.image.width, Un, Gn), b = Math.max(p, u, Math.ceil(S + c * 2)), A = Math.ceil(n.image.height + jn + m);
244
- return { w: b, h: A };
240
+ const u = x + v, y = Math.round(qn[n] * o / 14), C = i.richContent ? Math.min(160, Math.ceil(r * 6.5)) : 0, k = C > 0 ? 6 : 0;
241
+ if (!i.image)
242
+ return { w: Math.max(y, u), h: f + k + C };
243
+ const D = ni(i.image.width, Zn, Qn), j = Math.max(y, u, Math.ceil(D + d * 2)), Q = Math.ceil(i.image.height + _n + f + k + C);
244
+ return { w: j, h: Q };
245
245
  }
246
- function _n(n, s = {}) {
247
- const o = s.mode ?? "mindmap", i = s.preservePositions === !0, a = s.baseFontSize ?? 14, d = Ut(n, 0, null, 1, "right", a);
248
- return ti(d), ei(d, o, i), d.x = 0, d.y = 0, ni(d, i);
246
+ function oi(i, s = {}) {
247
+ const o = s.mode ?? "mindmap", n = s.preservePositions === !0, r = s.baseFontSize ?? 14, c = Kt(i, 0, null, 1, "right", r);
248
+ return ri(c), li(c, o, n), c.x = 0, c.y = 0, ai(c, n);
249
249
  }
250
- function ei(n, s, o = !1) {
250
+ function li(i, s, o = !1) {
251
251
  if (s === "mindmap") {
252
- const i = n.children;
253
- if (i.length !== 0) if (i.length === 1)
254
- i[0]._dir = "right", i[0].side = 1, i[0]._dirRight = 1;
252
+ const n = i.children;
253
+ if (n.length !== 0) if (n.length === 1)
254
+ n[0]._dir = "right", n[0].side = 1, n[0]._dirRight = 1;
255
255
  else {
256
- const x = i.reduce((p, S) => p + S._subtreeH, 0);
257
- let m = 1, h = Math.abs(i[0]._subtreeH - (x - i[0]._subtreeH)), u = 0;
258
- for (let p = 0; p < i.length - 1; p++) {
259
- u += i[p]._subtreeH;
260
- const S = Math.abs(u - (x - u));
261
- S < h && (h = S, m = p + 1);
256
+ const x = n.reduce((y, C) => y + C._subtreeH, 0);
257
+ let f = 1, v = Math.abs(n[0]._subtreeH - (x - n[0]._subtreeH)), u = 0;
258
+ for (let y = 0; y < n.length - 1; y++) {
259
+ u += n[y]._subtreeH;
260
+ const C = Math.abs(u - (x - u));
261
+ C < v && (v = C, f = y + 1);
262
262
  }
263
- for (let p = 0; p < m; p++)
264
- i[p]._dir = "right", i[p].side = 1, i[p]._dirRight = 1;
265
- for (let p = m; p < i.length; p++)
266
- i[p]._dir = "left", i[p].side = -1, i[p]._dirRight = -1;
267
- }
268
- const a = n.children.filter((x) => x.side === 1), d = n.children.filter((x) => x.side === -1), c = (x, m) => {
269
- const h = m === "right" ? 1 : -1;
270
- x._dir = m, x.side = h, x._dirRight = h;
271
- for (const u of x.children) c(u, m);
263
+ for (let y = 0; y < f; y++)
264
+ n[y]._dir = "right", n[y].side = 1, n[y]._dirRight = 1;
265
+ for (let y = f; y < n.length; y++)
266
+ n[y]._dir = "left", n[y].side = -1, n[y]._dirRight = -1;
267
+ }
268
+ const r = i.children.filter((x) => x.side === 1), c = i.children.filter((x) => x.side === -1), d = (x, f) => {
269
+ const v = f === "right" ? 1 : -1;
270
+ x._dir = f, x.side = v, x._dirRight = v;
271
+ for (const u of x.children) d(u, f);
272
272
  };
273
- for (const x of a) c(x, "right");
274
- for (const x of d) c(x, "left");
275
- if (a.length > 0) {
276
- const x = { ...n, children: a };
277
- je(x, "right", Ue, !0, o);
273
+ for (const x of r) d(x, "right");
274
+ for (const x of c) d(x, "left");
275
+ if (r.length > 0) {
276
+ const x = { ...i, children: r };
277
+ Je(x, "right", je, !0, o);
278
278
  }
279
- if (d.length > 0) {
280
- const x = { ...n, children: d };
281
- je(x, "left", Ue, !0, o);
279
+ if (c.length > 0) {
280
+ const x = { ...i, children: c };
281
+ Je(x, "left", je, !0, o);
282
282
  }
283
283
  } else if (s === "tree") {
284
- const i = (a) => {
285
- a.side = 1, a._dir = "right";
286
- for (const d of a.children) i(d);
284
+ const n = (r) => {
285
+ r.side = 1, r._dir = "right";
286
+ for (const c of r.children) n(c);
287
287
  };
288
- for (const a of n.children) a._dir = "right";
289
- je(n, "right", Ue, !0, o), i(n);
288
+ for (const r of i.children) r._dir = "right";
289
+ Je(i, "right", je, !0, o), n(i);
290
290
  } else {
291
- for (const i of n.children) i._dir = "down";
292
- Kt(n, Ue, o);
291
+ for (const n of i.children) n._dir = "down";
292
+ Yt(i, je, o);
293
293
  }
294
294
  }
295
- function je(n, s, o, i, a = !1) {
296
- if (n.children.length === 0) return;
297
- const d = n.children.reduce(
298
- (h, u, p) => h + u._subtreeH + (p > 0 ? $e : 0),
295
+ function Je(i, s, o, n, r = !1) {
296
+ if (i.children.length === 0) return;
297
+ const c = i.children.reduce(
298
+ (v, u, y) => v + u._subtreeH + (y > 0 ? We : 0),
299
299
  0
300
- ), c = s === "right" ? 1 : -1, x = i ? c : 1;
301
- let m = n.y - x * d / 2;
302
- n.children.forEach((h) => {
303
- a || (h.x = n.x + c * (n.width / 2 + o + h.width / 2), h.y = m + x * h._subtreeH / 2), h._dir = s, m += x * (h._subtreeH + $e), je(h, s, o, !1, a);
300
+ ), d = s === "right" ? 1 : -1, x = n ? d : 1;
301
+ let f = i.y - x * c / 2;
302
+ i.children.forEach((v) => {
303
+ r || (v.x = i.x + d * (i.width / 2 + o + v.width / 2), v.y = f + x * v._subtreeH / 2), v._dir = s, f += x * (v._subtreeH + We), Je(v, s, o, !1, r);
304
304
  });
305
305
  }
306
- function Kt(n, s, o = !1) {
307
- if (n.children.length === 0) return;
308
- const i = n.children.reduce(
309
- (d, c, x) => d + c._subtreeW + (x > 0 ? $e * 2 : 0),
306
+ function Yt(i, s, o = !1) {
307
+ if (i.children.length === 0) return;
308
+ const n = i.children.reduce(
309
+ (c, d, x) => c + d._subtreeW + (x > 0 ? We * 2 : 0),
310
310
  0
311
311
  );
312
- let a = n.x - i / 2;
313
- n.children.forEach((d) => {
314
- o || (d.x = a + d._subtreeW / 2, d.y = n.y + n.height / 2 + s + d.height / 2), d._dir = "down", a += d._subtreeW + $e * 2, Kt(d, s, o);
312
+ let r = i.x - n / 2;
313
+ i.children.forEach((c) => {
314
+ o || (c.x = r + c._subtreeW / 2, c.y = i.y + i.height / 2 + s + c.height / 2), c._dir = "down", r += c._subtreeW + We * 2, Yt(c, s, o);
315
315
  });
316
316
  }
317
- function Ut(n, s, o, i, a, d) {
318
- const c = Qn(n, s, d), x = {
319
- id: n.id,
320
- text: n.text,
317
+ function Kt(i, s, o, n, r, c) {
318
+ const d = ii(i, s, c), x = {
319
+ id: i.id,
320
+ text: i.text,
321
321
  depth: s,
322
322
  // Honor a user-set position from the data tree (drag commit).
323
323
  // The next applyDoLayout pass will overwrite these unless
324
324
  // preservePositions is true.
325
- x: n._x ?? 0,
326
- y: n._y ?? 0,
327
- width: c.w,
328
- height: c.h,
329
- fontSize: ft(s, d),
325
+ x: i._x ?? 0,
326
+ y: i._y ?? 0,
327
+ width: d.w,
328
+ height: d.h,
329
+ fontSize: ht(s, c),
330
330
  isRoot: s === 0,
331
- collapsed: n.collapsed,
332
- side: i,
333
- _dir: a,
334
- _dirRight: i,
335
- _subtreeH: c.h,
336
- _subtreeW: c.w,
337
- image: n.image ? { ...n.image } : void 0,
338
- link: n.link ? { url: n.link.url } : void 0,
339
- note: n.note ? { text: n.note.text } : void 0,
331
+ collapsed: i.collapsed,
332
+ side: n,
333
+ _dir: r,
334
+ _dirRight: n,
335
+ _subtreeH: d.h,
336
+ _subtreeW: d.w,
337
+ image: i.image ? { ...i.image } : void 0,
338
+ link: i.link ? { url: i.link.url } : void 0,
339
+ note: i.note ? { text: i.note.text } : void 0,
340
+ richContent: i.richContent ? { kind: i.richContent.kind, raw: i.richContent.raw, lang: i.richContent.lang } : void 0,
340
341
  children: [],
341
342
  parent: o
342
343
  };
343
- if (n.collapsed) return x;
344
- const m = n.children.length, h = Math.ceil(m / 2);
345
- return x.children = n.children.map((u, p) => {
346
- const S = s === 0 ? p < h ? 1 : -1 : i;
347
- return Ut(u, s + 1, x, S, a, d);
344
+ if (i.collapsed) return x;
345
+ const f = i.children.length, v = Math.ceil(f / 2);
346
+ return x.children = i.children.map((u, y) => {
347
+ const C = s === 0 ? y < v ? 1 : -1 : n;
348
+ return Kt(u, s + 1, x, C, r, c);
348
349
  }), x;
349
350
  }
350
- function ti(n) {
351
- const s = [n];
351
+ function ri(i) {
352
+ const s = [i];
352
353
  for (let o = 0; o < s.length; o++) {
353
- const i = s[o];
354
- for (const a of i.children) s.push(a);
354
+ const n = s[o];
355
+ for (const r of n.children) s.push(r);
355
356
  }
356
357
  for (let o = s.length - 1; o >= 0; o--) {
357
- const i = s[o];
358
- if (i.collapsed || i.children.length === 0) {
359
- i._subtreeH = i.height, i._subtreeW = i.width;
358
+ const n = s[o];
359
+ if (n.collapsed || n.children.length === 0) {
360
+ n._subtreeH = n.height, n._subtreeW = n.width;
360
361
  continue;
361
362
  }
362
- let a = 0, d = 0;
363
- for (const c of i.children)
364
- a += c._subtreeH, d += c._subtreeW;
365
- i.children.length > 1 && (a += $e * (i.children.length - 1), d += $e * 2 * (i.children.length - 1)), i._subtreeH = Math.max(i.height, a), i._subtreeW = Math.max(i.width, d);
363
+ let r = 0, c = 0;
364
+ for (const d of n.children)
365
+ r += d._subtreeH, c += d._subtreeW;
366
+ n.children.length > 1 && (r += We * (n.children.length - 1), c += We * 2 * (n.children.length - 1)), n._subtreeH = Math.max(n.height, r), n._subtreeW = Math.max(n.width, c);
366
367
  }
367
368
  }
368
- function ni(n, s = !1) {
369
- const o = [n];
370
- let i = 1 / 0, a = -1 / 0, d = 1 / 0, c = -1 / 0;
369
+ function ai(i, s = !1) {
370
+ const o = [i];
371
+ let n = 1 / 0, r = -1 / 0, c = 1 / 0, d = -1 / 0;
371
372
  for (; o.length; ) {
372
- const h = o.pop(), u = h.width / 2, p = h.height / 2;
373
- h.x - u < i && (i = h.x - u), h.x + u > a && (a = h.x + u), h.y - p < d && (d = h.y - p), h.y + p > c && (c = h.y + p), o.push(...h.children);
373
+ const v = o.pop(), u = v.width / 2, y = v.height / 2;
374
+ v.x - u < n && (n = v.x - u), v.x + u > r && (r = v.x + u), v.y - y < c && (c = v.y - y), v.y + y > d && (d = v.y + y), o.push(...v.children);
374
375
  }
375
376
  if (s)
376
377
  return {
377
- root: n,
378
- width: a - i + te * 2,
379
- height: c - d + te * 2,
380
- vbX: i - te,
381
- vbY: d - te,
382
- vbW: a - i + te * 2,
383
- vbH: c - d + te * 2
378
+ root: i,
379
+ width: r - n + oe * 2,
380
+ height: d - c + oe * 2,
381
+ vbX: n - oe,
382
+ vbY: c - oe,
383
+ vbW: r - n + oe * 2,
384
+ vbH: d - c + oe * 2
384
385
  };
385
- const x = te - d, m = [n];
386
- for (; m.length; ) {
387
- const h = m.pop();
388
- h.y += x, m.push(...h.children);
386
+ const x = oe - c, f = [i];
387
+ for (; f.length; ) {
388
+ const v = f.pop();
389
+ v.y += x, f.push(...v.children);
389
390
  }
390
- return d += x, c += x, {
391
- root: n,
392
- width: a - i + te * 2,
393
- height: c + te,
394
- vbX: i - te,
391
+ return c += x, d += x, {
392
+ root: i,
393
+ width: r - n + oe * 2,
394
+ height: d + oe,
395
+ vbX: n - oe,
395
396
  vbY: 0,
396
- vbW: a - i + te * 2,
397
- vbH: c + te
397
+ vbW: r - n + oe * 2,
398
+ vbH: d + oe
398
399
  };
399
400
  }
400
- const Pe = [
401
+ const Te = [
401
402
  {
402
403
  id: "default",
403
404
  name: "默认",
@@ -469,344 +470,462 @@ const Pe = [
469
470
  ]
470
471
  }
471
472
  ];
472
- function ii(n, s = []) {
473
- return [...Pe, ...s].find((i) => i.id === n) ?? Pe[0];
473
+ function si(i, s = []) {
474
+ return [...Te, ...s].find((n) => n.id === i) ?? Te[0];
474
475
  }
475
- function we() {
476
+ function ce() {
476
477
  return "n_" + Math.random().toString(36).slice(2, 10) + Date.now().toString(36).slice(-4);
477
478
  }
478
- function he(n) {
479
- return JSON.parse(JSON.stringify(n));
479
+ function ye(i) {
480
+ return JSON.parse(JSON.stringify(i));
480
481
  }
481
- function B(n, s) {
482
- if (n.id === s) return n;
483
- for (const o of n.children) {
484
- const i = B(o, s);
485
- if (i) return i;
482
+ function A(i, s) {
483
+ if (i.id === s) return i;
484
+ for (const o of i.children) {
485
+ const n = A(o, s);
486
+ if (n) return n;
486
487
  }
487
488
  return null;
488
489
  }
489
- function ae(n, s, o = null) {
490
- if (n.id === s) return o;
491
- for (const i of n.children) {
492
- const a = ae(i, s, n);
493
- if (a !== null) return a;
490
+ function de(i, s, o = null) {
491
+ if (i.id === s) return o;
492
+ for (const n of i.children) {
493
+ const r = de(n, s, i);
494
+ if (r !== null) return r;
494
495
  }
495
496
  return null;
496
497
  }
497
- function Gt(n, s) {
498
- const o = n.children.findIndex((i) => i.id === s);
498
+ function jt(i, s) {
499
+ const o = i.children.findIndex((n) => n.id === s);
499
500
  if (o >= 0)
500
- return n.children.splice(o, 1), !0;
501
- for (const i of n.children)
502
- if (Gt(i, s)) return !0;
501
+ return i.children.splice(o, 1), !0;
502
+ for (const n of i.children)
503
+ if (jt(n, s)) return !0;
503
504
  return !1;
504
505
  }
505
- function oi(n, s, o) {
506
- const i = B(n, s);
507
- return !i || i.text === o ? !1 : (i.text = o, !0);
506
+ function ui(i, s, o) {
507
+ const n = A(i, s);
508
+ return !n || n.text === o ? !1 : (n.text = o, !0);
508
509
  }
509
- function li(n, s, o, i) {
510
- if (!ae(n, s) || s === o || B(B(n, s), o)) return !1;
511
- const a = ae(n, s), d = a.children.findIndex((h) => h.id === s);
512
- if (d < 0) return !1;
513
- const [c] = a.children.splice(d, 1);
514
- if (i === "child") {
515
- const h = B(n, o);
516
- return h ? (h.children.push(c), !0) : (a.children.splice(d, 0, c), !1);
510
+ function ci(i, s, o, n) {
511
+ if (!de(i, s) || s === o || A(A(i, s), o)) return !1;
512
+ const r = de(i, s), c = r.children.findIndex((v) => v.id === s);
513
+ if (c < 0) return !1;
514
+ const [d] = r.children.splice(c, 1);
515
+ if (n === "child") {
516
+ const v = A(i, o);
517
+ return v ? (v.children.push(d), !0) : (r.children.splice(c, 0, d), !1);
517
518
  }
518
- const x = ae(n, o);
519
+ const x = de(i, o);
519
520
  if (!x)
520
- return a.children.splice(d, 0, c), !1;
521
- let m = x.children.findIndex((h) => h.id === o);
522
- return m < 0 ? (a.children.splice(d, 0, c), !1) : (i === "after" && (m += 1), x.children.splice(m, 0, c), !0);
521
+ return r.children.splice(c, 0, d), !1;
522
+ let f = x.children.findIndex((v) => v.id === o);
523
+ return f < 0 ? (r.children.splice(c, 0, d), !1) : (n === "after" && (f += 1), x.children.splice(f, 0, d), !0);
523
524
  }
524
- function jt(n) {
525
+ function Gt(i) {
525
526
  const s = /^新节点(?:\s+(\d+))?$/;
526
- let o = 0, i = !1;
527
- for (const a of n.children) {
528
- const d = a.text.match(s);
529
- if (d)
530
- if (d[1]) {
531
- const c = parseInt(d[1], 10);
532
- c > o && (o = c);
527
+ let o = 0, n = !1;
528
+ for (const r of i.children) {
529
+ const c = r.text.match(s);
530
+ if (c)
531
+ if (c[1]) {
532
+ const d = parseInt(c[1], 10);
533
+ d > o && (o = d);
533
534
  } else
534
- i = !0;
535
+ n = !0;
535
536
  }
536
- return o === 0 && !i ? Je : o > 0 ? `新节点 ${o + 1}` : "新节点 2";
537
+ return o === 0 && !n ? Ze : o > 0 ? `新节点 ${o + 1}` : "新节点 2";
537
538
  }
538
- function ri(n, s, o) {
539
- const i = B(n, s);
540
- if (!i) return null;
541
- const a = { id: we(), text: o ?? jt(i), children: [] };
542
- return i.children.push(a), a;
539
+ function di(i, s, o) {
540
+ const n = A(i, s);
541
+ if (!n) return null;
542
+ const r = { id: ce(), text: o ?? Gt(n), children: [] };
543
+ return n.children.push(r), r;
543
544
  }
544
- function ai(n, s, o) {
545
- const i = ae(n, s);
546
- if (!i) return null;
547
- const a = i.children.findIndex((c) => c.id === s);
548
- if (a < 0) return null;
549
- const d = { id: we(), text: o ?? jt(i), children: [] };
550
- return i.children.splice(a + 1, 0, d), d;
545
+ function fi(i, s, o) {
546
+ const n = de(i, s);
547
+ if (!n) return null;
548
+ const r = n.children.findIndex((d) => d.id === s);
549
+ if (r < 0) return null;
550
+ const c = { id: ce(), text: o ?? Gt(n), children: [] };
551
+ return n.children.splice(r + 1, 0, c), c;
551
552
  }
552
- function ui(n, s, o) {
553
- const i = ae(n, s);
554
- if (!i) return null;
555
- const a = i.children.findIndex((c) => c.id === s);
556
- if (a < 0) return null;
557
- const d = { id: we(), text: o, children: [] };
558
- return i.children.splice(a, 0, d), d;
553
+ function hi(i, s, o) {
554
+ const n = de(i, s);
555
+ if (!n) return null;
556
+ const r = n.children.findIndex((d) => d.id === s);
557
+ if (r < 0) return null;
558
+ const c = { id: ce(), text: o, children: [] };
559
+ return n.children.splice(r, 0, c), c;
559
560
  }
560
- function si(n, s) {
561
- const o = ae(n, s);
561
+ function vi(i, s) {
562
+ const o = de(i, s);
562
563
  if (!o) return null;
563
- const i = o.children.findIndex((c) => c.id === s);
564
- if (i < 0) return null;
565
- const a = o.children[i], d = he(a);
566
- return Jt(d), o.children.splice(i + 1, 0, d), d;
564
+ const n = o.children.findIndex((d) => d.id === s);
565
+ if (n < 0) return null;
566
+ const r = o.children[n], c = ye(r);
567
+ return Jt(c), o.children.splice(n + 1, 0, c), c;
567
568
  }
568
- function Jt(n) {
569
- n.id = we();
570
- for (const s of n.children) Jt(s);
569
+ function Jt(i) {
570
+ i.id = ce();
571
+ for (const s of i.children) Jt(s);
571
572
  }
572
- const Je = "新节点";
573
- function Xt(n, s = "导入的导图") {
574
- const o = n.split(/\r?\n/), i = { id: we(), text: s, children: [] }, a = [i], d = [-1 / 0], c = [], x = /^(#{1,6})\s+(.+?)\s*#*\s*$/, m = /^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/, h = /^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/, u = /^(`{3,}|~{3,})\s*(\S+)?\s*$/;
575
- let p = !1, S = [], b = null;
576
- function A(w) {
577
- S.push(w);
573
+ const Ze = "新节点";
574
+ function Xt(i, s = "导入的导图") {
575
+ const o = i.split(/\r?\n/), n = { id: ce(), text: s, children: [] }, r = [n], c = [-1 / 0], d = [], x = /^(#{1,6})\s+(.+?)\s*#*\s*$/, f = /^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/, v = /^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/, u = /^(`{3,}|~{3,})\s*(\S+)?\s*$/;
576
+ let y = !1, C = [], k = null;
577
+ function D(M) {
578
+ C.push(M);
578
579
  }
579
- function U() {
580
- if (b && S.length > 0) {
581
- for (; S.length > 0 && S[0].trim() === ""; ) S.shift();
582
- for (; S.length > 0 && S[S.length - 1].trim() === ""; ) S.pop();
583
- const w = S.join(`
580
+ function j() {
581
+ if (k && C.length > 0) {
582
+ for (; C.length > 0 && C[0].trim() === ""; ) C.shift();
583
+ for (; C.length > 0 && C[C.length - 1].trim() === ""; ) C.pop();
584
+ const M = C.join(`
584
585
  `);
585
- w && (b.note = { text: w });
586
+ M && (k.note = { text: M });
586
587
  }
587
- p = !1, S = [];
588
+ y = !1, C = [];
588
589
  }
589
- for (const w of o) {
590
- if (p) {
591
- const Y = w.match(u);
592
- if (Y && Y[1][0] === "`") {
593
- U();
590
+ for (const M of o) {
591
+ if (y) {
592
+ const V = M.match(u);
593
+ if (V && V[1][0] === "`") {
594
+ j();
594
595
  continue;
595
596
  }
596
- A(w);
597
+ D(M);
597
598
  continue;
598
599
  }
599
- const G = w.match(x);
600
- if (G) {
601
- const Y = G[1].length, re = G[2].trim();
602
- c.push({ level: Y, text: re, body: "" }), b = c[c.length - 1];
600
+ const z = M.match(x);
601
+ if (z) {
602
+ const V = z[1].length, ue = z[2].trim();
603
+ d.push({ level: V, text: ue, body: "" }), k = d[d.length - 1];
603
604
  continue;
604
605
  }
605
- const q = w.match(u);
606
- if (q && q[2] === "note") {
607
- p = !0, S = [];
606
+ const L = M.match(u);
607
+ if (L && L[2] === "note") {
608
+ y = !0, C = [];
608
609
  continue;
609
610
  }
610
- const T = w.match(m);
611
- if (T && b) {
612
- const Y = T[2], re = 160, me = 120;
613
- b.image = { src: Y, naturalW: re, naturalH: me, width: re, height: me };
611
+ const R = M.match(f);
612
+ if (R && k) {
613
+ const V = R[2], ue = 160, xe = 120;
614
+ k.image = { src: V, naturalW: ue, naturalH: xe, width: ue, height: xe };
614
615
  continue;
615
616
  }
616
- const le = w.match(h);
617
- if (le && b) {
618
- b.link = { url: le[2] }, b.text = le[1];
617
+ const Z = M.match(v);
618
+ if (Z && k) {
619
+ k.link = { url: Z[2] }, k.text = Z[1];
619
620
  continue;
620
621
  }
621
- w.trim().length > 0 && b && (b.body = b.body ? b.body + " " + w.trim() : w.trim());
622
+ M.trim().length > 0 && k && (k.body = k.body ? k.body + " " + M.trim() : M.trim());
622
623
  }
623
- p && U();
624
- function ce(w) {
625
- for (; a.length > 1; ) {
626
- const le = a.length - 1, Y = d[le];
627
- if (Y !== void 0 && Y < w.level) break;
628
- a.pop(), d.pop();
629
- }
630
- const G = a[a.length - 1], q = w.text, T = { id: we(), text: q, children: [] };
631
- w.image && (T.image = { ...w.image }), w.link && (T.link = { url: w.link.url }), w.note && (T.note = { text: w.note.text }), w.body && ue(w, c, c.indexOf(w)) && T.children.push({ id: we(), text: w.body, children: [] }), G.children.push(T), a.push(T), d.push(w.level);
624
+ y && j();
625
+ function Q(M) {
626
+ for (; r.length > 1; ) {
627
+ const Z = r.length - 1, V = c[Z];
628
+ if (V !== void 0 && V < M.level) break;
629
+ r.pop(), c.pop();
630
+ }
631
+ const z = r[r.length - 1], L = M.text, R = { id: ce(), text: L, children: [] };
632
+ M.image && (R.image = { ...M.image }), M.link && (R.link = { url: M.link.url }), M.note && (R.note = { text: M.note.text }), M.body && K(M, d, d.indexOf(M)) && R.children.push({ id: ce(), text: M.body, children: [] }), z.children.push(R), r.push(R), c.push(M.level);
632
633
  }
633
- function ue(w, G, q) {
634
- for (let T = q + 1; T < G.length; T++) {
635
- if (G[T].level <= w.level) return !0;
636
- if (G[T].level > w.level) return !1;
634
+ function K(M, z, L) {
635
+ for (let R = L + 1; R < z.length; R++) {
636
+ if (z[R].level <= M.level) return !0;
637
+ if (z[R].level > M.level) return !1;
637
638
  }
638
639
  return !0;
639
640
  }
640
- for (const w of c) ce(w);
641
- if (c.length > 0 && c[0].level === 1) {
642
- const w = i.children[0];
643
- w && (i.text = w.text, i.id = w.id, w.image && (i.image = { ...w.image }), w.link && (i.link = { url: w.link.url }), w.note && (i.note = { text: w.note.text }), i.children = w.children);
641
+ for (const M of d) Q(M);
642
+ if (d.length > 0 && d[0].level === 1) {
643
+ const M = n.children[0];
644
+ M && (n.text = M.text, n.id = M.id, M.image && (n.image = { ...M.image }), M.link && (n.link = { url: M.link.url }), M.note && (n.note = { text: M.note.text }), n.children = M.children);
644
645
  }
645
- return i;
646
+ return n;
646
647
  }
647
- function st(n, s = 1) {
648
- let o = "#".repeat(s) + " " + (n.text || "") + `
648
+ function ct(i, s = 1) {
649
+ let o = "#".repeat(s) + " " + (i.text || "") + `
649
650
  `;
650
- n.link && (o += `[${n.text || "link"}](${n.link.url})
651
- `), n.image && (o += `![image](${n.image.src})
652
- `), n.note && (o += "```note\n" + n.note.text + "\n```\n");
653
- for (const i of n.children) o += st(i, s + 1);
651
+ i.link && (o += `[${i.text || "link"}](${i.link.url})
652
+ `), i.image && (o += `![image](${i.image.src})
653
+ `), i.note && (o += "```note\n" + i.note.text + "\n```\n"), i.richContent && (o += i.richContent.raw + `
654
+ `);
655
+ for (const n of i.children) o += ct(n, s + 1);
654
656
  return o;
655
657
  }
656
- function di(n) {
657
- const s = n.minScale ?? 0.2, o = n.maxScale ?? 3, i = n.step ?? 1.2, a = D(1), d = D(0), c = D(0), x = D(!1), m = Ge({
658
+ function mi(i) {
659
+ var v, u;
660
+ const s = i.split(/\r?\n/), o = [];
661
+ let n = 0;
662
+ const r = /^(#{1,6})\s+(.+?)\s*#*\s*$/, c = /^(`{3,}|~{3,})\s*(\S+)?\s*$/, d = /^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/, x = /^(\s*)[-*+]\s+(.*)$/, f = /^(\s*)\d+\.\s+(.*)$/;
663
+ for (; n < s.length; ) {
664
+ const y = s[n], C = y.match(c);
665
+ if (C) {
666
+ const z = C[1][0], L = C[2] || "", R = [y];
667
+ for (n++; n < s.length; ) {
668
+ const V = s[n].match(c);
669
+ if (V && V[1][0] === z) {
670
+ R.push(s[n]), n++;
671
+ break;
672
+ }
673
+ R.push(s[n]), n++;
674
+ }
675
+ const Z = R.slice(1, -1).join(`
676
+ `).trim();
677
+ o.push({
678
+ kind: "code",
679
+ text: ((v = Z.split(`
680
+ `)[0]) == null ? void 0 : v.slice(0, 80)) || "(空代码块)",
681
+ raw: R.join(`
682
+ `),
683
+ lang: L
684
+ });
685
+ continue;
686
+ }
687
+ const k = y.match(r);
688
+ if (k) {
689
+ o.push({ kind: "heading", level: k[1].length, text: k[2].trim(), raw: y }), n++;
690
+ continue;
691
+ }
692
+ if (/^\s*\|/.test(y)) {
693
+ const z = [];
694
+ let L = n, R = !1;
695
+ for (; L < s.length && /^\s*\|/.test(s[L]); )
696
+ z.push(s[L]), d.test(s[L]) && (R = !0), L++;
697
+ if (R && z.length >= 2) {
698
+ o.push({
699
+ kind: "table",
700
+ text: ((u = z[0].replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|")[0]) == null ? void 0 : u.trim()) || "表格",
701
+ raw: z.join(`
702
+ `)
703
+ }), n = L;
704
+ continue;
705
+ }
706
+ }
707
+ const D = y.match(x), j = y.match(f);
708
+ if (D || j) {
709
+ let z = n;
710
+ for (; z < s.length; ) {
711
+ const L = s[z].match(x), R = s[z].match(f);
712
+ if (!(L || R)) break;
713
+ const Z = s[z].replace(/^\s*[-*+]\s+/, "").replace(/^\s*\d+\.\s+/, "").trim();
714
+ Z.length > 0 && o.push({
715
+ kind: "list",
716
+ text: Z.slice(0, 80) || "(列表项)",
717
+ raw: s[z]
718
+ }), z++;
719
+ }
720
+ n = z;
721
+ continue;
722
+ }
723
+ if (y.trim() === "") {
724
+ n++;
725
+ continue;
726
+ }
727
+ const Q = [y];
728
+ let K = n + 1;
729
+ for (; K < s.length; ) {
730
+ const z = s[K];
731
+ if (z.trim() === "" || r.test(z) || c.test(z) || x.test(z) || f.test(z) || /^\s*\|/.test(z)) break;
732
+ Q.push(z), K++;
733
+ }
734
+ const M = Q.join(" ").trim();
735
+ o.push({
736
+ kind: "paragraph",
737
+ text: M.slice(0, 80) || "(空段落)",
738
+ raw: Q.join(`
739
+ `)
740
+ }), n = K;
741
+ }
742
+ return o;
743
+ }
744
+ function Zi(i, s = "导入的导图") {
745
+ const o = mi(i || ""), n = { id: ce(), text: s, children: [] }, r = [n], c = [0];
746
+ let d = !1;
747
+ function x(f) {
748
+ if (f.kind === "heading") {
749
+ const u = f.level;
750
+ for (; r.length > 1 && c[c.length - 1] >= u; )
751
+ r.pop(), c.pop();
752
+ if (!d && u === 1) {
753
+ d = !0, n.text = f.text, c[0] = 1;
754
+ return;
755
+ }
756
+ const y = { id: ce(), text: f.text, children: [] };
757
+ r[r.length - 1].children.push(y), r.push(y), c.push(u);
758
+ return;
759
+ }
760
+ const v = {
761
+ id: ce(),
762
+ text: f.text,
763
+ children: [],
764
+ richContent: { kind: f.kind, raw: f.raw, lang: f.lang }
765
+ };
766
+ r[r.length - 1].children.push(v);
767
+ }
768
+ for (const f of o) x(f);
769
+ return n;
770
+ }
771
+ function Qi(i) {
772
+ return i.richContent ? i.richContent.raw + `
773
+ ` : "";
774
+ }
775
+ function gi(i) {
776
+ const s = i.minScale ?? 0.2, o = i.maxScale ?? 3, n = i.step ?? 1.2, r = F(1), c = F(0), d = F(0), x = F(!1), f = Ge({
658
777
  x: 0,
659
778
  y: 0,
660
779
  ox: 0,
661
780
  oy: 0
662
- }), h = D(!1), u = Ge({ x: 0, y: 0 }), p = Ge({ x: 0, y: 0, width: 0, height: 0 }), S = D(0);
663
- let b = null;
664
- function A(I) {
665
- b = I;
781
+ }), v = F(!1), u = Ge({ x: 0, y: 0 }), y = Ge({ x: 0, y: 0, width: 0, height: 0 }), C = F(0);
782
+ let k = null;
783
+ function D(W) {
784
+ k = W;
666
785
  }
667
- function U(I) {
668
- I.preventDefault();
669
- const W = n.getContainer();
670
- if (!W) return;
671
- const j = -I.deltaY * 1e-3, _ = Math.min(o, Math.max(s, a.value * (1 + j))), ne = W.getBoundingClientRect(), ie = I.clientX - ne.left, ke = I.clientY - ne.top, Be = (ie - d.value) / a.value, Me = (ke - c.value) / a.value;
672
- a.value = _, d.value = ie - Be * _, c.value = ke - Me * _;
786
+ function j(W) {
787
+ W.preventDefault();
788
+ const B = i.getContainer();
789
+ if (!B) return;
790
+ const _ = -W.deltaY * 1e-3, ne = Math.min(o, Math.max(s, r.value * (1 + _))), le = B.getBoundingClientRect(), re = W.clientX - le.left, Me = W.clientY - le.top, Re = (re - c.value) / r.value, Ce = (Me - d.value) / r.value;
791
+ r.value = ne, c.value = re - Re * ne, d.value = Me - Ce * ne;
673
792
  }
674
- function ce() {
675
- a.value = Math.min(o, a.value * i);
793
+ function Q() {
794
+ r.value = Math.min(o, r.value * n);
676
795
  }
677
- function ue() {
678
- a.value = Math.max(s, a.value / i);
796
+ function K() {
797
+ r.value = Math.max(s, r.value / n);
679
798
  }
680
- function w(I) {
681
- var j;
682
- I.target.closest(".zm-node, .zm-toolbar, button, input, textarea") || (x.value = !0, m.x = I.clientX, m.y = I.clientY, m.ox = d.value, m.oy = c.value, window.addEventListener("mousemove", G), window.addEventListener("mouseup", q), (j = I.preventDefault) == null || j.call(I));
799
+ function M(W) {
800
+ var _;
801
+ W.target.closest(".zm-node, .zm-toolbar, button, input, textarea") || (x.value = !0, f.x = W.clientX, f.y = W.clientY, f.ox = c.value, f.oy = d.value, window.addEventListener("mousemove", z), window.addEventListener("mouseup", L), (_ = W.preventDefault) == null || _.call(W));
683
802
  }
684
- function G(I) {
685
- x.value && (d.value = m.ox + (I.clientX - m.x), c.value = m.oy + (I.clientY - m.y));
803
+ function z(W) {
804
+ x.value && (c.value = f.ox + (W.clientX - f.x), d.value = f.oy + (W.clientY - f.y));
686
805
  }
687
- function q() {
688
- x.value = !1, window.removeEventListener("mousemove", G), window.removeEventListener("mouseup", q);
806
+ function L() {
807
+ x.value = !1, window.removeEventListener("mousemove", z), window.removeEventListener("mouseup", L);
689
808
  }
690
- function T(I, W) {
691
- h.value = !0, u.x = I, u.y = W, p.x = I, p.y = W, p.width = 0, p.height = 0, S.value++, window.addEventListener("mousemove", re), window.addEventListener("mouseup", Y);
809
+ function R(W, B) {
810
+ v.value = !0, u.x = W, u.y = B, y.x = W, y.y = B, y.width = 0, y.height = 0, C.value++, window.addEventListener("mousemove", ue), window.addEventListener("mouseup", V);
692
811
  }
693
- function le(I, W) {
694
- if (!h.value) return;
695
- const j = Math.min(u.x, I), _ = Math.min(u.y, W), ne = Math.max(u.x, I), ie = Math.max(u.y, W);
696
- p.x = j, p.y = _, p.width = ne - j, p.height = ie - _, S.value++;
812
+ function Z(W, B) {
813
+ if (!v.value) return;
814
+ const _ = Math.min(u.x, W), ne = Math.min(u.y, B), le = Math.max(u.x, W), re = Math.max(u.y, B);
815
+ y.x = _, y.y = ne, y.width = le - _, y.height = re - ne, C.value++;
697
816
  }
698
- function Y() {
699
- h.value = !1, window.removeEventListener("mousemove", re), window.removeEventListener("mouseup", Y), b && b();
817
+ function V() {
818
+ v.value = !1, window.removeEventListener("mousemove", ue), window.removeEventListener("mouseup", V), k && k();
700
819
  }
701
- function re(I) {
702
- if (!h.value) return;
703
- const W = n.getContainer();
704
- if (!W) return;
705
- const j = W.getBoundingClientRect(), _ = (I.clientX - j.left - d.value) / a.value, ne = (I.clientY - j.top - c.value) / a.value;
706
- le(_, ne);
820
+ function ue(W) {
821
+ if (!v.value) return;
822
+ const B = i.getContainer();
823
+ if (!B) return;
824
+ const _ = B.getBoundingClientRect(), ne = (W.clientX - _.left - c.value) / r.value, le = (W.clientY - _.top - d.value) / r.value;
825
+ Z(ne, le);
707
826
  }
708
- function me(I, W, j, _ = 60) {
709
- const ne = n.getContainer();
710
- if (!ne) return;
711
- const ie = ne.getBoundingClientRect(), ke = (ie.width - _ * 2) / I, Be = (ie.height - _ * 2) / W, Me = Math.min(1, Math.max(0.3, Math.min(ke, Be)));
712
- a.value = Me, d.value = ie.width / 2, c.value = ie.height / 2 - j * Me;
827
+ function xe(W, B, _, ne = 60) {
828
+ const le = i.getContainer();
829
+ if (!le) return;
830
+ const re = le.getBoundingClientRect(), Me = (re.width - ne * 2) / W, Re = (re.height - ne * 2) / B, Ce = Math.min(1, Math.max(0.3, Math.min(Me, Re)));
831
+ r.value = Ce, c.value = re.width / 2, d.value = re.height / 2 - _ * Ce;
713
832
  }
714
833
  return {
715
- scale: a,
716
- offsetX: d,
717
- offsetY: c,
834
+ scale: r,
835
+ offsetX: c,
836
+ offsetY: d,
718
837
  isPanning: x,
719
- onWheel: U,
720
- zoomIn: ce,
721
- zoomOut: ue,
722
- startPan: w,
723
- startMarquee: T,
724
- updateMarquee: le,
725
- isMarquee: h,
726
- marquee: p,
727
- marqueeVersion: S,
728
- setOnMarqueeEnd: A,
729
- resetView: me
838
+ onWheel: j,
839
+ zoomIn: Q,
840
+ zoomOut: K,
841
+ startPan: M,
842
+ startMarquee: R,
843
+ updateMarquee: Z,
844
+ isMarquee: v,
845
+ marquee: y,
846
+ marqueeVersion: C,
847
+ setOnMarqueeEnd: D,
848
+ resetView: xe
730
849
  };
731
850
  }
732
- const ci = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
733
- function qt(n) {
734
- return ci ? n.metaKey : n.ctrlKey;
851
+ const yi = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
852
+ function qt(i) {
853
+ return yi ? i.metaKey : i.ctrlKey;
735
854
  }
736
- function fi(n) {
855
+ function xi(i) {
737
856
  function s() {
738
- const i = n.getSelectedId();
739
- return i || (n.defaultTargetId ? n.defaultTargetId() : n.getRootId());
857
+ const n = i.getSelectedId();
858
+ return n || (i.defaultTargetId ? i.defaultTargetId() : i.getRootId());
740
859
  }
741
- function o(i) {
742
- const a = i.target;
743
- if (a && (a.tagName === "INPUT" || a.tagName === "TEXTAREA" || a.isContentEditable) || n.isReadonly() || n.isEditing()) return;
744
- const d = n.getSelectedId(), c = s();
745
- if (c) {
746
- if (qt(i) && !i.shiftKey) {
747
- if (i.key === "d" || i.key === "D") {
748
- d && d !== n.getRootId() && (i.preventDefault(), n.onDuplicate(d));
860
+ function o(n) {
861
+ const r = n.target;
862
+ if (r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.isContentEditable) || i.isReadonly() || i.isEditing()) return;
863
+ const c = i.getSelectedId(), d = s();
864
+ if (d) {
865
+ if (qt(n) && !n.shiftKey) {
866
+ if (n.key === "d" || n.key === "D") {
867
+ c && c !== i.getRootId() && (n.preventDefault(), i.onDuplicate(c));
749
868
  return;
750
869
  }
751
- if (i.key === "z" || i.key === "Z") {
752
- i.preventDefault(), n.onUndo();
870
+ if (n.key === "z" || n.key === "Z") {
871
+ n.preventDefault(), i.onUndo();
753
872
  return;
754
873
  }
755
- if (i.key === "y" || i.key === "Y") {
756
- i.preventDefault(), n.onRedo();
874
+ if (n.key === "y" || n.key === "Y") {
875
+ n.preventDefault(), i.onRedo();
757
876
  return;
758
877
  }
759
- if (i.key === "Home") {
760
- i.preventDefault(), n.onSelectRoot();
878
+ if (n.key === "Home") {
879
+ n.preventDefault(), i.onSelectRoot();
761
880
  return;
762
881
  }
763
882
  }
764
- if (qt(i) && i.shiftKey && (i.key === "Z" || i.key === "z")) {
765
- i.preventDefault(), n.onRedo();
883
+ if (qt(n) && n.shiftKey && (n.key === "Z" || n.key === "z")) {
884
+ n.preventDefault(), i.onRedo();
766
885
  return;
767
886
  }
768
- i.key === "Tab" ? (i.preventDefault(), n.onAddChild(c)) : i.key === "Enter" ? (i.preventDefault(), i.shiftKey ? d && d !== n.getRootId() && n.onAddSiblingBefore(d) : n.onAddSibling(c)) : (i.key === "Delete" || i.key === "Backspace") && d && d !== n.getRootId() ? (i.preventDefault(), n.onRemove(d)) : i.key === "F2" && d ? (i.preventDefault(), n.onStartEdit(d)) : i.key === "Escape" ? (i.preventDefault(), n.onClearSelection()) : i.key === "ArrowDown" ? (i.preventDefault(), n.onNavigate(0, 1)) : i.key === "ArrowUp" ? (i.preventDefault(), n.onNavigate(0, -1)) : i.key === "ArrowRight" ? (i.preventDefault(), n.onNavigate(1, 0)) : i.key === "ArrowLeft" && (i.preventDefault(), n.onNavigate(-1, 0));
887
+ n.key === "Tab" ? (n.preventDefault(), i.onAddChild(d)) : n.key === "Enter" ? (n.preventDefault(), n.shiftKey ? c && c !== i.getRootId() && i.onAddSiblingBefore(c) : i.onAddSibling(d)) : (n.key === "Delete" || n.key === "Backspace") && c && c !== i.getRootId() ? (n.preventDefault(), i.onRemove(c)) : n.key === "F2" && c ? (n.preventDefault(), i.onStartEdit(c)) : n.key === "Escape" ? (n.preventDefault(), i.onClearSelection()) : n.key === "ArrowDown" ? (n.preventDefault(), i.onNavigate(0, 1)) : n.key === "ArrowUp" ? (n.preventDefault(), i.onNavigate(0, -1)) : n.key === "ArrowRight" ? (n.preventDefault(), i.onNavigate(1, 0)) : n.key === "ArrowLeft" && (n.preventDefault(), i.onNavigate(-1, 0));
769
888
  }
770
889
  }
771
890
  ut(() => {
772
891
  window.addEventListener("keydown", o);
773
- }), ct(() => {
892
+ }), ft(() => {
774
893
  window.removeEventListener("keydown", o);
775
894
  });
776
895
  }
777
- function vi(n = 100) {
778
- const s = D([]);
896
+ function pi(i = 100) {
897
+ const s = F([]);
779
898
  let o = -1;
780
- function i() {
899
+ function n() {
781
900
  return o > 0;
782
901
  }
783
- function a() {
902
+ function r() {
784
903
  return o < s.value.length - 1;
785
904
  }
786
- function d(h) {
787
- const u = JSON.stringify(h);
788
- for (o < s.value.length - 1 && (s.value = s.value.slice(0, o + 1)), s.value.push(u), o = s.value.length - 1; s.value.length > n; )
905
+ function c(v) {
906
+ const u = JSON.stringify(v);
907
+ for (o < s.value.length - 1 && (s.value = s.value.slice(0, o + 1)), s.value.push(u), o = s.value.length - 1; s.value.length > i; )
789
908
  s.value.shift(), o--;
790
909
  }
791
- function c() {
792
- return i() ? (o--, JSON.parse(s.value[o])) : null;
910
+ function d() {
911
+ return n() ? (o--, JSON.parse(s.value[o])) : null;
793
912
  }
794
913
  function x() {
795
- return a() ? (o++, JSON.parse(s.value[o])) : null;
914
+ return r() ? (o++, JSON.parse(s.value[o])) : null;
796
915
  }
797
- function m() {
916
+ function f() {
798
917
  s.value = [], o = -1;
799
918
  }
800
919
  return {
801
- canUndo: i,
802
- canRedo: a,
803
- record: d,
804
- undo: c,
920
+ canUndo: n,
921
+ canRedo: r,
922
+ record: c,
923
+ undo: d,
805
924
  redo: x,
806
- reset: m
925
+ reset: f
807
926
  };
808
927
  }
809
- const hi = ["disabled"], mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"], pi = ["disabled"], bi = /* @__PURE__ */ dt({
928
+ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"], Ci = ["disabled"], Ei = ["disabled"], Si = /* @__PURE__ */ dt({
810
929
  __name: "NodeContextMenu",
811
930
  props: {
812
931
  x: {},
@@ -818,115 +937,127 @@ const hi = ["disabled"], mi = ["disabled"], gi = ["disabled"], yi = ["disabled"]
818
937
  readonly: { type: Boolean, default: !1 }
819
938
  },
820
939
  emits: ["pickImage", "setLink", "removeLink", "editNote", "removeNote", "removeImage", "close"],
821
- setup(n, { emit: s }) {
822
- const o = n, i = s, a = Q(() => {
823
- let S = o.x + 2, b = o.y + 2;
940
+ setup(i, { emit: s }) {
941
+ const o = i, n = s, r = te(() => {
942
+ let C = o.x + 2, k = o.y + 2;
824
943
  if (o.container) {
825
- const A = o.container.getBoundingClientRect(), U = 180, ce = d.value ? c.value ? 184 : 160 : 136;
826
- S + U > A.right && (S = Math.max(A.left + 4, o.x - U - 2)), b + ce > A.bottom && (b = Math.max(A.top + 4, o.y - ce - 2)), S < A.left + 2 && (S = A.left + 2), b < A.top + 2 && (b = A.top + 2);
944
+ const D = o.container.getBoundingClientRect(), j = 180, Q = c.value ? d.value ? 184 : 160 : 136;
945
+ C + j > D.right && (C = Math.max(D.left + 4, o.x - j - 2)), k + Q > D.bottom && (k = Math.max(D.top + 4, o.y - Q - 2)), C < D.left + 2 && (C = D.left + 2), k < D.top + 2 && (k = D.top + 2);
827
946
  }
828
- return { left: S, top: b };
829
- }), d = Q(() => o.hasImage), c = Q(() => o.hasLink), x = Q(() => o.hasNote);
830
- function m(S) {
831
- const b = S.target;
832
- b && b.closest(".zm-node-menu") || i("close");
947
+ return { left: C, top: k };
948
+ }), c = te(() => o.hasImage), d = te(() => o.hasLink), x = te(() => o.hasNote);
949
+ function f(C) {
950
+ const k = C.target;
951
+ k && k.closest(".zm-node-menu") || n("close");
833
952
  }
834
- function h(S) {
835
- S.key === "Escape" && i("close");
953
+ function v(C) {
954
+ C.key === "Escape" && n("close");
836
955
  }
837
956
  function u() {
838
- i("close");
957
+ n("close");
839
958
  }
840
- window.addEventListener("mousedown", m, !0), window.addEventListener("keydown", h, !0), window.addEventListener("wheel", u, !0), window.addEventListener("scroll", u, !0), ct(() => {
841
- window.removeEventListener("mousedown", m, !0), window.removeEventListener("keydown", h, !0), window.removeEventListener("wheel", u, !0), window.removeEventListener("scroll", u, !0);
959
+ window.addEventListener("mousedown", f, !0), window.addEventListener("keydown", v, !0), window.addEventListener("wheel", u, !0), window.addEventListener("scroll", u, !0), ft(() => {
960
+ window.removeEventListener("mousedown", f, !0), window.removeEventListener("keydown", v, !0), window.removeEventListener("wheel", u, !0), window.removeEventListener("scroll", u, !0);
842
961
  });
843
- function p(S) {
844
- o.readonly || (S(), i("close"));
962
+ function y(C) {
963
+ o.readonly || (C(), n("close"));
845
964
  }
846
- return (S, b) => (M(), C("div", {
965
+ return (C, k) => (w(), b("div", {
847
966
  class: "zm-node-menu",
848
- style: ve({ left: a.value.left + "px", top: a.value.top + "px" }),
849
- onContextmenu: b[6] || (b[6] = R(() => {
967
+ style: ge({ left: r.value.left + "px", top: r.value.top + "px" }),
968
+ onContextmenu: k[6] || (k[6] = H(() => {
850
969
  }, ["prevent"]))
851
970
  }, [
852
- y("button", {
971
+ p("button", {
853
972
  class: "zm-node-menu-item",
854
- disabled: n.readonly,
855
- onClick: b[0] || (b[0] = R((A) => p(() => i("pickImage")), ["stop"]))
973
+ disabled: i.readonly,
974
+ onClick: k[0] || (k[0] = H((D) => y(() => n("pickImage")), ["stop"]))
856
975
  }, [
857
- F(V, {
976
+ U(Y, {
858
977
  name: "image",
859
978
  size: 13
860
979
  }),
861
- y("span", null, be(d.value ? "替换图片" : "添加图片"), 1)
862
- ], 8, hi),
863
- d.value ? (M(), C("button", {
980
+ p("span", null, se(c.value ? "替换图片" : "添加图片"), 1)
981
+ ], 8, wi),
982
+ c.value ? (w(), b("button", {
864
983
  key: 0,
865
984
  class: "zm-node-menu-item",
866
- disabled: n.readonly,
867
- onClick: b[1] || (b[1] = R((A) => p(() => i("removeImage")), ["stop"]))
985
+ disabled: i.readonly,
986
+ onClick: k[1] || (k[1] = H((D) => y(() => n("removeImage")), ["stop"]))
868
987
  }, [
869
- F(V, {
988
+ U(Y, {
870
989
  name: "x",
871
990
  size: 13
872
991
  }),
873
- b[7] || (b[7] = y("span", null, "移除图片", -1))
874
- ], 8, mi)) : O("", !0),
875
- y("button", {
992
+ k[7] || (k[7] = p("span", null, "移除图片", -1))
993
+ ], 8, bi)) : q("", !0),
994
+ p("button", {
876
995
  class: "zm-node-menu-item",
877
- disabled: n.readonly,
878
- onClick: b[2] || (b[2] = R((A) => p(() => i("setLink")), ["stop"]))
996
+ disabled: i.readonly,
997
+ onClick: k[2] || (k[2] = H((D) => y(() => n("setLink")), ["stop"]))
879
998
  }, [
880
- F(V, {
999
+ U(Y, {
881
1000
  name: "link",
882
1001
  size: 13
883
1002
  }),
884
- y("span", null, be(c.value ? "编辑链接" : "添加链接"), 1)
885
- ], 8, gi),
886
- c.value ? (M(), C("button", {
1003
+ p("span", null, se(d.value ? "编辑链接" : "添加链接"), 1)
1004
+ ], 8, ki),
1005
+ d.value ? (w(), b("button", {
887
1006
  key: 1,
888
1007
  class: "zm-node-menu-item",
889
- disabled: n.readonly,
890
- onClick: b[3] || (b[3] = R((A) => p(() => i("removeLink")), ["stop"]))
1008
+ disabled: i.readonly,
1009
+ onClick: k[3] || (k[3] = H((D) => y(() => n("removeLink")), ["stop"]))
891
1010
  }, [
892
- F(V, {
1011
+ U(Y, {
893
1012
  name: "x",
894
1013
  size: 13
895
1014
  }),
896
- b[8] || (b[8] = y("span", null, "移除链接", -1))
897
- ], 8, yi)) : O("", !0),
898
- y("button", {
1015
+ k[8] || (k[8] = p("span", null, "移除链接", -1))
1016
+ ], 8, Mi)) : q("", !0),
1017
+ p("button", {
899
1018
  class: "zm-node-menu-item",
900
- disabled: n.readonly,
901
- onClick: b[4] || (b[4] = R((A) => p(() => i("editNote")), ["stop"]))
1019
+ disabled: i.readonly,
1020
+ onClick: k[4] || (k[4] = H((D) => y(() => n("editNote")), ["stop"]))
902
1021
  }, [
903
- F(V, {
1022
+ U(Y, {
904
1023
  name: "note",
905
1024
  size: 13
906
1025
  }),
907
- y("span", null, be(x.value ? "编辑笔记" : "添加笔记"), 1)
908
- ], 8, xi),
909
- x.value ? (M(), C("button", {
1026
+ p("span", null, se(x.value ? "编辑笔记" : "添加笔记"), 1)
1027
+ ], 8, Ci),
1028
+ x.value ? (w(), b("button", {
910
1029
  key: 2,
911
1030
  class: "zm-node-menu-item",
912
- disabled: n.readonly,
913
- onClick: b[5] || (b[5] = R((A) => p(() => i("removeNote")), ["stop"]))
1031
+ disabled: i.readonly,
1032
+ onClick: k[5] || (k[5] = H((D) => y(() => n("removeNote")), ["stop"]))
914
1033
  }, [
915
- F(V, {
1034
+ U(Y, {
916
1035
  name: "x",
917
1036
  size: 13
918
1037
  }),
919
- b[9] || (b[9] = y("span", null, "移除笔记", -1))
920
- ], 8, pi)) : O("", !0)
1038
+ k[9] || (k[9] = p("span", null, "移除笔记", -1))
1039
+ ], 8, Ei)) : q("", !0)
921
1040
  ], 36));
922
1041
  }
923
- }), wi = ["viewBox", "width", "height"], ki = { class: "zm-edges" }, Mi = ["d", "fill"], Ci = ["data-node-id", "onClick", "onDblclick", "onContextmenu", "onMouseenter", "onMouseleave"], Si = ["src", "width", "height", "alt"], Ei = {
1042
+ }), zi = ["viewBox", "width", "height"], Ni = { class: "zm-edges" }, $i = ["d", "fill"], Ii = ["data-node-id", "onClick", "onDblclick", "onContextmenu", "onMouseenter", "onMouseleave"], Wi = ["src", "width", "height", "alt"], Ri = {
924
1043
  key: 1,
925
1044
  class: "zm-text"
926
- }, zi = { class: "zm-text-label" }, Ni = ["href", "title"], Ii = ["title", "onClick"], Wi = ["title"], $i = ["title", "onClick"], Bi = ["onClick"], Ri = ["onMousedown"], Ai = ["onClick"], Li = {
1045
+ }, Bi = { class: "zm-text-label" }, Li = ["href", "title"], Ai = ["title", "onClick"], Hi = {
1046
+ key: 0,
1047
+ class: "zm-rich-code"
1048
+ }, Di = {
1049
+ key: 1,
1050
+ class: "zm-rich-list"
1051
+ }, Pi = {
1052
+ key: 2,
1053
+ class: "zm-rich-table"
1054
+ }, Ti = {
1055
+ key: 3,
1056
+ class: "zm-rich-paragraph"
1057
+ }, Oi = ["title"], Fi = ["title", "onClick"], Vi = ["onClick"], Xi = ["onMousedown"], qi = ["onClick"], Ui = {
927
1058
  key: 0,
928
1059
  class: "zm-toolbar"
929
- }, Hi = ["src"], Di = ["src"], Pi = { class: "zm-tb-tip" }, We = 24, De = 400, pe = 160, Ti = /* @__PURE__ */ dt({
1060
+ }, Yi = ["src"], Ki = ["src"], ji = { class: "zm-tb-tip" }, Ie = 24, Pe = 400, ke = 160, Gi = /* @__PURE__ */ dt({
930
1061
  __name: "MindMap",
931
1062
  props: {
932
1063
  data: {},
@@ -937,242 +1068,242 @@ const hi = ["disabled"], mi = ["disabled"], gi = ["disabled"], yi = ["disabled"]
937
1068
  lineColors: {}
938
1069
  },
939
1070
  emits: ["change", "select", "edit-note", "markdownChange"],
940
- setup(n, { expose: s, emit: o }) {
941
- const i = n, a = o, d = D(null), c = D(null), x = D(""), m = D(null), h = D(/* @__PURE__ */ new Set()), u = D(he(i.data)), p = D(i.markdown !== void 0);
942
- let S = !1;
1071
+ setup(i, { expose: s, emit: o }) {
1072
+ const n = i, r = o, c = F(null), d = F(null), x = F(""), f = F(null), v = F(/* @__PURE__ */ new Set()), u = F(ye(n.data)), y = F(n.markdown !== void 0);
1073
+ let C = !1;
943
1074
  Ye(
944
- () => i.markdown,
1075
+ () => n.markdown,
945
1076
  (e) => {
946
1077
  if (e === void 0) {
947
- p.value = !1;
1078
+ y.value = !1;
948
1079
  return;
949
1080
  }
950
- p.value = !0;
1081
+ y.value = !0;
951
1082
  const t = Xt(e || "");
952
- S = !0, u.value = he(t), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), Z(() => {
953
- S = !1, se();
1083
+ C = !0, u.value = ye(t), f.value = null, v.value = /* @__PURE__ */ new Set(), O(), ee(() => {
1084
+ C = !1, fe();
954
1085
  });
955
1086
  }
956
1087
  ), Ye(
957
1088
  u,
958
1089
  () => {
959
- p.value && !S && a("markdownChange", st(u.value));
1090
+ y.value && !C && r("markdownChange", ct(u.value));
960
1091
  },
961
1092
  { deep: !0 }
962
1093
  );
963
- const b = Q(() => k.showOrderBadge === !0), A = D(/* @__PURE__ */ new Map()), U = A.value;
964
- function ce(e, t) {
965
- const r = {};
966
- t.bg && (r.bg = t.bg), t.textColor && (r.textColor = t.textColor), t.borderColor && (r.borderColor = t.borderColor), t.fontWeight && (r.fontWeight = t.fontWeight), Object.keys(r).length === 0 ? U.delete(e) : U.set(e, r), A.value = new Map(U);
1094
+ const k = te(() => E.showOrderBadge === !0), D = F(/* @__PURE__ */ new Map()), j = D.value;
1095
+ function Q(e, t) {
1096
+ const a = {};
1097
+ t.bg && (a.bg = t.bg), t.textColor && (a.textColor = t.textColor), t.borderColor && (a.borderColor = t.borderColor), t.fontWeight && (a.fontWeight = t.fontWeight), Object.keys(a).length === 0 ? j.delete(e) : j.set(e, a), D.value = new Map(j);
967
1098
  }
968
- function ue(e) {
969
- return U.get(e) ?? {};
1099
+ function K(e) {
1100
+ return j.get(e) ?? {};
970
1101
  }
971
- function w(e, t) {
972
- const r = B(u.value, e);
973
- r && (r.image = {
1102
+ function M(e, t) {
1103
+ const a = A(u.value, e);
1104
+ a && (a.image = {
974
1105
  src: t.src,
975
1106
  naturalW: t.naturalW,
976
1107
  naturalH: t.naturalH,
977
- width: q(t.width, We, De),
978
- height: q(t.height, We, De)
979
- }, K(), H(), a("change", u.value));
980
- }
981
- function G(e) {
982
- const t = B(u.value, e);
983
- !t || !t.image || (delete t.image, K(), H(), a("change", u.value));
984
- }
985
- function q(e, t, r) {
986
- return Math.min(r, Math.max(t, e));
987
- }
988
- function T(e, t) {
989
- const r = new FileReader();
990
- r.onload = () => {
991
- if (typeof r.result != "string") return;
992
- const v = r.result, f = new window.Image();
993
- f.onload = () => {
994
- const l = f.naturalWidth || pe, g = f.naturalHeight || pe, $ = q(l, We, pe), X = q(Math.round(g * $ / l), We, De);
995
- t({ src: v, naturalW: l, naturalH: g, width: $, height: X });
996
- }, f.onerror = () => {
997
- t({ src: v, naturalW: pe, naturalH: pe, width: pe, height: pe });
998
- }, f.src = v;
999
- }, r.readAsDataURL(e);
1000
- }
1001
- function le(e) {
1108
+ width: L(t.width, Ie, Pe),
1109
+ height: L(t.height, Ie, Pe)
1110
+ }, G(), O(), r("change", u.value));
1111
+ }
1112
+ function z(e) {
1113
+ const t = A(u.value, e);
1114
+ !t || !t.image || (delete t.image, G(), O(), r("change", u.value));
1115
+ }
1116
+ function L(e, t, a) {
1117
+ return Math.min(a, Math.max(t, e));
1118
+ }
1119
+ function R(e, t) {
1120
+ const a = new FileReader();
1121
+ a.onload = () => {
1122
+ if (typeof a.result != "string") return;
1123
+ const m = a.result, h = new window.Image();
1124
+ h.onload = () => {
1125
+ const l = h.naturalWidth || ke, g = h.naturalHeight || ke, $ = L(l, Ie, ke), X = L(Math.round(g * $ / l), Ie, Pe);
1126
+ t({ src: m, naturalW: l, naturalH: g, width: $, height: X });
1127
+ }, h.onerror = () => {
1128
+ t({ src: m, naturalW: ke, naturalH: ke, width: ke, height: ke });
1129
+ }, h.src = m;
1130
+ }, a.readAsDataURL(e);
1131
+ }
1132
+ function Z(e) {
1002
1133
  const t = document.createElement("input");
1003
1134
  t.type = "file", t.accept = "image/*", t.style.display = "none", t.onchange = () => {
1004
- var v;
1005
- const r = (v = t.files) == null ? void 0 : v[0];
1006
- r && (T(r, (f) => w(e, f)), document.body.removeChild(t));
1135
+ var m;
1136
+ const a = (m = t.files) == null ? void 0 : m[0];
1137
+ a && (R(a, (h) => M(e, h)), document.body.removeChild(t));
1007
1138
  }, document.body.appendChild(t), t.click();
1008
1139
  }
1009
- function Y(e, t) {
1010
- const r = t.trim(), v = B(u.value, e);
1011
- v && (r ? v.link = { url: r } : delete v.link, K(), H(), a("change", u.value));
1012
- }
1013
- function re(e) {
1014
- Y(e, "");
1140
+ function V(e, t) {
1141
+ const a = t.trim(), m = A(u.value, e);
1142
+ m && (a ? m.link = { url: a } : delete m.link, G(), O(), r("change", u.value));
1015
1143
  }
1016
- function me(e, t) {
1017
- const r = B(u.value, e);
1018
- r && (t ? r.note = { text: t } : delete r.note, K(), H(), a("change", u.value));
1144
+ function ue(e) {
1145
+ V(e, "");
1019
1146
  }
1020
- function I(e) {
1021
- me(e, "");
1147
+ function xe(e, t) {
1148
+ const a = A(u.value, e);
1149
+ a && (t ? a.note = { text: t } : delete a.note, G(), O(), r("change", u.value));
1022
1150
  }
1023
- const W = D(null);
1024
- function j(e, t) {
1025
- i.readonly || (e.preventDefault(), e.stopPropagation(), m.value = t.id, a("select", B(u.value, t.id)), W.value = { nodeId: t.id, x: e.clientX, y: e.clientY });
1151
+ function W(e) {
1152
+ xe(e, "");
1026
1153
  }
1027
- function _() {
1028
- W.value = null;
1154
+ const B = F(null);
1155
+ function _(e, t) {
1156
+ n.readonly || (e.preventDefault(), e.stopPropagation(), f.value = t.id, r("select", A(u.value, t.id)), B.value = { nodeId: t.id, x: e.clientX, y: e.clientY });
1029
1157
  }
1030
1158
  function ne() {
1159
+ B.value = null;
1160
+ }
1161
+ function le() {
1031
1162
  var t;
1032
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1033
- e && le(e);
1163
+ const e = (t = B.value) == null ? void 0 : t.nodeId;
1164
+ e && Z(e);
1034
1165
  }
1035
- function ie() {
1036
- var v, f, l;
1037
- const e = (v = W.value) == null ? void 0 : v.nodeId;
1166
+ function re() {
1167
+ var m, h, l;
1168
+ const e = (m = B.value) == null ? void 0 : m.nodeId;
1038
1169
  if (!e) return;
1039
- const t = ((l = (f = B(u.value, e)) == null ? void 0 : f.link) == null ? void 0 : l.url) ?? "", r = window.prompt("输入链接 URL(留空取消)", t);
1040
- r !== null && Y(e, r);
1170
+ const t = ((l = (h = A(u.value, e)) == null ? void 0 : h.link) == null ? void 0 : l.url) ?? "", a = window.prompt("输入链接 URL(留空取消)", t);
1171
+ a !== null && V(e, a);
1041
1172
  }
1042
- function ke() {
1173
+ function Me() {
1043
1174
  var t;
1044
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1045
- e && re(e);
1175
+ const e = (t = B.value) == null ? void 0 : t.nodeId;
1176
+ e && ue(e);
1046
1177
  }
1047
- function Be() {
1178
+ function Re() {
1048
1179
  var t;
1049
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1180
+ const e = (t = B.value) == null ? void 0 : t.nodeId;
1050
1181
  e && vt(e);
1051
1182
  }
1052
- function Me() {
1183
+ function Ce() {
1053
1184
  var t;
1054
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1055
- e && I(e);
1185
+ const e = (t = B.value) == null ? void 0 : t.nodeId;
1186
+ e && W(e);
1056
1187
  }
1057
1188
  function Zt() {
1058
1189
  var t;
1059
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1060
- e && G(e);
1190
+ const e = (t = B.value) == null ? void 0 : t.nodeId;
1191
+ e && z(e);
1061
1192
  }
1062
1193
  function vt(e) {
1063
- i.readonly || a("edit-note", e);
1194
+ n.readonly || r("edit-note", e);
1064
1195
  }
1065
1196
  function Qt(e, t = 60) {
1066
- const r = e.replace(/\s+/g, " ").trim();
1067
- return r.length <= t ? r || "点击编辑笔记" : r.slice(0, t) + "…";
1197
+ const a = e.replace(/\s+/g, " ").trim();
1198
+ return a.length <= t ? a || "点击编辑笔记" : a.slice(0, t) + "…";
1068
1199
  }
1069
- function ht(e) {
1070
- var f;
1071
- if (i.readonly || c.value) return;
1200
+ function mt(e) {
1201
+ var h;
1202
+ if (n.readonly || d.value) return;
1072
1203
  const t = e.target;
1073
1204
  if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable))
1074
1205
  return;
1075
- const r = m.value;
1076
- if (!r) return;
1077
- const v = (f = e.clipboardData) == null ? void 0 : f.items;
1078
- if (v)
1079
- for (let l = 0; l < v.length; l++) {
1080
- const g = v[l];
1206
+ const a = f.value;
1207
+ if (!a) return;
1208
+ const m = (h = e.clipboardData) == null ? void 0 : h.items;
1209
+ if (m)
1210
+ for (let l = 0; l < m.length; l++) {
1211
+ const g = m[l];
1081
1212
  if (g.kind === "file" && g.type.startsWith("image/")) {
1082
1213
  const $ = g.getAsFile();
1083
1214
  if (!$) continue;
1084
1215
  e.preventDefault();
1085
- const X = B(u.value, r);
1216
+ const X = A(u.value, a);
1086
1217
  if (X != null && X.image && !window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))
1087
1218
  return;
1088
- T($, (J) => w(r, J));
1219
+ R($, (J) => M(a, J));
1089
1220
  return;
1090
1221
  }
1091
1222
  }
1092
1223
  }
1093
1224
  ut(() => {
1094
- window.addEventListener("paste", ht);
1095
- }), ct(() => {
1096
- window.removeEventListener("paste", ht);
1225
+ window.addEventListener("paste", mt);
1226
+ }), ft(() => {
1227
+ window.removeEventListener("paste", mt);
1097
1228
  });
1098
- const Re = D(null), _t = Q(() => {
1229
+ const Be = F(null), _t = te(() => {
1099
1230
  var e;
1100
- return ((e = Re.value) == null ? void 0 : e.nodeId) ?? null;
1231
+ return ((e = Be.value) == null ? void 0 : e.nodeId) ?? null;
1101
1232
  });
1102
1233
  function en(e, t) {
1103
1234
  if (!t.image) return;
1104
1235
  e.preventDefault(), e.stopPropagation();
1105
- const r = t.image.naturalW || t.image.width, v = t.image.naturalH || t.image.height, f = v > 0 ? v / r : 1;
1106
- Re.value = {
1236
+ const a = t.image.naturalW || t.image.width, m = t.image.naturalH || t.image.height, h = m > 0 ? m / a : 1;
1237
+ Be.value = {
1107
1238
  nodeId: t.id,
1108
1239
  startX: e.clientX,
1109
1240
  startY: e.clientY,
1110
1241
  startW: t.image.width,
1111
1242
  startH: t.image.height,
1112
- naturalW: r,
1113
- naturalH: v,
1114
- ratio: f,
1243
+ naturalW: a,
1244
+ naturalH: m,
1245
+ ratio: h,
1115
1246
  pendingW: t.image.width,
1116
1247
  pendingH: t.image.height
1117
- }, window.addEventListener("mousemove", mt), window.addEventListener("mouseup", gt);
1248
+ }, window.addEventListener("mousemove", gt), window.addEventListener("mouseup", yt);
1118
1249
  }
1119
- function mt(e) {
1250
+ function gt(e) {
1120
1251
  var X, J;
1121
- const t = Re.value;
1252
+ const t = Be.value;
1122
1253
  if (!t) return;
1123
- const r = E.scale.value || 1, v = e.clientX - t.startX, f = q(t.startW + v / r, We, De), l = q(f * t.ratio, We, De);
1124
- t.pendingW = f, t.pendingH = l;
1125
- const g = (X = d.value) == null ? void 0 : X.querySelector(
1254
+ const a = S.scale.value || 1, m = e.clientX - t.startX, h = L(t.startW + m / a, Ie, Pe), l = L(h * t.ratio, Ie, Pe);
1255
+ t.pendingW = h, t.pendingH = l;
1256
+ const g = (X = c.value) == null ? void 0 : X.querySelector(
1126
1257
  `[data-node-id="${t.nodeId}"] .zm-node-img`
1127
1258
  );
1128
- g && (g.style.width = `${f}px`, g.style.height = `${l}px`);
1129
- const $ = (J = d.value) == null ? void 0 : J.querySelector(
1259
+ g && (g.style.width = `${h}px`, g.style.height = `${l}px`);
1260
+ const $ = (J = c.value) == null ? void 0 : J.querySelector(
1130
1261
  `[data-node-id="${t.nodeId}"]`
1131
1262
  );
1132
- $ && ($.style.minWidth = `${Math.max(80, Math.ceil(f + 28))}px`, $.style.height = `${Math.ceil(l + 8 + 30)}px`);
1263
+ $ && ($.style.minWidth = `${Math.max(80, Math.ceil(h + 28))}px`, $.style.height = `${Math.ceil(l + 8 + 30)}px`);
1133
1264
  }
1134
- function gt() {
1135
- const e = Re.value;
1136
- if (window.removeEventListener("mousemove", mt), window.removeEventListener("mouseup", gt), Re.value = null, !e) return;
1137
- const t = B(u.value, e.nodeId);
1138
- !t || !t.image || (w(e.nodeId, {
1265
+ function yt() {
1266
+ const e = Be.value;
1267
+ if (window.removeEventListener("mousemove", gt), window.removeEventListener("mouseup", yt), Be.value = null, !e) return;
1268
+ const t = A(u.value, e.nodeId);
1269
+ !t || !t.image || (M(e.nodeId, {
1139
1270
  src: t.image.src,
1140
1271
  naturalW: t.image.naturalW,
1141
1272
  naturalH: t.image.naturalH,
1142
1273
  width: e.pendingW,
1143
1274
  height: e.pendingH
1144
- }), m.value = e.nodeId, a("select", t), _e = !0);
1275
+ }), f.value = e.nodeId, r("select", t), et = !0);
1145
1276
  }
1146
- const Qe = D(null);
1147
- let _e = !1;
1277
+ const _e = F(null);
1278
+ let et = !1;
1148
1279
  function tn(e) {
1149
- Qe.value = e;
1280
+ _e.value = e;
1150
1281
  }
1151
1282
  function nn(e) {
1152
- Qe.value === e && (Qe.value = null);
1283
+ _e.value === e && (_e.value = null);
1153
1284
  }
1154
- const yt = D(0), et = D(!1), fe = vi(100);
1155
- function K() {
1156
- fe.record({ data: u.value });
1285
+ const xt = F(0), tt = F(!1), ve = pi(100);
1286
+ function G() {
1287
+ ve.record({ data: u.value });
1157
1288
  }
1158
- function H() {
1159
- h.value = new Set(h.value), yt.value++;
1289
+ function O() {
1290
+ v.value = new Set(v.value), xt.value++;
1160
1291
  }
1161
- const oe = Q(() => {
1162
- var e, t, r, v, f, l, g, $, X, J;
1292
+ const ae = te(() => {
1293
+ var e, t, a, m, h, l, g, $, X, J;
1163
1294
  return {
1164
- rootBg: ((e = i.theme) == null ? void 0 : e.rootBg) ?? "#1f2937",
1165
- rootText: ((t = i.theme) == null ? void 0 : t.rootText) ?? "#ffffff",
1166
- branchBg: ((r = i.theme) == null ? void 0 : r.branchBg) ?? "#ffffff",
1167
- branchText: ((v = i.theme) == null ? void 0 : v.branchText) ?? "#1f2937",
1168
- lineColor: ((f = i.theme) == null ? void 0 : f.lineColor) ?? "#94a3b8",
1169
- bgColor: ((l = i.theme) == null ? void 0 : l.bgColor) ?? "#f8fafc",
1170
- fontSize: ((g = i.theme) == null ? void 0 : g.fontSize) ?? 14,
1171
- lineWidthStart: (($ = i.theme) == null ? void 0 : $.lineWidthStart) ?? 2.2,
1172
- lineWidthEnd: ((X = i.theme) == null ? void 0 : X.lineWidthEnd) ?? 0.8,
1173
- rainbowBranch: ((J = i.theme) == null ? void 0 : J.rainbowBranch) ?? !1
1295
+ rootBg: ((e = n.theme) == null ? void 0 : e.rootBg) ?? "#1f2937",
1296
+ rootText: ((t = n.theme) == null ? void 0 : t.rootText) ?? "#ffffff",
1297
+ branchBg: ((a = n.theme) == null ? void 0 : a.branchBg) ?? "#ffffff",
1298
+ branchText: ((m = n.theme) == null ? void 0 : m.branchText) ?? "#1f2937",
1299
+ lineColor: ((h = n.theme) == null ? void 0 : h.lineColor) ?? "#94a3b8",
1300
+ bgColor: ((l = n.theme) == null ? void 0 : l.bgColor) ?? "#f8fafc",
1301
+ fontSize: ((g = n.theme) == null ? void 0 : g.fontSize) ?? 14,
1302
+ lineWidthStart: (($ = n.theme) == null ? void 0 : $.lineWidthStart) ?? 2.2,
1303
+ lineWidthEnd: ((X = n.theme) == null ? void 0 : X.lineWidthEnd) ?? 0.8,
1304
+ rainbowBranch: ((J = n.theme) == null ? void 0 : J.rainbowBranch) ?? !1
1174
1305
  };
1175
- }), k = Ge({
1306
+ }), E = Ge({
1176
1307
  autoBalanceOnChange: !0,
1177
1308
  lineWidthStart: 12,
1178
1309
  lineWidthEnd: 3.6,
@@ -1184,548 +1315,567 @@ const hi = ["disabled"], mi = ["disabled"], gi = ["disabled"], yi = ["disabled"]
1184
1315
  taperedEdge: !0,
1185
1316
  showOrderBadge: !1
1186
1317
  });
1187
- function xt(e) {
1188
- return k.taperedEdge ? on(e) : bt(e);
1189
- }
1190
1318
  function pt(e) {
1191
- return k.taperedEdge ? k.lineWidthEnd : bt(e);
1319
+ return E.taperedEdge ? on(e) : bt(e);
1320
+ }
1321
+ function wt(e) {
1322
+ return E.taperedEdge ? E.lineWidthEnd : bt(e);
1192
1323
  }
1193
1324
  function on(e) {
1194
- return e <= 0 ? k.lineWidthStart : e === 1 ? Math.max(1.5, k.lineWidthStart * 0.67) : e === 2 ? Math.max(0.8, k.lineWidthStart * 0.42) : k.lineWidthEnd;
1325
+ return e <= 0 ? E.lineWidthStart : e === 1 ? Math.max(1.5, E.lineWidthStart * 0.67) : e === 2 ? Math.max(0.8, E.lineWidthStart * 0.42) : E.lineWidthEnd;
1195
1326
  }
1196
1327
  function bt(e) {
1197
- if (e <= 0) return k.lineWidthStart;
1198
- if (e >= 3) return k.lineWidthEnd;
1328
+ if (e <= 0) return E.lineWidthStart;
1329
+ if (e >= 3) return E.lineWidthEnd;
1199
1330
  const t = e / 3;
1200
- return k.lineWidthStart + (k.lineWidthEnd - k.lineWidthStart) * t;
1331
+ return E.lineWidthStart + (E.lineWidthEnd - E.lineWidthStart) * t;
1201
1332
  }
1202
- function ln(e, t, r, v) {
1203
- const f = 1 - e, l = f * f * f * t.x + 3 * f * f * e * r.x1 + 3 * f * e * e * r.x2 + e * e * e * v.x, g = f * f * f * t.y + 3 * f * f * e * r.y1 + 3 * f * e * e * r.y2 + e * e * e * v.y;
1333
+ function ln(e, t, a, m) {
1334
+ const h = 1 - e, l = h * h * h * t.x + 3 * h * h * e * a.x1 + 3 * h * e * e * a.x2 + e * e * e * m.x, g = h * h * h * t.y + 3 * h * h * e * a.y1 + 3 * h * e * e * a.y2 + e * e * e * m.y;
1204
1335
  return { x: l, y: g };
1205
1336
  }
1206
- function rn(e, t, r, v, f = 32, l = "curve", g = "right") {
1337
+ function rn(e, t, a, m, h = 32, l = "curve", g = "right") {
1207
1338
  if (l === "curve") {
1208
- let xe;
1339
+ let be;
1209
1340
  if (g === "right" || g === "left") {
1210
- const L = Math.abs(t.x - e.x) * 0.45, de = g === "right" ? 1 : -1;
1211
- xe = { x1: e.x + de * L, y1: e.y, x2: t.x - de * L, y2: t.y };
1341
+ const T = Math.abs(t.x - e.x) * 0.45, he = g === "right" ? 1 : -1;
1342
+ be = { x1: e.x + he * T, y1: e.y, x2: t.x - he * T, y2: t.y };
1212
1343
  } else {
1213
- const L = Math.abs(t.y - e.y) * 0.45;
1214
- xe = { x1: e.x, y1: e.y + L, x2: t.x, y2: t.y - L };
1344
+ const T = Math.abs(t.y - e.y) * 0.45;
1345
+ be = { x1: e.x, y1: e.y + T, x2: t.x, y2: t.y - T };
1215
1346
  }
1216
- const In = (N) => {
1217
- const L = 1 - N, de = -3 * L * L * e.x + 3 * (L * L - 2 * L * N) * xe.x1 + 3 * (2 * L * N - N * N) * xe.x2 + 3 * N * N * t.x, ze = -3 * L * L * e.y + 3 * (L * L - 2 * L * N) * xe.y1 + 3 * (2 * L * N - N * N) * xe.y2 + 3 * N * N * t.y;
1218
- return { dx: de, dy: ze };
1219
- }, He = [], rt = [];
1220
- for (let N = 0; N <= f; N++) {
1221
- const L = N / f, de = N === 0 ? e : N === f ? t : ln(L, e, xe, t), ze = In(L);
1222
- let Xe = Math.hypot(ze.dx, ze.dy);
1223
- Xe < 1e-6 && (Xe = 1);
1224
- const Pt = -ze.dy / Xe, Tt = ze.dx / Xe, qe = (r + (v - r) * L) / 2;
1225
- He.push({ x: de.x + Pt * qe, y: de.y + Tt * qe }), rt.push({ x: de.x - Pt * qe, y: de.y - Tt * qe });
1347
+ const Bn = (I) => {
1348
+ const T = 1 - I, he = -3 * T * T * e.x + 3 * (T * T - 2 * T * I) * be.x1 + 3 * (2 * T * I - I * I) * be.x2 + 3 * I * I * t.x, Ne = -3 * T * T * e.y + 3 * (T * T - 2 * T * I) * be.y1 + 3 * (2 * T * I - I * I) * be.y2 + 3 * I * I * t.y;
1349
+ return { dx: he, dy: Ne };
1350
+ }, He = [], at = [];
1351
+ for (let I = 0; I <= h; I++) {
1352
+ const T = I / h, he = I === 0 ? e : I === h ? t : ln(T, e, be, t), Ne = Bn(T);
1353
+ let qe = Math.hypot(Ne.dx, Ne.dy);
1354
+ qe < 1e-6 && (qe = 1);
1355
+ const Tt = -Ne.dy / qe, Ot = Ne.dx / qe, Ue = (a + (m - a) * T) / 2;
1356
+ He.push({ x: he.x + Tt * Ue, y: he.y + Ot * Ue }), at.push({ x: he.x - Tt * Ue, y: he.y - Ot * Ue });
1226
1357
  }
1227
- let Ve = `M ${He[0].x.toFixed(2)} ${He[0].y.toFixed(2)}`;
1228
- for (let N = 1; N <= f; N++) Ve += ` L ${He[N].x.toFixed(2)} ${He[N].y.toFixed(2)}`;
1229
- for (let N = f; N >= 0; N--) Ve += ` L ${rt[N].x.toFixed(2)} ${rt[N].y.toFixed(2)}`;
1230
- return Ve += " Z", Ve;
1358
+ let Xe = `M ${He[0].x.toFixed(2)} ${He[0].y.toFixed(2)}`;
1359
+ for (let I = 1; I <= h; I++) Xe += ` L ${He[I].x.toFixed(2)} ${He[I].y.toFixed(2)}`;
1360
+ for (let I = h; I >= 0; I--) Xe += ` L ${at[I].x.toFixed(2)} ${at[I].y.toFixed(2)}`;
1361
+ return Xe += " Z", Xe;
1231
1362
  }
1232
1363
  const $ = t.x - e.x, X = t.y - e.y;
1233
1364
  let J = Math.hypot($, X);
1234
1365
  J < 1e-6 && (J = 1);
1235
- const ye = -X / J, Se = $ / J, Ee = r / 2, Le = v / 2, At = { x: e.x + ye * Ee, y: e.y + Se * Ee }, Lt = { x: e.x - ye * Ee, y: e.y - Se * Ee }, Ht = { x: t.x - ye * Le, y: t.y - Se * Le }, Dt = { x: t.x + ye * Le, y: t.y + Se * Le };
1236
- return `M ${At.x.toFixed(2)} ${At.y.toFixed(2)} L ${Dt.x.toFixed(2)} ${Dt.y.toFixed(2)} L ${Ht.x.toFixed(2)} ${Ht.y.toFixed(2)} L ${Lt.x.toFixed(2)} ${Lt.y.toFixed(2)} Z`;
1366
+ const we = -X / J, Se = $ / J, ze = a / 2, Ae = m / 2, At = { x: e.x + we * ze, y: e.y + Se * ze }, Ht = { x: e.x - we * ze, y: e.y - Se * ze }, Dt = { x: t.x - we * Ae, y: t.y - Se * Ae }, Pt = { x: t.x + we * Ae, y: t.y + Se * Ae };
1367
+ return `M ${At.x.toFixed(2)} ${At.y.toFixed(2)} L ${Pt.x.toFixed(2)} ${Pt.y.toFixed(2)} L ${Dt.x.toFixed(2)} ${Dt.y.toFixed(2)} L ${Ht.x.toFixed(2)} ${Ht.y.toFixed(2)} Z`;
1237
1368
  }
1238
- const Te = Q(() => ee.value.root.children), an = Pe[0].colors, wt = Q(
1239
- () => ii(k.branchPaletteId, k.customPalettes)
1240
- ), ge = Q(() => {
1369
+ const Oe = te(() => ie.value.root.children), an = Te[0].colors, kt = te(
1370
+ () => si(E.branchPaletteId, E.customPalettes)
1371
+ ), pe = te(() => {
1241
1372
  const e = /* @__PURE__ */ new Map();
1242
- if (!k.rainbowBranch) return e;
1243
- const t = i.lineColors, r = t && t.length > 0 ? t : wt.value.colors.length > 0 ? wt.value.colors : an;
1244
- for (let f = 0; f < Te.value.length; f++) {
1245
- const l = Te.value[f];
1246
- e.set(l.id, r[f % r.length]);
1373
+ if (!E.rainbowBranch) return e;
1374
+ const t = n.lineColors, a = t && t.length > 0 ? t : kt.value.colors.length > 0 ? kt.value.colors : an;
1375
+ for (let h = 0; h < Oe.value.length; h++) {
1376
+ const l = Oe.value[h];
1377
+ e.set(l.id, a[h % a.length]);
1247
1378
  }
1248
- const v = (f, l) => {
1249
- e.set(f.id, l);
1250
- for (const g of f.children) v(g, l);
1379
+ const m = (h, l) => {
1380
+ e.set(h.id, l);
1381
+ for (const g of h.children) m(g, l);
1251
1382
  };
1252
- for (let f = 0; f < Te.value.length; f++) {
1253
- const l = Te.value[f];
1254
- v(l, r[f % r.length]);
1383
+ for (let h = 0; h < Oe.value.length; h++) {
1384
+ const l = Oe.value[h];
1385
+ m(l, a[h % a.length]);
1255
1386
  }
1256
1387
  return e;
1257
1388
  });
1258
- function un(e, t) {
1259
- return k.rainbowBranch ? ge.value.get(t.id) ?? oe.value.lineColor : oe.value.lineColor;
1389
+ function sn(e, t) {
1390
+ return E.rainbowBranch ? pe.value.get(t.id) ?? ae.value.lineColor : ae.value.lineColor;
1260
1391
  }
1261
- function sn(e) {
1262
- const t = ue(e.id);
1392
+ function un(e) {
1393
+ const t = K(e.id);
1263
1394
  if (t.bg) return t.bg;
1264
- if (e.isRoot) return oe.value.rootBg;
1265
- if (k.rainbowBranch) {
1266
- const r = ge.value.get(e.id);
1267
- if (r) return vn(r, 0.18);
1395
+ if (e.isRoot) return ae.value.rootBg;
1396
+ if (E.rainbowBranch) {
1397
+ const a = pe.value.get(e.id);
1398
+ if (a) return hn(a, 0.18);
1268
1399
  }
1269
- return oe.value.branchBg;
1400
+ return ae.value.branchBg;
1270
1401
  }
1271
- function dn(e) {
1272
- const t = ue(e.id);
1402
+ function cn(e) {
1403
+ const t = K(e.id);
1273
1404
  if (t.textColor) return t.textColor;
1274
- if (e.isRoot) return oe.value.rootText;
1275
- if (k.rainbowBranch) {
1276
- const r = ge.value.get(e.id);
1277
- if (r) return kt(r, 0.55);
1405
+ if (e.isRoot) return ae.value.rootText;
1406
+ if (E.rainbowBranch) {
1407
+ const a = pe.value.get(e.id);
1408
+ if (a) return Mt(a, 0.55);
1278
1409
  }
1279
- return oe.value.branchText;
1410
+ return ae.value.branchText;
1280
1411
  }
1281
- function cn(e) {
1282
- const t = ue(e.id);
1412
+ function dn(e) {
1413
+ const t = K(e.id);
1283
1414
  if (t.borderColor) return t.borderColor;
1284
- if (e.isRoot) return oe.value.rootBg;
1285
- if (k.rainbowBranch) {
1286
- const r = ge.value.get(e.id);
1287
- if (r) return kt(r, 0.3);
1415
+ if (e.isRoot) return ae.value.rootBg;
1416
+ if (E.rainbowBranch) {
1417
+ const a = pe.value.get(e.id);
1418
+ if (a) return Mt(a, 0.3);
1288
1419
  }
1289
- return oe.value.lineColor;
1420
+ return ae.value.lineColor;
1290
1421
  }
1291
1422
  function fn(e) {
1292
- return ue(e.id).fontWeight ?? (e.isRoot ? 600 : 400);
1423
+ return K(e.id).fontWeight ?? (e.isRoot ? 600 : 400);
1293
1424
  }
1294
- function vn(e, t) {
1295
- const r = e.replace("#", ""), v = r.length === 6 ? r : r.split("").map(($) => $ + $).join(""), f = parseInt(v.slice(0, 2), 16), l = parseInt(v.slice(2, 4), 16), g = parseInt(v.slice(4, 6), 16);
1296
- return `rgba(${f}, ${l}, ${g}, ${t})`;
1425
+ function hn(e, t) {
1426
+ const a = e.replace("#", ""), m = a.length === 6 ? a : a.split("").map(($) => $ + $).join(""), h = parseInt(m.slice(0, 2), 16), l = parseInt(m.slice(2, 4), 16), g = parseInt(m.slice(4, 6), 16);
1427
+ return `rgba(${h}, ${l}, ${g}, ${t})`;
1297
1428
  }
1298
- function kt(e, t) {
1299
- const r = e.replace("#", ""), v = r.length === 6 ? r : r.split("").map(($) => $ + $).join(""), f = Math.round(parseInt(v.slice(0, 2), 16) * (1 - t)), l = Math.round(parseInt(v.slice(2, 4), 16) * (1 - t)), g = Math.round(parseInt(v.slice(4, 6), 16) * (1 - t));
1300
- return `rgb(${f}, ${l}, ${g})`;
1429
+ function Mt(e, t) {
1430
+ const a = e.replace("#", ""), m = a.length === 6 ? a : a.split("").map(($) => $ + $).join(""), h = Math.round(parseInt(m.slice(0, 2), 16) * (1 - t)), l = Math.round(parseInt(m.slice(2, 4), 16) * (1 - t)), g = Math.round(parseInt(m.slice(4, 6), 16) * (1 - t));
1431
+ return `rgb(${h}, ${l}, ${g})`;
1301
1432
  }
1302
- const E = di({ getContainer: () => d.value });
1303
- E.setOnMarqueeEnd(Cn), fi({
1304
- isEditing: () => c.value !== null,
1305
- isReadonly: () => i.readonly,
1306
- getSelectedId: () => m.value,
1433
+ const S = gi({ getContainer: () => c.value });
1434
+ S.setOnMarqueeEnd(Nn), xi({
1435
+ isEditing: () => d.value !== null,
1436
+ isReadonly: () => n.readonly,
1437
+ getSelectedId: () => f.value,
1307
1438
  getRootId: () => u.value.id,
1308
1439
  // If nothing is selected, default Tab/Enter to the root so the user
1309
1440
  // can build a tree from scratch without first clicking somewhere.
1310
1441
  defaultTargetId: () => u.value.id,
1311
- onAddChild: Ce,
1312
- onAddSibling: Fe,
1442
+ onAddChild: Ee,
1443
+ onAddSibling: Ve,
1313
1444
  onAddSiblingBefore: St,
1314
- onRemove: zt,
1315
- onStartEdit: Ae,
1445
+ onRemove: Nt,
1446
+ onStartEdit: Le,
1316
1447
  onClearSelection: () => {
1317
- m.value = null, a("select", null);
1448
+ f.value = null, r("select", null);
1318
1449
  },
1319
- onDuplicate: Et,
1320
- onUndo: nt,
1321
- onRedo: it,
1450
+ onDuplicate: zt,
1451
+ onUndo: it,
1452
+ onRedo: ot,
1322
1453
  onNavigate: xn,
1323
1454
  onSelectRoot: () => {
1324
- m.value = u.value.id;
1325
- const e = B(u.value, u.value.id);
1326
- e && a("select", e);
1455
+ f.value = u.value.id;
1456
+ const e = A(u.value, u.value.id);
1457
+ e && r("select", e);
1327
1458
  }
1328
1459
  });
1329
- const ee = Q(() => {
1330
- const e = he(u.value);
1331
- return Ct(e), _n(e, { mode: k.layoutMode, baseFontSize: oe.value.fontSize });
1332
- }), Mt = D([]), tt = Q(() => (yt.value, Mt.value));
1460
+ const ie = te(() => {
1461
+ const e = ye(u.value);
1462
+ return Et(e), oi(e, { mode: E.layoutMode, baseFontSize: ae.value.fontSize });
1463
+ }), Ct = F([]), nt = te(() => (xt.value, Ct.value));
1333
1464
  Ye(
1334
- ee,
1465
+ ie,
1335
1466
  (e) => {
1336
- const t = [], r = (v) => {
1337
- t.push(v);
1338
- for (const f of v.children) r(f);
1467
+ const t = [], a = (m) => {
1468
+ t.push(m);
1469
+ for (const h of m.children) a(h);
1339
1470
  };
1340
- r(e.root), Mt.value = t;
1471
+ a(e.root), Ct.value = t;
1341
1472
  },
1342
1473
  { immediate: !0 }
1343
1474
  );
1344
- const hn = Q(() => {
1475
+ const vn = te(() => {
1345
1476
  const e = [];
1346
- for (const t of tt.value)
1347
- for (const r of t.children)
1348
- e.push({ from: t, to: r, key: `${t.id}->${r.id}` });
1477
+ for (const t of nt.value)
1478
+ for (const a of t.children)
1479
+ e.push({ from: t, to: a, key: `${t.id}->${a.id}` });
1349
1480
  return e;
1350
- }), mn = Q(
1351
- () => `${ee.value.vbX} ${ee.value.vbY} ${ee.value.vbW} ${ee.value.vbH}`
1481
+ }), mn = te(
1482
+ () => `${ie.value.vbX} ${ie.value.vbY} ${ie.value.vbW} ${ie.value.vbH}`
1352
1483
  );
1353
- function Ct(e) {
1354
- if (h.value.has(e.id)) {
1484
+ function Et(e) {
1485
+ if (v.value.has(e.id)) {
1355
1486
  e.children = [], e.collapsed = !0;
1356
1487
  return;
1357
1488
  }
1358
1489
  e.collapsed = !1;
1359
- for (const t of e.children) Ct(t);
1490
+ for (const t of e.children) Et(t);
1360
1491
  }
1361
- function Ae(e) {
1362
- const t = B(u.value, e);
1363
- t && (c.value = e, x.value = t.text, Z(() => {
1364
- const r = document.querySelector(".zm-input");
1365
- r == null || r.focus(), r == null || r.select();
1492
+ function Le(e) {
1493
+ const t = A(u.value, e);
1494
+ t && (d.value = e, x.value = t.text, ee(() => {
1495
+ const a = document.querySelector(".zm-input");
1496
+ a == null || a.focus(), a == null || a.select();
1366
1497
  }));
1367
1498
  }
1368
- function Oe(e = {}) {
1369
- if (!c.value) return;
1370
- const t = B(u.value, c.value);
1371
- t && t.text !== (x.value.trim() || " ") && (t.text = x.value.trim() || " ", K(), a("change", u.value));
1372
- const r = c.value;
1373
- c.value = null, e.addChild ? Z(() => Ce(r)) : e.addSibling === "after" ? Z(() => Fe(r)) : e.addSibling === "before" && Z(() => St(r));
1499
+ function Fe(e = {}) {
1500
+ if (!d.value) return;
1501
+ const t = A(u.value, d.value);
1502
+ t && t.text !== (x.value.trim() || " ") && (t.text = x.value.trim() || " ", G(), r("change", u.value));
1503
+ const a = d.value;
1504
+ d.value = null, e.addChild ? ee(() => Ee(a)) : e.addSibling === "after" ? ee(() => Ve(a)) : e.addSibling === "before" && ee(() => St(a));
1374
1505
  }
1375
1506
  function gn() {
1376
- c.value = null;
1507
+ d.value = null;
1377
1508
  }
1378
1509
  function yn(e) {
1379
1510
  const t = e.metaKey || e.ctrlKey;
1380
- t && (e.key === "z" || e.key === "Z") && !e.shiftKey ? (e.preventDefault(), nt()) : (t && e.shiftKey && (e.key === "z" || e.key === "Z") || t && (e.key === "y" || e.key === "Y") && !e.shiftKey) && (e.preventDefault(), it());
1511
+ t && (e.key === "z" || e.key === "Z") && !e.shiftKey ? (e.preventDefault(), it()) : (t && e.shiftKey && (e.key === "z" || e.key === "Z") || t && (e.key === "y" || e.key === "Y") && !e.shiftKey) && (e.preventDefault(), ot());
1381
1512
  }
1382
- function Ce(e) {
1383
- const t = ri(u.value, e, Je);
1384
- t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1513
+ function Ee(e) {
1514
+ const t = di(u.value, e, Ze);
1515
+ t && (G(), O(), r("change", u.value), ee(() => Le(t.id)));
1385
1516
  }
1386
- function Fe(e) {
1517
+ function Ve(e) {
1387
1518
  if (e === u.value.id) {
1388
- Ce(e);
1519
+ Ee(e);
1389
1520
  return;
1390
1521
  }
1391
- const t = ai(u.value, e, Je);
1392
- t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1522
+ const t = fi(u.value, e, Ze);
1523
+ t && (G(), O(), r("change", u.value), ee(() => Le(t.id)));
1393
1524
  }
1394
1525
  function St(e) {
1395
1526
  if (e === u.value.id) {
1396
- Ce(e);
1527
+ Ee(e);
1397
1528
  return;
1398
1529
  }
1399
- const t = ui(u.value, e, Je);
1400
- t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1530
+ const t = hi(u.value, e, Ze);
1531
+ t && (G(), O(), r("change", u.value), ee(() => Le(t.id)));
1401
1532
  }
1402
- function Et(e) {
1533
+ function zt(e) {
1403
1534
  if (e === u.value.id) return;
1404
- const t = si(u.value, e);
1405
- t && (K(), m.value = t.id, a("change", u.value), H());
1406
- }
1407
- function nt() {
1408
- const e = fe.undo();
1409
- e && (u.value = e.data, m.value = null, a("select", null), H(), a("change", u.value));
1535
+ const t = vi(u.value, e);
1536
+ t && (G(), f.value = t.id, r("change", u.value), O());
1410
1537
  }
1411
1538
  function it() {
1412
- const e = fe.redo();
1413
- e && (u.value = e.data, m.value = null, a("select", null), H(), a("change", u.value));
1539
+ const e = ve.undo();
1540
+ e && (u.value = e.data, f.value = null, r("select", null), O(), r("change", u.value));
1541
+ }
1542
+ function ot() {
1543
+ const e = ve.redo();
1544
+ e && (u.value = e.data, f.value = null, r("select", null), O(), r("change", u.value));
1414
1545
  }
1415
1546
  function xn(e, t) {
1416
- const r = m.value ?? u.value.id, v = B(u.value, r);
1417
- if (!v) return;
1418
- let f = null;
1547
+ const a = f.value ?? u.value.id, m = A(u.value, a);
1548
+ if (!m) return;
1549
+ let h = null;
1419
1550
  if (t === 1) {
1420
- const l = ae(u.value, v.id);
1551
+ const l = de(u.value, m.id);
1421
1552
  if (l) {
1422
- const g = l.children.findIndex(($) => $.id === v.id);
1423
- g >= 0 && g < l.children.length - 1 && (f = l.children[g + 1].id);
1553
+ const g = l.children.findIndex(($) => $.id === m.id);
1554
+ g >= 0 && g < l.children.length - 1 && (h = l.children[g + 1].id);
1424
1555
  }
1425
1556
  } else if (t === -1) {
1426
- const l = ae(u.value, v.id);
1557
+ const l = de(u.value, m.id);
1427
1558
  if (l) {
1428
- const g = l.children.findIndex(($) => $.id === v.id);
1429
- g > 0 && (f = l.children[g - 1].id);
1559
+ const g = l.children.findIndex(($) => $.id === m.id);
1560
+ g > 0 && (h = l.children[g - 1].id);
1430
1561
  }
1431
1562
  } else if (e === 1) {
1432
- const l = ae(u.value, v.id);
1433
- l && (f = l.id);
1434
- } else e === -1 && v.children.length > 0 && (f = v.children[0].id);
1435
- if (f) {
1436
- m.value = f;
1437
- const l = B(u.value, f);
1438
- l && a("select", l);
1563
+ const l = de(u.value, m.id);
1564
+ l && (h = l.id);
1565
+ } else e === -1 && m.children.length > 0 && (h = m.children[0].id);
1566
+ if (h) {
1567
+ f.value = h;
1568
+ const l = A(u.value, h);
1569
+ l && r("select", l);
1439
1570
  }
1440
1571
  }
1441
- function zt(e) {
1442
- e !== u.value.id && Gt(u.value, e) && (K(), m.value === e && (m.value = null), H(), a("change", u.value));
1572
+ function pn(e) {
1573
+ const t = e.split(`
1574
+ `);
1575
+ return /^(`{3,}|~{3,})/.test(t[0] ?? "") && t.shift(), /^(`{3,}|~{3,})\s*$/.test(t[t.length - 1] ?? "") && t.pop(), t.join(`
1576
+ `).replace(/\n+$/, "");
1577
+ }
1578
+ function wn(e) {
1579
+ return e.split(`
1580
+ `).map((t) => t.replace(/^\s*[-*+]\s+/, "").replace(/^\s*\d+\.\s+/, "").trim()).filter((t) => t.length > 0);
1581
+ }
1582
+ function bn(e) {
1583
+ return e.split(`
1584
+ `).filter((t) => t.trim().length > 0).filter((t) => !/^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/.test(t)).map(
1585
+ (t) => t.replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|").map((a) => a.trim())
1586
+ );
1587
+ }
1588
+ function kn(e) {
1589
+ return e.replace(/\s+/g, " ").trim();
1443
1590
  }
1444
1591
  function Nt(e) {
1445
- h.value.has(e) ? h.value.delete(e) : h.value.add(e), H();
1592
+ e !== u.value.id && jt(u.value, e) && (G(), f.value === e && (f.value = null), O(), r("change", u.value));
1446
1593
  }
1447
- function pn(e, t) {
1448
- oi(u.value, e, t) && (K(), H(), a("change", u.value));
1594
+ function $t(e) {
1595
+ v.value.has(e) ? v.value.delete(e) : v.value.add(e), O();
1449
1596
  }
1450
- function bn(e, t, r) {
1451
- return li(u.value, e, t, r) ? (K(), H(), a("change", u.value), !0) : !1;
1597
+ function Mn(e, t) {
1598
+ ui(u.value, e, t) && (G(), O(), r("change", u.value));
1452
1599
  }
1453
- function wn(e, t) {
1454
- e.stopPropagation(), m.value = t.id;
1455
- const r = B(u.value, t.id);
1456
- a("select", r);
1600
+ function Cn(e, t, a) {
1601
+ return ci(u.value, e, t, a) ? (G(), O(), r("change", u.value), !0) : !1;
1457
1602
  }
1458
- function kn(e) {
1603
+ function En(e, t) {
1604
+ e.stopPropagation(), f.value = t.id;
1605
+ const a = A(u.value, t.id);
1606
+ r("select", a);
1607
+ }
1608
+ function Sn(e) {
1459
1609
  const t = e.target;
1460
1610
  if (!t || t.closest(".zm-node, .zm-toolbar, button, input, textarea")) return;
1461
1611
  if (e.button === 2) {
1462
- E.startPan(e);
1612
+ S.startPan(e);
1463
1613
  return;
1464
1614
  }
1465
1615
  if (e.button !== 0) return;
1466
- const r = d.value.getBoundingClientRect(), v = (e.clientX - r.left - E.offsetX.value) / E.scale.value, f = (e.clientY - r.top - E.offsetY.value) / E.scale.value;
1467
- E.startMarquee(v, f);
1616
+ const a = c.value.getBoundingClientRect(), m = (e.clientX - a.left - S.offsetX.value) / S.scale.value, h = (e.clientY - a.top - S.offsetY.value) / S.scale.value;
1617
+ S.startMarquee(m, h);
1468
1618
  }
1469
- function Mn(e) {
1470
- if (_e) {
1471
- _e = !1;
1619
+ function zn(e) {
1620
+ if (et) {
1621
+ et = !1;
1472
1622
  return;
1473
1623
  }
1474
1624
  const t = e.target;
1475
1625
  if (!t || t.closest(".zm-node")) return;
1476
- const r = E.marquee;
1477
- r.width >= 4 || r.height >= 4 || m.value !== null && (m.value = null, a("select", null));
1626
+ const a = S.marquee;
1627
+ a.width >= 4 || a.height >= 4 || f.value !== null && (f.value = null, r("select", null));
1478
1628
  }
1479
- function Cn() {
1480
- const e = E.marquee;
1629
+ function Nn() {
1630
+ const e = S.marquee;
1481
1631
  if (e.width < 4 && e.height < 4)
1482
1632
  return;
1483
- const t = e.x, r = e.y, v = e.x + e.width, f = e.y + e.height, l = [];
1484
- for (const g of tt.value) {
1485
- const $ = g.width / 2, X = g.height / 2, J = g.x - $, ye = g.x + $, Se = g.y - X, Ee = g.y + X;
1486
- J <= v && ye >= t && Se <= f && Ee >= r && l.push(g.id);
1633
+ const t = e.x, a = e.y, m = e.x + e.width, h = e.y + e.height, l = [];
1634
+ for (const g of nt.value) {
1635
+ const $ = g.width / 2, X = g.height / 2, J = g.x - $, we = g.x + $, Se = g.y - X, ze = g.y + X;
1636
+ J <= m && we >= t && Se <= h && ze >= a && l.push(g.id);
1487
1637
  }
1488
1638
  if (l.length > 0) {
1489
- m.value = l[0];
1490
- const g = B(u.value, l[0]);
1491
- g && a("select", g);
1639
+ f.value = l[0];
1640
+ const g = A(u.value, l[0]);
1641
+ g && r("select", g);
1492
1642
  }
1493
1643
  }
1494
1644
  function It(e) {
1495
- return h.value.has(e);
1645
+ return v.value.has(e);
1496
1646
  }
1497
- function Sn(e) {
1498
- const t = B(u.value, e.id);
1647
+ function $n(e) {
1648
+ const t = A(u.value, e.id);
1499
1649
  return !!t && t.children.length > 0;
1500
1650
  }
1501
- function ot(e) {
1502
- const t = B(u.value, e);
1651
+ function lt(e) {
1652
+ const t = A(u.value, e);
1503
1653
  return t ? t.children.length : 0;
1504
1654
  }
1505
1655
  function Wt(e) {
1506
- if (!B(u.value, e)) return 0;
1507
- const v = [u.value];
1508
- for (; v.length; ) {
1509
- const f = v.pop(), l = f.children.findIndex((g) => g.id === e);
1656
+ if (!A(u.value, e)) return 0;
1657
+ const m = [u.value];
1658
+ for (; m.length; ) {
1659
+ const h = m.pop(), l = h.children.findIndex((g) => g.id === e);
1510
1660
  if (l >= 0) return l;
1511
- for (const g of f.children) v.push(g);
1661
+ for (const g of h.children) m.push(g);
1512
1662
  }
1513
1663
  return 0;
1514
1664
  }
1515
- function $t(e, t, r, v) {
1516
- if (((v == null ? void 0 : v._dir) ?? e._dir) === "down")
1665
+ function Rt(e, t, a, m) {
1666
+ if (((m == null ? void 0 : m._dir) ?? e._dir) === "down")
1517
1667
  return t === "out" ? { x: e.x, y: e.y + e.height / 2 } : { x: e.x, y: e.y - e.height / 2 };
1518
1668
  let l;
1519
- return t === "in" ? l = -e.side : r !== void 0 ? l = r : l = e.side, { x: e.x + l * (e.width / 2), y: e.y };
1669
+ return t === "in" ? l = -e.side : a !== void 0 ? l = a : l = e.side, { x: e.x + l * (e.width / 2), y: e.y };
1520
1670
  }
1521
- function se() {
1522
- const e = ee.value;
1523
- E.resetView(e.width, e.height, e.root.y);
1671
+ function fe() {
1672
+ const e = ie.value;
1673
+ S.resetView(e.width, e.height, e.root.y);
1524
1674
  }
1525
- function En() {
1526
- et.value = !0, K(), H(), Z(() => se());
1675
+ function In() {
1676
+ tt.value = !0, G(), O(), ee(() => fe());
1527
1677
  }
1528
- function lt(e) {
1529
- k.layoutMode !== e && (k.layoutMode = e, H(), Z(() => se()));
1678
+ function rt(e) {
1679
+ E.layoutMode !== e && (E.layoutMode = e, O(), ee(() => fe()));
1530
1680
  }
1531
1681
  function Bt() {
1532
1682
  return JSON.stringify(u.value, null, 2);
1533
1683
  }
1534
- function Rt(e) {
1684
+ function Lt(e) {
1535
1685
  try {
1536
1686
  const t = JSON.parse(e);
1537
- return !t.id || !Array.isArray(t.children) ? !1 : (fe.reset(), u.value = he(t), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), Z(() => se()), a("change", u.value), !0);
1687
+ return !t.id || !Array.isArray(t.children) ? !1 : (ve.reset(), u.value = ye(t), f.value = null, v.value = /* @__PURE__ */ new Set(), O(), ee(() => fe()), r("change", u.value), !0);
1538
1688
  } catch {
1539
1689
  return !1;
1540
1690
  }
1541
1691
  }
1542
- function zn() {
1692
+ function Wn() {
1543
1693
  const e = document.createElement("input");
1544
1694
  e.type = "file", e.accept = "application/json", e.onchange = () => {
1545
- var v;
1546
- const t = (v = e.files) == null ? void 0 : v[0];
1695
+ var m;
1696
+ const t = (m = e.files) == null ? void 0 : m[0];
1547
1697
  if (!t) return;
1548
- const r = new FileReader();
1549
- r.onload = () => {
1550
- typeof r.result == "string" && (Rt(r.result) || alert("导入失败:JSON 格式无效"));
1551
- }, r.readAsText(t);
1698
+ const a = new FileReader();
1699
+ a.onload = () => {
1700
+ typeof a.result == "string" && (Lt(a.result) || alert("导入失败:JSON 格式无效"));
1701
+ }, a.readAsText(t);
1552
1702
  }, e.click();
1553
1703
  }
1554
- function Nn() {
1555
- const e = new Blob([Bt()], { type: "application/json" }), t = URL.createObjectURL(e), r = document.createElement("a");
1556
- r.href = t, r.download = `${u.value.text || "mindmap"}.json`, r.click(), URL.revokeObjectURL(t);
1704
+ function Rn() {
1705
+ const e = new Blob([Bt()], { type: "application/json" }), t = URL.createObjectURL(e), a = document.createElement("a");
1706
+ a.href = t, a.download = `${u.value.text || "mindmap"}.json`, a.click(), URL.revokeObjectURL(t);
1557
1707
  }
1558
1708
  return s({
1559
- addChild: (e) => Ce(e),
1560
- addSibling: (e) => Fe(e),
1561
- removeNode: (e) => zt(e),
1562
- duplicateNode: (e) => Et(e),
1563
- setNodeText: (e, t) => pn(e, t),
1564
- moveNode: (e, t, r) => bn(e, t, r),
1565
- lineWidthForDepth: xt,
1566
- endWidthForDepth: pt,
1709
+ addChild: (e) => Ee(e),
1710
+ addSibling: (e) => Ve(e),
1711
+ removeNode: (e) => Nt(e),
1712
+ duplicateNode: (e) => zt(e),
1713
+ setNodeText: (e, t) => Mn(e, t),
1714
+ moveNode: (e, t, a) => Cn(e, t, a),
1715
+ lineWidthForDepth: pt,
1716
+ endWidthForDepth: wt,
1567
1717
  getData: () => u.value,
1568
1718
  setData: (e) => {
1569
- fe.reset(), u.value = he(e), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), K(), Z(() => se());
1719
+ ve.reset(), u.value = ye(e), f.value = null, v.value = /* @__PURE__ */ new Set(), O(), G(), ee(() => fe());
1570
1720
  },
1571
- resetView: () => se(),
1721
+ resetView: () => fe(),
1572
1722
  exportData: Bt,
1573
- importData: Rt,
1723
+ importData: Lt,
1574
1724
  /** Serialize the current data tree as markdown. Always available
1575
1725
  * — the same serializer is used to emit `markdownChange`. */
1576
- getMarkdown: () => st(u.value),
1726
+ getMarkdown: () => ct(u.value),
1577
1727
  /** Replace the data tree with the result of parsing `md`. The
1578
1728
  * flag `emitMarkdownChange` (default true) controls whether the
1579
1729
  * change is also echoed via `markdownChange` (use false when
1580
1730
  * the host just set the same value back from the prop). */
1581
1731
  setMarkdown: (e, t = !0) => {
1582
- const r = Xt(e || "");
1583
- t && (p.value = !0), S = !t, fe.reset(), u.value = he(r), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), K(), Z(() => {
1584
- S = !1, se();
1585
- }), a("change", u.value);
1732
+ const a = Xt(e || "");
1733
+ t && (y.value = !0), C = !t, ve.reset(), u.value = ye(a), f.value = null, v.value = /* @__PURE__ */ new Set(), O(), G(), ee(() => {
1734
+ C = !1, fe();
1735
+ }), r("change", u.value);
1586
1736
  },
1587
1737
  // Make balanced the active layout (sticky). Subsequent data changes
1588
1738
  // and additions stay in balanced mode. Pass `false` to revert to the
1589
1739
  // default compact layout.
1590
1740
  setBalanced: (e) => {
1591
- et.value = e;
1741
+ tt.value = e;
1592
1742
  },
1593
- isBalanced: () => et.value,
1743
+ isBalanced: () => tt.value,
1594
1744
  // Re-balance now: clear all manual drag offsets, re-run the balanced
1595
1745
  // layout, and re-center the view. This is the action tied to the
1596
1746
  // "balance" toolbar button.
1597
- balance: () => En(),
1598
- applyNodeStyle: (e, t) => ce(e, t),
1599
- getNodeStyle: (e) => ue(e),
1600
- applyNodeLink: (e, t) => Y(e, t),
1601
- removeNodeLink: (e) => re(e),
1602
- applyNodeNote: (e, t) => me(e, t),
1603
- removeNodeNote: (e) => I(e),
1604
- undo: () => nt(),
1605
- redo: () => it(),
1606
- canUndo: () => fe.canUndo(),
1607
- canRedo: () => fe.canRedo(),
1747
+ balance: () => In(),
1748
+ applyNodeStyle: (e, t) => Q(e, t),
1749
+ getNodeStyle: (e) => K(e),
1750
+ applyNodeLink: (e, t) => V(e, t),
1751
+ removeNodeLink: (e) => ue(e),
1752
+ applyNodeNote: (e, t) => xe(e, t),
1753
+ removeNodeNote: (e) => W(e),
1754
+ undo: () => it(),
1755
+ redo: () => ot(),
1756
+ canUndo: () => ve.canUndo(),
1757
+ canRedo: () => ve.canRedo(),
1608
1758
  // Settings panel / external mutation hooks
1609
1759
  applySettings: (e) => {
1610
- e.autoBalanceOnChange !== void 0 && (k.autoBalanceOnChange = e.autoBalanceOnChange), e.lineWidthStart !== void 0 && (k.lineWidthStart = Math.max(0.5, Math.min(20, e.lineWidthStart))), e.lineWidthEnd !== void 0 && (k.lineWidthEnd = Math.max(0.3, Math.min(10, e.lineWidthEnd))), e.rainbowBranch !== void 0 && (k.rainbowBranch = e.rainbowBranch), e.branchPaletteId !== void 0 && (k.branchPaletteId = e.branchPaletteId), e.customPalettes !== void 0 && (k.customPalettes = e.customPalettes), e.lineStyle !== void 0 && (k.lineStyle = e.lineStyle), e.taperedEdge !== void 0 && (k.taperedEdge = e.taperedEdge), e.showOrderBadge !== void 0 && (k.showOrderBadge = e.showOrderBadge);
1760
+ e.autoBalanceOnChange !== void 0 && (E.autoBalanceOnChange = e.autoBalanceOnChange), e.lineWidthStart !== void 0 && (E.lineWidthStart = Math.max(0.5, Math.min(20, e.lineWidthStart))), e.lineWidthEnd !== void 0 && (E.lineWidthEnd = Math.max(0.3, Math.min(10, e.lineWidthEnd))), e.rainbowBranch !== void 0 && (E.rainbowBranch = e.rainbowBranch), e.branchPaletteId !== void 0 && (E.branchPaletteId = e.branchPaletteId), e.customPalettes !== void 0 && (E.customPalettes = e.customPalettes), e.lineStyle !== void 0 && (E.lineStyle = e.lineStyle), e.taperedEdge !== void 0 && (E.taperedEdge = e.taperedEdge), e.showOrderBadge !== void 0 && (E.showOrderBadge = e.showOrderBadge);
1611
1761
  },
1612
1762
  getSettings: () => ({
1613
- autoBalanceOnChange: k.autoBalanceOnChange,
1614
- lineWidthStart: k.lineWidthStart,
1615
- lineWidthEnd: k.lineWidthEnd,
1616
- rainbowBranch: k.rainbowBranch,
1617
- branchPaletteId: k.branchPaletteId,
1618
- customPalettes: k.customPalettes,
1619
- lineStyle: k.lineStyle,
1620
- layoutMode: k.layoutMode,
1621
- taperedEdge: k.taperedEdge,
1622
- showOrderBadge: k.showOrderBadge
1763
+ autoBalanceOnChange: E.autoBalanceOnChange,
1764
+ lineWidthStart: E.lineWidthStart,
1765
+ lineWidthEnd: E.lineWidthEnd,
1766
+ rainbowBranch: E.rainbowBranch,
1767
+ branchPaletteId: E.branchPaletteId,
1768
+ customPalettes: E.customPalettes,
1769
+ lineStyle: E.lineStyle,
1770
+ layoutMode: E.layoutMode,
1771
+ taperedEdge: E.taperedEdge,
1772
+ showOrderBadge: E.showOrderBadge
1623
1773
  }),
1624
1774
  setBranchPalette: (e) => {
1625
1775
  if (!e) return;
1626
- [...Pe, ...k.customPalettes].find((r) => r.id === e) && (k.branchPaletteId = e);
1776
+ [...Te, ...E.customPalettes].find((a) => a.id === e) && (E.branchPaletteId = e);
1627
1777
  },
1628
- getBranchPalette: () => k.branchPaletteId,
1629
- getBranchPalettes: () => [...Pe, ...k.customPalettes]
1778
+ getBranchPalette: () => E.branchPaletteId,
1779
+ getBranchPalettes: () => [...Te, ...E.customPalettes]
1630
1780
  }), Ye(
1631
- () => i.data,
1781
+ () => n.data,
1632
1782
  (e) => {
1633
- u.value = he(e), H();
1783
+ u.value = ye(e), O();
1634
1784
  },
1635
1785
  { deep: !1 }
1636
1786
  ), ut(() => {
1637
- K(), Z(() => se());
1787
+ G(), ee(() => fe());
1638
1788
  }), (e, t) => {
1639
- var r, v, f;
1640
- return M(), C("div", {
1789
+ var a, m, h;
1790
+ return w(), b("div", {
1641
1791
  class: "zm-mindmap",
1642
- style: ve({ background: oe.value.bgColor, fontSize: oe.value.fontSize + "px" })
1792
+ style: ge({ background: ae.value.bgColor, fontSize: ae.value.fontSize + "px" })
1643
1793
  }, [
1644
- y("div", {
1794
+ p("div", {
1645
1795
  ref_key: "wrapperRef",
1646
- ref: d,
1796
+ ref: c,
1647
1797
  class: "zm-canvas",
1648
- onMousedown: kn,
1649
- onContextmenu: t[13] || (t[13] = R(() => {
1798
+ onMousedown: Sn,
1799
+ onContextmenu: t[16] || (t[16] = H(() => {
1650
1800
  }, ["prevent"])),
1651
- onWheel: t[14] || (t[14] = //@ts-ignore
1652
- (...l) => z(E).onWheel && z(E).onWheel(...l)),
1653
- onClick: Mn
1801
+ onWheel: t[17] || (t[17] = //@ts-ignore
1802
+ (...l) => N(S).onWheel && N(S).onWheel(...l)),
1803
+ onClick: zn
1654
1804
  }, [
1655
- y("div", {
1805
+ p("div", {
1656
1806
  class: "zm-svg-layer",
1657
- style: ve({
1658
- left: ee.value.vbX * z(E).scale.value + z(E).offsetX.value + "px",
1659
- top: ee.value.vbY * z(E).scale.value + z(E).offsetY.value + "px",
1660
- width: ee.value.vbW * z(E).scale.value + "px",
1661
- height: ee.value.vbH * z(E).scale.value + "px"
1807
+ style: ge({
1808
+ left: ie.value.vbX * N(S).scale.value + N(S).offsetX.value + "px",
1809
+ top: ie.value.vbY * N(S).scale.value + N(S).offsetY.value + "px",
1810
+ width: ie.value.vbW * N(S).scale.value + "px",
1811
+ height: ie.value.vbH * N(S).scale.value + "px"
1662
1812
  })
1663
1813
  }, [
1664
- (M(), C("svg", {
1814
+ (w(), b("svg", {
1665
1815
  class: "zm-svg",
1666
1816
  viewBox: mn.value,
1667
1817
  preserveAspectRatio: "xMinYMin meet",
1668
- width: ee.value.vbW * z(E).scale.value,
1669
- height: ee.value.vbH * z(E).scale.value
1818
+ width: ie.value.vbW * N(S).scale.value,
1819
+ height: ie.value.vbH * N(S).scale.value
1670
1820
  }, [
1671
- y("g", ki, [
1672
- (M(!0), C(P, null, Ot(hn.value, (l) => (M(), C("path", {
1821
+ p("g", Ni, [
1822
+ (w(!0), b(P, null, De(vn.value, (l) => (w(), b("path", {
1673
1823
  key: l.key,
1674
- d: rn($t(l.from, "out", l.to.side, l.to), $t(l.to, "in"), xt(l.from.depth), pt(l.to.depth), 32, k.lineStyle, l.to._dir),
1675
- fill: un(l.from, l.to),
1824
+ d: rn(Rt(l.from, "out", l.to.side, l.to), Rt(l.to, "in"), pt(l.from.depth), wt(l.to.depth), 32, E.lineStyle, l.to._dir),
1825
+ fill: sn(l.from, l.to),
1676
1826
  stroke: "none"
1677
- }, null, 8, Mi))), 128))
1827
+ }, null, 8, $i))), 128))
1678
1828
  ])
1679
- ], 8, wi))
1829
+ ], 8, zi))
1680
1830
  ], 4),
1681
- z(E).isMarquee.value ? (M(), C("div", {
1831
+ N(S).isMarquee.value ? (w(), b("div", {
1682
1832
  key: 0,
1683
1833
  class: "zm-marquee",
1684
- style: ve({
1685
- left: z(E).marquee.x * z(E).scale.value + z(E).offsetX.value + "px",
1686
- top: z(E).marquee.y * z(E).scale.value + z(E).offsetY.value + "px",
1687
- width: z(E).marquee.width * z(E).scale.value + "px",
1688
- height: z(E).marquee.height * z(E).scale.value + "px"
1834
+ style: ge({
1835
+ left: N(S).marquee.x * N(S).scale.value + N(S).offsetX.value + "px",
1836
+ top: N(S).marquee.y * N(S).scale.value + N(S).offsetY.value + "px",
1837
+ width: N(S).marquee.width * N(S).scale.value + "px",
1838
+ height: N(S).marquee.height * N(S).scale.value + "px"
1689
1839
  })
1690
- }, null, 4)) : O("", !0),
1691
- y("div", {
1840
+ }, null, 4)) : q("", !0),
1841
+ p("div", {
1692
1842
  class: "zm-world",
1693
- style: ve({
1694
- transform: `translate(${z(E).offsetX.value}px, ${z(E).offsetY.value}px) scale(${z(E).scale.value})`
1843
+ style: ge({
1844
+ transform: `translate(${N(S).offsetX.value}px, ${N(S).offsetY.value}px) scale(${N(S).scale.value})`
1695
1845
  })
1696
1846
  }, [
1697
- (M(!0), C(P, null, Ot(tt.value, (l) => (M(), C("div", {
1847
+ (w(!0), b(P, null, De(nt.value, (l) => (w(), b("div", {
1698
1848
  key: l.id,
1699
- class: Ie(["zm-node", {
1849
+ class: me(["zm-node", {
1700
1850
  "is-root": l.isRoot,
1701
- "is-selected": m.value === l.id,
1702
- "is-editing": c.value === l.id,
1851
+ "is-selected": f.value === l.id,
1852
+ "is-editing": d.value === l.id,
1703
1853
  "has-image": !!l.image,
1704
1854
  "is-resizing": _t.value === l.id
1705
1855
  }]),
1706
1856
  "data-node-id": l.id,
1707
- style: ve({
1857
+ style: ge({
1708
1858
  left: l.x + "px",
1709
1859
  top: l.y + "px",
1710
1860
  minWidth: l.width + "px",
1711
1861
  height: l.height + "px",
1712
1862
  fontSize: l.fontSize + "px",
1713
- background: sn(l),
1714
- color: dn(l),
1715
- borderColor: cn(l),
1863
+ background: un(l),
1864
+ color: cn(l),
1865
+ borderColor: dn(l),
1716
1866
  fontWeight: fn(l),
1717
1867
  // Center the box on (x, y) with translate(-50%, -50%)
1718
1868
  transform: "translate(-50%, -50%)"
1719
1869
  }),
1720
- onClick: (g) => wn(g, l),
1870
+ onClick: (g) => En(g, l),
1721
1871
  onDblclick: (g) => {
1722
- g.stopPropagation(), n.readonly || Ae(l.id);
1872
+ g.stopPropagation(), i.readonly || Le(l.id);
1723
1873
  },
1724
- onContextmenu: (g) => j(g, l),
1874
+ onContextmenu: (g) => _(g, l),
1725
1875
  onMouseenter: (g) => tn(l.id),
1726
1876
  onMouseleave: (g) => nn(l.id)
1727
1877
  }, [
1728
- l.image ? (M(), C("img", {
1878
+ l.image ? (w(), b("img", {
1729
1879
  key: 0,
1730
1880
  class: "zm-node-img",
1731
1881
  src: l.image.src,
@@ -1733,242 +1883,268 @@ const hi = ["disabled"], mi = ["disabled"], gi = ["disabled"], yi = ["disabled"]
1733
1883
  height: l.image.height,
1734
1884
  alt: l.text,
1735
1885
  draggable: "false"
1736
- }, null, 8, Si)) : O("", !0),
1737
- c.value !== l.id ? (M(), C("span", Ei, [
1738
- y("span", zi, be(l.text), 1),
1739
- l.link && !c.value ? (M(), C("a", {
1886
+ }, null, 8, Wi)) : q("", !0),
1887
+ d.value !== l.id ? (w(), b("span", Ri, [
1888
+ p("span", Bi, se(l.text), 1),
1889
+ l.link && !d.value ? (w(), b("a", {
1740
1890
  key: 0,
1741
1891
  class: "zm-node-link",
1742
1892
  href: l.link.url,
1743
1893
  target: "_blank",
1744
1894
  rel: "noopener noreferrer",
1745
1895
  title: `打开链接:${l.link.url}`,
1746
- onClick: t[0] || (t[0] = R(() => {
1896
+ onClick: t[0] || (t[0] = H(() => {
1747
1897
  }, ["stop"])),
1748
- onMousedown: t[1] || (t[1] = R(() => {
1898
+ onMousedown: t[1] || (t[1] = H(() => {
1749
1899
  }, ["stop"]))
1750
1900
  }, [
1751
- F(V, {
1901
+ U(Y, {
1752
1902
  name: "link",
1753
1903
  size: 11,
1754
1904
  stroke: 2
1755
1905
  })
1756
- ], 40, Ni)) : O("", !0),
1757
- l.note && !c.value ? (M(), C("button", {
1906
+ ], 40, Li)) : q("", !0),
1907
+ l.note && !d.value ? (w(), b("button", {
1758
1908
  key: 1,
1759
1909
  class: "zm-node-note-btn",
1760
1910
  type: "button",
1761
1911
  title: Qt(l.note.text),
1762
- onClick: R((g) => vt(l.id), ["stop"]),
1763
- onMousedown: t[2] || (t[2] = R(() => {
1912
+ onClick: H((g) => vt(l.id), ["stop"]),
1913
+ onMousedown: t[2] || (t[2] = H(() => {
1764
1914
  }, ["stop"]))
1765
1915
  }, [
1766
- F(V, {
1916
+ U(Y, {
1767
1917
  name: "note",
1768
1918
  size: 11,
1769
1919
  stroke: 2
1770
1920
  })
1771
- ], 40, Ii)) : O("", !0)
1772
- ])) : Wn((M(), C("input", {
1921
+ ], 40, Ai)) : q("", !0)
1922
+ ])) : q("", !0),
1923
+ l.richContent && d.value !== l.id ? (w(), b("div", {
1773
1924
  key: 2,
1925
+ class: me(["zm-rich", `zm-rich-${l.richContent.kind}`]),
1926
+ onClick: t[3] || (t[3] = H(() => {
1927
+ }, ["stop"])),
1928
+ onDblclick: t[4] || (t[4] = H(() => {
1929
+ }, ["stop"])),
1930
+ onMousedown: t[5] || (t[5] = H(() => {
1931
+ }, ["stop"]))
1932
+ }, [
1933
+ l.richContent.kind === "code" ? (w(), b("pre", Hi, [
1934
+ p("code", {
1935
+ class: me(l.richContent.lang ? `language-${l.richContent.lang}` : "")
1936
+ }, se(pn(l.richContent.raw)), 3)
1937
+ ])) : l.richContent.kind === "list" ? (w(), b("ul", Di, [
1938
+ (w(!0), b(P, null, De(wn(l.richContent.raw), (g, $) => (w(), b("li", { key: $ }, se(g), 1))), 128))
1939
+ ])) : l.richContent.kind === "table" ? (w(), b("table", Pi, [
1940
+ p("tbody", null, [
1941
+ (w(!0), b(P, null, De(bn(l.richContent.raw), (g, $) => (w(), b("tr", { key: $ }, [
1942
+ (w(!0), b(P, null, De(g, (X, J) => (w(), b("td", { key: J }, se(X), 1))), 128))
1943
+ ]))), 128))
1944
+ ])
1945
+ ])) : (w(), b("div", Ti, se(kn(l.richContent.raw)), 1))
1946
+ ], 34)) : Ln((w(), b("input", {
1947
+ key: 3,
1774
1948
  class: "zm-input",
1775
- "onUpdate:modelValue": t[3] || (t[3] = (g) => x.value = g),
1949
+ "onUpdate:modelValue": t[6] || (t[6] = (g) => x.value = g),
1776
1950
  autofocus: "",
1777
- onBlur: t[4] || (t[4] = (g) => Oe()),
1951
+ onBlur: t[7] || (t[7] = (g) => Fe()),
1778
1952
  onKeydown: [
1779
- t[5] || (t[5] = Ke(R((g) => Oe({ addSibling: "after" }), ["exact"]), ["enter"])),
1780
- t[6] || (t[6] = Ke(R((g) => Oe({ addSibling: "before" }), ["shift", "prevent", "exact"]), ["enter"])),
1781
- t[7] || (t[7] = Ke(R((g) => Oe({ addChild: !0 }), ["prevent"]), ["tab"])),
1953
+ t[8] || (t[8] = Ke(H((g) => Fe({ addSibling: "after" }), ["exact"]), ["enter"])),
1954
+ t[9] || (t[9] = Ke(H((g) => Fe({ addSibling: "before" }), ["shift", "prevent", "exact"]), ["enter"])),
1955
+ t[10] || (t[10] = Ke(H((g) => Fe({ addChild: !0 }), ["prevent"]), ["tab"])),
1782
1956
  Ke(gn, ["esc"]),
1783
1957
  yn
1784
1958
  ],
1785
- onMousedown: t[8] || (t[8] = R(() => {
1959
+ onMousedown: t[11] || (t[11] = H(() => {
1786
1960
  }, ["stop"])),
1787
- onClick: t[9] || (t[9] = R(() => {
1961
+ onClick: t[12] || (t[12] = H(() => {
1788
1962
  }, ["stop"]))
1789
1963
  }, null, 544)), [
1790
- [$n, x.value]
1964
+ [An, x.value]
1791
1965
  ]),
1792
- b.value ? (M(), C("span", {
1793
- key: 3,
1966
+ k.value ? (w(), b("span", {
1967
+ key: 4,
1794
1968
  class: "zm-order-badge",
1795
1969
  title: `数据顺序:第 ${Wt(l.id) + 1} 个`
1796
- }, be(Wt(l.id) + 1), 9, Wi)) : O("", !0),
1797
- It(l.id) && !l.isRoot && ot(l.id) > 0 ? (M(), C("span", {
1798
- key: 4,
1799
- class: Ie(["zm-collapse-badge", { "is-on-left": l.side === -1 }]),
1800
- style: ve({ background: ge.value.get(l.id) ?? "#64748b" }),
1801
- title: `展开 ${ot(l.id)} 个子节点`,
1802
- onMousedown: t[10] || (t[10] = R(() => {
1803
- }, ["stop"])),
1804
- onClick: R((g) => Nt(l.id), ["stop"])
1805
- }, be(ot(l.id)), 47, $i)) : O("", !0),
1806
- !n.readonly && !l.isRoot && Sn(l) && !It(l.id) ? (M(), C("button", {
1970
+ }, se(Wt(l.id) + 1), 9, Oi)) : q("", !0),
1971
+ It(l.id) && !l.isRoot && lt(l.id) > 0 ? (w(), b("span", {
1807
1972
  key: 5,
1808
- class: Ie(["zm-btn zm-collapse", { "is-on-left": l.side === -1 }]),
1809
- style: ve({ color: ge.value.get(l.id) ?? "#64748b", borderColor: ge.value.get(l.id) ?? "#64748b" }),
1973
+ class: me(["zm-collapse-badge", { "is-on-left": l.side === -1 }]),
1974
+ style: ge({ background: pe.value.get(l.id) ?? "#64748b" }),
1975
+ title: `展开 ${lt(l.id)} 个子节点`,
1976
+ onMousedown: t[13] || (t[13] = H(() => {
1977
+ }, ["stop"])),
1978
+ onClick: H((g) => $t(l.id), ["stop"])
1979
+ }, se(lt(l.id)), 47, Fi)) : q("", !0),
1980
+ !i.readonly && !l.isRoot && $n(l) && !It(l.id) ? (w(), b("button", {
1981
+ key: 6,
1982
+ class: me(["zm-btn zm-collapse", { "is-on-left": l.side === -1 }]),
1983
+ style: ge({ color: pe.value.get(l.id) ?? "#64748b", borderColor: pe.value.get(l.id) ?? "#64748b" }),
1810
1984
  title: "折叠",
1811
- onMousedown: t[11] || (t[11] = R(() => {
1985
+ onMousedown: t[14] || (t[14] = H(() => {
1812
1986
  }, ["stop"])),
1813
- onClick: R((g) => Nt(l.id), ["stop"])
1987
+ onClick: H((g) => $t(l.id), ["stop"])
1814
1988
  }, [
1815
- F(V, {
1989
+ U(Y, {
1816
1990
  name: "minus",
1817
1991
  size: 10,
1818
1992
  stroke: 2.4
1819
1993
  })
1820
- ], 46, Bi)) : O("", !0),
1821
- l.image && m.value === l.id && c.value !== l.id ? (M(), C("span", {
1822
- key: 6,
1994
+ ], 46, Vi)) : q("", !0),
1995
+ l.image && f.value === l.id && d.value !== l.id ? (w(), b("span", {
1996
+ key: 7,
1823
1997
  class: "zm-img-resize-handle",
1824
1998
  title: "拖动调整图片大小",
1825
- onMousedown: R((g) => en(g, l), ["stop"])
1826
- }, null, 40, Ri)) : O("", !0),
1827
- l.image && m.value === l.id && c.value !== l.id ? (M(), C("button", {
1828
- key: 7,
1999
+ onMousedown: H((g) => en(g, l), ["stop"])
2000
+ }, null, 40, Xi)) : q("", !0),
2001
+ l.image && f.value === l.id && d.value !== l.id ? (w(), b("button", {
2002
+ key: 8,
1829
2003
  class: "zm-img-remove-btn",
1830
2004
  title: "移除图片",
1831
- onMousedown: t[12] || (t[12] = R(() => {
2005
+ onMousedown: t[15] || (t[15] = H(() => {
1832
2006
  }, ["stop"])),
1833
- onClick: R((g) => G(l.id), ["stop"])
2007
+ onClick: H((g) => z(l.id), ["stop"])
1834
2008
  }, [
1835
- F(V, {
2009
+ U(Y, {
1836
2010
  name: "x",
1837
2011
  size: 9,
1838
2012
  stroke: 2.2
1839
2013
  })
1840
- ], 40, Ai)) : O("", !0)
1841
- ], 46, Ci))), 128))
2014
+ ], 40, qi)) : q("", !0)
2015
+ ], 46, Ii))), 128))
1842
2016
  ], 4),
1843
- W.value ? (M(), Bn(bi, {
2017
+ B.value ? (w(), Hn(Si, {
1844
2018
  key: 1,
1845
- x: W.value.x,
1846
- y: W.value.y,
1847
- container: d.value,
1848
- "has-image": !!((r = z(B)(u.value, W.value.nodeId)) != null && r.image),
1849
- "has-link": !!((v = z(B)(u.value, W.value.nodeId)) != null && v.link),
1850
- "has-note": !!((f = z(B)(u.value, W.value.nodeId)) != null && f.note),
1851
- readonly: i.readonly,
1852
- onPickImage: ne,
2019
+ x: B.value.x,
2020
+ y: B.value.y,
2021
+ container: c.value,
2022
+ "has-image": !!((a = N(A)(u.value, B.value.nodeId)) != null && a.image),
2023
+ "has-link": !!((m = N(A)(u.value, B.value.nodeId)) != null && m.link),
2024
+ "has-note": !!((h = N(A)(u.value, B.value.nodeId)) != null && h.note),
2025
+ readonly: n.readonly,
2026
+ onPickImage: le,
1853
2027
  onRemoveImage: Zt,
1854
- onSetLink: ie,
1855
- onRemoveLink: ke,
1856
- onEditNote: Be,
1857
- onRemoveNote: Me,
1858
- onClose: _
1859
- }, null, 8, ["x", "y", "container", "has-image", "has-link", "has-note", "readonly"])) : O("", !0)
2028
+ onSetLink: re,
2029
+ onRemoveLink: Me,
2030
+ onEditNote: Re,
2031
+ onRemoveNote: Ce,
2032
+ onClose: ne
2033
+ }, null, 8, ["x", "y", "container", "has-image", "has-link", "has-note", "readonly"])) : q("", !0)
1860
2034
  ], 544),
1861
- i.previewMode ? O("", !0) : (M(), C("div", Li, [
1862
- y("button", {
2035
+ n.previewMode ? q("", !0) : (w(), b("div", Ui, [
2036
+ p("button", {
1863
2037
  class: "zm-tb-btn",
1864
2038
  title: "放大",
1865
- onClick: t[15] || (t[15] = //@ts-ignore
1866
- (...l) => z(E).zoomIn && z(E).zoomIn(...l))
2039
+ onClick: t[18] || (t[18] = //@ts-ignore
2040
+ (...l) => N(S).zoomIn && N(S).zoomIn(...l))
1867
2041
  }, [
1868
- F(V, { name: "zoom-in" })
2042
+ U(Y, { name: "zoom-in" })
1869
2043
  ]),
1870
- y("button", {
2044
+ p("button", {
1871
2045
  class: "zm-tb-btn",
1872
2046
  title: "缩小",
1873
- onClick: t[16] || (t[16] = //@ts-ignore
1874
- (...l) => z(E).zoomOut && z(E).zoomOut(...l))
2047
+ onClick: t[19] || (t[19] = //@ts-ignore
2048
+ (...l) => N(S).zoomOut && N(S).zoomOut(...l))
1875
2049
  }, [
1876
- F(V, { name: "zoom-out" })
2050
+ U(Y, { name: "zoom-out" })
1877
2051
  ]),
1878
- y("button", {
2052
+ p("button", {
1879
2053
  class: "zm-tb-btn",
1880
2054
  title: "重置视图",
1881
- onClick: se
2055
+ onClick: fe
1882
2056
  }, [
1883
- F(V, { name: "reset" })
2057
+ U(Y, { name: "reset" })
1884
2058
  ]),
1885
- t[22] || (t[22] = y("span", { class: "zm-tb-divider" }, null, -1)),
1886
- n.readonly ? O("", !0) : (M(), C("button", {
2059
+ t[25] || (t[25] = p("span", { class: "zm-tb-divider" }, null, -1)),
2060
+ i.readonly ? q("", !0) : (w(), b("button", {
1887
2061
  key: 0,
1888
2062
  class: "zm-tb-btn",
1889
2063
  title: "添加子节点 (Tab)",
1890
- onClick: t[17] || (t[17] = (l) => m.value && Ce(m.value))
2064
+ onClick: t[20] || (t[20] = (l) => f.value && Ee(f.value))
1891
2065
  }, [
1892
- y("img", {
1893
- src: z(Dn),
2066
+ p("img", {
2067
+ src: N(Fn),
1894
2068
  width: "14",
1895
2069
  height: "14",
1896
2070
  alt: "添加子节点",
1897
2071
  draggable: "false"
1898
- }, null, 8, Hi)
2072
+ }, null, 8, Yi)
1899
2073
  ])),
1900
- n.readonly ? O("", !0) : (M(), C("button", {
2074
+ i.readonly ? q("", !0) : (w(), b("button", {
1901
2075
  key: 1,
1902
2076
  class: "zm-tb-btn",
1903
2077
  title: "添加同级 (Enter)",
1904
- onClick: t[18] || (t[18] = (l) => m.value && Fe(m.value))
2078
+ onClick: t[21] || (t[21] = (l) => f.value && Ve(f.value))
1905
2079
  }, [
1906
- y("img", {
1907
- src: z(Hn),
2080
+ p("img", {
2081
+ src: N(On),
1908
2082
  width: "14",
1909
2083
  height: "14",
1910
2084
  alt: "添加同级",
1911
2085
  draggable: "false"
1912
- }, null, 8, Di)
2086
+ }, null, 8, Ki)
1913
2087
  ])),
1914
- t[23] || (t[23] = y("span", { class: "zm-tb-divider" }, null, -1)),
1915
- y("button", {
1916
- class: Ie(["zm-tb-btn", { active: k.layoutMode === "mindmap" }]),
2088
+ t[26] || (t[26] = p("span", { class: "zm-tb-divider" }, null, -1)),
2089
+ p("button", {
2090
+ class: me(["zm-tb-btn", { active: E.layoutMode === "mindmap" }]),
1917
2091
  title: "思维导图布局 (中心辐射)",
1918
- onClick: t[19] || (t[19] = (l) => lt("mindmap"))
2092
+ onClick: t[22] || (t[22] = (l) => rt("mindmap"))
1919
2093
  }, [
1920
- F(V, { name: "mindmap" })
2094
+ U(Y, { name: "mindmap" })
1921
2095
  ], 2),
1922
- y("button", {
1923
- class: Ie(["zm-tb-btn", { active: k.layoutMode === "tree" }]),
2096
+ p("button", {
2097
+ class: me(["zm-tb-btn", { active: E.layoutMode === "tree" }]),
1924
2098
  title: "树形布局 (向右展开)",
1925
- onClick: t[20] || (t[20] = (l) => lt("tree"))
2099
+ onClick: t[23] || (t[23] = (l) => rt("tree"))
1926
2100
  }, [
1927
- F(V, { name: "tree" })
2101
+ U(Y, { name: "tree" })
1928
2102
  ], 2),
1929
- y("button", {
1930
- class: Ie(["zm-tb-btn", { active: k.layoutMode === "org" }]),
2103
+ p("button", {
2104
+ class: me(["zm-tb-btn", { active: E.layoutMode === "org" }]),
1931
2105
  title: "组织结构布局 (向下展开)",
1932
- onClick: t[21] || (t[21] = (l) => lt("org"))
2106
+ onClick: t[24] || (t[24] = (l) => rt("org"))
1933
2107
  }, [
1934
- F(V, { name: "org" })
2108
+ U(Y, { name: "org" })
1935
2109
  ], 2),
1936
- t[24] || (t[24] = y("span", { class: "zm-tb-divider" }, null, -1)),
1937
- n.readonly ? O("", !0) : (M(), C("button", {
2110
+ t[27] || (t[27] = p("span", { class: "zm-tb-divider" }, null, -1)),
2111
+ i.readonly ? q("", !0) : (w(), b("button", {
1938
2112
  key: 2,
1939
2113
  class: "zm-tb-btn",
1940
2114
  title: "导入 JSON",
1941
- onClick: zn
2115
+ onClick: Wn
1942
2116
  }, [
1943
- F(V, { name: "import" })
2117
+ U(Y, { name: "import" })
1944
2118
  ])),
1945
- y("button", {
2119
+ p("button", {
1946
2120
  class: "zm-tb-btn",
1947
2121
  title: "导出 JSON",
1948
- onClick: Nn
2122
+ onClick: Rn
1949
2123
  }, [
1950
- F(V, { name: "export" })
2124
+ U(Y, { name: "export" })
1951
2125
  ]),
1952
- y("span", Pi, be(Math.round(z(E).scale.value * 100)) + "%", 1)
2126
+ p("span", ji, se(Math.round(N(S).scale.value * 100)) + "%", 1)
1953
2127
  ]))
1954
2128
  ], 4);
1955
2129
  };
1956
2130
  }
1957
- }), Fi = {
1958
- install(n) {
1959
- n.component("FlowMindMap", Ti);
2131
+ }), _i = {
2132
+ install(i) {
2133
+ i.component("FlowMindMap", Gi);
1960
2134
  }
1961
2135
  };
1962
2136
  export {
1963
- Ti as MindMap,
1964
- ri as addChild,
1965
- ai as addSibling,
1966
- he as clone,
1967
- Fi as default,
1968
- B as findNode,
1969
- ae as findParent,
2137
+ Gi as MindMap,
2138
+ di as addChild,
2139
+ fi as addSibling,
2140
+ ye as clone,
2141
+ _i as default,
2142
+ A as findNode,
2143
+ de as findParent,
1970
2144
  Xt as markdownToMindMap,
1971
- st as mindMapToMarkdown,
1972
- Gt as removeNode,
1973
- we as uid
2145
+ Zi as markdownToRichMindMap,
2146
+ ct as mindMapToMarkdown,
2147
+ jt as removeNode,
2148
+ Qi as richBlockToMarkdown,
2149
+ ce as uid
1974
2150
  };