@billtaofbj/mindmap 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -2,31 +2,61 @@ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r
2
2
  import { BrandWatermark as O } from "@billtaofbj/core";
3
3
  import { useRoute as k, useRouter as A } from "vue-router";
4
4
  import { ElMessage as j, ElMessageBox as M } from "element-plus";
5
- import { Aim as N, ArrowLeft as P, Bell as F, Brush as I, Check as L, Clock as R, Close as z, CopyDocument as B, Delete as V, Document as H, DocumentCopy as U, Download as W, Edit as G, FullScreen as K, Grid as q, InfoFilled as ee, Link as te, Loading as ne, Monitor as J, Picture as re, Plus as ie, Promotion as ae, Refresh as oe, RefreshLeft as se, RefreshRight as ce, Scissor as Y, Share as le, Switch as ue, ZoomIn as de, ZoomOut as fe } from "@element-plus/icons-vue";
6
- import X from "axios";
7
- import * as pe from "yjs";
8
- import { HocuspocusProvider as me } from "@hocuspocus/provider";
9
- //#region \0plugin-vue:export-helper
10
- var Z = (e, t) => {
5
+ import N from "axios";
6
+ import { Aim as P, ArrowLeft as F, Bell as I, Brush as L, Check as R, Clock as z, Close as B, CopyDocument as V, Delete as H, Document as U, DocumentCopy as W, Download as G, Edit as K, FullScreen as q, Grid as ee, InfoFilled as te, Link as J, Loading as Y, Monitor as X, Picture as ne, Plus as Z, Promotion as re, Refresh as ie, RefreshLeft as ae, RefreshRight as oe, Scissor as se, Share as ce, Switch as le, ZoomIn as ue, ZoomOut as de } from "@element-plus/icons-vue";
7
+ import * as fe from "yjs";
8
+ import { HocuspocusProvider as pe } from "@hocuspocus/provider";
9
+ N.create({
10
+ baseURL: "/api",
11
+ timeout: 3e4
12
+ });
13
+ function me(e = "/api") {
14
+ let t = N.create({
15
+ baseURL: e,
16
+ timeout: 3e4
17
+ });
18
+ return {
19
+ list: (e) => t.get("/documents/", { params: e }),
20
+ get: (e) => t.get(`/documents/${e}`),
21
+ create: (e) => t.post("/documents/", e),
22
+ update: (e, n) => t.put(`/documents/${e}`, n),
23
+ delete: (e) => t.delete(`/documents/${e}`),
24
+ addAttachment: (e, n) => t.post(`/documents/${e}/attachments`, n),
25
+ listAttachments: (e) => t.get(`/documents/${e}/attachments`)
26
+ };
27
+ }
28
+ function he(e = "/api") {
29
+ let t = N.create({
30
+ baseURL: e,
31
+ timeout: 3e4
32
+ });
33
+ return {
34
+ get: (e) => t.get(`/questionnaires/${e}`),
35
+ create: (e) => t.post("/questionnaires/", e),
36
+ update: (e, n) => t.put(`/questionnaires/${e}`, n)
37
+ };
38
+ }
39
+ he("/api");
40
+ var ge = me("/api"), Q = (e, t) => {
11
41
  let n = e.__vccOpts || e;
12
42
  for (let [e, r] of t) n[e] = r;
13
43
  return n;
14
- }, Q = { class: "chat-header" }, he = { class: "chat-header-left" }, ge = { class: "chat-title" }, _e = { class: "online-users-list" }, $ = { class: "online-user-item" }, ve = { class: "online-user-name" }, ye = { key: 1 }, be = { class: "online-user-name" }, xe = { class: "chat-header-right" }, Se = {
44
+ }, _e = { class: "chat-header" }, ve = { class: "chat-header-left" }, ye = { class: "chat-title" }, be = { class: "online-users-list" }, $ = { class: "online-user-item" }, xe = { class: "online-user-name" }, Se = { key: 1 }, Ce = { class: "online-user-name" }, we = { class: "chat-header-right" }, Te = {
15
45
  key: 0,
16
46
  class: "chat-empty"
17
- }, Ce = { class: "chat-empty-hint" }, we = { key: 1 }, Te = { class: "message-content" }, Ee = {
47
+ }, Ee = { class: "chat-empty-hint" }, De = { key: 1 }, Oe = { class: "message-content" }, ke = {
18
48
  key: 0,
19
49
  class: "message-meta"
20
- }, De = {
50
+ }, Ae = {
21
51
  key: 0,
22
52
  class: "message-mention"
23
- }, Oe = ["innerHTML"], ke = { class: "message-time" }, Ae = {
53
+ }, je = ["innerHTML"], Me = { class: "message-time" }, Ne = {
24
54
  key: 1,
25
55
  class: "chat-message chat-message-ai"
26
- }, je = { class: "message-avatar ai" }, Me = { class: "chat-input-area" }, Ne = {
56
+ }, Pe = { class: "message-avatar ai" }, Fe = { class: "chat-input-area" }, Ie = {
27
57
  key: 0,
28
58
  class: "mention-popup"
29
- }, Pe = ["onClick", "onMouseenter"], Fe = { key: 1 }, Ie = /*#__PURE__*/ Z({
59
+ }, Le = ["onClick", "onMouseenter"], Re = { key: 1 }, ze = /*#__PURE__*/ Q({
30
60
  __name: "AiChatPanel",
31
61
  props: {
32
62
  visible: {
@@ -90,7 +120,7 @@ var Z = (e, t) => {
90
120
  let i = String(r || n.name || "");
91
121
  return t.has(i) ? !1 : (t.add(i), !0);
92
122
  })];
93
- }), I = t(() => P.value.length + 1), L = (e) => e.role === "ai" ? "chat-message-ai" : p.isCollab && e.user_id && e.user_id !== p.currentUser.id ? "chat-message-other" : "chat-message-user", R = (e) => e.role === "ai" ? { background: "linear-gradient(135deg, #409EFF, #337ECC)" } : { background: e.user_color || "#67C23A" }, B = (e) => (e.user_name || "U").charAt(0), H = (e) => {
123
+ }), F = t(() => P.value.length + 1), L = (e) => e.role === "ai" ? "chat-message-ai" : p.isCollab && e.user_id && e.user_id !== p.currentUser.id ? "chat-message-other" : "chat-message-user", R = (e) => e.role === "ai" ? { background: "linear-gradient(135deg, #409EFF, #337ECC)" } : { background: e.user_color || "#67C23A" }, z = (e) => (e.user_name || "U").charAt(0), V = (e) => {
94
124
  if (!p.isCollab) return;
95
125
  let t = typeof e == "string" ? e : e.target?.value || h.value, n = t.length, r = t.lastIndexOf("@", n);
96
126
  if (r !== -1 && r < n) {
@@ -140,15 +170,15 @@ var Z = (e, t) => {
140
170
  class: "ai-chat-panel",
141
171
  style: f({ width: c.panelWidth + "px" })
142
172
  }, [
143
- a("div", Q, [a("div", he, [
173
+ a("div", _e, [a("div", ve, [
144
174
  s(u, {
145
175
  size: 18,
146
176
  color: "#409EFF"
147
177
  }, {
148
- default: w(() => [s(x(J))]),
178
+ default: w(() => [s(x(X))]),
149
179
  _: 1
150
180
  }),
151
- a("span", ge, b(c.isCollab ? "协作聊天" : "AI 助手"), 1),
181
+ a("span", ye, b(c.isCollab ? "协作聊天" : "AI 助手"), 1),
152
182
  c.isCollab ? (g(), n(_, {
153
183
  key: 0,
154
184
  width: 200,
@@ -161,15 +191,15 @@ var Z = (e, t) => {
161
191
  effect: "plain",
162
192
  class: "online-tag"
163
193
  }, {
164
- default: w(() => [o(b(I.value) + "人在线 ", 1)]),
194
+ default: w(() => [o(b(F.value) + "人在线 ", 1)]),
165
195
  _: 1
166
196
  })]),
167
- default: w(() => [a("div", _e, [a("div", $, [
197
+ default: w(() => [a("div", be, [a("div", $, [
168
198
  a("div", {
169
199
  class: "online-user-avatar",
170
200
  style: f({ background: c.currentUser.color || "#409EFF" })
171
201
  }, b((c.currentUser.name || "U").charAt(0)), 5),
172
- a("span", ve, b(c.currentUser.name || "我"), 1),
202
+ a("span", xe, b(c.currentUser.name || "我"), 1),
173
203
  s(p, {
174
204
  size: "small",
175
205
  type: c.isOwner ? "warning" : "success",
@@ -191,10 +221,10 @@ var Z = (e, t) => {
191
221
  key: 0,
192
222
  size: 14
193
223
  }, {
194
- default: w(() => [s(x(J))]),
224
+ default: w(() => [s(x(X))]),
195
225
  _: 1
196
- })) : (g(), i("span", ye, b((e.name || "U").charAt(0)), 1))], 4),
197
- a("span", be, b(e.name || "未知用户"), 1),
226
+ })) : (g(), i("span", Se, b((e.name || "U").charAt(0)), 1))], 4),
227
+ a("span", Ce, b(e.name || "未知用户"), 1),
198
228
  e.isAi ? (g(), n(p, {
199
229
  key: 0,
200
230
  size: "small",
@@ -217,7 +247,7 @@ var Z = (e, t) => {
217
247
  ]))), 128))])]),
218
248
  _: 1
219
249
  })) : r("", !0)
220
- ]), a("div", xe, [
250
+ ]), a("div", we, [
221
251
  c.isCollab && c.unreadMention ? (g(), i("div", {
222
252
  key: 0,
223
253
  class: "mention-bell",
@@ -227,7 +257,7 @@ var Z = (e, t) => {
227
257
  size: 18,
228
258
  color: "#F56C6C"
229
259
  }, {
230
- default: w(() => [s(x(F))]),
260
+ default: w(() => [s(x(I))]),
231
261
  _: 1
232
262
  })])) : r("", !0),
233
263
  s(C, {
@@ -238,7 +268,7 @@ var Z = (e, t) => {
238
268
  title: "清空对话"
239
269
  }, {
240
270
  default: w(() => [s(u, null, {
241
- default: w(() => [s(x(V))]),
271
+ default: w(() => [s(x(H))]),
242
272
  _: 1
243
273
  })]),
244
274
  _: 1
@@ -251,7 +281,7 @@ var Z = (e, t) => {
251
281
  title: "关闭"
252
282
  }, {
253
283
  default: w(() => [s(u, null, {
254
- default: w(() => [s(x(z))]),
284
+ default: w(() => [s(x(B))]),
255
285
  _: 1
256
286
  })]),
257
287
  _: 1
@@ -262,16 +292,16 @@ var Z = (e, t) => {
262
292
  ref_key: "messagesRef",
263
293
  ref: S
264
294
  }, [
265
- c.messages.length === 0 ? (g(), i("div", Se, [
295
+ c.messages.length === 0 ? (g(), i("div", Te, [
266
296
  s(u, {
267
297
  size: 40,
268
298
  color: "#c0c4cc"
269
299
  }, {
270
- default: w(() => [s(x(J))]),
300
+ default: w(() => [s(x(X))]),
271
301
  _: 1
272
302
  }),
273
303
  a("p", null, b(c.isCollab ? "协作聊天室" : "你好!我是 AI 助手"), 1),
274
- a("p", Ce, b(c.isCollab ? "与团队成员和AI助手实时聊天" : "可以问我任何关于文档编辑的问题"), 1)
304
+ a("p", Ee, b(c.isCollab ? "与团队成员和AI助手实时聊天" : "可以问我任何关于文档编辑的问题"), 1)
275
305
  ])) : r("", !0),
276
306
  (g(!0), i(e, null, v(c.messages, (e) => (g(), i("div", {
277
307
  key: e._msgId || e.time + e.content,
@@ -283,21 +313,21 @@ var Z = (e, t) => {
283
313
  key: 0,
284
314
  size: 16
285
315
  }, {
286
- default: w(() => [s(x(J))]),
316
+ default: w(() => [s(x(X))]),
287
317
  _: 1
288
- })) : (g(), i("span", we, b(B(e)), 1))], 4), a("div", Te, [
289
- c.isCollab && e.role === "user" ? (g(), i("div", Ee, [a("span", {
318
+ })) : (g(), i("span", De, b(z(e)), 1))], 4), a("div", Oe, [
319
+ c.isCollab && e.role === "user" ? (g(), i("div", ke, [a("span", {
290
320
  class: "message-sender",
291
321
  style: f({ color: e.user_color || "#67C23A" })
292
- }, b(e.user_name || "用户"), 5), e.mentioned_user ? (g(), i("span", De, "@" + b(e.mentioned_user), 1)) : r("", !0)])) : r("", !0),
322
+ }, b(e.user_name || "用户"), 5), e.mentioned_user ? (g(), i("span", Ae, "@" + b(e.mentioned_user), 1)) : r("", !0)])) : r("", !0),
293
323
  a("div", {
294
324
  class: "message-text",
295
325
  innerHTML: e.content
296
- }, null, 8, Oe),
297
- a("div", ke, b(e.time), 1)
326
+ }, null, 8, je),
327
+ a("div", Me, b(e.time), 1)
298
328
  ])], 2))), 128)),
299
- c.loading ? (g(), i("div", Ae, [a("div", je, [s(u, { size: 16 }, {
300
- default: w(() => [s(x(J))]),
329
+ c.loading ? (g(), i("div", Ne, [a("div", Pe, [s(u, { size: 16 }, {
330
+ default: w(() => [s(x(X))]),
301
331
  _: 1
302
332
  })]), l[7] ||= a("div", { class: "message-content" }, [a("div", { class: "message-text typing-indicator" }, [
303
333
  a("span"),
@@ -305,7 +335,7 @@ var Z = (e, t) => {
305
335
  a("span")
306
336
  ])], -1)])) : r("", !0)
307
337
  ], 512),
308
- a("div", Me, [a("div", {
338
+ a("div", Fe, [a("div", {
309
339
  class: "chat-input-wrapper",
310
340
  ref_key: "inputWrapperRef",
311
341
  ref: T
@@ -324,14 +354,14 @@ var Z = (e, t) => {
324
354
  E(D(U, ["prevent"]), ["down"]),
325
355
  E(D(W, ["prevent"]), ["up"])
326
356
  ],
327
- onInput: H,
357
+ onInput: V,
328
358
  resize: "none"
329
359
  }, null, 8, [
330
360
  "modelValue",
331
361
  "placeholder",
332
362
  "onKeydown"
333
363
  ]),
334
- O.value ? (g(), i("div", Ne, [(g(!0), i(e, null, v(k.value, (e, t) => (g(), i("div", {
364
+ O.value ? (g(), i("div", Ie, [(g(!0), i(e, null, v(k.value, (e, t) => (g(), i("div", {
335
365
  key: e.id || e.clientId,
336
366
  class: d(["mention-item", { active: t === A.value }]),
337
367
  onClick: (t) => G(e),
@@ -343,9 +373,9 @@ var Z = (e, t) => {
343
373
  key: 0,
344
374
  size: 12
345
375
  }, {
346
- default: w(() => [s(x(J))]),
376
+ default: w(() => [s(x(X))]),
347
377
  _: 1
348
- })) : (g(), i("span", Fe, b((e.name || "U").charAt(0)), 1))], 4), a("span", null, b(e.name), 1)], 42, Pe))), 128))])) : r("", !0),
378
+ })) : (g(), i("span", Re, b((e.name || "U").charAt(0)), 1))], 4), a("span", null, b(e.name), 1)], 42, Le))), 128))])) : r("", !0),
349
379
  s(C, {
350
380
  class: "send-btn",
351
381
  type: "primary",
@@ -354,7 +384,7 @@ var Z = (e, t) => {
354
384
  onClick: K
355
385
  }, {
356
386
  default: w(() => [s(u, null, {
357
- default: w(() => [s(x(ae))]),
387
+ default: w(() => [s(x(re))]),
358
388
  _: 1
359
389
  })]),
360
390
  _: 1
@@ -366,7 +396,7 @@ var Z = (e, t) => {
366
396
  }, [["__scopeId", "data-v-01960100"]]);
367
397
  //#endregion
368
398
  //#region ../../src/composables/useChat.js
369
- function Le() {
399
+ function Be() {
370
400
  let e = _([]), t = _(!1), n = _(!1), r = _([]), i = _({
371
401
  id: "",
372
402
  name: "",
@@ -422,7 +452,7 @@ function Le() {
422
452
  console.warn("[useChat] Failed to push to Y.Array:", e);
423
453
  }
424
454
  if (r.roomId) try {
425
- await X.post(u, {
455
+ await N.post(u, {
426
456
  room_id: r.roomId,
427
457
  role: "user",
428
458
  content: t,
@@ -448,7 +478,7 @@ function Le() {
448
478
  console.warn("[useChat] Failed to push AI message to Y.Array:", e);
449
479
  }
450
480
  if (r) try {
451
- await X.post(u, {
481
+ await N.post(u, {
452
482
  room_id: r,
453
483
  role: "ai",
454
484
  content: t,
@@ -460,7 +490,7 @@ function Le() {
460
490
  }
461
491
  }, b = async (t) => {
462
492
  if (t) try {
463
- let n = await X.get(u, { params: { room_id: t } });
493
+ let n = await N.get(u, { params: { room_id: t } });
464
494
  if (Array.isArray(n.data)) {
465
495
  let t = n.data.map((e) => ({
466
496
  _msgId: e._msgId || `hist-${e.id || Date.now()}`,
@@ -479,7 +509,7 @@ function Le() {
479
509
  }
480
510
  }, S = async (t) => {
481
511
  if (e.value = [], l.clear(), t) try {
482
- await X.delete(u, { params: { room_id: t } });
512
+ await N.delete(u, { params: { room_id: t } });
483
513
  } catch (e) {
484
514
  console.warn("[useChat] Failed to clear messages on server:", e);
485
515
  }
@@ -513,8 +543,119 @@ function Le() {
513
543
  };
514
544
  }
515
545
  //#endregion
546
+ //#region ../../src/composables/useAiApi.js
547
+ var Ve = [
548
+ "我可以帮您优化流程图布局、检查节点逻辑,或者提供流程设计建议。请问有什么需要帮助的?",
549
+ "这个流程图的节点连接看起来很清晰。建议检查一下是否有遗漏的分支或异常处理路径。",
550
+ "根据当前的流程结构,我建议在关键决策节点后添加明确的条件标注,使流程更易理解。",
551
+ "流程图中的泳道划分很合理。如果需要,我可以帮您分析各角色的职责分配是否均衡。",
552
+ "我可以帮您检查流程中是否存在循环依赖或死锁风险。需要我逐条分析吗?",
553
+ "建议在流程开始和结束节点使用统一的样式,这样可以让读者更快识别流程的起止点。",
554
+ "这个执行图的逻辑链路比较长,建议在中间添加一些检查点节点,便于流程监控和调试。",
555
+ "我可以帮您生成流程图的文字说明文档,方便团队成员理解流程细节。"
556
+ ];
557
+ function He() {
558
+ return Ve[Math.floor(Math.random() * Ve.length)];
559
+ }
560
+ async function Ue(e, t, n) {
561
+ let r = { "Content-Type": "application/json" };
562
+ e.apiKey && (r.Authorization = `Bearer ${e.apiKey}`);
563
+ let i = await fetch(e.url, {
564
+ method: "POST",
565
+ headers: r,
566
+ body: JSON.stringify({
567
+ model: e.model || "gpt-4o-mini",
568
+ messages: t,
569
+ temperature: e.temperature ?? .7,
570
+ max_tokens: e.maxTokens ?? 4096
571
+ }),
572
+ signal: n
573
+ });
574
+ if (!i.ok) {
575
+ let e = await i.text().catch(() => "");
576
+ throw Error(`AI API error ${i.status}: ${e}`);
577
+ }
578
+ return (await i.json()).choices?.[0]?.message?.content || "";
579
+ }
580
+ function We(e) {
581
+ let t = _(!1), n = null, r = () => {
582
+ let t = typeof e == "function" ? e() : e;
583
+ return !!(t && t.url);
584
+ }, i = () => typeof e == "function" ? e() : e || {};
585
+ return {
586
+ loading: t,
587
+ isAvailable: r,
588
+ chat: async (e, r = []) => {
589
+ let a = i();
590
+ if (!a.url) return He();
591
+ t.value = !0, n && n.abort(), n = new AbortController();
592
+ try {
593
+ return await Ue(a, [
594
+ {
595
+ role: "system",
596
+ content: a.chatPrompt || "你是一个有帮助的AI助手,擅长文档编辑和流程设计。请简洁回答用户问题。"
597
+ },
598
+ ...r.map((e) => ({
599
+ role: e.role === "ai" ? "assistant" : "user",
600
+ content: e.content
601
+ })),
602
+ {
603
+ role: "user",
604
+ content: e
605
+ }
606
+ ], n.signal);
607
+ } catch (e) {
608
+ return e.name === "AbortError" ? "" : (console.warn("[useAiApi] Chat error, falling back to mock:", e), He());
609
+ } finally {
610
+ t.value = !1;
611
+ }
612
+ },
613
+ generate: async (e, r) => {
614
+ let a = i();
615
+ if (!a.url) return {
616
+ success: !1,
617
+ message: "AI生成功能开发中,敬请期待..."
618
+ };
619
+ t.value = !0, n && n.abort(), n = new AbortController();
620
+ try {
621
+ let t = await Ue(a, [{
622
+ role: "system",
623
+ content: a.generatePrompt || `你是一个专业的${r || "流程图"}生成助手。根据用户的描述,生成对应的JSON数据结构。只返回JSON,不要包含其他文字或markdown代码块标记。`
624
+ }, {
625
+ role: "user",
626
+ content: e
627
+ }], n.signal), i = null;
628
+ try {
629
+ let e = t.replace(/^```(?:json)?\s*/i, "").replace(/\s*```$/i, "").trim();
630
+ i = JSON.parse(e);
631
+ } catch {
632
+ i = null;
633
+ }
634
+ return {
635
+ success: !0,
636
+ content: t,
637
+ parsed: i
638
+ };
639
+ } catch (e) {
640
+ return e.name === "AbortError" ? {
641
+ success: !1,
642
+ message: "已取消"
643
+ } : (console.warn("[useAiApi] Generate error:", e), {
644
+ success: !1,
645
+ message: `AI生成失败: ${e.message}`
646
+ });
647
+ } finally {
648
+ t.value = !1;
649
+ }
650
+ },
651
+ abort: () => {
652
+ n &&= (n.abort(), null);
653
+ }
654
+ };
655
+ }
656
+ //#endregion
516
657
  //#region ../../src/composables/useVersionHistory.js
517
- var Re = "/api/document-versions", ze = 5e3, Be = () => {
658
+ var Ge = "/api/document-versions", Ke = 5e3, qe = () => {
518
659
  let e = _([]), t = _(!1);
519
660
  return {
520
661
  versions: e,
@@ -522,13 +663,13 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
522
663
  saveVersion: async ({ documentId: e, docType: t, content: n, userId: r, userName: i }) => {
523
664
  if (!e || !t || !n) return null;
524
665
  try {
525
- let { data: a } = await X.post(Re, {
666
+ let { data: a } = await N.post(Ge, {
526
667
  document_id: e,
527
668
  doc_type: t,
528
669
  content: typeof n == "string" ? n : JSON.stringify(n),
529
670
  user_id: r || null,
530
671
  user_name: i || null
531
- }, { timeout: ze });
672
+ }, { timeout: Ke });
532
673
  return a;
533
674
  } catch (e) {
534
675
  return console.warn("[useVersionHistory] Failed to save version:", e), null;
@@ -538,9 +679,9 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
538
679
  if (!n) return [];
539
680
  t.value = !0;
540
681
  try {
541
- let { data: t } = await X.get(Re, {
682
+ let { data: t } = await N.get(Ge, {
542
683
  params: { document_id: n },
543
- timeout: ze
684
+ timeout: Ke
544
685
  });
545
686
  return e.value = t, t;
546
687
  } catch (t) {
@@ -551,26 +692,26 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
551
692
  },
552
693
  getVersionContent: async (e) => {
553
694
  try {
554
- let { data: t } = await X.get(`${Re}/${e}`, { timeout: ze });
695
+ let { data: t } = await N.get(`${Ge}/${e}`, { timeout: Ke });
555
696
  return t;
556
697
  } catch (e) {
557
698
  return console.warn("[useVersionHistory] Failed to get version content:", e), null;
558
699
  }
559
700
  }
560
701
  };
561
- }, Ve = { class: "version-history-panel" }, He = {
702
+ }, Je = { class: "version-history-panel" }, Ye = {
562
703
  key: 0,
563
704
  class: "loading-state"
564
- }, Ue = {
705
+ }, Xe = {
565
706
  key: 1,
566
707
  class: "empty-state"
567
- }, We = {
708
+ }, Ze = {
568
709
  key: 2,
569
710
  class: "version-list"
570
- }, Ge = {
711
+ }, Qe = {
571
712
  key: 0,
572
713
  class: "current-version"
573
- }, Ke = { class: "current-version-header" }, qe = { class: "version-number" }, Je = ["onClick"], Ye = { class: "version-number" }, Xe = { class: "version-user" }, Ze = { class: "panel-footer" }, Qe = /*#__PURE__*/ Z({
714
+ }, $e = { class: "current-version-header" }, et = { class: "version-number" }, tt = ["onClick"], nt = { class: "version-number" }, rt = { class: "version-user" }, it = { class: "panel-footer" }, at = /*#__PURE__*/ Q({
574
715
  __name: "VersionHistoryPanel",
575
716
  props: {
576
717
  modelValue: {
@@ -584,7 +725,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
584
725
  },
585
726
  emits: ["update:modelValue", "apply"],
586
727
  setup(t, { expose: c, emit: l }) {
587
- let u = t, f = l, { versions: p, loading: m, loadVersions: h, getVersionContent: S } = Be(), T = _(!1), E = _(null), D = _(!1), O = _(null);
728
+ let u = t, f = l, { versions: p, loading: m, loadVersions: h, getVersionContent: S } = qe(), T = _(!1), E = _(null), D = _(!1), O = _(null);
588
729
  C(() => u.modelValue, (e) => {
589
730
  T.value = e, e && u.documentId && (E.value = null, h(u.documentId).then((e) => {
590
731
  e && e.length > 0 && (O.value = e[0]);
@@ -621,7 +762,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
621
762
  size: "420px",
622
763
  "before-close": M
623
764
  }, {
624
- footer: w(() => [a("div", Ze, [s(_, {
765
+ footer: w(() => [a("div", it, [s(_, {
625
766
  type: "primary",
626
767
  disabled: !E.value,
627
768
  loading: D.value,
@@ -630,22 +771,22 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
630
771
  default: w(() => [...c[4] ||= [o(" 切换到此版本 ", -1)]]),
631
772
  _: 1
632
773
  }, 8, ["disabled", "loading"])])]),
633
- default: w(() => [a("div", Ve, [x(m) ? (g(), i("div", He, [s(l, { class: "is-loading" }, {
634
- default: w(() => [s(x(ne))]),
774
+ default: w(() => [a("div", Je, [x(m) ? (g(), i("div", Ye, [s(l, { class: "is-loading" }, {
775
+ default: w(() => [s(x(Y))]),
635
776
  _: 1
636
- }), c[1] ||= a("span", null, "加载中...", -1)])) : x(p).length === 0 ? (g(), i("div", Ue, [s(l, {
777
+ }), c[1] ||= a("span", null, "加载中...", -1)])) : x(p).length === 0 ? (g(), i("div", Xe, [s(l, {
637
778
  size: 48,
638
779
  color: "#c0c4cc"
639
780
  }, {
640
- default: w(() => [s(x(R))]),
781
+ default: w(() => [s(x(z))]),
641
782
  _: 1
642
- }), c[2] ||= a("p", null, "暂无历史版本", -1)])) : (g(), i("div", We, [O.value ? (g(), i("div", Ge, [a("div", Ke, [s(u, {
783
+ }), c[2] ||= a("p", null, "暂无历史版本", -1)])) : (g(), i("div", Ze, [O.value ? (g(), i("div", Qe, [a("div", $e, [s(u, {
643
784
  type: "success",
644
785
  size: "small"
645
786
  }, {
646
787
  default: w(() => [...c[3] ||= [o("当前版本", -1)]]),
647
788
  _: 1
648
- }), a("span", qe, "v" + b(O.value.version_number), 1)])])) : r("", !0), s(h, null, {
789
+ }), a("span", et, "v" + b(O.value.version_number), 1)])])) : r("", !0), s(h, null, {
649
790
  default: w(() => [(g(!0), i(e, null, v(x(p), (e) => (g(), n(f, {
650
791
  key: e.id,
651
792
  timestamp: N(e.created_at),
@@ -656,7 +797,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
656
797
  default: w(() => [a("div", {
657
798
  class: d(["version-item", { active: E.value?.id === e.id }]),
658
799
  onClick: (t) => k(e)
659
- }, [a("span", Ye, "版本号:v" + b(e.version_number), 1), a("span", Xe, "提交人:" + b(e.user_name || "未知用户"), 1)], 10, Je)]),
800
+ }, [a("span", nt, "版本号:v" + b(e.version_number), 1), a("span", rt, "提交人:" + b(e.user_name || "未知用户"), 1)], 10, tt)]),
660
801
  _: 2
661
802
  }, 1032, [
662
803
  "timestamp",
@@ -669,7 +810,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
669
810
  }, 8, ["modelValue"]);
670
811
  };
671
812
  }
672
- }, [["__scopeId", "data-v-87924b7c"]]), $e = [
813
+ }, [["__scopeId", "data-v-87924b7c"]]), ot = [
673
814
  {
674
815
  label: "默认",
675
816
  value: "default",
@@ -1207,13 +1348,13 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1207
1348
  node: { color: "#333" }
1208
1349
  }
1209
1350
  }
1210
- ], et = { class: "toolbar-left" }, tt = { class: "toolbar-center" }, nt = { class: "option-list" }, rt = ["onClick"], it = { class: "theme-picker" }, at = { class: "theme-header" }, ot = { class: "theme-count" }, st = { class: "theme-grid" }, ct = ["onClick", "title"], lt = { class: "theme-name" }, ut = { class: "zoom-value" }, dt = { class: "toolbar-right" }, ft = {
1351
+ ], st = { class: "toolbar-left" }, ct = { class: "toolbar-center" }, lt = { class: "option-list" }, ut = ["onClick"], dt = { class: "theme-picker" }, ft = { class: "theme-header" }, pt = { class: "theme-count" }, mt = { class: "theme-grid" }, ht = ["onClick", "title"], gt = { class: "theme-name" }, _t = { class: "zoom-value" }, vt = { class: "toolbar-right" }, yt = {
1211
1352
  key: 0,
1212
1353
  class: "collab-users"
1213
- }, pt = ["title"], mt = {
1354
+ }, bt = ["title"], xt = {
1214
1355
  key: 0,
1215
1356
  class: "collab-more"
1216
- }, ht = /*#__PURE__*/ Z({
1357
+ }, St = /*#__PURE__*/ Q({
1217
1358
  __name: "MindMapToolbar",
1218
1359
  props: {
1219
1360
  undoCount: {
@@ -1267,6 +1408,18 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1267
1408
  showHistory: {
1268
1409
  type: Boolean,
1269
1410
  default: !1
1411
+ },
1412
+ backButton: {
1413
+ type: String,
1414
+ default: "show"
1415
+ },
1416
+ titleEditable: {
1417
+ type: Boolean,
1418
+ default: !0
1419
+ },
1420
+ authorEditable: {
1421
+ type: Boolean,
1422
+ default: !0
1270
1423
  }
1271
1424
  },
1272
1425
  emits: [
@@ -1353,26 +1506,28 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1353
1506
  label: "鱼骨图2",
1354
1507
  value: "fishbone2"
1355
1508
  }
1356
- ], k = $e;
1509
+ ], k = ot;
1357
1510
  return (c, u) => {
1358
- let p = y("el-icon"), _ = y("el-button"), C = y("el-input"), A = y("el-divider"), j = y("el-popover"), M = y("el-dropdown-item"), F = y("el-dropdown-menu"), R = y("el-dropdown"), z = y("Clock"), U = y("el-dialog");
1511
+ let p = y("el-icon"), _ = y("el-button"), C = y("el-input"), A = y("el-divider"), j = y("el-popover"), M = y("el-dropdown-item"), N = y("el-dropdown-menu"), I = y("el-dropdown"), z = y("Clock"), B = y("el-dialog");
1359
1512
  return g(), i(e, null, [a("div", {
1360
1513
  class: "mindmap-toolbar",
1361
1514
  onMousedown: l
1362
1515
  }, [
1363
- a("div", et, [
1364
- s(_, {
1516
+ a("div", st, [
1517
+ t.backButton === "hide" ? r("", !0) : (g(), n(_, {
1518
+ key: 0,
1365
1519
  size: "small",
1366
1520
  circle: "",
1521
+ disabled: t.backButton === "disable",
1367
1522
  onClick: u[0] ||= (e) => c.$emit("back"),
1368
1523
  title: "返回"
1369
1524
  }, {
1370
1525
  default: w(() => [s(p, null, {
1371
- default: w(() => [s(x(P))]),
1526
+ default: w(() => [s(x(F))]),
1372
1527
  _: 1
1373
1528
  })]),
1374
1529
  _: 1
1375
- }),
1530
+ }, 8, ["disabled"])),
1376
1531
  s(C, {
1377
1532
  modelValue: m.value,
1378
1533
  "onUpdate:modelValue": u[1] ||= (e) => m.value = e,
@@ -1380,7 +1535,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1380
1535
  placeholder: "思维导图标题 *",
1381
1536
  size: "small",
1382
1537
  style: { width: "200px" },
1383
- disabled: t.isCollaborating && !t.isCollabOwner,
1538
+ disabled: t.isCollaborating && !t.isCollabOwner || !t.titleEditable,
1384
1539
  required: ""
1385
1540
  }, null, 8, ["modelValue", "disabled"]),
1386
1541
  s(C, {
@@ -1390,10 +1545,11 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1390
1545
  placeholder: "作者 *",
1391
1546
  size: "small",
1392
1547
  style: { width: "120px" },
1548
+ disabled: !t.authorEditable,
1393
1549
  required: ""
1394
- }, null, 8, ["modelValue"])
1550
+ }, null, 8, ["modelValue", "disabled"])
1395
1551
  ]),
1396
- a("div", tt, [
1552
+ a("div", ct, [
1397
1553
  s(_, {
1398
1554
  size: "small",
1399
1555
  circle: "",
@@ -1402,7 +1558,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1402
1558
  title: "撤销"
1403
1559
  }, {
1404
1560
  default: w(() => [s(p, null, {
1405
- default: w(() => [s(x(se))]),
1561
+ default: w(() => [s(x(ae))]),
1406
1562
  _: 1
1407
1563
  })]),
1408
1564
  _: 1
@@ -1415,7 +1571,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1415
1571
  title: "重做"
1416
1572
  }, {
1417
1573
  default: w(() => [s(p, null, {
1418
- default: w(() => [s(x(ce))]),
1574
+ default: w(() => [s(x(oe))]),
1419
1575
  _: 1
1420
1576
  })]),
1421
1577
  _: 1
@@ -1444,7 +1600,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1444
1600
  title: "插入子节点"
1445
1601
  }, {
1446
1602
  default: w(() => [s(p, null, {
1447
- default: w(() => [s(x(ie))]),
1603
+ default: w(() => [s(x(Z))]),
1448
1604
  _: 1
1449
1605
  })]),
1450
1606
  _: 1
@@ -1457,7 +1613,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1457
1613
  disabled: t.isRootNode
1458
1614
  }, {
1459
1615
  default: w(() => [s(p, null, {
1460
- default: w(() => [s(x(B))]),
1616
+ default: w(() => [s(x(V))]),
1461
1617
  _: 1
1462
1618
  })]),
1463
1619
  _: 1
@@ -1470,7 +1626,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1470
1626
  disabled: t.isCollaborating && !t.isCollabOwner
1471
1627
  }, {
1472
1628
  default: w(() => [s(p, null, {
1473
- default: w(() => [s(x(ue))]),
1629
+ default: w(() => [s(x(le))]),
1474
1630
  _: 1
1475
1631
  })]),
1476
1632
  _: 1
@@ -1482,7 +1638,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1482
1638
  title: "删除节点"
1483
1639
  }, {
1484
1640
  default: w(() => [s(p, null, {
1485
- default: w(() => [s(x(V))]),
1641
+ default: w(() => [s(x(H))]),
1486
1642
  _: 1
1487
1643
  })]),
1488
1644
  _: 1
@@ -1500,16 +1656,16 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1500
1656
  disabled: t.isCollaborating && !t.isCollabOwner
1501
1657
  }, {
1502
1658
  default: w(() => [s(p, null, {
1503
- default: w(() => [s(x(q))]),
1659
+ default: w(() => [s(x(ee))]),
1504
1660
  _: 1
1505
1661
  })]),
1506
1662
  _: 1
1507
1663
  }, 8, ["disabled"])]),
1508
- default: w(() => [a("div", nt, [(g(), i(e, null, v(O, (e) => a("div", {
1664
+ default: w(() => [a("div", lt, [(g(), i(e, null, v(O, (e) => a("div", {
1509
1665
  key: e.value,
1510
1666
  class: d(["option-item", { active: t.currentLayout === e.value }]),
1511
1667
  onClick: (t) => c.$emit("change-layout", e.value)
1512
- }, b(e.label), 11, rt)), 64))])]),
1668
+ }, b(e.label), 11, ut)), 64))])]),
1513
1669
  _: 1
1514
1670
  }),
1515
1671
  s(j, {
@@ -1524,12 +1680,12 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1524
1680
  disabled: t.isCollaborating && !t.isCollabOwner
1525
1681
  }, {
1526
1682
  default: w(() => [s(p, null, {
1527
- default: w(() => [s(x(I))]),
1683
+ default: w(() => [s(x(L))]),
1528
1684
  _: 1
1529
1685
  })]),
1530
1686
  _: 1
1531
1687
  }, 8, ["disabled"])]),
1532
- default: w(() => [a("div", it, [a("div", at, [u[25] ||= a("h4", null, "选择主题", -1), a("span", ot, b(x(k).length) + " 种配色", 1)]), a("div", st, [(g(!0), i(e, null, v(x(k), (e) => (g(), i("div", {
1688
+ default: w(() => [a("div", dt, [a("div", ft, [u[25] ||= a("h4", null, "选择主题", -1), a("span", pt, b(x(k).length) + " 种配色", 1)]), a("div", mt, [(g(!0), i(e, null, v(x(k), (e) => (g(), i("div", {
1533
1689
  key: e.value,
1534
1690
  class: d(["theme-item", { active: t.currentTheme === e.value }]),
1535
1691
  onClick: (t) => c.$emit("change-theme", e.value),
@@ -1541,7 +1697,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1541
1697
  }, [a("div", {
1542
1698
  class: "theme-line",
1543
1699
  style: f({ background: e.config?.root?.fillColor || "#549688" })
1544
- }, null, 4)], 4), a("span", lt, b(e.label), 1)], 42, ct))), 128))])])]),
1700
+ }, null, 4)], 4), a("span", gt, b(e.label), 1)], 42, ht))), 128))])])]),
1545
1701
  _: 1
1546
1702
  }),
1547
1703
  s(A, { direction: "vertical" }),
@@ -1552,12 +1708,12 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1552
1708
  title: "放大"
1553
1709
  }, {
1554
1710
  default: w(() => [s(p, null, {
1555
- default: w(() => [s(x(de))]),
1711
+ default: w(() => [s(x(ue))]),
1556
1712
  _: 1
1557
1713
  })]),
1558
1714
  _: 1
1559
1715
  }),
1560
- a("span", ut, b(t.zoomPercent) + "%", 1),
1716
+ a("span", _t, b(t.zoomPercent) + "%", 1),
1561
1717
  s(_, {
1562
1718
  size: "small",
1563
1719
  circle: "",
@@ -1565,7 +1721,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1565
1721
  title: "缩小"
1566
1722
  }, {
1567
1723
  default: w(() => [s(p, null, {
1568
- default: w(() => [s(x(fe))]),
1724
+ default: w(() => [s(x(de))]),
1569
1725
  _: 1
1570
1726
  })]),
1571
1727
  _: 1
@@ -1577,7 +1733,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1577
1733
  title: "适应画布"
1578
1734
  }, {
1579
1735
  default: w(() => [s(p, null, {
1580
- default: w(() => [s(x(K))]),
1736
+ default: w(() => [s(x(q))]),
1581
1737
  _: 1
1582
1738
  })]),
1583
1739
  _: 1
@@ -1590,7 +1746,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1590
1746
  title: "自动适应画布"
1591
1747
  }, {
1592
1748
  default: w(() => [s(p, null, {
1593
- default: w(() => [s(x(N))]),
1749
+ default: w(() => [s(x(P))]),
1594
1750
  _: 1
1595
1751
  })]),
1596
1752
  _: 1
@@ -1603,19 +1759,19 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1603
1759
  disabled: t.isCollaborating && !t.isCollabOwner
1604
1760
  }, {
1605
1761
  default: w(() => [s(p, null, {
1606
- default: w(() => [s(x(oe))]),
1762
+ default: w(() => [s(x(ie))]),
1607
1763
  _: 1
1608
1764
  })]),
1609
1765
  _: 1
1610
1766
  }, 8, ["disabled"])
1611
1767
  ]),
1612
- a("div", dt, [
1613
- t.collabUsers.length > 0 ? (g(), i("div", ft, [(g(!0), i(e, null, v(t.collabUsers.slice(0, 5), (e) => (g(), i("div", {
1768
+ a("div", vt, [
1769
+ t.collabUsers.length > 0 ? (g(), i("div", yt, [(g(!0), i(e, null, v(t.collabUsers.slice(0, 5), (e) => (g(), i("div", {
1614
1770
  key: e.clientId,
1615
1771
  class: "collab-avatar",
1616
1772
  style: f({ background: e.color }),
1617
1773
  title: e.name
1618
- }, b(e.name?.charAt(0)), 13, pt))), 128)), t.collabUsers.length > 5 ? (g(), i("span", mt, "+" + b(t.collabUsers.length - 5), 1)) : r("", !0)])) : r("", !0),
1774
+ }, b(e.name?.charAt(0)), 13, bt))), 128)), t.collabUsers.length > 5 ? (g(), i("span", xt, "+" + b(t.collabUsers.length - 5), 1)) : r("", !0)])) : r("", !0),
1619
1775
  !t.isCollaborating || t.isCollabOwner ? (g(), n(_, {
1620
1776
  key: 1,
1621
1777
  size: "small",
@@ -1624,7 +1780,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1624
1780
  title: "协作"
1625
1781
  }, {
1626
1782
  default: w(() => [s(p, null, {
1627
- default: w(() => [s(x(le))]),
1783
+ default: w(() => [s(x(ce))]),
1628
1784
  _: 1
1629
1785
  }), a("span", null, b(t.isCollaborating ? "协作中" : "协作"), 1)]),
1630
1786
  _: 1
@@ -1637,34 +1793,34 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1637
1793
  title: "分享链接"
1638
1794
  }, {
1639
1795
  default: w(() => [s(p, null, {
1640
- default: w(() => [s(x(te))]),
1796
+ default: w(() => [s(x(J))]),
1641
1797
  _: 1
1642
1798
  })]),
1643
1799
  _: 1
1644
1800
  })) : r("", !0),
1645
- s(R, {
1801
+ s(I, {
1646
1802
  trigger: "click",
1647
1803
  onCommand: u[18] ||= (e) => c.$emit("export", e)
1648
1804
  }, {
1649
- dropdown: w(() => [s(F, null, {
1805
+ dropdown: w(() => [s(N, null, {
1650
1806
  default: w(() => [
1651
1807
  s(M, { command: "png" }, {
1652
1808
  default: w(() => [s(p, null, {
1653
- default: w(() => [s(x(re))]),
1809
+ default: w(() => [s(x(ne))]),
1654
1810
  _: 1
1655
1811
  }), u[27] ||= o("导出 PNG ", -1)]),
1656
1812
  _: 1
1657
1813
  }),
1658
1814
  s(M, { command: "svg" }, {
1659
1815
  default: w(() => [s(p, null, {
1660
- default: w(() => [s(x(H))]),
1816
+ default: w(() => [s(x(U))]),
1661
1817
  _: 1
1662
1818
  }), u[28] ||= o("导出 SVG ", -1)]),
1663
1819
  _: 1
1664
1820
  }),
1665
1821
  s(M, { command: "pdf" }, {
1666
1822
  default: w(() => [s(p, null, {
1667
- default: w(() => [s(x(H))]),
1823
+ default: w(() => [s(x(U))]),
1668
1824
  _: 1
1669
1825
  }), u[29] ||= o("导出 PDF ", -1)]),
1670
1826
  _: 1
@@ -1677,7 +1833,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1677
1833
  type: "warning"
1678
1834
  }, {
1679
1835
  default: w(() => [s(p, null, {
1680
- default: w(() => [s(x(W))]),
1836
+ default: w(() => [s(x(G))]),
1681
1837
  _: 1
1682
1838
  }), u[26] ||= a("span", null, "导出", -1)]),
1683
1839
  _: 1
@@ -1690,7 +1846,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1690
1846
  type: "primary"
1691
1847
  }, {
1692
1848
  default: w(() => [s(p, null, {
1693
- default: w(() => [s(x(L))]),
1849
+ default: w(() => [s(x(R))]),
1694
1850
  _: 1
1695
1851
  }), u[30] ||= a("span", null, "保存", -1)]),
1696
1852
  _: 1
@@ -1709,7 +1865,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1709
1865
  _: 1
1710
1866
  })) : r("", !0)
1711
1867
  ])
1712
- ], 32), s(U, {
1868
+ ], 32), s(B, {
1713
1869
  modelValue: S.value,
1714
1870
  "onUpdate:modelValue": u[23] ||= (e) => S.value = e,
1715
1871
  title: "AI生成思维导图",
@@ -1743,13 +1899,13 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1743
1899
  }, 8, ["modelValue"])], 64);
1744
1900
  };
1745
1901
  }
1746
- }, [["__scopeId", "data-v-47a9ddfc"]]), gt = { class: "mindmap-property-panel" }, _t = { class: "panel-header" }, vt = {
1902
+ }, [["__scopeId", "data-v-695aef34"]]), Ct = { class: "mindmap-property-panel" }, wt = { class: "panel-header" }, Tt = {
1747
1903
  key: 0,
1748
1904
  class: "panel-content"
1749
- }, yt = { class: "section" }, bt = { class: "section" }, xt = { class: "setting-row" }, St = { class: "setting-row" }, Ct = { class: "setting-row" }, wt = { class: "setting-row" }, Tt = { class: "setting-row" }, Et = { class: "section" }, Dt = { class: "section" }, Ot = { class: "tags-list" }, kt = { class: "tag-input-row" }, At = { class: "section" }, jt = {
1905
+ }, Et = { class: "section" }, Dt = { class: "section" }, Ot = { class: "setting-row" }, kt = { class: "setting-row" }, At = { class: "setting-row" }, jt = { class: "setting-row" }, Mt = { class: "setting-row" }, Nt = { class: "section" }, Pt = { class: "section" }, Ft = { class: "tags-list" }, It = { class: "tag-input-row" }, Lt = { class: "section" }, Rt = {
1750
1906
  key: 1,
1751
1907
  class: "panel-empty"
1752
- }, Mt = /*#__PURE__*/ Z({
1908
+ }, zt = /*#__PURE__*/ Q({
1753
1909
  __name: "MindMapPropertyPanel",
1754
1910
  props: {
1755
1911
  visible: {
@@ -1795,28 +1951,28 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1795
1951
  O.value.splice(e, 1), l("update-tags", [...O.value]);
1796
1952
  };
1797
1953
  return (r, c) => {
1798
- let l = y("el-icon"), _ = y("el-button"), C = y("el-input"), R = y("el-slider"), B = y("el-color-picker"), V = y("el-option"), H = y("el-select"), U = y("el-tag");
1799
- return T((g(), i("div", gt, [a("div", _t, [c[16] ||= a("span", { class: "header-label" }, "属性", -1), s(_, {
1954
+ let l = y("el-icon"), _ = y("el-button"), C = y("el-input"), R = y("el-slider"), z = y("el-color-picker"), V = y("el-option"), H = y("el-select"), U = y("el-tag");
1955
+ return T((g(), i("div", Ct, [a("div", wt, [c[16] ||= a("span", { class: "header-label" }, "属性", -1), s(_, {
1800
1956
  size: "small",
1801
1957
  circle: "",
1802
1958
  onClick: c[0] ||= (e) => r.$emit("close")
1803
1959
  }, {
1804
1960
  default: w(() => [s(l, null, {
1805
- default: w(() => [s(x(z))]),
1961
+ default: w(() => [s(x(B))]),
1806
1962
  _: 1
1807
1963
  })]),
1808
1964
  _: 1
1809
- })]), t.node ? (g(), i("div", vt, [
1810
- a("div", yt, [c[17] ||= a("div", { class: "section-title" }, "节点文本", -1), s(C, {
1965
+ })]), t.node ? (g(), i("div", Tt, [
1966
+ a("div", Et, [c[17] ||= a("div", { class: "section-title" }, "节点文本", -1), s(C, {
1811
1967
  modelValue: u.value,
1812
1968
  "onUpdate:modelValue": c[1] ||= (e) => u.value = e,
1813
1969
  size: "small",
1814
1970
  onChange: M,
1815
1971
  placeholder: "输入节点文本"
1816
1972
  }, null, 8, ["modelValue"])]),
1817
- a("div", bt, [
1973
+ a("div", Dt, [
1818
1974
  c[23] ||= a("div", { class: "section-title" }, "样式", -1),
1819
- a("div", xt, [c[18] ||= a("label", null, "字体大小", -1), s(R, {
1975
+ a("div", Ot, [c[18] ||= a("label", null, "字体大小", -1), s(R, {
1820
1976
  modelValue: d.value,
1821
1977
  "onUpdate:modelValue": c[2] ||= (e) => d.value = e,
1822
1978
  min: 12,
@@ -1825,25 +1981,25 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1825
1981
  onChange: c[3] ||= (e) => N("fontSize", e + "px"),
1826
1982
  style: { width: "140px" }
1827
1983
  }, null, 8, ["modelValue"])]),
1828
- a("div", St, [c[19] ||= a("label", null, "字体颜色", -1), s(B, {
1984
+ a("div", kt, [c[19] ||= a("label", null, "字体颜色", -1), s(z, {
1829
1985
  modelValue: f.value,
1830
1986
  "onUpdate:modelValue": c[4] ||= (e) => f.value = e,
1831
1987
  onChange: c[5] ||= (e) => N("color", e),
1832
1988
  size: "small"
1833
1989
  }, null, 8, ["modelValue"])]),
1834
- a("div", Ct, [c[20] ||= a("label", null, "背景色", -1), s(B, {
1990
+ a("div", At, [c[20] ||= a("label", null, "背景色", -1), s(z, {
1835
1991
  modelValue: p.value,
1836
1992
  "onUpdate:modelValue": c[6] ||= (e) => p.value = e,
1837
1993
  onChange: c[7] ||= (e) => N("background", e),
1838
1994
  size: "small"
1839
1995
  }, null, 8, ["modelValue"])]),
1840
- a("div", wt, [c[21] ||= a("label", null, "边框色", -1), s(B, {
1996
+ a("div", jt, [c[21] ||= a("label", null, "边框色", -1), s(z, {
1841
1997
  modelValue: m.value,
1842
1998
  "onUpdate:modelValue": c[8] ||= (e) => m.value = e,
1843
1999
  onChange: c[9] ||= (e) => N("borderColor", e),
1844
2000
  size: "small"
1845
2001
  }, null, 8, ["modelValue"])]),
1846
- a("div", Tt, [c[22] ||= a("label", null, "形状", -1), s(H, {
2002
+ a("div", Mt, [c[22] ||= a("label", null, "形状", -1), s(H, {
1847
2003
  modelValue: h.value,
1848
2004
  "onUpdate:modelValue": c[10] ||= (e) => h.value = e,
1849
2005
  size: "small",
@@ -1866,7 +2022,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1866
2022
  _: 1
1867
2023
  }, 8, ["modelValue"])])
1868
2024
  ]),
1869
- a("div", Et, [c[24] ||= a("div", { class: "section-title" }, "备注", -1), s(C, {
2025
+ a("div", Nt, [c[24] ||= a("div", { class: "section-title" }, "备注", -1), s(C, {
1870
2026
  modelValue: D.value,
1871
2027
  "onUpdate:modelValue": c[12] ||= (e) => D.value = e,
1872
2028
  type: "textarea",
@@ -1875,9 +2031,9 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1875
2031
  onChange: P,
1876
2032
  placeholder: "添加备注..."
1877
2033
  }, null, 8, ["modelValue"])]),
1878
- a("div", Dt, [
2034
+ a("div", Pt, [
1879
2035
  c[26] ||= a("div", { class: "section-title" }, "标签", -1),
1880
- a("div", Ot, [(g(!0), i(e, null, v(O.value, (e, t) => (g(), n(U, {
2036
+ a("div", Ft, [(g(!0), i(e, null, v(O.value, (e, t) => (g(), n(U, {
1881
2037
  key: t,
1882
2038
  closable: "",
1883
2039
  size: "small",
@@ -1886,7 +2042,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1886
2042
  default: w(() => [o(b(e.text || e), 1)]),
1887
2043
  _: 2
1888
2044
  }, 1032, ["onClose"]))), 128))]),
1889
- a("div", kt, [s(C, {
2045
+ a("div", It, [s(C, {
1890
2046
  modelValue: k.value,
1891
2047
  "onUpdate:modelValue": c[13] ||= (e) => k.value = e,
1892
2048
  size: "small",
@@ -1902,7 +2058,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1902
2058
  _: 1
1903
2059
  }, 8, ["disabled"])])
1904
2060
  ]),
1905
- a("div", At, [
2061
+ a("div", Lt, [
1906
2062
  c[27] ||= a("div", { class: "section-title" }, "超链接", -1),
1907
2063
  s(C, {
1908
2064
  modelValue: A.value,
@@ -1920,16 +2076,16 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1920
2076
  style: { "margin-top": "6px" }
1921
2077
  }, null, 8, ["modelValue"])
1922
2078
  ])
1923
- ])) : (g(), i("div", jt, [s(l, {
2079
+ ])) : (g(), i("div", Rt, [s(l, {
1924
2080
  size: 32,
1925
2081
  color: "#c0c4cc"
1926
2082
  }, {
1927
- default: w(() => [s(x(ee))]),
2083
+ default: w(() => [s(x(te))]),
1928
2084
  _: 1
1929
2085
  }), c[28] ||= a("p", null, "点击节点编辑属性", -1)]))], 512)), [[S, t.visible]]);
1930
2086
  };
1931
2087
  }
1932
- }, [["__scopeId", "data-v-c06f1443"]]), Nt = /*#__PURE__*/ Z({
2088
+ }, [["__scopeId", "data-v-c06f1443"]]), Bt = /*#__PURE__*/ Q({
1933
2089
  __name: "MindMapContextMenu",
1934
2090
  props: {
1935
2091
  visible: {
@@ -1963,14 +2119,14 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1963
2119
  class: "menu-item",
1964
2120
  onClick: n[0] ||= (e) => r("insertChild")
1965
2121
  }, [s(c, null, {
1966
- default: w(() => [s(x(ie))]),
2122
+ default: w(() => [s(x(Z))]),
1967
2123
  _: 1
1968
2124
  }), n[7] ||= o("插入子节点 ", -1)]),
1969
2125
  a("div", {
1970
2126
  class: "menu-item",
1971
2127
  onClick: n[1] ||= (e) => r("insertSibling")
1972
2128
  }, [s(c, null, {
1973
- default: w(() => [s(x(B))]),
2129
+ default: w(() => [s(x(V))]),
1974
2130
  _: 1
1975
2131
  }), n[8] ||= o("插入同级节点 ", -1)]),
1976
2132
  n[14] ||= a("div", { class: "menu-divider" }, null, -1),
@@ -1978,14 +2134,14 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1978
2134
  class: "menu-item",
1979
2135
  onClick: n[2] ||= (e) => r("edit")
1980
2136
  }, [s(c, null, {
1981
- default: w(() => [s(x(G))]),
2137
+ default: w(() => [s(x(K))]),
1982
2138
  _: 1
1983
2139
  }), n[9] ||= o("编辑文本 ", -1)]),
1984
2140
  a("div", {
1985
2141
  class: "menu-item",
1986
2142
  onClick: n[3] ||= (e) => r("delete")
1987
2143
  }, [s(c, null, {
1988
- default: w(() => [s(x(V))]),
2144
+ default: w(() => [s(x(H))]),
1989
2145
  _: 1
1990
2146
  }), n[10] ||= o("删除节点 ", -1)]),
1991
2147
  n[15] ||= a("div", { class: "menu-divider" }, null, -1),
@@ -1993,27 +2149,27 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
1993
2149
  class: "menu-item",
1994
2150
  onClick: n[4] ||= (e) => r("copy")
1995
2151
  }, [s(c, null, {
1996
- default: w(() => [s(x(H))]),
2152
+ default: w(() => [s(x(U))]),
1997
2153
  _: 1
1998
2154
  }), n[11] ||= o("复制 ", -1)]),
1999
2155
  a("div", {
2000
2156
  class: "menu-item",
2001
2157
  onClick: n[5] ||= (e) => r("cut")
2002
2158
  }, [s(c, null, {
2003
- default: w(() => [s(x(Y))]),
2159
+ default: w(() => [s(x(se))]),
2004
2160
  _: 1
2005
2161
  }), n[12] ||= o("剪切 ", -1)]),
2006
2162
  a("div", {
2007
2163
  class: "menu-item",
2008
2164
  onClick: n[6] ||= (e) => r("paste")
2009
2165
  }, [s(c, null, {
2010
- default: w(() => [s(x(U))]),
2166
+ default: w(() => [s(x(W))]),
2011
2167
  _: 1
2012
2168
  }), n[13] ||= o("粘贴 ", -1)])
2013
2169
  ], 4)), [[S, e.visible]]);
2014
2170
  };
2015
2171
  }
2016
- }, [["__scopeId", "data-v-0ca9bee8"]]), Pt = { class: "export-options" }, Ft = /*#__PURE__*/ Z({
2172
+ }, [["__scopeId", "data-v-0ca9bee8"]]), Vt = { class: "export-options" }, Ht = /*#__PURE__*/ Q({
2017
2173
  __name: "MindMapExportDialog",
2018
2174
  props: { visible: {
2019
2175
  type: Boolean,
@@ -2037,7 +2193,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2037
2193
  default: w(() => [...r[9] ||= [o("取消", -1)]]),
2038
2194
  _: 1
2039
2195
  })]),
2040
- default: w(() => [a("div", Pt, [
2196
+ default: w(() => [a("div", Vt, [
2041
2197
  a("div", {
2042
2198
  class: "export-item",
2043
2199
  onClick: r[0] ||= (e) => i("png")
@@ -2045,7 +2201,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2045
2201
  size: 32,
2046
2202
  color: "#409eff"
2047
2203
  }, {
2048
- default: w(() => [s(x(re))]),
2204
+ default: w(() => [s(x(ne))]),
2049
2205
  _: 1
2050
2206
  }), r[6] ||= a("div", { class: "export-info" }, [a("div", { class: "export-name" }, "PNG 图片"), a("div", { class: "export-desc" }, "高清位图,适合分享和预览")], -1)]),
2051
2207
  a("div", {
@@ -2055,7 +2211,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2055
2211
  size: 32,
2056
2212
  color: "#67c23a"
2057
2213
  }, {
2058
- default: w(() => [s(x(H))]),
2214
+ default: w(() => [s(x(U))]),
2059
2215
  _: 1
2060
2216
  }), r[7] ||= a("div", { class: "export-info" }, [a("div", { class: "export-name" }, "SVG 矢量图"), a("div", { class: "export-desc" }, "无损缩放,适合印刷和编辑")], -1)]),
2061
2217
  a("div", {
@@ -2065,7 +2221,7 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2065
2221
  size: 32,
2066
2222
  color: "#f56c6c"
2067
2223
  }, {
2068
- default: w(() => [s(x(H))]),
2224
+ default: w(() => [s(x(U))]),
2069
2225
  _: 1
2070
2226
  }), r[8] ||= a("div", { class: "export-info" }, [a("div", { class: "export-name" }, "PDF 文档"), a("div", { class: "export-desc" }, "通用格式,适合打印和归档")], -1)])
2071
2227
  ])]),
@@ -2073,46 +2229,46 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2073
2229
  }, 8, ["model-value"]);
2074
2230
  };
2075
2231
  }
2076
- }, [["__scopeId", "data-v-c9798127"]]), It = (e) => {
2077
- let t = new pe.Doc(), n = _(!1), r = _([]), i = _(""), a = _(!1), o = !1, s = null;
2078
- t.getXmlFragment("default");
2079
- let c = `ws://${window.location.hostname || "localhost"}:1234`, l = null, u = new me({
2080
- url: c,
2232
+ }, [["__scopeId", "data-v-c9798127"]]), Ut = (e, t = {}) => {
2233
+ let n = new fe.Doc(), r = _(!1), i = _([]), a = _(""), o = _(!1), s = !1, c = null;
2234
+ n.getXmlFragment("default");
2235
+ let l = window.location.hostname || "localhost", u = t.wsUrl || `ws://${l}:1234`, d = null, f = new pe({
2236
+ url: u,
2081
2237
  name: e,
2082
- document: t,
2238
+ document: n,
2083
2239
  connect: !1,
2084
2240
  reconnect: !0,
2085
2241
  onClose: () => {
2086
- n.value = !1, f();
2242
+ r.value = !1, m();
2087
2243
  },
2088
2244
  onConnect: () => {
2089
- n.value = !0, d();
2245
+ r.value = !0, p();
2090
2246
  }
2091
- }), d = () => {
2092
- f(), l = setInterval(() => {
2093
- if (u.connection && u.connection.ws) try {
2094
- u.connection.ws.send(JSON.stringify({ type: "ping" }));
2247
+ }), p = () => {
2248
+ m(), d = setInterval(() => {
2249
+ if (f.connection && f.connection.ws) try {
2250
+ f.connection.ws.send(JSON.stringify({ type: "ping" }));
2095
2251
  } catch {}
2096
2252
  }, 3e4);
2097
- }, f = () => {
2098
- l &&= (clearInterval(l), null);
2099
- }, p = t.getMap("mindmap");
2100
- t.getMap("meta"), u.awareness.on("change", () => {
2101
- r.value = Array.from(u.awareness.getStates().entries()).filter(([e, t]) => t.user).map(([e, t]) => ({
2253
+ }, m = () => {
2254
+ d &&= (clearInterval(d), null);
2255
+ }, h = n.getMap("mindmap");
2256
+ n.getMap("meta"), f.awareness.on("change", () => {
2257
+ i.value = Array.from(f.awareness.getStates().entries()).filter(([e, t]) => t.user).map(([e, t]) => ({
2102
2258
  clientId: e,
2103
2259
  ...t.user
2104
2260
  }));
2105
- }), p.observe((e) => {
2106
- e.keysChanged.has("_closed") && (a.value = p.get("_closed") === !0);
2261
+ }), h.observe((e) => {
2262
+ e.keysChanged.has("_closed") && (o.value = h.get("_closed") === !0);
2107
2263
  });
2108
- let m = (e) => {
2109
- u.awareness.setLocalStateField("user", {
2264
+ let g = (e) => {
2265
+ f.awareness.setLocalStateField("user", {
2110
2266
  id: e.id || `user-${Date.now()}`,
2111
2267
  name: e.name || `用户${Math.floor(Math.random() * 1e3)}`,
2112
- color: e.color || h(),
2268
+ color: e.color || v(),
2113
2269
  ...e
2114
2270
  });
2115
- }, h = () => {
2271
+ }, v = () => {
2116
2272
  let e = [
2117
2273
  "#409EFF",
2118
2274
  "#67C23A",
@@ -2124,56 +2280,56 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2124
2280
  "#3498DB"
2125
2281
  ];
2126
2282
  return e[Math.floor(Math.random() * e.length)];
2127
- }, g = () => {
2128
- u.connect();
2129
- }, v = () => p, y = () => {
2130
- u.disconnect();
2131
- }, b = () => {
2132
- a.value = !0, t.transact(() => {
2133
- p.set("_closed", !0);
2134
- }), u.disconnect();
2135
- }, x = () => p.get("_closed") === !0 ? (a.value = !0, !0) : !1, S = (e) => {
2136
- o || (s && clearTimeout(s), s = setTimeout(() => {
2137
- let n = JSON.stringify(e);
2138
- p.get("root") !== n && t.transact(() => {
2139
- p.set("root", n);
2283
+ }, y = () => {
2284
+ f.connect();
2285
+ }, b = () => h, x = () => {
2286
+ f.disconnect();
2287
+ }, S = () => {
2288
+ o.value = !0, n.transact(() => {
2289
+ h.set("_closed", !0);
2290
+ }), f.disconnect();
2291
+ }, C = () => h.get("_closed") === !0 ? (o.value = !0, !0) : !1, w = (e) => {
2292
+ s || (c && clearTimeout(c), c = setTimeout(() => {
2293
+ let t = JSON.stringify(e);
2294
+ h.get("root") !== t && n.transact(() => {
2295
+ h.set("root", t);
2140
2296
  });
2141
2297
  }, 50));
2142
- }, C = (e) => {
2143
- p.observe((t) => {
2298
+ }, T = (e) => {
2299
+ h.observe((t) => {
2144
2300
  if (t.keysChanged.has("root")) {
2145
- let t = p.get("root");
2301
+ let t = h.get("root");
2146
2302
  if (t) try {
2147
- o = !0, e(JSON.parse(t)), setTimeout(() => {
2148
- o = !1;
2303
+ s = !0, e(JSON.parse(t)), setTimeout(() => {
2304
+ s = !1;
2149
2305
  }, 100);
2150
2306
  } catch (e) {
2151
- console.error("Failed to parse remote mind map data:", e), o = !1;
2307
+ console.error("Failed to parse remote mind map data:", e), s = !1;
2152
2308
  }
2153
2309
  }
2154
2310
  });
2155
- }, w = () => {
2311
+ }, E = () => {
2156
2312
  let t = `${window.location.origin}/mindmap-editor/${e}?collab=1`;
2157
- return i.value = t, t;
2313
+ return a.value = t, t;
2158
2314
  };
2159
2315
  return {
2160
- ydoc: t,
2161
- provider: u,
2162
- isConnected: n,
2163
- onlineUsers: r,
2164
- shareUrl: i,
2165
- collaborationClosed: a,
2166
- setUserInfo: m,
2167
- connect: g,
2168
- disconnect: y,
2169
- closeCollaboration: b,
2170
- checkCollaborationClosed: x,
2171
- syncToYjs: S,
2172
- getYData: v,
2173
- onRemoteChange: C,
2174
- generateShareUrl: w,
2316
+ ydoc: n,
2317
+ provider: f,
2318
+ isConnected: r,
2319
+ onlineUsers: i,
2320
+ shareUrl: a,
2321
+ collaborationClosed: o,
2322
+ setUserInfo: g,
2323
+ connect: y,
2324
+ disconnect: x,
2325
+ closeCollaboration: S,
2326
+ checkCollaborationClosed: C,
2327
+ syncToYjs: w,
2328
+ getYData: b,
2329
+ onRemoteChange: T,
2330
+ generateShareUrl: E,
2175
2331
  copyShareUrl: async () => {
2176
- let e = i.value || w();
2332
+ let e = a.value || E();
2177
2333
  try {
2178
2334
  return await navigator.clipboard.writeText(e), !0;
2179
2335
  } catch {
@@ -2181,23 +2337,62 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2181
2337
  }
2182
2338
  },
2183
2339
  destroy: () => {
2184
- f(), s && clearTimeout(s), u.awareness.setLocalState(null), u.disconnect(), t.destroy();
2340
+ m(), c && clearTimeout(c), f.awareness.setLocalState(null), f.disconnect(), n.destroy();
2185
2341
  }
2186
2342
  };
2187
- }, Lt = { class: "mindmap-editor" }, Rt = { class: "editor-main" }, zt = "mindmap", Bt = /*#__PURE__*/ Z({
2343
+ }, Wt = { class: "mindmap-editor" }, Gt = { class: "editor-main" }, Kt = "mindmap", qt = /*#__PURE__*/ Q({
2188
2344
  __name: "MindMapEditor",
2345
+ props: {
2346
+ docId: {
2347
+ type: [Number, String],
2348
+ default: null
2349
+ },
2350
+ apiBase: {
2351
+ type: String,
2352
+ default: "/api"
2353
+ },
2354
+ saveApi: {
2355
+ type: [String, Function],
2356
+ default: null
2357
+ },
2358
+ loadApi: {
2359
+ type: [String, Function],
2360
+ default: null
2361
+ },
2362
+ wsUrl: {
2363
+ type: String,
2364
+ default: ""
2365
+ },
2366
+ user: {
2367
+ type: Object,
2368
+ default: null
2369
+ },
2370
+ uiConfig: {
2371
+ type: Object,
2372
+ default: () => ({})
2373
+ },
2374
+ aiApi: {
2375
+ type: [String, Object],
2376
+ default: null
2377
+ }
2378
+ },
2189
2379
  setup(e) {
2190
- let n = k(), r = A(), o = _(null), c = _(null), l = _(!1), d = _(!1), f = _(!1), { saveVersion: h } = Be(), v = Le(), b = _({
2380
+ let n = e, r = k(), o = A(), c = t(() => ({
2381
+ backButton: "show",
2382
+ titleEditable: !0,
2383
+ authorEditable: !0,
2384
+ ...n.uiConfig
2385
+ })), l = t(() => n.docId ?? r.params.id), d = t(() => n.apiBase && n.apiBase !== "/api" ? me(n.apiBase) : ge), f = _(null), h = _(null), v = _(!1), b = _(!1), S = _(!1), { saveVersion: T } = qe(), E = Be(), O = We(() => n.aiApi), P = _({
2191
2386
  visible: !1,
2192
2387
  x: 0,
2193
2388
  y: 0
2194
- }), S = null, T = !1, E = null, O = _(!1), N = _(!1), P = _(!1), F = _([]), I = _(""), L = _(""), R = _(n.params.id || null), z = _(null), B = t(() => !!z.value), V = _(!1);
2195
- C(B, () => {
2389
+ }), F = null, I = !1, L = null, R = _(!1), z = _(!1), B = _(!1), V = _([]), H = _(""), U = _(""), W = _(l.value || null), G = _(null), K = t(() => !!G.value), q = _(!1);
2390
+ C(K, () => {
2196
2391
  u(() => {
2197
- S && (S.getElRectInfo(), S.resize(), q.value && S.view.fit(void 0, !0));
2392
+ F && (F.getElRectInfo(), F.resize(), Z.value && F.view.fit(void 0, !0));
2198
2393
  });
2199
2394
  });
2200
- let H = _("mindMap"), U = _("default"), W = _(0), G = _(0), K = _(100), q = _(!0), ee = {
2395
+ let ee = _("mindMap"), te = _("default"), J = _(0), Y = _(0), ne = _(100), Z = _(!0), re = {
2201
2396
  data: {
2202
2397
  text: "中心主题",
2203
2398
  expand: !0
@@ -2227,9 +2422,9 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2227
2422
  children: []
2228
2423
  }]
2229
2424
  }]
2230
- }, te = JSON.parse(JSON.stringify(ee)), ne = async () => {
2231
- if (!o.value) return;
2232
- let e = await import("./simple-mind-map-DFGmd5vc.mjs"), t = e.default || e, [r, i, a, s, c, l, d, f, p, m, h, g, _] = await Promise.all([
2425
+ }, ie = JSON.parse(JSON.stringify(re)), ae = async () => {
2426
+ if (!f.value) return;
2427
+ let e = await import("./simple-mind-map-DFGmd5vc.mjs"), t = e.default || e, [r, i, a, o, s, c, p, m, h, g, _, v, y] = await Promise.all([
2233
2428
  import("./Export-C11gtER2.mjs"),
2234
2429
  import("./Drag-BNJqZaaB.mjs"),
2235
2430
  import("./Select-CY_n5-r2.mjs"),
@@ -2243,22 +2438,22 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2243
2438
  import("./NodeImgAdjust-CU_ka96q.mjs"),
2244
2439
  import("./Watermark-B-zBgHXG.mjs"),
2245
2440
  import("./Formula-rim6V3Ro.mjs")
2246
- ]), v = r.default, y = i.default, b = a.default, x = s.default, C = c.default, w = l.default, E = d.default, D = f.default, O = p.default, k = m.default, A = h.default, j = g.default, M = _.default, N = ee, P = n.params.id;
2247
- if (P) try {
2248
- let { documentAPI: e } = await import("./api-D2rfJWe_.mjs"), t = await e.get(P);
2249
- if (t.data?.content) {
2250
- let e = JSON.parse(t.data.content);
2251
- e && e.data && (N = e, te = JSON.parse(JSON.stringify(e)));
2441
+ ]), b = r.default, x = i.default, S = a.default, C = o.default, w = s.default, T = c.default, E = p.default, D = m.default, O = h.default, k = g.default, A = _.default, j = v.default, M = y.default, P = re, L = l.value;
2442
+ if (L) try {
2443
+ let e;
2444
+ if (e = typeof n.loadApi == "function" ? await n.loadApi(L) : n.loadApi ? await N.get(`${n.loadApi}/${L}`) : await d.value.get(L), e.data?.content) {
2445
+ let t = JSON.parse(e.data.content);
2446
+ t && t.data && (P = t, ie = JSON.parse(JSON.stringify(t)));
2252
2447
  }
2253
- t.data?.title && (I.value = t.data.title), t.data?.author && (L.value = t.data.author);
2448
+ e.data?.title && (H.value = e.data.title), e.data?.author && (U.value = e.data.author);
2254
2449
  } catch (e) {
2255
2450
  console.warn("Failed to load document:", e);
2256
2451
  }
2257
- S = new t({
2258
- el: o.value,
2259
- data: N,
2260
- layout: H.value,
2261
- theme: U.value,
2452
+ F = new t({
2453
+ el: f.value,
2454
+ data: P,
2455
+ layout: ee.value,
2456
+ theme: te.value,
2262
2457
  scaleRatio: .1,
2263
2458
  mousewheelAction: "move",
2264
2459
  mousewheelMoveStep: 100,
@@ -2270,136 +2465,136 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2270
2465
  fit: !0,
2271
2466
  enableAutoEnterTextEditWhenKeydown: !1,
2272
2467
  enableShortcutOnlyWhenMouseInSvg: !0
2273
- }), S.addPlugin(v), S.addPlugin(y), S.addPlugin(b), S.addPlugin(x), S.addPlugin(C), S.addPlugin(w), S.addPlugin(E), S.addPlugin(D), S.addPlugin(O), S.addPlugin(k), S.addPlugin(A), S.addPlugin(j), S.addPlugin(M), S.on("node_click", (e) => {
2274
- z.value = e, V.value = !e.parent;
2275
- }), S.on("draw_click", () => {
2276
- z.value = null, V.value = !1;
2277
- }), S.on("history_change", () => {
2278
- re();
2279
- }), S.on("back_forward", (e, t) => {
2280
- W.value = e || 0, G.value = (t || 1) - 1 - (e || 0);
2281
- }), S.on("data_change", () => {
2282
- he();
2283
- }), S.on("before_show_text_edit", () => {
2284
- Q = !0, Z && clearTimeout(Z);
2285
- }), S.on("hide_text_edit", () => {
2286
- Q = !1, q.value && u(() => ge());
2287
- }), S.on("scale", (e) => {
2288
- K.value = Math.round(e * 100);
2289
- }), S.on("node_tree_render_end", () => {
2290
- re(), T || (T = !0, u(() => {
2291
- S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0), ve();
2468
+ }), F.addPlugin(b), F.addPlugin(x), F.addPlugin(S), F.addPlugin(C), F.addPlugin(w), F.addPlugin(T), F.addPlugin(E), F.addPlugin(D), F.addPlugin(O), F.addPlugin(k), F.addPlugin(A), F.addPlugin(j), F.addPlugin(M), F.on("node_click", (e) => {
2469
+ G.value = e, q.value = !e.parent;
2470
+ }), F.on("draw_click", () => {
2471
+ G.value = null, q.value = !1;
2472
+ }), F.on("history_change", () => {
2473
+ oe();
2474
+ }), F.on("back_forward", (e, t) => {
2475
+ J.value = e || 0, Y.value = (t || 1) - 1 - (e || 0);
2476
+ }), F.on("data_change", () => {
2477
+ Se();
2478
+ }), F.on("before_show_text_edit", () => {
2479
+ xe = !0, $ && clearTimeout($);
2480
+ }), F.on("hide_text_edit", () => {
2481
+ xe = !1, Z.value && u(() => Ce());
2482
+ }), F.on("scale", (e) => {
2483
+ ne.value = Math.round(e * 100);
2484
+ }), F.on("node_tree_render_end", () => {
2485
+ oe(), I || (I = !0, u(() => {
2486
+ F.getElRectInfo(), F.resize(), F.view.fit(void 0, !0), Ee();
2292
2487
  }));
2293
2488
  });
2294
- }, re = () => {
2295
- if (S) try {
2296
- let e = S.command;
2297
- W.value = e.activeHistoryIndex || 0, G.value = (e.history?.length || 1) - 1 - (e.activeHistoryIndex || 0);
2489
+ }, oe = () => {
2490
+ if (F) try {
2491
+ let e = F.command;
2492
+ J.value = e.activeHistoryIndex || 0, Y.value = (e.history?.length || 1) - 1 - (e.activeHistoryIndex || 0);
2298
2493
  } catch {
2299
- W.value = 0, G.value = 0;
2494
+ J.value = 0, Y.value = 0;
2300
2495
  }
2301
- }, ie = async () => {
2302
- if (!S) return;
2303
- E = It(n.params.id || `mindmap-${Date.now()}`), E.connect();
2304
- let e = `用户${Math.floor(Math.random() * 1e3)}`;
2305
- E.setUserInfo({ name: e }), v.setCollabContext({
2306
- ydoc: E.ydoc,
2307
- provider: E.provider,
2308
- onlineUsers: F
2309
- }), v.setCurrentUser({
2310
- id: E.provider.awareness.clientID,
2496
+ }, se = async () => {
2497
+ if (!F) return;
2498
+ L = Ut(l.value || `mindmap-${Date.now()}`, { wsUrl: n.wsUrl || void 0 }), L.connect(n.wsUrl || void 0);
2499
+ let e = n.user?.name || `用户${Math.floor(Math.random() * 1e3)}`;
2500
+ L.setUserInfo({ name: e }), E.setCollabContext({
2501
+ ydoc: L.ydoc,
2502
+ provider: L.provider,
2503
+ onlineUsers: V
2504
+ }), E.setCurrentUser({
2505
+ id: L.provider.awareness.clientID,
2311
2506
  name: e,
2312
2507
  color: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`
2313
- }), E.syncToYjs(S.getData()), E.onRemoteChange((e) => {
2314
- S && S.setData(e);
2315
- }), S.on("data_change", () => {
2316
- E && E.syncToYjs(S.getData());
2317
- }), P.value = !0, O.value = !0, N.value = !0;
2508
+ }), L.syncToYjs(F.getData()), L.onRemoteChange((e) => {
2509
+ F && F.setData(e);
2510
+ }), F.on("data_change", () => {
2511
+ L && L.syncToYjs(F.getData());
2512
+ }), B.value = !0, R.value = !0, z.value = !0;
2318
2513
  let t = setInterval(() => {
2319
- E && (F.value = [...E.onlineUsers.value]);
2514
+ L && (V.value = [...L.onlineUsers.value]);
2320
2515
  }, 1e3);
2321
- E._userSyncTimer = t, n.params.id || await ke();
2322
- let r = E.generateShareUrl();
2516
+ L._userSyncTimer = t, l.value || await Le();
2517
+ let r = L.generateShareUrl();
2323
2518
  j.success("协作已开启,分享链接已复制");
2324
2519
  try {
2325
2520
  await navigator.clipboard.writeText(r);
2326
2521
  } catch {}
2327
- }, ae = () => {
2328
- E &&= (E._userSyncTimer && clearInterval(E._userSyncTimer), E.closeCollaboration(), null), P.value = !1, O.value = !1, N.value = !1, F.value = [], j.info("协作已关闭");
2329
- }, oe = async () => {
2330
- if (!S) return;
2331
- let e = n.params.id;
2522
+ }, ce = () => {
2523
+ L &&= (L._userSyncTimer && clearInterval(L._userSyncTimer), L.closeCollaboration(), null), B.value = !1, R.value = !1, z.value = !1, V.value = [], j.info("协作已关闭");
2524
+ }, le = async () => {
2525
+ if (!F) return;
2526
+ let e = l.value;
2332
2527
  if (!e) return;
2333
- E = It(e), E.connect();
2334
- let t = `协作人${Math.floor(Math.random() * 1e3)}`;
2335
- if (E.setUserInfo({ name: t }), v.setCollabContext({
2336
- ydoc: E.ydoc,
2337
- provider: E.provider,
2338
- onlineUsers: F
2339
- }), v.setCurrentUser({
2340
- id: E.provider.awareness.clientID,
2528
+ L = Ut(e, { wsUrl: n.wsUrl || void 0 }), L.connect();
2529
+ let t = n.user?.name || `协作人${Math.floor(Math.random() * 1e3)}`;
2530
+ if (L.setUserInfo({ name: t }), E.setCollabContext({
2531
+ ydoc: L.ydoc,
2532
+ provider: L.provider,
2533
+ onlineUsers: V
2534
+ }), E.setCurrentUser({
2535
+ id: L.provider.awareness.clientID,
2341
2536
  name: t,
2342
2537
  color: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`
2343
- }), E.onRemoteChange((e) => {
2344
- S && S.setData(e);
2345
- }), S.on("data_change", () => {
2346
- E && E.syncToYjs(S.getData());
2538
+ }), L.onRemoteChange((e) => {
2539
+ F && F.setData(e);
2540
+ }), F.on("data_change", () => {
2541
+ L && L.syncToYjs(F.getData());
2347
2542
  }), await new Promise((e) => {
2348
2543
  let t = () => {
2349
- let t = E.getYData().get("root");
2544
+ let t = L.getYData().get("root");
2350
2545
  if (t) try {
2351
2546
  let e = JSON.parse(t);
2352
- S.setData(e);
2547
+ F.setData(e);
2353
2548
  } catch {}
2354
2549
  e();
2355
2550
  };
2356
- if (E.isConnected.value) t();
2551
+ if (L.isConnected.value) t();
2357
2552
  else {
2358
- let e = C(() => E.isConnected.value, (n) => {
2553
+ let e = C(() => L.isConnected.value, (n) => {
2359
2554
  n && (e(), t());
2360
2555
  });
2361
2556
  }
2362
- }), E.checkCollaborationClosed()) {
2363
- j.warning("该协作已关闭,无法加入"), E.disconnect(), E = null;
2557
+ }), L.checkCollaborationClosed()) {
2558
+ j.warning("该协作已关闭,无法加入"), L.disconnect(), L = null;
2364
2559
  return;
2365
2560
  }
2366
- P.value = !0, O.value = !0, N.value = !1;
2561
+ B.value = !0, R.value = !0, z.value = !1;
2367
2562
  let r = setInterval(() => {
2368
- E && (F.value = [...E.onlineUsers.value]);
2563
+ L && (V.value = [...L.onlineUsers.value]);
2369
2564
  }, 1e3);
2370
- E._userSyncTimer = r, j.success("已加入协作");
2371
- }, se = async () => {
2372
- if (!E) await ie();
2565
+ L._userSyncTimer = r, j.success("已加入协作");
2566
+ }, ue = async () => {
2567
+ if (!L) await se();
2373
2568
  else {
2374
- let e = E.generateShareUrl();
2569
+ let e = L.generateShareUrl();
2375
2570
  try {
2376
2571
  await navigator.clipboard.writeText(e), j.success("分享链接已复制到剪贴板");
2377
2572
  } catch {
2378
2573
  j.info("分享链接: " + e);
2379
2574
  }
2380
2575
  }
2381
- }, ce = () => r.push("/"), Y = (e) => {
2382
- S && (e === "child" ? S.execCommand("INSERT_CHILD_NODE") : S.execCommand("INSERT_NODE"));
2383
- }, le = () => {
2384
- S && S.execCommand("REMOVE_NODE");
2385
- }, ue = () => {
2386
- if (!S) return;
2387
- let e = S.getData(), t = (e) => {
2576
+ }, de = () => o.push("/"), fe = (e) => {
2577
+ F && (e === "child" ? F.execCommand("INSERT_CHILD_NODE") : F.execCommand("INSERT_NODE"));
2578
+ }, pe = () => {
2579
+ F && F.execCommand("REMOVE_NODE");
2580
+ }, he = () => {
2581
+ if (!F) return;
2582
+ let e = F.getData(), t = (e) => {
2388
2583
  e.children && e.children.length > 0 && (e.children.reverse(), e.children.forEach(t));
2389
2584
  };
2390
- t(e), S.setData(e), u(() => {
2391
- S && (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2585
+ t(e), F.setData(e), u(() => {
2586
+ F && (F.getElRectInfo(), F.resize(), F.view.fit(void 0, !0));
2392
2587
  });
2393
- }, de = () => S?.execCommand("BACK"), fe = () => S?.execCommand("FORWARD"), X = () => S?.view.enlarge(), pe = () => S?.view.narrow(), me = () => {
2394
- S && (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2395
- }, Z = null, Q = !1, he = () => {
2396
- !q.value || !S || Q || (Z && clearTimeout(Z), Z = setTimeout(() => {
2397
- Q || (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2588
+ }, Q = () => F?.execCommand("BACK"), _e = () => F?.execCommand("FORWARD"), ve = () => F?.view.enlarge(), ye = () => F?.view.narrow(), be = () => {
2589
+ F && (F.getElRectInfo(), F.resize(), F.view.fit(void 0, !0));
2590
+ }, $ = null, xe = !1, Se = () => {
2591
+ !Z.value || !F || xe || ($ && clearTimeout($), $ = setTimeout(() => {
2592
+ xe || (F.getElRectInfo(), F.resize(), F.view.fit(void 0, !0));
2398
2593
  }, 200));
2399
- }, ge = () => {
2400
- S && (Z && clearTimeout(Z), S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2401
- }, _e = async () => {
2402
- if (S) {
2594
+ }, Ce = () => {
2595
+ F && ($ && clearTimeout($), F.getElRectInfo(), F.resize(), F.view.fit(void 0, !0));
2596
+ }, we = async () => {
2597
+ if (F) {
2403
2598
  try {
2404
2599
  await M.confirm("确定要复位思维导图吗?将恢复到最近一次保存的状态。", "复位确认", {
2405
2600
  confirmButtonText: "确定",
@@ -2409,207 +2604,206 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2409
2604
  } catch {
2410
2605
  return;
2411
2606
  }
2412
- S.setData(te), u(() => {
2413
- S && (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0));
2607
+ F.setData(ie), u(() => {
2608
+ F && (F.getElRectInfo(), F.resize(), F.view.fit(void 0, !0));
2414
2609
  });
2415
2610
  }
2416
- }, $ = null, ve = () => {
2417
- !o.value || !S || ($ = new ResizeObserver(() => {
2418
- S && (S.getElRectInfo(), S.resize());
2419
- }), $.observe(o.value));
2420
- }, ye = (e) => {
2421
- H.value = e, S && S.svg?.attr({ opacity: 0 }), S?.setLayout(e);
2611
+ }, Te = null, Ee = () => {
2612
+ !f.value || !F || (Te = new ResizeObserver(() => {
2613
+ F && (F.getElRectInfo(), F.resize());
2614
+ }), Te.observe(f.value));
2615
+ }, De = (e) => {
2616
+ ee.value = e, F && F.svg?.attr({ opacity: 0 }), F?.setLayout(e);
2422
2617
  let t = () => {
2423
- S && (S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0), S.svg?.attr({ opacity: 1 }), S.off("node_tree_render_end", t));
2618
+ F && (F.getElRectInfo(), F.resize(), F.view.fit(void 0, !0), F.svg?.attr({ opacity: 1 }), F.off("node_tree_render_end", t));
2424
2619
  };
2425
- S?.on("node_tree_render_end", t), setTimeout(() => {
2426
- S && (S.svg?.attr({ opacity: 1 }), S.off("node_tree_render_end", t));
2620
+ F?.on("node_tree_render_end", t), setTimeout(() => {
2621
+ F && (F.svg?.attr({ opacity: 1 }), F.off("node_tree_render_end", t));
2427
2622
  }, 3e3);
2428
- }, be = (e) => {
2429
- U.value = e;
2430
- let t = $e.find((t) => t.value === e);
2431
- t && t.config && Object.keys(t.config).length > 0 ? S?.setThemeConfig(t.config) : S?.setTheme("default");
2432
- }, xe = (e) => {
2433
- !S || !z.value || (z.value.setData({ text: e }), S.render());
2434
- }, Se = (e) => {
2435
- if (!S || !z.value) return;
2436
- let t = z.value.getData("style") || {};
2437
- z.value.setData("style", {
2623
+ }, Oe = (e) => {
2624
+ te.value = e;
2625
+ let t = ot.find((t) => t.value === e);
2626
+ t && t.config && Object.keys(t.config).length > 0 ? F?.setThemeConfig(t.config) : F?.setTheme("default");
2627
+ }, ke = (e) => {
2628
+ !F || !G.value || (G.value.setData({ text: e }), F.render());
2629
+ }, Ae = (e) => {
2630
+ if (!F || !G.value) return;
2631
+ let t = G.value.getData("style") || {};
2632
+ G.value.setData("style", {
2438
2633
  ...t,
2439
2634
  ...e
2440
- }), S.render();
2441
- }, Ce = (e) => {
2442
- !S || !z.value || z.value.setData({ note: e });
2443
- }, we = (e) => {
2444
- !S || !z.value || z.value.setData({ tag: e });
2445
- }, Te = ({ hyperlink: e, hyperlinkTitle: t }) => {
2446
- !S || !z.value || z.value.setData({
2635
+ }), F.render();
2636
+ }, je = (e) => {
2637
+ !F || !G.value || G.value.setData({ note: e });
2638
+ }, Me = (e) => {
2639
+ !F || !G.value || G.value.setData({ tag: e });
2640
+ }, Ne = ({ hyperlink: e, hyperlinkTitle: t }) => {
2641
+ !F || !G.value || G.value.setData({
2447
2642
  hyperlink: e,
2448
2643
  hyperlinkTitle: t
2449
2644
  });
2450
- }, Ee = (e) => {
2451
- e === "png" || e === "svg" ? l.value = !0 : Oe(e);
2452
- }, De = async (e) => {
2453
- j.info("AI生成功能开发中,敬请期待...");
2454
- }, Oe = async (e) => {
2455
- if (S) try {
2456
- e === "png" ? await S.export.exportImg() : e === "svg" ? await S.export.exportSvg() : e === "pdf" && await S.export.exportPdf(), j.success("导出成功");
2645
+ }, Pe = (e) => {
2646
+ e === "png" || e === "svg" ? v.value = !0 : Ie(e);
2647
+ }, Fe = async (e) => {
2648
+ let t = await O.generate(e, "思维导图");
2649
+ if (t.success && t.parsed) try {
2650
+ F.setData(t.parsed), j.success("AI生成成功");
2651
+ } catch {
2652
+ j.warning("AI返回的数据格式无法解析,请调整提示词后重试");
2653
+ }
2654
+ else j.info(t.message || "AI生成功能开发中,敬请期待...");
2655
+ }, Ie = async (e) => {
2656
+ if (F) try {
2657
+ e === "png" ? await F.export.exportImg() : e === "svg" ? await F.export.exportSvg() : e === "pdf" && await F.export.exportPdf(), j.success("导出成功");
2457
2658
  } catch (e) {
2458
2659
  j.error("导出失败: " + e.message);
2459
2660
  }
2460
- }, ke = async () => {
2461
- if (S) {
2462
- if (O.value && !N.value && (!E || !E.isConnected.value || E.collaborationClosed.value)) {
2661
+ }, Le = async () => {
2662
+ if (F) {
2663
+ if (R.value && !z.value && (!L || !L.isConnected.value || L.collaborationClosed.value)) {
2463
2664
  j.error("协作已关闭,无法提交保存");
2464
2665
  return;
2465
2666
  }
2466
- if (!I.value?.trim()) {
2667
+ if (!H.value?.trim()) {
2467
2668
  j.warning("请输入思维导图标题");
2468
2669
  return;
2469
2670
  }
2470
- if (!L.value?.trim()) {
2671
+ if (!U.value?.trim()) {
2471
2672
  j.warning("请输入作者");
2472
2673
  return;
2473
2674
  }
2474
2675
  try {
2475
- let e = S.getData(), t = JSON.stringify(e), i = n.params.id, { documentAPI: a } = await import("./api-D2rfJWe_.mjs");
2476
- if (i) await a.update(i, {
2676
+ let e = F.getData(), t = JSON.stringify(e), r = l.value, i = {
2677
+ title: H.value.trim(),
2477
2678
  content: t,
2478
- title: I.value.trim(),
2479
2679
  doc_type: "mindmap"
2480
- }), R.value = i;
2680
+ }, a = typeof n.saveApi == "function" ? n.saveApi : n.saveApi ? (e) => r ? N.put(`${n.saveApi}/${r}`, e) : N.post(n.saveApi, e) : null;
2681
+ if (a) W.value = (await a(i, r)).data?.id || r;
2682
+ else if (r) await d.value.update(r, i), W.value = r;
2481
2683
  else {
2482
- let e = await a.create({
2483
- title: I.value.trim(),
2484
- content: t,
2485
- doc_type: "mindmap"
2486
- });
2487
- R.value = e.data.id, r.replace(`/mindmap-editor/${e.data.id}`);
2684
+ let e = await d.value.create(i);
2685
+ W.value = e.data.id, n.docId || o.replace(`/mindmap-editor/${e.data.id}`);
2488
2686
  }
2489
- te = JSON.parse(JSON.stringify(e)), j.success("保存成功"), h({
2490
- documentId: String(R.value || ""),
2687
+ ie = JSON.parse(JSON.stringify(e)), j.success("保存成功"), T({
2688
+ documentId: String(W.value || ""),
2491
2689
  docType: "mindmap",
2492
2690
  content: JSON.stringify(e),
2493
- userId: String(v.currentUser.value?.id || ""),
2494
- userName: v.currentUser.value?.name || L.value || "未知"
2691
+ userId: String(E.currentUser.value?.id || ""),
2692
+ userName: E.currentUser.value?.name || U.value || "未知"
2495
2693
  });
2496
2694
  } catch (e) {
2497
2695
  j.error("保存失败: " + e.message);
2498
2696
  }
2499
2697
  }
2500
- }, Ae = (e) => {
2501
- b.value = {
2698
+ }, Re = (e) => {
2699
+ P.value = {
2502
2700
  visible: !0,
2503
2701
  x: e.clientX,
2504
2702
  y: e.clientY
2505
2703
  };
2506
- }, je = (e) => {
2704
+ }, Ve = (e) => {
2507
2705
  switch (e) {
2508
2706
  case "insertChild":
2509
- Y("child");
2707
+ fe("child");
2510
2708
  break;
2511
2709
  case "insertSibling":
2512
- Y("sibling");
2710
+ fe("sibling");
2513
2711
  break;
2514
2712
  case "edit":
2515
- z.value && (S?.execCommand("ACTIVE_NODE", z.value), S?.textEdit.enterTextEdit());
2713
+ G.value && (F?.execCommand("ACTIVE_NODE", G.value), F?.textEdit.enterTextEdit());
2516
2714
  break;
2517
2715
  case "delete":
2518
- le();
2716
+ pe();
2519
2717
  break;
2520
2718
  case "copy":
2521
- S?.execCommand("COPY");
2719
+ F?.execCommand("COPY");
2522
2720
  break;
2523
2721
  case "cut":
2524
- S?.execCommand("CUT");
2722
+ F?.execCommand("CUT");
2525
2723
  break;
2526
2724
  case "paste":
2527
- S?.execCommand("PASTE");
2725
+ F?.execCommand("PASTE");
2528
2726
  break;
2529
2727
  }
2530
- }, Me = () => {
2531
- b.value.visible = !1;
2532
- }, Ne = [
2533
- "我可以帮您梳理思维导图结构、扩展节点内容,或者提供思路启发。请问有什么需要帮助的?",
2534
- "这个思维导图的层级结构很清晰。建议在二级节点下添加更多细节,让内容更加丰富。",
2535
- "根据当前的主题,我建议您尝试从不同维度展开思考,比如时间、空间、因果、对比等角度。",
2536
- "思维导图中的关键词提炼得很好。如果需要,我可以帮您将某些节点展开为更详细的描述。",
2537
- "我可以帮您检查思维导图中是否存在重复或遗漏的分支。需要我逐个节点分析吗?",
2538
- "建议使用不同的颜色和图标来区分不同分支的重要性,这样可以让思维导图更加直观。",
2539
- "这个思维导图的逻辑框架不错。建议在关键节点添加备注,方便后续回顾和补充。",
2540
- "我可以帮您将思维导图转换为大纲文本,或者根据现有内容生成新的分支建议。"
2541
- ], Pe = async (e, t = {}) => {
2542
- let r = n.params.id ? `${zt}-${n.params.id}` : null;
2543
- await v.sendMessage(e, {
2728
+ }, He = () => {
2729
+ P.value.visible = !1;
2730
+ }, Ue = async (e, t = {}) => {
2731
+ let n = l.value ? `${Kt}-${l.value}` : null;
2732
+ await E.sendMessage(e, {
2544
2733
  ...t,
2545
- roomId: r
2734
+ roomId: n
2546
2735
  });
2547
- let i = t.mentionedUser, a = i && i.toLowerCase().includes("ai"), o = v.collabUsers.value.filter((e) => e.name !== v.currentUser.value.name);
2548
- (!i || a || o.length === 0) && (v.loading.value = !0, setTimeout(() => {
2549
- v.sendAiMessage(Ne[Math.floor(Math.random() * Ne.length)], r), v.loading.value = !1;
2550
- }, 800 + Math.random() * 1200));
2551
- }, Fe = () => {
2552
- let e = n.params.id ? `${zt}-${n.params.id}` : null;
2553
- v.clearMessages(e);
2554
- }, Re = () => {
2555
- if (!n.params.id) {
2736
+ let r = t.mentionedUser, i = r && r.toLowerCase().includes("ai"), a = E.collabUsers.value.filter((e) => e.name !== E.currentUser.value.name);
2737
+ if (!r || i || a.length === 0) {
2738
+ E.loading.value = !0;
2739
+ let t = await O.chat(e, E.messages.value);
2740
+ E.sendAiMessage(t, n), E.loading.value = !1;
2741
+ }
2742
+ }, Ge = () => {
2743
+ let e = l.value ? `${Kt}-${l.value}` : null;
2744
+ E.clearMessages(e);
2745
+ }, Ke = () => {
2746
+ if (!l.value) {
2556
2747
  j.warning("请先保存文档");
2557
2748
  return;
2558
2749
  }
2559
- f.value = !0;
2560
- }, ze = (e) => {
2750
+ S.value = !0;
2751
+ }, Je = (e) => {
2561
2752
  try {
2562
2753
  let t = typeof e == "string" ? JSON.parse(e) : e;
2563
- t && S && (S.setData(t), u(() => {
2564
- S.getElRectInfo(), S.resize(), S.view.fit(void 0, !0);
2754
+ t && F && (F.setData(t), u(() => {
2755
+ F.getElRectInfo(), F.resize(), F.view.fit(void 0, !0);
2565
2756
  }));
2566
2757
  } catch (e) {
2567
2758
  console.error("Version apply error:", e);
2568
2759
  }
2569
2760
  };
2570
2761
  return m(async () => {
2571
- await u(), await ne(), document.addEventListener("click", Me), n.query.collab === "1" && n.params.id && await oe();
2762
+ await u(), await ae(), document.addEventListener("click", He), r.query.collab === "1" && l.value && await le();
2572
2763
  }), p(() => {
2573
- document.removeEventListener("click", Me), Z && clearTimeout(Z), E &&= (E.destroy(), null), $ &&= ($.disconnect(), null), S &&= (S.destroy(), null);
2764
+ document.removeEventListener("click", He), $ && clearTimeout($), L &&= (L.destroy(), null), Te &&= (Te.disconnect(), null), F &&= (F.destroy(), null);
2574
2765
  }), (e, t) => {
2575
2766
  let n = y("el-icon"), r = y("el-button");
2576
- return g(), i("div", Lt, [
2577
- s(ht, {
2578
- "undo-count": W.value,
2579
- "redo-count": G.value,
2580
- "current-layout": H.value,
2581
- "current-theme": U.value,
2582
- "zoom-percent": K.value,
2583
- "auto-fit": q.value,
2584
- "is-collaborating": O.value,
2585
- "is-collab-owner": N.value,
2586
- "collab-users": F.value,
2587
- "model-title": I.value,
2588
- "model-author": L.value,
2589
- "is-root-node": V.value,
2590
- onBack: ce,
2591
- onUndo: de,
2592
- onRedo: fe,
2593
- onInsertChild: t[0] ||= (e) => Y("child"),
2594
- onInsertSibling: t[1] ||= (e) => Y("sibling"),
2595
- onReverseLayout: ue,
2596
- onDeleteNode: le,
2597
- onChangeLayout: ye,
2598
- onChangeTheme: be,
2599
- onZoomIn: X,
2600
- onZoomOut: pe,
2601
- onFitView: me,
2602
- onToggleAutoFit: t[2] ||= (e) => q.value = !q.value,
2603
- onResetView: _e,
2604
- onExport: Ee,
2605
- onSave: ke,
2606
- onToggleCollab: t[3] ||= (e) => O.value ? ae() : ie(),
2607
- onShareCollab: se,
2608
- "onUpdate:title": t[4] ||= (e) => I.value = e,
2609
- "onUpdate:author": t[5] ||= (e) => L.value = e,
2610
- onAiGenerate: De,
2611
- "show-history": !!R.value,
2612
- onHistory: Re
2767
+ return g(), i("div", Wt, [
2768
+ s(St, {
2769
+ "undo-count": J.value,
2770
+ "redo-count": Y.value,
2771
+ "current-layout": ee.value,
2772
+ "current-theme": te.value,
2773
+ "zoom-percent": ne.value,
2774
+ "auto-fit": Z.value,
2775
+ "is-collaborating": R.value,
2776
+ "is-collab-owner": z.value,
2777
+ "collab-users": V.value,
2778
+ "model-title": H.value,
2779
+ "model-author": U.value,
2780
+ "is-root-node": q.value,
2781
+ "back-button": c.value.backButton,
2782
+ "title-editable": c.value.titleEditable,
2783
+ "author-editable": c.value.authorEditable,
2784
+ onBack: de,
2785
+ onUndo: Q,
2786
+ onRedo: _e,
2787
+ onInsertChild: t[0] ||= (e) => fe("child"),
2788
+ onInsertSibling: t[1] ||= (e) => fe("sibling"),
2789
+ onReverseLayout: he,
2790
+ onDeleteNode: pe,
2791
+ onChangeLayout: De,
2792
+ onChangeTheme: Oe,
2793
+ onZoomIn: ve,
2794
+ onZoomOut: ye,
2795
+ onFitView: be,
2796
+ onToggleAutoFit: t[2] ||= (e) => Z.value = !Z.value,
2797
+ onResetView: we,
2798
+ onExport: Pe,
2799
+ onSave: Le,
2800
+ onToggleCollab: t[3] ||= (e) => R.value ? ce() : se(),
2801
+ onShareCollab: ue,
2802
+ "onUpdate:title": t[4] ||= (e) => H.value = e,
2803
+ "onUpdate:author": t[5] ||= (e) => U.value = e,
2804
+ onAiGenerate: Fe,
2805
+ "show-history": !!W.value,
2806
+ onHistory: Ke
2613
2807
  }, null, 8, [
2614
2808
  "undo-count",
2615
2809
  "redo-count",
@@ -2623,70 +2817,73 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2623
2817
  "model-title",
2624
2818
  "model-author",
2625
2819
  "is-root-node",
2820
+ "back-button",
2821
+ "title-editable",
2822
+ "author-editable",
2626
2823
  "show-history"
2627
2824
  ]),
2628
- a("div", Rt, [a("div", {
2825
+ a("div", Gt, [a("div", {
2629
2826
  class: "canvas-area",
2630
2827
  ref_key: "canvasRef",
2631
- ref: c,
2632
- onContextmenu: D(Ae, ["prevent"])
2828
+ ref: h,
2829
+ onContextmenu: D(Re, ["prevent"])
2633
2830
  }, [a("div", {
2634
2831
  class: "mindmap-container",
2635
2832
  ref_key: "containerRef",
2636
- ref: o
2637
- }, null, 512)], 544), s(Mt, {
2638
- visible: B.value,
2639
- node: z.value,
2640
- onClose: t[6] ||= (e) => z.value = null,
2641
- onUpdateText: xe,
2642
- onUpdateStyle: Se,
2643
- onUpdateNote: Ce,
2644
- onUpdateTags: we,
2645
- onUpdateHyperlink: Te
2833
+ ref: f
2834
+ }, null, 512)], 544), s(zt, {
2835
+ visible: K.value,
2836
+ node: G.value,
2837
+ onClose: t[6] ||= (e) => G.value = null,
2838
+ onUpdateText: ke,
2839
+ onUpdateStyle: Ae,
2840
+ onUpdateNote: je,
2841
+ onUpdateTags: Me,
2842
+ onUpdateHyperlink: Ne
2646
2843
  }, null, 8, ["visible", "node"])]),
2647
- s(Nt, {
2648
- visible: b.value.visible,
2649
- x: b.value.x,
2650
- y: b.value.y,
2651
- onCommand: je,
2652
- onClose: t[7] ||= (e) => b.value.visible = !1
2844
+ s(Bt, {
2845
+ visible: P.value.visible,
2846
+ x: P.value.x,
2847
+ y: P.value.y,
2848
+ onCommand: Ve,
2849
+ onClose: t[7] ||= (e) => P.value.visible = !1
2653
2850
  }, null, 8, [
2654
2851
  "visible",
2655
2852
  "x",
2656
2853
  "y"
2657
2854
  ]),
2658
- s(Ft, {
2659
- visible: l.value,
2660
- "onUpdate:visible": t[8] ||= (e) => l.value = e,
2661
- onExport: Oe
2855
+ s(Ht, {
2856
+ visible: v.value,
2857
+ "onUpdate:visible": t[8] ||= (e) => v.value = e,
2858
+ onExport: Ie
2662
2859
  }, null, 8, ["visible"]),
2663
2860
  s(r, {
2664
2861
  class: "ai-chat-fab",
2665
- type: d.value ? "primary" : "default",
2862
+ type: b.value ? "primary" : "default",
2666
2863
  circle: "",
2667
2864
  size: "large",
2668
- onClick: t[9] ||= (e) => d.value = !d.value,
2865
+ onClick: t[9] ||= (e) => b.value = !b.value,
2669
2866
  title: "AI助手"
2670
2867
  }, {
2671
2868
  default: w(() => [s(n, null, {
2672
- default: w(() => [s(x(J))]),
2869
+ default: w(() => [s(x(X))]),
2673
2870
  _: 1
2674
2871
  })]),
2675
2872
  _: 1
2676
2873
  }, 8, ["type"]),
2677
- s(Ie, {
2678
- visible: d.value,
2679
- messages: x(v).messages.value,
2680
- loading: x(v).loading.value,
2681
- "is-collab": x(v).isCollabMode.value,
2682
- "collab-users": x(v).collabUsers.value,
2683
- "current-user": x(v).currentUser.value,
2684
- "is-owner": N.value,
2685
- onSend: Pe,
2686
- onClose: t[10] ||= (e) => d.value = !1,
2687
- "unread-mention": x(v).unreadMention.value,
2688
- onClearUnread: t[11] ||= (e) => x(v).clearUnreadMention(),
2689
- onClear: Fe
2874
+ s(ze, {
2875
+ visible: b.value,
2876
+ messages: x(E).messages.value,
2877
+ loading: x(E).loading.value,
2878
+ "is-collab": x(E).isCollabMode.value,
2879
+ "collab-users": x(E).collabUsers.value,
2880
+ "current-user": x(E).currentUser.value,
2881
+ "is-owner": z.value,
2882
+ onSend: Ue,
2883
+ onClose: t[10] ||= (e) => b.value = !1,
2884
+ "unread-mention": x(E).unreadMention.value,
2885
+ onClearUnread: t[11] ||= (e) => x(E).clearUnreadMention(),
2886
+ onClear: Ge
2690
2887
  }, null, 8, [
2691
2888
  "visible",
2692
2889
  "messages",
@@ -2697,16 +2894,16 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2697
2894
  "is-owner",
2698
2895
  "unread-mention"
2699
2896
  ]),
2700
- s(Qe, {
2701
- modelValue: f.value,
2702
- "onUpdate:modelValue": t[12] ||= (e) => f.value = e,
2703
- "document-id": R.value,
2704
- onApply: ze
2897
+ s(at, {
2898
+ modelValue: S.value,
2899
+ "onUpdate:modelValue": t[12] ||= (e) => S.value = e,
2900
+ "document-id": W.value,
2901
+ onApply: Je
2705
2902
  }, null, 8, ["modelValue", "document-id"])
2706
2903
  ]);
2707
2904
  };
2708
2905
  }
2709
- }, [["__scopeId", "data-v-6b850065"]]), Vt = c({
2906
+ }, [["__scopeId", "data-v-29f796f9"]]), Jt = c({
2710
2907
  name: "YourCompanyMindmap",
2711
2908
  props: {
2712
2909
  docId: {
@@ -2717,6 +2914,14 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2717
2914
  type: String,
2718
2915
  default: "/api"
2719
2916
  },
2917
+ saveApi: {
2918
+ type: [String, Function],
2919
+ default: null
2920
+ },
2921
+ loadApi: {
2922
+ type: [String, Function],
2923
+ default: null
2924
+ },
2720
2925
  wsUrl: {
2721
2926
  type: String,
2722
2927
  default: ""
@@ -2732,14 +2937,22 @@ var Re = "/api/document-versions", ze = 5e3, Be = () => {
2732
2937
  roomId: {
2733
2938
  type: String,
2734
2939
  default: ""
2940
+ },
2941
+ uiConfig: {
2942
+ type: Object,
2943
+ default: () => ({})
2944
+ },
2945
+ aiApi: {
2946
+ type: [String, Object],
2947
+ default: null
2735
2948
  }
2736
2949
  },
2737
2950
  setup(e, { slots: t }) {
2738
2951
  return () => l("div", {
2739
2952
  class: "yourcompany-mindmap-wrapper",
2740
2953
  style: "position:relative"
2741
- }, [l(Bt, { ...e }), l(O)]);
2954
+ }, [l(qt, { ...e }), l(O)]);
2742
2955
  }
2743
2956
  });
2744
2957
  //#endregion
2745
- export { Vt as default };
2958
+ export { Jt as default };