flow-mindmap 0.1.1-beta.2 → 0.2.1

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,400 +1,401 @@
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 ct, openBlock as C, createElementBlock as E, Fragment as F, createElementVNode as p, createStaticVNode as Ne, createCommentVNode as X, ref as O, reactive as je, onMounted as st, onBeforeUnmount as dt, computed as te, withModifiers as D, normalizeStyle as ve, createVNode as q, toDisplayString as be, watch as Ue, nextTick as ee, unref as N, renderList as Ot, normalizeClass as Ie, withDirectives as Wn, withKeys as Ye, vModelText as $n, createBlock as Rn } from "vue";
2
+ const Bn = ["width", "height", "stroke-width"], Ln = {
3
3
  key: 4,
4
4
  points: "6 9 12 15 18 9"
5
- }, Ln = {
5
+ }, An = {
6
6
  key: 5,
7
7
  points: "9 6 15 12 9 18"
8
- }, V = /* @__PURE__ */ dt({
8
+ }, U = /* @__PURE__ */ ct({
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) => (C(), E("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" ? (C(), E(F, { 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" ? (C(), E(F, { 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 }, [
57
+ ], 64)) : i.name === "delete" ? (C(), E(F, { key: 2 }, [
58
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", {
59
+ ], 64)) : i.name === "edit" ? (C(), E(F, { 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" ? (C(), E("polyline", Ln)) : i.name === "expand" ? (C(), E("polyline", An)) : i.name === "zoom-in" ? (C(), E(F, { 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" ? (C(), E(F, { 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" ? (C(), E(F, { 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 }, [
126
+ ], 64)) : i.name === "logo" ? (C(), E(F, { key: 9 }, [
127
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 }, [
128
+ ], 64)) : i.name === "import" ? (C(), E(F, { 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" ? (C(), E(F, { 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" ? (C(), E(F, { key: 12 }, [
137
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 }, [
138
+ ], 64)) : i.name === "mindmap" ? (C(), E(F, { key: 13 }, [
139
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 }, [
140
+ ], 64)) : i.name === "tree" ? (C(), E(F, { key: 14 }, [
141
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 }, [
142
+ ], 64)) : i.name === "org" ? (C(), E(F, { key: 15 }, [
143
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", {
144
+ ], 64)) : i.name === "image" ? (C(), E(F, { 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" ? (C(), E(F, { 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" ? (C(), E(F, { 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" ? (C(), E(F, { 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)) : X("", !0)
195
+ ], 8, Bn));
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
+ }), 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", Ut = [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 = Ut.length - 1;
198
+ function Xn(i, s) {
199
+ return Math.round(ft(i, s) * Fn[Ze(i)]);
200
200
  }
201
- function Ze(n) {
202
- return Math.min(Vn, Math.max(0, n));
201
+ function Ze(i) {
202
+ return Math.min(Vn, 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 ft(i, s = 14) {
205
+ return Math.round(Ut[Ze(i)] * s / 14 * 10) / 10;
206
206
  }
207
- function qn(n, s = 14) {
208
- return Math.round(Tn[Ze(n)] * s / 14);
207
+ function qn(i, s = 14) {
208
+ return Math.round(Tn[Ze(i)] * s / 14);
209
209
  }
210
- const Ue = 60, $e = 14, te = 24;
210
+ const Ke = 60, $e = 14, oe = 24;
211
211
  let at = null;
212
- function Yn() {
212
+ function Un() {
213
213
  if (at) return at;
214
- const n = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
215
- return n ? (at = n, n) : {
214
+ const i = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
215
+ return i ? (at = 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 Yn(i, s, o) {
222
+ const n = `${o}|${s}|${i}`, r = Ft.get(n);
223
+ if (r !== void 0) return r;
224
+ const c = Un();
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, Zn = 200;
230
- function Qn(n, s, o) {
231
- return Math.min(o, Math.max(s, n));
229
+ const Kn = 24, jn = 400, Gn = 8, Vt = 16, Jn = 4, Zn = 200;
230
+ function Qn(i, s, o) {
231
+ return Math.min(o, Math.max(s, i));
232
232
  }
233
- function _n(n, s, o) {
234
- const i = Ze(s), a = ft(s, o), d = Math.min(Kn(n.text || "", a, Pn[i]), Zn), 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 _n(i, s, o) {
234
+ const n = Ze(s), r = ft(s, o), c = Math.min(Yn(i.text || "", r, Pn[n]), Zn), d = Xn(s, o), x = Math.ceil(c + d * 2), f = qn(s, o);
235
+ let v = 0;
236
+ if (i.link && (v += Vt), i.note && (v += Vt), v > 0) {
237
+ const Y = (i.link ? 1 : 0) + (i.note ? 1 : 0);
238
+ v += Jn * Y;
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 = Qn(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, g = Math.round(On[n] * o / 14), M = 0, w = 0;
241
+ if (!i.image)
242
+ return { w: Math.max(g, u), h: f + w + M };
243
+ const H = Qn(i.image.width, Kn, jn), j = Math.max(g, u, Math.ceil(H + d * 2)), Z = Math.ceil(i.image.height + Gn + f + w + M);
244
+ return { w: j, h: Z };
245
245
  }
246
- function ei(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 ni(d), ti(d, o, i), d.x = 0, d.y = 0, ii(d, i);
246
+ function ei(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 ni(c), ti(c, o, n), c.x = 0, c.y = 0, ii(c, n);
249
249
  }
250
- function ti(n, s, o = !1) {
250
+ function ti(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((g, M) => g + M._subtreeH, 0);
257
+ let f = 1, v = Math.abs(n[0]._subtreeH - (x - n[0]._subtreeH)), u = 0;
258
+ for (let g = 0; g < n.length - 1; g++) {
259
+ u += n[g]._subtreeH;
260
+ const M = Math.abs(u - (x - u));
261
+ M < v && (v = M, f = g + 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 g = 0; g < f; g++)
264
+ n[g]._dir = "right", n[g].side = 1, n[g]._dirRight = 1;
265
+ for (let g = f; g < n.length; g++)
266
+ n[g]._dir = "left", n[g].side = -1, n[g]._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
+ Ge(x, "right", Ke, !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
+ Ge(x, "left", Ke, !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
+ Ge(i, "right", Ke, !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, Ke, 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 Ge(i, s, o, n, r = !1) {
296
+ if (i.children.length === 0) return;
297
+ const c = i.children.reduce(
298
+ (v, u, g) => v + u._subtreeH + (g > 0 ? $e : 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 + $e), Ge(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 ? $e * 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 + $e * 2, Yt(c, s, o);
315
315
  });
316
316
  }
317
- function Ut(n, s, o, i, a, d) {
318
- const c = _n(n, s, d), x = {
319
- id: n.id,
320
- text: n.text,
317
+ function Kt(i, s, o, n, r, c) {
318
+ const d = _n(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: ft(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, g) => {
347
+ const M = s === 0 ? g < v ? 1 : -1 : n;
348
+ return Kt(u, s + 1, x, M, r, c);
348
349
  }), x;
349
350
  }
350
- function ni(n) {
351
- const s = [n];
351
+ function ni(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 += $e * (n.children.length - 1), c += $e * 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 ii(n, s = !1) {
369
- const o = [n];
370
- let i = 1 / 0, a = -1 / 0, d = 1 / 0, c = -1 / 0;
369
+ function ii(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, g = v.height / 2;
374
+ v.x - u < n && (n = v.x - u), v.x + u > r && (r = v.x + u), v.y - g < c && (c = v.y - g), v.y + g > d && (d = v.y + g), 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
401
  const Pe = [
@@ -469,344 +470,462 @@ const Pe = [
469
470
  ]
470
471
  }
471
472
  ];
472
- function oi(n, s = []) {
473
- return [...Pe, ...s].find((i) => i.id === n) ?? Pe[0];
473
+ function oi(i, s = []) {
474
+ return [...Pe, ...s].find((n) => n.id === i) ?? Pe[0];
474
475
  }
475
- function we() {
476
+ function ue() {
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 me(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 ce(i, s, o = null) {
491
+ if (i.id === s) return o;
492
+ for (const n of i.children) {
493
+ const r = ce(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 li(n, s, o) {
506
- const i = B(n, s);
507
- return !i || i.text === o ? !1 : (i.text = o, !0);
506
+ function li(i, s, o) {
507
+ const n = A(i, s);
508
+ return !n || n.text === o ? !1 : (n.text = o, !0);
508
509
  }
509
- function ri(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 ri(i, s, o, n) {
511
+ if (!ce(i, s) || s === o || A(A(i, s), o)) return !1;
512
+ const r = ce(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 = ce(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 ? Je : o > 0 ? `新节点 ${o + 1}` : "新节点 2";
537
538
  }
538
- function ai(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 ai(i, s, o) {
540
+ const n = A(i, s);
541
+ if (!n) return null;
542
+ const r = { id: ue(), text: o ?? Gt(n), children: [] };
543
+ return n.children.push(r), r;
543
544
  }
544
- function ui(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 si(i, s, o) {
546
+ const n = ce(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: ue(), text: o ?? Gt(n), children: [] };
551
+ return n.children.splice(r + 1, 0, c), c;
551
552
  }
552
- function si(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 ui(i, s, o) {
554
+ const n = ce(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: ue(), text: o, children: [] };
559
+ return n.children.splice(r, 0, c), c;
559
560
  }
560
- function di(n, s) {
561
- const o = ae(n, s);
561
+ function ci(i, s) {
562
+ const o = ce(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 = me(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 = ue();
571
+ for (const s of i.children) Jt(s);
571
572
  }
572
573
  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);
574
+ function Xt(i, s = "导入的导图") {
575
+ const o = i.split(/\r?\n/), n = { id: ue(), 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 g = !1, M = [], w = null;
577
+ function H(b) {
578
+ M.push(b);
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 (w && M.length > 0) {
582
+ for (; M.length > 0 && M[0].trim() === ""; ) M.shift();
583
+ for (; M.length > 0 && M[M.length - 1].trim() === ""; ) M.pop();
584
+ const b = M.join(`
584
585
  `);
585
- w && (b.note = { text: w });
586
+ b && (w.note = { text: b });
586
587
  }
587
- p = !1, S = [];
588
+ g = !1, M = [];
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 b of o) {
591
+ if (g) {
592
+ const V = b.match(u);
593
+ if (V && V[1][0] === "`") {
594
+ j();
594
595
  continue;
595
596
  }
596
- A(w);
597
+ H(b);
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 = b.match(x);
601
+ if (z) {
602
+ const V = z[1].length, se = z[2].trim();
603
+ d.push({ level: V, text: se, body: "" }), w = 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 = b.match(u);
607
+ if (L && L[2] === "note") {
608
+ g = !0, M = [];
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 $ = b.match(f);
612
+ if ($ && w) {
613
+ const V = $[2], se = 160, ge = 120;
614
+ w.image = { src: V, naturalW: se, naturalH: ge, width: se, height: ge };
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 J = b.match(v);
618
+ if (J && w) {
619
+ w.link = { url: J[2] }, w.text = J[1];
619
620
  continue;
620
621
  }
621
- w.trim().length > 0 && b && (b.body = b.body ? b.body + " " + w.trim() : w.trim());
622
+ b.trim().length > 0 && w && (w.body = w.body ? w.body + " " + b.trim() : b.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
+ g && j();
625
+ function Z(b) {
626
+ for (; r.length > 1; ) {
627
+ const J = r.length - 1, V = c[J];
628
+ if (V !== void 0 && V < b.level) break;
629
+ r.pop(), c.pop();
630
+ }
631
+ const z = r[r.length - 1], L = b.text, $ = { id: ue(), text: L, children: [] };
632
+ b.image && ($.image = { ...b.image }), b.link && ($.link = { url: b.link.url }), b.note && ($.note = { text: b.note.text }), b.body && Y(b, d, d.indexOf(b)) && $.children.push({ id: ue(), text: b.body, children: [] }), z.children.push($), r.push($), c.push(b.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 Y(b, z, L) {
635
+ for (let $ = L + 1; $ < z.length; $++) {
636
+ if (z[$].level <= b.level) return !0;
637
+ if (z[$].level > b.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 b of d) Z(b);
642
+ if (d.length > 0 && d[0].level === 1) {
643
+ const b = n.children[0];
644
+ b && (n.text = b.text, n.id = b.id, b.image && (n.image = { ...b.image }), b.link && (n.link = { url: b.link.url }), b.note && (n.note = { text: b.note.text }), n.children = b.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 ut(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 += ut(n, s + 1);
654
656
  return o;
655
657
  }
656
- function ci(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 di(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 g = s[n], M = g.match(c);
665
+ if (M) {
666
+ const z = M[1][0], L = M[2] || "", $ = [g];
667
+ for (n++; n < s.length; ) {
668
+ const V = s[n].match(c);
669
+ if (V && V[1][0] === z) {
670
+ $.push(s[n]), n++;
671
+ break;
672
+ }
673
+ $.push(s[n]), n++;
674
+ }
675
+ const J = $.slice(1, -1).join(`
676
+ `).trim();
677
+ o.push({
678
+ kind: "code",
679
+ text: ((v = J.split(`
680
+ `)[0]) == null ? void 0 : v.slice(0, 80)) || "(空代码块)",
681
+ raw: $.join(`
682
+ `),
683
+ lang: L
684
+ });
685
+ continue;
686
+ }
687
+ const w = g.match(r);
688
+ if (w) {
689
+ o.push({ kind: "heading", level: w[1].length, text: w[2].trim(), raw: g }), n++;
690
+ continue;
691
+ }
692
+ if (/^\s*\|/.test(g)) {
693
+ const z = [];
694
+ let L = n, $ = !1;
695
+ for (; L < s.length && /^\s*\|/.test(s[L]); )
696
+ z.push(s[L]), d.test(s[L]) && ($ = !0), L++;
697
+ if ($ && 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 H = g.match(x), j = g.match(f);
708
+ if (H || j) {
709
+ let z = n;
710
+ for (; z < s.length; ) {
711
+ const L = s[z].match(x), $ = s[z].match(f);
712
+ if (!(L || $)) break;
713
+ const J = s[z].replace(/^\s*[-*+]\s+/, "").replace(/^\s*\d+\.\s+/, "").trim();
714
+ J.length > 0 && o.push({
715
+ kind: "list",
716
+ text: J.slice(0, 80) || "(列表项)",
717
+ raw: s[z]
718
+ }), z++;
719
+ }
720
+ n = z;
721
+ continue;
722
+ }
723
+ if (g.trim() === "") {
724
+ n++;
725
+ continue;
726
+ }
727
+ const Z = [g];
728
+ let Y = n + 1;
729
+ for (; Y < s.length; ) {
730
+ const z = s[Y];
731
+ if (z.trim() === "" || r.test(z) || c.test(z) || x.test(z) || f.test(z) || /^\s*\|/.test(z)) break;
732
+ Z.push(z), Y++;
733
+ }
734
+ const b = Z.join(" ").trim();
735
+ o.push({
736
+ kind: "paragraph",
737
+ text: b.slice(0, 80) || "(空段落)",
738
+ raw: Z.join(`
739
+ `)
740
+ }), n = Y;
741
+ }
742
+ return o;
743
+ }
744
+ function Xi(i, s = "导入的导图") {
745
+ const o = di(i || ""), n = { id: ue(), 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 g = { id: ue(), text: f.text, children: [] };
757
+ r[r.length - 1].children.push(g), r.push(g), c.push(u);
758
+ return;
759
+ }
760
+ const v = {
761
+ id: ue(),
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 fi(i) {
776
+ const s = i.minScale ?? 0.2, o = i.maxScale ?? 3, n = i.step ?? 1.2, r = O(1), c = O(0), d = O(0), x = O(!1), f = je({
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 = O(!1), u = je({ x: 0, y: 0 }), g = je({ x: 0, y: 0, width: 0, height: 0 }), M = O(0);
782
+ let w = null;
783
+ function H(W) {
784
+ w = 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 R = i.getContainer();
789
+ if (!R) return;
790
+ const Q = -W.deltaY * 1e-3, ne = Math.min(o, Math.max(s, r.value * (1 + Q))), le = R.getBoundingClientRect(), re = W.clientX - le.left, ke = W.clientY - le.top, Re = (re - c.value) / r.value, Me = (ke - d.value) / r.value;
791
+ r.value = ne, c.value = re - Re * ne, d.value = ke - Me * ne;
673
792
  }
674
- function ce() {
675
- a.value = Math.min(o, a.value * i);
793
+ function Z() {
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 Y() {
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 b(W) {
800
+ var Q;
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), (Q = W.preventDefault) == null || Q.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 $(W, R) {
810
+ v.value = !0, u.x = W, u.y = R, g.x = W, g.y = R, g.width = 0, g.height = 0, M.value++, window.addEventListener("mousemove", se), 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 J(W, R) {
813
+ if (!v.value) return;
814
+ const Q = Math.min(u.x, W), ne = Math.min(u.y, R), le = Math.max(u.x, W), re = Math.max(u.y, R);
815
+ g.x = Q, g.y = ne, g.width = le - Q, g.height = re - ne, M.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", se), window.removeEventListener("mouseup", V), w && w();
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 se(W) {
821
+ if (!v.value) return;
822
+ const R = i.getContainer();
823
+ if (!R) return;
824
+ const Q = R.getBoundingClientRect(), ne = (W.clientX - Q.left - c.value) / r.value, le = (W.clientY - Q.top - d.value) / r.value;
825
+ J(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 ge(W, R, Q, ne = 60) {
828
+ const le = i.getContainer();
829
+ if (!le) return;
830
+ const re = le.getBoundingClientRect(), ke = (re.width - ne * 2) / W, Re = (re.height - ne * 2) / R, Me = Math.min(1, Math.max(0.3, Math.min(ke, Re)));
831
+ r.value = Me, c.value = re.width / 2, d.value = re.height / 2 - Q * Me;
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: Z,
840
+ zoomOut: Y,
841
+ startPan: b,
842
+ startMarquee: $,
843
+ updateMarquee: J,
844
+ isMarquee: v,
845
+ marquee: g,
846
+ marqueeVersion: M,
847
+ setOnMarqueeEnd: H,
848
+ resetView: ge
730
849
  };
731
850
  }
732
- const fi = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
733
- function qt(n) {
734
- return fi ? n.metaKey : n.ctrlKey;
851
+ const hi = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
852
+ function qt(i) {
853
+ return hi ? i.metaKey : i.ctrlKey;
735
854
  }
736
- function vi(n) {
855
+ function vi(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
- ut(() => {
890
+ st(() => {
772
891
  window.addEventListener("keydown", o);
773
- }), ct(() => {
892
+ }), dt(() => {
774
893
  window.removeEventListener("keydown", o);
775
894
  });
776
895
  }
777
- function hi(n = 100) {
778
- const s = D([]);
896
+ function mi(i = 100) {
897
+ const s = O([]);
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 mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"], pi = ["disabled"], bi = ["disabled"], wi = /* @__PURE__ */ dt({
928
+ const gi = ["disabled"], yi = ["disabled"], xi = ["disabled"], pi = ["disabled"], wi = ["disabled"], bi = ["disabled"], ki = /* @__PURE__ */ ct({
810
929
  __name: "NodeContextMenu",
811
930
  props: {
812
931
  x: {},
@@ -818,115 +937,115 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["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 M = o.x + 2, w = 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 H = o.container.getBoundingClientRect(), j = 180, Z = c.value ? d.value ? 184 : 160 : 136;
945
+ M + j > H.right && (M = Math.max(H.left + 4, o.x - j - 2)), w + Z > H.bottom && (w = Math.max(H.top + 4, o.y - Z - 2)), M < H.left + 2 && (M = H.left + 2), w < H.top + 2 && (w = H.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: M, top: w };
948
+ }), c = te(() => o.hasImage), d = te(() => o.hasLink), x = te(() => o.hasNote);
949
+ function f(M) {
950
+ const w = M.target;
951
+ w && w.closest(".zm-node-menu") || n("close");
833
952
  }
834
- function h(S) {
835
- S.key === "Escape" && i("close");
953
+ function v(M) {
954
+ M.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), dt(() => {
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 g(M) {
963
+ o.readonly || (M(), n("close"));
845
964
  }
846
- return (S, b) => (M(), C("div", {
965
+ return (M, w) => (C(), E("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: ve({ left: r.value.left + "px", top: r.value.top + "px" }),
968
+ onContextmenu: w[6] || (w[6] = D(() => {
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: w[0] || (w[0] = D((H) => g(() => n("pickImage")), ["stop"]))
856
975
  }, [
857
- F(V, {
976
+ q(U, {
858
977
  name: "image",
859
978
  size: 13
860
979
  }),
861
- y("span", null, be(d.value ? "替换图片" : "添加图片"), 1)
862
- ], 8, mi),
863
- d.value ? (M(), C("button", {
980
+ p("span", null, be(c.value ? "替换图片" : "添加图片"), 1)
981
+ ], 8, gi),
982
+ c.value ? (C(), E("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: w[1] || (w[1] = D((H) => g(() => n("removeImage")), ["stop"]))
868
987
  }, [
869
- F(V, {
988
+ q(U, {
870
989
  name: "x",
871
990
  size: 13
872
991
  }),
873
- b[7] || (b[7] = y("span", null, "移除图片", -1))
874
- ], 8, gi)) : O("", !0),
875
- y("button", {
992
+ w[7] || (w[7] = p("span", null, "移除图片", -1))
993
+ ], 8, yi)) : X("", !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: w[2] || (w[2] = D((H) => g(() => n("setLink")), ["stop"]))
879
998
  }, [
880
- F(V, {
999
+ q(U, {
881
1000
  name: "link",
882
1001
  size: 13
883
1002
  }),
884
- y("span", null, be(c.value ? "编辑链接" : "添加链接"), 1)
885
- ], 8, yi),
886
- c.value ? (M(), C("button", {
1003
+ p("span", null, be(d.value ? "编辑链接" : "添加链接"), 1)
1004
+ ], 8, xi),
1005
+ d.value ? (C(), E("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: w[3] || (w[3] = D((H) => g(() => n("removeLink")), ["stop"]))
891
1010
  }, [
892
- F(V, {
1011
+ q(U, {
893
1012
  name: "x",
894
1013
  size: 13
895
1014
  }),
896
- b[8] || (b[8] = y("span", null, "移除链接", -1))
897
- ], 8, xi)) : O("", !0),
898
- y("button", {
1015
+ w[8] || (w[8] = p("span", null, "移除链接", -1))
1016
+ ], 8, pi)) : X("", !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: w[4] || (w[4] = D((H) => g(() => n("editNote")), ["stop"]))
902
1021
  }, [
903
- F(V, {
1022
+ q(U, {
904
1023
  name: "note",
905
1024
  size: 13
906
1025
  }),
907
- y("span", null, be(x.value ? "编辑笔记" : "添加笔记"), 1)
908
- ], 8, pi),
909
- x.value ? (M(), C("button", {
1026
+ p("span", null, be(x.value ? "编辑笔记" : "添加笔记"), 1)
1027
+ ], 8, wi),
1028
+ x.value ? (C(), E("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: w[5] || (w[5] = D((H) => g(() => n("removeNote")), ["stop"]))
914
1033
  }, [
915
- F(V, {
1034
+ q(U, {
916
1035
  name: "x",
917
1036
  size: 13
918
1037
  }),
919
- b[9] || (b[9] = y("span", null, "移除笔记", -1))
920
- ], 8, bi)) : O("", !0)
1038
+ w[9] || (w[9] = p("span", null, "移除笔记", -1))
1039
+ ], 8, bi)) : X("", !0)
921
1040
  ], 36));
922
1041
  }
923
- }), ki = ["viewBox", "width", "height"], Mi = { class: "zm-edges" }, Ci = ["d", "fill"], Si = ["data-node-id", "onClick", "onDblclick", "onContextmenu", "onMouseenter", "onMouseleave"], Ei = ["src", "width", "height", "alt"], zi = {
1042
+ }), Mi = ["viewBox", "width", "height"], Ci = { class: "zm-edges" }, Ei = ["d", "fill"], Si = ["data-node-id", "onClick", "onDblclick", "onContextmenu", "onMouseenter", "onMouseleave"], zi = ["src", "width", "height", "alt"], Ni = {
924
1043
  key: 1,
925
1044
  class: "zm-text"
926
- }, Ni = { class: "zm-text-label" }, Ii = ["href", "title"], Wi = ["title", "onClick"], $i = ["title"], Bi = ["title", "onClick"], Ri = ["onClick"], Ai = ["onMousedown"], Li = ["onClick"], Hi = {
1045
+ }, Ii = { class: "zm-text-label" }, Wi = ["href", "title"], $i = ["title", "onClick"], Ri = ["title"], Bi = ["title", "onClick"], Li = ["onClick"], Ai = ["onMousedown"], Hi = ["onClick"], Di = {
927
1046
  key: 0,
928
1047
  class: "zm-toolbar"
929
- }, Di = ["src"], Pi = ["src"], Ti = { class: "zm-tb-tip" }, We = 24, De = 400, pe = 160, Oi = /* @__PURE__ */ dt({
1048
+ }, Pi = ["src"], Ti = ["src"], Oi = { class: "zm-tb-tip" }, We = 24, De = 400, we = 160, Fi = /* @__PURE__ */ ct({
930
1049
  __name: "MindMap",
931
1050
  props: {
932
1051
  data: {},
@@ -937,213 +1056,213 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
937
1056
  lineColors: {}
938
1057
  },
939
1058
  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;
943
- Ye(
944
- () => i.markdown,
1059
+ setup(i, { expose: s, emit: o }) {
1060
+ const n = i, r = o, c = O(null), d = O(null), x = O(""), f = O(null), v = O(/* @__PURE__ */ new Set()), u = O(me(n.data)), g = O(n.markdown !== void 0);
1061
+ let M = !1;
1062
+ Ue(
1063
+ () => n.markdown,
945
1064
  (e) => {
946
1065
  if (e === void 0) {
947
- p.value = !1;
1066
+ g.value = !1;
948
1067
  return;
949
1068
  }
950
- p.value = !0;
1069
+ g.value = !0;
951
1070
  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();
1071
+ M = !0, u.value = me(t), f.value = null, v.value = /* @__PURE__ */ new Set(), T(), ee(() => {
1072
+ M = !1, de();
954
1073
  });
955
1074
  }
956
- ), Ye(
1075
+ ), Ue(
957
1076
  u,
958
1077
  () => {
959
- p.value && !S && a("markdownChange", st(u.value));
1078
+ g.value && !M && r("markdownChange", ut(u.value));
960
1079
  },
961
1080
  { deep: !0 }
962
1081
  );
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);
1082
+ const w = te(() => k.showOrderBadge === !0), H = O(/* @__PURE__ */ new Map()), j = H.value;
1083
+ function Z(e, t) {
1084
+ const a = {};
1085
+ 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), H.value = new Map(j);
967
1086
  }
968
- function ue(e) {
969
- return U.get(e) ?? {};
1087
+ function Y(e) {
1088
+ return j.get(e) ?? {};
970
1089
  }
971
- function w(e, t) {
972
- const r = B(u.value, e);
973
- r && (r.image = {
1090
+ function b(e, t) {
1091
+ const a = A(u.value, e);
1092
+ a && (a.image = {
974
1093
  src: t.src,
975
1094
  naturalW: t.naturalW,
976
1095
  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) {
1096
+ width: L(t.width, We, De),
1097
+ height: L(t.height, We, De)
1098
+ }, G(), T(), r("change", u.value));
1099
+ }
1100
+ function z(e) {
1101
+ const t = A(u.value, e);
1102
+ !t || !t.image || (delete t.image, G(), T(), r("change", u.value));
1103
+ }
1104
+ function L(e, t, a) {
1105
+ return Math.min(a, Math.max(t, e));
1106
+ }
1107
+ function $(e, t) {
1108
+ const a = new FileReader();
1109
+ a.onload = () => {
1110
+ if (typeof a.result != "string") return;
1111
+ const m = a.result, h = new window.Image();
1112
+ h.onload = () => {
1113
+ const l = h.naturalWidth || we, y = h.naturalHeight || we, B = L(l, We, we), K = L(Math.round(y * B / l), We, De);
1114
+ t({ src: m, naturalW: l, naturalH: y, width: B, height: K });
1115
+ }, h.onerror = () => {
1116
+ t({ src: m, naturalW: we, naturalH: we, width: we, height: we });
1117
+ }, h.src = m;
1118
+ }, a.readAsDataURL(e);
1119
+ }
1120
+ function J(e) {
1002
1121
  const t = document.createElement("input");
1003
1122
  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));
1123
+ var m;
1124
+ const a = (m = t.files) == null ? void 0 : m[0];
1125
+ a && ($(a, (h) => b(e, h)), document.body.removeChild(t));
1007
1126
  }, document.body.appendChild(t), t.click();
1008
1127
  }
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));
1128
+ function V(e, t) {
1129
+ const a = t.trim(), m = A(u.value, e);
1130
+ m && (a ? m.link = { url: a } : delete m.link, G(), T(), r("change", u.value));
1012
1131
  }
1013
- function re(e) {
1014
- Y(e, "");
1132
+ function se(e) {
1133
+ V(e, "");
1015
1134
  }
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));
1135
+ function ge(e, t) {
1136
+ const a = A(u.value, e);
1137
+ a && (t ? a.note = { text: t } : delete a.note, G(), T(), r("change", u.value));
1019
1138
  }
1020
- function I(e) {
1021
- me(e, "");
1139
+ function W(e) {
1140
+ ge(e, "");
1022
1141
  }
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 });
1026
- }
1027
- function _() {
1028
- W.value = null;
1142
+ const R = O(null);
1143
+ function Q(e, t) {
1144
+ n.readonly || (e.preventDefault(), e.stopPropagation(), f.value = t.id, r("select", A(u.value, t.id)), R.value = { nodeId: t.id, x: e.clientX, y: e.clientY });
1029
1145
  }
1030
1146
  function ne() {
1147
+ R.value = null;
1148
+ }
1149
+ function le() {
1031
1150
  var t;
1032
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1033
- e && le(e);
1151
+ const e = (t = R.value) == null ? void 0 : t.nodeId;
1152
+ e && J(e);
1034
1153
  }
1035
- function ie() {
1036
- var v, f, l;
1037
- const e = (v = W.value) == null ? void 0 : v.nodeId;
1154
+ function re() {
1155
+ var m, h, l;
1156
+ const e = (m = R.value) == null ? void 0 : m.nodeId;
1038
1157
  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);
1158
+ const t = ((l = (h = A(u.value, e)) == null ? void 0 : h.link) == null ? void 0 : l.url) ?? "", a = window.prompt("输入链接 URL(留空取消)", t);
1159
+ a !== null && V(e, a);
1041
1160
  }
1042
1161
  function ke() {
1043
1162
  var t;
1044
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1045
- e && re(e);
1163
+ const e = (t = R.value) == null ? void 0 : t.nodeId;
1164
+ e && se(e);
1046
1165
  }
1047
- function Be() {
1166
+ function Re() {
1048
1167
  var t;
1049
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1050
- e && vt(e);
1168
+ const e = (t = R.value) == null ? void 0 : t.nodeId;
1169
+ e && ht(e);
1051
1170
  }
1052
1171
  function Me() {
1053
1172
  var t;
1054
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1055
- e && I(e);
1173
+ const e = (t = R.value) == null ? void 0 : t.nodeId;
1174
+ e && W(e);
1056
1175
  }
1057
1176
  function Zt() {
1058
1177
  var t;
1059
- const e = (t = W.value) == null ? void 0 : t.nodeId;
1060
- e && G(e);
1178
+ const e = (t = R.value) == null ? void 0 : t.nodeId;
1179
+ e && z(e);
1061
1180
  }
1062
- function vt(e) {
1063
- i.readonly || a("edit-note", e);
1181
+ function ht(e) {
1182
+ n.readonly || r("edit-note", e);
1064
1183
  }
1065
1184
  function Qt(e, t = 60) {
1066
- const r = e.replace(/\s+/g, " ").trim();
1067
- return r.length <= t ? r || "点击编辑笔记" : r.slice(0, t) + "…";
1185
+ const a = e.replace(/\s+/g, " ").trim();
1186
+ return a.length <= t ? a || "点击编辑笔记" : a.slice(0, t) + "…";
1068
1187
  }
1069
- function ht(e) {
1070
- var f;
1071
- if (i.readonly || c.value) return;
1188
+ function vt(e) {
1189
+ var h;
1190
+ if (n.readonly || d.value) return;
1072
1191
  const t = e.target;
1073
1192
  if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable))
1074
1193
  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];
1081
- if (g.kind === "file" && g.type.startsWith("image/")) {
1082
- const $ = g.getAsFile();
1083
- if (!$) continue;
1194
+ const a = f.value;
1195
+ if (!a) return;
1196
+ const m = (h = e.clipboardData) == null ? void 0 : h.items;
1197
+ if (m)
1198
+ for (let l = 0; l < m.length; l++) {
1199
+ const y = m[l];
1200
+ if (y.kind === "file" && y.type.startsWith("image/")) {
1201
+ const B = y.getAsFile();
1202
+ if (!B) continue;
1084
1203
  e.preventDefault();
1085
- const X = B(u.value, r);
1086
- if (X != null && X.image && !window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))
1204
+ const K = A(u.value, a);
1205
+ if (K != null && K.image && !window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))
1087
1206
  return;
1088
- T($, (J) => w(r, J));
1207
+ $(B, (_) => b(a, _));
1089
1208
  return;
1090
1209
  }
1091
1210
  }
1092
1211
  }
1093
- ut(() => {
1094
- window.addEventListener("paste", ht);
1095
- }), ct(() => {
1096
- window.removeEventListener("paste", ht);
1212
+ st(() => {
1213
+ window.addEventListener("paste", vt);
1214
+ }), dt(() => {
1215
+ window.removeEventListener("paste", vt);
1097
1216
  });
1098
- const Re = D(null), _t = Q(() => {
1217
+ const Be = O(null), _t = te(() => {
1099
1218
  var e;
1100
- return ((e = Re.value) == null ? void 0 : e.nodeId) ?? null;
1219
+ return ((e = Be.value) == null ? void 0 : e.nodeId) ?? null;
1101
1220
  });
1102
1221
  function en(e, t) {
1103
1222
  if (!t.image) return;
1104
1223
  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 = {
1224
+ const a = t.image.naturalW || t.image.width, m = t.image.naturalH || t.image.height, h = m > 0 ? m / a : 1;
1225
+ Be.value = {
1107
1226
  nodeId: t.id,
1108
1227
  startX: e.clientX,
1109
1228
  startY: e.clientY,
1110
1229
  startW: t.image.width,
1111
1230
  startH: t.image.height,
1112
- naturalW: r,
1113
- naturalH: v,
1114
- ratio: f,
1231
+ naturalW: a,
1232
+ naturalH: m,
1233
+ ratio: h,
1115
1234
  pendingW: t.image.width,
1116
1235
  pendingH: t.image.height
1117
1236
  }, window.addEventListener("mousemove", mt), window.addEventListener("mouseup", gt);
1118
1237
  }
1119
1238
  function mt(e) {
1120
- var X, J;
1121
- const t = Re.value;
1239
+ var K, _;
1240
+ const t = Be.value;
1122
1241
  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(
1242
+ const a = S.scale.value || 1, m = e.clientX - t.startX, h = L(t.startW + m / a, We, De), l = L(h * t.ratio, We, De);
1243
+ t.pendingW = h, t.pendingH = l;
1244
+ const y = (K = c.value) == null ? void 0 : K.querySelector(
1126
1245
  `[data-node-id="${t.nodeId}"] .zm-node-img`
1127
1246
  );
1128
- g && (g.style.width = `${f}px`, g.style.height = `${l}px`);
1129
- const $ = (J = d.value) == null ? void 0 : J.querySelector(
1247
+ y && (y.style.width = `${h}px`, y.style.height = `${l}px`);
1248
+ const B = (_ = c.value) == null ? void 0 : _.querySelector(
1130
1249
  `[data-node-id="${t.nodeId}"]`
1131
1250
  );
1132
- $ && ($.style.minWidth = `${Math.max(80, Math.ceil(f + 28))}px`, $.style.height = `${Math.ceil(l + 8 + 30)}px`);
1251
+ B && (B.style.minWidth = `${Math.max(80, Math.ceil(h + 28))}px`, B.style.height = `${Math.ceil(l + 8 + 30)}px`);
1133
1252
  }
1134
1253
  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, {
1254
+ const e = Be.value;
1255
+ if (window.removeEventListener("mousemove", mt), window.removeEventListener("mouseup", gt), Be.value = null, !e) return;
1256
+ const t = A(u.value, e.nodeId);
1257
+ !t || !t.image || (b(e.nodeId, {
1139
1258
  src: t.image.src,
1140
1259
  naturalW: t.image.naturalW,
1141
1260
  naturalH: t.image.naturalH,
1142
1261
  width: e.pendingW,
1143
1262
  height: e.pendingH
1144
- }), m.value = e.nodeId, a("select", t), _e = !0);
1263
+ }), f.value = e.nodeId, r("select", t), _e = !0);
1145
1264
  }
1146
- const Qe = D(null);
1265
+ const Qe = O(null);
1147
1266
  let _e = !1;
1148
1267
  function tn(e) {
1149
1268
  Qe.value = e;
@@ -1151,28 +1270,28 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1151
1270
  function nn(e) {
1152
1271
  Qe.value === e && (Qe.value = null);
1153
1272
  }
1154
- const yt = D(0), et = D(!1), fe = hi(100);
1155
- function K() {
1156
- fe.record({ data: u.value });
1273
+ const yt = O(0), et = O(!1), he = mi(100);
1274
+ function G() {
1275
+ he.record({ data: u.value });
1157
1276
  }
1158
- function H() {
1159
- h.value = new Set(h.value), yt.value++;
1277
+ function T() {
1278
+ v.value = new Set(v.value), yt.value++;
1160
1279
  }
1161
- const oe = Q(() => {
1162
- var e, t, r, v, f, l, g, $, X, J;
1280
+ const ae = te(() => {
1281
+ var e, t, a, m, h, l, y, B, K, _;
1163
1282
  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
1283
+ rootBg: ((e = n.theme) == null ? void 0 : e.rootBg) ?? "#1f2937",
1284
+ rootText: ((t = n.theme) == null ? void 0 : t.rootText) ?? "#ffffff",
1285
+ branchBg: ((a = n.theme) == null ? void 0 : a.branchBg) ?? "#ffffff",
1286
+ branchText: ((m = n.theme) == null ? void 0 : m.branchText) ?? "#1f2937",
1287
+ lineColor: ((h = n.theme) == null ? void 0 : h.lineColor) ?? "#94a3b8",
1288
+ bgColor: ((l = n.theme) == null ? void 0 : l.bgColor) ?? "#f8fafc",
1289
+ fontSize: ((y = n.theme) == null ? void 0 : y.fontSize) ?? 14,
1290
+ lineWidthStart: ((B = n.theme) == null ? void 0 : B.lineWidthStart) ?? 2.2,
1291
+ lineWidthEnd: ((K = n.theme) == null ? void 0 : K.lineWidthEnd) ?? 0.8,
1292
+ rainbowBranch: ((_ = n.theme) == null ? void 0 : _.rainbowBranch) ?? !1
1174
1293
  };
1175
- }), k = Ge({
1294
+ }), k = je({
1176
1295
  autoBalanceOnChange: !0,
1177
1296
  lineWidthStart: 12,
1178
1297
  lineWidthEnd: 3.6,
@@ -1185,195 +1304,195 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1185
1304
  showOrderBadge: !1
1186
1305
  });
1187
1306
  function xt(e) {
1188
- return k.taperedEdge ? on(e) : bt(e);
1307
+ return k.taperedEdge ? on(e) : wt(e);
1189
1308
  }
1190
1309
  function pt(e) {
1191
- return k.taperedEdge ? k.lineWidthEnd : bt(e);
1310
+ return k.taperedEdge ? k.lineWidthEnd : wt(e);
1192
1311
  }
1193
1312
  function on(e) {
1194
1313
  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;
1195
1314
  }
1196
- function bt(e) {
1315
+ function wt(e) {
1197
1316
  if (e <= 0) return k.lineWidthStart;
1198
1317
  if (e >= 3) return k.lineWidthEnd;
1199
1318
  const t = e / 3;
1200
1319
  return k.lineWidthStart + (k.lineWidthEnd - k.lineWidthStart) * t;
1201
1320
  }
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;
1204
- return { x: l, y: g };
1321
+ function ln(e, t, a, m) {
1322
+ 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, y = h * h * h * t.y + 3 * h * h * e * a.y1 + 3 * h * e * e * a.y2 + e * e * e * m.y;
1323
+ return { x: l, y };
1205
1324
  }
1206
- function rn(e, t, r, v, f = 32, l = "curve", g = "right") {
1325
+ function rn(e, t, a, m, h = 32, l = "curve", y = "right") {
1207
1326
  if (l === "curve") {
1208
- let xe;
1209
- 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 };
1327
+ let pe;
1328
+ if (y === "right" || y === "left") {
1329
+ const P = Math.abs(t.x - e.x) * 0.45, fe = y === "right" ? 1 : -1;
1330
+ pe = { x1: e.x + fe * P, y1: e.y, x2: t.x - fe * P, y2: t.y };
1212
1331
  } 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 };
1332
+ const P = Math.abs(t.y - e.y) * 0.45;
1333
+ pe = { x1: e.x, y1: e.y + P, x2: t.x, y2: t.y - P };
1215
1334
  }
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 };
1335
+ const In = (I) => {
1336
+ const P = 1 - I, fe = -3 * P * P * e.x + 3 * (P * P - 2 * P * I) * pe.x1 + 3 * (2 * P * I - I * I) * pe.x2 + 3 * I * I * t.x, ze = -3 * P * P * e.y + 3 * (P * P - 2 * P * I) * pe.y1 + 3 * (2 * P * I - I * I) * pe.y2 + 3 * I * I * t.y;
1337
+ return { dx: fe, dy: ze };
1219
1338
  }, 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);
1339
+ for (let I = 0; I <= h; I++) {
1340
+ const P = I / h, fe = I === 0 ? e : I === h ? t : ln(P, e, pe, t), ze = In(P);
1222
1341
  let Xe = Math.hypot(ze.dx, ze.dy);
1223
1342
  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 });
1343
+ const Pt = -ze.dy / Xe, Tt = ze.dx / Xe, qe = (a + (m - a) * P) / 2;
1344
+ He.push({ x: fe.x + Pt * qe, y: fe.y + Tt * qe }), rt.push({ x: fe.x - Pt * qe, y: fe.y - Tt * qe });
1226
1345
  }
1227
1346
  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)}`;
1347
+ for (let I = 1; I <= h; I++) Ve += ` L ${He[I].x.toFixed(2)} ${He[I].y.toFixed(2)}`;
1348
+ for (let I = h; I >= 0; I--) Ve += ` L ${rt[I].x.toFixed(2)} ${rt[I].y.toFixed(2)}`;
1230
1349
  return Ve += " Z", Ve;
1231
1350
  }
1232
- const $ = t.x - e.x, X = t.y - e.y;
1233
- let J = Math.hypot($, X);
1234
- 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`;
1351
+ const B = t.x - e.x, K = t.y - e.y;
1352
+ let _ = Math.hypot(B, K);
1353
+ _ < 1e-6 && (_ = 1);
1354
+ const xe = -K / _, Ee = B / _, Se = a / 2, Ae = m / 2, Lt = { x: e.x + xe * Se, y: e.y + Ee * Se }, At = { x: e.x - xe * Se, y: e.y - Ee * Se }, Ht = { x: t.x - xe * Ae, y: t.y - Ee * Ae }, Dt = { x: t.x + xe * Ae, y: t.y + Ee * Ae };
1355
+ return `M ${Lt.x.toFixed(2)} ${Lt.y.toFixed(2)} L ${Dt.x.toFixed(2)} ${Dt.y.toFixed(2)} L ${Ht.x.toFixed(2)} ${Ht.y.toFixed(2)} L ${At.x.toFixed(2)} ${At.y.toFixed(2)} Z`;
1237
1356
  }
1238
- const Te = Q(() => ee.value.root.children), an = Pe[0].colors, wt = Q(
1357
+ const Te = te(() => ie.value.root.children), an = Pe[0].colors, bt = te(
1239
1358
  () => oi(k.branchPaletteId, k.customPalettes)
1240
- ), ge = Q(() => {
1359
+ ), ye = te(() => {
1241
1360
  const e = /* @__PURE__ */ new Map();
1242
1361
  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]);
1362
+ const t = n.lineColors, a = t && t.length > 0 ? t : bt.value.colors.length > 0 ? bt.value.colors : an;
1363
+ for (let h = 0; h < Te.value.length; h++) {
1364
+ const l = Te.value[h];
1365
+ e.set(l.id, a[h % a.length]);
1247
1366
  }
1248
- const v = (f, l) => {
1249
- e.set(f.id, l);
1250
- for (const g of f.children) v(g, l);
1367
+ const m = (h, l) => {
1368
+ e.set(h.id, l);
1369
+ for (const y of h.children) m(y, l);
1251
1370
  };
1252
- for (let f = 0; f < Te.value.length; f++) {
1253
- const l = Te.value[f];
1254
- v(l, r[f % r.length]);
1371
+ for (let h = 0; h < Te.value.length; h++) {
1372
+ const l = Te.value[h];
1373
+ m(l, a[h % a.length]);
1255
1374
  }
1256
1375
  return e;
1257
1376
  });
1258
- function un(e, t) {
1259
- return k.rainbowBranch ? ge.value.get(t.id) ?? oe.value.lineColor : oe.value.lineColor;
1377
+ function sn(e, t) {
1378
+ return k.rainbowBranch ? ye.value.get(t.id) ?? ae.value.lineColor : ae.value.lineColor;
1260
1379
  }
1261
- function sn(e) {
1262
- const t = ue(e.id);
1380
+ function un(e) {
1381
+ const t = Y(e.id);
1263
1382
  if (t.bg) return t.bg;
1264
- if (e.isRoot) return oe.value.rootBg;
1383
+ if (e.isRoot) return ae.value.rootBg;
1265
1384
  if (k.rainbowBranch) {
1266
- const r = ge.value.get(e.id);
1267
- if (r) return vn(r, 0.18);
1385
+ const a = ye.value.get(e.id);
1386
+ if (a) return hn(a, 0.18);
1268
1387
  }
1269
- return oe.value.branchBg;
1388
+ return ae.value.branchBg;
1270
1389
  }
1271
- function dn(e) {
1272
- const t = ue(e.id);
1390
+ function cn(e) {
1391
+ const t = Y(e.id);
1273
1392
  if (t.textColor) return t.textColor;
1274
- if (e.isRoot) return oe.value.rootText;
1393
+ if (e.isRoot) return ae.value.rootText;
1275
1394
  if (k.rainbowBranch) {
1276
- const r = ge.value.get(e.id);
1277
- if (r) return kt(r, 0.55);
1395
+ const a = ye.value.get(e.id);
1396
+ if (a) return kt(a, 0.55);
1278
1397
  }
1279
- return oe.value.branchText;
1398
+ return ae.value.branchText;
1280
1399
  }
1281
- function cn(e) {
1282
- const t = ue(e.id);
1400
+ function dn(e) {
1401
+ const t = Y(e.id);
1283
1402
  if (t.borderColor) return t.borderColor;
1284
- if (e.isRoot) return oe.value.rootBg;
1403
+ if (e.isRoot) return ae.value.rootBg;
1285
1404
  if (k.rainbowBranch) {
1286
- const r = ge.value.get(e.id);
1287
- if (r) return kt(r, 0.3);
1405
+ const a = ye.value.get(e.id);
1406
+ if (a) return kt(a, 0.3);
1288
1407
  }
1289
- return oe.value.lineColor;
1408
+ return ae.value.lineColor;
1290
1409
  }
1291
1410
  function fn(e) {
1292
- return ue(e.id).fontWeight ?? (e.isRoot ? 600 : 400);
1411
+ return Y(e.id).fontWeight ?? (e.isRoot ? 600 : 400);
1293
1412
  }
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})`;
1413
+ function hn(e, t) {
1414
+ const a = e.replace("#", ""), m = a.length === 6 ? a : a.split("").map((B) => B + B).join(""), h = parseInt(m.slice(0, 2), 16), l = parseInt(m.slice(2, 4), 16), y = parseInt(m.slice(4, 6), 16);
1415
+ return `rgba(${h}, ${l}, ${y}, ${t})`;
1297
1416
  }
1298
1417
  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})`;
1301
- }
1302
- const E = ci({ getContainer: () => d.value });
1303
- E.setOnMarqueeEnd(Cn), vi({
1304
- isEditing: () => c.value !== null,
1305
- isReadonly: () => i.readonly,
1306
- getSelectedId: () => m.value,
1418
+ const a = e.replace("#", ""), m = a.length === 6 ? a : a.split("").map((B) => B + B).join(""), h = Math.round(parseInt(m.slice(0, 2), 16) * (1 - t)), l = Math.round(parseInt(m.slice(2, 4), 16) * (1 - t)), y = Math.round(parseInt(m.slice(4, 6), 16) * (1 - t));
1419
+ return `rgb(${h}, ${l}, ${y})`;
1420
+ }
1421
+ const S = fi({ getContainer: () => c.value });
1422
+ S.setOnMarqueeEnd(Cn), vi({
1423
+ isEditing: () => d.value !== null,
1424
+ isReadonly: () => n.readonly,
1425
+ getSelectedId: () => f.value,
1307
1426
  getRootId: () => u.value.id,
1308
1427
  // If nothing is selected, default Tab/Enter to the root so the user
1309
1428
  // can build a tree from scratch without first clicking somewhere.
1310
1429
  defaultTargetId: () => u.value.id,
1311
1430
  onAddChild: Ce,
1312
1431
  onAddSibling: Fe,
1313
- onAddSiblingBefore: St,
1432
+ onAddSiblingBefore: Et,
1314
1433
  onRemove: zt,
1315
- onStartEdit: Ae,
1434
+ onStartEdit: Le,
1316
1435
  onClearSelection: () => {
1317
- m.value = null, a("select", null);
1436
+ f.value = null, r("select", null);
1318
1437
  },
1319
- onDuplicate: Et,
1438
+ onDuplicate: St,
1320
1439
  onUndo: nt,
1321
1440
  onRedo: it,
1322
1441
  onNavigate: xn,
1323
1442
  onSelectRoot: () => {
1324
- m.value = u.value.id;
1325
- const e = B(u.value, u.value.id);
1326
- e && a("select", e);
1443
+ f.value = u.value.id;
1444
+ const e = A(u.value, u.value.id);
1445
+ e && r("select", e);
1327
1446
  }
1328
1447
  });
1329
- const ee = Q(() => {
1330
- const e = he(u.value);
1331
- return Ct(e), ei(e, { mode: k.layoutMode, baseFontSize: oe.value.fontSize });
1332
- }), Mt = D([]), tt = Q(() => (yt.value, Mt.value));
1333
- Ye(
1334
- ee,
1448
+ const ie = te(() => {
1449
+ const e = me(u.value);
1450
+ return Ct(e), ei(e, { mode: k.layoutMode, baseFontSize: ae.value.fontSize });
1451
+ }), Mt = O([]), tt = te(() => (yt.value, Mt.value));
1452
+ Ue(
1453
+ ie,
1335
1454
  (e) => {
1336
- const t = [], r = (v) => {
1337
- t.push(v);
1338
- for (const f of v.children) r(f);
1455
+ const t = [], a = (m) => {
1456
+ t.push(m);
1457
+ for (const h of m.children) a(h);
1339
1458
  };
1340
- r(e.root), Mt.value = t;
1459
+ a(e.root), Mt.value = t;
1341
1460
  },
1342
1461
  { immediate: !0 }
1343
1462
  );
1344
- const hn = Q(() => {
1463
+ const vn = te(() => {
1345
1464
  const e = [];
1346
1465
  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}` });
1466
+ for (const a of t.children)
1467
+ e.push({ from: t, to: a, key: `${t.id}->${a.id}` });
1349
1468
  return e;
1350
- }), mn = Q(
1351
- () => `${ee.value.vbX} ${ee.value.vbY} ${ee.value.vbW} ${ee.value.vbH}`
1469
+ }), mn = te(
1470
+ () => `${ie.value.vbX} ${ie.value.vbY} ${ie.value.vbW} ${ie.value.vbH}`
1352
1471
  );
1353
1472
  function Ct(e) {
1354
- if (h.value.has(e.id)) {
1473
+ if (v.value.has(e.id)) {
1355
1474
  e.children = [], e.collapsed = !0;
1356
1475
  return;
1357
1476
  }
1358
1477
  e.collapsed = !1;
1359
1478
  for (const t of e.children) Ct(t);
1360
1479
  }
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();
1480
+ function Le(e) {
1481
+ const t = A(u.value, e);
1482
+ t && (d.value = e, x.value = t.text, ee(() => {
1483
+ const a = document.querySelector(".zm-input");
1484
+ a == null || a.focus(), a == null || a.select();
1366
1485
  }));
1367
1486
  }
1368
1487
  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));
1488
+ if (!d.value) return;
1489
+ const t = A(u.value, d.value);
1490
+ t && t.text !== (x.value.trim() || " ") && (t.text = x.value.trim() || " ", G(), r("change", u.value));
1491
+ const a = d.value;
1492
+ d.value = null, e.addChild ? ee(() => Ce(a)) : e.addSibling === "after" ? ee(() => Fe(a)) : e.addSibling === "before" && ee(() => Et(a));
1374
1493
  }
1375
1494
  function gn() {
1376
- c.value = null;
1495
+ d.value = null;
1377
1496
  }
1378
1497
  function yn(e) {
1379
1498
  const t = e.metaKey || e.ctrlKey;
@@ -1381,90 +1500,90 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1381
1500
  }
1382
1501
  function Ce(e) {
1383
1502
  const t = ai(u.value, e, Je);
1384
- t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1503
+ t && (G(), T(), r("change", u.value), ee(() => Le(t.id)));
1385
1504
  }
1386
1505
  function Fe(e) {
1387
1506
  if (e === u.value.id) {
1388
1507
  Ce(e);
1389
1508
  return;
1390
1509
  }
1391
- const t = ui(u.value, e, Je);
1392
- t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1510
+ const t = si(u.value, e, Je);
1511
+ t && (G(), T(), r("change", u.value), ee(() => Le(t.id)));
1393
1512
  }
1394
- function St(e) {
1513
+ function Et(e) {
1395
1514
  if (e === u.value.id) {
1396
1515
  Ce(e);
1397
1516
  return;
1398
1517
  }
1399
- const t = si(u.value, e, Je);
1400
- t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1518
+ const t = ui(u.value, e, Je);
1519
+ t && (G(), T(), r("change", u.value), ee(() => Le(t.id)));
1401
1520
  }
1402
- function Et(e) {
1521
+ function St(e) {
1403
1522
  if (e === u.value.id) return;
1404
- const t = di(u.value, e);
1405
- t && (K(), m.value = t.id, a("change", u.value), H());
1523
+ const t = ci(u.value, e);
1524
+ t && (G(), f.value = t.id, r("change", u.value), T());
1406
1525
  }
1407
1526
  function nt() {
1408
- const e = fe.undo();
1409
- e && (u.value = e.data, m.value = null, a("select", null), H(), a("change", u.value));
1527
+ const e = he.undo();
1528
+ e && (u.value = e.data, f.value = null, r("select", null), T(), r("change", u.value));
1410
1529
  }
1411
1530
  function it() {
1412
- const e = fe.redo();
1413
- e && (u.value = e.data, m.value = null, a("select", null), H(), a("change", u.value));
1531
+ const e = he.redo();
1532
+ e && (u.value = e.data, f.value = null, r("select", null), T(), r("change", u.value));
1414
1533
  }
1415
1534
  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;
1535
+ const a = f.value ?? u.value.id, m = A(u.value, a);
1536
+ if (!m) return;
1537
+ let h = null;
1419
1538
  if (t === 1) {
1420
- const l = ae(u.value, v.id);
1539
+ const l = ce(u.value, m.id);
1421
1540
  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);
1541
+ const y = l.children.findIndex((B) => B.id === m.id);
1542
+ y >= 0 && y < l.children.length - 1 && (h = l.children[y + 1].id);
1424
1543
  }
1425
1544
  } else if (t === -1) {
1426
- const l = ae(u.value, v.id);
1545
+ const l = ce(u.value, m.id);
1427
1546
  if (l) {
1428
- const g = l.children.findIndex(($) => $.id === v.id);
1429
- g > 0 && (f = l.children[g - 1].id);
1547
+ const y = l.children.findIndex((B) => B.id === m.id);
1548
+ y > 0 && (h = l.children[y - 1].id);
1430
1549
  }
1431
1550
  } 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);
1551
+ const l = ce(u.value, m.id);
1552
+ l && (h = l.id);
1553
+ } else e === -1 && m.children.length > 0 && (h = m.children[0].id);
1554
+ if (h) {
1555
+ f.value = h;
1556
+ const l = A(u.value, h);
1557
+ l && r("select", l);
1439
1558
  }
1440
1559
  }
1441
1560
  function zt(e) {
1442
- e !== u.value.id && Gt(u.value, e) && (K(), m.value === e && (m.value = null), H(), a("change", u.value));
1561
+ e !== u.value.id && jt(u.value, e) && (G(), f.value === e && (f.value = null), T(), r("change", u.value));
1443
1562
  }
1444
1563
  function Nt(e) {
1445
- h.value.has(e) ? h.value.delete(e) : h.value.add(e), H();
1564
+ v.value.has(e) ? v.value.delete(e) : v.value.add(e), T();
1446
1565
  }
1447
1566
  function pn(e, t) {
1448
- li(u.value, e, t) && (K(), H(), a("change", u.value));
1567
+ li(u.value, e, t) && (G(), T(), r("change", u.value));
1449
1568
  }
1450
- function bn(e, t, r) {
1451
- return ri(u.value, e, t, r) ? (K(), H(), a("change", u.value), !0) : !1;
1569
+ function wn(e, t, a) {
1570
+ return ri(u.value, e, t, a) ? (G(), T(), r("change", u.value), !0) : !1;
1452
1571
  }
1453
- function wn(e, t) {
1454
- e.stopPropagation(), m.value = t.id;
1455
- const r = B(u.value, t.id);
1456
- a("select", r);
1572
+ function bn(e, t) {
1573
+ e.stopPropagation(), f.value = t.id;
1574
+ const a = A(u.value, t.id);
1575
+ r("select", a);
1457
1576
  }
1458
1577
  function kn(e) {
1459
1578
  const t = e.target;
1460
1579
  if (!t || t.closest(".zm-node, .zm-toolbar, button, input, textarea")) return;
1461
1580
  if (e.button === 2) {
1462
- E.startPan(e);
1581
+ S.startPan(e);
1463
1582
  return;
1464
1583
  }
1465
1584
  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);
1585
+ 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;
1586
+ S.startMarquee(m, h);
1468
1587
  }
1469
1588
  function Mn(e) {
1470
1589
  if (_e) {
@@ -1473,68 +1592,68 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1473
1592
  }
1474
1593
  const t = e.target;
1475
1594
  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));
1595
+ const a = S.marquee;
1596
+ a.width >= 4 || a.height >= 4 || f.value !== null && (f.value = null, r("select", null));
1478
1597
  }
1479
1598
  function Cn() {
1480
- const e = E.marquee;
1599
+ const e = S.marquee;
1481
1600
  if (e.width < 4 && e.height < 4)
1482
1601
  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);
1602
+ const t = e.x, a = e.y, m = e.x + e.width, h = e.y + e.height, l = [];
1603
+ for (const y of tt.value) {
1604
+ const B = y.width / 2, K = y.height / 2, _ = y.x - B, xe = y.x + B, Ee = y.y - K, Se = y.y + K;
1605
+ _ <= m && xe >= t && Ee <= h && Se >= a && l.push(y.id);
1487
1606
  }
1488
1607
  if (l.length > 0) {
1489
- m.value = l[0];
1490
- const g = B(u.value, l[0]);
1491
- g && a("select", g);
1608
+ f.value = l[0];
1609
+ const y = A(u.value, l[0]);
1610
+ y && r("select", y);
1492
1611
  }
1493
1612
  }
1494
1613
  function It(e) {
1495
- return h.value.has(e);
1614
+ return v.value.has(e);
1496
1615
  }
1497
- function Sn(e) {
1498
- const t = B(u.value, e.id);
1616
+ function En(e) {
1617
+ const t = A(u.value, e.id);
1499
1618
  return !!t && t.children.length > 0;
1500
1619
  }
1501
1620
  function ot(e) {
1502
- const t = B(u.value, e);
1621
+ const t = A(u.value, e);
1503
1622
  return t ? t.children.length : 0;
1504
1623
  }
1505
1624
  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);
1625
+ if (!A(u.value, e)) return 0;
1626
+ const m = [u.value];
1627
+ for (; m.length; ) {
1628
+ const h = m.pop(), l = h.children.findIndex((y) => y.id === e);
1510
1629
  if (l >= 0) return l;
1511
- for (const g of f.children) v.push(g);
1630
+ for (const y of h.children) m.push(y);
1512
1631
  }
1513
1632
  return 0;
1514
1633
  }
1515
- function $t(e, t, r, v) {
1516
- if (((v == null ? void 0 : v._dir) ?? e._dir) === "down")
1634
+ function $t(e, t, a, m) {
1635
+ if (((m == null ? void 0 : m._dir) ?? e._dir) === "down")
1517
1636
  return t === "out" ? { x: e.x, y: e.y + e.height / 2 } : { x: e.x, y: e.y - e.height / 2 };
1518
1637
  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 };
1638
+ 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
1639
  }
1521
- function se() {
1522
- const e = ee.value;
1523
- E.resetView(e.width, e.height, e.root.y);
1640
+ function de() {
1641
+ const e = ie.value;
1642
+ S.resetView(e.width, e.height, e.root.y);
1524
1643
  }
1525
- function En() {
1526
- et.value = !0, K(), H(), Z(() => se());
1644
+ function Sn() {
1645
+ et.value = !0, G(), T(), ee(() => de());
1527
1646
  }
1528
1647
  function lt(e) {
1529
- k.layoutMode !== e && (k.layoutMode = e, H(), Z(() => se()));
1648
+ k.layoutMode !== e && (k.layoutMode = e, T(), ee(() => de()));
1530
1649
  }
1531
- function Bt() {
1650
+ function Rt() {
1532
1651
  return JSON.stringify(u.value, null, 2);
1533
1652
  }
1534
- function Rt(e) {
1653
+ function Bt(e) {
1535
1654
  try {
1536
1655
  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);
1656
+ return !t.id || !Array.isArray(t.children) ? !1 : (he.reset(), u.value = me(t), f.value = null, v.value = /* @__PURE__ */ new Set(), T(), ee(() => de()), r("change", u.value), !0);
1538
1657
  } catch {
1539
1658
  return !1;
1540
1659
  }
@@ -1542,47 +1661,47 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1542
1661
  function zn() {
1543
1662
  const e = document.createElement("input");
1544
1663
  e.type = "file", e.accept = "application/json", e.onchange = () => {
1545
- var v;
1546
- const t = (v = e.files) == null ? void 0 : v[0];
1664
+ var m;
1665
+ const t = (m = e.files) == null ? void 0 : m[0];
1547
1666
  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);
1667
+ const a = new FileReader();
1668
+ a.onload = () => {
1669
+ typeof a.result == "string" && (Bt(a.result) || alert("导入失败:JSON 格式无效"));
1670
+ }, a.readAsText(t);
1552
1671
  }, e.click();
1553
1672
  }
1554
1673
  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);
1674
+ const e = new Blob([Rt()], { type: "application/json" }), t = URL.createObjectURL(e), a = document.createElement("a");
1675
+ a.href = t, a.download = `${u.value.text || "mindmap"}.json`, a.click(), URL.revokeObjectURL(t);
1557
1676
  }
1558
1677
  return s({
1559
1678
  addChild: (e) => Ce(e),
1560
1679
  addSibling: (e) => Fe(e),
1561
1680
  removeNode: (e) => zt(e),
1562
- duplicateNode: (e) => Et(e),
1681
+ duplicateNode: (e) => St(e),
1563
1682
  setNodeText: (e, t) => pn(e, t),
1564
- moveNode: (e, t, r) => bn(e, t, r),
1683
+ moveNode: (e, t, a) => wn(e, t, a),
1565
1684
  lineWidthForDepth: xt,
1566
1685
  endWidthForDepth: pt,
1567
1686
  getData: () => u.value,
1568
1687
  setData: (e) => {
1569
- fe.reset(), u.value = he(e), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), K(), Z(() => se());
1688
+ he.reset(), u.value = me(e), f.value = null, v.value = /* @__PURE__ */ new Set(), T(), G(), ee(() => de());
1570
1689
  },
1571
- resetView: () => se(),
1572
- exportData: Bt,
1573
- importData: Rt,
1690
+ resetView: () => de(),
1691
+ exportData: Rt,
1692
+ importData: Bt,
1574
1693
  /** Serialize the current data tree as markdown. Always available
1575
1694
  * — the same serializer is used to emit `markdownChange`. */
1576
- getMarkdown: () => st(u.value),
1695
+ getMarkdown: () => ut(u.value),
1577
1696
  /** Replace the data tree with the result of parsing `md`. The
1578
1697
  * flag `emitMarkdownChange` (default true) controls whether the
1579
1698
  * change is also echoed via `markdownChange` (use false when
1580
1699
  * the host just set the same value back from the prop). */
1581
1700
  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);
1701
+ const a = Xt(e || "");
1702
+ t && (g.value = !0), M = !t, he.reset(), u.value = me(a), f.value = null, v.value = /* @__PURE__ */ new Set(), T(), G(), ee(() => {
1703
+ M = !1, de();
1704
+ }), r("change", u.value);
1586
1705
  },
1587
1706
  // Make balanced the active layout (sticky). Subsequent data changes
1588
1707
  // and additions stay in balanced mode. Pass `false` to revert to the
@@ -1594,17 +1713,17 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1594
1713
  // Re-balance now: clear all manual drag offsets, re-run the balanced
1595
1714
  // layout, and re-center the view. This is the action tied to the
1596
1715
  // "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),
1716
+ balance: () => Sn(),
1717
+ applyNodeStyle: (e, t) => Z(e, t),
1718
+ getNodeStyle: (e) => Y(e),
1719
+ applyNodeLink: (e, t) => V(e, t),
1720
+ removeNodeLink: (e) => se(e),
1721
+ applyNodeNote: (e, t) => ge(e, t),
1722
+ removeNodeNote: (e) => W(e),
1604
1723
  undo: () => nt(),
1605
1724
  redo: () => it(),
1606
- canUndo: () => fe.canUndo(),
1607
- canRedo: () => fe.canRedo(),
1725
+ canUndo: () => he.canUndo(),
1726
+ canRedo: () => he.canRedo(),
1608
1727
  // Settings panel / external mutation hooks
1609
1728
  applySettings: (e) => {
1610
1729
  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);
@@ -1623,83 +1742,83 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1623
1742
  }),
1624
1743
  setBranchPalette: (e) => {
1625
1744
  if (!e) return;
1626
- [...Pe, ...k.customPalettes].find((r) => r.id === e) && (k.branchPaletteId = e);
1745
+ [...Pe, ...k.customPalettes].find((a) => a.id === e) && (k.branchPaletteId = e);
1627
1746
  },
1628
1747
  getBranchPalette: () => k.branchPaletteId,
1629
1748
  getBranchPalettes: () => [...Pe, ...k.customPalettes]
1630
- }), Ye(
1631
- () => i.data,
1749
+ }), Ue(
1750
+ () => n.data,
1632
1751
  (e) => {
1633
- u.value = he(e), H();
1752
+ u.value = me(e), T();
1634
1753
  },
1635
1754
  { deep: !1 }
1636
- ), ut(() => {
1637
- K(), Z(() => se());
1755
+ ), st(() => {
1756
+ G(), ee(() => de());
1638
1757
  }), (e, t) => {
1639
- var r, v, f;
1640
- return M(), C("div", {
1758
+ var a, m, h;
1759
+ return C(), E("div", {
1641
1760
  class: "zm-mindmap",
1642
- style: ve({ background: oe.value.bgColor, fontSize: oe.value.fontSize + "px" })
1761
+ style: ve({ background: ae.value.bgColor, fontSize: ae.value.fontSize + "px" })
1643
1762
  }, [
1644
- y("div", {
1763
+ p("div", {
1645
1764
  ref_key: "wrapperRef",
1646
- ref: d,
1765
+ ref: c,
1647
1766
  class: "zm-canvas",
1648
1767
  onMousedown: kn,
1649
- onContextmenu: t[13] || (t[13] = R(() => {
1768
+ onContextmenu: t[13] || (t[13] = D(() => {
1650
1769
  }, ["prevent"])),
1651
1770
  onWheel: t[14] || (t[14] = //@ts-ignore
1652
- (...l) => z(E).onWheel && z(E).onWheel(...l)),
1771
+ (...l) => N(S).onWheel && N(S).onWheel(...l)),
1653
1772
  onClick: Mn
1654
1773
  }, [
1655
- y("div", {
1774
+ p("div", {
1656
1775
  class: "zm-svg-layer",
1657
1776
  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"
1777
+ left: ie.value.vbX * N(S).scale.value + N(S).offsetX.value + "px",
1778
+ top: ie.value.vbY * N(S).scale.value + N(S).offsetY.value + "px",
1779
+ width: ie.value.vbW * N(S).scale.value + "px",
1780
+ height: ie.value.vbH * N(S).scale.value + "px"
1662
1781
  })
1663
1782
  }, [
1664
- (M(), C("svg", {
1783
+ (C(), E("svg", {
1665
1784
  class: "zm-svg",
1666
1785
  viewBox: mn.value,
1667
1786
  preserveAspectRatio: "xMinYMin meet",
1668
- width: ee.value.vbW * z(E).scale.value,
1669
- height: ee.value.vbH * z(E).scale.value
1787
+ width: ie.value.vbW * N(S).scale.value,
1788
+ height: ie.value.vbH * N(S).scale.value
1670
1789
  }, [
1671
- y("g", Mi, [
1672
- (M(!0), C(P, null, Ot(hn.value, (l) => (M(), C("path", {
1790
+ p("g", Ci, [
1791
+ (C(!0), E(F, null, Ot(vn.value, (l) => (C(), E("path", {
1673
1792
  key: l.key,
1674
1793
  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),
1794
+ fill: sn(l.from, l.to),
1676
1795
  stroke: "none"
1677
- }, null, 8, Ci))), 128))
1796
+ }, null, 8, Ei))), 128))
1678
1797
  ])
1679
- ], 8, ki))
1798
+ ], 8, Mi))
1680
1799
  ], 4),
1681
- z(E).isMarquee.value ? (M(), C("div", {
1800
+ N(S).isMarquee.value ? (C(), E("div", {
1682
1801
  key: 0,
1683
1802
  class: "zm-marquee",
1684
1803
  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"
1804
+ left: N(S).marquee.x * N(S).scale.value + N(S).offsetX.value + "px",
1805
+ top: N(S).marquee.y * N(S).scale.value + N(S).offsetY.value + "px",
1806
+ width: N(S).marquee.width * N(S).scale.value + "px",
1807
+ height: N(S).marquee.height * N(S).scale.value + "px"
1689
1808
  })
1690
- }, null, 4)) : O("", !0),
1691
- y("div", {
1809
+ }, null, 4)) : X("", !0),
1810
+ p("div", {
1692
1811
  class: "zm-world",
1693
1812
  style: ve({
1694
- transform: `translate(${z(E).offsetX.value}px, ${z(E).offsetY.value}px) scale(${z(E).scale.value})`
1813
+ transform: `translate(${N(S).offsetX.value}px, ${N(S).offsetY.value}px) scale(${N(S).scale.value})`
1695
1814
  })
1696
1815
  }, [
1697
- (M(!0), C(P, null, Ot(tt.value, (l) => (M(), C("div", {
1816
+ (C(!0), E(F, null, Ot(tt.value, (l) => (C(), E("div", {
1698
1817
  key: l.id,
1699
1818
  class: Ie(["zm-node", {
1700
1819
  "is-root": l.isRoot,
1701
- "is-selected": m.value === l.id,
1702
- "is-editing": c.value === l.id,
1820
+ "is-selected": f.value === l.id,
1821
+ "is-editing": d.value === l.id,
1703
1822
  "has-image": !!l.image,
1704
1823
  "is-resizing": _t.value === l.id
1705
1824
  }]),
@@ -1710,22 +1829,22 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1710
1829
  minWidth: l.width + "px",
1711
1830
  height: l.height + "px",
1712
1831
  fontSize: l.fontSize + "px",
1713
- background: sn(l),
1714
- color: dn(l),
1715
- borderColor: cn(l),
1832
+ background: un(l),
1833
+ color: cn(l),
1834
+ borderColor: dn(l),
1716
1835
  fontWeight: fn(l),
1717
1836
  // Center the box on (x, y) with translate(-50%, -50%)
1718
1837
  transform: "translate(-50%, -50%)"
1719
1838
  }),
1720
- onClick: (g) => wn(g, l),
1721
- onDblclick: (g) => {
1722
- g.stopPropagation(), n.readonly || Ae(l.id);
1839
+ onClick: (y) => bn(y, l),
1840
+ onDblclick: (y) => {
1841
+ y.stopPropagation(), i.readonly || Le(l.id);
1723
1842
  },
1724
- onContextmenu: (g) => j(g, l),
1725
- onMouseenter: (g) => tn(l.id),
1726
- onMouseleave: (g) => nn(l.id)
1843
+ onContextmenu: (y) => Q(y, l),
1844
+ onMouseenter: (y) => tn(l.id),
1845
+ onMouseleave: (y) => nn(l.id)
1727
1846
  }, [
1728
- l.image ? (M(), C("img", {
1847
+ l.image ? (C(), E("img", {
1729
1848
  key: 0,
1730
1849
  class: "zm-node-img",
1731
1850
  src: l.image.src,
@@ -1733,242 +1852,244 @@ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"]
1733
1852
  height: l.image.height,
1734
1853
  alt: l.text,
1735
1854
  draggable: "false"
1736
- }, null, 8, Ei)) : O("", !0),
1737
- c.value !== l.id ? (M(), C("span", zi, [
1738
- y("span", Ni, be(l.text), 1),
1739
- l.link && !c.value ? (M(), C("a", {
1855
+ }, null, 8, zi)) : X("", !0),
1856
+ d.value !== l.id ? (C(), E("span", Ni, [
1857
+ p("span", Ii, be(l.text), 1),
1858
+ l.link && !d.value ? (C(), E("a", {
1740
1859
  key: 0,
1741
1860
  class: "zm-node-link",
1742
1861
  href: l.link.url,
1743
1862
  target: "_blank",
1744
1863
  rel: "noopener noreferrer",
1745
1864
  title: `打开链接:${l.link.url}`,
1746
- onClick: t[0] || (t[0] = R(() => {
1865
+ onClick: t[0] || (t[0] = D(() => {
1747
1866
  }, ["stop"])),
1748
- onMousedown: t[1] || (t[1] = R(() => {
1867
+ onMousedown: t[1] || (t[1] = D(() => {
1749
1868
  }, ["stop"]))
1750
1869
  }, [
1751
- F(V, {
1870
+ q(U, {
1752
1871
  name: "link",
1753
1872
  size: 11,
1754
1873
  stroke: 2
1755
1874
  })
1756
- ], 40, Ii)) : O("", !0),
1757
- l.note && !c.value ? (M(), C("button", {
1875
+ ], 40, Wi)) : X("", !0),
1876
+ l.note && !d.value ? (C(), E("button", {
1758
1877
  key: 1,
1759
1878
  class: "zm-node-note-btn",
1760
1879
  type: "button",
1761
1880
  title: Qt(l.note.text),
1762
- onClick: R((g) => vt(l.id), ["stop"]),
1763
- onMousedown: t[2] || (t[2] = R(() => {
1881
+ onClick: D((y) => ht(l.id), ["stop"]),
1882
+ onMousedown: t[2] || (t[2] = D(() => {
1764
1883
  }, ["stop"]))
1765
1884
  }, [
1766
- F(V, {
1885
+ q(U, {
1767
1886
  name: "note",
1768
1887
  size: 11,
1769
1888
  stroke: 2
1770
1889
  })
1771
- ], 40, Wi)) : O("", !0)
1772
- ])) : Wn((M(), C("input", {
1890
+ ], 40, $i)) : X("", !0)
1891
+ ])) : Wn((C(), E("input", {
1773
1892
  key: 2,
1774
1893
  class: "zm-input",
1775
- "onUpdate:modelValue": t[3] || (t[3] = (g) => x.value = g),
1894
+ "onUpdate:modelValue": t[3] || (t[3] = (y) => x.value = y),
1776
1895
  autofocus: "",
1777
- onBlur: t[4] || (t[4] = (g) => Oe()),
1896
+ onBlur: t[4] || (t[4] = (y) => Oe()),
1778
1897
  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"])),
1782
- Ke(gn, ["esc"]),
1898
+ t[5] || (t[5] = Ye(D((y) => Oe({ addSibling: "after" }), ["exact"]), ["enter"])),
1899
+ t[6] || (t[6] = Ye(D((y) => Oe({ addSibling: "before" }), ["shift", "prevent", "exact"]), ["enter"])),
1900
+ t[7] || (t[7] = Ye(D((y) => Oe({ addChild: !0 }), ["prevent"]), ["tab"])),
1901
+ Ye(gn, ["esc"]),
1783
1902
  yn
1784
1903
  ],
1785
- onMousedown: t[8] || (t[8] = R(() => {
1904
+ onMousedown: t[8] || (t[8] = D(() => {
1786
1905
  }, ["stop"])),
1787
- onClick: t[9] || (t[9] = R(() => {
1906
+ onClick: t[9] || (t[9] = D(() => {
1788
1907
  }, ["stop"]))
1789
1908
  }, null, 544)), [
1790
1909
  [$n, x.value]
1791
1910
  ]),
1792
- b.value ? (M(), C("span", {
1911
+ w.value ? (C(), E("span", {
1793
1912
  key: 3,
1794
1913
  class: "zm-order-badge",
1795
1914
  title: `数据顺序:第 ${Wt(l.id) + 1} 个`
1796
- }, be(Wt(l.id) + 1), 9, $i)) : O("", !0),
1797
- It(l.id) && !l.isRoot && ot(l.id) > 0 ? (M(), C("span", {
1915
+ }, be(Wt(l.id) + 1), 9, Ri)) : X("", !0),
1916
+ It(l.id) && !l.isRoot && ot(l.id) > 0 ? (C(), E("span", {
1798
1917
  key: 4,
1799
1918
  class: Ie(["zm-collapse-badge", { "is-on-left": l.side === -1 }]),
1800
- style: ve({ background: ge.value.get(l.id) ?? "#64748b" }),
1919
+ style: ve({ background: ye.value.get(l.id) ?? "#64748b" }),
1801
1920
  title: `展开 ${ot(l.id)} 个子节点`,
1802
- onMousedown: t[10] || (t[10] = R(() => {
1921
+ onMousedown: t[10] || (t[10] = D(() => {
1803
1922
  }, ["stop"])),
1804
- onClick: R((g) => Nt(l.id), ["stop"])
1805
- }, be(ot(l.id)), 47, Bi)) : O("", !0),
1806
- !n.readonly && !l.isRoot && Sn(l) && !It(l.id) ? (M(), C("button", {
1923
+ onClick: D((y) => Nt(l.id), ["stop"])
1924
+ }, be(ot(l.id)), 47, Bi)) : X("", !0),
1925
+ !i.readonly && !l.isRoot && En(l) && !It(l.id) ? (C(), E("button", {
1807
1926
  key: 5,
1808
1927
  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" }),
1928
+ style: ve({ color: ye.value.get(l.id) ?? "#64748b", borderColor: ye.value.get(l.id) ?? "#64748b" }),
1810
1929
  title: "折叠",
1811
- onMousedown: t[11] || (t[11] = R(() => {
1930
+ onMousedown: t[11] || (t[11] = D(() => {
1812
1931
  }, ["stop"])),
1813
- onClick: R((g) => Nt(l.id), ["stop"])
1932
+ onClick: D((y) => Nt(l.id), ["stop"])
1814
1933
  }, [
1815
- F(V, {
1934
+ q(U, {
1816
1935
  name: "minus",
1817
1936
  size: 10,
1818
1937
  stroke: 2.4
1819
1938
  })
1820
- ], 46, Ri)) : O("", !0),
1821
- l.image && m.value === l.id && c.value !== l.id ? (M(), C("span", {
1939
+ ], 46, Li)) : X("", !0),
1940
+ l.image && f.value === l.id && d.value !== l.id ? (C(), E("span", {
1822
1941
  key: 6,
1823
1942
  class: "zm-img-resize-handle",
1824
1943
  title: "拖动调整图片大小",
1825
- onMousedown: R((g) => en(g, l), ["stop"])
1826
- }, null, 40, Ai)) : O("", !0),
1827
- l.image && m.value === l.id && c.value !== l.id ? (M(), C("button", {
1944
+ onMousedown: D((y) => en(y, l), ["stop"])
1945
+ }, null, 40, Ai)) : X("", !0),
1946
+ l.image && f.value === l.id && d.value !== l.id ? (C(), E("button", {
1828
1947
  key: 7,
1829
1948
  class: "zm-img-remove-btn",
1830
1949
  title: "移除图片",
1831
- onMousedown: t[12] || (t[12] = R(() => {
1950
+ onMousedown: t[12] || (t[12] = D(() => {
1832
1951
  }, ["stop"])),
1833
- onClick: R((g) => G(l.id), ["stop"])
1952
+ onClick: D((y) => z(l.id), ["stop"])
1834
1953
  }, [
1835
- F(V, {
1954
+ q(U, {
1836
1955
  name: "x",
1837
1956
  size: 9,
1838
1957
  stroke: 2.2
1839
1958
  })
1840
- ], 40, Li)) : O("", !0)
1959
+ ], 40, Hi)) : X("", !0)
1841
1960
  ], 46, Si))), 128))
1842
1961
  ], 4),
1843
- W.value ? (M(), Bn(wi, {
1962
+ R.value ? (C(), Rn(ki, {
1844
1963
  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,
1964
+ x: R.value.x,
1965
+ y: R.value.y,
1966
+ container: c.value,
1967
+ "has-image": !!((a = N(A)(u.value, R.value.nodeId)) != null && a.image),
1968
+ "has-link": !!((m = N(A)(u.value, R.value.nodeId)) != null && m.link),
1969
+ "has-note": !!((h = N(A)(u.value, R.value.nodeId)) != null && h.note),
1970
+ readonly: n.readonly,
1971
+ onPickImage: le,
1853
1972
  onRemoveImage: Zt,
1854
- onSetLink: ie,
1973
+ onSetLink: re,
1855
1974
  onRemoveLink: ke,
1856
- onEditNote: Be,
1975
+ onEditNote: Re,
1857
1976
  onRemoveNote: Me,
1858
- onClose: _
1859
- }, null, 8, ["x", "y", "container", "has-image", "has-link", "has-note", "readonly"])) : O("", !0)
1977
+ onClose: ne
1978
+ }, null, 8, ["x", "y", "container", "has-image", "has-link", "has-note", "readonly"])) : X("", !0)
1860
1979
  ], 544),
1861
- i.previewMode ? O("", !0) : (M(), C("div", Hi, [
1862
- y("button", {
1980
+ n.previewMode ? X("", !0) : (C(), E("div", Di, [
1981
+ p("button", {
1863
1982
  class: "zm-tb-btn",
1864
1983
  title: "放大",
1865
1984
  onClick: t[15] || (t[15] = //@ts-ignore
1866
- (...l) => z(E).zoomIn && z(E).zoomIn(...l))
1985
+ (...l) => N(S).zoomIn && N(S).zoomIn(...l))
1867
1986
  }, [
1868
- F(V, { name: "zoom-in" })
1987
+ q(U, { name: "zoom-in" })
1869
1988
  ]),
1870
- y("button", {
1989
+ p("button", {
1871
1990
  class: "zm-tb-btn",
1872
1991
  title: "缩小",
1873
1992
  onClick: t[16] || (t[16] = //@ts-ignore
1874
- (...l) => z(E).zoomOut && z(E).zoomOut(...l))
1993
+ (...l) => N(S).zoomOut && N(S).zoomOut(...l))
1875
1994
  }, [
1876
- F(V, { name: "zoom-out" })
1995
+ q(U, { name: "zoom-out" })
1877
1996
  ]),
1878
- y("button", {
1997
+ p("button", {
1879
1998
  class: "zm-tb-btn",
1880
1999
  title: "重置视图",
1881
- onClick: se
2000
+ onClick: de
1882
2001
  }, [
1883
- F(V, { name: "reset" })
2002
+ q(U, { name: "reset" })
1884
2003
  ]),
1885
- t[22] || (t[22] = y("span", { class: "zm-tb-divider" }, null, -1)),
1886
- n.readonly ? O("", !0) : (M(), C("button", {
2004
+ t[22] || (t[22] = p("span", { class: "zm-tb-divider" }, null, -1)),
2005
+ i.readonly ? X("", !0) : (C(), E("button", {
1887
2006
  key: 0,
1888
2007
  class: "zm-tb-btn",
1889
2008
  title: "添加子节点 (Tab)",
1890
- onClick: t[17] || (t[17] = (l) => m.value && Ce(m.value))
2009
+ onClick: t[17] || (t[17] = (l) => f.value && Ce(f.value))
1891
2010
  }, [
1892
- y("img", {
1893
- src: z(Dn),
2011
+ p("img", {
2012
+ src: N(Dn),
1894
2013
  width: "14",
1895
2014
  height: "14",
1896
2015
  alt: "添加子节点",
1897
2016
  draggable: "false"
1898
- }, null, 8, Di)
2017
+ }, null, 8, Pi)
1899
2018
  ])),
1900
- n.readonly ? O("", !0) : (M(), C("button", {
2019
+ i.readonly ? X("", !0) : (C(), E("button", {
1901
2020
  key: 1,
1902
2021
  class: "zm-tb-btn",
1903
2022
  title: "添加同级 (Enter)",
1904
- onClick: t[18] || (t[18] = (l) => m.value && Fe(m.value))
2023
+ onClick: t[18] || (t[18] = (l) => f.value && Fe(f.value))
1905
2024
  }, [
1906
- y("img", {
1907
- src: z(Hn),
2025
+ p("img", {
2026
+ src: N(Hn),
1908
2027
  width: "14",
1909
2028
  height: "14",
1910
2029
  alt: "添加同级",
1911
2030
  draggable: "false"
1912
- }, null, 8, Pi)
2031
+ }, null, 8, Ti)
1913
2032
  ])),
1914
- t[23] || (t[23] = y("span", { class: "zm-tb-divider" }, null, -1)),
1915
- y("button", {
2033
+ t[23] || (t[23] = p("span", { class: "zm-tb-divider" }, null, -1)),
2034
+ p("button", {
1916
2035
  class: Ie(["zm-tb-btn", { active: k.layoutMode === "mindmap" }]),
1917
2036
  title: "思维导图布局 (中心辐射)",
1918
2037
  onClick: t[19] || (t[19] = (l) => lt("mindmap"))
1919
2038
  }, [
1920
- F(V, { name: "mindmap" })
2039
+ q(U, { name: "mindmap" })
1921
2040
  ], 2),
1922
- y("button", {
2041
+ p("button", {
1923
2042
  class: Ie(["zm-tb-btn", { active: k.layoutMode === "tree" }]),
1924
2043
  title: "树形布局 (向右展开)",
1925
2044
  onClick: t[20] || (t[20] = (l) => lt("tree"))
1926
2045
  }, [
1927
- F(V, { name: "tree" })
2046
+ q(U, { name: "tree" })
1928
2047
  ], 2),
1929
- y("button", {
2048
+ p("button", {
1930
2049
  class: Ie(["zm-tb-btn", { active: k.layoutMode === "org" }]),
1931
2050
  title: "组织结构布局 (向下展开)",
1932
2051
  onClick: t[21] || (t[21] = (l) => lt("org"))
1933
2052
  }, [
1934
- F(V, { name: "org" })
2053
+ q(U, { name: "org" })
1935
2054
  ], 2),
1936
- t[24] || (t[24] = y("span", { class: "zm-tb-divider" }, null, -1)),
1937
- n.readonly ? O("", !0) : (M(), C("button", {
2055
+ t[24] || (t[24] = p("span", { class: "zm-tb-divider" }, null, -1)),
2056
+ i.readonly ? X("", !0) : (C(), E("button", {
1938
2057
  key: 2,
1939
2058
  class: "zm-tb-btn",
1940
2059
  title: "导入 JSON",
1941
2060
  onClick: zn
1942
2061
  }, [
1943
- F(V, { name: "import" })
2062
+ q(U, { name: "import" })
1944
2063
  ])),
1945
- y("button", {
2064
+ p("button", {
1946
2065
  class: "zm-tb-btn",
1947
2066
  title: "导出 JSON",
1948
2067
  onClick: Nn
1949
2068
  }, [
1950
- F(V, { name: "export" })
2069
+ q(U, { name: "export" })
1951
2070
  ]),
1952
- y("span", Ti, be(Math.round(z(E).scale.value * 100)) + "%", 1)
2071
+ p("span", Oi, be(Math.round(N(S).scale.value * 100)) + "%", 1)
1953
2072
  ]))
1954
2073
  ], 4);
1955
2074
  };
1956
2075
  }
1957
- }), Vi = {
1958
- install(n) {
1959
- n.component("FlowMindMap", Oi);
2076
+ }), Ui = {
2077
+ install(i) {
2078
+ i.component("FlowMindMap", Fi);
1960
2079
  }
1961
2080
  };
1962
2081
  export {
1963
- Oi as MindMap,
2082
+ Fi as MindMap,
1964
2083
  ai as addChild,
1965
- ui as addSibling,
1966
- he as clone,
1967
- Vi as default,
1968
- B as findNode,
1969
- ae as findParent,
2084
+ si as addSibling,
2085
+ me as clone,
2086
+ Ui as default,
2087
+ A as findNode,
2088
+ ce as findParent,
1970
2089
  Xt as markdownToMindMap,
1971
- st as mindMapToMarkdown,
1972
- Gt as removeNode,
1973
- we as uid
2090
+ Xi as markdownToRichMindMap,
2091
+ ut as mindMapToMarkdown,
2092
+ jt as removeNode,
2093
+ qi as richBlockToMarkdown,
2094
+ ue as uid
1974
2095
  };