patent-editor 0.2.4 → 0.2.5
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/lib.js +647 -647
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/lib.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as m, jsxs as L, Fragment as
|
|
5
|
-
import
|
|
6
|
-
import { Extension as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { Table as
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import { dropCursor as
|
|
27
|
-
import { gapCursor as
|
|
28
|
-
import
|
|
29
|
-
import { PluginKey as
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import { create as
|
|
33
|
-
import { DecorationSet as
|
|
34
|
-
import { diff_match_patch as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import { TextStyle as
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
1
|
+
var Sn = Object.defineProperty;
|
|
2
|
+
var En = (e, t, n) => t in e ? Sn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var Se = (e, t, n) => En(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsx as m, jsxs as L, Fragment as je } from "react/jsx-runtime";
|
|
5
|
+
import Ee, { forwardRef as _t, useState as $, useEffect as M, useCallback as ae, useImperativeHandle as It, useRef as j, useMemo as Nt } from "react";
|
|
6
|
+
import { Extension as Oe, ReactRenderer as kn, Node as Z, mergeAttributes as ie, NodeViewWrapper as _n, ReactNodeViewRenderer as At, EditorContent as In, useEditor as Nn } from "@tiptap/react";
|
|
7
|
+
import An from "@tiptap/extension-document";
|
|
8
|
+
import Ln from "@tiptap/extension-paragraph";
|
|
9
|
+
import Pn from "@tiptap/extension-text";
|
|
10
|
+
import Dn from "@tiptap/extension-heading";
|
|
11
|
+
import Rn from "@tiptap/extension-bullet-list";
|
|
12
|
+
import Mn from "@tiptap/extension-ordered-list";
|
|
13
|
+
import Fn from "@tiptap/extension-list-item";
|
|
14
|
+
import $n from "@tiptap/extension-blockquote";
|
|
15
|
+
import zn from "@tiptap/extension-code-block";
|
|
16
|
+
import On from "@tiptap/extension-horizontal-rule";
|
|
17
|
+
import Bn from "@tiptap/extension-task-list";
|
|
18
|
+
import Hn from "@tiptap/extension-task-item";
|
|
19
|
+
import qn from "@tiptap/extension-image";
|
|
20
|
+
import { Table as Un } from "@tiptap/extension-table";
|
|
21
|
+
import Wn from "@tiptap/extension-table-row";
|
|
22
|
+
import jn from "@tiptap/extension-table-cell";
|
|
23
|
+
import Gn from "@tiptap/extension-table-header";
|
|
24
|
+
import Vn from "@tiptap/extension-placeholder";
|
|
25
|
+
import Jn from "@tiptap/extension-history";
|
|
26
|
+
import { dropCursor as Kn } from "prosemirror-dropcursor";
|
|
27
|
+
import { gapCursor as Xn } from "prosemirror-gapcursor";
|
|
28
|
+
import Yn from "@tiptap/extension-text-align";
|
|
29
|
+
import { PluginKey as we, Plugin as Be, TextSelection as Zn } from "@tiptap/pm/state";
|
|
30
|
+
import Qn from "@tiptap/suggestion";
|
|
31
|
+
import er from "tippy.js";
|
|
32
|
+
import { create as tr } from "zustand";
|
|
33
|
+
import { DecorationSet as be, Decoration as re } from "@tiptap/pm/view";
|
|
34
|
+
import { diff_match_patch as Lt } from "diff-match-patch";
|
|
35
|
+
import nr from "@tiptap/extension-bold";
|
|
36
|
+
import rr from "@tiptap/extension-italic";
|
|
37
|
+
import ar from "@tiptap/extension-underline";
|
|
38
|
+
import ir from "@tiptap/extension-strike";
|
|
39
|
+
import sr from "@tiptap/extension-code";
|
|
40
|
+
import or from "@tiptap/extension-superscript";
|
|
41
|
+
import cr from "@tiptap/extension-subscript";
|
|
42
|
+
import lr from "@tiptap/extension-link";
|
|
43
|
+
import { TextStyle as dr } from "@tiptap/extension-text-style";
|
|
44
|
+
import ur from "@tiptap/extension-color";
|
|
45
|
+
import mr from "@tiptap/extension-highlight";
|
|
46
|
+
import gr from "katex";
|
|
47
47
|
import "katex/dist/katex.min.css";
|
|
48
48
|
import "mathlive";
|
|
49
|
-
import { findWrapping as
|
|
50
|
-
import { Slice as
|
|
51
|
-
import { createPortal as
|
|
52
|
-
import { Undo2 as
|
|
49
|
+
import { findWrapping as fr } from "@tiptap/pm/transform";
|
|
50
|
+
import { Slice as pr, Fragment as hr } from "@tiptap/pm/model";
|
|
51
|
+
import { createPortal as yr } from "react-dom";
|
|
52
|
+
import { Undo2 as br, Redo2 as vr, Bold as Pt, Italic as Dt, Underline as Rt, Strikethrough as Mt, Code as Ft, Superscript as $t, Subscript as zt, Pilcrow as wr, Heading1 as xr, Heading2 as Cr, Heading3 as Tr, AlignLeft as Sr, AlignCenter as Er, AlignRight as kr, AlignJustify as _r, List as Ir, ListOrdered as Nr, Quote as Ar, FileCode2 as Lr, Table as Pr, Minus as Dr, CheckSquare as Rr, Image as Ot, Link2 as Bt, FileText as Ht, Box as Mr, Workflow as Fr, FunctionSquare as $r, Sigma as zr, GitGraph as Or, Square as ut, ChevronDown as qt, Trash2 as Br, Highlighter as Hr, Sparkles as qr, CaseSensitive as Ur, ChevronUp as Wr, Replace as mt, X as jr, ReplaceAll as Gr, PanelLeft as Vr, PanelLeftClose as Jr } from "lucide-react";
|
|
53
53
|
import Y from "clsx";
|
|
54
|
-
import { BubbleMenu as
|
|
55
|
-
import { convertMillimetersToTwip as
|
|
56
|
-
import { saveAs as
|
|
57
|
-
const
|
|
54
|
+
import { BubbleMenu as Kr } from "@tiptap/react/menus";
|
|
55
|
+
import { convertMillimetersToTwip as he, Document as Xr, Packer as Yr, Paragraph as He, AlignmentType as at, TextRun as qe } from "docx";
|
|
56
|
+
import { saveAs as Zr } from "file-saver";
|
|
57
|
+
const Qr = new we("slashCommand"), ea = Oe.create({
|
|
58
58
|
name: "slashCommand",
|
|
59
59
|
addOptions() {
|
|
60
60
|
return {
|
|
@@ -68,14 +68,14 @@ const Yr = new ve("slashCommand"), Zr = ze.create({
|
|
|
68
68
|
},
|
|
69
69
|
addProseMirrorPlugins() {
|
|
70
70
|
return [
|
|
71
|
-
|
|
71
|
+
Qn({
|
|
72
72
|
editor: this.editor,
|
|
73
73
|
...this.options.suggestion,
|
|
74
|
-
pluginKey:
|
|
74
|
+
pluginKey: Qr
|
|
75
75
|
})
|
|
76
76
|
];
|
|
77
77
|
}
|
|
78
|
-
}),
|
|
78
|
+
}), ta = {
|
|
79
79
|
visible: !0,
|
|
80
80
|
activeTab: "chat",
|
|
81
81
|
activeSectionType: null,
|
|
@@ -83,7 +83,7 @@ const Yr = new ve("slashCommand"), Zr = ze.create({
|
|
|
83
83
|
regenerate: !1,
|
|
84
84
|
chatReferences: [],
|
|
85
85
|
pendingChatMessage: null
|
|
86
|
-
}, I =
|
|
86
|
+
}, I = tr((e) => ({
|
|
87
87
|
editor: null,
|
|
88
88
|
document: null,
|
|
89
89
|
selection: null,
|
|
@@ -94,7 +94,7 @@ const Yr = new ve("slashCommand"), Zr = ze.create({
|
|
|
94
94
|
aiService: null,
|
|
95
95
|
chatSessionAPI: null,
|
|
96
96
|
chatSessionId: null,
|
|
97
|
-
rightPanel: { ...
|
|
97
|
+
rightPanel: { ...ta },
|
|
98
98
|
setEditor: (t) => e({ editor: t }),
|
|
99
99
|
setDocument: (t) => e({ document: t }),
|
|
100
100
|
setSelection: (t) => e({ selection: t }),
|
|
@@ -162,7 +162,7 @@ const Yr = new ve("slashCommand"), Zr = ze.create({
|
|
|
162
162
|
setPendingChatMessage: (t) => e((n) => ({
|
|
163
163
|
rightPanel: { ...n.rightPanel, pendingChatMessage: t }
|
|
164
164
|
}))
|
|
165
|
-
})),
|
|
165
|
+
})), Ut = _t(
|
|
166
166
|
({ items: e, command: t }, n) => {
|
|
167
167
|
const [r, a] = $(0);
|
|
168
168
|
M(() => {
|
|
@@ -175,7 +175,7 @@ const Yr = new ve("slashCommand"), Zr = ze.create({
|
|
|
175
175
|
},
|
|
176
176
|
[e, t]
|
|
177
177
|
);
|
|
178
|
-
return
|
|
178
|
+
return It(n, () => ({
|
|
179
179
|
onKeyDown: ({ event: o }) => o.key === "ArrowUp" ? (a((c) => (c + e.length - 1) % e.length), !0) : o.key === "ArrowDown" ? (a((c) => (c + 1) % e.length), !0) : o.key === "Enter" ? (i(r), !0) : !1
|
|
180
180
|
})), e.length ? /* @__PURE__ */ m("div", { className: "slash-menu", children: e.map((o, c) => /* @__PURE__ */ L(
|
|
181
181
|
"button",
|
|
@@ -195,8 +195,8 @@ const Yr = new ve("slashCommand"), Zr = ze.create({
|
|
|
195
195
|
)) }) : /* @__PURE__ */ m("div", { className: "slash-menu", children: /* @__PURE__ */ m("div", { className: "slash-menu-empty", children: "No results" }) });
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
|
-
|
|
199
|
-
function
|
|
198
|
+
Ut.displayName = "SlashMenuList";
|
|
199
|
+
function na(e) {
|
|
200
200
|
const t = e === "zh";
|
|
201
201
|
return [
|
|
202
202
|
{
|
|
@@ -298,11 +298,11 @@ function ea(e) {
|
|
|
298
298
|
}
|
|
299
299
|
];
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function ra() {
|
|
302
302
|
return {
|
|
303
303
|
char: "/",
|
|
304
304
|
items: ({ query: e }) => {
|
|
305
|
-
const t = I.getState().editorLanguage, n =
|
|
305
|
+
const t = I.getState().editorLanguage, n = na(t);
|
|
306
306
|
if (!e) return n;
|
|
307
307
|
const r = e.toLowerCase();
|
|
308
308
|
return n.filter(
|
|
@@ -313,10 +313,10 @@ function ta() {
|
|
|
313
313
|
let e = null, t = null;
|
|
314
314
|
return {
|
|
315
315
|
onStart: (n) => {
|
|
316
|
-
e = new
|
|
316
|
+
e = new kn(Ut, {
|
|
317
317
|
props: n,
|
|
318
318
|
editor: n.editor
|
|
319
|
-
}), n.clientRect && (t =
|
|
319
|
+
}), n.clientRect && (t = er("body", {
|
|
320
320
|
getReferenceClientRect: n.clientRect,
|
|
321
321
|
appendTo: () => document.body,
|
|
322
322
|
content: e.element,
|
|
@@ -343,8 +343,8 @@ function ta() {
|
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
|
-
const
|
|
347
|
-
function
|
|
346
|
+
const aa = new we("searchReplace");
|
|
347
|
+
function ke(e, t, n) {
|
|
348
348
|
if (!t) return [];
|
|
349
349
|
const r = [], a = e.textBetween(0, e.content.size, `
|
|
350
350
|
`, "\0"), i = n ? t : t.toLowerCase(), o = n ? a : a.toLowerCase();
|
|
@@ -369,7 +369,7 @@ function Ee(e, t, n) {
|
|
|
369
369
|
}
|
|
370
370
|
return r;
|
|
371
371
|
}
|
|
372
|
-
const
|
|
372
|
+
const ia = Oe.create({
|
|
373
373
|
name: "searchReplace",
|
|
374
374
|
addStorage() {
|
|
375
375
|
return {
|
|
@@ -382,30 +382,30 @@ const ra = ze.create({
|
|
|
382
382
|
},
|
|
383
383
|
addCommands() {
|
|
384
384
|
return {
|
|
385
|
-
setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results =
|
|
385
|
+
setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results = ke(t.state.doc, e, this.storage.caseSensitive), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
|
|
386
386
|
setReplaceTerm: (e) => () => (this.storage.replaceTerm = e, !0),
|
|
387
|
-
setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results =
|
|
387
|
+
setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results = ke(t.state.doc, this.storage.searchTerm, e), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
|
|
388
388
|
nextSearchResult: () => ({ editor: e }) => {
|
|
389
389
|
if (this.storage.results.length === 0) return !1;
|
|
390
390
|
this.storage.currentIndex = (this.storage.currentIndex + 1) % this.storage.results.length;
|
|
391
391
|
const t = this.storage.results[this.storage.currentIndex];
|
|
392
|
-
return t && (e.commands.setTextSelection(t),
|
|
392
|
+
return t && (e.commands.setTextSelection(t), gt(e)), e.view.dispatch(e.state.tr), !0;
|
|
393
393
|
},
|
|
394
394
|
previousSearchResult: () => ({ editor: e }) => {
|
|
395
395
|
if (this.storage.results.length === 0) return !1;
|
|
396
396
|
this.storage.currentIndex = (this.storage.currentIndex - 1 + this.storage.results.length) % this.storage.results.length;
|
|
397
397
|
const t = this.storage.results[this.storage.currentIndex];
|
|
398
|
-
return t && (e.commands.setTextSelection(t),
|
|
398
|
+
return t && (e.commands.setTextSelection(t), gt(e)), e.view.dispatch(e.state.tr), !0;
|
|
399
399
|
},
|
|
400
400
|
replaceCurrent: () => ({ editor: e }) => {
|
|
401
401
|
if (this.storage.results.length === 0 || this.storage.currentIndex < 0) return !1;
|
|
402
402
|
const t = this.storage.results[this.storage.currentIndex];
|
|
403
|
-
return t ? (e.chain().focus().insertContentAt(t, this.storage.replaceTerm).run(), this.storage.results =
|
|
403
|
+
return t ? (e.chain().focus().insertContentAt(t, this.storage.replaceTerm).run(), this.storage.results = ke(e.state.doc, this.storage.searchTerm, this.storage.caseSensitive), this.storage.currentIndex >= this.storage.results.length && (this.storage.currentIndex = 0), e.view.dispatch(e.state.tr), !0) : !1;
|
|
404
404
|
},
|
|
405
405
|
replaceAll: () => ({ editor: e }) => {
|
|
406
406
|
if (this.storage.results.length === 0) return !1;
|
|
407
407
|
const { searchTerm: t, replaceTerm: n, caseSensitive: r } = this.storage;
|
|
408
|
-
let a =
|
|
408
|
+
let a = ke(e.state.doc, t, r);
|
|
409
409
|
const i = e.state.tr;
|
|
410
410
|
let o = 0;
|
|
411
411
|
for (const c of a) {
|
|
@@ -432,24 +432,24 @@ const ra = ze.create({
|
|
|
432
432
|
addProseMirrorPlugins() {
|
|
433
433
|
const e = this.storage;
|
|
434
434
|
return [
|
|
435
|
-
new
|
|
436
|
-
key:
|
|
435
|
+
new Be({
|
|
436
|
+
key: aa,
|
|
437
437
|
props: {
|
|
438
438
|
decorations: (t) => {
|
|
439
439
|
if (!e.searchTerm || e.results.length === 0)
|
|
440
|
-
return
|
|
440
|
+
return be.empty;
|
|
441
441
|
const n = e.results.map((r, a) => {
|
|
442
442
|
const i = a === e.currentIndex ? "search-highlight search-highlight--current" : "search-highlight";
|
|
443
443
|
return re.inline(r.from, r.to, { class: i });
|
|
444
444
|
});
|
|
445
|
-
return
|
|
445
|
+
return be.create(t.doc, n);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
})
|
|
449
449
|
];
|
|
450
450
|
}
|
|
451
451
|
});
|
|
452
|
-
function
|
|
452
|
+
function gt(e) {
|
|
453
453
|
requestAnimationFrame(() => {
|
|
454
454
|
const t = e.view.domAtPos(e.state.selection.from);
|
|
455
455
|
if (t != null && t.node) {
|
|
@@ -458,17 +458,17 @@ function ut(e) {
|
|
|
458
458
|
}
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
|
-
const
|
|
462
|
-
let
|
|
463
|
-
function
|
|
464
|
-
return
|
|
461
|
+
const sa = -1, oa = 1, ft = 0;
|
|
462
|
+
let Ge = null;
|
|
463
|
+
function ca() {
|
|
464
|
+
return Ge || (Ge = new Lt()), Ge;
|
|
465
465
|
}
|
|
466
|
-
const
|
|
467
|
-
function
|
|
466
|
+
const Wt = new we("patchDiff");
|
|
467
|
+
function la(e, t) {
|
|
468
468
|
let n = null;
|
|
469
469
|
return e.state.doc.descendants((r, a) => n ? !1 : r.type.name === "patent_section" && r.attrs.sectionType === t ? (n = { from: a + 1, to: a + r.nodeSize - 1 }, !1) : !0), n;
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function jt(e, t, n) {
|
|
472
472
|
const r = [];
|
|
473
473
|
let a = "", i = !0;
|
|
474
474
|
return e.state.doc.nodesBetween(t, n, (o, c) => {
|
|
@@ -478,26 +478,26 @@ function Ut(e, t, n) {
|
|
|
478
478
|
} else o.isLeaf ? (a += "\0", i = !1) : !i && o.isBlock && (a += "\0", i = !0);
|
|
479
479
|
}), { text: a, segments: r };
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function ye(e, t) {
|
|
482
482
|
for (const n of e)
|
|
483
483
|
if (t >= n.textIdx && t <= n.textIdx + n.len)
|
|
484
484
|
return n.docPos + (t - n.textIdx);
|
|
485
485
|
return -1;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
const { text: i, segments: o } =
|
|
487
|
+
function pt(e, t, n, r, a) {
|
|
488
|
+
const { text: i, segments: o } = jt(e, n, r);
|
|
489
489
|
let c = 0;
|
|
490
490
|
for (; c <= i.length - t.length; ) {
|
|
491
491
|
const s = i.indexOf(t, c);
|
|
492
492
|
if (s === -1) return null;
|
|
493
|
-
const l =
|
|
493
|
+
const l = ye(o, s), d = ye(o, s + t.length);
|
|
494
494
|
if (l >= 0 && d >= 0 && !(a && a.has(l)))
|
|
495
495
|
return { from: l, to: d };
|
|
496
496
|
c = s + 1;
|
|
497
497
|
}
|
|
498
498
|
return null;
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function Rs(e, t, n, r, a) {
|
|
501
501
|
const i = t.target;
|
|
502
502
|
let o = null;
|
|
503
503
|
const c = /* @__PURE__ */ new Set();
|
|
@@ -507,15 +507,15 @@ function Ps(e, t, n, r, a) {
|
|
|
507
507
|
if (!i)
|
|
508
508
|
t.from != null && t.to != null && (o = { from: t.from, to: t.to });
|
|
509
509
|
else if (i.type === "section" && i.sectionType)
|
|
510
|
-
o =
|
|
510
|
+
o = la(e, i.sectionType);
|
|
511
511
|
else if (i.type === "ref" && i.refIndex != null) {
|
|
512
512
|
const d = n[i.refIndex];
|
|
513
513
|
(d == null ? void 0 : d.from) != null && (d == null ? void 0 : d.to) != null && (o = { from: d.from, to: d.to });
|
|
514
|
-
} else i.type === "search" && i.searchText && (o =
|
|
514
|
+
} else i.type === "search" && i.searchText && (o = pt(e, i.searchText, 0, e.state.doc.content.size, c));
|
|
515
515
|
if (!o) return null;
|
|
516
516
|
let s = o;
|
|
517
517
|
if (t.search) {
|
|
518
|
-
const d =
|
|
518
|
+
const d = pt(e, t.search, o.from, o.to, c);
|
|
519
519
|
d && (s = d);
|
|
520
520
|
}
|
|
521
521
|
const l = s.from < s.to ? e.state.doc.textBetween(s.from, s.to, " ", "\0") : "";
|
|
@@ -530,25 +530,25 @@ function Ps(e, t, n, r, a) {
|
|
|
530
530
|
status: "pending"
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
|
-
let H = [],
|
|
534
|
-
function
|
|
535
|
-
return
|
|
536
|
-
|
|
533
|
+
let H = [], De = [];
|
|
534
|
+
function Ms(e) {
|
|
535
|
+
return De.push(e), () => {
|
|
536
|
+
De = De.filter((t) => t !== e);
|
|
537
537
|
};
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
|
|
539
|
+
function ue() {
|
|
540
|
+
De.forEach((e) => e());
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function Fs() {
|
|
543
543
|
return [...H];
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
H = e,
|
|
545
|
+
function $s(e) {
|
|
546
|
+
H = e, ue();
|
|
547
547
|
}
|
|
548
|
-
function
|
|
549
|
-
H = [],
|
|
548
|
+
function zs() {
|
|
549
|
+
H = [], ue();
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function Os(e, t) {
|
|
552
552
|
const n = H.find((i) => i.id === t);
|
|
553
553
|
if (!n || n.status !== "pending") return !1;
|
|
554
554
|
n.status = "accepted";
|
|
@@ -557,8 +557,8 @@ function $s(e, t) {
|
|
|
557
557
|
r.delete(n.from, n.to);
|
|
558
558
|
else if (n.type === "insert")
|
|
559
559
|
r.insertText(n.content, n.from);
|
|
560
|
-
else if (
|
|
561
|
-
const o =
|
|
560
|
+
else if (Gt(e, n.from, n.to)) {
|
|
561
|
+
const o = Vt(e, n.content);
|
|
562
562
|
r.replaceWith(n.from, n.to, o);
|
|
563
563
|
} else
|
|
564
564
|
r.insertText(n.content, n.from, n.to);
|
|
@@ -569,33 +569,33 @@ function $s(e, t) {
|
|
|
569
569
|
const o = a.map(i.from, 1), c = a.map(i.to, -1);
|
|
570
570
|
o >= c && i.type !== "insert" ? i.status = "rejected" : (i.from = o, i.to = i.type === "insert" ? o : c);
|
|
571
571
|
}
|
|
572
|
-
return H = H.filter((i) => i.id !== t && i.status === "pending"),
|
|
572
|
+
return H = H.filter((i) => i.id !== t && i.status === "pending"), Ue(e), ue(), !0;
|
|
573
573
|
}
|
|
574
|
-
function
|
|
574
|
+
function Bs(e, t) {
|
|
575
575
|
const n = H.find((r) => r.id === t);
|
|
576
|
-
return !n || n.status !== "pending" ? !1 : (n.status = "rejected", H = H.filter((r) => r.id !== t),
|
|
576
|
+
return !n || n.status !== "pending" ? !1 : (n.status = "rejected", H = H.filter((r) => r.id !== t), Ue(e), ue(), !0);
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function Hs(e) {
|
|
579
579
|
const n = [...H.filter((a) => a.status === "pending")].sort((a, i) => i.from - a.from), { tr: r } = e.state;
|
|
580
580
|
for (const a of n)
|
|
581
581
|
if (a.type === "delete")
|
|
582
582
|
r.delete(a.from, a.to);
|
|
583
583
|
else if (a.type === "insert")
|
|
584
584
|
r.insertText(a.content, a.from);
|
|
585
|
-
else if (
|
|
586
|
-
const o =
|
|
585
|
+
else if (Gt(e, a.from, a.to)) {
|
|
586
|
+
const o = Vt(e, a.content);
|
|
587
587
|
r.replaceWith(a.from, a.to, o);
|
|
588
588
|
} else
|
|
589
589
|
r.insertText(a.content, a.from, a.to);
|
|
590
|
-
e.view.dispatch(r), H = [],
|
|
590
|
+
e.view.dispatch(r), H = [], Ue(e), ue();
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
H = [],
|
|
592
|
+
function qs(e) {
|
|
593
|
+
H = [], Ue(e), ue();
|
|
594
594
|
}
|
|
595
|
-
function
|
|
596
|
-
e.view.dispatch(e.state.tr.setMeta(
|
|
595
|
+
function Ue(e) {
|
|
596
|
+
e.view.dispatch(e.state.tr.setMeta(Wt, !0));
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function da(e, t, n) {
|
|
599
599
|
const r = [];
|
|
600
600
|
return e.nodesBetween(t, n, (a, i) => {
|
|
601
601
|
if (a.isTextblock) {
|
|
@@ -605,7 +605,7 @@ function ca(e, t, n) {
|
|
|
605
605
|
return !0;
|
|
606
606
|
}), r;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function ua(e, t) {
|
|
609
609
|
if (!t.originalText || !t.content) return null;
|
|
610
610
|
try {
|
|
611
611
|
const c = e.resolve(t.from), s = e.resolve(t.to);
|
|
@@ -613,16 +613,16 @@ function la(e, t) {
|
|
|
613
613
|
} catch {
|
|
614
614
|
return null;
|
|
615
615
|
}
|
|
616
|
-
const n =
|
|
616
|
+
const n = ca(), r = n.diff_main(t.originalText, t.content);
|
|
617
617
|
n.diff_cleanupSemantic(r);
|
|
618
|
-
const a = r.filter(([c]) => c ===
|
|
618
|
+
const a = r.filter(([c]) => c === ft).reduce((c, [, s]) => c + s.length, 0);
|
|
619
619
|
if (t.originalText.length > 0 && a / t.originalText.length < 0.3) return null;
|
|
620
620
|
const i = [];
|
|
621
621
|
let o = t.from;
|
|
622
622
|
for (const [c, s] of r)
|
|
623
|
-
if (c ===
|
|
623
|
+
if (c === ft)
|
|
624
624
|
o += s.length;
|
|
625
|
-
else if (c ===
|
|
625
|
+
else if (c === sa) {
|
|
626
626
|
const l = o + s.length;
|
|
627
627
|
i.push(
|
|
628
628
|
re.inline(o, l, {
|
|
@@ -630,7 +630,7 @@ function la(e, t) {
|
|
|
630
630
|
"data-patch-id": t.id
|
|
631
631
|
})
|
|
632
632
|
), o = l;
|
|
633
|
-
} else c ===
|
|
633
|
+
} else c === oa && i.push(
|
|
634
634
|
re.widget(o, () => {
|
|
635
635
|
const l = document.createElement("span");
|
|
636
636
|
return l.className = "patch-diff-insert-inline", l.textContent = s, l.setAttribute("data-patch-id", t.id), l;
|
|
@@ -638,24 +638,24 @@ function la(e, t) {
|
|
|
638
638
|
);
|
|
639
639
|
return i;
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
return new
|
|
643
|
-
key:
|
|
641
|
+
function ma() {
|
|
642
|
+
return new Be({
|
|
643
|
+
key: Wt,
|
|
644
644
|
props: {
|
|
645
645
|
decorations(e) {
|
|
646
646
|
const t = H.filter((r) => r.status === "pending");
|
|
647
|
-
if (t.length === 0) return
|
|
647
|
+
if (t.length === 0) return be.empty;
|
|
648
648
|
const n = [];
|
|
649
649
|
for (const r of t) {
|
|
650
650
|
if (r.type === "replace") {
|
|
651
|
-
const a =
|
|
651
|
+
const a = ua(e.doc, r);
|
|
652
652
|
if (a) {
|
|
653
653
|
n.push(...a);
|
|
654
654
|
continue;
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
657
|
if (r.type === "delete" || r.type === "replace") {
|
|
658
|
-
const a =
|
|
658
|
+
const a = da(e.doc, r.from, r.to);
|
|
659
659
|
for (const i of a)
|
|
660
660
|
n.push(
|
|
661
661
|
re.inline(i.from, i.to, {
|
|
@@ -681,17 +681,17 @@ function da() {
|
|
|
681
681
|
})
|
|
682
682
|
);
|
|
683
683
|
}
|
|
684
|
-
return
|
|
684
|
+
return be.create(e.doc, n);
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
|
-
function
|
|
689
|
+
function Gt(e, t, n) {
|
|
690
690
|
var i;
|
|
691
691
|
const r = e.state.doc.resolve(t);
|
|
692
692
|
return !!((i = r.parent.type.spec.content) != null && i.includes("block") && t === r.start() && n === r.end());
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function Vt(e, t) {
|
|
695
695
|
const n = e.state.schema;
|
|
696
696
|
return t.split(/\n\n+/).filter((a) => a.trim().length > 0).map((a) => {
|
|
697
697
|
const i = a.replace(/\n/g, " ").trim();
|
|
@@ -701,7 +701,7 @@ function jt(e, t) {
|
|
|
701
701
|
);
|
|
702
702
|
});
|
|
703
703
|
}
|
|
704
|
-
const
|
|
704
|
+
const ga = Z.create({
|
|
705
705
|
name: "hardBreak",
|
|
706
706
|
inline: !0,
|
|
707
707
|
group: "inline",
|
|
@@ -722,40 +722,40 @@ const ua = Z.create({
|
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
|
-
}),
|
|
725
|
+
}), fa = Oe.create({
|
|
726
726
|
name: "dragDropUX",
|
|
727
727
|
addProseMirrorPlugins() {
|
|
728
728
|
return [
|
|
729
|
-
|
|
729
|
+
Kn({
|
|
730
730
|
width: 3,
|
|
731
731
|
color: "#2563eb"
|
|
732
732
|
}),
|
|
733
|
-
|
|
733
|
+
Xn()
|
|
734
734
|
];
|
|
735
735
|
}
|
|
736
|
-
}),
|
|
736
|
+
}), pa = Oe.create({
|
|
737
737
|
name: "patchDiff",
|
|
738
738
|
addProseMirrorPlugins() {
|
|
739
|
-
return [
|
|
739
|
+
return [ma()];
|
|
740
740
|
}
|
|
741
|
-
}),
|
|
742
|
-
In,
|
|
743
|
-
Nn,
|
|
741
|
+
}), ha = [
|
|
744
742
|
An,
|
|
745
|
-
|
|
746
|
-
|
|
743
|
+
Ln,
|
|
744
|
+
Pn,
|
|
745
|
+
fa,
|
|
746
|
+
Dn.configure({
|
|
747
747
|
levels: [1, 2, 3, 4, 5, 6]
|
|
748
748
|
}),
|
|
749
|
-
Pn,
|
|
750
|
-
Dn,
|
|
751
749
|
Rn,
|
|
752
750
|
Mn,
|
|
753
751
|
Fn,
|
|
754
|
-
ua,
|
|
755
752
|
$n,
|
|
756
753
|
zn,
|
|
757
|
-
|
|
758
|
-
|
|
754
|
+
ga,
|
|
755
|
+
On,
|
|
756
|
+
Bn,
|
|
757
|
+
Hn.configure({ nested: !0 }),
|
|
758
|
+
qn.extend({
|
|
759
759
|
addAttributes() {
|
|
760
760
|
var e;
|
|
761
761
|
return {
|
|
@@ -771,46 +771,46 @@ const ua = Z.create({
|
|
|
771
771
|
inline: !0,
|
|
772
772
|
allowBase64: !0
|
|
773
773
|
}),
|
|
774
|
-
|
|
774
|
+
Un.configure({
|
|
775
775
|
resizable: !0
|
|
776
776
|
}),
|
|
777
|
-
qn,
|
|
778
|
-
Un,
|
|
779
777
|
Wn,
|
|
780
|
-
jn
|
|
778
|
+
jn,
|
|
779
|
+
Gn,
|
|
780
|
+
Vn.configure({
|
|
781
781
|
placeholder: ({ node: e }) => e.type.name === "heading" ? "Heading" : "Type / for commands..."
|
|
782
782
|
}),
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
suggestion:
|
|
783
|
+
Jn,
|
|
784
|
+
ea.configure({
|
|
785
|
+
suggestion: ra()
|
|
786
786
|
}),
|
|
787
|
-
|
|
788
|
-
|
|
787
|
+
ia,
|
|
788
|
+
Yn.configure({
|
|
789
789
|
types: ["heading", "paragraph"],
|
|
790
790
|
defaultAlignment: "left"
|
|
791
791
|
}),
|
|
792
|
-
|
|
793
|
-
],
|
|
794
|
-
er,
|
|
795
|
-
tr,
|
|
792
|
+
pa
|
|
793
|
+
], ya = [
|
|
796
794
|
nr,
|
|
797
795
|
rr,
|
|
798
796
|
ar,
|
|
799
797
|
ir,
|
|
800
798
|
sr,
|
|
801
|
-
or
|
|
799
|
+
or,
|
|
800
|
+
cr,
|
|
801
|
+
lr.configure({
|
|
802
802
|
openOnClick: !1
|
|
803
803
|
}),
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
],
|
|
808
|
-
...
|
|
809
|
-
...
|
|
804
|
+
dr,
|
|
805
|
+
ur,
|
|
806
|
+
mr.configure({ multicolor: !0 })
|
|
807
|
+
], ba = [
|
|
808
|
+
...ha,
|
|
809
|
+
...ya
|
|
810
810
|
];
|
|
811
|
-
class
|
|
811
|
+
class va {
|
|
812
812
|
constructor() {
|
|
813
|
-
|
|
813
|
+
Se(this, "commands", /* @__PURE__ */ new Map());
|
|
814
814
|
}
|
|
815
815
|
normalizeCommand(t) {
|
|
816
816
|
return typeof t == "function" ? {
|
|
@@ -874,11 +874,11 @@ class ya {
|
|
|
874
874
|
return Array.from(this.commands.keys()).sort();
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
|
-
const le = new
|
|
878
|
-
class
|
|
877
|
+
const le = new va();
|
|
878
|
+
class wa {
|
|
879
879
|
constructor() {
|
|
880
|
-
|
|
881
|
-
|
|
880
|
+
Se(this, "plugins", /* @__PURE__ */ new Map());
|
|
881
|
+
Se(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
|
|
882
882
|
}
|
|
883
883
|
logLifecycle(t, n) {
|
|
884
884
|
t !== "stateSync" && console.info(`[PluginManager:${t}] ${n}`);
|
|
@@ -960,7 +960,7 @@ class ba {
|
|
|
960
960
|
});
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
|
-
const B = new
|
|
963
|
+
const B = new wa(), ht = {
|
|
964
964
|
zh: {
|
|
965
965
|
language: "语言",
|
|
966
966
|
bold: "加粗",
|
|
@@ -1207,13 +1207,13 @@ const B = new ba(), ft = {
|
|
|
1207
1207
|
insertMathBlock: "Insert math block",
|
|
1208
1208
|
insertDrawioDiagram: "Insert Draw.io diagram"
|
|
1209
1209
|
}
|
|
1210
|
-
}, q = (e) => e === "en" ?
|
|
1211
|
-
let
|
|
1212
|
-
const
|
|
1210
|
+
}, q = (e) => e === "en" ? ht.en : ht.zh;
|
|
1211
|
+
let _e = 0;
|
|
1212
|
+
const Ie = () => {
|
|
1213
1213
|
document.querySelectorAll('body > svg[id^="standalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
|
|
1214
1214
|
(e.id.startsWith("dmermaid") || e.id.startsWith("dstandalone")) && e.remove();
|
|
1215
1215
|
}), document.querySelectorAll('body > div[id^="dstandalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > div[id^="dmermaid"]').forEach((e) => e.remove()), document.querySelectorAll('body > div[id^="standalone-mermaid-"]').forEach((e) => e.remove());
|
|
1216
|
-
},
|
|
1216
|
+
}, xa = Z.create({
|
|
1217
1217
|
name: "mermaid",
|
|
1218
1218
|
group: "block",
|
|
1219
1219
|
atom: !0,
|
|
@@ -1265,13 +1265,13 @@ const _e = () => {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
try {
|
|
1267
1267
|
const A = await import("mermaid");
|
|
1268
|
-
A.default.initialize({ startOnLoad: !1, theme: "default" }),
|
|
1269
|
-
const D = `standalone-mermaid-${
|
|
1268
|
+
A.default.initialize({ startOnLoad: !1, theme: "default" }), _e += 1;
|
|
1269
|
+
const D = `standalone-mermaid-${_e}`, { svg: z } = await A.default.render(D, N);
|
|
1270
1270
|
c.innerHTML = z, h = N;
|
|
1271
1271
|
} catch {
|
|
1272
1272
|
c.innerHTML = "", h = "";
|
|
1273
1273
|
} finally {
|
|
1274
|
-
|
|
1274
|
+
Ie();
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
1277
|
}, E = () => {
|
|
@@ -1285,11 +1285,11 @@ const _e = () => {
|
|
|
1285
1285
|
if (N)
|
|
1286
1286
|
try {
|
|
1287
1287
|
const A = await import("mermaid");
|
|
1288
|
-
A.default.initialize({ startOnLoad: !1, theme: "default" }),
|
|
1289
|
-
const D = `standalone-mermaid-${
|
|
1290
|
-
c.innerHTML = z, h = N,
|
|
1288
|
+
A.default.initialize({ startOnLoad: !1, theme: "default" }), _e += 1;
|
|
1289
|
+
const D = `standalone-mermaid-${_e}`, { svg: z } = await A.default.render(D, N);
|
|
1290
|
+
c.innerHTML = z, h = N, Ie();
|
|
1291
1291
|
} catch {
|
|
1292
|
-
|
|
1292
|
+
Ie();
|
|
1293
1293
|
const A = I.getState().editorLanguage;
|
|
1294
1294
|
u.textContent = A === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", u.style.display = "inline";
|
|
1295
1295
|
return;
|
|
@@ -1322,15 +1322,15 @@ const _e = () => {
|
|
|
1322
1322
|
ignoreMutation: () => !0,
|
|
1323
1323
|
update: (C) => C.type.name !== "mermaid" ? !1 : (r = C, T(), !0),
|
|
1324
1324
|
destroy: () => {
|
|
1325
|
-
_(),
|
|
1325
|
+
_(), Ie();
|
|
1326
1326
|
}
|
|
1327
1327
|
};
|
|
1328
1328
|
};
|
|
1329
1329
|
}
|
|
1330
|
-
}),
|
|
1330
|
+
}), Ca = {
|
|
1331
1331
|
name: "mermaid",
|
|
1332
1332
|
version: "1.0.0",
|
|
1333
|
-
extensions: [
|
|
1333
|
+
extensions: [xa],
|
|
1334
1334
|
toolbarItems: [
|
|
1335
1335
|
{
|
|
1336
1336
|
id: "mermaid-insert",
|
|
@@ -1355,7 +1355,7 @@ const _e = () => {
|
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
|
-
},
|
|
1358
|
+
}, Ve = "https://draw.goatpatent.com", Ta = Z.create({
|
|
1359
1359
|
name: "drawio",
|
|
1360
1360
|
group: "block",
|
|
1361
1361
|
atom: !0,
|
|
@@ -1399,7 +1399,7 @@ const _e = () => {
|
|
|
1399
1399
|
const v = document.createElement("button");
|
|
1400
1400
|
v.className = "drawio-modal-close-btn", v.textContent = "✕", v.type = "button", v.addEventListener("click", () => f()), x.append(T, v), u = document.createElement("iframe"), u.className = "drawio-modal-iframe", u.setAttribute("frameborder", "0"), E.append(x, u), g.appendChild(E), document.body.appendChild(g);
|
|
1401
1401
|
const _ = w === "en" ? "en" : "zh";
|
|
1402
|
-
u.src =
|
|
1402
|
+
u.src = `${Ve}/?embed=1&proto=json&spin=1&lang=${_}`;
|
|
1403
1403
|
const C = u;
|
|
1404
1404
|
d = (N) => {
|
|
1405
1405
|
var D, z;
|
|
@@ -1414,13 +1414,13 @@ const _e = () => {
|
|
|
1414
1414
|
const Q = typeof r.attrs.xml == "string" ? r.attrs.xml : "";
|
|
1415
1415
|
(D = C.contentWindow) == null || D.postMessage(
|
|
1416
1416
|
JSON.stringify({ action: "load", autosave: 0, xml: Q || "" }),
|
|
1417
|
-
|
|
1417
|
+
Ve
|
|
1418
1418
|
);
|
|
1419
1419
|
} else if (A.event === "save") {
|
|
1420
1420
|
const Q = A.xml || "";
|
|
1421
1421
|
(z = C.contentWindow) == null || z.postMessage(
|
|
1422
1422
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1423
|
-
|
|
1423
|
+
Ve
|
|
1424
1424
|
), l({ xml: Q });
|
|
1425
1425
|
} else if (A.event === "export") {
|
|
1426
1426
|
const Q = A.data || "";
|
|
@@ -1451,10 +1451,10 @@ const _e = () => {
|
|
|
1451
1451
|
};
|
|
1452
1452
|
};
|
|
1453
1453
|
}
|
|
1454
|
-
}),
|
|
1454
|
+
}), Sa = {
|
|
1455
1455
|
name: "drawio",
|
|
1456
1456
|
version: "1.0.0",
|
|
1457
|
-
extensions: [
|
|
1457
|
+
extensions: [Ta],
|
|
1458
1458
|
toolbarItems: [
|
|
1459
1459
|
{
|
|
1460
1460
|
id: "drawio-insert",
|
|
@@ -1479,7 +1479,7 @@ const _e = () => {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
-
},
|
|
1482
|
+
}, Jt = ({
|
|
1483
1483
|
node: e,
|
|
1484
1484
|
updateAttributes: t,
|
|
1485
1485
|
selected: n,
|
|
@@ -1532,7 +1532,7 @@ const _e = () => {
|
|
|
1532
1532
|
}, [e.attrs.latex, i]);
|
|
1533
1533
|
let p = "";
|
|
1534
1534
|
try {
|
|
1535
|
-
p =
|
|
1535
|
+
p = gr.renderToString(e.attrs.latex || "", {
|
|
1536
1536
|
throwOnError: !1,
|
|
1537
1537
|
displayMode: c
|
|
1538
1538
|
});
|
|
@@ -1540,7 +1540,7 @@ const _e = () => {
|
|
|
1540
1540
|
p = e.attrs.latex || "";
|
|
1541
1541
|
}
|
|
1542
1542
|
return /* @__PURE__ */ m(
|
|
1543
|
-
|
|
1543
|
+
_n,
|
|
1544
1544
|
{
|
|
1545
1545
|
as: c ? "div" : "span",
|
|
1546
1546
|
className: c ? "math-block" : "math-inline",
|
|
@@ -1557,7 +1557,7 @@ const _e = () => {
|
|
|
1557
1557
|
] })
|
|
1558
1558
|
}
|
|
1559
1559
|
);
|
|
1560
|
-
},
|
|
1560
|
+
}, Ea = Z.create({
|
|
1561
1561
|
name: "math_inline",
|
|
1562
1562
|
group: "inline",
|
|
1563
1563
|
inline: !0,
|
|
@@ -1583,14 +1583,14 @@ const _e = () => {
|
|
|
1583
1583
|
return ["span", ie(e, { "data-type": "math_inline" })];
|
|
1584
1584
|
},
|
|
1585
1585
|
addNodeView() {
|
|
1586
|
-
return
|
|
1586
|
+
return At(Jt, {
|
|
1587
1587
|
stopEvent: ({ event: e }) => {
|
|
1588
1588
|
const t = e.target;
|
|
1589
1589
|
return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
|
|
1590
1590
|
}
|
|
1591
1591
|
});
|
|
1592
1592
|
}
|
|
1593
|
-
}),
|
|
1593
|
+
}), ka = Z.create({
|
|
1594
1594
|
name: "math_block",
|
|
1595
1595
|
group: "block",
|
|
1596
1596
|
atom: !0,
|
|
@@ -1606,17 +1606,17 @@ const _e = () => {
|
|
|
1606
1606
|
return ["div", ie(e, { "data-type": "math_block" })];
|
|
1607
1607
|
},
|
|
1608
1608
|
addNodeView() {
|
|
1609
|
-
return
|
|
1609
|
+
return At(Jt, {
|
|
1610
1610
|
stopEvent: ({ event: e }) => {
|
|
1611
1611
|
const t = e.target;
|
|
1612
1612
|
return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
|
|
1613
1613
|
}
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
|
-
}),
|
|
1616
|
+
}), _a = {
|
|
1617
1617
|
name: "math",
|
|
1618
1618
|
version: "1.0.0",
|
|
1619
|
-
extensions: [
|
|
1619
|
+
extensions: [Ea, ka],
|
|
1620
1620
|
toolbarItems: [
|
|
1621
1621
|
{
|
|
1622
1622
|
id: "math-inline-insert",
|
|
@@ -1661,14 +1661,14 @@ const _e = () => {
|
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
|
-
},
|
|
1664
|
+
}, it = (e, t, n = {}) => {
|
|
1665
1665
|
const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size;
|
|
1666
1666
|
let i = null;
|
|
1667
1667
|
return e.state.doc.nodesBetween(r, a, (o, c) => i ? !1 : o.type.name === t ? (i = { node: o, pos: c }, !1) : !0), i;
|
|
1668
|
-
},
|
|
1668
|
+
}, Kt = (e, t, n = {}) => {
|
|
1669
1669
|
const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size, i = [];
|
|
1670
1670
|
return e.state.doc.nodesBetween(r, a, (o, c) => (t(o, c) && i.push({ node: o, pos: c }), !0)), i;
|
|
1671
|
-
},
|
|
1671
|
+
}, Re = (e, t) => {
|
|
1672
1672
|
const { $from: n } = e.state.selection;
|
|
1673
1673
|
for (let r = n.depth; r >= 0; r -= 1) {
|
|
1674
1674
|
const a = n.node(r);
|
|
@@ -1679,7 +1679,7 @@ const _e = () => {
|
|
|
1679
1679
|
};
|
|
1680
1680
|
}
|
|
1681
1681
|
return null;
|
|
1682
|
-
},
|
|
1682
|
+
}, Ia = (e) => {
|
|
1683
1683
|
const { $from: t } = e.state.selection;
|
|
1684
1684
|
for (let n = t.depth; n >= 0; n -= 1) {
|
|
1685
1685
|
const r = t.node(n);
|
|
@@ -1690,19 +1690,19 @@ const _e = () => {
|
|
|
1690
1690
|
};
|
|
1691
1691
|
}
|
|
1692
1692
|
return null;
|
|
1693
|
-
},
|
|
1693
|
+
}, Na = (e, t) => e.state.schema.nodes[t] || null, Aa = (e) => {
|
|
1694
1694
|
const t = Array.isArray(e.content) ? e.content : e.content ? [e.content] : void 0;
|
|
1695
1695
|
return {
|
|
1696
1696
|
type: e.type,
|
|
1697
1697
|
attrs: e.attrs,
|
|
1698
1698
|
content: t
|
|
1699
1699
|
};
|
|
1700
|
-
},
|
|
1701
|
-
const n =
|
|
1700
|
+
}, Xt = (e, t) => {
|
|
1701
|
+
const n = Aa(t);
|
|
1702
1702
|
return typeof t.position == "number" ? e.chain().focus().insertContentAt(t.position, n).run() : e.chain().focus().insertContent(n).run();
|
|
1703
|
-
},
|
|
1703
|
+
}, ze = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
|
|
1704
1704
|
var s;
|
|
1705
|
-
const i = typeof t.position == "number" ? t.position : (s =
|
|
1705
|
+
const i = typeof t.position == "number" ? t.position : (s = it(e, t.type || "")) == null ? void 0 : s.pos;
|
|
1706
1706
|
if (typeof i != "number")
|
|
1707
1707
|
return !1;
|
|
1708
1708
|
const o = r.doc.nodeAt(i);
|
|
@@ -1710,65 +1710,65 @@ const _e = () => {
|
|
|
1710
1710
|
return !1;
|
|
1711
1711
|
const c = { ...o.attrs, ...t.attrs };
|
|
1712
1712
|
return n.setNodeMarkup(i, void 0, c), a && a(n), !0;
|
|
1713
|
-
}),
|
|
1713
|
+
}), Yt = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
|
|
1714
1714
|
var c;
|
|
1715
|
-
const i = typeof t.position == "number" ? t.position : (c =
|
|
1715
|
+
const i = typeof t.position == "number" ? t.position : (c = it(e, t.type || "")) == null ? void 0 : c.pos;
|
|
1716
1716
|
if (typeof i != "number")
|
|
1717
1717
|
return !1;
|
|
1718
1718
|
const o = r.doc.nodeAt(i);
|
|
1719
1719
|
return !o || t.type && o.type.name !== t.type ? !1 : (n.delete(i, i + o.nodeSize), a && a(n), !0);
|
|
1720
|
-
}),
|
|
1721
|
-
const n =
|
|
1720
|
+
}), Zt = (e, t) => {
|
|
1721
|
+
const n = Na(e, t.type);
|
|
1722
1722
|
return n ? e.commands.command(({ tr: r, state: a, dispatch: i }) => {
|
|
1723
1723
|
const { from: o, to: c } = a.selection, s = a.selection.$from.blockRange(a.selection.$to);
|
|
1724
1724
|
if (!s)
|
|
1725
1725
|
return !1;
|
|
1726
|
-
const l =
|
|
1726
|
+
const l = fr(s, n, t.attrs);
|
|
1727
1727
|
return l ? (r.wrap(s, l), i && i(r.scrollIntoView()), o <= c) : !1;
|
|
1728
1728
|
}) : !1;
|
|
1729
|
-
},
|
|
1729
|
+
}, La = (e, t) => {
|
|
1730
1730
|
if (t.length === 0)
|
|
1731
1731
|
return !1;
|
|
1732
1732
|
const n = e.getJSON();
|
|
1733
1733
|
for (const r of t)
|
|
1734
|
-
if (!(r.type === "insertNode" ?
|
|
1734
|
+
if (!(r.type === "insertNode" ? Xt(e, r.payload) : r.type === "updateNodeAttrs" ? ze(e, r.payload) : r.type === "removeNode" ? Yt(e, r.payload) : Zt(e, r.payload)))
|
|
1735
1735
|
return e.commands.setContent(n), !1;
|
|
1736
1736
|
return !0;
|
|
1737
|
-
};
|
|
1738
|
-
let
|
|
1739
|
-
const
|
|
1740
|
-
let
|
|
1741
|
-
const
|
|
1742
|
-
let F = null,
|
|
1743
|
-
const
|
|
1744
|
-
function
|
|
1745
|
-
ne && (window.removeEventListener("message", ne), ne = null), F && (F.src = "about:blank", F.remove(), F = null),
|
|
1737
|
+
}, de = "https://draw.goatpatent.com";
|
|
1738
|
+
let Ne = 0;
|
|
1739
|
+
const Qe = [];
|
|
1740
|
+
let Ae = !1;
|
|
1741
|
+
const Pa = 2e4, yt = 6e4;
|
|
1742
|
+
let F = null, Me = !1, ne = null, pe = null;
|
|
1743
|
+
const et = /* @__PURE__ */ new Map();
|
|
1744
|
+
function bt() {
|
|
1745
|
+
ne && (window.removeEventListener("message", ne), ne = null), F && (F.src = "about:blank", F.remove(), F = null), Me = !1;
|
|
1746
1746
|
}
|
|
1747
|
-
function
|
|
1748
|
-
const n =
|
|
1747
|
+
function Da(e, t) {
|
|
1748
|
+
const n = et.get(e);
|
|
1749
1749
|
if (n) {
|
|
1750
1750
|
t(n);
|
|
1751
1751
|
return;
|
|
1752
1752
|
}
|
|
1753
|
-
|
|
1753
|
+
Qe.push({ xml: e, callback: t }), tt();
|
|
1754
1754
|
}
|
|
1755
|
-
function
|
|
1756
|
-
if (
|
|
1757
|
-
|
|
1758
|
-
const { xml: e, callback: t } =
|
|
1755
|
+
function tt() {
|
|
1756
|
+
if (Ae || Qe.length === 0) return;
|
|
1757
|
+
Ae = !0, pe && (clearTimeout(pe), pe = null);
|
|
1758
|
+
const { xml: e, callback: t } = Qe.shift(), n = et.get(e);
|
|
1759
1759
|
if (n) {
|
|
1760
|
-
t(n),
|
|
1760
|
+
t(n), Ae = !1, pe = setTimeout(bt, yt), tt();
|
|
1761
1761
|
return;
|
|
1762
1762
|
}
|
|
1763
1763
|
ne && (window.removeEventListener("message", ne), ne = null);
|
|
1764
1764
|
let r = null;
|
|
1765
1765
|
const a = (o) => {
|
|
1766
|
-
r && (clearTimeout(r), r = null), o &&
|
|
1766
|
+
r && (clearTimeout(r), r = null), o && et.set(e, o), t(o), Ae = !1, pe = setTimeout(bt, yt), tt();
|
|
1767
1767
|
}, i = () => {
|
|
1768
1768
|
var o;
|
|
1769
1769
|
(o = F.contentWindow) == null || o.postMessage(
|
|
1770
1770
|
JSON.stringify({ action: "load", autosave: 0, xml: e || "" }),
|
|
1771
|
-
|
|
1771
|
+
de
|
|
1772
1772
|
);
|
|
1773
1773
|
};
|
|
1774
1774
|
ne = (o) => {
|
|
@@ -1779,20 +1779,20 @@ function Qe() {
|
|
|
1779
1779
|
} catch {
|
|
1780
1780
|
return;
|
|
1781
1781
|
}
|
|
1782
|
-
c.event === "init" ? (
|
|
1782
|
+
c.event === "init" ? (Me = !0, i()) : c.event === "load" ? setTimeout(() => {
|
|
1783
1783
|
var s;
|
|
1784
1784
|
(s = F == null ? void 0 : F.contentWindow) == null || s.postMessage(
|
|
1785
1785
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1786
|
-
|
|
1786
|
+
de
|
|
1787
1787
|
);
|
|
1788
1788
|
}, 1500) : c.event === "export" && a(c.data || "");
|
|
1789
|
-
}, window.addEventListener("message", ne), r = setTimeout(() => a(""),
|
|
1789
|
+
}, window.addEventListener("message", ne), r = setTimeout(() => a(""), Pa), F ? Me && i() : (F = document.createElement("iframe"), F.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:1920px;height:1080px;opacity:0;pointer-events:none;", document.body.appendChild(F), Me = !1, F.src = `${de}/?embed=1&proto=json&spin=0&chrome=0`);
|
|
1790
1790
|
}
|
|
1791
|
-
const
|
|
1791
|
+
const Le = () => {
|
|
1792
1792
|
document.querySelectorAll('body > svg[id^="fig-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
|
|
1793
1793
|
(e.id.startsWith("dmermaid") || e.id.startsWith("dfi")) && e.remove();
|
|
1794
1794
|
}), document.querySelectorAll("body > #dmermaid-svg").forEach((e) => e.remove()), document.querySelectorAll("body > style[data-mermaid-style]").forEach((e) => e.remove());
|
|
1795
|
-
},
|
|
1795
|
+
}, Ra = Z.create({
|
|
1796
1796
|
name: "figure",
|
|
1797
1797
|
group: "block",
|
|
1798
1798
|
content: "inline*",
|
|
@@ -1887,22 +1887,22 @@ const Ae = () => {
|
|
|
1887
1887
|
var k;
|
|
1888
1888
|
l.classList.remove("figure-upload-area--dragover"), r.attrs.contentType === "image" && (S.preventDefault(), S.stopPropagation(), Q(((k = S.dataTransfer) == null ? void 0 : k.files) ?? null));
|
|
1889
1889
|
});
|
|
1890
|
-
const
|
|
1890
|
+
const gn = () => {
|
|
1891
1891
|
a || (a = !0, y.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", T.textContent = "", T.style.display = "none", J(), requestAnimationFrame(() => y.focus()));
|
|
1892
|
-
},
|
|
1892
|
+
}, fn = () => {
|
|
1893
1893
|
a = !1, J();
|
|
1894
|
-
},
|
|
1894
|
+
}, pn = async () => {
|
|
1895
1895
|
const S = y.value;
|
|
1896
1896
|
T.textContent = "", T.style.display = "none";
|
|
1897
1897
|
const k = S.trim();
|
|
1898
1898
|
if (k)
|
|
1899
1899
|
try {
|
|
1900
1900
|
const P = await import("mermaid");
|
|
1901
|
-
P.default.initialize({ startOnLoad: !1, theme: "default" }),
|
|
1902
|
-
const O = `fig-mermaid-${
|
|
1903
|
-
f.innerHTML = R,
|
|
1901
|
+
P.default.initialize({ startOnLoad: !1, theme: "default" }), Ne += 1;
|
|
1902
|
+
const O = `fig-mermaid-${Ne}`, { svg: R } = await P.default.render(O, k);
|
|
1903
|
+
f.innerHTML = R, Le();
|
|
1904
1904
|
} catch {
|
|
1905
|
-
|
|
1905
|
+
Le();
|
|
1906
1906
|
const P = I.getState().editorLanguage;
|
|
1907
1907
|
T.textContent = P === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", T.style.display = "inline";
|
|
1908
1908
|
return;
|
|
@@ -1910,16 +1910,16 @@ const Ae = () => {
|
|
|
1910
1910
|
z({ mermaidCode: S }), a = !1, J();
|
|
1911
1911
|
};
|
|
1912
1912
|
p.addEventListener("dblclick", (S) => {
|
|
1913
|
-
S.preventDefault(), S.stopPropagation(),
|
|
1913
|
+
S.preventDefault(), S.stopPropagation(), gn();
|
|
1914
1914
|
}), x.addEventListener("click", (S) => {
|
|
1915
|
-
S.stopPropagation(),
|
|
1915
|
+
S.stopPropagation(), pn();
|
|
1916
1916
|
}), w.addEventListener("click", (S) => {
|
|
1917
|
-
S.stopPropagation(),
|
|
1917
|
+
S.stopPropagation(), fn();
|
|
1918
1918
|
}), y.addEventListener("mousedown", (S) => S.stopPropagation()), y.addEventListener("keydown", (S) => S.stopPropagation()), y.addEventListener("keypress", (S) => S.stopPropagation());
|
|
1919
|
-
let ee = null,
|
|
1920
|
-
const
|
|
1919
|
+
let ee = null, G = null, U = null;
|
|
1920
|
+
const hn = () => {
|
|
1921
1921
|
if (i) return;
|
|
1922
|
-
i = !0, J(),
|
|
1922
|
+
i = !0, J(), G = document.createElement("div"), G.className = "drawio-modal-overlay";
|
|
1923
1923
|
const S = document.createElement("div");
|
|
1924
1924
|
S.className = "drawio-modal-content";
|
|
1925
1925
|
const k = document.createElement("div");
|
|
@@ -1927,12 +1927,12 @@ const Ae = () => {
|
|
|
1927
1927
|
const P = document.createElement("span"), O = I.getState().editorLanguage;
|
|
1928
1928
|
P.textContent = O === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", P.className = "drawio-modal-title";
|
|
1929
1929
|
const R = document.createElement("button");
|
|
1930
|
-
R.className = "drawio-modal-close-btn", R.textContent = "✕", R.type = "button", R.addEventListener("click", () =>
|
|
1931
|
-
const
|
|
1932
|
-
U.src =
|
|
1930
|
+
R.className = "drawio-modal-close-btn", R.textContent = "✕", R.type = "button", R.addEventListener("click", () => We()), k.append(P, R), U = document.createElement("iframe"), U.className = "drawio-modal-iframe", U.setAttribute("frameborder", "0"), S.append(k, U), G.appendChild(S), document.body.appendChild(G);
|
|
1931
|
+
const fe = O === "en" ? "en" : "zh";
|
|
1932
|
+
U.src = `${de}/?embed=1&proto=json&spin=1&lang=${fe}`;
|
|
1933
1933
|
const K = U;
|
|
1934
1934
|
ee = (X) => {
|
|
1935
|
-
var oe,
|
|
1935
|
+
var oe, Te;
|
|
1936
1936
|
if (!K || X.source !== K.contentWindow) return;
|
|
1937
1937
|
let W;
|
|
1938
1938
|
try {
|
|
@@ -1944,76 +1944,76 @@ const Ae = () => {
|
|
|
1944
1944
|
const ce = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
|
|
1945
1945
|
(oe = K.contentWindow) == null || oe.postMessage(
|
|
1946
1946
|
JSON.stringify({ action: "load", autosave: 0, xml: ce || "" }),
|
|
1947
|
-
|
|
1947
|
+
de
|
|
1948
1948
|
);
|
|
1949
1949
|
} else if (W.event === "save") {
|
|
1950
1950
|
const ce = W.xml || "";
|
|
1951
|
-
(
|
|
1951
|
+
(Te = K.contentWindow) == null || Te.postMessage(
|
|
1952
1952
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1953
|
-
|
|
1953
|
+
de
|
|
1954
1954
|
), z({ drawioXml: ce });
|
|
1955
1955
|
} else if (W.event === "export") {
|
|
1956
1956
|
const ce = W.data || "";
|
|
1957
|
-
z({ drawioSvg: ce }),
|
|
1958
|
-
} else W.event === "exit" &&
|
|
1957
|
+
z({ drawioSvg: ce }), We();
|
|
1958
|
+
} else W.event === "exit" && We();
|
|
1959
1959
|
}, window.addEventListener("message", ee);
|
|
1960
|
-
},
|
|
1961
|
-
i = !1, ee && (window.removeEventListener("message", ee), ee = null), U && (U.src = "about:blank", U = null),
|
|
1960
|
+
}, We = () => {
|
|
1961
|
+
i = !1, ee && (window.removeEventListener("message", ee), ee = null), U && (U.src = "about:blank", U = null), G && (G.remove(), G = null), J();
|
|
1962
1962
|
};
|
|
1963
1963
|
v.addEventListener("dblclick", (S) => {
|
|
1964
|
-
S.preventDefault(), S.stopPropagation(),
|
|
1964
|
+
S.preventDefault(), S.stopPropagation(), hn();
|
|
1965
1965
|
}), o.addEventListener("mousedown", (S) => {
|
|
1966
1966
|
const k = S.target;
|
|
1967
1967
|
if (!(k instanceof HTMLElement) || k === D || D.contains(k) || k === y || h.contains(k) || k === l || l.contains(k) || k === u || k === g || p.contains(k) || v.contains(k)) return;
|
|
1968
1968
|
const P = typeof n == "function" ? n() : null;
|
|
1969
1969
|
if (typeof P != "number") return;
|
|
1970
|
-
const O = P + r.nodeSize - 1, R =
|
|
1970
|
+
const O = P + r.nodeSize - 1, R = Zn.create(e.state.doc, O);
|
|
1971
1971
|
e.view.dispatch(e.state.tr.setSelection(R));
|
|
1972
1972
|
});
|
|
1973
|
-
let
|
|
1974
|
-
const
|
|
1975
|
-
let
|
|
1976
|
-
const
|
|
1973
|
+
let xe = !1, se = null, me = null, Ce = 0;
|
|
1974
|
+
const yn = 2, bn = 1500, vn = 3e3;
|
|
1975
|
+
let ge = "";
|
|
1976
|
+
const wn = async (S) => {
|
|
1977
1977
|
const k = S.trim();
|
|
1978
|
-
if (k !==
|
|
1978
|
+
if (k !== ge) {
|
|
1979
1979
|
if (!k) {
|
|
1980
|
-
f.innerHTML = "",
|
|
1980
|
+
f.innerHTML = "", ge = "";
|
|
1981
1981
|
return;
|
|
1982
1982
|
}
|
|
1983
1983
|
try {
|
|
1984
1984
|
const P = await import("mermaid");
|
|
1985
|
-
P.default.initialize({ startOnLoad: !1, theme: "default" }),
|
|
1986
|
-
const O = `fig-mermaid-${
|
|
1987
|
-
f.innerHTML = R,
|
|
1985
|
+
P.default.initialize({ startOnLoad: !1, theme: "default" }), Ne += 1;
|
|
1986
|
+
const O = `fig-mermaid-${Ne}`, { svg: R } = await P.default.render(O, k);
|
|
1987
|
+
f.innerHTML = R, ge = k;
|
|
1988
1988
|
} catch {
|
|
1989
|
-
f.innerHTML = "",
|
|
1989
|
+
f.innerHTML = "", ge = "";
|
|
1990
1990
|
} finally {
|
|
1991
|
-
|
|
1991
|
+
Le();
|
|
1992
1992
|
}
|
|
1993
1993
|
}
|
|
1994
1994
|
}, J = () => {
|
|
1995
|
-
const S = I.getState().editorLanguage, k = q(S), P = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", O = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", R = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "",
|
|
1995
|
+
const S = I.getState().editorLanguage, k = q(S), P = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", O = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", R = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", fe = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
|
|
1996
1996
|
O ? (A.textContent = `[${O}] `, A.style.display = "inline") : (A.textContent = "", A.style.display = "none");
|
|
1997
1997
|
const K = P === "image", X = P === "mermaid", W = P === "drawio";
|
|
1998
1998
|
s.style.display = K && R ? "block" : "none", l.style.display = K && !R ? "flex" : "none", u.style.display = K && R ? "block" : "none", p.style.display = X && !a ? "block" : "none", h.style.display = X && a ? "block" : "none", v.style.display = W ? "flex" : "none", K && R && (s.src = R);
|
|
1999
1999
|
const oe = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
|
|
2000
2000
|
W && (oe ? (_.src = oe, _.style.display = "block") : (_.src = "", _.style.display = "none")), d.textContent = k.figureUploadHint || "点击上传或拖拽图片", u.textContent = k.figureReplaceImage || "更换图片", x.textContent = k.mermaidSaveAndRender || "保存并渲染", w.textContent = k.mermaidCancel || "取消";
|
|
2001
|
-
const
|
|
2002
|
-
X && !a && (
|
|
2003
|
-
const
|
|
2004
|
-
W &&
|
|
2001
|
+
const Te = fe.trim().length > 0, ce = f.querySelector("svg") !== null;
|
|
2002
|
+
X && !a && (Te && ce ? (b.textContent = k.mermaidDoubleClickToEdit || "双击编辑", b.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (b.textContent = k.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", b.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), W && !i && (oe ? (C.textContent = k.mermaidDoubleClickToEdit || "双击编辑", C.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (C.textContent = k.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", C.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), X && !a && fe.trim() !== ge && wn(fe);
|
|
2003
|
+
const Cn = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
|
|
2004
|
+
W && Cn && !oe && !xe && !i && (se && clearTimeout(se), se = setTimeout(() => {
|
|
2005
2005
|
se = null;
|
|
2006
|
-
const
|
|
2007
|
-
!
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
},
|
|
2006
|
+
const lt = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "", Tn = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
|
|
2007
|
+
!lt || Tn || xe || (xe = !0, Da(lt, (dt) => {
|
|
2008
|
+
xe = !1, dt ? (Ce = 0, z({ drawioSvg: dt })) : Ce < yn && (Ce++, me = setTimeout(() => {
|
|
2009
|
+
me = null, J();
|
|
2010
|
+
}, vn * Ce));
|
|
2011
2011
|
}));
|
|
2012
|
-
},
|
|
2012
|
+
}, bn));
|
|
2013
2013
|
};
|
|
2014
|
-
let
|
|
2015
|
-
const
|
|
2016
|
-
S.editorLanguage !==
|
|
2014
|
+
let ct = I.getState().editorLanguage;
|
|
2015
|
+
const xn = I.subscribe((S) => {
|
|
2016
|
+
S.editorLanguage !== ct && (ct = S.editorLanguage, J());
|
|
2017
2017
|
});
|
|
2018
2018
|
return J(), {
|
|
2019
2019
|
dom: o,
|
|
@@ -2028,12 +2028,12 @@ const Ae = () => {
|
|
|
2028
2028
|
},
|
|
2029
2029
|
update: (S) => S.type.name !== "figure" ? !1 : (r = S, J(), !0),
|
|
2030
2030
|
destroy: () => {
|
|
2031
|
-
se && (clearTimeout(se), se = null),
|
|
2031
|
+
se && (clearTimeout(se), se = null), me && (clearTimeout(me), me = null), xn(), Le(), ee && (window.removeEventListener("message", ee), ee = null), U && (U.src = "about:blank", U = null), G && (G.remove(), G = null);
|
|
2032
2032
|
}
|
|
2033
2033
|
};
|
|
2034
2034
|
};
|
|
2035
2035
|
}
|
|
2036
|
-
}),
|
|
2036
|
+
}), Ma = Z.create({
|
|
2037
2037
|
name: "reference",
|
|
2038
2038
|
group: "inline",
|
|
2039
2039
|
inline: !0,
|
|
@@ -2119,7 +2119,7 @@ const Ae = () => {
|
|
|
2119
2119
|
};
|
|
2120
2120
|
};
|
|
2121
2121
|
}
|
|
2122
|
-
}),
|
|
2122
|
+
}), vt = {
|
|
2123
2123
|
technical_field: "sectionTitle_technical_field",
|
|
2124
2124
|
background_art: "sectionTitle_background_art",
|
|
2125
2125
|
summary: "sectionTitle_summary",
|
|
@@ -2134,7 +2134,7 @@ const Ae = () => {
|
|
|
2134
2134
|
design_description: "sectionTitle_design_description",
|
|
2135
2135
|
design_views: "sectionTitle_design_views",
|
|
2136
2136
|
design_brief: "sectionTitle_design_brief"
|
|
2137
|
-
},
|
|
2137
|
+
}, Fa = /* @__PURE__ */ new Set([
|
|
2138
2138
|
"abstract",
|
|
2139
2139
|
"abstract_drawing",
|
|
2140
2140
|
"claims",
|
|
@@ -2145,22 +2145,22 @@ const Ae = () => {
|
|
|
2145
2145
|
"design_description",
|
|
2146
2146
|
"design_views",
|
|
2147
2147
|
"design_brief"
|
|
2148
|
-
]),
|
|
2148
|
+
]), $a = /* @__PURE__ */ new Set([
|
|
2149
2149
|
"technical_field",
|
|
2150
2150
|
"background_art",
|
|
2151
2151
|
"summary",
|
|
2152
2152
|
"drawing_description",
|
|
2153
2153
|
"detailed_description"
|
|
2154
|
-
]),
|
|
2154
|
+
]), st = (e) => {
|
|
2155
2155
|
if (e.isText)
|
|
2156
2156
|
return (e.text ?? "").trim().length > 0;
|
|
2157
2157
|
if (e.isAtom || e.isLeaf || !["patent_section", "patent_title", "paragraph"].includes(e.type.name))
|
|
2158
2158
|
return !0;
|
|
2159
2159
|
let t = !1;
|
|
2160
2160
|
return e.forEach((n) => {
|
|
2161
|
-
!t &&
|
|
2161
|
+
!t && st(n) && (t = !0);
|
|
2162
2162
|
}), t;
|
|
2163
|
-
},
|
|
2163
|
+
}, za = Z.create({
|
|
2164
2164
|
name: "patent_title",
|
|
2165
2165
|
group: "block",
|
|
2166
2166
|
content: "inline*",
|
|
@@ -2205,7 +2205,7 @@ const Ae = () => {
|
|
|
2205
2205
|
const g = () => {
|
|
2206
2206
|
const b = I.getState(), h = q(b.editorLanguage), y = typeof h.bookTitle_description == "string" ? h.bookTitle_description : "说明书", E = typeof h.patentTitlePlaceholder == "string" ? h.patentTitlePlaceholder : "专利名称";
|
|
2207
2207
|
i.textContent = y;
|
|
2208
|
-
const x =
|
|
2208
|
+
const x = st(r), w = b.rightPanel.activeSectionPos === s();
|
|
2209
2209
|
o.textContent = `[${E}]`, o.style.display = x ? "none" : "", o.classList.toggle("ps-placeholder--active", w && !x), c.classList.toggle("pt-title-content--has-content", x);
|
|
2210
2210
|
};
|
|
2211
2211
|
let u = I.getState().editorLanguage, p = I.getState().rightPanel.activeSectionPos;
|
|
@@ -2223,7 +2223,7 @@ const Ae = () => {
|
|
|
2223
2223
|
};
|
|
2224
2224
|
};
|
|
2225
2225
|
}
|
|
2226
|
-
}),
|
|
2226
|
+
}), Oa = Z.create({
|
|
2227
2227
|
name: "patent_section",
|
|
2228
2228
|
group: "block",
|
|
2229
2229
|
content: "block+",
|
|
@@ -2255,15 +2255,15 @@ const Ae = () => {
|
|
|
2255
2255
|
const n = [];
|
|
2256
2256
|
return t.forEach((r) => {
|
|
2257
2257
|
r.type.name === "patent_section" || r.type.name === "patent_title" ? e(r.content).forEach((i) => n.push(i)) : r.isBlock && r.content.size > 0 ? n.push(r.copy(e(r.content))) : n.push(r);
|
|
2258
|
-
}),
|
|
2258
|
+
}), hr.from(n);
|
|
2259
2259
|
};
|
|
2260
2260
|
return [
|
|
2261
|
-
new
|
|
2262
|
-
key: new
|
|
2261
|
+
new Be({
|
|
2262
|
+
key: new we("patentSectionLock"),
|
|
2263
2263
|
props: {
|
|
2264
2264
|
transformPasted: (t) => {
|
|
2265
2265
|
const n = e(t.content);
|
|
2266
|
-
return new
|
|
2266
|
+
return new pr(n, t.openStart, t.openEnd);
|
|
2267
2267
|
}
|
|
2268
2268
|
},
|
|
2269
2269
|
filterTransaction: (t, n) => {
|
|
@@ -2308,7 +2308,7 @@ const Ae = () => {
|
|
|
2308
2308
|
};
|
|
2309
2309
|
c.addEventListener("click", g), s.addEventListener("focusin", d), s.addEventListener("click", d);
|
|
2310
2310
|
const u = () => {
|
|
2311
|
-
const h = I.getState(), y = q(h.editorLanguage), E = Object.keys(
|
|
2311
|
+
const h = I.getState(), y = q(h.editorLanguage), E = Object.keys(vt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", x = Fa.has(E), w = $a.has(E), T = vt[E], v = typeof y[T] == "string" ? y[T] : E, _ = st(r), C = h.rightPanel.activeSectionPos === l();
|
|
2312
2312
|
a.className = `ps${_ ? "" : " ps--empty"}${w ? " ps--sub" : ""}`, a.setAttribute("data-section-type", E), i.className = x ? "pb-heading" : "ps-heading ps-heading--sub", i.textContent = v, c.textContent = `[${v}]`, c.style.display = _ ? "none" : "", c.classList.toggle("ps-placeholder--active", C && !_), s.classList.toggle("ps-content--has-content", _);
|
|
2313
2313
|
};
|
|
2314
2314
|
let p = I.getState().editorLanguage, f = I.getState().rightPanel.activeSectionPos;
|
|
@@ -2326,27 +2326,27 @@ const Ae = () => {
|
|
|
2326
2326
|
};
|
|
2327
2327
|
};
|
|
2328
2328
|
}
|
|
2329
|
-
}),
|
|
2329
|
+
}), Ba = [
|
|
2330
2330
|
"abstract",
|
|
2331
2331
|
// 说明书摘要
|
|
2332
2332
|
"abstract_drawing"
|
|
2333
2333
|
// 摘要附图
|
|
2334
|
-
],
|
|
2334
|
+
], Ha = [
|
|
2335
2335
|
"technical_field",
|
|
2336
2336
|
"background_art",
|
|
2337
2337
|
"summary",
|
|
2338
2338
|
"drawing_description",
|
|
2339
2339
|
"detailed_description"
|
|
2340
|
-
],
|
|
2340
|
+
], qa = [
|
|
2341
2341
|
"drawing_figures"
|
|
2342
2342
|
// 说明书附图
|
|
2343
|
-
],
|
|
2343
|
+
], Ua = [
|
|
2344
2344
|
"design_product_name",
|
|
2345
2345
|
"design_usage",
|
|
2346
2346
|
"design_description",
|
|
2347
2347
|
"design_views",
|
|
2348
2348
|
"design_brief"
|
|
2349
|
-
],
|
|
2349
|
+
], Fe = (e) => ({
|
|
2350
2350
|
type: "patent_section",
|
|
2351
2351
|
attrs: {
|
|
2352
2352
|
sectionType: e,
|
|
@@ -2357,35 +2357,35 @@ const Ae = () => {
|
|
|
2357
2357
|
type: "paragraph"
|
|
2358
2358
|
}
|
|
2359
2359
|
]
|
|
2360
|
-
}),
|
|
2360
|
+
}), Qt = () => ({
|
|
2361
2361
|
type: "patent_title",
|
|
2362
2362
|
content: []
|
|
2363
|
-
}),
|
|
2364
|
-
...
|
|
2365
|
-
|
|
2366
|
-
...
|
|
2367
|
-
...
|
|
2368
|
-
],
|
|
2369
|
-
|
|
2370
|
-
...
|
|
2371
|
-
],
|
|
2363
|
+
}), Wa = () => [
|
|
2364
|
+
...Ba.map(Fe),
|
|
2365
|
+
Qt(),
|
|
2366
|
+
...Ha.map(Fe),
|
|
2367
|
+
...qa.map(Fe)
|
|
2368
|
+
], ja = () => [
|
|
2369
|
+
Qt(),
|
|
2370
|
+
...Ua.map(Fe)
|
|
2371
|
+
], en = (e = "invention") => ({ type: "doc", content: e === "design" ? ja() : Wa() }), ve = (e) => Kt(e, (t) => t.type.name === "figure"), V = (e) => typeof e != "string" ? "" : e.trim(), wt = (e) => {
|
|
2372
2372
|
const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
|
|
2373
|
-
|
|
2374
|
-
const o =
|
|
2373
|
+
ve(e).forEach((i) => {
|
|
2374
|
+
const o = V(i.node.attrs.id);
|
|
2375
2375
|
o && r.add(o);
|
|
2376
2376
|
});
|
|
2377
2377
|
let a = 1;
|
|
2378
2378
|
for (; r.has(`${n}${a}`); )
|
|
2379
2379
|
a += 1;
|
|
2380
2380
|
return `${n}${a}`;
|
|
2381
|
-
},
|
|
2382
|
-
const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r =
|
|
2381
|
+
}, Ga = /^(Fig\.|图)(\d+)$/, Va = (e) => {
|
|
2382
|
+
const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r = ve(e);
|
|
2383
2383
|
if (r.length === 0) return;
|
|
2384
2384
|
const a = [];
|
|
2385
2385
|
let i = 1;
|
|
2386
2386
|
for (const c of r) {
|
|
2387
|
-
const s =
|
|
2388
|
-
if (!
|
|
2387
|
+
const s = V(c.node.attrs.id);
|
|
2388
|
+
if (!Ga.exec(s)) continue;
|
|
2389
2389
|
const d = `${n}${i}`;
|
|
2390
2390
|
s !== d && a.push({ pos: c.pos, expectedId: d, currentId: s }), i++;
|
|
2391
2391
|
}
|
|
@@ -2396,26 +2396,26 @@ const Ae = () => {
|
|
|
2396
2396
|
!s || s.type.name !== "figure" || o.setNodeMarkup(c.pos, void 0, { ...s.attrs, id: c.expectedId });
|
|
2397
2397
|
}
|
|
2398
2398
|
o.steps.length > 0 && (o.setMeta("addToHistory", !1), e.view.dispatch(o));
|
|
2399
|
-
},
|
|
2399
|
+
}, tn = (e) => {
|
|
2400
2400
|
const t = /* @__PURE__ */ new Map();
|
|
2401
|
-
return
|
|
2402
|
-
const r =
|
|
2401
|
+
return ve(e).forEach((n) => {
|
|
2402
|
+
const r = V(n.node.attrs.id);
|
|
2403
2403
|
r && t.set(r, {
|
|
2404
2404
|
id: r,
|
|
2405
2405
|
pos: n.pos
|
|
2406
2406
|
});
|
|
2407
2407
|
}), t;
|
|
2408
|
-
},
|
|
2408
|
+
}, nn = () => I.getState().editorLanguage === "en" ? "en" : "zh", rn = (e, t, n) => {
|
|
2409
2409
|
const r = q(e);
|
|
2410
2410
|
return n ? r.invalidFigureReference : t || (e === "en" ? "Figure ?" : "附图?");
|
|
2411
|
-
},
|
|
2412
|
-
const t =
|
|
2411
|
+
}, Je = (e) => {
|
|
2412
|
+
const t = tn(e), n = nn();
|
|
2413
2413
|
e.commands.command(({ tr: r, state: a, dispatch: i }) => {
|
|
2414
2414
|
let o = !1;
|
|
2415
2415
|
return a.doc.descendants((c, s) => {
|
|
2416
2416
|
if (c.type.name !== "reference" || c.attrs.targetType !== "figure")
|
|
2417
2417
|
return !0;
|
|
2418
|
-
const l = typeof c.attrs.targetFigureId == "string" && c.attrs.targetFigureId ?
|
|
2418
|
+
const l = typeof c.attrs.targetFigureId == "string" && c.attrs.targetFigureId ? V(c.attrs.targetFigureId) : null, d = l ? t.get(l) : void 0, g = d ? d.id : null, u = !d, p = rn(n, g, u), f = {
|
|
2419
2419
|
...c.attrs,
|
|
2420
2420
|
targetType: "figure",
|
|
2421
2421
|
targetFigureId: l,
|
|
@@ -2430,10 +2430,10 @@ const Ae = () => {
|
|
|
2430
2430
|
) && (r.setNodeMarkup(s, void 0, f), o = !0), !0;
|
|
2431
2431
|
}), o && i && i(r), !0;
|
|
2432
2432
|
});
|
|
2433
|
-
},
|
|
2433
|
+
}, Ja = {
|
|
2434
2434
|
name: "patent",
|
|
2435
2435
|
version: "1.0.0",
|
|
2436
|
-
extensions: [
|
|
2436
|
+
extensions: [Ra, Ma, za, Oa],
|
|
2437
2437
|
toolbarItems: [
|
|
2438
2438
|
{
|
|
2439
2439
|
id: "patent-figure-insert",
|
|
@@ -2456,14 +2456,14 @@ const Ae = () => {
|
|
|
2456
2456
|
return !1;
|
|
2457
2457
|
const r = n.lang === "en" ? "en" : "zh";
|
|
2458
2458
|
I.getState().setEditorLanguage(r);
|
|
2459
|
-
const i = (n.scope || "all") === "current" ?
|
|
2459
|
+
const i = (n.scope || "all") === "current" ? Re(e, "reference") : null;
|
|
2460
2460
|
return e.commands.command(({ tr: c, state: s, dispatch: l }) => {
|
|
2461
2461
|
let d = !1;
|
|
2462
2462
|
return s.doc.descendants((g, u) => (g.type.name !== "reference" || i && u !== i.pos || g.attrs.lang !== r && (c.setNodeMarkup(u, void 0, {
|
|
2463
2463
|
...g.attrs,
|
|
2464
2464
|
lang: r
|
|
2465
2465
|
}), d = !0), !0)), d && l && l(c), !0;
|
|
2466
|
-
}) ? (
|
|
2466
|
+
}) ? (Je(e), !0) : !1;
|
|
2467
2467
|
}
|
|
2468
2468
|
},
|
|
2469
2469
|
insertFigure: {
|
|
@@ -2472,7 +2472,7 @@ const Ae = () => {
|
|
|
2472
2472
|
shortcut: "Ctrl+Shift+F",
|
|
2473
2473
|
isActive: ({ editor: e }) => e.isActive("figure"),
|
|
2474
2474
|
execute: ({ editor: e }, t) => {
|
|
2475
|
-
const n = typeof t == "object" && t ? t : {}, r =
|
|
2475
|
+
const n = typeof t == "object" && t ? t : {}, r = V(n.id) || wt(e), a = n.contentType && ["image", "mermaid", "drawio"].includes(n.contentType) ? n.contentType : "image";
|
|
2476
2476
|
return e.chain().focus().insertContent({
|
|
2477
2477
|
type: "figure",
|
|
2478
2478
|
attrs: { id: r, contentType: a, imageSrc: "", mermaidCode: "", drawioXml: "" },
|
|
@@ -2484,17 +2484,17 @@ const Ae = () => {
|
|
|
2484
2484
|
description: "Update figure attributes",
|
|
2485
2485
|
category: "patent",
|
|
2486
2486
|
execute: ({ editor: e }, t) => {
|
|
2487
|
-
const n = typeof t == "object" && t ? t : {}, r =
|
|
2487
|
+
const n = typeof t == "object" && t ? t : {}, r = Re(e, "figure"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
|
|
2488
2488
|
if (typeof a != "number")
|
|
2489
2489
|
return !1;
|
|
2490
2490
|
const i = e.state.doc.nodeAt(a);
|
|
2491
2491
|
if (!i || i.type.name !== "figure")
|
|
2492
2492
|
return !1;
|
|
2493
|
-
const c = (typeof n.id == "string" ?
|
|
2494
|
-
if (
|
|
2493
|
+
const c = (typeof n.id == "string" ? V(n.id) : V(i.attrs.id)) || wt(e);
|
|
2494
|
+
if (ve(e).some((d) => d.pos === a ? !1 : V(d.node.attrs.id) === c))
|
|
2495
2495
|
return !1;
|
|
2496
2496
|
const l = { id: c };
|
|
2497
|
-
return typeof n.contentType == "string" && ["image", "mermaid", "drawio"].includes(n.contentType) && (l.contentType = n.contentType), typeof n.imageSrc == "string" && (l.imageSrc = n.imageSrc), typeof n.mermaidCode == "string" && (l.mermaidCode = n.mermaidCode), typeof n.drawioXml == "string" && (l.drawioXml = n.drawioXml),
|
|
2497
|
+
return typeof n.contentType == "string" && ["image", "mermaid", "drawio"].includes(n.contentType) && (l.contentType = n.contentType), typeof n.imageSrc == "string" && (l.imageSrc = n.imageSrc), typeof n.mermaidCode == "string" && (l.mermaidCode = n.mermaidCode), typeof n.drawioXml == "string" && (l.drawioXml = n.drawioXml), ze(e, {
|
|
2498
2498
|
type: "figure",
|
|
2499
2499
|
position: a,
|
|
2500
2500
|
attrs: l
|
|
@@ -2507,8 +2507,8 @@ const Ae = () => {
|
|
|
2507
2507
|
execute: ({ editor: e }) => {
|
|
2508
2508
|
const t = /* @__PURE__ */ new Set();
|
|
2509
2509
|
let n = !1;
|
|
2510
|
-
return
|
|
2511
|
-
const a =
|
|
2510
|
+
return ve(e).forEach((r) => {
|
|
2511
|
+
const a = V(r.node.attrs.id);
|
|
2512
2512
|
if (a) {
|
|
2513
2513
|
if (t.has(a)) {
|
|
2514
2514
|
n = !0;
|
|
@@ -2531,13 +2531,13 @@ const Ae = () => {
|
|
|
2531
2531
|
return typeof n.targetFigureId == "string" && n.targetFigureId.trim().length > 0;
|
|
2532
2532
|
},
|
|
2533
2533
|
execute: ({ editor: e }, t) => {
|
|
2534
|
-
const n = typeof t == "object" && t ? t : {}, r =
|
|
2534
|
+
const n = typeof t == "object" && t ? t : {}, r = tn(e), a = typeof n.targetFigureId == "string" ? V(n.targetFigureId) : "";
|
|
2535
2535
|
if (!a)
|
|
2536
2536
|
return !1;
|
|
2537
2537
|
const i = r.get(a);
|
|
2538
2538
|
if (!i)
|
|
2539
2539
|
return !1;
|
|
2540
|
-
const o = n.lang ||
|
|
2540
|
+
const o = n.lang || nn(), c = n.displayText || rn(o, i.id, !1);
|
|
2541
2541
|
return e.chain().focus().insertContent({
|
|
2542
2542
|
type: "reference",
|
|
2543
2543
|
attrs: {
|
|
@@ -2552,14 +2552,14 @@ const Ae = () => {
|
|
|
2552
2552
|
target: n.target || i.id,
|
|
2553
2553
|
highlight: !1
|
|
2554
2554
|
}
|
|
2555
|
-
}).run() ? (
|
|
2555
|
+
}).run() ? (Je(e), !0) : !1;
|
|
2556
2556
|
}
|
|
2557
2557
|
},
|
|
2558
2558
|
insertPatentDocument: {
|
|
2559
2559
|
description: "Insert patent document skeleton with all sections",
|
|
2560
2560
|
category: "patent",
|
|
2561
2561
|
execute: ({ editor: e }, t) => {
|
|
2562
|
-
const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a =
|
|
2562
|
+
const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a = en(r);
|
|
2563
2563
|
return e.commands.setContent(a);
|
|
2564
2564
|
}
|
|
2565
2565
|
},
|
|
@@ -2567,10 +2567,10 @@ const Ae = () => {
|
|
|
2567
2567
|
description: "Toggle patent section collapse state",
|
|
2568
2568
|
category: "patent",
|
|
2569
2569
|
execute: ({ editor: e }, t) => {
|
|
2570
|
-
const n = typeof t == "object" && t ? t : {}, r =
|
|
2570
|
+
const n = typeof t == "object" && t ? t : {}, r = Re(e, "patent_section"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
|
|
2571
2571
|
if (typeof a != "number") return !1;
|
|
2572
2572
|
const i = e.state.doc.nodeAt(a);
|
|
2573
|
-
return !i || i.type.name !== "patent_section" ? !1 :
|
|
2573
|
+
return !i || i.type.name !== "patent_section" ? !1 : ze(e, {
|
|
2574
2574
|
type: "patent_section",
|
|
2575
2575
|
position: a,
|
|
2576
2576
|
attrs: { collapsed: !i.attrs.collapsed }
|
|
@@ -2579,13 +2579,13 @@ const Ae = () => {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
},
|
|
2581
2581
|
onStateChange: (e) => {
|
|
2582
|
-
|
|
2582
|
+
Va(e), Je(e);
|
|
2583
2583
|
}
|
|
2584
|
-
},
|
|
2585
|
-
|
|
2586
|
-
const
|
|
2584
|
+
}, Ka = [Ca, Sa, _a, Ja];
|
|
2585
|
+
Ka.forEach((e) => B.register(e));
|
|
2586
|
+
const Xa = (e = {}) => {
|
|
2587
2587
|
const t = [
|
|
2588
|
-
...
|
|
2588
|
+
...ba,
|
|
2589
2589
|
...B.getExtensions(),
|
|
2590
2590
|
...e.extensions || []
|
|
2591
2591
|
];
|
|
@@ -2593,41 +2593,41 @@ const Ja = (e = {}) => {
|
|
|
2593
2593
|
...e,
|
|
2594
2594
|
extensions: t
|
|
2595
2595
|
};
|
|
2596
|
-
},
|
|
2596
|
+
}, Ke = (e) => {
|
|
2597
2597
|
const { from: t, to: n } = e.state.selection;
|
|
2598
2598
|
return {
|
|
2599
2599
|
editor: e,
|
|
2600
2600
|
selection: { from: t, to: n },
|
|
2601
2601
|
store: I.getState()
|
|
2602
2602
|
};
|
|
2603
|
-
},
|
|
2604
|
-
execCommand: (t, n, r) => B.executeCommand(t,
|
|
2605
|
-
canExecCommand: (t, n) => B.canExecuteCommand(t,
|
|
2606
|
-
isCommandActive: (t) => B.isCommandActive(t,
|
|
2603
|
+
}, ot = (e) => ({
|
|
2604
|
+
execCommand: (t, n, r) => B.executeCommand(t, Ke(e), n, r),
|
|
2605
|
+
canExecCommand: (t, n) => B.canExecuteCommand(t, Ke(e), n),
|
|
2606
|
+
isCommandActive: (t) => B.isCommandActive(t, Ke(e)),
|
|
2607
2607
|
listCommands: () => B.getCommandNames(),
|
|
2608
|
-
insertNode: (t) =>
|
|
2609
|
-
updateNodeAttrs: (t) =>
|
|
2610
|
-
removeNode: (t) =>
|
|
2611
|
-
wrapSelection: (t) =>
|
|
2612
|
-
applyTransactionBatch: (t) =>
|
|
2613
|
-
findNodeByType: (t, n) =>
|
|
2614
|
-
findAncestorNode: (t) =>
|
|
2615
|
-
findCurrentBlock: () =>
|
|
2616
|
-
findNodesByPredicate: (t, n) =>
|
|
2617
|
-
}),
|
|
2608
|
+
insertNode: (t) => Xt(e, t),
|
|
2609
|
+
updateNodeAttrs: (t) => ze(e, t),
|
|
2610
|
+
removeNode: (t) => Yt(e, t),
|
|
2611
|
+
wrapSelection: (t) => Zt(e, t),
|
|
2612
|
+
applyTransactionBatch: (t) => La(e, t),
|
|
2613
|
+
findNodeByType: (t, n) => it(e, t, n),
|
|
2614
|
+
findAncestorNode: (t) => Re(e, t),
|
|
2615
|
+
findCurrentBlock: () => Ia(e),
|
|
2616
|
+
findNodesByPredicate: (t, n) => Kt(e, t, n)
|
|
2617
|
+
}), Ya = ["history", "text", "structure", "format", "technical", "patent"], Za = {
|
|
2618
2618
|
history: "groupHistory",
|
|
2619
2619
|
text: "groupText",
|
|
2620
2620
|
structure: "groupStructure",
|
|
2621
2621
|
format: "groupFormat",
|
|
2622
2622
|
technical: "groupTechnical",
|
|
2623
2623
|
patent: "groupPatent"
|
|
2624
|
-
},
|
|
2624
|
+
}, Xe = (e, t) => {
|
|
2625
2625
|
if (t) {
|
|
2626
|
-
const n =
|
|
2626
|
+
const n = Za[e];
|
|
2627
2627
|
if (n && typeof t[n] == "string") return t[n];
|
|
2628
2628
|
}
|
|
2629
2629
|
return e.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ");
|
|
2630
|
-
},
|
|
2630
|
+
}, xt = ({ btn: e, items: t }) => {
|
|
2631
2631
|
const [n, r] = $(!1), a = j(null), i = j(null), [o, c] = $({ top: 0, left: 0 }), s = ae(() => {
|
|
2632
2632
|
if (!a.current) return;
|
|
2633
2633
|
const l = a.current.getBoundingClientRect();
|
|
@@ -2669,10 +2669,10 @@ const Ja = (e = {}) => {
|
|
|
2669
2669
|
e.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200 text-gray-500"
|
|
2670
2670
|
),
|
|
2671
2671
|
disabled: e.disabled,
|
|
2672
|
-
children: /* @__PURE__ */ m(
|
|
2672
|
+
children: /* @__PURE__ */ m(qt, { size: 12 })
|
|
2673
2673
|
}
|
|
2674
2674
|
),
|
|
2675
|
-
n &&
|
|
2675
|
+
n && yr(
|
|
2676
2676
|
/* @__PURE__ */ m(
|
|
2677
2677
|
"div",
|
|
2678
2678
|
{
|
|
@@ -2695,21 +2695,21 @@ const Ja = (e = {}) => {
|
|
|
2695
2695
|
document.body
|
|
2696
2696
|
)
|
|
2697
2697
|
] });
|
|
2698
|
-
},
|
|
2698
|
+
}, Qa = ({
|
|
2699
2699
|
editor: e,
|
|
2700
|
-
groupOrder: t =
|
|
2700
|
+
groupOrder: t = Ya,
|
|
2701
2701
|
collapsibleGroups: n = !0,
|
|
2702
2702
|
defaultCollapsedGroups: r = []
|
|
2703
2703
|
}) => {
|
|
2704
2704
|
const [a, i] = $(() => new Set(r)), { editorLanguage: o, setEditorLanguage: c } = I(), s = q(o);
|
|
2705
2705
|
if (!e)
|
|
2706
2706
|
return null;
|
|
2707
|
-
const l =
|
|
2707
|
+
const l = ot(e), d = o === "zh", g = [
|
|
2708
2708
|
{
|
|
2709
2709
|
id: "core-undo",
|
|
2710
2710
|
label: s.undo,
|
|
2711
2711
|
group: "history",
|
|
2712
|
-
icon:
|
|
2712
|
+
icon: br,
|
|
2713
2713
|
tooltip: `${s.undo} (Ctrl+Z)`,
|
|
2714
2714
|
isActive: !1,
|
|
2715
2715
|
disabled: !e.can().chain().focus().undo().run(),
|
|
@@ -2721,7 +2721,7 @@ const Ja = (e = {}) => {
|
|
|
2721
2721
|
id: "core-redo",
|
|
2722
2722
|
label: s.redo,
|
|
2723
2723
|
group: "history",
|
|
2724
|
-
icon:
|
|
2724
|
+
icon: vr,
|
|
2725
2725
|
tooltip: `${s.redo} (Ctrl+Y)`,
|
|
2726
2726
|
isActive: !1,
|
|
2727
2727
|
disabled: !e.can().chain().focus().redo().run(),
|
|
@@ -2733,7 +2733,7 @@ const Ja = (e = {}) => {
|
|
|
2733
2733
|
id: "core-bold",
|
|
2734
2734
|
label: s.bold,
|
|
2735
2735
|
group: "text",
|
|
2736
|
-
icon:
|
|
2736
|
+
icon: Pt,
|
|
2737
2737
|
tooltip: s.bold,
|
|
2738
2738
|
isActive: e.isActive("bold"),
|
|
2739
2739
|
disabled: !1,
|
|
@@ -2745,7 +2745,7 @@ const Ja = (e = {}) => {
|
|
|
2745
2745
|
id: "core-italic",
|
|
2746
2746
|
label: s.italic,
|
|
2747
2747
|
group: "text",
|
|
2748
|
-
icon:
|
|
2748
|
+
icon: Dt,
|
|
2749
2749
|
tooltip: s.italic,
|
|
2750
2750
|
isActive: e.isActive("italic"),
|
|
2751
2751
|
disabled: !1,
|
|
@@ -2757,7 +2757,7 @@ const Ja = (e = {}) => {
|
|
|
2757
2757
|
id: "core-underline",
|
|
2758
2758
|
label: s.underline,
|
|
2759
2759
|
group: "text",
|
|
2760
|
-
icon:
|
|
2760
|
+
icon: Rt,
|
|
2761
2761
|
tooltip: s.underline,
|
|
2762
2762
|
isActive: e.isActive("underline"),
|
|
2763
2763
|
disabled: !1,
|
|
@@ -2769,7 +2769,7 @@ const Ja = (e = {}) => {
|
|
|
2769
2769
|
id: "core-strike",
|
|
2770
2770
|
label: s.strike,
|
|
2771
2771
|
group: "text",
|
|
2772
|
-
icon:
|
|
2772
|
+
icon: Mt,
|
|
2773
2773
|
tooltip: s.strike,
|
|
2774
2774
|
isActive: e.isActive("strike"),
|
|
2775
2775
|
disabled: !1,
|
|
@@ -2781,7 +2781,7 @@ const Ja = (e = {}) => {
|
|
|
2781
2781
|
id: "core-code",
|
|
2782
2782
|
label: s.code,
|
|
2783
2783
|
group: "text",
|
|
2784
|
-
icon:
|
|
2784
|
+
icon: Ft,
|
|
2785
2785
|
tooltip: s.code,
|
|
2786
2786
|
isActive: e.isActive("code"),
|
|
2787
2787
|
disabled: !1,
|
|
@@ -2793,7 +2793,7 @@ const Ja = (e = {}) => {
|
|
|
2793
2793
|
id: "core-superscript",
|
|
2794
2794
|
label: s.superscript,
|
|
2795
2795
|
group: "text",
|
|
2796
|
-
icon:
|
|
2796
|
+
icon: $t,
|
|
2797
2797
|
tooltip: `${s.superscript} (Ctrl+.)`,
|
|
2798
2798
|
isActive: e.isActive("superscript"),
|
|
2799
2799
|
disabled: !1,
|
|
@@ -2805,7 +2805,7 @@ const Ja = (e = {}) => {
|
|
|
2805
2805
|
id: "core-subscript",
|
|
2806
2806
|
label: s.subscript,
|
|
2807
2807
|
group: "text",
|
|
2808
|
-
icon:
|
|
2808
|
+
icon: zt,
|
|
2809
2809
|
tooltip: `${s.subscript} (Ctrl+,)`,
|
|
2810
2810
|
isActive: e.isActive("subscript"),
|
|
2811
2811
|
disabled: !1,
|
|
@@ -2817,7 +2817,7 @@ const Ja = (e = {}) => {
|
|
|
2817
2817
|
id: "core-paragraph",
|
|
2818
2818
|
label: s.paragraph,
|
|
2819
2819
|
group: "structure",
|
|
2820
|
-
icon:
|
|
2820
|
+
icon: wr,
|
|
2821
2821
|
tooltip: s.paragraph,
|
|
2822
2822
|
isActive: e.isActive("paragraph"),
|
|
2823
2823
|
disabled: !1,
|
|
@@ -2829,7 +2829,7 @@ const Ja = (e = {}) => {
|
|
|
2829
2829
|
id: "core-heading1",
|
|
2830
2830
|
label: "H1",
|
|
2831
2831
|
group: "structure",
|
|
2832
|
-
icon:
|
|
2832
|
+
icon: xr,
|
|
2833
2833
|
tooltip: s.heading1,
|
|
2834
2834
|
isActive: e.isActive("heading", { level: 1 }),
|
|
2835
2835
|
disabled: !1,
|
|
@@ -2841,7 +2841,7 @@ const Ja = (e = {}) => {
|
|
|
2841
2841
|
id: "core-heading2",
|
|
2842
2842
|
label: "H2",
|
|
2843
2843
|
group: "structure",
|
|
2844
|
-
icon:
|
|
2844
|
+
icon: Cr,
|
|
2845
2845
|
tooltip: s.heading2,
|
|
2846
2846
|
isActive: e.isActive("heading", { level: 2 }),
|
|
2847
2847
|
disabled: !1,
|
|
@@ -2853,7 +2853,7 @@ const Ja = (e = {}) => {
|
|
|
2853
2853
|
id: "core-heading3",
|
|
2854
2854
|
label: "H3",
|
|
2855
2855
|
group: "structure",
|
|
2856
|
-
icon:
|
|
2856
|
+
icon: Tr,
|
|
2857
2857
|
tooltip: s.heading3,
|
|
2858
2858
|
isActive: e.isActive("heading", { level: 3 }),
|
|
2859
2859
|
disabled: !1,
|
|
@@ -2865,7 +2865,7 @@ const Ja = (e = {}) => {
|
|
|
2865
2865
|
id: "core-align-left",
|
|
2866
2866
|
label: s.alignLeft,
|
|
2867
2867
|
group: "format",
|
|
2868
|
-
icon:
|
|
2868
|
+
icon: Sr,
|
|
2869
2869
|
tooltip: s.alignLeft,
|
|
2870
2870
|
isActive: e.isActive({ textAlign: "left" }),
|
|
2871
2871
|
disabled: !1,
|
|
@@ -2877,7 +2877,7 @@ const Ja = (e = {}) => {
|
|
|
2877
2877
|
id: "core-align-center",
|
|
2878
2878
|
label: s.alignCenter,
|
|
2879
2879
|
group: "format",
|
|
2880
|
-
icon:
|
|
2880
|
+
icon: Er,
|
|
2881
2881
|
tooltip: s.alignCenter,
|
|
2882
2882
|
isActive: e.isActive({ textAlign: "center" }),
|
|
2883
2883
|
disabled: !1,
|
|
@@ -2889,7 +2889,7 @@ const Ja = (e = {}) => {
|
|
|
2889
2889
|
id: "core-align-right",
|
|
2890
2890
|
label: s.alignRight,
|
|
2891
2891
|
group: "format",
|
|
2892
|
-
icon:
|
|
2892
|
+
icon: kr,
|
|
2893
2893
|
tooltip: s.alignRight,
|
|
2894
2894
|
isActive: e.isActive({ textAlign: "right" }),
|
|
2895
2895
|
disabled: !1,
|
|
@@ -2901,7 +2901,7 @@ const Ja = (e = {}) => {
|
|
|
2901
2901
|
id: "core-align-justify",
|
|
2902
2902
|
label: s.alignJustify,
|
|
2903
2903
|
group: "format",
|
|
2904
|
-
icon:
|
|
2904
|
+
icon: _r,
|
|
2905
2905
|
tooltip: s.alignJustify,
|
|
2906
2906
|
isActive: e.isActive({ textAlign: "justify" }),
|
|
2907
2907
|
disabled: !1,
|
|
@@ -2913,7 +2913,7 @@ const Ja = (e = {}) => {
|
|
|
2913
2913
|
id: "core-bullet-list",
|
|
2914
2914
|
label: s.bulletList,
|
|
2915
2915
|
group: "structure",
|
|
2916
|
-
icon:
|
|
2916
|
+
icon: Ir,
|
|
2917
2917
|
tooltip: s.bulletList,
|
|
2918
2918
|
isActive: e.isActive("bulletList"),
|
|
2919
2919
|
disabled: !1,
|
|
@@ -2925,7 +2925,7 @@ const Ja = (e = {}) => {
|
|
|
2925
2925
|
id: "core-ordered-list",
|
|
2926
2926
|
label: s.orderedList,
|
|
2927
2927
|
group: "structure",
|
|
2928
|
-
icon:
|
|
2928
|
+
icon: Nr,
|
|
2929
2929
|
tooltip: s.orderedList,
|
|
2930
2930
|
isActive: e.isActive("orderedList"),
|
|
2931
2931
|
disabled: !1,
|
|
@@ -2937,7 +2937,7 @@ const Ja = (e = {}) => {
|
|
|
2937
2937
|
id: "core-blockquote",
|
|
2938
2938
|
label: s.blockquote,
|
|
2939
2939
|
group: "structure",
|
|
2940
|
-
icon:
|
|
2940
|
+
icon: Ar,
|
|
2941
2941
|
tooltip: s.blockquote,
|
|
2942
2942
|
isActive: e.isActive("blockquote"),
|
|
2943
2943
|
disabled: !1,
|
|
@@ -2949,7 +2949,7 @@ const Ja = (e = {}) => {
|
|
|
2949
2949
|
id: "core-code-block",
|
|
2950
2950
|
label: s.codeBlock,
|
|
2951
2951
|
group: "structure",
|
|
2952
|
-
icon:
|
|
2952
|
+
icon: Lr,
|
|
2953
2953
|
tooltip: s.codeBlock,
|
|
2954
2954
|
isActive: e.isActive("codeBlock"),
|
|
2955
2955
|
disabled: !1,
|
|
@@ -2961,7 +2961,7 @@ const Ja = (e = {}) => {
|
|
|
2961
2961
|
id: "core-table",
|
|
2962
2962
|
label: s.insertTable,
|
|
2963
2963
|
group: "structure",
|
|
2964
|
-
icon:
|
|
2964
|
+
icon: Pr,
|
|
2965
2965
|
tooltip: s.insertTable,
|
|
2966
2966
|
isActive: !1,
|
|
2967
2967
|
disabled: !1,
|
|
@@ -2973,7 +2973,7 @@ const Ja = (e = {}) => {
|
|
|
2973
2973
|
id: "core-horizontal-rule",
|
|
2974
2974
|
label: s.horizontalRule,
|
|
2975
2975
|
group: "structure",
|
|
2976
|
-
icon:
|
|
2976
|
+
icon: Dr,
|
|
2977
2977
|
tooltip: s.horizontalRule,
|
|
2978
2978
|
isActive: !1,
|
|
2979
2979
|
disabled: !1,
|
|
@@ -2985,7 +2985,7 @@ const Ja = (e = {}) => {
|
|
|
2985
2985
|
id: "core-task-list",
|
|
2986
2986
|
label: s.taskList,
|
|
2987
2987
|
group: "structure",
|
|
2988
|
-
icon:
|
|
2988
|
+
icon: Rr,
|
|
2989
2989
|
tooltip: s.taskList,
|
|
2990
2990
|
isActive: e.isActive("taskList"),
|
|
2991
2991
|
disabled: !1,
|
|
@@ -2994,21 +2994,21 @@ const Ja = (e = {}) => {
|
|
|
2994
2994
|
}
|
|
2995
2995
|
}
|
|
2996
2996
|
], u = {
|
|
2997
|
-
GitGraph:
|
|
2998
|
-
Sigma:
|
|
2999
|
-
FunctionSquare:
|
|
3000
|
-
Workflow:
|
|
3001
|
-
Box:
|
|
3002
|
-
FileText:
|
|
3003
|
-
Link2:
|
|
3004
|
-
Image:
|
|
2997
|
+
GitGraph: Or,
|
|
2998
|
+
Sigma: zr,
|
|
2999
|
+
FunctionSquare: $r,
|
|
3000
|
+
Workflow: Fr,
|
|
3001
|
+
Box: Mr,
|
|
3002
|
+
FileText: Ht,
|
|
3003
|
+
Link2: Bt,
|
|
3004
|
+
Image: Ot
|
|
3005
3005
|
}, p = B.getToolbarItems().map((v) => {
|
|
3006
3006
|
const _ = B.getCommandMeta(v.command), C = d && v.tooltipZh ? v.tooltipZh : v.tooltip || (_ == null ? void 0 : _.description) || v.label, N = v.shortcut || (_ == null ? void 0 : _.shortcut), A = N ? `${C} (${N})` : C;
|
|
3007
3007
|
return {
|
|
3008
3008
|
id: v.id,
|
|
3009
3009
|
label: v.label,
|
|
3010
3010
|
group: v.group || "technical",
|
|
3011
|
-
icon: v.icon ? u[v.icon] ||
|
|
3011
|
+
icon: v.icon ? u[v.icon] || ut : ut,
|
|
3012
3012
|
isActive: l.isCommandActive(v.command),
|
|
3013
3013
|
disabled: !l.canExecCommand(v.command),
|
|
3014
3014
|
tooltip: A,
|
|
@@ -3040,7 +3040,7 @@ const Ja = (e = {}) => {
|
|
|
3040
3040
|
{ label: s.insertImageFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "image" }) },
|
|
3041
3041
|
{ label: s.insertMermaidFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
|
|
3042
3042
|
{ label: s.insertDrawioFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "drawio" }) }
|
|
3043
|
-
], T = (v) => v.id === "core-table" ? /* @__PURE__ */ m(
|
|
3043
|
+
], T = (v) => v.id === "core-table" ? /* @__PURE__ */ m(xt, { btn: v, items: x }, v.id) : v.id === "patent-figure-insert" ? /* @__PURE__ */ m(xt, { btn: v, items: w }, v.id) : /* @__PURE__ */ m(
|
|
3044
3044
|
"button",
|
|
3045
3045
|
{
|
|
3046
3046
|
onClick: v.run,
|
|
@@ -3083,15 +3083,15 @@ const Ja = (e = {}) => {
|
|
|
3083
3083
|
E(v.group);
|
|
3084
3084
|
},
|
|
3085
3085
|
className: "px-2 py-1 text-xs rounded bg-gray-200 text-gray-700 hover:bg-gray-300",
|
|
3086
|
-
title: _ ? `${s.expand} ${
|
|
3087
|
-
children:
|
|
3086
|
+
title: _ ? `${s.expand} ${Xe(v.group, s)}` : `${s.collapse} ${Xe(v.group, s)}`,
|
|
3087
|
+
children: Xe(v.group, s)
|
|
3088
3088
|
}
|
|
3089
3089
|
),
|
|
3090
3090
|
(!n || !_) && v.items.map(T)
|
|
3091
3091
|
] }, v.group);
|
|
3092
3092
|
})
|
|
3093
3093
|
] }) });
|
|
3094
|
-
},
|
|
3094
|
+
}, ei = ({ editor: e }) => {
|
|
3095
3095
|
const [t, n] = $(0), [r, a] = $(""), i = I((w) => w.editorLanguage), o = q(i);
|
|
3096
3096
|
if (M(() => {
|
|
3097
3097
|
if (!e) return;
|
|
@@ -3100,7 +3100,7 @@ const Ja = (e = {}) => {
|
|
|
3100
3100
|
e.off("selectionUpdate", w), e.off("update", w);
|
|
3101
3101
|
};
|
|
3102
3102
|
}, [e]), !e) return null;
|
|
3103
|
-
const c =
|
|
3103
|
+
const c = ot(e), s = [];
|
|
3104
3104
|
e.state.doc.descendants((w) => {
|
|
3105
3105
|
if (w.type.name !== "figure") return !0;
|
|
3106
3106
|
const T = typeof w.attrs.id == "string" ? w.attrs.id.trim() : "";
|
|
@@ -3122,7 +3122,7 @@ const Ja = (e = {}) => {
|
|
|
3122
3122
|
});
|
|
3123
3123
|
};
|
|
3124
3124
|
return /* @__PURE__ */ m("div", { className: "border-b border-gray-200 bg-gray-50 p-2", children: /* @__PURE__ */ L("div", { className: "bg-white border border-gray-200 rounded-md px-2 py-2 flex flex-wrap items-center gap-2", children: [
|
|
3125
|
-
s.length > 0 && /* @__PURE__ */ L(
|
|
3125
|
+
s.length > 0 && /* @__PURE__ */ L(je, { children: [
|
|
3126
3126
|
/* @__PURE__ */ m("span", { className: "text-xs text-gray-500", children: o.figureReferenceTarget }),
|
|
3127
3127
|
/* @__PURE__ */ L(
|
|
3128
3128
|
"select",
|
|
@@ -3147,12 +3147,12 @@ const Ja = (e = {}) => {
|
|
|
3147
3147
|
},
|
|
3148
3148
|
className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
|
|
3149
3149
|
title: o.insertFigureReference,
|
|
3150
|
-
children: /* @__PURE__ */ m(
|
|
3150
|
+
children: /* @__PURE__ */ m(Ot, { size: 16 })
|
|
3151
3151
|
}
|
|
3152
3152
|
)
|
|
3153
3153
|
] }),
|
|
3154
3154
|
/* @__PURE__ */ m("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
|
|
3155
|
-
d && /* @__PURE__ */ L(
|
|
3155
|
+
d && /* @__PURE__ */ L(je, { children: [
|
|
3156
3156
|
/* @__PURE__ */ m("span", { className: "text-xs font-medium text-gray-700", children: o.currentFigure }),
|
|
3157
3157
|
/* @__PURE__ */ m("span", { className: "text-xs text-gray-500", children: o.figureId }),
|
|
3158
3158
|
/* @__PURE__ */ m(
|
|
@@ -3188,7 +3188,7 @@ const Ja = (e = {}) => {
|
|
|
3188
3188
|
] }),
|
|
3189
3189
|
e.isActive("image") && (() => {
|
|
3190
3190
|
const T = e.getAttributes("image").width || "";
|
|
3191
|
-
return /* @__PURE__ */ L(
|
|
3191
|
+
return /* @__PURE__ */ L(je, { children: [
|
|
3192
3192
|
/* @__PURE__ */ m("span", { className: "text-xs font-medium text-gray-700", children: i === "zh" ? "图片" : "Image" }),
|
|
3193
3193
|
["25%", "50%", "75%", "100%"].map((_) => /* @__PURE__ */ m(
|
|
3194
3194
|
"button",
|
|
@@ -3212,11 +3212,11 @@ const Ja = (e = {}) => {
|
|
|
3212
3212
|
},
|
|
3213
3213
|
className: "p-2 hover:bg-red-50 text-red-600 rounded",
|
|
3214
3214
|
title: o.deleteSelection,
|
|
3215
|
-
children: /* @__PURE__ */ m(
|
|
3215
|
+
children: /* @__PURE__ */ m(Br, { size: 16 })
|
|
3216
3216
|
}
|
|
3217
3217
|
)
|
|
3218
3218
|
] }) });
|
|
3219
|
-
},
|
|
3219
|
+
}, an = {
|
|
3220
3220
|
// Invention & Utility Model
|
|
3221
3221
|
technical_field: [],
|
|
3222
3222
|
background_art: ["technical_field"],
|
|
@@ -3234,10 +3234,10 @@ const Ja = (e = {}) => {
|
|
|
3234
3234
|
design_views: ["design_description"],
|
|
3235
3235
|
design_brief: ["design_description", "design_views"]
|
|
3236
3236
|
};
|
|
3237
|
-
function
|
|
3238
|
-
return (
|
|
3237
|
+
function Us(e, t) {
|
|
3238
|
+
return (an[e] || []).filter((r) => !t.has(r));
|
|
3239
3239
|
}
|
|
3240
|
-
function
|
|
3240
|
+
function ti(e) {
|
|
3241
3241
|
const t = [];
|
|
3242
3242
|
return e.state.doc.descendants((n, r) => n.type.name === "patent_title" ? (t.push({
|
|
3243
3243
|
sectionType: "patent_title",
|
|
@@ -3249,7 +3249,7 @@ function Qa(e) {
|
|
|
3249
3249
|
content: n.textContent || ""
|
|
3250
3250
|
}), !1) : !0), t;
|
|
3251
3251
|
}
|
|
3252
|
-
function
|
|
3252
|
+
function sn(e) {
|
|
3253
3253
|
const { from: t } = e.state.selection, n = e.state.doc.resolve(t);
|
|
3254
3254
|
for (let r = n.depth; r >= 0; r--) {
|
|
3255
3255
|
const a = n.node(r);
|
|
@@ -3268,10 +3268,10 @@ function rn(e) {
|
|
|
3268
3268
|
}
|
|
3269
3269
|
return null;
|
|
3270
3270
|
}
|
|
3271
|
-
function
|
|
3272
|
-
const n =
|
|
3271
|
+
function ni(e, t) {
|
|
3272
|
+
const n = an[t];
|
|
3273
3273
|
if (!n || n.length === 0) return [];
|
|
3274
|
-
const r =
|
|
3274
|
+
const r = ti(e), a = new Map(r.map((i) => [i.sectionType, i]));
|
|
3275
3275
|
return n.map((i) => {
|
|
3276
3276
|
const o = a.get(i);
|
|
3277
3277
|
return !o || o.content.trim().length === 0 ? null : {
|
|
@@ -3280,14 +3280,14 @@ function ei(e, t) {
|
|
|
3280
3280
|
};
|
|
3281
3281
|
}).filter((i) => i !== null && i.content.length > 0);
|
|
3282
3282
|
}
|
|
3283
|
-
function
|
|
3283
|
+
function Ws(e, t = {}) {
|
|
3284
3284
|
const n = I.getState().editorLanguage, { from: r, to: a } = e.state.selection, i = r !== a ? e.state.doc.textBetween(r, a, " ", "\0") : void 0;
|
|
3285
3285
|
let o = t.sectionType, c = t.targetSectionPos;
|
|
3286
3286
|
if (!o) {
|
|
3287
|
-
const g =
|
|
3287
|
+
const g = sn(e);
|
|
3288
3288
|
g && (o = g.sectionType, c = g.pos);
|
|
3289
3289
|
}
|
|
3290
|
-
const s = t.scope || (o ? "section" : i ? "selection" : "document"), l = o ?
|
|
3290
|
+
const s = t.scope || (o ? "section" : i ? "selection" : "document"), l = o ? ni(e, o) : void 0;
|
|
3291
3291
|
let d;
|
|
3292
3292
|
if (s === "selection" && r !== a) {
|
|
3293
3293
|
const u = Math.max(0, r - 200), p = Math.min(e.state.doc.content.size, a + 200), f = e.state.doc.textBetween(u, r, " ", "\0"), b = e.state.doc.textBetween(a, p, " ", "\0");
|
|
@@ -3304,14 +3304,14 @@ function qs(e, t = {}) {
|
|
|
3304
3304
|
language: n
|
|
3305
3305
|
};
|
|
3306
3306
|
}
|
|
3307
|
-
const
|
|
3307
|
+
const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
3308
3308
|
const { addChatReference: n, openChatPanel: r, editorLanguage: a } = I(), i = a === "zh", o = (l) => Y(
|
|
3309
3309
|
"p-1.5 rounded transition-colors",
|
|
3310
3310
|
l ? "bg-blue-100 text-blue-600" : "text-gray-600 hover:bg-gray-100"
|
|
3311
3311
|
), c = () => {
|
|
3312
3312
|
const { from: l, to: d } = e.state.selection;
|
|
3313
3313
|
if (l === d) return;
|
|
3314
|
-
const g = e.state.doc.textBetween(l, d, " "), u =
|
|
3314
|
+
const g = e.state.doc.textBetween(l, d, " "), u = sn(e);
|
|
3315
3315
|
if (t) {
|
|
3316
3316
|
t({ text: g, from: l, to: d, sectionType: u == null ? void 0 : u.sectionType });
|
|
3317
3317
|
return;
|
|
@@ -3322,7 +3322,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3322
3322
|
d !== null && (d === "" ? e.chain().focus().extendMarkRange("link").unsetLink().run() : e.chain().focus().extendMarkRange("link").setLink({ href: d }).run());
|
|
3323
3323
|
};
|
|
3324
3324
|
return /* @__PURE__ */ m(
|
|
3325
|
-
|
|
3325
|
+
Kr,
|
|
3326
3326
|
{
|
|
3327
3327
|
editor: e,
|
|
3328
3328
|
shouldShow: ({ editor: l, state: d }) => {
|
|
@@ -3336,7 +3336,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3336
3336
|
onClick: () => e.chain().focus().toggleBold().run(),
|
|
3337
3337
|
className: o(e.isActive("bold")),
|
|
3338
3338
|
title: "Bold",
|
|
3339
|
-
children: /* @__PURE__ */ m(
|
|
3339
|
+
children: /* @__PURE__ */ m(Pt, { size: 15 })
|
|
3340
3340
|
}
|
|
3341
3341
|
),
|
|
3342
3342
|
/* @__PURE__ */ m(
|
|
@@ -3345,7 +3345,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3345
3345
|
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
3346
3346
|
className: o(e.isActive("italic")),
|
|
3347
3347
|
title: "Italic",
|
|
3348
|
-
children: /* @__PURE__ */ m(
|
|
3348
|
+
children: /* @__PURE__ */ m(Dt, { size: 15 })
|
|
3349
3349
|
}
|
|
3350
3350
|
),
|
|
3351
3351
|
/* @__PURE__ */ m(
|
|
@@ -3354,7 +3354,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3354
3354
|
onClick: () => e.chain().focus().toggleUnderline().run(),
|
|
3355
3355
|
className: o(e.isActive("underline")),
|
|
3356
3356
|
title: "Underline",
|
|
3357
|
-
children: /* @__PURE__ */ m(
|
|
3357
|
+
children: /* @__PURE__ */ m(Rt, { size: 15 })
|
|
3358
3358
|
}
|
|
3359
3359
|
),
|
|
3360
3360
|
/* @__PURE__ */ m(
|
|
@@ -3363,7 +3363,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3363
3363
|
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
3364
3364
|
className: o(e.isActive("strike")),
|
|
3365
3365
|
title: "Strikethrough",
|
|
3366
|
-
children: /* @__PURE__ */ m(
|
|
3366
|
+
children: /* @__PURE__ */ m(Mt, { size: 15 })
|
|
3367
3367
|
}
|
|
3368
3368
|
),
|
|
3369
3369
|
/* @__PURE__ */ m(
|
|
@@ -3372,7 +3372,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3372
3372
|
onClick: () => e.chain().focus().toggleCode().run(),
|
|
3373
3373
|
className: o(e.isActive("code")),
|
|
3374
3374
|
title: "Code",
|
|
3375
|
-
children: /* @__PURE__ */ m(
|
|
3375
|
+
children: /* @__PURE__ */ m(Ft, { size: 15 })
|
|
3376
3376
|
}
|
|
3377
3377
|
),
|
|
3378
3378
|
/* @__PURE__ */ m(
|
|
@@ -3381,7 +3381,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3381
3381
|
onClick: () => e.chain().focus().toggleSuperscript().run(),
|
|
3382
3382
|
className: o(e.isActive("superscript")),
|
|
3383
3383
|
title: "Superscript",
|
|
3384
|
-
children: /* @__PURE__ */ m(
|
|
3384
|
+
children: /* @__PURE__ */ m($t, { size: 15 })
|
|
3385
3385
|
}
|
|
3386
3386
|
),
|
|
3387
3387
|
/* @__PURE__ */ m(
|
|
@@ -3390,7 +3390,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3390
3390
|
onClick: () => e.chain().focus().toggleSubscript().run(),
|
|
3391
3391
|
className: o(e.isActive("subscript")),
|
|
3392
3392
|
title: "Subscript",
|
|
3393
|
-
children: /* @__PURE__ */ m(
|
|
3393
|
+
children: /* @__PURE__ */ m(zt, { size: 15 })
|
|
3394
3394
|
}
|
|
3395
3395
|
),
|
|
3396
3396
|
/* @__PURE__ */ m("div", { className: "bubble-menu-divider" }),
|
|
@@ -3400,7 +3400,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3400
3400
|
onClick: () => e.chain().focus().toggleHighlight().run(),
|
|
3401
3401
|
className: o(e.isActive("highlight")),
|
|
3402
3402
|
title: "Highlight",
|
|
3403
|
-
children: /* @__PURE__ */ m(
|
|
3403
|
+
children: /* @__PURE__ */ m(Hr, { size: 15 })
|
|
3404
3404
|
}
|
|
3405
3405
|
),
|
|
3406
3406
|
/* @__PURE__ */ m(
|
|
@@ -3409,7 +3409,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3409
3409
|
onClick: s,
|
|
3410
3410
|
className: o(e.isActive("link")),
|
|
3411
3411
|
title: "Link",
|
|
3412
|
-
children: /* @__PURE__ */ m(
|
|
3412
|
+
children: /* @__PURE__ */ m(Bt, { size: 15 })
|
|
3413
3413
|
}
|
|
3414
3414
|
),
|
|
3415
3415
|
/* @__PURE__ */ m("div", { className: "bubble-menu-divider" }),
|
|
@@ -3419,13 +3419,13 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3419
3419
|
onClick: c,
|
|
3420
3420
|
className: "p-1.5 rounded transition-colors text-purple-500 hover:bg-purple-50",
|
|
3421
3421
|
title: i ? "AI 优化" : "AI Optimize",
|
|
3422
|
-
children: /* @__PURE__ */ m(
|
|
3422
|
+
children: /* @__PURE__ */ m(qr, { size: 15 })
|
|
3423
3423
|
}
|
|
3424
3424
|
)
|
|
3425
3425
|
] })
|
|
3426
3426
|
}
|
|
3427
3427
|
);
|
|
3428
|
-
},
|
|
3428
|
+
}, ai = ({ editor: e }) => {
|
|
3429
3429
|
var E;
|
|
3430
3430
|
const [t, n] = $(!1), [r, a] = $(!1), [i, o] = $(""), [c, s] = $(""), [l, d] = $(!1), g = j(null), u = e.extensionStorage.searchReplace, p = ((E = u == null ? void 0 : u.results) == null ? void 0 : E.length) ?? 0, f = (u == null ? void 0 : u.currentIndex) ?? -1;
|
|
3431
3431
|
M(() => {
|
|
@@ -3482,21 +3482,21 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3482
3482
|
onClick: y,
|
|
3483
3483
|
className: Y("find-replace-btn", l && "find-replace-btn--active"),
|
|
3484
3484
|
title: "Case Sensitive",
|
|
3485
|
-
children: /* @__PURE__ */ m(
|
|
3485
|
+
children: /* @__PURE__ */ m(Ur, { size: 15 })
|
|
3486
3486
|
}
|
|
3487
3487
|
),
|
|
3488
|
-
/* @__PURE__ */ m("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ m(
|
|
3489
|
-
/* @__PURE__ */ m("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ m(
|
|
3488
|
+
/* @__PURE__ */ m("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ m(Wr, { size: 15 }) }),
|
|
3489
|
+
/* @__PURE__ */ m("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ m(qt, { size: 15 }) }),
|
|
3490
3490
|
/* @__PURE__ */ m(
|
|
3491
3491
|
"button",
|
|
3492
3492
|
{
|
|
3493
3493
|
onClick: () => a((x) => !x),
|
|
3494
3494
|
className: Y("find-replace-btn", r && "find-replace-btn--active"),
|
|
3495
3495
|
title: "Toggle Replace",
|
|
3496
|
-
children: /* @__PURE__ */ m(
|
|
3496
|
+
children: /* @__PURE__ */ m(mt, { size: 15 })
|
|
3497
3497
|
}
|
|
3498
3498
|
),
|
|
3499
|
-
/* @__PURE__ */ m("button", { onClick: h, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ m(
|
|
3499
|
+
/* @__PURE__ */ m("button", { onClick: h, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ m(jr, { size: 15 }) })
|
|
3500
3500
|
] }),
|
|
3501
3501
|
r && /* @__PURE__ */ L("div", { className: "find-replace-row", children: [
|
|
3502
3502
|
/* @__PURE__ */ m(
|
|
@@ -3514,12 +3514,12 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3514
3514
|
className: "find-replace-input"
|
|
3515
3515
|
}
|
|
3516
3516
|
),
|
|
3517
|
-
/* @__PURE__ */ m("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ m(
|
|
3518
|
-
/* @__PURE__ */ m("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ m(
|
|
3517
|
+
/* @__PURE__ */ m("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ m(mt, { size: 15 }) }),
|
|
3518
|
+
/* @__PURE__ */ m("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ m(Gr, { size: 15 }) })
|
|
3519
3519
|
] })
|
|
3520
3520
|
] }) : null;
|
|
3521
|
-
},
|
|
3522
|
-
const { editorLanguage: t } = I(), n = t === "zh", r =
|
|
3521
|
+
}, ii = ({ editor: e }) => {
|
|
3522
|
+
const { editorLanguage: t } = I(), n = t === "zh", r = Nt(() => {
|
|
3523
3523
|
const a = e.state, o = a.doc.textBetween(0, a.doc.content.size, " ", "\0").replace(/\s/g, "").length, { from: c, to: s } = a.selection;
|
|
3524
3524
|
let l = 0;
|
|
3525
3525
|
return c !== s && (l = a.doc.textBetween(c, s, " ", "\0").replace(/\s/g, "").length), { charCount: o, selectionCount: l };
|
|
@@ -3536,19 +3536,19 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3536
3536
|
r.selectionCount
|
|
3537
3537
|
] })
|
|
3538
3538
|
] });
|
|
3539
|
-
},
|
|
3539
|
+
}, si = {
|
|
3540
3540
|
empty: "○",
|
|
3541
3541
|
filled: "●"
|
|
3542
|
-
},
|
|
3542
|
+
}, oi = {
|
|
3543
3543
|
empty: "text-gray-400",
|
|
3544
3544
|
filled: "text-green-500"
|
|
3545
|
-
},
|
|
3545
|
+
}, ci = /* @__PURE__ */ new Set([
|
|
3546
3546
|
"technical_field",
|
|
3547
3547
|
"background_art",
|
|
3548
3548
|
"summary",
|
|
3549
3549
|
"drawing_description",
|
|
3550
3550
|
"detailed_description"
|
|
3551
|
-
]),
|
|
3551
|
+
]), li = ({ editor: e }) => {
|
|
3552
3552
|
const { editorLanguage: t } = I(), n = q(t), [r, a] = $(!1), [i, o] = $(0);
|
|
3553
3553
|
M(() => {
|
|
3554
3554
|
const s = () => o((l) => l + 1);
|
|
@@ -3556,7 +3556,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3556
3556
|
e.off("update", s);
|
|
3557
3557
|
};
|
|
3558
3558
|
}, [e]);
|
|
3559
|
-
const c =
|
|
3559
|
+
const c = Nt(() => {
|
|
3560
3560
|
const s = [];
|
|
3561
3561
|
let l = !1;
|
|
3562
3562
|
return e.state.doc.descendants((d, g) => {
|
|
@@ -3581,7 +3581,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3581
3581
|
}), !1;
|
|
3582
3582
|
}
|
|
3583
3583
|
if (d.type.name === "patent_section") {
|
|
3584
|
-
const u = d.attrs.sectionType, p =
|
|
3584
|
+
const u = d.attrs.sectionType, p = ci.has(u), f = `sectionTitle_${u}`, b = typeof n[f] == "string" ? n[f] : u, h = d.textContent || "", y = h.trim().length > 0;
|
|
3585
3585
|
return s.push({
|
|
3586
3586
|
type: "section",
|
|
3587
3587
|
pos: g,
|
|
@@ -3610,11 +3610,11 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3610
3610
|
onClick: () => a(!1),
|
|
3611
3611
|
className: "outline-panel-toggle",
|
|
3612
3612
|
title: t === "zh" ? "展开大纲" : "Expand Outline",
|
|
3613
|
-
children: /* @__PURE__ */ m(
|
|
3613
|
+
children: /* @__PURE__ */ m(Vr, { size: 16 })
|
|
3614
3614
|
}
|
|
3615
3615
|
) }) : /* @__PURE__ */ L("div", { className: "outline-panel", children: [
|
|
3616
3616
|
/* @__PURE__ */ L("div", { className: "outline-panel-header", children: [
|
|
3617
|
-
/* @__PURE__ */ m(
|
|
3617
|
+
/* @__PURE__ */ m(Ht, { size: 14 }),
|
|
3618
3618
|
/* @__PURE__ */ m("span", { children: t === "zh" ? "文档大纲" : "Outline" }),
|
|
3619
3619
|
/* @__PURE__ */ m(
|
|
3620
3620
|
"button",
|
|
@@ -3622,7 +3622,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3622
3622
|
onClick: () => a(!0),
|
|
3623
3623
|
className: "outline-panel-toggle ml-auto",
|
|
3624
3624
|
title: t === "zh" ? "收起大纲" : "Collapse Outline",
|
|
3625
|
-
children: /* @__PURE__ */ m(
|
|
3625
|
+
children: /* @__PURE__ */ m(Jr, { size: 14 })
|
|
3626
3626
|
}
|
|
3627
3627
|
)
|
|
3628
3628
|
] }),
|
|
@@ -3644,7 +3644,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3644
3644
|
}));
|
|
3645
3645
|
},
|
|
3646
3646
|
children: [
|
|
3647
|
-
s.type === "section" && s.state && /* @__PURE__ */ m("span", { className: Y("outline-item-state",
|
|
3647
|
+
s.type === "section" && s.state && /* @__PURE__ */ m("span", { className: Y("outline-item-state", oi[s.state]), children: si[s.state] || "○" }),
|
|
3648
3648
|
/* @__PURE__ */ m("span", { className: "outline-item-title", children: s.title }),
|
|
3649
3649
|
s.type !== "book-group" && /* @__PURE__ */ m("span", { className: "outline-item-count", children: s.charCount })
|
|
3650
3650
|
]
|
|
@@ -3653,7 +3653,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3653
3653
|
))
|
|
3654
3654
|
] })
|
|
3655
3655
|
] });
|
|
3656
|
-
},
|
|
3656
|
+
}, di = ({
|
|
3657
3657
|
editor: e,
|
|
3658
3658
|
mode: t = "edit",
|
|
3659
3659
|
className: n
|
|
@@ -3667,16 +3667,16 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3667
3667
|
t === "readonly" ? "cursor-default" : "cursor-text",
|
|
3668
3668
|
n
|
|
3669
3669
|
),
|
|
3670
|
-
children: /* @__PURE__ */ m(
|
|
3670
|
+
children: /* @__PURE__ */ m(In, { editor: e, className: "h-full" })
|
|
3671
3671
|
}
|
|
3672
|
-
)),
|
|
3672
|
+
)), on = "patent-editor-draft", ui = 1500, mi = () => {
|
|
3673
3673
|
try {
|
|
3674
|
-
const e = localStorage.getItem(
|
|
3674
|
+
const e = localStorage.getItem(on);
|
|
3675
3675
|
return e ? JSON.parse(e) : null;
|
|
3676
3676
|
} catch {
|
|
3677
3677
|
return null;
|
|
3678
3678
|
}
|
|
3679
|
-
},
|
|
3679
|
+
}, gi = ({
|
|
3680
3680
|
initialContent: e,
|
|
3681
3681
|
onChange: t,
|
|
3682
3682
|
className: n,
|
|
@@ -3685,7 +3685,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3685
3685
|
onEditorReady: i,
|
|
3686
3686
|
onSelectionOptimize: o
|
|
3687
3687
|
}) => {
|
|
3688
|
-
const { setEditor: c, setDocument: s, editorLanguage: l, autoSaveStatus: d, ai: g } = I(), { setAutoSaveStatus: u, setLastSavedAt: p } = I(), f = j(null), b = e || (t ? null :
|
|
3688
|
+
const { setEditor: c, setDocument: s, editorLanguage: l, autoSaveStatus: d, ai: g } = I(), { setAutoSaveStatus: u, setLastSavedAt: p } = I(), f = j(null), b = e || (t ? null : mi()) || {
|
|
3689
3689
|
type: "doc",
|
|
3690
3690
|
content: [
|
|
3691
3691
|
{
|
|
@@ -3695,18 +3695,18 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3695
3695
|
]
|
|
3696
3696
|
}, h = ae((T) => {
|
|
3697
3697
|
try {
|
|
3698
|
-
u("saving"), localStorage.setItem(
|
|
3698
|
+
u("saving"), localStorage.setItem(on, JSON.stringify(T)), u("saved"), p(/* @__PURE__ */ new Date());
|
|
3699
3699
|
} catch {
|
|
3700
3700
|
u("error");
|
|
3701
3701
|
}
|
|
3702
|
-
}, [u, p]), y =
|
|
3703
|
-
|
|
3702
|
+
}, [u, p]), y = Nn(
|
|
3703
|
+
Xa({
|
|
3704
3704
|
content: b,
|
|
3705
3705
|
onUpdate: ({ editor: T }) => {
|
|
3706
3706
|
const v = T.getJSON();
|
|
3707
3707
|
s(v), B.notifyStateChange(T), t && t(v), t || (f.current && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
3708
3708
|
h(v);
|
|
3709
|
-
},
|
|
3709
|
+
}, ui));
|
|
3710
3710
|
},
|
|
3711
3711
|
onCreate: ({ editor: T }) => {
|
|
3712
3712
|
c(T), i == null || i(T), B.initializePlugins(T), B.notifyStateChange(T);
|
|
@@ -3738,26 +3738,26 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3738
3738
|
const x = q(l), w = d === "saving" ? x.autoSaveSaving : d === "saved" ? x.autoSaveSaved : d === "error" ? x.autoSaveError : "";
|
|
3739
3739
|
return /* @__PURE__ */ L("div", { className: `editor-container flex flex-col h-full ${n}`, children: [
|
|
3740
3740
|
!r && /* @__PURE__ */ L("div", { className: "flex items-center", children: [
|
|
3741
|
-
/* @__PURE__ */ m(
|
|
3741
|
+
/* @__PURE__ */ m(Qa, { editor: y }),
|
|
3742
3742
|
w && /* @__PURE__ */ m("span", { className: `auto-save-indicator auto-save-indicator--${d} ml-2`, children: w })
|
|
3743
3743
|
] }),
|
|
3744
|
-
!r && y && /* @__PURE__ */ m(
|
|
3745
|
-
!r && y && /* @__PURE__ */ m(
|
|
3746
|
-
!r && y && /* @__PURE__ */ m(
|
|
3744
|
+
!r && y && /* @__PURE__ */ m(ei, { editor: y }),
|
|
3745
|
+
!r && y && /* @__PURE__ */ m(ri, { editor: y, onSelectionOptimize: o }),
|
|
3746
|
+
!r && y && /* @__PURE__ */ m(ai, { editor: y }),
|
|
3747
3747
|
/* @__PURE__ */ L("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
3748
|
-
!r && y && /* @__PURE__ */ m(
|
|
3748
|
+
!r && y && /* @__PURE__ */ m(li, { editor: y }),
|
|
3749
3749
|
/* @__PURE__ */ m("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ m(
|
|
3750
|
-
|
|
3750
|
+
di,
|
|
3751
3751
|
{
|
|
3752
3752
|
editor: y,
|
|
3753
3753
|
mode: r || !a || g.status === "streaming" && g.activeSectionType === "claims" ? "readonly" : "edit"
|
|
3754
3754
|
}
|
|
3755
3755
|
) })
|
|
3756
3756
|
] }),
|
|
3757
|
-
!r && /* @__PURE__ */ m(
|
|
3757
|
+
!r && /* @__PURE__ */ m(ii, { editor: y })
|
|
3758
3758
|
] });
|
|
3759
3759
|
};
|
|
3760
|
-
function
|
|
3760
|
+
function cn(e) {
|
|
3761
3761
|
const t = e.getReader(), n = new TextDecoder();
|
|
3762
3762
|
let r = "";
|
|
3763
3763
|
return new ReadableStream({
|
|
@@ -3809,7 +3809,7 @@ function sn(e) {
|
|
|
3809
3809
|
}
|
|
3810
3810
|
});
|
|
3811
3811
|
}
|
|
3812
|
-
function
|
|
3812
|
+
function fi(e, t) {
|
|
3813
3813
|
let n = null;
|
|
3814
3814
|
return {
|
|
3815
3815
|
async request(r) {
|
|
@@ -3824,14 +3824,14 @@ function mi(e, t) {
|
|
|
3824
3824
|
throw new Error(`AI service error: ${i.status} ${i.statusText}`);
|
|
3825
3825
|
if (!i.body)
|
|
3826
3826
|
throw new Error("AI service returned no body");
|
|
3827
|
-
return
|
|
3827
|
+
return cn(i.body);
|
|
3828
3828
|
},
|
|
3829
3829
|
abort() {
|
|
3830
3830
|
n == null || n.abort(), n = null;
|
|
3831
3831
|
}
|
|
3832
3832
|
};
|
|
3833
3833
|
}
|
|
3834
|
-
function
|
|
3834
|
+
function pi(e, t) {
|
|
3835
3835
|
let n = null;
|
|
3836
3836
|
const r = e.replace(/\/+$/, "");
|
|
3837
3837
|
async function a(i, o) {
|
|
@@ -3878,28 +3878,28 @@ function gi(e, t) {
|
|
|
3878
3878
|
});
|
|
3879
3879
|
if (!s.ok) throw new Error(`Chat stream error: ${s.status} ${s.statusText}`);
|
|
3880
3880
|
if (!s.body) throw new Error("Chat stream returned no body");
|
|
3881
|
-
return
|
|
3881
|
+
return cn(s.body);
|
|
3882
3882
|
},
|
|
3883
3883
|
abort() {
|
|
3884
3884
|
n == null || n.abort(), n = null;
|
|
3885
3885
|
}
|
|
3886
3886
|
};
|
|
3887
3887
|
}
|
|
3888
|
-
const
|
|
3888
|
+
const hi = _t(
|
|
3889
3889
|
({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, editable: i = !0, language: o, aiService: c, chatSessionAPI: s, aiBaseUrl: l, aiHeaders: d, onSelectionOptimize: g }, u) => {
|
|
3890
3890
|
const { setEditorLanguage: p, setAIService: f, setChatSessionAPI: b } = I(), h = j(null), y = ae((x) => {
|
|
3891
3891
|
h.current = x;
|
|
3892
|
-
}, []), E =
|
|
3892
|
+
}, []), E = Ee.useMemo(() => {
|
|
3893
3893
|
if (e) return e;
|
|
3894
|
-
if (t) return
|
|
3894
|
+
if (t) return en(t);
|
|
3895
3895
|
}, [e, t]);
|
|
3896
|
-
return
|
|
3896
|
+
return Ee.useEffect(() => {
|
|
3897
3897
|
o && p(o);
|
|
3898
|
-
}, [o, p]),
|
|
3899
|
-
c ? f(c) : l && f(
|
|
3900
|
-
}, [c, l, d, f]),
|
|
3901
|
-
s ? b(s) : l && b(
|
|
3902
|
-
}, [s, l, d, b]),
|
|
3898
|
+
}, [o, p]), Ee.useEffect(() => {
|
|
3899
|
+
c ? f(c) : l && f(fi(l, d));
|
|
3900
|
+
}, [c, l, d, f]), Ee.useEffect(() => {
|
|
3901
|
+
s ? b(s) : l && b(pi(l, d));
|
|
3902
|
+
}, [s, l, d, b]), It(u, () => ({
|
|
3903
3903
|
getContent: () => {
|
|
3904
3904
|
var x;
|
|
3905
3905
|
return ((x = h.current) == null ? void 0 : x.getJSON()) ?? null;
|
|
@@ -3909,13 +3909,13 @@ const fi = Et(
|
|
|
3909
3909
|
(w = h.current) == null || w.commands.setContent(x);
|
|
3910
3910
|
},
|
|
3911
3911
|
getEditor: () => h.current,
|
|
3912
|
-
execCommand: async (x, w) => h.current ?
|
|
3912
|
+
execCommand: async (x, w) => h.current ? ot(h.current).execCommand(x, w) : null,
|
|
3913
3913
|
focus: () => {
|
|
3914
3914
|
var x;
|
|
3915
3915
|
(x = h.current) == null || x.commands.focus();
|
|
3916
3916
|
}
|
|
3917
3917
|
})), /* @__PURE__ */ m(
|
|
3918
|
-
|
|
3918
|
+
gi,
|
|
3919
3919
|
{
|
|
3920
3920
|
initialContent: E,
|
|
3921
3921
|
onChange: n,
|
|
@@ -3928,13 +3928,13 @@ const fi = Et(
|
|
|
3928
3928
|
);
|
|
3929
3929
|
}
|
|
3930
3930
|
);
|
|
3931
|
-
|
|
3932
|
-
async function
|
|
3931
|
+
hi.displayName = "PatentEditor";
|
|
3932
|
+
async function js(e, t, n) {
|
|
3933
3933
|
var a, i, o, c;
|
|
3934
3934
|
let r = !1;
|
|
3935
|
-
(a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" &&
|
|
3935
|
+
(a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && dn(e, n.targetSectionPos);
|
|
3936
3936
|
try {
|
|
3937
|
-
let s =
|
|
3937
|
+
let s = ln(e, n);
|
|
3938
3938
|
for (; ; ) {
|
|
3939
3939
|
const { done: l, value: d } = await t.read();
|
|
3940
3940
|
if (l) break;
|
|
@@ -3943,15 +3943,15 @@ async function Us(e, t, n) {
|
|
|
3943
3943
|
const g = e.state.tr.insertText(d, s);
|
|
3944
3944
|
e.view.dispatch(g), s = g.mapping.map(s, 1);
|
|
3945
3945
|
}
|
|
3946
|
-
n.mode === "section" && typeof n.targetSectionPos == "number" &&
|
|
3946
|
+
n.mode === "section" && typeof n.targetSectionPos == "number" && nt(e, n.targetSectionPos), (o = n.onComplete) == null || o.call(n);
|
|
3947
3947
|
} catch (s) {
|
|
3948
3948
|
(c = n.onError) == null || c.call(n, s instanceof Error ? s : new Error(String(s)));
|
|
3949
3949
|
}
|
|
3950
3950
|
}
|
|
3951
|
-
async function
|
|
3951
|
+
async function Gs(e, t, n, r) {
|
|
3952
3952
|
var i, o, c, s, l, d, g, u;
|
|
3953
3953
|
const a = new AbortController();
|
|
3954
|
-
(i = r.onStart) == null || i.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" &&
|
|
3954
|
+
(i = r.onStart) == null || i.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && dn(e, r.targetSectionPos);
|
|
3955
3955
|
try {
|
|
3956
3956
|
const p = await fetch(t, {
|
|
3957
3957
|
method: "POST",
|
|
@@ -3964,7 +3964,7 @@ async function Ws(e, t, n, r) {
|
|
|
3964
3964
|
const f = (o = p.body) == null ? void 0 : o.getReader();
|
|
3965
3965
|
if (!f) throw new Error("No response body");
|
|
3966
3966
|
const b = new TextDecoder();
|
|
3967
|
-
let h =
|
|
3967
|
+
let h = ln(e, r), y = "";
|
|
3968
3968
|
for (; ; ) {
|
|
3969
3969
|
const { done: E, value: x } = await f.read();
|
|
3970
3970
|
if (E) break;
|
|
@@ -3976,7 +3976,7 @@ async function Ws(e, t, n, r) {
|
|
|
3976
3976
|
if (!T.startsWith("data: ")) continue;
|
|
3977
3977
|
const v = T.slice(6).trim();
|
|
3978
3978
|
if (v === "[DONE]")
|
|
3979
|
-
return r.mode === "section" && typeof r.targetSectionPos == "number" &&
|
|
3979
|
+
return r.mode === "section" && typeof r.targetSectionPos == "number" && nt(e, r.targetSectionPos), (c = r.onComplete) == null || c.call(r), { abort: () => a.abort() };
|
|
3980
3980
|
try {
|
|
3981
3981
|
const _ = JSON.parse(v), C = _.content || _.text || ((s = _.delta) == null ? void 0 : s.content) || "";
|
|
3982
3982
|
if (!C) continue;
|
|
@@ -3987,13 +3987,13 @@ async function Ws(e, t, n, r) {
|
|
|
3987
3987
|
}
|
|
3988
3988
|
}
|
|
3989
3989
|
}
|
|
3990
|
-
r.mode === "section" && typeof r.targetSectionPos == "number" &&
|
|
3990
|
+
r.mode === "section" && typeof r.targetSectionPos == "number" && nt(e, r.targetSectionPos), (d = r.onComplete) == null || d.call(r);
|
|
3991
3991
|
} catch (p) {
|
|
3992
3992
|
p.name === "AbortError" ? (g = r.onAbort) == null || g.call(r) : (u = r.onError) == null || u.call(r, p instanceof Error ? p : new Error(String(p)));
|
|
3993
3993
|
}
|
|
3994
3994
|
return { abort: () => a.abort() };
|
|
3995
3995
|
}
|
|
3996
|
-
function
|
|
3996
|
+
function ln(e, t) {
|
|
3997
3997
|
if (t.mode === "section" && typeof t.targetSectionPos == "number") {
|
|
3998
3998
|
const n = e.state.doc.nodeAt(t.targetSectionPos);
|
|
3999
3999
|
if (n && n.type.name === "patent_section")
|
|
@@ -4001,7 +4001,7 @@ function on(e, t) {
|
|
|
4001
4001
|
}
|
|
4002
4002
|
return e.state.selection.from;
|
|
4003
4003
|
}
|
|
4004
|
-
function
|
|
4004
|
+
function dn(e, t) {
|
|
4005
4005
|
const n = e.state.doc.nodeAt(t);
|
|
4006
4006
|
if (!n || n.type.name !== "patent_section") return;
|
|
4007
4007
|
const r = t + 1, a = t + n.nodeSize - 1;
|
|
@@ -4010,7 +4010,7 @@ function cn(e, t) {
|
|
|
4010
4010
|
i.replaceWith(r, a, o), i.setMeta("addToHistory", !1), e.view.dispatch(i);
|
|
4011
4011
|
}
|
|
4012
4012
|
}
|
|
4013
|
-
function
|
|
4013
|
+
function nt(e, t) {
|
|
4014
4014
|
const n = e.state.doc.nodeAt(t);
|
|
4015
4015
|
if (!n || n.type.name !== "patent_section") return;
|
|
4016
4016
|
const r = e.state.tr, a = [];
|
|
@@ -4030,7 +4030,7 @@ function et(e, t) {
|
|
|
4030
4030
|
r.setMeta("addToHistory", !1), e.view.dispatch(r);
|
|
4031
4031
|
}
|
|
4032
4032
|
}
|
|
4033
|
-
const
|
|
4033
|
+
const Ct = {
|
|
4034
4034
|
technical_field: {
|
|
4035
4035
|
zh: "本发明涉及航天器自主导航与控制技术领域,具体涉及一种基于多传感器融合的航天器自主避障控制方法、系统、电子设备及计算机可读存储介质。该方法综合利用激光雷达、红外传感器和星敏感器的探测数据,通过实时环境感知与路径规划算法,实现航天器在复杂空间环境中的自主安全避障机动。",
|
|
4036
4036
|
en: "The present invention relates to the field of autonomous navigation and control technology for spacecraft, and specifically to a method, system, electronic device, and computer-readable storage medium for autonomous obstacle avoidance control of spacecraft based on multi-sensor fusion."
|
|
@@ -4100,7 +4100,7 @@ S103:局部实时避障控制。采用模型预测控制(MPC)策略,以
|
|
|
4100
4100
|
S104:安全验证。对计算得到的控制指令进行轨迹传播仿真,验证机动后轨迹在未来72小时内不会与TLE目录中的已知空间目标产生碰撞风险(miss distance > 1km)。`,
|
|
4101
4101
|
en: "The technical solution of the embodiments of the present invention will be described clearly and completely below with reference to the drawings."
|
|
4102
4102
|
}
|
|
4103
|
-
},
|
|
4103
|
+
}, Pe = {
|
|
4104
4104
|
"help-draft": {
|
|
4105
4105
|
zh: `当然可以帮你撰写技术方案!请先描述以下信息:
|
|
4106
4106
|
|
|
@@ -4160,7 +4160,7 @@ S104:安全验证。对计算得到的控制指令进行轨迹传播仿真,
|
|
|
4160
4160
|
en: "That is a great question. As an AI patent writing assistant, I can help you with..."
|
|
4161
4161
|
}
|
|
4162
4162
|
}, te = (e) => new Promise((t) => setTimeout(t, e));
|
|
4163
|
-
function
|
|
4163
|
+
function rt(e, t = 30) {
|
|
4164
4164
|
let n = !1;
|
|
4165
4165
|
return new ReadableStream({
|
|
4166
4166
|
async pull(r) {
|
|
@@ -4178,30 +4178,30 @@ function tt(e, t = 30) {
|
|
|
4178
4178
|
}
|
|
4179
4179
|
});
|
|
4180
4180
|
}
|
|
4181
|
-
function
|
|
4182
|
-
const t = [], n =
|
|
4181
|
+
function yi(e) {
|
|
4182
|
+
const t = [], n = $e(e, 3);
|
|
4183
4183
|
for (const r of n)
|
|
4184
4184
|
t.push({ type: "delta", content: r });
|
|
4185
4185
|
return t.push({ type: "done", usage: { tokens: e.length * 2 } }), t;
|
|
4186
4186
|
}
|
|
4187
|
-
function
|
|
4187
|
+
function $e(e, t) {
|
|
4188
4188
|
const n = [];
|
|
4189
4189
|
for (let r = 0; r < e.length; r += t)
|
|
4190
4190
|
n.push(e.slice(r, r + t));
|
|
4191
4191
|
return n;
|
|
4192
4192
|
}
|
|
4193
|
-
function
|
|
4193
|
+
function bi(e, t, n) {
|
|
4194
4194
|
const r = n === "zh", a = [];
|
|
4195
4195
|
let i;
|
|
4196
|
-
if (e.includes("技术方案") || e.includes("draft") ? i =
|
|
4196
|
+
if (e.includes("技术方案") || e.includes("draft") ? i = Pe["help-draft"][r ? "zh" : "en"] : e.includes("审查") || e.includes("review") || e.includes("Review") ? i = Pe.review[r ? "zh" : "en"] : e.includes("权利要求") || e.includes("claims") || e.includes("Optimize") ? i = Pe.claims[r ? "zh" : "en"] : i = Pe.default[r ? "zh" : "en"], t.length > 0) {
|
|
4197
4197
|
const o = r ? `正在分析引用的 ${t.length} 段文本并生成优化建议...
|
|
4198
4198
|
|
|
4199
4199
|
` : `Analyzing ${t.length} referenced text(s) and generating suggestions...
|
|
4200
4200
|
|
|
4201
4201
|
`;
|
|
4202
|
-
for (const c of
|
|
4202
|
+
for (const c of $e(o, 4))
|
|
4203
4203
|
a.push({ type: "delta", content: c });
|
|
4204
|
-
for (const c of
|
|
4204
|
+
for (const c of $e(i, 4))
|
|
4205
4205
|
a.push({ type: "delta", content: c });
|
|
4206
4206
|
for (let c = 0; c < t.length; c++) {
|
|
4207
4207
|
const s = t[c], l = s.text;
|
|
@@ -4234,33 +4234,33 @@ function hi(e, t, n) {
|
|
|
4234
4234
|
});
|
|
4235
4235
|
}
|
|
4236
4236
|
} else
|
|
4237
|
-
for (const o of
|
|
4237
|
+
for (const o of $e(i, 4))
|
|
4238
4238
|
a.push({ type: "delta", content: o });
|
|
4239
4239
|
return a.push({ type: "done", usage: { tokens: i.length * 2 } }), a;
|
|
4240
4240
|
}
|
|
4241
|
-
function
|
|
4241
|
+
function Vs() {
|
|
4242
4242
|
let e = null;
|
|
4243
4243
|
return {
|
|
4244
4244
|
async request(t) {
|
|
4245
4245
|
var c;
|
|
4246
4246
|
if (e = new AbortController(), await te(300), e.signal.aborted)
|
|
4247
4247
|
throw new DOMException("Aborted", "AbortError");
|
|
4248
|
-
const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((c =
|
|
4248
|
+
const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((c = Ct[r]) == null ? void 0 : c[n]) || Ct.technical_field[n];
|
|
4249
4249
|
let i = a;
|
|
4250
4250
|
t.instruction && (i = (n === "zh" ? `[基于指令"${t.instruction}"生成]
|
|
4251
4251
|
|
|
4252
4252
|
` : `[Generated based on instruction "${t.instruction}"]
|
|
4253
4253
|
|
|
4254
4254
|
`) + a);
|
|
4255
|
-
const o =
|
|
4256
|
-
return
|
|
4255
|
+
const o = yi(i);
|
|
4256
|
+
return rt(o, 25);
|
|
4257
4257
|
},
|
|
4258
4258
|
abort() {
|
|
4259
4259
|
e == null || e.abort(), e = null;
|
|
4260
4260
|
}
|
|
4261
4261
|
};
|
|
4262
4262
|
}
|
|
4263
|
-
function
|
|
4263
|
+
function Js() {
|
|
4264
4264
|
const e = /* @__PURE__ */ new Map();
|
|
4265
4265
|
let t = null, n = null;
|
|
4266
4266
|
return {
|
|
@@ -4303,7 +4303,7 @@ function Vs() {
|
|
|
4303
4303
|
status: "done",
|
|
4304
4304
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4305
4305
|
}), i.session.messageCount = i.messages.length, i.session.lastMessage = a.content, i.session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4306
|
-
const c =
|
|
4306
|
+
const c = bi(
|
|
4307
4307
|
a.content,
|
|
4308
4308
|
a.references || [],
|
|
4309
4309
|
a.language
|
|
@@ -4315,10 +4315,10 @@ function Vs() {
|
|
|
4315
4315
|
const i = e.get(r);
|
|
4316
4316
|
if (!i) throw new Error("Session not found");
|
|
4317
4317
|
if (!n || n.messageId !== a)
|
|
4318
|
-
return
|
|
4318
|
+
return rt([{ type: "done" }]);
|
|
4319
4319
|
const o = n.events;
|
|
4320
4320
|
n = null;
|
|
4321
|
-
const c =
|
|
4321
|
+
const c = rt(o, 18), s = `${a}_a`;
|
|
4322
4322
|
let l = "";
|
|
4323
4323
|
for (const d of o)
|
|
4324
4324
|
d.type === "delta" && (l += d.content);
|
|
@@ -4335,7 +4335,7 @@ function Vs() {
|
|
|
4335
4335
|
}
|
|
4336
4336
|
};
|
|
4337
4337
|
}
|
|
4338
|
-
function
|
|
4338
|
+
function vi(e) {
|
|
4339
4339
|
const t = [], n = e.replace(/\r\n/g, `
|
|
4340
4340
|
`).trim();
|
|
4341
4341
|
if (!n) return t;
|
|
@@ -4350,12 +4350,12 @@ function yi(e) {
|
|
|
4350
4350
|
if (a.length === 0)
|
|
4351
4351
|
return t.push({ number: 1, text: n, dependsOn: [] }), t;
|
|
4352
4352
|
for (let o = 0; o < a.length; o++) {
|
|
4353
|
-
const c = a[o].index + a[o].matchLength, s = o + 1 < a.length ? a[o + 1].index : n.length, l = n.slice(c, s).trim(), d = a[o].number, g =
|
|
4353
|
+
const c = a[o].index + a[o].matchLength, s = o + 1 < a.length ? a[o + 1].index : n.length, l = n.slice(c, s).trim(), d = a[o].number, g = wi(l, d);
|
|
4354
4354
|
t.push({ number: d, text: l, dependsOn: g });
|
|
4355
4355
|
}
|
|
4356
4356
|
return t;
|
|
4357
4357
|
}
|
|
4358
|
-
function
|
|
4358
|
+
function wi(e, t) {
|
|
4359
4359
|
const n = [], r = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g;
|
|
4360
4360
|
let a;
|
|
4361
4361
|
for (; (a = r.exec(e)) !== null; ) {
|
|
@@ -4371,18 +4371,18 @@ function bi(e, t) {
|
|
|
4371
4371
|
}
|
|
4372
4372
|
return [...new Set(n)].sort((o, c) => o - c);
|
|
4373
4373
|
}
|
|
4374
|
-
function
|
|
4375
|
-
return
|
|
4374
|
+
function Ks(e) {
|
|
4375
|
+
return vi(e).map((n) => ({
|
|
4376
4376
|
type: "paragraph",
|
|
4377
4377
|
content: n.text ? [{ type: "text", text: `${n.number}. ${n.text}` }] : [{ type: "text", text: `${n.number}. ` }]
|
|
4378
4378
|
}));
|
|
4379
4379
|
}
|
|
4380
|
-
const
|
|
4381
|
-
let
|
|
4382
|
-
function
|
|
4383
|
-
return
|
|
4380
|
+
const xi = -1, Ci = 1, Ti = 0, un = new we("docDiff");
|
|
4381
|
+
let Ye = null;
|
|
4382
|
+
function Si() {
|
|
4383
|
+
return Ye || (Ye = new Lt()), Ye;
|
|
4384
4384
|
}
|
|
4385
|
-
function
|
|
4385
|
+
function Ei(e, t, n) {
|
|
4386
4386
|
const r = [];
|
|
4387
4387
|
return e.nodesBetween(t, n, (a, i) => {
|
|
4388
4388
|
if (a.isTextblock) {
|
|
@@ -4392,31 +4392,31 @@ function Ti(e, t, n) {
|
|
|
4392
4392
|
return !0;
|
|
4393
4393
|
}), r;
|
|
4394
4394
|
}
|
|
4395
|
-
function
|
|
4396
|
-
const n = e.state.doc, r = n.content.size, { text: a, segments: i } =
|
|
4395
|
+
function Xs(e, t) {
|
|
4396
|
+
const n = e.state.doc, r = n.content.size, { text: a, segments: i } = jt(e, 0, r), o = Si(), c = o.diff_main(t, a);
|
|
4397
4397
|
o.diff_cleanupEfficiency(c);
|
|
4398
4398
|
const s = [];
|
|
4399
4399
|
let l = 0;
|
|
4400
4400
|
for (const [u, p] of c)
|
|
4401
|
-
if (u ===
|
|
4401
|
+
if (u === Ti)
|
|
4402
4402
|
l += p.length;
|
|
4403
|
-
else if (u ===
|
|
4403
|
+
else if (u === Ci) {
|
|
4404
4404
|
let f = 0;
|
|
4405
4405
|
for (; f < p.length; ) {
|
|
4406
4406
|
for (; f < p.length && p[f] === "\0"; ) f++;
|
|
4407
4407
|
if (f >= p.length) break;
|
|
4408
4408
|
const b = f;
|
|
4409
4409
|
for (; f < p.length && p[f] !== "\0"; ) f++;
|
|
4410
|
-
const h =
|
|
4410
|
+
const h = ye(i, l + b), y = ye(i, l + f);
|
|
4411
4411
|
if (h >= 0 && y >= 0 && y > h)
|
|
4412
|
-
for (const E of
|
|
4412
|
+
for (const E of Ei(n, h, y))
|
|
4413
4413
|
s.push(
|
|
4414
4414
|
re.inline(E.from, E.to, { class: "patch-diff-insert-inline" })
|
|
4415
4415
|
);
|
|
4416
4416
|
}
|
|
4417
4417
|
l += p.length;
|
|
4418
|
-
} else if (u ===
|
|
4419
|
-
const f =
|
|
4418
|
+
} else if (u === xi) {
|
|
4419
|
+
const f = ye(i, l);
|
|
4420
4420
|
if (f >= 0) {
|
|
4421
4421
|
const b = p.replace(/\0/g, " ");
|
|
4422
4422
|
s.push(
|
|
@@ -4431,8 +4431,8 @@ function Js(e, t) {
|
|
|
4431
4431
|
);
|
|
4432
4432
|
}
|
|
4433
4433
|
}
|
|
4434
|
-
const d =
|
|
4435
|
-
key:
|
|
4434
|
+
const d = be.create(n, s), g = new Be({
|
|
4435
|
+
key: un,
|
|
4436
4436
|
props: {
|
|
4437
4437
|
decorations() {
|
|
4438
4438
|
return d;
|
|
@@ -4441,22 +4441,22 @@ function Js(e, t) {
|
|
|
4441
4441
|
});
|
|
4442
4442
|
e.registerPlugin(g);
|
|
4443
4443
|
}
|
|
4444
|
-
function
|
|
4445
|
-
e.unregisterPlugin(
|
|
4444
|
+
function Ys(e) {
|
|
4445
|
+
e.unregisterPlugin(un);
|
|
4446
4446
|
}
|
|
4447
|
-
const
|
|
4447
|
+
const ki = /* @__PURE__ */ new Set([
|
|
4448
4448
|
"abstract",
|
|
4449
4449
|
"abstract_drawing",
|
|
4450
4450
|
"claims",
|
|
4451
4451
|
"drawing_figures"
|
|
4452
|
-
]),
|
|
4452
|
+
]), _i = /* @__PURE__ */ new Set([
|
|
4453
4453
|
"technical_field",
|
|
4454
4454
|
"background_art",
|
|
4455
4455
|
"summary",
|
|
4456
4456
|
"drawing_description",
|
|
4457
4457
|
"detailed_description"
|
|
4458
4458
|
]);
|
|
4459
|
-
function
|
|
4459
|
+
function Ii(e, t) {
|
|
4460
4460
|
const n = q(t), r = [];
|
|
4461
4461
|
return e.state.doc.descendants((a) => {
|
|
4462
4462
|
if (a.type.name === "patent_title") {
|
|
@@ -4478,87 +4478,87 @@ function ki(e, t) {
|
|
|
4478
4478
|
return !0;
|
|
4479
4479
|
}), r;
|
|
4480
4480
|
}
|
|
4481
|
-
function
|
|
4482
|
-
return new
|
|
4483
|
-
children: [new
|
|
4484
|
-
alignment:
|
|
4481
|
+
function Tt(e) {
|
|
4482
|
+
return new He({
|
|
4483
|
+
children: [new qe({ text: e, bold: !0, size: 32, font: "黑体" })],
|
|
4484
|
+
alignment: at.CENTER,
|
|
4485
4485
|
spacing: { before: 400, after: 200 }
|
|
4486
4486
|
});
|
|
4487
4487
|
}
|
|
4488
|
-
function
|
|
4489
|
-
return new
|
|
4490
|
-
children: [new
|
|
4491
|
-
alignment:
|
|
4488
|
+
function St(e) {
|
|
4489
|
+
return new He({
|
|
4490
|
+
children: [new qe({ text: e, bold: !0, size: 28, font: "黑体" })],
|
|
4491
|
+
alignment: at.CENTER,
|
|
4492
4492
|
spacing: { before: 240, after: 120 }
|
|
4493
4493
|
});
|
|
4494
4494
|
}
|
|
4495
|
-
function
|
|
4496
|
-
return new
|
|
4497
|
-
children: [new
|
|
4498
|
-
alignment:
|
|
4495
|
+
function Ni(e) {
|
|
4496
|
+
return new He({
|
|
4497
|
+
children: [new qe({ text: e, bold: !0, size: 36, font: "宋体" })],
|
|
4498
|
+
alignment: at.CENTER,
|
|
4499
4499
|
spacing: { before: 200, after: 200 }
|
|
4500
4500
|
});
|
|
4501
4501
|
}
|
|
4502
|
-
function
|
|
4503
|
-
return new
|
|
4504
|
-
children: [new
|
|
4502
|
+
function Ze(e) {
|
|
4503
|
+
return new He({
|
|
4504
|
+
children: [new qe({ text: e, size: 24, font: "宋体" })],
|
|
4505
4505
|
spacing: { line: 360 },
|
|
4506
|
-
indent: { firstLine:
|
|
4506
|
+
indent: { firstLine: he(7) }
|
|
4507
4507
|
});
|
|
4508
4508
|
}
|
|
4509
|
-
function
|
|
4509
|
+
function Ai(e, t) {
|
|
4510
4510
|
const n = q(t), r = [];
|
|
4511
4511
|
let a = !1;
|
|
4512
4512
|
for (const i of e) {
|
|
4513
|
-
if (
|
|
4514
|
-
r.push(
|
|
4513
|
+
if (ki.has(i.sectionType)) {
|
|
4514
|
+
r.push(Tt(i.title));
|
|
4515
4515
|
for (const o of i.paragraphs)
|
|
4516
|
-
r.push(
|
|
4516
|
+
r.push(Ze(o));
|
|
4517
4517
|
continue;
|
|
4518
4518
|
}
|
|
4519
4519
|
if (i.type === "patent_title") {
|
|
4520
4520
|
if (!a) {
|
|
4521
4521
|
const o = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
|
|
4522
|
-
r.push(
|
|
4522
|
+
r.push(Tt(o)), a = !0;
|
|
4523
4523
|
}
|
|
4524
4524
|
for (const o of i.paragraphs)
|
|
4525
|
-
r.push(
|
|
4525
|
+
r.push(Ni(o));
|
|
4526
4526
|
continue;
|
|
4527
4527
|
}
|
|
4528
|
-
if (
|
|
4529
|
-
r.push(
|
|
4528
|
+
if (_i.has(i.sectionType)) {
|
|
4529
|
+
r.push(St(i.title));
|
|
4530
4530
|
for (const o of i.paragraphs)
|
|
4531
|
-
r.push(
|
|
4531
|
+
r.push(Ze(o));
|
|
4532
4532
|
continue;
|
|
4533
4533
|
}
|
|
4534
|
-
r.push(
|
|
4534
|
+
r.push(St(i.title));
|
|
4535
4535
|
for (const o of i.paragraphs)
|
|
4536
|
-
r.push(
|
|
4536
|
+
r.push(Ze(o));
|
|
4537
4537
|
}
|
|
4538
4538
|
return r;
|
|
4539
4539
|
}
|
|
4540
|
-
async function
|
|
4541
|
-
const n =
|
|
4540
|
+
async function Zs(e, t) {
|
|
4541
|
+
const n = Ii(e, t), r = Ai(n, t), a = n.find((l) => l.type === "patent_title"), i = a != null && a.paragraphs[0] ? `${a.paragraphs[0]}.docx` : "patent-document.docx", o = {
|
|
4542
4542
|
properties: {
|
|
4543
4543
|
page: {
|
|
4544
4544
|
margin: {
|
|
4545
|
-
top:
|
|
4546
|
-
bottom:
|
|
4547
|
-
left:
|
|
4548
|
-
right:
|
|
4545
|
+
top: he(25),
|
|
4546
|
+
bottom: he(25),
|
|
4547
|
+
left: he(25),
|
|
4548
|
+
right: he(20)
|
|
4549
4549
|
}
|
|
4550
4550
|
}
|
|
4551
4551
|
},
|
|
4552
4552
|
children: r
|
|
4553
|
-
}, c = new
|
|
4553
|
+
}, c = new Xr({
|
|
4554
4554
|
sections: [o]
|
|
4555
|
-
}), s = await
|
|
4556
|
-
|
|
4555
|
+
}), s = await Yr.toBlob(c);
|
|
4556
|
+
Zr(s, i);
|
|
4557
4557
|
}
|
|
4558
|
-
async function
|
|
4558
|
+
async function Qs(e) {
|
|
4559
4559
|
window.print();
|
|
4560
4560
|
}
|
|
4561
|
-
function
|
|
4561
|
+
function eo(e, t) {
|
|
4562
4562
|
const n = [], r = t === "zh";
|
|
4563
4563
|
let a = 0;
|
|
4564
4564
|
const i = () => `v_${++a}`;
|
|
@@ -4629,25 +4629,25 @@ function Zs(e, t) {
|
|
|
4629
4629
|
return !0;
|
|
4630
4630
|
}), n;
|
|
4631
4631
|
}
|
|
4632
|
-
const
|
|
4633
|
-
function
|
|
4632
|
+
const Li = /^(\d+)\s*[.、]\s*/, Et = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g, kt = /claims?\s+(\d+)(?:\s*[-~to]+\s*(\d+))?/gi;
|
|
4633
|
+
function Pi(e, t) {
|
|
4634
4634
|
const n = [];
|
|
4635
4635
|
let r;
|
|
4636
|
-
for (
|
|
4636
|
+
for (Et.lastIndex = 0; (r = Et.exec(e)) !== null; ) {
|
|
4637
4637
|
const a = parseInt(r[1], 10), i = r[2] ? parseInt(r[2], 10) : a;
|
|
4638
4638
|
for (let o = a; o <= i; o++)
|
|
4639
4639
|
o !== t && o > 0 && n.push(o);
|
|
4640
4640
|
}
|
|
4641
|
-
for (
|
|
4641
|
+
for (kt.lastIndex = 0; (r = kt.exec(e)) !== null; ) {
|
|
4642
4642
|
const a = parseInt(r[1], 10), i = r[2] ? parseInt(r[2], 10) : a;
|
|
4643
4643
|
for (let o = a; o <= i; o++)
|
|
4644
4644
|
o !== t && o > 0 && n.push(o);
|
|
4645
4645
|
}
|
|
4646
4646
|
return [...new Set(n)].sort((a, i) => a - i);
|
|
4647
4647
|
}
|
|
4648
|
-
const
|
|
4648
|
+
const mn = (e) => {
|
|
4649
4649
|
if (e.type.name === "reference")
|
|
4650
|
-
return
|
|
4650
|
+
return Di(e);
|
|
4651
4651
|
if (e.type.name === "hardBreak")
|
|
4652
4652
|
return `
|
|
4653
4653
|
`;
|
|
@@ -4655,9 +4655,9 @@ const dn = (e) => {
|
|
|
4655
4655
|
return e.text || "";
|
|
4656
4656
|
let t = "";
|
|
4657
4657
|
return e.forEach((n) => {
|
|
4658
|
-
t +=
|
|
4658
|
+
t += mn(n);
|
|
4659
4659
|
}), t;
|
|
4660
|
-
},
|
|
4660
|
+
}, Di = (e) => {
|
|
4661
4661
|
const t = e.attrs.lang === "en" ? "en" : "zh", n = e.attrs.targetType === "figure" ? "figure" : "claim", r = typeof e.attrs.displayText == "string" ? e.attrs.displayText.trim() : "";
|
|
4662
4662
|
if (r)
|
|
4663
4663
|
return r;
|
|
@@ -4667,17 +4667,17 @@ const dn = (e) => {
|
|
|
4667
4667
|
}
|
|
4668
4668
|
const a = Number(e.attrs.resolvedNumber);
|
|
4669
4669
|
return Number.isFinite(a) ? t === "en" ? `Claim ${a}` : `权利要求${a}` : t === "en" ? "Claim ?" : "权利要求?";
|
|
4670
|
-
},
|
|
4670
|
+
}, to = (e) => {
|
|
4671
4671
|
const t = [];
|
|
4672
4672
|
return e.state.doc.descendants((n, r) => {
|
|
4673
4673
|
if (n.type.name === "patent_section")
|
|
4674
4674
|
return n.attrs.sectionType === "claims";
|
|
4675
4675
|
if (n.type.name !== "paragraph") return !0;
|
|
4676
|
-
const a =
|
|
4676
|
+
const a = mn(n).trim(), i = Li.exec(a);
|
|
4677
4677
|
if (!i) return !0;
|
|
4678
4678
|
const o = parseInt(i[1], 10);
|
|
4679
4679
|
if (!Number.isFinite(o) || o <= 0) return !0;
|
|
4680
|
-
const c = a.slice(i[0].length).trim(), s =
|
|
4680
|
+
const c = a.slice(i[0].length).trim(), s = Pi(c, o);
|
|
4681
4681
|
return t.push({
|
|
4682
4682
|
claimId: `claim_${o}`,
|
|
4683
4683
|
number: o,
|
|
@@ -4689,40 +4689,40 @@ const dn = (e) => {
|
|
|
4689
4689
|
}), t;
|
|
4690
4690
|
};
|
|
4691
4691
|
export {
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4692
|
+
gi as EditorView,
|
|
4693
|
+
Wt as PatchDiffPluginKey,
|
|
4694
|
+
hi as PatentEditor,
|
|
4695
|
+
Hs as acceptAllPatches,
|
|
4696
|
+
Os as acceptPatch,
|
|
4697
|
+
Xs as applyDocDiffDecorations,
|
|
4698
|
+
Ws as buildAIContext,
|
|
4699
|
+
Ks as buildClaimsJSONContent,
|
|
4700
|
+
en as buildPatentDocument,
|
|
4701
|
+
zs as clearPatches,
|
|
4702
|
+
pi as createChatSessionAPI,
|
|
4703
|
+
ot as createCommandExecutor,
|
|
4704
|
+
Xa as createEditorConfig,
|
|
4705
|
+
Vs as createMockAIService,
|
|
4706
|
+
Js as createMockChatSessionAPI,
|
|
4707
|
+
fi as createSSEAdapter,
|
|
4708
|
+
Qs as exportToPdf,
|
|
4709
|
+
Zs as exportToWord,
|
|
4710
|
+
to as extractClaimsFromEditor,
|
|
4711
|
+
sn as findSectionAtCursor,
|
|
4712
|
+
ti as getAllSections,
|
|
4713
|
+
Us as getMissingSectionDeps,
|
|
4714
|
+
Fs as getPatches,
|
|
4715
|
+
Ms as onPatchChange,
|
|
4716
4716
|
B as pluginManager,
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4717
|
+
qs as rejectAllPatches,
|
|
4718
|
+
Bs as rejectPatch,
|
|
4719
|
+
Ys as removeDocDiffDecorations,
|
|
4720
|
+
Rs as resolvePatchTarget,
|
|
4721
|
+
an as sectionContextDeps,
|
|
4722
|
+
$s as setPatches,
|
|
4723
4723
|
I as useEditorStore,
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4724
|
+
eo as validatePatentDocument,
|
|
4725
|
+
js as writeStream,
|
|
4726
|
+
Gs as writeStreamFromSSE
|
|
4727
4727
|
};
|
|
4728
4728
|
//# sourceMappingURL=lib.js.map
|